42 #include <boost/core/ignore_unused.hpp>
51 ModuleKey ProcessHalfModeToFourier::className =
54 ProcessHalfModeToFourier::create,
55 "modify a FourierHalfMode into a Fourier expansion so it can be "
56 "processed as a 3D field.");
63 ConfigOption(
false,
"NotSet",
"Take fields as sin mode");
72 boost::ignore_unused(vm);
75 if (
m_config[
"realmodetoimag"].as<string>().compare(
"NotSet"))
79 m_config[
"realmodetoimag"].as<string>(), value),
80 "Failed to interpret realmodetoimag string");
87 for (
int i = 0; i <
m_f->m_data.size(); ++i)
91 m_f->m_fielddef[i]->m_basis[2] ==
93 "This module is only for fourier Half modes");
96 m_f->m_fielddef[i]->m_homogeneousZIDs.resize(2);
97 m_f->m_fielddef[i]->m_homogeneousZIDs[0] = 2;
98 m_f->m_fielddef[i]->m_homogeneousZIDs[1] = 3;
100 int nelemts =
m_f->m_fielddef[i]->m_elementIDs.size();
101 if (
m_f->m_fielddef[i]->m_uniOrder)
103 m_f->m_fielddef[i]->m_numModes[2] = 4;
107 for (
int e = 0; e < nelemts; ++e)
109 m_f->m_fielddef[i]->m_numModes[3 * e + 2] = 4;
117 int ndata =
m_f->m_data[i].size();
118 vector<NekDouble> data =
m_f->m_data[i];
119 m_f->m_data[i].resize(2 * ndata);
120 int offset = 0, count = 0;
121 for (
size_t n = 0; n <
m_f->m_fielddef[i]->m_fields.size(); ++n)
123 int datalen =
m_f->m_fielddef[i]->m_numModes[0] *
124 m_f->m_fielddef[i]->m_numModes[1];
125 for (
int e = 0; e < nelemts; ++e)
127 if (!
m_f->m_fielddef[i]->m_uniOrder)
130 datalen =
m_f->m_fielddef[i]->m_numModes[3 * e] *
131 m_f->m_fielddef[i]->m_numModes[3 * e + 1];
133 if (sinmode.count(n))
135 for (
int l = 0; l < datalen; ++l)
137 m_f->m_data[i][count++] = 0.;
139 for (
int l = 0; l < datalen; ++l)
141 m_f->m_data[i][count++] = -data[offset + l];
146 for (
int l = 0; l < datalen; ++l)
148 m_f->m_data[i][count++] = data[offset + l];
150 for (
int l = 0; l < datalen; ++l)
152 m_f->m_data[i][count++] = 0.;
#define ASSERTL0(condition, msg)
FieldSharedPtr m_f
Field object.
std::map< std::string, ConfigOption > m_config
List of configuration values.
virtual ~ProcessHalfModeToFourier()
virtual void Process(po::variables_map &vm)
Write mesh to output file.
ModulePriority m_priority
Abstract base class for processing modules.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
static bool GenerateVector(const std::string &str, std::vector< T > &out)
Takes a comma-separated string and converts it to entries in a vector.
std::shared_ptr< Field > FieldSharedPtr
std::pair< ModuleType, std::string > ModuleKey
ModuleFactory & GetModuleFactory()
@ eFourierHalfModeIm
Fourier Modified expansions with just the imaginary part of the first mode .
@ eFourierHalfModeRe
Fourier Modified expansions with just the real part of the first mode .
@ eFourier
Fourier Expansion .
The above copyright notice and this permission notice shall be included.
Represents a command-line configuration option.