OpenCMISS-Zinc C++ API Documentation
elementbasis.hpp
Go to the documentation of this file.
1 
4 /* OpenCMISS-Zinc Library
5 *
6 * This Source Code Form is subject to the terms of the Mozilla Public
7 * License, v. 2.0. If a copy of the MPL was not distributed with this
8 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
9 
10 #ifndef CMZN_ELEMENTBASIS_HPP__
11 #define CMZN_ELEMENTBASIS_HPP__
12 
13 #include "opencmiss/zinc/elementbasis.h"
14 
15 namespace OpenCMISS
16 {
17 namespace Zinc
18 {
19 
29 {
30 private:
31 
32  cmzn_elementbasis_id id;
33 
34 public:
35 
36  Elementbasis() : id(0)
37  { }
38 
39  // takes ownership of C handle, responsibility for destroying it
40  explicit Elementbasis(cmzn_elementbasis_id element_basis_id) :
41  id(element_basis_id)
42  { }
43 
44  Elementbasis(const Elementbasis& elementBasis) :
45  id(cmzn_elementbasis_access(elementBasis.id))
46  { }
47 
48  Elementbasis& operator=(const Elementbasis& elementBasis)
49  {
50  cmzn_elementbasis_id temp_id = cmzn_elementbasis_access(elementBasis.id);
51  if (0 != id)
52  {
53  cmzn_elementbasis_destroy(&id);
54  }
55  id = temp_id;
56  return *this;
57  }
58 
59  ~Elementbasis()
60  {
61  if (0 != id)
62  {
63  cmzn_elementbasis_destroy(&id);
64  }
65  }
66 
72  bool isValid() const
73  {
74  return (0 != id);
75  }
76 
83  {
84  FUNCTION_TYPE_INVALID = CMZN_ELEMENTBASIS_FUNCTION_TYPE_INVALID,
86  FUNCTION_TYPE_CONSTANT = CMZN_ELEMENTBASIS_FUNCTION_TYPE_CONSTANT,
88  FUNCTION_TYPE_LINEAR_LAGRANGE = CMZN_ELEMENTBASIS_FUNCTION_TYPE_LINEAR_LAGRANGE,
91  FUNCTION_TYPE_QUADRATIC_LAGRANGE = CMZN_ELEMENTBASIS_FUNCTION_TYPE_QUADRATIC_LAGRANGE,
94  FUNCTION_TYPE_CUBIC_LAGRANGE = CMZN_ELEMENTBASIS_FUNCTION_TYPE_CUBIC_LAGRANGE,
97  FUNCTION_TYPE_LINEAR_SIMPLEX = CMZN_ELEMENTBASIS_FUNCTION_TYPE_LINEAR_SIMPLEX,
104  FUNCTION_TYPE_QUADRATIC_SIMPLEX = CMZN_ELEMENTBASIS_FUNCTION_TYPE_QUADRATIC_SIMPLEX,
112  FUNCTION_TYPE_CUBIC_HERMITE = CMZN_ELEMENTBASIS_FUNCTION_TYPE_CUBIC_HERMITE
115  };
116 
122  cmzn_elementbasis_id getId() const
123  {
124  return id;
125  }
126 
133  {
134  return cmzn_elementbasis_get_dimension(id);
135  }
136 
145  enum FunctionType getFunctionType(int chartComponent)
146  {
147  return static_cast<FunctionType>(cmzn_elementbasis_get_function_type(id, chartComponent));
148  }
149 
158  int setFunctionType(int chartComponent, FunctionType functionType)
159  {
160  return cmzn_elementbasis_set_function_type(id, chartComponent,
161  static_cast<cmzn_elementbasis_function_type>(functionType));
162  }
163 
170  {
171  return cmzn_elementbasis_get_number_of_nodes(id);
172  }
173 
187  {
188  return cmzn_elementbasis_get_number_of_functions(id);
189  }
190 
199  int getNumberOfFunctionsPerNode(int nodeNumber)
200  {
201  return cmzn_elementbasis_get_number_of_functions_per_node(id, nodeNumber);
202  }
203 
204 };
205 
206 } // namespace Zinc
207 }
208 
209 #endif /* CMZN_ELEMENTBASIS_HPP__ */
A set of basis functions that can apply over an element of a given dimension.
Definition: elementbasis.hpp:28
int getDimension()
Definition: elementbasis.hpp:132
int getNumberOfFunctions()
Definition: elementbasis.hpp:186
int getNumberOfFunctionsPerNode(int nodeNumber)
Definition: elementbasis.hpp:199
FunctionType
Definition: elementbasis.hpp:82
enum FunctionType getFunctionType(int chartComponent)
Definition: elementbasis.hpp:145
cmzn_elementbasis_id getId() const
Definition: elementbasis.hpp:122
int getNumberOfNodes()
Definition: elementbasis.hpp:169
The OpenCMISS namespace.
Definition: context.hpp:20
bool isValid() const
Definition: elementbasis.hpp:72
int setFunctionType(int chartComponent, FunctionType functionType)
Definition: elementbasis.hpp:158