// Copyright (C) 2007-2008 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. // // 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 // #ifndef __GEOMETRIC2DINTERSECTOR_TXX__ #define __GEOMETRIC2DINTERSECTOR_TXX__ #include "Geometric2DIntersector.hxx" #include "PlanarIntersectorP0P0.txx" #include "PlanarIntersectorP0P1.txx" #include "PlanarIntersectorP1P0.txx" #include "CellModel.hxx" #include "QuadraticPolygon.hxx" #include "EdgeArcCircle.hxx" #include "EdgeLin.hxx" #include "Node.hxx" namespace INTERP_KERNEL { template class InterpType> Geometric2DIntersector::Geometric2DIntersector(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double medianPlane, double precision, int orientation): InterpType >(meshT,meshS,dimCaracteristic, precision, medianPlane, true, orientation, 0) { QUADRATIC_PLANAR::_precision=dimCaracteristic*precision; } template class InterpType> double Geometric2DIntersector::intersectGeometry(ConnType icellT, ConnType icellS, ConnType nbNodesT, ConnType nbNodesS) { int orientation = 1; std::vector CoordsT; std::vector CoordsS; PlanarIntersector::getRealCoordinates(icellT,icellS,nbNodesT,nbNodesS,CoordsT,CoordsS,orientation); NormalizedCellType tT=PlanarIntersector::_meshT.getTypeOfElement(icellT); NormalizedCellType tS=PlanarIntersector::_meshS.getTypeOfElement(icellS); QuadraticPolygon *p1=buildPolygonFrom(CoordsT,tT); QuadraticPolygon *p2=buildPolygonFrom(CoordsS,tS); double ret=p1->intersectWith(*p2); delete p1; delete p2; return ret; } template class InterpType> double Geometric2DIntersector::intersectGeometryWithQuadrangle(const double *quadrangle, const std::vector& sourceCoords, bool isSourceQuad) { std::vector nodes(4); nodes[0]=new Node(quadrangle[0],quadrangle[1]); nodes[1]=new Node(quadrangle[SPACEDIM],quadrangle[SPACEDIM+1]); nodes[2]=new Node(quadrangle[2*SPACEDIM],quadrangle[2*SPACEDIM+1]); nodes[3]=new Node(quadrangle[3*SPACEDIM],quadrangle[3*SPACEDIM+1]); int nbOfSourceNodes=sourceCoords.size()/SPACEDIM; std::vector nodes2(nbOfSourceNodes); for(int i=0;iintersectWith(*p2); delete p1; delete p2; return ret; } template class InterpType> QuadraticPolygon *Geometric2DIntersector::buildPolygonFrom(const std::vector& coords, NormalizedCellType type) { int nbNodes=coords.size()/SPACEDIM; std::vector nodes(nbNodes); for(int i=0;i class InterpType> QuadraticPolygon *Geometric2DIntersector::buildPolygonAFrom(ConnType cell, int nbOfPoints, NormalizedCellType type) { const ConnType *startOfCellNodeConn=PlanarIntersector::_connectT+OTT::conn2C(PlanarIntersector::_connIndexT[OTT::ind2C(cell)]); std::vector nodes(nbOfPoints); for(int i=0;i::_coordsT+OTT::coo2C(startOfCellNodeConn[i])*SPACEDIM); if(CellModel::getCellModel(type).isQuadratic()) return QuadraticPolygon::buildLinearPolygon(nodes); else return QuadraticPolygon::buildArcCirclePolygon(nodes); } template class InterpType> QuadraticPolygon *Geometric2DIntersector::buildPolygonBFrom(ConnType cell, int nbOfPoints, NormalizedCellType type) { const ConnType *startOfCellNodeConn=PlanarIntersector::_connectS+OTT::conn2C(PlanarIntersector::_connIndexS[OTT::ind2C(cell)]); std::vector nodes(nbOfPoints); for(int i=0;i::_coordsS+OTT::coo2C(startOfCellNodeConn[i])*SPACEDIM); if(type!=NORM_TRI6 && type!=NORM_QUAD8) return QuadraticPolygon::buildLinearPolygon(nodes); else return QuadraticPolygon::buildArcCirclePolygon(nodes); } } #endif