46 static std::string
npts = LibUtilities::SessionReader::RegisterCmdLineArgument(
47 "NumberOfPoints",
"n",
"Define number of points to dump output");
95 int expsize =
m_f->m_exp.size();
105 if(
m_f->m_comm->TreatAsRankZero())
107 cout <<
"Processing input xml file" << endl;
115 bool fldfilegiven =
true;
118 if(
m_f->m_inputfiles.count(
"fld") != 0)
122 else if(
m_f->m_inputfiles.count(
"chk") != 0)
126 else if (
m_f->m_inputfiles.count(
"rst") != 0)
132 fldfilegiven =
false;
135 string xml_ending =
"xml";
136 string xml_gz_ending =
"xml.gz";
138 std::vector<std::string> files;
140 for (
int i = 0; i <
m_f->m_inputfiles[xml_ending].size(); ++i)
142 files.push_back(
m_f->m_inputfiles[xml_ending][i]);
146 for (
int j =0; j <
m_f->m_inputfiles[xml_gz_ending].size(); ++j)
148 files.push_back(
m_f->m_inputfiles[xml_gz_ending][j]);
156 if(vm.count(
"range"))
158 vector<NekDouble> values;
160 vm[
"range"].as<string>().c_str(), values),
161 "Failed to interpret range string");
164 "Do not have minimum values of xmin,xmax");
166 "Do not have an even number of range values");
168 int nvalues = values.size()/2;
172 rng->m_doZrange =
false;
173 rng->m_doYrange =
false;
174 rng->m_checkShape =
false;
179 rng->m_doZrange =
true;
180 rng->m_zmin = values[4];
181 rng->m_zmax = values[5];
183 rng->m_doYrange =
true;
184 rng->m_ymin = values[2];
185 rng->m_ymax = values[3];
187 rng->m_doXrange =
true;
188 rng->m_xmin = values[0];
189 rng->m_xmax = values[1];
192 ASSERTL0(
false,
"too many values specfied in range");
197 if(vm.count(
"onlyshape"))
203 rng->m_doXrange =
false;
204 rng->m_doYrange =
false;
205 rng->m_doZrange =
false;
208 rng->m_checkShape =
true;
211 boost::to_upper_copy(vm[
"onlyshape"].as<string>());
216 boost::to_upper(shapeval);
217 if(shapematch.compare(shapeval) == 0)
223 ASSERTL0(i != LibUtilities::SIZE_ShapeType,
224 "Failed to find shape type in -onlyshape command line "
229 vector<string> cmdArgs;
230 cmdArgs.push_back(
"FieldConvert");
234 cmdArgs.push_back(
"--verbose");
237 if(vm.count(
"part-only"))
239 cmdArgs.push_back(
"--part-only");
241 boost::lexical_cast<string>(vm[
"part-only"].as<int>()));
244 if(vm.count(
"part-only-overlapping"))
246 cmdArgs.push_back(
"--part-only-overlapping");
248 boost::lexical_cast<string>(vm[
"part-only-overlapping"].as<int>()));
253 cmdArgs.push_back(
"--npz");
255 boost::lexical_cast<string>(vm[
"npz"].as<int>()));
258 int argc = cmdArgs.size();
259 const char **argv =
new const char*[argc];
260 for (
int i = 0; i < argc; ++i)
262 argv[i] = cmdArgs[i].c_str();
273 if(
m_f->m_comm->TreatAsRankZero())
279 ss << cpuTime <<
"s";
280 cout <<
"\t InputXml session reader CPU Time: " << setw(8) << left
292 if(
m_f->m_comm->TreatAsRankZero())
298 ss << cpuTime <<
"s";
299 cout <<
"\t InputXml mesh graph setup CPU Time: " << setw(8) << left
312 if(!expansions.size())
317 m_f->m_exp.resize(1);
321 int NumHomogeneousDir = 0;
328 SpatialDomains::ExpansionMap::const_iterator expIt;
331 for (expIt = expansions.begin(); expIt != expansions.end(); ++expIt)
333 ElementGIDs[i++] = expIt->second->m_geomShPtr->GetGlobalID();
336 m_f->m_fielddef.clear();
339 m_f->m_fld->Import(
m_f->m_inputfiles[fldending][0],
342 m_f->m_fieldMetaDataMap,
344 NumHomogeneousDir =
m_f->m_fielddef[0]->m_numHomogeneousDir;
348 m_f->m_graph->SetExpansions(
m_f->m_fielddef);
352 if(
m_f->m_session->DefinesSolverInfo(
"HOMOGENEOUS"))
354 std::string HomoStr =
m_f->m_session->GetSolverInfo(
"HOMOGENEOUS");
356 if((HomoStr ==
"HOMOGENEOUS1D") || (HomoStr ==
"Homogeneous1D")
357 || (HomoStr ==
"1D") || (HomoStr ==
"Homo1D"))
359 NumHomogeneousDir = 1;
361 if((HomoStr ==
"HOMOGENEOUS2D") || (HomoStr ==
"Homogeneous2D")
362 || (HomoStr ==
"2D") || (HomoStr ==
"Homo2D"))
364 NumHomogeneousDir = 2;
374 if(vm.count(
"output-points"))
376 nPointsNew = vm[
"output-points"].as<
int>();
380 m_f->m_graph->SetExpansionsToEvenlySpacedPoints(nPointsNew);
384 if(vm.count(
"output-points"))
386 int nPointsNew = vm[
"output-points"].as<
int>();
387 m_f->m_graph->SetExpansionsToPointOrder(nPointsNew);
393 if(
m_f->m_comm->TreatAsRankZero())
399 ss << cpuTime <<
"s";
400 cout <<
"\t InputXml setexpansion CPU Time: " << setw(8) << left
407 if(NumHomogeneousDir == 1 && vm.count(
"output-points-hom-z"))
409 int expdim =
m_f->m_graph->GetMeshDimension();
410 m_f->m_fielddef[0]->m_numModes[expdim] = vm[
"output-points-hom-z"].as<
int>();
413 m_f->m_exp[0] =
m_f->SetUpFirstExpList(NumHomogeneousDir,fldfilegiven);
417 if(
m_f->m_comm->TreatAsRankZero())
424 ss1 << cpuTime <<
"s";
425 cout <<
"\t InputXml set first exp CPU Time: " << setw(8) << left
426 << ss1.str() << endl;
#define ASSERTL0(condition, msg)
pair< ModuleType, string > ModuleKey
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.
FieldSharedPtr m_f
Field object.
const char *const ShapeTypeMap[]
static SessionReaderSharedPtr CreateInstance(int argc, char *argv[])
Creates an instance of the SessionReader class.
boost::shared_ptr< DomainRange > DomainRangeShPtr
boost::shared_ptr< Field > FieldSharedPtr
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()
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.