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 : IntersectorCU1D.txx
20 // Created : Thu Dec 17 14:17:49 2009
21 // Author : Edward AGAPOV (eap)
23 #ifndef __IntersectorCU1D_TXX__
24 #define __IntersectorCU1D_TXX__
26 #include "IntersectorCU1D.hxx"
27 #include "IntersectorCU.txx"
29 #define IntersectorCU1D_TEMPLATE template<class MyCMeshType, class MyUMeshType, class MyMatrix>
30 #define INTERSECTOR_CU1D IntersectorCU1D<MyCMeshType,MyUMeshType,MyMatrix >
31 #define _INTER_CU IntersectorCU <MyCMeshType,MyUMeshType,MyMatrix,IntersectorCU1D<MyCMeshType,MyUMeshType,MyMatrix> >
33 namespace INTERP_KERNEL
35 //================================================================================
37 * \brief intersector of the unstructured mesh and the cartesian mesh in 1D
39 //================================================================================
41 IntersectorCU1D_TEMPLATE
42 INTERSECTOR_CU1D::IntersectorCU1D(const MyCMeshType& meshS,
43 const MyUMeshType& meshT):
44 _INTER_CU( meshS, meshT )
46 if ( MyCMeshType::MY_SPACEDIM != 1 || MyCMeshType::MY_MESHDIM != 1 ||
47 MyUMeshType::MY_SPACEDIM != 1 || MyUMeshType::MY_MESHDIM != 1 )
48 throw Exception("IntersectorCU1D(): Invalid mesh dimension, it must be 1");
51 //================================================================================
55 //================================================================================
57 IntersectorCU1D_TEMPLATE
58 INTERSECTOR_CU1D::~IntersectorCU1D()
62 //================================================================================
64 * \brief Calculate length of intersection of an unstructured cell and a cartesian one.
65 * The cartesian cell is given by its [i,j,k] indices
67 //================================================================================
69 IntersectorCU1D_TEMPLATE
70 double INTERSECTOR_CU1D::intersectGeometry(UConnType icellT,
71 const std::vector<CConnType>& icellS)
73 std::vector<double> coordsU;
74 _INTER_CU::getUCoordinates(icellT, coordsU);
76 const double* coordsC = & _INTER_CU::_coordsC[0][ _FMIC(icellS[0]) ];
78 double res = std::min( coordsU[1], coordsC[1] ) - std::max( coordsU[0], coordsC[0] );