Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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 48 of file XmlToTecplot.cpp.

References ASSERTL0, Nektar::LibUtilities::eFourier, Nektar::LibUtilities::ePolyEvenlySpaced, Nektar::LibUtilities::BasisKey::GetBasisType(), Nektar::LibUtilities::BasisKey::GetNumModes(), and Nektar::LibUtilities::BasisKey::GetPointsKey().

49 {
51  Array<OneD,NekDouble> xc0,xc1,xc2;
52 
53  if(argc < 2)
54  {
55  fprintf(stderr,"Usage: XmlToTecplot meshfile\n");
56  exit(1);
57  }
58 
59  LibUtilities::SessionReader::RegisterCmdLineFlag(
60  "multi-zone", "m", "Output multi-zone format (one element per zone).");
61 
63  = LibUtilities::SessionReader::CreateInstance(argc, argv);
64 
65  //----------------------------------------------
66  // Read in mesh from input file
67  string meshfile(argv[argc-1]);
69  = SpatialDomains::MeshGraph::Read(vSession);
70  //----------------------------------------------
71 
72  //----------------------------------------------
73  // Set up Expansion information
74  SpatialDomains::ExpansionMap emap = graphShPt->GetExpansions();
76 
77  for (it = emap.begin(); it != emap.end(); ++it)
78  {
79  for (int i = 0; i < it->second->m_basisKeyVector.size(); ++i)
80  {
81  LibUtilities::BasisKey tmp1 = it->second->m_basisKeyVector[i];
83  it->second->m_basisKeyVector[i] = LibUtilities::BasisKey(
84  tmp1.GetBasisType(), tmp1.GetNumModes(),
87  }
88  }
89  //----------------------------------------------
90 
91  //----------------------------------------------
92  // Define Expansion
93  int expdim = graphShPt->GetMeshDimension();
95 
96  switch(expdim)
97  {
98  case 1:
99  {
102  Exp[0] = Exp1D;
103  break;
104  }
105  case 2:
106  {
107  if(vSession->DefinesSolverInfo("HOMOGENEOUS"))
108  {
109  std::string HomoStr = vSession->GetSolverInfo("HOMOGENEOUS");
111 
112  ASSERTL0(
113  HomoStr == "HOMOGENEOUS1D" || HomoStr == "Homogeneous1D" ||
114  HomoStr == "1D" || HomoStr == "Homo1D",
115  "Only 3DH1D supported for XML output currently.");
116 
117  int nplanes;
118  vSession->LoadParameter("HomModesZ", nplanes);
119 
120  // choose points to be at evenly spaced points at nplanes + 1
121  // points
122  const LibUtilities::PointsKey Pkey(
123  nplanes + 1, LibUtilities::ePolyEvenlySpaced);
124  const LibUtilities::BasisKey Bkey(
125  LibUtilities::eFourier, nplanes, Pkey);
126  NekDouble lz = vSession->GetParameter("LZ");
127 
130  vSession, Bkey, lz, false, false, graphShPt);
131  Exp[0] = Exp3DH1;
132  }
133  else
134  {
137  Exp[0] = Exp2D;
138  }
139  break;
140  }
141  case 3:
142  {
145  Exp[0] = Exp3D;
146  break;
147  }
148  default:
149  ASSERTL0(false,"Expansion dimension not recognised");
150  break;
151  }
152 
153  //-----------------------------------------------
154 
155  //----------------------------------------------
156  // Write solution depending on #define
157  string outfile(strtok(argv[argc-1],"."));
158  outfile += ".dat";
159  ofstream outstrm(outfile.c_str());
160 
161  Exp[0]->WriteTecplotHeader(outstrm);
162 
163  if (vSession->DefinesCmdLineArgument("multi-zone"))
164  {
165  int nExp = Exp[0]->GetExpSize();
166 
167  for (int i = 0; i < nExp; ++i)
168  {
169  Exp[0]->WriteTecplotZone (outstrm, i);
170  Exp[0]->WriteTecplotConnectivity(outstrm, i);
171  }
172  }
173  else
174  {
175  Exp[0]->WriteTecplotZone (outstrm);
176  Exp[0]->WriteTecplotConnectivity(outstrm);
177  }
178 
179  outstrm.close();
180  //----------------------------------------------
181  return 0;
182 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
BasisType GetBasisType() const
Return type of expansion basis.
Definition: Basis.h:139
Fourier Expansion .
Definition: BasisType.h:52
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:51
1D Evenly-spaced points using Lagrange polynomial
Definition: PointsType.h:65
boost::shared_ptr< ExpList1D > ExpList1DSharedPtr
Shared pointer to an ExpList1D object.
Definition: ExpList1D.h:50
Defines a specification for a set of points.
Definition: Points.h:58
double NekDouble
boost::shared_ptr< ExpList2D > ExpList2DSharedPtr
Shared pointer to an ExpList2D object.
Definition: ExpList2D.h:49
boost::shared_ptr< ExpList3D > ExpList3DSharedPtr
Shared pointer to an ExpList3D object.
Definition: ExpList3D.h:115
PointsKey GetPointsKey() const
Return distribution of points.
Definition: Basis.h:145
boost::shared_ptr< ExpList3DHomogeneous1D > ExpList3DHomogeneous1DSharedPtr
Shared pointer to an ExpList3DHomogeneous1D object.
int GetNumModes() const
Returns the order of the basis.
Definition: Basis.h:84
boost::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:442
Describes the specification for a Basis.
Definition: Basis.h:50
std::map< int, ExpansionShPtr > ExpansionMap
Definition: MeshGraph.h:174
std::map< int, ExpansionShPtr >::iterator ExpansionMapIter
Definition: MeshGraph.h:175