From c9fb637b7085cbff36057a64722eae941e28bad7 Mon Sep 17 00:00:00 2001 From: SONOLET Aymeric Date: Fri, 12 Apr 2024 15:59:28 +0200 Subject: [PATCH] fix: some errors of clang-tidy ex: transforms InterpKernelException into std::exception --- src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx | 7 +++---- src/INTERP_KERNEL/ExprEval/InterpKernelUnit.cxx | 3 +-- src/INTERP_KERNEL/InterpolationCU.txx | 2 +- src/INTERP_KERNEL/MappedBarycentric2DIntersectorP1P1.txx | 5 +++-- src/INTERP_KERNEL/PlanarIntersectorP0P1Bary.txx | 3 ++- src/INTERP_KERNEL/PlanarIntersectorP0P1PL.txx | 7 ++++--- src/INTERP_KERNEL/PlanarIntersectorP1P0.txx | 3 ++- src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.txx | 3 ++- src/INTERP_KERNEL/PlanarIntersectorP1P0PL.txx | 3 ++- src/INTERP_KERNEL/PlanarIntersectorP1P1.txx | 7 ++++--- src/INTERP_KERNEL/PlanarIntersectorP1P1PL.txx | 5 +++-- src/INTERP_KERNELTest/PerfTest.cxx | 2 +- 12 files changed, 28 insertions(+), 22 deletions(-) diff --git a/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx b/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx index 6db2e5a6a..920c63fc5 100644 --- a/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx +++ b/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx @@ -28,7 +28,6 @@ #include #include -#include #include #include #include @@ -318,7 +317,7 @@ DecompositionInUnitBase ExprParser::evaluateUnit() const { res=(ValueUnit *)evaluateLowLev(gen); } - catch(std::exception& e) + catch(INTERP_KERNEL::Exception& e) { delete gen; throw e; @@ -437,7 +436,7 @@ Value *ExprParser::evaluateLowLev(Value *valGen) const { _leaf->fillValue(ret); } - catch(std::exception& e) + catch(INTERP_KERNEL::Exception& e) { delete ret; throw e; @@ -455,7 +454,7 @@ Value *ExprParser::evaluateLowLev(Value *valGen) const for(auto iter3 : _func_btw_sub_expr) iter3->operate(stackOfVal); } - catch(std::exception& e) + catch(INTERP_KERNEL::Exception& e) { for(auto & iter4 : stackOfVal) delete iter4; diff --git a/src/INTERP_KERNEL/ExprEval/InterpKernelUnit.cxx b/src/INTERP_KERNEL/ExprEval/InterpKernelUnit.cxx index 72d1d9393..b337123bb 100644 --- a/src/INTERP_KERNEL/ExprEval/InterpKernelUnit.cxx +++ b/src/INTERP_KERNEL/ExprEval/InterpKernelUnit.cxx @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -348,7 +347,7 @@ void Unit::tryToInterprate() const _decomp_in_base=expr.evaluateUnit(); _is_interpretation_ok=true; } - catch(std::exception&) { } + catch(INTERP_KERNEL::Exception&) { } } } diff --git a/src/INTERP_KERNEL/InterpolationCU.txx b/src/INTERP_KERNEL/InterpolationCU.txx index b765ee447..5db3a5fd9 100644 --- a/src/INTERP_KERNEL/InterpolationCU.txx +++ b/src/INTERP_KERNEL/InterpolationCU.txx @@ -119,7 +119,7 @@ namespace INTERP_KERNEL { case 1: intersector = new IntersectorCU1D( src_mesh, tgt_mesh ); break; case 2: intersector = new IntersectorCU2D( src_mesh, tgt_mesh ); break; - case 3: intersector = new IntersectorCU3D( src_mesh, tgt_mesh, SplittingPolicy() ); break; + case 3: intersector = new IntersectorCU3D( src_mesh, tgt_mesh, getSplittingPolicy() ); break; } // create empty maps for all target elements result.resize( intersector->getNumberOfRowsOfResMatrix() ); diff --git a/src/INTERP_KERNEL/MappedBarycentric2DIntersectorP1P1.txx b/src/INTERP_KERNEL/MappedBarycentric2DIntersectorP1P1.txx index abca8c6a0..9be695bcc 100644 --- a/src/INTERP_KERNEL/MappedBarycentric2DIntersectorP1P1.txx +++ b/src/INTERP_KERNEL/MappedBarycentric2DIntersectorP1P1.txx @@ -25,6 +25,7 @@ #include "MappedBarycentric2DIntersectorP1P1.hxx" #include "PlanarIntersector.hxx" #include "NormalizedGeometricTypes" +#include "InterpKernelUtilities.hxx" #include "PointLocatorAlgos.txx" #include @@ -44,7 +45,7 @@ namespace INTERP_KERNEL { std::vector CoordsT; PlanarIntersector::getRealTargetCoordinates(OTT::indFC(icellT),CoordsT); - ConnType nbOfNodesT=ConnType(CoordsT.size())/SPACEDIM; + ConnType nbOfNodesT=ToConnType(CoordsT.size())/SPACEDIM; for(typename std::vector::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++) { NormalizedCellType tS=PlanarIntersector::_meshS.getTypeOfElement(OTT::indFC(*iter)); @@ -54,7 +55,7 @@ namespace INTERP_KERNEL PlanarIntersector::getRealSourceCoordinates(OTT::indFC(*iter),CoordsS); std::vector CoordsTTmp(CoordsT); if(SPACEDIM==3) - PlanarIntersector::projectionThis(&CoordsS[0],&CoordsTTmp[0],ConnType(CoordsS.size())/SPACEDIM,nbOfNodesT); + PlanarIntersector::projectionThis(&CoordsS[0],&CoordsTTmp[0],ToConnType(CoordsS.size())/SPACEDIM,nbOfNodesT); const ConnType *startOfCellNodeConnT=PlanarIntersector::_connectT+OTT::conn2C(PlanarIntersector::_connIndexT[icellT]); for(ConnType nodeIdT=0;nodeIdT @@ -85,7 +86,7 @@ namespace INTERP_KERNEL bool isSourceQuad=CellModel::GetCellModel(tS).isQuadratic(); PlanarIntersector::getRealSourceCoordinates(OTT::indFC(iS),srcCellCoords); std::vector *srcCoords(&srcCellCoords); - ConnType srcNbNodes = ConnType(srcCellCoords.size())/SPACEDIM; + ConnType srcNbNodes = ToConnType(srcCellCoords.size())/SPACEDIM; if(SPACEDIM==3) { srcCellCoordsTmp=srcCellCoords; diff --git a/src/INTERP_KERNEL/PlanarIntersectorP0P1PL.txx b/src/INTERP_KERNEL/PlanarIntersectorP0P1PL.txx index 6fb21d626..8d370645e 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP0P1PL.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP0P1PL.txx @@ -22,6 +22,7 @@ #include "PlanarIntersector.hxx" #include "InterpolationUtils.hxx" +#include "InterpKernelUtilities.hxx" #include "PlanarIntersectorP0P1PL.hxx" #include "PointLocatorAlgos.txx" @@ -47,17 +48,17 @@ namespace INTERP_KERNEL const ConnType *startOfCellNodeConnT=PlanarIntersector::_connectT+OTT::conn2C(PlanarIntersector::_connIndexT[icellT]); std::vector coordsTarget; PlanarIntersector::getRealTargetCoordinates(OTT::indFC(icellT),coordsTarget); - ConnType nbNodesT=ConnType(coordsTarget.size())/SPACEDIM; + ConnType nbNodesT=ToConnType(coordsTarget.size())/SPACEDIM; ii=0; for(typename std::vector::const_iterator iter2=icellsS.begin();iter2!=icellsS.end();iter2++,ii++) { std::vector tmpSource(coordsOfSources[ii]); std::vector tmpTarget(coordsTarget); if(SPACEDIM==3) - PlanarIntersector::projectionThis(&tmpSource[0],&tmpTarget[0],ConnType(tmpSource.size())/SPACEDIM,nbNodesT); + PlanarIntersector::projectionThis(&tmpSource[0],&tmpTarget[0],ToConnType(tmpSource.size())/SPACEDIM,nbNodesT); for(ConnType nodeIdT=0;nodeIdT::isElementContainsPointAlg2DSimple(&tmpTarget[0]+nodeIdT*SPACEDIM,&tmpSource[0],ConnType(tmpSource.size())/SPACEDIM,PlanarIntersector::_precision)) + if(PointLocatorAlgos::isElementContainsPointAlg2DSimple(&tmpTarget[0]+nodeIdT*SPACEDIM,&tmpSource[0],ToConnType(tmpSource.size())/SPACEDIM,PlanarIntersector::_precision)) { ConnType curNodeTInCmode=OTT::coo2C(startOfCellNodeConnT[nodeIdT]); typename MyMatrix::value_type& resRow=res[curNodeTInCmode]; diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P0.txx b/src/INTERP_KERNEL/PlanarIntersectorP1P0.txx index 3bf8cb26d..319c209bf 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P0.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P0.txx @@ -24,6 +24,7 @@ #include "PlanarIntersector.txx" #include "PlanarIntersectorP1P0.hxx" #include "InterpolationUtils.hxx" +#include "InterpKernelUtilities.hxx" #include "CellModel.hxx" #include @@ -84,7 +85,7 @@ namespace INTERP_KERNEL fillDualCellOfTri(triangle,quadrangle); std::vector targetCellCoordsTmp(targetCellCoords); if(SPACEDIM==3) - orientation=PlanarIntersector::projectionThis(&targetCellCoordsTmp[0],quadrangle,ConnType(targetCellCoords.size())/SPACEDIM,4); + orientation=PlanarIntersector::projectionThis(&targetCellCoordsTmp[0],quadrangle,ToConnType(targetCellCoords.size())/SPACEDIM,4); double surf=orientation*intersectGeometryWithQuadrangle(quadrangle,targetCellCoordsTmp,isTargetQuad); surf=PlanarIntersector::getValueRegardingOption(surf); if(surf!=0.) diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.txx b/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.txx index 98b6e6e80..2f6fd8c62 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.txx @@ -24,6 +24,7 @@ #include "PlanarIntersector.hxx" #include "PlanarIntersectorP1P0Bary.hxx" #include "InterpolationUtils.hxx" +#include "InterpKernelUtilities.hxx" #include "CellModel.hxx" #include @@ -80,7 +81,7 @@ namespace INTERP_KERNEL // target cell data PlanarIntersector::getRealTargetCoordinates(OTT::indFC(icellT),tgtCellCoords); std::vector * tgtCoords = & tgtCellCoords; - ConnType tgtNbNodes = ConnType(tgtCellCoords.size())/SPACEDIM; + ConnType tgtNbNodes = ToConnType(tgtCellCoords.size())/SPACEDIM; NormalizedCellType tT=PlanarIntersector::_meshT.getTypeOfElement(OTT::indFC(icellT)); bool isTargetQuad=CellModel::GetCellModel(tT).isQuadratic(); diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P0PL.txx b/src/INTERP_KERNEL/PlanarIntersectorP1P0PL.txx index 054949e55..812282d71 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P0PL.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P0PL.txx @@ -24,6 +24,7 @@ #include "InterpolationUtils.hxx" #include "NormalizedGeometricTypes" #include "PlanarIntersectorP1P0PL.hxx" +#include "InterpKernelUtilities.hxx" #include "VolSurfFormulae.hxx" #include "PointLocatorAlgos.txx" @@ -48,7 +49,7 @@ namespace INTERP_KERNEL PlanarIntersector::getRealTargetCoordinates(OTT::indFC(icellT),CoordsT); double baryT[SPACEDIM]; double baryTTmp[SPACEDIM]; - calculateBarycenterDyn2(&CoordsT[0],ConnType(CoordsT.size())/SPACEDIM,baryT); + calculateBarycenterDyn2(&CoordsT[0],ToConnType(CoordsT.size())/SPACEDIM,baryT); for(typename std::vector::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++) { NormalizedCellType tS=PlanarIntersector::_meshS.getTypeOfElement(OTT::indFC(*iter)); diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P1.txx b/src/INTERP_KERNEL/PlanarIntersectorP1P1.txx index a9c11974a..6445ad357 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P1.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P1.txx @@ -23,6 +23,7 @@ #include "PlanarIntersector.txx" #include "PlanarIntersectorP1P1.hxx" #include "InterpolationUtils.hxx" +#include "InterpKernelUtilities.hxx" #include namespace INTERP_KERNEL @@ -63,7 +64,7 @@ namespace INTERP_KERNEL ConnType curNodeTInCmode=OTT::coo2C(startOfCellNodeConn[nodeIdT]); PlanarIntersector::getRealTargetCoordinatesPermute(OTT::indFC(icellT),nodeIdT,polygT); std::vector polygDualT(SPACEDIM*2*(nbNodesT-1)); - fillDualCellOfPolyg(&polygT[0],ConnType(polygT.size())/SPACEDIM,&polygDualT[0]); + fillDualCellOfPolyg(&polygT[0],ToConnType(polygT.size())/SPACEDIM,&polygDualT[0]); typename MyMatrix::value_type& resRow=res[curNodeTInCmode]; for(typename std::vector::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++) { @@ -76,10 +77,10 @@ namespace INTERP_KERNEL std::vector polygS; PlanarIntersector::getRealSourceCoordinatesPermute(OTT::indFC(iS),nodeIdS,polygS); std::vector polygDualS(SPACEDIM*2*(nbNodesS-1)); - fillDualCellOfPolyg(&polygS[0],ConnType(polygS.size())/SPACEDIM,&polygDualS[0]); + fillDualCellOfPolyg(&polygS[0],ToConnType(polygS.size())/SPACEDIM,&polygDualS[0]); std::vector polygDualTTmp(polygDualT); if(SPACEDIM==3) - orientation=PlanarIntersector::projectionThis(&polygDualS[0],&polygDualTTmp[0],ConnType(polygDualS.size())/SPACEDIM,ConnType(polygDualT.size())/SPACEDIM); + orientation=PlanarIntersector::projectionThis(&polygDualS[0],&polygDualTTmp[0],ToConnType(polygDualS.size())/SPACEDIM,ToConnType(polygDualT.size())/SPACEDIM); double surf=orientation*intersectGeometryGeneral(polygDualTTmp,polygDualS); surf=PlanarIntersector::getValueRegardingOption(surf); if(surf!=0.) diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P1PL.txx b/src/INTERP_KERNEL/PlanarIntersectorP1P1PL.txx index 7cbb512af..f57ac7739 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P1PL.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P1PL.txx @@ -24,6 +24,7 @@ #include "InterpolationUtils.hxx" #include "NormalizedGeometricTypes" #include "PlanarIntersectorP1P1PL.hxx" +#include "InterpKernelUtilities.hxx" #include "PointLocatorAlgos.txx" #include @@ -44,7 +45,7 @@ namespace INTERP_KERNEL { std::vector CoordsT; this->getRealTargetCoordinates(OTT::indFC(icellT),CoordsT); - ConnType nbOfNodesT=ConnType(CoordsT.size())/SPACEDIM; + ConnType nbOfNodesT=ToConnType(CoordsT.size())/SPACEDIM; for(typename std::vector::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++) { NormalizedCellType tS=this->_meshS.getTypeOfElement(OTT::indFC(*iter)); @@ -54,7 +55,7 @@ namespace INTERP_KERNEL this->getRealSourceCoordinates(OTT::indFC(*iter),CoordsS); std::vector CoordsTTmp(CoordsT); if(SPACEDIM==3) - this->projectionThis(CoordsS.data(),CoordsTTmp.data(),ConnType(CoordsS.size())/SPACEDIM,nbOfNodesT); + this->projectionThis(CoordsS.data(),CoordsTTmp.data(),ToConnType(CoordsS.size())/SPACEDIM,nbOfNodesT); const ConnType *startOfCellNodeConnT=this->_connectT+OTT::conn2C(this->_connIndexT[icellT]); for(int nodeIdT=0;nodeIdT