#include <PsPolatorAndPsNumericType.h>
Inheritance diagram for PsPolator< Type >:


Public Methods | |
| PsPolator (PsnAbstractFifo< Type > *) | |
| do not use : constructor with associated history fifo | |
| PsPolator (void) | |
| default constructor | |
| PsPolator (int numberOfValuesForMaxPrecision) | |
| contructor defining the number of values needed for a miximum precision level | |
| virtual | ~PsPolator (void) |
| Destructor. | |
| const Type & | polate (const int requestedPrecisionLevel, const PsDate &t, int &distance, Type &resultPlaceHolder) const |
| generic polation member function : not virtual, and called by the output. | |
| virtual const Type & | interpolate (Type &resultPlaceHolder, const int interpolateLevel, const PsDate &dateNeeded, const PsDate &dateAfter, const Type &valueAfter, const PsDate &dateBefore, int offsetToMostRecentOfDateBefore) const |
| Interpolation member function. | |
| virtual const Type & | extrapolate (Type &resultPlaceHolder, const int requestedPrecisionLevel, const PsDate &t, const PsDate &tIndice) const |
| extrapolate member function | |
| virtual const Type & | antepolate (Type &resultPlaceHolder, const int requestedPrecisionLevel, const PsDate &t, const PsDate &tIndice, unsigned int indice) const |
| La méthode d'antépolation. | |
| void | setFifo (PsnAbstractFifo< Type > *fifo) |
| mise à jour de la file associé à l'interpolateur | |
Protected Methods | |
| int | getNumberOfPresentValues (int maxNeeded=-1) const |
| Le nombre de valeurs actuellement présentent dans la file. | |
| const Type & | get (const int indice) const |
| Aller chercher une valeur dans la file. | |
| const PsDate & | getDate (const int indice) const |
| Aller chercher la date d'une valeur dans la file. | |
Protected Attributes | |
| PsnAbstractFifo< Type > * | _fifo |
| pointeur sur la file des valeurs sur la output | |
Private Methods | |
| void | intialisePolator () |
| méthode commune aux différents constructeurs | |
strictly speeking, objects of this type never do any polations
Definition at line 275 of file PsPolatorAndPsNumericType.h.
|
||||||||||
|
do not use : constructor with associated history fifo
Definition at line 641 of file PsPolatorAndPsNumericType.h. References PsPolator< Type >::_fifo, and PsPolator< Type >::intialisePolator().
00642 : PsPolatorNT ( 0 ) 00643 { 00644 #ifdef _DEBUGTYPEUTIL 00645 cout << "PsPolator constructeur avec file" << endl; 00646 #endif 00647 00648 intialisePolator(); 00649 _fifo = file2 ; |
|
||||||||||
|
default constructor
Definition at line 620 of file PsPolatorAndPsNumericType.h. References PsPolator< Type >::intialisePolator().
00621 : PsPolatorNT ( 0 ) 00622 { 00623 #ifdef _DEBUGTYPEUTIL 00624 cout << "PsPolator constructeur sans file" << endl; 00625 #endif 00626 intialisePolator(); |
|
||||||||||
|
contructor defining the number of values needed for a miximum precision level
Definition at line 631 of file PsPolatorAndPsNumericType.h. References PsPolator< Type >::intialisePolator().
00632 : PsPolatorNT ( numberOfValuesForMaxPrecision ) 00633 { 00634 #ifdef _DEBUGTYPEUTIL 00635 cout << "PsPolator constructeur avec paramètre et sans file" << endl; 00636 #endif 00637 intialisePolator(); |
|
||||||||||
|
Destructor.
Definition at line 658 of file PsPolatorAndPsNumericType.h.
00660 {
|
|
||||||||||||||||||||||||||||
|
La méthode d'antépolation.
Reimplemented in PsNumericPolatorT< Type >. Definition at line 931 of file PsPolatorAndPsNumericType.h. References PsPolator< Type >::get(), and PsDate. Referenced by PsPolator< Type >::polate().
00939 {
00940 #ifdef _DEBUGTYPEUTIL
00941 cout << "*********************************************" << endl ;
00942 cout << "PsPolator::antepolate" << endl;
00943 cout << "PsDate t <----- : " << t << endl ;
00944 cout << "PsDate tIndice <----- : " << tIndice << endl ;
00945 cout << "niveau interpolate : " << requestedPrecisionLevel << endl ;
00946 cout << "indice dernier: " << indice << endl ;
00947 cout << "*********************************************" << endl ;
00948 #endif
00949
00950 return get(indice);
00951
|
|
||||||||||||||||||||||||
|
extrapolate member function
Reimplemented in PsNumericPolatorT< Type >. Definition at line 909 of file PsPolatorAndPsNumericType.h. References PsPolator< Type >::get(), and PsDate. Referenced by PsPolator< Type >::polate().
00916 {
00917 #ifdef _DEBUGTYPEUTIL
00918 cout << "*********************************************" << endl ;
00919 cout << "PsPolator<Type>::extrapolate PAR DEFAUT" << endl;
00920 cout << "PsDate t <----- : " << t << endl ;
00921 cout << "PsDate tIndice <----- : " << tIndice << endl ;
00922 cout << "niveau interpolation : " << requestedPrecisionLevel << endl ;
00923 cout << "indice dernier: " << requestedPrecisionLevel << endl ;
00924 cout << "*********************************************" << endl ;
00925 #endif
00926
00927 return get(0);
00928
|
|
||||||||||
|
Aller chercher une valeur dans la file.
Definition at line 663 of file PsPolatorAndPsNumericType.h. References PsPolator< Type >::_fifo. Referenced by PsPolator< Type >::antepolate(), PsPolator< Type >::extrapolate(), PsPolator< Type >::interpolate(), and PsPolator< Type >::polate().
00665 {
00666 return _fifo->getPreceedingValue(value) ;
|
|
||||||||||
|
Aller chercher la date d'une valeur dans la file. Cette méthode fonctionne selon le même principe que get Definition at line 670 of file PsPolatorAndPsNumericType.h. References PsPolator< Type >::_fifo, and PsDate. Referenced by PsPolator< Type >::polate().
00672 {
00673 #ifdef _DEBUGTYPEUTIL
00674 cerr<<"PsPolator<Type>::"<<this<<"::getDate ("<<value<<") "<<endl;
00675 #endif
00676 return _fifo->getPreceedingDate(value) ;
|
|
||||||||||
|
Le nombre de valeurs actuellement présentent dans la file.
Definition at line 692 of file PsPolatorAndPsNumericType.h. References PsPolator< Type >::_fifo. Referenced by PsPolator< Type >::polate().
00694 {
00695 #ifdef _DEBUGTYPEUTIL
00696 cerr<<"PsPolator<Type>::getNumberOfPresentValues"<<endl;
00697 #endif
00698 return(_fifo->getNumberOfPresentValues(maxNeeded));
|
|
||||||||||||||||||||||||||||||||||||
|
Interpolation member function.
Reimplemented in PsNumericPolatorT< Type >. Definition at line 872 of file PsPolatorAndPsNumericType.h. References PsPolator< Type >::get(), and PsDate. Referenced by PsPolator< Type >::polate().
00881 {
00882
00883 #ifdef _DEBUGTYPEUTIL
00884 cout << "*********************************************" << endl ;
00885 cout << "PsPolator::interpolation PAR DEFAUT" << endl;
00886 cout << "PsDate dateAfter <----- : " << dateAfter << endl ;
00887 cout << "PsDate dateNeeded <----- : " << dateNeeded << endl ;
00888 cout << "PsDate dateBefore <----- : " << dateBefore << endl ;
00889 cout << "Type : valueAfter " << valueAfter << endl ;
00890 cout << "int : offsetToMostRecentOfDateBefore " << offsetToMostRecentOfDateBefore << endl ;
00891 #endif
00892
00893 if ( (dateAfter - dateNeeded) <= (dateNeeded - dateBefore) )
00894 {
00895 resultPlaceHolder = valueAfter ;
00896 }
00897 else
00898 {
00899 resultPlaceHolder = get (offsetToMostRecentOfDateBefore) ;
00900 }
00901
00902 return resultPlaceHolder ;
00903
|
|
|||||||||
|
méthode commune aux différents constructeurs
Definition at line 652 of file PsPolatorAndPsNumericType.h. References PsPolator< Type >::_fifo. Referenced by PsPolator< Type >::PsPolator().
00653 {
00654 _fifo = NULL ;
|
|
||||||||||||||||||||||||
|
generic polation member function : not virtual, and called by the output. This member function calls the other member functions when polation is needed.
Definition at line 701 of file PsPolatorAndPsNumericType.h. References PsPolator< Type >::_fifo, PsPolator< Type >::antepolate(), PsPolator< Type >::extrapolate(), PsPolator< Type >::get(), PsPolator< Type >::getDate(), PsPolator< Type >::getNumberOfPresentValues(), PsPolator< Type >::interpolate(), and PsDate.
00708 {
00709 #ifdef _DEBUGTYPEUTIL
00710 cerr<<"PsPolator<Type>::"<<this<<"::polate ("<<requestedPrecisionLevel<<","<<t<<") "<<endl;
00711 #endif
00712
00713
00714 int requestedPrecisionLevelPossible = requestedPrecisionLevel ;
00715 //_fifo->initialiseContext() ;
00716 int NumberOfPresentValues = getNumberOfPresentValues(requestedPrecisionLevel+1) ;
00717
00718 #ifdef _DEBUGTYPEUTIL
00719 cerr<<"PsPolator<Type>::"<<this<<"::polate : NumberOfPresentValues : "<<NumberOfPresentValues<<endl;
00720 #endif
00721
00722 if (NumberOfPresentValues==0) {
00723 throw PsEmptyFifoException ("PsPolator::polate") ;
00724 }
00725
00726 // Same test for antepolate and extrapolate
00727 // ------------------------------------------------
00728 if (NumberOfPresentValues<=requestedPrecisionLevel) {
00729
00730 requestedPrecisionLevelPossible = NumberOfPresentValues-1;
00731
00732 }
00733
00734 const PsDate & dateDerniereValeur( getDate( 0 ) );
00735
00736 assert(dateDerniereValeur != -1) ;
00737
00738 if (dateDerniereValeur <t)
00739 {
00740 #ifdef _DEBUGTYPEUTIL
00741 cerr<<"Cas de l'extrapolation"<<endl;
00742 #endif
00743
00744 distanceTemporelle = t - dateDerniereValeur ;
00745
00746
00747 // On est dans le cas d'une extrapolation
00748 assert (t != dateDerniereValeur) ;
00749 assert ((NumberOfPresentValues != 1)||(requestedPrecisionLevelPossible == 0)) ;
00750 return extrapolate(resultPlaceHolder,
00751 requestedPrecisionLevelPossible,
00752 t,
00753 dateDerniereValeur );
00754 }
00755
00756 // On est dans la configuration suivante :
00757 // t <= DateDerniereValeurs
00758 // ***********
00759 // - Soit on recupere une date dans la file qui correspond a t
00760 // - Soit on interpole
00761 // - soit on antépole
00762
00763
00764
00765 int indice = 0 ; // l'indice le plus proche dans la file correspondant a la date t
00766
00767 unsigned int numberOfValuesInFifoNeededToContinueExamination = 2 ;
00768
00769 PsDate const * examinedDate = & dateDerniereValeur ;
00770 PsDate const * dateExaminedBefore = NULL ;
00771 Type const * valueExaminedBefore = NULL ;
00772
00773 bool pasTrouve ; // end of iteration
00774 bool exact ; // interpolation needed
00775
00776 if (*examinedDate == t)
00777 {
00778 pasTrouve = false ;
00779 exact = true ;
00780 }
00781 else
00782 {
00783 pasTrouve = true ;
00784 exact = false ;
00785 }
00786 #ifdef _DEBUGTYPEUTIL
00787 cerr <<"PsPolator<Type>::polate : Boucle de recherche de valeurs...."<<t<< endl ;
00788 #endif
00789
00790 while ( (pasTrouve) &&
00791 (_fifo->getNumberOfPresentValues(numberOfValuesInFifoNeededToContinueExamination) >= numberOfValuesInFifoNeededToContinueExamination ) )
00792 {
00793
00794 #ifdef _DEBUGTYPEUTIL
00795 cerr<<"variables de boucles : "
00796 <<pasTrouve<<" "
00797 <<examinedDate<<" "
00798 <<exact<<" "
00799 <<t<<" "
00800 <<indice<<" "
00801 <<numberOfValuesInFifoNeededToContinueExamination<<endl;
00802 #endif
00803
00804 dateExaminedBefore = examinedDate ;
00805 valueExaminedBefore = & get (indice) ;
00806 indice ++ ;
00807 examinedDate = & getDate ( indice ) ;
00808
00809 if ( *examinedDate == t ) {
00810
00811 pasTrouve = false ;
00812 exact = true ;
00813
00814 }
00815 else if ( *examinedDate < t )
00816 {
00817
00818 pasTrouve = false ;
00819 exact = false ;
00820 }
00821
00822 ++numberOfValuesInFifoNeededToContinueExamination ;
00823
00824 #ifdef _DEBUGATTRIBUTSMOME
00825 if (indice > 4) cerr<<"On demande loin "<<NumberOfPresentValues<<" "<<examinedDate<<" "<<t<<endl;
00826 #endif
00827 }
00828
00829 if (*examinedDate > t) {//because of relaxed coherance, this can sometimes happen
00830 return antepolate(resultPlaceHolder,
00831 requestedPrecisionLevelPossible,
00832 t,
00833 *examinedDate,
00834 indice );
00835 }
00836
00837 /* here, dateOfOldestValueAvailable <= examinedDate <= t <= oldExaminedDate <= dateDerniereValeur, with examinedDate == t if exact */
00838
00839 distanceTemporelle = t - *examinedDate ;
00840 if ( ! exact) {
00841 assert ( dateExaminedBefore != NULL) ;
00842 assert ( valueExaminedBefore != NULL ) ;
00843 return interpolate ( resultPlaceHolder,
00844 requestedPrecisionLevelPossible,
00845 t,
00846 *dateExaminedBefore,
00847 *valueExaminedBefore,
00848 *examinedDate,
00849 indice) ;
00850 }
00851 else {
00852 return get( indice ) ;
00853 }
|
|
||||||||||
|
mise à jour de la file associé à l'interpolateur
Definition at line 682 of file PsPolatorAndPsNumericType.h. References PsPolator< Type >::_fifo.
00684 {
00685 #ifdef _DEBUGTYPEUTIL
00686 cerr<<"PsPolator<Type>::setFifo "<<endl;
00687 #endif
00688 _fifo = fifo ;
|
|
|||||
|
pointeur sur la file des valeurs sur la output
Definition at line 375 of file PsPolatorAndPsNumericType.h. Referenced by PsPolator< Type >::get(), PsPolator< Type >::getDate(), PsPolator< Type >::getNumberOfPresentValues(), PsPolator< Type >::intialisePolator(), PsPolator< Type >::polate(), PsPolator< Type >::PsPolator(), and PsPolator< Type >::setFifo(). |
| Documentation generated on Mon Nov 25 15:26:20 2002 |
Generated with doxygen 1.2.12 by Dimitri van Heesch , 1997-2001 |