1 #ifndef DUNE_GRIDGLUE_COMMON_PROJECTIONHELPER2_HH 2 #define DUNE_GRIDGLUE_COMMON_PROJECTIONHELPER2_HH 17 template<
typename Coordinate>
31 std::array<unsigned, 2>
edge;
39 std::array<Coordinate, 2>
local;
45 constexpr
static unsigned dim = Coordinate::dimension;
54 static_assert(dim == 2 || dim == 3,
"Projection only implemented for dim=2 or dim=3");
59 typedef typename Coordinate::field_type
Field;
68 typedef std::array<Coordinate, dim>
Images;
82 const Field m_overlap;
92 const Field m_max_normal_product;
99 Field m_epsilon =
Field(1e-12);
102 std::tuple<Images, Preimages> m_images;
105 std::tuple<std::bitset<dim>, std::bitset<dim> > m_success;
108 unsigned m_number_of_edge_intersections;
111 std::array<EdgeIntersection, maxEdgeIntersections> m_edge_intersections;
124 bool m_projection_valid;
131 template<
typename Corners,
typename Normals>
132 void doProjection(
const std::tuple<Corners&, Corners&>& corners,
const std::tuple<Normals&, Normals&>& normals);
142 template<
typename Corners,
typename Normals>
143 void doInverseProjection(
const std::tuple<Corners&, Corners&>& corners,
const std::tuple<Normals&, Normals&>& normals);
153 template<
typename Corners,
typename Normals>
154 void doEdgeIntersection(
const std::tuple<Corners&, Corners&>& corners,
const std::tuple<Normals&, Normals&>& normals);
181 template<
typename Corners,
typename Normals>
182 inline bool projectionFeasible(
const Coordinate& x,
const Coordinate& nx,
const Coordinate& px,
const Corners& corners,
const Normals& normals)
const;
210 template<
typename Corners,
typename Normals>
211 void project(
const std::tuple<Corners&, Corners&>& corners,
const std::tuple<Normals&, Normals&>& normals);
233 const std::tuple<Images, Preimages>&
images()
const 250 const std::tuple<std::bitset<dim>, std::bitset<dim> >&
success()
const 251 {
return m_success; }
261 {
return m_number_of_edge_intersections; }
272 {
return m_edge_intersections; }
unsigned numberOfEdgeIntersections() const
Number of edge intersections.
Definition: projection.hh:260
static constexpr unsigned maxEdgeIntersections
maximum number of edge-edge intersections
Definition: projection.hh:52
Images Preimages
Definition: projection.hh:76
const std::array< EdgeIntersection, maxEdgeIntersections > & edgeIntersections() const
Edge-edge intersections.
Definition: projection.hh:271
Projection of a line (triangle) on another line (triangle).
Definition: projection.hh:18
std::array< Coordinate, 2 > local
Local coordinates of intersection and distance along normals.
Definition: projection.hh:39
const std::tuple< std::bitset< dim >, std::bitset< dim > > & success() const
Indicate whether projection (inverse projection) is valid for each corner or not. ...
Definition: projection.hh:250
Coordinate::field_type Field
Scalar type.
Definition: projection.hh:54
std::array< Coordinate, dim > Images
List of corner images.
Definition: projection.hh:68
Projection(const Field overlap=Field(0), const Field max_normal_product=Field(-0.1))
Definition: projection_impl.hh:128
const std::tuple< Images, Preimages > & images() const
Images and preimages of corners.
Definition: projection.hh:233
std::array< unsigned, 2 > edge
Edge numbers in image and preimage triangle.
Definition: projection.hh:31
void project(const std::tuple< Corners &, Corners &> &corners, const std::tuple< Normals &, Normals &> &normals)
Do the actual projection.
Definition: projection_impl.hh:460
static constexpr unsigned dim
dimension of coordinates
Definition: projection.hh:45
Intersection between two edges of a triangle.
Definition: projection.hh:26
void epsilon(const Field epsilon)
Set epsilon used for floating-point comparisons.
Definition: projection_impl.hh:138
Definition: gridglue.hh:30