KASKADE 7 development version
Loading...
Searching...
No Matches
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-2025 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/fmatrix.hh"
21#include "dune/common/fvector.hh"
22#include "dune/geometry/type.hh"
23
24
25namespace Kaskade
26{
50 template <class Grid, class Face, class Displacement, int dimw=Face::dimensionworld>
52 {
53 public:
54 static int const facedimension = Face::mydimension;
55 static int const celldimension = Grid::dimension;
56 static int const griddimension = Face::dimensionworld;
57 static int const worlddimension = dimw;
58
59 using ctype = typename Face::ctype;
60 using Cell = typename Grid::template Codim<0>::Entity;
61
62 private:
63 enum Kind { VOLUMEMESH, SURFACEMESH, PLANARMESH };
64 static Kind const kind = facedimension==celldimension-1? VOLUMEMESH
65 : griddimension==worlddimension? SURFACEMESH
66 : PLANARMESH;
67
68 using PositionExtension = Dune::FieldVector<ctype,worlddimension-celldimension>;
69
70 public:
75
80
85
90
94 BoundaryFace(Face const& f, Displacement const* d = nullptr);
95
97
104 Face const& gridFace() const
105 {
106 return *face;
107 }
108
112 std::pair<GlobalPosition,GlobalPosition> boundingBox() const;
113
117 Dune::GeometryType type() const
118 {
119 return gt;
120 }
121
125 ctype volume() const
126 {
127 return vol;
128 }
129
134
135
140
148 std::optional<std::pair<LocalPosition,ctype>> intersection(GlobalPosition const& a,
149 GlobalPosition const& b) const;
150
151
152 private:
153 // In planar meshes, the grid-global coordinates as returned by mesh functions are "too short".
154 // We extend the missing entries by the given values in z.
155 static GlobalPosition extend(CellGlobalPosition const& x,
156 PositionExtension const& z);
157
158 // Get the cell corresponding to the face. In surface and embedded meshes, this is
159 // the face itself.
160 Cell cell() const;
161
162 GlobalPosition globalUncached(LocalPosition const& xi) const;
163 GlobalPosition unitOuterNormalUncached(LocalPosition const& xi) const;
164
165
168
169 // Compute the Jacobian of the deformation at given local position.
170 std::pair<DeformationJacobian,GridJacobian> jacobians(LocalPosition const& xi) const;
171 std::pair<DeformationJacobian,GridJacobian> jacobiansUncached(LocalPosition const& xi) const;
172
173 std::shared_ptr<Face> face;
174 Dune::GeometryType gt; // geometry type
175 bool faceAffine;
176
177 Displacement const* disp;
178 bool displacementAffine;
179 ctype vol; // deformed face's area
180
181 // Precomputed (because of being constant) values in case of affine displacement and affine face
182 // (implying that the deformed face is affine).
183 DeformationJacobian deformationJacobian; // grid -> world
184 GridJacobian gridJacobian; // reference -> grid
185 GlobalPosition origin; // world position of reference origin
186 GlobalPosition normal;
187 };
188
189 // ----------------------------------------------------------------------------------------------
190}
191
192
193#endif
typename Face::ctype ctype
BoundaryFace(Face const &f, Displacement const *d=nullptr)
Constructor.
Dune::GeometryType type() const
Returns the type of reference face.
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.
Dune::FieldVector< ctype, facedimension > LocalPosition
Local position vector in the face's reference simplex.
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.
Face const & gridFace() const
returns the underlying face (or cell in case of surface meshes).
Dune::FieldVector< ctype, worlddimension > GlobalPosition
Global position in the world.
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 Grid::template Codim< 0 >::Entity Cell
Dune::FieldVector< ctype, griddimension > CellGlobalPosition
Global position of the grid.
Dune::FieldVector< ctype, celldimension > CellLocalPosition
Local position in the grid cell to which this face belongs.
typename GridView::Intersection Face
The type of faces in the grid view.
Definition gridBasics.hh:42