Salome HOME
Voronoi 1D + getCellsContainingPoint is now a virtual abstract method
[tools/medcoupling.git] / src / MEDCoupling / MEDCoupling1GTUMesh.cxx
index 3a41929d7eca597393abdfcbe49966baf771288b..7dda1671a544aeb7b8aa1848d581350bb3f5ae01 100644 (file)
@@ -329,10 +329,19 @@ MEDCouplingFieldDouble *MEDCoupling1GTUMesh::getMeasureFieldOnNode(bool isAbs) c
  */
 int MEDCoupling1GTUMesh::getCellContainingPoint(const double *pos, double eps) const
 {
-  MCAuto<MEDCouplingUMesh> m=buildUnstructured();
+  MCAuto<MEDCouplingUMesh> m(buildUnstructured());
   return m->getCellContainingPoint(pos,eps);
 }
 
+/*!
+ * to improve perf !
+ */
+void MEDCoupling1GTUMesh::getCellsContainingPoint(const double *pos, double eps, std::vector<int>& elts) const
+{
+  MCAuto<MEDCouplingUMesh> m(buildUnstructured());
+  return m->getCellsContainingPoint(pos,eps,elts);
+}
+
 MEDCouplingFieldDouble *MEDCoupling1GTUMesh::buildOrthogonalField() const
 {
   MCAuto<MEDCouplingUMesh> m=buildUnstructured();
@@ -2357,7 +2366,7 @@ void MEDCoupling1DGTUMesh::checkConsistencyOfConnectivity() const
       if(c1->getInfoOnComponent(0)!="")
         throw INTERP_KERNEL::Exception("Nodal connectivity index array is expected to have no info on its single component !");
       int f=c1->front(),ll=c1->back();
-      if(f<0 || f>=sz2)
+      if(f<0 || (sz2>0 && f>=sz2))
         {
           std::ostringstream oss; oss << "Nodal connectivity index array first value (" << f << ") is expected to be exactly in [0," << sz2 << ") !";
           throw INTERP_KERNEL::Exception(oss.str().c_str());