17 if((argc < 3) || (argc > 4))
19 fprintf(stderr,
"Usage: ./Fld2Tecplot [-c] file.xml file.fld\n");
33 char **newargv =
new char*[newargc];
36 newargv[1] =
new char[31];
37 strcpy(newargv[1],
"--SetToOneSpaceDimension=false");
39 for(
int i = 1; i < argc; ++i)
41 newargv[i + 1] = argv[i];
45 session = LibUtilities::SessionReader::CreateInstance(newargc, newargv);
46 graph = SpatialDomains::MeshGraph::Read(session);
50 session->LoadSolverInfo(
"Driver", vDriverModule,
"Standard");
56 if(!(PulseWave = std::dynamic_pointer_cast
59 ASSERTL0(
false,
"Failed to dynamically cast to PulseWaveSystemOutput");
62 std::string fname(argv[argc-1]);
65 int ndomains = PulseWave->GetNdomains();
67 PulseWave->ImportFldToMultiDomains(fname,Vessels = PulseWave->UpdateVessels(),
69 int fdot = fname.find_last_of(
'.');
71 if (fdot != std::string::npos)
73 string ending = fname.substr(fdot);
78 if (ending ==
".chk" || ending ==
".fld")
80 fname = fname.substr(0,fdot);
86 ofstream outfile(fname.c_str());
87 int nvariables = session->GetVariables().size();
90 for(j = 0; j < nvariables-1; ++j)
92 var += session->GetVariable(j) +
", ";
94 var += session->GetVariable(j);
96 Vessels[0]->WriteTecplotHeader(outfile,var);
98 for(
int n = 0; n < ndomains; ++n)
100 Vessels[n*nvariables]->WriteTecplotZone(outfile);
101 for(
int j = 0; j < nvariables; ++j)
103 Vessels[n * nvariables + j]->WriteTecplotField(outfile);
106 Vessels[n * nvariables]->WriteTecplotConnectivity(outfile);
110 catch (
const std::runtime_error&)
114 catch (
const std::string& eStr)
116 cout <<
"Error: " << eStr << endl;
#define ASSERTL0(condition, msg)
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
Base class for unsteady solvers.
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