1#include <libmesh/distributed_mesh.h>
2#include <libmesh/dof_map.h>
3#include <libmesh/equation_systems.h>
4#include <libmesh/linear_implicit_system.h>
5#include <libmesh/mesh.h>
6#include <libmesh/mesh_communication.h>
7#include <libmesh/mesh_generation.h>
8#include <libmesh/numeric_vector.h>
9#include <libmesh/replicated_mesh.h>
10#include <libmesh/enum_norm_type.h>
11#include <libmesh/enum_to_string.h>
13#include <libmesh/abaqus_io.h>
14#include <libmesh/dyna_io.h>
15#include <libmesh/exodusII_io.h>
16#include <libmesh/gmsh_io.h>
17#include <libmesh/nemesis_io.h>
18#include <libmesh/stl_io.h>
19#include <libmesh/vtk_io.h>
20#include <libmesh/tetgen_io.h>
35 const Real & x = p(0);
36 const Real & y = p(1);
47 const Real & x = p(0);
48 const Real & y = p(1);
50 return sin(x) + cos(y);
60 const Real & x = p(0);
61 const Real & y = p(1);
62 const Real & z = p(2);
65 param.
get<
short>(
"face") : -1;
68 auto is_on_face = [facedim](
Real r,
short rdim) {
74 return (std::abs(numerator - std::round(numerator)) <
104#ifdef LIBMESH_HAVE_VTK
109#ifdef LIBMESH_HAVE_EXODUS_API
121#ifndef LIBMESH_USE_COMPLEX_NUMBERS
169#if defined(LIBMESH_HAVE_EXODUS_API) && defined(LIBMESH_HAVE_NEMESIS_API)
180#ifndef LIBMESH_USE_COMPLEX_NUMBERS
186#ifdef LIBMESH_HAVE_GZSTREAM
210#ifdef LIBMESH_HAVE_TETGEN
226#ifdef LIBMESH_HAVE_VTK
246 std::set<Elem *> elements {
mesh.elements_begin(),
mesh.elements_end()};
247 for (
Elem * elem : elements)
249 const Point center = elem->vertex_average();
250 const int xn =
int(center(0)*3);
251 const int yn =
int(center(1)*3);
258 vtk.
write(
"read_elem_ids_test.pvtu");
269 mesh.
read(
"read_elem_ids_test.pvtu");
275 for (
const auto & elem :
mesh.element_ptr_range())
277 const Point center = elem->vertex_average();
278 const int xn =
int(center(0)*3);
279 const int yn =
int(center(1)*3);
280 const dof_id_type expected_id = start_id + yn*5 + xn;
281 CPPUNIT_ASSERT_EQUAL(elem->id(), expected_id);
296 for (
const auto & elem :
mesh.element_ptr_range())
298 const Point center = elem->vertex_average();
299 const int xn =
int(center(0)*3);
300 const int yn =
int(center(1)*3);
302 elem->subdomain_id() = new_id;
307 vtk.
write(
"read_sbd_ids_test.pvtu");
318 mesh.
read(
"read_sbd_ids_test.pvtu");
324 for (
const auto & elem :
mesh.element_ptr_range())
326 const Point center = elem->vertex_average();
327 const int xn =
int(center(0)*3);
328 const int yn =
int(center(1)*3);
330 CPPUNIT_ASSERT_EQUAL(elem->subdomain_id(), expected_id);
337#ifdef LIBMESH_HAVE_EXODUS_API
341 const std::vector<unique_id_type> & expected_unique_ids)
344#ifdef LIBMESH_ENABLE_UNIQUE_ID
353 exii.
read(
"meshes/nontrivial_node_num_map.exo");
384 {0, 2, 8, 7, 1, 4, 6, 5, 3});
393 {0, 4, 1, 8, 5, 7, 6, 3, 2});
398 const std::vector<unique_id_type> & expected_unique_ids)
401#ifdef LIBMESH_ENABLE_UNIQUE_ID
410 exii.
read(
"meshes/nontrivial_elem_num_map.exo");
413 auto expected_it = expected_unique_ids.begin();
414 for (
const auto & elem :
mesh.element_ptr_range())
421 CPPUNIT_ASSERT_EQUAL(elem->unique_id(), *expected_it++);
444 std::vector<unique_id_type> expected_unique_ids = {
445 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
446 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45};
448 true, expected_unique_ids);
455 std::vector<unique_id_type> expected_unique_ids(35);
456 std::iota(expected_unique_ids.begin(), expected_unique_ids.end(), 50);
458 false, expected_unique_ids);
488 CPPUNIT_ASSERT_EQUAL(std::string(header_info.
title.data()), std::string(
"read_header_test.e"));
489 CPPUNIT_ASSERT_EQUAL(header_info.
num_dim, 2);
490 CPPUNIT_ASSERT_EQUAL(header_info.
num_elem, 9);
495 CPPUNIT_ASSERT_EQUAL(header_info.
num_edge, 0);
507 exii.
read(
"meshes/mesh_with_low_order_edge_blocks.e");
526 CPPUNIT_ASSERT_EQUAL(
static_cast<std::size_t
>(26), bi.
n_boundary_ids());
533 CPPUNIT_ASSERT(std::binary_search(edge_list.begin(), edge_list.end(), std::make_tuple(4, 1, 8007)));
534 CPPUNIT_ASSERT(std::binary_search(edge_list.begin(), edge_list.end(), std::make_tuple(10, 6, 8001)));
537 CPPUNIT_ASSERT(!std::binary_search(edge_list.begin(), edge_list.end(), std::make_tuple(1, 8, 8009)));
538 CPPUNIT_ASSERT(!std::binary_search(edge_list.begin(), edge_list.end(), std::make_tuple(2, 10, 9011)));
557 exii.
read(
"meshes/Cube_With_Sidesets.e");
574 CPPUNIT_ASSERT_EQUAL(
static_cast<std::size_t
>(6), bi.
n_boundary_ids());
582 bool has_bcid = bc_ids.count(i);
584 CPPUNIT_ASSERT(has_bcid);
590 std::vector<int> side_counts(6, 0);
595 for (
const auto & elem :
mesh.active_local_element_ptr_range())
600 for (
unsigned short side=0; side<elem->n_sides(); side++)
602 if (elem->neighbor_ptr(side))
607 std::vector<boundary_id_type> bids;
609 side_counts[bids[0]-1]++;
610 CPPUNIT_ASSERT_EQUAL(libmesh_side_to_bcid[side], bids[0]);
615 for (
auto bc_count : side_counts)
619 CPPUNIT_ASSERT_EQUAL(bc_count, 9);
627 exii.
write(
"Cube_With_Sidesets_out.e");
632 template <
typename MeshType,
typename IOType>
649 IOType meshoutput(
mesh);
651 meshoutput.write_equation_systems(filename, es);
657 IOType meshinput(
mesh);
660 if (meshinput.is_parallel_format())
670 meshinput.read(filename);
671 if (!meshinput.is_parallel_format())
681#ifdef LIBMESH_USE_COMPLEX_NUMBERS
682 meshinput.copy_nodal_solution(sys,
"testn",
"r_n");
684 meshinput.copy_nodal_solution(sys,
"testn",
"n");
694 LIBMESH_ASSERT_NUMBERS_EQUAL
702 { LOG_UNIT_TEST; testCopyNodalSolutionImpl<ReplicatedMesh,ExodusII_IO>(
"repl_with_nodal_soln.e"); }
705 { LOG_UNIT_TEST; testCopyNodalSolutionImpl<DistributedMesh,ExodusII_IO>(
"dist_with_nodal_soln.e"); }
707#if defined(LIBMESH_HAVE_NEMESIS_API)
709 { LOG_UNIT_TEST; testCopyNodalSolutionImpl<ReplicatedMesh,Nemesis_IO>(
"repl_with_nodal_soln.nem"); }
712 { LOG_UNIT_TEST; testCopyNodalSolutionImpl<DistributedMesh,Nemesis_IO>(
"dist_with_nodal_soln.nem"); }
716 template <
typename MeshType,
typename IOType>
735 IOType meshinput(
mesh);
738 std::set<std::string> sys_list;
739 meshinput.write_equation_systems(filename, es, &sys_list);
742 meshinput.write_element_data(es);
748 IOType meshinput(
mesh);
751 if (meshinput.is_parallel_format())
763 meshinput.read(filename);
764 if (!meshinput.is_parallel_format())
774#ifdef LIBMESH_USE_COMPLEX_NUMBERS
775 meshinput.copy_elemental_solution(sys,
"teste",
"r_e");
776 meshinput.copy_elemental_solution(sys,
"teste_no_p",
"r_e_no_p");
777 meshinput.copy_elemental_solution(sys,
"teste_xyz",
"r_e_xyz");
779 meshinput.copy_elemental_solution(sys,
"teste",
"e");
780 meshinput.copy_elemental_solution(sys,
"teste_no_p",
"e_no_p");
781 meshinput.copy_elemental_solution(sys,
"teste_xyz",
"e_xyz");
791 LIBMESH_ASSERT_NUMBERS_EQUAL
793 LIBMESH_ASSERT_NUMBERS_EQUAL
795 LIBMESH_ASSERT_NUMBERS_EQUAL
803 { LOG_UNIT_TEST; testCopyElementSolutionImpl<ReplicatedMesh,ExodusII_IO>(
"repl_with_elem_soln.e"); }
806 { LOG_UNIT_TEST; testCopyElementSolutionImpl<DistributedMesh,ExodusII_IO>(
"dist_with_elem_soln.e"); }
808#if defined(LIBMESH_HAVE_NEMESIS_API)
810 { LOG_UNIT_TEST; testCopyElementSolutionImpl<ReplicatedMesh,Nemesis_IO>(
"repl_with_elem_soln.nem"); }
813 { LOG_UNIT_TEST; testCopyElementSolutionImpl<DistributedMesh,Nemesis_IO>(
"dist_with_elem_soln.nem"); }
819 template <
typename MeshType,
typename IOType>
837 std::set<std::string> sys_list;
853 nem_io.
read(filename);
858#ifdef LIBMESH_USE_COMPLEX_NUMBERS
865 CPPUNIT_ASSERT_EQUAL(
int(sys.solution->size()), 1);
872 { LOG_UNIT_TEST; testSingleElementImpl<ReplicatedMesh,Nemesis_IO>(
"repl_with_single_elem.nem"); }
875 { LOG_UNIT_TEST; testSingleElementImpl<DistributedMesh,Nemesis_IO>(
"dist_with_single_elem.nem"); }
879#ifndef LIBMESH_USE_COMPLEX_NUMBERS
884 template <
typename MeshType,
typename IOType>
912 for (
const auto & elem :
mesh.active_local_element_ptr_range())
914 const Point & p = elem->vertex_average();
931 IOType meshinput(
mesh);
934 std::set<std::string> sys_list;
935 meshinput.write_equation_systems(filename, es, &sys_list);
938 meshinput.write_element_data(es);
944 IOType meshinput(
mesh);
947 if (meshinput.is_parallel_format())
964 meshinput.read(filename);
965 if (!meshinput.is_parallel_format())
972 meshinput.copy_elemental_solution(sys,
"teste_x",
"e_x");
973 meshinput.copy_elemental_solution(sys,
"teste_y",
"e_y");
974 meshinput.copy_elemental_solution(sys,
"teste_no_p_x",
"e_no_p_x");
975 meshinput.copy_elemental_solution(sys,
"teste_no_p_y",
"e_no_p_y");
984 LIBMESH_ASSERT_NUMBERS_EQUAL
986 LIBMESH_ASSERT_NUMBERS_EQUAL
988 LIBMESH_ASSERT_NUMBERS_EQUAL
990 LIBMESH_ASSERT_NUMBERS_EQUAL
997 { LOG_UNIT_TEST; testCopyElementVectorImpl<ReplicatedMesh, ExodusII_IO>(
"repl_with_elem_vec.e"); }
1000 { LOG_UNIT_TEST; testCopyElementVectorImpl<DistributedMesh,ExodusII_IO>(
"dist_with_elem_vec.e"); }
1002#if defined(LIBMESH_HAVE_NEMESIS_API)
1004 { LOG_UNIT_TEST; testCopyElementVectorImpl<ReplicatedMesh,Nemesis_IO>(
"repl_with_elem_vec.nem"); }
1007 { LOG_UNIT_TEST; testCopyElementVectorImpl<DistributedMesh,Nemesis_IO>(
"dist_with_elem_vec.nem"); }
1015 const Real scalar_value = 42.;
1016 const Real xyz_value = 84.;
1017 const std::vector<Real> vector_values = {10., 20., 30.};
1028 const auto xyz_var =
1030 const auto vec_var =
1034 (
mesh, 2, 2, 2, 0., 1., 0., 1., 0., 1.,
HEX8);
1040 std::vector<dof_id_type> dof_indices;
1041 for (
const auto & elem :
mesh.element_ptr_range())
1044 for (
unsigned int i=0; i<dof_indices.size(); ++i)
1045 sys.
solution->set(dof_indices[i], i);
1047 sys.
solution->set(elem->dof_number(sys.
number(), c_var, 0), scalar_value);
1048 sys.
solution->set(elem->dof_number(sys.
number(), xyz_var, 0), xyz_value);
1052 cast_int<unsigned int>(comp)),
1053 vector_values[comp]);
1061 std::set<std::string> sys_list;
1065 sys_list = {
"SimpleSystem"};
1068 (es, &sys_list,
"_elem_corner_");
1073 std::vector<std::string> file_var_names =
1083 std::vector<Real> expected_values =
1085 scalar_value, xyz_value, vector_values[0], vector_values[1], vector_values[2]};
1099 exii.
read(
"elemental_from_nodal.e");
1110 for (
const auto & elem :
mesh.active_element_ptr_range())
1114 LIBMESH_ASSERT_FP_EQUAL
1125 std::string &,
const std::string &),
1128 const bool write_discontinuous =
false,
1129 const std::vector<FEType> earlier_vars = {},
1130 const std::vector<FEType> later_vars = {})
1137 const bool is_tensor = (
Elem::build(elem_type)->n_sides() ==
dim * 2);
1146 const std::string filename =
1147 "side_discontinuous_"+Utility::enum_to_string<ElemType>(elem_type)+(write_discontinuous?
"_disc":
"")+
".e";
1156 for (
auto vartype : earlier_vars)
1157 sys.add_variable(
"earlier_"+
std::to_string(varnum++), vartype);
1162 for (
auto vartype : later_vars)
1163 sys.add_variable(
"later_"+
std::to_string(varnum++), vartype);
1167 (
mesh, nx, ny, nz, 0., 1., 0., 1., 0., 1., elem_type);
1170 (
mesh, nx, ny, 0., 1., 0., 1., elem_type);
1173 (
mesh, nx, 0., 1., elem_type);
1177 CPPUNIT_ASSERT_LESS(n_true_nodes, n_true_elem);
1179 const unsigned int our_ny =
dim>1 ? ny : 1;
1180 const unsigned int our_nz =
dim>2 ? nz : 1;
1183 CPPUNIT_ASSERT_LESSEQUAL(n_true_elem, min_n_elem);
1185 for (
const auto & elem :
mesh.active_local_element_ptr_range())
1188 if (!elem->neighbor_ptr(s) || elem->neighbor_ptr(s)->id() < elem->id())
1191 auto side = elem->build_side_ptr(s);
1192 n_fake_nodes += side->n_nodes();
1198 const dof_id_type expected_fakes = [elem_type]() {
1204 return 3*nx*ny + nx + ny;
1207 return 2*nx*ny + nx + ny;
1209 return 48*nx*ny*nz + 4*(nx*ny+nx*nz+ny*nz);
1211 return 3*nx*ny*nz + nx*ny + nx*nz + ny*nz;
1217 CPPUNIT_ASSERT_EQUAL(n_fake_elem, expected_fakes);
1227 exii.write_added_sides(
true);
1229 if (write_discontinuous)
1230 exii.write_discontinuous_equation_systems(filename, es);
1232 exii.write_equation_systems(filename, es);
1242 exii.read(filename);
1246 CPPUNIT_ASSERT_EQUAL(
mesh.
n_elem(), n_true_elem + n_fake_elem);
1247 if (write_discontinuous)
1251 n_true_elem*nodes_per_elem + n_fake_nodes);
1254 CPPUNIT_ASSERT_EQUAL(
mesh.
n_nodes(), n_true_nodes + n_fake_nodes);
1265#ifdef LIBMESH_USE_COMPLEX_NUMBERS
1266 exii.copy_nodal_solution(sys,
"ul",
"r_u");
1268 exii.copy_nodal_solution(sys,
"ul",
"u");
1272 const std::string nullstr;
1273 const std::string facestr =
"face";
1278#ifdef LIBMESH_ENABLE_EXCEPTIONS
1279 bool threw_exception =
false;
1283 for (
const auto & elem :
mesh.active_local_element_ptr_range())
1286 if (elem->dim() ==
dim)
1289 std::vector<dof_id_type> dof_indices;
1296 const Point normal = [elem](){
1297 if (elem->dim() == 2)
1298 return Point((elem->point(1) - elem->point(0)).cross
1299 (elem->point(2) - elem->point(0)));
1300 else if (elem->dim() == 1)
1302 (elem->point(1)(1)-elem->point(0)(1),
1303 elem->point(0)(0)-elem->point(1)(0));
1314 libmesh_assert_less(std::abs(normal(1)),
TOLERANCE);
1315 libmesh_assert_less(std::abs(normal(2)),
TOLERANCE);
1317 else if (std::abs(normal(1)) >
TOLERANCE)
1320 libmesh_assert_less(std::abs(normal(2)),
TOLERANCE);
1325 libmesh_assert_greater(std::abs(normal(2)),
TOLERANCE);
1327 libmesh_assert_greater_equal(faceval, 0);
1328 es.parameters.set<
short>(facestr) = faceval;
1333 const Point node_pt = elem->point(i);
1334 const Real nodal_coef =
1336 const Real exact_val =
1338 (node_pt, es.parameters, nullstr,
1340 LIBMESH_ASSERT_FP_EQUAL
1341 (nodal_coef, exact_val,
1342 std::max(
Real(2),nodal_coef+exact_val)*
1348#ifdef LIBMESH_ENABLE_EXCEPTIONS
1351 threw_exception =
true;
1355 if (!threw_exception)
1357 CPPUNIT_ASSERT(!threw_exception);
1361 CPPUNIT_ASSERT_EQUAL(n_side_nodes, n_fake_nodes);
1526#if defined(LIBMESH_HAVE_EXODUS_API) && defined(LIBMESH_HAVE_NEMESIS_API)
1527 template <
typename MeshType>
1545 nem.
read(
"test_nemesis_read.nem");
1553 { LOG_UNIT_TEST; testNemesisReadImpl<ReplicatedMesh>(); }
1556 { LOG_UNIT_TEST; testNemesisReadImpl<DistributedMesh>(); }
1564 for (
auto & elem :
mesh.element_ptr_range())
1566 Point master_pt = {};
1569 if (elem->dim() > 0)
1570 master_pt(0) = 0.25;
1572 if (elem->dim() > 1)
1573 master_pt(1) = -0.25;
1575 if (elem->dim() > 2)
1576 master_pt(2) = 0.75;
1583 CPPUNIT_ASSERT((inverse_pt-master_pt).norm() <
TOLERANCE);
1585 CPPUNIT_ASSERT(elem->contains_point(physical_pt));
1588 std::set<subdomain_id_type> my_subdomain { elem->subdomain_id() };
1592 std::set<const Elem * > located_elems;
1593 (*locator)(physical_pt, located_elems, &my_subdomain);
1595 CPPUNIT_ASSERT(located_elems.count(elem));
1608 bool found_the_quad =
false;
1610 for (
auto & elem :
mesh.element_ptr_range())
1615 CPPUNIT_ASSERT_EQUAL(elem->type(),
QUAD9);
1616 found_the_quad =
true;
1618 for (
unsigned int n=0; n != 9; ++n)
1619 CPPUNIT_ASSERT_EQUAL
1620 (elem->node_ref(n).get_extra_datum<
Real>(weight_index),
1623 CPPUNIT_ASSERT_EQUAL(elem->point(0)(0),
Real(0.5));
1624 CPPUNIT_ASSERT_EQUAL(elem->point(0)(1),
Real(0.5));
1625 CPPUNIT_ASSERT_EQUAL(elem->point(1)(0),
Real(1.5));
1626 CPPUNIT_ASSERT_EQUAL(elem->point(1)(1),
Real(0.5));
1627 CPPUNIT_ASSERT_EQUAL(elem->point(2)(0),
Real(1.5));
1628 CPPUNIT_ASSERT_EQUAL(elem->point(2)(1),
Real(1.5));
1629 CPPUNIT_ASSERT_EQUAL(elem->point(3)(0),
Real(0.5));
1630 CPPUNIT_ASSERT_EQUAL(elem->point(3)(1),
Real(1.5));
1631 CPPUNIT_ASSERT(elem->has_affine_map());
1633 for (
unsigned int v=0; v != 4; ++v)
1634 CPPUNIT_ASSERT_EQUAL(elem->point(v)(2),
Real(0));
1639 CPPUNIT_ASSERT(found_the_quad);
1687 dyna.
read(
"meshes/1_quad.bxt.gz");
1708#ifdef LIBMESH_ENABLE_EXCEPTIONS
1709 std::string what =
"";
1713 gmsh_io.
read(
"meshes/block.msh");
1721 std::regex msg_regex(
"outside entity physical bounding box");
1722 CPPUNIT_ASSERT(std::regex_search(what, msg_regex));
1735 gmsh_io.
read(
"meshes/circle.msh");
1750 gmsh_io.
read(
"meshes/bcid_overlap.msh");
1756 std::string(
"srfBC4A"));
1758 std::string(
"srfBC4B"));
1762 std::string(
"volBC3A"));
1764 std::string(
"volBC3B"));
1776 stl_io.
read(
"meshes/Cluster_34.stl");
1791 stl_io.
read(
"meshes/engraving.stl");
1800#ifdef LIBMESH_HAVE_TETGEN
1808 tetgen_io.
read(
"meshes/tetgen_one_tet10.ele");
1822 CPPUNIT_ASSERT(elem);
1825 bool have_elem = elem;
1827 CPPUNIT_ASSERT(have_elem);
1847 dyna.
read(
"meshes/1_quad.bxt.gz");
1868 dyna.
read(
"meshes/25_quad.bxt.gz");
1883 for (
const auto & elem :
mesh.active_element_ptr_range())
1887 LIBMESH_ASSERT_FP_EQUAL(
Real(0.04), elem->volume(),
TOLERANCE);
1889 for (
unsigned int n=0; n != 9; ++n)
1890 CPPUNIT_ASSERT_EQUAL
1891 (elem->node_ref(n).get_extra_datum<
Real>(weight_index),
1894 unsigned int n_neighbors = 0, n_neighbors_expected = 2;
1895 for (
unsigned int side=0; side != 4; ++side)
1896 if (elem->neighbor_ptr(side))
1898 Point c = elem->vertex_average();
1900 if (c(0) > 0.2 && c(0) < 0.8)
1901 n_neighbors_expected++;
1902 if (c(1) > 0.2 && c(1) < 0.8)
1903 n_neighbors_expected++;
1905 CPPUNIT_ASSERT_EQUAL(n_neighbors, n_neighbors_expected);
1910#ifdef LIBMESH_HAVE_SOLVER
1911#ifdef LIBMESH_ENABLE_CONSTRAINTS
1927 for (
const auto elem :
mesh.element_ptr_range())
1928 order = std::max(order,
int(elem->default_order()));
1930 CPPUNIT_ASSERT (order > 0);
1934 std::unique_ptr<MeshBase> mesh_clone =
mesh.
clone();
1935 CPPUNIT_ASSERT(*mesh_clone ==
mesh);
1950 std::set<unsigned int> skip_dimensions {0};
1951 const Real L2_norm =
1955 LIBMESH_ASSERT_FP_EQUAL(L2_norm, expected_norms[0], my_tolerance);
1956 const Real Linf_norm =
1959 LIBMESH_ASSERT_FP_EQUAL(Linf_norm, expected_norms[1], my_tolerance);
1960 const Real H1_norm =
1963 LIBMESH_ASSERT_FP_EQUAL(H1_norm, expected_norms[2], my_tolerance);
1964 const Real W1inf_norm =
1968 LIBMESH_ASSERT_FP_EQUAL(W1inf_norm, expected_norms[3], 10*my_tolerance);
1977 dyna.
read(filename);
1999 {{0.9639857809698268, 1.839870171669186,
2000 0.7089812562241862, 1.306121188539059}});
2009 {{3.22612556930183, 1.97405365384733,
2010 2.53376235803176, 1.41374070517223}});
2019 {{2.2812154374012, 1.974049990211937,
2020 1.791640772215248, 1.413679237529376}});
2029 {{0.963612880188165, 1.82329452603503,
2030 0.707998701597943, 1.31399222566683}});
2034 std::array<Real, 4> expected_norms,
2035 bool use_disc_bex =
false)
2049 exii.
read(filename);
2066 exii.
write(
"exodus_file_mapping_out.e");
2069#ifdef LIBMESH_HAVE_VTK
2073 vtkout.
write(
"vtk_file_mapping_out.pvtu");
2084 {{2.2812154374012, 1.974049990211937,
2085 1.791640772215248, 1.413679237529376}});
2094 {{2.03496953073072, 1.97996853164955,
2095 1.18462134113435, 1.03085301158959}});
2103 {{1.26865962862531, 1.42562070158386,
2104 1.54905363492342, 1.29782906548366}});
2112 {{0.963612880188165, 1.82329452603503,
2113 0.707998701597943, 1.31399222566683}});
2129 {{2.28234312456534, 1.97439548757586,
2130 1.79290449809266, 1.41075128955985}},
2140 {{2.03496953073072, 1.97996853164955,
2141 1.18462134113435, 1.03085301158959}},
2150 {{1.26877626663365, 1.42553698909339,
2151 1.54810114917177, 1.29792704408979}},
2160 {{0.963855209590556, 1.8234396424318,
2161 0.708286572453382, 1.31468940958327}},
void ErrorVector unsigned int
void max(const T &r, T &o, Request &req) const
The AbaqusIO class is a preliminary implementation for reading Abaqus mesh files in ASCII format.
virtual void read(const std::string &name) override
This method implements reading a mesh from a specified file.
The BoundaryInfo class contains information relevant to boundary conditions including storing faces,...
std::size_t n_boundary_ids() const
std::string & sideset_name(boundary_id_type id)
void boundary_ids(const Node *node, std::vector< boundary_id_type > &vec_to_fill) const
Fills a user-provided std::vector with the boundary ids associated with Node node.
const std::set< boundary_id_type > & get_boundary_ids() const
std::vector< BCTuple > build_edge_list() const
Create a list of (element_id, edge_id, boundary_id) tuples for all relevant edges.
const std::map< boundary_id_type, std::string > & get_sideset_name_map() const
This class handles the numbering of degrees of freedom on a mesh.
dof_id_type n_constrained_dofs() const
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
unique_id_type unique_id() const
Reading and writing meshes in (a subset of) LS-DYNA format.
virtual void read(const std::string &name) override
Reads in a mesh in the Dyna format from the ASCII file given by name.
This is the base class from which all geometric element types are derived.
static std::unique_ptr< Elem > build(const ElemType type, Elem *p=nullptr)
static const unsigned int type_to_dim_map[INVALID_ELEM]
This array maps the integer representation of the ElemType enum to the geometric dimension of the ele...
virtual Real volume() const
This is the EquationSystems class.
Parameters parameters
Data structure holding arbitrary parameters.
virtual void init()
Initialize all the systems.
virtual System & add_system(std::string_view system_type, std::string_view name)
Add the system of type system_type named name to the systems array.
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs...
virtual void write(const std::string &fname) override
This method implements writing a mesh to a specified file.
ExodusHeaderInfo read_header(const std::string &name)
Read only the header information, instead of the entire mesh.
virtual void write_equation_systems(const std::string &fname, const EquationSystems &es, const std::set< std::string > *system_names=nullptr) override
Writes out the solution for no specific time or timestep.
static int get_exodus_version()
void write_element_data_from_discontinuous_nodal_data(const EquationSystems &es, const std::set< std::string > *system_names=nullptr, const std::string &var_suffix="_elem_node_")
Similar to the function above, but instead of only handling (CONSTANT, MONOMIAL) data,...
void set_unique_ids_from_maps(bool val)
If true, this flag enforces the following behaviors:
void copy_elemental_solution(System &system, std::string system_var_name, std::string exodus_var_name, unsigned int timestep=1)
If we read in a elemental solution while reading in a mesh, we can attempt to copy that elemental sol...
virtual void read(const std::string &name) override
This method implements reading a mesh from a specified file.
void set_discontinuous_bex(bool disc_bex)
Set to true (false is the default) to generate independent nodes for every Bezier Extraction element ...
static Point map(const unsigned int dim, const Elem *elem, const Point &reference_point)
static Point inverse_map(const unsigned int dim, const Elem *elem, const Point &p, const Real tolerance=TOLERANCE, const bool secure=true, const bool extra_checks=true)
class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
FEType set_p_refinement(bool p) &
"Fluent API" for constructing a non-default p_refinement, for easier compatibility between non-InfFE ...
Reading and writing meshes in the Gmsh format.
virtual void read(const std::string &name) override
Reads in a mesh in the Gmsh *.msh format from the ASCII file given by name.
Manages consistently variables, degrees of freedom, coefficient vectors, matrices and linear solvers ...
A class to represent the internal "this should never happen" errors, to be thrown by "libmesh_error()...
This is the MeshBase class.
virtual bool is_serial() const
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
virtual const Node * node_ptr(const dof_id_type i) const =0
virtual dof_id_type n_elem() const =0
virtual void renumber_elem(dof_id_type old_id, dof_id_type new_id)=0
Changes the id of element old_id, both by changing elem(old_id)->id() and by moving elem(old_id) in t...
void allow_renumbering(bool allow)
If false is passed in then this mesh will no longer be renumbered when being prepared for use.
const std::map< subdomain_id_type, std::string > & get_subdomain_name_map() const
void prepare_for_use(const bool skip_renumber_nodes_and_elements, const bool skip_find_neighbors)
Prepare a newly created (or read) mesh for use.
virtual void write(const std::string &name) const =0
virtual std::unique_ptr< MeshBase > clone() const =0
Virtual "copy constructor".
virtual dof_id_type n_nodes() const =0
ElemMappingType default_mapping_type() const
Returns the default master space to physical space mapping basis functions to be used on newly added ...
virtual void read(const std::string &name, void *mesh_data=nullptr, bool skip_renumber_nodes_and_elements=false, bool skip_find_neighbors=false, bool skip_detect_interior_parents=false)=0
Interfaces for reading/writing a mesh to/from a file.
virtual dof_id_type max_elem_id() const =0
virtual const Elem * query_elem_ptr(const dof_id_type i) const =0
std::string & subdomain_name(subdomain_id_type id)
unsigned char default_mapping_data() const
Returns any default data value used by the master space to physical space mapping.
std::unique_ptr< PointLocatorBase > sub_point_locator() const
void skip_noncritical_partitioning(bool skip)
If true is passed in then the elements on this mesh will no longer be (re)partitioned,...
This is the MeshCommunication class.
void broadcast(MeshBase &) const
This method takes a mesh (which is assumed to reside on processor 0) and broadcasts it to all the oth...
virtual void write_equation_systems(const std::string &, const EquationSystems &, const std::set< std::string > *system_names=nullptr)
This method implements writing a mesh with data to a specified file where the data is taken from the ...
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
The Nemesis_IO class implements reading parallel meshes in the Nemesis file format from Sandia Nation...
void write_element_data(const EquationSystems &es)
Write out element solution in parallel, without localizing the solution vector.
virtual void read(const std::string &base_filename) override
Implements reading the mesh from several different files.
void copy_elemental_solution(System &system, std::string system_var_name, std::string exodus_var_name, unsigned int timestep=1)
If we read in a elemental solution while reading in a mesh, we can attempt to copy that elemental sol...
processor_id_type processor_id() const
const Parallel::Communicator & comm() const
This class provides the ability to map between arbitrary, user-defined strings and several data types...
bool have_parameter(std::string_view) const
const T & get(std::string_view) const
A Point defines a location in LIBMESH_DIM dimensional Real space.
The ReplicatedMesh class is derived from the MeshBase class, and is used to store identical copies of...
This class implements reading and writing triangle meshes in the STL format.
virtual void read(const std::string &mesh_file) override
This method implements reading a mesh from a specified file.
Manages consistently variables, degrees of freedom, and coefficient vectors.
void project_solution(FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr, std::optional< ConstElemRange > active_local_range=std::nullopt, std::optional< std::vector< unsigned int > > variable_numbers=std::nullopt) const
Projects arbitrary functions onto the current solution.
std::unique_ptr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
Number point_value(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
unsigned int add_variable(std::string_view var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
Adds the variable var to the list of variables for this system.
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
const std::string & variable_name(const unsigned int i) const
Real calculate_norm(const NumericVector< Number > &v, unsigned int var, FEMNormType norm_type, std::set< unsigned int > *skip_dimensions=nullptr) const
const DofMap & get_dof_map() const
unsigned int number() const
This class implements reading and writing meshes in the TetGen format.
virtual void read(const std::string &) override
This method implements reading a mesh from a specified file in TetGen format.
This class implements reading and writing meshes in the VTK format.
virtual void write(const std::string &) override
Output the mesh without solutions to a .pvtu file.
Communicator * TestCommWorld
The libMesh namespace provides an interface to certain functionality in the library.
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
ElemType
Defines an enum for geometric element types.
void libmesh_ignore(const Args &...)
static constexpr Real TOLERANCE
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
const dof_id_type n_nodes