Back to index

salome-kernel  6.5.0
Classes | Public Types | Public Member Functions | Private Attributes | Friends
CalciumCouplingPolicy Class Reference

#include <CalciumCouplingPolicy.hxx>

Inheritance diagram for CalciumCouplingPolicy:
Inheritance graph
[legend]
Collaboration diagram for CalciumCouplingPolicy:
Collaboration graph
[legend]

List of all members.

Classes

struct  BoundedDataIdProcessor
struct  BoundedDataIdProcessor< DataManipulator, typename boost::enable_if< boost::is_float< typename DataManipulator::InnerType > >::type >
struct  DisconnectProcessor
struct  EraseDataIdBeforeOrAfterTagProcessor
struct  EraseDataIdProcessor
struct  InternalDataIdContainer

Public Types

typedef
CalciumTypes::DependencyType 
DependencyType
typedef CalciumTypes::DateCalSchem DateCalSchem
typedef
CalciumTypes::InterpolationSchem 
InterpolationSchem
typedef
CalciumTypes::ExtrapolationSchem 
ExtrapolationSchem
typedef
CalciumTypes::DisconnectDirective 
DisconnectDirective
typedef double TimeType
typedef long TagType
typedef std::pair< TimeType,
TagType
DataId
typedef
InternalDataIdContainer
< TimeType, TagType
DataIdContainer
typedef std::vector< DataId >
::iterator 
iterator

Public Member Functions

 CalciumCouplingPolicy ()
void setDependencyType (DependencyType dependencyType)
DependencyType getDependencyType () const
void setStorageLevel (size_t storageLevel)
size_t getStorageLevel () const
void setDateCalSchem (DateCalSchem dateCalSchem)
DateCalSchem getDateCalSchem () const
void setAlpha (double alpha)
double getAlpha () const
void setDeltaT (double deltaT)
double getDeltaT () const
void setInterpolationSchem (InterpolationSchem interpolationSchem)
void setExtrapolationSchem (ExtrapolationSchem extrapolationSchem)
InterpolationSchem getInterpolationSchem () const
ExtrapolationSchem getExtrapolationSchem () const
TimeType getTime (const DataId &dataId) const
TagType getTag (const DataId &dataId) const
template<typename AssocContainer >
bool isDataIdConveniant (AssocContainer &storedDatas, const typename AssocContainer::key_type &expectedDataId, bool &isEqual, bool &isBounded, typename AssocContainer::iterator &wDataIt1) const
TimeType getEffectiveTime (TimeType ti, TimeType tf)
void disconnect (bool provideLastGivenValue)
template<typename Container >
bool isDataIdConveniant (Container &storedDatas, const typename Container::key_type &expectedDataId, bool &isEqual, bool &isBounded, typename Container::iterator &wDataIt1) const
virtual void wakeupWaiting ()

Private Attributes

DependencyType _dependencyType
size_t _storageLevel
DateCalSchem _dateCalSchem
InterpolationSchem _interpolationSchem
ExtrapolationSchem _extrapolationSchem
double _alpha
double _deltaT
DisconnectDirective _disconnectDirective

Friends

class InternalDataIdContainer
class BoundedDataIdProcessor
class EraseDataIdProcessor
class EraseDataIdBeforeOrAfterTagProcessor
class DisconnectProcessor

Detailed Description

Definition at line 45 of file CalciumCouplingPolicy.hxx.


Member Typedef Documentation

Definition at line 103 of file CalciumCouplingPolicy.hxx.

Definition at line 104 of file CalciumCouplingPolicy.hxx.

Definition at line 59 of file CalciumCouplingPolicy.hxx.

Definition at line 58 of file CalciumCouplingPolicy.hxx.

Definition at line 62 of file CalciumCouplingPolicy.hxx.

Definition at line 61 of file CalciumCouplingPolicy.hxx.

Definition at line 60 of file CalciumCouplingPolicy.hxx.

Definition at line 105 of file CalciumCouplingPolicy.hxx.

Definition at line 102 of file CalciumCouplingPolicy.hxx.

Definition at line 101 of file CalciumCouplingPolicy.hxx.


Constructor & Destructor Documentation


Member Function Documentation

void CalciumCouplingPolicy::disconnect ( bool  provideLastGivenValue)

Definition at line 105 of file CalciumCouplingPolicy.cxx.

                                                                 {

  if (provideLastGivenValue) {
#ifdef MYDEBUG
    std::cout << "-------- CalciumCouplingPolicy::disconnect CP_CONT  ------------------" << std::endl;
#endif
    _disconnectDirective = CalciumTypes::CONTINUE;
  } else {
#ifdef MYDEBUG
    std::cout << "-------- CalciumCouplingPolicy::disconnect CP_ARRET  ------------------" << std::endl;
#endif
    _disconnectDirective = CalciumTypes::STOP;
  }

  //Wakeup get data if any
  wakeupWaiting();  
}

