Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
XmlToTecplot.cpp File Reference
#include <cstdio>
#include <cstdlib>
#include <MultiRegions/ExpList.h>
#include <MultiRegions/ExpList1D.h>
#include <MultiRegions/ExpList2D.h>
#include <MultiRegions/ExpList3D.h>
#include <MultiRegions/ExpList3DHomogeneous1D.h>
Include dependency graph for XmlToTecplot.cpp:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 47 of file XmlToTecplot.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL0, Nektar::LibUtilities::SessionReader::CreateInstance(), Nektar::LibUtilities::eFourier, Nektar::LibUtilities::ePolyEvenlySpaced, Nektar::LibUtilities::BasisKey::GetBasisType(), Nektar::LibUtilities::BasisKey::GetNumModes(), Nektar::LibUtilities::BasisKey::GetPointsKey(), Nektar::SpatialDomains::MeshGraph::Read(), and Nektar::LibUtilities::SessionReader::RegisterCmdLineFlag().

{
Array<OneD,NekDouble> fce;
Array<OneD,NekDouble> xc0,xc1,xc2;
if(argc < 2)
{
fprintf(stderr,"Usage: XmlToTecplot meshfile\n");
exit(1);
}
LibUtilities::SessionReader::RegisterCmdLineFlag(
"multi-zone", "m", "Output multi-zone format (one element per zone).");
= LibUtilities::SessionReader::CreateInstance(argc, argv);
//----------------------------------------------
// Read in mesh from input file
string meshfile(argv[argc-1]);
= SpatialDomains::MeshGraph::Read(vSession);
//----------------------------------------------
//----------------------------------------------
// Set up Expansion information
SpatialDomains::ExpansionMap emap = graphShPt->GetExpansions();
for (it = emap.begin(); it != emap.end(); ++it)
{
for (int i = 0; i < it->second->m_basisKeyVector.size(); ++i)
{
LibUtilities::BasisKey tmp1 = it->second->m_basisKeyVector[i];
it->second->m_basisKeyVector[i] = LibUtilities::BasisKey(
tmp1.GetBasisType(), tmp1.GetNumModes(),
}
}
//----------------------------------------------
//----------------------------------------------
// Define Expansion
int expdim = graphShPt->GetMeshDimension();
Array<OneD, MultiRegions::ExpListSharedPtr> Exp(1);
switch(expdim)
{
case 1:
{
Exp[0] = Exp1D;
break;
}
case 2:
{
if(vSession->DefinesSolverInfo("HOMOGENEOUS"))
{
std::string HomoStr = vSession->GetSolverInfo("HOMOGENEOUS");
HomoStr == "HOMOGENEOUS1D" || HomoStr == "Homogeneous1D" ||
HomoStr == "1D" || HomoStr == "Homo1D",
"Only 3DH1D supported for XML output currently.");
int nplanes;
vSession->LoadParameter("HomModesZ", nplanes);
// choose points to be at evenly spaced points at nplanes + 1
// points
LibUtilities::eFourier, nplanes, Pkey);
NekDouble lz = vSession->GetParameter("LZ");
vSession, Bkey, lz, false, false, graphShPt);
Exp[0] = Exp3DH1;
}
else
{
Exp[0] = Exp2D;
}
break;
}
case 3:
{
Exp[0] = Exp3D;
break;
}
default:
ASSERTL0(false,"Expansion dimension not recognised");
break;
}
//-----------------------------------------------
//----------------------------------------------
// Write solution depending on #define
string outfile(strtok(argv[argc-1],"."));
outfile += ".dat";
ofstream outstrm(outfile.c_str());
Exp[0]->WriteTecplotHeader(outstrm);
if (vSession->DefinesCmdLineArgument("multi-zone"))
{
int nExp = Exp[0]->GetExpSize();
for (int i = 0; i < nExp; ++i)
{
Exp[0]->WriteTecplotZone (outstrm, i);
Exp[0]->WriteTecplotConnectivity(outstrm, i);
}
}
else
{
Exp[0]->WriteTecplotZone (outstrm);
Exp[0]->WriteTecplotConnectivity(outstrm);
}
outstrm.close();
//----------------------------------------------
return 0;
}