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(FieldDef[n],
113 fld->Write(filename, FieldDef, FieldData,
m_f->m_fieldMetaDataMap,
118 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
119 std::vector<LibUtilities::FieldDefinitionsSharedPtr>();
120 std::vector<std::vector<NekDouble>> FieldData =
121 std::vector<std::vector<NekDouble>>();
122 fld->Write(filename, FieldDef, FieldData,
m_f->m_fieldMetaDataMap);
128 boost::ignore_unused(vm);
131 string filename =
m_config[
"outfile"].as<
string>();
137 fld->Write(filename,
m_f->m_fielddef,
m_f->m_data,
m_f->m_fieldMetaDataMap);
142 boost::ignore_unused(vm);
143 return fs::path(filename);
148 boost::ignore_unused(vm);
150 int nprocs =
m_f->m_comm->GetSize();
151 fs::path specPath(filename), fulloutname;
154 fulloutname = specPath;
160 pad %
m_f->m_comm->GetRank() %
"fld";
163 fs::path poutfile(pad.str());
164 fulloutname = specPath / poutfile;
171 std::string iofmt(
"Xml");
174 if (
m_f->m_session->DefinesSolverInfo(
"IOFormat"))
176 iofmt =
m_f->m_session->GetSolverInfo(
"IOFormat");
178 if (
m_f->m_session->DefinesCmdLineArgument(
"io-format"))
181 m_f->m_session->GetCmdLineArgument<std::string>(
"io-format");
186 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.
virtual fs::path GetFullOutName(std::string &filename, po::variables_map &vm)
virtual void OutputFromExp(po::variables_map &vm)
Write from m_exp to output file.
virtual void OutputFromData(po::variables_map &vm)
Write from data to output file.
std::string GetIOFormat()
virtual fs::path GetPath(std::string &filename, po::variables_map &vm)
virtual void OutputFromPts(po::variables_map &vm)
Write from pts to output file.
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.