Here is the call graph for this function:

Definition at line 67 of file CalciumCouplingPolicy.cxx.

{ return _alpha; }

Definition at line 55 of file CalciumCouplingPolicy.cxx.

{ return _dateCalSchem; }

Definition at line 76 of file CalciumCouplingPolicy.cxx.

{return _deltaT;}

Definition at line 39 of file CalciumCouplingPolicy.cxx.

{ return _dependencyType;}

Definition at line 96 of file CalciumCouplingPolicy.cxx.

                                                                          {
  if ( _dateCalSchem == CalciumTypes::TI_SCHEM )  return ti;
  if ( _dateCalSchem == CalciumTypes::TF_SCHEM )  return tf;
  
  //CalciumTypes::ALPHA_SCHEM
  return tf*_alpha + ti*(1-_alpha);
}

Definition at line 92 of file CalciumCouplingPolicy.cxx.

{ return _extrapolationSchem; };

Definition at line 91 of file CalciumCouplingPolicy.cxx.

{ return _interpolationSchem; };

Definition at line 47 of file CalciumCouplingPolicy.cxx.

{return _storageLevel;}
TagType CalciumCouplingPolicy::getTag ( const DataId dataId) const [inline]

Definition at line 111 of file CalciumCouplingPolicy.hxx.

{ return dataId.second;}
TimeType CalciumCouplingPolicy::getTime ( const DataId dataId) const [inline]

Definition at line 110 of file CalciumCouplingPolicy.hxx.

{ return dataId.first;}
template<typename Container >
bool CouplingPolicy::isDataIdConveniant ( Container &  storedDatas,
const typename Container::key_type &  expectedDataId,
bool isEqual,
bool isBounded,
typename Container::iterator &  wDataIt1 
) const [inline, inherited]

Definition at line 77 of file CouplingPolicy.hxx.

                                                                        {
    typedef typename Container::key_type   key_type;
    typedef typename Container::value_type value_type;
    typedef typename Container::iterator iterator;
    isBounded = false;
    FindKeyPredicate<value_type> fkp(expectedDataId);
    wDataIt1  = std::find_if(storedDatas.begin(),storedDatas.end(),fkp);
    isEqual   = (wDataIt1 != storedDatas.end());
    std::cout << "-------- Generic isDataIdConvenient : isEqual : " << isEqual << " , isBounded " << isBounded << std::endl;
    return isEqual || isBounded;
  }
template<typename AssocContainer >
bool CalciumCouplingPolicy::isDataIdConveniant ( AssocContainer &  storedDatas,
const typename AssocContainer::key_type &  expectedDataId,
bool isEqual,
bool isBounded,
typename AssocContainer::iterator &  wDataIt1 
) const

Definition at line 292 of file CalciumCouplingPolicy.hxx.

                                                                                                                                    {
 
  // Rem : le type key_type == DataId
  typedef typename AssocContainer::key_type key_type;
  AdjacentFunctor< key_type > af(expectedDataId);
  if ( _dependencyType == CalciumTypes::TIME_DEPENDENCY )
  {
#ifdef MYDEBUG
    std::cout << "-------- time expected : " << expectedDataId.first << std::endl;
    std::cout << "-------- time expected corrected : " << expectedDataId.first*(1.0-_deltaT) << std::endl;
#endif
    af.setMaxValue(key_type(expectedDataId.first*(1.0-_deltaT),0));
  }
  isBounded = false;

  // Rem 1 :
  // L'algo adjacent_find ne peut être utilisé avec l'AdjacentPredicate 
  //   - si la table contient un seul élément l'algorithme adjacent_find retourne end()
  //     que se soit l'élément attendu ou non
  //   - si la table contient deux éléments dont le dernier est celui recherché
  //     l'algorithme adjacent_find retourne end() aussi
  //   d'ou la necessité d'effectuer  un find avant ou d'écrire un algorithme ad hoc
 
  // Rem 2 :
  //
  // L'algo find_if ne peut être utilisé car il recopie l'AdjacentFunctor
  // qui ne peut alors pas mémoriser ses états précédents
  //    
 
  // Un codage en reverse serait plus efficace
  typename AssocContainer::iterator prev    = storedDatas.begin();
  typename AssocContainer::iterator current = prev;
  while ( (current != storedDatas.end()) && !af(current->first)  ) 
  {
#ifdef MYDEBUG
    std::cerr << "------- stored time : " << current->first << std::endl;
#endif
    //  if ( af(current->first) ) break;
    prev = current++;
  }

  isEqual = af.isEqual();
    
  // On considère qu'il n'est pas possible d'encadrer en dépendance itérative,
  // on se veut pas calculer d'interpolation. 
  if  ( _dependencyType == CalciumTypes::TIME_DEPENDENCY)  isBounded = af.isBounded();

  if ( isEqual ) wDataIt1 = current;
  else 
    if (isBounded) wDataIt1 = prev;
    else
      wDataIt1 = storedDatas.end();

#ifdef MYDEBUG
  std::cout << "-------- isDataIdConvenient : isEqual : " << isEqual << " , isBounded " << isBounded << std::endl;
#endif

  return isEqual || isBounded;
}

