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)
 
 ~OutputPts () override
 
- Public Member Functions inherited from Nektar::FieldUtils::OutputFileBase
 OutputFileBase (FieldSharedPtr f)
 
 ~OutputFileBase () override
 
- 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)
 
virtual ~Module ()=default
 
void Process (po::variables_map &vm)
 
std::string GetModuleName ()
 
std::string GetModuleDescription ()
 
const ConfigOptionGetConfigOption (const std::string &key) const
 
ModulePriority GetModulePriority ()
 
std::vector< ModuleKeyGetModulePrerequisites ()
 
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 AddFile (std::string fileType, std::string fileName)
 
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

std::string v_GetModuleName () override
 
void v_OutputFromPts (po::variables_map &vm) override
 Write from pts to output file. More...
 
void v_OutputFromExp (po::variables_map &vm) override
 Write from m_exp to output file. More...
 
void v_OutputFromData (po::variables_map &vm) override
 Write from data to output file. More...
 
fs::path v_GetPath (std::string &filename, po::variables_map &vm) override
 
fs::path v_GetFullOutName (std::string &filename, po::variables_map &vm) override
 
- Protected Member Functions inherited from Nektar::FieldUtils::OutputFileBase
void v_Process (po::variables_map &vm) override
 Write fld to output file. More...
 
std::string v_GetModuleName () override
 
std::string v_GetModuleDescription () override
 
ModulePriority v_GetModulePriority () override
 
virtual void v_OutputFromPts (po::variables_map &vm)=0
 Write from pts to output file. More...
 
virtual void v_OutputFromExp (po::variables_map &vm)=0
 Write from m_exp to output file. More...
 
virtual void v_OutputFromData (po::variables_map &vm)=0
 Write from data to output file. More...
 
virtual fs::path v_GetPath (std::string &filename, po::variables_map &vm)
 
fs::path GetPath (std::string &filename, po::variables_map &vm)
 
virtual fs::path v_GetFullOutName (std::string &filename, po::variables_map &vm)
 
fs::path GetFullOutName (std::string &filename, po::variables_map &vm)
 
- Protected Member Functions inherited from Nektar::FieldUtils::Module
 Module ()
 
virtual void v_Process (po::variables_map &vm)
 
virtual std::string v_GetModuleName ()
 
virtual std::string v_GetModuleDescription ()
 
virtual ModulePriority v_GetModulePriority ()
 
virtual std::vector< ModuleKeyv_GetModulePrerequisites ()
 

Additional Inherited Members

- Public Attributes inherited from Nektar::FieldUtils::Module
FieldSharedPtr m_f
 Field object. More...
 
- 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
std::map< std::string, ConfigOptionm_config
 List of configuration values. More...
 
std::set< std::string > m_allowedFiles
 List of allowed file formats. More...
 

Detailed Description

Converter from fld to pts.

Definition at line 45 of file OutputPts.h.

Constructor & Destructor Documentation

◆ OutputPts()

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

Definition at line 58 of file OutputPts.cpp.

59{
60}

◆ ~OutputPts()

Nektar::FieldUtils::OutputPts::~OutputPts ( )
override

Definition at line 62 of file OutputPts.cpp.

63{
64}

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 49 of file OutputPts.h.

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

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

◆ v_GetFullOutName()

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

Reimplemented from Nektar::FieldUtils::OutputFileBase.

Definition at line 130 of file OutputPts.cpp.

132{
133 return fs::path(filename);
134}

◆ v_GetModuleName()

std::string Nektar::FieldUtils::OutputPts::v_GetModuleName ( )
inlineoverrideprotectedvirtual

Reimplemented from Nektar::FieldUtils::OutputFileBase.

Definition at line 59 of file OutputPts.h.

60 {
61 return "OutputPts";
62 }

◆ v_GetPath()

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

Reimplemented from Nektar::FieldUtils::OutputFileBase.

Definition at line 124 of file OutputPts.cpp.

126{
127 return fs::path(filename);
128}

◆ v_OutputFromData()

