// Copyright (C) 2007-2014 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 __PLANARINTERSECTORP0P1_TXX__ #define __PLANARINTERSECTORP0P1_TXX__ #include "PlanarIntersectorP0P1.hxx" #include "InterpolationUtils.hxx" #include "CellModel.hxx" namespace INTERP_KERNEL { template PlanarIntersectorP0P1::PlanarIntersectorP0P1(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 PlanarIntersectorP0P1::getNumberOfRowsOfResMatrix() const { return PlanarIntersector::_meshT.getNumberOfNodes(); } template int PlanarIntersectorP0P1::getNumberOfColsOfResMatrix() const { return PlanarIntersector::_meshS.getNumberOfElements(); } /*! * 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 PlanarIntersectorP0P1::intersectCells(ConnType icellT, const std::vector& icellsS, MyMatrix& res) { int nbNodesT=PlanarIntersector::_connIndexT[icellT+1]-PlanarIntersector::_connIndexT[icellT]; double triangle[9]; double quadrangle[12]; std::vector sourceCellCoords; int orientation=1; const ConnType *startOfCellNodeConn=PlanarIntersector::_connectT+OTT::conn2C(PlanarIntersector::_connIndexT[icellT]); for(int nodeIdT=0;nodeIdT::coo2C(startOfCellNodeConn[nodeIdT]); std::copy(PlanarIntersector::_coordsT+curNodeTInCmode*SPACEDIM, PlanarIntersector::_coordsT+curNodeTInCmode*SPACEDIM+SPACEDIM,triangle); typename MyMatrix::value_type& resRow=res[curNodeTInCmode]; for(typename std::vector::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++) { int iS=*iter; PlanarIntersector::getRealSourceCoordinates(OTT::indFC(iS),sourceCellCoords); for(int subTriT=1;subTriT<=nbNodesT-2;subTriT++) { std::copy(PlanarIntersector::_coordsT+OTT::coo2C(startOfCellNodeConn[(nodeIdT+subTriT)%nbNodesT])*SPACEDIM, PlanarIntersector::_coordsT+OTT::coo2C(startOfCellNodeConn[(nodeIdT+subTriT)%nbNodesT])*SPACEDIM+SPACEDIM, triangle+SPACEDIM); std::copy(PlanarIntersector::_coordsT+OTT::coo2C(startOfCellNodeConn[(nodeIdT+subTriT+1)%nbNodesT])*SPACEDIM, PlanarIntersector::_coordsT+OTT::coo2C(startOfCellNodeConn[(nodeIdT+subTriT+1)%nbNodesT])*SPACEDIM+SPACEDIM, triangle+2*SPACEDIM); fillDualCellOfTri(triangle,quadrangle); std::vector sourceCellCoordsTmp(sourceCellCoords); if(SPACEDIM==3) orientation=PlanarIntersector::projectionThis(&sourceCellCoordsTmp[0],quadrangle,sourceCellCoords.size()/SPACEDIM,4); NormalizedCellType tS=PlanarIntersector::_meshS.getTypeOfElement(OTT::indFC(iS)); double surf=orientation*intersectGeometryWithQuadrangle(quadrangle,sourceCellCoordsTmp,CellModel::GetCellModel(tS).isQuadratic()); surf=PlanarIntersector::getValueRegardingOption(surf); if(surf!=0.) { typename MyMatrix::value_type::const_iterator iterRes=resRow.find(OTT::indFC(iS)); if(iterRes==resRow.end()) resRow.insert(std::make_pair(OTT::indFC(iS),surf)); else { double val=(*iterRes).second+surf; resRow.erase(OTT::indFC(iS)); resRow.insert(std::make_pair(OTT::indFC(iS),val)); } } } } } } } #endif