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<>
59 class ECL_PUBLIC BluePrintFactory< TensionSpline > {
60 public:
74  static blueprints::C2TensionSpline Natural(const Array<double>& x_set, const Array<double>& y_set,
75  const double &tau);
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  *******************************************/
100  typedef BluePrintFactory< TensionSpline > Factory;
102  /******************************************
103  ** Constructors
104  *******************************************/
111  TensionSpline () {};
112  virtual ~TensionSpline() {};
139  template<typename Derived>
140  TensionSpline(const BluePrint< Derived > &blueprint) {
141  blueprint.implementApply(*this);
142  }
143 
144  /******************************************
145  ** Access
146  *******************************************/
147  friend class blueprints::C2TensionSpline;
148 
158  double operator()(const double &x) const;
169  double derivative(const double &x) const;
178  double dderivative(const double &x) const;
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:
208  Array<double> discretised_domain; // N+1 x_i's
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:
257  typedef ecl::TensionSpline base_type;
263  C2TensionSpline() {};
264  ~C2TensionSpline() {};
265 
279  C2TensionSpline(const ecl::Array<double>& x_set, const ecl::Array<double>& y_set, const double &tau);
280 
288  base_type instantiate();
289 
297  void apply(base_type& spline) const;
298 
299  private:
300  ecl::Array<double> x_data;
301  ecl::Array<double> y_data;
302  ecl::Array<double> yddot_data;
303  double tension;
304 };
305 
306 } // namespace blueprints
307 } // namespace ecl
308 
309 #endif /* ECL_GEOMETRY_TENSION_SPLINE_HPP_ */
ecl_compile_time_concept_check
#define ecl_compile_time_concept_check(Model)
ecl::operator<<
OutputStream & operator<<(OutputStream &ostream, const Array< ElementType, ArraySize > &array)
ecl::TensionSpline
Storage container for a tension spline interpolation.
Definition: tension_spline.hpp:101
ecl_geometry_PUBLIC
#define ecl_geometry_PUBLIC
Definition: macros.hpp:37
macros.hpp
Macros for ecl geometry.
streams.hpp
blueprints.hpp
ecl::TensionSpline::functions
Array< TensionFunction > functions
Definition: tension_spline.hpp:217
array.hpp
ecl::BluePrint
ecl::StreamConcept
standard_exception.hpp
containers.hpp
ecl::Array< double >
macros.hpp
ecl
Embedded control libraries.
ECL_PUBLIC
#define ECL_PUBLIC
tension_function.hpp
Representations for the tension function..


ecl_geometry
Author(s): Daniel Stonier
autogenerated on Wed Mar 2 2022 00:16:39