// Copyright (C) 2007-2013 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 // // Author : Anthony Geay (CEA/DEN) #ifndef __PLANARINTERSECTORP1P0_TXX__ #define __PLANARINTERSECTORP1P0_TXX__ #include "PlanarIntersectorP1P0.hxx" #include "InterpolationUtils.hxx" namespace INTERP_KERNEL { template PlanarIntersectorP1P0::PlanarIntersectorP1P0(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double md3DSurf, double minDot3DSurf, double medianPlane, bool doRotate, int orientation, int printLevel): PlanarIntersector(meshT,meshS,dimCaracteristic,precision,md3DSurf,minDot3DSurf,medianPlane,doRotate,orientation,printLevel) { } template int PlanarIntersectorP1P0::getNumberOfRowsOfResMatrix() const { return PlanarIntersector::_meshT.getNumberOfElements(); } template int PlanarIntersectorP1P0::getNumberOfColsOfResMatrix() const { return PlanarIntersector::_meshS.getNumberOfNodes(); } /*! * This methods split on the fly, into triangles in order to compute dual mesh of target cell (with icellT id in target mesh in C mode). */ template void PlanarIntersectorP1P0::intersectCells(ConnType icellT, const std::vector& icellsS, MyMatrix& res) { double triangle[9]; double quadrangle[12]; std::vector targetCellCoords; int orientation=1; PlanarIntersector::getRealTargetCoordinates(OTT::indFC(icellT),targetCellCoords); NormalizedCellType tT=PlanarIntersector::_meshT.getTypeOfElement(OTT::indFC(icellT)); bool isTargetQuad=CellModel::GetCellModel(tT).isQuadratic(); typename MyMatrix::value_type& resRow=res[icellT]; for(typename std::vector::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++) { int iS=*iter; int 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++) { std::copy(PlanarIntersector::_coordsS+OTT::coo2C(startOfCellNodeConn[(nodeIdS+subTriS)%nbNodesS])*SPACEDIM, PlanarIntersector::_coordsS+OTT::coo2C(startOfCellNodeConn[(nodeIdS+subTriS)%nbNodesS])*SPACEDIM+SPACEDIM, triangle+SPACEDIM); std::copy(PlanarIntersector::_coordsS+OTT::coo2C(startOfCellNodeConn[(nodeIdS+subTriS+1)%nbNodesS])*SPACEDIM, PlanarIntersector::_coordsS+OTT::coo2C(startOfCellNodeConn[(nodeIdS+subTriS+1)%nbNodesS])*SPACEDIM+SPACEDIM, triangle+2*SPACEDIM); fillDualCellOfTri(triangle,quadrangle); std::vector targetCellCoordsTmp(targetCellCoords); if(SPACEDIM==3) orientation=PlanarIntersector::projectionThis(&targetCellCoordsTmp[0],quadrangle,targetCellCoords.size()/SPACEDIM,4); double surf=orientation*intersectGeometryWithQuadrangle(quadrangle,targetCellCoordsTmp,isTargetQuad); surf=PlanarIntersector::getValueRegardingOption(surf); if(surf!=0.) { typename MyMatrix::value_type::const_iterator iterRes=resRow.find(OTT::indFC(curNodeSInCmode)); if(iterRes==resRow.end()) resRow.insert(std::make_pair(OTT::indFC(curNodeSInCmode),surf)); else { double val=(*iterRes).second+surf; resRow.erase(OTT::indFC(curNodeSInCmode)); resRow.insert(std::make_pair(OTT::indFC(curNodeSInCmode),val)); } } } } } } } #endif