Reference documentation for deal.II version 8.4.1

## Classes

class  ArclengthProjectionLineManifold

class  DirectionalProjectionBoundary

class  NormalProjectionBoundary

class  NormalToMeshProjectionBoundary

## Functions

std_cxx11::tuple< unsigned int, unsigned int, unsigned int > count_elements (const TopoDS_Shape &shape)

TopoDS_Shape read_IGES (const std::string &filename, const double scale_factor=1e-3)

void write_IGES (const TopoDS_Shape &shape, const std::string &filename)

TopoDS_Shape read_STEP (const std::string &filename, const double scale_factor=1e-3)

void write_STEP (const TopoDS_Shape &shape, const std::string &filename)

double get_shape_tolerance (const TopoDS_Shape &shape)

TopoDS_Shape intersect_plane (const TopoDS_Shape &in_shape, const double c_x, const double c_y, const double c_z, const double c, const double tolerance=1e-7)

TopoDS_Edge join_edges (const TopoDS_Shape &in_shape, const double tolerance=1e-7)

TopoDS_Edge interpolation_curve (std::vector< Point< 3 > > &curve_points, const Tensor< 1, 3 > &direction=Tensor< 1, 3 >(), const bool closed=false, const double tolerance=1e-7)

void extract_geometrical_shapes (const TopoDS_Shape &shape, std::vector< TopoDS_Face > &faces, std::vector< TopoDS_Edge > &edges, std::vector< TopoDS_Vertex > &vertices)

void create_triangulation (const TopoDS_Face &face, Triangulation< 2, 3 > &tria)

void extract_compound_shapes (const TopoDS_Shape &shape, std::vector< TopoDS_Compound > &compounds, std::vector< TopoDS_CompSolid > &compsolids, std::vector< TopoDS_Solid > &solids, std::vector< TopoDS_Shell > &shells, std::vector< TopoDS_Wire > &wires)

std_cxx11::tuple< Point< 3 >, TopoDS_Shape, double, double > project_point_and_pull_back (const TopoDS_Shape &in_shape, const Point< 3 > &origin, const double tolerance=1e-7)

Point< 3 > closest_point (const TopoDS_Shape &in_shape, const Point< 3 > &origin, const double tolerance=1e-7)

Point< 3 > push_forward (const TopoDS_Shape &in_shape, const double u, const double v)

std_cxx11::tuple< Point< 3 >, Point< 3 >, double > push_forward_and_differential_forms (const TopoDS_Face &face, const double u, const double v, const double tolerance=1e-7)

std_cxx11::tuple< Point< 3 >, Point< 3 >, double > closest_point_and_differential_forms (const TopoDS_Shape &in_shape, const Point< 3 > &origin, const double tolerance=1e-7)

Point< 3 > line_intersection (const TopoDS_Shape &in_shape, const Point< 3 > &origin, const Tensor< 1, 3 > &direction, const double tolerance=1e-7)

Point< 3 > point (const gp_Pnt &p)

gp_Pnt point (const Point< 3 > &p)

bool point_compare (const Point< 3 > &p1, const Point< 3 > &p2, const Tensor< 1, 3 > &direction=Tensor< 1, 3 >(), const double tolerance=1e-10)

DeclException1 (ExcPointNotOnManifold, Point< 3 >,<<"The point [ "<< arg1<<" ] is not on the manifold.")

DeclException1 (ExcProjectionFailed, Point< 3 >,<<"Projection of point [ "<< arg1<< " ] failed.")

DeclException1 (ExcOCCError, IFSelect_ReturnStatus,<<"An OpenCASCADE routine failed with return status "<< arg1)

DeclException0 (ExcEdgeIsDegenerate)

DeclException0 (ExcUnsupportedShape)

## Detailed Description

We collect in this namespace all utilities which operate on OpenCASCADE entities. OpenCASCADE splits every object into a topological description and a geometrical entity. The basic topological description is a TopoDS_Shape. TopoDS_Shapes are light objects, and can be copied around. The closest deal.II analog is a TriaIterator.

