/usr/include/deal.II/opencascade/boundary_lib.h is in libdeal.ii-dev 8.5.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | // ---------------------------------------------------------------------
//
// Copyright (C) 2014 - 2017 by the deal.II authors
//
// This file is part of the deal.II library.
//
// The deal.II library is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE at
// the top level of the deal.II distribution.
//
// ---------------------------------------------------------------------
#ifndef dealii__occ_boundary_lib_h
#define dealii__occ_boundary_lib_h
#include <deal.II/base/config.h>
#ifdef DEAL_II_WITH_OPENCASCADE
#include <deal.II/opencascade/utilities.h>
#include <deal.II/grid/tria_boundary.h>
#include <deal.II/grid/manifold.h>
// opencascade needs "HAVE_CONFIG_H" to be exported...
#define HAVE_CONFIG_H
#include <Adaptor3d_Curve.hxx>
#include <Adaptor3d_HCurve.hxx>
#include <BRepAdaptor_Curve.hxx>
#undef HAVE_CONFIG_H
DEAL_II_NAMESPACE_OPEN
/**
* @addtogroup OpenCASCADE
* @{
*/
namespace OpenCASCADE
{
/**
* A Boundary object based on OpenCASCADE TopoDS_Shape where where new
* points are first computed by averaging the surrounding points in the same
* way as FlatManifold does, and are then projected in the normal direction
* using OpenCASCADE utilities.
*
* This class makes no assumptions on the shape you pass to it, and the
* topological dimension of the Manifold is inferred from the TopoDS_Shape
* itself. In debug mode there is a sanity check to make sure that the
* surrounding points (the ones used in project_to_manifold()) actually live
* on the Manifold, i.e., calling OpenCASCADE::closest_point() on those
* points leaves them untouched. If this is not the case, an
* ExcPointNotOnManifold is thrown.
*
* This could happen, for example, if you are trying to use a shape of type
* TopoDS_Edge when projecting on a face. In this case, the vertices of the
* face would be collapsed to the edge, and your surrounding points would
* not be lying on the given shape, raising an exception.
*
* @author Luca Heltai, Andrea Mola, 2011--2014.
*/
template <int dim, int spacedim>
class NormalProjectionBoundary : public Boundary<dim,spacedim>
{
public:
/**
* The standard constructor takes a generic TopoDS_Shape @p sh, and a
* tolerance used to compute distances internally.
*
* The TopoDS_Shape can be arbitrary, i.e., a collection of shapes, faces,
* edges or a single face or edge.
*/
NormalProjectionBoundary(const TopoDS_Shape &sh,
const double tolerance=1e-7);
/**
* Perform the actual projection onto the manifold. This function, in
* debug mode, checks that each of the @p surrounding_points is within
* tolerance from the given TopoDS_Shape. If this is not the case, an
* exception is thrown.
*
* The projected point is computed using OpenCASCADE normal projection
* algorithms.
*/
virtual Point<spacedim>
project_to_manifold (const std::vector<Point<spacedim> > &surrounding_points,
const Point<spacedim> &candidate) const;
private:
/**
* The topological shape which is used internally to project points. You
* can construct such a shape by calling the OpenCASCADE::read_IGES()
* function, which will create a TopoDS_Shape with the geometry contained
* in the IGES file.
*/
const TopoDS_Shape sh;
/**
* Relative tolerance used by this class to compute distances.
*/
const double tolerance;
};
/**
* A Boundary object based on OpenCASCADE TopoDS_Shape where new points are
* first computed by averaging the surrounding points in the same way as
* FlatManifold does, and then projecting them onto the manifold along the
* direction specified at construction time using OpenCASCADE utilities.
*
* This class makes no assumptions on the shape you pass to it, and the
* topological dimension of the Manifold is inferred from the TopoDS_Shape
* itself. In debug mode there is a sanity check to make sure that the
* surrounding points (the ones used in project_to_manifold()) actually live
* on the Manifold, i.e., calling OpenCASCADE::closest_point() on those
* points leaves them untouched. If this is not the case, an
* ExcPointNotOnManifold is thrown.
*
* Notice that this type of Boundary descriptor may fail to give results if
* the triangulation to be refined is close to the boundary of the given
* TopoDS_Shape, or when the direction you use at construction time does not
* intersect the shape. An exception is thrown when this happens.
*
* @author Luca Heltai, Andrea Mola, 2011--2014.
*/
template <int dim, int spacedim>
class DirectionalProjectionBoundary : public Boundary<dim,spacedim>
{
public:
/**
* Construct a Boundary object which will project points on the
* TopoDS_Shape @p sh, along the given @p direction.
*/
DirectionalProjectionBoundary(const TopoDS_Shape &sh,
const Tensor<1,spacedim> &direction,
const double tolerance=1e-7);
/**
* Perform the actual projection onto the manifold. This function, in
* debug mode, checks that each of the @p surrounding_points is within
* tolerance from the given TopoDS_Shape. If this is not the case, an
* exception is thrown.
*
* The projected point is computed using OpenCASCADE directional
* projection algorithms.
*/
virtual Point<spacedim>
project_to_manifold (const std::vector<Point<spacedim> > &surrounding_points,
const Point<spacedim> &candidate) const;
private:
/**
* The topological shape which is used internally to project points. You
* can construct such a shape by calling the OpenCASCADE::read_IGES()
* function, which will create a TopoDS_Shape with the geometry contained
* in the IGES file.
*/
const TopoDS_Shape sh;
/**
* Direction used to project new points on the shape.
*/
const Point<3> direction;
/**
* Relative tolerance used by this class to compute distances.
*/
const double tolerance;
};
/**
* A Boundary object based on OpenCASCADE TopoDS_Shape where new points are
* first computed by averaging the surrounding points in the same way as
* FlatManifold does, and then projecting them using OpenCASCADE utilities
* onto the manifold along a direction which is an estimation of the
* surrounding points (hence mesh cell) normal.
*
* The direction normal to the mesh is particularly useful because it is the
* direction in which the mesh is missing nodes. For instance, during the
* refinement of a cell a new node is initially created around the
* baricenter of the cell. This location somehow ensures a uniform distance
* from the nodes of the old cell. Projecting such cell baricenter onto the
* CAD surface in the direction normal to the original cell will then retain
* uniform distance from the points of the original cell. Of course, at the
* stage of mesh generation, no dof handler nor finite element are defined,
* and such direction has to be estimated. For the case in which 8
* surrounding points are present, 4 different triangles are identified with
* the points assigned, and the normals of such triangles are averaged to
* obtain the approximation of the normal to the cell.
*
* The case in which 2 surrounding points are present (i.e.:a cell edge is
* being refined) is of course more tricky. The average of the CAD surface
* normals at the 2 surrounding points is first computed, and then projected
* onto the plane normal to the segment linking the surrounding points. This
* again is an attempt to have the new point with equal distance with
* respect to the surrounding points
*
* This class only operates with CAD faces and makes the assumption that the
* shape you pass to it contains at least one face. If that is not the case,
* an Exception is thrown. In debug mode there is a sanity check to make
* sure that the surrounding points (the ones used in project_to_manifold())
* actually live on the Manifold, i.e., calling OpenCASCADE::closest_point()
* on those points leaves them untouched. If this is not the case, an
* ExcPointNotOnManifold is thrown.
*
*
* Notice that this type of Boundary descriptor may fail to give results if
* the triangulation to be refined is close to the boundary of the given
* TopoDS_Shape, or when the normal direction estimated from the surrounding
* points does not intersect the shape. An exception is thrown when this
* happens.
*
* @author Luca Heltai, Andrea Mola, 2011--2014.
*/
template <int dim, int spacedim>
class NormalToMeshProjectionBoundary : public Boundary<dim,spacedim>
{
public:
/**
* Construct a Boundary object which will project points on the
* TopoDS_Shape @p sh, along a direction which is approximately normal to
* the mesh cell.
*/
NormalToMeshProjectionBoundary(const TopoDS_Shape &sh,
const double tolerance=1e-7);
/**
* Perform the actual projection onto the manifold. This function, in
* debug mode, checks that each of the @p surrounding_points is within
* tolerance from the given TopoDS_Shape. If this is not the case, an
* exception is thrown.
*/
virtual Point<spacedim>
project_to_manifold (const std::vector<Point<spacedim> > &surrounding_points,
const Point<spacedim> &candidate) const;
private:
/**
* The topological shape which is used internally to project points. You
* can construct such a shape by calling the OpenCASCADE::read_IGES()
* function, which will create a TopoDS_Shape with the geometry contained
* in the IGES file.
*/
const TopoDS_Shape sh;
/**
* Direction used to project new points on the shape.
*/
const Point<3> direction;
/**
* Relative tolerance used by this class to compute distances.
*/
const double tolerance;
};
/**
* A Boundary object based on OpenCASCADE TopoDS_Shape objects which have
* topological dimension equal to one (TopoDS_Edge or TopoDS_Wire) where new
* points are located at the arclength average of the surrounding points. If
* the given TopoDS_Shape can be casted to a periodic (closed) curve, then
* this information is used internally to set the periodicity of the base
* ChartManifold class.
*
* This class can only work on TopoDS_Edge or TopoDS_Wire objects, and it
* only makes sense when spacedim is three. If you use an object of
* topological dimension different from one, an exception is throw.
*
* In debug mode there is an additional sanity check to make sure that the
* surrounding points actually live on the Manifold, i.e., calling
* OpenCASCADE::closest_point() on those points leaves them untouched. If
* this is not the case, an ExcPointNotOnManifold is thrown.
*
* @author Luca Heltai, Andrea Mola, 2011--2014.
*/
template <int dim, int spacedim>
class ArclengthProjectionLineManifold : public ChartManifold<dim,spacedim,1>
{
public:
/**
* Default constructor with a TopoDS_Edge.
*/
ArclengthProjectionLineManifold(const TopoDS_Shape &sh,
const double tolerance=1e-7);
/**
* Given a point on real space, find its arclength parameter. Throws an
* error in debug mode, if the point is not on the TopoDS_Edge given at
* construction time.
*/
virtual Point<1>
pull_back(const Point<spacedim> &space_point) const;
/**
* Given an arclength parameter, find its image in real space.
*/
virtual Point<spacedim>
push_forward(const Point<1> &chart_point) const;
private:
/**
* A Curve adaptor. This is the one which is used in the computations, and
* it points to the right one above.
*/
Handle_Adaptor3d_HCurve curve;
/**
* Relative tolerance used in all internal computations.
*/
const double tolerance;
/**
* The total length of the curve. This is also used as a period if the
* edge is periodic.
*/
const double length;
};
/**
* Manifold description for the face of a CAD imported usign OpenCASCADE.
*
* @ingroup manifold
*
* @author Andrea Mola, Mauro Bardelloni, 2016
*/
template <int dim, int spacedim>
class NURBSPatchManifold : public ChartManifold<dim, spacedim, 2>
{
public:
/**
* The constructor takes an OpenCASCADE TopoDS_Face @p face and an optional
* @p tolerance. This class uses the interval OpenCASCADE variables @var u,
* @var v to descrive the manifold.
*/
NURBSPatchManifold(const TopoDS_Face &face, const double tolerance = 1e-7);
/**
* Pull back the given point from the Euclidean space. Will return the uv
* coordinates associated with the point @p space_point.
*/
virtual Point<2>
pull_back(const Point<spacedim> &space_point) const;
/**
* Given a @p chart_point in the uv coordinate system, this method returns the
* Euclidean coordinates associated.
*/
virtual Point<spacedim>
push_forward(const Point<2> &chart_point) const;
/**
* Given a point in the spacedim dimensional Euclidean space, this
* method returns the derivatives of the function $F$ that maps from
* the uv coordinate system to the Euclidean coordinate
* system. In other words, it is a matrix of size
* $\text{spacedim}\times\text{chartdim}$.
*
* This function is used in the computations required by the
* get_tangent_vector() function.
*
* Refer to the general documentation of this class for more information.
*/
virtual
DerivativeForm<1,2,spacedim>
push_forward_gradient(const Point<2> &chart_point) const;
private:
/**
* Return a tuple representing the minimum and maximum values of u
* and v. Precisely, it returns (u_min, u_max, v_min, v_max)
*/
std_cxx11::tuple<double, double, double, double>
get_uv_bounds() const;
/**
* An OpenCASCADE TopoDS_Face @p face given by the CAD.
*/
TopoDS_Face face;
/**
* Tolerance used by OpenCASCADE to identify points in each
* operation.
*/
double tolerance;
};
}
/*@}*/
DEAL_II_NAMESPACE_CLOSE
#endif // DEAL_II_WITH_OPENCASCADE
/*------------------------------ occ_boundary_lib.h ------------------------------*/
#endif
/*------------------------------ occ_boundary_lib.h ------------------------------*/
|