48 LibUtilities::SessionReader::RegisterCmdLineArgument(
49 "SetToOneSpaceDimension",
"1",
"Redefine mesh to be aligned to x-axis");
51 int main(
int argc,
char *argv[])
53 if ((argc < 3) || (argc > 4))
55 fprintf(stderr,
"Usage: ./Fld2Tecplot [-c] file.xml file.fld\n");
68 int newargc = argc + 1;
69 char **newargv =
new char *[newargc];
72 newargv[1] =
new char[31];
73 strcpy(newargv[1],
"--SetToOneSpaceDimension=false");
75 for (
int i = 1; i < argc; ++i)
77 newargv[i + 1] = argv[i];
81 session = LibUtilities::SessionReader::CreateInstance(newargc, newargv);
82 graph = SpatialDomains::MeshGraph::Read(session);
86 session->LoadSolverInfo(
"Driver", vDriverModule,
"Standard");
92 if (!(PulseWave = std::dynamic_pointer_cast<PulseWaveSystem>(EqSys)))
95 "Failed to dynamically cast to PulseWaveSystemOutput");
98 std::string fname(argv[argc - 1]);
101 int ndomains = PulseWave->GetNdomains();
103 PulseWave->ImportFldToMultiDomains(
104 fname, Vessels = PulseWave->UpdateVessels(), ndomains);
105 int fdot = fname.find_last_of(
'.');
107 if (fdot != std::string::npos)
109 string ending = fname.substr(fdot);
114 if (ending ==
".chk" || ending ==
".fld")
116 fname = fname.substr(0, fdot);
122 ofstream outfile(fname.c_str());
123 int nvariables = session->GetVariables().size();
124 std::string var =
"";
126 for (j = 0; j < nvariables - 1; ++j)
128 var += session->GetVariable(j) +
", ";
130 var += session->GetVariable(j);
132 Vessels[0]->WriteTecplotHeader(outfile, var);
134 for (
int n = 0; n < ndomains; ++n)
136 Vessels[n * nvariables]->WriteTecplotZone(outfile);
137 for (
int j = 0; j < nvariables; ++j)
139 Vessels[n * nvariables + j]->WriteTecplotField(outfile);
142 Vessels[n * nvariables]->WriteTecplotConnectivity(outfile);
146 catch (
const std::runtime_error &)
150 catch (
const std::string &eStr)
152 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