FEDEM Model Database  R8.0
Source code of the FEDEM model database
FFlFEElementTopSpec.H
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2023 SAP SE
2 //
3 // SPDX-License-Identifier: Apache-2.0
4 //
5 // This file is part of FEDEM - https://openfedem.org
7 
8 #ifndef FFL_FEELEMENT_TOP_SPEC_H
9 #define FFL_FEELEMENT_TOP_SPEC_H
10 
11 #include <vector>
12 #include <utility>
13 
14 
15 #define FFL_FE_ELEMENT_TOP_SPEC(Class) \
16  virtual FFlFEElementTopSpec* getFEElementTopSpec() const \
17  { return FFaSingelton<FFlFEElementTopSpec,Class>::instance(); }
18 
19 
20 using EdgeType = std::pair<int,int>;
21 
22 
23 struct FaceType
24 {
25  void addEdge(int i1, int i2) { myEdges.emplace_back(i1,i2); }
26  std::vector<EdgeType> myEdges;
27 };
28 
29 
31 {
32 public:
34  {
36  iAmShellFaces = allSlaveNodes = false;
37  }
38  virtual ~FFlFEElementTopSpec() {}
39 
40  void addFace(const FaceType& f) { myFaces.push_back(f); }
41  void addExpandedFace(const FaceType& f) { myExpandedFaces.push_back(f); }
42  void addExplicitEdge(int i1, int i2) { myExplicitEdges.emplace_back(i1,i2); }
43 
44  int getNodeCount() const { return myNodeCount; }
45  int getExpandedNodeCount() const { return myExpandedNodeCount; }
46  virtual int getNodeDOFs(int) const { return myNodeDOFs; }
47 
48  virtual bool isSlaveNode(int) const { return allSlaveNodes; }
49  virtual bool isReferenceNode(int) const { return false; }
50 
51  bool isShellFaces() const { return iAmShellFaces; }
52 
53  void setNodeCount(int count) { myNodeCount = count; }
54  void setExpandedNodeCount(int count) { myExpandedNodeCount = count; }
55  void setNodeDOFs(int count) { myNodeDOFs = count; }
56 
57  void setShellFaces(bool trueOrFalse) { iAmShellFaces = trueOrFalse; }
58  void setSlaveStatus(bool trueOrFalse) { allSlaveNodes = trueOrFalse; }
59 
60  void setTopology(int faceCount, int* faceConnections, bool expanded = false);
61  void setExpandedTopology(int faceCount, int* faceConnections);
62 
63  // Get local element node ids for each vertex in face
64  bool getFaceTopology(short int faceNumber, bool isExpandedFace,
65  bool switchNormal, short int idxOffset,
66  std::vector<int>& topology) const;
67 
68  // Get the number of vertices in the given local face
69  int getFaceVertexCount(short int faceNumber, bool isExpandedFace) const;
70 
71  // Get local face number defined by two local node ids
72  short int getFaceNum(int node1, int node2) const;
73 
74  void dump() const;
75 
76  std::vector<FaceType> myFaces;
77  std::vector<FaceType> myExpandedFaces;
78  std::vector<EdgeType> myExplicitEdges;
79 
80  unsigned short myExplEdgePattern;
81 
82 protected:
85  char myNodeDOFs : 7;
86  bool iAmShellFaces : 1;
87  bool allSlaveNodes : 1;
88 };
89 
90 #endif
std::pair< int, int > EdgeType
Definition: FFlFEElementTopSpec.H:20
Definition: FFlFEElementTopSpec.H:31
void dump() const
Definition: FFlFEElementTopSpec.C:14
void setTopology(int faceCount, int *faceConnections, bool expanded=false)
Definition: FFlFEElementTopSpec.C:31
void setNodeDOFs(int count)
Definition: FFlFEElementTopSpec.H:55
void addFace(const FaceType &f)
Definition: FFlFEElementTopSpec.H:40
void setNodeCount(int count)
Definition: FFlFEElementTopSpec.H:53
virtual bool isReferenceNode(int) const
Definition: FFlFEElementTopSpec.H:49
bool isShellFaces() const
Definition: FFlFEElementTopSpec.H:51
void setExpandedNodeCount(int count)
Definition: FFlFEElementTopSpec.H:54
FFlFEElementTopSpec()
Definition: FFlFEElementTopSpec.H:33
int myExpandedNodeCount
Definition: FFlFEElementTopSpec.H:84
int getFaceVertexCount(short int faceNumber, bool isExpandedFace) const
Definition: FFlFEElementTopSpec.C:122
void setSlaveStatus(bool trueOrFalse)
Definition: FFlFEElementTopSpec.H:58
std::vector< FaceType > myFaces
Definition: FFlFEElementTopSpec.H:76
bool iAmShellFaces
Definition: FFlFEElementTopSpec.H:86
bool allSlaveNodes
Definition: FFlFEElementTopSpec.H:87
int myNodeCount
Definition: FFlFEElementTopSpec.H:83
virtual int getNodeDOFs(int) const
Definition: FFlFEElementTopSpec.H:46
void setExpandedTopology(int faceCount, int *faceConnections)
Definition: FFlFEElementTopSpec.C:57
virtual ~FFlFEElementTopSpec()
Definition: FFlFEElementTopSpec.H:38
void setShellFaces(bool trueOrFalse)
Definition: FFlFEElementTopSpec.H:57
bool getFaceTopology(short int faceNumber, bool isExpandedFace, bool switchNormal, short int idxOffset, std::vector< int > &topology) const
Definition: FFlFEElementTopSpec.C:68
char myNodeDOFs
Definition: FFlFEElementTopSpec.H:85
void addExpandedFace(const FaceType &f)
Definition: FFlFEElementTopSpec.H:41
void addExplicitEdge(int i1, int i2)
Definition: FFlFEElementTopSpec.H:42
int getExpandedNodeCount() const
Definition: FFlFEElementTopSpec.H:45
std::vector< EdgeType > myExplicitEdges
Definition: FFlFEElementTopSpec.H:78
virtual bool isSlaveNode(int) const
Definition: FFlFEElementTopSpec.H:48
int getNodeCount() const
Definition: FFlFEElementTopSpec.H:44
unsigned short myExplEdgePattern
Definition: FFlFEElementTopSpec.H:80
short int getFaceNum(int node1, int node2) const
Definition: FFlFEElementTopSpec.C:145
std::vector< FaceType > myExpandedFaces
Definition: FFlFEElementTopSpec.H:77
Definition: FFlFEElementTopSpec.H:24
void addEdge(int i1, int i2)
Definition: FFlFEElementTopSpec.H:25
std::vector< EdgeType > myEdges
Definition: FFlFEElementTopSpec.H:26