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)
 
 ~ProcessHomogeneousPlane () override
 
- 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 ()
 
std::vector< ModuleKeyGetModulePrerequisites ()
 
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

void v_Process (po::variables_map &vm) override
 Write mesh to output file. More...
 
std::string v_GetModuleName () override
 
std::string v_GetModuleDescription () override
 
ModulePriority v_GetModulePriority () override
 
- Protected Member Functions inherited from Nektar::FieldUtils::Module
 Module ()
 
virtual void v_Process (po::variables_map &vm)
 
virtual std::string v_GetModuleName ()
 
virtual std::string v_GetModuleDescription ()
 
virtual ModulePriority v_GetModulePriority ()
 
virtual std::vector< ModuleKeyv_GetModulePrerequisites ()
 

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 47 of file ProcessHomogeneousPlane.h.

Constructor & Destructor Documentation

◆ ProcessHomogeneousPlane()

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

Definition at line 52 of file ProcessHomogeneousPlane.cpp.

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

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

◆ ~ProcessHomogeneousPlane()

Nektar::FieldUtils::ProcessHomogeneousPlane::~ProcessHomogeneousPlane ( )
override

Definition at line 60 of file ProcessHomogeneousPlane.cpp.

61{
62}

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 51 of file ProcessHomogeneousPlane.h.

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

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

◆ v_GetModuleDescription()

std::string Nektar::FieldUtils::ProcessHomogeneousPlane::v_GetModuleDescription ( )
inlineoverrideprotectedvirtual

Reimplemented from Nektar::FieldUtils::Module.

Reimplemented in Nektar::FieldUtils::ProcessMeanMode.

Definition at line 69 of file ProcessHomogeneousPlane.h.

70 {
71 return "Extracting plane";
72 }

◆ v_GetModuleName()

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

Reimplemented from Nektar::FieldUtils::Module.

Reimplemented in Nektar::FieldUtils::ProcessMeanMode.

Definition at line 64 of file ProcessHomogeneousPlane.h.

65 {
66 return "ProcessHomogeneousPlane";
67 }

◆ v_GetModulePriority()

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

Reimplemented from Nektar::FieldUtils::Module.

Reimplemented in Nektar::FieldUtils::ProcessMeanMode.

Definition at line 74 of file ProcessHomogeneousPlane.h.

75 {
76 return eModifyExp;
77 }

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 64 of file ProcessHomogeneousPlane.cpp.

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

Definition at line 55 of file ProcessHomogeneousPlane.h.