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

This processing module calculates the vorticity and adds it as an extra-field to the output file. More...

#include <ProcessNumModes.h>

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

Public Member Functions

 ProcessNumModes (FieldSharedPtr f)
 
virtual ~ProcessNumModes ()
 
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)
 
virtual ~Module ()=default
 
const ConfigOptionGetConfigOption (const std::string &key) const
 
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
 

Additional Inherited Members

- Public Attributes inherited from Nektar::FieldUtils::Module
FieldSharedPtr m_f
 Field object. More...
 
- Protected Member Functions inherited from Nektar::FieldUtils::Module
 Module ()
 
- 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 calculates the vorticity and adds it as an extra-field to the output file.

Definition at line 48 of file ProcessNumModes.h.

Constructor & Destructor Documentation

◆ ProcessNumModes()

Nektar::FieldUtils::ProcessNumModes::ProcessNumModes ( FieldSharedPtr  f)

Definition at line 56 of file ProcessNumModes.cpp.

56  : ProcessModule(f)
57 {
58 }

◆ ~ProcessNumModes()

Nektar::FieldUtils::ProcessNumModes::~ProcessNumModes ( )
virtual

Definition at line 60 of file ProcessNumModes.cpp.

61 {
62 }

Member Function Documentation

◆ create()

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

Creates an instance of this class.

Definition at line 52 of file ProcessNumModes.h.

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

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

◆ GetModuleDescription()

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

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 69 of file ProcessNumModes.h.

70  {
71  return "Calculating number of modes";
72  }

◆ GetModuleName()

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

Implements Nektar::FieldUtils::Module.

Definition at line 64 of file ProcessNumModes.h.

65  {
66  return "ProcessNumModes";
67  }

◆ GetModulePriority()

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

Implements Nektar::FieldUtils::Module.

Definition at line 74 of file ProcessNumModes.h.

75  {
76  return eModifyExp;
77  }

References Nektar::FieldUtils::eModifyExp.

◆ Process()

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

Write mesh to output file.

Implements Nektar::FieldUtils::Module.

Definition at line 64 of file ProcessNumModes.cpp.

65 {
66  m_f->SetUpExp(vm);
67 
68  int i, s;
69  int expdim = m_f->m_graph->GetMeshDimension();
70  int nfields = m_f->m_variables.size();
71  int addfields = expdim;
72 
73  m_f->m_variables.push_back("P1");
74  if (addfields >= 2)
75  {
76  m_f->m_variables.push_back("P2");
77  }
78  if (addfields == 3)
79  {
80  m_f->m_variables.push_back("P3");
81  }
82 
83  // Skip in case of empty partition
84  if (m_f->m_exp[0]->GetNumElmts() == 0)
85  {
86  return;
87  }
88 
89  int npoints = m_f->m_exp[0]->GetNpoints();
90  Array<OneD, Array<OneD, NekDouble>> outfield(addfields);
91  int nstrips;
92 
93  m_f->m_session->LoadParameter("Strip_Z", nstrips, 1);
94 
95  for (i = 0; i < addfields; ++i)
96  {
97  outfield[i] = Array<OneD, NekDouble>(npoints);
98  }
99 
101 
102  int nExp, nq, offset;
103  nExp = m_f->m_exp[0]->GetExpSize();
104 
105  for (int n = 0; n < nExp; n++)
106  {
107  offset = m_f->m_exp[0]->GetPhys_Offset(n);
108  nq = m_f->m_exp[0]->GetExp(n)->GetTotPoints();
109 
110  for (i = 0; i < expdim; i++)
111  {
112  int P = m_f->m_exp[0]->GetExp(n)->GetBasis(i)->GetNumModes();
113  Array<OneD, NekDouble> result = outfield[i] + offset;
114  Vmath::Fill(nq, 1.0 * P, result, 1);
115  }
116  }
117 
118  for (s = 0; s < nstrips; ++s)
119  {
120  for (i = 0; i < addfields; ++i)
121  {
122  Exp = m_f->AppendExpList(m_f->m_numHomogeneousDir);
123  Vmath::Vcopy(npoints, outfield[i], 1, Exp->UpdatePhys(), 1);
124  Exp->FwdTransLocalElmt(outfield[i], Exp->UpdateCoeffs());
125 
126  auto it =
127  m_f->m_exp.begin() + s * (nfields + addfields) + nfields + i;
128  m_f->m_exp.insert(it, Exp);
129  }
130  }
131 }
FieldSharedPtr m_f
Field object.
Definition: Module.h:225
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
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1255

References Vmath::Fill(), Nektar::FieldUtils::Module::m_f, Nektar::LibUtilities::P, and Vmath::Vcopy().

Member Data Documentation

◆ className

ModuleKey Nektar::FieldUtils::ProcessNumModes::className
static
Initial value:
=
"Computes number of modes in each direction for 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:198
std::pair< ModuleType, std::string > ModuleKey
Definition: Module.h:285
ModuleFactory & GetModuleFactory()
Definition: Module.cpp:49

Definition at line 56 of file ProcessNumModes.h.