File: FuncSpaceData.cpp

package info (click to toggle)
gmsh 4.8.4%2Bds2-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 87,812 kB
  • sloc: cpp: 378,014; ansic: 99,669; yacc: 7,216; python: 6,680; java: 3,486; lisp: 659; lex: 621; perl: 571; makefile: 470; sh: 440; xml: 415; javascript: 113; pascal: 35; modula3: 32
file content (98 lines) | stat: -rw-r--r-- 3,232 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// Gmsh - Copyright (C) 1997-2012 C. Geuzaine, J.-B-> Remacle
//
// See the LICENSE.txt file for license information. Please report all
// issues on https://gitlab.onelab.info/gmsh/gmsh/issues.

#include "FuncSpaceData.h"
#include "MElement.h"

FuncSpaceData::FuncSpaceData(const FuncSpaceData &fsd, int order)
  : _parentType(fsd._parentType), _spaceOrder(order),
    _serendipity(fsd._serendipity), _nij(0), _nk(_spaceOrder),
    _pyramidalSpace(fsd._pyramidalSpace)
{
}

FuncSpaceData::FuncSpaceData(const FuncSpaceData &fsd, int nij, int nk)
  : _parentType(fsd._parentType),
    _spaceOrder(fsd._pyramidalSpace ? nij + nk : std::max(nij, nk)),
    _serendipity(fsd._serendipity), _nij(nij), _nk(nk),
    _pyramidalSpace(fsd._pyramidalSpace)
{
}

FuncSpaceData::FuncSpaceData(const MElement *el)
  : _parentType(el->getType()), _spaceOrder(el->getPolynomialOrder()),
    _serendipity(el->getIsOnlySerendipity()), _nij(0), _nk(_spaceOrder),
    _pyramidalSpace(el->getType() == TYPE_PYR)
{
}

FuncSpaceData::FuncSpaceData(const MElement *el, int order, bool serendip)
  : _parentType(el->getType()), _spaceOrder(order), _serendipity(serendip),
    _nij(0), _nk(_spaceOrder), _pyramidalSpace(el->getType() == TYPE_PYR)
{
}

FuncSpaceData::FuncSpaceData(const MElement *el, bool pyr, int nij, int nk,
                             bool serendip)
  : _parentType(el->getType()), _spaceOrder(pyr ? nij + nk : std::max(nij, nk)),
    _serendipity(serendip), _nij(nij), _nk(nk), _pyramidalSpace(pyr)
{
  if(el->getType() != TYPE_PYR)
    Msg::Error("Creation of pyramidal space data for a non-pyramid element !");
}

FuncSpaceData::FuncSpaceData(int tag)
  : _parentType(ElementType::getParentType(tag)),
    _spaceOrder(ElementType::getOrder(tag)),
    _serendipity(ElementType::getSerendipity(tag) > 1), _nij(0),
    _nk(_spaceOrder),
    _pyramidalSpace(ElementType::getParentType(tag) == TYPE_PYR)
{
}

FuncSpaceData::FuncSpaceData(int type, int order, bool serendip)
  : _parentType(type), _spaceOrder(order), _serendipity(serendip), _nij(0),
    _nk(_spaceOrder), _pyramidalSpace(type == TYPE_PYR)
{
}

FuncSpaceData::FuncSpaceData(int type, bool pyr, int nij, int nk, bool serendip)
  : _parentType(type), _spaceOrder(pyr ? nij + nk : std::max(nij, nk)),
    _serendipity(serendip), _nij(nij), _nk(nk), _pyramidalSpace(pyr)
{
  if(_parentType != TYPE_PYR)
    Msg::Error("Creation of pyramidal space data for a non-pyramid element!");
}

void FuncSpaceData::getOrderForBezier(int order[3], int exponentZ) const
{
  if(_pyramidalSpace && exponentZ < 0) {
    Msg::Error("getOrderForBezier needs third exponent for pyramidal space!");
    order[0] = order[1] = order[2] = -1;
    return;
  }
  if(getType() == TYPE_PYR) {
    if(_pyramidalSpace) {
      order[0] = order[1] = _nij + exponentZ;
      order[2] = _nk;
    }
    else {
      order[0] = order[1] = _nij;
      order[2] = _nk;
    }
  }
  else
    order[0] = order[1] = order[2] = _spaceOrder;
}

FuncSpaceData FuncSpaceData::getForNonSerendipitySpace() const
{
  if(!_serendipity) return *this;

  if(_parentType == TYPE_PYR)
    return FuncSpaceData(_parentType, _pyramidalSpace, _nij, _nk, false);
  else
    return FuncSpaceData(_parentType, _spaceOrder, false);
}