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

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 49 of file ProcessHomogeneousStretch.h.

Constructor & Destructor Documentation

◆ ProcessHomogeneousStretch()

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

Definition at line 60 of file ProcessHomogeneousStretch.cpp.

61  : ProcessModule(f)
62 {
63  m_config["factor"] =
64  ConfigOption(false, "NotSet", "integer stretch factor");
65 }
std::map< std::string, ConfigOption > m_config
List of configuration values.
Definition: Module.h:263

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

◆ ~ProcessHomogeneousStretch()

Nektar::FieldUtils::ProcessHomogeneousStretch::~ProcessHomogeneousStretch ( )
virtual

Definition at line 67 of file ProcessHomogeneousStretch.cpp.

68 {
69 }

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

54  {
56  }
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::ProcessHomogeneousStretch::v_GetModuleDescription ( )
inlineoverrideprotectedvirtual

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 71 of file ProcessHomogeneousStretch.h.

72  {
73  return "Stretching expansion";
74  }

◆ v_GetModuleName()

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

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 66 of file ProcessHomogeneousStretch.h.

67  {
68  return "ProcessHomogeneousStretch";
69  }

◆ v_GetModulePriority()

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

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 76 of file ProcessHomogeneousStretch.h.

77  {
78  return eModifyExp;
79  }

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 71 of file ProcessHomogeneousStretch.cpp.

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

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

Definition at line 57 of file ProcessHomogeneousStretch.h.