OpenCMISS-Zinc C++ API Documentation
 All Classes Namespaces Files Functions Typedefs Enumerations Enumerator Pages
fieldfiniteelement.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_FIELDTYPESFINITEELEMENT_HPP__
10 #define CMZN_FIELDTYPESFINITEELEMENT_HPP__
11 
12 #include "zinc/fieldfiniteelement.h"
13 #include "zinc/field.hpp"
14 #include "zinc/fieldmodule.hpp"
15 #include "zinc/element.hpp"
16 
17 namespace OpenCMISS
18 {
19 namespace Zinc
20 {
21 
29 class FieldFiniteElement : public Field
30 {
31 public:
32 
34  { }
35 
36  // takes ownership of C handle, responsibility for destroying it
37  explicit FieldFiniteElement(cmzn_field_finite_element_id field_finite_element_id) :
38  Field(reinterpret_cast<cmzn_field_id>(field_finite_element_id))
39  { }
40 };
41 class FieldEmbedded : public Field
49 {
50 private:
51  // takes ownership of C handle, responsibility for destroying it
52  explicit FieldEmbedded(cmzn_field_id field_id) : Field(field_id)
53  { }
54 
55  friend FieldEmbedded Fieldmodule::createFieldEmbedded(const Field& sourceField,
56  const Field& embeddedLocationField);
57 
58 public:
59 
60  FieldEmbedded() : Field(0)
61  { }
62 
63 };
64 
72 {
73 public:
74 
76  { }
77 
78  // takes ownership of C handle, responsibility for destroying it
79  explicit FieldFindMeshLocation(cmzn_field_find_mesh_location_id field_find_mesh_location_id) :
80  Field(reinterpret_cast<cmzn_field_id>(field_find_mesh_location_id))
81  { }
82 
88  {
89  SEARCH_MODE_INVALID = CMZN_FIELD_FIND_MESH_LOCATION_SEARCH_MODE_INVALID,
92  SEARCH_MODE_EXACT = CMZN_FIELD_FIND_MESH_LOCATION_SEARCH_MODE_EXACT,
96  SEARCH_MODE_NEAREST = CMZN_FIELD_FIND_MESH_LOCATION_SEARCH_MODE_NEAREST
99  };
100 
107  {
108  return Mesh(cmzn_field_find_mesh_location_get_mesh(
109  reinterpret_cast<cmzn_field_find_mesh_location_id>(id)));
110  }
111 
119  {
120  return static_cast<SearchMode>(cmzn_field_find_mesh_location_get_search_mode(
121  reinterpret_cast<cmzn_field_find_mesh_location_id>(id)));
122  }
123 
131  int setSearchMode(SearchMode searchMode)
132  {
133  return cmzn_field_find_mesh_location_set_search_mode(
134  reinterpret_cast<cmzn_field_find_mesh_location_id>(id),
135  static_cast<cmzn_field_find_mesh_location_search_mode>(searchMode));
136  }
137 };
138 class FieldNodeValue : public Field
145 {
146 private:
147  // takes ownership of C handle, responsibility for destroying it
148  explicit FieldNodeValue(cmzn_field_id field_id) : Field(field_id)
149  { }
150 
151  friend FieldNodeValue Fieldmodule::createFieldNodeValue(const Field& sourceField,
152  Node::ValueLabel nodeValueLabel, int versionNumber);
153 
154 public:
155 
156  FieldNodeValue() : Field(0)
157  { }
158 
159 };
160 
168 {
169 public:
170 
172  { }
173 
174  // takes ownership of C handle, responsibility for destroying it
175  explicit FieldStoredMeshLocation(cmzn_field_stored_mesh_location_id field_stored_mesh_location_id) :
176  Field(reinterpret_cast<cmzn_field_id>(field_stored_mesh_location_id))
177  { }
178 };
179 class FieldStoredString : public Field
186 {
187 public:
188 
189  FieldStoredString() : Field(0)
190  { }
191 
192  // takes ownership of C handle, responsibility for destroying it
193  explicit FieldStoredString(cmzn_field_stored_string_id field_stored_string_id) :
194  Field(reinterpret_cast<cmzn_field_id>(field_stored_string_id))
195  { }
196 };
197 
199 {
200  return FieldFiniteElement(reinterpret_cast<cmzn_field_finite_element_id>(
201  cmzn_fieldmodule_create_field_finite_element(id,numberOfComponents)));
202 }
203 
205 {
206  return FieldFiniteElement(cmzn_field_cast_finite_element(id));
207 }
208 
209 inline FieldEmbedded Fieldmodule::createFieldEmbedded(const Field& sourceField, const Field& embeddedLocationField)
210 {
211  return FieldEmbedded(cmzn_fieldmodule_create_field_embedded(id,
212  sourceField.getId(), embeddedLocationField.getId()));
213 }
214 
216  const Field& sourceField, const Field& meshField, const Mesh& mesh)
217 {
218  return FieldFindMeshLocation(reinterpret_cast<cmzn_field_find_mesh_location_id>(
219  cmzn_fieldmodule_create_field_find_mesh_location(id, sourceField.getId(), meshField.getId(), mesh.getId())));
220 }
221 
223 {
224  return FieldFindMeshLocation(cmzn_field_cast_find_mesh_location(id));
225 }
226 
228  Node::ValueLabel nodeValueLabel, int versionNumber)
229 {
230  return FieldNodeValue(cmzn_fieldmodule_create_field_node_value(id,
231  sourceField.getId(), static_cast<cmzn_node_value_label>(nodeValueLabel),
232  versionNumber));
233 }
234 
236 {
237  return FieldStoredMeshLocation(reinterpret_cast<cmzn_field_stored_mesh_location_id>(
238  cmzn_fieldmodule_create_field_stored_mesh_location(id, mesh.getId())));
239 }
240 
242 {
243  return FieldStoredMeshLocation(cmzn_field_cast_stored_mesh_location(id));
244 }
245 
247 {
248  return FieldStoredString(reinterpret_cast<cmzn_field_stored_string_id>(
249  cmzn_fieldmodule_create_field_stored_string(id)));
250 }
251 
253 {
254  return FieldStoredString(cmzn_field_cast_stored_string(id));
255 }
256 
257 } // namespace Zinc
258 }
259 #endif /* CMZN_FIELD_TYPES_FINITE_ELEMENT_HPP__ */
FieldFiniteElement createFieldFiniteElement(int numberOfComponents)
Definition: fieldfiniteelement.hpp:198
A real-valued field defined by element basis.
Definition: fieldfiniteelement.hpp:29
ValueLabel
Definition: node.hpp:83
Base field type: an abstraction of a mathematical field.
Definition: field.hpp:46
FieldStoredString castStoredString()
Definition: fieldfiniteelement.hpp:252
int setSearchMode(SearchMode searchMode)
Definition: fieldfiniteelement.hpp:131
FieldFindMeshLocation castFindMeshLocation()
Definition: fieldfiniteelement.hpp:222
FieldStoredMeshLocation createFieldStoredMeshLocation(const Mesh &mesh)
Definition: fieldfiniteelement.hpp:235
FieldEmbedded createFieldEmbedded(const Field &sourceField, const Field &embeddedLocationField)
Definition: fieldfiniteelement.hpp:209
FieldStoredString createFieldStoredString()
Definition: fieldfiniteelement.hpp:246
FieldFiniteElement castFiniteElement()
Definition: fieldfiniteelement.hpp:204
A field which stores and returns string values at nodes.
Definition: fieldfiniteelement.hpp:185
FieldNodeValue createFieldNodeValue(const Field &sourceField, Node::ValueLabel nodeValueLabel, int versionNumber)
Definition: fieldfiniteelement.hpp:227
A field which represents and returns node values/derivatives.
Definition: fieldfiniteelement.hpp:144
A field returning a value of a source field at an embedded location.
Definition: fieldfiniteelement.hpp:48
cmzn_field_id getId() const
Definition: field.hpp:98
SearchMode
Definition: fieldfiniteelement.hpp:87
Mesh getMesh()
Definition: fieldfiniteelement.hpp:106
A field storing locations within a mesh.
Definition: fieldfiniteelement.hpp:167
cmzn_mesh_id getId() const
Definition: element.hpp:703
FieldStoredMeshLocation castStoredMeshLocation()
Definition: fieldfiniteelement.hpp:241
SearchMode getSearchMode()
Definition: fieldfiniteelement.hpp:118
A finite element mesh consisting of a set of elements of fixed dimension.
Definition: element.hpp:650
A field that computes the location in a mesh.
Definition: fieldfiniteelement.hpp:71
FieldFindMeshLocation createFieldFindMeshLocation(const Field &sourceField, const Field &meshField, const Mesh &mesh)
Definition: fieldfiniteelement.hpp:215