39#include <boost/format.hpp>
51 "Writes a Fld file."),
54 "Writes a Fld file."),
60 ConfigOption(
false,
"Xml",
"Output format of field file");
74 ASSERTL0(
m_f->m_variables.size(),
"OutputFld: need input data.")
77 string filename =
m_config[
"outfile"].as<
string>();
85 int nfields =
m_f->m_variables.size();
87 m_f->m_session->LoadParameter(
"Strip_Z", nstrips, 1);
89 if (
m_f->m_exp[0]->GetNumElmts() != 0)
91 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
92 m_f->m_exp[0]->GetFieldDefinitions();
93 std::vector<std::vector<NekDouble>> FieldData(FieldDef.size());
94 for (s = 0; s < nstrips; ++s)
96 for (j = 0; j < nfields; ++j)
98 for (i = 0; i < FieldDef.size() / nstrips; ++i)
100 int n = s * FieldDef.size() / nstrips + i;
102 FieldDef[n]->m_fields.push_back(
m_f->m_variables[j]);
103 m_f->m_exp[s * nfields + j]->AppendFieldData(
104 FieldDef[n], FieldData[n],
105 m_f->m_exp[s * nfields + j]->UpdateCoeffs());
109 fld->Write(filename, FieldDef, FieldData,
m_f->m_fieldMetaDataMap,
114 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
115 std::vector<LibUtilities::FieldDefinitionsSharedPtr>();
116 std::vector<std::vector<NekDouble>> FieldData =
117 std::vector<std::vector<NekDouble>>();
118 fld->Write(filename, FieldDef, FieldData,
m_f->m_fieldMetaDataMap);
125 string filename =
m_config[
"outfile"].as<
string>();
131 fld->Write(filename,
m_f->m_fielddef,
m_f->m_data,
m_f->m_fieldMetaDataMap);
135 [[maybe_unused]] po::variables_map &vm)
137 return fs::path(filename);
141 [[maybe_unused]] po::variables_map &vm)
143 int nprocs =
m_f->m_comm->GetSpaceComm()->GetSize();
144 fs::path specPath(filename), fulloutname;
147 fulloutname = specPath;
153 pad %
m_f->m_comm->GetSpaceComm()->GetRank() %
"fld";
156 fs::path poutfile(pad.str());
157 fulloutname = specPath / poutfile;
164 std::string iofmt(
"Xml");
167 if (
m_f->m_session->DefinesSolverInfo(
"IOFormat"))
169 iofmt =
m_f->m_session->GetSolverInfo(
"IOFormat");
171 if (
m_f->m_session->DefinesCmdLineArgument(
"io-format"))
174 m_f->m_session->GetCmdLineArgument<std::string>(
"io-format");
179 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)
void v_OutputFromData(po::variables_map &vm) override
Write from data to output file.
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.
fs::path v_GetPath(std::string &filename, po::variables_map &vm) override
std::string GetIOFormat()
void v_OutputFromPts(po::variables_map &vm) override
Write from pts to output file.
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.
Represents a command-line configuration option.