14 LibUtilities::SessionReader::RegisterCmdLineArgument(
15 "SetToOneSpaceDimension",
"1",
"Redefine mesh to be aligned to x-axis");
17 int main(
int argc,
char *argv[])
19 if ((argc < 3) || (argc > 4))
21 fprintf(stderr,
"Usage: ./Fld2Tecplot [-c] file.xml file.fld\n");
34 int newargc = argc + 1;
35 char **newargv =
new char *[newargc];
38 newargv[1] =
new char[31];
39 strcpy(newargv[1],
"--SetToOneSpaceDimension=false");
41 for (
int i = 1; i < argc; ++i)
43 newargv[i + 1] = argv[i];
47 session = LibUtilities::SessionReader::CreateInstance(newargc, newargv);
48 graph = SpatialDomains::MeshGraph::Read(session);
52 session->LoadSolverInfo(
"Driver", vDriverModule,
"Standard");
58 if (!(PulseWave = std::dynamic_pointer_cast<PulseWaveSystem>(EqSys)))
61 "Failed to dynamically cast to PulseWaveSystemOutput");
64 std::string fname(argv[argc - 1]);
67 int ndomains = PulseWave->GetNdomains();
69 PulseWave->ImportFldToMultiDomains(
70 fname, Vessels = PulseWave->UpdateVessels(), ndomains);
71 int fdot = fname.find_last_of(
'.');
73 if (fdot != std::string::npos)
75 string ending = fname.substr(fdot);
80 if (ending ==
".chk" || ending ==
".fld")
82 fname = fname.substr(0, fdot);
88 ofstream outfile(fname.c_str());
89 int nvariables = session->GetVariables().size();
92 for (j = 0; j < nvariables - 1; ++j)
94 var += session->GetVariable(j) +
", ";
96 var += session->GetVariable(j);
98 Vessels[0]->WriteTecplotHeader(outfile, var);
100 for (
int n = 0; n < ndomains; ++n)
102 Vessels[n * nvariables]->WriteTecplotZone(outfile);
103 for (
int j = 0; j < nvariables; ++j)
105 Vessels[n * nvariables + j]->WriteTecplotField(outfile);
108 Vessels[n * nvariables]->WriteTecplotConnectivity(outfile);
112 catch (
const std::runtime_error &)
116 catch (
const std::string &eStr)
118 cout <<
"Error: " << eStr << endl;
#define ASSERTL0(condition, msg)
int main(int argc, char *argv[])
static std::string SetToOneD
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Driver > DriverSharedPtr
A shared pointer to a Driver object.
DriverFactory & GetDriverFactory()
std::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
The above copyright notice and this permission notice shall be included.
std::shared_ptr< PulseWaveSystem > PulseWaveSystemSharedPtr