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

This processing module replaces all expansions by a single plane from 3DH1D fields, defined by the parameter planeid. More...

#include <ProcessHomogeneousPlane.h>

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

Public Member Functions

 ProcessHomogeneousPlane (FieldSharedPtr f)
 
virtual ~ProcessHomogeneousPlane ()
 
- 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 replaces all expansions by a single plane from 3DH1D fields, defined by the parameter planeid.

Definition at line 49 of file ProcessHomogeneousPlane.h.

Constructor & Destructor Documentation

◆ ProcessHomogeneousPlane()

Nektar::FieldUtils::ProcessHomogeneousPlane::ProcessHomogeneousPlane ( FieldSharedPtr  f)

Definition at line 56 of file ProcessHomogeneousPlane.cpp.

57  : ProcessModule(f)
58 {
59  m_config["planeid"] = ConfigOption(false, "NotSet", "plane id to extract");
60  m_config["wavespace"] =
61  ConfigOption(true, "0", "Extract plane in Fourier space");
62 }
std::map< std::string, ConfigOption > m_config
List of configuration values.
Definition: Module.h:263

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

◆ ~ProcessHomogeneousPlane()

Nektar::FieldUtils::ProcessHomogeneousPlane::~ProcessHomogeneousPlane ( )
virtual

Definition at line 64 of file ProcessHomogeneousPlane.cpp.

65 {
66 }

Member Function Documentation

◆ create()

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

Creates an instance of this class.

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

Reimplemented from Nektar::FieldUtils::Module.

Reimplemented in Nektar::FieldUtils::ProcessMeanMode.

Definition at line 71 of file ProcessHomogeneousPlane.h.

72  {
73  return "Extracting plane";
74  }

◆ v_GetModuleName()

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

Reimplemented from Nektar::FieldUtils::Module.

Reimplemented in Nektar::FieldUtils::ProcessMeanMode.

Definition at line 66 of file ProcessHomogeneousPlane.h.

67  {
68  return "ProcessHomogeneousPlane";
69  }

◆ v_GetModulePriority()

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

Reimplemented from Nektar::FieldUtils::Module.

Reimplemented in Nektar::FieldUtils::ProcessMeanMode.

Definition at line 76 of file ProcessHomogeneousPlane.h.

77  {
78  return eModifyExp;
79  }

References Nektar::FieldUtils::eModifyExp.

◆ v_Process()

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

Write mesh to output file.

Reimplemented from Nektar::FieldUtils::Module.

Reimplemented in Nektar::FieldUtils::ProcessMeanMode.

Definition at line 68 of file ProcessHomogeneousPlane.cpp.

69 {
70  m_f->SetUpExp(vm);
71 
72  ASSERTL0(m_f->m_numHomogeneousDir == 1,
73  "ProcessHomogeneousPlane only works for Homogeneous1D.");
74 
75  m_f->m_numHomogeneousDir = 0;
76 
77  // Skip in case of empty partition
78  if (m_f->m_exp[0]->GetNumElmts() == 0)
79  {
80  return;
81  }
82 
83  ASSERTL0(m_config["planeid"].m_beenSet,
84  "Missing parameter planeid for ProcessHomogeneousPlane");
85 
86  int planeid = m_config["planeid"].as<int>();
87  int nfields = m_f->m_variables.size();
88 
89  int nstrips;
90  m_f->m_session->LoadParameter("Strip_Z", nstrips, 1);
91 
92  // Look for correct plane (because of parallel case)
93  int plane = -1;
94  for (int i = 0; i < m_f->m_exp[0]->GetZIDs().size(); ++i)
95  {
96  if (m_f->m_exp[0]->GetZIDs()[i] == planeid)
97  {
98  plane = i;
99  }
100  }
101 
102  if (plane != -1)
103  {
104  for (int s = 0; s < nstrips; ++s)
105  {
106  for (int i = 0; i < nfields; ++i)
107  {
108  int n = s * nfields + i;
109  m_f->m_exp[n] = m_f->m_exp[n]->GetPlane(plane);
110 
111  if (m_config["wavespace"].as<bool>())
112  {
113  m_f->m_exp[n]->BwdTrans(m_f->m_exp[n]->GetCoeffs(),
114  m_f->m_exp[n]->UpdatePhys());
115  }
116  else
117  {
118  m_f->m_exp[n]->FwdTransLocalElmt(
119  m_f->m_exp[n]->GetPhys(),
120  m_f->m_exp[n]->UpdateCoeffs());
121  }
122  }
123  }
124 
125  // Create new SessionReader with RowComm. This is done because when
126  // using a module requiring m_f->m_declareExpansionAsContField and
127  // outputting to vtu/dat, a new ContField with equispaced points
128  // is created. Since creating ContFields require communication, we have
129  // to change m_session->m_comm to prevent mpi from hanging
130  // (RowComm will only be used when creating the new expansion,
131  // since in other places we use m_f->m_comm)
132  std::vector<std::string> files;
133  for (int i = 0; i < m_f->m_inputfiles["xml"].size(); ++i)
134  {
135  files.push_back(m_f->m_inputfiles["xml"][i]);
136  }
137  for (int j = 0; j < m_f->m_inputfiles["xml.gz"].size(); ++j)
138  {
139  files.push_back(m_f->m_inputfiles["xml.gz"][j]);
140  }
141  vector<string> cmdArgs;
142  cmdArgs.push_back("FieldConvert");
143  if (m_f->m_verbose)
144  {
145  cmdArgs.push_back("--verbose");
146  }
147  int argc = cmdArgs.size();
148  const char **argv = new const char *[argc];
149  for (int i = 0; i < argc; ++i)
150  {
151  argv[i] = cmdArgs[i].c_str();
152  }
154  argc, (char **)argv, files, m_f->m_comm->GetRowComm());
155  m_f->m_session->InitSession();
156  }
157  else
158  {
159  // Create empty expansion
160  for (int s = 0; s < nstrips; ++s)
161  {
162  for (int i = 0; i < nfields; ++i)
163  {
164  int n = s * nfields + i;
165  m_f->m_exp[n] =
167  }
168  }
169  }
170 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:215
FieldSharedPtr m_f
Field object.
Definition: Module.h:234
static SessionReaderSharedPtr CreateInstance(int argc, char *argv[])
Creates an instance of the SessionReader class.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL0, Nektar::LibUtilities::SessionReader::CreateInstance(), Nektar::FieldUtils::Module::m_config, and Nektar::FieldUtils::Module::m_f.

Referenced by Nektar::FieldUtils::ProcessMeanMode::v_Process().

Member Data Documentation

◆ className

ModuleKey Nektar::FieldUtils::ProcessHomogeneousPlane::className
static
Initial value:
=
"Extracts a plane from a 3DH1D expansion, requires planeid to be "
"defined.")
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 ProcessHomogeneousPlane.h.