3#ifndef DUNE_GRIDGLUE_COMMON_PROJECTIONHELPER2_HH
4#define DUNE_GRIDGLUE_COMMON_PROJECTIONHELPER2_HH
19template<
typename Coordinate>
33 std::array<unsigned, 2>
edge;
41 std::array<Coordinate, 2>
local;
47 constexpr static unsigned dim = Coordinate::dimension;
56 static_assert(
dim == 2 ||
dim == 3,
"Projection only implemented for dim=2 or dim=3");
61 typedef typename Coordinate::field_type
Field;
70 typedef std::array<Coordinate, dim>
Images;
84 const Field m_overlap;
94 const Field m_max_normal_product;
104 std::tuple<Images, Preimages> m_images;
107 std::tuple<std::bitset<dim>, std::bitset<dim> > m_success;
110 unsigned m_number_of_edge_intersections;
113 std::array<EdgeIntersection, maxEdgeIntersections> m_edge_intersections;
126 bool m_projection_valid;
133 template<
typename Corners,
typename Normals>
134 void doProjection(
const std::tuple<Corners&, Corners&>& corners,
const std::tuple<Normals&, Normals&>& normals);
144 template<
typename Corners,
typename Normals>
145 void doInverseProjection(
const std::tuple<Corners&, Corners&>& corners,
const std::tuple<Normals&, Normals&>& normals);
155 template<
typename Corners,
typename Normals>
156 void doEdgeIntersection(
const std::tuple<Corners&, Corners&>& corners,
const std::tuple<Normals&, Normals&>& normals);
183 template<
typename Corners,
typename Normals>
184 inline bool projectionFeasible(
const Coordinate& x,
const Coordinate& nx,
const Coordinate& px,
const Corners& corners,
const Normals& normals)
const;
212 template<
typename Corners,
typename Normals>
213 void project(
const std::tuple<Corners&, Corners&>& corners,
const std::tuple<Normals&, Normals&>& normals);
235 const std::tuple<Images, Preimages>&
images()
const
252 const std::tuple<std::bitset<dim>, std::bitset<dim> >&
success()
const
253 {
return m_success; }
263 {
return m_number_of_edge_intersections; }
274 {
return m_edge_intersections; }
Definition gridglue.hh:37
Projection of a line (triangle) on another line (triangle).
Definition projection.hh:21
Coordinate::field_type Field
Scalar type.
Definition projection.hh:61
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:252
static constexpr unsigned maxEdgeIntersections
maximum number of edge-edge intersections
Definition projection.hh:54
Images Preimages
Definition projection.hh:78
std::array< Coordinate, dim > Images
List of corner images.
Definition projection.hh:70
void epsilon(const Field epsilon)
Set epsilon used for floating-point comparisons.
Definition projection_impl.hh:140
void project(const std::tuple< Corners &, Corners & > &corners, const std::tuple< Normals &, Normals & > &normals)
Do the actual projection.
Definition projection_impl.hh:469
static constexpr unsigned dim
dimension of coordinates
Definition projection.hh:47
unsigned numberOfEdgeIntersections() const
Number of edge intersections.
Definition projection.hh:262
const std::tuple< Images, Preimages > & images() const
Images and preimages of corners.
Definition projection.hh:235
const std::array< EdgeIntersection, maxEdgeIntersections > & edgeIntersections() const
Edge-edge intersections.
Definition projection.hh:273
Intersection between two edges of a triangle.
Definition projection.hh:29
std::array< Coordinate, 2 > local
Local coordinates of intersection and distance along normals.
Definition projection.hh:41
std::array< unsigned, 2 > edge
Edge numbers in image and preimage triangle.
Definition projection.hh:33