X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling%2FMEDCouplingFieldT.txx;h=d274bdce62bc619dd5667956a13ac888dd384fe9;hb=fc22b4cd63404700f73e09be7507a11b838e55bc;hp=61e2aa1bf8ffd1fecb0775650d7eb00cafb4dca2;hpb=c5f9a2bb5f775564b5bd81de58dfa708bcef020d;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling/MEDCouplingFieldT.txx b/src/MEDCoupling/MEDCouplingFieldT.txx index 61e2aa1bf..d274bdce6 100644 --- a/src/MEDCoupling/MEDCouplingFieldT.txx +++ b/src/MEDCoupling/MEDCouplingFieldT.txx @@ -117,21 +117,22 @@ namespace MEDCoupling } return ret.retn(); } + + template + bool MEDCouplingFieldT::isEqual(const MEDCouplingFieldT *other, double meshPrec, T valsPrec) const + { + std::string tmp; + return isEqualIfNotWhy(other,meshPrec,valsPrec,tmp); + } template - bool MEDCouplingFieldT::isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec, std::string& reason) const + bool MEDCouplingFieldT::isEqualIfNotWhy(const MEDCouplingFieldT *other, double meshPrec, T valsPrec, std::string& reason) const { if(!other) throw INTERP_KERNEL::Exception("MEDCouplingFieldT::isEqualIfNotWhy : other instance is NULL !"); - const MEDCouplingFieldT *otherC(dynamic_cast *>(other)); - if(!otherC) - { - reason="field given in input is not castable in MEDCouplingFieldT !"; - return false; - } - if(!MEDCouplingField::isEqualIfNotWhy(other,meshPrec,valsPrec,reason)) + if(!isEqualIfNotWhyProtected(other,meshPrec,reason)) return false; - if(!_time_discr->isEqualIfNotWhy(otherC->_time_discr,T(valsPrec),reason)) + if(!_time_discr->isEqualIfNotWhy(other->_time_discr,T(valsPrec),reason)) { reason.insert(0,"In FieldT time discretizations differ :"); return false; @@ -150,14 +151,13 @@ namespace MEDCoupling * \throw If the spatial discretization of \a this field is NULL. */ template - bool MEDCouplingFieldT::isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const + bool MEDCouplingFieldT::isEqualWithoutConsideringStr(const MEDCouplingFieldT *other, double meshPrec, T valsPrec) const { - const MEDCouplingFieldT *otherC(dynamic_cast *>(other)); - if(!otherC) + if(!other) return false; - if(!MEDCouplingField::isEqualWithoutConsideringStr(other,meshPrec,valsPrec)) + if(!isEqualWithoutConsideringStrProtected(other,meshPrec)) return false; - if(!_time_discr->isEqualWithoutConsideringStr(otherC->_time_discr,T(valsPrec))) + if(!_time_discr->isEqualWithoutConsideringStr(other->_time_discr,valsPrec)) return false; return true; }