Here is the call graph for this function:

void CalciumCouplingPolicy::setAlpha ( double  alpha)

Definition at line 57 of file CalciumCouplingPolicy.cxx.

                                                 {
  MESSAGE( "CalciumCouplingPolicy::setAlpha: " << alpha );
  if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY )
    throw CalciumException(CalciumTypes::CPITVR,LOC("Can't set alpha on a port that is not time dependent"));
  
  if ( 0 <= alpha && alpha <= 1 ) _alpha = alpha; 
  else 
    throw CalciumException(CalciumTypes::CPRENA,LOC("alpha must be between [0,1]"));
}

Definition at line 48 of file CalciumCouplingPolicy.cxx.

                                                                                          {
  MESSAGE( "CalciumCouplingPolicy::setDateCalSchem: " << dateCalSchem );
  if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY )
    throw CalciumException(CalciumTypes::CPITVR,LOC("Can't set a temporal scheme on a port that is not time dependent"));
  _dateCalSchem = dateCalSchem;
}
void CalciumCouplingPolicy::setDeltaT ( double  deltaT)

Definition at line 69 of file CalciumCouplingPolicy.cxx.

                                                    {
  if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY )
    throw CalciumException(CalciumTypes::CPITVR,LOC("Can't set deltaT on a port that is not time dependent"));
  if ( 0 <= deltaT && deltaT <= 1 ) _deltaT = deltaT; 
  else 
    throw(CalciumException(CalciumTypes::CPRENA,LOC("deltaT must be between [0,1]")));
}

Definition at line 85 of file CalciumCouplingPolicy.cxx.

                                                                                                    {
  if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY )
    throw CalciumException(CalciumTypes::CPITVR,LOC("Can't set ExtrapolationSchem on a port that is not time dependent"));
_extrapolationSchem=extrapolationSchem;
}

Definition at line 78 of file CalciumCouplingPolicy.cxx.

                                                                                                    {
  MESSAGE( "CalciumCouplingPolicy::setInterpolationSchem: " << interpolationSchem );
  if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY )
    throw CalciumException(CalciumTypes::CPITVR,LOC("Can't set InterpolationSchem on a port that is not time dependent"));
  _interpolationSchem=interpolationSchem;
}
void CalciumCouplingPolicy::setStorageLevel ( size_t  storageLevel)

Definition at line 41 of file CalciumCouplingPolicy.cxx.

                                                                              {
  MESSAGE( "CalciumCouplingPolicy::setStorageLevel: " << storageLevel );
  if ( storageLevel < 1 && (storageLevel != CalciumTypes::UNLIMITED_STORAGE_LEVEL)  )
    throw CalciumException(CalciumTypes::CPRENA,LOC("StorageLevel < 1 is not allowed"));
  _storageLevel = storageLevel;
}
virtual void CouplingPolicy::wakeupWaiting ( ) [inline, virtual, inherited]

Friends And Related Function Documentation

friend class BoundedDataIdProcessor [friend]

Definition at line 53 of file CalciumCouplingPolicy.hxx.

friend class DisconnectProcessor [friend]

Definition at line 56 of file CalciumCouplingPolicy.hxx.

friend class EraseDataIdBeforeOrAfterTagProcessor [friend]

Definition at line 55 of file CalciumCouplingPolicy.hxx.

friend class EraseDataIdProcessor [friend]

Definition at line 54 of file CalciumCouplingPolicy.hxx.

friend class InternalDataIdContainer [friend]

Definition at line 50 of file CalciumCouplingPolicy.hxx.


Member Data Documentation

Definition at line 71 of file CalciumCouplingPolicy.hxx.

Definition at line 68 of file CalciumCouplingPolicy.hxx.

Definition at line 72 of file CalciumCouplingPolicy.hxx.

Definition at line 66 of file CalciumCouplingPolicy.hxx.

Definition at line 73 of file CalciumCouplingPolicy.hxx.

Definition at line 70 of file CalciumCouplingPolicy.hxx.

Definition at line 69 of file CalciumCouplingPolicy.hxx.

Definition at line 67 of file CalciumCouplingPolicy.hxx.


The documentation for this class was generated from the following files: