34int main(
int argc,
char *argv[])
37 const char *mesh_file =
"../../data/inline-quad.mesh";
40 bool visualization =
true;
43 bool aspect_ratio =
true;
47 args.
AddOption(&mesh_file,
"-m",
"--mesh",
50 "Finite element order for visualization"
51 "(defaults to order of the mesh).");
52 args.
AddOption(&ref_levels,
"-r",
"--ref-levels",
53 "Number of initial uniform refinement levels.");
54 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
56 "Enable or disable GLVis visualization.");
57 args.
AddOption(&visit,
"-visit",
"--visit",
"-no-visit",
59 "Enable or disable VisIt.");
60 args.
AddOption(&size,
"-size",
"--size",
"-no-size",
62 "Visualize size parameter.");
63 args.
AddOption(&aspect_ratio,
"-aspr",
"--aspect-ratio",
"-no-aspr",
65 "Visualize aspect-ratio parameter.");
66 args.
AddOption(&skewness,
"-skew",
"--skew",
"-no-skew",
68 "Visualize skewness parameter.");
77 Mesh *mesh =
new Mesh(mesh_file, 1, 1,
false);
78 for (
int lev = 0; lev < ref_levels; lev++)
84 int nSize = 1, nAspr = 1, nSkew = 1;
92 const int nTotalParams = nSize + nAspr + nSkew;
95 order = mesh->
GetNodes() == NULL ? 1 :
96 mesh->
GetNodes()->FESpace()->GetFE(0)->GetOrder();
106 Vector geomParams(nTotalParams);
110 for (
int e = 0; e < mesh->
GetNE(); e++)
121 Vector asprVals, skewVals, oriVals;
123 asprVals, skewVals, oriVals);
124 allVals(q + 0) = sizeVal;
125 for (
int n = 0; n < nAspr; n++)
127 allVals(q + (n+1)*ir.
GetNPoints()) = asprVals(n);
129 for (
int n = 0; n < nSkew; n++)
131 allVals(q + (n+1+nAspr)*ir.
GetNPoints()) = skewVals(n);
159 "Size", cx, cy, visw, vish,
"Rjmc");
162 max_size = size_gf.
Max();
163 cout <<
"Min size: " << min_size << endl;
164 cout <<
"Max size: " << max_size << endl;
170 if (visit) { visit_dc.
RegisterField(
"Aspect-Ratio", &aspr_gf); }
175 "Aspect-Ratio", cx, cy, visw, vish,
"Rjmc");
178 max_aspr = aspr_gf.
Max();
179 max_aspr = std::max((
real_t) 1.0/min_aspr, max_aspr);
180 cout <<
"Worst aspect-ratio: " << max_aspr << endl;
181 cout <<
"(in any direction)" << endl;
192 "Skewness (radians)", cx, cy, visw, vish,
196 max_skew = skew_gf.
Max();
197 cout <<
"Min skew (in deg): " << min_skew*180/M_PI << endl;
198 cout <<
"Max skew (in deg): " << max_skew*180/M_PI << endl;
210 skew_gf1, skew_gf2, skew_gf3;
220 "Size", cx, cy, visw, vish,
"Rjmc");
223 max_size = size_gf.
Max();
224 cout <<
"Min size: " << min_size << endl;
225 cout <<
"Max size: " << max_size << endl;
242 "Aspect-Ratio", cx, cy, visw, vish,
"Rjmc");
245 "Aspect-Ratio2", cx, cy, visw, vish,
"Rjmc");
248 max_aspr1 = aspr_gf1.
Max();
249 max_aspr1 = std::max((
real_t) 1.0/min_aspr1, max_aspr1);
252 max_aspr2 = aspr_gf2.
Max();
253 max_aspr2 = std::max((
real_t) 1.0/min_aspr2, max_aspr2);
254 real_t max_aspr = max(max_aspr1, max_aspr2);
257 for (
int i = 0; i < aspr_gf1.
Size(); i++)
259 aspr_gf3(i) = 1.0/(aspr_gf1(i)*aspr_gf2(i));
262 max_aspr3 = aspr_gf3.
Max();
263 max_aspr3 = std::max((
real_t) 1.0/min_aspr3, max_aspr3);
264 max_aspr = std::max(max_aspr, max_aspr3);
266 cout <<
"Worst aspect-ratio: " << max_aspr << endl;
267 cout <<
"(in any direction)" << endl;
287 "Skewness", cx, cy, visw, vish,
"Rjmc");
290 "Skewness2", cx, cy, visw, vish,
"Rjmc");
293 "Dihedral", cx, cy, visw, vish,
"Rjmc");
296 max_skew1 = skew_gf1.
Max();
298 max_skew2 = skew_gf2.
Max();
300 max_skew3 = skew_gf3.
Max();
301 cout <<
"Min skew 1 (in deg): " << min_skew1*180/M_PI << endl;
302 cout <<
"Max skew 1 (in deg): " << max_skew1*180/M_PI << endl;
304 cout <<
"Min skew 2 (in deg): " << min_skew2*180/M_PI << endl;
305 cout <<
"Max skew 2 (in deg): " << max_skew2*180/M_PI << endl;
307 cout <<
"Min skew 3 (in deg): " << min_skew3*180/M_PI << endl;
308 cout <<
"Max skew 3 (in deg): " << max_skew3*180/M_PI << endl;
int Size() const
Return the logical size of the array.
virtual void SetFormat(int fmt)
Set the desired output mesh and data format.
Data type dense matrix using column-major storage.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
int GetNDofs() const
Returns number of degrees of freedom. This is the number of Local Degrees of Freedom.
DofTransformation * GetElementVDofs(int i, Array< int > &vdofs) const
Returns indices of degrees of freedom for the i'th element. The returned indices are offsets into an ...
virtual const FiniteElement * GetFE(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th element in t...
Abstract class for all finite elements.
const IntegrationRule & GetNodes() const
Get a const reference to the nodes of the element.
Class for grid function - Vector with associated FE space.
virtual void MakeRef(FiniteElementSpace *f, real_t *v)
Make the GridFunction reference external data on a new FiniteElementSpace.
Class for integration point with weight.
Class for an integration rule - an Array of IntegrationPoint.
int GetNPoints() const
Returns the number of the points in the integration rule.
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
Arbitrary order "L2-conforming" discontinuous finite elements.
void GetElementJacobian(int i, DenseMatrix &J, const IntegrationPoint *ip=NULL)
int GetNE() const
Returns number of elements.
int Dimension() const
Dimension of the reference space used within the elements.
void GetNodes(Vector &node_coord) const
void GetGeometricParametersFromJacobian(const DenseMatrix &J, real_t &volume, Vector &aspr, Vector &skew, Vector &ori) const
Computes geometric parameters associated with a Jacobian matrix in 2D/3D. These parameters are (1) Ar...
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
void PrintUsage(std::ostream &out) const
Print the usage message.
void PrintOptions(std::ostream &out) const
Print the options.
void AddOption(bool *var, const char *enable_short_name, const char *enable_long_name, const char *disable_short_name, const char *disable_long_name, const char *description, bool required=false)
Add a boolean option and set 'var' to receive the value. Enable/disable tags are used to set the bool...
bool Good() const
Return true if the command line options were parsed successfully.
void SetSubVector(const Array< int > &dofs, const real_t value)
Set the entries listed in dofs to the given value.
real_t Max() const
Returns the maximal element of the vector.
int Size() const
Returns the size of the vector.
void SetSize(int s)
Resize the vector to size s.
real_t * GetData() const
Return a pointer to the beginning of the Vector data.
real_t Min() const
Returns the minimal element of the vector.
Data collection with VisIt I/O routines.
virtual void Save() override
Save the collection and a VisIt root file.
virtual void RegisterField(const std::string &field_name, GridFunction *gf) override
Add a grid function to the collection and update the root file.
void VisualizeField(socketstream &sock, const char *vishost, int visport, GridFunction &gf, const char *title, int x, int y, int w, int h, const char *keys, bool vec)