Back to index

salome-kernel  6.5.0
Public Member Functions | Public Attributes
CalciumCouplingPolicy::BoundedDataIdProcessor< DataManipulator, typename boost::enable_if< boost::is_float< typename DataManipulator::InnerType > >::type > Struct Template Reference

#include <CalciumCouplingPolicy.hxx>

Collaboration diagram for CalciumCouplingPolicy::BoundedDataIdProcessor< DataManipulator, typename boost::enable_if< boost::is_float< typename DataManipulator::InnerType > >::type >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 BoundedDataIdProcessor (const CalciumCouplingPolicy &couplingPolicy)
template<typename MapIterator >
void apply (typename iterator_t< MapIterator >::value_type &data, const DataId &dataId, const MapIterator &it1) const

Public Attributes

const CalciumCouplingPolicy_couplingPolicy

Detailed Description

template<typename DataManipulator>
struct CalciumCouplingPolicy::BoundedDataIdProcessor< DataManipulator, typename boost::enable_if< boost::is_float< typename DataManipulator::InnerType > >::type >

Definition at line 186 of file CalciumCouplingPolicy.hxx.


Constructor & Destructor Documentation

template<typename DataManipulator >
CalciumCouplingPolicy::BoundedDataIdProcessor< DataManipulator, typename boost::enable_if< boost::is_float< typename DataManipulator::InnerType > >::type >::BoundedDataIdProcessor ( const CalciumCouplingPolicy couplingPolicy) [inline]

Definition at line 192 of file CalciumCouplingPolicy.hxx.

                                                                     :
    _couplingPolicy(couplingPolicy) {};

Member Function Documentation

template<typename DataManipulator >
template<typename MapIterator >
void CalciumCouplingPolicy::BoundedDataIdProcessor< DataManipulator, typename boost::enable_if< boost::is_float< typename DataManipulator::InnerType > >::type >::apply ( typename iterator_t< MapIterator >::value_type &  data,
const DataId dataId,
const MapIterator &  it1 
) const [inline]

Definition at line 197 of file CalciumCouplingPolicy.hxx.

                                                                           {
      
    typedef typename iterator_t<MapIterator>::value_type value_type;
    typedef typename DataManipulator::InnerType InnerType;
    typedef typename DataManipulator::Type Type;

    MapIterator it2=it1; ++it2;
    size_t   dataSize1 = DataManipulator::size(it1->second);
#ifdef MYDEBUG
    std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Taille de donnée dataId1 : " << dataSize1 << std::endl;
#endif
 
    // Gérer dans calcium la limite de la taille du buffer donnée par
    // l'utilisateur.
    size_t   dataSize2 = DataManipulator::size(it2->second);
#ifdef MYDEBUG
    std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Taille de donnée dataId2 : " << dataSize2 << std::endl;
#endif

    size_t   dataSize  = std::min< size_t >( dataSize1, dataSize2 );
    DataId   dataId2 = it2->first;
    DataId   dataId1 = it1->first;
    TimeType t2      = dataId2.first;
    TimeType t1      = dataId1.first;
#ifdef MYDEBUG
    std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t1 : " << t1 << std::endl;
    std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t2 : " << t2 << std::endl;
#endif
    TimeType t       = dataId.first;
#ifdef MYDEBUG
    std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t : " << t << std::endl;
#endif
    TimeType timeDiff  = t2-t1;
#ifdef MYDEBUG
    std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de timeDiff : " << timeDiff << std::endl;
#endif
    TimeType coeff   = (t2-t)/timeDiff;
#ifdef MYDEBUG
    std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de coeff : " << coeff << std::endl;
#endif

    InnerType const * const InIt1 = DataManipulator::getPointer(it1->second);
#ifdef MYDEBUG
    std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données à t1 : " << std::endl;
    std::copy(InIt1,InIt1+dataSize1,std::ostream_iterator<InnerType>(std::cout," "));
    std::cout << std::endl;
#endif
    InnerType const * const InIt2 = DataManipulator::getPointer(it2->second);
#ifdef MYDEBUG
    std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données à t2 : " << std::endl;
    std::copy(InIt2,InIt2+dataSize2,std::ostream_iterator<InnerType>(std::cout," "));
    std::cout << std::endl;
#endif
    Type              dataOut = DataManipulator::create(dataSize);
    InnerType * const OutIt   = DataManipulator::getPointer(dataOut);
 
#ifdef MYDEBUG
    std::cerr << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : interpolationSchem : " << _couplingPolicy._interpolationSchem << std::endl;
    std::cerr << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : alpha : " << _couplingPolicy._alpha << std::endl;
    std::cerr << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : datecalschem : " << _couplingPolicy._dateCalSchem << std::endl;
    std::cerr << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : storageLevel : " << _couplingPolicy._storageLevel << std::endl;
#endif
    if ( timeDiff == 0.0 ||  _couplingPolicy._interpolationSchem == CalciumTypes::L0_SCHEM ) {
      std::copy(InIt1,InIt1+dataSize,OutIt);
    } else {

      boost::lambda::placeholder1_type _1;
      boost::lambda::placeholder2_type _2;
      // OLD: REM : Pour des buffers de type int
      // OLD: le compilo indiquera warning: converting to `long int' from `Double'
      std::transform(InIt1,InIt1+dataSize,InIt2,OutIt,
                     ( _1 - _2 ) * coeff + _2 );
//       for(size_t i =0;  i < dataSize3; ++i) {
//      OutIt[i]=(InIt1[i] - InIt2[i]) * coeff + InIt2[i];
//       }

    }
#ifdef MYDEBUG
    std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données calculées à t : " << std::endl;
    std::copy(OutIt,OutIt+dataSize,std::ostream_iterator<InnerType>(std::cout," "));
    std::cout << std::endl;
#endif
    data = dataOut;
    
  }

Member Data Documentation

template<typename DataManipulator >
const CalciumCouplingPolicy& CalciumCouplingPolicy::BoundedDataIdProcessor< DataManipulator, typename boost::enable_if< boost::is_float< typename DataManipulator::InnerType > >::type >::_couplingPolicy

Definition at line 190 of file CalciumCouplingPolicy.hxx.


The documentation for this struct was generated from the following file: