9 #ifndef CMZN_FIELDCOMPOSITE_HPP__
10 #define CMZN_FIELDCOMPOSITE_HPP__
13 #include "zinc/fieldcomposite.h"
14 #include "zinc/field.hpp"
15 #include "zinc/fieldmodule.hpp"
21 class FieldIdentity :
public Field
35 explicit FieldIdentity(cmzn_field_id field_id) : Field(field_id)
42 FieldIdentity() : Field(0)
60 explicit FieldComponent(cmzn_field_component_id field_component_id) :
61 Field(reinterpret_cast<cmzn_field_id>(field_component_id))
71 return reinterpret_cast<cmzn_field_component_id
>(id);
81 return cmzn_field_component_get_component_index(
getDerivedId());
91 return cmzn_field_component_set_component_index(
getDerivedId(), componentIndex);
95 class FieldConcatenate :
public Field
108 explicit FieldConcatenate(cmzn_field_id field_id) : Field(field_id)
115 FieldConcatenate() : Field(0)
122 return FieldIdentity(cmzn_fieldmodule_create_field_identity(
id, sourceField.
getId()));
128 cmzn_fieldmodule_create_field_component(
id, sourceField.
getId(), componentIndex)));
138 cmzn_field_id concatenateField = 0;
141 cmzn_field_id *source_fields =
new cmzn_field_id[fieldsCount];
142 for (
int i = 0; i < fieldsCount; i++)
144 source_fields[i] = sourceFields[i].
getId();
146 concatenateField = cmzn_fieldmodule_create_field_concatenate(
id, fieldsCount, source_fields);
147 delete[] source_fields;
Base field type: an abstraction of a mathematical field.
Definition: field.hpp:46
A field which concatenates the components of all source fields, in order, into a single vector...
Definition: fieldcomposite.hpp:103
FieldComponent createFieldComponent(const Field &sourceField, int componentIndex)
Definition: fieldcomposite.hpp:125
FieldComponent castComponent()
Definition: fieldcomposite.hpp:131
A field returning a single component of a source field as a scalar.
Definition: fieldcomposite.hpp:52
cmzn_field_id getId() const
Definition: field.hpp:98
int getComponentIndex()
Definition: fieldcomposite.hpp:79
cmzn_field_component_id getDerivedId()
Definition: fieldcomposite.hpp:69
int setComponentIndex(int componentIndex)
Definition: fieldcomposite.hpp:89
FieldConcatenate createFieldConcatenate(int fieldsCount, const Field *sourceFields)
Definition: fieldcomposite.hpp:136
FieldIdentity createFieldIdentity(const Field &sourceField)
Definition: fieldcomposite.hpp:120
A field with the single source field.
Definition: fieldcomposite.hpp:30