// Copyright (C) 2007-2016 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 __INTEGRALUNIFORMINTERSECTOR_TXX__ #define __INTEGRALUNIFORMINTERSECTOR_TXX__ #include "IntegralUniformIntersector.hxx" #include "VolSurfUser.txx" namespace INTERP_KERNEL { template IntegralUniformIntersector::IntegralUniformIntersector(const MyMeshType& mesh, bool isAbs):_mesh(mesh),_from_to(false),_is_abs(isAbs) { } template void IntegralUniformIntersector::putValueIn(ConnType iInCMode, double val1, MyMatrix& res) const { static const NumberingPolicy numPol=MyMeshType::My_numPol; double val=performNormalization(val1); if(_from_to) { typename MyMatrix::value_type& resRow=res[0]; typename MyMatrix::value_type::const_iterator iterRes=resRow.find(OTT::indFC(iInCMode)); if(iterRes==resRow.end()) resRow.insert(std::make_pair(OTT::indFC(iInCMode),val)); else { double val2=(*iterRes).second+val; resRow.erase(OTT::indFC(iInCMode)); resRow.insert(std::make_pair(OTT::indFC(iInCMode),val2)); } } else { typename MyMatrix::value_type& resRow=res[iInCMode]; typename MyMatrix::value_type::const_iterator iterRes=resRow.find(OTT::indFC(0)); if(iterRes==resRow.end()) resRow.insert(std::make_pair(OTT::indFC(0),val)); else { double val2=(*iterRes).second+val; resRow.erase(OTT::indFC(0)); resRow.insert(std::make_pair(OTT::indFC(0),val2)); } } } template IntegralUniformIntersectorP0::IntegralUniformIntersectorP0(const MyMeshType& mesh, bool isAbs):IntegralUniformIntersector(mesh,isAbs) { } template int IntegralUniformIntersectorP0::getNumberOfRowsOfResMatrix() const { if(IntegralUniformIntersector::_from_to) return 1; else return IntegralUniformIntersector::_mesh.getNumberOfElements(); } template int IntegralUniformIntersectorP0::getNumberOfColsOfResMatrix() const { if(IntegralUniformIntersector::_from_to) return IntegralUniformIntersector::_mesh.getNumberOfElements(); else return 1; } template void IntegralUniformIntersectorP0::intersectCells(ConnType targetCell, const std::vector& srcCells, MyMatrix& res) { static const NumberingPolicy numPol=MyMeshType::My_numPol; res.resize(getNumberOfRowsOfResMatrix()); unsigned long nbelem=IntegralUniformIntersector::_mesh.getNumberOfElements(); const ConnType *connIndx=IntegralUniformIntersector::_mesh.getConnectivityIndexPtr(); const ConnType *conn=IntegralUniformIntersector::_mesh.getConnectivityPtr(); const double *coords=IntegralUniformIntersector::_mesh.getCoordinatesPtr(); for(unsigned long i=0;i::_mesh.getTypeOfElement(OTT::indFC(i)); double val=computeVolSurfOfCell(t,conn+OTT::ind2C(connIndx[i]),connIndx[i+1]-connIndx[i],coords); IntegralUniformIntersector::putValueIn(i,val,res); } } template IntegralUniformIntersectorP1::IntegralUniformIntersectorP1(const MyMeshType& mesh, bool isAbs):IntegralUniformIntersector(mesh,isAbs) { } template int IntegralUniformIntersectorP1::getNumberOfRowsOfResMatrix() const { if(IntegralUniformIntersector::_from_to) return 1; else return IntegralUniformIntersector::_mesh.getNumberOfNodes(); } template int IntegralUniformIntersectorP1::getNumberOfColsOfResMatrix() const { if(IntegralUniformIntersector::_from_to) return IntegralUniformIntersector::_mesh.getNumberOfNodes(); else return 1; } template void IntegralUniformIntersectorP1::intersectCells(ConnType targetCell, const std::vector& srcCells, MyMatrix& res) { static const NumberingPolicy numPol=MyMeshType::My_numPol; res.resize(getNumberOfRowsOfResMatrix()); unsigned long nbelem=IntegralUniformIntersector::_mesh.getNumberOfElements(); const ConnType *connIndx=IntegralUniformIntersector::_mesh.getConnectivityIndexPtr(); const ConnType *conn=IntegralUniformIntersector::_mesh.getConnectivityPtr(); const double *coords=IntegralUniformIntersector::_mesh.getCoordinatesPtr(); for(unsigned long i=0;i::_mesh.getTypeOfElement(OTT::indFC(i)); int lgth=connIndx[i+1]-connIndx[i]; const ConnType *locConn=conn+OTT::ind2C(connIndx[i]); double val=computeVolSurfOfCell(t,locConn,lgth,coords); if(t==NORM_TRI3) val/=3.; else if(t==NORM_TETRA4) val/=4.; else throw INTERP_KERNEL::Exception("Invalid cell type detected : must be TRI3 or TETRA4 ! "); for(int j=0;j::putValueIn(OTT::coo2C(locConn[j]),val,res); } } } #endif