Nektar++
Public Member Functions | Static Public Member Functions | Static Public Attributes | 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 ()
 
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)
 
virtual ~Module ()=default
 
const ConfigOptionGetConfigOption (const std::string &key) const
 
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
 

Additional Inherited Members

- Public Attributes inherited from Nektar::FieldUtils::Module
FieldSharedPtr m_f
 Field object. More...
 
- Protected Member Functions inherited from Nektar::FieldUtils::Module
 Module ()
 
- 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 57 of file ProcessHomogeneousPlane.cpp.

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

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

◆ ~ProcessHomogeneousPlane()

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

Definition at line 65 of file ProcessHomogeneousPlane.cpp.

66 {
67 }

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

◆ GetModuleDescription()

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

Reimplemented from Nektar::FieldUtils::Module.

Reimplemented in Nektar::FieldUtils::ProcessMeanMode.

Definition at line 70 of file ProcessHomogeneousPlane.h.

71  {
72  return "Extracting plane";
73  }

◆ GetModuleName()

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

Implements Nektar::FieldUtils::Module.

Reimplemented in Nektar::FieldUtils::ProcessMeanMode.

Definition at line 65 of file ProcessHomogeneousPlane.h.

66  {
67  return "ProcessHomogeneousPlane";
68  }

◆ GetModulePriority()

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

Implements Nektar::FieldUtils::Module.

Reimplemented in Nektar::FieldUtils::ProcessMeanMode.

Definition at line 75 of file ProcessHomogeneousPlane.h.

76  {
77  return eModifyExp;
78  }

References Nektar::FieldUtils::eModifyExp.

◆ Process()

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

Write mesh to output file.

Implements Nektar::FieldUtils::Module.

Reimplemented in Nektar::FieldUtils::ProcessMeanMode.

Definition at line 69 of file ProcessHomogeneousPlane.cpp.

70 {
71  m_f->SetUpExp(vm);
72 
73  ASSERTL0(m_f->m_numHomogeneousDir == 1,
74  "ProcessHomogeneousPlane only works for Homogeneous1D.");
75 
76  m_f->m_numHomogeneousDir = 0;
77 
78  // Skip in case of empty partition
79  if (m_f->m_exp[0]->GetNumElmts() == 0)
80  {
81  return;
82  }
83 
84  ASSERTL0(m_config["planeid"].m_beenSet,
85  "Missing parameter planeid for ProcessHomogeneousPlane");
86 
87  int planeid = m_config["planeid"].as<int>();
88  int nfields = m_f->m_variables.size();
89 
90  int nstrips;
91  m_f->m_session->LoadParameter("Strip_Z", nstrips, 1);
92 
93  // Look for correct plane (because of parallel case)
94  int plane = -1;
95  for (int i = 0; i < m_f->m_exp[0]->GetZIDs().size(); ++i)
96  {
97  if (m_f->m_exp[0]->GetZIDs()[i] == planeid)
98  {
99  plane = i;
100  }
101  }
102 
103  if (plane != -1)
104  {
105  for (int s = 0; s < nstrips; ++s)
106  {
107  for (int i = 0; i < nfields; ++i)
108  {
109  int n = s * nfields + i;
110  m_f->m_exp[n] = m_f->m_exp[n]->GetPlane(plane);
111 
112  if (m_config["wavespace"].as<bool>())
113  {
114  m_f->m_exp[n]->BwdTrans(m_f->m_exp[n]->GetCoeffs(),
115  m_f->m_exp[n]->UpdatePhys());
116  }
117  else
118  {
119  m_f->m_exp[n]->FwdTrans_IterPerExp(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:216
FieldSharedPtr m_f
Field object.
Definition: Module.h:230
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::Process().

Member Data Documentation

◆ className

ModuleKey Nektar::FieldUtils::ProcessHomogeneousPlane::className
static
Initial value:
=
ModuleKey(eProcessModule, "homplane"),
"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:200
std::pair< ModuleType, std::string > ModuleKey
Definition: Module.h:290
ModuleFactory & GetModuleFactory()
Definition: Module.cpp:49

Definition at line 57 of file ProcessHomogeneousPlane.h.