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

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

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.

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

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::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

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

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

70 {
71  boost::ignore_unused(vm);
72 
73  ASSERTL0(m_f->m_numHomogeneousDir == 1,
74  "ProcessHomogeneousPlane only works for Homogeneous1D.");
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().num_elements(); ++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]->FwdTrans_IterPerExp(m_f->m_exp[n]->GetPhys(),
119  m_f->m_exp[n]->UpdateCoeffs());
120  }
121  }
122  }
123 
124  // Create new SessionReader with RowComm. This is done because when
125  // using a module requiring m_f->m_declareExpansionAsContField and
126  // outputting to vtu/dat, a new ContField with equispaced points
127  // is created. Since creating ContFields require communication, we have
128  // to change m_session->m_comm to prevent mpi from hanging
129  // (RowComm will only be used when creating the new expansion,
130  // since in other places we use m_f->m_comm)
131  std::vector<std::string> files;
132  for (int i = 0; i < m_f->m_inputfiles["xml"].size(); ++i)
133  {
134  files.push_back(m_f->m_inputfiles["xml"][i]);
135  }
136  for (int j = 0; j < m_f->m_inputfiles["xml.gz"].size(); ++j)
137  {
138  files.push_back(m_f->m_inputfiles["xml.gz"][j]);
139  }
140  vector<string> cmdArgs;
141  cmdArgs.push_back("FieldConvert");
142  if (m_f->m_verbose)
143  {
144  cmdArgs.push_back("--verbose");
145  }
146  int argc = cmdArgs.size();
147  const char **argv = new const char *[argc];
148  for (int i = 0; i < argc; ++i)
149  {
150  argv[i] = cmdArgs[i].c_str();
151  }
153  argc, (char **)argv, files, m_f->m_comm->GetRowComm());
154  m_f->m_session->InitSession();
155  }
156  else
157  {
158  // Create empty expansion
159  for (int s = 0; s < nstrips; ++s)
160  {
161  for (int i = 0; i < nfields; ++i)
162  {
163  int n = s * nfields + i;
164  m_f->m_exp[n] =
166  }
167  }
168  }
169 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
std::map< std::string, ConfigOption > m_config
List of configuration values.
static SessionReaderSharedPtr CreateInstance(int argc, char *argv[])
Creates an instance of the SessionReader class.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
FieldSharedPtr m_f
Field object.

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

Definition at line 57 of file ProcessHomogeneousPlane.h.