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

#include <InputFld.h>

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

Public Member Functions

 InputFld (FieldSharedPtr f)
 Set up InputFld object. More...
 
 ~InputFld () override
 
- Public Member Functions inherited from Nektar::FieldUtils::InputModule
 InputModule (FieldSharedPtr p_m)
 
void PrintSummary ()
 Print a brief summary of information. 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 ModuleSharedPtr create (FieldSharedPtr f)
 Creates an instance of this class. More...
 
- Static Public Member Functions inherited from Nektar::FieldUtils::InputModule
static FIELD_UTILS_EXPORT std::string GuessFormat (std::string fileName)
 Tries to guess the format of the input file. More...
 

Static Public Attributes

static ModuleKey m_className []
 ModuleKey for class. More...
 

Protected Member Functions

void v_Process (po::variables_map &vm) override
 
std::string v_GetModuleName () override
 
std::string v_GetModuleDescription () override
 
ModulePriority v_GetModulePriority () override
 
- 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::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 for Fld files.

Definition at line 46 of file InputFld.h.

Constructor & Destructor Documentation

◆ InputFld()

Nektar::FieldUtils::InputFld::InputFld ( FieldSharedPtr  f)

Set up InputFld object.

Definition at line 62 of file InputFld.cpp.

62 : InputModule(f)
63{
64 m_allowedFiles.insert("fld");
65 m_allowedFiles.insert("chk");
66 m_allowedFiles.insert("rst");
67 m_allowedFiles.insert("bse");
68}
InputModule(FieldSharedPtr p_m)
Definition: Module.cpp:61
std::set< std::string > m_allowedFiles
List of allowed file formats.
Definition: Module.h:274

References Nektar::FieldUtils::Module::m_allowedFiles.

◆ ~InputFld()

Nektar::FieldUtils::InputFld::~InputFld ( )
override

Definition at line 73 of file InputFld.cpp.

74{
75}

Member Function Documentation

◆ create()

static ModuleSharedPtr Nektar::FieldUtils::InputFld::create ( FieldSharedPtr  f)
inlinestatic

Creates an instance of this class.

Definition at line 53 of file InputFld.h.

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

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

◆ v_GetModuleDescription()

std::string Nektar::FieldUtils::InputFld::v_GetModuleDescription ( )
inlineoverrideprotectedvirtual

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 68 of file InputFld.h.

69 {
70 return "Processing input fld file";
71 }

◆ v_GetModuleName()

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

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 63 of file InputFld.h.

64 {
65 return "InputFld";
66 }

◆ v_GetModulePriority()

ModulePriority Nektar::FieldUtils::InputFld::v_GetModulePriority ( )
inlineoverrideprotectedvirtual

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 73 of file InputFld.h.

74 {
75 return eCreateFieldData;
76 }

References Nektar::FieldUtils::eCreateFieldData.

◆ v_Process()

void Nektar::FieldUtils::InputFld::v_Process ( po::variables_map &  vm)
overrideprotectedvirtual

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 80 of file InputFld.cpp.

81{
82 int i;
83 string fileName = m_config["infile"].as<string>();
84
85 LibUtilities::FieldIOSharedPtr fld = m_f->FieldIOForFile(fileName);
86
87 int oldSize = m_f->m_fielddef.size();
88 if (m_f->m_graph)
89 {
90 // Determine IDs of elements in the domain
91 vector<int> IDs;
92 auto domain = m_f->m_graph->GetDomain();
93 for (int d = 0; d < domain.size(); ++d)
94 {
95 for (auto &compIter : domain[d])
96 {
97 for (auto &x : compIter.second->m_geomVec)
98 {
99 IDs.push_back(x->GetGlobalID());
100 }
101 }
102 }
103
104 if (!IDs.size())
105 {
106 return;
107 }
108
109 // Move to an array to match FieldIO interface
110 Array<OneD, int> ElementGIDs(IDs.size(), IDs.data());
111
112 fld->Import(fileName, m_f->m_fielddef, m_f->m_data,
113 m_f->m_fieldMetaDataMap, ElementGIDs);
114 }
115 else // load all data.
116 {
117 fld->Import(fileName, m_f->m_fielddef, m_f->m_data,
118 m_f->m_fieldMetaDataMap);
119 }
120
121 // save field names
122 for (i = 0; i < m_f->m_fielddef[oldSize]->m_fields.size(); ++i)
123 {
124 // check for multiple fld files
125 auto it = find(m_f->m_variables.begin(), m_f->m_variables.end(),
126 m_f->m_fielddef[oldSize]->m_fields[i]);
127
128 if (it == m_f->m_variables.end())
129 {
130 m_f->m_variables.push_back(m_f->m_fielddef[oldSize]->m_fields[i]);
131 }
132 }
133}
FieldSharedPtr m_f
Field object.
Definition: Module.h:239
std::map< std::string, ConfigOption > m_config
List of configuration values.
Definition: Module.h:272
std::shared_ptr< FieldIO > FieldIOSharedPtr
Definition: FieldIO.h:322
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
Definition: StdRegions.hpp:475
std::vector< double > d(NPUPPER *NPUPPER)

References Nektar::UnitTests::d(), Nektar::StdRegions::find(), Nektar::FieldUtils::Module::m_config, and Nektar::FieldUtils::Module::m_f.

Member Data Documentation

◆ m_className

ModuleKey Nektar::FieldUtils::InputFld::m_className
static
Initial value:
= {
ModuleKey(eInputModule, "fld"), InputFld::create, "Reads Fld file."),
"Reads checkpoint file."),
"Reads restart file."),
"Reads stability base-flow file.")}
static ModuleSharedPtr create(FieldSharedPtr f)
Creates an instance of this class.
Definition: InputFld.h:53
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
std::pair< ModuleType, std::string > ModuleKey
Definition: Module.h:180
ModuleFactory & GetModuleFactory()
Definition: Module.cpp:47

ModuleKey for class.

Definition at line 58 of file InputFld.h.