27 #include <boost/algorithm/string.hpp>
28 #include <boost/archive/binary_iarchive.hpp>
29 #include <boost/io/ios_state.hpp>
30 #include <boost/property_tree/ptree.hpp>
31 #include <boost/property_tree/xml_parser.hpp>
32 #include <boost/serialization/serialization.hpp>
34 #ifdef DEAL_II_GMSH_WITH_API
45 #ifdef DEAL_II_WITH_ASSIMP
46 # include <assimp/Importer.hpp>
47 # include <assimp/postprocess.h>
48 # include <assimp/scene.h>
51 #ifdef DEAL_II_TRILINOS_WITH_SEACAS
52 # include <exodusII.h>
69 template <
int spacedim>
71 assign_1d_boundary_ids(
72 const std::map<unsigned int, types::boundary_id> &boundary_ids,
75 if (boundary_ids.size() > 0)
76 for (
const auto &cell :
triangulation.active_cell_iterators())
78 if (boundary_ids.find(cell->vertex_index(f)) != boundary_ids.end())
83 "You are trying to prescribe boundary ids on the face "
84 "of a 1d cell (i.e., on a vertex), but this face is not actually at "
85 "the boundary of the mesh. This is not allowed."));
86 cell->face(f)->set_boundary_id(
87 boundary_ids.find(cell->vertex_index(f))->second);
92 template <
int dim,
int spacedim>
94 assign_1d_boundary_ids(
const std::map<unsigned int, types::boundary_id> &,
105 template <
int dim,
int spacedim>
113 const auto n_hypercube_vertices =
114 ReferenceCells::get_hypercube<dim>().n_vertices();
115 bool is_only_hypercube =
true;
117 if (cell.vertices.size() != n_hypercube_vertices)
119 is_only_hypercube =
false;
127 if (is_only_hypercube)
132 template <
int dim,
int spacedim>
134 :
tria(nullptr, typeid(*this).name())
140 template <
int dim,
int spacedim>
142 :
tria(&t, typeid(*this).name())
148 template <
int dim,
int spacedim>
157 template <
int dim,
int spacedim>
169 text[0] =
"# vtk DataFile Version 3.0";
172 text[3] =
"DATASET UNSTRUCTURED_GRID";
174 for (
unsigned int i = 0; i < 4; ++i)
179 line.compare(text[i]) == 0,
182 "While reading VTK file, failed to find a header line with text <") +
189 std::vector<Point<spacedim>>
vertices;
190 std::vector<CellData<dim>> cells;
199 if (keyword ==
"POINTS")
201 unsigned int n_vertices;
206 for (
unsigned int vertex = 0; vertex < n_vertices; ++vertex)
210 in >> x(0) >> x(1) >> x(2);
213 for (
unsigned int d = 0;
d < spacedim; ++
d)
221 "While reading VTK file, failed to find POINTS section"));
225 unsigned int n_geometric_objects = 0;
228 if (keyword ==
"CELLS")
231 std::vector<unsigned int> cell_types;
233 std::streampos oldpos = in.tellg();
236 while (in >> keyword)
237 if (keyword ==
"CELL_TYPES")
241 cell_types.resize(n_ints);
243 for (
unsigned int i = 0; i < n_ints; ++i)
252 in >> n_geometric_objects;
257 for (
unsigned int count = 0; count < n_geometric_objects; ++count)
259 unsigned int n_vertices;
263 if (cell_types[count] == 10 || cell_types[count] == 12)
271 cells.emplace_back(n_vertices);
273 for (
unsigned int j = 0; j < n_vertices;
275 in >> cells.back().vertices[j];
279 if (cell_types[count] == 12)
282 cells.back().vertices[3]);
284 cells.back().vertices[7]);
287 cells.back().material_id = 0;
290 else if (cell_types[count] == 5 || cell_types[count] == 9)
299 for (
unsigned int j = 0; j < n_vertices;
306 else if (cell_types[count] == 3)
310 for (
unsigned int j = 0; j < n_vertices;
321 "While reading VTK file, unknown cell type encountered"));
326 for (
unsigned int count = 0; count < n_geometric_objects; ++count)
328 unsigned int n_vertices;
332 if (cell_types[count] == 5 || cell_types[count] == 9)
339 cells.emplace_back(n_vertices);
341 for (
unsigned int j = 0; j < n_vertices;
343 in >> cells.back().vertices[j];
347 if (cell_types[count] == 9)
352 cells.back().vertices[3]);
355 cells.back().material_id = 0;
358 else if (cell_types[count] == 3)
364 for (
unsigned int j = 0; j < n_vertices;
377 "While reading VTK file, unknown cell type encountered"));
382 for (
unsigned int count = 0; count < n_geometric_objects; ++count)
388 cell_types[count] == 3 && type == 2,
390 "While reading VTK file, unknown cell type encountered"));
391 cells.emplace_back(type);
393 for (
unsigned int j = 0; j < type; ++j)
394 in >> cells.back().vertices[j];
396 cells.back().material_id = 0;
402 "While reading VTK file, failed to find CELLS section"));
409 keyword ==
"CELL_TYPES",
411 "While reading VTK file, missing CELL_TYPES section. Found <" +
412 keyword +
"> instead.")));
416 n_ints == n_geometric_objects,
417 ExcMessage(
"The VTK reader found a CELL_DATA statement "
418 "that lists a total of " +
420 " cell data objects, but this needs to "
421 "equal the number of cells (which is " +
423 ") plus the number of quads (" +
425 " in 3d or the number of lines (" +
430 for (
unsigned int i = 0; i < n_ints; ++i)
434 while (in >> keyword)
435 if (keyword ==
"CELL_DATA")
441 ExcMessage(
"The VTK reader found a CELL_DATA statement "
442 "that lists a total of " +
444 " cell data objects, but this needs to "
445 "equal the number of cells (which is " +
447 ") plus the number of quads (" +
450 " in 3d or the number of lines (" +
455 const std::vector<std::string> data_sets{
"MaterialID",
458 for (
unsigned int i = 0; i < data_sets.size(); ++i)
461 while (in >> keyword)
462 if (keyword ==
"SCALARS")
467 std::string field_name;
469 if (std::find(data_sets.begin(),
471 field_name) == data_sets.end())
483 std::getline(in, line);
486 std::min(
static_cast<std::size_t
>(3),
487 line.size() - 1)) ==
"int",
489 "While reading VTK file, material- and manifold IDs can only have type 'int'."));
493 keyword ==
"LOOKUP_TABLE",
495 "While reading VTK file, missing keyword 'LOOKUP_TABLE'."));
499 keyword ==
"default",
501 "While reading VTK file, missing keyword 'default'."));
508 for (
unsigned int i = 0; i < cells.size(); ++i)
512 if (field_name ==
"MaterialID")
513 cells[i].material_id =
515 else if (field_name ==
"ManifoldID")
516 cells[i].manifold_id =
528 if (field_name ==
"MaterialID")
529 boundary_quad.material_id =
531 else if (field_name ==
"ManifoldID")
532 boundary_quad.manifold_id =
541 if (field_name ==
"MaterialID")
542 boundary_line.material_id =
544 else if (field_name ==
"ManifoldID")
545 boundary_line.manifold_id =
557 if (field_name ==
"MaterialID")
558 boundary_line.material_id =
560 else if (field_name ==
"ManifoldID")
561 boundary_line.manifold_id =
571 apply_grid_fixup_functions(
vertices, cells, subcelldata);
577 "While reading VTK file, failed to find CELLS section"));
582 template <
int dim,
int spacedim>
586 namespace pt = boost::property_tree;
588 pt::read_xml(in, tree);
589 auto section = tree.get_optional<std::string>(
"VTKFile.dealiiData");
593 "While reading a VTU file, failed to find dealiiData section. "
594 "Notice that we can only read grid files in .vtu format that "
595 "were created by the deal.II library, using a call to "
596 "GridOut::write_vtu(), where the flag "
597 "GridOutFlags::Vtu::serialize_triangulation is set to true."));
601 const auto string_archive =
603 std::istringstream in_stream(string_archive);
604 boost::archive::binary_iarchive ia(in_stream);
609 template <
int dim,
int spacedim>
617 skip_comment_lines(in,
'#');
628 "Expected '-1' before and after a section."));
640 std::getline(in, line);
643 if (line.compare(
"-1") == 0)
654 std::vector<Point<spacedim>>
vertices;
673 in >> dummy >> dummy >> dummy;
676 in >> x[0] >> x[1] >> x[2];
680 for (
unsigned int d = 0;
d < spacedim; ++
d)
695 AssertThrow(tmp == 2412, ExcUnknownSectionType(tmp));
697 std::vector<CellData<dim>> cells;
724 in >> type >> dummy >> dummy >> dummy >> dummy;
726 AssertThrow((type == 11) || (type == 44) || (type == 94) || (type == 115),
727 ExcUnknownElementType(type));
729 if ((((type == 44) || (type == 94)) && (dim == 2)) ||
730 ((type == 115) && (dim == 3)))
733 cells.emplace_back();
740 cells.back().material_id = 0;
743 cells.back().vertices[v] =
vertex_indices[cells.back().vertices[v]];
745 cell_indices[no] = no_cell;
749 else if (((type == 11) && (dim == 2)) ||
750 ((type == 11) && (dim == 3)))
753 in >> dummy >> dummy >> dummy;
758 for (
unsigned int &vertex :
764 for (
unsigned int &vertex :
768 line_indices[no] = no_line;
772 else if (((type == 44) || (type == 94)) && (dim == 3))
787 for (
unsigned int &vertex :
791 quad_indices[no] = no_quad;
799 "> when running in dim=" +
818 AssertThrow((tmp == 2467) || (tmp == 2477), ExcUnknownSectionType(tmp));
834 in >> dummy >> dummy >> dummy >> dummy >> dummy >> dummy >>
845 std::getline(in, line);
848 "The line before the line containing an ID has too "
849 "many entries. This is not a valid UNV file."));
851 std::getline(in, line);
853 std::istringstream id_stream(line);
856 !id_stream.fail() && id_stream.eof(),
858 "The given UNV file contains a boundary or material id set to '" +
860 "', which cannot be parsed as a fixed-width integer, whereas "
861 "deal.II only supports integer boundary and material ids. To fix "
862 "this, ensure that all such ids are given integer values."));
867 "' is not convertible to either types::material_id nor "
868 "types::boundary_id."));
870 const unsigned int n_lines =
871 (n_entities % 2 == 0) ? (n_entities / 2) : ((n_entities + 1) / 2);
873 for (
unsigned int line = 0; line < n_lines; ++line)
875 unsigned int n_fragments;
877 if (line == n_lines - 1)
878 n_fragments = (n_entities % 2 == 0) ? (2) : (1);
882 for (
unsigned int no_fragment = 0; no_fragment < n_fragments;
886 in >> dummy >> no >> dummy >> dummy;
888 if (cell_indices.count(no) > 0)
889 cells[cell_indices[no]].material_id = id;
891 if (line_indices.count(no) > 0)
895 if (quad_indices.count(no) > 0)
903 apply_grid_fixup_functions(
vertices, cells, subcelldata);
909 template <
int dim,
int spacedim>
912 const bool apply_all_indicators_to_manifolds)
918 skip_comment_lines(in,
'#');
921 unsigned int n_vertices;
925 in >> n_vertices >>
n_cells >> dummy
931 std::vector<Point<spacedim>>
vertices(n_vertices);
937 for (
unsigned int vertex = 0; vertex < n_vertices; ++vertex)
944 in >> vertex_number >> x[0] >> x[1] >> x[2];
947 for (
unsigned int d = 0;
d < spacedim; ++
d)
956 std::vector<CellData<dim>> cells;
959 for (
unsigned int cell = 0; cell <
n_cells; ++cell)
968 std::string cell_type;
978 if (((cell_type ==
"line") && (dim == 1)) ||
979 ((cell_type ==
"quad") && (dim == 2)) ||
980 ((cell_type ==
"hex") && (dim == 3)))
984 cells.emplace_back();
997 if (apply_all_indicators_to_manifolds)
998 cells.back().manifold_id =
1008 cells.back().vertices[i] =
1015 cells.back().vertices[i]));
1020 else if ((cell_type ==
"line") && ((dim == 2) || (dim == 3)))
1040 if (apply_all_indicators_to_manifolds)
1057 for (
unsigned int &vertex :
1069 else if ((cell_type ==
"quad") && (dim == 3))
1090 if (apply_all_indicators_to_manifolds)
1107 for (
unsigned int &vertex :
1121 AssertThrow(
false, ExcUnknownIdentifier(cell_type));
1126 apply_grid_fixup_functions(
vertices, cells, subcelldata);
1132 template <
int dim,
int spacedim>
1139 read_in_abaqus(std::istream &in);
1141 write_out_avs_ucd(std::ostream &out)
const;
1144 const double tolerance;
1147 get_global_node_numbers(
const int face_cell_no,
1148 const int face_cell_face_no)
const;
1151 std::vector<std::vector<double>> node_list;
1154 std::vector<std::vector<double>> cell_list;
1156 std::vector<std::vector<double>> face_list;
1159 std::map<std::string, std::vector<int>> elsets_list;
1163 template <
int dim,
int spacedim>
1166 const bool apply_all_indicators_to_manifolds)
1173 Assert((spacedim == 2 && dim == spacedim) ||
1174 (spacedim == 3 && (dim == spacedim || dim == spacedim - 1)),
1180 Abaqus_to_UCD<dim, spacedim> abaqus_to_ucd;
1181 abaqus_to_ucd.read_in_abaqus(in);
1183 std::stringstream in_ucd;
1184 abaqus_to_ucd.write_out_avs_ucd(in_ucd);
1192 read_ucd(in_ucd, apply_all_indicators_to_manifolds);
1194 catch (std::exception &exc)
1196 std::cerr <<
"Exception on processing internal UCD data: " << std::endl
1197 << exc.what() << std::endl;
1202 "Internal conversion from ABAQUS file to UCD format was unsuccessful. "
1203 "More information is provided in an error message printed above. "
1204 "Are you sure that your ABAQUS mesh file conforms with the requirements "
1205 "listed in the documentation?"));
1212 "Internal conversion from ABAQUS file to UCD format was unsuccessful. "
1213 "Are you sure that your ABAQUS mesh file conforms with the requirements "
1214 "listed in the documentation?"));
1219 template <
int dim,
int spacedim>
1229 skip_comment_lines(in,
'#');
1235 AssertThrow(line ==
"MeshVersionFormatted 0", ExcInvalidDBMESHInput(line));
1237 skip_empty_lines(in);
1241 AssertThrow(line ==
"Dimension", ExcInvalidDBMESHInput(line));
1242 unsigned int dimension;
1244 AssertThrow(dimension == dim, ExcDBMESHWrongDimension(dimension));
1245 skip_empty_lines(in);
1258 while (getline(in, line), line.find(
"# END") == std::string::npos)
1260 skip_empty_lines(in);
1265 AssertThrow(line ==
"Vertices", ExcInvalidDBMESHInput(line));
1267 unsigned int n_vertices;
1271 std::vector<Point<spacedim>>
vertices(n_vertices);
1272 for (
unsigned int vertex = 0; vertex < n_vertices; ++vertex)
1275 for (
unsigned int d = 0;
d < dim; ++
d)
1282 skip_empty_lines(in);
1288 AssertThrow(line ==
"Edges", ExcInvalidDBMESHInput(line));
1290 unsigned int n_edges;
1292 for (
unsigned int edge = 0; edge < n_edges; ++edge)
1295 in >> dummy >> dummy;
1301 skip_empty_lines(in);
1310 AssertThrow(line ==
"CrackedEdges", ExcInvalidDBMESHInput(line));
1313 for (
unsigned int edge = 0; edge < n_edges; ++edge)
1316 in >> dummy >> dummy;
1322 skip_empty_lines(in);
1328 AssertThrow(line ==
"Quadrilaterals", ExcInvalidDBMESHInput(line));
1330 static constexpr std::array<unsigned int, 8> local_vertex_numbering = {
1331 {0, 1, 5, 4, 2, 3, 7, 6}};
1332 std::vector<CellData<dim>> cells;
1336 for (
unsigned int cell = 0; cell <
n_cells; ++cell)
1340 cells.emplace_back();
1344 cells.back().vertices[dim == 3 ? local_vertex_numbering[i] :
1348 (
static_cast<unsigned int>(cells.back().vertices[i]) <=
1352 --cells.back().vertices[i];
1360 skip_empty_lines(in);
1368 while (getline(in, line), ((line.find(
"End") == std::string::npos) && (in)))
1374 apply_grid_fixup_functions(
vertices, cells, subcelldata);
1380 template <
int dim,
int spacedim>
1387 const auto reference_cell = ReferenceCells::get_hypercube<dim>();
1391 std::getline(in, line);
1393 unsigned int n_vertices;
1398 std::getline(in, line);
1401 std::getline(in, line);
1404 for (
unsigned int i = 0; i < 8; ++i)
1405 std::getline(in, line);
1408 std::vector<CellData<dim>> cells(
n_cells);
1419 for (
unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
1420 in >> cell.vertices[
reference_cell.exodusii_vertex_to_deal_vertex(i)];
1424 std::vector<Point<spacedim>>
vertices(n_vertices);
1427 for (
unsigned int d = 0;
d < spacedim; ++
d)
1429 for (
unsigned int d = spacedim;
d < 3; ++
d)
1438 apply_grid_fixup_functions(
vertices, cells, subcelldata);
1444 template <
int dim,
int spacedim>
1461 std::stringstream whole_file;
1466 std::getline(in, line);
1471 if (line.find(
'#') != std::string::npos)
1472 line.erase(line.find(
'#'), std::string::npos);
1473 while ((line.size() > 0) && (line.back() ==
' '))
1474 line.erase(line.size() - 1);
1476 if (line.size() > 0)
1477 whole_file <<
'\n' << line;
1496 unsigned int version_major, version_minor;
1497 whole_file >> version_major >> version_minor;
1498 AssertThrow((version_major == 0) && (version_minor == 1),
1499 ExcMessage(
"deal.II can currently only read version 0.1 "
1500 "of the mphtxt file format."));
1505 unsigned int n_tags;
1506 whole_file >> n_tags;
1507 for (
unsigned int i = 0; i < n_tags; ++i)
1510 while (whole_file.peek() ==
'\n')
1512 std::getline(whole_file, dummy);
1518 unsigned int n_types;
1519 whole_file >> n_types;
1520 for (
unsigned int i = 0; i < n_types; ++i)
1523 while (whole_file.peek() ==
'\n')
1525 std::getline(whole_file, dummy);
1545 whole_file >> dummy >> dummy >> dummy;
1549 while (whole_file.peek() ==
'\n')
1551 std::getline(whole_file, s);
1555 unsigned int version;
1556 whole_file >> version;
1560 unsigned int file_space_dim;
1561 whole_file >> file_space_dim;
1565 "The mesh file uses a different number of space dimensions "
1566 "than the triangulation you want to read it into."));
1568 unsigned int n_vertices;
1569 whole_file >> n_vertices;
1571 unsigned int starting_vertex_index;
1572 whole_file >> starting_vertex_index;
1574 std::vector<Point<spacedim>>
vertices(n_vertices);
1575 for (
unsigned int v = 0; v < n_vertices; ++v)
1606 std::vector<CellData<dim>> cells;
1609 unsigned int n_types;
1610 whole_file >> n_types;
1611 for (
unsigned int type = 0; type < n_types; ++type)
1618 whole_file >> dummy;
1622 std::string object_name;
1623 whole_file >> object_name;
1625 static const std::map<std::string, ReferenceCell> name_to_type = {
1635 AssertThrow(name_to_type.find(object_name) != name_to_type.end(),
1636 ExcMessage(
"The input file contains a cell type <" +
1638 "> that the reader does not "
1639 "current support"));
1640 const ReferenceCell object_type = name_to_type.at(object_name);
1642 unsigned int n_vertices_per_element;
1643 whole_file >> n_vertices_per_element;
1645 unsigned int n_elements;
1646 whole_file >> n_elements;
1660 ExcMessage(
"Triangles should not appear in input files "
1668 "Quadrilaterals should not appear in input files "
1675 ExcMessage(
"Tetrahedra should not appear in input files "
1676 "for 1d or 2d meshes."));
1683 "Prisms (wedges) should not appear in input files "
1684 "for 1d or 2d meshes."));
1703 std::vector<unsigned int> vertices_for_this_element(
1704 n_vertices_per_element);
1705 for (
unsigned int e = 0;
e < n_elements; ++
e)
1708 for (
unsigned int v = 0; v < n_vertices_per_element; ++v)
1710 whole_file >> vertices_for_this_element[v];
1711 vertices_for_this_element[v] -= starting_vertex_index;
1720 cells.emplace_back();
1721 cells.back().vertices = vertices_for_this_element;
1727 vertices_for_this_element;
1735 cells.emplace_back();
1736 cells.back().vertices = vertices_for_this_element;
1742 vertices_for_this_element;
1750 cells.emplace_back();
1751 cells.back().vertices = vertices_for_this_element;
1764 unsigned int n_geom_entity_indices;
1765 whole_file >> n_geom_entity_indices;
1767 (n_geom_entity_indices == n_elements),
1774 if (n_geom_entity_indices != 0)
1776 for (
unsigned int e = 0;
e < n_geom_entity_indices; ++
e)
1779 unsigned int geometric_entity_index;
1780 whole_file >> geometric_entity_index;
1786 cells[cells.size() - n_elements +
e].material_id =
1787 geometric_entity_index;
1792 .boundary_id = geometric_entity_index;
1798 cells[cells.size() - n_elements +
e].material_id =
1799 geometric_entity_index;
1804 .boundary_id = geometric_entity_index;
1810 cells[cells.size() - n_elements +
e].material_id =
1811 geometric_entity_index;
1837 if (line.vertices[1] < line.vertices[0])
1838 std::swap(line.vertices[0], line.vertices[1]);
1843 return std::lexicographical_compare(a.vertices.begin(),
1865 Assert((face.vertices.size() == 3) || (face.vertices.size() == 4),
1867 std::sort(face.vertices.begin(), face.vertices.end());
1872 return std::lexicographical_compare(a.vertices.begin(),
1883 for (
const auto &face : cell->face_iterators())
1884 if (face->at_boundary())
1890 std::array<unsigned int, 2> face_vertex_indices = {
1891 {face->vertex_index(0), face->vertex_index(1)}};
1892 if (face_vertex_indices[0] > face_vertex_indices[1])
1893 std::swap(face_vertex_indices[0], face_vertex_indices[1]);
1899 face_vertex_indices,
1901 const std::array<unsigned int, 2>
1902 &face_vertex_indices) ->
bool {
1903 return std::lexicographical_compare(
1906 face_vertex_indices.begin(),
1907 face_vertex_indices.end());
1911 (p->vertices[0] == face_vertex_indices[0]) &&
1912 (p->vertices[1] == face_vertex_indices[1]))
1914 face->set_boundary_id(p->boundary_id);
1922 std::vector<unsigned int> face_vertex_indices(
1923 face->n_vertices());
1924 for (
unsigned int v = 0; v < face->n_vertices(); ++v)
1925 face_vertex_indices[v] = face->vertex_index(v);
1926 std::sort(face_vertex_indices.begin(),
1927 face_vertex_indices.end());
1933 face_vertex_indices,
1935 const std::vector<unsigned int>
1936 &face_vertex_indices) ->
bool {
1937 return std::lexicographical_compare(
1940 face_vertex_indices.begin(),
1941 face_vertex_indices.end());
1945 (p->vertices == face_vertex_indices))
1947 face->set_boundary_id(p->boundary_id);
1952 for (
unsigned int e = 0;
e < face->n_lines(); ++
e)
1954 const auto edge = face->line(
e);
1956 std::array<unsigned int, 2> edge_vertex_indices = {
1957 {edge->vertex_index(0), edge->vertex_index(1)}};
1958 if (edge_vertex_indices[0] > edge_vertex_indices[1])
1960 edge_vertex_indices[1]);
1966 edge_vertex_indices,
1968 const std::array<unsigned int, 2>
1969 &edge_vertex_indices) ->
bool {
1970 return std::lexicographical_compare(
1973 edge_vertex_indices.begin(),
1974 edge_vertex_indices.end());
1978 (p->vertices[0] == edge_vertex_indices[0]) &&
1979 (p->vertices[1] == edge_vertex_indices[1]))
1981 edge->set_boundary_id(p->boundary_id);
1990 template <
int dim,
int spacedim>
1997 unsigned int n_vertices;
2004 std::array<std::map<int, int>, 4> tag_maps;
2009 unsigned int gmsh_file_format = 0;
2010 if (line ==
"@f$NOD")
2011 gmsh_file_format = 10;
2012 else if (line ==
"@f$MeshFormat")
2013 gmsh_file_format = 20;
2019 if (gmsh_file_format == 20)
2022 unsigned int file_type, data_size;
2024 in >> version >> file_type >> data_size;
2027 gmsh_file_format =
static_cast<unsigned int>(version * 10);
2035 AssertThrow(line ==
"@f$EndMeshFormat", ExcInvalidGMSHInput(line));
2039 if (line ==
"@f$PhysicalNames")
2045 while (line !=
"@f$EndPhysicalNames");
2050 if (line ==
"@f$Entities")
2052 unsigned long n_points, n_curves, n_surfaces, n_volumes;
2054 in >> n_points >> n_curves >> n_surfaces >> n_volumes;
2055 for (
unsigned int i = 0; i < n_points; ++i)
2059 unsigned int n_physicals;
2060 double box_min_x, box_min_y, box_min_z, box_max_x, box_max_y,
2064 if (gmsh_file_format > 40)
2066 in >> tag >> box_min_x >> box_min_y >> box_min_z >>
2068 box_max_x = box_min_x;
2069 box_max_y = box_min_y;
2070 box_max_z = box_min_z;
2074 in >> tag >> box_min_x >> box_min_y >> box_min_z >>
2075 box_max_x >> box_max_y >> box_max_z >> n_physicals;
2080 ExcMessage(
"More than one tag is not supported!"));
2082 int physical_tag = 0;
2083 for (
unsigned int j = 0; j < n_physicals; ++j)
2085 tag_maps[0][tag] = physical_tag;
2087 for (
unsigned int i = 0; i < n_curves; ++i)
2091 unsigned int n_physicals;
2092 double box_min_x, box_min_y, box_min_z, box_max_x, box_max_y,
2096 in >> tag >> box_min_x >> box_min_y >> box_min_z >> box_max_x >>
2097 box_max_y >> box_max_z >> n_physicals;
2101 ExcMessage(
"More than one tag is not supported!"));
2103 int physical_tag = 0;
2104 for (
unsigned int j = 0; j < n_physicals; ++j)
2106 tag_maps[1][tag] = physical_tag;
2111 for (
unsigned int j = 0; j < n_points; ++j)
2115 for (
unsigned int i = 0; i < n_surfaces; ++i)
2119 unsigned int n_physicals;
2120 double box_min_x, box_min_y, box_min_z, box_max_x, box_max_y,
2124 in >> tag >> box_min_x >> box_min_y >> box_min_z >> box_max_x >>
2125 box_max_y >> box_max_z >> n_physicals;
2129 ExcMessage(
"More than one tag is not supported!"));
2131 int physical_tag = 0;
2132 for (
unsigned int j = 0; j < n_physicals; ++j)
2134 tag_maps[2][tag] = physical_tag;
2139 for (
unsigned int j = 0; j < n_curves; ++j)
2142 for (
unsigned int i = 0; i < n_volumes; ++i)
2146 unsigned int n_physicals;
2147 double box_min_x, box_min_y, box_min_z, box_max_x, box_max_y,
2151 in >> tag >> box_min_x >> box_min_y >> box_min_z >> box_max_x >>
2152 box_max_y >> box_max_z >> n_physicals;
2156 ExcMessage(
"More than one tag is not supported!"));
2158 int physical_tag = 0;
2159 for (
unsigned int j = 0; j < n_physicals; ++j)
2161 tag_maps[3][tag] = physical_tag;
2166 for (
unsigned int j = 0; j < n_surfaces; ++j)
2170 AssertThrow(line ==
"@f$EndEntities", ExcInvalidGMSHInput(line));
2175 if (line ==
"@f$PartitionedEntities")
2181 while (line !=
"@f$EndPartitionedEntities");
2188 AssertThrow(line ==
"@f$Nodes", ExcInvalidGMSHInput(line));
2192 int n_entity_blocks = 1;
2193 if (gmsh_file_format > 40)
2197 in >> n_entity_blocks >> n_vertices >> min_node_tag >> max_node_tag;
2199 else if (gmsh_file_format == 40)
2201 in >> n_entity_blocks >> n_vertices;
2205 std::vector<Point<spacedim>>
vertices(n_vertices);
2212 unsigned int global_vertex = 0;
2213 for (
int entity_block = 0; entity_block < n_entity_blocks; ++entity_block)
2216 unsigned long numNodes;
2218 if (gmsh_file_format < 40)
2220 numNodes = n_vertices;
2227 int tagEntity, dimEntity;
2228 in >> tagEntity >> dimEntity >> parametric >> numNodes;
2231 std::vector<int> vertex_numbers;
2233 if (gmsh_file_format > 40)
2234 for (
unsigned long vertex_per_entity = 0;
2235 vertex_per_entity < numNodes;
2236 ++vertex_per_entity)
2238 in >> vertex_number;
2239 vertex_numbers.push_back(vertex_number);
2242 for (
unsigned long vertex_per_entity = 0; vertex_per_entity < numNodes;
2243 ++vertex_per_entity, ++global_vertex)
2249 if (gmsh_file_format > 40)
2251 vertex_number = vertex_numbers[vertex_per_entity];
2252 in >> x[0] >> x[1] >> x[2];
2255 in >> vertex_number >> x[0] >> x[1] >> x[2];
2257 for (
unsigned int d = 0;
d < spacedim; ++
d)
2263 if (parametric != 0)
2278 static const std::string end_nodes_marker[] = {
"@f$ENDNOD",
"@f$EndNodes"};
2279 AssertThrow(line == end_nodes_marker[gmsh_file_format == 10 ? 0 : 1],
2280 ExcInvalidGMSHInput(line));
2284 static const std::string begin_elements_marker[] = {
"@f$ELM",
"@f$Elements"};
2285 AssertThrow(line == begin_elements_marker[gmsh_file_format == 10 ? 0 : 1],
2286 ExcInvalidGMSHInput(line));
2289 if (gmsh_file_format > 40)
2293 in >> n_entity_blocks >>
n_cells >> min_node_tag >> max_node_tag;
2295 else if (gmsh_file_format == 40)
2297 in >> n_entity_blocks >>
n_cells;
2301 n_entity_blocks = 1;
2308 std::vector<CellData<dim>> cells;
2310 std::map<unsigned int, types::boundary_id> boundary_ids_1d;
2313 static constexpr std::array<unsigned int, 8> local_vertex_numbering = {
2314 {0, 1, 5, 4, 2, 3, 7, 6}};
2315 unsigned int global_cell = 0;
2316 for (
int entity_block = 0; entity_block < n_entity_blocks; ++entity_block)
2319 unsigned long numElements;
2322 if (gmsh_file_format < 40)
2328 else if (gmsh_file_format == 40)
2330 int tagEntity, dimEntity;
2331 in >> tagEntity >> dimEntity >> cell_type >> numElements;
2337 int tagEntity, dimEntity;
2338 in >> dimEntity >> tagEntity >> cell_type >> numElements;
2342 for (
unsigned int cell_per_entity = 0; cell_per_entity < numElements;
2343 ++cell_per_entity, ++global_cell)
2352 unsigned int nod_num;
2373 unsigned int elm_number = 0;
2374 if (gmsh_file_format < 40)
2380 if (gmsh_file_format < 20)
2386 else if (gmsh_file_format < 40)
2391 unsigned int n_tags;
2398 for (
unsigned int i = 1; i < n_tags; ++i)
2403 else if (cell_type == 2)
2405 else if (cell_type == 3)
2407 else if (cell_type == 4)
2409 else if (cell_type == 5)
2420 else if (cell_type == 2)
2422 else if (cell_type == 3)
2424 else if (cell_type == 4)
2426 else if (cell_type == 5)
2452 if (((cell_type == 1) && (dim == 1)) ||
2453 ((cell_type == 2) && (dim == 2)) ||
2454 ((cell_type == 3) && (dim == 2)) ||
2455 ((cell_type == 4) && (dim == 3)) ||
2456 ((cell_type == 5) && (dim == 3)))
2459 unsigned int vertices_per_cell = 0;
2461 vertices_per_cell = 2;
2462 else if (cell_type == 2)
2463 vertices_per_cell = 3;
2464 else if (cell_type == 3)
2465 vertices_per_cell = 4;
2466 else if (cell_type == 4)
2467 vertices_per_cell = 4;
2468 else if (cell_type == 5)
2469 vertices_per_cell = 8;
2473 "Number of nodes does not coincide with the "
2474 "number required for this object"));
2477 cells.emplace_back();
2478 cells.back().vertices.resize(vertices_per_cell);
2479 for (
unsigned int i = 0; i < vertices_per_cell; ++i)
2482 if (vertices_per_cell ==
2486 .vertices[dim == 3 ?
2487 local_vertex_numbering[i] :
2492 in >> cells.back().vertices[i];
2510 for (
unsigned int i = 0; i < vertices_per_cell; ++i)
2515 ExcInvalidVertexIndexGmsh(cell_per_entity,
2517 cells.back().vertices[i]));
2520 cells.back().vertices[i] =
2524 else if ((cell_type == 1) &&
2525 ((dim == 2) || (dim == 3)))
2549 for (
unsigned int &vertex :
2563 else if ((cell_type == 2 || cell_type == 3) &&
2567 unsigned int vertices_per_cell = 0;
2570 vertices_per_cell = 3;
2571 else if (cell_type == 3)
2572 vertices_per_cell = 4;
2580 for (
unsigned int i = 0; i < vertices_per_cell; ++i)
2600 for (
unsigned int &vertex :
2613 else if (cell_type == 15)
2616 unsigned int node_index = 0;
2617 if (gmsh_file_format < 20)
2637 AssertThrow(
false, ExcGmshUnsupportedGeometry(cell_type));
2645 static const std::string end_elements_marker[] = {
"@f$ENDELM",
"@f$EndElements"};
2646 AssertThrow(line == end_elements_marker[gmsh_file_format == 10 ? 0 : 1],
2647 ExcInvalidGMSHInput(line));
2655 apply_grid_fixup_functions(
vertices, cells, subcelldata);
2661 assign_1d_boundary_ids(boundary_ids_1d, *
tria);
2666 #ifdef DEAL_II_GMSH_WITH_API
2667 template <
int dim,
int spacedim>
2673 const std::map<int, std::uint8_t> gmsh_to_dealii_type = {
2674 {{15, 0}, {1, 1}, {2, 2}, {3, 3}, {4, 4}, {7, 5}, {6, 6}, {5, 7}}};
2677 const std::array<std::vector<unsigned int>, 8> gmsh_to_dealii = {
2684 {{0, 1, 2, 3, 4, 5}},
2685 {{0, 1, 3, 2, 4, 5, 7, 6}}}};
2687 std::vector<Point<spacedim>>
vertices;
2688 std::vector<CellData<dim>> cells;
2690 std::map<unsigned int, types::boundary_id> boundary_ids_1d;
2693 gmsh::option::setNumber(
"General.Verbosity", 0);
2697 ExcMessage(
"You are trying to read a gmsh file with dimension " +
2704 gmsh::model::mesh::removeDuplicateNodes();
2705 gmsh::model::mesh::renumberNodes();
2706 std::vector<std::size_t> node_tags;
2707 std::vector<double> coord;
2708 std::vector<double> parametricCoord;
2709 gmsh::model::mesh::getNodes(
2710 node_tags, coord, parametricCoord, -1, -1,
false,
false);
2712 for (
unsigned int i = 0; i < node_tags.size(); ++i)
2716 for (
unsigned int d = 0;
d < spacedim; ++
d)
2720 for (
unsigned int d = spacedim;
d < 3; ++
d)
2721 Assert(std::abs(coord[i * 3 +
d]) < 1
e-10,
2722 ExcMessage(
"The grid you are reading contains nodes that are "
2723 "nonzero in the coordinate with index " +
2725 ", but you are trying to save "
2726 "it on a grid embedded in a " +
2734 std::vector<std::pair<int, int>> entities;
2735 gmsh::model::getEntities(entities);
2737 for (
const auto &
e : entities)
2740 const int &entity_dim =
e.first;
2741 const int &entity_tag =
e.second;
2747 std::vector<int> physical_tags;
2748 gmsh::model::getPhysicalGroupsForEntity(entity_dim,
2753 if (physical_tags.size())
2754 for (
auto physical_tag : physical_tags)
2757 gmsh::model::getPhysicalName(entity_dim, physical_tag, name);
2761 std::map<std::string, int> id_names;
2763 bool throw_anyway =
false;
2764 bool found_boundary_id =
false;
2767 for (
const auto &it : id_names)
2769 const auto &name = it.first;
2770 const auto &
id = it.second;
2771 if (entity_dim == dim && name ==
"MaterialID")
2774 found_boundary_id =
true;
2776 else if (entity_dim < dim && name ==
"BoundaryID")
2779 found_boundary_id =
true;
2781 else if (name ==
"ManifoldID")
2787 throw_anyway =
true;
2793 if (throw_anyway && !found_boundary_id)
2807 std::vector<int> element_types;
2808 std::vector<std::vector<std::size_t>> element_ids, element_nodes;
2809 gmsh::model::mesh::getElements(
2810 element_types, element_ids, element_nodes, entity_dim, entity_tag);
2812 for (
unsigned int i = 0; i < element_types.size(); ++i)
2814 const auto &type = gmsh_to_dealii_type.at(element_types[i]);
2815 const auto n_vertices = gmsh_to_dealii[type].size();
2816 const auto &elements = element_ids[i];
2817 const auto &nodes = element_nodes[i];
2818 for (
unsigned int j = 0; j < elements.size(); ++j)
2820 if (entity_dim == dim)
2822 cells.emplace_back(n_vertices);
2823 auto &cell = cells.back();
2824 for (
unsigned int v = 0; v < n_vertices; ++v)
2826 nodes[n_vertices * j + gmsh_to_dealii[type][v]] - 1;
2830 else if (entity_dim == 2)
2834 for (
unsigned int v = 0; v < n_vertices; ++v)
2836 nodes[n_vertices * j + gmsh_to_dealii[type][v]] - 1;
2841 else if (entity_dim == 1)
2845 for (
unsigned int v = 0; v < n_vertices; ++v)
2847 nodes[n_vertices * j + gmsh_to_dealii[type][v]] - 1;
2852 else if (entity_dim == 0)
2856 for (
unsigned int j = 0; j < elements.size(); ++j)
2863 apply_grid_fixup_functions(
vertices, cells, subcelldata);
2869 assign_1d_boundary_ids(boundary_ids_1d, *
tria);
2878 template <
int dim,
int spacedim>
2881 std::string & header,
2882 std::vector<unsigned int> &tecplot2deal,
2883 unsigned int & n_vars,
2884 unsigned int & n_vertices,
2886 std::vector<unsigned int> &IJK,
2911 std::transform(header.begin(), header.end(), header.begin(), ::toupper);
2915 std::replace(header.begin(), header.end(),
'\t',
' ');
2916 std::replace(header.begin(), header.end(),
',',
' ');
2917 std::replace(header.begin(), header.end(),
'\n',
' ');
2924 if (header[pos + 1] ==
' ')
2925 header.erase(pos + 1, 1);
2926 else if (header[pos - 1] ==
' ')
2928 header.erase(pos - 1, 1);
2932 pos = header.find(
'=', ++pos);
2935 std::vector<std::string> entries =
2939 for (
unsigned int i = 0; i < entries.size(); ++i)
2948 tecplot2deal[0] = 0;
2951 while (entries[i][0] ==
'"')
2953 if (entries[i] ==
"\"X\"")
2954 tecplot2deal[0] = n_vars;
2955 else if (entries[i] ==
"\"Y\"")
2961 tecplot2deal[1] = n_vars;
2963 else if (entries[i] ==
"\"Z\"")
2969 tecplot2deal[2] = n_vars;
2981 "Tecplot file must contain at least one variable for each dimension"));
2982 for (
unsigned int d = 1;
d < dim; ++
d)
2984 tecplot2deal[
d] > 0,
2986 "Tecplot file must contain at least one variable for each dimension."));
2991 "ZONETYPE=FELINESEG") &&
2995 "ZONETYPE=FEQUADRILATERAL") &&
2999 "ZONETYPE=FEBRICK") &&
3007 "The tecplot file contains an unsupported ZONETYPE."));
3010 "DATAPACKING=POINT"))
3013 "DATAPACKING=BLOCK"))
3036 "ET=QUADRILATERAL") &&
3048 "The tecplot file contains an unsupported ElementType."));
3056 dim > 1 || IJK[1] == 1,
3058 "Parameter 'J=' found in tecplot, although this is only possible for dimensions greater than 1."));
3064 dim > 2 || IJK[2] == 1,
3066 "Parameter 'K=' found in tecplot, although this is only possible for dimensions greater than 2."));
3081 for (
unsigned int d = 0;
d < dim; ++
d)
3086 "Tecplot file does not contain a complete and consistent set of parameters"));
3087 n_vertices *= IJK[
d];
3096 "Tecplot file does not contain a complete and consistent set of parameters"));
3102 n_cells = *std::max_element(IJK.begin(), IJK.end());
3106 "Tecplot file does not contain a complete and consistent set of parameters"));
3116 const unsigned int dim = 2;
3117 const unsigned int spacedim = 2;
3122 skip_comment_lines(in,
'#');
3125 std::string line, header;
3132 std::string letters =
"abcdfghijklmnopqrstuvwxyzABCDFGHIJKLMNOPQRSTUVWXYZ";
3135 while (line.find_first_of(letters) != std::string::npos)
3137 header +=
" " + line;
3144 std::vector<unsigned int> tecplot2deal(dim);
3145 std::vector<unsigned int> IJK(dim);
3146 unsigned int n_vars, n_vertices,
n_cells;
3147 bool structured, blocked;
3149 parse_tecplot_header(header,
3164 std::vector<Point<spacedim>>
vertices(n_vertices + 1);
3167 std::vector<CellData<dim>> cells(
n_cells);
3183 unsigned int next_index = 0;
3187 if (tecplot2deal[0] == 0)
3191 std::vector<std::string> first_var =
3194 for (
unsigned int i = 1; i < first_var.size() + 1; ++i)
3195 vertices[i](0) = std::strtod(first_var[i - 1].c_str(), &endptr);
3200 for (
unsigned int j = first_var.size() + 1; j < n_vertices + 1; ++j)
3208 for (
unsigned int i = 1; i < n_vars; ++i)
3217 if (next_index == dim && structured)
3220 if ((next_index < dim) && (i == tecplot2deal[next_index]))
3223 for (
unsigned int j = 1; j < n_vertices + 1; ++j)
3231 for (
unsigned int j = 1; j < n_vertices + 1; ++j)
3243 std::vector<double> vars(n_vars);
3248 std::vector<std::string> first_vertex =
3251 for (
unsigned int d = 0;
d < dim; ++
d)
3253 std::strtod(first_vertex[tecplot2deal[
d]].c_str(), &endptr);
3257 for (
unsigned int v = 2; v < n_vertices + 1; ++v)
3259 for (
unsigned int i = 0; i < n_vars; ++i)
3265 for (
unsigned int i = 0; i < dim; ++i)
3266 vertices[v](i) = vars[tecplot2deal[i]];
3274 unsigned int I = IJK[0], J = IJK[1];
3276 unsigned int cell = 0;
3278 for (
unsigned int j = 0; j < J - 1; ++j)
3279 for (
unsigned int i = 1; i < I; ++i)
3281 cells[cell].vertices[0] = i + j * I;
3282 cells[cell].vertices[1] = i + 1 + j * I;
3283 cells[cell].vertices[2] = i + (j + 1) * I;
3284 cells[cell].vertices[3] = i + 1 + (j + 1) * I;
3288 std::vector<unsigned int> boundary_vertices(2 * I + 2 * J - 4);
3290 for (
unsigned int i = 1; i < I + 1; ++i)
3292 boundary_vertices[k] = i;
3294 boundary_vertices[k] = i + (J - 1) * I;
3297 for (
unsigned int j = 1; j < J - 1; ++j)
3299 boundary_vertices[k] = 1 + j * I;
3301 boundary_vertices[k] = I + j * I;
3320 for (
unsigned int i = 0; i <
n_cells; ++i)
3337 apply_grid_fixup_functions(
vertices, cells, subcelldata);
3343 template <
int dim,
int spacedim>
3352 template <
int dim,
int spacedim>
3355 const unsigned int mesh_index,
3356 const bool remove_duplicates,
3358 const bool ignore_unsupported_types)
3360 #ifdef DEAL_II_WITH_ASSIMP
3365 Assimp::Importer importer;
3368 const aiScene *scene =
3369 importer.ReadFile(filename.c_str(),
3370 aiProcess_RemoveComponent |
3371 aiProcess_JoinIdenticalVertices |
3372 aiProcess_ImproveCacheLocality | aiProcess_SortByPType |
3373 aiProcess_OptimizeGraph | aiProcess_OptimizeMeshes);
3379 ExcMessage(
"Input file contains no meshes."));
3382 (mesh_index < scene->mNumMeshes),
3385 unsigned int start_mesh =
3387 unsigned int end_mesh =
3392 std::vector<Point<spacedim>>
vertices;
3393 std::vector<CellData<dim>> cells;
3397 unsigned int v_offset = 0;
3398 unsigned int c_offset = 0;
3400 static constexpr std::array<unsigned int, 8> local_vertex_numbering = {
3401 {0, 1, 5, 4, 2, 3, 7, 6}};
3403 for (
unsigned int m = start_mesh; m < end_mesh; ++m)
3405 const aiMesh *mesh = scene->mMeshes[m];
3409 if ((dim == 2) && mesh->mPrimitiveTypes != aiPrimitiveType_POLYGON)
3416 else if ((dim == 1) && mesh->mPrimitiveTypes != aiPrimitiveType_LINE)
3424 const unsigned int n_vertices = mesh->mNumVertices;
3425 const aiVector3D * mVertices = mesh->mVertices;
3428 const unsigned int n_faces = mesh->mNumFaces;
3429 const aiFace * mFaces = mesh->mFaces;
3431 vertices.resize(v_offset + n_vertices);
3432 cells.resize(c_offset + n_faces);
3434 for (
unsigned int i = 0; i < n_vertices; ++i)
3435 for (
unsigned int d = 0;
d < spacedim; ++
d)
3438 unsigned int valid_cell = c_offset;
3439 for (
unsigned int i = 0; i < n_faces; ++i)
3446 .vertices[dim == 3 ? local_vertex_numbering[f] :
3448 mFaces[i].mIndices[f] + v_offset;
3450 cells[valid_cell].material_id = m;
3459 " vertices. We expected only " +
3464 cells.resize(valid_cell);
3469 v_offset += n_vertices;
3470 c_offset = valid_cell;
3474 if (cells.size() == 0)
3477 if (remove_duplicates)
3482 unsigned int n_verts = 0;
3486 std::vector<unsigned int> considered_vertices;
3488 vertices, cells, subcelldata, considered_vertices, tol);
3492 apply_grid_fixup_functions(
vertices, cells, subcelldata);
3498 (void)remove_duplicates;
3500 (void)ignore_unsupported_types;
3505 #ifdef DEAL_II_TRILINOS_WITH_SEACAS
3512 exodusii_name_to_type(
const std::string &type_name,
3513 const int n_nodes_per_element)
3519 std::string type_name_2 = type_name;
3522 type_name_2.begin(),
3523 [](
unsigned char c) { return std::toupper(c); });
3524 const std::string
numbers =
"0123456789";
3525 type_name_2.erase(std::find_first_of(type_name_2.begin(),
3532 if (type_name_2 ==
"BAR" || type_name_2 ==
"BEAM" ||
3533 type_name_2 ==
"EDGE" || type_name_2 ==
"TRUSS")
3535 else if (type_name_2 ==
"TRI" || type_name_2 ==
"TRIANGLE")
3537 else if (type_name_2 ==
"QUAD" || type_name_2 ==
"QUADRILATERAL")
3539 else if (type_name_2 ==
"SHELL")
3541 if (n_nodes_per_element == 3)
3546 else if (type_name_2 ==
"TET" || type_name_2 ==
"TETRA" ||
3547 type_name_2 ==
"TETRAHEDRON")
3549 else if (type_name_2 ==
"PYRA" || type_name_2 ==
"PYRAMID")
3551 else if (type_name_2 ==
"WEDGE")
3553 else if (type_name_2 ==
"HEX" || type_name_2 ==
"HEXAHEDRON")
3563 template <
int dim,
int spacedim = dim>
3564 std::pair<SubCellData, std::vector<std::vector<int>>>
3565 read_exodusii_sidesets(
const int ex_id,
3566 const int n_side_sets,
3568 const bool apply_all_indicators_to_manifolds)
3571 std::vector<std::vector<int>> b_or_m_id_to_sideset_ids;
3573 b_or_m_id_to_sideset_ids.emplace_back();
3579 if (dim == spacedim && n_side_sets > 0)
3581 std::vector<int> side_set_ids(n_side_sets);
3582 int ierr = ex_get_ids(ex_id, EX_SIDE_SET, side_set_ids.data());
3583 AssertThrowExodusII(ierr);
3591 std::map<std::size_t, std::vector<int>> face_side_sets;
3592 for (
const int side_set_id : side_set_ids)
3595 int n_distribution_factors = -1;
3597 ierr = ex_get_set_param(ex_id,
3601 &n_distribution_factors);
3602 AssertThrowExodusII(ierr);
3605 std::vector<int> elements(n_sides);
3606 std::vector<int> faces(n_sides);
3607 ierr = ex_get_set(ex_id,
3612 AssertThrowExodusII(ierr);
3620 for (
int side_n = 0; side_n < n_sides; ++side_n)
3622 const long element_n = elements[side_n] - 1;
3623 const long face_n = faces[side_n] - 1;
3624 const std::size_t face_id =
3625 element_n * max_faces_per_cell + face_n;
3626 face_side_sets[face_id].push_back(side_set_id);
3632 std::vector<std::pair<std::size_t, std::vector<int>>>
3633 face_id_to_side_sets;
3634 face_id_to_side_sets.reserve(face_side_sets.size());
3635 for (
auto &pair : face_side_sets)
3638 face_id_to_side_sets.push_back(std::move(pair));
3642 std::sort(face_id_to_side_sets.begin(),
3643 face_id_to_side_sets.end(),
3644 [](
const auto &a,
const auto &
b) {
3645 return std::lexicographical_compare(a.second.begin(),
3656 for (
const auto &pair : face_id_to_side_sets)
3658 const std::size_t face_id = pair.first;
3659 const std::vector<int> &face_sideset_ids = pair.second;
3660 if (face_sideset_ids != b_or_m_id_to_sideset_ids.back())
3665 ++current_b_or_m_id;
3666 b_or_m_id_to_sideset_ids.push_back(face_sideset_ids);
3667 Assert(current_b_or_m_id == b_or_m_id_to_sideset_ids.size() - 1,
3671 const unsigned int local_face_n = face_id % max_faces_per_cell;
3672 const CellData<dim> &cell = cells[face_id / max_faces_per_cell];
3675 const unsigned int deal_face_n =
3686 if (apply_all_indicators_to_manifolds)
3687 boundary_line.manifold_id = current_b_or_m_id;
3689 boundary_line.boundary_id = current_b_or_m_id;
3690 for (
unsigned int j = 0; j < face_reference_cell.
n_vertices();
3692 boundary_line.vertices[j] =
3694 deal_face_n, j, 0)];
3701 if (apply_all_indicators_to_manifolds)
3702 boundary_quad.manifold_id = current_b_or_m_id;
3704 boundary_quad.boundary_id = current_b_or_m_id;
3705 for (
unsigned int j = 0; j < face_reference_cell.
n_vertices();
3707 boundary_quad.vertices[j] =
3709 deal_face_n, j, 0)];
3716 return std::make_pair(std::move(subcelldata),
3717 std::move(b_or_m_id_to_sideset_ids));
3722 template <
int dim,
int spacedim>
3725 const std::string &filename,
3726 const bool apply_all_indicators_to_manifolds)
3728 #ifdef DEAL_II_TRILINOS_WITH_SEACAS
3730 int component_word_size =
sizeof(
double);
3732 int floating_point_word_size = 0;
3733 float ex_version = 0.0;
3735 const int ex_id = ex_open(filename.c_str(),
3737 &component_word_size,
3738 &floating_point_word_size,
3741 ExcMessage(
"ExodusII failed to open the specified input file."));
3744 std::vector<char> string_temp(MAX_LINE_LENGTH + 1,
'\0');
3745 int mesh_dimension = 0;
3748 int n_element_blocks = 0;
3749 int n_node_sets = 0;
3750 int n_side_sets = 0;
3752 int ierr = ex_get_init(ex_id,
3760 AssertThrowExodusII(ierr);
3771 std::vector<Point<spacedim>>
vertices;
3774 std::vector<double> xs(n_nodes);
3775 std::vector<double> ys(n_nodes);
3776 std::vector<double> zs(n_nodes);
3778 ierr = ex_get_coord(ex_id, xs.data(), ys.data(), zs.data());
3779 AssertThrowExodusII(ierr);
3781 for (
int vertex_n = 0; vertex_n < n_nodes; ++vertex_n)
3786 vertices.emplace_back(xs[vertex_n]);
3789 vertices.emplace_back(xs[vertex_n], ys[vertex_n]);
3792 vertices.emplace_back(xs[vertex_n], ys[vertex_n], zs[vertex_n]);
3800 std::vector<int> element_block_ids(n_element_blocks);
3801 ierr = ex_get_ids(ex_id, EX_ELEM_BLOCK, element_block_ids.data());
3802 AssertThrowExodusII(ierr);
3804 std::vector<CellData<dim>> cells;
3805 cells.reserve(n_elements);
3809 for (
const int element_block_id : element_block_ids)
3811 std::fill(string_temp.begin(), string_temp.end(),
'\0');
3812 int n_block_elements = 0;
3813 int n_nodes_per_element = 0;
3814 int n_edges_per_element = 0;
3815 int n_faces_per_element = 0;
3816 int n_attributes_per_element = 0;
3819 ierr = ex_get_block(ex_id,
3824 &n_nodes_per_element,
3825 &n_edges_per_element,
3826 &n_faces_per_element,
3827 &n_attributes_per_element);
3828 AssertThrowExodusII(ierr);
3830 exodusii_name_to_type(string_temp.data(), n_nodes_per_element);
3834 " with element type " + std::string(string_temp.data()) +
3836 ", which does not match the topological mesh dimension " +
3844 std::vector<int> connection(n_nodes_per_element * n_block_elements);
3845 ierr = ex_get_conn(ex_id,
3851 AssertThrowExodusII(ierr);
3853 for (
unsigned int elem_n = 0; elem_n < connection.size();
3854 elem_n += n_nodes_per_element)
3860 connection[elem_n + i] - 1;
3863 cells.push_back(std::move(cell));
3868 auto pair = read_exodusii_sidesets<dim, spacedim>(
3869 ex_id, n_side_sets, cells, apply_all_indicators_to_manifolds);
3870 ierr = ex_close(ex_id);
3871 AssertThrowExodusII(ierr);
3873 apply_grid_fixup_functions(
vertices, cells, pair.first);
3880 (void)apply_all_indicators_to_manifolds;
3887 template <
int dim,
int spacedim>
3901 if (std::find_if(line.begin(), line.end(), [](
const char c) {
3906 for (
int i = line.size() - 1; i >= 0; --i)
3907 in.putback(line[i]);
3917 template <
int dim,
int spacedim>
3920 const char comment_start)
3925 while (in.get(c) && c == comment_start)
3928 while (in.get() !=
'\n')
3938 skip_empty_lines(in);
3943 template <
int dim,
int spacedim>
3966 for (
unsigned int i = 0; i < cells.size(); ++i)
3968 for (
const auto vertex : cells[i].
vertices)
3982 out <<
"# cell " << i << std::endl;
3984 for (
const auto vertex : cells[i].
vertices)
3988 out <<
"set label \"" << i <<
"\" at " <<
center(0) <<
',' <<
center(1)
3989 <<
" center" << std::endl;
3992 for (
unsigned int f = 0; f < 2; ++f)
3998 for (
unsigned int f = 2; f < 4; ++f)
4008 <<
"set nokey" << std::endl
4009 <<
"pl [" << min_x <<
':' << max_x <<
"][" << min_y <<
':' << max_y
4010 <<
"] " << min_y << std::endl
4011 <<
"pause -1" << std::endl;
4022 for (
const auto &cell : cells)
4089 template <
int dim,
int spacedim>
4097 if (format == Default)
4098 name = search.
find(filename);
4103 if (format == Default)
4107 if (dotpos < name.size() &&
4108 (dotpos > slashpos || slashpos == std::string::npos))
4110 std::string ext = name.substr(dotpos + 1);
4111 format = parse_format(ext);
4115 if (format == assimp)
4119 else if (format == exodusii)
4121 read_exodusii(name);
4125 std::ifstream in(name.c_str());
4131 template <
int dim,
int spacedim>
4135 if (format == Default)
4178 ExcMessage(
"There is no read_assimp(istream &) function. "
4179 "Use the read_assimp(string &filename, ...) "
4180 "functions, instead."));
4185 ExcMessage(
"There is no read_exodusii(istream &) function. "
4186 "Use the read_exodusii(string &filename, ...) "
4187 "function, instead."));
4198 template <
int dim,
int spacedim>
4227 return ".unknown_format";
4233 template <
int dim,
int spacedim>
4237 if (format_name ==
"dbmesh")
4240 if (format_name ==
"exodusii")
4243 if (format_name ==
"msh")
4246 if (format_name ==
"unv")
4249 if (format_name ==
"vtk")
4252 if (format_name ==
"vtu")
4256 if (format_name ==
"inp")
4259 if (format_name ==
"ucd")
4262 if (format_name ==
"xda")
4265 if (format_name ==
"tecplot")
4268 if (format_name ==
"dat")
4271 if (format_name ==
"plt")
4290 template <
int dim,
int spacedim>
4294 return "dbmesh|exodusii|msh|unv|vtk|vtu|ucd|abaqus|xda|tecplot|assimp";
4301 template <
int dim,
int spacedim>
4302 Abaqus_to_UCD<dim, spacedim>::Abaqus_to_UCD()
4315 from_string(
T &t,
const std::string &s, std::ios_base &(*f)(std::ios_base &))
4317 std::istringstream iss(s);
4318 return !(iss >> f >> t).fail();
4325 extract_int(
const std::string &s)
4328 for (
const char c : s)
4330 if (isdigit(c) != 0)
4337 from_string(number, tmp, std::dec);
4343 template <
int dim,
int spacedim>
4345 Abaqus_to_UCD<dim, spacedim>::read_in_abaqus(std::istream &input_stream)
4354 while (std::getline(input_stream, line))
4357 std::transform(line.begin(), line.end(), line.begin(), ::toupper);
4359 if (line.compare(
"*HEADING") == 0 || line.compare(0, 2,
"**") == 0 ||
4360 line.compare(0, 5,
"*PART") == 0)
4363 while (std::getline(input_stream, line))
4369 else if (line.compare(0, 5,
"*NODE") == 0)
4378 while (std::getline(input_stream, line))
4383 std::vector<double> node(spacedim + 1);
4385 std::istringstream iss(line);
4387 for (
unsigned int i = 0; i < spacedim + 1; ++i)
4388 iss >> node[i] >> comma;
4390 node_list.push_back(node);
4393 else if (line.compare(0, 8,
"*ELEMENT") == 0)
4408 const std::string before_material =
"ELSET=EB";
4409 const std::size_t idx = line.find(before_material);
4410 if (idx != std::string::npos)
4412 from_string(material,
4413 line.substr(idx + before_material.size()),
4419 while (std::getline(input_stream, line))
4424 std::istringstream iss(line);
4430 const unsigned int n_data_per_cell =
4432 std::vector<double> cell(n_data_per_cell);
4433 for (
unsigned int i = 0; i < n_data_per_cell; ++i)
4434 iss >> cell[i] >> comma;
4437 cell[0] =
static_cast<double>(material);
4438 cell_list.push_back(cell);
4441 else if (line.compare(0, 8,
"*SURFACE") == 0)
4452 const std::string name_key =
"NAME=";
4453 const std::size_t name_idx_start =
4454 line.find(name_key) + name_key.size();
4455 std::size_t name_idx_end = line.find(
',', name_idx_start);
4456 if (name_idx_end == std::string::npos)
4458 name_idx_end = line.size();
4460 const int b_indicator = extract_int(
4461 line.substr(name_idx_start, name_idx_end - name_idx_start));
4468 while (std::getline(input_stream, line))
4482 std::istringstream iss(line);
4489 std::vector<double> quad_node_list;
4490 const std::string elset_name = line.substr(0, line.find(
','));
4491 if (elsets_list.count(elset_name) != 0)
4495 iss >> stmp >> temp >> face_number;
4497 const std::vector<int> cells = elsets_list[elset_name];
4498 for (
const int cell : cells)
4502 get_global_node_numbers(el_idx, face_number);
4503 quad_node_list.insert(quad_node_list.begin(),
4506 face_list.push_back(quad_node_list);
4513 iss >> el_idx >> comma >> temp >> face_number;
4515 get_global_node_numbers(el_idx, face_number);
4516 quad_node_list.insert(quad_node_list.begin(), b_indicator);
4518 face_list.push_back(quad_node_list);
4522 else if (line.compare(0, 6,
"*ELSET") == 0)
4526 std::string elset_name;
4528 const std::string elset_key =
"*ELSET, ELSET=";
4529 const std::size_t idx = line.find(elset_key);
4530 if (idx != std::string::npos)
4532 const std::string comma =
",";
4533 const std::size_t first_comma = line.find(comma);
4534 const std::size_t second_comma =
4535 line.find(comma, first_comma + 1);
4536 const std::size_t elset_name_start =
4537 line.find(elset_key) + elset_key.size();
4538 elset_name = line.substr(elset_name_start,
4539 second_comma - elset_name_start);
4549 std::vector<int> elements;
4550 const std::size_t generate_idx = line.find(
"GENERATE");
4551 if (generate_idx != std::string::npos)
4554 std::getline(input_stream, line);
4555 std::istringstream iss(line);
4565 iss >> elid_start >> comma >> elid_end;
4569 "While reading an ABAQUS file, the reader "
4570 "expected a comma but found a <") +
4571 comma +
"> in the line <" + line +
">."));
4573 elid_start <= elid_end,
4576 "While reading an ABAQUS file, the reader encountered "
4577 "a GENERATE statement in which the upper bound <") +
4579 "> for the element numbers is not larger or equal "
4580 "than the lower bound <" +
4584 if (iss.rdbuf()->in_avail() != 0)
4585 iss >> comma >> elis_step;
4589 "While reading an ABAQUS file, the reader "
4590 "expected a comma but found a <") +
4591 comma +
"> in the line <" + line +
">."));
4593 for (
int i = elid_start; i <= elid_end; i += elis_step)
4594 elements.push_back(i);
4595 elsets_list[elset_name] = elements;
4597 std::getline(input_stream, line);
4602 while (std::getline(input_stream, line))
4607 std::istringstream iss(line);
4612 iss >> elid >> comma;
4617 "While reading an ABAQUS file, the reader "
4618 "expected a comma but found a <") +
4619 comma +
"> in the line <" + line +
">."));
4621 elements.push_back(elid);
4625 elsets_list[elset_name] = elements;
4630 else if (line.compare(0, 5,
"*NSET") == 0)
4633 while (std::getline(input_stream, line))
4639 else if (line.compare(0, 14,
"*SOLID SECTION") == 0)
4643 const std::string elset_key =
"ELSET=";
4644 const std::size_t elset_start =
4645 line.find(
"ELSET=") + elset_key.size();
4646 const std::size_t elset_end = line.find(
',', elset_start + 1);
4647 const std::string elset_name =
4648 line.substr(elset_start, elset_end - elset_start);
4653 const std::string material_key =
"MATERIAL=";
4654 const std::size_t last_equal =
4655 line.find(
"MATERIAL=") + material_key.size();
4656 const std::size_t material_id_start = line.find(
'-', last_equal);
4659 line.substr(material_id_start + 1),
4663 const std::vector<int> &elset_cells = elsets_list[elset_name];
4664 for (
const int elset_cell : elset_cells)
4666 const int cell_id = elset_cell - 1;
4674 template <
int dim,
int spacedim>
4676 Abaqus_to_UCD<dim, spacedim>::get_global_node_numbers(
4677 const int face_cell_no,
4678 const int face_cell_face_no)
const
4688 if (face_cell_face_no == 1)
4690 quad_node_list[0] = cell_list[face_cell_no - 1][1];
4691 quad_node_list[1] = cell_list[face_cell_no - 1][2];
4693 else if (face_cell_face_no == 2)
4695 quad_node_list[0] = cell_list[face_cell_no - 1][2];
4696 quad_node_list[1] = cell_list[face_cell_no - 1][3];
4698 else if (face_cell_face_no == 3)
4700 quad_node_list[0] = cell_list[face_cell_no - 1][3];
4701 quad_node_list[1] = cell_list[face_cell_no - 1][4];
4703 else if (face_cell_face_no == 4)
4705 quad_node_list[0] = cell_list[face_cell_no - 1][4];
4706 quad_node_list[1] = cell_list[face_cell_no - 1][1];
4716 if (face_cell_face_no == 1)
4718 quad_node_list[0] = cell_list[face_cell_no - 1][1];
4719 quad_node_list[1] = cell_list[face_cell_no - 1][4];
4720 quad_node_list[2] = cell_list[face_cell_no - 1][3];
4721 quad_node_list[3] = cell_list[face_cell_no - 1][2];
4723 else if (face_cell_face_no == 2)
4725 quad_node_list[0] = cell_list[face_cell_no - 1][5];
4726 quad_node_list[1] = cell_list[face_cell_no - 1][8];
4727 quad_node_list[2] = cell_list[face_cell_no - 1][7];
4728 quad_node_list[3] = cell_list[face_cell_no - 1][6];
4730 else if (face_cell_face_no == 3)
4732 quad_node_list[0] = cell_list[face_cell_no - 1][1];
4733 quad_node_list[1] = cell_list[face_cell_no - 1][2];
4734 quad_node_list[2] = cell_list[face_cell_no - 1][6];
4735 quad_node_list[3] = cell_list[face_cell_no - 1][5];
4737 else if (face_cell_face_no == 4)
4739 quad_node_list[0] = cell_list[face_cell_no - 1][2];
4740 quad_node_list[1] = cell_list[face_cell_no - 1][3];
4741 quad_node_list[2] = cell_list[face_cell_no - 1][7];
4742 quad_node_list[3] = cell_list[face_cell_no - 1][6];
4744 else if (face_cell_face_no == 5)
4746 quad_node_list[0] = cell_list[face_cell_no - 1][3];
4747 quad_node_list[1] = cell_list[face_cell_no - 1][4];
4748 quad_node_list[2] = cell_list[face_cell_no - 1][8];
4749 quad_node_list[3] = cell_list[face_cell_no - 1][7];
4751 else if (face_cell_face_no == 6)
4753 quad_node_list[0] = cell_list[face_cell_no - 1][1];
4754 quad_node_list[1] = cell_list[face_cell_no - 1][5];
4755 quad_node_list[2] = cell_list[face_cell_no - 1][8];
4756 quad_node_list[3] = cell_list[face_cell_no - 1][4];
4769 return quad_node_list;
4772 template <
int dim,
int spacedim>
4774 Abaqus_to_UCD<dim, spacedim>::write_out_avs_ucd(std::ostream &output)
const
4783 const boost::io::ios_base_all_saver formatting_saver(output);
4787 output <<
"# Abaqus to UCD mesh conversion" << std::endl;
4788 output <<
"# Mesh type: AVS UCD" << std::endl;
4817 output << node_list.size() <<
"\t" << (cell_list.size() + face_list.size())
4818 <<
"\t0\t0\t0" << std::endl;
4821 output.precision(8);
4825 for (
const auto &node : node_list)
4828 output << node[0] <<
"\t";
4831 output.setf(std::ios::scientific, std::ios::floatfield);
4832 for (
unsigned int jj = 1; jj < spacedim + 1; ++jj)
4835 if (std::abs(node[jj]) > tolerance)
4836 output <<
static_cast<double>(node[jj]) <<
"\t";
4838 output << 0.0 <<
"\t";
4841 output << 0.0 <<
"\t";
4843 output << std::endl;
4844 output.unsetf(std::ios::floatfield);
4848 for (
unsigned int ii = 0; ii < cell_list.size(); ++ii)
4850 output << ii + 1 <<
"\t" << cell_list[ii][0] <<
"\t"
4851 << (dim == 2 ?
"quad" :
"hex") <<
"\t";
4852 for (
unsigned int jj = 1; jj < GeometryInfo<dim>::vertices_per_cell + 1;
4854 output << cell_list[ii][jj] <<
"\t";
4856 output << std::endl;
4860 for (
unsigned int ii = 0; ii < face_list.size(); ++ii)
4862 output << ii + 1 <<
"\t" << face_list[ii][0] <<
"\t"
4863 << (dim == 2 ?
"line" :
"quad") <<
"\t";
4864 for (
unsigned int jj = 1; jj < GeometryInfo<dim>::vertices_per_face + 1;
4866 output << face_list[ii][jj] <<
"\t";
4868 output << std::endl;
4875 #include "grid_in.inst"
void read_vtk(std::istream &in)
static void skip_empty_lines(std::istream &in)
void read_assimp(const std::string &filename, const unsigned int mesh_index=numbers::invalid_unsigned_int, const bool remove_duplicates=true, const double tol=1e-12, const bool ignore_unsupported_element_types=true)
static void debug_output_grid(const std::vector< CellData< dim >> &cells, const std::vector< Point< spacedim >> &vertices, std::ostream &out)
void read_abaqus(std::istream &in, const bool apply_all_indicators_to_manifolds=false)
static std::string default_suffix(const Format format)
void read_xda(std::istream &in)
void read_comsol_mphtxt(std::istream &in)
static void skip_comment_lines(std::istream &in, const char comment_start)
void attach_triangulation(Triangulation< dim, spacedim > &tria)
void read_msh(std::istream &in)
static Format parse_format(const std::string &format_name)
void read_vtu(std::istream &in)
void read_tecplot(std::istream &in)
ExodusIIData read_exodusii(const std::string &filename, const bool apply_all_indicators_to_manifolds=false)
void read_dbmesh(std::istream &in)
void read_ucd(std::istream &in, const bool apply_all_indicators_to_manifolds=false)
void read(std::istream &in, Format format=Default)
static std::string get_format_names()
void read_unv(std::istream &in)
static void parse_tecplot_header(std::string &header, std::vector< unsigned int > &tecplot2deal, unsigned int &n_vars, unsigned int &n_vertices, unsigned int &n_cells, std::vector< unsigned int > &IJK, bool &structured, bool &blocked)
std::string find(const std::string &filename, const char *open_mode="r")
std_cxx20::ranges::iota_view< unsigned int, unsigned int > vertex_indices() const
unsigned int n_vertices() const
unsigned int face_to_cell_vertices(const unsigned int face, const unsigned int vertex, const unsigned char face_orientation) const
unsigned int exodusii_vertex_to_deal_vertex(const unsigned int vertex_n) const
unsigned int get_dimension() const
ReferenceCell face_reference_cell(const unsigned int face_no) const
unsigned int exodusii_face_to_deal_face(const unsigned int face_n) const
static ReferenceCell n_vertices_to_type(const int dim, const unsigned int n_vertices)
virtual void create_triangulation(const std::vector< Point< spacedim >> &vertices, const std::vector< CellData< dim >> &cells, const SubCellData &subcelldata)
void load(Archive &ar, const unsigned int version)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_FALLTHROUGH
IteratorRange< active_cell_iterator > active_cell_iterators() const
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcNeedsAssimp()
static ::ExceptionBase & ExcNoTriangulationSelected()
#define Assert(cond, exc)
static ::ExceptionBase & ExcNotImplemented()
static ::ExceptionBase & ExcInvalidState()
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInvalidVertexIndex(int arg1, int arg2, int arg3)
static ::ExceptionBase & ExcIndexRange(std::size_t arg1, std::size_t arg2, std::size_t arg3)
static ::ExceptionBase & ExcIO()
static ::ExceptionBase & ExcMessage(std::string arg1)
static ::ExceptionBase & ExcNeedsExodusII()
#define AssertThrow(cond, exc)
std::string default_suffix(const OutputFormat output_format)
void reference_cell(Triangulation< dim, spacedim > &tria, const ReferenceCell &reference_cell)
types::global_dof_index size_type
void swap(MemorySpaceData< T, MemorySpace > &u, MemorySpaceData< T, MemorySpace > &v)
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
constexpr const ReferenceCell Tetrahedron
constexpr const ReferenceCell Quadrilateral
constexpr const ReferenceCell Wedge
constexpr const ReferenceCell Pyramid
constexpr const ReferenceCell Invalid
constexpr const ReferenceCell Triangle
constexpr const ReferenceCell Hexahedron
constexpr const ReferenceCell Vertex
constexpr const ReferenceCell Line
std::pair< int, unsigned int > get_integer_at_position(const std::string &name, const unsigned int position)
std::vector< unsigned char > decode_base64(const std::string &base64_input)
std::vector< std::string > break_text_into_lines(const std::string &original_text, const unsigned int width, const char delimiter=' ')
std::string int_to_string(const unsigned int value, const unsigned int digits=numbers::invalid_unsigned_int)
bool match_at_string_start(const std::string &name, const std::string &pattern)
std::string decompress(const std::string &compressed_input)
Iterator lower_bound(Iterator first, Iterator last, const T &val)
std::string trim(const std::string &input)
unsigned int n_cells(const internal::TriangulationImplementation::NumberCache< 1 > &c)
const types::material_id invalid_material_id
const types::boundary_id internal_face_boundary_id
static const unsigned int invalid_unsigned_int
const types::manifold_id flat_manifold_id
void transform(const InputIterator &begin_in, const InputIterator &end_in, OutputIterator out, const Function &function, const unsigned int grainsize)
const ::parallel::distributed::Triangulation< dim, spacedim > * triangulation
std::vector< unsigned int > vertices
types::material_id material_id
std::vector< std::vector< int > > id_to_sideset_ids
std::vector< CellData< 2 > > boundary_quads
bool check_consistency(const unsigned int dim) const
std::vector< CellData< 1 > > boundary_lines
const ::Triangulation< dim, spacedim > & tria