The OpenCASCADE topology is designed with reference to the STEP standard ISO-10303-42. The structure is an oriented one-way graph, where parents refer to their children, and there are no back references. Abstract structure is implemented as C++ classes from the TopoDS package. A TopoDS_Shape is manipulated by value and contains 3 fields: location, orientation and a myTShape handle (of the TopoDS_TShape type). According to OpenCASCADE documentation, myTShape and Location are used to share data between various shapes to save memory. For example, an edge belonging to two faces has equal Locations and myTShape fields but different Orientations (Forward in context of one face and Reversed in one of the other).

Valid shapes include collection of other shapes, solids, faces, edges, vertices, etc.

Once a topological description is available, if a concrete geometrical object can be created, the BRep classes allow one to extract the actual geometrical information from a shape.

This is done by inheriting abstract topology classes from the TopoDS package by those implementing a boundary representation model (from the BRep package). Only 3 types of topological objects have geometric representations – vertex, edge, and face.

Every TopoDS_Shape can be queried to figure out what type of shape it is, and actual geometrical objects, like surfaces, curves or points, can be extracted using BRepTools.

In this namespace we provide readers and writers that read standard CAD files, and return a TopoDS_Shape, or that write a CAD file, given a TopoDS_Shape. Most of the functions in the OpenCASCADE namespace deal with TopoDS_Shapes of one type or another, and provide interfaces to common deal.II objects, like Triangulation, Manifold, and so on.

Notice that these tools are only useful when spacedim is equal to three, since OpenCASCADE only operates in three-dimensional mode.

## Function Documentation

 std_cxx11::tuple< unsigned int, unsigned int, unsigned int > OpenCASCADE::count_elements ( const TopoDS_Shape & shape )

Count the subobjects of a shape. This function is useful to gather information about the TopoDS_Shape passed as argument. It returns the number of faces, edges and vertices (the only topological entities associated with actual geometries) which are contained in the given shape.

Definition at line 73 of file utilities.cc.

 TopoDS_Shape OpenCASCADE::read_IGES ( const std::string & filename, const double scale_factor = 1e-3 )

Read IGES files and translate their content into openCascade topological entities. The option scale_factor is used to compensate for different units being used in the IGES files and in the target application. The standard unit for IGES files is millimiters. The return object is a TopoDS_Shape which contains all objects from the file.

Definition at line 181 of file utilities.cc.

 void OpenCASCADE::write_IGES ( const TopoDS_Shape & shape, const std::string & filename )

Write the given topological shape into an IGES file.

Definition at line 212 of file utilities.cc.

 TopoDS_Shape OpenCASCADE::read_STEP ( const std::string & filename, const double scale_factor = 1e-3 )

Read STEP files and translate their content into openCascade topological entities. The option scale_factor is used to compensate for different units being used in the STEP files and in the target application. The standard unit for STEP files is millimiters. The return object is a TopoDS_Shape which contains all objects from the file.

Definition at line 224 of file utilities.cc.

 void OpenCASCADE::write_STEP ( const TopoDS_Shape & shape, const std::string & filename )

Write the given topological shape into an STEP file.

Definition at line 255 of file utilities.cc.

 double OpenCASCADE::get_shape_tolerance ( const TopoDS_Shape & shape )

This function returns the tolerance associated with the shape. Each CAD geometrical object is defined along with a tolerance, which indicates possible inaccuracy of its placement. For instance, the tolerance of a vertex indicates that it can be located in any point contained in a sphere centered in the nominal position and having radius tol. While carrying out an operation such as projecting a point onto a surface (which will in turn have its tolerance) we must keep in mind that the precision of the projection will be limited by the tolerance with which the surface is built. The tolerance is computed taking the maximum tolerance among the subshapes composing the shape.

