From: eap Date: Fri, 29 Nov 2019 16:49:04 +0000 (+0300) Subject: LOT2: finalize int->mcIdType in INTERP_KERNEL X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fef2cb435b58a24cae7da1d9e8ec9065ce5be6f3;p=tools%2Fmedcoupling.git LOT2: finalize int->mcIdType in INTERP_KERNEL --- diff --git a/src/INTERP_KERNEL/BBTreeDst.txx b/src/INTERP_KERNEL/BBTreeDst.txx index 3fa065126..3862e1b4b 100755 --- a/src/INTERP_KERNEL/BBTreeDst.txx +++ b/src/INTERP_KERNEL/BBTreeDst.txx @@ -98,11 +98,11 @@ public: tmp=0; if(!new_elems_left.empty()) tmp=&(new_elems_left[0]); - _left=new BBTreeDst(bbs, tmp, level+1, (mcIdType)new_elems_left.size()); + _left=new BBTreeDst(bbs, tmp, level+1, ToIdType(new_elems_left.size())); tmp=0; if(!new_elems_right.empty()) tmp=&(new_elems_right[0]); - _right=new BBTreeDst(bbs, tmp, level+1, (mcIdType)new_elems_right.size()); + _right=new BBTreeDst(bbs, tmp, level+1, ToIdType(new_elems_right.size())); } ~BBTreeDst() diff --git a/src/INTERP_KERNEL/CellModel.cxx b/src/INTERP_KERNEL/CellModel.cxx index 133f9d027..e79822e62 100644 --- a/src/INTERP_KERNEL/CellModel.cxx +++ b/src/INTERP_KERNEL/CellModel.cxx @@ -449,7 +449,7 @@ namespace INTERP_KERNEL /*! * Equivalent to getNumberOfSons except that this method deals with dynamic type. */ - unsigned CellModel::getNumberOfSons2(const mcIdType *conn, int lgth) const + unsigned CellModel::getNumberOfSons2(const mcIdType *conn, mcIdType lgth) const { if(!isDynamic()) return getNumberOfSons(); @@ -466,7 +466,7 @@ namespace INTERP_KERNEL return std::count(conn,conn+lgth,-1)+1; } - unsigned CellModel::getNumberOfEdgesIn3D(const mcIdType *conn, int lgth) const + unsigned CellModel::getNumberOfEdgesIn3D(const mcIdType *conn, mcIdType lgth) const { if(!isDynamic()) return _nb_of_little_sons; @@ -558,7 +558,7 @@ namespace INTERP_KERNEL return nbOfTurnLoop; } - unsigned CellModel::fillSonCellNodalConnectivity2(int sonId, const mcIdType *nodalConn, int lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const + unsigned CellModel::fillSonCellNodalConnectivity2(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const { typeOfSon=getSonType2(sonId); if(!isDynamic()) @@ -601,7 +601,7 @@ namespace INTERP_KERNEL /*! * Equivalent to CellModel::fillSonCellNodalConnectivity2 except for HEXA8 where the order of sub faces is not has MED file numbering for transformation HEXA8->HEXA27 */ - unsigned CellModel::fillSonCellNodalConnectivity4(int sonId, const mcIdType *nodalConn, int lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const + unsigned CellModel::fillSonCellNodalConnectivity4(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const { if(_type==NORM_HEXA8) { @@ -612,7 +612,7 @@ namespace INTERP_KERNEL return fillSonCellNodalConnectivity2(sonId,nodalConn,lgth,sonNodalConn,typeOfSon); } - unsigned CellModel::fillSonEdgesNodalConnectivity3D(int sonId, const mcIdType *nodalConn, int lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const + unsigned CellModel::fillSonEdgesNodalConnectivity3D(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const { if(!isDynamic()) { @@ -732,7 +732,7 @@ namespace INTERP_KERNEL */ //================================================================================ - unsigned CellModel::getNumberOfNodesConstituentTheSon2(unsigned sonId, const mcIdType *nodalConn, int lgth) const + unsigned CellModel::getNumberOfNodesConstituentTheSon2(unsigned sonId, const mcIdType *nodalConn, mcIdType lgth) const { if(!isDynamic()) return getNumberOfNodesConstituentTheSon(sonId); @@ -765,7 +765,7 @@ namespace INTERP_KERNEL * If not an exception will be thrown. * @return True if two cells have same orientation, false if not. */ - bool CellModel::getOrientationStatus(unsigned lgth, const mcIdType *conn1, const mcIdType *conn2) const + bool CellModel::getOrientationStatus(mcIdType lgth, const mcIdType *conn1, const mcIdType *conn2) const { if(_dim!=1 && _dim!=2) throw INTERP_KERNEL::Exception("CellModel::getOrientationStatus : invalid dimension ! Must be 1 or 2 !"); diff --git a/src/INTERP_KERNEL/CellModel.hxx b/src/INTERP_KERNEL/CellModel.hxx index 7d8825145..369791950 100644 --- a/src/INTERP_KERNEL/CellModel.hxx +++ b/src/INTERP_KERNEL/CellModel.hxx @@ -58,14 +58,14 @@ namespace INTERP_KERNEL //! sonId is in C format. INTERPKERNEL_EXPORT const unsigned *getNodesConstituentTheSon(unsigned sonId) const { return _sons_con[sonId]; } INTERPKERNEL_EXPORT const unsigned *getNodesConstituentTheLittleSon(unsigned littleSonId) const { return _little_sons_con[littleSonId]; } - INTERPKERNEL_EXPORT bool getOrientationStatus(unsigned lgth, const mcIdType *conn1, const mcIdType *conn2) const; + INTERPKERNEL_EXPORT bool getOrientationStatus(mcIdType lgth, const mcIdType *conn1, const mcIdType *conn2) const; INTERPKERNEL_EXPORT unsigned getNumberOfNodes() const { return _nb_of_pts; } INTERPKERNEL_EXPORT unsigned getNumberOfSons() const { return _nb_of_sons; } - INTERPKERNEL_EXPORT unsigned getNumberOfSons2(const mcIdType *conn, int lgth) const; - INTERPKERNEL_EXPORT unsigned getNumberOfEdgesIn3D(const mcIdType *conn, int lgth) const; + INTERPKERNEL_EXPORT unsigned getNumberOfSons2(const mcIdType *conn, mcIdType lgth) const; + INTERPKERNEL_EXPORT unsigned getNumberOfEdgesIn3D(const mcIdType *conn, mcIdType lgth) const; INTERPKERNEL_EXPORT unsigned getNumberOfMicroEdges() const; INTERPKERNEL_EXPORT unsigned getNumberOfNodesConstituentTheSon(unsigned sonId) const { return _nb_of_sons_con[sonId]; } - INTERPKERNEL_EXPORT unsigned getNumberOfNodesConstituentTheSon2(unsigned sonId, const mcIdType *nodalConn, int lgth) const; + INTERPKERNEL_EXPORT unsigned getNumberOfNodesConstituentTheSon2(unsigned sonId, const mcIdType *nodalConn, mcIdType lgth) const; INTERPKERNEL_EXPORT NormalizedCellType getExtrudedType() const { return _extruded_type; } INTERPKERNEL_EXPORT NormalizedCellType getCorrespondingPolyType() const; INTERPKERNEL_EXPORT NormalizedCellType getReverseExtrudedType() const { return _reverse_extruded_type; } @@ -75,9 +75,9 @@ namespace INTERP_KERNEL INTERPKERNEL_EXPORT NormalizedCellType getSonType(unsigned sonId) const { return _sons_type[sonId]; } INTERPKERNEL_EXPORT NormalizedCellType getSonType2(unsigned sonId) const; INTERPKERNEL_EXPORT unsigned fillSonCellNodalConnectivity(int sonId, const mcIdType *nodalConn, mcIdType *sonNodalConn) const; - INTERPKERNEL_EXPORT unsigned fillSonCellNodalConnectivity2(int sonId, const mcIdType *nodalConn, int lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const; - INTERPKERNEL_EXPORT unsigned fillSonCellNodalConnectivity4(int sonId, const mcIdType *nodalConn, int lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const; - INTERPKERNEL_EXPORT unsigned fillSonEdgesNodalConnectivity3D(int sonId, const mcIdType *nodalConn, int lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const; + INTERPKERNEL_EXPORT unsigned fillSonCellNodalConnectivity2(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const; + INTERPKERNEL_EXPORT unsigned fillSonCellNodalConnectivity4(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const; + INTERPKERNEL_EXPORT unsigned fillSonEdgesNodalConnectivity3D(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const; INTERPKERNEL_EXPORT unsigned fillMicroEdgeNodalConnectivity(int sonId, const mcIdType *nodalConn, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const; INTERPKERNEL_EXPORT void changeOrientationOf2D(mcIdType *nodalConn, unsigned int sz) const; INTERPKERNEL_EXPORT void changeOrientationOf1D(mcIdType *nodalConn, unsigned int sz) const; diff --git a/src/INTERP_KERNEL/ConvexIntersector.txx b/src/INTERP_KERNEL/ConvexIntersector.txx index bf763e41c..3331675a3 100644 --- a/src/INTERP_KERNEL/ConvexIntersector.txx +++ b/src/INTERP_KERNEL/ConvexIntersector.txx @@ -68,7 +68,7 @@ namespace INTERP_KERNEL /*** Compute the intersection area ***/ INTERP_KERNEL::PolygonAlgorithms P(_epsilon, PlanarIntersector::_precision); std::deque inter = P.intersectConvexPolygons(&CoordsT[0], &CoordsS[0], - ToConnType(CoordsT.size())/SPACEDIM, ToConnType(CoordsS.size())/SPACEDIM); + int(CoordsT.size())/SPACEDIM, int(CoordsS.size())/SPACEDIM); double area[SPACEDIM]; int nb_inter =((int)inter.size())/SPACEDIM; for(int i = 1; i P(_epsilon, PlanarIntersector::_precision); std::deque inter = P.intersectConvexPolygons(quadrangle, &sourceCoords[0], - 4, nbOfNodesS); + 4, nbOfNodesS); double area[SPACEDIM]; int nb_inter =((int)inter.size())/SPACEDIM; for(int i = 1; i& sourceCoords) { double result = 0; - ConnType nbOfNodesS=ToConnType(sourceCoords.size())/SPACEDIM; - ConnType nbOfNodesT=ToConnType(targetCoords.size())/SPACEDIM; + int nbOfNodesS=int(sourceCoords.size())/SPACEDIM; + int nbOfNodesT=int(targetCoords.size())/SPACEDIM; /*** Compute the intersection area ***/ INTERP_KERNEL::PolygonAlgorithms P(_epsilon, PlanarIntersector::_precision); std::deque inter = P.intersectConvexPolygons(&targetCoords[0], &sourceCoords[0], diff --git a/src/INTERP_KERNEL/CurveIntersector.hxx b/src/INTERP_KERNEL/CurveIntersector.hxx index dfa03a4b9..339343820 100644 --- a/src/INTERP_KERNEL/CurveIntersector.hxx +++ b/src/INTERP_KERNEL/CurveIntersector.hxx @@ -54,7 +54,7 @@ namespace INTERP_KERNEL struct TDualSegment { std::vector _coords; - int _nodeId; // in mesh mode + ConnType _nodeId; // in mesh mode }; static void getDualSegments(ConnType icell, const MyMeshType& mesh, diff --git a/src/INTERP_KERNEL/CurveIntersector.txx b/src/INTERP_KERNEL/CurveIntersector.txx index 1aa6db204..50df7a994 100644 --- a/src/INTERP_KERNEL/CurveIntersector.txx +++ b/src/INTERP_KERNEL/CurveIntersector.txx @@ -77,7 +77,7 @@ namespace INTERP_KERNEL int ibox=0; for(long icell=0; icell::max(); } //updating the bounding box with each node of the element - for (int j=0; j @@ -180,7 +180,7 @@ namespace INTERP_KERNEL template bool CurveIntersector::getRealTargetCoordinates(ConnType icellT, std::vector& coordsT) const { - int nbNodesT(_connIndexT[OTT::ind2C(icellT)+1] - _connIndexT[OTT::ind2C(icellT)]); + ConnType nbNodesT(_connIndexT[OTT::ind2C(icellT)+1] - _connIndexT[OTT::ind2C(icellT)]); coordsT.resize(SPACEDIM*nbNodesT); for (ConnType iT=0; iT typename MyMeshType::MyConnType CurveIntersector::getNodeIdOfTargetCellAt(ConnType icellT, ConnType nodeIdInCellT) const { - int nbNodesT(_connIndexT[OTT::ind2C(icellT)+1] - _connIndexT[OTT::ind2C(icellT)]); + ConnType nbNodesT(_connIndexT[OTT::ind2C(icellT)+1] - _connIndexT[OTT::ind2C(icellT)]); if(nodeIdInCellT>=0 && nodeIdInCellT::coo2C(_connectT[OTT::conn2C(_connIndexT[OTT::ind2C(icellT)]+nodeIdInCellT)]); else @@ -218,7 +218,7 @@ namespace INTERP_KERNEL template bool CurveIntersector::getRealSourceCoordinates(ConnType icellS, std::vector& coordsS) const { - int nbNodesS = _connIndexS[OTT::ind2C(icellS)+1] - _connIndexS[OTT::ind2C(icellS)]; + ConnType nbNodesS = _connIndexS[OTT::ind2C(icellS)+1] - _connIndexS[OTT::ind2C(icellS)]; coordsS.resize(SPACEDIM*nbNodesS); for(ConnType iS=0; iS typename MyMeshType::MyConnType CurveIntersector::getNodeIdOfSourceCellAt(ConnType icellS, ConnType nodeIdInCellS) const { - int nbNodesS(_connIndexS[OTT::ind2C(icellS)+1] - _connIndexS[OTT::ind2C(icellS)]); + ConnType nbNodesS(_connIndexS[OTT::ind2C(icellS)+1] - _connIndexS[OTT::ind2C(icellS)]); if(nodeIdInCellS>=0 && nodeIdInCellS::coo2C(_connectS[OTT::conn2C(_connIndexS[OTT::ind2C(icellS)]+nodeIdInCellS)]); else @@ -259,9 +259,9 @@ namespace INTERP_KERNEL std::vector& segments) { // get coordinates of cell nodes - int nbNodes; - std::vector ncoords; - std::vector nodeIds; + ConnType nbNodes; + std::vector ncoords; + std::vector nodeIds; { const ConnType *connect = mesh.getConnectivityPtr(); const ConnType *connIndex = mesh.getConnectivityIndexPtr(); @@ -272,7 +272,7 @@ namespace INTERP_KERNEL ncoords.resize(SPACEDIM*nbNodes); nodeIds.resize(nbNodes); - for(int i=0; i::conn2C(connIndex[OTT::ind2C(icell)]+i)]; @@ -289,7 +289,7 @@ namespace INTERP_KERNEL // fill segments segments.clear(); segments.reserve( 2*nbNodes ); - for(int i=0; igetNbGauss(); @@ -3002,13 +3002,13 @@ double* GaussCoords::calculateCoords( NormalizedCellType theGeometry, } -void GaussCoords::calculateCoords( NormalizedCellType theGeometry, const double *theNodeCoords, const int theSpaceDim, const int *theIndex, double *result) +void GaussCoords::calculateCoords( NormalizedCellType theGeometry, const double *theNodeCoords, const int theSpaceDim, const mcIdType *theIndex, double *result) { const GaussInfo *info = getInfoGivenCellType(theGeometry); calculateCoordsAlg(info,theNodeCoords,theSpaceDim,theIndex,result); } -void GaussCoords::calculateCoordsAlg(const GaussInfo *info, const double* theNodeCoords, const int theSpaceDim, const int *theIndex, double *result) +void GaussCoords::calculateCoordsAlg(const GaussInfo *info, const double* theNodeCoords, const int theSpaceDim, const mcIdType *theIndex, double *result) { int aConn = info->getNbRef(); diff --git a/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.hxx b/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.hxx index a263134e8..70195f701 100644 --- a/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.hxx +++ b/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.hxx @@ -23,6 +23,7 @@ #include "INTERPKERNELDefines.hxx" #include "NormalizedUnstructuredMesh.hxx" #include "InterpKernelException.hxx" +#include "MCIdType.hxx" #include @@ -200,23 +201,23 @@ namespace INTERP_KERNEL INTERPKERNEL_EXPORT void addGaussInfo( NormalizedCellType theGeometry, int coordDim, const double* theGaussCoord, - int theNbGauss, + mcIdType theNbGauss, const double* theReferenceCoord, - int theNbRef); + mcIdType theNbRef); INTERPKERNEL_EXPORT double* calculateCoords( NormalizedCellType theGeometry, const double* theNodeCoords, const int theSpaceDim, - const int* theIndex); + const mcIdType* theIndex); INTERPKERNEL_EXPORT void calculateCoords( NormalizedCellType theGeometry, const double* theNodeCoords, const int theSpaceDim, - const int* theIndex, + const mcIdType* theIndex, double *result); private: const GaussInfo *getInfoGivenCellType(NormalizedCellType cellType); - void calculateCoordsAlg(const GaussInfo *info, const double* theNodeCoords, const int theSpaceDim, const int *theIndex, + void calculateCoordsAlg(const GaussInfo *info, const double* theNodeCoords, const int theSpaceDim, const mcIdType *theIndex, double *result); private: typedef std::vector GaussInfoVector; diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx index 074fd5b8f..7617feb11 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx @@ -166,13 +166,13 @@ unsigned MergePoints::getNumberOfAssociations() const return ret; } -void MergePoints::PushInMap(int key, int value, std::map& mergedNodes) +void MergePoints::PushInMap(mcIdType key, mcIdType value, std::map& mergedNodes) { if(key!=-1 && value!=-1) mergedNodes[key]=value; } -void MergePoints::updateMergedNodes(int e1Start, int e1End, int e2Start, int e2End, std::map& mergedNodes) +void MergePoints::updateMergedNodes(mcIdType e1Start, mcIdType e1End, mcIdType e2Start, mcIdType e2End, std::map& mergedNodes) { unsigned subTot(_ass1Start1+_ass1End1+_ass1Start2+_ass1End2); if(subTot!=0) @@ -984,7 +984,7 @@ bool Edge::isEqual(const Edge& other) const * \param [in,out] subNodes to be sorted * \return true if a reordering was necessary false if not. */ -bool Edge::sortSubNodesAbs(const double *coo, std::vector& subNodes) +bool Edge::sortSubNodesAbs(const double *coo, std::vector& subNodes) { Bounds b; b.prepareForAggregation(); @@ -998,8 +998,8 @@ bool Edge::sortSubNodesAbs(const double *coo, std::vector& subNodes) // std::size_t sz(subNodes.size()),i(0); std::vector< std::pair > an2(sz); - std::map m; - for(std::vector::const_iterator it=subNodes.begin();it!=subNodes.end();it++,i++) + std::map m; + for(std::vector::const_iterator it=subNodes.begin();it!=subNodes.end();it++,i++) { Node *n(new Node(coo[2*(*it)],coo[2*(*it)+1])); n->applySimilarity(xBary,yBary,dimChar); @@ -1011,12 +1011,12 @@ bool Edge::sortSubNodesAbs(const double *coo, std::vector& subNodes) bool ret(false); for(i=0;i::const_iterator it2=m.begin();it2!=m.end();it2++) + for(std::map::const_iterator it2=m.begin();it2!=m.end();it2++) (*it2).first->decrRef(); return ret; } @@ -1024,11 +1024,11 @@ bool Edge::sortSubNodesAbs(const double *coo, std::vector& subNodes) /** * Sort nodes so that they all lie consecutively on the edge that has been cut. */ -void Edge::sortIdsAbs(const std::vector& addNodes, const std::map& mapp1, - const std::map& mapp2, std::vector& edgesThis) +void Edge::sortIdsAbs(const std::vector& addNodes, const std::map& mapp1, + const std::map& mapp2, std::vector& edgesThis) { - int startId=(*mapp1.find(_start)).second; - int endId=(*mapp1.find(_end)).second; + mcIdType startId=(*mapp1.find(_start)).second; + mcIdType endId=(*mapp1.find(_end)).second; if (! addNodes.size()) // quick way out, no new node to add. { edgesThis.push_back(startId); @@ -1052,17 +1052,17 @@ void Edge::sortIdsAbs(const std::vector& addNodes, const for(std::size_t i=0;i(getCharactValueBtw0And1(*addNodes[i]),addNodes[i]); std::sort(an2.begin(),an2.end()); - std::vector tmpp; + std::vector tmpp; for(std::vector< std::pair >::const_iterator it=an2.begin();it!=an2.end();it++) { - int idd=(*mapp2.find((*it).second)).second; + mcIdType idd=(*mapp2.find((*it).second)).second; tmpp.push_back(idd); } - std::vector tmpp2(tmpp.size()+2); + std::vector tmpp2(tmpp.size()+2); tmpp2[0]=startId; std::copy(tmpp.begin(),tmpp.end(),tmpp2.begin()+1); tmpp2[tmpp.size()+1]=endId; - std::vector::iterator itt=std::unique(tmpp2.begin(),tmpp2.end()); + std::vector::iterator itt=std::unique(tmpp2.begin(),tmpp2.end()); tmpp2.resize(std::distance(tmpp2.begin(),itt)); int nbOfEdges=tmpp2.size()-1; for(int i=0;i& addNodes, const } } -void Edge::fillGlobalInfoAbs(bool direction, const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& edgesThis, std::vector& addCoo, std::map mapAddCoo) const +void Edge::fillGlobalInfoAbs(bool direction, const std::map& mapThis, const std::map& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY, + std::vector& edgesThis, std::vector& addCoo, std::map mapAddCoo) const { - int tmp[2]; + mcIdType tmp[2]; _start->fillGlobalInfoAbs(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,tmp); _end->fillGlobalInfoAbs(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,tmp+1); if(direction) @@ -1090,9 +1090,9 @@ void Edge::fillGlobalInfoAbs(bool direction, const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, +void Edge::fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY, short skipStartOrEnd, - std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const + std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const { if (skipStartOrEnd != -1) // see meaning in splitAbs() _start->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,edgesOther); diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx index 1b4438e1d..32ee76a10 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx @@ -25,6 +25,7 @@ #include "InterpKernelException.hxx" #include "InterpKernelGeo2DBounds.hxx" #include "InterpKernelGeo2DNode.hxx" +#include "MCIdType.hxx" #include #include @@ -82,9 +83,9 @@ namespace INTERP_KERNEL bool isEnd2(unsigned rk) const; void clear(); unsigned getNumberOfAssociations() const; - void updateMergedNodes(int e1Start, int e1End, int e2Start, int e2End, std::map& mergedNodes); + void updateMergedNodes(mcIdType e1Start, mcIdType e1End, mcIdType e2Start, mcIdType e2End, std::map& mergedNodes); private: - static void PushInMap(int key, int value, std::map& mergedNodes); + static void PushInMap(mcIdType key, mcIdType value, std::map& mergedNodes); private: unsigned _ass1Start1 : 1; unsigned _ass1End1 : 1; @@ -281,14 +282,14 @@ namespace INTERP_KERNEL void dumpToCout(const std::map& mapp, int index) const; bool isEqual(const Edge& other) const; public: - bool sortSubNodesAbs(const double *coo, std::vector& subNodes); - void sortIdsAbs(const std::vector& addNodes, const std::map& mapp1, const std::map& mapp2, std::vector& edgesThis); + bool sortSubNodesAbs(const double *coo, std::vector& subNodes); + void sortIdsAbs(const std::vector& addNodes, const std::map& mapp1, const std::map& mapp2, std::vector& edgesThis); virtual Edge *buildEdgeLyingOnMe(Node *start, Node *end, bool direction=true) const = 0; - void fillGlobalInfoAbs(bool direction, const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& edgesThis, std::vector& addCoo, std::map mapAddCoo) const; - void fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, + void fillGlobalInfoAbs(bool direction, const std::map& mapThis, const std::map& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY, + std::vector& edgesThis, std::vector& addCoo, std::map mapAddCoo) const; + void fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY, short skipStartOrEnd, - std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const; + std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const; protected: Edge():_cnt(1),_loc(FULL_UNKNOWN),_start(0),_end(0) { } diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx index f73b9e154..d54a41f48 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx @@ -495,8 +495,8 @@ EdgeArcCircle::EdgeArcCircle(double sX, double sY, double mX, double mY, double * @param angle0 in ]-Pi;Pi[ * @param deltaAngle in ]-2.*Pi;2.*Pi[ */ -EdgeArcCircle::EdgeArcCircle(Node *start, Node *end, const double *center, double radius, double angle0, double deltaAngle, bool direction):Edge(start,end,direction),_angle(deltaAngle), - _angle0(angle0),_radius(radius) +EdgeArcCircle::EdgeArcCircle(Node *start, Node *end, const double *center, double radius, double angle0, double deltaAngle, bool direction):Edge(start,end,direction),_angle0(angle0),_angle(deltaAngle), + _radius(radius) { _center[0]=center[0]; _center[1]=center[1]; @@ -546,7 +546,7 @@ void EdgeArcCircle::unApplySimilarity(double xBary, double yBary, double dimChar * 'conn' is of size 3. conn[0] is start id, conn[1] is end id and conn[2] is middle id. * 'offset' is typically the number of nodes already existing in global 2D curve mesh. Additional coords 'addCoo' ids will be put after the already existing. */ -void EdgeArcCircle::tesselate(const int *conn, int offset, double eps, std::vector& newConn, std::vector& addCoo) const +void EdgeArcCircle::tesselate(const mcIdType *conn, mcIdType offset, double eps, std::vector& newConn, std::vector& addCoo) const { newConn.push_back(INTERP_KERNEL::NORM_POLYL); int nbOfSubDiv=(int)(fabs(_angle)/eps); @@ -556,7 +556,7 @@ void EdgeArcCircle::tesselate(const int *conn, int offset, double eps, std::vect return ; } double signOfAngle=_angle>0.?1.:-1.; - int offset2=offset+((int)addCoo.size())/2; + mcIdType offset2=offset+(ToIdType(addCoo.size()))/2; newConn.push_back(conn[0]); for(int i=1;i& newConn, std::vector& addCoo) const; + void tesselate(const mcIdType *conn, mcIdType offset, double eps, std::vector& newConn, std::vector& addCoo) const; static EdgeArcCircle *BuildFromNodes(Node *start, Node *middle, Node *end); static double GetAbsoluteAngle(const double *vect, double& normVect); static double GetAbsoluteAngleOfNormalizedVect(double ux, double uy); diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.cxx index 857821515..76a54f14b 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.cxx @@ -219,8 +219,8 @@ bool ElementaryEdge::isEqual(const ElementaryEdge& other) const /*! * Called by QuadraticPolygon::splitAbs method. */ -void ElementaryEdge::fillGlobalInfoAbs(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& edgesThis, std::vector& addCoo, std::map mapAddCoo) const +void ElementaryEdge::fillGlobalInfoAbs(const std::map& mapThis, const std::map& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY, + std::vector& edgesThis, std::vector& addCoo, std::map mapAddCoo) const { _ptr->fillGlobalInfoAbs(_direction,mapThis,mapOther,offset1,offset2,fact,baryX,baryY,edgesThis,addCoo,mapAddCoo); } @@ -229,9 +229,9 @@ void ElementaryEdge::fillGlobalInfoAbs(const std::map * Called by QuadraticPolygon::splitAbs method. Close to ElementaryEdge::fillGlobalInfoAbs method expect that here edgesOther (that replace edgesThis) is here an in/out parameter that only contains nodes * unsorted because the "other" mesh is not subdivided yet. */ -void ElementaryEdge::fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, +void ElementaryEdge::fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY, short skipStartOrEnd, - std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const + std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const { if (!_direction) skipStartOrEnd *= -1; // invert value - see QuadraticPolygon::splitAbs() diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx index 3446b70ff..55b90d455 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx @@ -70,11 +70,11 @@ namespace INTERP_KERNEL INTERPKERNEL_EXPORT bool intresincEqCoarse(const Edge *other) const; INTERPKERNEL_EXPORT bool isEqual(const ElementaryEdge& other) const; public: - INTERPKERNEL_EXPORT void fillGlobalInfoAbs(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& edgesThis, std::vector& addCoo, std::map mapAddCoo) const; - INTERPKERNEL_EXPORT void fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, + INTERPKERNEL_EXPORT void fillGlobalInfoAbs(const std::map& mapThis, const std::map& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY, + std::vector& edgesThis, std::vector& addCoo, std::map mapAddCoo) const; + INTERPKERNEL_EXPORT void fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY, short skipStartOrEnd, - std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const; + std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const; INTERPKERNEL_EXPORT static ElementaryEdge *BuildEdgeFromStartEndDir(bool direction, INTERP_KERNEL::Node *start, INTERP_KERNEL::Node *end); private: bool _direction; diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.cxx index c48d783f9..31f762236 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.cxx @@ -148,10 +148,10 @@ void Node::unApplySimilarity(double xBary, double yBary, double dimChar) /*! * Called by QuadraticPolygon::splitAbs method. */ -void Node::fillGlobalInfoAbs(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& addCoo, std::map& mapAddCoo, int *nodeId) const +void Node::fillGlobalInfoAbs(const std::map& mapThis, const std::map& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY, + std::vector& addCoo, std::map& mapAddCoo, mcIdType *nodeId) const { - std::map::const_iterator it=mapOther.find(const_cast(this)); + std::map::const_iterator it=mapOther.find(const_cast(this)); if(it!=mapOther.end()) // order matters, try in mapOther first. { *nodeId=(*it).second+offset1; @@ -179,10 +179,10 @@ void Node::fillGlobalInfoAbs(const std::map& mapThis, /*! * Called by QuadraticPolygon::splitAbs method. */ -void Node::fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& addCoo, std::map& mapAddCoo, std::vector& pointsOther) const +void Node::fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY, + std::vector& addCoo, std::map& mapAddCoo, std::vector& pointsOther) const { - int tmp; + mcIdType tmp; std::size_t sz1=addCoo.size(); fillGlobalInfoAbs(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,&tmp); if(sz1!=addCoo.size() // newly created point @@ -192,7 +192,7 @@ void Node::fillGlobalInfoAbs2(const std::map& mapThis pointsOther.push_back(tmp); return ; } - std::vector::const_iterator it=std::find(pointsOther.begin(),pointsOther.end(),tmp); + std::vector::const_iterator it=std::find(pointsOther.begin(),pointsOther.end(),tmp); if(it!=pointsOther.end()) return ; pointsOther.push_back(tmp); diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.hxx index be9ba0d58..b6ac1863e 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.hxx @@ -23,6 +23,7 @@ #include "InterpKernelGeo2DPrecision.hxx" #include "INTERPKERNELDefines.hxx" +#include "MCIdType.hxx" #include #include @@ -96,10 +97,10 @@ namespace INTERP_KERNEL static double distanceBtw2Pt(const double *a, const double *b) { return sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1])); } static double distanceBtw2PtSq(const double *a, const double *b) { return (a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1]); } // - void fillGlobalInfoAbs(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& addCoo, std::map& mapAddCoo, int *nodeId) const; - void fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& addCoo, std::map& mapAddCoo, std::vector& pointsOther) const; + void fillGlobalInfoAbs(const std::map& mapThis, const std::map& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY, + std::vector& addCoo, std::map& mapAddCoo, mcIdType *nodeId) const; + void fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY, + std::vector& addCoo, std::map& mapAddCoo, std::vector& pointsOther) const; protected: ~Node(); protected: diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx index 3e4c6c10d..5ccc4c06b 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx @@ -284,12 +284,12 @@ double QuadraticPolygon::intersectWithAbs(QuadraticPolygon& other) * the cell id in global other mesh. */ void QuadraticPolygon::splitAbs(QuadraticPolygon& other, - const std::map& mapThis, const std::map& mapOther, - int offset1, int offset2 , - const std::vector& otherEdgeIds, - std::vector& edgesThis, int cellIdThis, - std::vector< std::vector >& edgesInOtherColinearWithThis, std::vector< std::vector >& subDivOther, - std::vector& addCoo, std::map& mergedNodes) + const std::map& mapThis, const std::map& mapOther, + mcIdType offset1, mcIdType offset2 , + const std::vector& otherEdgeIds, + std::vector& edgesThis, mcIdType cellIdThis, + std::vector< std::vector >& edgesInOtherColinearWithThis, std::vector< std::vector >& subDivOther, + std::vector& addCoo, std::map& mergedNodes) { double xBaryBB, yBaryBB; double fact=normalizeExt(&other, xBaryBB, yBaryBB); @@ -300,7 +300,7 @@ void QuadraticPolygon::splitAbs(QuadraticPolygon& other, ComposedEdge *cThis=new ComposedEdge; ComposedEdge *cOther=new ComposedEdge; int i=0; - std::map mapAddCoo; + std::map mapAddCoo; for(itOther.first();!itOther.finished();itOther.next(),i++) { // For each edge of 'other', proceed with intersections: the edge might split into sub-edges, 'otherTmp' will hold the final split result. @@ -322,7 +322,7 @@ void QuadraticPolygon::splitAbs(QuadraticPolygon& other, ElementaryEdge* curThis=itThis.current(); merge.clear(); // - std::map::const_iterator thisStart(mapThis.find(curThis->getStartNode())),thisEnd(mapThis.find(curThis->getEndNode())), + std::map::const_iterator thisStart(mapThis.find(curThis->getStartNode())),thisEnd(mapThis.find(curThis->getEndNode())), otherStart(mapOther.find(curOtherTmp->getStartNode())),otherEnd(mapOther.find(curOtherTmp->getEndNode())); int thisStart2(thisStart==mapThis.end()?-1:(*thisStart).second), thisEnd2(thisEnd==mapThis.end()?-1:(*thisEnd).second), otherStart2(otherStart==mapOther.end()?-1:(*otherStart).second+offset1),otherEnd2(otherEnd==mapOther.end()?-1:(*otherEnd).second+offset1); @@ -386,8 +386,8 @@ void QuadraticPolygon::splitAbs(QuadraticPolygon& other, * orientation of edge (see buildDescendingConnectivity2() method). * See appendEdgeFromCrudeDataArray() for params description. */ -void QuadraticPolygon::buildFromCrudeDataArray(const std::map& mapp, bool isQuad, const int *nodalBg, const double *coords, - const int *descBg, const int *descEnd, const std::vector >& intersectEdges) +void QuadraticPolygon::buildFromCrudeDataArray(const std::map& mapp, bool isQuad, const mcIdType *nodalBg, const double *coords, + const mcIdType *descBg, const mcIdType *descEnd, const std::vector >& intersectEdges) { std::size_t nbOfSeg=std::distance(descBg,descEnd); for(std::size_t i=0;i& mapp, bool isQuad, - const int *nodalBg, const double *coords, - const int *descBg, const int *descEnd, const std::vector >& intersectEdges) +void QuadraticPolygon::appendEdgeFromCrudeDataArray(std::size_t edgePos, const std::map& mapp, bool isQuad, + const mcIdType *nodalBg, const double *coords, + const mcIdType *descBg, const mcIdType *descEnd, const std::vector >& intersectEdges) { if(!isQuad) { bool direct=descBg[edgePos]>0; - int edgeId=abs(descBg[edgePos])-1; // back to C indexing mode - const std::vector& subEdge=intersectEdges[edgeId]; + mcIdType edgeId=abs(descBg[edgePos])-1; // back to C indexing mode + const std::vector& subEdge=intersectEdges[edgeId]; std::size_t nbOfSubEdges=subEdge.size()/2; for(std::size_t j=0;j0; - int edgeId=abs(descBg[edgePos])-1; - const std::vector& subEdge=intersectEdges[edgeId]; + mcIdType edgeId=abs(descBg[edgePos])-1; + const std::vector& subEdge=intersectEdges[edgeId]; std::size_t nbOfSubEdges=subEdge.size()/2; if(colinearity) { @@ -445,7 +445,7 @@ void QuadraticPolygon::appendEdgeFromCrudeDataArray(std::size_t edgePos, const s } } -void QuadraticPolygon::appendSubEdgeFromCrudeDataArray(Edge *baseEdge, std::size_t j, bool direct, int edgeId, const std::vector& subEdge, const std::map& mapp) +void QuadraticPolygon::appendSubEdgeFromCrudeDataArray(Edge *baseEdge, std::size_t j, bool direct, mcIdType edgeId, const std::vector& subEdge, const std::map& mapp) { std::size_t nbOfSubEdges=subEdge.size()/2; if(!baseEdge) @@ -469,17 +469,17 @@ void QuadraticPolygon::appendSubEdgeFromCrudeDataArray(Edge *baseEdge, std::size * This method builds from descending conn of a quadratic polygon stored in crude mode (MEDCoupling). Descending conn is in FORTRAN relative mode in order to give the * orientation of edge. */ -void QuadraticPolygon::buildFromCrudeDataArray2(const std::map& mapp, bool isQuad, const int *nodalBg, const double *coords, const int *descBg, const int *descEnd, const std::vector >& intersectEdges2, - const INTERP_KERNEL::QuadraticPolygon& pol1, const int *descBg1, const int *descEnd1, const std::vector >& intersectEdges1, - const std::vector< std::vector >& colinear1, - std::map >& alreadyExistingIn2) +void QuadraticPolygon::buildFromCrudeDataArray2(const std::map& mapp, bool isQuad, const mcIdType *nodalBg, const double *coords, const mcIdType *descBg, const mcIdType *descEnd, const std::vector >& intersectEdges2, + const INTERP_KERNEL::QuadraticPolygon& pol1, const mcIdType *descBg1, const mcIdType *descEnd1, const std::vector >& intersectEdges1, + const std::vector< std::vector >& colinear1, + std::map >& alreadyExistingIn2) { std::size_t nbOfSeg=std::distance(descBg,descEnd); for(std::size_t i=0;i0; - int edgeId=abs(descBg[i])-1;//current edge id of pol2 - std::map >::const_iterator it1=alreadyExistingIn2.find(descBg[i]),it2=alreadyExistingIn2.find(-descBg[i]); + mcIdType edgeId=abs(descBg[i])-1;//current edge id of pol2 + std::map >::const_iterator it1=alreadyExistingIn2.find(descBg[i]),it2=alreadyExistingIn2.find(-descBg[i]); if(it1!=alreadyExistingIn2.end() || it2!=alreadyExistingIn2.end()) { bool sameDir=(it1!=alreadyExistingIn2.end()); @@ -503,18 +503,18 @@ void QuadraticPolygon::buildFromCrudeDataArray2(const std::map > > idIns1; - int offset1=0; + std::vector > > idIns1; + mcIdType offset1=0; if(!directos) {// if the current edge of pol2 has one or more colinear edges part into pol1 - const std::vector& c=colinear1[edgeId]; + const std::vector& c=colinear1[edgeId]; std::size_t nbOfEdgesIn1=std::distance(descBg1,descEnd1); for(std::size_t j=0;j >(edgeId1,std::pair(descBg1[j]>0,offset1)));// it exists an edge into pol1 given by tuple (idIn1,direct1) that is colinear at edge 'edgeId' in pol2 + idIns1.push_back(std::pair >(edgeId1,std::pair(descBg1[j]>0,offset1)));// it exists an edge into pol1 given by tuple (idIn1,direct1) that is colinear at edge 'edgeId' in pol2 //std::pair0; } offset1+=intersectEdges1[edgeId1].size()/2;//offset1 is used to find the INTERP_KERNEL::Edge * instance into pol1 that will be part of edge into pol2 @@ -534,22 +534,22 @@ void QuadraticPolygon::buildFromCrudeDataArray2(const std::map& subEdge=intersectEdges2[edgeId]; + const std::vector& subEdge=intersectEdges2[edgeId]; std::size_t nbOfSubEdges=subEdge.size()/2; for(std::size_t j=0;j > >::const_iterator it=idIns1.begin();it!=idIns1.end() && !found;it++) + for(std::vector > >::const_iterator it=idIns1.begin();it!=idIns1.end() && !found;it++) { - int idIn1=(*it).first;//store if needed the cell id in 1 + mcIdType idIn1=(*it).first;//store if needed the cell id in 1 direct1=(*it).second.first; offset1=(*it).second.second; - const std::vector& subEdge1PossiblyAlreadyIn1=intersectEdges1[idIn1]; + const std::vector& subEdge1PossiblyAlreadyIn1=intersectEdges1[idIn1]; nbOfSubEdges1=subEdge1PossiblyAlreadyIn1.size()/2; offset2=0; for(std::size_t k=0;k >& intersectEdges, - const INTERP_KERNEL::QuadraticPolygon& pol1, const int *descBg1, const int *descEnd1, - const std::vector >& intersectEdges1, const std::vector< std::vector >& colinear1) const +void QuadraticPolygon::updateLocOfEdgeFromCrudeDataArray2(const mcIdType *descBg, const mcIdType *descEnd, const std::vector >& intersectEdges, + const INTERP_KERNEL::QuadraticPolygon& pol1, const mcIdType *descBg1, const mcIdType *descEnd1, + const std::vector >& intersectEdges1, const std::vector< std::vector >& colinear1) const { std::size_t nbOfSeg=std::distance(descBg,descEnd); for(std::size_t i=0;i0; - int edgeId=abs(descBg[i])-1;//current edge id of pol2 - const std::vector& c=colinear1[edgeId]; + mcIdType edgeId=abs(descBg[i])-1;//current edge id of pol2 + const std::vector& c=colinear1[edgeId]; if(c.empty()) continue; - const std::vector& subEdge=intersectEdges[edgeId]; + const std::vector& subEdge=intersectEdges[edgeId]; std::size_t nbOfSubEdges=subEdge.size()/2; // std::size_t nbOfEdgesIn1=std::distance(descBg1,descEnd1); - int offset1=0; + mcIdType offset1=0; for(std::size_t j=0;j0; - const std::vector& subEdge1PossiblyAlreadyIn1=intersectEdges1[idIn1]; + const std::vector& subEdge1PossiblyAlreadyIn1=intersectEdges1[idIn1]; std::size_t nbOfSubEdges1=subEdge1PossiblyAlreadyIn1.size()/2; - int offset2=0; + mcIdType offset2=0; bool found=false; for(std::size_t kk=0;kk& mapp, double xBary, double yBary, double fact, int offset, std::vector& addCoordsQuadratic, std::vector& conn, std::vector& connI) const +void QuadraticPolygon::appendCrudeData(const std::map& mapp, double xBary, double yBary, double fact, mcIdType offset, std::vector& addCoordsQuadratic, std::vector& conn, std::vector& connI) const { int nbOfNodesInPg=0; bool presenceOfQuadratic=presenceOfQuadraticEdge(); @@ -648,14 +648,14 @@ void QuadraticPolygon::appendCrudeData(const std::map { Node *tmp=0; tmp=(*it)->getStartNode(); - std::map::const_iterator it1=mapp.find(tmp); + std::map::const_iterator it1=mapp.find(tmp); conn.push_back((*it1).second); nbOfNodesInPg++; } if(presenceOfQuadratic) { int j=0; - int off=offset+((int)addCoordsQuadratic.size())/2; + mcIdType off=offset+ToIdType(addCoordsQuadratic.size())/2; for(std::list::const_iterator it=_sub_edges.begin();it!=_sub_edges.end();it++,j++,nbOfNodesInPg++) { INTERP_KERNEL::Node *node=(*it)->getPtr()->buildRepresentantOfMySelf(); @@ -676,9 +676,9 @@ void QuadraticPolygon::appendCrudeData(const std::map * @param [in,out] edgesBoundaryOther, parameter that stores all edges in result of intersection that are not */ void QuadraticPolygon::buildPartitionsAbs(QuadraticPolygon& other, std::set& edgesThis, std::set& edgesBoundaryOther, - const std::map& mapp, int idThis, int idOther, int offset, - std::vector& addCoordsQuadratic, std::vector& conn, std::vector& connI, - std::vector& nbThis, std::vector& nbOther) + const std::map& mapp, mcIdType idThis, mcIdType idOther, mcIdType offset, + std::vector& addCoordsQuadratic, std::vector& conn, std::vector& connI, + std::vector& nbThis, std::vector& nbOther) { double xBaryBB, yBaryBB; double fact=normalizeExt(&other, xBaryBB, yBaryBB); @@ -1244,9 +1244,9 @@ std::list::iterator QuadraticPolygon::CheckInList(Node *n, s * intersecting cells */ void QuadraticPolygon::ComputeResidual(const QuadraticPolygon& pol1, const std::set& notUsedInPol1, const std::set& edgesInPol2OnBoundary, - const std::map& mapp, int offset, int idThis, - std::vector& addCoordsQuadratic, std::vector& conn, - std::vector& connI, std::vector& nb1, std::vector& nb2) + const std::map& mapp, mcIdType offset, mcIdType idThis, + std::vector& addCoordsQuadratic, std::vector& conn, + std::vector& connI, std::vector& nb1, std::vector& nb2) { // Initialise locations on pol1. Remember that edges found in 'notUsedInPol1' are also part of the edges forming pol1. pol1.initLocations(); diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.hxx index 4814be460..478b10ad2 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.hxx @@ -66,21 +66,21 @@ namespace INTERP_KERNEL INTERPKERNEL_EXPORT double intersectWithAbs1D(QuadraticPolygon& other, bool& isColinear); //! Before intersecting as intersectWith a normalization is done. INTERPKERNEL_EXPORT double intersectWithAbs(QuadraticPolygon& other, double* barycenter); - INTERPKERNEL_EXPORT void splitAbs(QuadraticPolygon& other, const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, const std::vector& otherEdgeIds, - std::vector& edgesThis, int cellIdThis, std::vector< std::vector >& edgesInOtherColinearWithThis, std::vector< std::vector >& subDivOther, std::vector& addCoo, std::map& mergedNodes); - INTERPKERNEL_EXPORT void buildFromCrudeDataArray(const std::map& mapp, bool isQuad, const int *nodalBg, const double *coords, - const int *descBg, const int *descEnd, const std::vector >& intersectEdges); - INTERPKERNEL_EXPORT void buildFromCrudeDataArray2(const std::map& mapp, bool isQuad, const int *nodalBg, const double *coords, const int *descBg, const int *descEnd, const std::vector >& intersectEdges, - const INTERP_KERNEL::QuadraticPolygon& pol1, const int *descBg1, const int *descEnd1, const std::vector >& intersectEdges1, - const std::vector< std::vector >& colinear1, - std::map >& alreadyExistingIn2); - INTERPKERNEL_EXPORT void updateLocOfEdgeFromCrudeDataArray2(const int *descBg, const int *descEnd, const std::vector >& intersectEdges, const INTERP_KERNEL::QuadraticPolygon& pol1, const int *descBg1, const int *descEnd1, const std::vector >& intersectEdges1, const std::vector< std::vector >& colinear1) const; - INTERPKERNEL_EXPORT void appendEdgeFromCrudeDataArray(std::size_t edgeId, const std::map& mapp, bool isQuad, const int *nodalBg, const double *coords, - const int *descBg, const int *descEnd, const std::vector >& intersectEdges); - INTERPKERNEL_EXPORT void appendSubEdgeFromCrudeDataArray(Edge *baseEdge, std::size_t j, bool direct, int edgeId, const std::vector& subEdge, const std::map& mapp); - INTERPKERNEL_EXPORT void appendCrudeData(const std::map& mapp, double xBary, double yBary, double fact, int offset, std::vector& addCoordsQuadratic, std::vector& conn, std::vector& connI) const; - INTERPKERNEL_EXPORT void buildPartitionsAbs(QuadraticPolygon& other, std::set& edgesThis, std::set& edgesBoundaryOther, const std::map& mapp, int idThis, int idOther, int offset, - std::vector& addCoordsQuadratic, std::vector& conn, std::vector& connI, std::vector& nb1, std::vector& nb2); + INTERPKERNEL_EXPORT void splitAbs(QuadraticPolygon& other, const std::map& mapThis, const std::map& mapOther, mcIdType offset1, mcIdType offset2, const std::vector& otherEdgeIds, + std::vector& edgesThis, mcIdType cellIdThis, std::vector< std::vector >& edgesInOtherColinearWithThis, std::vector< std::vector >& subDivOther, std::vector& addCoo, std::map& mergedNodes); + INTERPKERNEL_EXPORT void buildFromCrudeDataArray(const std::map& mapp, bool isQuad, const mcIdType *nodalBg, const double *coords, + const mcIdType *descBg, const mcIdType *descEnd, const std::vector >& intersectEdges); + INTERPKERNEL_EXPORT void buildFromCrudeDataArray2(const std::map& mapp, bool isQuad, const mcIdType *nodalBg, const double *coords, const mcIdType *descBg, const mcIdType *descEnd, const std::vector >& intersectEdges, + const INTERP_KERNEL::QuadraticPolygon& pol1, const mcIdType *descBg1, const mcIdType *descEnd1, const std::vector >& intersectEdges1, + const std::vector< std::vector >& colinear1, + std::map >& alreadyExistingIn2); + INTERPKERNEL_EXPORT void updateLocOfEdgeFromCrudeDataArray2(const mcIdType *descBg, const mcIdType *descEnd, const std::vector >& intersectEdges, const INTERP_KERNEL::QuadraticPolygon& pol1, const mcIdType *descBg1, const mcIdType *descEnd1, const std::vector >& intersectEdges1, const std::vector< std::vector >& colinear1) const; + INTERPKERNEL_EXPORT void appendEdgeFromCrudeDataArray(std::size_t edgeId, const std::map& mapp, bool isQuad, const mcIdType *nodalBg, const double *coords, + const mcIdType *descBg, const mcIdType *descEnd, const std::vector >& intersectEdges); + INTERPKERNEL_EXPORT void appendSubEdgeFromCrudeDataArray(Edge *baseEdge, std::size_t j, bool direct, mcIdType edgeId, const std::vector& subEdge, const std::map& mapp); + INTERPKERNEL_EXPORT void appendCrudeData(const std::map& mapp, double xBary, double yBary, double fact, mcIdType offset, std::vector& addCoordsQuadratic, std::vector& conn, std::vector& connI) const; + INTERPKERNEL_EXPORT void buildPartitionsAbs(QuadraticPolygon& other, std::set& edgesThis, std::set& edgesBoundaryOther, const std::map& mapp, mcIdType idThis, mcIdType idOther, mcIdType offset, + std::vector& addCoordsQuadratic, std::vector& conn, std::vector& connI, std::vector& nb1, std::vector& nb2); // INTERPKERNEL_EXPORT double intersectWith(const QuadraticPolygon& other) const; INTERPKERNEL_EXPORT double intersectWith(const QuadraticPolygon& other, double* barycenter) const; @@ -95,8 +95,8 @@ namespace INTERP_KERNEL INTERPKERNEL_EXPORT std::vector buildIntersectionPolygons(const QuadraticPolygon& pol1, const QuadraticPolygon& pol2) const; INTERPKERNEL_EXPORT bool haveIAChanceToBeCompletedBy(const QuadraticPolygon& pol1NotSplitted, const QuadraticPolygon& pol2Splitted, bool& direction, bool& needCleaning) const; - INTERPKERNEL_EXPORT static void ComputeResidual(const QuadraticPolygon& pol1, const std::set& notUsedInPol1, const std::set& edgesInPol2OnBoundary, const std::map& mapp, int offset, int idThis, - std::vector& addCoordsQuadratic, std::vector& conn, std::vector& connI, std::vector& nb1, std::vector& nb2); + INTERPKERNEL_EXPORT static void ComputeResidual(const QuadraticPolygon& pol1, const std::set& notUsedInPol1, const std::set& edgesInPol2OnBoundary, const std::map& mapp, mcIdType offset, mcIdType idThis, + std::vector& addCoordsQuadratic, std::vector& conn, std::vector& connI, std::vector& nb1, std::vector& nb2); INTERPKERNEL_EXPORT void cleanDegeneratedConsecutiveEdges(); protected: std::list zipConsecutiveInSegments() const; diff --git a/src/INTERP_KERNEL/InterpKernelCellSimplify.cxx b/src/INTERP_KERNEL/InterpKernelCellSimplify.cxx index 333e75eff..1fa6079c9 100644 --- a/src/INTERP_KERNEL/InterpKernelCellSimplify.cxx +++ b/src/INTERP_KERNEL/InterpKernelCellSimplify.cxx @@ -39,12 +39,12 @@ using namespace INTERP_KERNEL; * It retrieves the same cell with a potentially different type (in return) whose connectivity is defined by (retConn,retLgth) * \b WARNING for optimization reason the arrays 'retConn' and 'conn' can overlapped ! */ -INTERP_KERNEL::NormalizedCellType CellSimplify::simplifyDegeneratedCell(INTERP_KERNEL::NormalizedCellType type, const mcIdType *conn, int lgth, mcIdType *retConn, int& retLgth) +INTERP_KERNEL::NormalizedCellType CellSimplify::simplifyDegeneratedCell(INTERP_KERNEL::NormalizedCellType type, const mcIdType *conn, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth) { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); std::set c(conn,conn+lgth); c.erase(-1); - bool isObviousNonDegeneratedCell=((int)c.size()==lgth); + bool isObviousNonDegeneratedCell=(ToIdType(c.size())==lgth); if((cm.getDimension()==3 && cm.isQuadratic()) || isObviousNonDegeneratedCell) {//quadratic 3D, do nothing for the moment. retLgth=lgth; @@ -85,7 +85,7 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::simplifyDegeneratedCell(INTERP_K } if(cm.getDimension()==3) { - int nbOfFaces,lgthOfPolyhConn; + mcIdType nbOfFaces,lgthOfPolyhConn; mcIdType *zipFullReprOfPolyh=getFullPolyh3DCell(type,conn,lgth,nbOfFaces,lgthOfPolyhConn); INTERP_KERNEL::NormalizedCellType ret=tryToUnPoly3D(zipFullReprOfPolyh,nbOfFaces,lgthOfPolyhConn,retConn,retLgth); delete [] zipFullReprOfPolyh; @@ -99,7 +99,7 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::simplifyDegeneratedCell(INTERP_K * This static method tries to unpolygonize a cell whose connectivity is given by 'conn' and 'lgth'. * Contrary to INTERP_KERNEL::CellSimplify::simplifyDegeneratedCell method 'conn' and 'retConn' do not overlap. */ -INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPoly2D(bool isQuad, const mcIdType *conn, int lgth, mcIdType *retConn, int& retLgth) +INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPoly2D(bool isQuad, const mcIdType *conn, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth) { retLgth=lgth; std::copy(conn,conn+lgth,retConn); @@ -135,8 +135,8 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPoly2D(bool isQuad, const * The format of output array is the following : * 1,2,3,-1,3,4,2,-1,3,4,1,-1,1,2,4,NORM_TRI3,NORM_TRI3,NORM_TRI3 (faces type at the end of classical polyhedron nodal description) */ -mcIdType *CellSimplify::getFullPolyh3DCell(INTERP_KERNEL::NormalizedCellType type, const mcIdType *conn, int lgth, - int& retNbOfFaces, int& retLgth) +mcIdType *CellSimplify::getFullPolyh3DCell(INTERP_KERNEL::NormalizedCellType type, const mcIdType *conn, mcIdType lgth, + mcIdType& retNbOfFaces, mcIdType& retLgth) { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); unsigned nbOfFaces=cm.getNumberOfSons2(conn,lgth); @@ -150,7 +150,7 @@ mcIdType *CellSimplify::getFullPolyh3DCell(INTERP_KERNEL::NormalizedCellType typ // mcIdType *tmp2=new mcIdType[offset]; tmp2[0]=work[0]; - int newPos=1; + mcIdType newPos=1; for(unsigned k=1;k nodes(conn,conn+lgth); nodes.erase(-1); @@ -202,7 +202,7 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPoly3D(const mcIdType *co } } -bool CellSimplify::orientOppositeFace(const mcIdType *baseFace, mcIdType *retConn, const mcIdType *sideFace, int lgthBaseFace) +bool CellSimplify::orientOppositeFace(const mcIdType *baseFace, mcIdType *retConn, const mcIdType *sideFace, mcIdType lgthBaseFace) { std::vector tmp2; std::set bases(baseFace,baseFace+lgthBaseFace); @@ -213,7 +213,7 @@ bool CellSimplify::orientOppositeFace(const mcIdType *baseFace, mcIdType *retCon std::vector< std::pair > baseEdges(lgthBaseFace); std::vector< std::pair > oppEdges(lgthBaseFace); std::vector< std::pair > sideEdges(4); - for(int i=0;i(baseFace[i],baseFace[(i+1)%lgthBaseFace]); oppEdges[i]=std::pair(retConn[i],retConn[(i+1)%lgthBaseFace]); @@ -273,7 +273,7 @@ bool CellSimplify::orientOppositeFace(const mcIdType *baseFace, mcIdType *retCon return true; } -bool CellSimplify::isWellOriented(const mcIdType *baseFace, mcIdType *retConn, const mcIdType *sideFace, int lgthBaseFace) +bool CellSimplify::isWellOriented(const mcIdType *baseFace, mcIdType *retConn, const mcIdType *sideFace, mcIdType lgthBaseFace) { return true; } @@ -283,10 +283,10 @@ bool CellSimplify::isWellOriented(const mcIdType *baseFace, mcIdType *retConn, c * k_th node in retConnOfOppFace. Excluded faces 'baseFace' and 'oppFace' all the other faces in 'conn' must be QUAD4 faces. * If the arrangement process succeeds true is returned and retConnOfOppFace is filled. */ -bool CellSimplify::tryToArrangeOppositeFace(const mcIdType *conn, int lgth, int lgthBaseFace, const mcIdType *baseFace, const mcIdType *oppFace, int nbOfFaces, mcIdType *retConnOfOppFace) +bool CellSimplify::tryToArrangeOppositeFace(const mcIdType *conn, mcIdType lgth, mcIdType lgthBaseFace, const mcIdType *baseFace, const mcIdType *oppFace, mcIdType nbOfFaces, mcIdType *retConnOfOppFace) { retConnOfOppFace[0]=oppFace[0]; - for(int j=1;j(),(mcIdType)INTERP_KERNEL::NORM_QUAD4))==conn+lgth+nbOfFaces) + if(std::find_if(conn+lgth,conn+lgth+nbOfFaces,std::bind2nd(std::not_equal_to(),ToIdType(INTERP_KERNEL::NORM_QUAD4)))==conn+lgth+nbOfFaces) {//6 faces are QUAD4. int oppositeFace=-1; std::set conn1(conn,conn+4); @@ -343,15 +343,15 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyHex8(const mcIdType * return INTERP_KERNEL::NORM_POLYHED; } -INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyHexp12(const mcIdType *conn, int nbOfFaces, int lgth, mcIdType *retConn, int& retLgth) +INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyHexp12(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth) { - std::size_t nbOfHexagon=std::count(conn+lgth,conn+lgth+nbOfFaces,(mcIdType)INTERP_KERNEL::NORM_POLYGON); - std::size_t nbOfQuad=std::count(conn+lgth,conn+lgth+nbOfFaces,(mcIdType)INTERP_KERNEL::NORM_QUAD4); + std::size_t nbOfHexagon=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_POLYGON)); + std::size_t nbOfQuad=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4)); if(nbOfQuad==6 && nbOfHexagon==2) { - const mcIdType *hexag0=std::find(conn+lgth,conn+lgth+nbOfFaces,(mcIdType)INTERP_KERNEL::NORM_POLYGON); + const mcIdType *hexag0=std::find(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_POLYGON)); std::size_t hexg0Id=std::distance(conn+lgth,hexag0); - const mcIdType *hexag1=std::find(hexag0+1,conn+lgth+nbOfFaces,(mcIdType)INTERP_KERNEL::NORM_POLYGON); + const mcIdType *hexag1=std::find(hexag0+1,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_POLYGON)); std::size_t hexg1Id=std::distance(conn+lgth,hexag1); const mcIdType *connHexag0=conn+5*hexg0Id; std::size_t lgthH0=std::distance(connHexag0,std::find(connHexag0,conn+lgth,-1)); @@ -388,14 +388,14 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyHexp12(const mcIdType * Cell with 'conn' connectivity has been detected as a good candidate. Full check of this. If yes NORM_PENTA6 is returned. * If fails a POLYHED is returned. */ -INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPenta6(const mcIdType *conn, int nbOfFaces, int lgth, mcIdType *retConn, int& retLgth) +INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPenta6(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth) { - std::size_t nbOfTriFace=std::count(conn+lgth,conn+lgth+nbOfFaces,(mcIdType)INTERP_KERNEL::NORM_TRI3); - std::size_t nbOfQuadFace=std::count(conn+lgth,conn+lgth+nbOfFaces,(mcIdType)INTERP_KERNEL::NORM_QUAD4); + std::size_t nbOfTriFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3)); + std::size_t nbOfQuadFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4)); if(nbOfTriFace==2 && nbOfQuadFace==3) { - std::size_t tri3_0=std::distance(conn+lgth,std::find(conn+lgth,conn+lgth+nbOfFaces,(mcIdType)INTERP_KERNEL::NORM_TRI3)); - std::size_t tri3_1=std::distance(conn+lgth,std::find(conn+lgth+tri3_0+1,conn+lgth+nbOfFaces,(mcIdType)INTERP_KERNEL::NORM_TRI3)); + std::size_t tri3_0=std::distance(conn+lgth,std::find(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3))); + std::size_t tri3_1=std::distance(conn+lgth,std::find(conn+lgth+tri3_0+1,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3))); const mcIdType *tri_0=0,*tri_1=0; const mcIdType *w=conn; for(std::size_t i=0;i<5;i++) @@ -432,13 +432,13 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPenta6(const mcIdType * Cell with 'conn' connectivity has been detected as a good candidate. Full check of this. If yes NORM_PYRA5 is returned. * If fails a POLYHED is returned. */ -INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPyra5(const mcIdType *conn, int nbOfFaces, int lgth, mcIdType *retConn, int& retLgth) +INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPyra5(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth) { - std::size_t nbOfTriFace=std::count(conn+lgth,conn+lgth+nbOfFaces,(mcIdType)INTERP_KERNEL::NORM_TRI3); - std::size_t nbOfQuadFace=std::count(conn+lgth,conn+lgth+nbOfFaces,(mcIdType)INTERP_KERNEL::NORM_QUAD4); + std::size_t nbOfTriFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_TRI3)); + std::size_t nbOfQuadFace=std::count(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4)); if(nbOfTriFace==4 && nbOfQuadFace==1) { - std::size_t quad4_pos=std::distance(conn+lgth,std::find(conn+lgth,conn+lgth+nbOfFaces,(mcIdType)INTERP_KERNEL::NORM_QUAD4)); + std::size_t quad4_pos=std::distance(conn+lgth,std::find(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_QUAD4))); const mcIdType *quad4=0; const mcIdType *w=conn; for(std::size_t i=0;i<5 && quad4==0;i++) @@ -491,9 +491,9 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPyra5(const mcIdType * Cell with 'conn' connectivity has been detected as a good candidate. Full check of this. If yes NORM_TETRA4 is returned. * If fails a POLYHED is returned. */ -INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyTetra4(const mcIdType *conn, int nbOfFaces, int lgth, mcIdType *retConn, int& retLgth) +INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyTetra4(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth) { - if(std::find_if(conn+lgth,conn+lgth+nbOfFaces,std::bind2nd(std::not_equal_to(),(mcIdType)INTERP_KERNEL::NORM_TRI3))==conn+lgth+nbOfFaces) + if(std::find_if(conn+lgth,conn+lgth+nbOfFaces,std::bind2nd(std::not_equal_to(),ToIdType(INTERP_KERNEL::NORM_TRI3)))==conn+lgth+nbOfFaces) { std::set tribase(conn,conn+3); int point=-1; @@ -534,7 +534,7 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyTetra4(const mcIdType * - fully degenerated polygons (polygon with 1 point, or 2 if quadratic) * - quad polygon with 2 points and two identical quad points */ -bool CellSimplify::isFlatCell(const mcIdType* conn, mcIdType pos, int lgth, NormalizedCellType type) +bool CellSimplify::isFlatCell(const mcIdType* conn, mcIdType pos, mcIdType lgth, NormalizedCellType type) { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); if ( lgth <= 2 ) // a polygon with a single, or two points has been returned. This check also captures degenerated quadratics diff --git a/src/INTERP_KERNEL/InterpKernelCellSimplify.hxx b/src/INTERP_KERNEL/InterpKernelCellSimplify.hxx index 148d67b70..1246a2722 100644 --- a/src/INTERP_KERNEL/InterpKernelCellSimplify.hxx +++ b/src/INTERP_KERNEL/InterpKernelCellSimplify.hxx @@ -31,20 +31,20 @@ namespace INTERP_KERNEL class INTERPKERNEL_EXPORT CellSimplify { public: - static INTERP_KERNEL::NormalizedCellType simplifyDegeneratedCell(INTERP_KERNEL::NormalizedCellType type, const mcIdType *conn, int lgth, mcIdType *retConn, int& retLgth); - static mcIdType *getFullPolyh3DCell(INTERP_KERNEL::NormalizedCellType type, const mcIdType *conn, int lgth, - int& retNbOfFaces, int& retLgth); - static INTERP_KERNEL::NormalizedCellType tryToUnPoly2D(bool isQuad, const mcIdType *conn, int lgth, mcIdType *retConn, int& retLgth); - static INTERP_KERNEL::NormalizedCellType tryToUnPoly3D(const mcIdType *conn, int nbOfFaces, int lgth, mcIdType *retConn, int& retLgth); - static INTERP_KERNEL::NormalizedCellType tryToUnPolyHex8(const mcIdType *conn, int nbOfFaces, int lgth, mcIdType *retConn, int& retLgth); - static INTERP_KERNEL::NormalizedCellType tryToUnPolyHexp12(const mcIdType *conn, int nbOfFaces, int lgth, mcIdType *retConn, int& retLgth); - static INTERP_KERNEL::NormalizedCellType tryToUnPolyPenta6(const mcIdType *conn, int nbOfFaces, int lgth, mcIdType *retConn, int& retLgth); - static INTERP_KERNEL::NormalizedCellType tryToUnPolyPyra5(const mcIdType *conn, int nbOfFaces, int lgth, mcIdType *retConn, int& retLgth); - static INTERP_KERNEL::NormalizedCellType tryToUnPolyTetra4(const mcIdType *conn, int nbOfFaces, int lgth, mcIdType *retConn, int& retLgth); - static bool tryToArrangeOppositeFace(const mcIdType *conn, int lgth, int lgthBaseFace, const mcIdType *baseFace, const mcIdType *oppFaceId, int nbOfFaces, mcIdType *retConnOfOppFace); - static bool isWellOriented(const mcIdType *baseFace, mcIdType *retConn, const mcIdType *sideFace, int lgthBaseFace); - static bool orientOppositeFace(const mcIdType *baseFace, mcIdType *retConn, const mcIdType *sideFace, int lgthBaseFace); - static bool isFlatCell(const mcIdType* conn, mcIdType pos, int lgth, NormalizedCellType type); + static INTERP_KERNEL::NormalizedCellType simplifyDegeneratedCell(INTERP_KERNEL::NormalizedCellType type, const mcIdType *conn, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth); + static mcIdType *getFullPolyh3DCell(INTERP_KERNEL::NormalizedCellType type, const mcIdType *conn, mcIdType lgth, + mcIdType& retNbOfFaces, mcIdType& retLgth); + static INTERP_KERNEL::NormalizedCellType tryToUnPoly2D(bool isQuad, const mcIdType *conn, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth); + static INTERP_KERNEL::NormalizedCellType tryToUnPoly3D(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth); + static INTERP_KERNEL::NormalizedCellType tryToUnPolyHex8(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth); + static INTERP_KERNEL::NormalizedCellType tryToUnPolyHexp12(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth); + static INTERP_KERNEL::NormalizedCellType tryToUnPolyPenta6(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth); + static INTERP_KERNEL::NormalizedCellType tryToUnPolyPyra5(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth); + static INTERP_KERNEL::NormalizedCellType tryToUnPolyTetra4(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth); + static bool tryToArrangeOppositeFace(const mcIdType *conn, mcIdType lgth, mcIdType lgthBaseFace, const mcIdType *baseFace, const mcIdType *oppFaceId, mcIdType nbOfFaces, mcIdType *retConnOfOppFace); + static bool isWellOriented(const mcIdType *baseFace, mcIdType *retConn, const mcIdType *sideFace, mcIdType lgthBaseFace); + static bool orientOppositeFace(const mcIdType *baseFace, mcIdType *retConn, const mcIdType *sideFace, mcIdType lgthBaseFace); + static bool isFlatCell(const mcIdType* conn, mcIdType pos, mcIdType lgth, NormalizedCellType type); }; } diff --git a/src/INTERP_KERNEL/Interpolation.txx b/src/INTERP_KERNEL/Interpolation.txx index 7b2e3ba2c..5187a59ac 100755 --- a/src/INTERP_KERNEL/Interpolation.txx +++ b/src/INTERP_KERNEL/Interpolation.txx @@ -74,13 +74,13 @@ namespace INTERP_KERNEL if(nbMailleS!=0) { diagonalS=getDistanceBtw2Pts(BoxS+SPACEDIM,BoxS); - dimCaracteristicS=diagonalS/nbMailleS; + dimCaracteristicS=diagonalS/(double)nbMailleS; } double diagonalT,dimCaracteristicT=std::numeric_limits::max(); if(nbMailleT!=0) { diagonalT=getDistanceBtw2Pts(BoxT+SPACEDIM,BoxT); - dimCaracteristicT=diagonalT/nbMailleT; + dimCaracteristicT=diagonalT/(double)nbMailleT; } if (printLevel>=1) { diff --git a/src/INTERP_KERNEL/Interpolation1D0D.hxx b/src/INTERP_KERNEL/Interpolation1D0D.hxx index df400c8cf..1507a9ab3 100644 --- a/src/INTERP_KERNEL/Interpolation1D0D.hxx +++ b/src/INTERP_KERNEL/Interpolation1D0D.hxx @@ -36,7 +36,7 @@ namespace INTERP_KERNEL Interpolation1D0D(); Interpolation1D0D(const InterpolationOptions& io); template - int interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method); + typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method); private: void adjustBoundingBoxes(std::vector& bbox); }; diff --git a/src/INTERP_KERNEL/Interpolation1D0D.txx b/src/INTERP_KERNEL/Interpolation1D0D.txx index 8bade822d..9bce3507b 100755 --- a/src/INTERP_KERNEL/Interpolation1D0D.txx +++ b/src/INTERP_KERNEL/Interpolation1D0D.txx @@ -41,7 +41,7 @@ namespace INTERP_KERNEL * adjusted in a similar fashion as in InterpolationPlanar::performAdjustmentOfBB() **/ template - int Interpolation1D0D::interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method) + typename MyMeshType::MyConnType Interpolation1D0D::interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method) { constexpr int SPACEDIM=MyMeshType::MY_SPACEDIM; using ConnType=typename MyMeshType::MyConnType; @@ -73,7 +73,7 @@ namespace INTERP_KERNEL // create BBTree structure // - get bounding boxes std::vector bboxes(2*SPACEDIM*numSrcElems); - int* srcElemIdx = new int[numSrcElems]; + ConnType* srcElemIdx = new ConnType[numSrcElems]; for(ConnType i = 0; i < numSrcElems ; ++i) { // get source bboxes in right order diff --git a/src/INTERP_KERNEL/Interpolation2D1D.hxx b/src/INTERP_KERNEL/Interpolation2D1D.hxx index 9d0ce99d6..a2c2f601d 100644 --- a/src/INTERP_KERNEL/Interpolation2D1D.hxx +++ b/src/INTERP_KERNEL/Interpolation2D1D.hxx @@ -40,7 +40,7 @@ namespace INTERP_KERNEL class Interpolation2D1D : public Interpolation { public: - typedef std::map > DuplicateFacesType; + typedef std::map > DuplicateFacesType; Interpolation2D1D() { setOrientation(2); } Interpolation2D1D(const InterpolationOptions& io):Interpolation(io) { } @@ -48,7 +48,7 @@ namespace INTERP_KERNEL // Main function to interpolate triangular and quadratic meshes template - int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result, const std::string& method); + typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result, const std::string& method); DuplicateFacesType retrieveDuplicateFaces() const { return _duplicate_faces; diff --git a/src/INTERP_KERNEL/Interpolation2D1D.txx b/src/INTERP_KERNEL/Interpolation2D1D.txx index 02aef0c72..7cc6ca443 100755 --- a/src/INTERP_KERNEL/Interpolation2D1D.txx +++ b/src/INTERP_KERNEL/Interpolation2D1D.txx @@ -46,7 +46,7 @@ namespace INTERP_KERNEL * */ template - int Interpolation2D1D::interpolateMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, MatrixType& result, const std::string& method) + typename MyMeshType::MyConnType Interpolation2D1D::interpolateMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, MatrixType& result, const std::string& method) { static const int SPACEDIM=MyMeshType::MY_SPACEDIM; typedef typename MyMeshType::MyConnType ConnType; @@ -118,7 +118,7 @@ namespace INTERP_KERNEL const ConnType *connIndxT=myMeshT.getConnectivityIndexPtr(); for(ConnType iT=0; iT intersecting_elems; double bb[2*SPACEDIM]; intersector->getElemBB(bb,myMeshT,OTT::indFC(iT),nb_nodesT); diff --git a/src/INTERP_KERNEL/Interpolation2D3D.hxx b/src/INTERP_KERNEL/Interpolation2D3D.hxx index d23b91478..0a624c9af 100644 --- a/src/INTERP_KERNEL/Interpolation2D3D.hxx +++ b/src/INTERP_KERNEL/Interpolation2D3D.hxx @@ -27,6 +27,7 @@ #include "Interpolation.hxx" #include "NormalizedUnstructuredMesh.hxx" #include "InterpolationOptions.hxx" +#include "MCIdType.hxx" namespace INTERP_KERNEL { @@ -42,7 +43,7 @@ namespace INTERP_KERNEL class Interpolation2D3D : public Interpolation { public: - typedef std::map > DuplicateFacesType; + typedef std::map > DuplicateFacesType; INTERPKERNEL_EXPORT Interpolation2D3D(); INTERPKERNEL_EXPORT Interpolation2D3D(const InterpolationOptions& io); diff --git a/src/INTERP_KERNEL/InterpolationCC.hxx b/src/INTERP_KERNEL/InterpolationCC.hxx index 00a22098a..d1b434f99 100644 --- a/src/INTERP_KERNEL/InterpolationCC.hxx +++ b/src/INTERP_KERNEL/InterpolationCC.hxx @@ -41,7 +41,7 @@ namespace INTERP_KERNEL InterpolationCC(); InterpolationCC(const InterpolationOptions& io); template - int interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const char *method); + typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const char *method); private: }; diff --git a/src/INTERP_KERNEL/InterpolationCC.txx b/src/INTERP_KERNEL/InterpolationCC.txx index ee3d43ce0..7a3363bca 100644 --- a/src/INTERP_KERNEL/InterpolationCC.txx +++ b/src/INTERP_KERNEL/InterpolationCC.txx @@ -74,15 +74,15 @@ namespace INTERP_KERNEL */ //================================================================================ - template + template void fillMatrix(const std::list< Interference > inter_of_axis[dim], MatrixType& result, - const int src_nb_cells[dim], - const int tgt_nb_cells[dim], - const int src_i_cell = 0, - const int tgt_i_cell = 0, - const int src_prev_area = 1, - const int tgt_prev_area = 1, + const ConnType src_nb_cells[dim], + const ConnType tgt_nb_cells[dim], + const ConnType src_i_cell = 0, + const ConnType tgt_i_cell = 0, + const ConnType src_prev_area = 1, + const ConnType tgt_prev_area = 1, const int axis = 0, const double prev_value = 1.0) { @@ -92,29 +92,29 @@ namespace INTERP_KERNEL { for ( TIntIterator i = inter_of_axis[axis].begin(); i != inter_of_axis[axis].end(); ++i ) { - double value = i->_length * prev_value; - int src_i = i->_src_index * src_prev_area + src_i_cell; - int tgt_i = i->_tgt_index * tgt_prev_area + tgt_i_cell; + double value = i->_length * prev_value; + ConnType src_i = i->_src_index * src_prev_area + src_i_cell; + ConnType tgt_i = i->_tgt_index * tgt_prev_area + tgt_i_cell; result[ tgt_i ].insert( std::make_pair( _TMI( src_i ), value )); } } else { - int src_prev_area_next = src_prev_area * src_nb_cells[ axis ]; - int tgt_prev_area_next = tgt_prev_area * tgt_nb_cells[ axis ]; + ConnType src_prev_area_next = src_prev_area * src_nb_cells[ axis ]; + ConnType tgt_prev_area_next = tgt_prev_area * tgt_nb_cells[ axis ]; for ( TIntIterator i = inter_of_axis[axis].begin(); i != inter_of_axis[axis].end(); ++i ) { - double value = i->_length * prev_value; - int src_i = i->_src_index * src_prev_area + src_i_cell; - int tgt_i = i->_tgt_index * tgt_prev_area + tgt_i_cell; + double value = i->_length * prev_value; + ConnType src_i = i->_src_index * src_prev_area + src_i_cell; + ConnType tgt_i = i->_tgt_index * tgt_prev_area + tgt_i_cell; // call for the next axis - fillMatrix(inter_of_axis, result, - src_nb_cells, tgt_nb_cells, src_i, tgt_i, - src_prev_area_next, tgt_prev_area_next, - axis+1, value ); + fillMatrix(inter_of_axis, result, + src_nb_cells, tgt_nb_cells, src_i, tgt_i, + src_prev_area_next, tgt_prev_area_next, + axis+1, value ); } } } @@ -141,7 +141,7 @@ namespace INTERP_KERNEL //================================================================================ template - int InterpolationCC::interpolateMeshes(const MyMeshType& src_mesh, + typename MyMeshType::MyConnType InterpolationCC::interpolateMeshes(const MyMeshType& src_mesh, const MyMeshType& tgt_mesh, MatrixType& result, const char * method) @@ -152,7 +152,8 @@ namespace INTERP_KERNEL // create empty maps for all target elements result.resize( tgt_mesh.getNumberOfElements() ); - const int ret = ToConnType(src_mesh.getNumberOfElements()); + typedef typename MyMeshType::MyConnType ConnType; + const ConnType ret = src_mesh.getNumberOfElements(); const double eps = getPrecision(); const int dim = MyMeshType::MY_MESHDIM; @@ -160,14 +161,15 @@ namespace INTERP_KERNEL const double* src_coords[ dim ]; const double* tgt_coords[ dim ]; - int src_nb_cells[ dim ]; - int tgt_nb_cells[ dim ]; + ConnType src_nb_cells[ dim ]; + ConnType tgt_nb_cells[ dim ]; for ( int j = 0; j < dim; ++j ) { - src_coords[ j ] = src_mesh.getCoordsAlongAxis( _TMI( j )); - tgt_coords[ j ] = tgt_mesh.getCoordsAlongAxis( _TMI( j )); - src_nb_cells[ j ] = ToConnType(src_mesh.nbCellsAlongAxis( _TMI( j ))); - tgt_nb_cells[ j ] = ToConnType(tgt_mesh.nbCellsAlongAxis( _TMI( j ))); + int axis = static_cast( _TMI( j )); + src_coords[ j ] = src_mesh.getCoordsAlongAxis( axis ); + tgt_coords[ j ] = tgt_mesh.getCoordsAlongAxis( axis ); + src_nb_cells[ j ] = src_mesh.nbCellsAlongAxis( axis ); + tgt_nb_cells[ j ] = tgt_mesh.nbCellsAlongAxis( axis ); } // ============================================ @@ -235,15 +237,15 @@ namespace INTERP_KERNEL switch ( dim ) { case 3: - fillMatrix( interferences, result, src_nb_cells,tgt_nb_cells ); + fillMatrix( interferences, result, src_nb_cells,tgt_nb_cells ); break; case 2: - fillMatrix( interferences, result, src_nb_cells,tgt_nb_cells ); + fillMatrix( interferences, result, src_nb_cells,tgt_nb_cells ); break; case 1: - fillMatrix( interferences, result, src_nb_cells,tgt_nb_cells ); + fillMatrix( interferences, result, src_nb_cells,tgt_nb_cells ); break; } diff --git a/src/INTERP_KERNEL/InterpolationCU.txx b/src/INTERP_KERNEL/InterpolationCU.txx index eae13af3a..e43d80cc8 100644 --- a/src/INTERP_KERNEL/InterpolationCU.txx +++ b/src/INTERP_KERNEL/InterpolationCU.txx @@ -125,8 +125,9 @@ namespace INTERP_KERNEL std::map< double, CConnType> src_coord_to_index[ dim ]; for ( int j = 0; j < dim; ++j ) { - src_coords [j] = src_mesh.getCoordsAlongAxis( _TMIC( j )); - src_nb_coords[j] = static_cast(src_mesh.nbCellsAlongAxis ( _TMIC( j ))) + 1; + int axis = static_cast( _TMIC( j )); + src_coords [j] = src_mesh.getCoordsAlongAxis( axis ); + src_nb_coords[j] = static_cast(src_mesh.nbCellsAlongAxis( axis )) + 1; for (CConnType i = 0; i < src_nb_coords[j]; ++i ) src_coord_to_index[j].insert( std::make_pair( src_coords[j][i], i )); } diff --git a/src/INTERP_KERNEL/InterpolationCurve.txx b/src/INTERP_KERNEL/InterpolationCurve.txx index 1718d9ca2..972aa5f91 100755 --- a/src/INTERP_KERNEL/InterpolationCurve.txx +++ b/src/INTERP_KERNEL/InterpolationCurve.txx @@ -189,7 +189,7 @@ namespace INTERP_KERNEL const ConnType *connIndxT = myMeshT.getConnectivityIndexPtr(); for(ConnType iT=0; iT intersecting_elems; double bb[2*SPACEDIM]; intersector->getElemBB(bb,myMeshT,OTT::indFC(iT),nb_nodesT); diff --git a/src/INTERP_KERNEL/InterpolationPlanar.txx b/src/INTERP_KERNEL/InterpolationPlanar.txx index 0527ffda9..bf9481f87 100755 --- a/src/INTERP_KERNEL/InterpolationPlanar.txx +++ b/src/INTERP_KERNEL/InterpolationPlanar.txx @@ -139,13 +139,13 @@ namespace INTERP_KERNEL if(nbMailleS!=0) { diagonalS=getDistanceBtw2Pts(BoxS+SPACEDIM,BoxS); - dimCaracteristicS=diagonalS/nbMailleS; + dimCaracteristicS=diagonalS/(double)(nbMailleS); } double diagonalT,dimCaracteristicT=std::numeric_limits::max(); if(nbMailleT!=0) { diagonalT=getDistanceBtw2Pts(BoxT+SPACEDIM,BoxT); - dimCaracteristicT=diagonalT/nbMailleT; + dimCaracteristicT=diagonalT/(double)(nbMailleT); } _dim_caracteristic=std::min(dimCaracteristicS, dimCaracteristicT); @@ -401,7 +401,7 @@ namespace INTERP_KERNEL const ConnType *connIndxT=myMeshT.getConnectivityIndexPtr(); for(ConnType iT=0; iT intersecting_elems; double bb[2*SPACEDIM]; intersector->getElemBB(bb,myMeshT,OTT::indFC(iT),nb_nodesT); diff --git a/src/INTERP_KERNEL/InterpolationUtils.hxx b/src/INTERP_KERNEL/InterpolationUtils.hxx index f5ff0abde..abf55b698 100644 --- a/src/INTERP_KERNEL/InterpolationUtils.hxx +++ b/src/INTERP_KERNEL/InterpolationUtils.hxx @@ -170,7 +170,7 @@ namespace INTERP_KERNEL * @param quadOut is a 8 doubles array filled after the following call. */ template - inline void fillDualCellOfPolyg(const double *polygIn, int nPtsPolygonIn, double *polygOut) + inline void fillDualCellOfPolyg(const double *polygIn, mcIdType nPtsPolygonIn, double *polygOut) { //1st point std::copy(polygIn,polygIn+SPACEDIM,polygOut); @@ -179,7 +179,7 @@ namespace INTERP_KERNEL std::transform(polygOut+SPACEDIM,polygOut+2*SPACEDIM,polygOut+SPACEDIM,std::bind2nd(std::multiplies(),0.5)); double tmp[SPACEDIM]; // - for(int i=0;i()); std::transform(tmp,tmp+SPACEDIM,polygOut+(2*i+3)*SPACEDIM,std::bind2nd(std::multiplies(),0.5)); diff --git a/src/INTERP_KERNEL/Intersector3D.txx b/src/INTERP_KERNEL/Intersector3D.txx index 7cd83329b..47bec7ebf 100644 --- a/src/INTERP_KERNEL/Intersector3D.txx +++ b/src/INTERP_KERNEL/Intersector3D.txx @@ -37,7 +37,7 @@ namespace INTERP_KERNEL template void Intersector3D::getRealTargetCoordinates(ConnType icellT, std::vector& coordsT) const { - int nbNodesT=_target_mesh.getNumberOfNodesOfElement(icellT); + ConnType nbNodesT=_target_mesh.getNumberOfNodesOfElement(icellT); coordsT.resize(SPACEDIM*nbNodesT); std::vector::iterator iter=coordsT.begin(); for (ConnType iT=0; iT void Intersector3D::getRealSourceCoordinates(ConnType icellS, std::vector& coordsS) const { - int nbNodesS=_src_mesh.getNumberOfNodesOfElement(icellS); + ConnType nbNodesS=_src_mesh.getNumberOfNodesOfElement(icellS); coordsS.resize(SPACEDIM*nbNodesS); std::vector::iterator iter=coordsS.begin(); for (ConnType iS=0; iS::ind2C(icellS)]; ConnType end=myConIndexS[OTT::ind2C(icellS)+1]; - int nbNodesS=end-start; + ConnType nbNodesS=end-start; res.resize(nbNodesS); std::copy(myConectS+OTT::conn2C(start),myConectS+OTT::conn2C(end),res.begin()); } diff --git a/src/INTERP_KERNEL/IntersectorCU.hxx b/src/INTERP_KERNEL/IntersectorCU.hxx index 7c3214e1d..32c3b888c 100644 --- a/src/INTERP_KERNEL/IntersectorCU.hxx +++ b/src/INTERP_KERNEL/IntersectorCU.hxx @@ -47,7 +47,7 @@ namespace INTERP_KERNEL void getUElemBB(double* bb, UConnType iP); void getUCoordinates(UConnType icell, std::vector& coords); - UConnType getNumberOfRowsOfResMatrix() const; + CConnType getNumberOfRowsOfResMatrix() const; CConnType getNumberOfColsOfResMatrix() const; void intersectCells(CConnType icellU, const std::vector& icellC, MyMatrix& res); double intersectGeometry(CConnType icellT, const std::vector& icellC) { return asLeaf().intersectGeometry(icellT,icellC); } diff --git a/src/INTERP_KERNEL/IntersectorCU.txx b/src/INTERP_KERNEL/IntersectorCU.txx index 13f334a80..de1a4cd48 100644 --- a/src/INTERP_KERNEL/IntersectorCU.txx +++ b/src/INTERP_KERNEL/IntersectorCU.txx @@ -60,8 +60,9 @@ namespace INTERP_KERNEL for ( int j = 0; j < SPACEDIM; ++j ) { - _coordsC [ j ] = _meshC.getCoordsAlongAxis( _TMIC( j )); - _nbCellsC[ j ] = static_cast(_meshC.nbCellsAlongAxis ( _TMIC( j ))); + int axis = static_cast( _TMIC( j )); + _coordsC [ j ] = _meshC.getCoordsAlongAxis( axis ); + _nbCellsC[ j ] = static_cast(_meshC.nbCellsAlongAxis( axis )); } } @@ -123,7 +124,7 @@ namespace INTERP_KERNEL } _CU_TEMPLATE - typename MyUMeshType::MyConnType _INTERSECTOR_CU_::getNumberOfRowsOfResMatrix() const + typename MyCMeshType::MyConnType _INTERSECTOR_CU_::getNumberOfRowsOfResMatrix() const { return _meshU.getNumberOfElements(); } diff --git a/src/INTERP_KERNEL/IntersectorCU3D.txx b/src/INTERP_KERNEL/IntersectorCU3D.txx index 6b128dd29..7db6905bb 100644 --- a/src/INTERP_KERNEL/IntersectorCU3D.txx +++ b/src/INTERP_KERNEL/IntersectorCU3D.txx @@ -45,30 +45,30 @@ namespace INTERP_KERNEL public: static const int MY_SPACEDIM=3; static const int MY_MESHDIM=3; - typedef int MyConnType; + typedef mcIdType MyConnType; static const NumberingPolicy My_numPol=ALL_C_MODE; _Cartesian3D2UnstructHexMesh(const double * coords[3]): _coordsC(coords) {} - void setHexa(int I, int J, int K) // indices in C mode + void setHexa(mcIdType I, mcIdType J, mcIdType K) // indices in C mode { double* pCoord = _coordsU; - for ( int k = K; k < K+2; ++k ) - for ( int j = J; j < J+2; ++j ) - for ( int i = I; i < I+2; ++i ) + for ( mcIdType k = K; k < K+2; ++k ) + for ( mcIdType j = J; j < J+2; ++j ) + for ( mcIdType i = I; i < I+2; ++i ) { *pCoord++ = _coordsC[0][i]; *pCoord++ = _coordsC[1][j]; *pCoord++ = _coordsC[2][k]; } } - const int *getConnectivityPtr() const + const mcIdType *getConnectivityPtr() const { - static int conn[] = { 1,0,2,3,5,4,6,7 }; + static mcIdType conn[] = { 1,0,2,3,5,4,6,7 }; return conn; } - const int *getConnectivityIndexPtr() const + const mcIdType *getConnectivityIndexPtr() const { - static int conInd[] = { 0,8 }; + static mcIdType conInd[] = { 0,8 }; return conInd; } void getBoundingBox(double *boundingBox) const @@ -80,10 +80,10 @@ namespace INTERP_KERNEL boundingBox[BoundingBox::ZMIN] = _coordsU[2]; boundingBox[BoundingBox::ZMAX] = _coordsU[2+4*MY_SPACEDIM]; } - NormalizedCellType getTypeOfElement(int eltId) const { return NORM_HEXA8; } - unsigned char getNumberOfNodesOfElement(int eltId) const { return 8; } - unsigned long getNumberOfElements() const { return 1; } - unsigned long getNumberOfNodes() const { return 8; } + NormalizedCellType getTypeOfElement(mcIdType eltId) const { return NORM_HEXA8; } + mcIdType getNumberOfNodesOfElement(mcIdType eltId) const { return 8; } + mcIdType getNumberOfElements() const { return 1; } + mcIdType getNumberOfNodes() const { return 8; } const double *getCoordinatesPtr() const { return _coordsU; } void releaseTempArrays() {} private: diff --git a/src/INTERP_KERNEL/MCIdType.hxx b/src/INTERP_KERNEL/MCIdType.hxx index a74f075f8..6accd369b 100644 --- a/src/INTERP_KERNEL/MCIdType.hxx +++ b/src/INTERP_KERNEL/MCIdType.hxx @@ -39,5 +39,10 @@ template inline mcIdType ToIdType(T val) { return static_cast(val); } +template inline T FromIdType(mcIdType val) +{ + return static_cast(val); +} + #endif diff --git a/src/INTERP_KERNEL/PlanarIntersector.hxx b/src/INTERP_KERNEL/PlanarIntersector.hxx index 72779a629..f648c7533 100644 --- a/src/INTERP_KERNEL/PlanarIntersector.hxx +++ b/src/INTERP_KERNEL/PlanarIntersector.hxx @@ -47,17 +47,17 @@ namespace INTERP_KERNEL void adjustBoundingBoxes(std::vector& bbox, double surf3DAdjustmentEps, double surf3DAdjustmentEpsAbs); inline void getElemBB(double* bb, const MyMeshType& mesh, ConnType iP, ConnType nb_nodes); static int Projection(double *Coords_A, double *Coords_B, - int nb_NodesA, int nb_NodesB, double epsilon, double md3DSurf, double minDot3DSurf, double median_plane, bool do_rotate); + ConnType nb_NodesA, ConnType nb_NodesB, double epsilon, double md3DSurf, double minDot3DSurf, double median_plane, bool do_rotate); virtual const DuplicateFacesType* getIntersectFaces() const { return NULL; } protected : - int projectionThis(double *Coords_A, double *Coords_B, int nb_NodesA, int nb_NodesB); + int projectionThis(double *Coords_A, double *Coords_B, ConnType nb_NodesA, ConnType nb_NodesB); void getRealTargetCoordinates(ConnType icellT, std::vector& coordsT); void getRealSourceCoordinates(ConnType icellS, std::vector& coordsS); - void getRealTargetCoordinatesPermute(ConnType icellT, int offset, std::vector& coordsT); - void getRealSourceCoordinatesPermute(ConnType icellS, int offset, std::vector& coordsS); + void getRealTargetCoordinatesPermute(ConnType icellT, ConnType offset, std::vector& coordsT); + void getRealSourceCoordinatesPermute(ConnType icellS, ConnType offset, std::vector& coordsS); void getRealCoordinates(ConnType icellT, ConnType icellS, ConnType nbNodesT, ConnType nbNodesS, std::vector& coordsT, std::vector& coordsS, int& orientation); double getValueRegardingOption(double val) const; static void Rotate3DTriangle( double* PP1, double*PP2, double*PP3, diff --git a/src/INTERP_KERNEL/PlanarIntersector.txx b/src/INTERP_KERNEL/PlanarIntersector.txx index 59871ce69..f5a9ae729 100644 --- a/src/INTERP_KERNEL/PlanarIntersector.txx +++ b/src/INTERP_KERNEL/PlanarIntersector.txx @@ -70,7 +70,7 @@ namespace INTERP_KERNEL int ibox=0; for(long icell=0; icell::max(); } //updating the bounding box with each node of the element - for (int j=0; j::coo2C(conn[OTT::conn2C(conn_index[icell]+j)]); for(int idim=0; idim void PlanarIntersector::getRealTargetCoordinates(ConnType icellT, std::vector& coordsT) { - int nbNodesT=_connIndexT[OTT::ind2C(icellT)+1]-_connIndexT[OTT::ind2C(icellT)]; + ConnType nbNodesT=_connIndexT[OTT::ind2C(icellT)+1]-_connIndexT[OTT::ind2C(icellT)]; coordsT.resize(SPACEDIM*nbNodesT); for (ConnType iT=0; iT void PlanarIntersector::getRealSourceCoordinates(ConnType icellS, std::vector& coordsS) { - int nbNodesS=_connIndexS[OTT::ind2C(icellS)+1]-_connIndexS[OTT::ind2C(icellS)]; + ConnType nbNodesS=_connIndexS[OTT::ind2C(icellS)+1]-_connIndexS[OTT::ind2C(icellS)]; coordsS.resize(SPACEDIM*nbNodesS); for (ConnType iS=0; iS - void PlanarIntersector::getRealTargetCoordinatesPermute(ConnType icellT, int offset, std::vector& coordsT) + void PlanarIntersector::getRealTargetCoordinatesPermute(ConnType icellT, ConnType offset, std::vector& coordsT) { - int nbNodesT=_connIndexT[OTT::ind2C(icellT)+1]-_connIndexT[OTT::ind2C(icellT)]; + ConnType nbNodesT=_connIndexT[OTT::ind2C(icellT)+1]-_connIndexT[OTT::ind2C(icellT)]; coordsT.resize(SPACEDIM*nbNodesT); for (ConnType iTTmp=0; iTTmp - void PlanarIntersector::getRealSourceCoordinatesPermute(ConnType icellS, int offset, std::vector& coordsS) + void PlanarIntersector::getRealSourceCoordinatesPermute(ConnType icellS, ConnType offset, std::vector& coordsS) { - int nbNodesS=_connIndexS[OTT::ind2C(icellS)+1]-_connIndexS[OTT::ind2C(icellS)]; + ConnType nbNodesS=_connIndexS[OTT::ind2C(icellS)+1]-_connIndexS[OTT::ind2C(icellS)]; coordsS.resize(SPACEDIM*nbNodesS); for (ConnType iSTmp=0; iSTmp - int PlanarIntersector::projectionThis(double *Coords_A, double *Coords_B, int nb_NodesA, int nb_NodesB) + int PlanarIntersector::projectionThis(double *Coords_A, double *Coords_B, ConnType nb_NodesA, ConnType nb_NodesB) { return Projection(Coords_A,Coords_B,nb_NodesA,nb_NodesB,_dim_caracteristic*_precision,_max_distance_3Dsurf_intersect,_min_dot_btw_3Dsurf_intersect,_median_plane,_do_rotate); } template int PlanarIntersector::Projection(double *Coords_A, double *Coords_B, - int nb_NodesA, int nb_NodesB, double epsilon, double md3DSurf, double minDot3DSurf, double median_plane, bool do_rotate) + ConnType nb_NodesA, ConnType nb_NodesB, double epsilon, double md3DSurf, double minDot3DSurf, double median_plane, bool do_rotate) { double normal_A[3]={0,0,0}; double normal_B[3]={0,0,0}; @@ -289,10 +289,10 @@ namespace INTERP_KERNEL bool same_orientation; //Find the normal to cells A and B - int i_A1(1); + ConnType i_A1(1); while(i_A1(Coords_A,&Coords_A[SPACEDIM*i_A1])< epsilon) i_A1++; - int i_A2(i_A1+1); + ConnType i_A2(i_A1+1); crossprod(Coords_A, &Coords_A[SPACEDIM*i_A1], &Coords_A[SPACEDIM*i_A2],normal_A); double normA(sqrt(dotprod(normal_A,normal_A))); while(i_A2(normal_A,normal_A)); } - int i_B1(1); + ConnType i_B1(1); while(i_B1(Coords_B,Coords_B+SPACEDIM*i_B1)< epsilon) i_B1++; - int i_B2(i_B1+1); + ConnType i_B2(i_B1+1); crossprod(Coords_B, Coords_B+SPACEDIM*i_B1, Coords_B+SPACEDIM*i_B2,normal_B); double normB(sqrt(dotprod(normal_B,normal_B))); while(i_B2(&Coords_A[SPACEDIM*i_A],linear_comb); for(int idim =0; idim< SPACEDIM; idim++) Coords_A[SPACEDIM*i_A+idim] -= proj*linear_comb[idim]; } - for(int i_B=0; i_B(Coords_B+SPACEDIM*i_B,linear_comb); for(int idim =0; idim< SPACEDIM; idim++) diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P0.txx b/src/INTERP_KERNEL/PlanarIntersectorP1P0.txx index f10ea00b6..48ec63802 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P0.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P0.txx @@ -62,14 +62,14 @@ namespace INTERP_KERNEL for(typename std::vector::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++) { ConnType iS=*iter; - int nbNodesS=PlanarIntersector::_connIndexS[iS+1]-PlanarIntersector::_connIndexS[iS]; + ConnType nbNodesS=PlanarIntersector::_connIndexS[iS+1]-PlanarIntersector::_connIndexS[iS]; const ConnType *startOfCellNodeConn=PlanarIntersector::_connectS+OTT::conn2C(PlanarIntersector::_connIndexS[iS]); - for(int nodeIdS=0;nodeIdS::coo2C(startOfCellNodeConn[nodeIdS]); std::copy(PlanarIntersector::_coordsS+curNodeSInCmode*SPACEDIM, PlanarIntersector::_coordsS+curNodeSInCmode*SPACEDIM+SPACEDIM,triangle); - for(int subTriS=1;subTriS<=nbNodesS-2;subTriS++) + for(ConnType subTriS=1;subTriS<=nbNodesS-2;subTriS++) { std::copy(PlanarIntersector::_coordsS+OTT::coo2C(startOfCellNodeConn[(nodeIdS+subTriS)%nbNodesS])*SPACEDIM, PlanarIntersector::_coordsS+OTT::coo2C(startOfCellNodeConn[(nodeIdS+subTriS)%nbNodesS])*SPACEDIM+SPACEDIM, diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P1.txx b/src/INTERP_KERNEL/PlanarIntersectorP1P1.txx index 32cd8e6f0..86791ab8b 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P1.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P1.txx @@ -52,12 +52,12 @@ namespace INTERP_KERNEL template void PlanarIntersectorP1P1::intersectCells(ConnType icellT, const std::vector& icellsS, MyMatrix& res) { - int nbNodesT=PlanarIntersector::_connIndexT[icellT+1]-PlanarIntersector::_connIndexT[icellT]; + ConnType nbNodesT=PlanarIntersector::_connIndexT[icellT+1]-PlanarIntersector::_connIndexT[icellT]; int orientation=1; const ConnType *startOfCellNodeConn=PlanarIntersector::_connectT+OTT::conn2C(PlanarIntersector::_connIndexT[icellT]); std::vector polygT; PlanarIntersector::getRealTargetCoordinates(OTT::indFC(icellT),polygT); - for(int nodeIdT=0;nodeIdT::coo2C(startOfCellNodeConn[nodeIdT]); PlanarIntersector::getRealTargetCoordinatesPermute(OTT::indFC(icellT),nodeIdT,polygT); @@ -67,9 +67,9 @@ namespace INTERP_KERNEL for(typename std::vector::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++) { ConnType iS=*iter; - int nbNodesS=PlanarIntersector::_connIndexS[iS+1]-PlanarIntersector::_connIndexS[iS]; + ConnType nbNodesS=PlanarIntersector::_connIndexS[iS+1]-PlanarIntersector::_connIndexS[iS]; const ConnType *startOfCellNodeConnS=PlanarIntersector::_connectS+OTT::conn2C(PlanarIntersector::_connIndexS[iS]); - for(int nodeIdS=0;nodeIdS::coo2C(startOfCellNodeConnS[nodeIdS]); std::vector polygS; diff --git a/src/INTERP_KERNEL/PointLocatorAlgos.txx b/src/INTERP_KERNEL/PointLocatorAlgos.txx index 7017933ea..1cf302acb 100644 --- a/src/INTERP_KERNEL/PointLocatorAlgos.txx +++ b/src/INTERP_KERNEL/PointLocatorAlgos.txx @@ -34,7 +34,7 @@ namespace INTERP_KERNEL { public: virtual ~GenericPointLocatorAlgos() { } - virtual std::list locates(const double* x, double eps) = 0; + virtual std::list locates(const double* x, double eps) = 0; }; template @@ -102,7 +102,7 @@ namespace INTERP_KERNEL return retlist; } - static bool isElementContainsPointAlg2D(const double *ptToTest, const double *cellPts, int nbEdges, double eps) + static bool isElementContainsPointAlg2D(const double *ptToTest, const double *cellPts, mcIdType nbEdges, double eps) { /* with dimension 2, it suffices to check all the edges and see if the sign of double products from the point @@ -116,7 +116,7 @@ namespace INTERP_KERNEL here XA^XC and XC^XB have different signs*/ const int SPACEDIM=MyMeshType::MY_SPACEDIM; int* sign = new int[nbEdges]; - for (int iedge=0; iedge class Polyhedron3D2DIntersectorP0P0 : public Intersector3DP0P0 { - typedef typename std::map > DuplicateFacesType; + typedef typename std::map > DuplicateFacesType; public: static const int SPACEDIM=MyMeshType::MY_SPACEDIM; diff --git a/src/INTERP_KERNEL/Polyhedron3D2DIntersectorP0P0.txx b/src/INTERP_KERNEL/Polyhedron3D2DIntersectorP0P0.txx index 57d42e9d9..a2ae9b7c4 100644 --- a/src/INTERP_KERNEL/Polyhedron3D2DIntersectorP0P0.txx +++ b/src/INTERP_KERNEL/Polyhedron3D2DIntersectorP0P0.txx @@ -87,7 +87,7 @@ namespace INTERP_KERNEL const std::vector& srcCells, MyMatrixType& matrix) { - int nbOfNodesT=Intersector3D::_target_mesh.getNumberOfNodesOfElement(OTT::indFC(targetCell)); + ConnType nbOfNodesT=Intersector3D::_target_mesh.getNumberOfNodesOfElement(OTT::indFC(targetCell)); releaseArrays(); _split.splitTargetCell(targetCell,nbOfNodesT,_tetra); @@ -99,11 +99,11 @@ namespace INTERP_KERNEL // calculate the coordinates of the nodes typename MyMeshType::MyConnType cellSrc = *iterCellS; - int cellSrcIdx = OTT::indFC(cellSrc); + ConnType cellSrcIdx = OTT::indFC(cellSrc); NormalizedCellType normCellType=Intersector3D::_src_mesh.getTypeOfElement(cellSrcIdx); const CellModel& cellModelCell=CellModel::GetCellModel(normCellType); const MyMeshType& src_mesh = Intersector3D::_src_mesh; - unsigned nbOfNodes4Type=cellModelCell.isDynamic() ? src_mesh.getNumberOfNodesOfElement(cellSrcIdx) : cellModelCell.getNumberOfNodes(); + ConnType nbOfNodes4Type=cellModelCell.isDynamic() ? src_mesh.getNumberOfNodesOfElement(cellSrcIdx) : cellModelCell.getNumberOfNodes(); mcIdType *polyNodes=new mcIdType[nbOfNodes4Type]; double **polyCoords = new double*[nbOfNodes4Type]; for(int i = 0;i<(int)nbOfNodes4Type;++i) @@ -153,7 +153,7 @@ namespace INTERP_KERNEL } else { - std::set targetCellSet; + std::set targetCellSet; targetCellSet.insert(targetCell); _intersect_faces.insert(std::make_pair(cellSrcIdx, targetCellSet)); } diff --git a/src/INTERP_KERNEL/PolyhedronIntersectorP0P1.txx b/src/INTERP_KERNEL/PolyhedronIntersectorP0P1.txx index eac117c24..baa5a50ef 100644 --- a/src/INTERP_KERNEL/PolyhedronIntersectorP0P1.txx +++ b/src/INTERP_KERNEL/PolyhedronIntersectorP0P1.txx @@ -91,7 +91,7 @@ namespace INTERP_KERNEL double volume = tmp->intersectSourceCell(*iterCellS); if(volume!=0.) { - int targetNodeId(tmp->getId(0)); + ConnType targetNodeId(tmp->getId(0)); if(targetNodeId<0) { std::ostringstream oss; oss << "PolyhedronIntersectorP0P1::intersectCells : On target cell #" << targetCell << " the splitting into tetra4 leads to the creation of an additional point that interacts with source cell Id #" << *iterCellS << " !"; diff --git a/src/INTERP_KERNEL/PolyhedronIntersectorP1P0.txx b/src/INTERP_KERNEL/PolyhedronIntersectorP1P0.txx index 85b4b58ae..b56f5f5ef 100644 --- a/src/INTERP_KERNEL/PolyhedronIntersectorP1P0.txx +++ b/src/INTERP_KERNEL/PolyhedronIntersectorP1P0.txx @@ -85,7 +85,7 @@ namespace INTERP_KERNEL for(typename std::vector::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++) { releaseArrays(); - int nbOfNodesS=Intersector3D::_src_mesh.getNumberOfNodesOfElement(OTT::indFC(*iterCellS)); + ConnType nbOfNodesS=Intersector3D::_src_mesh.getNumberOfNodesOfElement(OTT::indFC(*iterCellS)); _split.splitTargetCell(*iterCellS,nbOfNodesS,_tetra); for(typename std::vector*>::iterator iter = _tetra.begin(); iter != _tetra.end(); ++iter) { diff --git a/src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.txx b/src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.txx index c4645fecb..7084fd980 100755 --- a/src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.txx +++ b/src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.txx @@ -97,7 +97,7 @@ namespace INTERP_KERNEL { typename MyMatrix::value_type& resRow=res[tgtCell]; - int nbOfNodesT=Intersector3D::_target_mesh.getNumberOfNodesOfElement(OTT::indFC(tgtCell)); + ConnType nbOfNodesT=Intersector3D::_target_mesh.getNumberOfNodesOfElement(OTT::indFC(tgtCell)); releaseArrays(); _split.splitTargetCell(tgtCell,nbOfNodesT,_tetra); diff --git a/src/INTERP_KERNEL/PolyhedronIntersectorP1P1.txx b/src/INTERP_KERNEL/PolyhedronIntersectorP1P1.txx index 746fa7d14..79731b9d3 100755 --- a/src/INTERP_KERNEL/PolyhedronIntersectorP1P1.txx +++ b/src/INTERP_KERNEL/PolyhedronIntersectorP1P1.txx @@ -79,8 +79,8 @@ namespace INTERP_KERNEL UnitTetraIntersectionBary b; b.init(); #endif // split the targetCell into dual cells - std::pair< int, std::vector > subTetraNodes[24]; // a node of sub tetra and its coordinates - const double* nodes[4]; int conn[4]; + std::pair< ConnType, std::vector > subTetraNodes[24]; // a node of sub tetra and its coordinates + const double* nodes[4]; ConnType conn[4]; for(int node = 0; node < 4 ; ++node) nodes[node]=getCoordsOfNode2(node, OTT::indFC(targetCell), Intersector3D::_target_mesh,conn[node]); diff --git a/src/INTERP_KERNEL/SplitterTetra.cxx b/src/INTERP_KERNEL/SplitterTetra.cxx index 67eb81537..0d109f48d 100644 --- a/src/INTERP_KERNEL/SplitterTetra.cxx +++ b/src/INTERP_KERNEL/SplitterTetra.cxx @@ -23,8 +23,8 @@ namespace INTERP_KERNEL { - void SplitHexa8IntoTetras(SplittingPolicy policy, const int *nodalConnBg, const int *nodalConnEnd, const double *coords, - std::vector& tetrasNodalConn, std::vector& addCoords) + void SplitHexa8IntoTetras(SplittingPolicy policy, const mcIdType *nodalConnBg, const mcIdType *nodalConnEnd, const double *coords, + std::vector& tetrasNodalConn, std::vector& addCoords) { if(std::distance(nodalConnBg,nodalConnEnd)!=8) throw INTERP_KERNEL::Exception("SplitHexa8IntoTetras : input hexa do not have 8 nodes !"); @@ -33,7 +33,7 @@ namespace INTERP_KERNEL case PLANAR_FACE_5: { tetrasNodalConn.resize(20); - int *conn(&tetrasNodalConn[0]); + mcIdType *conn(&tetrasNodalConn[0]); conn[0]=nodalConnBg[SPLIT_NODES_5_WO[0]]; conn[1]=nodalConnBg[SPLIT_NODES_5_WO[1]]; conn[2]=nodalConnBg[SPLIT_NODES_5_WO[2]]; conn[3]=nodalConnBg[SPLIT_NODES_5_WO[3]]; conn[4]=nodalConnBg[SPLIT_NODES_5_WO[4]]; conn[5]=nodalConnBg[SPLIT_NODES_5_WO[5]]; conn[6]=nodalConnBg[SPLIT_NODES_5_WO[6]]; conn[7]=nodalConnBg[SPLIT_NODES_5_WO[7]]; conn[8]=nodalConnBg[SPLIT_NODES_5_WO[8]]; conn[9]=nodalConnBg[SPLIT_NODES_5_WO[9]]; conn[10]=nodalConnBg[SPLIT_NODES_5_WO[10]]; conn[11]=nodalConnBg[SPLIT_NODES_5_WO[11]]; @@ -44,7 +44,7 @@ namespace INTERP_KERNEL case PLANAR_FACE_6: { tetrasNodalConn.resize(24); - int *conn(&tetrasNodalConn[0]); + mcIdType *conn(&tetrasNodalConn[0]); conn[0]=nodalConnBg[SPLIT_NODES_6_WO[0]]; conn[1]=nodalConnBg[SPLIT_NODES_6_WO[1]]; conn[2]=nodalConnBg[SPLIT_NODES_6_WO[2]]; conn[3]=nodalConnBg[SPLIT_NODES_6_WO[3]]; conn[4]=nodalConnBg[SPLIT_NODES_6_WO[4]]; conn[5]=nodalConnBg[SPLIT_NODES_6_WO[5]]; conn[6]=nodalConnBg[SPLIT_NODES_6_WO[6]]; conn[7]=nodalConnBg[SPLIT_NODES_6_WO[7]]; conn[8]=nodalConnBg[SPLIT_NODES_6_WO[8]]; conn[9]=nodalConnBg[SPLIT_NODES_6_WO[9]]; conn[10]=nodalConnBg[SPLIT_NODES_6_WO[10]]; conn[11]=nodalConnBg[SPLIT_NODES_6_WO[11]]; @@ -57,7 +57,7 @@ namespace INTERP_KERNEL { addCoords.resize(7*3); tetrasNodalConn.resize(24*4); - int *conn(&tetrasNodalConn[0]); + mcIdType *conn(&tetrasNodalConn[0]); double *tmp(&addCoords[18]); tmp[0]=0.; tmp[1]=0.; tmp[2]=0.; double *tmp2(&addCoords[0]); @@ -66,7 +66,7 @@ namespace INTERP_KERNEL tmp2[0]=0.; tmp2[1]=0.; tmp2[2]=0.; for(int j=0;j<4;j++,conn+=4) { - int tmp3(nodalConnBg[GENERAL_24_SUB_NODES_WO[4*i+j]]); + mcIdType tmp3(nodalConnBg[GENERAL_24_SUB_NODES_WO[4*i+j]]); tmp2[0]+=coords[3*tmp3+0]; tmp2[1]+=coords[3*tmp3+1]; tmp2[2]+=coords[3*tmp3+2]; @@ -97,13 +97,13 @@ namespace INTERP_KERNEL tmp2[1]=(tmp[3*(GENERAL_48_SUB_NODES[2*i+24]-8)+1]+tmp[3*(GENERAL_48_SUB_NODES[2*i+25]-8)+1])/2.; tmp2[2]=(tmp[3*(GENERAL_48_SUB_NODES[2*i+24]-8)+2]+tmp[3*(GENERAL_48_SUB_NODES[2*i+25]-8)+2])/2.; } - int *conn(&tetrasNodalConn[0]); + mcIdType *conn(&tetrasNodalConn[0]); std::vector dummy; for(int i=0;i<8;i++) { - std::vector c; + std::vector c; SplitHexa8IntoTetras(PLANAR_FACE_6,GENERAL_48_SUBZONES_2+i*8,GENERAL_48_SUBZONES_2+(i+1)*8,coords,c,dummy); - int *conn2(&c[0]); + mcIdType *conn2(&c[0]); for(int j=0;j<6;j++,conn+=4,conn2+=4) { conn[0]=conn2[0]>=0?nodalConnBg[conn2[0]]:conn2[0]; @@ -119,8 +119,8 @@ namespace INTERP_KERNEL } } - void SplitIntoTetras(SplittingPolicy policy, NormalizedCellType gt, const int *nodalConnBg, const int *nodalConnEnd, const double *coords, - std::vector& tetrasNodalConn, std::vector& addCoords) + void SplitIntoTetras(SplittingPolicy policy, NormalizedCellType gt, const mcIdType *nodalConnBg, const mcIdType *nodalConnEnd, const double *coords, + std::vector& tetrasNodalConn, std::vector& addCoords) { switch(gt) { @@ -143,7 +143,7 @@ namespace INTERP_KERNEL if(sz!=5) throw INTERP_KERNEL::Exception("SplitIntoTetras : input pyra5 do not have 5 nodes !"); tetrasNodalConn.resize(8); - int *conn(&tetrasNodalConn[0]); + mcIdType *conn(&tetrasNodalConn[0]); conn[0]=nodalConnBg[0]; conn[1]=nodalConnBg[1]; conn[2]=nodalConnBg[2]; conn[3]=nodalConnBg[4]; conn[4]=nodalConnBg[0]; conn[5]=nodalConnBg[2]; conn[6]=nodalConnBg[3]; conn[7]=nodalConnBg[4]; return ; @@ -154,7 +154,7 @@ namespace INTERP_KERNEL if(sz!=6) throw INTERP_KERNEL::Exception("SplitIntoTetras : input penta6 do not have 6 nodes !"); tetrasNodalConn.resize(12); - int *conn(&tetrasNodalConn[0]); + mcIdType *conn(&tetrasNodalConn[0]); conn[0]=nodalConnBg[0]; conn[1]=nodalConnBg[1]; conn[2]=nodalConnBg[2]; conn[3]=nodalConnBg[3]; conn[4]=nodalConnBg[3]; conn[5]=nodalConnBg[5]; conn[6]=nodalConnBg[4]; conn[7]=nodalConnBg[2]; conn[8]=nodalConnBg[4]; conn[9]=nodalConnBg[2]; conn[10]=nodalConnBg[1]; conn[11]=nodalConnBg[3]; @@ -166,7 +166,7 @@ namespace INTERP_KERNEL if(sz!=12) throw INTERP_KERNEL::Exception("SplitIntoTetras : input octa12 (hexagone prism) do not have 12 nodes !"); tetrasNodalConn.resize(48); - int *conn(&tetrasNodalConn[0]); + mcIdType *conn(&tetrasNodalConn[0]); conn[0]=nodalConnBg[0]; conn[1]=nodalConnBg[1]; conn[2]=nodalConnBg[5]; conn[3]=nodalConnBg[6]; conn[4]=nodalConnBg[6]; conn[5]=nodalConnBg[11]; conn[6]=nodalConnBg[7]; conn[7]=nodalConnBg[5]; conn[8]=nodalConnBg[7]; conn[9]=nodalConnBg[5]; conn[10]=nodalConnBg[1]; conn[11]=nodalConnBg[6]; @@ -186,28 +186,28 @@ namespace INTERP_KERNEL } case NORM_POLYHED: { - std::size_t nbOfFaces(std::count(nodalConnBg,nodalConnEnd,-1)+1); + mcIdType nbOfFaces(ToIdType(std::count(nodalConnBg,nodalConnEnd,-1)+1)); std::size_t nbOfTetra(std::distance(nodalConnBg,nodalConnEnd)-nbOfFaces+1); addCoords.resize((nbOfFaces+1)*3); tetrasNodalConn.resize(nbOfTetra*4); - int *conn(&tetrasNodalConn[0]); - const int *work(nodalConnBg); + mcIdType *conn(&tetrasNodalConn[0]); + const mcIdType *work(nodalConnBg); double *tmp(&addCoords[0]),*tmp2(&addCoords[3*nbOfFaces]); tmp2[0]=0.; tmp2[1]=0.; tmp2[2]=0.; - for(std::size_t i=0;i class SplitterTetra { - public: + public: + typedef typename MyMeshType::MyConnType ConnType; SplitterTetra(const MyMeshType& srcMesh, const double** tetraCorners, const typename MyMeshType::MyConnType *nodesId); - SplitterTetra(const MyMeshType& srcMesh, const double tetraCorners[12], const int *conn = 0); + SplitterTetra(const MyMeshType& srcMesh, const double tetraCorners[12], const ConnType *conn = 0); ~SplitterTetra(); double intersectSourceCell(typename MyMeshType::MyConnType srcCell, double* baryCentre=0); double intersectSourceFace(const NormalizedCellType polyType, - const int polyNodesNbr, - const mcIdType *const polyNodes, + const ConnType polyNodesNbr, + const ConnType *const polyNodes, const double *const *const polyCoords, const double dimCaracteristic, const double precision, @@ -381,19 +382,19 @@ namespace INTERP_KERNEL double intersectTetra(const double** tetraCorners); - typename MyMeshType::MyConnType getId(mcIdType id) { return _conn[id]; } + ConnType getId(mcIdType id) { return _conn[id]; } void splitIntoDualCells(SplitterTetra **output); - void splitMySelfForDual(double* output, int i, typename MyMeshType::MyConnType& nodeId); + void splitMySelfForDual(double* output, int i, ConnType& nodeId); void clearVolumesCache(); private: inline static void CheckIsOutside(const double* pt, bool* isOutside, const double errTol = DEFAULT_ABS_TOL); inline static void CheckIsStrictlyOutside(const double* pt, bool* isStrictlyOutside, const double errTol = DEFAULT_ABS_TOL); - inline void calculateNode(typename MyMeshType::MyConnType globalNodeNum); - inline void calculateNode2(typename MyMeshType::MyConnType globalNodeNum, const double* node); + inline void calculateNode(ConnType globalNodeNum); + inline void calculateNode2(ConnType globalNodeNum, const double* node); inline void calculateVolume(TransformedTriangle& tri, const TriangleFaceKey& key); inline void calculateSurface(TransformedTriangle& tri, const TriangleFaceKey& key); @@ -416,7 +417,7 @@ namespace INTERP_KERNEL TetraAffineTransform* _t; /// HashMap relating node numbers to transformed nodes, used for caching - HashMap< typename MyMeshType::MyConnType , double* > _nodes; + HashMap< ConnType , double* > _nodes; /// HashMap relating triangular faces to calculated volume contributions, used for caching HashMap< TriangleFaceKey, double > _volumes; @@ -425,7 +426,7 @@ namespace INTERP_KERNEL const MyMeshType& _src_mesh; // node id of the first node in target mesh in C mode. - typename MyMeshType::MyConnType _conn[4]; + ConnType _conn[4]; double _coords[12]; @@ -557,7 +558,7 @@ namespace INTERP_KERNEL inline const double* getCoordsOfSubNode(typename MyMeshTypeT::MyConnType node);//to suppress inline const double* getCoordsOfSubNode2(typename MyMeshTypeT::MyConnType node, typename MyMeshTypeT::MyConnType& nodeId);//to suppress //template - inline void calcBarycenter(int n, double* barycenter, const typename MyMeshTypeT::MyConnType* pts);//to suppress + inline void calcBarycenter(typename MyMeshTypeT::MyConnType n, double* barycenter, const int* pts);//to suppress private: const MyMeshTypeT& _target_mesh; const MyMeshTypeS& _src_mesh; @@ -577,7 +578,7 @@ namespace INTERP_KERNEL */ template //template - inline void SplitterTetra2::calcBarycenter(int n, double* barycenter, const typename MyMeshTypeT::MyConnType* pts) + inline void SplitterTetra2::calcBarycenter(typename MyMeshTypeT::MyConnType n, double* barycenter, const int* pts) { barycenter[0] = barycenter[1] = barycenter[2] = 0.0; for(int i = 0; i < n ; ++i) @@ -588,9 +589,9 @@ namespace INTERP_KERNEL barycenter[2] += pt[2]; } - barycenter[0] /= n; - barycenter[1] /= n; - barycenter[2] /= n; + barycenter[0] /= (double)n; + barycenter[1] /= (double)n; + barycenter[2] /= (double)n; } /** diff --git a/src/INTERP_KERNEL/SplitterTetra.txx b/src/INTERP_KERNEL/SplitterTetra.txx index 147312671..ce0136d99 100644 --- a/src/INTERP_KERNEL/SplitterTetra.txx +++ b/src/INTERP_KERNEL/SplitterTetra.txx @@ -99,7 +99,7 @@ namespace INTERP_KERNEL * \param [in] tetraCorners array 4*3 doubles containing corners of input tetrahedron (P0X,P0Y,P0Y,P1X,P1Y,P1Z,P2X,P2Y,P2Z,P3X,P3Y,P3Z). */ template - SplitterTetra::SplitterTetra(const MyMeshType& srcMesh, const double tetraCorners[12], const int *conn): _t(0),_src_mesh(srcMesh) + SplitterTetra::SplitterTetra(const MyMeshType& srcMesh, const double tetraCorners[12], const ConnType *conn): _t(0),_src_mesh(srcMesh) { if(!conn) { _conn[0]=0; _conn[1]=1; _conn[2]=2; _conn[3]=3; } @@ -121,7 +121,7 @@ namespace INTERP_KERNEL SplitterTetra::~SplitterTetra() { delete _t; - for(HashMap< int, double* >::iterator iter = _nodes.begin(); iter != _nodes.end() ; ++iter) + for(typename HashMap< ConnType, double* >::iterator iter = _nodes.begin(); iter != _nodes.end() ; ++iter) delete[] iter->second; } @@ -191,14 +191,14 @@ namespace INTERP_KERNEL // get type of cell NormalizedCellType normCellType=_src_mesh.getTypeOfElement(OTT::indFC(element)); const CellModel& cellModelCell=CellModel::GetCellModel(normCellType); - unsigned nbOfNodes4Type=cellModelCell.isDynamic() ? _src_mesh.getNumberOfNodesOfElement(OTT::indFC(element)) : cellModelCell.getNumberOfNodes(); + ConnType nbOfNodes4Type=cellModelCell.isDynamic() ? _src_mesh.getNumberOfNodesOfElement(OTT::indFC(element)) : cellModelCell.getNumberOfNodes(); // halfspace filtering bool isOutside[8] = {true, true, true, true, true, true, true, true}; bool isTargetOutside = false; // calculate the coordinates of the nodes ConnType *cellNodes=new ConnType[nbOfNodes4Type]; - for(int i = 0;i<(int)nbOfNodes4Type;++i) + for(ConnType i = 0;i global numbers too, but not sure it is worth it const ConnType globalNodeNum = getGlobalNumberOfNode(i, OTT::indFC(element), _src_mesh); @@ -232,19 +232,19 @@ namespace INTERP_KERNEL // get nb of sons of a cell const ConnType* rawCellConn = _src_mesh.getConnectivityPtr() + OTT::conn2C( _src_mesh.getConnectivityIndexPtr()[ element ]); - const int rawNbCellNodes = _src_mesh.getConnectivityIndexPtr()[ element+1 ] - _src_mesh.getConnectivityIndexPtr()[ element ]; + const ConnType rawNbCellNodes = _src_mesh.getConnectivityIndexPtr()[ element+1 ] - _src_mesh.getConnectivityIndexPtr()[ element ]; unsigned nbOfSons = cellModelCell.getNumberOfSons2(rawCellConn, rawNbCellNodes); for(unsigned ii = 0 ; ii < nbOfSons; ++ii) { // get sons connectivity NormalizedCellType faceType; - mcIdType *faceNodes, nbFaceNodes=-1; + ConnType *faceNodes, nbFaceNodes=-1; if ( cellModelCell.isDynamic() ) { - faceNodes=new mcIdType[nbOfNodes4Type]; + faceNodes=new ConnType[nbOfNodes4Type]; nbFaceNodes = cellModelCell.fillSonCellNodalConnectivity2(ii,rawCellConn,rawNbCellNodes,faceNodes,faceType); - for ( int i = 0; i < nbFaceNodes; ++i ) + for ( ConnType i = 0; i < nbFaceNodes; ++i ) faceNodes[i] = OTT::coo2C(faceNodes[i]); } else @@ -326,8 +326,8 @@ namespace INTERP_KERNEL case NORM_POLYGON: { - int nbTria = nbFaceNodes - 2; // split polygon into nbTria triangles - for ( int iTri = 0; iTri < nbTria; ++iTri ) + ConnType nbTria = nbFaceNodes - 2; // split polygon into nbTria triangles + for ( ConnType iTri = 0; iTri < nbTria; ++iTri ) { TriangleFaceKey key = TriangleFaceKey(faceNodes[0], faceNodes[1+iTri], faceNodes[2+iTri]); if(_volumes.find(key) == _volumes.end()) @@ -589,8 +589,8 @@ namespace INTERP_KERNEL */ template double SplitterTetra::intersectSourceFace(const NormalizedCellType polyType, - const int polyNodesNbr, - const mcIdType *const polyNodes, + const ConnType polyNodesNbr, + const ConnType *const polyNodes, const double *const *const polyCoords, const double dimCaracteristic, const double precision, @@ -614,9 +614,9 @@ namespace INTERP_KERNEL bool isTargetOutside = false; // calculate the coordinates of the nodes - for(int i = 0;i<(int)polyNodesNbr;++i) + for(ConnType i = 0;i void SplitterTetra2::splitTargetCell2(typename MyMeshTypeT::MyConnType targetCell, typename std::vector< SplitterTetra* >& tetra) { - const int *refConn(_target_mesh.getConnectivityPtr()); - const int *cellConn(refConn+_target_mesh.getConnectivityIndexPtr()[targetCell]); + typedef typename MyMeshTypeT::MyConnType TConnType; + const TConnType *refConn(_target_mesh.getConnectivityPtr()); + const TConnType *cellConn(refConn+_target_mesh.getConnectivityIndexPtr()[targetCell]); INTERP_KERNEL::NormalizedCellType gt(_target_mesh.getTypeOfElement(targetCell)); - std::vector tetrasNodalConn; + std::vector tetrasNodalConn; std::vector addCoords; const double *coords(_target_mesh.getCoordinatesPtr()); SplitIntoTetras(_splitting_pol,gt,cellConn,refConn+_target_mesh.getConnectivityIndexPtr()[targetCell+1],coords,tetrasNodalConn,addCoords); std::size_t nbTetras(tetrasNodalConn.size()/4); tetra.resize(nbTetras); double tmp[12]; - int tmp2[4]; + typename MyMeshTypeS::MyConnType tmp2[4]; for(std::size_t i=0;i=0) { @@ -980,7 +981,7 @@ namespace INTERP_KERNEL _node_ids.resize(8); tetra.reserve(1); const double *nodes[4]; - int conn[4]; + ConnType conn[4]; for(int node = 0; node < 4 ; ++node) { nodes[node]=getCoordsOfNode2(node, OTT::indFC(targetCell),_target_mesh,conn[node]); @@ -1061,7 +1062,7 @@ namespace INTERP_KERNEL for(int i = 0; i < 5; ++i) { const double* nodes[4]; - int conn[4]; + typename MyMeshTypeS::MyConnType conn[4]; for(int j = 0; j < 4; ++j) { conn[j] = subZone[ SPLIT_NODES_5[4*i+j] ]; @@ -1085,7 +1086,7 @@ namespace INTERP_KERNEL for(int i = 0; i < 6; ++i) { const double* nodes[4]; - int conn[4]; + typename MyMeshTypeS::MyConnType conn[4]; for(int j = 0; j < 4; ++j) { conn[j] = subZone[SPLIT_NODES_6[4*i+j]]; @@ -1112,7 +1113,7 @@ namespace INTERP_KERNEL // nodes to use for tetrahedron const double* nodes[4]; - int conn[4]; + typename MyMeshTypeS::MyConnType conn[4]; // get the cell center conn[0] = 14; nodes[0] = getCoordsOfSubNode(conn[0]); @@ -1172,7 +1173,7 @@ namespace INTERP_KERNEL // create tetrahedra const double* nodes[4]; - int conn[4]; + typename MyMeshTypeS::MyConnType conn[4]; for(int i = 0; i < 2; ++i) { for(int j = 0; j < 4; ++j) @@ -1198,24 +1199,24 @@ namespace INTERP_KERNEL // get type of cell and nb of cell nodes NormalizedCellType normCellType=_target_mesh.getTypeOfElement(OTT::indFC(targetCell)); const CellModel& cellModelCell=CellModel::GetCellModel(normCellType); - unsigned nbOfCellNodes=cellModelCell.isDynamic() ? _target_mesh.getNumberOfNodesOfElement(OTT::indFC(targetCell)) : cellModelCell.getNumberOfNodes(); + ConnType nbOfCellNodes=cellModelCell.isDynamic() ? _target_mesh.getNumberOfNodesOfElement(OTT::indFC(targetCell)) : cellModelCell.getNumberOfNodes(); // get nb of cell sons (faces) const ConnType* rawCellConn = _target_mesh.getConnectivityPtr() + OTT::conn2C( _target_mesh.getConnectivityIndexPtr()[ targetCell ]); - const int rawNbCellNodes = _target_mesh.getConnectivityIndexPtr()[ targetCell+1 ] - _target_mesh.getConnectivityIndexPtr()[ targetCell ]; + const ConnType rawNbCellNodes = _target_mesh.getConnectivityIndexPtr()[ targetCell+1 ] - _target_mesh.getConnectivityIndexPtr()[ targetCell ]; unsigned nbOfSons = cellModelCell.getNumberOfSons2(rawCellConn, rawNbCellNodes); // indices of nodes of a son static std::vector allNodeIndices; // == 0,1,2,...,nbOfCellNodes-1 - while ( allNodeIndices.size() < nbOfCellNodes ) + while ( allNodeIndices.size() < (std::size_t)nbOfCellNodes ) allNodeIndices.push_back( static_cast(allNodeIndices.size()) ); - std::vector classicFaceNodes(4); + std::vector classicFaceNodes(4); if(cellModelCell.isQuadratic()) throw INTERP_KERNEL::Exception("SplitterTetra2::splitConvex : quadratic 3D cells are not implemented yet !"); - int* faceNodes = cellModelCell.isDynamic() ? &allNodeIndices[0] : &classicFaceNodes[0]; + ConnType* faceNodes = cellModelCell.isDynamic() ? &allNodeIndices[0] : &classicFaceNodes[0]; // nodes of tetrahedron - int conn[4]; + typename MyMeshTypeS::MyConnType conn[4]; const double* nodes[4]; nodes[3] = getCoordsOfSubNode2( nbOfCellNodes,conn[3]); // barycenter diff --git a/src/INTERP_KERNEL/VolSurfFormulae.hxx b/src/INTERP_KERNEL/VolSurfFormulae.hxx index da543be2f..ae2851387 100644 --- a/src/INTERP_KERNEL/VolSurfFormulae.hxx +++ b/src/INTERP_KERNEL/VolSurfFormulae.hxx @@ -26,20 +26,21 @@ #include "InterpKernelGeo2DEdgeLin.hxx" #include "InterpKernelGeo2DEdgeArcCircle.hxx" #include "InterpKernelGeo2DQuadraticPolygon.hxx" +#include "MCIdType.hxx" #include #include namespace INTERP_KERNEL { - inline void calculateBarycenterDyn(const double **pts, int nbPts, + inline void calculateBarycenterDyn(const double **pts, mcIdType nbPts, int dim, double *bary); - inline double calculateAreaForPolyg(const double **coords, int nbOfPtsInPolygs, + inline double calculateAreaForPolyg(const double **coords, mcIdType nbOfPtsInPolygs, int spaceDim); - inline double calculateAreaForQPolyg(const double **coords, int nbOfPtsInPolygs, + inline double calculateAreaForQPolyg(const double **coords, mcIdType nbOfPtsInPolygs, int spaceDim); inline double calculateLgthForSeg2(const double *p1, const double *p2, int spaceDim) @@ -168,7 +169,7 @@ namespace INTERP_KERNEL // =================================== // Calculate Normal Vector for Polygon // =================================== - inline void calculateNormalForPolyg(const double **coords, int nbOfPtsInPolygs, + inline void calculateNormalForPolyg(const double **coords, mcIdType nbOfPtsInPolygs, double *normal) { double coordOfBary[3]; @@ -203,14 +204,14 @@ namespace INTERP_KERNEL // ========================== // Calculate Area for Polygon // ========================== - inline double calculateAreaForPolyg(const double **coords, int nbOfPtsInPolygs, + inline double calculateAreaForPolyg(const double **coords, mcIdType nbOfPtsInPolygs, int spaceDim) { double ret=0.; double coordOfBary[3]; calculateBarycenterDyn(coords,nbOfPtsInPolygs,spaceDim,coordOfBary); - for ( int i=0; i nodes(nbOfPtsInPolygs); - for(int i=0;igetArea(); @@ -465,7 +466,7 @@ namespace INTERP_KERNEL * polyhedron */ template - inline double calculateVolumeForPolyh2(const ConnType *connec, int lgth, const double *coords) + inline double calculateVolumeForPolyh2(const ConnType *connec, mcIdType lgth, const double *coords) { std::size_t nbOfFaces=std::count(connec,connec+lgth,-1)+1; double volume=0.; @@ -496,10 +497,10 @@ namespace INTERP_KERNEL * @param res must be of size at least 3 to store the result. */ template - inline void areaVectorOfPolygon(const ConnType *connec, int lgth, const double *coords, double *res) + inline void areaVectorOfPolygon(const ConnType *connec, mcIdType lgth, const double *coords, double *res) { res[0]=0.; res[1]=0.; res[2]=0.; - for(int ptId=0;ptId::coo2C(connec[ptId]); const double *pti1=coords+3*OTT::coo2C(connec[(ptId+1)%lgth]); @@ -510,7 +511,7 @@ namespace INTERP_KERNEL } template - inline void computePolygonBarycenter3D(const ConnType *connec, int lgth, const double *coords, double *res) + inline void computePolygonBarycenter3D(const ConnType *connec, mcIdType lgth, const double *coords, double *res) { double area[3]; areaVectorOfPolygon(connec,lgth,coords,area); @@ -519,7 +520,7 @@ namespace INTERP_KERNEL { area[0]/=norm; area[1]/=norm; area[2]/=norm; res[0]=0.; res[1]=0.; res[2]=0.; - for(int i=1;i::coo2C(connec[(i+1)%lgth])]-coords[3*OTT::coo2C(connec[i])]; v[1]=coords[3*OTT::coo2C(connec[(i+1)%lgth])+1]-coords[3*OTT::coo2C(connec[i])+1]; @@ -569,13 +570,13 @@ namespace INTERP_KERNEL else { res[0]=0.; res[1]=0.; res[2]=0.; - for(int i=0;i::coo2C(connec[i])]; res[1]+=coords[3*OTT::coo2C(connec[i])+1]; res[2]+=coords[3*OTT::coo2C(connec[i])+2]; } - res[0]/=lgth; res[1]/=lgth; res[2]/=lgth; + res[0]/=FromIdType(lgth); res[1]/=FromIdType(lgth); res[2]/=FromIdType(lgth); return; } } @@ -588,7 +589,7 @@ namespace INTERP_KERNEL } template - inline void barycenterOfPolyhedron(const ConnType *connec, int lgth, const double *coords, double *res) + inline void barycenterOfPolyhedron(const ConnType *connec, mcIdType lgth, const double *coords, double *res) { std::size_t nbOfFaces=std::count(connec,connec+lgth,-1)+1; res[0]=0.; res[1]=0.; res[2]=0.; @@ -755,39 +756,39 @@ namespace INTERP_KERNEL { } - inline void calculateBarycenterDyn(const double **pts, int nbPts, + inline void calculateBarycenterDyn(const double **pts, mcIdType nbPts, int dim, double *bary) { for(int i=0;i(nbPts); } } template - inline void calculateBarycenterDyn2(const double *pts, int nbPts, double *bary) + inline void calculateBarycenterDyn2(const double *pts, mcIdType nbPts, double *bary) { for(int i=0;i(nbPts); } } - inline void computePolygonBarycenter2DEngine(double **coords, int lgth, double *res) + inline void computePolygonBarycenter2DEngine(double **coords, mcIdType lgth, double *res) { double area=0.; res[0]=0.; res[1]=0.; - for(int i=0;i - inline void computePolygonBarycenter2D(const ConnType *connec, int lgth, const double *coords, double *res) + inline void computePolygonBarycenter2D(const ConnType *connec, mcIdType lgth, const double *coords, double *res) { double **coords2=new double *[lgth]; - for(int i=0;i(coords+2*OTT::coo2C(connec[i])); computePolygonBarycenter2DEngine(coords2,lgth,res); delete [] coords2; } - inline void computeQPolygonBarycenter2D(double **coords, int nbOfPtsInPolygs, int spaceDim, double *res) + inline void computeQPolygonBarycenter2D(double **coords, mcIdType nbOfPtsInPolygs, int spaceDim, double *res) { if(nbOfPtsInPolygs%2==0) { if(spaceDim==2) { std::vector nodes(nbOfPtsInPolygs); - for(int i=0;igetBarycenter(res); diff --git a/src/INTERP_KERNEL/VolSurfUser.cxx b/src/INTERP_KERNEL/VolSurfUser.cxx index 853e3226d..c8b01fd08 100644 --- a/src/INTERP_KERNEL/VolSurfUser.cxx +++ b/src/INTERP_KERNEL/VolSurfUser.cxx @@ -212,7 +212,7 @@ namespace INTERP_KERNEL return sqrt(sDist); } - double DistanceFromPtToPolygonInSpaceDim3(const double *pt, const int *connOfPolygonBg, const int *connOfPolygonEnd, const double *coords) + double DistanceFromPtToPolygonInSpaceDim3(const double *pt, const mcIdType *connOfPolygonBg, const mcIdType *connOfPolygonEnd, const double *coords) { std::size_t nbOfEdges=std::distance(connOfPolygonBg,connOfPolygonEnd); if(nbOfEdges<3) diff --git a/src/INTERP_KERNEL/VolSurfUser.hxx b/src/INTERP_KERNEL/VolSurfUser.hxx index 225dfbb8a..e37550344 100644 --- a/src/INTERP_KERNEL/VolSurfUser.hxx +++ b/src/INTERP_KERNEL/VolSurfUser.hxx @@ -29,16 +29,16 @@ namespace INTERP_KERNEL { template - double computeVolSurfOfCell(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords); + double computeVolSurfOfCell(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords); template - double computeVolSurfOfCell2(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords, int spaceDim); + double computeVolSurfOfCell2(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords, int spaceDim); template - void computeBarycenter(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords, double *res); + void computeBarycenter(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords, double *res); template - void computeBarycenter2(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords, int spaceDim, double *res); + void computeBarycenter2(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords, int spaceDim, double *res); double INTERPKERNEL_EXPORT OrthoDistanceFromPtToPlaneInSpaceDim3(const double *p, const double *p1, const double *p2, const double *p3); diff --git a/src/INTERP_KERNEL/VolSurfUser.txx b/src/INTERP_KERNEL/VolSurfUser.txx index 9f637f78e..6e1512603 100644 --- a/src/INTERP_KERNEL/VolSurfUser.txx +++ b/src/INTERP_KERNEL/VolSurfUser.txx @@ -29,7 +29,7 @@ namespace INTERP_KERNEL { template - double computeVolSurfOfCell(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords) + double computeVolSurfOfCell(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords) { switch(type) { @@ -221,7 +221,7 @@ namespace INTERP_KERNEL } template - double computeVolSurfOfCell2(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords, int spaceDim) + double computeVolSurfOfCell2(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords, int spaceDim) { if(spaceDim==3) return computeVolSurfOfCell(type,connec,lgth,coords); @@ -234,7 +234,7 @@ namespace INTERP_KERNEL template - void computeBarycenter(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords, double *res) + void computeBarycenter(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords, double *res) { switch(type) { @@ -424,7 +424,7 @@ namespace INTERP_KERNEL } template - void computeBarycenter2(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords, int spaceDim, double *res) + void computeBarycenter2(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords, int spaceDim, double *res) { if(spaceDim==3) return computeBarycenter(type,connec,lgth,coords,res); diff --git a/src/INTERP_KERNELTest/MeshTestToolkit.hxx b/src/INTERP_KERNELTest/MeshTestToolkit.hxx index 39ab79a98..ff4cc7be2 100644 --- a/src/INTERP_KERNELTest/MeshTestToolkit.hxx +++ b/src/INTERP_KERNELTest/MeshTestToolkit.hxx @@ -29,7 +29,7 @@ #define ERR_TOL 1.0e-8 -typedef std::vector > IntersectionMatrix; +typedef std::vector > IntersectionMatrix; namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNELTest/MeshTestToolkit.txx b/src/INTERP_KERNELTest/MeshTestToolkit.txx index b2e695a72..f934c1e8a 100644 --- a/src/INTERP_KERNELTest/MeshTestToolkit.txx +++ b/src/INTERP_KERNELTest/MeshTestToolkit.txx @@ -70,7 +70,7 @@ namespace INTERP_TEST { if(iter->count(i) != 0.0) { - std::map::const_iterator iter2 = iter->find(i); + std::map::const_iterator iter2 = iter->find(i); vol += fabs(iter2->second); } } @@ -89,8 +89,8 @@ namespace INTERP_TEST double MeshTestToolkit::sumCol(const IntersectionMatrix& m, int i) const { double vol = 0.0; - const std::map& col = m[i]; - for(std::map::const_iterator iter = col.begin() ; iter != col.end() ; ++iter) + const std::map& col = m[i]; + for(std::map::const_iterator iter = col.begin() ; iter != col.end() ; ++iter) { vol += fabs(iter->second); } @@ -123,7 +123,7 @@ namespace INTERP_TEST std::vector volumes; for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter) { - for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) + for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) { volumes.push_back(fabs(iter2->second)); } @@ -203,9 +203,9 @@ namespace INTERP_TEST int i = 0; for(IntersectionMatrix::const_iterator iter = m1.begin() ; iter != m1.end() ; ++iter) { - for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) + for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) { - int j = iter2->first; + mcIdType j = iter2->first; if(m2.at(j).count(i) == 0) { if(!epsilonEqual(iter2->second, 0.0, _precision)) @@ -245,13 +245,13 @@ namespace INTERP_TEST for(IntersectionMatrix::const_iterator iter = m1.begin() ; iter != m1.end() ; ++iter) { - for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) + for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) { - int j = iter2->first; + mcIdType j = iter2->first; const double v1 = fabs(iter2->second); //if(m2[j - 1].count(i+1) > 0) // { - std::map theMap = m2.at(j); + std::map theMap = m2.at(j); const double v2 = fabs(theMap[i]); if(v1 != v2) { @@ -287,9 +287,9 @@ namespace INTERP_TEST bool isDiagonal = true; for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter) { - for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) + for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) { - int j = iter2->first; + mcIdType j = iter2->first; const double vol = iter2->second; if(vol != 0.0 && (i != j)) { @@ -322,7 +322,7 @@ namespace INTERP_TEST std::cout << "Intersection matrix is " << std::endl; for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter) { - for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) + for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) { std::cout << "V(" << i << ", " << iter2->first << ") = " << iter2->second << std::endl; } diff --git a/src/INTERP_KERNELTest/PerfTest.cxx b/src/INTERP_KERNELTest/PerfTest.cxx index 1d78aaf91..2b76b4eaf 100644 --- a/src/INTERP_KERNELTest/PerfTest.cxx +++ b/src/INTERP_KERNELTest/PerfTest.cxx @@ -106,7 +106,7 @@ namespace INTERP_TEST for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter) { numElems += iter->size(); - for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) + for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) { if(!INTERP_KERNEL::epsilonEqual(iter2->second, 0.0, VOL_PREC)) { diff --git a/src/INTERP_KERNELTest/ThreeDSurfProjectionTest.cxx b/src/INTERP_KERNELTest/ThreeDSurfProjectionTest.cxx index 2b0443eb2..c647bf1f7 100644 --- a/src/INTERP_KERNELTest/ThreeDSurfProjectionTest.cxx +++ b/src/INTERP_KERNELTest/ThreeDSurfProjectionTest.cxx @@ -19,6 +19,7 @@ #include "ThreeDSurfProjectionTest.hxx" #include "PlanarIntersector.txx" +#include "MCIdType.hxx" class MyMeshType { @@ -26,7 +27,7 @@ public: static const int MY_SPACEDIM=3; static const int MY_MESHDIM=3; static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE; - typedef int MyConnType; + typedef mcIdType MyConnType; }; class MyMatrixType diff --git a/src/INTERP_KERNELTest/UnitTetra3D2DIntersectionTest.cxx b/src/INTERP_KERNELTest/UnitTetra3D2DIntersectionTest.cxx index 98bd5e21a..c58578451 100644 --- a/src/INTERP_KERNELTest/UnitTetra3D2DIntersectionTest.cxx +++ b/src/INTERP_KERNELTest/UnitTetra3D2DIntersectionTest.cxx @@ -22,6 +22,7 @@ #include "TetraAffineTransform.hxx" #include "InterpolationUtils.hxx" #include "SplitterTetra.txx" +#include "MCIdType.hxx" #include @@ -31,13 +32,13 @@ namespace INTERP_TEST { struct __MESH_DUMMY { - typedef int MyConnType; + typedef mcIdType MyConnType; static const int MY_SPACEDIM=3; }; static SplitterTetra<__MESH_DUMMY>* buildSplitterTetra() { - const int conn[4] = { 0,1,2,3 }; + const mcIdType conn[4] = { 0,1,2,3 }; const double targetCoords[] = { -20., 0.,10., -20.,10.,10., @@ -53,7 +54,7 @@ namespace INTERP_TEST void UnitTetra3D2DIntersectionTest::test_UnitTetra3D2DIntersection_1() { - const int conn[4] = { 0,1,2 }; + const mcIdType conn[4] = { 0,1,2 }; const double sourceCoords[] = { -20., 0., 10., -12., 0., 10., @@ -98,7 +99,7 @@ namespace INTERP_TEST void UnitTetra3D2DIntersectionTest::test_UnitTetra3D2DIntersection_2() { - const int conn[4] = { 0,1,2,3 }; + const mcIdType conn[4] = { 0,1,2,3 }; const double sourceCoords[] = { -20., 0., 10., -12., 0., 10., @@ -144,7 +145,7 @@ namespace INTERP_TEST void UnitTetra3D2DIntersectionTest::test_UnitTetra3D2DIntersection_3() { - const int conn[4] = { 0,1,2 }; + const mcIdType conn[4] = { 0,1,2 }; const double sourceCoords[] = { -20., 0., 16., -18., 0., 16., diff --git a/src/INTERP_KERNELTest/UnitTetraIntersectionBaryTest.cxx b/src/INTERP_KERNELTest/UnitTetraIntersectionBaryTest.cxx index 0b1df04a0..e1afe231e 100644 --- a/src/INTERP_KERNELTest/UnitTetraIntersectionBaryTest.cxx +++ b/src/INTERP_KERNELTest/UnitTetraIntersectionBaryTest.cxx @@ -27,6 +27,7 @@ #include "TetraAffineTransform.hxx" #include "InterpolationUtils.hxx" #include "SplitterTetra.txx" +#include "MCIdType.hxx" #include @@ -271,7 +272,7 @@ namespace INTERP_TEST struct __MESH_DUMMY { - typedef int MyConnType; + typedef mcIdType MyConnType; }; void UnitTetraIntersectionBaryTest::test_UnitTetraIntersectionBary_13() @@ -288,7 +289,7 @@ namespace INTERP_TEST 75,150,75, 100,100,100}; - int conn[4] = { 0,1,2,3 }; + mcIdType conn[4] = { 0,1,2,3 }; const double* tnodes[4]={ T, T+3, T+6, T+9 }; const double* snodes[4]={ S, S+3, S+6, S+9 };