Nektar++
Public Member Functions | Static Public Member Functions | Static Public Attributes | 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 ()
 
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)
 
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 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

- Protected Member Functions inherited from Nektar::FieldUtils::Module
 Module ()
 
- Protected Attributes inherited from Nektar::FieldUtils::Module
FieldSharedPtr m_f
 Field object. More...
 
std::map< std::string, ConfigOptionm_config
 List of configuration values. 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.

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

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.

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

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

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

◆ GetModuleDescription()

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

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 70 of file ProcessHomogeneousStretch.h.

71  {
72  return "Stretching expansion";
73  }

◆ GetModuleName()

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

Implements Nektar::FieldUtils::Module.

Definition at line 65 of file ProcessHomogeneousStretch.h.

66  {
67  return "ProcessHomogeneousStretch";
68  }

◆ GetModulePriority()

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

◆ Process()

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

Write mesh to output file.

Implements Nektar::FieldUtils::Module.

Definition at line 71 of file ProcessHomogeneousStretch.cpp.

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

72 {
73  boost::ignore_unused(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().num_elements();
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  // Loop planes backwards so we can copy in place
103  for (int p = nplanes - 1; p > 1; --p)
104  {
105  int newP = 2 * factor * (p / 2) + p % 2;
106  if (newP < nplanes)
107  {
108  Vmath::Vcopy(
109  ncoeffs, m_f->m_exp[n]->GetPlane(p)->GetCoeffs(), 1,
110  m_f->m_exp[n]->GetPlane(newP)->UpdateCoeffs(), 1);
111  }
112  Vmath::Zero(ncoeffs, m_f->m_exp[n]->GetPlane(p)->UpdateCoeffs(),
113  1);
114  }
115 
116  m_f->m_exp[n]->BwdTrans(m_f->m_exp[n]->GetCoeffs(),
117  m_f->m_exp[n]->UpdatePhys());
118  m_f->m_exp[n]->SetHomoLen(factor*m_f->m_exp[n]->GetHomoLen());
119  }
120  }
121 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
std::map< std::string, ConfigOption > m_config
List of configuration values.
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:376
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1064
FieldSharedPtr m_f
Field object.

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.")

Definition at line 57 of file ProcessHomogeneousStretch.h.