gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
nodalBasis.h
Go to the documentation of this file.
1 // Gmsh - Copyright (C) 1997-2022 C. Geuzaine, J.-F. Remacle
2 //
3 // See the LICENSE.txt file in the Gmsh root directory for license information.
4 // Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
5 
6 #ifndef NODALBASIS_H
7 #define NODALBASIS_H
8 
9 #include "fullMatrix.h"
10 #include "GmshDefines.h"
11 
12 class nodalBasis {
13 public:
15  bool serendip;
17 
19  nodalBasis(int tag);
20  virtual ~nodalBasis() {}
21  virtual int getNumShapeFunctions() const = 0;
22  int getNumBubbleShapeFunctions() const;
23  void getReferenceNodes(fullMatrix<double> &nodes) const { nodes = points; }
24  const fullMatrix<double> &getReferenceNodes() const { return points; }
25 
26  // compute the matrix that projects the provided points on the current control
27  // points
28  bool forwardTransformation(const fullMatrix<double> &otherPoints,
30  int elementType = -1) const;
31 
32  // compute the renumbering vector to map the provided points on the current
33  // control points
34  bool forwardRenumbering(const fullMatrix<double> &otherPoints, int *renum,
35  int elemenType = -1) const;
36 
37  // Basis functions & gradients evaluation
38  virtual void f(double u, double v, double w, double *sf) const = 0;
39  virtual void f(const fullMatrix<double> &coord,
40  fullMatrix<double> &sf) const = 0;
41  virtual void f(double u, double v, double w, int i, double *sf) const = 0;
42  virtual void df(double u, double v, double w, double grads[][3]) const = 0;
43  virtual void df(const fullMatrix<double> &coord,
44  fullMatrix<double> &dfm) const = 0;
45  virtual void df(double u, double v, double w, int i,
46  double grad[3]) const = 0;
47  virtual void ddf(double u, double v, double w, double grads[][3][3]) const
48  {
49  Msg::Error("ddf not implemented for this basis");
50  }
51  virtual void dddf(double u, double v, double w, double grads[][3][3][3]) const
52  {
53  Msg::Error("dddf not implemented for this basis");
54  }
55 
56  // closures is the list of the nodes of each face, in the order of the
57  // polynomialBasis of the face; fullClosures is mapping of the nodes of the
58  // element that rotates the element so that the considered face becomes the
59  // first one in the right orientation; For element, like prisms that have
60  // different kind of faces, fullCLosure[i] rotates the element so that the
61  // considered face becomes the closureRef[i]-th face (the first triangle or
62  // the first quad face)
63  class closure : public std::vector<int> {
64  public:
65  int type;
66  };
67  typedef std::vector<closure> clCont;
69  std::vector<int> closureRef;
70 
71  // for a given face/edge, with both a sign and a rotation, give an ordered
72  // list of nodes on this face/edge
73  virtual int getClosureType(int id) const { return closures[id].type; }
74  virtual const std::vector<int> &getClosure(int id) const
75  {
76  return closures[id];
77  }
78  virtual const std::vector<int> &getFullClosure(int id) const
79  {
80  return fullClosures[id];
81  }
82  inline int getClosureId(int iFace, int iSign = 1, int iRot = 0) const;
83  inline void breakClosureId(int i, int &iFace, int &iSign, int &iRot) const;
84 };
85 
86 inline int nodalBasis::getClosureId(int iFace, int iSign, int iRot) const
87 {
88  return iFace + numFaces * (iSign == 1 ? 0 : 1) + 2 * numFaces * iRot;
89 }
90 
91 inline void nodalBasis::breakClosureId(int i, int &iFace, int &iSign,
92  int &iRot) const
93 {
94  iFace = i % numFaces;
95  i = (i - iFace) / numFaces;
96  iSign = i % 2;
97  iRot = (i - iSign) / 2;
98 }
99 
100 #endif
nodalBasis::forwardRenumbering
bool forwardRenumbering(const fullMatrix< double > &otherPoints, int *renum, int elemenType=-1) const
Definition: nodalBasis.cpp:928
nodalBasis::clCont
std::vector< closure > clCont
Definition: nodalBasis.h:67
nodalBasis::breakClosureId
void breakClosureId(int i, int &iFace, int &iSign, int &iRot) const
Definition: nodalBasis.h:91
nodalBasis::f
virtual void f(const fullMatrix< double > &coord, fullMatrix< double > &sf) const =0
nodalBasis::closureRef
std::vector< int > closureRef
Definition: nodalBasis.h:69
nodalBasis::points
fullMatrix< double > points
Definition: nodalBasis.h:16
nodalBasis::df
virtual void df(double u, double v, double w, double grads[][3]) const =0
nodalBasis::df
virtual void df(double u, double v, double w, int i, double grad[3]) const =0
Msg::Error
static void Error(const char *fmt,...)
Definition: GmshMessage.cpp:482
nodalBasis::numFaces
int numFaces
Definition: nodalBasis.h:14
projection
static double projection(SPoint3 &p1, SPoint3 &p2, SPoint3 &q, SPoint3 &result)
Definition: hausdorffDistance.cpp:29
nodalBasis::parentType
int parentType
Definition: nodalBasis.h:14
nodalBasis::forwardTransformation
bool forwardTransformation(const fullMatrix< double > &otherPoints, fullMatrix< double > &projection, int elementType=-1) const
Definition: nodalBasis.cpp:910
nodalBasis::getReferenceNodes
void getReferenceNodes(fullMatrix< double > &nodes) const
Definition: nodalBasis.h:23
nodalBasis::closure::type
int type
Definition: nodalBasis.h:65
nodalBasis::type
int type
Definition: nodalBasis.h:14
nodalBasis::ddf
virtual void ddf(double u, double v, double w, double grads[][3][3]) const
Definition: nodalBasis.h:47
nodalBasis::serendip
bool serendip
Definition: nodalBasis.h:15
nodalBasis::~nodalBasis
virtual ~nodalBasis()
Definition: nodalBasis.h:20
fullMatrix< double >
nodalBasis::dddf
virtual void dddf(double u, double v, double w, double grads[][3][3][3]) const
Definition: nodalBasis.h:51
nodalBasis::getClosureId
int getClosureId(int iFace, int iSign=1, int iRot=0) const
Definition: nodalBasis.h:86
nodalBasis::getClosure
virtual const std::vector< int > & getClosure(int id) const
Definition: nodalBasis.h:74
nodalBasis::order
int order
Definition: nodalBasis.h:14
nodalBasis::f
virtual void f(double u, double v, double w, double *sf) const =0
nodalBasis::getNumBubbleShapeFunctions
int getNumBubbleShapeFunctions() const
Definition: nodalBasis.cpp:863
GmshDefines.h
nodalBasis::getClosureType
virtual int getClosureType(int id) const
Definition: nodalBasis.h:73
nodalBasis::nodalBasis
nodalBasis()
Definition: nodalBasis.h:18
nodalBasis::closure
Definition: nodalBasis.h:63
nodalBasis::dimension
int dimension
Definition: nodalBasis.h:14
nodalBasis
Definition: nodalBasis.h:12
nodalBasis::closures
clCont closures
Definition: nodalBasis.h:68
nodalBasis::df
virtual void df(const fullMatrix< double > &coord, fullMatrix< double > &dfm) const =0
nodalBasis::fullClosures
clCont fullClosures
Definition: nodalBasis.h:68
nodalBasis::getReferenceNodes
const fullMatrix< double > & getReferenceNodes() const
Definition: nodalBasis.h:24
nodalBasis::f
virtual void f(double u, double v, double w, int i, double *sf) const =0
nodalBasis::getFullClosure
virtual const std::vector< int > & getFullClosure(int id) const
Definition: nodalBasis.h:78
fullMatrix.h
nodalBasis::getNumShapeFunctions
virtual int getNumShapeFunctions() const =0