Nektar++
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
Nektar::FieldUtils::OutputPts Class Reference

Converter from fld to pts. More...

#include <OutputPts.h>

Inheritance diagram for Nektar::FieldUtils::OutputPts:
[legend]

Public Member Functions

 OutputPts (FieldSharedPtr f)
 
virtual ~OutputPts ()
 
virtual std::string GetModuleName ()
 
- Public Member Functions inherited from Nektar::FieldUtils::OutputFileBase
 OutputFileBase (FieldSharedPtr f)
 
virtual ~OutputFileBase ()
 
virtual void Process (po::variables_map &vm)
 Write fld to output file. More...
 
virtual std::string GetModuleDescription ()
 
virtual ModulePriority GetModulePriority ()
 
- Public Member Functions inherited from Nektar::FieldUtils::OutputModule
 OutputModule (FieldSharedPtr p_f)
 
FIELD_UTILS_EXPORT void OpenStream ()
 Open a file for output. More...
 
- Public Member Functions inherited from Nektar::FieldUtils::Module
FIELD_UTILS_EXPORT Module (FieldSharedPtr p_f)
 
FIELD_UTILS_EXPORT void RegisterConfig (std::string key, std::string value="")
 Register a configuration option with a module. More...
 
FIELD_UTILS_EXPORT void PrintConfig ()
 Print out all configuration options for a module. More...
 
FIELD_UTILS_EXPORT void SetDefaults ()
 Sets default configuration options for those which have not been set. More...
 
FIELD_UTILS_EXPORT void EvaluateTriFieldAtEquiSpacedPts (LocalRegions::ExpansionSharedPtr &exp, const Array< OneD, const NekDouble > &infield, Array< OneD, NekDouble > &outfield)
 

Static Public Member Functions

static std::shared_ptr< Modulecreate (FieldSharedPtr f)
 Creates an instance of this class. More...
 

Static Public Attributes

static ModuleKey m_className []
 

Protected Member Functions

virtual void OutputFromPts (po::variables_map &vm)
 Write from pts to output file. More...
 
virtual void OutputFromExp (po::variables_map &vm)
 Write from m_exp to output file. More...
 
virtual void OutputFromData (po::variables_map &vm)
 Write from data to output file. More...
 
virtual fs::path GetPath (std::string &filename, po::variables_map &vm)
 
virtual fs::path GetFullOutName (std::string &filename, po::variables_map &vm)
 
- Protected Member Functions inherited from Nektar::FieldUtils::Module
 Module ()
 

Additional Inherited Members

- Protected Attributes inherited from Nektar::FieldUtils::OutputFileBase
bool m_requireEquiSpaced
 
- Protected Attributes inherited from Nektar::FieldUtils::OutputModule
std::ofstream m_fldFile
 Output stream. More...
 
- Protected Attributes inherited from Nektar::FieldUtils::Module
FieldSharedPtr m_f
 Field object. More...
 
std::map< std::string, ConfigOptionm_config
 List of configuration values. More...
 

Detailed Description

Converter from fld to pts.

Definition at line 47 of file OutputPts.h.

Constructor & Destructor Documentation

◆ OutputPts()

Nektar::FieldUtils::OutputPts::OutputPts ( FieldSharedPtr  f)

Definition at line 61 of file OutputPts.cpp.

61  : OutputFileBase(f)
62 {
63 }

◆ ~OutputPts()

Nektar::FieldUtils::OutputPts::~OutputPts ( )
virtual

Definition at line 65 of file OutputPts.cpp.

66 {
67 }

Member Function Documentation

◆ create()

static std::shared_ptr<Module> Nektar::FieldUtils::OutputPts::create ( FieldSharedPtr  f)
inlinestatic

Creates an instance of this class.

Definition at line 51 of file OutputPts.h.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr().

52  {
54  }
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.

◆ GetFullOutName()

fs::path Nektar::FieldUtils::OutputPts::GetFullOutName ( std::string &  filename,
po::variables_map &  vm 
)
protectedvirtual

Implements Nektar::FieldUtils::OutputFileBase.

Definition at line 143 of file OutputPts.cpp.

Referenced by GetModuleName().

145 {
146  boost::ignore_unused(vm);
147  return fs::path(filename);
148 }

◆ GetModuleName()

virtual std::string Nektar::FieldUtils::OutputPts::GetModuleName ( )
inlinevirtual

Reimplemented from Nektar::FieldUtils::OutputFileBase.

Definition at line 60 of file OutputPts.h.

References GetFullOutName(), GetPath(), OutputFromData(), OutputFromExp(), and OutputFromPts().

61  {
62  return "OutputPts";
63  }

