Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the ExodusII reader work with line types. #14745

Merged
merged 1 commit into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion source/grid/grid_in.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3517,7 +3517,11 @@ namespace
numbers.end()),
type_name_2.end());

if (type_name_2 == "TRI" || type_name_2 == "TRIANGLE")
// The manual specifies BAR, BEAM, and TRUSS: in practice people use EDGE
if (type_name_2 == "BAR" || type_name_2 == "BEAM" ||
type_name_2 == "EDGE" || type_name_2 == "TRUSS")
return ReferenceCells::Line;
else if (type_name_2 == "TRI" || type_name_2 == "TRIANGLE")
return ReferenceCells::Triangle;
else if (type_name_2 == "QUAD" || type_name_2 == "QUADRILATERAL")
return ReferenceCells::Quadrilateral;
Expand Down Expand Up @@ -3813,6 +3817,13 @@ GridIn<dim, spacedim>::read_exodusii(
AssertThrowExodusII(ierr);
const ReferenceCell type =
exodusii_name_to_type(string_temp.data(), n_nodes_per_element);
AssertThrow(type.get_dimension() == dim,
ExcMessage(
"The ExodusII block " + std::to_string(element_block_id) +
" with element type " + std::string(string_temp.data()) +
" has dimension " + std::to_string(type.get_dimension()) +
", which does not match the topological mesh dimension " +
std::to_string(dim) + "."));

// The number of nodes per element may be larger than what we want to
// read - for example, if the Exodus file contains a QUAD9 element, we
Expand Down
29 changes: 17 additions & 12 deletions tests/grid/grid_in_exodusii.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,19 @@ read_and_print(const std::string &filename,
deallog << std::endl;
}

for (const auto &face : tria.active_face_iterators())
{
if (face->at_boundary())
{
deallog << "face center = " << face->center();
if (read_as_manifolds)
deallog << " face manifold id = " << face->manifold_id();
else
deallog << " face boundary id = " << face->boundary_id();
deallog << std::endl;
}
}
if (dim > 1)
for (const auto &face : tria.active_face_iterators())
{
if (face->at_boundary())
{
deallog << "face center = " << face->center();
if (read_as_manifolds)
deallog << " face manifold id = " << face->manifold_id();
else
deallog << " face boundary id = " << face->boundary_id();
deallog << std::endl;
}
}

deallog << "Number of vertices: " << tria.get_vertices().size() << std::endl;
deallog << "Number of cells: " << tria.n_cells() << std::endl;
Expand Down Expand Up @@ -106,6 +107,10 @@ main()
deallog << "--------------------------------------" << std::endl;
read_and_print<3>(SOURCE_DIR "/grids/exodusii/four-sidesets.e", true);

deallog << "-------------" << std::endl;
deallog << "codim 1 lines" << std::endl;
deallog << "-------------" << std::endl;
read_and_print<1, 2>(SOURCE_DIR "/grids/exodusii/lines.e");

deallog << "OK" << std::endl;
}
56 changes: 56 additions & 0 deletions tests/grid/grid_in_exodusii.with_trilinos_with_seacas=on.output
Original file line number Diff line number Diff line change
Expand Up @@ -415,4 +415,60 @@ LOOKUP_TABLE default
-1 -1 -1 -1
1 2 5 3 4 1 5 1 4 3 1 4 6 3

DEAL::-------------
DEAL::codim 1 lines
DEAL::-------------
DEAL::boundary id = 0 sideset ids =
DEAL::Number of vertices: 9
DEAL::Number of cells: 8
DEAL::cell 0 type = Line volume = 3.50000
DEAL::cell 1 type = Line volume = 7.00000
DEAL::cell 2 type = Line volume = 2.82843
DEAL::cell 3 type = Line volume = 3.00000
DEAL::cell 4 type = Line volume = 7.00000
DEAL::cell 5 type = Line volume = 2.82843
DEAL::cell 6 type = Line volume = 7.00000
DEAL::cell 7 type = Line volume = 2.82843
# vtk DataFile Version 3.0
Triangulation generated with deal.II
ASCII
DATASET UNSTRUCTURED_GRID
POINTS 9 double
0.0 0.0 0
7.0 0.0 0
5.0 2.0 0
2.0 2.0 0
2.0 5.0 0
0.0 7.0 0
5.0 5.0 0
7.0 3.5 0
7.0 7.0 0

CELLS 8 24
2 7 1
2 1 0
2 0 3
2 3 2
2 0 5
2 5 4
2 5 8
2 8 6

CELL_TYPES 8
3 3 3 3 3 3 3 3



CELL_DATA 8
SCALARS MaterialID int 1
LOOKUP_TABLE default
1 1 1 1 1 1 1 1



SCALARS ManifoldID int 1
LOOKUP_TABLE default
-1 -1 -1 -1 -1 -1 -1 -1


DEAL::OK
Binary file added tests/grid/grids/exodusii/lines.e
Binary file not shown.