OpenCMISS-Zinc C++ API Documentation
fieldarithmeticoperators.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_FIELDARITHMETICOPERATORS_HPP__
10 #define CMZN_FIELDARITHMETICOPERATORS_HPP__
11 
12 #include "opencmiss/zinc/fieldarithmeticoperators.h"
13 #include "opencmiss/zinc/field.hpp"
14 #include "opencmiss/zinc/fieldmodule.hpp"
15 
16 namespace OpenCMISS
17 {
18 namespace Zinc
19 {
20 class FieldAdd : public Field
30 {
31 private:
32  // takes ownership of C handle, responsibility for destroying it
33  explicit FieldAdd(cmzn_field_id field_id) : Field(field_id)
34  { }
35 
36  friend FieldAdd Fieldmodule::createFieldAdd(const Field& sourceField1, const Field& sourceField2);
37 
38 public:
39 
40  FieldAdd() : Field(0)
41  { }
42 
43 };
44 
45 inline FieldAdd operator+(const Field& operand1, const Field& operand2)
46 {
47  return operand1.getFieldmodule().createFieldAdd(operand1, operand2);
48 }
49 class FieldPower : public Field
59 {
60 private:
61  // takes ownership of C handle, responsibility for destroying it
62  explicit FieldPower(cmzn_field_id field_id) : Field(field_id)
63  { }
64 
65  friend FieldPower Fieldmodule::createFieldPower(const Field& sourceField1, const Field& sourceField2);
66 
67 public:
68 
69  FieldPower() : Field(0)
70  { }
71 
72 };
73 class FieldMultiply : public Field
83 {
84 private:
85  // takes ownership of C handle, responsibility for destroying it
86  explicit FieldMultiply(cmzn_field_id field_id) : Field(field_id)
87  { }
88 
89  friend FieldMultiply Fieldmodule::createFieldMultiply(const Field& sourceField1, const Field& sourceField2);
90 
91 public:
92 
93  FieldMultiply() : Field(0)
94  { }
95 
96 };
97 
98 inline FieldMultiply operator*(const Field& operand1, const Field& operand2)
99 {
100  return operand1.getFieldmodule().createFieldMultiply(operand1, operand2);
101 }
102 class FieldDivide : public Field
112 {
113 private:
114  // takes ownership of C handle, responsibility for destroying it
115  explicit FieldDivide(cmzn_field_id field_id) : Field(field_id)
116  { }
117 
118  friend FieldDivide Fieldmodule::createFieldDivide(const Field& sourceField1, const Field& sourceField2);
119 
120 public:
121 
122  FieldDivide() : Field(0)
123  { }
124 
125 };
126 
127 inline FieldDivide operator/(const Field& operand1, const Field& operand2)
128 {
129  return operand1.getFieldmodule().createFieldDivide(operand1, operand2);
130 }
131 class FieldSubtract : public Field
141 {
142 private:
143  // takes ownership of C handle, responsibility for destroying it
144  explicit FieldSubtract(cmzn_field_id field_id) : Field(field_id)
145  { }
146 
147  friend FieldSubtract Fieldmodule::createFieldSubtract(const Field& sourceField1, const Field& sourceField2);
148 
149 public:
150 
151  FieldSubtract() : Field(0)
152  { }
153 
154 };
155 
156 inline FieldSubtract operator-(const Field& operand1, const Field& operand2)
157 {
158  return operand1.getFieldmodule().createFieldSubtract(operand1, operand2);
159 }
160 class FieldLog : public Field
169 {
170 private:
171  // takes ownership of C handle, responsibility for destroying it
172  explicit FieldLog(cmzn_field_id field_id) : Field(field_id)
173  { }
174 
175  friend FieldLog Fieldmodule::createFieldLog(const Field& sourceField);
176 
177 public:
178 
179  FieldLog() : Field(0)
180  { }
181 
182 };
183 
184 inline FieldLog log(const Field& sourceField)
185 {
186  return sourceField.getFieldmodule().createFieldLog(sourceField);
187 }
188 class FieldSqrt : public Field
197 {
198 private:
199  // takes ownership of C handle, responsibility for destroying it
200  explicit FieldSqrt(cmzn_field_id field_id) : Field(field_id)
201  { }
202 
203  friend FieldSqrt Fieldmodule::createFieldSqrt(const Field& sourceField);
204 
205 public:
206 
207  FieldSqrt() : Field(0)
208  { }
209 
210 };
211 
212 inline FieldSqrt sqrt(const Field& sourceField)
213 {
214  return sourceField.getFieldmodule().createFieldSqrt(sourceField);
215 }
216 class FieldExp : public Field
225 {
226 private:
227  // takes ownership of C handle, responsibility for destroying it
228  explicit FieldExp(cmzn_field_id field_id) : Field(field_id)
229  { }
230 
231  friend FieldExp Fieldmodule::createFieldExp(const Field& sourceField);
232 
233 public:
234 
235  FieldExp() : Field(0)
236  { }
237 
238 };
239 
240 inline FieldExp exp(const Field& sourceField)
241 {
242  return sourceField.getFieldmodule().createFieldExp(sourceField);
243 }
244 class FieldAbs : public Field
253 {
254 private:
255  // takes ownership of C handle, responsibility for destroying it
256  explicit FieldAbs(cmzn_field_id field_id) : Field(field_id)
257  { }
258 
259  friend FieldAbs Fieldmodule::createFieldAbs(const Field& sourceField);
260 
261 public:
262 
263  FieldAbs() : Field(0)
264  { }
265 
266 };
267 
268 inline FieldAbs abs(const Field& sourceField)
269 {
270  return sourceField.getFieldmodule().createFieldAbs(sourceField);
271 }
272 
273 /* inline Fieldmodule factory methods */
274 
275 inline FieldAdd Fieldmodule::createFieldAdd(const Field& sourceField1, const Field& sourceField2)
276 {
277  return FieldAdd(cmzn_fieldmodule_create_field_add(id,
278  sourceField1.getId(), sourceField2.getId()));
279 }
280 
281 inline FieldPower Fieldmodule::createFieldPower(const Field& sourceField1, const Field& sourceField2)
282 {
283  return FieldPower(cmzn_fieldmodule_create_field_power(id,
284  sourceField1.getId(), sourceField2.getId()));
285 }
286 
287 inline FieldMultiply Fieldmodule::createFieldMultiply(const Field& sourceField1, const Field& sourceField2)
288 {
289  return FieldMultiply(cmzn_fieldmodule_create_field_multiply(id,
290  sourceField1.getId(), sourceField2.getId()));
291 }
292 
293 inline FieldDivide Fieldmodule::createFieldDivide(const Field& sourceField1, const Field& sourceField2)
294 {
295  return FieldDivide(cmzn_fieldmodule_create_field_divide(id,
296  sourceField1.getId(), sourceField2.getId()));
297 }
298 
299 inline FieldSubtract Fieldmodule::createFieldSubtract(const Field& sourceField1, const Field& sourceField2)
300 {
301  return FieldSubtract(cmzn_fieldmodule_create_field_subtract(id,
302  sourceField1.getId(), sourceField2.getId()));
303 }
304 
305 inline FieldLog Fieldmodule::createFieldLog(const Field& sourceField)
306 {
307  return FieldLog(cmzn_fieldmodule_create_field_log(id, sourceField.getId()));
308 }
309 
310 inline FieldSqrt Fieldmodule::createFieldSqrt(const Field& sourceField)
311 {
312  return FieldSqrt(cmzn_fieldmodule_create_field_sqrt(id, sourceField.getId()));
313 }
314 
315 inline FieldExp Fieldmodule::createFieldExp(const Field& sourceField)
316 {
317  return FieldExp(cmzn_fieldmodule_create_field_exp(id, sourceField.getId()));
318 }
319 
320 inline FieldAbs Fieldmodule::createFieldAbs(const Field& sourceField)
321 {
322  return FieldAbs(cmzn_fieldmodule_create_field_abs(id, sourceField.getId()));
323 }
324 
325 } // namespace Zinc
326 }
327 
328 #endif
FieldSubtract createFieldSubtract(const Field &sourceField1, const Field &sourceField2)
Definition: fieldarithmeticoperators.hpp:299
A field where the which divides the components of source_field_one by source_field_two.
Definition: fieldarithmeticoperators.hpp:111
FieldAbs createFieldAbs(const Field &sourceField)
Definition: fieldarithmeticoperators.hpp:320
FieldMultiply createFieldMultiply(const Field &sourceField1, const Field &sourceField2)
Definition: fieldarithmeticoperators.hpp:287
Base field type: an abstraction of a mathematical field.
Definition: field.hpp:51
A field where the which calculates the components of source_field_one raised to the power of the comp...
Definition: fieldarithmeticoperators.hpp:58
FieldAdd createFieldAdd(const Field &sourceField1, const Field &sourceField2)
Definition: fieldarithmeticoperators.hpp:275
A field where the which multiplies the components of source_field_one and source_field_two.
Definition: fieldarithmeticoperators.hpp:82
FieldLog createFieldLog(const Field &sourceField)
Definition: fieldarithmeticoperators.hpp:305
FieldPower createFieldPower(const Field &sourceField1, const Field &sourceField2)
Definition: fieldarithmeticoperators.hpp:281
cmzn_field_id getId() const
Definition: field.hpp:103
A field where the field components are the natural exponent of each component in the source field...
Definition: fieldarithmeticoperators.hpp:224
FieldExp createFieldExp(const Field &sourceField)
Definition: fieldarithmeticoperators.hpp:315
A field where the field components are the natural logarithm of each component in the source field...
Definition: fieldarithmeticoperators.hpp:168
A field where the field components are the square root of each component in the source field...
Definition: fieldarithmeticoperators.hpp:196
A field where the which adds the components of source_field_one and source_field_two.
Definition: fieldarithmeticoperators.hpp:29
FieldSqrt createFieldSqrt(const Field &sourceField)
Definition: fieldarithmeticoperators.hpp:310
A field which gives the result of subtracting source_field_two from source_field_one.
Definition: fieldarithmeticoperators.hpp:140
The OpenCMISS namespace.
Definition: context.hpp:20
FieldDivide createFieldDivide(const Field &sourceField1, const Field &sourceField2)
Definition: fieldarithmeticoperators.hpp:293
A field where the field components are the absolute value of each component in the source field...
Definition: fieldarithmeticoperators.hpp:252
Fieldmodule getFieldmodule() const
Definition: fieldmodule.hpp:1786