gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
FuncSpaceData.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 #include "FuncSpaceData.h"
7 #include "MElement.h"
8 
10  : _parentType(fsd._parentType), _spaceOrder(order),
11  _serendipity(fsd._serendipity), _nij(0), _nk(_spaceOrder),
12  _pyramidalSpace(fsd._pyramidalSpace)
13 {
14 }
15 
16 FuncSpaceData::FuncSpaceData(const FuncSpaceData &fsd, int nij, int nk)
17  : _parentType(fsd._parentType),
18  _spaceOrder(fsd._pyramidalSpace ? nij + nk : std::max(nij, nk)),
19  _serendipity(fsd._serendipity), _nij(nij), _nk(nk),
20  _pyramidalSpace(fsd._pyramidalSpace)
21 {
22 }
23 
25  : _parentType(el->getType()), _spaceOrder(el->getPolynomialOrder()),
26  _serendipity(el->getIsOnlySerendipity()), _nij(0), _nk(_spaceOrder),
27  _pyramidalSpace(el->getType() == TYPE_PYR)
28 {
29 }
30 
31 FuncSpaceData::FuncSpaceData(const MElement *el, int order, bool serendip)
32  : _parentType(el->getType()), _spaceOrder(order), _serendipity(serendip),
33  _nij(0), _nk(_spaceOrder), _pyramidalSpace(el->getType() == TYPE_PYR)
34 {
35 }
36 
37 FuncSpaceData::FuncSpaceData(const MElement *el, bool pyr, int nij, int nk,
38  bool serendip)
39  : _parentType(el->getType()), _spaceOrder(pyr ? nij + nk : std::max(nij, nk)),
40  _serendipity(serendip), _nij(nij), _nk(nk), _pyramidalSpace(pyr)
41 {
42  if(el->getType() != TYPE_PYR)
43  Msg::Error("Creation of pyramidal space data for a non-pyramid element !");
44 }
45 
47  : _parentType(ElementType::getParentType(tag)),
48  _spaceOrder(ElementType::getOrder(tag)),
49  _serendipity(ElementType::getSerendipity(tag) > 1), _nij(0),
50  _nk(_spaceOrder),
51  _pyramidalSpace(ElementType::getParentType(tag) == TYPE_PYR)
52 {
53 }
54 
55 FuncSpaceData::FuncSpaceData(int type, int order, bool serendip)
56  : _parentType(type), _spaceOrder(order), _serendipity(serendip), _nij(0),
57  _nk(_spaceOrder), _pyramidalSpace(type == TYPE_PYR)
58 {
59 }
60 
61 FuncSpaceData::FuncSpaceData(int type, bool pyr, int nij, int nk, bool serendip)
62  : _parentType(type), _spaceOrder(pyr ? nij + nk : std::max(nij, nk)),
63  _serendipity(serendip), _nij(nij), _nk(nk), _pyramidalSpace(pyr)
64 {
65  if(_parentType != TYPE_PYR)
66  Msg::Error("Creation of pyramidal space data for a non-pyramid element!");
67 }
68 
69 void FuncSpaceData::getOrderForBezier(int order[3], int exponentZ) const
70 {
71  if(_pyramidalSpace && exponentZ < 0) {
72  Msg::Error("getOrderForBezier needs third exponent for pyramidal space!");
73  order[0] = order[1] = order[2] = -1;
74  return;
75  }
76  if(getType() == TYPE_PYR) {
77  if(_pyramidalSpace) {
78  order[0] = order[1] = _nij + exponentZ;
79  order[2] = _nk;
80  }
81  else {
82  order[0] = order[1] = _nij;
83  order[2] = _nk;
84  }
85  }
86  else
87  order[0] = order[1] = order[2] = _spaceOrder;
88 }
89 
91 {
92  if(!_serendipity) return *this;
93 
94  if(_parentType == TYPE_PYR)
96  else
97  return FuncSpaceData(_parentType, _spaceOrder, false);
98 }
FuncSpaceData::_nij
int _nij
Definition: FuncSpaceData.h:26
FuncSpaceData::_spaceOrder
int _spaceOrder
Definition: FuncSpaceData.h:21
FuncSpaceData::_parentType
int _parentType
Definition: FuncSpaceData.h:21
Msg::Error
static void Error(const char *fmt,...)
Definition: GmshMessage.cpp:482
ElementType::getSerendipity
int getSerendipity(int type)
Definition: ElementType.cpp:598
FuncSpaceData::getForNonSerendipitySpace
FuncSpaceData getForNonSerendipitySpace() const
Definition: FuncSpaceData.cpp:90
getOrder
static int getOrder(GEntity *ge)
Definition: HighOrder.cpp:1341
FuncSpaceData::FuncSpaceData
FuncSpaceData()
Definition: FuncSpaceData.h:36
MElement::getType
virtual int getType() const =0
FuncSpaceData::_pyramidalSpace
bool _pyramidalSpace
Definition: FuncSpaceData.h:27
ElementType::getType
int getType(int parentType, int order, bool serendip=false)
Definition: ElementType.cpp:757
MElement
Definition: MElement.h:30
FuncSpaceData::getType
int getType() const
Definition: FuncSpaceData.h:65
TYPE_PYR
#define TYPE_PYR
Definition: GmshDefines.h:69
FuncSpaceData
Definition: FuncSpaceData.h:16
FuncSpaceData::_serendipity
bool _serendipity
Definition: FuncSpaceData.h:22
std
Definition: picojson.h:1135
FuncSpaceData.h
MElement.h
ElementType
Definition: ElementType.h:11
FuncSpaceData::getOrderForBezier
void getOrderForBezier(int[3], int exponentZ=-1) const
Definition: FuncSpaceData.cpp:69
FuncSpaceData::_nk
int _nk
Definition: FuncSpaceData.h:26
ElementType::getParentType
int getParentType(int type)
Definition: ElementType.cpp:10