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

This processing module adds a fld with the composite ID. More...

#include <ProcessAddCompositeID.h>

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

Public Member Functions

 ProcessAddCompositeID (FieldSharedPtr f)
 
 ~ProcessAddCompositeID () 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
 Write mesh to output file. More...
 
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 fld with the composite ID.

Definition at line 47 of file ProcessAddCompositeID.h.

Constructor & Destructor Documentation

◆ ProcessAddCompositeID()

Nektar::FieldUtils::ProcessAddCompositeID::ProcessAddCompositeID ( FieldSharedPtr  f)

Definition at line 53 of file ProcessAddCompositeID.cpp.

◆ ~ProcessAddCompositeID()

Nektar::FieldUtils::ProcessAddCompositeID::~ProcessAddCompositeID ( )
override

Definition at line 58 of file ProcessAddCompositeID.cpp.

59{
60}

Member Function Documentation

◆ create()

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

Creates an instance of this class.

Definition at line 51 of file ProcessAddCompositeID.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_GetModuleDescription()

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

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 69 of file ProcessAddCompositeID.h.

70 {
71 return "Adding composite ID as a new field";
72 }

◆ v_GetModuleName()

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

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 64 of file ProcessAddCompositeID.h.

65 {
66 return "ProcessAddCompositeID";
67 }

◆ v_GetModulePriority()

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

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 74 of file ProcessAddCompositeID.h.

75 {
76 return eModifyExp;
77 }

References Nektar::FieldUtils::eModifyExp.

◆ v_Process()

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

Write mesh to output file.

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 62 of file ProcessAddCompositeID.cpp.

63{
64 m_f->SetUpExp(vm);
65
66 int nfields = m_f->m_variables.size();
67 m_f->m_variables.push_back("compositeID");
68 // Skip in case of empty partition
69 if (m_f->m_exp[0]->GetNumElmts() == 0)
70 {
71 return;
72 }
73
74 int NumHomogeneousDir = m_f->m_numHomogeneousDir;
76
77 if (nfields)
78 {
79 m_f->m_exp.resize(nfields + 1);
80 exp = m_f->AppendExpList(NumHomogeneousDir);
81
82 m_f->m_exp[nfields] = exp;
83 }
84 else
85 {
86 exp = m_f->m_exp[0];
87 }
88
89 // Get Composites
91 m_f->m_graph->GetComposites();
92
93 int compid = -1;
94
95 // loop over elements
96 for (int n = 0; n < exp->GetNumElmts(); ++n)
97 {
98 LocalRegions::ExpansionSharedPtr elmt = exp->GetExp(n);
99
100 // loop over composite list and search for geometry pointer in list
101 for (auto &it : CompositeMap)
102 {
103 if (find(it.second->m_geomVec.begin(), it.second->m_geomVec.end(),
104 elmt->GetGeom()) != it.second->m_geomVec.end())
105 {
106 compid = it.first;
107 break;
108 }
109 }
110
111 WARNINGL0(compid != -1, "Failed to find composite ID for element: " +
112 boost::lexical_cast<string>(n));
113
114 // Fill element with the value of the index
115 int npts = elmt->GetTotPoints();
116 Array<OneD, NekDouble> tmp;
117 Vmath::Fill(npts, (NekDouble)compid,
118 tmp = exp->UpdatePhys() + exp->GetPhys_Offset(n), 1);
119 }
120
121 // forward transform
122 exp->FwdTransLocalElmt(exp->GetPhys(), exp->UpdateCoeffs());
123}
#define WARNINGL0(condition, msg)
Definition: ErrorUtil.hpp:215
FieldSharedPtr m_f
Field object.
Definition: Module.h:239
std::shared_ptr< Expansion > ExpansionSharedPtr
Definition: Expansion.h:66
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::map< int, CompositeSharedPtr > CompositeMap
Definition: MeshGraph.h:136
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
Definition: StdRegions.hpp:447
double NekDouble
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
Definition: Vmath.hpp:54

References Vmath::Fill(), Nektar::StdRegions::find(), Nektar::FieldUtils::Module::m_f, and WARNINGL0.

Member Data Documentation

◆ className

ModuleKey Nektar::FieldUtils::ProcessAddCompositeID::className
static
Initial value:
=
ModuleKey(eProcessModule, "addcompositeid"),
"Add a field which contains the composite ID of each element")
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.
Definition: NekFactory.hpp:197
std::pair< ModuleType, std::string > ModuleKey
Definition: Module.h:180
ModuleFactory & GetModuleFactory()
Definition: Module.cpp:47

Definition at line 55 of file ProcessAddCompositeID.h.