/usr/include/dolfin/intersection/IntersectionOperator.h is in libdolfin1.0-dev 1.0.0-1.
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 | // Copyright (C) 2009-2011 Andre Massing
//
// This file is part of DOLFIN.
//
// DOLFIN is free software: you can 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 3 of the License, or
// (at your option) any later version.
//
// DOLFIN is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
//
// First added: 2009-09-01
// Last changed: 2011-11-11
#ifndef __INTERSECTIONOPERATOR_H
#define __INTERSECTIONOPERATOR_H
#include <string>
#include <utility>
#include <vector>
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
#include <dolfin/common/types.h>
namespace dolfin
{
// Forward declarations
class MeshEntity;
class Mesh;
template <class T> class MeshFunction;
class Point;
class IntersectionOperatorImplementation;
class IntersectionOperator
{
public:
/// Create intersection detector for a given mesh
///
///
/// @param kernel_type The CGAL geometric kernel is used to compute predicates,
/// intersections and such. Depending on this choice the kernel
/// (kernel_type = "ExcactPredicates") can compute predicates excactly
/// (without roundoff error) or only approximately (default, kernel_type =
/// "SimpleCartesian").
IntersectionOperator(const Mesh& _mesh,
const std::string& kernel_type = "SimpleCartesian");
IntersectionOperator(boost::shared_ptr<const Mesh> _mesh,
const std::string& kernel_type = "SimpleCartesian");
/// Create IntersectionOperator for a given mesh
///
/// *Arguments*
/// labels (_MeshFunction<unsigned int>_)
/// A MeshFunction over entities labeling the part of the Mesh
/// for which the distance will be measured to
///
/// label (uint)
/// The label determining the part of the mesh for which
/// the distance will be measured to
///
/// kernel_type (std::string)
/// The CGAL geometric kernel which is used to compute predicates,
/// intersections and such. Depending on this choice the kernel
/// (kernel_type = "ExcactPredicates") can compute predicates
/// excactly (without roundoff error) or only approximately
/// default value is "SimpleCartesian".
IntersectionOperator(const MeshFunction<unsigned int>& labels,
uint label,
const std::string& kernel_type = "SimpleCartesian");
/// Create IntersectionOperator for a given mesh (shared data)
///
/// *Arguments*
/// labels (_MeshFunction<unsigned int>_)
/// A MeshFunction over facets labeling the part of the Boundary
/// for which the distance will be measured to
///
/// label (uint)
/// The label determining the part of the mesh for which
/// the distance will be measured to
///
/// kernel_type (std::string)
/// The CGAL geometric kernel which is used to compute predicates,
/// intersections and such. Depending on this choice the kernel
/// (kernel_type = "ExcactPredicates") can compute predicates
/// excactly (without roundoff error) or only approximately
/// default value is "SimpleCartesian".
IntersectionOperator(boost::shared_ptr<const MeshFunction<unsigned int> > labels,
uint label, const std::string&
kernel_type="SimpleCartesian");
/// Destructor. Needed be explicit written, otherwise default inline
/// here, with prohibits pImpl with scoped_ptr.
~IntersectionOperator();
/// Compute all id of all cells which are intersects by a \em point.
/// \param[out] ids_result The ids of the intersected entities are saved in a set for efficienty
/// reasons, to avoid to sort out duplicates later on.
void all_intersected_entities(const Point & point,
std::set<uint>& ids_result) const;
/// Compute all id of all cells which are intersects any point in \em points.
/// \param[out] ids_result The ids of the intersected entities are saved in a set for efficienty
/// reasons, to avoid to sort out duplicates later on.
void all_intersected_entities(const std::vector<Point>& points,
std::set<uint>& ids_result) const;
/// Compute all id of all cells which are intersects by a \em entity.
/// \param[out] ids_result The ids of the intersected entities are saved in a vector.
/// This allows is more efficent than using a set and allows a map between
/// the (external) cell and the intersected cell of the mesh. If you
/// are only interested in intersection with a list of cells without caring about which
/// cell what intersected by which one, use
/// void IntersectionOperator::all_intersected_entities(const std::vector<Cell> &, std::set<uint> &) const;
/// @internal
/// @todo This function has to improved: 1) it requires the object the
/// mesh is to be cut with to be another mesh entitiy instead of being just a
/// kind of geometric object. 2) Requires a runtime switch 3) would require a
/// implementation for each geometric primitive if they have no common base
/// class.
void all_intersected_entities(const MeshEntity & entity, std::vector<uint> & ids_result) const;
/// Compute all id of all cells which are intersects by any of the entities in \em entities. This
/// \param[out] ids_result The ids of the intersected set are saved in a set for efficienty
/// reasons, to avoid to sort out duplicates later on.
void all_intersected_entities(const std::vector<MeshEntity> & entities, std::set<uint> & ids_result) const;
/// Compute all id of all cells which are intersects by the given mesh \em another_mesh;
/// \param[out] ids_result The ids of the intersected entities are saved in a set for efficienty
/// reasons, to avoid to sort out duplicates later on.
void all_intersected_entities(const Mesh& another_mesh,
std::set<uint>& ids_result) const;
/// Computes only the first id of the entity, which contains the point. Returns -1 if no cell is intersected.
/// @internal @remark This makes the function evaluation significantly faster.
int any_intersected_entity(const Point& point) const;
/// Computes the point inside the mesh which is closest to the point query.
Point closest_point(const Point & point) const;
/// Computes the index of the cell inside the mesh which are closest to the point query.
dolfin::uint closest_cell(const Point & point) const;
/// Computes the point inside the mesh and the corresponding cell index
/// that are closest to the point query.
std::pair<Point,uint> closest_point_and_cell(const Point & point) const;
/// Computes the distance between the given point and the nearest entity
double distance(const Point & point) const;
/// Rebuilds the underlying search structure from scratch and uses
/// the kernel kernel_type underlying CGAL Geometry kernel.
void reset_kernel(const std::string& kernel_type = "SimpleCartesian");
/// Clears search structure. Should be used if the mesh has changed
void clear();
const Mesh& mesh() const;
private:
// Helper function to introduce lazy initialization.
const IntersectionOperatorImplementation& rImpl() const;
// Factory function to create the dimension dependent intersection
// operator implementation.
IntersectionOperatorImplementation*
create_intersection_operator(const std::string & kernel_type);
// Pointer to implementation. Mutable to enable lazy initialization.
mutable boost::scoped_ptr<IntersectionOperatorImplementation> _pImpl;
// Pointer to mesh.
boost::shared_ptr<const Mesh> _mesh;
// Pointer to mesh function
boost::shared_ptr<const MeshFunction<uint> > _labels;
// Label if MeshFunction is used
uint _label;
// Flag if MeshFunction is used
bool _use_labels;
// String description of the used geometry kernel.
std::string _kernel_type;
};
}
#endif
|