OpenCMISS-Zinc C++ API Documentation
fieldmeshoperators.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 #ifndef CMZN_FIELDMESHOPERATORS_HPP__
10 #define CMZN_FIELDMESHOPERATORS_HPP__
11 
12 #include "opencmiss/zinc/fieldmeshoperators.h"
13 #include "opencmiss/zinc/field.hpp"
14 #include "opencmiss/zinc/fieldmodule.hpp"
15 #include "opencmiss/zinc/element.hpp"
16 
17 namespace OpenCMISS
18 {
19 namespace Zinc
20 {
21 
33 class FieldMeshIntegral : public Field
34 {
35 private:
36 
42  inline cmzn_field_mesh_integral_id getDerivedId()
43  {
44  return reinterpret_cast<cmzn_field_mesh_integral_id>(id);
45  }
46 
47 public:
48 
50  { }
51 
52  // takes ownership of C handle, responsibility for destroying it
53  explicit FieldMeshIntegral(cmzn_field_mesh_integral_id field_mesh_integral_id) :
54  Field(reinterpret_cast<cmzn_field_id>(field_mesh_integral_id))
55  { }
56 
70  int getNumbersOfPoints(int valuesCount, int *valuesOut)
71  {
72  return cmzn_field_mesh_integral_get_numbers_of_points(getDerivedId(),
73  valuesCount, valuesOut);
74  }
75 
103  int setNumbersOfPoints(int valuesCount, const int *valuesIn)
104  {
105  return cmzn_field_mesh_integral_set_numbers_of_points(getDerivedId(),
106  valuesCount, valuesIn);
107  }
108 
116  {
117  return static_cast<Element::QuadratureRule>(
118  cmzn_field_mesh_integral_get_element_quadrature_rule(getDerivedId()));
119  };
120 
132  {
133  return cmzn_field_mesh_integral_set_element_quadrature_rule(getDerivedId(),
134  static_cast<cmzn_element_quadrature_rule>(quadratureRule));
135  }
136 };
158 {
159 private:
160  // takes ownership of C handle, responsibility for destroying it
161  explicit FieldMeshIntegralSquares(cmzn_field_mesh_integral_id field_mesh_integral_id) :
162  FieldMeshIntegral(field_mesh_integral_id)
163  { }
164 
166  const Field& integrandField, const Field& coordinateField, const Mesh& mesh);
167 
168 public:
170  { }
171 };
172 
173 
175  const Field& integrandField, const Field& coordinateField, const Mesh& mesh)
176 {
177  return FieldMeshIntegral(reinterpret_cast<cmzn_field_mesh_integral_id>(
178  cmzn_fieldmodule_create_field_mesh_integral(id, integrandField.getId(),
179  coordinateField.getId(), mesh.getId())));
180 }
181 
183 {
184  return FieldMeshIntegral(cmzn_field_cast_mesh_integral(id));
185 }
186 
188  const Field& integrandField, const Field& coordinateField, const Mesh& mesh)
189 {
190  return FieldMeshIntegralSquares(reinterpret_cast<cmzn_field_mesh_integral_id>(
191  cmzn_fieldmodule_create_field_mesh_integral_squares(id, integrandField.getId(),
192  coordinateField.getId(), mesh.getId())));
193 }
194 
195 } // namespace Zinc
196 }
197 
198 #endif
int setNumbersOfPoints(int valuesCount, const int *valuesIn)
Definition: fieldmeshoperators.hpp:103
Base field type: an abstraction of a mathematical field.
Definition: field.hpp:51
Element::QuadratureRule getElementQuadratureRule()
Definition: fieldmeshoperators.hpp:115
A specialisation of the mesh integral field that integrates the squares of the components of the inte...
Definition: fieldmeshoperators.hpp:157
QuadratureRule
Definition: element.hpp:187
A field calculating the integral over a mesh.
Definition: fieldmeshoperators.hpp:33
cmzn_field_id getId() const
Definition: field.hpp:103
FieldMeshIntegralSquares createFieldMeshIntegralSquares(const Field &integrandField, const Field &coordinateField, const Mesh &mesh)
Definition: fieldmeshoperators.hpp:187
cmzn_mesh_id getId() const
Definition: mesh.hpp:87
FieldMeshIntegral castMeshIntegral()
Definition: fieldmeshoperators.hpp:182
int getNumbersOfPoints(int valuesCount, int *valuesOut)
Definition: fieldmeshoperators.hpp:70
FieldMeshIntegral createFieldMeshIntegral(const Field &integrandField, const Field &coordinateField, const Mesh &mesh)
Definition: fieldmeshoperators.hpp:174
The OpenCMISS namespace.
Definition: context.hpp:20
A finite element mesh consisting of a set of elements of fixed dimension.
Definition: mesh.hpp:34
int setElementQuadratureRule(Element::QuadratureRule quadratureRule)
Definition: fieldmeshoperators.hpp:131