◆ GetPath()

fs::path Nektar::FieldUtils::OutputPts::GetPath ( std::string &  filename,
po::variables_map &  vm 
)
protectedvirtual

Implements Nektar::FieldUtils::OutputFileBase.

Definition at line 136 of file OutputPts.cpp.

Referenced by GetModuleName().

138 {
139  boost::ignore_unused(vm);
140  return fs::path(filename);
141 }

◆ OutputFromData()

void Nektar::FieldUtils::OutputPts::OutputFromData ( po::variables_map &  vm)
protectedvirtual

Write from data to output file.

Implements Nektar::FieldUtils::OutputFileBase.

Definition at line 129 of file OutputPts.cpp.

References Nektar::ErrorUtil::efatal, and NEKERROR.

Referenced by GetModuleName().

130 {
131  boost::ignore_unused(vm);
133  "OutputPts can't write using only FieldData.");
134 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209

◆ OutputFromExp()

void Nektar::FieldUtils::OutputPts::OutputFromExp ( po::variables_map &  vm)
protectedvirtual

Write from m_exp to output file.

Implements Nektar::FieldUtils::OutputFileBase.

Definition at line 88 of file OutputPts.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::FieldUtils::Module::m_f, and OutputFromPts().

Referenced by GetModuleName().

89 {
90  Array<OneD, Array<OneD, NekDouble> > tmp(
91  m_f->m_exp[0]->GetCoordim(0) +
92  m_f->m_variables.size());
93 
94  switch (m_f->m_exp[0]->GetCoordim(0))
95  {
96  case 1:
97  tmp[0] = Array<OneD, NekDouble>(m_f->m_exp[0]->GetTotPoints());
98  m_f->m_exp[0]->GetCoords(tmp[0]);
99  break;
100 
101  case 2:
102  tmp[1] = Array<OneD, NekDouble>(m_f->m_exp[0]->GetTotPoints());
103  tmp[0] = Array<OneD, NekDouble>(m_f->m_exp[0]->GetTotPoints());
104  m_f->m_exp[0]->GetCoords(tmp[0], tmp[1]);
105  break;
106 
107  case 3:
108  tmp[2] = Array<OneD, NekDouble>(m_f->m_exp[0]->GetTotPoints());
109  tmp[1] = Array<OneD, NekDouble>(m_f->m_exp[0]->GetTotPoints());
110  tmp[0] = Array<OneD, NekDouble>(m_f->m_exp[0]->GetTotPoints());
111  m_f->m_exp[0]->GetCoords(tmp[0], tmp[1], tmp[2]);
112  break;
113  }
114 
115  for (int i = 0; i < m_f->m_variables.size(); ++i)
116  {
117  tmp[i + m_f->m_exp[0]->GetCoordim(0)] =
118  m_f->m_exp[i]->GetPhys();
119  }
120  m_f->m_fieldPts =
122  m_f->m_exp[0]->GetCoordim(0),
123  m_f->m_variables,
124  tmp);
125 
126  OutputFromPts(vm);
127 }
virtual void OutputFromPts(po::variables_map &vm)
Write from pts to output file.
Definition: OutputPts.cpp:69
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
FieldSharedPtr m_f
Field object.

◆ OutputFromPts()

void Nektar::FieldUtils::OutputPts::OutputFromPts ( po::variables_map &  vm)
protectedvirtual

Write from pts to output file.

Implements Nektar::FieldUtils::OutputFileBase.

Definition at line 69 of file OutputPts.cpp.

References Nektar::FieldUtils::Module::m_config, Nektar::FieldUtils::Module::m_f, Nektar::LibUtilities::CsvIO::Write(), and Nektar::LibUtilities::PtsIO::Write().

Referenced by GetModuleName(), and OutputFromExp().

70 {
71  boost::ignore_unused(vm);
72 
73  // Extract the output filename and extension
74  string filename = m_config["outfile"].as<string>();
75 
76  if (boost::filesystem::path(filename).extension() == ".csv")
77  {
78  LibUtilities::CsvIO csvIO(m_f->m_comm);
79  csvIO.Write(filename, m_f->m_fieldPts);
80  }
81  else
82  {
83  LibUtilities::PtsIO ptsIO(m_f->m_comm);
84  ptsIO.Write(filename, m_f->m_fieldPts);
85  }
86 }
std::map< std::string, ConfigOption > m_config
List of configuration values.
FieldSharedPtr m_f
Field object.

Member Data Documentation

◆ m_className

ModuleKey Nektar::FieldUtils::OutputPts::m_className
static
Initial value:

Definition at line 55 of file OutputPts.h.