OpenCMISS-Zinc C++ API Documentation
fieldgroup.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_FIELDGROUP_HPP__
10 #define CMZN_FIELDGROUP_HPP__
11 
12 #include "opencmiss/zinc/fieldgroup.h"
13 #include "opencmiss/zinc/field.hpp"
14 #include "opencmiss/zinc/fieldmodule.hpp"
15 #include "opencmiss/zinc/fieldsubobjectgroup.hpp"
16 #include "opencmiss/zinc/node.hpp"
17 #include "opencmiss/zinc/element.hpp"
18 #include "opencmiss/zinc/region.hpp"
19 
20 namespace OpenCMISS
21 {
22 namespace Zinc
23 {
24 
35 class FieldGroup : public Field
36 {
37 public:
38 
39  FieldGroup() : Field(0)
40  { }
41 
42  // takes ownership of C handle, responsibility for destroying it
43  explicit FieldGroup(cmzn_field_group_id field_group_id) :
44  Field(reinterpret_cast<cmzn_field_id>(field_group_id))
45  { }
46 
52  {
53  SUBELEMENT_HANDLING_MODE_INVALID = CMZN_FIELD_GROUP_SUBELEMENT_HANDLING_MODE_INVALID,
55  SUBELEMENT_HANDLING_MODE_NONE = CMZN_FIELD_GROUP_SUBELEMENT_HANDLING_MODE_NONE,
58  SUBELEMENT_HANDLING_MODE_FULL = CMZN_FIELD_GROUP_SUBELEMENT_HANDLING_MODE_FULL
63  };
64 
70  inline cmzn_field_group_id getDerivedId()
71  {
72  return reinterpret_cast<cmzn_field_group_id>(id);
73  }
74 
80  bool isEmpty()
81  {
82  return cmzn_field_group_is_empty(getDerivedId());
83  }
84 
90  bool isEmptyLocal()
91  {
92  return cmzn_field_group_is_empty_local(getDerivedId());
93  }
94 
102  int clear()
103  {
104  return cmzn_field_group_clear(getDerivedId());
105  }
106 
114  {
115  return cmzn_field_group_clear_local(getDerivedId());
116  }
117 
125  {
126  return cmzn_field_group_remove_empty_subgroups(getDerivedId());
127  }
128 
138  {
139  return cmzn_field_group_add_local_region(getDerivedId());
140  }
141 
150  {
151  return cmzn_field_group_contains_local_region(getDerivedId());
152  }
153 
163  {
164  return cmzn_field_group_remove_local_region(getDerivedId());
165  }
166 
177  int addRegion(const Region& region)
178  {
179  return cmzn_field_group_add_region(getDerivedId(),
180  region.getId());
181  }
182 
192  int removeRegion(const Region& region)
193  {
194  return cmzn_field_group_remove_region(getDerivedId(), region.getId());
195  }
196 
205  bool containsRegion(const Region& region)
206  {
207  return cmzn_field_group_contains_region(getDerivedId(), region.getId());
208  }
209 
218  {
219  return static_cast<SubelementHandlingMode>(
220  cmzn_field_group_get_subelement_handling_mode(getDerivedId()));
221  }
222 
233  {
234  return cmzn_field_group_set_subelement_handling_mode(getDerivedId(),
235  static_cast<enum cmzn_field_group_subelement_handling_mode>(mode));
236  }
237 
248  {
249  return FieldGroup(cmzn_field_group_create_subregion_field_group(
250  getDerivedId(), region.getId()));
251  }
252 
261  {
262  return FieldGroup(cmzn_field_group_get_subregion_field_group(
263  getDerivedId(), region.getId()));
264  }
265 
280  {
281  return FieldNodeGroup(cmzn_field_group_create_field_node_group(
282  getDerivedId(), nodeset.getId()));
283  }
284 
295  {
296  return FieldNodeGroup(cmzn_field_group_get_field_node_group(
297  getDerivedId(), nodeset.getId()));
298  }
299 
314  {
315  return FieldElementGroup(cmzn_field_group_create_field_element_group(
316  getDerivedId(), mesh.getId()));
317  }
318 
329  {
330  return FieldElementGroup(cmzn_field_group_get_field_element_group(
331  getDerivedId(), mesh.getId()));
332  }
333 
341  {
342  return Field(cmzn_field_group_get_subobject_group_field_for_domain_field(
343  getDerivedId(), domainField.getId()));
344  }
345 
352  {
353  return FieldGroup(cmzn_field_group_get_first_non_empty_subregion_field_group(
354  getDerivedId()));
355  }
356 
357 };
358 
360 {
361  return FieldGroup(reinterpret_cast<cmzn_field_group_id>(
362  cmzn_fieldmodule_create_field_group(id)));
363 }
364 
366 {
367  return FieldGroup(cmzn_field_cast_group(id));
368 }
369 
370 } // namespace Zinc
371 }
372 
373 #endif
A field which defines a subset of elements from a master mesh.
Definition: fieldsubobjectgroup.hpp:31
int removeRegion(const Region &region)
Definition: fieldgroup.hpp:192
Base field type: an abstraction of a mathematical field.
Definition: field.hpp:51
int clear()
Definition: fieldgroup.hpp:102
FieldGroup getFirstNonEmptySubregionFieldGroup()
Definition: fieldgroup.hpp:351
cmzn_nodeset_id getId() const
Definition: nodeset.hpp:82
bool isEmptyLocal()
Definition: fieldgroup.hpp:90
int removeEmptySubgroups()
Definition: fieldgroup.hpp:124
cmzn_field_group_id getDerivedId()
Definition: fieldgroup.hpp:70
FieldNodeGroup createFieldNodeGroup(const Nodeset &nodeset)
Definition: fieldgroup.hpp:279
A field which defines a subset of nodes from a master nodeset.
Definition: fieldsubobjectgroup.hpp:64
int removeLocalRegion()
Definition: fieldgroup.hpp:162
A hierarchical block/namespace owning domains and fields.
Definition: region.hpp:33
cmzn_region_id getId() const
Definition: region.hpp:84
int addRegion(const Region &region)
Definition: fieldgroup.hpp:177
int setSubelementHandlingMode(SubelementHandlingMode mode)
Definition: fieldgroup.hpp:232
bool containsRegion(const Region &region)
Definition: fieldgroup.hpp:205
FieldGroup createSubregionFieldGroup(const Region &region)
Definition: fieldgroup.hpp:247
cmzn_field_id getId() const
Definition: field.hpp:103
FieldElementGroup getFieldElementGroup(const Mesh &mesh)
Definition: fieldgroup.hpp:328
SubelementHandlingMode
Definition: fieldgroup.hpp:51
cmzn_mesh_id getId() const
Definition: mesh.hpp:87
FieldGroup castGroup()
Definition: fieldgroup.hpp:365
FieldElementGroup createFieldElementGroup(const Mesh &mesh)
Definition: fieldgroup.hpp:313
int clearLocal()
Definition: fieldgroup.hpp:113
bool containsLocalRegion()
Definition: fieldgroup.hpp:149
FieldNodeGroup getFieldNodeGroup(const Nodeset &nodeset)
Definition: fieldgroup.hpp:294
SubelementHandlingMode getSubelementHandlingMode()
Definition: fieldgroup.hpp:217
A generic group field used for grouping local subobjects.
Definition: fieldgroup.hpp:35
FieldGroup getSubregionFieldGroup(const Region &region)
Definition: fieldgroup.hpp:260
Field getSubobjectGroupFieldForDomainField(const Field &domainField)
Definition: fieldgroup.hpp:340
The OpenCMISS namespace.
Definition: context.hpp:20
bool isEmpty()
Definition: fieldgroup.hpp:80
int addLocalRegion()
Definition: fieldgroup.hpp:137
FieldGroup createFieldGroup()
Definition: fieldgroup.hpp:359
A finite element mesh consisting of a set of elements of fixed dimension.
Definition: mesh.hpp:34
A set of nodes or points.
Definition: nodeset.hpp:29