void Nektar::FieldUtils::OutputPts::v_OutputFromData ( po::variables_map &  vm)
overrideprotectedvirtual

Write from data to output file.

Implements Nektar::FieldUtils::OutputFileBase.

Definition at line 119 of file OutputPts.cpp.

120{
121 NEKERROR(ErrorUtil::efatal, "OutputPts can't write using only FieldData.");
122}
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:202

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

◆ v_OutputFromExp()

void Nektar::FieldUtils::OutputPts::v_OutputFromExp ( po::variables_map &  vm)
overrideprotectedvirtual

Write from m_exp to output file.

Implements Nektar::FieldUtils::OutputFileBase.

Definition at line 83 of file OutputPts.cpp.

84{
85 Array<OneD, Array<OneD, NekDouble>> tmp(m_f->m_exp[0]->GetCoordim(0) +
86 m_f->m_variables.size());
87
88 switch (m_f->m_exp[0]->GetCoordim(0))
89 {
90 case 1:
91 tmp[0] = Array<OneD, NekDouble>(m_f->m_exp[0]->GetTotPoints());
92 m_f->m_exp[0]->GetCoords(tmp[0]);
93 break;
94
95 case 2:
96 tmp[1] = Array<OneD, NekDouble>(m_f->m_exp[0]->GetTotPoints());
97 tmp[0] = Array<OneD, NekDouble>(m_f->m_exp[0]->GetTotPoints());
98 m_f->m_exp[0]->GetCoords(tmp[0], tmp[1]);
99 break;
100
101 case 3:
102 tmp[2] = Array<OneD, NekDouble>(m_f->m_exp[0]->GetTotPoints());
103 tmp[1] = Array<OneD, NekDouble>(m_f->m_exp[0]->GetTotPoints());
104 tmp[0] = Array<OneD, NekDouble>(m_f->m_exp[0]->GetTotPoints());
105 m_f->m_exp[0]->GetCoords(tmp[0], tmp[1], tmp[2]);
106 break;
107 }
108
109 for (int i = 0; i < m_f->m_variables.size(); ++i)
110 {
111 tmp[i + m_f->m_exp[0]->GetCoordim(0)] = m_f->m_exp[i]->GetPhys();
112 }
114 m_f->m_exp[0]->GetCoordim(0), m_f->m_variables, tmp);
115
116 v_OutputFromPts(vm);
117}
FieldSharedPtr m_f
Field object.
Definition: Module.h:239
void v_OutputFromPts(po::variables_map &vm) override
Write from pts to output file.
Definition: OutputPts.cpp:66

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

◆ v_OutputFromPts()

void Nektar::FieldUtils::OutputPts::v_OutputFromPts ( po::variables_map &  vm)
overrideprotectedvirtual

Write from pts to output file.

Implements Nektar::FieldUtils::OutputFileBase.

Definition at line 66 of file OutputPts.cpp.

67{
68 // Extract the output filename and extension
69 string filename = m_config["outfile"].as<string>();
70
71 if (fs::path(filename).extension() == ".csv")
72 {
73 LibUtilities::CsvIO csvIO(m_f->m_comm);
74 csvIO.Write(filename, m_f->m_fieldPts);
75 }
76 else
77 {
78 LibUtilities::PtsIO ptsIO(m_f->m_comm);
79 ptsIO.Write(filename, m_f->m_fieldPts);
80 }
81}
std::map< std::string, ConfigOption > m_config
List of configuration values.
Definition: Module.h:272

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

Referenced by v_OutputFromExp().

Member Data Documentation

◆ m_className

ModuleKey Nektar::FieldUtils::OutputPts::m_className
static
Initial value:
= {
"Writes a pts file."),
"Writes a csv file."),
}
static std::shared_ptr< Module > create(FieldSharedPtr f)
Creates an instance of this class.
Definition: OutputPts.h:49
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:197
std::pair< ModuleType, std::string > ModuleKey
Definition: Module.h:180
ModuleFactory & GetModuleFactory()
Definition: Module.cpp:47

Definition at line 53 of file OutputPts.h.