// Copyright (C) 2007-2015 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 __PLANARINTERSECTORP1P1PL_TXX__ #define __PLANARINTERSECTORP1P1PL_TXX__ #include "PlanarIntersectorP1P1PL.hxx" #include "PlanarIntersector.txx" #include "CellModel.hxx" #include "PointLocatorAlgos.txx" #include "MeshUtils.hxx" namespace INTERP_KERNEL { template PlanarIntersectorP1P1PL::PlanarIntersectorP1P1PL(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double md3DSurf, double minDot3DSurf, double medianPlane, double precision, int orientation): PlanarIntersector(meshT,meshS,dimCaracteristic,precision,md3DSurf,minDot3DSurf,medianPlane,true,orientation,0) { } template void PlanarIntersectorP1P1PL::intersectCells(ConnType icellT, const std::vector& icellsS, MyMatrix& res) { std::vector CoordsT; PlanarIntersector::getRealTargetCoordinates(OTT::indFC(icellT),CoordsT); int nbOfNodesT=CoordsT.size()/SPACEDIM; for(typename std::vector::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++) { NormalizedCellType tS=PlanarIntersector::_meshS.getTypeOfElement(OTT::indFC(*iter)); if(tS!=NORM_TRI3) throw INTERP_KERNEL::Exception("Invalid source cell detected for meshdim==2. Only TRI3 supported !"); std::vector CoordsS; PlanarIntersector::getRealSourceCoordinates(OTT::indFC(*iter),CoordsS); std::vector CoordsTTmp(CoordsT); if(SPACEDIM==3) PlanarIntersector::projectionThis(&CoordsS[0],&CoordsTTmp[0],CoordsS.size()/SPACEDIM,nbOfNodesT); const ConnType *startOfCellNodeConnT=PlanarIntersector::_connectT+OTT::conn2C(PlanarIntersector::_connIndexT[icellT]); for(int nodeIdT=0;nodeIdT::ind2C(startOfCellNodeConnT[nodeIdT])]; if( PointLocatorAlgos::isElementContainsPointAlg2D(&CoordsTTmp[nodeIdT*SPACEDIM],&CoordsS[0],3,PlanarIntersector::_precision) ) { double resLoc[3]; barycentric_coords(&CoordsS[0],&CoordsTTmp[nodeIdT*SPACEDIM],resLoc); const ConnType *startOfCellNodeConnS=PlanarIntersector::_connectS+OTT::conn2C(PlanarIntersector::_connIndexS[*iter]); for(int nodeIdS=0;nodeIdS<3;nodeIdS++) { if(fabs(resLoc[nodeIdS])>PlanarIntersector::_precision) { ConnType curNodeSInCmode=OTT::coo2C(startOfCellNodeConnS[nodeIdS]); typename MyMatrix::value_type::const_iterator iterRes=resRow.find(OTT::indFC(curNodeSInCmode)); if(iterRes==resRow.end()) resRow.insert(std::make_pair(OTT::indFC(curNodeSInCmode),resLoc[nodeIdS])); else { double val=(*iterRes).second+resLoc[nodeIdS]; resRow.erase(OTT::indFC(curNodeSInCmode)); resRow.insert(std::make_pair(OTT::indFC(curNodeSInCmode),val)); } } } } } } } template int PlanarIntersectorP1P1PL::getNumberOfRowsOfResMatrix() const { return PlanarIntersector::_meshT.getNumberOfNodes(); } template int PlanarIntersectorP1P1PL::getNumberOfColsOfResMatrix() const { return PlanarIntersector::_meshS.getNumberOfNodes(); } } #endif