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
44#ifdef DEAL_II_WITH_ASSIMP
45# include <assimp/Importer.hpp>
46# include <assimp/postprocess.h>
47# include <assimp/scene.h>
50#ifdef DEAL_II_TRILINOS_WITH_SEACAS
68 template <
int spacedim>
70 assign_1d_boundary_ids(
71 const std::map<unsigned int, types::boundary_id> &boundary_ids,
74 if (boundary_ids.size() > 0)
75 for (
const auto &cell :
triangulation.active_cell_iterators())
77 if (boundary_ids.find(cell->vertex_index(f)) != boundary_ids.end())
82 "You are trying to prescribe boundary ids on the face "
83 "of a 1d cell (i.e., on a vertex), but this face is not actually at "
84 "the boundary of the mesh. This is not allowed."));
85 cell->face(f)->set_boundary_id(
86 boundary_ids.find(cell->vertex_index(f))->second);
91 template <
int dim,
int spacedim>
93 assign_1d_boundary_ids(
const std::map<unsigned int, types::boundary_id> &,
102template <
int dim,
int spacedim>
104 :
tria(nullptr, typeid(*this).name())
105 , default_format(ucd)
110template <
int dim,
int spacedim>
112 :
tria(&t, typeid(*this).name())
113 , default_format(ucd)
118template <
int dim,
int spacedim>
127template <
int dim,
int spacedim>
139 text[0] =
"# vtk DataFile Version 3.0";
142 text[3] =
"DATASET UNSTRUCTURED_GRID";
144 for (
unsigned int i = 0; i < 4; ++i)
149 line.compare(text[i]) == 0,
152 "While reading VTK file, failed to find a header line with text <") +
159 std::vector<Point<spacedim>>
vertices;
160 std::vector<CellData<dim>> cells;
169 if (keyword ==
"POINTS")
171 unsigned int n_vertices;
176 for (
unsigned int vertex = 0; vertex < n_vertices; ++vertex)
180 in >> x(0) >> x(1) >> x(2);
183 for (
unsigned int d = 0; d < spacedim; ++d)
191 "While reading VTK file, failed to find POINTS section"));
195 unsigned int n_geometric_objects = 0;
198 bool is_quad_or_hex_mesh =
false;
199 bool is_tria_or_tet_mesh =
false;
201 if (keyword ==
"CELLS")
204 std::vector<unsigned int> cell_types;
206 std::streampos oldpos = in.tellg();
209 while (in >> keyword)
210 if (keyword ==
"CELL_TYPES")
214 cell_types.resize(n_ints);
216 for (
unsigned int i = 0; i < n_ints; ++i)
225 in >> n_geometric_objects;
230 for (
unsigned int count = 0; count < n_geometric_objects; ++count)
232 unsigned int n_vertices;
236 if (cell_types[count] == 10 || cell_types[count] == 12)
238 if (cell_types[count] == 10)
239 is_tria_or_tet_mesh =
true;
240 if (cell_types[count] == 12)
241 is_quad_or_hex_mesh =
true;
249 cells.emplace_back(n_vertices);
251 for (
unsigned int j = 0; j < n_vertices;
253 in >> cells.back().vertices[j];
257 if (cell_types[count] == 12)
259 std::swap(cells.back().vertices[2],
260 cells.back().vertices[3]);
261 std::swap(cells.back().vertices[6],
262 cells.back().vertices[7]);
265 cells.back().material_id = 0;
268 else if (cell_types[count] == 5 || cell_types[count] == 9)
270 if (cell_types[count] == 5)
271 is_tria_or_tet_mesh =
true;
272 if (cell_types[count] == 9)
273 is_quad_or_hex_mesh =
true;
282 for (
unsigned int j = 0; j < n_vertices;
289 else if (cell_types[count] == 3)
293 for (
unsigned int j = 0; j < n_vertices;
304 "While reading VTK file, unknown cell type encountered"));
309 for (
unsigned int count = 0; count < n_geometric_objects; ++count)
311 unsigned int n_vertices;
315 if (cell_types[count] == 5 || cell_types[count] == 9)
322 if (cell_types[count] == 5)
323 is_tria_or_tet_mesh =
true;
324 if (cell_types[count] == 9)
325 is_quad_or_hex_mesh =
true;
327 cells.emplace_back(n_vertices);
329 for (
unsigned int j = 0; j < n_vertices;
331 in >> cells.back().vertices[j];
335 if (cell_types[count] == 9)
339 std::swap(cells.back().vertices[2],
340 cells.back().vertices[3]);
343 cells.back().material_id = 0;
346 else if (cell_types[count] == 3)
352 for (
unsigned int j = 0; j < n_vertices;
365 "While reading VTK file, unknown cell type encountered"));
370 for (
unsigned int count = 0; count < n_geometric_objects; ++count)
376 cell_types[count] == 3 && type == 2,
378 "While reading VTK file, unknown cell type encountered"));
379 cells.emplace_back(type);
381 for (
unsigned int j = 0; j < type; ++j)
382 in >> cells.back().vertices[j];
384 cells.back().material_id = 0;
390 "While reading VTK file, failed to find CELLS section"));
397 keyword ==
"CELL_TYPES",
399 "While reading VTK file, missing CELL_TYPES section. Found <" +
400 keyword +
"> instead.")));
404 n_ints == n_geometric_objects,
405 ExcMessage(
"The VTK reader found a CELL_DATA statement "
406 "that lists a total of " +
408 " cell data objects, but this needs to "
409 "equal the number of cells (which is " +
411 ") plus the number of quads (" +
413 " in 3d or the number of lines (" +
418 for (
unsigned int i = 0; i < n_ints; ++i)
422 while (in >> keyword)
423 if (keyword ==
"CELL_DATA")
429 ExcMessage(
"The VTK reader found a CELL_DATA statement "
430 "that lists a total of " +
432 " cell data objects, but this needs to "
433 "equal the number of cells (which is " +
435 ") plus the number of quads (" +
438 " in 3d or the number of lines (" +
443 const std::vector<std::string> data_sets{
"MaterialID",
446 for (
unsigned int i = 0; i < data_sets.size(); ++i)
449 while (in >> keyword)
450 if (keyword ==
"SCALARS")
455 std::string field_name;
457 if (std::find(data_sets.begin(),
459 field_name) == data_sets.end())
471 std::getline(in, line);
474 std::min(
static_cast<std::size_t
>(3),
475 line.size() - 1)) ==
"int",
477 "While reading VTK file, material- and manifold IDs can only have type 'int'."));
481 keyword ==
"LOOKUP_TABLE",
483 "While reading VTK file, missing keyword 'LOOKUP_TABLE'."));
487 keyword ==
"default",
489 "While reading VTK file, missing keyword 'default'."));
496 for (
unsigned int i = 0; i < cells.size(); ++i)
500 if (field_name ==
"MaterialID")
501 cells[i].material_id =
503 else if (field_name ==
"ManifoldID")
504 cells[i].manifold_id =
516 if (field_name ==
"MaterialID")
517 boundary_quad.material_id =
519 else if (field_name ==
"ManifoldID")
520 boundary_quad.manifold_id =
529 if (field_name ==
"MaterialID")
530 boundary_line.material_id =
532 else if (field_name ==
"ManifoldID")
533 boundary_line.manifold_id =
545 if (field_name ==
"MaterialID")
546 boundary_line.material_id =
548 else if (field_name ==
"ManifoldID")
549 boundary_line.manifold_id =
567 if (dim == 1 || (is_quad_or_hex_mesh && !is_tria_or_tet_mesh))
586 "While reading VTK file, failed to find CELLS section"));
591template <
int dim,
int spacedim>
595 namespace pt = boost::property_tree;
597 pt::read_xml(in, tree);
598 auto section = tree.get_optional<std::string>(
"VTKFile.dealiiData");
602 "While reading a VTU file, failed to find dealiiData section. "
603 "Notice that we can only read grid files in .vtu format that "
604 "were created by the deal.II library, using a call to "
605 "GridOut::write_vtu(), where the flag "
606 "GridOutFlags::Vtu::serialize_triangulation is set to true."));
610 const auto string_archive =
612 std::istringstream in_stream(string_archive);
613 boost::archive::binary_iarchive ia(in_stream);
618template <
int dim,
int spacedim>
622 Assert(
tria !=
nullptr, ExcNoTriangulationSelected());
626 skip_comment_lines(in,
'#');
637 "Expected '-1' before and after a section."));
649 std::getline(in, line);
651 boost::algorithm::trim(line);
652 if (line.compare(
"-1") == 0)
663 std::vector<Point<spacedim>>
vertices;
682 in >> dummy >> dummy >> dummy;
685 in >> x[0] >> x[1] >> x[2];
689 for (
unsigned int d = 0; d < spacedim; ++d)
704 AssertThrow(tmp == 2412, ExcUnknownSectionType(tmp));
706 std::vector<CellData<dim>> cells;
733 in >> type >> dummy >> dummy >> dummy >> dummy;
735 AssertThrow((type == 11) || (type == 44) || (type == 94) || (type == 115),
736 ExcUnknownElementType(type));
738 if ((((type == 44) || (type == 94)) && (dim == 2)) ||
739 ((type == 115) && (dim == 3)))
741 const auto reference_cell = ReferenceCells::get_hypercube<dim>();
742 cells.emplace_back();
747 .vertices[reference_cell.unv_vertex_to_deal_vertex(v)];
749 cells.back().material_id = 0;
752 cells.back().vertices[v] =
vertex_indices[cells.back().vertices[v]];
754 cell_indices[no] = no_cell;
758 else if (((type == 11) && (dim == 2)) ||
759 ((type == 11) && (dim == 3)))
762 in >> dummy >> dummy >> dummy;
767 for (
unsigned int &vertex :
773 for (
unsigned int &vertex :
777 line_indices[no] = no_line;
781 else if (((type == 44) || (type == 94)) && (dim == 3))
792 .vertices[reference_cell.unv_vertex_to_deal_vertex(v)];
796 for (
unsigned int &vertex :
800 quad_indices[no] = no_quad;
808 "> when running in dim=" +
827 AssertThrow((tmp == 2467) || (tmp == 2477), ExcUnknownSectionType(tmp));
843 in >> dummy >> dummy >> dummy >> dummy >> dummy >> dummy >>
849 const unsigned int n_lines =
850 (n_entities % 2 == 0) ? (n_entities / 2) : ((n_entities + 1) / 2);
852 for (
unsigned int line = 0; line < n_lines; ++line)
854 unsigned int n_fragments;
856 if (line == n_lines - 1)
857 n_fragments = (n_entities % 2 == 0) ? (2) : (1);
861 for (
unsigned int no_fragment = 0; no_fragment < n_fragments;
865 in >> dummy >> no >> dummy >> dummy;
867 if (cell_indices.count(no) > 0)
868 cells[cell_indices[no]].material_id = id;
870 if (line_indices.count(no) > 0)
874 if (quad_indices.count(no) > 0)
896template <
int dim,
int spacedim>
899 const bool apply_all_indicators_to_manifolds)
901 Assert(
tria !=
nullptr, ExcNoTriangulationSelected());
905 skip_comment_lines(in,
'#');
908 unsigned int n_vertices;
909 unsigned int n_cells;
912 in >> n_vertices >> n_cells >> dummy
918 std::vector<Point<spacedim>>
vertices(n_vertices);
924 for (
unsigned int vertex = 0; vertex < n_vertices; ++vertex)
931 in >> vertex_number >> x[0] >> x[1] >> x[2];
934 for (
unsigned int d = 0; d < spacedim; ++d)
943 std::vector<CellData<dim>> cells;
946 for (
unsigned int cell = 0; cell < n_cells; ++cell)
955 std::string cell_type;
959 unsigned int material_id;
965 if (((cell_type ==
"line") && (dim == 1)) ||
966 ((cell_type ==
"quad") && (dim == 2)) ||
967 ((cell_type ==
"hex") && (dim == 3)))
971 cells.emplace_back();
976 Assert(material_id <= std::numeric_limits<types::material_id>::max(),
979 std::numeric_limits<types::material_id>::max()));
984 if (apply_all_indicators_to_manifolds)
985 cells.back().manifold_id =
987 cells.back().material_id = material_id;
995 cells.back().vertices[i] =
1001 ExcInvalidVertexIndex(cell,
1002 cells.back().vertices[i]));
1007 else if ((cell_type ==
"line") && ((dim == 2) || (dim == 3)))
1015 Assert(material_id <= std::numeric_limits<types::boundary_id>::max(),
1018 std::numeric_limits<types::boundary_id>::max()));
1027 if (apply_all_indicators_to_manifolds)
1044 for (
unsigned int &vertex :
1052 AssertThrow(
false, ExcInvalidVertexIndex(cell, vertex));
1056 else if ((cell_type ==
"quad") && (dim == 3))
1065 Assert(material_id <= std::numeric_limits<types::boundary_id>::max(),
1068 std::numeric_limits<types::boundary_id>::max()));
1077 if (apply_all_indicators_to_manifolds)
1094 for (
unsigned int &vertex :
1102 Assert(
false, ExcInvalidVertexIndex(cell, vertex));
1108 AssertThrow(
false, ExcUnknownIdentifier(cell_type));
1120 if (dim == spacedim)
1128 template <
int dim,
int spacedim>
1135 read_in_abaqus(std::istream &in);
1137 write_out_avs_ucd(std::ostream &out)
const;
1140 const double tolerance;
1143 get_global_node_numbers(
const int face_cell_no,
1144 const int face_cell_face_no)
const;
1147 std::vector<std::vector<double>> node_list;
1150 std::vector<std::vector<double>> cell_list;
1152 std::vector<std::vector<double>> face_list;
1155 std::map<std::string, std::vector<int>> elsets_list;
1159template <
int dim,
int spacedim>
1162 const bool apply_all_indicators_to_manifolds)
1164 Assert(
tria !=
nullptr, ExcNoTriangulationSelected());
1169 Assert((spacedim == 2 && dim == spacedim) ||
1170 (spacedim == 3 && (dim == spacedim || dim == spacedim - 1)),
1176 Abaqus_to_UCD<dim, spacedim> abaqus_to_ucd;
1177 abaqus_to_ucd.read_in_abaqus(in);
1179 std::stringstream in_ucd;
1180 abaqus_to_ucd.write_out_avs_ucd(in_ucd);
1188 read_ucd(in_ucd, apply_all_indicators_to_manifolds);
1190 catch (std::exception &exc)
1192 std::cerr <<
"Exception on processing internal UCD data: " << std::endl
1193 << exc.what() << std::endl;
1198 "Internal conversion from ABAQUS file to UCD format was unsuccessful. "
1199 "More information is provided in an error message printed above. "
1200 "Are you sure that your ABAQUS mesh file conforms with the requirements "
1201 "listed in the documentation?"));
1208 "Internal conversion from ABAQUS file to UCD format was unsuccessful. "
1209 "Are you sure that your ABAQUS mesh file conforms with the requirements "
1210 "listed in the documentation?"));
1215template <
int dim,
int spacedim>
1219 Assert(
tria !=
nullptr, ExcNoTriangulationSelected());
1225 skip_comment_lines(in,
'#');
1231 AssertThrow(line ==
"MeshVersionFormatted 0", ExcInvalidDBMESHInput(line));
1233 skip_empty_lines(in);
1237 AssertThrow(line ==
"Dimension", ExcInvalidDBMESHInput(line));
1238 unsigned int dimension;
1240 AssertThrow(dimension == dim, ExcDBMESHWrongDimension(dimension));
1241 skip_empty_lines(in);
1254 while (getline(in, line), line.find(
"# END") == std::string::npos)
1256 skip_empty_lines(in);
1261 AssertThrow(line ==
"Vertices", ExcInvalidDBMESHInput(line));
1263 unsigned int n_vertices;
1267 std::vector<Point<spacedim>>
vertices(n_vertices);
1268 for (
unsigned int vertex = 0; vertex < n_vertices; ++vertex)
1271 for (
unsigned int d = 0; d < dim; ++d)
1278 skip_empty_lines(in);
1284 AssertThrow(line ==
"Edges", ExcInvalidDBMESHInput(line));
1286 unsigned int n_edges;
1288 for (
unsigned int edge = 0; edge < n_edges; ++edge)
1291 in >> dummy >> dummy;
1297 skip_empty_lines(in);
1306 AssertThrow(line ==
"CrackedEdges", ExcInvalidDBMESHInput(line));
1309 for (
unsigned int edge = 0; edge < n_edges; ++edge)
1312 in >> dummy >> dummy;
1318 skip_empty_lines(in);
1324 AssertThrow(line ==
"Quadrilaterals", ExcInvalidDBMESHInput(line));
1326 std::vector<CellData<dim>> cells;
1328 unsigned int n_cells;
1330 for (
unsigned int cell = 0; cell < n_cells; ++cell)
1334 cells.emplace_back();
1340 (
static_cast<unsigned int>(cells.back().vertices[i]) <=
1342 ExcInvalidVertexIndex(cell, cells.back().vertices[i]));
1344 --cells.back().vertices[i];
1352 skip_empty_lines(in);
1360 while (getline(in, line), ((line.find(
"End") == std::string::npos) && (in)))
1381template <
int dim,
int spacedim>
1385 Assert(
tria !=
nullptr, ExcNoTriangulationSelected());
1388 const auto reference_cell = ReferenceCells::get_hypercube<dim>();
1392 std::getline(in, line);
1394 unsigned int n_vertices;
1395 unsigned int n_cells;
1399 std::getline(in, line);
1402 std::getline(in, line);
1405 for (
unsigned int i = 0; i < 8; ++i)
1406 std::getline(in, line);
1409 std::vector<CellData<dim>> cells(n_cells);
1420 for (
unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
1421 in >> cell.vertices[reference_cell.exodusii_vertex_to_deal_vertex(i)];
1425 std::vector<Point<spacedim>>
vertices(n_vertices);
1428 for (
unsigned int d = 0; d < spacedim; ++d)
1430 for (
unsigned int d = spacedim; d < 3; ++d)
1449template <
int dim,
int spacedim>
1453 Assert(
tria !=
nullptr, ExcNoTriangulationSelected());
1466 std::stringstream whole_file;
1471 std::getline(in, line);
1476 if (line.find(
'#') != std::string::npos)
1477 line.erase(line.find(
'#'), std::string::npos);
1478 while ((line.size() > 0) && (line.back() ==
' '))
1479 line.erase(line.size() - 1);
1481 if (line.size() > 0)
1482 whole_file <<
'\n' << line;
1501 unsigned int version_major, version_minor;
1502 whole_file >> version_major >> version_minor;
1503 AssertThrow((version_major == 0) && (version_minor == 1),
1504 ExcMessage(
"deal.II can currently only read version 0.1 "
1505 "of the mphtxt file format."));
1510 unsigned int n_tags;
1511 whole_file >> n_tags;
1512 for (
unsigned int i = 0; i < n_tags; ++i)
1515 while (whole_file.peek() ==
'\n')
1517 std::getline(whole_file, dummy);
1523 unsigned int n_types;
1524 whole_file >> n_types;
1525 for (
unsigned int i = 0; i < n_types; ++i)
1528 while (whole_file.peek() ==
'\n')
1530 std::getline(whole_file, dummy);
1550 whole_file >> dummy >> dummy >> dummy;
1554 while (whole_file.peek() ==
'\n')
1556 std::getline(whole_file, s);
1560 unsigned int version;
1561 whole_file >> version;
1565 unsigned int file_space_dim;
1566 whole_file >> file_space_dim;
1570 "The mesh file uses a different number of space dimensions "
1571 "than the triangulation you want to read it into."));
1573 unsigned int n_vertices;
1574 whole_file >> n_vertices;
1576 unsigned int starting_vertex_index;
1577 whole_file >> starting_vertex_index;
1579 std::vector<Point<spacedim>>
vertices(n_vertices);
1580 for (
unsigned int v = 0; v < n_vertices; ++v)
1611 std::vector<CellData<dim>> cells;
1614 unsigned int n_types;
1615 whole_file >> n_types;
1616 for (
unsigned int type = 0; type < n_types; ++type)
1623 whole_file >> dummy;
1627 std::string object_name;
1628 whole_file >> object_name;
1630 static const std::map<std::string, ReferenceCell> name_to_type = {
1640 AssertThrow(name_to_type.find(object_name) != name_to_type.end(),
1641 ExcMessage(
"The input file contains a cell type <" +
1643 "> that the reader does not "
1644 "current support"));
1645 const ReferenceCell object_type = name_to_type.at(object_name);
1647 unsigned int n_vertices_per_element;
1648 whole_file >> n_vertices_per_element;
1650 unsigned int n_elements;
1651 whole_file >> n_elements;
1665 ExcMessage(
"Triangles should not appear in input files "
1673 "Quadrilaterals should not appear in input files "
1680 ExcMessage(
"Tetrahedra should not appear in input files "
1681 "for 1d or 2d meshes."));
1688 "Prisms (wedges) should not appear in input files "
1689 "for 1d or 2d meshes."));
1708 std::vector<unsigned int> vertices_for_this_element(
1709 n_vertices_per_element);
1710 for (
unsigned int e = 0; e < n_elements; ++e)
1713 for (
unsigned int v = 0; v < n_vertices_per_element; ++v)
1715 whole_file >> vertices_for_this_element[v];
1716 vertices_for_this_element[v] -= starting_vertex_index;
1725 cells.emplace_back();
1726 cells.back().vertices = vertices_for_this_element;
1732 vertices_for_this_element;
1740 cells.emplace_back();
1741 cells.back().vertices = vertices_for_this_element;
1747 vertices_for_this_element;
1755 cells.emplace_back();
1756 cells.back().vertices = vertices_for_this_element;
1769 unsigned int n_geom_entity_indices;
1770 whole_file >> n_geom_entity_indices;
1772 (n_geom_entity_indices == n_elements),
1779 if (n_geom_entity_indices != 0)
1781 for (
unsigned int e = 0; e < n_geom_entity_indices; ++e)
1784 unsigned int geometric_entity_index;
1785 whole_file >> geometric_entity_index;
1791 cells[cells.size() - n_elements + e].material_id =
1792 geometric_entity_index;
1797 .boundary_id = geometric_entity_index;
1803 cells[cells.size() - n_elements + e].material_id =
1804 geometric_entity_index;
1809 .boundary_id = geometric_entity_index;
1815 cells[cells.size() - n_elements + e].material_id =
1816 geometric_entity_index;
1842 if (line.vertices[1] < line.vertices[0])
1843 std::swap(line.vertices[0], line.vertices[1]);
1848 return std::lexicographical_compare(a.vertices.begin(),
1870 Assert((face.vertices.size() == 3) || (face.vertices.size() == 4),
1872 std::sort(face.vertices.begin(), face.vertices.end());
1877 return std::lexicographical_compare(a.vertices.begin(),
1888 for (
const auto &face : cell->face_iterators())
1889 if (face->at_boundary())
1895 std::array<unsigned int, 2> face_vertex_indices = {
1896 {face->vertex_index(0), face->vertex_index(1)}};
1897 if (face_vertex_indices[0] > face_vertex_indices[1])
1898 std::swap(face_vertex_indices[0], face_vertex_indices[1]);
1904 face_vertex_indices,
1906 const std::array<unsigned int, 2>
1907 &face_vertex_indices) ->
bool {
1908 return std::lexicographical_compare(
1911 face_vertex_indices.begin(),
1912 face_vertex_indices.end());
1916 (p->vertices[0] == face_vertex_indices[0]) &&
1917 (p->vertices[1] == face_vertex_indices[1]))
1919 face->set_boundary_id(p->boundary_id);
1927 std::vector<unsigned int> face_vertex_indices(
1928 face->n_vertices());
1929 for (
unsigned int v = 0; v < face->n_vertices(); ++v)
1930 face_vertex_indices[v] = face->vertex_index(v);
1931 std::sort(face_vertex_indices.begin(),
1932 face_vertex_indices.end());
1938 face_vertex_indices,
1940 const std::vector<unsigned int>
1941 &face_vertex_indices) ->
bool {
1942 return std::lexicographical_compare(
1945 face_vertex_indices.begin(),
1946 face_vertex_indices.end());
1950 (p->vertices == face_vertex_indices))
1952 face->set_boundary_id(p->boundary_id);
1957 for (
unsigned int e = 0; e < face->n_lines(); ++e)
1959 const auto edge = face->line(e);
1961 std::array<unsigned int, 2> edge_vertex_indices = {
1962 {edge->vertex_index(0), edge->vertex_index(1)}};
1963 if (edge_vertex_indices[0] > edge_vertex_indices[1])
1964 std::swap(edge_vertex_indices[0],
1965 edge_vertex_indices[1]);
1971 edge_vertex_indices,
1973 const std::array<unsigned int, 2>
1974 &edge_vertex_indices) ->
bool {
1975 return std::lexicographical_compare(
1978 edge_vertex_indices.begin(),
1979 edge_vertex_indices.end());
1983 (p->vertices[0] == edge_vertex_indices[0]) &&
1984 (p->vertices[1] == edge_vertex_indices[1]))
1986 edge->set_boundary_id(p->boundary_id);
1995template <
int dim,
int spacedim>
1999 Assert(
tria !=
nullptr, ExcNoTriangulationSelected());
2002 unsigned int n_vertices;
2003 unsigned int n_cells;
2009 std::array<std::map<int, int>, 4> tag_maps;
2014 unsigned int gmsh_file_format = 0;
2015 if (line ==
"@f$NOD")
2016 gmsh_file_format = 10;
2017 else if (line ==
"@f$MeshFormat")
2018 gmsh_file_format = 20;
2024 if (gmsh_file_format == 20)
2027 unsigned int file_type, data_size;
2029 in >> version >> file_type >> data_size;
2032 gmsh_file_format =
static_cast<unsigned int>(version * 10);
2040 AssertThrow(line ==
"@f$EndMeshFormat", ExcInvalidGMSHInput(line));
2044 if (line ==
"@f$PhysicalNames")
2050 while (line !=
"@f$EndPhysicalNames");
2055 if (line ==
"@f$Entities")
2057 unsigned long n_points, n_curves, n_surfaces, n_volumes;
2059 in >> n_points >> n_curves >> n_surfaces >> n_volumes;
2060 for (
unsigned int i = 0; i < n_points; ++i)
2064 unsigned int n_physicals;
2065 double box_min_x, box_min_y, box_min_z, box_max_x, box_max_y,
2069 if (gmsh_file_format > 40)
2071 in >> tag >> box_min_x >> box_min_y >> box_min_z >>
2073 box_max_x = box_min_x;
2074 box_max_y = box_min_y;
2075 box_max_z = box_min_z;
2079 in >> tag >> box_min_x >> box_min_y >> box_min_z >>
2080 box_max_x >> box_max_y >> box_max_z >> n_physicals;
2085 ExcMessage(
"More than one tag is not supported!"));
2087 int physical_tag = 0;
2088 for (
unsigned int j = 0; j < n_physicals; ++j)
2090 tag_maps[0][tag] = physical_tag;
2092 for (
unsigned int i = 0; i < n_curves; ++i)
2096 unsigned int n_physicals;
2097 double box_min_x, box_min_y, box_min_z, box_max_x, box_max_y,
2101 in >> tag >> box_min_x >> box_min_y >> box_min_z >> box_max_x >>
2102 box_max_y >> box_max_z >> n_physicals;
2106 ExcMessage(
"More than one tag is not supported!"));
2108 int physical_tag = 0;
2109 for (
unsigned int j = 0; j < n_physicals; ++j)
2111 tag_maps[1][tag] = physical_tag;
2116 for (
unsigned int j = 0; j < n_points; ++j)
2120 for (
unsigned int i = 0; i < n_surfaces; ++i)
2124 unsigned int n_physicals;
2125 double box_min_x, box_min_y, box_min_z, box_max_x, box_max_y,
2129 in >> tag >> box_min_x >> box_min_y >> box_min_z >> box_max_x >>
2130 box_max_y >> box_max_z >> n_physicals;
2134 ExcMessage(
"More than one tag is not supported!"));
2136 int physical_tag = 0;
2137 for (
unsigned int j = 0; j < n_physicals; ++j)
2139 tag_maps[2][tag] = physical_tag;
2144 for (
unsigned int j = 0; j < n_curves; ++j)
2147 for (
unsigned int i = 0; i < n_volumes; ++i)
2151 unsigned int n_physicals;
2152 double box_min_x, box_min_y, box_min_z, box_max_x, box_max_y,
2156 in >> tag >> box_min_x >> box_min_y >> box_min_z >> box_max_x >>
2157 box_max_y >> box_max_z >> n_physicals;
2161 ExcMessage(
"More than one tag is not supported!"));
2163 int physical_tag = 0;
2164 for (
unsigned int j = 0; j < n_physicals; ++j)
2166 tag_maps[3][tag] = physical_tag;
2171 for (
unsigned int j = 0; j < n_surfaces; ++j)
2175 AssertThrow(line ==
"@f$EndEntities", ExcInvalidGMSHInput(line));
2180 if (line ==
"@f$PartitionedEntities")
2186 while (line !=
"@f$EndPartitionedEntities");
2193 AssertThrow(line ==
"@f$Nodes", ExcInvalidGMSHInput(line));
2197 int n_entity_blocks = 1;
2198 if (gmsh_file_format > 40)
2202 in >> n_entity_blocks >> n_vertices >> min_node_tag >> max_node_tag;
2204 else if (gmsh_file_format == 40)
2206 in >> n_entity_blocks >> n_vertices;
2210 std::vector<Point<spacedim>>
vertices(n_vertices);
2217 unsigned int global_vertex = 0;
2218 for (
int entity_block = 0; entity_block < n_entity_blocks; ++entity_block)
2221 unsigned long numNodes;
2223 if (gmsh_file_format < 40)
2225 numNodes = n_vertices;
2232 int tagEntity, dimEntity;
2233 in >> tagEntity >> dimEntity >> parametric >> numNodes;
2236 std::vector<int> vertex_numbers;
2238 if (gmsh_file_format > 40)
2239 for (
unsigned long vertex_per_entity = 0;
2240 vertex_per_entity < numNodes;
2241 ++vertex_per_entity)
2243 in >> vertex_number;
2244 vertex_numbers.push_back(vertex_number);
2247 for (
unsigned long vertex_per_entity = 0; vertex_per_entity < numNodes;
2248 ++vertex_per_entity, ++global_vertex)
2254 if (gmsh_file_format > 40)
2256 vertex_number = vertex_numbers[vertex_per_entity];
2257 in >> x[0] >> x[1] >> x[2];
2260 in >> vertex_number >> x[0] >> x[1] >> x[2];
2262 for (
unsigned int d = 0; d < spacedim; ++d)
2268 if (parametric != 0)
2283 static const std::string end_nodes_marker[] = {
"@f$ENDNOD",
"@f$EndNodes"};
2284 AssertThrow(line == end_nodes_marker[gmsh_file_format == 10 ? 0 : 1],
2285 ExcInvalidGMSHInput(line));
2289 static const std::string begin_elements_marker[] = {
"@f$ELM",
"@f$Elements"};
2290 AssertThrow(line == begin_elements_marker[gmsh_file_format == 10 ? 0 : 1],
2291 ExcInvalidGMSHInput(line));
2294 if (gmsh_file_format > 40)
2298 in >> n_entity_blocks >> n_cells >> min_node_tag >> max_node_tag;
2300 else if (gmsh_file_format == 40)
2302 in >> n_entity_blocks >> n_cells;
2306 n_entity_blocks = 1;
2313 std::vector<CellData<dim>> cells;
2315 std::map<unsigned int, types::boundary_id> boundary_ids_1d;
2316 bool is_quad_or_hex_mesh =
false;
2317 bool is_tria_or_tet_mesh =
false;
2320 unsigned int global_cell = 0;
2321 for (
int entity_block = 0; entity_block < n_entity_blocks; ++entity_block)
2323 unsigned int material_id;
2324 unsigned long numElements;
2327 if (gmsh_file_format < 40)
2331 numElements = n_cells;
2333 else if (gmsh_file_format == 40)
2335 int tagEntity, dimEntity;
2336 in >> tagEntity >> dimEntity >> cell_type >> numElements;
2337 material_id = tag_maps[dimEntity][tagEntity];
2342 int tagEntity, dimEntity;
2343 in >> dimEntity >> tagEntity >> cell_type >> numElements;
2344 material_id = tag_maps[dimEntity][tagEntity];
2347 for (
unsigned int cell_per_entity = 0; cell_per_entity < numElements;
2348 ++cell_per_entity, ++global_cell)
2357 unsigned int nod_num;
2378 unsigned int elm_number = 0;
2379 if (gmsh_file_format < 40)
2385 if (gmsh_file_format < 20)
2391 else if (gmsh_file_format < 40)
2396 unsigned int n_tags;
2403 for (
unsigned int i = 1; i < n_tags; ++i)
2408 else if (cell_type == 2)
2410 else if (cell_type == 3)
2412 else if (cell_type == 4)
2414 else if (cell_type == 5)
2425 else if (cell_type == 2)
2427 else if (cell_type == 3)
2429 else if (cell_type == 4)
2431 else if (cell_type == 5)
2457 if (((cell_type == 1) && (dim == 1)) ||
2458 ((cell_type == 2) && (dim == 2)) ||
2459 ((cell_type == 3) && (dim == 2)) ||
2460 ((cell_type == 4) && (dim == 3)) ||
2461 ((cell_type == 5) && (dim == 3)))
2464 unsigned int vertices_per_cell = 0;
2466 vertices_per_cell = 2;
2467 else if (cell_type == 2)
2469 vertices_per_cell = 3;
2470 is_tria_or_tet_mesh =
true;
2472 else if (cell_type == 3)
2474 vertices_per_cell = 4;
2475 is_quad_or_hex_mesh =
true;
2477 else if (cell_type == 4)
2479 vertices_per_cell = 4;
2480 is_tria_or_tet_mesh =
true;
2482 else if (cell_type == 5)
2484 vertices_per_cell = 8;
2485 is_quad_or_hex_mesh =
true;
2490 "Number of nodes does not coincide with the "
2491 "number required for this object"));
2494 cells.emplace_back();
2495 cells.back().vertices.resize(vertices_per_cell);
2496 for (
unsigned int i = 0; i < vertices_per_cell; ++i)
2499 if (vertices_per_cell ==
2507 in >> cells.back().vertices[i];
2513 std::numeric_limits<types::material_id>::max(),
2517 std::numeric_limits<types::material_id>::max()));
2522 cells.back().material_id = material_id;
2525 for (
unsigned int i = 0; i < vertices_per_cell; ++i)
2530 ExcInvalidVertexIndexGmsh(cell_per_entity,
2532 cells.back().vertices[i]));
2535 cells.back().vertices[i] =
2539 else if ((cell_type == 1) &&
2540 ((dim == 2) || (dim == 3)))
2549 std::numeric_limits<types::boundary_id>::max(),
2553 std::numeric_limits<types::boundary_id>::max()));
2564 for (
unsigned int &vertex :
2573 ExcInvalidVertexIndex(cell_per_entity,
2578 else if ((cell_type == 2 || cell_type == 3) &&
2582 unsigned int vertices_per_cell = 0;
2586 vertices_per_cell = 3;
2587 is_tria_or_tet_mesh =
true;
2589 else if (cell_type == 3)
2591 vertices_per_cell = 4;
2592 is_quad_or_hex_mesh =
true;
2601 for (
unsigned int i = 0; i < vertices_per_cell; ++i)
2606 std::numeric_limits<types::boundary_id>::max(),
2610 std::numeric_limits<types::boundary_id>::max()));
2621 for (
unsigned int &vertex :
2630 ExcInvalidVertexIndex(cell_per_entity, vertex));
2634 else if (cell_type == 15)
2637 unsigned int node_index = 0;
2638 if (gmsh_file_format < 20)
2658 AssertThrow(
false, ExcGmshUnsupportedGeometry(cell_type));
2666 static const std::string end_elements_marker[] = {
"@f$ENDELM",
"@f$EndElements"};
2667 AssertThrow(line == end_elements_marker[gmsh_file_format == 10 ? 0 : 1],
2668 ExcInvalidGMSHInput(line));
2685 if (dim == 1 || (is_quad_or_hex_mesh && !is_tria_or_tet_mesh))
2690 if (dim == spacedim)
2694 else if (is_tria_or_tet_mesh)
2696 if (dim == spacedim)
2704 assign_1d_boundary_ids(boundary_ids_1d, *
tria);
2709#ifdef DEAL_II_GMSH_WITH_API
2710template <
int dim,
int spacedim>
2714 Assert(
tria !=
nullptr, ExcNoTriangulationSelected());
2716 const std::map<int, std::uint8_t> gmsh_to_dealii_type = {
2717 {{15, 0}, {1, 1}, {2, 2}, {3, 3}, {4, 4}, {7, 5}, {6, 6}, {5, 7}}};
2720 const std::array<std::vector<unsigned int>, 8> gmsh_to_dealii = {
2727 {{0, 1, 2, 3, 4, 5}},
2728 {{0, 1, 3, 2, 4, 5, 7, 6}}}};
2730 std::vector<Point<spacedim>>
vertices;
2731 std::vector<CellData<dim>> cells;
2733 std::map<unsigned int, types::boundary_id> boundary_ids_1d;
2736 gmsh::option::setNumber(
"General.Verbosity", 0);
2740 ExcMessage(
"You are trying to read a gmsh file with dimension " +
2741 std::to_string(gmsh::model::getDimension()) +
2742 " into a grid of dimension " + std::to_string(dim)));
2747 gmsh::model::mesh::removeDuplicateNodes();
2748 gmsh::model::mesh::renumberNodes();
2749 std::vector<std::size_t> node_tags;
2750 std::vector<double> coord;
2751 std::vector<double> parametricCoord;
2752 gmsh::model::mesh::getNodes(
2753 node_tags, coord, parametricCoord, -1, -1,
false,
false);
2755 for (
unsigned int i = 0; i < node_tags.size(); ++i)
2759 for (
unsigned int d = 0; d < spacedim; ++d)
2763 for (
unsigned int d = spacedim; d < 3; ++d)
2765 ExcMessage(
"The grid you are reading contains nodes that are "
2766 "nonzero in the coordinate with index " +
2768 ", but you are trying to save "
2769 "it on a grid embedded in a " +
2770 std::to_string(spacedim) +
" dimensional space."));
2777 std::vector<std::pair<int, int>> entities;
2778 gmsh::model::getEntities(entities);
2780 for (
const auto &e : entities)
2783 const int &entity_dim = e.first;
2784 const int &entity_tag = e.second;
2790 std::vector<int> physical_tags;
2791 gmsh::model::getPhysicalGroupsForEntity(entity_dim,
2796 if (physical_tags.size())
2797 for (
auto physical_tag : physical_tags)
2800 gmsh::model::getPhysicalName(entity_dim, physical_tag, name);
2804 std::map<std::string, int> id_names;
2806 bool throw_anyway =
false;
2807 bool found_boundary_id =
false;
2810 for (
const auto &it : id_names)
2812 const auto &name = it.first;
2813 const auto &
id = it.second;
2814 if (entity_dim == dim && name ==
"MaterialID")
2817 found_boundary_id =
true;
2819 else if (entity_dim < dim && name ==
"BoundaryID")
2822 found_boundary_id =
true;
2824 else if (name ==
"ManifoldID")
2830 throw_anyway =
true;
2836 if (throw_anyway && !found_boundary_id)
2845 boundary_id = physical_tag;
2850 std::vector<int> element_types;
2851 std::vector<std::vector<std::size_t>> element_ids, element_nodes;
2852 gmsh::model::mesh::getElements(
2853 element_types, element_ids, element_nodes, entity_dim, entity_tag);
2855 for (
unsigned int i = 0; i < element_types.size(); ++i)
2857 const auto &type = gmsh_to_dealii_type.at(element_types[i]);
2858 const auto n_vertices = gmsh_to_dealii[type].size();
2859 const auto &elements = element_ids[i];
2860 const auto &nodes = element_nodes[i];
2861 for (
unsigned int j = 0; j < elements.size(); ++j)
2863 if (entity_dim == dim)
2865 cells.emplace_back(n_vertices);
2866 auto &cell = cells.back();
2867 for (
unsigned int v = 0; v < n_vertices; ++v)
2869 nodes[n_vertices * j + gmsh_to_dealii[type][v]] - 1;
2870 cell.manifold_id = manifold_id;
2871 cell.material_id = boundary_id;
2873 else if (entity_dim == 2)
2877 for (
unsigned int v = 0; v < n_vertices; ++v)
2879 nodes[n_vertices * j + gmsh_to_dealii[type][v]] - 1;
2881 face.manifold_id = manifold_id;
2882 face.boundary_id = boundary_id;
2884 else if (entity_dim == 1)
2888 for (
unsigned int v = 0; v < n_vertices; ++v)
2890 nodes[n_vertices * j + gmsh_to_dealii[type][v]] - 1;
2892 line.manifold_id = manifold_id;
2893 line.boundary_id = boundary_id;
2895 else if (entity_dim == 0)
2899 for (
unsigned int j = 0; j < elements.size(); ++j)
2900 boundary_ids_1d[nodes[j] - 1] = boundary_id;
2913 assign_1d_boundary_ids(boundary_ids_1d, *
tria);
2922template <
int dim,
int spacedim>
2925 std::string & header,
2926 std::vector<unsigned int> &tecplot2deal,
2927 unsigned int & n_vars,
2928 unsigned int & n_vertices,
2929 unsigned int & n_cells,
2930 std::vector<unsigned int> &IJK,
2955 std::transform(header.begin(), header.end(), header.begin(), ::toupper);
2959 std::replace(header.begin(), header.end(),
'\t',
' ');
2960 std::replace(header.begin(), header.end(),
',',
' ');
2961 std::replace(header.begin(), header.end(),
'\n',
' ');
2965 std::string::size_type pos = header.find(
'=');
2967 while (pos !=
static_cast<std::string::size_type
>(std::string::npos))
2968 if (header[pos + 1] ==
' ')
2969 header.erase(pos + 1, 1);
2970 else if (header[pos - 1] ==
' ')
2972 header.erase(pos - 1, 1);
2976 pos = header.find(
'=', ++pos);
2979 std::vector<std::string> entries =
2983 for (
unsigned int i = 0; i < entries.size(); ++i)
2992 tecplot2deal[0] = 0;
2995 while (entries[i][0] ==
'"')
2997 if (entries[i] ==
"\"X\"")
2998 tecplot2deal[0] = n_vars;
2999 else if (entries[i] ==
"\"Y\"")
3005 tecplot2deal[1] = n_vars;
3007 else if (entries[i] ==
"\"Z\"")
3013 tecplot2deal[2] = n_vars;
3025 "Tecplot file must contain at least one variable for each dimension"));
3026 for (
unsigned int d = 1; d < dim; ++d)
3028 tecplot2deal[d] > 0,
3030 "Tecplot file must contain at least one variable for each dimension."));
3035 "ZONETYPE=FELINESEG") &&
3039 "ZONETYPE=FEQUADRILATERAL") &&
3043 "ZONETYPE=FEBRICK") &&
3051 "The tecplot file contains an unsupported ZONETYPE."));
3054 "DATAPACKING=POINT"))
3057 "DATAPACKING=BLOCK"))
3080 "ET=QUADRILATERAL") &&
3092 "The tecplot file contains an unsupported ElementType."));
3100 dim > 1 || IJK[1] == 1,
3102 "Parameter 'J=' found in tecplot, although this is only possible for dimensions greater than 1."));
3108 dim > 2 || IJK[2] == 1,
3110 "Parameter 'K=' found in tecplot, although this is only possible for dimensions greater than 2."));
3125 for (
unsigned int d = 0; d < dim; ++d)
3130 "Tecplot file does not contain a complete and consistent set of parameters"));
3131 n_vertices *= IJK[d];
3132 n_cells *= (IJK[d] - 1);
3140 "Tecplot file does not contain a complete and consistent set of parameters"));
3146 n_cells = *std::max_element(IJK.begin(), IJK.end());
3150 "Tecplot file does not contain a complete and consistent set of parameters"));
3160 const unsigned int dim = 2;
3161 const unsigned int spacedim = 2;
3162 Assert(
tria !=
nullptr, ExcNoTriangulationSelected());
3166 skip_comment_lines(in,
'#');
3169 std::string line, header;
3176 std::string letters =
"abcdfghijklmnopqrstuvwxyzABCDFGHIJKLMNOPQRSTUVWXYZ";
3179 while (line.find_first_of(letters) != std::string::npos)
3181 header +=
" " + line;
3188 std::vector<unsigned int> tecplot2deal(dim);
3189 std::vector<unsigned int> IJK(dim);
3190 unsigned int n_vars, n_vertices, n_cells;
3191 bool structured, blocked;
3193 parse_tecplot_header(header,
3208 std::vector<Point<spacedim>>
vertices(n_vertices + 1);
3211 std::vector<CellData<dim>> cells(n_cells);
3227 unsigned int next_index = 0;
3231 if (tecplot2deal[0] == 0)
3235 std::vector<std::string> first_var =
3238 for (
unsigned int i = 1; i < first_var.size() + 1; ++i)
3239 vertices[i](0) = std::strtod(first_var[i - 1].c_str(), &endptr);
3244 for (
unsigned int j = first_var.size() + 1; j < n_vertices + 1; ++j)
3252 for (
unsigned int i = 1; i < n_vars; ++i)
3261 if (next_index == dim && structured)
3264 if ((next_index < dim) && (i == tecplot2deal[next_index]))
3267 for (
unsigned int j = 1; j < n_vertices + 1; ++j)
3275 for (
unsigned int j = 1; j < n_vertices + 1; ++j)
3287 std::vector<double> vars(n_vars);
3292 std::vector<std::string> first_vertex =
3295 for (
unsigned int d = 0; d < dim; ++d)
3297 std::strtod(first_vertex[tecplot2deal[d]].c_str(), &endptr);
3301 for (
unsigned int v = 2; v < n_vertices + 1; ++v)
3303 for (
unsigned int i = 0; i < n_vars; ++i)
3309 for (
unsigned int i = 0; i < dim; ++i)
3310 vertices[v](i) = vars[tecplot2deal[i]];
3318 unsigned int I = IJK[0], J = IJK[1];
3320 unsigned int cell = 0;
3322 for (
unsigned int j = 0; j < J - 1; ++j)
3323 for (
unsigned int i = 1; i < I; ++i)
3325 cells[cell].vertices[0] = i + j * I;
3326 cells[cell].vertices[1] = i + 1 + j * I;
3327 cells[cell].vertices[2] = i + (j + 1) * I;
3328 cells[cell].vertices[3] = i + 1 + (j + 1) * I;
3332 std::vector<unsigned int> boundary_vertices(2 * I + 2 * J - 4);
3334 for (
unsigned int i = 1; i < I + 1; ++i)
3336 boundary_vertices[k] = i;
3338 boundary_vertices[k] = i + (J - 1) * I;
3341 for (
unsigned int j = 1; j < J - 1; ++j)
3343 boundary_vertices[k] = 1 + j * I;
3345 boundary_vertices[k] = I + j * I;
3364 for (
unsigned int i = 0; i < n_cells; ++i)
3396template <
int dim,
int spacedim>
3405template <
int dim,
int spacedim>
3408 const unsigned int mesh_index,
3409 const bool remove_duplicates,
3411 const bool ignore_unsupported_types)
3413#ifdef DEAL_II_WITH_ASSIMP
3418 Assimp::Importer importer;
3421 const aiScene *scene =
3422 importer.ReadFile(filename.c_str(),
3423 aiProcess_RemoveComponent |
3424 aiProcess_JoinIdenticalVertices |
3425 aiProcess_ImproveCacheLocality | aiProcess_SortByPType |
3426 aiProcess_OptimizeGraph | aiProcess_OptimizeMeshes);
3432 ExcMessage(
"Input file contains no meshes."));
3435 (mesh_index < scene->mNumMeshes),
3438 unsigned int start_mesh =
3440 unsigned int end_mesh =
3445 std::vector<Point<spacedim>>
vertices;
3446 std::vector<CellData<dim>> cells;
3450 unsigned int v_offset = 0;
3451 unsigned int c_offset = 0;
3454 for (
unsigned int m = start_mesh; m < end_mesh; ++m)
3456 const aiMesh *mesh = scene->mMeshes[m];
3460 if ((dim == 2) && mesh->mPrimitiveTypes != aiPrimitiveType_POLYGON)
3463 ExcMessage(
"Incompatible mesh " + std::to_string(m) +
3464 "/" + std::to_string(scene->mNumMeshes)));
3467 else if ((dim == 1) && mesh->mPrimitiveTypes != aiPrimitiveType_LINE)
3470 ExcMessage(
"Incompatible mesh " + std::to_string(m) +
3471 "/" + std::to_string(scene->mNumMeshes)));
3475 const unsigned int n_vertices = mesh->mNumVertices;
3476 const aiVector3D * mVertices = mesh->mVertices;
3479 const unsigned int n_faces = mesh->mNumFaces;
3480 const aiFace * mFaces = mesh->mFaces;
3482 vertices.resize(v_offset + n_vertices);
3483 cells.resize(c_offset + n_faces);
3485 for (
unsigned int i = 0; i < n_vertices; ++i)
3486 for (
unsigned int d = 0; d < spacedim; ++d)
3487 vertices[i + v_offset][d] = mVertices[i][d];
3489 unsigned int valid_cell = c_offset;
3490 for (
unsigned int i = 0; i < n_faces; ++i)
3498 mFaces[i].mIndices[f] + v_offset;
3500 cells[valid_cell].material_id = m;
3506 ExcMessage(
"Face " + std::to_string(i) +
" of mesh " +
3507 std::to_string(m) +
" has " +
3508 std::to_string(mFaces[i].mNumIndices) +
3509 " vertices. We expected only " +
3514 cells.resize(valid_cell);
3519 v_offset += n_vertices;
3520 c_offset = valid_cell;
3524 if (cells.size() == 0)
3527 if (remove_duplicates)
3532 unsigned int n_verts = 0;
3536 std::vector<unsigned int> considered_vertices;
3538 vertices, cells, subcelldata, considered_vertices, tol);
3543 if (dim == spacedim)
3551 (void)remove_duplicates;
3553 (void)ignore_unsupported_types;
3558#ifdef DEAL_II_TRILINOS_WITH_SEACAS
3565 exodusii_name_to_type(
const std::string &type_name,
3566 const int n_nodes_per_element)
3572 std::string type_name_2 = type_name;
3573 std::transform(type_name_2.begin(),
3575 type_name_2.begin(),
3576 [](
unsigned char c) { return std::toupper(c); });
3577 const std::string
numbers =
"0123456789";
3578 type_name_2.erase(std::find_first_of(type_name_2.begin(),
3584 if (type_name_2 ==
"TRI" || type_name_2 ==
"TRIANGLE")
3586 else if (type_name_2 ==
"QUAD" || type_name_2 ==
"QUADRILATERAL")
3588 else if (type_name_2 ==
"SHELL")
3590 if (n_nodes_per_element == 3)
3595 else if (type_name_2 ==
"TET" || type_name_2 ==
"TETRA" ||
3596 type_name_2 ==
"TETRAHEDRON")
3598 else if (type_name_2 ==
"PYRA" || type_name_2 ==
"PYRAMID")
3600 else if (type_name_2 ==
"WEDGE")
3602 else if (type_name_2 ==
"HEX" || type_name_2 ==
"HEXAHEDRON")
3612 template <
int dim,
int spacedim = dim>
3613 std::pair<SubCellData, std::vector<std::vector<int>>>
3614 read_exodusii_sidesets(
const int ex_id,
3615 const int n_side_sets,
3617 const bool apply_all_indicators_to_manifolds)
3620 std::vector<std::vector<int>> b_or_m_id_to_sideset_ids;
3622 b_or_m_id_to_sideset_ids.emplace_back();
3628 if (dim == spacedim && n_side_sets > 0)
3630 std::vector<int> side_set_ids(n_side_sets);
3631 int ierr = ex_get_ids(ex_id, EX_SIDE_SET, side_set_ids.data());
3632 AssertThrowExodusII(ierr);
3640 std::map<std::size_t, std::vector<int>> face_side_sets;
3641 for (
const int side_set_id : side_set_ids)
3644 int n_distribution_factors = -1;
3646 ierr = ex_get_set_param(ex_id,
3650 &n_distribution_factors);
3651 AssertThrowExodusII(ierr);
3654 std::vector<int> elements(n_sides);
3655 std::vector<int> faces(n_sides);
3656 ierr = ex_get_set(ex_id,
3661 AssertThrowExodusII(ierr);
3669 for (
int side_n = 0; side_n < n_sides; ++side_n)
3671 const long element_n = elements[side_n] - 1;
3672 const long face_n = faces[side_n] - 1;
3673 const std::size_t face_id =
3674 element_n * max_faces_per_cell + face_n;
3675 face_side_sets[face_id].push_back(side_set_id);
3681 std::vector<std::pair<std::size_t, std::vector<int>>>
3682 face_id_to_side_sets;
3683 for (
auto &pair : face_side_sets)
3686 face_id_to_side_sets.push_back(std::move(pair));
3690 std::sort(face_id_to_side_sets.begin(),
3691 face_id_to_side_sets.end(),
3692 [](
const auto &a,
const auto &b) {
3693 return std::lexicographical_compare(a.second.begin(),
3700 for (
const auto &pair : face_id_to_side_sets)
3702 const std::size_t face_id = pair.first;
3703 const std::vector<int> &face_sideset_ids = pair.second;
3704 if (face_sideset_ids != b_or_m_id_to_sideset_ids.back())
3709 ++current_b_or_m_id;
3710 b_or_m_id_to_sideset_ids.push_back(face_sideset_ids);
3711 Assert(current_b_or_m_id == b_or_m_id_to_sideset_ids.size() - 1,
3715 const unsigned int local_face_n = face_id % max_faces_per_cell;
3716 const CellData<dim> &cell = cells[face_id / max_faces_per_cell];
3719 const unsigned int deal_face_n =
3730 if (apply_all_indicators_to_manifolds)
3731 boundary_line.manifold_id = current_b_or_m_id;
3733 boundary_line.boundary_id = current_b_or_m_id;
3734 for (
unsigned int j = 0; j < face_reference_cell.
n_vertices();
3736 boundary_line.vertices[j] =
3738 deal_face_n, j, 0)];
3745 if (apply_all_indicators_to_manifolds)
3746 boundary_quad.manifold_id = current_b_or_m_id;
3748 boundary_quad.boundary_id = current_b_or_m_id;
3749 for (
unsigned int j = 0; j < face_reference_cell.
n_vertices();
3751 boundary_quad.vertices[j] =
3753 deal_face_n, j, 0)];
3760 return std::make_pair(std::move(subcelldata),
3761 std::move(b_or_m_id_to_sideset_ids));
3766template <
int dim,
int spacedim>
3769 const std::string &filename,
3770 const bool apply_all_indicators_to_manifolds)
3772#ifdef DEAL_II_TRILINOS_WITH_SEACAS
3774 int component_word_size =
sizeof(double);
3776 int floating_point_word_size = 0;
3777 float ex_version = 0.0;
3779 const int ex_id = ex_open(filename.c_str(),
3781 &component_word_size,
3782 &floating_point_word_size,
3785 ExcMessage(
"ExodusII failed to open the specified input file."));
3788 std::vector<char> string_temp(MAX_LINE_LENGTH + 1,
'\0');
3789 int mesh_dimension = 0;
3792 int n_element_blocks = 0;
3793 int n_node_sets = 0;
3794 int n_side_sets = 0;
3796 int ierr = ex_get_init(ex_id,
3804 AssertThrowExodusII(ierr);
3808 std::vector<double> xs(n_nodes);
3809 std::vector<double> ys(n_nodes);
3810 std::vector<double> zs(n_nodes);
3812 ierr = ex_get_coord(ex_id, xs.data(), ys.data(), zs.data());
3813 AssertThrowExodusII(ierr);
3821 std::vector<Point<spacedim>>
vertices;
3823 for (
int vertex_n = 0; vertex_n < n_nodes; ++vertex_n)
3828 vertices.emplace_back(xs[vertex_n]);
3831 vertices.emplace_back(xs[vertex_n], ys[vertex_n]);
3834 vertices.emplace_back(xs[vertex_n], ys[vertex_n], zs[vertex_n]);
3841 std::vector<int> element_block_ids(n_element_blocks);
3842 ierr = ex_get_ids(ex_id, EX_ELEM_BLOCK, element_block_ids.data());
3843 AssertThrowExodusII(ierr);
3845 bool is_only_quad_or_hex =
true;
3847 std::vector<CellData<dim>> cells;
3851 for (
const int element_block_id : element_block_ids)
3853 std::fill(string_temp.begin(), string_temp.end(),
'\0');
3854 int n_block_elements = 0;
3855 int n_nodes_per_element = 0;
3856 int n_edges_per_element = 0;
3857 int n_faces_per_element = 0;
3858 int n_attributes_per_element = 0;
3861 ierr = ex_get_block(ex_id,
3866 &n_nodes_per_element,
3867 &n_edges_per_element,
3868 &n_faces_per_element,
3869 &n_attributes_per_element);
3870 AssertThrowExodusII(ierr);
3872 exodusii_name_to_type(string_temp.data(), n_nodes_per_element);
3875 is_only_quad_or_hex =
false;
3882 std::vector<int> connection(n_nodes_per_element * n_block_elements);
3883 ierr = ex_get_conn(ex_id,
3889 AssertThrowExodusII(ierr);
3891 for (
unsigned int elem_n = 0; elem_n < connection.size();
3892 elem_n += n_nodes_per_element)
3898 connection[elem_n + i] - 1;
3901 cells.push_back(cell);
3906 auto pair = read_exodusii_sidesets<dim, spacedim>(
3907 ex_id, n_side_sets, cells, apply_all_indicators_to_manifolds);
3908 ierr = ex_close(ex_id);
3909 AssertThrowExodusII(ierr);
3911 if (is_only_quad_or_hex)
3916 if (dim == spacedim)
3927 (void)apply_all_indicators_to_manifolds;
3934template <
int dim,
int spacedim>
3948 if (std::find_if(line.begin(), line.end(), [](
const char c) {
3953 for (
int i = line.size() - 1; i >= 0; --i)
3954 in.putback(line[i]);
3964template <
int dim,
int spacedim>
3967 const char comment_start)
3972 while (in.get(c) && c == comment_start)
3975 while (in.get() !=
'\n')
3985 skip_empty_lines(in);
3990template <
int dim,
int spacedim>
4008 double min_x =
vertices[cells[0].vertices[0]](0),
4010 min_y =
vertices[cells[0].vertices[0]](1),
4013 for (
unsigned int i = 0; i < cells.size(); ++i)
4015 for (
const auto vertex : cells[i].
vertices)
4029 out <<
"# cell " << i << std::endl;
4031 for (
const auto vertex : cells[i].
vertices)
4035 out <<
"set label \"" << i <<
"\" at " <<
center(0) <<
',' <<
center(1)
4036 <<
" center" << std::endl;
4039 for (
unsigned int f = 0; f < 2; ++f)
4041 <<
vertices[cells[i].vertices[f]](1) <<
" to "
4045 for (
unsigned int f = 2; f < 4; ++f)
4049 <<
vertices[cells[i].vertices[f]](1) << std::endl;
4055 <<
"set nokey" << std::endl
4056 <<
"pl [" << min_x <<
':' << max_x <<
"][" << min_y <<
':' << max_y
4057 <<
"] " << min_y << std::endl
4058 <<
"pause -1" << std::endl;
4069 for (
const auto &cell : cells)
4136template <
int dim,
int spacedim>
4144 if (format == Default)
4145 name = search.
find(filename);
4147 name = search.
find(filename, default_suffix(format));
4150 if (format == Default)
4152 const std::string::size_type slashpos = name.find_last_of(
'/');
4153 const std::string::size_type dotpos = name.find_last_of(
'.');
4154 if (dotpos < name.size() &&
4155 (dotpos > slashpos || slashpos == std::string::npos))
4157 std::string ext = name.substr(dotpos + 1);
4158 format = parse_format(ext);
4162 if (format == assimp)
4166 else if (format == exodusii)
4168 read_exodusii(name);
4172 std::ifstream in(name.c_str());
4178template <
int dim,
int spacedim>
4182 if (format == Default)
4183 format = default_format;
4225 ExcMessage(
"There is no read_assimp(istream &) function. "
4226 "Use the read_assimp(string &filename, ...) "
4227 "functions, instead."));
4232 ExcMessage(
"There is no read_exodusii(istream &) function. "
4233 "Use the read_exodusii(string &filename, ...) "
4234 "function, instead."));
4245template <
int dim,
int spacedim>
4274 return ".unknown_format";
4280template <
int dim,
int spacedim>
4284 if (format_name ==
"dbmesh")
4287 if (format_name ==
"exodusii")
4290 if (format_name ==
"msh")
4293 if (format_name ==
"unv")
4296 if (format_name ==
"vtk")
4299 if (format_name ==
"vtu")
4303 if (format_name ==
"inp")
4306 if (format_name ==
"ucd")
4309 if (format_name ==
"xda")
4312 if (format_name ==
"tecplot")
4315 if (format_name ==
"dat")
4318 if (format_name ==
"plt")
4337template <
int dim,
int spacedim>
4341 return "dbmesh|exodusii|msh|unv|vtk|vtu|ucd|abaqus|xda|tecplot|assimp";
4348 template <
int dim,
int spacedim>
4349 Abaqus_to_UCD<dim, spacedim>::Abaqus_to_UCD()
4362 from_string(T &t,
const std::string &s, std::ios_base &(*f)(std::ios_base &))
4364 std::istringstream iss(s);
4365 return !(iss >> f >> t).fail();
4372 extract_int(
const std::string &s)
4375 for (
const char c : s)
4377 if (isdigit(c) != 0)
4384 from_string(number, tmp, std::dec);
4390 template <
int dim,
int spacedim>
4392 Abaqus_to_UCD<dim, spacedim>::read_in_abaqus(std::istream &input_stream)
4401 while (std::getline(input_stream, line))
4404 std::transform(line.begin(), line.end(), line.begin(), ::toupper);
4406 if (line.compare(
"*HEADING") == 0 || line.compare(0, 2,
"**") == 0 ||
4407 line.compare(0, 5,
"*PART") == 0)
4410 while (std::getline(input_stream, line))
4416 else if (line.compare(0, 5,
"*NODE") == 0)
4425 while (std::getline(input_stream, line))
4430 std::vector<double> node(spacedim + 1);
4432 std::istringstream iss(line);
4434 for (
unsigned int i = 0; i < spacedim + 1; ++i)
4435 iss >> node[i] >> comma;
4437 node_list.push_back(node);
4440 else if (line.compare(0, 8,
"*ELEMENT") == 0)
4455 const std::string before_material =
"ELSET=EB";
4456 const std::size_t idx = line.find(before_material);
4457 if (idx != std::string::npos)
4459 from_string(material,
4460 line.substr(idx + before_material.size()),
4466 while (std::getline(input_stream, line))
4471 std::istringstream iss(line);
4477 const unsigned int n_data_per_cell =
4479 std::vector<double> cell(n_data_per_cell);
4480 for (
unsigned int i = 0; i < n_data_per_cell; ++i)
4481 iss >> cell[i] >> comma;
4484 cell[0] =
static_cast<double>(material);
4485 cell_list.push_back(cell);
4488 else if (line.compare(0, 8,
"*SURFACE") == 0)
4499 const std::string name_key =
"NAME=";
4500 const std::size_t name_idx_start =
4501 line.find(name_key) + name_key.size();
4502 std::size_t name_idx_end = line.find(
',', name_idx_start);
4503 if (name_idx_end == std::string::npos)
4505 name_idx_end = line.size();
4507 const int b_indicator = extract_int(
4508 line.substr(name_idx_start, name_idx_end - name_idx_start));
4515 while (std::getline(input_stream, line))
4521 std::transform(line.begin(),
4529 std::istringstream iss(line);
4536 std::vector<double> quad_node_list;
4537 const std::string elset_name = line.substr(0, line.find(
','));
4538 if (elsets_list.count(elset_name) != 0)
4542 iss >> stmp >> temp >> face_number;
4544 const std::vector<int> cells = elsets_list[elset_name];
4545 for (
const int cell : cells)
4549 get_global_node_numbers(el_idx, face_number);
4550 quad_node_list.insert(quad_node_list.begin(),
4553 face_list.push_back(quad_node_list);
4560 iss >> el_idx >> comma >> temp >> face_number;
4562 get_global_node_numbers(el_idx, face_number);
4563 quad_node_list.insert(quad_node_list.begin(), b_indicator);
4565 face_list.push_back(quad_node_list);
4569 else if (line.compare(0, 6,
"*ELSET") == 0)
4573 std::string elset_name;
4575 const std::string elset_key =
"*ELSET, ELSET=";
4576 const std::size_t idx = line.find(elset_key);
4577 if (idx != std::string::npos)
4579 const std::string comma =
",";
4580 const std::size_t first_comma = line.find(comma);
4581 const std::size_t second_comma =
4582 line.find(comma, first_comma + 1);
4583 const std::size_t elset_name_start =
4584 line.find(elset_key) + elset_key.size();
4585 elset_name = line.substr(elset_name_start,
4586 second_comma - elset_name_start);
4596 std::vector<int> elements;
4597 const std::size_t generate_idx = line.find(
"GENERATE");
4598 if (generate_idx != std::string::npos)
4601 std::getline(input_stream, line);
4602 std::istringstream iss(line);
4612 iss >> elid_start >> comma >> elid_end;
4616 "While reading an ABAQUS file, the reader "
4617 "expected a comma but found a <") +
4618 comma +
"> in the line <" + line +
">."));
4620 elid_start <= elid_end,
4623 "While reading an ABAQUS file, the reader encountered "
4624 "a GENERATE statement in which the upper bound <") +
4626 "> for the element numbers is not larger or equal "
4627 "than the lower bound <" +
4631 if (iss.rdbuf()->in_avail() != 0)
4632 iss >> comma >> elis_step;
4636 "While reading an ABAQUS file, the reader "
4637 "expected a comma but found a <") +
4638 comma +
"> in the line <" + line +
">."));
4640 for (
int i = elid_start; i <= elid_end; i += elis_step)
4641 elements.push_back(i);
4642 elsets_list[elset_name] = elements;
4644 std::getline(input_stream, line);
4649 while (std::getline(input_stream, line))
4654 std::istringstream iss(line);
4659 iss >> elid >> comma;
4664 "While reading an ABAQUS file, the reader "
4665 "expected a comma but found a <") +
4666 comma +
"> in the line <" + line +
">."));
4668 elements.push_back(elid);
4672 elsets_list[elset_name] = elements;
4677 else if (line.compare(0, 5,
"*NSET") == 0)
4680 while (std::getline(input_stream, line))
4686 else if (line.compare(0, 14,
"*SOLID SECTION") == 0)
4690 const std::string elset_key =
"ELSET=";
4691 const std::size_t elset_start =
4692 line.find(
"ELSET=") + elset_key.size();
4693 const std::size_t elset_end = line.find(
',', elset_start + 1);
4694 const std::string elset_name =
4695 line.substr(elset_start, elset_end - elset_start);
4700 const std::string material_key =
"MATERIAL=";
4701 const std::size_t last_equal =
4702 line.find(
"MATERIAL=") + material_key.size();
4703 const std::size_t material_id_start = line.find(
'-', last_equal);
4705 from_string(material_id,
4706 line.substr(material_id_start + 1),
4710 const std::vector<int> &elset_cells = elsets_list[elset_name];
4711 for (
const int elset_cell : elset_cells)
4713 const int cell_id = elset_cell - 1;
4721 template <
int dim,
int spacedim>
4723 Abaqus_to_UCD<dim, spacedim>::get_global_node_numbers(
4724 const int face_cell_no,
4725 const int face_cell_face_no)
const
4735 if (face_cell_face_no == 1)
4737 quad_node_list[0] = cell_list[face_cell_no - 1][1];
4738 quad_node_list[1] = cell_list[face_cell_no - 1][2];
4740 else if (face_cell_face_no == 2)
4742 quad_node_list[0] = cell_list[face_cell_no - 1][2];
4743 quad_node_list[1] = cell_list[face_cell_no - 1][3];
4745 else if (face_cell_face_no == 3)
4747 quad_node_list[0] = cell_list[face_cell_no - 1][3];
4748 quad_node_list[1] = cell_list[face_cell_no - 1][4];
4750 else if (face_cell_face_no == 4)
4752 quad_node_list[0] = cell_list[face_cell_no - 1][4];
4753 quad_node_list[1] = cell_list[face_cell_no - 1][1];
4763 if (face_cell_face_no == 1)
4765 quad_node_list[0] = cell_list[face_cell_no - 1][1];
4766 quad_node_list[1] = cell_list[face_cell_no - 1][4];
4767 quad_node_list[2] = cell_list[face_cell_no - 1][3];
4768 quad_node_list[3] = cell_list[face_cell_no - 1][2];
4770 else if (face_cell_face_no == 2)
4772 quad_node_list[0] = cell_list[face_cell_no - 1][5];
4773 quad_node_list[1] = cell_list[face_cell_no - 1][8];
4774 quad_node_list[2] = cell_list[face_cell_no - 1][7];
4775 quad_node_list[3] = cell_list[face_cell_no - 1][6];
4777 else if (face_cell_face_no == 3)
4779 quad_node_list[0] = cell_list[face_cell_no - 1][1];
4780 quad_node_list[1] = cell_list[face_cell_no - 1][2];
4781 quad_node_list[2] = cell_list[face_cell_no - 1][6];
4782 quad_node_list[3] = cell_list[face_cell_no - 1][5];
4784 else if (face_cell_face_no == 4)
4786 quad_node_list[0] = cell_list[face_cell_no - 1][2];
4787 quad_node_list[1] = cell_list[face_cell_no - 1][3];
4788 quad_node_list[2] = cell_list[face_cell_no - 1][7];
4789 quad_node_list[3] = cell_list[face_cell_no - 1][6];
4791 else if (face_cell_face_no == 5)
4793 quad_node_list[0] = cell_list[face_cell_no - 1][3];
4794 quad_node_list[1] = cell_list[face_cell_no - 1][4];
4795 quad_node_list[2] = cell_list[face_cell_no - 1][8];
4796 quad_node_list[3] = cell_list[face_cell_no - 1][7];
4798 else if (face_cell_face_no == 6)
4800 quad_node_list[0] = cell_list[face_cell_no - 1][1];
4801 quad_node_list[1] = cell_list[face_cell_no - 1][5];
4802 quad_node_list[2] = cell_list[face_cell_no - 1][8];
4803 quad_node_list[3] = cell_list[face_cell_no - 1][4];
4816 return quad_node_list;
4819 template <
int dim,
int spacedim>
4821 Abaqus_to_UCD<dim, spacedim>::write_out_avs_ucd(std::ostream &output)
const
4830 const boost::io::ios_base_all_saver formatting_saver(output);
4834 output <<
"# Abaqus to UCD mesh conversion" << std::endl;
4835 output <<
"# Mesh type: AVS UCD" << std::endl;
4864 output << node_list.size() <<
"\t" << (cell_list.size() + face_list.size())
4865 <<
"\t0\t0\t0" << std::endl;
4868 output.precision(8);
4872 for (
const auto &node : node_list)
4875 output << node[0] <<
"\t";
4878 output.setf(std::ios::scientific, std::ios::floatfield);
4879 for (
unsigned int jj = 1; jj < spacedim + 1; ++jj)
4882 if (
std::abs(node[jj]) > tolerance)
4883 output <<
static_cast<double>(node[jj]) <<
"\t";
4885 output << 0.0 <<
"\t";
4888 output << 0.0 <<
"\t";
4890 output << std::endl;
4891 output.unsetf(std::ios::floatfield);
4895 for (
unsigned int ii = 0; ii < cell_list.size(); ++ii)
4897 output << ii + 1 <<
"\t" << cell_list[ii][0] <<
"\t"
4898 << (dim == 2 ?
"quad" :
"hex") <<
"\t";
4899 for (
unsigned int jj = 1; jj < GeometryInfo<dim>::vertices_per_cell + 1;
4901 output << cell_list[ii][jj] <<
"\t";
4903 output << std::endl;
4907 for (
unsigned int ii = 0; ii < face_list.size(); ++ii)
4909 output << ii + 1 <<
"\t" << face_list[ii][0] <<
"\t"
4910 << (dim == 2 ?
"line" :
"quad") <<
"\t";
4911 for (
unsigned int jj = 1; jj < GeometryInfo<dim>::vertices_per_face + 1;
4913 output << face_list[ii][jj] <<
"\t";
4915 output << std::endl;
4922#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)
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 void debug_output_grid(const std::vector< CellData< dim > > &cells, const std::vector< Point< spacedim > > &vertices, std::ostream &out)
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
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 & ExcIO()
static ::ExceptionBase & ExcNeedsAssimp()
static ::ExceptionBase & ExcNotImplemented()
void to_value(const std::string &s, T &t)
#define Assert(cond, exc)
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
static ::ExceptionBase & ExcNeedsExodusII()
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcIndexRange(std::size_t arg1, std::size_t arg2, std::size_t arg3)
static ::ExceptionBase & ExcInvalidState()
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
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)
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
::VectorizedArray< Number, width > min(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > abs(const ::VectorizedArray< Number, width > &)
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