Nektar++
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | 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)
 
virtual ~ProcessAddCompositeID ()
 
virtual void Process (po::variables_map &vm)
 Write mesh to output file. More...
 
virtual std::string GetModuleName ()
 
virtual std::string GetModuleDescription ()
 
virtual ModulePriority GetModulePriority ()
 
- 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)
 
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 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
 

Additional Inherited Members

- Protected Member Functions inherited from Nektar::FieldUtils::Module
 Module ()
 
- Protected Attributes inherited from Nektar::FieldUtils::Module
FieldSharedPtr m_f
 Field object. More...
 
std::map< std::string, ConfigOptionm_config
 List of configuration values. More...
 

Detailed Description

This processing module adds a fld with the composite ID.

Definition at line 49 of file ProcessAddCompositeID.h.

Constructor & Destructor Documentation

◆ ProcessAddCompositeID()

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

Definition at line 57 of file ProcessAddCompositeID.cpp.

◆ ~ProcessAddCompositeID()

Nektar::FieldUtils::ProcessAddCompositeID::~ProcessAddCompositeID ( )
virtual

Definition at line 62 of file ProcessAddCompositeID.cpp.

63 {
64 }

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 53 of file ProcessAddCompositeID.h.

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

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

◆ GetModuleDescription()

virtual std::string Nektar::FieldUtils::ProcessAddCompositeID::GetModuleDescription ( )
inlinevirtual

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 70 of file ProcessAddCompositeID.h.

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

◆ GetModuleName()

virtual std::string Nektar::FieldUtils::ProcessAddCompositeID::GetModuleName ( )
inlinevirtual

Implements Nektar::FieldUtils::Module.

Definition at line 65 of file ProcessAddCompositeID.h.

66  {
67  return "ProcessAddCompositeID";
68  }

◆ GetModulePriority()

virtual ModulePriority Nektar::FieldUtils::ProcessAddCompositeID::GetModulePriority ( )
inlinevirtual

Implements Nektar::FieldUtils::Module.

Definition at line 75 of file ProcessAddCompositeID.h.

References Nektar::FieldUtils::eModifyExp.

◆ Process()

void Nektar::FieldUtils::ProcessAddCompositeID::Process ( po::variables_map &  vm)
virtual

Write mesh to output file.

Implements Nektar::FieldUtils::Module.

Definition at line 66 of file ProcessAddCompositeID.cpp.

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

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

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")

Definition at line 57 of file ProcessAddCompositeID.h.