46 static std::string
npts = LibUtilities::SessionReader::RegisterCmdLineArgument(
47 "NumberOfPoints",
"n",
"Define number of points to dump output");
91 Timer timer, timerpart;
95 int expsize =
m_f->m_exp.size();
105 if(
m_f->m_comm->GetRank() == 0)
107 cout <<
"Processing input xml file" << endl;
116 bool fldfilegiven =
true;
119 if(
m_f->m_inputfiles.count(
"fld") != 0)
123 else if(
m_f->m_inputfiles.count(
"chk") != 0)
127 else if (
m_f->m_inputfiles.count(
"rst") != 0)
133 fldfilegiven =
false;
136 string xml_ending =
"xml";
137 string xml_gz_ending =
"xml.gz";
139 std::vector<std::string> files;
141 for (
int i = 0; i <
m_f->m_inputfiles[xml_ending].size(); ++i)
143 files.push_back(
m_f->m_inputfiles[xml_ending][i]);
147 for (
int j =0; j <
m_f->m_inputfiles[xml_gz_ending].size(); ++j)
149 files.push_back(
m_f->m_inputfiles[xml_gz_ending][j]);
157 if(vm.count(
"range"))
159 vector<NekDouble> values;
161 vm[
"range"].as<string>().c_str(), values),
162 "Failed to interpret range string");
165 "Do not have minimum values of xmin,xmax");
167 "Do not have an even number of range values");
169 int nvalues = values.size()/2;
173 rng->m_doZrange =
false;
174 rng->m_doYrange =
false;
175 rng->m_checkShape =
false;
180 rng->m_doZrange =
true;
181 rng->m_zmin = values[4];
182 rng->m_zmax = values[5];
184 rng->m_doYrange =
true;
185 rng->m_ymin = values[2];
186 rng->m_ymax = values[3];
188 rng->m_doXrange =
true;
189 rng->m_xmin = values[0];
190 rng->m_xmax = values[1];
193 ASSERTL0(
false,
"too many values specfied in range");
198 if(vm.count(
"onlyshape"))
204 rng->m_doXrange =
false;
205 rng->m_doYrange =
false;
206 rng->m_doZrange =
false;
209 rng->m_checkShape =
true;
212 boost::to_upper_copy(vm[
"onlyshape"].as<string>());
217 boost::to_upper(shapeval);
218 if(shapematch.compare(shapeval) == 0)
224 ASSERTL0(i != LibUtilities::SIZE_ShapeType,
225 "Failed to find shape type in -onlyshape command line "
230 vector<string> cmdArgs;
231 cmdArgs.push_back(
"FieldConvert");
235 cmdArgs.push_back(
"--verbose");
238 if(vm.count(
"shared-filesystem"))
240 cmdArgs.push_back(
"--shared-filesystem");
243 if(vm.count(
"part-only"))
245 cmdArgs.push_back(
"--part-only");
247 boost::lexical_cast<string>(vm[
"part-only"].as<int>()));
250 if(vm.count(
"part-only-overlapping"))
252 cmdArgs.push_back(
"--part-only-overlapping");
254 boost::lexical_cast<string>(vm[
"part-only-overlapping"].as<int>()));
257 int argc = cmdArgs.size();
258 const char **argv =
new const char*[argc];
259 for (
int i = 0; i < argc; ++i)
261 argv[i] = cmdArgs[i].c_str();
272 if(
m_f->m_comm->GetRank() == 0)
278 ss << cpuTime <<
"s";
279 cout <<
"\t InputXml session reader CPU Time: " << setw(8) << left
291 if(
m_f->m_comm->GetRank() == 0)
297 ss << cpuTime <<
"s";
298 cout <<
"\t InputXml mesh graph setup CPU Time: " << setw(8) << left
311 if(!expansions.size())
316 m_f->m_exp.resize(1);
320 int NumHomogeneousDir = 0;
327 SpatialDomains::ExpansionMap::const_iterator expIt;
330 for (expIt = expansions.begin(); expIt != expansions.end(); ++expIt)
332 ElementGIDs[i++] = expIt->second->m_geomShPtr->GetGlobalID();
335 m_f->m_fld->Import(
m_f->m_inputfiles[fldending][0],
m_f->m_fielddef,
339 NumHomogeneousDir =
m_f->m_fielddef[0]->m_numHomogeneousDir;
343 m_f->m_graph->SetExpansions(
m_f->m_fielddef);
347 if(
m_f->m_session->DefinesSolverInfo(
"HOMOGENEOUS"))
349 std::string HomoStr =
m_f->m_session->GetSolverInfo(
"HOMOGENEOUS");
351 if((HomoStr ==
"HOMOGENEOUS1D") || (HomoStr ==
"Homogeneous1D")
352 || (HomoStr ==
"1D") || (HomoStr ==
"Homo1D"))
354 NumHomogeneousDir = 1;
356 if((HomoStr ==
"HOMOGENEOUS2D") || (HomoStr ==
"Homogeneous2D")
357 || (HomoStr ==
"2D") || (HomoStr ==
"Homo2D"))
359 NumHomogeneousDir = 2;
369 if(vm.count(
"output-points"))
371 nPointsNew = vm[
"output-points"].as<
int>();
375 m_f->m_graph->SetExpansionsToEvenlySpacedPoints(nPointsNew);
379 if(vm.count(
"output-points"))
381 int nPointsNew = vm[
"output-points"].as<
int>();
382 m_f->m_graph->SetExpansionsToPointOrder(nPointsNew);
388 if(
m_f->m_comm->GetRank() == 0)
394 ss << cpuTime <<
"s";
395 cout <<
"\t InputXml setexpansion CPU Time: " << setw(8) << left
403 if(
m_f->m_comm->GetRank() == 0)
409 ss << cpuTime <<
"s";
410 cout <<
"\t InputXml setexpansion CPU Time: " << setw(8) << left
417 if(NumHomogeneousDir == 1 && vm.count(
"output-points-hom-z"))
419 int expdim =
m_f->m_graph->GetMeshDimension();
420 m_f->m_fielddef[0]->m_numModes[expdim] = vm[
"output-points-hom-z"].as<
int>();
423 m_f->m_exp[0] =
m_f->SetUpFirstExpList(NumHomogeneousDir,fldfilegiven);
427 if(
m_f->m_comm->GetRank() == 0)
434 ss1 << cpuTime <<
"s";
435 cout <<
"\t InputXml set first exp CPU Time: " << setw(8) << left
436 << ss1.str() << endl;
443 ss << cpuTime <<
"s";
444 cout <<
"InputXml CPU Time: " << setw(8) << left
#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.
static std::vector< std::vector< NekDouble > > NullVectorNekDoubleVector
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.
static FieldMetaDataMap NullFieldMetaDataMap
std::map< int, ExpansionShPtr > ExpansionMap
ModuleFactory & GetModuleFactory()
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.