X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FINTERP_KERNEL%2FPlanarIntersector.txx;h=f5a9ae7298aa01722bdae885b7c7f12f2e123afe;hb=b219559763498c4bd10c730cd3d2c62b1eed45db;hp=11b959dec1dd19f0a869d1bfbd2cb1b648fc0daf;hpb=75943f980f7b908052ef03c2c0154508f4b0a039;p=tools%2Fmedcoupling.git diff --git a/src/INTERP_KERNEL/PlanarIntersector.txx b/src/INTERP_KERNEL/PlanarIntersector.txx index 11b959dec..f5a9ae729 100644 --- a/src/INTERP_KERNEL/PlanarIntersector.txx +++ b/src/INTERP_KERNEL/PlanarIntersector.txx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D +// Copyright (C) 2007-2019 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -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::getElemBB(double* bb, const MyMeshType& mesh, ConnType iP, ConnType nb_nodes) @@ -132,8 +132,8 @@ namespace INTERP_KERNEL { /* We build the segment tree for locating possible matching intersections*/ - long size = bbox.size()/(2*SPACEDIM); - for (int i=0; i::max(); 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++) Coords_B[SPACEDIM*i_B+idim] -= proj*linear_comb[idim]; } - //Buid the matrix sending A into the Oxy plane and apply it to A and B + //Build the matrix sending A into the Oxy plane and apply it to A and B if(do_rotate) { TranslationRotationMatrix rotation; //rotate3DTriangle(Coords_A, &Coords_A[SPACEDIM*i_A1], &Coords_A[SPACEDIM*i_A2], rotation); - rotate3DTriangle(Coords_B, Coords_B+SPACEDIM*i_B1, Coords_B+SPACEDIM*i_B2, rotation); + Rotate3DTriangle(Coords_B, Coords_B+SPACEDIM*i_B1, Coords_B+SPACEDIM*i_B2, rotation); for (int i=0; i - void PlanarIntersector::rotate3DTriangle(double* PP1, double*PP2, double*PP3, + void PlanarIntersector::Rotate3DTriangle(double* PP1, double*PP2, double*PP3, TranslationRotationMatrix& rotation_matrix) { //initializes