80 string range =
m_config[
"range"].as<
string>();
85 if (
m_f->m_comm->TreatAsRankZero())
98 string xml_ending =
"xml";
99 string xml_gz_ending =
"xml.gz";
101 std::vector<std::string> files;
103 for (
int i = 0; i <
m_f->m_inputfiles[xml_ending].size(); ++i)
105 files.push_back(
m_f->m_inputfiles[xml_ending][i]);
109 for (
int j = 0; j <
m_f->m_inputfiles[xml_gz_ending].size(); ++j)
111 files.push_back(
m_f->m_inputfiles[xml_gz_ending][j]);
117 if (vm.count(
"range"))
120 "The command line option \"range\" (FieldConvert -r xmin,xmax,"
121 "ymin,ymax) is deprecated. Please use the InputXml "
122 "option instead, i.e. \n \t"
123 "FieldConvert myfile.xml:xml:range=\"xmin,xmax,ymin,ymax\" "
127 if (vm.count(
"range") || range.size())
129 vector<NekDouble> values;
134 "Failed to interpret range string");
140 "Failed to interpret range string");
143 ASSERTL0(values.size() > 1,
"Do not have minimum values of xmin,xmax");
145 "Do not have an even number of range values");
147 int nvalues = values.size() / 2;
150 rng->m_doZrange =
false;
151 rng->m_doYrange =
false;
152 rng->m_checkShape =
false;
157 rng->m_doZrange =
true;
158 rng->m_zmin = values[4];
159 rng->m_zmax = values[5];
162 rng->m_doYrange =
true;
163 rng->m_ymin = values[2];
164 rng->m_ymax = values[3];
167 rng->m_doXrange =
true;
168 rng->m_xmin = values[0];
169 rng->m_xmax = values[1];
173 "too many values specfied in range");
178 if (vm.count(
"onlyshape"))
183 rng->m_doXrange =
false;
184 rng->m_doYrange =
false;
185 rng->m_doZrange =
false;
188 rng->m_checkShape =
true;
190 string shapematch = boost::to_upper_copy(vm[
"onlyshape"].as<string>());
195 boost::to_upper(shapeval);
196 if (shapematch.compare(shapeval) == 0)
203 "Failed to find shape type in -onlyshape command line "
208 vector<string> cmdArgs;
209 cmdArgs.push_back(
"FieldConvert");
213 cmdArgs.push_back(
"--verbose");
216 if (vm.count(
"part-only"))
218 cmdArgs.push_back(
"--part-only");
220 boost::lexical_cast<string>(vm[
"part-only"].as<int>()));
223 if (vm.count(
"part-only-overlapping"))
225 cmdArgs.push_back(
"--part-only-overlapping");
227 boost::lexical_cast<string>(vm[
"part-only-overlapping"].as<int>()));
232 cmdArgs.push_back(
"--npz");
233 cmdArgs.push_back(boost::lexical_cast<string>(vm[
"npz"].as<int>()));
239 cmdArgs.push_back(
"--npt");
240 cmdArgs.push_back(boost::lexical_cast<string>(vm[
"npt"].as<int>()));
243 int argc = cmdArgs.size();
244 const char **argv =
new const char *[argc];
245 for (
int i = 0; i < argc; ++i)
247 argv[i] = cmdArgs[i].c_str();
251 argc, (
char **)argv, files,
m_f->m_comm);
253 if (vm.count(
"nparts"))
256 ASSERTL0(boost::icontains(files[0],
"_xml"),
257 "Expect the mesh to have been pre-partitioned when "
258 " using the \"--nparts\" option. Please use \"--part-only\" "
259 "option to prepartition xml file.");
267 if (
m_f->m_comm->TreatAsRankZero())
270 NekDouble cpuTime = timerpart.TimePerTest(1);
273 ss << cpuTime <<
"s";
274 cout <<
"\t InputXml session reader CPU Time: " << setw(8) << left
284 if (
m_f->m_comm->TreatAsRankZero())
287 NekDouble cpuTime = timerpart.TimePerTest(1);
290 ss << cpuTime <<
"s";
291 cout <<
"\t InputXml mesh graph setup CPU Time: " << setw(8)
292 << left << ss.str() << endl;
#define ASSERTL0(condition, msg)
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
std::set< std::string > m_allowedFiles
List of allowed file formats.
FieldSharedPtr m_f
Field object.
std::map< std::string, ConfigOption > m_config
List of configuration values.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
static SessionReaderSharedPtr CreateInstance(int argc, char *argv[])
Creates an instance of the SessionReader class.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
static bool GenerateVector(const std::string &str, std::vector< T > &out)
Takes a comma-separated string and converts it to entries in a vector.
static MeshGraphSharedPtr Read(const LibUtilities::SessionReaderSharedPtr pSession, LibUtilities::DomainRangeShPtr rng=LibUtilities::NullDomainRangeShPtr, bool fillGraph=true, SpatialDomains::MeshGraphSharedPtr partitionedGraph=nullptr)
std::shared_ptr< Field > FieldSharedPtr
std::pair< ModuleType, std::string > ModuleKey
ModuleFactory & GetModuleFactory()
const char *const ShapeTypeMap[SIZE_ShapeType]
std::shared_ptr< DomainRange > DomainRangeShPtr
static DomainRangeShPtr NullDomainRangeShPtr
Represents a command-line configuration option.