1 // Copyright (C) 2009-2014 OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // File : IntersectorCU2D.txx
20 // Created : Thu Dec 17 14:17:49 2009
21 // Author : Edward AGAPOV (eap)
23 #ifndef __IntersectorCU2D_TXX__
24 #define __IntersectorCU2D_TXX__
26 #include "IntersectorCU2D.hxx"
27 #include "IntersectorCU.txx"
29 #define IntersectorCU2D_TEMPLATE template<class MyCMeshType, class MyUMeshType, class MyMatrix>
30 #define INTERSECTOR_CU2D IntersectorCU2D<MyCMeshType, MyUMeshType, MyMatrix >
31 #define INTER_CU IntersectorCU<MyCMeshType,MyUMeshType,MyMatrix,IntersectorCU2D<MyCMeshType,MyUMeshType,MyMatrix> >
34 namespace INTERP_KERNEL
36 IntersectorCU2D_TEMPLATE
37 INTERSECTOR_CU2D::IntersectorCU2D(const MyCMeshType& meshS,
38 const MyUMeshType& meshT):
39 IntersectorCU<MyCMeshType, MyUMeshType, MyMatrix, IntersectorCU2D<MyCMeshType,MyUMeshType,MyMatrix> >( meshS, meshT ),
40 _intersector(meshT, meshT, 0,0,0,0,0,0 )
42 if ( MyCMeshType::MY_SPACEDIM != 2 || MyCMeshType::MY_MESHDIM != 2 ||
43 MyUMeshType::MY_SPACEDIM != 2 || MyUMeshType::MY_MESHDIM != 2 )
44 throw Exception("IntersectorCU2D(): Invalid mesh dimension, it must be 2");
48 //================================================================================
50 * \brief Calculate area of intersection of an unstructured cell and a cartesian one.
51 * The cartesian cell is given by its [i,j] indices
53 //================================================================================
55 IntersectorCU2D_TEMPLATE
56 double INTERSECTOR_CU2D::intersectGeometry(UConnType icellT,
57 const std::vector<CConnType>& icellS)
59 std::vector<double> uCoords;
60 this->getUCoordinates( icellT, uCoords );
62 NormalizedCellType tT = INTER_CU::_meshU.getTypeOfElement( _TMIU(icellT));
63 bool is_tgt_quad = CellModel::GetCellModel(tT).isQuadratic();
65 double quad[8] = { INTER_CU::_coordsC[0][icellS[0]], INTER_CU::_coordsC[1][icellS[1]],
66 INTER_CU::_coordsC[0][icellS[0]+1], INTER_CU::_coordsC[1][icellS[1]],
67 INTER_CU::_coordsC[0][icellS[0]+1], INTER_CU::_coordsC[1][icellS[1]+1],
68 INTER_CU::_coordsC[0][icellS[0]], INTER_CU::_coordsC[1][icellS[1]+1] };
70 double surf = _intersector.intersectGeometryWithQuadrangle( quad,