Salome HOME
Attempt of Management of profiles in spliter
[tools/medcoupling.git] / src / INTERP_KERNEL / PolyhedronIntersectorP0P1.txx
index 75de8e4c479a52e7ef28bd8d924c5e2f8b4bc621..eac117c246d629cfbdd749aa1f683658355eb05a 100644 (file)
@@ -1,21 +1,22 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2019  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+// Author : Anthony Geay (CEA/DEN)
 #ifndef __POLYHEDRONINTERSECTORP0P1_TXX__
 #define __POLYHEDRONINTERSECTORP0P1_TXX__
 
@@ -77,9 +78,8 @@ namespace INTERP_KERNEL
   void PolyhedronIntersectorP0P1<MyMeshType,MyMatrix>::intersectCells(ConnType targetCell, const std::vector<ConnType>& srcCells, MyMatrix& res)
   {
     SplitterTetra<MyMeshType>* subTetras[24];
-    int nbOfNodesT=Intersector3D<MyMeshType,MyMatrix>::_target_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(targetCell));
     releaseArrays();
-    _split.splitTargetCell(targetCell,nbOfNodesT,_tetra);
+    _split.splitTargetCell2(targetCell,_tetra);
     for(typename std::vector<ConnType>::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++)
       {
         for(typename std::vector<SplitterTetra<MyMeshType>*>::iterator iter = _tetra.begin(); iter != _tetra.end(); ++iter)
@@ -91,7 +91,13 @@ namespace INTERP_KERNEL
                 double volume = tmp->intersectSourceCell(*iterCellS);
                 if(volume!=0.)
                   {
-                    typename MyMatrix::value_type& resRow=res[tmp->getId(0)];
+                    int targetNodeId(tmp->getId(0));
+                    if(targetNodeId<0)
+                      {
+                        std::ostringstream oss; oss << "PolyhedronIntersectorP0P1::intersectCells : On target cell #" <<  targetCell << " the splitting into tetra4 leads to the creation of an additional point that interacts with source cell Id #" << *iterCellS << " !";
+                        throw INTERP_KERNEL::Exception(oss.str().c_str());
+                      }
+                    typename MyMatrix::value_type& resRow=res[targetNodeId];
                     typename MyMatrix::value_type::const_iterator iterRes=resRow.find(OTT<ConnType,numPol>::indFC(*iterCellS));
                     if(iterRes==resRow.end())
                       resRow.insert(std::make_pair(OTT<ConnType,numPol>::indFC(*iterCellS),volume));