13 static std::string
cvar = LibUtilities::SessionReader::RegisterCmdLineFlag(
14 "CharateristicVariables",
"c",
"Output characteristic variables");
16 static std::string
SetToOneD = LibUtilities::SessionReader::RegisterCmdLineArgument(
"SetToOneSpaceDimension",
"1",
"Redefine mesh to be aligned to x-axis");
18 int main(
int argc,
char *argv[])
20 if((argc < 3)||(argc > 4))
22 fprintf(stderr,
"Usage: ./Fld2Tecplot [-c] file.xml file.fld\n");
37 char **newargv =
new char*[newargc];
40 newargv[1] =
new char[31];
41 strcpy(newargv[1],
"--SetToOneSpaceDimension=false");
43 for(
int i = 1; i < argc; ++i)
45 newargv[i+1] = argv[i];
49 session = LibUtilities::SessionReader::CreateInstance(newargc, newargv);
52 bool CalcCharacteristicVariables =
false;
54 if(session->DefinesCmdLineArgument(
cvar))
56 CalcCharacteristicVariables =
true;
61 session->LoadSolverInfo(
"Driver", vDriverModule,
"Standard");
67 if(!(PulseWave = boost::dynamic_pointer_cast
70 ASSERTL0(
false,
"Failed to dynamically cast to PulseWaveSystemOutput");
73 std::string fname(argv[argc-1]);
76 int ndomains = PulseWave->GetNdomains();
78 PulseWave->ImportFldToMultiDomains(fname,Vessels = PulseWave->UpdateVessels(),
80 int fdot = fname.find_last_of(
'.');
82 if (fdot != std::string::npos)
84 string ending = fname.substr(fdot);
89 if (ending ==
".chk" || ending ==
".fld")
91 fname = fname.substr(0,fdot);
95 fname = fname +
".dat";
97 ofstream outfile(fname.c_str());
98 int nvariables = session->GetVariables().size();
101 for(j = 0; j < nvariables-1; ++j)
103 var += session->GetVariable(j) +
", ";
105 var += session->GetVariable(j);
107 if(CalcCharacteristicVariables)
109 var +=
", Char1, Char2";
112 Vessels[0]->WriteTecplotHeader(outfile,var);
114 for(
int n = 0; n < ndomains; ++n)
116 Vessels[n*nvariables]->WriteTecplotZone(outfile);
117 for(
int j = 0; j < nvariables; ++j)
119 Vessels[n*nvariables+j]->WriteTecplotField(outfile);
122 if(CalcCharacteristicVariables)
124 PulseWave->CalcCharacteristicVariables(n*nvariables);
126 for(
int j = 0; j < nvariables; ++j)
128 Vessels[n*nvariables+j]->WriteTecplotField(outfile);
131 Vessels[n*nvariables]->WriteTecplotConnectivity(outfile);
135 catch (
const std::runtime_error&)
139 catch (
const std::string& eStr)
141 cout <<
"Error: " << eStr << endl;
boost::shared_ptr< PulseWaveSystem > PulseWaveSystemSharedPtr
#define ASSERTL0(condition, msg)
boost::shared_ptr< Driver > DriverSharedPtr
A shared pointer to a Driver object.
tBaseSharedPtr CreateInstance(tKey idKey BOOST_PP_COMMA_IF(MAX_PARAM) BOOST_PP_ENUM_BINARY_PARAMS(MAX_PARAM, tParam, x))
Create an instance of the class referred to by idKey.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
boost::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
Base class for unsteady solvers.
static std::string SetToOneD
DriverFactory & GetDriverFactory()
int main(int argc, char *argv[])