52 int main(
int argc,
char *argv[])
56 cerr <<
"Usage: XmlToVtk meshfile" << endl;
61 "jacobian",
"j",
"Output Jacobian as scalar field");
63 "quality",
"q",
"Output distribution of scaled Jacobians");
68 bool jac = vSession->DefinesCmdLineArgument(
"jacobian");
69 bool quality = vSession->DefinesCmdLineArgument(
"quality");
71 jac = quality ?
true : jac;
74 string meshfile(argv[argc-1]);
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);
261 const int pts = deriv[0][0].num_elements();
262 const int nq = chi->GetTotPoints();
263 const int expDim = chi->GetNumBases();
273 &deriv[1][0][0], 1, &deriv[0][1][0], 1,
281 &deriv[2][1][0], 1, &deriv[1][2][0], 1,
284 &jac[0], 1, &jac[0], 1);
286 &deriv[0][1][0], 1, &deriv[2][2][0], 1,
289 &jac[0], 1, &jac[0], 1);
291 &deriv[1][1][0], 1, &deriv[0][2][0], 1,
294 &jac[0], 1, &jac[0], 1);
299 for (
int k = 0; k < pts; ++k)
303 for (
int i = 0; i < deriv.num_elements(); ++i)
305 for (
int j = 0; j < deriv[i].num_elements(); ++j)
307 frob += deriv[i][j][k]*deriv[i][j][k];
312 NekDouble sigma = 0.5*(jac[k] + sqrt(jac[k]*jac[k] + 4*delta*delta));
314 eta[k] = expDim * pow(sigma,2.0/expDim) / frob;
315 if(eta[k] > 1 || eta[k] < 0)
316 cout << eta[k] << endl;
static std::string RegisterCmdLineFlag(const std::string &pName, const std::string &pShortName, const std::string &pDescription)
Registers a command-line flag with the session reader.
#define ASSERTL0(condition, msg)
std::vector< PointsKey > PointsKeyVector
static boost::shared_ptr< MeshGraph > Read(const LibUtilities::SessionReaderSharedPtr &pSession, DomainRangeShPtr &rng=NullDomainRangeShPtr)
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
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.
int main(int argc, char *argv[])
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
1D Evenly-spaced points using Lagrange polynomial
static SessionReaderSharedPtr CreateInstance(int argc, char *argv[])
Creates an instance of the SessionReader class.
boost::shared_ptr< ExpList1D > ExpList1DSharedPtr
Shared pointer to an ExpList1D object.
Defines a specification for a set of points.
boost::shared_ptr< Expansion > ExpansionSharedPtr
void Vvtvvtm(int n, const T *v, int incv, const T *w, int incw, const T *x, int incx, const T *y, int incy, T *z, int incz)
vvtvvtm (vector times vector minus vector times vector):
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