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 ()
 
- Public Member Functions inherited from Nektar::FieldUtils::OutputFileBase
 OutputFileBase (FieldSharedPtr f)
 
virtual ~OutputFileBase ()
 
- 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 ()
 
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

virtual std::string v_GetModuleName () override
 
virtual void v_OutputFromPts (po::variables_map &vm) override
 Write from pts to output file. More...
 
virtual void v_OutputFromExp (po::variables_map &vm) override
 Write from m_exp to output file. More...
 
virtual void v_OutputFromData (po::variables_map &vm) override
 Write from data to output file. More...
 
virtual fs::path v_GetPath (std::string &filename, po::variables_map &vm) override
 
virtual fs::path v_GetFullOutName (std::string &filename, po::variables_map &vm) override
 
- Protected Member Functions inherited from Nektar::FieldUtils::OutputFileBase
virtual void v_Process (po::variables_map &vm) override
 Write fld to output file. More...
 
virtual std::string v_GetModuleName () override
 
virtual std::string v_GetModuleDescription () override
 
virtual 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 ()
 

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

Constructor & Destructor Documentation

◆ OutputPts()

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

Definition at line 62 of file OutputPts.cpp.

63{
64}

◆ ~OutputPts()

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

Definition at line 66 of file OutputPts.cpp.

67{
68}

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.

52 {
54 }
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 137 of file OutputPts.cpp.

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

◆ v_GetModuleName()

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

Reimplemented from Nektar::FieldUtils::OutputFileBase.

Definition at line 61 of file OutputPts.h.

62 {
63 return "OutputPts";
64 }

◆ 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 131 of file OutputPts.cpp.

132{
133 boost::ignore_unused(vm);
134 return fs::path(filename);
135}

◆ 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 125 of file OutputPts.cpp.

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

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 89 of file OutputPts.cpp.

90{
91 Array<OneD, Array<OneD, NekDouble>> tmp(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)] = m_f->m_exp[i]->GetPhys();
118 }
120 m_f->m_exp[0]->GetCoordim(0), m_f->m_variables, tmp);
121
122 v_OutputFromPts(vm);
123}
FieldSharedPtr m_f
Field object.
Definition: Module.h:234
virtual void v_OutputFromPts(po::variables_map &vm) override
Write from pts to output file.
Definition: OutputPts.cpp:70

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 70 of file OutputPts.cpp.

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

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:51
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:198
std::pair< ModuleType, std::string > ModuleKey
Definition: Module.h:317
ModuleFactory & GetModuleFactory()
Definition: Module.cpp:49

Definition at line 55 of file OutputPts.h.