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)
 
virtual ~ProcessNumModes ()
 
- 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 ()
 
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

virtual void v_Process (po::variables_map &vm) override
 Write mesh to output file. More...
 
virtual std::string v_GetModuleName () override
 
virtual std::string v_GetModuleDescription () override
 
virtual 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 ()
 

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 48 of file ProcessNumModes.h.

Constructor & Destructor Documentation

◆ ProcessNumModes()

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

Definition at line 56 of file ProcessNumModes.cpp.

◆ ~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().

◆ v_GetModuleDescription()

virtual std::string Nektar::FieldUtils::ProcessNumModes::v_GetModuleDescription ( )
inlineoverrideprotectedvirtual

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 70 of file ProcessNumModes.h.

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

◆ v_GetModuleName()

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

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 65 of file ProcessNumModes.h.

66 {
67 return "ProcessNumModes";
68 }

◆ v_GetModulePriority()

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

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 75 of file ProcessNumModes.h.

76 {
77 return eModifyExp;
78 }

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 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
100 int nExp, nq, offset;
101 nExp = m_f->m_exp[0]->GetExpSize();
102
103 for (int n = 0; n < nExp; n++)
104 {
105 offset = m_f->m_exp[0]->GetPhys_Offset(n);
106 nq = m_f->m_exp[0]->GetExp(n)->GetTotPoints();
107
108 for (i = 0; i < expdim; i++)
109 {
110 int P = m_f->m_exp[0]->GetExp(n)->GetBasis(i)->GetNumModes();
111 Array<OneD, NekDouble> result = outfield[i] + offset;
112 Vmath::Fill(nq, 1.0 * P, result, 1);
113 }
114 }
115
116 for (s = 0; s < nstrips; ++s) // homogeneous strip varient
117 {
118 for (i = 0; i < addfields; ++i)
119 {
121 m_f->AppendExpList(m_f->m_numHomogeneousDir);
122 auto it =
123 m_f->m_exp.begin() + s * (nfields + addfields) + nfields + i;
124 m_f->m_exp.insert(it, Exp);
125 }
126 }
127
128 for (s = 0; s < nstrips; ++s)
129 {
130 for (i = 0; i < addfields; ++i)
131 {
132 int fid = s * (nfields + addfields) + nfields + i;
133 Vmath::Vcopy(npoints, outfield[i], 1, m_f->m_exp[fid]->UpdatePhys(),
134 1);
135 m_f->m_exp[fid]->FwdTransLocalElmt(outfield[i],
136 m_f->m_exp[fid]->UpdateCoeffs());
137 }
138 }
139}
FieldSharedPtr m_f
Field object.
Definition: Module.h:234
@ P
Monomial polynomials .
Definition: BasisType.h:64
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:43
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1191

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:317
ModuleFactory & GetModuleFactory()
Definition: Module.cpp:49

Definition at line 56 of file ProcessNumModes.h.