9 using namespace Nektar;
10 using namespace Nektar::SolverUtils;
13 "CharateristicVariables",
"c",
"Output characteristic variables");
17 int main(
int argc,
char *argv[])
19 if((argc < 3)||(argc > 4))
21 fprintf(stderr,
"Usage: ./Fld2Tecplot [-c] file.xml file.fld\n");
36 char **newargv =
new char*[newargc];
39 newargv[1] =
new char[30];
40 strcpy(newargv[1],
"--SetToOneSpaceDimension=false");
42 for(
int i = 1; i < argc; ++i)
44 newargv[i+1] = argv[i];
51 bool CalcCharacteristicVariables =
false;
53 if(session->DefinesCmdLineArgument(
cvar))
55 CalcCharacteristicVariables =
true;
60 session->LoadSolverInfo(
"Driver", vDriverModule,
"Standard");
66 if(!(PulseWave = boost::dynamic_pointer_cast
69 ASSERTL0(
false,
"Failed to dynamically cast to PulseWaveSystemOutput");
72 std::string fname(argv[argc-1]);
73 Array<OneD, MultiRegions::ExpListSharedPtr> Vessels;
75 int ndomains = PulseWave->GetNdomains();
77 PulseWave->ImportFldToMultiDomains(fname,Vessels = PulseWave->UpdateVessels(),
79 int fdot = fname.find_last_of(
'.');
81 if (fdot != std::string::npos)
83 string ending = fname.substr(fdot);
88 if (ending ==
".chk" || ending ==
".fld")
90 fname = fname.substr(0,fdot);
94 fname = fname +
".dat";
96 ofstream outfile(fname.c_str());
97 int nvariables = session->GetVariables().size();
100 for(j = 0; j < nvariables-1; ++j)
102 var += session->GetVariable(j) +
", ";
104 var += session->GetVariable(j);
106 if(CalcCharacteristicVariables)
108 var +=
", Char1, Char2";
111 Vessels[0]->WriteTecplotHeader(outfile,var);
113 for(
int n = 0; n < ndomains; ++n)
115 Vessels[n*nvariables]->WriteTecplotZone(outfile);
116 for(
int j = 0; j < nvariables; ++j)
118 Vessels[n*nvariables+j]->WriteTecplotField(outfile);
121 if(CalcCharacteristicVariables)
123 PulseWave->CalcCharacteristicVariables(n*nvariables);
125 for(
int j = 0; j < nvariables; ++j)
127 Vessels[n*nvariables+j]->WriteTecplotField(outfile);
130 Vessels[n*nvariables]->WriteTecplotConnectivity(outfile);
134 catch (
const std::runtime_error&)
138 catch (
const std::string& eStr)
140 cout <<
"Error: " << eStr << endl;