OpenCMISS-Zinc C++ API Documentation
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 "opencmiss/zinc/fieldfiniteelement.h"
13 #include "opencmiss/zinc/field.hpp"
14 #include "opencmiss/zinc/fieldcache.hpp"
15 #include "opencmiss/zinc/fieldmodule.hpp"
16 #include "opencmiss/zinc/element.hpp"
17 #include "opencmiss/zinc/node.hpp"
18 
19 namespace OpenCMISS
20 {
21 namespace Zinc
22 {
23 
31 class FieldFiniteElement : public Field
32 {
33 public:
34 
36  { }
37 
38  // takes ownership of C handle, responsibility for destroying it
39  explicit FieldFiniteElement(cmzn_field_finite_element_id field_finite_element_id) :
40  Field(reinterpret_cast<cmzn_field_id>(field_finite_element_id))
41  { }
42 
48  inline cmzn_field_finite_element_id getDerivedId()
49  {
50  return reinterpret_cast<cmzn_field_finite_element_id>(this->id);
51  }
52 
78  int getNodeParameters(const Fieldcache& cache, int componentNumber,
79  Node::ValueLabel nodeValueLabel, int versionNumber, int valuesCount, double *valuesOut)
80  {
81  return cmzn_field_finite_element_get_node_parameters(this->getDerivedId(),
82  cache.getId(), componentNumber, static_cast<cmzn_node_value_label>(nodeValueLabel),
83  versionNumber, valuesCount, valuesOut);
84  }
85 
111  int setNodeParameters(const Fieldcache& cache, int componentNumber,
112  Node::ValueLabel nodeValueLabel, int versionNumber, int valuesCount, const double *valuesIn)
113  {
114  return cmzn_field_finite_element_set_node_parameters(this->getDerivedId(),
115  cache.getId(), componentNumber, static_cast<cmzn_node_value_label>(nodeValueLabel),
116  versionNumber, valuesCount, valuesIn);
117  }
118 
128  {
129  return cmzn_field_finite_element_has_parameters_at_location(this->getDerivedId(), cache.getId());
130  }
131 };
132 
145 {
146 private:
148  const Field& sourceField);
149 
150 public:
151 
153  { }
154 
155  // takes ownership of C handle, responsibility for destroying it
156  explicit FieldEdgeDiscontinuity(cmzn_field_edge_discontinuity_id field_edge_discontinuity_id) :
157  Field(reinterpret_cast<cmzn_field_id>(field_edge_discontinuity_id))
158  { }
159 
165  inline cmzn_field_edge_discontinuity_id getDerivedId()
166  {
167  return reinterpret_cast<cmzn_field_edge_discontinuity_id>(id);
168  }
169 
174  enum Measure
175  {
176  MEASURE_INVALID = CMZN_FIELD_EDGE_DISCONTINUITY_MEASURE_INVALID,
179  MEASURE_C1 = CMZN_FIELD_EDGE_DISCONTINUITY_MEASURE_C1,
183  MEASURE_G1 = CMZN_FIELD_EDGE_DISCONTINUITY_MEASURE_G1,
188  MEASURE_SURFACE_NORMAL = CMZN_FIELD_EDGE_DISCONTINUITY_MEASURE_SURFACE_NORMAL
192  };
193 
203  {
204  return Field(cmzn_field_edge_discontinuity_get_conditional_field(getDerivedId()));
205  }
206 
218  int setConditionalField(const Field& conditionalField)
219  {
220  return cmzn_field_edge_discontinuity_set_conditional_field(getDerivedId(), conditionalField.getId());
221  }
222 
232  {
233  return static_cast<Measure>(cmzn_field_edge_discontinuity_get_measure(getDerivedId()));
234  }
235 
245  int setMeasure(Measure measure)
246  {
247  return cmzn_field_edge_discontinuity_set_measure(getDerivedId(),
248  static_cast<cmzn_field_edge_discontinuity_measure>(measure));
249  }
250 
251 };
252 class FieldEmbedded : public Field
260 {
261 private:
262  // takes ownership of C handle, responsibility for destroying it
263  explicit FieldEmbedded(cmzn_field_id field_id) : Field(field_id)
264  { }
265 
266  friend FieldEmbedded Fieldmodule::createFieldEmbedded(const Field& sourceField,
267  const Field& embeddedLocationField);
268 
269 public:
270 
271  FieldEmbedded() : Field(0)
272  { }
273 
274 };
275 
283 {
284 public:
285 
287  { }
288 
289  // takes ownership of C handle, responsibility for destroying it
290  explicit FieldFindMeshLocation(cmzn_field_find_mesh_location_id field_find_mesh_location_id) :
291  Field(reinterpret_cast<cmzn_field_id>(field_find_mesh_location_id))
292  { }
293 
299  {
300  SEARCH_MODE_INVALID = CMZN_FIELD_FIND_MESH_LOCATION_SEARCH_MODE_INVALID,
303  SEARCH_MODE_EXACT = CMZN_FIELD_FIND_MESH_LOCATION_SEARCH_MODE_EXACT,
307  SEARCH_MODE_NEAREST = CMZN_FIELD_FIND_MESH_LOCATION_SEARCH_MODE_NEAREST
310  };
311 
318  {
319  return Mesh(cmzn_field_find_mesh_location_get_mesh(
320  reinterpret_cast<cmzn_field_find_mesh_location_id>(id)));
321  }
322 
330  {
331  return static_cast<SearchMode>(cmzn_field_find_mesh_location_get_search_mode(
332  reinterpret_cast<cmzn_field_find_mesh_location_id>(id)));
333  }
334 
342  int setSearchMode(SearchMode searchMode)
343  {
344  return cmzn_field_find_mesh_location_set_search_mode(
345  reinterpret_cast<cmzn_field_find_mesh_location_id>(id),
346  static_cast<cmzn_field_find_mesh_location_search_mode>(searchMode));
347  }
348 };
349 class FieldNodeValue : public Field
361 {
362 private:
363  // takes ownership of C handle, responsibility for destroying it
364  explicit FieldNodeValue(cmzn_field_id field_id) : Field(field_id)
365  { }
366 
367  friend FieldNodeValue Fieldmodule::createFieldNodeValue(const Field& sourceField,
368  Node::ValueLabel nodeValueLabel, int versionNumber);
369 
370 public:
371 
372  FieldNodeValue() : Field(0)
373  { }
374 
375 };
376 
384 {
385 public:
386 
388  { }
389 
390  // takes ownership of C handle, responsibility for destroying it
391  explicit FieldStoredMeshLocation(cmzn_field_stored_mesh_location_id field_stored_mesh_location_id) :
392  Field(reinterpret_cast<cmzn_field_id>(field_stored_mesh_location_id))
393  { }
394 };
395 class FieldStoredString : public Field
402 {
403 public:
404 
405  FieldStoredString() : Field(0)
406  { }
407 
408  // takes ownership of C handle, responsibility for destroying it
409  explicit FieldStoredString(cmzn_field_stored_string_id field_stored_string_id) :
410  Field(reinterpret_cast<cmzn_field_id>(field_stored_string_id))
411  { }
412 };
413 class FieldIsExterior : public Field
422 {
423 private:
424  // takes ownership of C handle, responsibility for destroying it
425  explicit FieldIsExterior(cmzn_field_id field_id) : Field(field_id)
426  { }
427 
429 
430 public:
431 
432  FieldIsExterior() : Field(0)
433  { }
434 };
435 class FieldIsOnFace : public Field
444 {
445 private:
446  // takes ownership of C handle, responsibility for destroying it
447  explicit FieldIsOnFace(cmzn_field_id field_id) : Field(field_id)
448  { }
449 
451 
452 public:
453 
454  FieldIsOnFace() : Field(0)
455  { }
456 };
457 class FieldNodeLookup : public Field
466 {
467 private:
468  // takes ownership of C handle, responsibility for destroying it
469  explicit FieldNodeLookup(cmzn_field_id field_id) : Field(field_id)
470  { }
471 
472  friend FieldNodeLookup Fieldmodule::createFieldNodeLookup(const Field& sourceField,
473  const Node& lookupNode);
474 
475 public:
476 
477  FieldNodeLookup() : Field(0)
478  { }
479 
480 };
481 
482 
484 {
485  return FieldFiniteElement(reinterpret_cast<cmzn_field_finite_element_id>(
486  cmzn_fieldmodule_create_field_finite_element(id,numberOfComponents)));
487 }
488 
490 {
491  return FieldFiniteElement(cmzn_field_cast_finite_element(id));
492 }
493 
495  const Field& sourceField)
496 {
497  return FieldEdgeDiscontinuity(reinterpret_cast<cmzn_field_edge_discontinuity_id>(
498  cmzn_fieldmodule_create_field_edge_discontinuity(id, sourceField.getId())));
499 }
500 
502 {
503  return FieldEdgeDiscontinuity(cmzn_field_cast_edge_discontinuity(id));
504 }
505 
506 inline FieldEmbedded Fieldmodule::createFieldEmbedded(const Field& sourceField, const Field& embeddedLocationField)
507 {
508  return FieldEmbedded(cmzn_fieldmodule_create_field_embedded(id,
509  sourceField.getId(), embeddedLocationField.getId()));
510 }
511 
513  const Field& sourceField, const Field& meshField, const Mesh& mesh)
514 {
515  return FieldFindMeshLocation(reinterpret_cast<cmzn_field_find_mesh_location_id>(
516  cmzn_fieldmodule_create_field_find_mesh_location(id, sourceField.getId(), meshField.getId(), mesh.getId())));
517 }
518 
520 {
521  return FieldFindMeshLocation(cmzn_field_cast_find_mesh_location(id));
522 }
523 
525  Node::ValueLabel nodeValueLabel, int versionNumber)
526 {
527  return FieldNodeValue(cmzn_fieldmodule_create_field_node_value(id,
528  sourceField.getId(), static_cast<cmzn_node_value_label>(nodeValueLabel),
529  versionNumber));
530 }
531 
533 {
534  return FieldStoredMeshLocation(reinterpret_cast<cmzn_field_stored_mesh_location_id>(
535  cmzn_fieldmodule_create_field_stored_mesh_location(id, hostMesh.getId())));
536 }
537 
539 {
540  return FieldStoredMeshLocation(cmzn_field_cast_stored_mesh_location(id));
541 }
542 
544 {
545  return FieldStoredString(reinterpret_cast<cmzn_field_stored_string_id>(
546  cmzn_fieldmodule_create_field_stored_string(id)));
547 }
548 
550 {
551  return FieldStoredString(cmzn_field_cast_stored_string(id));
552 }
553 
555 {
556  return FieldIsExterior(cmzn_fieldmodule_create_field_is_exterior(id));
557 }
558 
560 {
561  return FieldIsOnFace(cmzn_fieldmodule_create_field_is_on_face(
562  id, static_cast<cmzn_element_face_type>(face)));
563 }
564 
566  const Node& lookupNode)
567 {
568  return FieldNodeLookup(cmzn_fieldmodule_create_field_node_lookup(
569  id, sourceField.getId(), lookupNode.getId()));
570 }
571 
572 } // namespace Zinc
573 }
574 #endif /* CMZN_FIELD_TYPES_FINITE_ELEMENT_HPP__ */
FieldFiniteElement createFieldFiniteElement(int numberOfComponents)
Definition: fieldfiniteelement.hpp:483
A real-valued interpolated field.
Definition: fieldfiniteelement.hpp:31
ValueLabel
Definition: node.hpp:80
Base field type: an abstraction of a mathematical field.
Definition: field.hpp:51
FieldStoredString castStoredString()
Definition: fieldfiniteelement.hpp:549
int setSearchMode(SearchMode searchMode)
Definition: fieldfiniteelement.hpp:342
int setMeasure(Measure measure)
Definition: fieldfiniteelement.hpp:245
FieldFindMeshLocation castFindMeshLocation()
Definition: fieldfiniteelement.hpp:519
FieldStoredMeshLocation createFieldStoredMeshLocation(const Mesh &mesh)
Definition: fieldfiniteelement.hpp:532
FieldIsOnFace createFieldIsOnFace(Element::FaceType face)
Definition: fieldfiniteelement.hpp:559
FieldEmbedded createFieldEmbedded(const Field &sourceField, const Field &embeddedLocationField)
Definition: fieldfiniteelement.hpp:506
bool hasParametersAtLocation(const Fieldcache &cache)
Definition: fieldfiniteelement.hpp:127
FieldStoredString createFieldStoredString()
Definition: fieldfiniteelement.hpp:543
FieldFiniteElement castFiniteElement()
Definition: fieldfiniteelement.hpp:489
A field which stores and returns string values at nodes.
Definition: fieldfiniteelement.hpp:401
FieldNodeValue createFieldNodeValue(const Field &sourceField, Node::ValueLabel nodeValueLabel, int versionNumber)
Definition: fieldfiniteelement.hpp:524
A field which represents and returns labelled node parameters, i.
Definition: fieldfiniteelement.hpp:360
FieldIsExterior createFieldIsExterior()
Definition: fieldfiniteelement.hpp:554
FieldEdgeDiscontinuity castEdgeDiscontinuity()
Definition: fieldfiniteelement.hpp:501
A field returning a value of a source field at an embedded location.
Definition: fieldfiniteelement.hpp:259
int getNodeParameters(const Fieldcache &cache, int componentNumber, Node::ValueLabel nodeValueLabel, int versionNumber, int valuesCount, double *valuesOut)
Definition: fieldfiniteelement.hpp:78
cmzn_field_finite_element_id getDerivedId()
Definition: fieldfiniteelement.hpp:48
cmzn_field_id getId() const
Definition: field.hpp:103
SearchMode
Definition: fieldfiniteelement.hpp:298
A field measuring discontinuity between surface elements.
Definition: fieldfiniteelement.hpp:144
Field getConditionalField()
Definition: fieldfiniteelement.hpp:202
Mesh getMesh()
Definition: fieldfiniteelement.hpp:317
A field storing locations within a mesh.
Definition: fieldfiniteelement.hpp:383
cmzn_field_edge_discontinuity_id getDerivedId()
Definition: fieldfiniteelement.hpp:165
Measure
Definition: fieldfiniteelement.hpp:174
FieldEdgeDiscontinuity createFieldEdgeDiscontinuity(const Field &sourceField)
Definition: fieldfiniteelement.hpp:494
cmzn_mesh_id getId() const
Definition: mesh.hpp:87
cmzn_node_id getId() const
Definition: node.hpp:136
int setNodeParameters(const Fieldcache &cache, int componentNumber, Node::ValueLabel nodeValueLabel, int versionNumber, int valuesCount, const double *valuesIn)
Definition: fieldfiniteelement.hpp:111
FieldStoredMeshLocation castStoredMeshLocation()
Definition: fieldfiniteelement.hpp:538
Cache for setting domain locations at which fields are evaluated or assigned.
Definition: fieldcache.hpp:33
A field which returns 1 on 2-D faces and 1-D lines considered to lie on a specified face of their top...
Definition: fieldfiniteelement.hpp:443
A field which returns 1 on 2-D faces and 1-D lines considered as exterior to their top-level element...
Definition: fieldfiniteelement.hpp:421
SearchMode getSearchMode()
Definition: fieldfiniteelement.hpp:329
A field whose value equals source field calculated at the lookup node instead of the domain location ...
Definition: fieldfiniteelement.hpp:465
The OpenCMISS namespace.
Definition: context.hpp:20
FieldNodeLookup createFieldNodeLookup(const Field &sourceField, const Node &lookupNode)
Definition: fieldfiniteelement.hpp:565
Point object used to represent finite element nodes.
Definition: node.hpp:34
cmzn_fieldcache_id getId() const
Definition: fieldcache.hpp:86
FaceType
Definition: element.hpp:110
A finite element mesh consisting of a set of elements of fixed dimension.
Definition: mesh.hpp:34
Measure getMeasure()
Definition: fieldfiniteelement.hpp:231
A field that computes the location in a mesh.
Definition: fieldfiniteelement.hpp:282
int setConditionalField(const Field &conditionalField)
Definition: fieldfiniteelement.hpp:218
FieldFindMeshLocation createFieldFindMeshLocation(const Field &sourceField, const Field &meshField, const Mesh &mesh)
Definition: fieldfiniteelement.hpp:512