56 cerr <<
"Usage: XmlToVtk meshfile" << endl;
60 LibUtilities::SessionReader::RegisterCmdLineFlag(
61 "jacobian",
"j",
"Output Jacobian as scalar field");
62 LibUtilities::SessionReader::RegisterCmdLineFlag(
63 "quality",
"q",
"Output distribution of scaled Jacobians");
66 = LibUtilities::SessionReader::CreateInstance(argc, argv);
68 bool jac = vSession->DefinesCmdLineArgument(
"jacobian");
69 bool quality = vSession->DefinesCmdLineArgument(
"quality");
71 jac = quality ?
true : jac;
74 string meshfile(argv[argc-1]);
76 SpatialDomains::MeshGraph::Read(vSession);
82 for (it = emap.begin(); it != emap.end(); ++it)
84 for (
int i = 0; i < it->second->m_basisKeyVector.size(); ++i)
96 int expdim = graphShPt->GetMeshDimension();
103 if(vSession->DefinesSolverInfo(
"HOMOGENEOUS"))
105 std::string HomoStr = vSession->GetSolverInfo(
"HOMOGENEOUS");
109 HomoStr ==
"HOMOGENEOUS1D" || HomoStr ==
"Homogeneous1D" ||
110 HomoStr ==
"1D" || HomoStr ==
"Homo1D",
111 "Only 3DH1D supported for XML output currently.");
114 vSession->LoadParameter(
"HomModesZ", nplanes);
122 NekDouble lz = vSession->GetParameter(
"LZ");
126 vSession, Bkey, lz,
false,
false, graphShPt);
141 if(vSession->DefinesSolverInfo(
"HOMOGENEOUS"))
143 std::string HomoStr = vSession->GetSolverInfo(
"HOMOGENEOUS");
147 HomoStr ==
"HOMOGENEOUS1D" || HomoStr ==
"Homogeneous1D" ||
148 HomoStr ==
"1D" || HomoStr ==
"Homo1D",
149 "Only 3DH1D supported for XML output currently.");
152 vSession->LoadParameter(
"HomModesZ", nplanes);
160 NekDouble lz = vSession->GetParameter(
"LZ");
164 vSession, Bkey, lz,
false,
false, graphShPt);
186 ASSERTL0(
false,
"Expansion dimension not recognised");
192 string outname(strtok(argv[argc-1],
"."));
194 ofstream outfile(outname.c_str());
196 Exp[0]->WriteVtkHeader(outfile);
205 Exp[0]->GetCoords(x0, x1, x2);
208 for(
int i = 0; i < Exp[0]->GetExpSize(); ++i)
218 const int npts = chi->GetTotPoints();
223 tmp = Exp[0]->UpdatePhys()
224 + Exp[0]->GetPhys_Offset(i), 1);
228 Exp[0]->WriteVtkPieceHeader(outfile, i);
229 Exp[0]->WriteVtkPieceData (outfile, i,
"Q");
230 Exp[0]->WriteVtkPieceFooter(outfile, i);
234 =
Vmath::Imin(Exp[0]->GetNpoints(), Exp[0]->GetPhys(), 1);
235 cout <<
"- Minimum Jacobian: "
236 <<
Vmath::Vmin(Exp[0]->GetNpoints(), Exp[0]->GetPhys(), 1)
237 <<
" at coords (" << x0[n] <<
", " << x1[n] <<
", " << x2[n] <<
")"
244 for(
int i = 0; i < Exp[0]->GetExpSize(); ++i)
246 Exp[0]->WriteVtkPieceHeader(outfile, i);
247 Exp[0]->WriteVtkPieceFooter(outfile, i);
251 Exp[0]->WriteVtkFooter(outfile);
#define ASSERTL0(condition, msg)
std::vector< PointsKey > PointsKeyVector
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
T Vmin(int n, const T *x, const int incx)
Return the minimum element in x - called vmin to avoid conflict with min.
BasisType GetBasisType() const
Return type of expansion basis.
int Imin(int n, const T *x, const int incx)
Return the index of the minimum element in x.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
1D Evenly-spaced points using Lagrange polynomial
boost::shared_ptr< ExpList1D > ExpList1DSharedPtr
Shared pointer to an ExpList1D object.
Defines a specification for a set of points.
boost::shared_ptr< Expansion > ExpansionSharedPtr
boost::shared_ptr< ExpList2D > ExpList2DSharedPtr
Shared pointer to an ExpList2D object.
Array< OneD, NekDouble > GetQ(SpatialDomains::DerivStorage &deriv, LocalRegions::ExpansionSharedPtr exp)
boost::shared_ptr< ExpList2DHomogeneous1D > ExpList2DHomogeneous1DSharedPtr
Shared pointer to an ExpList2DHomogeneous1D object.
boost::shared_ptr< ExpList3D > ExpList3DSharedPtr
Shared pointer to an ExpList3D object.
PointsKey GetPointsKey() const
Return distribution of points.
boost::shared_ptr< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object.
boost::shared_ptr< ExpList3DHomogeneous1D > ExpList3DHomogeneous1DSharedPtr
Shared pointer to an ExpList3DHomogeneous1D object.
int GetNumModes() const
Returns the order of the basis.
boost::shared_ptr< StdExpansion > StdExpansionSharedPtr
boost::shared_ptr< MeshGraph > MeshGraphSharedPtr
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
boost::shared_ptr< Geometry > GeometrySharedPtr
Describes the specification for a Basis.
std::map< int, ExpansionShPtr > ExpansionMap
std::map< int, ExpansionShPtr >::iterator ExpansionMapIter