Salome HOME
merge from agy/Template2
authorAnthony Geay <anthony.geay@edf.fr>
Thu, 1 Jun 2017 06:37:40 +0000 (08:37 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Thu, 1 Jun 2017 06:37:40 +0000 (08:37 +0200)
1  2 
src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx
src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx
src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx
src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx
src/MEDCoupling/MEDCouplingMemArray.cxx
src/MEDCoupling/MEDCouplingMemArray.txx
src/MEDCoupling/MEDCouplingMemArrayChar.cxx
src/MEDCoupling/MEDCouplingStructuredMesh.cxx
src/MEDCoupling/MEDCouplingStructuredMesh.hxx
src/MEDCoupling/MEDCouplingUMesh.cxx
src/MEDCoupling/MEDCouplingUMesh.hxx

index 24142a4b285a0f35ef5055242e9b4dd5cfc83d9b,9f1ef0feaff0da63a20676648586c626c9ea8bac..658d78727d407f86abcfbc2ce3509f7e987c12b3
@@@ -1309,8 -1248,7 +1248,7 @@@ DataArrayInt *DataArrayDouble::computeN
      throw INTERP_KERNEL::Exception("DataArrayDouble::computeNbOfInteractionsWith : input array is NULL !");
    if(!isAllocated() || !otherBBoxFrmt->isAllocated())
      throw INTERP_KERNEL::Exception("DataArrayDouble::computeNbOfInteractionsWith : this and input array must be allocated !");
-   std::size_t nbOfComp(getNumberOfComponents());
-   int nbOfTuples(getNumberOfTuples());
 -  int nbOfComp(getNumberOfComponents()),nbOfTuples(getNumberOfTuples());
++  std::size_t nbOfComp(getNumberOfComponents()),nbOfTuples(getNumberOfTuples());
    if(nbOfComp!=otherBBoxFrmt->getNumberOfComponents())
      {
        std::ostringstream oss; oss << "DataArrayDouble::computeNbOfInteractionsWith : this number of components (" << nbOfComp << ") must be equal to the number of components of input array (" << otherBBoxFrmt->getNumberOfComponents() << ") !";
index 51edbee9696e234dab9e04d8e10d515f7f0c6f33,5a1f3ee69937a168a7742d71580298cff079194b..f290260540768fbad3a194ab7868672492232d93
@@@ -3249,6 -3262,99 +3262,98 @@@ struct NotInRang
      this->declareAsNew();
    }
  
 -    int nbOfTuples(this->getNumberOfTuples());
+   template<class T>
+   struct ImplReprTraits { static void SetPrecision(std::ostream& oss) { } };
+   template<>
+   struct ImplReprTraits<double> {  static void SetPrecision(std::ostream& oss) { oss.precision(17); } };
+   
+   template<>
+   struct ImplReprTraits<float> {  static void SetPrecision(std::ostream& oss) { oss.precision(7); } };
+   
+   template<class T>
+   void DataArrayTemplateClassic<T>::reprStream(std::ostream& stream) const
+   {
+     stream << "Name of " << Traits<T>::ReprStr << " array : \"" << this->_name << "\"\n";
+     reprWithoutNameStream(stream);
+   }
+   template<class T>
+   void DataArrayTemplateClassic<T>::reprZipStream(std::ostream& stream) const
+   {
+     stream << "Name of " << Traits<T>::ReprStr << " array : \"" << this->_name << "\"\n";
+     reprZipWithoutNameStream(stream);
+   }
+   template<class T>
+   void DataArrayTemplateClassic<T>::reprNotTooLongStream(std::ostream& stream) const
+   {
+     stream << "Name of "<< Traits<T>::ReprStr << " array : \"" << this->_name << "\"\n";
+     reprNotTooLongWithoutNameStream(stream);
+   }
+   template<class T>
+   void DataArrayTemplateClassic<T>::reprWithoutNameStream(std::ostream& stream) const
+   {
+     DataArray::reprWithoutNameStream(stream);
+     ImplReprTraits<T>::SetPrecision(stream);
+     this->_mem.repr(this->getNumberOfComponents(),stream);
+   }
+   template<class T>
+   void DataArrayTemplateClassic<T>::reprZipWithoutNameStream(std::ostream& stream) const
+   {
+     DataArray::reprWithoutNameStream(stream);
+     ImplReprTraits<T>::SetPrecision(stream);
+     this->_mem.reprZip(this->getNumberOfComponents(),stream);
+   }
+   template<class T>
+   void DataArrayTemplateClassic<T>::reprNotTooLongWithoutNameStream(std::ostream& stream) const
+   {
+     DataArray::reprWithoutNameStream(stream);
+     ImplReprTraits<T>::SetPrecision(stream);
+     this->_mem.reprNotTooLong(this->getNumberOfComponents(),stream);
+   }
+   /*!
+    * This method is close to repr method except that when \a this has more than 1000 tuples, all tuples are not
+    * printed out to avoid to consume too much space in interpretor.
+    * \sa repr
+    */
+   template<class T>
+   std::string DataArrayTemplateClassic<T>::reprNotTooLong() const
+   {
+     std::ostringstream ret;
+     reprNotTooLongStream(ret);
+     return ret.str();
+   }
+   
+   /////////////////////////////////
+   
+   /*!
+    * Checks if all values in \a this array are equal to \a val at precision \a eps.
+    *  \param [in] val - value to check equality of array values to.
+    *  \param [in] eps - precision to check the equality.
+    *  \return bool - \a true if all values are in range (_val_ - _eps_; _val_ + _eps_),
+    *                 \a false else.
+    *  \throw If \a this->getNumberOfComponents() != 1
+    *  \throw If \a this is not allocated.
+    */
+   template<class T>
+   bool DataArrayTemplateFP<T>::isUniform(T val, T eps) const
+   {
+     this->checkAllocated();
+     if(this->getNumberOfComponents()!=1)
+       throw INTERP_KERNEL::Exception("DataArrayDouble::isUniform : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before !");
+     const T *w(this->begin()),*end2(this->end());
+     const T vmin(val-eps),vmax(val+eps);
+     for(;w!=end2;w++)
+       if(*w<vmin || *w>vmax)
+         return false;
+     return true;
+   }
    /*!
     * Equivalent to DataArrayInt::isEqual except that if false the reason of
     * mismatch is given.
Simple merge
Simple merge