Mechanics of Defect Evolution Library
Loading...
Searching...
No Matches
SimplexBase.h
Go to the documentation of this file.
1/* This file is part of MoDELib, the Mechanics Of Defects Evolution Library.
2 *
3 *
4 * MoDELib is distributed without any warranty under the
5 * GNU General Public License (GPL) v2 <http://www.gnu.org/licenses/>.
6 */
7
8#ifndef model_SimplexBase_H_
9#define model_SimplexBase_H_
10
11#include <StaticID.h>
12//#include <NonCopyable.h>
13#include <SimplexTraits.h>
14
15
16namespace model
17{
18
19 /**************************************************************************/
20 /**************************************************************************/
21 template<short int _dim, short int order>
22 struct SimplexBase : public StaticID<SimplexBase<_dim,order> >
23 {
24
25 static constexpr short int dim=_dim;
28
33
34 /**********************************************************************/
36 const SimplexIDType& vIN) :
37 /* init */ mesh(m)
38 /* init */,xID(SimplexTraitsType::sortID(vIN))
39 /* init */,key(xID)
40 {
42
43 }
44
45 SimplexBase(const SimplexBase&)=delete;
47
48 std::array<const Simplex<dim,0>*, SimplexTraits<dim,order>::nVertices> vertices() const
49 {
50 std::array<const Simplex<dim,0>*, SimplexTraits<dim,order>::nVertices> temp{};
51 const auto* simplex=static_cast<const Simplex<dim,order>*>(this);
52 if constexpr (order==0)
53 {
54 temp[0]=simplex;
55 }
56 else
57 {
58 // Follow owned children, so retained simplices keep their original geometry
59 // even when the mesh is reloaded or destroyed.
60 for (const auto& child : simplex->children())
61 {
62 for (const auto* vertex : child->vertices())
63 {
64 for (size_t v=0;v<temp.size();++v)
65 {
66 if (xID[v]==vertex->xID[0])
67 {
68 temp[v]=vertex;
69 }
70 }
71 }
72 }
73 }
74 return temp;
75 }
76
77 };
78
79} // close namespace
80#endif
SimplexBase(SimplicialMesh< dim > *const m, const SimplexIDType &vIN)
Definition SimplexBase.h:35
SimplexBase(const SimplexBase &)=delete
static constexpr short int dim
Definition SimplexBase.h:25
SimplicialMesh< dim > *const mesh
Definition SimplexBase.h:29
const SimplexIDType xID
Definition SimplexBase.h:31
const SimplexIDType & key
Definition SimplexBase.h:32
std::array< const Simplex< dim, 0 > *, SimplexTraits< dim, order >::nVertices > vertices() const
Definition SimplexBase.h:48
SimplexTraitsType::SimplexIDType SimplexIDType
Definition SimplexBase.h:27
SimplexBase & operator=(const SimplexBase &)=delete
SimplexTraits< dim, order > SimplexTraitsType
Definition SimplexBase.h:26
SimplexIDType KeyType
Definition SimplexBase.h:30
static constexpr int nVertices
SimplexID< nVertices > SimplexIDType
b order
REAL * vertex
Definition triangle.cpp:542
vertex temp
void t struct mesh * m
REAL v[4]