KASKADE 7 development version
boundaryFace.hh
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the library KASKADE 7 */
4/* https://www.zib.de/research/projects/kaskade7-finite-element-toolbox */
5/* */
6/* Copyright (C) 2020-2023 Zuse Institute Berlin */
7/* */
8/* KASKADE 7 is distributed under the terms of the ZIB Academic License. */
9/* see $KASKADE/academic.txt */
10/* */
11/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
12
13#ifndef BOUNDARYFACE_HH
14#define BOUNDARYFACE_HH
15
16#include <memory>
17#include <optional>
18#include <utility>
19
20#include "dune/common/fvector.hh"
21#include "dune/geometry/type.hh"
22
23
24namespace Kaskade
25{
43 template <class Grid, class Face, class Displacement, int dimw=Face::dimensionworld>
45 {
46 public:
47 static int const facedimension = Face::mydimension;
48 static int const celldimension = Grid::dimension;
49 static int const griddimension = Face::dimensionworld;
50 static int const worlddimension = dimw;
51
52 using ctype = typename Face::ctype;
53 using Cell = typename Grid::Codim<0>::Entity;
54
55 private:
56 enum Kind { VOLUMEMESH, SURFACEMESH, PLANARMESH };
57 static Kind const kind = facedimension==celldimension-1? VOLUMEMESH
58 : griddimension==worlddimension? SURFACEMESH
59 : PLANARMESH;
60
61 using PositionExtension = Dune::FieldVector<ctype,worlddimension-celldimension>;
62
63 public:
68
73
78
83
87 BoundaryFace(Face const& f, Displacement const* d = nullptr);
88
90
91 Face const& gridFace() const
92 {
93 return *face;
94 }
95
99 std::pair<GlobalPosition,GlobalPosition> boundingBox() const;
100
104 Dune::GeometryType type() const
105 {
106 return gt;
107 }
108
112 ctype volume() const
113 {
114 return vol;
115 }
116
121
122
127
135 std::optional<std::pair<LocalPosition,ctype>> intersection(GlobalPosition const& a,
136 GlobalPosition const& b) const;
137
138
139 private:
140 // In planar meshes, the grid-global coordinates as returned by mesh functions are "too short".
141 // We extend the missing entries by the given values in z.
142 static GlobalPosition extend(CellGlobalPosition const& x,
143 PositionExtension const& z);
144
145 // Get the cell corresponding to the face. In surface and embedded meshes, this is
146 // the face itself.
147 Cell cell() const;
148
149 GlobalPosition globalUncached(LocalPosition const& xi) const;
150 GlobalPosition unitOuterNormalUncached(LocalPosition const& xi) const;
151
152
155
156 // Compute the Jacobian of the deformation at given local position.
157 std::pair<DeformationJacobian,GridJacobian> jacobians(LocalPosition const& xi) const;
158 std::pair<DeformationJacobian,GridJacobian> jacobiansUncached(LocalPosition const& xi) const;
159
160 std::shared_ptr<Face> face;
161 Dune::GeometryType gt; // geometry type
162 bool faceAffine;
163
164 Displacement const* disp;
165 bool displacementAffine;
166 ctype vol; // deformed face's area
167
168 // Precomputed (because of being constant) values in case of affine displacement and affine face
169 // (implying that the deformed face is affine).
170 DeformationJacobian deformationJacobian; // grid -> world
171 GridJacobian gridJacobian; // reference -> grid
172 GlobalPosition origin; // world position of reference origin
173 GlobalPosition normal;
174 };
175
176 // ----------------------------------------------------------------------------------------------
177}
178
179
180#endif
A class for representing displaced/deformed boundary faces.
Definition: boundaryFace.hh:45
typename Face::ctype ctype
Definition: boundaryFace.hh:52
static int const griddimension
Definition: boundaryFace.hh:49
static int const worlddimension
Definition: boundaryFace.hh:50
BoundaryFace(Face const &f, Displacement const *d=nullptr)
Constructor.
Dune::GeometryType type() const
Returns the type of reference face.
static int const facedimension
Definition: boundaryFace.hh:47
static int const celldimension
Definition: boundaryFace.hh:48
std::pair< GlobalPosition, GlobalPosition > boundingBox() const
Computes the axis-aligned bounding box.
GlobalPosition global(LocalPosition const &xi) const
Computes the global world position of the given local coordinate.
std::optional< std::pair< LocalPosition, ctype > > intersection(GlobalPosition const &a, GlobalPosition const &b) const
Computes the intersection of the boundary face with the given line segment , if there is any.
typename Grid::Codim< 0 >::Entity Cell
Definition: boundaryFace.hh:53
Face const & gridFace() const
Definition: boundaryFace.hh:91
ctype volume() const
Computes the area of the deformed face.
GlobalPosition unitOuterNormal(LocalPosition const &xi) const
Computes the unit outer normal of the deformed face.
typename GridView::Intersection Face
The type of faces in the grid view.
Definition: gridBasics.hh:42