39 #include <boost/core/ignore_unused.hpp>
50 ModuleKey ProcessHomogeneousPlane::className =
53 ProcessHomogeneousPlane::create,
54 "Extracts a plane from a 3DH1D expansion, requires planeid to be "
62 ConfigOption(
true,
"0",
"Extract plane in Fourier space");
74 "ProcessHomogeneousPlane only works for Homogeneous1D.");
76 m_f->m_numHomogeneousDir = 0;
79 if (
m_f->m_exp[0]->GetNumElmts() == 0)
85 "Missing parameter planeid for ProcessHomogeneousPlane");
87 int planeid =
m_config[
"planeid"].as<
int>();
88 int nfields =
m_f->m_variables.size();
91 m_f->m_session->LoadParameter(
"Strip_Z", nstrips, 1);
95 for (
int i = 0; i <
m_f->m_exp[0]->GetZIDs().size(); ++i)
97 if (
m_f->m_exp[0]->GetZIDs()[i] == planeid)
105 for (
int s = 0; s < nstrips; ++s)
107 for (
int i = 0; i < nfields; ++i)
109 int n = s * nfields + i;
110 m_f->m_exp[n] =
m_f->m_exp[n]->GetPlane(plane);
112 if (
m_config[
"wavespace"].as<bool>())
114 m_f->m_exp[n]->BwdTrans(
m_f->m_exp[n]->GetCoeffs(),
115 m_f->m_exp[n]->UpdatePhys());
119 m_f->m_exp[n]->FwdTrans_IterPerExp(
m_f->m_exp[n]->GetPhys(),
120 m_f->m_exp[n]->UpdateCoeffs());
132 std::vector<std::string> files;
133 for (
int i = 0; i <
m_f->m_inputfiles[
"xml"].size(); ++i)
135 files.push_back(
m_f->m_inputfiles[
"xml"][i]);
137 for (
int j = 0; j <
m_f->m_inputfiles[
"xml.gz"].size(); ++j)
139 files.push_back(
m_f->m_inputfiles[
"xml.gz"][j]);
141 vector<string> cmdArgs;
142 cmdArgs.push_back(
"FieldConvert");
145 cmdArgs.push_back(
"--verbose");
147 int argc = cmdArgs.size();
148 const char **argv =
new const char *[argc];
149 for (
int i = 0; i < argc; ++i)
151 argv[i] = cmdArgs[i].c_str();
154 argc, (
char **)argv, files,
m_f->m_comm->GetRowComm());
155 m_f->m_session->InitSession();
160 for (
int s = 0; s < nstrips; ++s)
162 for (
int i = 0; i < nfields; ++i)
164 int n = s * nfields + i;
#define ASSERTL0(condition, msg)
FieldSharedPtr m_f
Field object.
std::map< std::string, ConfigOption > m_config
List of configuration values.
virtual void Process(po::variables_map &vm)
Write mesh to output file.
virtual ~ProcessHomogeneousPlane()
Abstract base class for processing modules.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
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.
std::shared_ptr< Field > FieldSharedPtr
std::pair< ModuleType, std::string > ModuleKey
ModuleFactory & GetModuleFactory()
The above copyright notice and this permission notice shall be included.
Represents a command-line configuration option.