/**
* Read grid data from an ucd file. Numerical data is ignored.
+ * It is not possible to use a ucd file to set both boundary_id and
+ * manifold_id for the same cell. Yet it is possible to use
+ * the flag apply_all_indicators_to_manifolds to decide if
+ * the indicators in the file refer to manifolds (flag set to true)
+ * or boundaries (flag set to false).
*/
- void read_ucd (std::istream &in);
+ void read_ucd (std::istream &in,
+ const bool apply_all_indicators_to_manifolds=false);
/**
* Read grid data from an Abaqus file. Numerical and constitutive data is
template <int dim, int spacedim>
-void GridIn<dim, spacedim>::read_ucd (std::istream &in)
+void GridIn<dim, spacedim>::read_ucd (std::istream &in,
+ const bool apply_all_indicators_to_manifolds)
{
Assert (tria != 0, ExcNoTriangulationSelected());
AssertThrow (in, ExcIO());
Assert(material_id < numbers::internal_face_boundary_id,
ExcIndexRange(material_id,0,numbers::internal_face_boundary_id));
- subcelldata.boundary_lines.back().boundary_id
- = static_cast<types::boundary_id>(material_id);
+ if (apply_all_indicators_to_manifolds)
+ subcelldata.boundary_lines.back().manifold_id
+ = static_cast<types::manifold_id>(material_id);
+ else
+ subcelldata.boundary_lines.back().boundary_id
+ = static_cast<types::boundary_id>(material_id);
// transform from ucd to
// consecutive numbering
Assert(material_id < numbers::internal_face_boundary_id,
ExcIndexRange(material_id,0,numbers::internal_face_boundary_id));
- subcelldata.boundary_quads.back().boundary_id
- = static_cast<types::boundary_id>(material_id);
+ if (apply_all_indicators_to_manifolds)
+ subcelldata.boundary_quads.back().manifold_id
+ = static_cast<types::manifold_id>(material_id);
+ else
+ subcelldata.boundary_quads.back().boundary_id
+ = static_cast<types::boundary_id>(material_id);
// transform from ucd to
// consecutive numbering
// need to allow that
if (boundary_line->boundary_id != numbers::internal_face_boundary_id)
{
- AssertThrow (! (line->boundary_id() == numbers::internal_face_boundary_id),
- ExcInteriorLineCantBeBoundary(line->vertex_index(0),
- line->vertex_index(1),
- boundary_line->boundary_id));
- line->set_boundary_id (boundary_line->boundary_id);
+ if (line->boundary_id() == numbers::internal_face_boundary_id)
+ {
+ // if we are here, it means that we want to assign a boundary indicator
+ // different from numbers::internal_face_boundary_id to an internal line.
+ // As said, this would be not allowed, and an exception should be immediately
+ // thrown. Still, there is the possibility that one only wants to specifiy a
+ // manifold_id here. If that is the case (manifold_id != numbers::flat_manifold_id)
+ // the operation is allowed. Otherwise, we really tried to specify a boundary_id
+ // (and not a manifold_id) to an internal face. The exception must be thrown.
+ if (boundary_line->manifold_id == numbers::flat_manifold_id)
+ {
+ // If we are here, this assertion will surely fail, for the aforementioned
+ // reasons
+ AssertThrow (! (line->boundary_id() == numbers::internal_face_boundary_id),
+ ExcInteriorLineCantBeBoundary(line->vertex_index(0),
+ line->vertex_index(1),
+ boundary_line->boundary_id));
+ }
+ else
+ {
+ line->set_manifold_id (boundary_line->manifold_id);
+ }
+ }
+ else
+ line->set_boundary_id (boundary_line->boundary_id);
}
-
line->set_manifold_id (boundary_line->manifold_id);
}