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"
374 "i) Increase space dimension\n"
379 "P) View partitioning\n"
380 "m) View materials\n"
382 "B) View boundary partitioning\n"
384 "h) View element sizes, h\n"
385 "k) View element ratios, kappa\n"
386 "J) View scaled Jacobian\n"
387 "l) Plot a function\n"
388 "x) Print sub-element stats\n"
389 "f) Find physical point in reference space\n"
390 "p) Generate a partitioning\n"
391 "o) Reorder elements\n"
392 "S) Save in MFEM serial format\n"
393 "T) Save in MFEM parallel format using the current partitioning\n"
394 "V) Save in VTK format (only linear and quadratic meshes)\n"
395#ifdef MFEM_USE_NETCDF
396 "X) Save in Exodus II format (only linear and quadratic meshes)\n"
398 "D) Save as a DataCollection\n"
401 "Z) Save in MFEM format with compression\n"
416 "Choose type of refinement:\n"
417 "s) standard refinement with Mesh::UniformRefinement()\n"
418 "b) Mesh::UniformRefinement() (bisection for tet meshes)\n"
419 "u) uniform refinement with a factor\n"
420 "g) non-uniform refinement (Gauss-Lobatto) with a factor\n"
421 "n) NURBS refinement with factors\n"
422 "p) NURBS NC-patch refinement with factors\n"
423 "c) NURBS coarsening with a factor\n"
424 "l) refine locally using the region() function\n"
425 "r) random refinement with a probability\n"
442 cout <<
"enter refinement factor --> " << flush;
445 if (ref_factor <= 1 || ref_factor > 32) {
break; }
454 cout <<
"enter refinement factor, 1st dimension --> " << flush;
455 cin >> ref_factors[0];
456 cout <<
"enter refinement factor, 2nd dimension --> " << flush;
457 cin >> ref_factors[1];
460 cout <<
"enter refinement factor, 3rd dimension --> "
462 cin >> ref_factors[2];
464 for (
auto ref_factor : ref_factors)
465 if (ref_factor <= 1 || ref_factor > 32) {
break; }
467 char input_tol =
'n';
468 cout <<
"enter NURBS tolerance? [y/n] --> " << flush;
472 if (input_tol ==
'y')
474 cout <<
"enter NURBS tolerance --> " << flush;
484 cout <<
"enter default refinement factor --> " << flush;
486 if (ref_factor <= 1 || ref_factor > 32) {
break; }
488 cout <<
"enter knot vector refinement factor filename? [y/n] ---> " << flush;
489 char input_kvf =
'n';
492 if (input_kvf ==
'y')
494 cout <<
"enter filename ---> " << flush;
502 cout <<
"enter coarsening factor --> " << flush;
504 cin >> coarsen_factor;
505 if (coarsen_factor <= 1 || coarsen_factor > 32) {
break; }
507 char input_tol =
'n';
508 cout <<
"enter NURBS tolerance? [y/n] --> " << flush;
512 if (input_tol ==
'y')
514 cout <<
"enter NURBS tolerance --> " << flush;
525 for (
int i = 0; i < mesh->
GetNE(); i++)
535 marked_elements.
Append(i);
545 bool nc_simplices =
true;
547 cout <<
"enter probability --> " << flush;
550 if (probability < 0.0 || probability > 1.0) {
break; }
561 cout <<
"Current space dimension is " << curr_sdim <<
"\n";
562 cout <<
"Enter new space dimension --> " << flush;
565 if (new_sdim > curr_sdim && new_sdim <= 3)
584 cout <<
"New space dimension must be greater than current space "
585 <<
"dimension and less than 4." << endl;
592 cout <<
"enter new order for mesh curvature --> " << flush;
601 cout <<
"scaling factor ---> " << flush;
607 for (
int i = 0; i < mesh->
GetNV(); i++)
629 cout <<
"Choose a transformation:\n"
630 "u) User-defined transform through mesh-explorer::transformation()\n"
631 "a) Affine transform\n"
632 "k) Kershaw transform\n"
633 "s) Spiral transform\n"<<
"---> " << flush;
639 else if (type ==
'a')
645 cout <<
"Type of transformation matrix:\n"
649 "g) General\n" <<
" ---> " << flush;
656 if (sdim > 1) { A(1,1) = 1.0; }
657 if (sdim > 2) { A(2,2) = 1.0; }
664 cout <<
"Rotation angle (degrees) --> " << flush;
666 const real_t angle = angle_deg * M_PI / 180.0;
674 real_t a_deg, b_deg, c_deg;
675 cout <<
"Euler angles z-x-z (degrees) --> " << flush;
676 cin >> a_deg >> b_deg >> c_deg;
679 const real_t beta = b_deg * M_PI / 180.0;
680 const real_t gamma = c_deg * M_PI / 180.0;
683 const real_t cb = cos(beta ), sb = sin(beta );
684 const real_t cc = cos(gamma), sc = sin(gamma);
686 A(0,0) = ca * cc - cb * sa * sc;
687 A(0,1) = -ca * sc - cb * cc * sa;
690 A(1,0) = cc * sa + ca * cb * sc;
691 A(1,1) = ca * cb * cc - sa * sc;
702 cout <<
"Scale factors for each cartesian direction --> "
705 if (sdim > 1) { cin >> A(1,1); }
706 if (sdim > 2) { cin >> A(2,2); }
710 cout <<
"General matrix entries in column major order --> "
712 for (
int j=0; j<sdim; j++)
713 for (
int i=0; i<sdim; i++)
721 cout <<
"Warning - transformation matrix has non-positive "
722 <<
"determinant. Elements may be flattened or "
727 cout <<
"Translation vector components --> " << flush;
729 if (sdim > 1) { cin >>
b(1); }
730 if (sdim > 2) { cin >>
b(2); }
735 else if (type ==
'k')
737 cout <<
"Note: For Kershaw transformation, the input must be "
738 "Cartesian aligned with nx multiple of 6 and "
739 "both ny and nz multiples of 2."
740 "Kershaw transform works for 2D meshes also.\n" << flush;
743 cout <<
"Kershaw transform factor, epsy in (0, 1]) ---> " << flush;
747 cout <<
"Kershaw transform factor, epsz in (0, 1]) ---> " << flush;
753 else if (type ==
's')
756 "Mesh space dimension must be at least 2 "
757 "for spiral transformation.\n");
758 cout <<
"Note: For Spiral transformation, the input mesh is "
759 "assumed to be in [0,1]^D.\n" << flush;
760 real_t turns, width, gap, height = 1.0;
761 cout <<
"Number of turns: ---> " << flush;
763 cout <<
"Width of spiral arm (e.g. 0.1) ---> " << flush;
765 cout <<
"Gap between adjacent spiral arms at the end of each turn (e.g. 0.05) ---> "
770 cout <<
"Maximum spiral height ---> " << flush;
779 MFEM_ABORT(
"Transformation type not supported.");
787 cout <<
"jitter factor ---> " << flush;
794 cerr <<
"The mesh should have nodes, introduce curvature first!\n";
810 for (
int i = 0; i < fespace->
GetNE(); i++)
813 for (
int j = 0; j < dofs.
Size(); j++)
821 for (
int i = 0; i < fespace->
GetNDofs(); i++)
823 for (
int d = 0; d <
dim; d++)
830 cout <<
"move boundary nodes? [y/n] ---> " << flush;
837 for (
int i = 0; i < fespace->
GetNBE(); i++)
840 for (
int j = 0; j < vdofs.
Size(); j++)
857 real_t min_det_J, max_det_J, min_det_J_z, max_det_J_z;
858 real_t min_kappa, max_kappa, max_ratio_det_J_z;
860 max_det_J = max_kappa = max_ratio_det_J_z = -
infinity();
861 cout <<
"subdivision factor ---> " << flush;
864 bad_elems_by_geom = 0;
866 const int max_to_print = 10;
867 for (
int i = 0; i < mesh->
GetNE(); i++)
886 min_det_J_z = std::min(min_det_J_z, det_J);
887 max_det_J_z = std::max(max_det_J_z, det_J);
889 min_kappa = std::min(min_kappa,
kappa);
890 max_kappa = std::max(max_kappa,
kappa);
893 std::max(max_ratio_det_J_z, max_det_J_z/min_det_J_z);
894 min_det_J = std::min(min_det_J, min_det_J_z);
895 max_det_J = std::max(max_det_J, max_det_J_z);
896 if (min_det_J_z <= 0.0)
898 if (nz < max_to_print)
902 cout <<
"det(J) < 0 = " << min_det_J_z <<
" in element "
903 << i <<
", centered at: ";
907 bad_elems_by_geom[geom]++;
910 if (nz >= max_to_print)
912 cout <<
"det(J) < 0 for " << nz - max_to_print <<
" more elements "
915 cout <<
"\nbad elements = " << nz;
921 cout <<
"\nmin det(J) = " << min_det_J
922 <<
"\nmax det(J) = " << max_det_J
923 <<
"\nglobal ratio = " << max_det_J/min_det_J
924 <<
"\nmax el ratio = " << max_ratio_det_J_z
925 <<
"\nmin kappa = " << min_kappa
926 <<
"\nmax kappa = " << max_kappa << endl;
932 cout <<
"\npoint in physical space ---> " << flush;
933 for (
int i = 0; i < sdim; i++)
935 cin >> point_mat(i,0);
943 cout <<
"point in reference space:";
944 if (elem_ids[0] == -1)
946 cout <<
" NOT FOUND!\n";
950 cout <<
" element " << elem_ids[0] <<
", ip =";
951 cout <<
" " << ips[0].x;
954 cout <<
" " << ips[0].y;
957 cout <<
" " << ips[0].z;
966 cout <<
"What type of reordering?\n"
967 "g) Gecko edge-product minimization\n"
968 "h) Hilbert spatial sort\n"
981 int outer, inner, window, period;
982 cout <<
"Enter number of outer iterations (default 5): " << flush;
984 cout <<
"Enter number of inner iterations (default 4): " << flush;
986 cout <<
"Enter window size (default 4, beware of exponential cost): "
989 cout <<
"Enter period for window size increment (default 2): "
994 for (
int i = 0; i < outer; i++)
998 tentative, inner, window, period, seed,
true);
1000 if (cost < best_cost)
1002 ordering = tentative;
1006 cout <<
"Final cost: " << best_cost << endl;
1013 if (mk ==
'm' || mk ==
'b' || mk ==
'e' || mk ==
'v' || mk ==
'h' ||
1014 mk ==
'k' || mk ==
'J' || mk ==
'p' || mk ==
'B' || mk ==
'P')
1024 for (
int i = 0; i < mesh->
GetNE(); i++)
1032 for (
int i = 0; i < mesh->
GetNE(); i++)
1034 attr(i) = partitioning[i] + 1;
1038 if (mk ==
'b' || mk ==
'B')
1046 bdr_attr.
SetSpace(bdr_attr_fespace);
1049 for (
int i = 0; i < bdr_mesh->
GetNE(); i++)
1056 for (
int i = 0; i < bdr_mesh->
GetNE(); i++)
1058 bdr_attr(i) = bdr_partitioning[i] + 1;
1063 MFEM_WARNING(
"Unimplemented case.");
1068 MFEM_WARNING(
"Unsupported mesh dimension.");
1083 int el0 = (int)floor(
a * mesh->
GetNE());
1084 cout <<
"Generating coloring starting with element " << el0+1
1085 <<
" / " << mesh->
GetNE() << endl;
1087 for (
int i = 0; i < coloring.
Size(); i++)
1089 attr(i) = coloring[i];
1091 cout <<
"Number of colors: " << attr.
Max() + 1 << endl;
1092 for (
int i = 0; i < mesh->
GetNE(); i++)
1094 attr(i) = elem_partitioning[i] = i;
1096 cout <<
"GLVis keystrokes for mesh element visualization:\n"
1097 <<
"- F3/F4 - Shrink/Zoom the elements\n"
1098 <<
"- Ctrl+F3/F4 - 3D: cut holes in element faces \n"
1099 <<
"- F8 - 3D: toggle visible elements\n"
1100 <<
"- F9/F10 - 3D: cycle through visible elements\n";
1109 for (
int i = 0; i < mesh->
GetNE(); i++)
1119 attr(i) = -pow(-attr(i), 1.0/
real_t(
dim));
1123 attr(i) = pow(attr(i), 1.0/
real_t(
dim));
1125 h_min = min(h_min, attr(i));
1126 h_max = max(h_max, attr(i));
1128 cout <<
"h_min = " << h_min <<
", h_max = " << h_max << endl;
1134 for (
int i = 0; i < mesh->
GetNE(); i++)
1152 cout <<
"subdivision factor ---> " << flush;
1154 for (
int i = 0; i < mesh->
GetNE(); i++)
1173 for (
int k = 0; k < J.
Width(); k++)
1181 attr(i) = std::min(sJ, attr(i));
1188 cout <<
"What type of partitioning?\n"
1190 "s) Simple 1D split of the element sequence\n"
1191 "0) METIS_PartGraphRecursive (sorted neighbor lists)\n"
1192 "1) METIS_PartGraphKway (sorted neighbor lists)"
1194 "2) METIS_PartGraphVKway (sorted neighbor lists)\n"
1195 "3) METIS_PartGraphRecursive\n"
1196 "4) METIS_PartGraphKway\n"
1197 "5) METIS_PartGraphVKway\n"
1204 cout <<
"Enter nx: " << flush;
1205 cin >> nxyz[0]; np = nxyz[0];
1208 cout <<
"Enter ny: " << flush;
1209 cin >> nxyz[1]; np *= nxyz[1];
1212 cout <<
"Enter nz: " << flush;
1213 cin >> nxyz[2]; np *= nxyz[2];
1223 cout <<
"Enter number of processors: " << flush;
1227 for (
int i = 0; i < mesh->
GetNE(); i++)
1229 partitioning[i] = (
long long)i * np / mesh->
GetNE();
1235 int part_method = pk -
'0';
1236 if (part_method < 0 || part_method > 5)
1240 cout <<
"Enter number of processors: " << flush;
1249 const char part_file[] =
"partitioning.txt";
1250 ofstream opart(part_file);
1251 opart <<
"number_of_elements " << mesh->
GetNE() <<
'\n'
1252 <<
"number_of_processors " << np <<
'\n';
1253 for (
int i = 0; i < mesh->
GetNE(); i++)
1255 opart << partitioning[i] <<
'\n';
1257 cout <<
"Partitioning file: " << part_file << endl;
1261 for (
int i = 0; i < mesh->
GetNE(); i++)
1263 proc_el[partitioning[i]]++;
1265 int min_el = proc_el[0], max_el = proc_el[0];
1266 for (
int i = 1; i < np; i++)
1268 if (min_el > proc_el[i])
1270 min_el = proc_el[i];
1272 if (max_el < proc_el[i])
1274 max_el = proc_el[i];
1277 cout <<
"Partitioning stats:\n"
1279 << setw(12) <<
"minimum"
1280 << setw(12) <<
"average"
1281 << setw(12) <<
"maximum"
1282 << setw(12) <<
"total" <<
'\n';
1283 cout <<
" elements "
1284 << setw(12) << min_el
1286 << setw(12) << max_el
1287 << setw(12) << mesh->
GetNE() << endl;
1294 for (
int i = 0; i < mesh->
GetNE(); i++)
1296 attr(i) = partitioning[i] + 1;
1304 sol_sock.precision(14);
1307 sol_sock <<
"fem2d_gf_data_keys\n";
1310 mesh->
Print(sol_sock);
1317 mesh->
Print(sol_sock);
1318 for (
int i = 0; i < mesh->
GetNE(); i++)
1320 attr(i) = partitioning[i];
1335 attr.
Save(sol_sock);
1336 sol_sock <<
"RjlmAb***********";
1348 sol_sock <<
"fem3d_gf_data_keys\n";
1349 if (mk ==
'v' || mk ==
'h' || mk ==
'k' || mk ==
'J' || mk ==
'm')
1351 mesh->
Print(sol_sock);
1353 else if (mk ==
'b' || mk ==
'B')
1355 bdr_mesh->
Print(sol_sock);
1356 bdr_attr.
Save(sol_sock);
1357 sol_sock <<
"mcaaA";
1359 sol_sock <<
"pppppp" <<
"pppppp" <<
"pppppp";
1366 mesh->
Print(sol_sock);
1367 for (
int i = 0; i < mesh->
GetNE(); i++)
1369 attr(i) = partitioning[i];
1384 if (mk !=
'b' && mk !=
'B')
1386 attr.
Save(sol_sock);
1402 cout <<
"Unable to connect to "
1403 <<
vishost <<
':' << visport << endl;
1405 delete attr_fespace;
1406 delete bdr_attr_fespace;
1414 cout <<
"Enter projection space order: " << flush;
1434 sol_sock.precision(14);
1435 sol_sock <<
"solution\n" << *mesh << level << flush;
1439 cout <<
"Unable to connect to "
1440 <<
vishost <<
':' << visport << endl;
1447 const char omesh_file[] =
"mesh-explorer.mesh";
1448 ofstream omesh(omesh_file);
1449 omesh.precision(14);
1451 cout <<
"New mesh file: " << omesh_file << endl;
1456 string mesh_prefix(
"mesh-explorer.mesh."), line;
1459 cout <<
"Enter mesh file prefix or press <enter> to use \""
1460 << mesh_prefix <<
"\": " << flush;
1463 cin.ignore(std::numeric_limits<std::streamsize>::max(),
'\n');
1465 if (!line.empty()) { mesh_prefix = line; }
1467 cout <<
"Enter floating point output precision (num. digits): "
1470 for (
int i = 0; i < np; i++)
1475 omesh.precision(precision);
1476 mesh_part.
Print(omesh);
1478 cout <<
"New parallel mesh files: " << mesh_prefix <<
"<rank>" << endl;
1483 const char omesh_file[] =
"mesh-explorer.vtk";
1484 ofstream omesh(omesh_file);
1485 omesh.precision(14);
1487 cout <<
"New VTK mesh file: " << omesh_file << endl;
1490#ifdef MFEM_USE_NETCDF
1493 const char omesh_file[] =
"mesh-explorer.e";
1495 cout <<
"New Exodus II mesh file: " << omesh_file << endl;
1501 cout <<
"What type of DataCollection?\n"
1502 "p) ParaView Data Collection\n"
1503 "v) VisIt Data Collection\n"
1507 if (dk ==
'p' || dk ==
'P')
1509 const char omesh_file[] =
"mesh-explorer-paraview";
1513 int order = mesh->
GetNodes()->FESpace()->GetMaxElementOrder();
1521 cout <<
"New ParaView mesh file: " << omesh_file << endl;
1523 else if (dk ==
'v' || dk ==
'V')
1525 const char omesh_file[] =
"mesh-explorer-visit";
1529 cout <<
"New VisIt mesh file: " << omesh_file <<
"_000000.mfem_root"
1534 cout <<
"Unrecognized DataCollection type: \"" << dk <<
"\""
1542 const char omesh_file[] =
"mesh-explorer.mesh.gz";
1544 omesh.precision(14);
1546 cout <<
"New mesh file: " << omesh_file << endl;
1552 delete bdr_attr_fec;
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
virtual int GetMaxElementOrder() const
Return the maximum polynomial order over all elements.
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.
Arbitrary order "L2-conforming" discontinuous finite elements.
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
Print the mesh to the given stream using the default MFEM mesh format.
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)
void Transform(std::function< void(const Vector &, Vector &)> f)
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...
void PrintExodusII(const std::string &fpath)
Export a mesh to an Exodus II file.
int SpaceDimension() const
Dimension of the physical space containing the mesh.
void GetNodes(Vector &node_coord) const
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 UniformRefinement(int i, const DSTable &, int *, int *, int *)
Geometry::Type GetElementBaseGeometry(int i) const
virtual void RefineNURBSWithKVFactors(int rf, const std::string &kvf)
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.
void SetLevelsOfDetail(int levels_of_detail_)
Set the refinement level.
void SetHighOrderOutput(bool high_order_output_)
Sets whether or not to output the data as high-order elements (false by default).
Writer for ParaView visualization (PVD and VTU format)
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