gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
HierarchicalBasisH1.cpp
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 #include "HierarchicalBasisH1.h"
10 
12  double const &u, double const &v, double const &w,
13  const std::vector<double> &faceFunctions,
14  std::vector<double> &quadFaceFunctionsAllOrientations,
15  std::vector<double> &triFaceFunctionsAllOrientations)
16 {
17  int it = 0;
18  // quadrilateral faces
19  if(_nQuadFaceFunction > 0) {
20  for(int iOrientation = 0; iOrientation < 8; iOrientation++) {
21  int flag1 = 1;
22  int flag2 = 1;
23  int flag3 = 1;
24  std::vector<double> orientedFaceFunction(_nQuadFaceFunction +
26  for(int r = 0; r < _nQuadFaceFunction + _nTriFaceFunction; r++) {
27  orientedFaceFunction[r] = faceFunctions[r];
28  }
29  switch(iOrientation) {
30  case(0): // case 111
31  flag1 = 1, flag2 = 1, flag3 = 1;
32  break;
33  case(1): // case -111
34  flag1 = -1, flag2 = 1, flag3 = 1;
35  break;
36  case(2): // case 1-11
37  flag1 = 1, flag2 = -1, flag3 = 1;
38  break;
39  case(3): // case -1-11
40  flag1 = -1, flag2 = -1, flag3 = 1;
41  break;
42  case(4): // case 11-1
43  flag1 = 1, flag2 = 1, flag3 = -1;
44  break;
45  case(5): // case -11-1
46  flag1 = -1, flag2 = 1, flag3 = -1;
47  break;
48  case(6): // case 1-1-1
49  flag1 = 1, flag2 = -1, flag3 = -1;
50  break;
51  case(7): // case -1-1-1
52  flag1 = -1, flag2 = -1, flag3 = -1;
53  break;
54  }
55  for(int iFace = 0; iFace < _nfaceQuad; iFace++) {
56  orientOneFace(u, v, w, flag1, flag2, flag3, iFace,
57  orientedFaceFunction);
58  }
59  for(int r = 0; r < _nQuadFaceFunction; r++) {
60  quadFaceFunctionsAllOrientations[it] = orientedFaceFunction[r];
61  it++;
62  }
63  }
64  }
65  // Triangular faces
66  it = 0;
67  if(_nTriFaceFunction > 0) {
68  for(int iOrientation = 0; iOrientation < 6; iOrientation++) {
69  std::vector<double> orientedFaceFunction(_nQuadFaceFunction +
71  for(int r = 0; r < _nQuadFaceFunction + _nTriFaceFunction; r++) {
72  orientedFaceFunction[r] = faceFunctions[r];
73  }
74  int flag1 = 0;
75  int flag2 = 1;
76  int flag3 = 1;
77  switch(iOrientation) {
78  case(0): // case 01
79  flag1 = 0, flag2 = 1;
80  break;
81  case(1): // case 11
82  flag1 = 1, flag2 = 1;
83  break;
84  case(2): // case 21
85  flag1 = 2, flag2 = 1;
86  break;
87  case(3): // case 0-1
88  flag1 = 0, flag2 = -1;
89  break;
90  case(4): // case 1-1
91  flag1 = 1, flag2 = -1;
92  break;
93  case(5): // case 2-1
94  flag1 = 2, flag2 = -1;
95  break;
96  }
97  for(int iFace = _nfaceQuad; iFace < _nfaceQuad + _nfaceTri; iFace++) {
98  orientOneFace(u, v, w, flag1, flag2, flag3, iFace,
99  orientedFaceFunction);
100  }
101  for(int r = 0; r < _nTriFaceFunction; r++) {
102  triFaceFunctionsAllOrientations[it] =
103  orientedFaceFunction[r + _nQuadFaceFunction];
104  it++;
105  }
106  }
107  }
108 }
110  double const &u, double const &v, double const &w,
111  const std::vector<std::vector<double> > &faceFunctions,
112  std::vector<std::vector<double> > &quadFaceFunctionsAllOrientations,
113  std::vector<std::vector<double> > &triFaceFunctionsAllOrientations,
114  std::string typeFunction)
115 {
116  int it = 0;
117  // quadrilateral faces
118  if(_nQuadFaceFunction > 0) {
119  for(int iOrientation = 0; iOrientation < 8; iOrientation++) {
120  int flag1 = 1;
121  int flag2 = 1;
122  int flag3 = 1;
123  std::vector<std::vector<double> > orientedFaceFunction(
124  _nQuadFaceFunction + _nTriFaceFunction, std::vector<double>(3, 0));
125  for(int r = 0; r < _nQuadFaceFunction + _nTriFaceFunction; r++) {
126  orientedFaceFunction[r][0] = faceFunctions[r][0];
127  orientedFaceFunction[r][1] = faceFunctions[r][1];
128  orientedFaceFunction[r][2] = faceFunctions[r][2];
129  }
130  switch(iOrientation) {
131  case(0): // case 111
132  flag1 = 1, flag2 = 1, flag3 = 1;
133  break;
134  case(1): // case -111
135  flag1 = -1, flag2 = 1, flag3 = 1;
136  break;
137  case(2): // case 1-11
138  flag1 = 1, flag2 = -1, flag3 = 1;
139  break;
140  case(3): // case -1-11
141  flag1 = -1, flag2 = -1, flag3 = 1;
142  break;
143  case(4): // case 11-1
144  flag1 = 1, flag2 = 1, flag3 = -1;
145  break;
146  case(5): // case -11-1
147  flag1 = -1, flag2 = 1, flag3 = -1;
148  break;
149  case(6): // case 1-1-1
150  flag1 = 1, flag2 = -1, flag3 = -1;
151  break;
152  case(7): // case -1-1-1
153  flag1 = -1, flag2 = -1, flag3 = -1;
154  break;
155  }
156  for(int iFace = 0; iFace < _nfaceQuad; iFace++) {
157  orientOneFace(u, v, w, flag1, flag2, flag3, iFace,
158  orientedFaceFunction);
159  }
160  for(int r = 0; r < _nQuadFaceFunction; r++) {
161  quadFaceFunctionsAllOrientations[it][0] = orientedFaceFunction[r][0];
162  quadFaceFunctionsAllOrientations[it][1] = orientedFaceFunction[r][1];
163  quadFaceFunctionsAllOrientations[it][2] = orientedFaceFunction[r][2];
164  it++;
165  }
166  }
167  }
168  // Triangular faces
169  it = 0;
170  if(_nTriFaceFunction > 0) {
171  for(int iOrientation = 0; iOrientation < 6; iOrientation++) {
172  std::vector<std::vector<double> > orientedFaceFunction(
173  _nQuadFaceFunction + _nTriFaceFunction, std::vector<double>(3, 0));
174  for(int r = 0; r < _nQuadFaceFunction + _nTriFaceFunction; r++) {
175  orientedFaceFunction[r] = faceFunctions[r];
176  }
177  int flag1 = 0;
178  int flag2 = 1;
179  int flag3 = 1;
180  switch(iOrientation) {
181  case(0): // case 01
182  flag1 = 0, flag2 = 1;
183  break;
184  case(1): // case 11
185  flag1 = 1, flag2 = 1;
186  break;
187  case(2): // case 21
188  flag1 = 2, flag2 = 1;
189  break;
190  case(3): // case 0-1
191  flag1 = 0, flag2 = -1;
192  break;
193  case(4): // case 1-1
194  flag1 = 1, flag2 = -1;
195  break;
196  case(5): // case 2-1
197  flag1 = 2, flag2 = -1;
198  break;
199  }
200  for(int iFace = _nfaceQuad; iFace < _nfaceQuad + _nfaceTri; iFace++) {
201  orientOneFace(u, v, w, flag1, flag2, flag3, iFace,
202  orientedFaceFunction);
203  }
204  for(int r = 0; r < _nTriFaceFunction; r++) {
205  triFaceFunctionsAllOrientations[it][0] =
206  orientedFaceFunction[r + _nQuadFaceFunction][0];
207  triFaceFunctionsAllOrientations[it][1] =
208  orientedFaceFunction[r + _nQuadFaceFunction][1];
209  triFaceFunctionsAllOrientations[it][2] =
210  orientedFaceFunction[r + _nQuadFaceFunction][2];
211  it++;
212  }
213  }
214  }
215 }
HierarchicalBasisH1::addAllOrientedFaceFunctions
virtual void addAllOrientedFaceFunctions(double const &u, double const &v, double const &w, const std::vector< double > &faceFunctions, std::vector< double > &quadFaceFunctionsAllOrientations, std::vector< double > &triFaceFunctionsAllOrientations)
Definition: HierarchicalBasisH1.cpp:11
HierarchicalBasis::_nTriFaceFunction
int _nTriFaceFunction
Definition: HierarchicalBasis.h:27
HierarchicalBasisH1::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< double > &faceFunctions)=0
HierarchicalBasisH1::~HierarchicalBasisH1
virtual ~HierarchicalBasisH1()=0
Definition: HierarchicalBasisH1.cpp:9
HierarchicalBasis::_nQuadFaceFunction
int _nQuadFaceFunction
Definition: HierarchicalBasis.h:26
HierarchicalBasis::_nfaceTri
int _nfaceTri
Definition: HierarchicalBasis.h:23
HierarchicalBasis::_nfaceQuad
int _nfaceQuad
Definition: HierarchicalBasis.h:22
HierarchicalBasisH1.h