KASKADE 7 development version
gridBasics.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) 2019-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#ifndef GRIDBASICS_HH_
13#define GRIDBASICS_HH_
14
15#include <mutex>
16
17// forward declarations of grids
18#include "dune/common/fvector.hh"
19#include "dune/grid/geometrygrid/declaration.hh"
20
22
23
24
25// ------------------------------------------------------------------------------------------------
26
27namespace Kaskade
28{
34 template <class GridView>
35 using Cell = typename GridView::template Codim<0>::Entity;
36
41 template <class GridView>
42 using Face = typename GridView::Intersection;
43
49 template <class GridView>
51
52
58 template <class GridView>
60
66 template <class GridView>
67 using FaceLocalPosition = Dune::FieldVector<typename GridView::ctype,GridView::dimension-1>;
68
69
70
71
72
73 // ----------------------------------------------------------------------------------------------
74
82 template <class Grid>
83 struct GridLocking: public std::false_type
84 {
95 {
96 static GridLocking<Grid> m;
97 return m;
98 }
99
100 void lock()
101 {}
102
103 bool try_lock()
104 {
105 return true;
106 }
107
108 void unlock()
109 {}
110 };
111
112
113
114 template <class HostGrid, class Deformation, class Allocator>
115 struct GridLocking<Dune::GeometryGrid<HostGrid,Deformation,Allocator>>: public std::true_type
116 {
117 static std::recursive_mutex& mutex()
118 {
119 static std::recursive_mutex m;
120 return m;
121 }
122 };
123
124 // ----------------------------------------------------------------------------------------------
125
126
127}
128
129#endif
typename GridView::template Codim< 0 >::Entity Cell
The type of cells (entities of codimension 0) in the grid view.
Definition: gridBasics.hh:35
typename GridView::Intersection Face
The type of faces in the grid view.
Definition: gridBasics.hh:42
Grid locking information based on grid type.
Definition: gridBasics.hh:84
static GridLocking< Grid > & mutex()
Returns a globally unique lockable object that shall be used for locking access to operations on the ...
Definition: gridBasics.hh:94