Definition at line 269 of file utilities.cc.

 TopoDS_Shape OpenCASCADE::intersect_plane ( const TopoDS_Shape & in_shape, const double c_x, const double c_y, const double c_z, const double c, const double tolerance = 1e-7 )

Perform the intersection of the given topological shape with the plane $$c_x x + c_y y + c_z z +c = 0$$. The returned topological shape will contain as few bsplines as possible. An exception is thrown if the intersection produces an empty shape.

Definition at line 295 of file utilities.cc.

 TopoDS_Edge OpenCASCADE::join_edges ( const TopoDS_Shape & in_shape, const double tolerance = 1e-7 )

Try to join all edges contained in the given TopoDS_Shape into a single TopoDS_Edge, containing as few BSPlines as possible. If the input shape contains faces, they will be ignored by this function. If the contained edges cannot be joined into a single one, i.e., they form disconnected curves, an exception will be thrown.

Definition at line 308 of file utilities.cc.

 TopoDS_Edge OpenCASCADE::interpolation_curve ( std::vector< Point< 3 > > & curve_points, const Tensor< 1, 3 > & direction = Tensor<1,3>(), const bool closed = false, const double tolerance = 1e-7 )

Creates a 3D smooth BSpline curve passing through the points in the assigned vector, and store it in the returned TopoDS_Shape (which is of type TopoDS_Edge). The points are reordered internally according to their scalar product with the direction, if direction is different from zero, otherwise they are used as passed. Notice that this function changes the input points if required by the algorithm.

This class is used to interpolate a BsplineCurve passing through an array of points, with a C2 Continuity. If the optional parameter closed is set to true, then the curve will be C2 at all points except the first (where only C1 continuity will be given), and it will be a closed curve.

The curve is garanteed to be at distance tolerance from the input points. If the algorithm fails in generating such a curve, an exception is thrown.

Definition at line 413 of file utilities.cc.

 void OpenCASCADE::extract_geometrical_shapes ( const TopoDS_Shape & shape, std::vector< TopoDS_Face > & faces, std::vector< TopoDS_Edge > & edges, std::vector< TopoDS_Vertex > & vertices )

Extract all subshapes from a TopoDS_Shape, and store the results into standard containers. If the shape does not contain a certain type of shape, the respective container will be empty.

Definition at line 89 of file utilities.cc.

 void OpenCASCADE::create_triangulation ( const TopoDS_Face & face, Triangulation< 2, 3 > & tria )

Create a triangulation from a single face. This class extract the first u and v parameter of the parametric surface making up this face, and creates a Triangulation<2,3> containing a single coarse cell reflecting this face. If the surface is not a trimmed surface, the vertices of this cell will coincide with the TopoDS_Vertex vertices of the original TopoDS_Face. This, however, is often not the case, and the user should be careful on how this mesh is used.

Definition at line 608 of file utilities.cc.

 void OpenCASCADE::extract_compound_shapes ( const TopoDS_Shape & shape, std::vector< TopoDS_Compound > & compounds, std::vector< TopoDS_CompSolid > & compsolids, std::vector< TopoDS_Solid > & solids, std::vector< TopoDS_Shell > & shells, std::vector< TopoDS_Wire > & wires )

Extract all compound shapes from a TopoDS_Shape, and store the results into standard containers. If the shape does not contain a certain type of compound, the respective container will be empty.

Definition at line 114 of file utilities.cc.

 std_cxx11::tuple< Point< 3 >, TopoDS_Shape, double, double > OpenCASCADE::project_point_and_pull_back ( const TopoDS_Shape & in_shape, const Point< 3 > & origin, const double tolerance = 1e-7 )

Project the point origin on the topological shape given by in_shape, and returns the projected point, the subshape which contains the point and the parametric u and v coordinates of the point within the resulting shape. If the shape is not elementary, all its subshapes are iterated, faces first, then edges, and the returned shape is the closest one to the point origin. If the returned shape is an edge, then only the u coordinate is filled with sensible information, and the v coordinate is set to zero.

