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

This processing module adds a new field from a string definition. More...

#include <ProcessRemoveField.h>

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

Public Member Functions

 ProcessRemoveField (FieldSharedPtr f)
 
 ~ProcessRemoveField () override
 
- Public Member Functions inherited from Nektar::FieldUtils::ProcessModule
 ProcessModule ()
 
 ProcessModule (FieldSharedPtr p_f)
 
- 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 className
 

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

This processing module adds a new field from a string definition.

Definition at line 46 of file ProcessRemoveField.h.

Constructor & Destructor Documentation

◆ ProcessRemoveField()

Nektar::FieldUtils::ProcessRemoveField::ProcessRemoveField ( FieldSharedPtr  f)

Definition at line 51 of file ProcessRemoveField.cpp.

51 : ProcessModule(f)
52{
53 m_config["fieldname"] =
54 ConfigOption(false, "NotSet", "Name for field to be removed, required");
55}
std::map< std::string, ConfigOption > m_config
List of configuration values.
Definition: Module.h:272

References Nektar::FieldUtils::Module::m_config.

◆ ~ProcessRemoveField()

Nektar::FieldUtils::ProcessRemoveField::~ProcessRemoveField ( void  )
override

Definition at line 57 of file ProcessRemoveField.cpp.

58{
59}

Member Function Documentation

◆ create()

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

Creates an instance of this class.

Definition at line 50 of file ProcessRemoveField.h.

51 {
53 }
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::ProcessRemoveField::v_GetModuleDescription ( )
inlineoverrideprotectedvirtual

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 67 of file ProcessRemoveField.h.

68 {
69 return "Removes specific fields from .fld";
70 }

◆ v_GetModuleName()

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

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 62 of file ProcessRemoveField.h.

63 {
64 return "ProcessRemoveField";
65 }

◆ v_GetModulePriority()

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

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 72 of file ProcessRemoveField.h.

73 {
74 return eModifyExp;
75 }

References Nektar::FieldUtils::eModifyExp.

◆ v_Process()

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

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 61 of file ProcessRemoveField.cpp.

62{
63 // Obtain field names to be removed
64 string fieldNames = m_config["fieldname"].as<string>();
65 vector<string> fieldName;
66 ASSERTL0(fieldNames != "NotSet", "A fieldname is required");
67
68 ASSERTL0(ParseUtils::GenerateVector(fieldNames, fieldName),
69 "Failed to interpret fields string");
70 m_f->SetUpExp(vm);
71
72 // Remove fields specified
73 for (int i = 0; i < fieldName.size(); ++i)
74 {
75 // check if field exists
76 auto it = std::find(m_f->m_variables.begin(), m_f->m_variables.end(),
77 fieldName[i]);
78 ASSERTL0(it != m_f->m_variables.end(), "Field does not exist");
79
80 int fieldID = std::distance(m_f->m_variables.begin(), it);
81
82 m_f->m_variables.erase(it);
83 m_f->m_exp.erase(m_f->m_exp.begin() + fieldID);
84
85 if (m_f->m_comm->GetSpaceComm()->TreatAsRankZero())
86 {
87 cout << "Field " << fieldName[i] << " has been erased" << endl;
88 }
89 }
90}
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
FieldSharedPtr m_f
Field object.
Definition: Module.h:239
static bool GenerateVector(const std::string &str, std::vector< T > &out)
Takes a comma-separated string and converts it to entries in a vector.
Definition: ParseUtils.cpp:130
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
Definition: StdRegions.hpp:475

References ASSERTL0, Nektar::StdRegions::find(), Nektar::ParseUtils::GenerateVector(), Nektar::FieldUtils::Module::m_config, and Nektar::FieldUtils::Module::m_f.

Member Data Documentation

◆ className

ModuleKey Nektar::FieldUtils::ProcessRemoveField::className
static
Initial value:
=
"Remove one of the existing fields")
static std::shared_ptr< Module > create(FieldSharedPtr f)
Creates an instance of this class.
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

Definition at line 54 of file ProcessRemoveField.h.