39#include <boost/core/ignore_unused.hpp>
40#include <boost/format.hpp>
54 "Writes a Fld file."),
57 "Writes a Fld file."),
63 ConfigOption(
false,
"Xml",
"Output format of field file");
72 boost::ignore_unused(vm);
78 boost::ignore_unused(vm);
79 ASSERTL0(
m_f->m_variables.size(),
"OutputFld: need input data.")
82 string filename =
m_config[
"outfile"].as<
string>();
90 int nfields =
m_f->m_variables.size();
92 m_f->m_session->LoadParameter(
"Strip_Z", nstrips, 1);
94 if (
m_f->m_exp[0]->GetNumElmts() != 0)
96 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
97 m_f->m_exp[0]->GetFieldDefinitions();
98 std::vector<std::vector<NekDouble>> FieldData(FieldDef.size());
99 for (s = 0; s < nstrips; ++s)
101 for (j = 0; j < nfields; ++j)
103 for (i = 0; i < FieldDef.size() / nstrips; ++i)
105 int n = s * FieldDef.size() / nstrips + i;
107 FieldDef[n]->m_fields.push_back(
m_f->m_variables[j]);
108 m_f->m_exp[s * nfields + j]->AppendFieldData(
109 FieldDef[n], FieldData[n],
110 m_f->m_exp[s * nfields + j]->UpdateCoeffs());
114 fld->Write(filename, FieldDef, FieldData,
m_f->m_fieldMetaDataMap,
119 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
120 std::vector<LibUtilities::FieldDefinitionsSharedPtr>();
121 std::vector<std::vector<NekDouble>> FieldData =
122 std::vector<std::vector<NekDouble>>();
123 fld->Write(filename, FieldDef, FieldData,
m_f->m_fieldMetaDataMap);
129 boost::ignore_unused(vm);
132 string filename =
m_config[
"outfile"].as<
string>();
138 fld->Write(filename,
m_f->m_fielddef,
m_f->m_data,
m_f->m_fieldMetaDataMap);
143 boost::ignore_unused(vm);
144 return fs::path(filename);
148 po::variables_map &vm)
150 boost::ignore_unused(vm);
152 int nprocs =
m_f->m_comm->GetSpaceComm()->GetSize();
153 fs::path specPath(filename), fulloutname;
156 fulloutname = specPath;
162 pad %
m_f->m_comm->GetSpaceComm()->GetRank() %
"fld";
165 fs::path poutfile(pad.str());
166 fulloutname = specPath / poutfile;
173 std::string iofmt(
"Xml");
176 if (
m_f->m_session->DefinesSolverInfo(
"IOFormat"))
178 iofmt =
m_f->m_session->GetSolverInfo(
"IOFormat");
180 if (
m_f->m_session->DefinesCmdLineArgument(
"io-format"))
183 m_f->m_session->GetCmdLineArgument<std::string>(
"io-format");
188 iofmt =
m_config[
"format"].as<
string>();
#define ASSERTL0(condition, msg)
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
FieldSharedPtr m_f
Field object.
std::map< std::string, ConfigOption > m_config
List of configuration values.
Converter from fld to vtk.
static ModuleKey m_className[]
OutputFld(FieldSharedPtr f)
virtual void v_OutputFromData(po::variables_map &vm) override
Write from data to output file.
virtual void v_OutputFromExp(po::variables_map &vm) override
Write from m_exp to output file.
static std::shared_ptr< Module > create(FieldSharedPtr f)
Creates an instance of this class.
virtual fs::path v_GetPath(std::string &filename, po::variables_map &vm) override
std::string GetIOFormat()
virtual void v_OutputFromPts(po::variables_map &vm) override
Write from pts to output file.
virtual fs::path v_GetFullOutName(std::string &filename, po::variables_map &vm) override
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
std::shared_ptr< Field > FieldSharedPtr
std::pair< ModuleType, std::string > ModuleKey
ModuleFactory & GetModuleFactory()
std::shared_ptr< FieldIO > FieldIOSharedPtr
FieldIOFactory & GetFieldIOFactory()
Returns the FieldIO factory.
The above copyright notice and this permission notice shall be included.
Represents a command-line configuration option.