tension_spline.hpp
Go to the documentation of this file.
1 
8 /*****************************************************************************
9 ** Ifdefs
10 *****************************************************************************/
11 
12 #ifndef ECL_GEOMETRY_TENSION_SPLINE_HPP_
13 #define ECL_GEOMETRY_TENSION_SPLINE_HPP_
14 
15 /*****************************************************************************
16 ** Includes
17 *****************************************************************************/
18 
19 #include "tension_function.hpp"
20 #include <ecl/config/macros.hpp>
21 #include <ecl/concepts/macros.hpp>
22 #include <ecl/concepts/streams.hpp>
24 #include <ecl/containers/array.hpp>
27 #include "macros.hpp"
28 
29 /*****************************************************************************
30 ** Namespaces
31 *****************************************************************************/
32 
33 namespace ecl {
34 
35 /*****************************************************************************
36 ** Forward Declarations
37 *****************************************************************************/
38 
39 class TensionSpline;
40 
41 namespace blueprints {
42 
43 class C2TensionSpline;
44 
45 } // namespace blueprints
46 
47 /*****************************************************************************
48 ** BluePrintFactory
49 *****************************************************************************/
58 template<>
60 public:
74  static blueprints::C2TensionSpline Natural(const Array<double>& x_set, const Array<double>& y_set,
75  const double &tau) ecl_assert_throw_decl(StandardException);
76 
77  virtual ~BluePrintFactory() {};
78 };
79 
80 /*****************************************************************************
81 ** Interface [TensionSpline]
82 *****************************************************************************/
95 class ecl_geometry_PUBLIC TensionSpline : public BluePrintFactory< TensionSpline > {
96  public:
97  /******************************************
98  ** Typedefs
99  *******************************************/
102  /******************************************
103  ** Constructors
104  *******************************************/
112  virtual ~TensionSpline() {};
139  template<typename Derived>
141  blueprint.implementApply(*this);
142  }
143 
144  /******************************************
145  ** Access
146  *******************************************/
148 
158  double operator()(const double &x) const ecl_assert_throw_decl(StandardException);
169  double derivative(const double &x) const ecl_assert_throw_decl(StandardException);
178  double dderivative(const double &x) const ecl_assert_throw_decl(StandardException);
179 
187  const Array<double>& domain() const { return discretised_domain; }
188 
189  /******************************************
190  ** Streaming
191  *******************************************/
204  template <typename OutputStream>
205  friend OutputStream& operator << (OutputStream &ostream, const TensionSpline &tension_spline);
206 
207  private:
209  Array<TensionFunction> functions; // N tension_functions
210  double tension;
211 };
212 
213 /*****************************************************************************
214 ** Interface [Minimum/Maximum][TensionSpline]
215 *****************************************************************************/
216 
217 /*****************************************************************************
218 ** Implementation [TensionSpline][Streaming]
219 *****************************************************************************/
220 
221 template <typename OutputStream>
222 OutputStream& operator << (OutputStream &ostream, const TensionSpline &tension_spline) {
223 
225 
226  for ( unsigned int i = 0; i < tension_spline.functions.size(); ++i ) {
227  ostream << tension_spline.functions[i] << "\n";
228  }
229  ostream.flush();
230  return ostream;
231 }
232 
233 /*****************************************************************************
234 ** BluePrints
235 *****************************************************************************/
236 
237 namespace blueprints {
238 
239 /*****************************************************************************
240 ** Interface [C2TensionSpline]
241 *****************************************************************************/
242 
252 class ecl_geometry_PUBLIC C2TensionSpline : public ecl::BluePrint<C2TensionSpline> {
253  public:
265 
280 
288  base_type instantiate();
289 
297  void apply(base_type& spline) const;
298 
299  private:
303  double tension;
304 };
305 
306 } // namespace blueprints
307 } // namespace ecl
308 
309 #endif /* ECL_GEOMETRY_TENSION_SPLINE_HPP_ */
Embedded control libraries.
Blueprint factory for tension splines.
Storage container for a tension spline interpolation.
Array< double > discretised_domain
void implementApply(BaseType &object) const
Blueprint for generating a tension spline satisfying C2 constraints.
C2TensionSpline()
Default constructor.
OutputStream & operator<<(OutputStream &ostream, const Void void_object)
#define ecl_geometry_PUBLIC
Definition: macros.hpp:37
ecl::TensionSpline base_type
Abstract representation of the class to be instantiated/configured.
TensionSpline(const BluePrint< Derived > &blueprint)
Blueprint constructor.
const Array< double > & domain() const
The discretised domain for this spline.
C2TensionSpline(const ecl::Array< double > &x_set, const ecl::Array< double > &y_set, const double &tau) ecl_assert_throw_decl(ecl base_type instantiate()
Constructor that properly configures/initialises the blueprint.
Representations for the tension function..
BluePrintFactory< TensionSpline > Factory
Generates blueprints for this class.
TensionSpline()
Default constructor.
#define ecl_assert_throw_decl(exception)
#define ecl_compile_time_concept_check(Model)
Array< TensionFunction > functions
#define ECL_PUBLIC


ecl_geometry
Author(s): Daniel Stonier
autogenerated on Mon Jun 10 2019 13:08:37