12 #ifndef ECL_GEOMETRY_TENSION_FUNCTION_HPP_ 13 #define ECL_GEOMETRY_TENSION_FUNCTION_HPP_ 20 #include <ecl/config/macros.hpp> 21 #include <ecl/concepts/macros.hpp> 22 #include <ecl/concepts/streams.hpp> 23 #include <ecl/containers/array.hpp> 24 #include <ecl/errors/compile_time_assert.hpp> 25 #include <ecl/utilities/blueprints.hpp> 26 #include <ecl/formatters/floats.hpp> 38 class TensionFunction;
40 namespace blueprints {
42 class TensionSecondDerivativeInterpolation;
58 class ECL_PUBLIC BluePrintFactory< TensionFunction > {
77 static blueprints::TensionSecondDerivativeInterpolation Interpolation(
const double x_i,
const double y_i,
const double yddot_i,
78 const double x_f,
const double y_f,
const double yddot_f);
80 virtual ~BluePrintFactory() {};
110 class ECL_PUBLIC TensionFunction :
public BluePrintFactory< TensionFunction > {
122 virtual ~TensionFunction() {}
145 template<
typename Derived>
146 TensionFunction(
const BluePrint< Derived > &blueprint) {
147 blueprint.implementApply(*
this);
163 double derivative(
const double &tau,
const double &x)
const;
175 double dderivative(
const double &tau,
const double &x)
const;
190 double operator ()(
const double &tau,
const double &x)
const;
195 friend class blueprints::TensionSecondDerivativeInterpolation;
198 template <
typename OutputStream>
199 friend OutputStream&
operator << (OutputStream &ostream,
const TensionFunction &
function);
222 template <
typename OutputStream>
229 double h =
function.x_f -
function.x_0;
230 if ( (
function.z_0 == 0.0 ) && (
function.z_f == 0.0 ) ) {
234 if (
function.z_0 != 0.0 ) {
235 ostream << format(
function.z_0) <<
"*sinh[tau(";
236 ostream << format(
function.x_f) <<
"-x)] + ";
238 if (
function.z_f != 0.0 ) {
239 ostream << format(
function.z_f) <<
"*sinh[tau(x-";
240 ostream << format(
function.x_0) <<
")]}/[tau^2 sinh(";
241 ostream << format(
function.x_f -
function.x_0) <<
"*tau)]";
246 ostream << format(
function.y_0/h) <<
"-";
247 ostream << format(
function.z_0/h) <<
"/tau^2)(";
248 ostream << format(
function.x_f) <<
"-x)\n";
250 ostream << format(
function.y_f/h) <<
"-";
251 ostream << format(
function.z_f/h) <<
"/tau^2)(x-";
252 ostream << format(
function.x_0) <<
")\n";
262 namespace blueprints {
284 class ECL_PUBLIC TensionSecondDerivativeInterpolation :
public ecl::BluePrint<TensionSecondDerivativeInterpolation> {
302 TensionSecondDerivativeInterpolation(
const double x_i,
const double y_i,
const double yddot_i,
303 const double x_f,
const double y_f,
const double yddot_f) :
306 yddot_initial(yddot_i),
311 virtual ~TensionSecondDerivativeInterpolation() {}
329 void apply(base_type&
function)
const;
332 double x_initial, y_initial, yddot_initial;
333 double x_final, y_final, yddot_final;
Defines validating functionality for the streams concept.
OutputStream & operator<<(OutputStream &ostream, const Void void_object)
Output stream operator for Void objects.
Representation of a tension function.
#define ecl_compile_time_concept_check(Model)
Compile time concept checking assertion.
This is a parent template for blueprints using crtp.