gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
FuncSpaceData.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 FUNCSPACEDATA_H
7 #define FUNCSPACEDATA_H
8 
9 #include <cstddef>
10 #include "GmshDefines.h"
11 #include "GmshMessage.h"
12 #include "ElementType.h"
13 
14 class MElement;
15 
17  // Store data that allows to easily know how to construct gradient, jacobian,
18  // bezier and metric bases.
19 
20 private:
23  // For pyramids, '_spaceOrder' is not used.
24 
25  // Pyramids:
26  int _nij, _nk;
28  // There are two possible spaces in function of '_pyramidalSpace'.
29  // if '_pyramidalSpace' == true, the space is a pyramid-like space:
30  // {X^i Y^j Z^k | i,j <= k+'_nij', k <= '_nk'},
31  // otherwise, the space is a hex-like space:
32  // {X^i Y^j Z^k | i,j <= '_nij', k <= '_nk'},
33  // where X = xi/(1-zeta), Y = eta/(1-zeta) and Z = (1-zeta).
34 
35 public:
37  : _parentType(-1), _spaceOrder(-1), _serendipity(false), _nij(-1), _nk(-1),
38  _pyramidalSpace(false)
39  {
40  }
41 
42  // Constructors for the function space of a different order
43  FuncSpaceData(const FuncSpaceData &fsd, int order);
44  FuncSpaceData(const FuncSpaceData &fsd, int nij, int nk);
45 
46  // Constructors using MElement*
47  FuncSpaceData(const MElement *el);
48  FuncSpaceData(const MElement *el, int order, bool serendip);
49  FuncSpaceData(const MElement *el, bool pyr, int nij, int nk, bool serendip);
50 
51  // Constructor using element type or (parentType, order, serendip)
52  FuncSpaceData(int tag);
53  FuncSpaceData(int type, int order, bool serendip);
54  FuncSpaceData(int type, bool pyr, int nij, int nk, bool serendip);
55 
56  // Print
57  void print() const
58  {
59  Msg::Info("FuncSpaceData: type%d, order%d, nij%d, nk%d, pyr%d, serendip%d",
61  _serendipity);
62  }
63 
64  // Get methods
65  int getType() const { return _parentType; }
66  int getDimension() const
67  {
68  switch(_parentType) {
69  case TYPE_PNT: return 0;
70  case TYPE_LIN: return 1;
71  case TYPE_TRI:
72  case TYPE_QUA: return 2;
73  case TYPE_TET:
74  case TYPE_PRI:
75  case TYPE_HEX:
76  case TYPE_PYR: return 3;
77  default: return -1;
78  }
79  }
80  int getSpaceOrder() const { return _spaceOrder; }
81  int getNij() const { return _nij; }
82  int getNk() const { return _nk; }
83  bool getSerendipity() const { return _serendipity; }
84  bool getPyramidalSpace() const { return _pyramidalSpace; }
85 
86  void getOrderForBezier(int[3], int exponentZ = -1) const;
87 
88  // Change space
90 
91  //
92  inline bool operator<(const FuncSpaceData &other) const
93  {
94  if(_parentType == other._parentType) {
95  if(_spaceOrder == other._spaceOrder) {
96  if(_nij == other._nij) {
97  if(_nk == other._nk) {
98  return _pyramidalSpace ? false : other._pyramidalSpace;
99  }
100  else
101  return _nk < other._nk;
102  }
103  else
104  return _nij < other._nij;
105  }
106  else
107  return _spaceOrder < other._spaceOrder;
108  }
109  else
110  return _parentType < other._parentType;
111  }
112  inline bool operator==(const FuncSpaceData &other) const
113  {
114  return _parentType == other._parentType &&
115  _spaceOrder == other._spaceOrder && _nij == other._nij &&
116  _nk == other._nk && _pyramidalSpace == other._pyramidalSpace;
117  }
118 };
119 
120 #endif
FuncSpaceData::_nij
int _nij
Definition: FuncSpaceData.h:26
TYPE_LIN
#define TYPE_LIN
Definition: GmshDefines.h:65
Msg::Info
static void Info(const char *fmt,...)
Definition: GmshMessage.cpp:587
FuncSpaceData::_spaceOrder
int _spaceOrder
Definition: FuncSpaceData.h:21
FuncSpaceData::_parentType
int _parentType
Definition: FuncSpaceData.h:21
TYPE_PNT
#define TYPE_PNT
Definition: GmshDefines.h:64
TYPE_TRI
#define TYPE_TRI
Definition: GmshDefines.h:66
FuncSpaceData::getNij
int getNij() const
Definition: FuncSpaceData.h:81
FuncSpaceData::getForNonSerendipitySpace
FuncSpaceData getForNonSerendipitySpace() const
Definition: FuncSpaceData.cpp:90
GmshMessage.h
TYPE_PRI
#define TYPE_PRI
Definition: GmshDefines.h:70
FuncSpaceData::getPyramidalSpace
bool getPyramidalSpace() const
Definition: FuncSpaceData.h:84
FuncSpaceData::FuncSpaceData
FuncSpaceData()
Definition: FuncSpaceData.h:36
FuncSpaceData::_pyramidalSpace
bool _pyramidalSpace
Definition: FuncSpaceData.h:27
GmshDefines.h
FuncSpaceData::getNk
int getNk() const
Definition: FuncSpaceData.h:82
MElement
Definition: MElement.h:30
FuncSpaceData::print
void print() const
Definition: FuncSpaceData.h:57
FuncSpaceData::getType
int getType() const
Definition: FuncSpaceData.h:65
FuncSpaceData::operator<
bool operator<(const FuncSpaceData &other) const
Definition: FuncSpaceData.h:92
TYPE_PYR
#define TYPE_PYR
Definition: GmshDefines.h:69
FuncSpaceData
Definition: FuncSpaceData.h:16
TYPE_QUA
#define TYPE_QUA
Definition: GmshDefines.h:67
FuncSpaceData::getSerendipity
bool getSerendipity() const
Definition: FuncSpaceData.h:83
FuncSpaceData::_serendipity
bool _serendipity
Definition: FuncSpaceData.h:22
FuncSpaceData::operator==
bool operator==(const FuncSpaceData &other) const
Definition: FuncSpaceData.h:112
TYPE_HEX
#define TYPE_HEX
Definition: GmshDefines.h:71
FuncSpaceData::getSpaceOrder
int getSpaceOrder() const
Definition: FuncSpaceData.h:80
TYPE_TET
#define TYPE_TET
Definition: GmshDefines.h:68
FuncSpaceData::getOrderForBezier
void getOrderForBezier(int[3], int exponentZ=-1) const
Definition: FuncSpaceData.cpp:69
FuncSpaceData::_nk
int _nk
Definition: FuncSpaceData.h:26
ElementType.h
FuncSpaceData::getDimension
int getDimension() const
Definition: FuncSpaceData.h:66