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

This processing module stretches the homogeneous direction of a 3DH1D expansion by an integer factor. More...

#include <ProcessHomogeneousStretch.h>

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

Public Member Functions

 ProcessHomogeneousStretch (FieldSharedPtr f)
 
 ~ProcessHomogeneousStretch () 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 stretches the homogeneous direction of a 3DH1D expansion by an integer factor.

Definition at line 47 of file ProcessHomogeneousStretch.h.

Constructor & Destructor Documentation

◆ ProcessHomogeneousStretch()

Nektar::FieldUtils::ProcessHomogeneousStretch::ProcessHomogeneousStretch ( FieldSharedPtr  f)

Definition at line 56 of file ProcessHomogeneousStretch.cpp.

57 : ProcessModule(f)
58{
59 m_config["factor"] =
60 ConfigOption(false, "NotSet", "integer stretch factor");
61}
std::map< std::string, ConfigOption > m_config
List of configuration values.
Definition: Module.h:272

References Nektar::FieldUtils::Module::m_config.

◆ ~ProcessHomogeneousStretch()

Nektar::FieldUtils::ProcessHomogeneousStretch::~ProcessHomogeneousStretch ( )
override

Definition at line 63 of file ProcessHomogeneousStretch.cpp.

64{
65}

Member Function Documentation

◆ create()

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

Creates an instance of this class.

Definition at line 51 of file ProcessHomogeneousStretch.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::ProcessHomogeneousStretch::v_GetModuleDescription ( )
inlineoverrideprotectedvirtual

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 69 of file ProcessHomogeneousStretch.h.

70 {
71 return "Stretching expansion";
72 }

◆ v_GetModuleName()

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

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 64 of file ProcessHomogeneousStretch.h.

65 {
66 return "ProcessHomogeneousStretch";
67 }

◆ v_GetModulePriority()

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

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 74 of file ProcessHomogeneousStretch.h.

75 {
76 return eModifyExp;
77 }

References Nektar::FieldUtils::eModifyExp.

◆ v_Process()

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

Write mesh to output file.

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 67 of file ProcessHomogeneousStretch.cpp.

68{
69 m_f->SetUpExp(vm);
70
71 // Skip in case of empty partition
72 if (m_f->m_exp[0]->GetNumElmts() == 0)
73 {
74 return;
75 }
76
77 ASSERTL0(m_f->m_numHomogeneousDir == 1,
78 "ProcessHomogeneousStretch only works for Homogeneous1D.");
79
80 ASSERTL0(m_config["factor"].m_beenSet,
81 "Missing parameter factor for ProcessHomogeneousStretch");
82
83 int factor = m_config["factor"].as<int>();
84 int nfields = m_f->m_variables.size();
85 int nplanes = m_f->m_exp[0]->GetHomogeneousBasis()->GetZ().size();
86
87 ASSERTL0(factor > 1, "Parameter factor must be an int greater than 1.");
88
89 int nstrips;
90 m_f->m_session->LoadParameter("Strip_Z", nstrips, 1);
91
92 for (int s = 0; s < nstrips; ++s)
93 {
94 for (int i = 0; i < nfields; ++i)
95 {
96 int n = s * nfields + i;
97 int ncoeffs = m_f->m_exp[n]->GetPlane(0)->GetNcoeffs();
98
99 // Loop planes backwards so we can copy in place
100 for (int p = nplanes - 1; p > 1; --p)
101 {
102 int newP = 2 * factor * (p / 2) + p % 2;
103 if (newP < nplanes)
104 {
106 ncoeffs, m_f->m_exp[n]->GetPlane(p)->GetCoeffs(), 1,
107 m_f->m_exp[n]->GetPlane(newP)->UpdateCoeffs(), 1);
108 }
109 Vmath::Zero(ncoeffs, m_f->m_exp[n]->GetPlane(p)->UpdateCoeffs(),
110 1);
111 }
112
113 m_f->m_exp[n]->BwdTrans(m_f->m_exp[n]->GetCoeffs(),
114 m_f->m_exp[n]->UpdatePhys());
115 m_f->m_exp[n]->SetHomoLen(factor * m_f->m_exp[n]->GetHomoLen());
116 }
117 }
118}
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
FieldSharedPtr m_f
Field object.
Definition: Module.h:239
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.hpp:273
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.hpp:825

References ASSERTL0, Nektar::FieldUtils::Module::m_config, Nektar::FieldUtils::Module::m_f, CellMLToNektar.cellml_metadata::p, Vmath::Vcopy(), and Vmath::Zero().

Member Data Documentation

◆ className

ModuleKey Nektar::FieldUtils::ProcessHomogeneousStretch::className
static
Initial value:
=
ModuleKey(eProcessModule, "homstretch"),
"Stretches homogeneous direction of a 3DH1D expansion, requires factor "
"to be "
"defined. The number of modes in the final expansion can be defined "
"using"
" --output-points-hom-z.")
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 ProcessHomogeneousStretch.h.