OpenCMISS-Zinc C++ API Documentation
fieldsmoothing.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 
10 #ifndef CMZN_FIELDSMOOTHING_HPP__
11 #define CMZN_FIELDSMOOTHING_HPP__
12 
13 #include "opencmiss/zinc/fieldsmoothing.h"
14 #include "opencmiss/zinc/field.hpp"
15 #include "opencmiss/zinc/fieldmodule.hpp"
16 
17 namespace OpenCMISS
18 {
19 namespace Zinc
20 {
21 
29 {
30 protected:
31  cmzn_fieldsmoothing_id id;
32 
33 public:
34 
35  Fieldsmoothing() : id(0)
36  { }
37 
38  // takes ownership of C handle, responsibility for destroying it
39  explicit Fieldsmoothing(cmzn_fieldsmoothing_id in_fieldsmoothing_id) :
40  id(in_fieldsmoothing_id)
41  { }
42 
43  Fieldsmoothing(const Fieldsmoothing& fieldsmoothing) :
44  id(cmzn_fieldsmoothing_access(fieldsmoothing.id))
45  { }
46 
47  Fieldsmoothing& operator=(const Fieldsmoothing& fieldsmoothing)
48  {
49  cmzn_fieldsmoothing_id temp_id = cmzn_fieldsmoothing_access(fieldsmoothing.id);
50  if (0 != id)
51  cmzn_fieldsmoothing_destroy(&id);
52  id = temp_id;
53  return *this;
54  }
55 
57  {
58  if (0 != id)
59  cmzn_fieldsmoothing_destroy(&id);
60  }
61 
65  enum Algorithm
66  {
67  ALGORITHM_INVALID = CMZN_FIELDSMOOTHING_ALGORITHM_INVALID,
69  ALGORITHM_AVERAGE_DELTA_DERIVATIVES_UNSCALED = CMZN_FIELDSMOOTHING_ALGORITHM_AVERAGE_DELTA_DERIVATIVES_UNSCALED
72  };
73 
79  bool isValid() const
80  {
81  return (0 != id);
82  }
83 
89  cmzn_fieldsmoothing_id getId() const
90  {
91  return id;
92  }
93 
101  int setAlgorithm(Algorithm algorithm)
102  {
103  return cmzn_fieldsmoothing_set_algorithm(getId(),
104  static_cast<cmzn_fieldsmoothing_algorithm>(algorithm));
105  }
106 
113  int setTime(double time)
114  {
115  return cmzn_fieldsmoothing_set_time(id, time);
116  }
117 };
118 
120 {
121  return Fieldsmoothing(cmzn_fieldmodule_create_fieldsmoothing(id));
122 }
123 
124 inline int Field::smooth(const Fieldsmoothing& fieldsmoothing)
125 {
126  return cmzn_field_smooth(this->getId(), fieldsmoothing.getId());
127 }
128 
129 } // namespace Zinc
130 } // namespace OpenCMISS
131 
132 #endif /* CMZN_Fieldsmoothing_HPP__ */
bool isValid() const
Definition: fieldsmoothing.hpp:79
int setTime(double time)
Definition: fieldsmoothing.hpp:113
Fieldsmoothing createFieldsmoothing()
Definition: fieldsmoothing.hpp:119
Parameters for smoothing a field.
Definition: fieldsmoothing.hpp:28
Algorithm
Definition: fieldsmoothing.hpp:65
cmzn_fieldsmoothing_id getId() const
Definition: fieldsmoothing.hpp:89
int smooth(const Fieldsmoothing &fieldsmoothing)
Definition: fieldsmoothing.hpp:124
The OpenCMISS namespace.
Definition: context.hpp:20
int setAlgorithm(Algorithm algorithm)
Definition: fieldsmoothing.hpp:101