This function returns a tuple containing the projected point, the shape, the u coordinate and the v coordinate (which is different from zero only if the resulting shape is a face).

Definition at line 445 of file utilities.cc.

 Point< 3 > OpenCASCADE::closest_point ( const TopoDS_Shape & in_shape, const Point< 3 > & origin, const double tolerance = 1e-7 )

Return the projection of the point origin on the topological shape given by in_shape. If the shape is not elementary, all its subshapes are iterated, faces first, then edges, and the returned point is the closest one to the in_shape, regardless of its type.

Definition at line 525 of file utilities.cc.

 Point< 3 > OpenCASCADE::push_forward ( const TopoDS_Shape & in_shape, const double u, const double v )

Given an elementary shape in_shape and the reference coordinates within the shape, returns the corresponding point in real space. If the shape is a TopoDS_Edge, the v coordinate is ignored. Only edges or faces, as returned by the function project_point_and_pull_back(), can be used as input to this function. If this is not the case, an Exception is thrown.

Definition at line 567 of file utilities.cc.

 std_cxx11::tuple< Point< 3 >, Point< 3 >, double > OpenCASCADE::push_forward_and_differential_forms ( const TopoDS_Face & face, const double u, const double v, const double tolerance = 1e-7 )

Given a TopoDS_Face face and the reference coordinates within this face, returns the corresponding point in real space, the normal to the surface at that point and the mean curvature as a tuple.

Definition at line 590 of file utilities.cc.

 std_cxx11::tuple< Point< 3 >, Point< 3 >, double > OpenCASCADE::closest_point_and_differential_forms ( const TopoDS_Shape & in_shape, const Point< 3 > & origin, const double tolerance = 1e-7 )

Get the closest point to the given topological shape, together with the normal and the mean curvature at that point. If the shape is not elementary, all its sub-faces (only the faces) are iterated, faces first, and only the closest point is returned. This function will throw an exception if the in_shape does not contain at least one face.

Definition at line 535 of file utilities.cc.

 Point< 3 > OpenCASCADE::line_intersection ( const TopoDS_Shape & in_shape, const Point< 3 > & origin, const Tensor< 1, 3 > & direction, const double tolerance = 1e-7 )

Intersect a line passing through the given origin point along direction and the given topological shape. If there is more than one intersection, it will return the closest one.

The optional tolerance parameter is used to compute distances.

Definition at line 372 of file utilities.cc.

 Point< 3 > OpenCASCADE::point ( const gp_Pnt & p )

Convert OpenCASCADE point into a Point<3>.

Definition at line 156 of file utilities.cc.

 gp_Pnt OpenCASCADE::point ( const Point< 3 > & p )

Definition at line 150 of file utilities.cc.

 bool OpenCASCADE::point_compare ( const Point< 3 > & p1, const Point< 3 > & p2, const Tensor< 1, 3 > & direction = Tensor<1,3>(), const double tolerance = 1e-10 )

Sort two points according to their scalar product with direction. If the norm of the direction is zero, then use lexicographical ordering. The optional parameter is used as a relative tolerance when comparing objects.

Definition at line 161 of file utilities.cc.

 OpenCASCADE::DeclException1 ( ExcPointNotOnManifold , Point< 3 > , <<"The point is not on the manifold." ["<< arg1<<"] )

Exception thrown when the point specified as argument does not lie between tolerance from the given TopoDS_Shape.

 OpenCASCADE::DeclException1 ( ExcProjectionFailed , Point< 3 > , <<"Projection of point failed." ["<< arg1<< "] )

Exception thrown when the point specified as argument cannot be projected to the manifold.

 OpenCASCADE::DeclException1 ( ExcOCCError , IFSelect_ReturnStatus , <<"An OpenCASCADE routine failed with return status "<< arg1 )

Thrown when internal OpenCASCADE utilities fail to return the OK status.