OpenCMISS-Zinc C++ API Documentation
fieldmatrixoperators.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_FIELDMATRIXOPERATORS_HPP__
10 #define CMZN_FIELDMATRIXOPERATORS_HPP__
11 
12 #include "opencmiss/zinc/fieldmatrixoperators.h"
13 #include "opencmiss/zinc/field.hpp"
14 #include "opencmiss/zinc/fieldmodule.hpp"
15 
16 namespace OpenCMISS
17 {
18 namespace Zinc
19 {
20 class FieldDeterminant : public Field
29 {
30 private:
31  // takes ownership of C handle, responsibility for destroying it
32  explicit FieldDeterminant(cmzn_field_id field_id) : Field(field_id)
33  { }
34 
35  friend FieldDeterminant Fieldmodule::createFieldDeterminant(const Field& sourceField);
36 
37 public:
38 
39  FieldDeterminant() : Field(0)
40  { }
41 
42 };
43 
50 class FieldEigenvalues : public Field
51 {
52 private:
53 
55 
56 public:
57 
58  explicit FieldEigenvalues(cmzn_field_eigenvalues_id field_eigenvalues_id) :
59  Field(reinterpret_cast<cmzn_field_id>(field_eigenvalues_id))
60  { }
61 
62  FieldEigenvalues() : Field(0)
63  { }
64 
65 };
66 class FieldEigenvectors : public Field
76 {
77 private:
78  // takes ownership of C handle, responsibility for destroying it
79  explicit FieldEigenvectors(cmzn_field_id field_id) : Field(field_id)
80  { }
81 
83  const FieldEigenvalues& eigenvaluesField);
84 
85 public:
86 
88  { }
89 
90 };
91 class FieldMatrixInvert : public Field
100 {
101 private:
102  // takes ownership of C handle, responsibility for destroying it
103  explicit FieldMatrixInvert(cmzn_field_id field_id) : Field(field_id)
104  { }
105 
107 
108 public:
109 
110  FieldMatrixInvert() : Field(0)
111  { }
112 
113 };
114 class FieldMatrixMultiply : public Field
127 {
128 private:
129  // takes ownership of C handle, responsibility for destroying it
130  explicit FieldMatrixMultiply(cmzn_field_id field_id) : Field(field_id)
131  { }
132 
134  const Field& sourceField1, const Field& sourceField2);
135 
136 public:
137 
139  { }
140 
141 };
142 class FieldProjection : public Field
166 {
167 private:
168  // takes ownership of C handle, responsibility for destroying it
169  explicit FieldProjection(cmzn_field_id field_id) : Field(field_id)
170  { }
171 
172  friend FieldProjection Fieldmodule::createFieldProjection(const Field& sourceField,
173  const Field& projectionMatrixField);
174 
175 public:
176 
177  FieldProjection() : Field(0)
178  { }
179 
180 };
181 class FieldTranspose : public Field
191 {
192 private:
193  // takes ownership of C handle, responsibility for destroying it
194  explicit FieldTranspose(cmzn_field_id field_id) : Field(field_id)
195  { }
196 
197  friend FieldTranspose Fieldmodule::createFieldTranspose(int sourceNumberOfRows,
198  const Field& sourceField);
199 
200 public:
201 
202  FieldTranspose() : Field(0)
203  { }
204 
205 };
206 
208 {
209  return FieldDeterminant(cmzn_fieldmodule_create_field_determinant(id,
210  sourceField.getId()));
211 }
212 
214 {
215  return FieldEigenvalues(cmzn_field_cast_eigenvalues(id));
216 }
217 
219 {
220  return FieldEigenvalues(reinterpret_cast<cmzn_field_eigenvalues_id>(
221  cmzn_fieldmodule_create_field_eigenvalues(id,sourceField.getId())));
222 }
223 
225 {
226  return FieldEigenvectors(cmzn_fieldmodule_create_field_eigenvectors(id,
227  eigenValuesField.getId()));
228 }
229 
231 {
232  return FieldMatrixInvert(cmzn_fieldmodule_create_field_matrix_invert(id,
233  sourceField.getId()));
234 }
235 
237  const Field& sourceField1, const Field& sourceField2)
238 {
239  return FieldMatrixMultiply(cmzn_fieldmodule_create_field_matrix_multiply(id,
240  numberOfRows, sourceField1.getId(), sourceField2.getId()));
241 }
242 
244  const Field& projectionMatrixField)
245 {
246  return FieldProjection(cmzn_fieldmodule_create_field_projection(id,
247  sourceField.getId(), projectionMatrixField.getId()));
248 }
249 
250 inline FieldTranspose Fieldmodule::createFieldTranspose(int sourceNumberOfRows,
251  const Field& sourceField)
252 {
253  return FieldTranspose(cmzn_fieldmodule_create_field_transpose(id,
254  sourceNumberOfRows, sourceField.getId()));
255 }
256 
257 } // namespace Zinc
258 }
259 
260 #endif
FieldMatrixMultiply createFieldMatrixMultiply(int numberOfRows, const Field &sourceField1, const Field &sourceField2)
Definition: fieldmatrixoperators.hpp:236
FieldEigenvalues createFieldEigenvalues(const Field &sourceField)
Definition: fieldmatrixoperators.hpp:218
A field returning the transpose of N*M matrix source_field.
Definition: fieldmatrixoperators.hpp:190
Base field type: an abstraction of a mathematical field.
Definition: field.hpp:51
A field returning the scalar real determinant of a square matrix source field.
Definition: fieldmatrixoperators.hpp:28
FieldMatrixInvert createFieldMatrixInvert(const Field &sourceField)
Definition: fieldmatrixoperators.hpp:230
cmzn_field_id getId() const
Definition: field.hpp:103
A field returning the inverse of N*N symmetric matrix valued source field.
Definition: fieldmatrixoperators.hpp:99
A field returning the N, N-dimensional eigenvectors computed with the source eigenvalues field...
Definition: fieldmatrixoperators.hpp:75
A field returning the values resulting from matrix multiplication <source_field1> x <source_field2>...
Definition: fieldmatrixoperators.hpp:126
FieldTranspose createFieldTranspose(int sourceNumberOfRows, const Field &sourceField)
Definition: fieldmatrixoperators.hpp:250
A projection field returning the result of a matrix multiplication with perspective division on the s...
Definition: fieldmatrixoperators.hpp:165
FieldEigenvectors createFieldEigenvectors(const FieldEigenvalues &eigenValuesField)
Definition: fieldmatrixoperators.hpp:224
The OpenCMISS namespace.
Definition: context.hpp:20
FieldEigenvalues castEigenvalues()
Definition: fieldmatrixoperators.hpp:213
FieldProjection createFieldProjection(const Field &sourceField, const Field &projectionMatrixField)
Definition: fieldmatrixoperators.hpp:243
A field calculating the eigenvalues.
Definition: fieldmatrixoperators.hpp:50
FieldDeterminant createFieldDeterminant(const Field &sourceField)
Definition: fieldmatrixoperators.hpp:207