1 #ifndef __JTOOLS__JHERMITESPLINE__
2 #define __JTOOLS__JHERMITESPLINE__
21 namespace JPP {
using namespace JTOOLS; }
45 template<
class JElement_t,
template<
class,
class>
class JCollection_t,
class JDistance_t>
47 public JCollection_t<JElement_t, JDistance_t>,
61 typedef typename collection_type::iterator
iterator;
76 if (this->size() >= 2
u) {
81 i->setU((j->getY() - i->getY()) / this->
getDistance(i->getX(), j->getX()));
87 i->setU((j->getY() - i->getY()) / this->
getDistance(i->getX(), j->getX()));
90 for (
iterator k = this->begin(), i =
k++,
j =
k++;
k != this->end(); ++i, ++
j, ++
k) {
91 j->setU(0.5 * ((j->getY() - i->getY()) / this->
getDistance(i->getX(), j->getX()) +
92 (
k->getY() - j->getY()) / this->
getDistance(j->getX(),
k->getX())));
97 for (
iterator j = this->begin(), i = j++; j != this->end(); ++i, ++
j) {
98 if (i->getY() == j->getY()) {
103 for (
iterator j = this->begin(), i = j++; j != this->end(); ++i, ++
j) {
106 const ordinate_type w = (i->getU()*i->getU() + j->getU()*j->getU());
112 i->setU(v*i->getU());
113 j->setU(v*j->getU());
159 template<
class JElement_t,
160 template<
class,
class>
class JCollection_t,
169 template<
class JElement_t,
template<
class,
class>
class JCollection_t,
class JDistance_t>
175 public JFunction<typename JElement_t::abscissa_type,
176 typename JResultType<typename JElement_t::ordinate_type>::result_type>
189 typedef typename collection_type::iterator
iterator;
215 if (this->size() <= 1
u) {
223 if ((p == this->begin() && this->
getDistance(x, (p++)->getX()) > distance_type::precision) ||
224 (p == this->end() && this->
getDistance((--p)->getX(), x) > distance_type::precision)) {
231 const double dx = this->
getDistance(p->getX(), q->getX());
232 const double t = this->
getDistance(p->getX(), x) / dx;
234 return h00(t)*p->getY() +
h10(t)*p->getU()*dx +
h01(t)*q->getY() +
h11(t)*q->getU()*dx;
239 using collection_type::h00;
240 using collection_type::h10;
241 using collection_type::h01;
242 using collection_type::h11;
249 template<
class JElement_t,
template<
class,
class>
class JCollection_t,
class JDistance_t>
255 public JFunction<typename JElement_t::abscissa_type,
256 JResultDerivative<typename JResultType<typename JElement_t::ordinate_type>::result_type> >
269 typedef typename collection_type::iterator
iterator;
295 if (this->size() <= 1
u) {
304 if ((p == this->begin() && this->
getDistance(x, (p++)->getX()) > distance_type::precision) ||
305 (p == this->end() && this->
getDistance((--p)->getX(), x) > distance_type::precision)) {
312 const double dx = this->
getDistance(p->getX(), q->getX());
313 const double t = this->
getDistance(p->getX(), x) / dx;
315 result.f =
h00 (t)*p->getY() +
h10 (t)*p->getU()*dx +
h01 (t)*q->getY() +
h11 (t)*q->getU()*dx;
324 using collection_type::h00;
325 using collection_type::h10;
326 using collection_type::h01;
327 using collection_type::h11;
329 using collection_type::h00p;
330 using collection_type::h10p;
331 using collection_type::h01p;
332 using collection_type::h11p;
349 template<
class JElement_t,
template<
class,
class>
class JCollection_t,
class JDistance_t>
355 public JFunction<typename JElement_t::abscissa_type,
356 JResultPDF<typename JResultType<typename JElement_t::ordinate_type>::result_type> >
369 typedef typename collection_type::iterator
iterator;
395 if (this->size() <= 1
u) {
403 if (p == this->begin() && this->
getDistance(x, (p++)->getX()) > distance_type::precision) {
412 result.V = this->rbegin()->getIntegral();
420 }
else if (p == this->end() && this->
getDistance((--p)->getX(), x) > distance_type::precision) {
428 result.v = this->rbegin()->getIntegral();
429 result.V = this->rbegin()->getIntegral();
440 const double dx = this->
getDistance(p->getX(), q->getX());
441 const double t = this->
getDistance(p->getX(), x) / dx;
443 result.f =
h00 (t)*p->getY() +
h10 (t)*p->getU()*dx +
h01 (t)*q->getY() +
h11 (t)*q->getU()*dx;
445 result.v = (p->getIntegral() +
446 (
H00 (t)*p->getY() +
H10 (t)*p->getU()*dx +
H01 (t)*q->getY() +
H11 (t)*q->getU()*dx)*dx);
447 result.V = this->rbegin()->getIntegral();
455 using collection_type::h00;
456 using collection_type::h10;
457 using collection_type::h01;
458 using collection_type::h11;
460 using collection_type::h00p;
461 using collection_type::h10p;
462 using collection_type::h01p;
463 using collection_type::h11p;
465 using collection_type::H00;
466 using collection_type::H10;
467 using collection_type::H01;
468 using collection_type::H11;
475 if (!this->empty()) {
481 for (
iterator j = this->begin(), i =
j++;
j != this->end(); ++i, ++
j) {
483 const double dx = this->
getDistance(i->getX(),
j->getX());
490 j->setIntegral(i->getIntegral() + v +
w);
505 template<
class JElement_t,
506 template<
class,
class>
class JCollection_t,
507 class JResult_t =
typename JElement_t::ordinate_type,
511 public JFunction1D<typename JElement_t::abscissa_type, JResult_t>
545 template<
class JKey_t,
547 template<
class,
class,
class>
class JMap_t,
551 public JMap_t<JKey_t, JValue_t, JDistance_t>,
566 typedef typename collection_type::iterator
iterator;
618 for (
iterator i = this->begin(); i != this->end(); ++i) {
637 template<
class JElement_t,
638 template<
class,
class>
class JCollection_t,
641 inline typename JElement_t::ordinate_type
650 if (input.getSize() > 1) {
652 output.
put(input.begin()->getX(), V);
654 for (const_iterator
j = input.begin(), i =
j++;
j != input.end(); ++i, ++
j) {
656 const double dx = input.getDistance(i->getX(),
j->getX());
657 const ordinate_type y = i->getY() +
j->getY();
658 const ordinate_type z = i->getU() -
j->getU();
660 const ordinate_type
v = dx * 0.50 * y;
661 const ordinate_type
w = dx * 1.00 * z*dx/12.0;
665 output.
put(
j->getX(), V);
682 template<
class JElement_t,
683 template<
class,
class>
class JCollection_t,
685 inline typename JElement_t::ordinate_type
693 if (input.getSize() > 1) {
695 for (const_iterator i = input.begin(); i != input.end(); ++i) {
696 output.
put(i->getX(), i->getIntegral());
699 return input.rbegin()->getIntegral();
then fatal No hydrophone data file $HYDROPHONE_TXT fi sort gr k
Exception for a functional operation.
This include file containes various data structures that can be used as specific return types for the...
static const JZero zero
Function object to assign zero value.
Definition of zero value for any class.
double getDistance(const JFirst_t &first, const JSecond_t &second)
Get distance between objects.
Exception for missing value.
Exception for division by zero.
Exception for accessing a value in a collection that is outside of its range.