X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling%2FMEDCouplingMemArrayFloat.cxx;h=c9fa547eb2e5d4d81a393fe238ed470fb4cc78c1;hb=ac1df6b0ba8b337555fb39610c89f678d889580d;hp=36f4de3bb5b345be0c15c540e6d9af18d39d098b;hpb=0b115acf5e7a5023a92fff2803d84d239060273a;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling/MEDCouplingMemArrayFloat.cxx b/src/MEDCoupling/MEDCouplingMemArrayFloat.cxx index 36f4de3bb..c9fa547eb 100644 --- a/src/MEDCoupling/MEDCouplingMemArrayFloat.cxx +++ b/src/MEDCoupling/MEDCouplingMemArrayFloat.cxx @@ -26,6 +26,7 @@ template class MEDCoupling::MemArray; template class MEDCoupling::DataArrayTemplate; template class MEDCoupling::DataArrayTemplateClassic; template class MEDCoupling::DataArrayTemplateFP; +template class MEDCoupling::DataArrayIterator; DataArrayFloat *DataArrayFloat::New() { @@ -37,25 +38,6 @@ DataArrayFloat *DataArrayFloat::deepCopy() const return new DataArrayFloat(*this); } -void DataArrayFloat::reprStream(std::ostream& stream) const -{ - stream << "Name of float array : \"" << _name << "\"\n"; - reprWithoutNameStream(stream); -} - -void DataArrayFloat::reprZipStream(std::ostream& stream) const -{ - stream << "Name of float array : \"" << _name << "\"\n"; - reprZipWithoutNameStream(stream); -} - -void DataArrayFloat::reprZipWithoutNameStream(std::ostream& stream) const -{ - DataArray::reprWithoutNameStream(stream); - stream.precision(7); - _mem.repr(getNumberOfComponents(),stream); -} - void DataArrayFloat::reprCppStream(const std::string& varName, std::ostream& stream) const { int nbTuples(getNumberOfTuples()),nbComp(getNumberOfComponents()); @@ -130,26 +112,6 @@ void DataArrayFloat::reprQuickOverviewData(std::ostream& stream, std::size_t max stream << "]"; } -std::string DataArrayFloat::reprNotTooLong() const -{ - std::ostringstream ret; - reprNotTooLongStream(ret); - return ret.str(); -} - -void DataArrayFloat::reprNotTooLongStream(std::ostream& stream) const -{ - stream << "Name of float array : \"" << _name << "\"\n"; - reprNotTooLongWithoutNameStream(stream); -} - -void DataArrayFloat::reprNotTooLongWithoutNameStream(std::ostream& stream) const -{ - DataArray::reprWithoutNameStream(stream); - stream.precision(7); - _mem.reprNotTooLong(getNumberOfComponents(),stream); -} - bool DataArrayFloat::isEqualIfNotWhy(const DataArrayFloat& other, float prec, std::string& reason) const { if(!areInfoEqualsIfNotWhy(other,reason)) @@ -169,14 +131,40 @@ bool DataArrayFloat::isEqualWithoutConsideringStr(const DataArrayFloat& other, f return _mem.isEqual(other._mem,prec,tmp); } +DataArrayFloatIterator *DataArrayFloat::iterator() +{ + return new DataArrayFloatIterator(this); +} + +DataArrayFloatIterator::DataArrayFloatIterator(DataArrayFloat *da):DataArrayIterator(da) +{ +} + +DataArrayFloatTuple::DataArrayFloatTuple(float *pt, int nbOfComp):DataArrayTuple(pt,nbOfComp) +{ +} + +std::string DataArrayFloatTuple::repr() const +{ + std::ostringstream oss; oss.precision(7); oss << "("; + for(int i=0;i<_nb_of_compo-1;i++) + oss << _pt[i] << ", "; + oss << _pt[_nb_of_compo-1] << ")"; + return oss.str(); +} + +float DataArrayFloatTuple::floatValue() const +{ + return this->zeValue(); +} + /*! - * Returns either a \a deep or \a shallow copy of this array. For more info see - * \ref MEDCouplingArrayBasicsCopyDeep and \ref MEDCouplingArrayBasicsCopyShallow. - * \param [in] dCpy - if \a true, a deep copy is returned, else, a shallow one. - * \return DataArrayDouble * - either a new instance of DataArrayDouble (if \a dCpy - * == \a true) or \a this instance (if \a dCpy == \a false). + * This method returns a newly allocated instance the caller should dealed with by a MEDCoupling::DataArrayFloat::decrRef. + * This method performs \b no copy of data. The content is only referenced using MEDCoupling::DataArrayFloat::useArray with ownership set to \b false. + * This method throws an INTERP_KERNEL::Exception is it is impossible to match sizes of \b this that is too say \b nbOfCompo=this->_nb_of_elem and \bnbOfTuples==1 or + * \b nbOfCompo=1 and \bnbOfTuples==this->_nb_of_elem. */ -DataArrayFloat *DataArrayFloat::performCopyOrIncrRef(bool dCpy) const +DataArrayFloat *DataArrayFloatTuple::buildDAFloat(int nbOfTuples, int nbOfCompo) const { - return DataArrayTemplateClassic::PerformCopyOrIncrRef(dCpy,*this); + return this->buildDA(nbOfTuples,nbOfCompo); }