51 v(0) =
p(0) + s*
p(1) + s*
p(2);
52 v(1) =
p(1) + s*
p(2) + s*
p(0);
55 else if (
p.Size() == 2)
73 return std::max(std::max(x - (
real_t) 0.25, -y), y - (
real_t) 1.0);
80 real_t y =
p.Size() > 1 ?
p(1) : 0.0;
81 real_t z =
p.Size() > 2 ?
p(2) : 0.0;
87 const real_t r_small = 1.0;
88 return hypot(r_big - hypot(x, y), z) - r_small;
94 return hypot(hypot(x, y), z) - r;
105 for (
int p = 0;
p < np;
p++)
108 fname << mesh_prefix <<
'.' << setfill(
'0') << setw(6) <<
p;
112 cerr <<
"Can not open mesh file: " << fname.str().c_str()
114 for (
p--;
p >= 0;
p--)
116 delete mesh_array[
p];
120 mesh_array[
p] =
new Mesh(meshin, 1, 0);
122 for (
int i = 0; i < mesh_array[
p]->GetNE(); i++)
126 for (
int i = 0; i < mesh_array[
p]->GetNBE(); i++)
131 mesh =
new Mesh(mesh_array, np);
133 for (
int p = 0;
p < np;
p++)
135 delete mesh_array[np-1-
p];
149 for (
int i = 0; i < mesh->
GetNBE(); i++)
154 for (
int j = 0; j < nv; j++)
160 for (
int i = 0; i < v2v.
Size(); i++)
174 for (
int i = 0; i < v2v.
Size(); i++)
186 for (
int i = 0; i < mesh->
GetNBE(); i++)
192 for (
int j = 0; j < nv; j++)
234 for (
int i=0; i<mesh->
GetNBE(); i++)
237 mesh->
GetNodes()->GetSubVector(vdofs, v);
245 cout <<
"\nDiscontinuous nodes not yet supported" << endl;
257 for (
int be = 0; be < mesh->
GetNBE(); be++)
260 bdr_partitioning[be] = partitioning[e];
264int main (
int argc,
char *argv[])
267 const char *mesh_file =
"../../data/beam-hex.mesh";
272 args.
AddOption(&mesh_file,
"-m",
"--mesh",
273 "Mesh file to visualize.");
275 "Load mesh from multiple processors.");
276 args.
AddOption(&refine,
"-ref",
"--refinement",
"-no-ref",
"--no-refinement",
277 "Prepare the mesh for refinement or not.");
278 args.
AddOption(&visport,
"-p",
"--send-port",
"Socket for GLVis.");
287 cout <<
"Visualize and manipulate a serial mesh:\n"
288 <<
" mesh-explorer -m <mesh_file>\n"
289 <<
"Visualize and manipulate a parallel mesh:\n"
290 <<
" mesh-explorer -np <#proc> -m <mesh_prefix>\n" << endl
298 Mesh *bdr_mesh = NULL;
301 const bool use_par_mesh = np > 0;
309 mesh =
new Mesh(mesh_file, 1, refine);
313 bdr_partitioning = 0;
315 elem_partitioning = 0;
320 mesh =
read_par_mesh(np, mesh_file, partitioning, bdr_partitioning);
348 cout <<
"boundary attribs :";
353 cout <<
'\n' <<
"material attribs :";
359 cout <<
"mesh curvature : ";
366 cout <<
"NONE" << endl;
371 cout <<
"What would you like to do?\n"
373 "c) Change curvature\n"
378 "P) View partitioning\n"
379 "m) View materials\n"
381 "B) View boundary partitioning\n"
383 "h) View element sizes, h\n"
384 "k) View element ratios, kappa\n"
385 "J) View scaled Jacobian\n"
386 "l) Plot a function\n"
387 "x) Print sub-element stats\n"
388 "f) Find physical point in reference space\n"
389 "p) Generate a partitioning\n"
390 "o) Reorder elements\n"
391 "S) Save in MFEM serial format\n"
392 "T) Save in MFEM parallel format using the current partitioning\n"
393 "V) Save in VTK format (only linear and quadratic meshes)\n"
394#ifdef MFEM_USE_NETCDF
395 "X) Save in Exodus II format (only linear and quadratic meshes)\n"
397 "D) Save as a DataCollection\n"
400 "Z) Save in MFEM format with compression\n"
415 "Choose type of refinement:\n"
416 "s) standard refinement with Mesh::UniformRefinement()\n"
417 "b) Mesh::UniformRefinement() (bisection for tet meshes)\n"
418 "u) uniform refinement with a factor\n"
419 "g) non-uniform refinement (Gauss-Lobatto) with a factor\n"
420 "n) NURBS refinement (uniform or by formula) with a factor\n"
421 "c) NURBS coarsening (uniform or by formula) with a factor\n"
422 "l) refine locally using the region() function\n"
423 "r) random refinement with a probability\n"
440 cout <<
"enter refinement factor --> " << flush;
443 if (ref_factor <= 1 || ref_factor > 32) {
break; }
452 cout <<
"enter refinement factor, 1st dimension --> " << flush;
453 cin >> ref_factors[0];
454 cout <<
"enter refinement factor, 2nd dimension --> " << flush;
455 cin >> ref_factors[1];
458 cout <<
"enter refinement factor, 3rd dimension --> "
460 cin >> ref_factors[2];
462 for (
auto ref_factor : ref_factors)
463 if (ref_factor <= 1 || ref_factor > 32) {
break; }
465 char input_tol =
'n';
466 cout <<
"enter NURBS tolerance? [y/n] ---> " << flush;
470 if (input_tol ==
'y')
472 cout <<
"enter NURBS tolerance ---> " << flush;
481 cout <<
"enter coarsening factor --> " << flush;
483 cin >> coarsen_factor;
484 if (coarsen_factor <= 1 || coarsen_factor > 32) {
break; }
486 char input_tol =
'n';
487 cout <<
"enter NURBS tolerance? [y/n] ---> " << flush;
491 if (input_tol ==
'y')
493 cout <<
"enter NURBS tolerance ---> " << flush;
504 for (
int i = 0; i < mesh->
GetNE(); i++)
514 marked_elements.
Append(i);
524 bool nc_simplices =
true;
526 cout <<
"enter probability --> " << flush;
529 if (probability < 0.0 || probability > 1.0) {
break; }
540 cout <<
"enter new order for mesh curvature --> " << flush;
549 cout <<
"scaling factor ---> " << flush;
555 for (
int i = 0; i < mesh->
GetNV(); i++)
577 cout <<
"Choose a transformation:\n"
578 "u) User-defined transform through mesh-explorer::transformation()\n"
579 "k) Kershaw transform\n"
580 "s) Spiral transform\n"<<
"---> " << flush;
586 else if (type ==
'k')
588 cout <<
"Note: For Kershaw transformation, the input must be "
589 "Cartesian aligned with nx multiple of 6 and "
590 "both ny and nz multiples of 2."
591 "Kershaw transform works for 2D meshes also.\n" << flush;
594 cout <<
"Kershaw transform factor, epsy in (0, 1]) ---> " << flush;
598 cout <<
"Kershaw transform factor, epsz in (0, 1]) ---> " << flush;
604 else if (type ==
's')
607 "Mesh space dimension must be at least 2 "
608 "for spiral transformation.\n");
609 cout <<
"Note: For Spiral transformation, the input mesh is "
610 "assumed to be in [0,1]^D.\n" << flush;
611 real_t turns, width, gap, height = 1.0;
612 cout <<
"Number of turns: ---> " << flush;
614 cout <<
"Width of spiral arm (e.g. 0.1) ---> " << flush;
616 cout <<
"Gap between adjacent spiral arms at the end of each turn (e.g. 0.05) ---> "
621 cout <<
"Maximum spiral height ---> " << flush;
630 MFEM_ABORT(
"Transformation type not supported.");
638 cout <<
"jitter factor ---> " << flush;
645 cerr <<
"The mesh should have nodes, introduce curvature first!\n";
661 for (
int i = 0; i < fespace->
GetNE(); i++)
664 for (
int j = 0; j < dofs.
Size(); j++)
672 for (
int i = 0; i < fespace->
GetNDofs(); i++)
674 for (
int d = 0; d <
dim; d++)
681 cout <<
"move boundary nodes? [y/n] ---> " << flush;
688 for (
int i = 0; i < fespace->
GetNBE(); i++)
691 for (
int j = 0; j < vdofs.
Size(); j++)
708 real_t min_det_J, max_det_J, min_det_J_z, max_det_J_z;
709 real_t min_kappa, max_kappa, max_ratio_det_J_z;
711 max_det_J = max_kappa = max_ratio_det_J_z = -
infinity();
712 cout <<
"subdivision factor ---> " << flush;
715 bad_elems_by_geom = 0;
717 const int max_to_print = 10;
718 for (
int i = 0; i < mesh->
GetNE(); i++)
737 min_det_J_z = std::min(min_det_J_z, det_J);
738 max_det_J_z = std::max(max_det_J_z, det_J);
740 min_kappa = std::min(min_kappa,
kappa);
741 max_kappa = std::max(max_kappa,
kappa);
744 std::max(max_ratio_det_J_z, max_det_J_z/min_det_J_z);
745 min_det_J = std::min(min_det_J, min_det_J_z);
746 max_det_J = std::max(max_det_J, max_det_J_z);
747 if (min_det_J_z <= 0.0)
749 if (nz < max_to_print)
753 cout <<
"det(J) < 0 = " << min_det_J_z <<
" in element "
754 << i <<
", centered at: ";
758 bad_elems_by_geom[geom]++;
761 if (nz >= max_to_print)
763 cout <<
"det(J) < 0 for " << nz - max_to_print <<
" more elements "
766 cout <<
"\nbad elements = " << nz;
772 cout <<
"\nmin det(J) = " << min_det_J
773 <<
"\nmax det(J) = " << max_det_J
774 <<
"\nglobal ratio = " << max_det_J/min_det_J
775 <<
"\nmax el ratio = " << max_ratio_det_J_z
776 <<
"\nmin kappa = " << min_kappa
777 <<
"\nmax kappa = " << max_kappa << endl;
783 cout <<
"\npoint in physical space ---> " << flush;
784 for (
int i = 0; i < sdim; i++)
786 cin >> point_mat(i,0);
794 cout <<
"point in reference space:";
795 if (elem_ids[0] == -1)
797 cout <<
" NOT FOUND!\n";
801 cout <<
" element " << elem_ids[0] <<
", ip =";
802 cout <<
" " << ips[0].x;
805 cout <<
" " << ips[0].y;
808 cout <<
" " << ips[0].z;
817 cout <<
"What type of reordering?\n"
818 "g) Gecko edge-product minimization\n"
819 "h) Hilbert spatial sort\n"
832 int outer, inner, window, period;
833 cout <<
"Enter number of outer iterations (default 5): " << flush;
835 cout <<
"Enter number of inner iterations (default 4): " << flush;
837 cout <<
"Enter window size (default 4, beware of exponential cost): "
840 cout <<
"Enter period for window size increment (default 2): "
845 for (
int i = 0; i < outer; i++)
849 tentative, inner, window, period, seed,
true);
851 if (cost < best_cost)
853 ordering = tentative;
857 cout <<
"Final cost: " << best_cost << endl;
864 if (mk ==
'm' || mk ==
'b' || mk ==
'e' || mk ==
'v' || mk ==
'h' ||
865 mk ==
'k' || mk ==
'J' || mk ==
'p' || mk ==
'B' || mk ==
'P')
875 for (
int i = 0; i < mesh->
GetNE(); i++)
883 for (
int i = 0; i < mesh->
GetNE(); i++)
885 attr(i) = partitioning[i] + 1;
889 if (mk ==
'b' || mk ==
'B')
897 bdr_attr.
SetSpace(bdr_attr_fespace);
900 for (
int i = 0; i < bdr_mesh->
GetNE(); i++)
907 for (
int i = 0; i < bdr_mesh->
GetNE(); i++)
909 bdr_attr(i) = bdr_partitioning[i] + 1;
914 MFEM_WARNING(
"Unimplemented case.");
919 MFEM_WARNING(
"Unsupported mesh dimension.");
934 int el0 = (int)floor(
a * mesh->
GetNE());
935 cout <<
"Generating coloring starting with element " << el0+1
936 <<
" / " << mesh->
GetNE() << endl;
938 for (
int i = 0; i < coloring.
Size(); i++)
940 attr(i) = coloring[i];
942 cout <<
"Number of colors: " << attr.
Max() + 1 << endl;
943 for (
int i = 0; i < mesh->
GetNE(); i++)
945 attr(i) = elem_partitioning[i] = i;
947 cout <<
"GLVis keystrokes for mesh element visualization:\n"
948 <<
"- F3/F4 - Shrink/Zoom the elements\n"
949 <<
"- Ctrl+F3/F4 - 3D: cut holes in element faces \n"
950 <<
"- F8 - 3D: toggle visible elements\n"
951 <<
"- F9/F10 - 3D: cycle through visible elements\n";
960 for (
int i = 0; i < mesh->
GetNE(); i++)
970 attr(i) = -pow(-attr(i), 1.0/
real_t(
dim));
976 h_min = min(h_min, attr(i));
977 h_max = max(h_max, attr(i));
979 cout <<
"h_min = " << h_min <<
", h_max = " << h_max << endl;
985 for (
int i = 0; i < mesh->
GetNE(); i++)
1003 cout <<
"subdivision factor ---> " << flush;
1005 for (
int i = 0; i < mesh->
GetNE(); i++)
1024 for (
int k = 0; k < J.
Width(); k++)
1032 attr(i) = std::min(sJ, attr(i));
1039 cout <<
"What type of partitioning?\n"
1041 "s) Simple 1D split of the element sequence\n"
1042 "0) METIS_PartGraphRecursive (sorted neighbor lists)\n"
1043 "1) METIS_PartGraphKway (sorted neighbor lists)"
1045 "2) METIS_PartGraphVKway (sorted neighbor lists)\n"
1046 "3) METIS_PartGraphRecursive\n"
1047 "4) METIS_PartGraphKway\n"
1048 "5) METIS_PartGraphVKway\n"
1055 cout <<
"Enter nx: " << flush;
1056 cin >> nxyz[0]; np = nxyz[0];
1059 cout <<
"Enter ny: " << flush;
1060 cin >> nxyz[1]; np *= nxyz[1];
1063 cout <<
"Enter nz: " << flush;
1064 cin >> nxyz[2]; np *= nxyz[2];
1074 cout <<
"Enter number of processors: " << flush;
1078 for (
int i = 0; i < mesh->
GetNE(); i++)
1080 partitioning[i] = (
long long)i * np / mesh->
GetNE();
1086 int part_method = pk -
'0';
1087 if (part_method < 0 || part_method > 5)
1091 cout <<
"Enter number of processors: " << flush;
1100 const char part_file[] =
"partitioning.txt";
1101 ofstream opart(part_file);
1102 opart <<
"number_of_elements " << mesh->
GetNE() <<
'\n'
1103 <<
"number_of_processors " << np <<
'\n';
1104 for (
int i = 0; i < mesh->
GetNE(); i++)
1106 opart << partitioning[i] <<
'\n';
1108 cout <<
"Partitioning file: " << part_file << endl;
1112 for (
int i = 0; i < mesh->
GetNE(); i++)
1114 proc_el[partitioning[i]]++;
1116 int min_el = proc_el[0], max_el = proc_el[0];
1117 for (
int i = 1; i < np; i++)
1119 if (min_el > proc_el[i])
1121 min_el = proc_el[i];
1123 if (max_el < proc_el[i])
1125 max_el = proc_el[i];
1128 cout <<
"Partitioning stats:\n"
1130 << setw(12) <<
"minimum"
1131 << setw(12) <<
"average"
1132 << setw(12) <<
"maximum"
1133 << setw(12) <<
"total" <<
'\n';
1134 cout <<
" elements "
1135 << setw(12) << min_el
1137 << setw(12) << max_el
1138 << setw(12) << mesh->
GetNE() << endl;
1145 for (
int i = 0; i < mesh->
GetNE(); i++)
1147 attr(i) = partitioning[i] + 1;
1155 sol_sock.precision(14);
1158 sol_sock <<
"fem2d_gf_data_keys\n";
1161 mesh->
Print(sol_sock);
1168 mesh->
Print(sol_sock);
1169 for (
int i = 0; i < mesh->
GetNE(); i++)
1171 attr(i) = partitioning[i];
1186 attr.
Save(sol_sock);
1187 sol_sock <<
"RjlmAb***********";
1199 sol_sock <<
"fem3d_gf_data_keys\n";
1200 if (mk ==
'v' || mk ==
'h' || mk ==
'k' || mk ==
'J')
1202 mesh->
Print(sol_sock);
1204 else if (mk ==
'b' || mk ==
'B')
1206 bdr_mesh->
Print(sol_sock);
1207 bdr_attr.
Save(sol_sock);
1208 sol_sock <<
"mcaaA";
1210 sol_sock <<
"pppppp" <<
"pppppp" <<
"pppppp";
1217 mesh->
Print(sol_sock);
1218 for (
int i = 0; i < mesh->
GetNE(); i++)
1220 attr(i) = partitioning[i];
1235 if (mk !=
'b' && mk !=
'B')
1237 attr.
Save(sol_sock);
1253 cout <<
"Unable to connect to "
1254 <<
vishost <<
':' << visport << endl;
1256 delete attr_fespace;
1257 delete bdr_attr_fespace;
1265 cout <<
"Enter projection space order: " << flush;
1285 sol_sock.precision(14);
1286 sol_sock <<
"solution\n" << *mesh << level << flush;
1290 cout <<
"Unable to connect to "
1291 <<
vishost <<
':' << visport << endl;
1298 const char omesh_file[] =
"mesh-explorer.mesh";
1299 ofstream omesh(omesh_file);
1300 omesh.precision(14);
1302 cout <<
"New mesh file: " << omesh_file << endl;
1307 string mesh_prefix(
"mesh-explorer.mesh."), line;
1310 cout <<
"Enter mesh file prefix or press <enter> to use \""
1311 << mesh_prefix <<
"\": " << flush;
1314 cin.ignore(std::numeric_limits<std::streamsize>::max(),
'\n');
1316 if (!line.empty()) { mesh_prefix = line; }
1318 cout <<
"Enter floating point output precision (num. digits): "
1321 for (
int i = 0; i < np; i++)
1326 omesh.precision(precision);
1327 mesh_part.
Print(omesh);
1329 cout <<
"New parallel mesh files: " << mesh_prefix <<
"<rank>" << endl;
1334 const char omesh_file[] =
"mesh-explorer.vtk";
1335 ofstream omesh(omesh_file);
1336 omesh.precision(14);
1338 cout <<
"New VTK mesh file: " << omesh_file << endl;
1341#ifdef MFEM_USE_NETCDF
1344 const char omesh_file[] =
"mesh-explorer.e";
1346 cout <<
"New Exodus II mesh file: " << omesh_file << endl;
1352 cout <<
"What type of DataCollection?\n"
1353 "p) ParaView Data Collection\n"
1354 "v) VisIt Data Collection\n"
1358 if (dk ==
'p' || dk ==
'P')
1360 const char omesh_file[] =
"mesh-explorer-paraview";
1364 int order = mesh->
GetNodes()->FESpace()->GetMaxElementOrder();
1372 cout <<
"New ParaView mesh file: " << omesh_file << endl;
1374 else if (dk ==
'v' || dk ==
'V')
1376 const char omesh_file[] =
"mesh-explorer-visit";
1380 cout <<
"New VisIt mesh file: " << omesh_file <<
"_000000.mfem_root"
1385 cout <<
"Unrecognized DataCollection type: \"" << dk <<
"\""
1393 const char omesh_file[] =
"mesh-explorer.mesh.gz";
1395 omesh.precision(14);
1397 cout <<
"New mesh file: " << omesh_file << endl;
1403 delete bdr_attr_fec;
264int main (
int argc,
char *argv[]) {
…}
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
int Size() const
Return the logical size of the array.
void DeleteAll()
Delete the whole array.
int Append(const T &el)
Append element 'el' to array, resize if necessary.
@ GaussLobatto
Closed type.
@ GaussLegendre
Open type.
@ ClosedUniform
Nodes: x_i = i/(n-1), i=0,...,n-1.
Piecewise-constant discontinuous finite elements in 2D. This class is kept only for backward compatib...
Piecewise-constant discontinuous finite elements in 3D. This class is kept only for backward compatib...
void SetPrecision(int prec)
Set the precision (number of digits) used for the text output of doubles.
Data type dense matrix using column-major storage.
void GetColumnReference(int c, Vector &col)
real_t CalcSingularvalue(const int i) const
Return the i-th singular value (decreasing order) of NxN matrix, N=1,2,3.
Abstract data type element.
Geometry::Type GetGeometryType() const
virtual void GetVertices(Array< int > &v) const =0
Get the indices defining the vertices.
int GetAttribute() const
Return element's attribute.
virtual int GetNVertices() const =0
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
static FiniteElementCollection * New(const char *name)
Factory method: return a newly allocated FiniteElementCollection according to the given name.
virtual const char * Name() const
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
DofTransformation * GetElementDofs(int elem, Array< int > &dofs) const
Returns indices of degrees of freedom of element 'elem'. The returned indices are offsets into an ldo...
int GetNDofs() const
Returns number of degrees of freedom. This is the number of Local Degrees of Freedom.
int GetNBE() const
Returns number of boundary elements in the mesh.
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 ...
int GetNE() const
Returns number of elements in the mesh.
const FiniteElementCollection * FEColl() const
DofTransformation * GetBdrElementVDofs(int i, Array< int > &vdofs) const
Returns indices of degrees of freedom for i'th boundary element. The returned indices are offsets int...
int DofToVDof(int dof, int vd, int ndofs=-1) const
Compute a single vdof corresponding to the index dof and the vector index vd.
A general function coefficient.
RefinedGeometry * Refine(Geometry::Type Geom, int Times, int ETimes=1)
const IntegrationPoint & GetCenter(int GeomType) const
Return the center of the given Geometry::Type, GeomType.
void JacToPerfJac(int GeomType, const DenseMatrix &J, DenseMatrix &PJ) const
Class for grid function - Vector with associated FE space.
virtual void Save(std::ostream &out) const
Save the GridFunction to an output stream.
void MakeOwner(FiniteElementCollection *fec_)
Make the GridFunction the owner of fec_owned and fes.
virtual void ProjectCoefficient(Coefficient &coeff)
Project coeff Coefficient to this GridFunction. The projection computation depends on the choice of t...
virtual void SetSpace(FiniteElementSpace *f)
Associate a new FiniteElementSpace with the GridFunction.
Arbitrary order H1-conforming (continuous) finite elements.
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.
Class containing a minimal description of a part (a subset of the elements) of a Mesh and its connect...
void Print(std::ostream &os) const
Write the MeshPart to a stream using the parallel format "MFEM mesh v1.2".
Class that allows serial meshes to be partitioned into MeshPart objects, typically one MeshPart at a ...
void ExtractPart(int part_id, MeshPart &mesh_part) const
Construct a MeshPart corresponding to the given part_id.
void NURBSCoarsening(int cf=2, real_t tol=1.0e-12)
int AddSegment(int v1, int v2, int attr=1)
Adds a segment to the mesh given by 2 vertices v1 and v2.
void GetElementColoring(Array< int > &colors, int el0=0)
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
NURBSExtension * NURBSext
Optional NURBS mesh extension.
int * CartesianPartitioning(int nxyz[])
void GeneralRefinement(const Array< Refinement > &refinements, int nonconforming=-1, int nc_limit=0)
int GetAttribute(int i) const
Return the attribute of element i.
int AddQuad(int v1, int v2, int v3, int v4, int attr=1)
Adds a quadrilateral to the mesh given by 4 vertices v1 through v4.
const FiniteElementSpace * GetNodalFESpace() const
void PrintCharacteristics(Vector *Vh=NULL, Vector *Vk=NULL, std::ostream &os=mfem::out)
Compute and print mesh characteristics such as number of vertices, number of elements,...
int AddTriangle(int v1, int v2, int v3, int attr=1)
Adds a triangle to the mesh given by 3 vertices v1 through v3.
real_t GetGeckoElementOrdering(Array< int > &ordering, int iterations=4, int window=4, int period=2, int seed=0, bool verbose=false, real_t time_limit=0)
void FinalizeTopology(bool generate_bdr=true)
Finalize the construction of the secondary topology (connectivity) data of a Mesh.
virtual void Print(std::ostream &os=mfem::out, const std::string &comments="") const
void PrintWithPartitioning(int *partitioning, std::ostream &os, int elem_attr=0) const
Prints the mesh with boundary elements given by the boundary of the subdomains, so that the boundary ...
int AddVertex(real_t x, real_t y=0.0, real_t z=0.0)
int GetNE() const
Returns number of elements.
int Dimension() const
Dimension of the reference space used within the elements.
void RandomRefinement(real_t prob, bool aniso=false, int nonconforming=-1, int nc_limit=0)
Refine each element with given probability. Uses GeneralRefinement.
const Element * GetBdrElement(int i) const
Return pointer to the i'th boundary element object.
void ReorderElements(const Array< int > &ordering, bool reorder_vertices=true)
static Mesh MakeRefined(Mesh &orig_mesh, int ref_factor, int ref_type)
Create a refined (by any factor) version of orig_mesh.
real_t GetElementSize(int i, int type=0)
Get the size of the i-th element relative to the perfect reference element.
void GetElementTransformation(int i, IsoparametricTransformation *ElTr) const
Builds the transformation defining the i-th element in ElTr. ElTr must be allocated in advance and wi...
int SpaceDimension() const
Dimension of the physical space containing the mesh.
void GetNodes(Vector &node_coord) const
void PrintExodusII(const std::string fpath)
Export a mesh to an Exodus II file.
int GetNV() const
Returns number of vertices. Vertices are only at the corners of elements, where you would expect them...
void GetHilbertElementOrdering(Array< int > &ordering)
void GetBdrElementAdjacentElement(int bdr_el, int &el, int &info) const
For the given boundary element, bdr_el, return its adjacent element and its info, i....
void GetElementCenter(int i, Vector ¢er)
static void PrintElementsByGeometry(int dim, const Array< int > &num_elems_by_geom, std::ostream &os)
Auxiliary method used by PrintCharacteristics().
int GetNBE() const
Returns number of boundary elements.
virtual void Finalize(bool refine=false, bool fix_orientation=false)
Finalize the construction of a general Mesh.
virtual int FindPoints(DenseMatrix &point_mat, Array< int > &elem_ids, Array< IntegrationPoint > &ips, bool warn=true, InverseElementTransformation *inv_trans=NULL)
Find the ids of the elements that contain the given points, and their corresponding reference coordin...
void NewNodes(GridFunction &nodes, bool make_owner=false)
Replace the internal node GridFunction with the given GridFunction.
virtual void NURBSUniformRefinement(int rf=2, real_t tol=1.0e-12)
Refine NURBS mesh, with an optional refinement factor, generally anisotropic.
void EnsureNCMesh(bool simplices_nonconforming=false)
void PrintVTK(std::ostream &os)
virtual void SetCurvature(int order, bool discont=false, int space_dim=-1, int ordering=1)
Set the curvature of the mesh nodes using the given polynomial degree.
void Transform(void(*f)(const Vector &, Vector &))
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
Geometry::Type GetElementBaseGeometry(int i) const
int * GeneratePartitioning(int nparts, int part_method=1)
Array< int > attributes
A list of all unique element attributes used by the Mesh.
const real_t * GetVertex(int i) const
Return pointer to vertex i's coordinates.
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
void PrintOptions(std::ostream &out) const
Print the options.
void PrintHelp(std::ostream &out) const
Print the help message.
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.
bool Help() const
Return true if we are flagged to print the help message.
void PrintError(std::ostream &out) const
Print the error message.
Helper class for ParaView visualization data.
void SetHighOrderOutput(bool high_order_output_)
void SetLevelsOfDetail(int levels_of_detail_)
void Randomize(int seed=0)
Set random values in the vector.
void Print(std::ostream &out=mfem::out, int width=8) const
Prints vector to stream out.
void SetSubVector(const Array< int > &dofs, const real_t value)
Set the entries listed in dofs to the given value.
real_t Norml2() const
Returns the l2 norm of the vector.
real_t Max() const
Returns the maximal element of the vector.
Data collection with VisIt I/O routines.
void Save() override
Save the collection and a VisIt root file.
bool is_open()
True if the socketstream is open, false otherwise.
Mesh * skin_mesh(Mesh *mesh)
real_t f(const Vector &p)
Mesh * read_par_mesh(int np, const char *mesh_prefix, Array< int > &partitioning, Array< int > &bdr_partitioning)
void transformation(const Vector &p, Vector &v)
void recover_bdr_partitioning(const Mesh *mesh, const Array< int > &partitioning, Array< int > &bdr_partitioning)
real_t region(const Vector &p)
real_t infinity()
Define a shortcut for std::numeric_limits<double>::infinity()
std::string MakeParFilename(const std::string &prefix, const int myid, const std::string suffix, const int width)
Construct a string of the form "<prefix><myid><suffix>" where the integer myid is padded with leading...
GeometryRefiner GlobGeometryRefiner
real_t rand_real()
Generate a random real_t number in the interval [0,1) using rand().
L2_FECollection DG_FECollection
Declare an alternative name for L2_FECollection = DG_FECollection.
real_t p(const Vector &x, real_t t)
std::array< int, NCMesh::MaxFaceNodes > nodes