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"))
78 m_f->m_variables, sinmode);
81 for (
int i = 0; i <
m_f->m_data.size(); ++i)
85 m_f->m_fielddef[i]->m_basis[2] ==
87 "This module is only for fourier Half modes");
90 m_f->m_fielddef[i]->m_homogeneousZIDs.resize(2);
91 m_f->m_fielddef[i]->m_homogeneousZIDs[0] = 2;
92 m_f->m_fielddef[i]->m_homogeneousZIDs[1] = 3;
94 int nelemts =
m_f->m_fielddef[i]->m_elementIDs.size();
95 if (
m_f->m_fielddef[i]->m_uniOrder)
97 m_f->m_fielddef[i]->m_numModes[2] = 4;
101 for (
int e = 0; e < nelemts; ++e)
103 m_f->m_fielddef[i]->m_numModes[3 * e + 2] = 4;
111 int ndata =
m_f->m_data[i].size();
112 vector<NekDouble> data =
m_f->m_data[i];
113 m_f->m_data[i].resize(2 * ndata);
114 int offset = 0, count = 0;
115 for (
size_t n = 0; n <
m_f->m_fielddef[i]->m_fields.size(); ++n)
118 m_f->m_fielddef[i]->m_shapeType,
119 m_f->m_fielddef[i]->m_numModes[0],
120 m_f->m_fielddef[i]->m_numModes[1]);
121 for (
int e = 0; e < nelemts; ++e)
123 if (!
m_f->m_fielddef[i]->m_uniOrder)
127 m_f->m_fielddef[i]->m_shapeType,
128 m_f->m_fielddef[i]->m_numModes[3 * e],
129 m_f->m_fielddef[i]->m_numModes[3 * e + 1]);
131 if (sinmode.count(n))
133 for (
int l = 0; l < datalen; ++l)
135 m_f->m_data[i][count++] = 0.;
137 for (
int l = 0; l < datalen; ++l)
139 m_f->m_data[i][count++] = -data[offset + l];
144 for (
int l = 0; l < datalen; ++l)
146 m_f->m_data[i][count++] = data[offset + l];
148 for (
int l = 0; l < datalen; ++l)
150 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 v_Process(po::variables_map &vm) override
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 GenerateVariableSet(const std::string &str, const std::vector< std::string > &variables, std::set< int > &out)
Generate a set of variable locations.
std::shared_ptr< Field > FieldSharedPtr
std::pair< ModuleType, std::string > ModuleKey
ModuleFactory & GetModuleFactory()
int GetNumberOfCoefficients(ShapeType shape, std::vector< unsigned int > &modes, int offset=0)
@ 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.