52 cerr <<
"Usage: XmlToVtk meshfile" << endl;
56 LibUtilities::SessionReader::RegisterCmdLineFlag(
57 "jacobian",
"j",
"Output Jacobian as scalar field");
58 LibUtilities::SessionReader::RegisterCmdLineFlag(
59 "quality",
"q",
"Output distribution of scaled Jacobians");
62 = LibUtilities::SessionReader::CreateInstance(argc, argv);
64 bool jac = vSession->DefinesCmdLineArgument(
"jacobian");
65 bool quality = vSession->DefinesCmdLineArgument(
"quality");
67 jac = quality ?
true : jac;
70 string meshfile(argv[argc-1]);
72 SpatialDomains::MeshGraph::Read(vSession);
78 for (it = emap.begin(); it != emap.end(); ++it)
80 for (
int i = 0; i < it->second->m_basisKeyVector.size(); ++i)
92 int expdim = graphShPt->GetMeshDimension();
99 if(vSession->DefinesSolverInfo(
"HOMOGENEOUS"))
101 std::string HomoStr = vSession->GetSolverInfo(
"HOMOGENEOUS");
105 HomoStr ==
"HOMOGENEOUS1D" || HomoStr ==
"Homogeneous1D" ||
106 HomoStr ==
"1D" || HomoStr ==
"Homo1D",
107 "Only 3DH1D supported for XML output currently.");
110 vSession->LoadParameter(
"HomModesZ", nplanes);
118 NekDouble lz = vSession->GetParameter(
"LZ");
122 vSession, Bkey, lz,
false,
false, graphShPt);
137 if(vSession->DefinesSolverInfo(
"HOMOGENEOUS"))
139 std::string HomoStr = vSession->GetSolverInfo(
"HOMOGENEOUS");
143 HomoStr ==
"HOMOGENEOUS1D" || HomoStr ==
"Homogeneous1D" ||
144 HomoStr ==
"1D" || HomoStr ==
"Homo1D",
145 "Only 3DH1D supported for XML output currently.");
148 vSession->LoadParameter(
"HomModesZ", nplanes);
156 NekDouble lz = vSession->GetParameter(
"LZ");
160 vSession, Bkey, lz,
false,
false, graphShPt);
182 ASSERTL0(
false,
"Expansion dimension not recognised");
188 string outname(strtok(argv[argc-1],
"."));
190 ofstream outfile(outname.c_str());
192 Exp[0]->WriteVtkHeader(outfile);
201 Exp[0]->GetCoords(x0, x1, x2);
203 vector<NekDouble> jacDist;
207 jacDist.resize(Exp[0]->GetExpSize());
211 for(
int i = 0; i < Exp[0]->GetExpSize(); ++i)
216 unsigned int npts = e->GetTotPoints();
222 = g->GetJac(ptsKeys);
226 tmp = Exp[0]->UpdatePhys()
227 + Exp[0]->GetPhys_Offset(i), 1);
235 tmp = Exp[0]->UpdatePhys()
236 + Exp[0]->GetPhys_Offset(i), 1);
242 tmp = Exp[0]->UpdatePhys()
243 + Exp[0]->GetPhys_Offset(i), 1);
248 jacDist[i] = scaledJac;
251 Exp[0]->WriteVtkPieceHeader(outfile, i);
252 Exp[0]->WriteVtkPieceData (outfile, i,
"Jac");
253 Exp[0]->WriteVtkPieceFooter(outfile, i);
257 =
Vmath::Imin(Exp[0]->GetNpoints(), Exp[0]->GetPhys(), 1);
258 cout <<
"- Minimum Jacobian: "
259 <<
Vmath::Vmin(Exp[0]->GetNpoints(), Exp[0]->GetPhys(), 1)
260 <<
" at coords (" << x0[n] <<
", " << x1[n] <<
", " << x2[n] <<
")"
265 string distName = vSession->GetSessionName() +
".jac";
266 ofstream dist(distName.c_str());
267 dist.setf (ios::scientific, ios::floatfield);
269 for (
int i = 0; i < Exp[0]->GetExpSize(); ++i)
271 dist << setw(10) << i <<
" "
272 << setw(20) << setprecision(15) << jacDist[i] << endl;
277 cout <<
"- Minimum/maximum scaled Jacobian: "
278 <<
Vmath::Vmin(Exp[0]->GetExpSize(), &jacDist[0], 1) <<
" "
279 <<
Vmath::Vmax(Exp[0]->GetExpSize(), &jacDist[0], 1)
286 for(
int i = 0; i < Exp[0]->GetExpSize(); ++i)
288 Exp[0]->WriteVtkPieceHeader(outfile, i);
289 Exp[0]->WriteVtkPieceFooter(outfile, i);
293 Exp[0]->WriteVtkFooter(outfile);
#define ASSERTL0(condition, msg)
std::vector< PointsKey > PointsKeyVector
T Vmax(int n, const T *x, const int incx)
Return the maximum element in x – called vmax to avoid conflict with max.
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.
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
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< ExpList2D > ExpList2DSharedPtr
Shared pointer to an ExpList2D object.
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< Expansion > ExpansionSharedPtr
boost::shared_ptr< ExpList3DHomogeneous1D > ExpList3DHomogeneous1DSharedPtr
Shared pointer to an ExpList3DHomogeneous1D object.
int GetNumModes() const
Returns the order of the basis.
boost::shared_ptr< MeshGraph > MeshGraphSharedPtr
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Geometry is curved or has non-constant factors.
Describes the specification for a Basis.
std::map< int, ExpansionShPtr > ExpansionMap
std::map< int, ExpansionShPtr >::iterator ExpansionMapIter