X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling%2FMEDCouplingGaussLocalization.cxx;h=5075612a1f08448778d619643f3e2f4dc91e4e92;hb=38b974ecc3f627da9eb42c01bda66bd051b81c2a;hp=5572831aca0cd95fc3386b3de51f042e1734178e;hpb=b219559763498c4bd10c730cd3d2c62b1eed45db;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling/MEDCouplingGaussLocalization.cxx b/src/MEDCoupling/MEDCouplingGaussLocalization.cxx index 5572831ac..5075612a1 100644 --- a/src/MEDCoupling/MEDCouplingGaussLocalization.cxx +++ b/src/MEDCoupling/MEDCouplingGaussLocalization.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2019 CEA/DEN, EDF R&D +// Copyright (C) 2007-2021 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 @@ -34,29 +34,18 @@ using namespace MEDCoupling; MEDCouplingGaussLocalization::MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w) -try:_type(type),_ref_coord(refCoo),_gauss_coord(gsCoo),_weight(w) +:_type(type),_ref_coord(refCoo),_gauss_coord(gsCoo),_weight(w) { + // Will potentially throw (and then release memory for above objects _ref_coord etc ...) checkConsistencyLight(); } -catch(INTERP_KERNEL::Exception& e) -{ - _type=INTERP_KERNEL::NORM_ERROR; - _ref_coord.clear(); - _gauss_coord.clear(); - _weight.clear(); - throw e; -} MEDCouplingGaussLocalization::MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) -try:_type(typ) +:_type(typ) { + // Will potentially throw INTERP_KERNEL::CellModel::GetCellModel(_type); } -catch(INTERP_KERNEL::Exception& e) -{ - _type=INTERP_KERNEL::NORM_ERROR; - throw e; -} void MEDCouplingGaussLocalization::setType(INTERP_KERNEL::NormalizedCellType typ) { @@ -224,7 +213,6 @@ MCAuto MEDCouplingGaussLocalization::localizePtsInRefCooForEach double *retPtr(ret->getPointer()); if(dim!=ToIdType(ptsInRefCoo->getNumberOfComponents())) throw INTERP_KERNEL::Exception("MEDCouplingGaussLocalization::localizePtsInRefCooForEachCell : number of components of input coo is not equal to dim of element !"); - const std::vector& wg(getWeights()); INTERP_KERNEL::GaussCoords calculator; calculator.addGaussInfo(typ,dim, ptsInRefCoo->begin(),nbPts,&_ref_coord[0],getNumberOfPtsInRefCell()); // @@ -324,6 +312,6 @@ bool MEDCouplingGaussLocalization::AreAlmostEqual(const std::vector& v1, return false; std::vector tmp(sz); std::transform(v1.begin(),v1.end(),v2.begin(),tmp.begin(),std::minus()); - std::transform(tmp.begin(),tmp.end(),tmp.begin(),std::ptr_fun(fabs)); + std::transform(tmp.begin(),tmp.end(),tmp.begin(),[](double c){return fabs(c);}); return *std::max_element(tmp.begin(),tmp.end())