49 LibUtilities::SessionReader::RegisterCmdLineArgument(
50 "SetToOneSpaceDimension",
"1",
"Redefine mesh to be aligned to x-axis");
52int main(
int argc,
char *argv[])
54 if ((argc < 3) || (argc > 4))
56 fprintf(stderr,
"Usage: ./Fld2Tecplot [-c] file.xml file.fld\n");
69 int newargc = argc + 1;
70 char **newargv =
new char *[newargc];
73 newargv[1] =
new char[31];
74 strcpy(newargv[1],
"--SetToOneSpaceDimension=false");
76 for (
int i = 1; i < argc; ++i)
78 newargv[i + 1] = argv[i];
82 session = LibUtilities::SessionReader::CreateInstance(newargc, newargv);
83 graph = SpatialDomains::MeshGraphIO::Read(session);
87 session->LoadSolverInfo(
"Driver", vDriverModule,
"Standard");
93 if (!(PulseWave = std::dynamic_pointer_cast<PulseWaveSystem>(EqSys)))
96 "Failed to dynamically cast to PulseWaveSystemOutput");
99 std::string fname(argv[argc - 1]);
102 int ndomains = PulseWave->GetNdomains();
104 PulseWave->ImportFldToMultiDomains(
105 fname, Vessels = PulseWave->UpdateVessels(), ndomains);
106 int fdot = fname.find_last_of(
'.');
108 if (fdot != std::string::npos)
110 string ending = fname.substr(fdot);
115 if (ending ==
".chk" || ending ==
".fld")
117 fname = fname.substr(0, fdot);
123 ofstream outfile(fname.c_str());
124 int nvariables = session->GetVariables().size();
125 std::string var =
"";
127 for (j = 0; j < nvariables - 1; ++j)
129 var += session->GetVariable(j) +
", ";
131 var += session->GetVariable(j);
133 Vessels[0]->WriteTecplotHeader(outfile, var);
135 for (
int n = 0; n < ndomains; ++n)
137 Vessels[n * nvariables]->WriteTecplotZone(outfile);
138 for (
int j = 0; j < nvariables; ++j)
140 Vessels[n * nvariables + j]->WriteTecplotField(outfile);
143 Vessels[n * nvariables]->WriteTecplotConnectivity(outfile);
147 catch (
const std::runtime_error &)
151 catch (
const std::string &eStr)
153 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
std::shared_ptr< PulseWaveSystem > PulseWaveSystemSharedPtr