gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
HierarchicalBasisHcurlTetra.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 // Contributed by Ismail Badia.
7 
8 // Reference : "Higher-Order Finite Element Methods"; Pavel Solin, Karel
9 // Segeth, Ivo Dolezel, Chapman and Hall/CRC; Edition : Har/Cdr (2003).
10 
11 #ifndef HIERARCHICAL_BASIS_HCURL_TETRA_H
12 #define HIERARCHICAL_BASIS_HCURL_TETRA_H
13 
14 #include <stdexcept>
15 #include <math.h>
16 #include "HierarchicalBasisHcurl.h"
17 
18 /*
19  * MTetrahedron
20  *
21  * v
22  * .
23  * ,/
24  * /
25  * 2
26  * ,/|`\
27  * ,/ | `\
28  * ,/ '. `\
29  * ,/ | `\
30  * ,/ | `\
31  * 0-----------'.--------1 --> u
32  * `\. | ,/
33  * `\. | ,/
34  * `\. '. ,/
35  * `\. |/
36  * `3
37  * `\.
38  * ` w
39  *
40  *
41  * Oriented Edges:
42  * e0={0, 1}, e1={1, 2}, e2={2, 0}, e3={0, 3}, e4={2, 3}, e5={1, 3}
43  *
44  *
45  * Oritented Surface:
46  * s0={0, 1, 2}, s1={0, 1, 3}, s2={0, 2, 3}, s3={1, 2, 3}
47  * Local (directional) orders on mesh faces are not allowed to exceed the mini-
48  * mum of the (appropriate directional) orders of approximation associated with
49  * the interior of the adjacent elements. Local orders of approximation on mesh
50  * edges are limited by the minimum of all (appropriate directional) orders cor-
51  * responding to faces sharing that edge
52  */
54 public:
55  HierarchicalBasisHcurlTetra(int order);
57  virtual unsigned int getNumberOfOrientations() const;
58  virtual void generateBasis(double const &u, double const &v, double const &w,
59  std::vector<std::vector<double> > &vertexBasis,
60  std::vector<std::vector<double> > &edgeBasis,
61  std::vector<std::vector<double> > &faceBasis,
62  std::vector<std::vector<double> > &bubbleBasis,
63  std::string typeFunction)
64  {
65  if(typeFunction == "HcurlLegendre") {
66  generateHcurlBasis(u, v, w, edgeBasis, faceBasis, bubbleBasis);
67  }
68  else if("CurlHcurlLegendre" == typeFunction) {
69  generateCurlBasis(u, v, w, edgeBasis, faceBasis, bubbleBasis);
70  }
71  else {
72  throw std::runtime_error("unknown typeFunction");
73  }
74  }
75 
76  virtual void
77  orientEdge(int const &flagOrientation, int const &edgeNumber,
78  std::vector<std::vector<double> > &edgeBasis,
79  const std::vector<std::vector<double> > &eTablePositiveFlag,
80  const std::vector<std::vector<double> > &eTableNegativeFlag);
82  std::vector<std::vector<double> > &edgeFunctions);
83  virtual void orientFace(
84  int const &flag1, int const &flag2, int const &flag3, int const &faceNumber,
85  const std::vector<std::vector<double> > &quadFaceFunctionsAllOrientation,
86  const std::vector<std::vector<double> > &triFaceFunctionsAllOrientation,
87  std::vector<std::vector<double> > &fTableCopy);
88  virtual void getKeysInfo(std::vector<int> &functionTypeInfo,
89  std::vector<int> &orderInfo);
90 
91 private:
92  int _pb; // bubble function order
93  int _pOrderEdge[6]; // Edge functions order (pOrderEdge[0] matches the order
94  // of the edge 0)
95  int _pOrderFace[4]; // Face functions order in direction
96  static double
97  _affineCoordinate(const int &j, const double &u, const double &v,
98  const double &w); // affine coordinate lambdaj j=1..4
99 
100  virtual void
101  generateHcurlBasis(double const &u, double const &v, double const &w,
102  std::vector<std::vector<double> > &edgeBasis,
103  std::vector<std::vector<double> > &faceBasis,
104  std::vector<std::vector<double> > &bubbleBasis);
105 
106  virtual void
107  generateCurlBasis(double const &u, double const &v, double const &w,
108  std::vector<std::vector<double> > &edgeBasis,
109  std::vector<std::vector<double> > &faceBasis,
110  std::vector<std::vector<double> > &bubbleBasis);
111 
112  static double dotProduct(const std::vector<double> &u,
113  const std::vector<double> &v);
114  inline void gradient(const double &lambda1, const double &lambda2,
115  const std::vector<double> &dlambda1,
116  const std::vector<double> &dlambda2,
117  std::vector<double> &result); // grad(u)v+grad(v)u
118  inline void curlFunction(const double &a, const std::vector<double> &nD,
119  const std::vector<double> &grad,
120  std::vector<double> &result);
121  virtual void orientOneFace(double const &u, double const &v, double const &w,
122  int const &flag1, int const &flag2,
123  int const &flag3, int const &faceNumber,
124  std::vector<std::vector<double> > &faceFunctions,
125  std::string typeFunction);
126 };
127 
128 #endif
HierarchicalBasisHcurl
Definition: HierarchicalBasisHcurl.h:16
HierarchicalBasisHcurlTetra::orientOneFace
virtual void orientOneFace(double const &u, double const &v, double const &w, int const &flag1, int const &flag2, int const &flag3, int const &faceNumber, std::vector< std::vector< double > > &faceFunctions, std::string typeFunction)
Definition: HierarchicalBasisHcurlTetra.cpp:494
HierarchicalBasisHcurlTetra::_pOrderFace
int _pOrderFace[4]
Definition: HierarchicalBasisHcurlTetra.h:95
HierarchicalBasisHcurlTetra::_affineCoordinate
static double _affineCoordinate(const int &j, const double &u, const double &v, const double &w)
Definition: HierarchicalBasisHcurlTetra.cpp:44
HierarchicalBasisHcurlTetra::_pb
int _pb
Definition: HierarchicalBasisHcurlTetra.h:92
HierarchicalBasisHcurlTetra::HierarchicalBasisHcurlTetra
HierarchicalBasisHcurlTetra(int order)
Definition: HierarchicalBasisHcurlTetra.cpp:14
HierarchicalBasisHcurlTetra::generateBasis
virtual void generateBasis(double const &u, double const &v, double const &w, std::vector< std::vector< double > > &vertexBasis, std::vector< std::vector< double > > &edgeBasis, std::vector< std::vector< double > > &faceBasis, std::vector< std::vector< double > > &bubbleBasis, std::string typeFunction)
Definition: HierarchicalBasisHcurlTetra.h:58
HierarchicalBasisHcurlTetra::generateHcurlBasis
virtual void generateHcurlBasis(double const &u, double const &v, double const &w, std::vector< std::vector< double > > &edgeBasis, std::vector< std::vector< double > > &faceBasis, std::vector< std::vector< double > > &bubbleBasis)
Definition: HierarchicalBasisHcurlTetra.cpp:64
HierarchicalBasisHcurlTetra
Definition: HierarchicalBasisHcurlTetra.h:53
HierarchicalBasisHcurlTetra::orientEdgeFunctionsForNegativeFlag
virtual void orientEdgeFunctionsForNegativeFlag(std::vector< std::vector< double > > &edgeFunctions)
Definition: HierarchicalBasisHcurlTetra.cpp:474
HierarchicalBasisHcurlTetra::dotProduct
static double dotProduct(const std::vector< double > &u, const std::vector< double > &v)
Definition: HierarchicalBasisHcurlTetra.cpp:58
HierarchicalBasisHcurlTetra::getKeysInfo
virtual void getKeysInfo(std::vector< int > &functionTypeInfo, std::vector< int > &orderInfo)
Definition: HierarchicalBasisHcurlTetra.cpp:1562
HierarchicalBasisHcurlTetra::orientEdge
virtual void orientEdge(int const &flagOrientation, int const &edgeNumber, std::vector< std::vector< double > > &edgeBasis, const std::vector< std::vector< double > > &eTablePositiveFlag, const std::vector< std::vector< double > > &eTableNegativeFlag)
Definition: HierarchicalBasisHcurlTetra.cpp:443
HierarchicalBasisHcurlTetra::gradient
void gradient(const double &lambda1, const double &lambda2, const std::vector< double > &dlambda1, const std::vector< double > &dlambda2, std::vector< double > &result)
Definition: HierarchicalBasisHcurlTetra.cpp:958
HierarchicalBasisHcurlTetra::generateCurlBasis
virtual void generateCurlBasis(double const &u, double const &v, double const &w, std::vector< std::vector< double > > &edgeBasis, std::vector< std::vector< double > > &faceBasis, std::vector< std::vector< double > > &bubbleBasis)
Definition: HierarchicalBasisHcurlTetra.cpp:968
HierarchicalBasisHcurlTetra::getNumberOfOrientations
virtual unsigned int getNumberOfOrientations() const
Definition: HierarchicalBasisHcurlTetra.cpp:39
HierarchicalBasisHcurlTetra::_pOrderEdge
int _pOrderEdge[6]
Definition: HierarchicalBasisHcurlTetra.h:93
HierarchicalBasisHcurlTetra::orientFace
virtual void orientFace(int const &flag1, int const &flag2, int const &flag3, int const &faceNumber, const std::vector< std::vector< double > > &quadFaceFunctionsAllOrientation, const std::vector< std::vector< double > > &triFaceFunctionsAllOrientation, std::vector< std::vector< double > > &fTableCopy)
Definition: HierarchicalBasisHcurlTetra.cpp:926
HierarchicalBasisHcurlTetra::~HierarchicalBasisHcurlTetra
virtual ~HierarchicalBasisHcurlTetra()
Definition: HierarchicalBasisHcurlTetra.cpp:37
HierarchicalBasisHcurlTetra::curlFunction
void curlFunction(const double &a, const std::vector< double > &nD, const std::vector< double > &grad, std::vector< double > &result)
Definition: HierarchicalBasisHcurlTetra.cpp:950
HierarchicalBasisHcurl.h