X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling%2FMEDCouplingField.cxx;h=94c0a12fad091179c86d4e2c1fc3586e300646dd;hb=ac1df6b0ba8b337555fb39610c89f678d889580d;hp=cb69a6de775153fa6c6e57919bbbbaf75756bb23;hpb=6f841c1f16f8b9d0b7ba50cf000ade240b2484b2;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling/MEDCouplingField.cxx b/src/MEDCoupling/MEDCouplingField.cxx index cb69a6de7..94c0a12fa 100644 --- a/src/MEDCoupling/MEDCouplingField.cxx +++ b/src/MEDCoupling/MEDCouplingField.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2015 CEA/DEN, EDF R&D +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -24,9 +24,17 @@ #include -using namespace ParaMEDMEM; +using namespace MEDCoupling; -bool MEDCouplingField::isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec, std::string& reason) const +void MEDCouplingField::checkConsistencyLight() const +{ + if(!_mesh) + throw INTERP_KERNEL::Exception("Field invalid because no mesh specified !"); + if(_type.isNull()) + throw INTERP_KERNEL::Exception("MEDCouplingField::checkConsistencyLight : no spatial discretization !"); +} + +bool MEDCouplingField::isEqualIfNotWhyProtected(const MEDCouplingField *other, double meshPrec, std::string& reason) const { if(!other) throw INTERP_KERNEL::Exception("MEDCouplingField::isEqualIfNotWhy : other instance is NULL !"); @@ -49,7 +57,7 @@ bool MEDCouplingField::isEqualIfNotWhy(const MEDCouplingField *other, double mes reason=oss.str(); return false; } - if(!_type->isEqualIfNotWhy(other->_type,valsPrec,reason)) + if(!_type->isEqualIfNotWhy(other->_type,meshPrec,reason)) { reason.insert(0,"Spatial discretizations differ :"); return false; @@ -69,37 +77,22 @@ bool MEDCouplingField::isEqualIfNotWhy(const MEDCouplingField *other, double mes return ret; } -/*! - * Checks if \a this and another MEDCouplingField are fully equal. - * \param [in] other - the field to compare with \a this one. - * \param [in] meshPrec - precision used to compare node coordinates of the underlying mesh. - * \param [in] valsPrec - precision used to compare field values. - * \return bool - \c true if the two fields are equal, \c false else. - * \throw If \a other is NULL. - */ -bool MEDCouplingField::isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const -{ - std::string tmp; - return isEqualIfNotWhy(other,meshPrec,valsPrec,tmp); -} - /*! * Checks if \a this and another MEDCouplingField are equal. The textual * information like names etc. is not considered. * \param [in] other - the field to compare with \a this one. * \param [in] meshPrec - precision used to compare node coordinates of the underlying mesh. - * \param [in] valsPrec - precision used to compare field values. * \return bool - \c true if the two fields are equal, \c false else. * \throw If \a other is NULL. * \throw If the spatial discretization of \a this field is NULL. */ -bool MEDCouplingField::isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const +bool MEDCouplingField::isEqualWithoutConsideringStrProtected(const MEDCouplingField *other, double meshPrec) const { if(!other) throw INTERP_KERNEL::Exception("MEDCouplingField::isEqualWithoutConsideringStr : input field is NULL !"); if(!_type) throw INTERP_KERNEL::Exception("MEDCouplingField::isEqualWithoutConsideringStr : spatial discretization of this is NULL !"); - if(!_type->isEqualWithoutConsideringStr(other->_type,valsPrec)) + if(!_type->isEqualWithoutConsideringStr(other->_type,meshPrec)) return false; if(_nature!=other->_nature) return false; @@ -186,8 +179,8 @@ std::vector MEDCouplingField::getDirectChildrenWithNull /*! * Returns a type of \ref MEDCouplingSpatialDisc "spatial discretization" of \a this - * field in terms of enum ParaMEDMEM::TypeOfField. - * \return ParaMEDMEM::TypeOfField - the type of \a this field. + * field in terms of enum MEDCoupling::TypeOfField. + * \return MEDCoupling::TypeOfField - the type of \a this field. * \throw If the geometric type is empty. */ TypeOfField MEDCouplingField::getTypeOfField() const @@ -199,7 +192,7 @@ TypeOfField MEDCouplingField::getTypeOfField() const /*! * Returns the nature of \a this field. This information is very important during - * interpolation process using ParaMEDMEM::MEDCouplingRemapper or ParaMEDMEM::InterpKernelDEC. + * interpolation process using MEDCoupling::MEDCouplingRemapper or MEDCoupling::InterpKernelDEC. * In other context than the two mentioned above, this attribute is unimportant. This * attribute is not stored in the MED file. * For more information of the semantics and the influence of this attribute to the @@ -214,7 +207,7 @@ NatureOfField MEDCouplingField::getNature() const /*! * Sets the nature of \a this field. This information is very important during - * interpolation process using ParaMEDMEM::MEDCouplingRemapper or ParaMEDMEM::InterpKernelDEC. + * interpolation process using MEDCoupling::MEDCouplingRemapper or MEDCoupling::InterpKernelDEC. * In other context than the two mentioned above, this attribute is unimportant. This * attribute is not stored in the MED file. * For more information of the semantics and the influence of this attribute to the @@ -228,6 +221,8 @@ NatureOfField MEDCouplingField::getNature() const void MEDCouplingField::setNature(NatureOfField nat) { MEDCouplingNatureOfField::GetRepr(nat);//generate a throw if nat not recognized + if(_type) + _type->checkCompatibilityWithNature(nat); _nature=nat; } @@ -366,7 +361,7 @@ void MEDCouplingField::clearGaussLocalizations() * problem. * \param [in] locId - the id of the Gauss localization object of interest. * It must be in range 0 <= locId < getNbOfGaussLocalization() . - * \return \ref ParaMEDMEM::MEDCouplingGaussLocalization "MEDCouplingGaussLocalization" & - the + * \return \ref MEDCoupling::MEDCouplingGaussLocalization "MEDCouplingGaussLocalization" & - the * Gauss localization object. * \throw If \a this field is not on Gauss points. * \throw If \a locId is not within the valid range.