1 // Gmsh - Copyright (C) 1997-2021 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 "HierarchicalBasisHcurl.h"
~HierarchicalBasisHcurl()9 HierarchicalBasisHcurl::~HierarchicalBasisHcurl() {}
addAllOrientedFaceFunctions(double const & u,double const & v,double const & w,const std::vector<std::vector<double>> & faceFunctions,std::vector<std::vector<double>> & quadFaceFunctionsAllOrientation,std::vector<std::vector<double>> & triFaceFunctionsAllOrientation,std::string typeFunction)10 void HierarchicalBasisHcurl::addAllOrientedFaceFunctions(
11 double const &u, double const &v, double const &w,
12 const std::vector<std::vector<double> > &faceFunctions,
13 std::vector<std::vector<double> > &quadFaceFunctionsAllOrientation,
14 std::vector<std::vector<double> > &triFaceFunctionsAllOrientation,
15 std::string typeFunction)
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<std::vector<double> > orientedFaceFunction(
25 _nQuadFaceFunction + _nTriFaceFunction, std::vector<double>(3, 0));
26 for(int r = 0; r < _nQuadFaceFunction + _nTriFaceFunction; r++) {
27 orientedFaceFunction[r][0] = faceFunctions[r][0];
28 orientedFaceFunction[r][1] = faceFunctions[r][1];
29 orientedFaceFunction[r][2] = faceFunctions[r][2];
30 }
31 switch(iOrientation) {
32 case(0): // case 111
33 flag1 = 1, flag2 = 1, flag3 = 1;
34 break;
35 case(1): // case -111
36 flag1 = -1, flag2 = 1, flag3 = 1;
37 break;
38 case(2): // case 1-11
39 flag1 = 1, flag2 = -1, flag3 = 1;
40 break;
41 case(3): // case -1-11
42 flag1 = -1, flag2 = -1, flag3 = 1;
43 break;
44 case(4): // case 11-1
45 flag1 = 1, flag2 = 1, flag3 = -1;
46 break;
47 case(5): // case -11-1
48 flag1 = -1, flag2 = 1, flag3 = -1;
49 break;
50 case(6): // case 1-1-1
51 flag1 = 1, flag2 = -1, flag3 = -1;
52 break;
53 case(7): // case -1-1-1
54 flag1 = -1, flag2 = -1, flag3 = -1;
55 break;
56 }
57 for(int iFace = 0; iFace < _nfaceQuad; iFace++) {
58 orientOneFace(u, v, w, flag1, flag2, flag3, iFace, orientedFaceFunction,
59 typeFunction);
60 }
61 for(int r = 0; r < _nQuadFaceFunction; r++) {
62 quadFaceFunctionsAllOrientation[it][0] = orientedFaceFunction[r][0];
63 quadFaceFunctionsAllOrientation[it][1] = orientedFaceFunction[r][1];
64 quadFaceFunctionsAllOrientation[it][2] = orientedFaceFunction[r][2];
65 it++;
66 }
67 }
68 }
69 // Triangular faces
70 it = 0;
71 if(_nTriFaceFunction > 0) {
72 for(int iOrientation = 0; iOrientation < 6; iOrientation++) {
73 std::vector<std::vector<double> > orientedFaceFunction(
74 _nQuadFaceFunction + _nTriFaceFunction, std::vector<double>(3, 0));
75 for(int r = 0; r < _nQuadFaceFunction + _nTriFaceFunction; r++) {
76 orientedFaceFunction[r] = faceFunctions[r];
77 }
78 int flag1 = 0;
79 int flag2 = 1;
80 int flag3 = 1;
81 switch(iOrientation) {
82 case(0): // case 01
83 flag1 = 0, flag2 = 1;
84 break;
85 case(1): // case 11
86 flag1 = 1, flag2 = 1;
87 break;
88 case(2): // case 21
89 flag1 = 2, flag2 = 1;
90 break;
91 case(3): // case 0-1
92 flag1 = 0, flag2 = -1;
93 break;
94 case(4): // case 1-1
95 flag1 = 1, flag2 = -1;
96 break;
97 case(5): // case 2-1
98 flag1 = 2, flag2 = -1;
99 break;
100 }
101 for(int iFace = _nfaceQuad; iFace < _nfaceQuad + _nfaceTri; iFace++) {
102 orientOneFace(u, v, w, flag1, flag2, flag3, iFace, orientedFaceFunction,
103 typeFunction);
104 }
105 for(int r = 0; r < _nTriFaceFunction; r++) {
106 triFaceFunctionsAllOrientation[it][0] =
107 orientedFaceFunction[r + _nQuadFaceFunction][0];
108 triFaceFunctionsAllOrientation[it][1] =
109 orientedFaceFunction[r + _nQuadFaceFunction][1];
110 triFaceFunctionsAllOrientation[it][2] =
111 orientedFaceFunction[r + _nQuadFaceFunction][2];
112 it++;
113 }
114 }
115 }
116 }
117