46 static std::string
npts = LibUtilities::SessionReader::RegisterCmdLineArgument(
47 "NumberOfPoints",
"n",
"Define number of points to dump output");
90 int expsize =
m_f->m_exp.size();
100 if (
m_f->m_comm->TreatAsRankZero())
102 cout <<
"Processing input xml file" << endl;
110 bool fldfilegiven =
true;
113 if (
m_f->m_inputfiles.count(
"fld") != 0)
117 else if (
m_f->m_inputfiles.count(
"chk") != 0)
121 else if (
m_f->m_inputfiles.count(
"rst") != 0)
127 fldfilegiven =
false;
130 string xml_ending =
"xml";
131 string xml_gz_ending =
"xml.gz";
133 std::vector<std::string> files;
135 for (
int i = 0; i <
m_f->m_inputfiles[xml_ending].size(); ++i)
137 files.push_back(
m_f->m_inputfiles[xml_ending][i]);
141 for (
int j = 0; j <
m_f->m_inputfiles[xml_gz_ending].size(); ++j)
143 files.push_back(
m_f->m_inputfiles[xml_gz_ending][j]);
149 if (vm.count(
"range"))
151 vector<NekDouble> values;
153 vm[
"range"].as<string>().c_str(), values),
154 "Failed to interpret range string");
156 ASSERTL0(values.size() > 1,
"Do not have minimum values of xmin,xmax");
158 "Do not have an even number of range values");
160 int nvalues = values.size() / 2;
163 rng->m_doZrange =
false;
164 rng->m_doYrange =
false;
165 rng->m_checkShape =
false;
170 rng->m_doZrange =
true;
171 rng->m_zmin = values[4];
172 rng->m_zmax = values[5];
174 rng->m_doYrange =
true;
175 rng->m_ymin = values[2];
176 rng->m_ymax = values[3];
178 rng->m_doXrange =
true;
179 rng->m_xmin = values[0];
180 rng->m_xmax = values[1];
183 ASSERTL0(
false,
"too many values specfied in range");
188 if (vm.count(
"onlyshape"))
194 rng->m_doXrange =
false;
195 rng->m_doYrange =
false;
196 rng->m_doZrange =
false;
199 rng->m_checkShape =
true;
201 string shapematch = boost::to_upper_copy(vm[
"onlyshape"].as<string>());
206 boost::to_upper(shapeval);
207 if (shapematch.compare(shapeval) == 0)
213 ASSERTL0(i != LibUtilities::SIZE_ShapeType,
214 "Failed to find shape type in -onlyshape command line "
219 vector<string> cmdArgs;
220 cmdArgs.push_back(
"FieldConvert");
224 cmdArgs.push_back(
"--verbose");
227 if (vm.count(
"part-only"))
229 cmdArgs.push_back(
"--part-only");
231 boost::lexical_cast<string>(vm[
"part-only"].as<int>()));
234 if (vm.count(
"part-only-overlapping"))
236 cmdArgs.push_back(
"--part-only-overlapping");
238 boost::lexical_cast<string>(vm[
"part-only-overlapping"].as<int>()));
243 cmdArgs.push_back(
"--npz");
244 cmdArgs.push_back(boost::lexical_cast<string>(vm[
"npz"].as<int>()));
247 int argc = cmdArgs.size();
248 const char **argv =
new const char *[argc];
249 for (
int i = 0; i < argc; ++i)
251 argv[i] = cmdArgs[i].c_str();
255 argc, (
char **)argv, files,
m_f->m_comm);
262 if (
m_f->m_comm->TreatAsRankZero())
268 ss << cpuTime <<
"s";
269 cout <<
"\t InputXml session reader CPU Time: " << setw(8) << left
279 if (
m_f->m_comm->TreatAsRankZero())
285 ss << cpuTime <<
"s";
286 cout <<
"\t InputXml mesh graph setup CPU Time: " << setw(8)
287 << left << ss.str() << endl;
295 m_f->m_graph->GetExpansions();
300 if (!expansions.size())
305 m_f->m_exp.resize(1);
309 int NumHomogeneousDir = 0;
316 SpatialDomains::ExpansionMap::const_iterator expIt;
319 for (expIt = expansions.begin(); expIt != expansions.end(); ++expIt)
321 ElementGIDs[i++] = expIt->second->m_geomShPtr->GetGlobalID();
324 m_f->m_fielddef.clear();
327 m_f->FieldIOForFile(
m_f->m_inputfiles[fldending][0])->Import(
328 m_f->m_inputfiles[fldending][0],
m_f->m_fielddef,
m_f->m_data,
329 m_f->m_fieldMetaDataMap, ElementGIDs);
330 NumHomogeneousDir =
m_f->m_fielddef[0]->m_numHomogeneousDir;
334 m_f->m_graph->SetExpansions(
m_f->m_fielddef);
338 if (
m_f->m_session->DefinesSolverInfo(
"HOMOGENEOUS"))
340 std::string HomoStr =
m_f->m_session->GetSolverInfo(
"HOMOGENEOUS");
342 if ((HomoStr ==
"HOMOGENEOUS1D") || (HomoStr ==
"Homogeneous1D") ||
343 (HomoStr ==
"1D") || (HomoStr ==
"Homo1D"))
345 NumHomogeneousDir = 1;
347 if ((HomoStr ==
"HOMOGENEOUS2D") || (HomoStr ==
"Homogeneous2D") ||
348 (HomoStr ==
"2D") || (HomoStr ==
"Homo2D"))
350 NumHomogeneousDir = 2;
360 if (vm.count(
"output-points"))
362 nPointsNew = vm[
"output-points"].as<
int>();
365 m_f->m_graph->SetExpansionsToEvenlySpacedPoints(nPointsNew);
369 if (vm.count(
"output-points"))
371 int nPointsNew = vm[
"output-points"].as<
int>();
372 m_f->m_graph->SetExpansionsToPointOrder(nPointsNew);
378 if (
m_f->m_comm->TreatAsRankZero())
384 ss << cpuTime <<
"s";
385 cout <<
"\t InputXml setexpansion CPU Time: " << setw(8) << left
392 if (NumHomogeneousDir == 1 && vm.count(
"output-points-hom-z"))
394 int expdim =
m_f->m_graph->GetMeshDimension();
395 m_f->m_fielddef[0]->m_numModes[expdim] =
396 vm[
"output-points-hom-z"].as<
int>();
399 m_f->m_exp[0] =
m_f->SetUpFirstExpList(NumHomogeneousDir, fldfilegiven);
403 if (
m_f->m_comm->TreatAsRankZero())
410 ss1 << cpuTime <<
"s";
411 cout <<
"\t InputXml set first exp CPU Time: " << setw(8) << left
412 << ss1.str() << endl;
#define ASSERTL0(condition, msg)
static boost::shared_ptr< MeshGraph > Read(const LibUtilities::SessionReaderSharedPtr &pSession, DomainRangeShPtr &rng=NullDomainRangeShPtr)
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
pair< ModuleType, string > ModuleKey
const char *const ShapeTypeMap[]
static SessionReaderSharedPtr CreateInstance(int argc, char *argv[])
Creates an instance of the SessionReader class.
boost::shared_ptr< Field > FieldSharedPtr
boost::shared_ptr< DomainRange > DomainRangeShPtr
static DomainRangeShPtr NullDomainRangeShPtr
static bool GenerateUnOrderedVector(const char *const str, std::vector< NekDouble > &vec)
NekDouble TimePerTest(unsigned int n)
Returns amount of seconds per iteration in a test with n iterations.
std::map< int, ExpansionShPtr > ExpansionMap
ModuleFactory & GetModuleFactory()
FieldSharedPtr m_f
Field object.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.