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

This processing module determine the number of modes 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)
 
 ~ProcessNumModes () 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 determine the number of modes and adds it as an extra-field to the output file.

Definition at line 46 of file ProcessNumModes.h.

Constructor & Destructor Documentation

◆ ProcessNumModes()

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

Definition at line 52 of file ProcessNumModes.cpp.

◆ ~ProcessNumModes()

Nektar::FieldUtils::ProcessNumModes::~ProcessNumModes ( )
override

Definition at line 56 of file ProcessNumModes.cpp.

57{
58}

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 50 of file ProcessNumModes.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::ProcessNumModes::v_GetModuleDescription ( )
inlineoverrideprotectedvirtual

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 68 of file ProcessNumModes.h.

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

◆ v_GetModuleName()

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

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 63 of file ProcessNumModes.h.

64 {
65 return "ProcessNumModes";
66 }

◆ v_GetModulePriority()

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

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 73 of file ProcessNumModes.h.

74 {
75 return eModifyExp;
76 }

References Nektar::FieldUtils::eModifyExp.

◆ v_Process()

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

Write mesh to output file.

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 60 of file ProcessNumModes.cpp.

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

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:197
std::pair< ModuleType, std::string > ModuleKey
Definition: Module.h:180
ModuleFactory & GetModuleFactory()
Definition: Module.cpp:47

Definition at line 54 of file ProcessNumModes.h.