// 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 // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // Author : Anthony Geay (CEA/DEN) #ifndef __CONVEXINTERSECTOR_TXX__ #define __CONVEXINTERSECTOR_TXX__ #include "ConvexIntersector.hxx" #include "PlanarIntersectorP0P0.txx" #include "PlanarIntersectorP0P1.txx" #include "PlanarIntersectorP1P0.txx" #include "PlanarIntersectorP1P1.txx" #include "PlanarIntersectorP1P0Bary.txx" #include "PlanarIntersectorP0P1Bary.txx" #include "PolygonAlgorithms.txx" #include #define CONVINTERSECTOR_TEMPLATE template class InterpType> #define CONVEX_INTERSECTOR_ ConvexIntersector namespace INTERP_KERNEL { CONVINTERSECTOR_TEMPLATE CONVEX_INTERSECTOR_::ConvexIntersector(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double md3DSurf, double minDot3DSurf, double medianPlane, bool doRotate , int oriantation, int printLevel) :InterpType(meshT,meshS,dimCaracteristic, precision, md3DSurf, minDot3DSurf, medianPlane, doRotate, oriantation, printLevel), _epsilon(precision*dimCaracteristic) { if(PlanarIntersector::_print_level >= 1) { std::cout << " - intersection type = convex " << std::endl; if(SPACEDIM==3){ if(PlanarIntersector::_do_rotate) std::cout << " _do_rotate = true" << std::endl; else std::cout << " _do_rotate = false" << std::endl; } } } CONVINTERSECTOR_TEMPLATE double CONVEX_INTERSECTOR_::intersectGeometry(ConnType icellT, ConnType icellS, ConnType nbNodesT, ConnType nbNodesS) { double result = 0; int orientation = 1; /*** Obtain the coordinates of T and S ***/ std::vector CoordsT; std::vector CoordsS; PlanarIntersector::getRealCoordinates(icellT,icellS,nbNodesT,nbNodesS,CoordsT,CoordsS,orientation); /*** Compute the intersection area ***/ INTERP_KERNEL::PolygonAlgorithms P(_epsilon, PlanarIntersector::_precision); std::deque inter = P.intersectConvexPolygons(&CoordsT[0], &CoordsS[0], CoordsT.size()/SPACEDIM, CoordsS.size()/SPACEDIM); double area[SPACEDIM]; int nb_inter =((int)inter.size())/SPACEDIM; for(int i = 1; i(&inter[0],&inter[SPACEDIM*i],&inter[SPACEDIM*(i+1)],area); result +=0.5*norm(area); } //DEBUG prints if(PlanarIntersector::_print_level >= 3) { std::cout << std::endl << "Number of nodes of the intersection = "<< nb_inter << std::endl; for(int i=0; i< nb_inter; i++) {for (int idim=0; idim