Salome HOME
MERGE stage 1: keep doc/dev and src/MEDCalc/doc
[tools/medcoupling.git] / src / MEDCoupling / MEDCouplingPointSet.cxx
index f216276c6c66bf1a23f73bccf30944f76fc775de..4793b7993ff5adfc236eee4c9f2298347a76d2d2 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2015  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.
+// 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
@@ -20,8 +20,8 @@
 
 #include "MEDCouplingPointSet.hxx"
 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MEDCoupling1GTUMesh.hxx"
 #include "MEDCouplingUMesh.hxx"
-#include "MEDCouplingUMeshDesc.hxx"
 #include "MEDCouplingMemArray.hxx"
 #include "PlanarIntersector.txx"
 #include "InterpKernelGeo2DQuadraticPolygon.hxx"
@@ -75,12 +75,16 @@ void MEDCouplingPointSet::updateTime() const
     }
 }
 
-std::size_t MEDCouplingPointSet::getHeapMemorySize() const
+std::size_t MEDCouplingPointSet::getHeapMemorySizeWithoutChildren() const
 {
-  std::size_t ret=0;
-  if(_coords)
-    ret+=_coords->getHeapMemorySize();
-  return MEDCouplingMesh::getHeapMemorySize()+ret;
+  return MEDCouplingMesh::getHeapMemorySizeWithoutChildren();
+}
+
+std::vector<const BigMemoryObject *> MEDCouplingPointSet::getDirectChildrenWithNull() const
+{
+  std::vector<const BigMemoryObject *> ret;
+  ret.push_back(_coords);
+  return ret;
 }
 
 void MEDCouplingPointSet::setCoords(const DataArrayDouble *coords)
@@ -117,17 +121,17 @@ DataArrayDouble *MEDCouplingPointSet::getCoordinatesAndOwner() const
  *
  *  \param [in] other - the mesh to copy string attributes from.
  */
-void MEDCouplingPointSet::copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception)
+void MEDCouplingPointSet::copyTinyStringsFrom(const MEDCouplingMesh *other)
 {
+  MEDCouplingMesh::copyTinyStringsFrom(other);
   const MEDCouplingPointSet *otherC=dynamic_cast<const MEDCouplingPointSet *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("MEDCouplingPointSet::copyTinyStringsFrom : meshes have not same type !");
-  MEDCouplingMesh::copyTinyStringsFrom(other);
   if(_coords && otherC->_coords)
     _coords->copyStringInfoFrom(*otherC->_coords);
 }
 
-bool MEDCouplingPointSet::isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const throw(INTERP_KERNEL::Exception)
+bool MEDCouplingPointSet::isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const
 {
   if(!other)
     throw INTERP_KERNEL::Exception("MEDCouplingPointSet::isEqualIfNotWhy : null mesh instance in input !");
@@ -218,10 +222,12 @@ bool MEDCouplingPointSet::areCoordsEqualWithoutConsideringStr(const MEDCouplingP
  *  \throw If the coordinates array is not set.
  *  \throw If \a nodeId is not a valid index for the coordinates array.
  *
+ *  \if ENABLE_EXAMPLES
  *  \ref cpp_mcpointset_getcoordinatesofnode "Here is a C++ example".<br>
  *  \ref  py_mcpointset_getcoordinatesofnode "Here is a Python example".
+ *  \endif
  */
-void MEDCouplingPointSet::getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const throw(INTERP_KERNEL::Exception)
+void MEDCouplingPointSet::getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const
 {
   if(!_coords)
     throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getCoordinatesOfNode : no coordinates array set !");
@@ -250,7 +256,7 @@ void MEDCouplingPointSet::getCoordinatesOfNode(int nodeId, std::vector<double>&
  *  \param [out] areNodesMerged - is set to \a true if any coincident nodes found.
  *  \param [out] newNbOfNodes - returns number of unique nodes.
  *  \return DataArrayInt * - the permutation array in "Old to New" mode. For more 
- *          info on "Old to New" mode see \ref MEDCouplingArrayRenumbering. The caller
+ *          info on "Old to New" mode see \ref numbering. The caller
  *          is to delete this array using decrRef() as it is no more needed.
  *  \throw If the coordinates array is not set.
  */
@@ -268,8 +274,7 @@ DataArrayInt *MEDCouplingPointSet::buildPermArrayForMergeNode(double precision,
 
 /*!
  * Finds nodes coincident within \a prec tolerance.
- * Ids of coincident nodes are stored in output arrays.
- * A pair of arrays (\a comm, \a commIndex) is called "Surjective Format 2".
+ * Ids of coincident nodes are stored in output arrays in the \ref numbering-indirect format.
  *  \param [in] prec - minimal absolute distance (using infinite norm) between two nodes at which they are
  *              considered not coincident.
  *  \param [in] limitNodeId - limit node id. If all nodes within a group of coincident
@@ -280,7 +285,7 @@ DataArrayInt *MEDCouplingPointSet::buildPermArrayForMergeNode(double precision,
  *               \a comm->getNumberOfTuples() == \a commIndex->back(). The caller
  *               is to delete this array using decrRef() as it is no more needed.
  *  \param [out] commIndex - the array dividing all ids stored in \a comm into
- *               groups of (ids of) coincident nodes. Its every value is a tuple
+ *               groups of (ids of) coincident nodes (\ref numbering-indirect). Its every value is a tuple
  *               index where a next group of nodes begins. For example the second
  *               group of nodes in \a comm is described by following range of indices:
  *               [ \a commIndex[1], \a commIndex[2] ). \a commIndex->getNumberOfTuples()-1
@@ -288,8 +293,10 @@ DataArrayInt *MEDCouplingPointSet::buildPermArrayForMergeNode(double precision,
  *               is to delete this array using decrRef() as it is no more needed.
  *  \throw If the coordinates array is not set.
  *
+ *  \if ENABLE_EXAMPLES
  *  \ref cpp_mcpointset_findcommonnodes "Here is a C++ example".<br>
  *  \ref  py_mcpointset_findcommonnodes "Here is a Python example".
+ *  \endif
  */
 void MEDCouplingPointSet::findCommonNodes(double prec, int limitNodeId, DataArrayInt *&comm, DataArrayInt *&commIndex) const
 {
@@ -310,10 +317,12 @@ void MEDCouplingPointSet::findCommonNodes(double prec, int limitNodeId, DataArra
  *          array using decrRef() as it is no more needed.
  *  \throw If the coordinates array is not set.
  *
+ *  \if ENABLE_EXAMPLES
  *  \ref cpp_mcpointset_getnodeidsnearpoint "Here is a C++ example".<br>
  *  \ref  py_mcpointset_getnodeidsnearpoint "Here is a Python example".
+ *  \endif
  */
-DataArrayInt *MEDCouplingPointSet::getNodeIdsNearPoint(const double *pos, double eps) const throw(INTERP_KERNEL::Exception)
+DataArrayInt *MEDCouplingPointSet::getNodeIdsNearPoint(const double *pos, double eps) const
 {
   DataArrayInt *c=0,*cI=0;
   getNodeIdsNearPoints(pos,1,eps,c,cI);
@@ -330,11 +339,11 @@ DataArrayInt *MEDCouplingPointSet::getNodeIdsNearPoint(const double *pos, double
  *         parameter. 
  *  \param [in] eps - the lowest distance between (using infinite norm) a point and a node at which the node is
  *         not returned by this method.
- *  \param [out] c - array returning ids of nodes located closer than \a eps to the
+ *  \param [out] c - array (\ref numbering-indirect) returning ids of nodes located closer than \a eps to the
  *         given points. The caller
  *         is to delete this array using decrRef() as it is no more needed.
  *  \param [out] cI - for each i-th given point, the array specifies tuples of \a c
- *         holding ids of nodes close to the i-th point. <br>The i-th value of \a cI is an 
+ *         holding ids of nodes close to the i-th point (\ref numbering-indirect). <br>The i-th value of \a cI is an
  *         index of tuple of \a c holding id of a first (if any) node close to the
  *         i-th given point. Difference between the i-th and (i+1)-th value of \a cI
  *         (i.e. \a cI[ i+1 ] - \a cI[ i ]) defines number of nodes close to the i-th
@@ -343,10 +352,12 @@ DataArrayInt *MEDCouplingPointSet::getNodeIdsNearPoint(const double *pos, double
  *         The caller is to delete this array using decrRef() as it is no more needed.
  *  \throw If the coordinates array is not set.
  *
+ *  \if ENABLE_EXAMPLES
  *  \ref cpp_mcpointset_getnodeidsnearpoints "Here is a C++ example".<br>
  *  \ref  py_mcpointset_getnodeidsnearpoints "Here is a Python example".
+ *  \endif
  */
-void MEDCouplingPointSet::getNodeIdsNearPoints(const double *pos, int nbOfPoints, double eps, DataArrayInt *& c, DataArrayInt *& cI) const throw(INTERP_KERNEL::Exception)
+void MEDCouplingPointSet::getNodeIdsNearPoints(const double *pos, int nbOfPoints, double eps, DataArrayInt *& c, DataArrayInt *& cI) const
 {
   if(!_coords)
     throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getNodeIdsNearPoint : no coordiantes set !");
@@ -357,8 +368,8 @@ void MEDCouplingPointSet::getNodeIdsNearPoints(const double *pos, int nbOfPoints
 }
 
 /*!
- * @param comm in param in the same format than one returned by findCommonNodes method.
- * @param commI in param in the same format than one returned by findCommonNodes method.
+ * @param comm in param in the same format than one returned by findCommonNodes method (\ref numbering-indirect).
+ * @param commI in param in the same format than one returned by findCommonNodes method (\ref numbering-indirect).
  * @return the old to new correspondance array.
  */
 DataArrayInt *MEDCouplingPointSet::buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex,
@@ -376,13 +387,15 @@ DataArrayInt *MEDCouplingPointSet::buildNewNumberingFromCommonNodesFormat(const
  * array is modified accordingly.
  *  \param [in] newNodeNumbers - a permutation array, of length \a
  *         this->getNumberOfNodes(), in "Old to New" mode. 
- *         See \ref MEDCouplingArrayRenumbering for more info on renumbering modes.
+ *         See \ref numbering for more info on renumbering modes.
  *  \param [in] newNbOfNodes - number of nodes remaining after renumbering.
  *  \throw If the coordinates array is not set.
  *  \throw If the nodal connectivity of cells is not defined.
  *
+ *  \if ENABLE_EXAMPLES
  *  \ref cpp_mcumesh_renumberNodes "Here is a C++ example".<br>
  *  \ref  py_mcumesh_renumberNodes "Here is a Python example".
+ *  \endif
  */
 void MEDCouplingPointSet::renumberNodes(const int *newNodeNumbers, int newNbOfNodes)
 {
@@ -401,14 +414,16 @@ void MEDCouplingPointSet::renumberNodes(const int *newNodeNumbers, int newNbOfNo
  * of merged nodes (whose new ids coincide) is changed to be at their barycenter.
  *  \param [in] newNodeNumbers - a permutation array, of length \a
  *         this->getNumberOfNodes(), in "Old to New" mode. 
- *         See \ref MEDCouplingArrayRenumbering for more info on renumbering modes.
+ *         See \ref numbering for more info on renumbering modes.
  *  \param [in] newNbOfNodes - number of nodes remaining after renumbering, which is
  *         actually one more than the maximal id in \a newNodeNumbers.
  *  \throw If the coordinates array is not set.
  *  \throw If the nodal connectivity of cells is not defined.
  *
+ *  \if ENABLE_EXAMPLES
  *  \ref cpp_mcumesh_renumberNodes "Here is a C++ example".<br>
  *  \ref  py_mcumesh_renumberNodes "Here is a Python example".
+ *  \endif
  */
 void MEDCouplingPointSet::renumberNodes2(const int *newNodeNumbers, int newNbOfNodes)
 {
@@ -444,10 +459,12 @@ void MEDCouplingPointSet::renumberNodes2(const int *newNodeNumbers, int newNbOfN
  *         pre-allocated by the caller.
  *  \throw If the coordinates array is not set.
  *
+ *  \if ENABLE_EXAMPLES
  *  \ref cpp_mcpointset_getBoundingBox "Here is a C++ example".<br>
  *  \ref  py_mcpointset_getBoundingBox "Here is a Python example".
+ *  \endif
  */
-void MEDCouplingPointSet::getBoundingBox(double *bbox) const throw(INTERP_KERNEL::Exception)
+void MEDCouplingPointSet::getBoundingBox(double *bbox) const
 {
   if(!_coords)
     throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getBoundingBox : Coordinates not set !");
@@ -466,10 +483,12 @@ void MEDCouplingPointSet::zipCoords()
   traducer->decrRef();
 }
 
+/*! \cond HIDDEN_ITEMS */
 struct MEDCouplingCompAbs
 {
   bool operator()(double x, double y) { return std::abs(x)<std::abs(y);}
 };
+/*! \endcond */
 
 /*!
  * Returns the carateristic dimension of \a this point set, that is a maximal
@@ -493,7 +512,7 @@ double MEDCouplingPointSet::getCaracteristicDimension() const
  * \param [in] eps absolute epsilon. under that value of delta between max and min no scale is performed.
  *
  */
-void MEDCouplingPointSet::recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception)
+void MEDCouplingPointSet::recenterForMaxPrecision(double eps)
 {
   if(!_coords)
     throw INTERP_KERNEL::Exception("MEDCouplingPointSet::recenterForMaxPrecision : Coordinates not set !");
@@ -516,8 +535,10 @@ void MEDCouplingPointSet::recenterForMaxPrecision(double eps) throw(INTERP_KERNE
  *  \throw If \a vector == NULL && \a this->getSpaceDimension() == 3.
  *  \throw If Magnitude of \a vector is zero.
  *
+ *  \if ENABLE_EXAMPLES
  *  \ref cpp_mcpointset_rotate "Here is a C++ example".<br>
  *  \ref  py_mcpointset_rotate "Here is a Python example".
+ *  \endif
  */
 void MEDCouplingPointSet::rotate(const double *center, const double *vector, double angle)
 {
@@ -539,8 +560,10 @@ void MEDCouplingPointSet::rotate(const double *center, const double *vector, dou
  *  \throw If the coordinates array is not set.
  *  \throw If \a vector == NULL.
  *
+ *  \if ENABLE_EXAMPLES
  *  \ref cpp_mcpointset_translate "Here is a C++ example".<br>
  *  \ref  py_mcpointset_translate "Here is a Python example".
+ *  \endif
  */
 void MEDCouplingPointSet::translate(const double *vector)
 {
@@ -567,8 +590,10 @@ void MEDCouplingPointSet::translate(const double *vector)
  *  \throw If the coordinates array is not set.
  *  \throw If \a point == NULL.
  *
+ *  \if ENABLE_EXAMPLES
  *  \ref cpp_mcpointset_scale "Here is a C++ example".<br>
  *  \ref  py_mcpointset_scale "Here is a Python example".
+ *  \endif
  */
 void MEDCouplingPointSet::scale(const double *point, double factor)
 {
@@ -600,7 +625,7 @@ void MEDCouplingPointSet::scale(const double *point, double factor)
  *  \throw If the coordinates array is not set.
  *  \throw If \a newSpaceDim < 1.
  */
-void MEDCouplingPointSet::changeSpaceDimension(int newSpaceDim, double dftValue) throw(INTERP_KERNEL::Exception)
+void MEDCouplingPointSet::changeSpaceDimension(int newSpaceDim, double dftValue)
 {
   if(getCoords()==0)
     throw INTERP_KERNEL::Exception("changeSpaceDimension must be called on an MEDCouplingPointSet instance with coordinates set !");
@@ -625,7 +650,7 @@ void MEDCouplingPointSet::changeSpaceDimension(int newSpaceDim, double dftValue)
  *  \throw If the coordinates array of \a other is not set.
  *  \throw If the coordinates of \a this and \a other do not match.
  */
-void MEDCouplingPointSet::tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception)
+void MEDCouplingPointSet::tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon)
 {
   if(_coords==other._coords)
     return ;
@@ -645,7 +670,7 @@ void MEDCouplingPointSet::tryToShareSameCoords(const MEDCouplingPointSet& other,
  * \param [in] nodeIdsToDuplicateBg begin of node ids (included) to be duplicated in connectivity only
  * \param [in] nodeIdsToDuplicateEnd end of node ids (excluded) to be duplicated in connectivity only
  */
-void MEDCouplingPointSet::duplicateNodesInCoords(const int *nodeIdsToDuplicateBg, const int *nodeIdsToDuplicateEnd) throw(INTERP_KERNEL::Exception)
+void MEDCouplingPointSet::duplicateNodesInCoords(const int *nodeIdsToDuplicateBg, const int *nodeIdsToDuplicateEnd)
 {
   if(!_coords)
     throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : no coords set !");
@@ -669,7 +694,7 @@ void MEDCouplingPointSet::duplicateNodesInCoords(const int *nodeIdsToDuplicateBg
  *  \throw If the magnitude of \a vec is zero.
  *  \throw If \a this->getSpaceDimension() != 3.
  */
-void MEDCouplingPointSet::findNodesOnPlane(const double *pt, const double *vec, double eps, std::vector<int>& nodes) const throw(INTERP_KERNEL::Exception)
+void MEDCouplingPointSet::findNodesOnPlane(const double *pt, const double *vec, double eps, std::vector<int>& nodes) const
 {
   if(getSpaceDimension()!=3)
     throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnPlane : Invalid spacedim to be applied on this ! Must be equal to 3 !");
@@ -708,7 +733,7 @@ void MEDCouplingPointSet::findNodesOnPlane(const double *pt, const double *vec,
  *  \throw If the magnitude of \a vec is zero.
  *  \throw If ( \a this->getSpaceDimension() != 3 && \a this->getSpaceDimension() != 2 ).
  */
-void MEDCouplingPointSet::findNodesOnLine(const double *pt, const double *vec, double eps, std::vector<int>& nodes) const throw(INTERP_KERNEL::Exception)
+void MEDCouplingPointSet::findNodesOnLine(const double *pt, const double *vec, double eps, std::vector<int>& nodes) const
 {
   int spaceDim=getSpaceDimension();
   if(spaceDim!=2 && spaceDim!=3)
@@ -766,7 +791,7 @@ void MEDCouplingPointSet::findNodesOnLine(const double *pt, const double *vec, d
  *  \throw If both \a m1 and \a m2 are NULL.
  *  \throw If \a m1->getSpaceDimension() != \a m2->getSpaceDimension().
  */
-DataArrayDouble *MEDCouplingPointSet::MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception)
+DataArrayDouble *MEDCouplingPointSet::MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2)
 {
   int spaceDim=m1->getSpaceDimension();
   if(spaceDim!=m2->getSpaceDimension())
@@ -774,7 +799,7 @@ DataArrayDouble *MEDCouplingPointSet::MergeNodesArray(const MEDCouplingPointSet
   return DataArrayDouble::Aggregate(m1->getCoords(),m2->getCoords());
 }
 
-DataArrayDouble *MEDCouplingPointSet::MergeNodesArray(const std::vector<const MEDCouplingPointSet *>& ms) throw(INTERP_KERNEL::Exception)
+DataArrayDouble *MEDCouplingPointSet::MergeNodesArray(const std::vector<const MEDCouplingPointSet *>& ms)
 {
   if(ms.empty())
     throw INTERP_KERNEL::Exception("MEDCouplingPointSet::MergeNodesArray : input array must be NON EMPTY !");
@@ -815,8 +840,10 @@ MEDCouplingPointSet *MEDCouplingPointSet::BuildInstanceFromMeshType(MEDCouplingM
     {
     case UNSTRUCTURED:
       return MEDCouplingUMesh::New();
-    case UNSTRUCTURED_DESC:
-      return MEDCouplingUMeshDesc::New();
+    case SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED:
+      return MEDCoupling1SGTUMesh::New();
+    case SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED:
+      return MEDCoupling1DGTUMesh::New();
     default:
       throw INTERP_KERNEL::Exception("Invalid type of mesh specified");
     }
@@ -903,24 +930,24 @@ void MEDCouplingPointSet::unserialization(const std::vector<double>& tinyInfoD,
   if(tinyInfo[2]>=0 && tinyInfo[1]>=1)
     {
       setCoords(a2);
-      setName(littleStrings[0].c_str());
-      setDescription(littleStrings[1].c_str());
-      a2->setName(littleStrings[2].c_str());
-      setTimeUnit(littleStrings[3].c_str());
+      setName(littleStrings[0]);
+      setDescription(littleStrings[1]);
+      a2->setName(littleStrings[2]);
+      setTimeUnit(littleStrings[3]);
       for(int i=0;i<tinyInfo[1];i++)
-        getCoords()->setInfoOnComponent(i,littleStrings[i+4].c_str());
+        getCoords()->setInfoOnComponent(i,littleStrings[i+4]);
       setTime(tinyInfoD[0],tinyInfo[3],tinyInfo[4]);
     }
   else
     {
-      setName(littleStrings[0].c_str());
-      setDescription(littleStrings[1].c_str());
-      setTimeUnit(littleStrings[2].c_str());
+      setName(littleStrings[0]);
+      setDescription(littleStrings[1]);
+      setTimeUnit(littleStrings[2]);
       setTime(tinyInfoD[0],tinyInfo[3],tinyInfo[4]);
     }
 }
 
-void MEDCouplingPointSet::checkCoherency() const throw(INTERP_KERNEL::Exception)
+void MEDCouplingPointSet::checkCoherency() const
 {
   if(!_coords)
     throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkCoherency : no coordinates set !");
@@ -1050,7 +1077,7 @@ void MEDCouplingPointSet::Rotate3DAlg(const double *center, const double *vect,
  * 
  * \throw If \a srcMesh and \a trgMesh have not the same space dimension.
  */
-DataArrayInt *MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) throw(INTERP_KERNEL::Exception)
+DataArrayInt *MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps)
 {
   if(!srcMesh || !trgMesh)
     throw INTERP_KERNEL::Exception("MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells : the input meshes must be not NULL !");
@@ -1094,13 +1121,28 @@ MEDCouplingMesh *MEDCouplingPointSet::buildPartAndReduceNodes(const int *start,
 }
 
 /*!
- * This method specialized the MEDCouplingMesh::buildPartRange
+ * This method specialized the MEDCouplingMesh::buildPartRange.
+ * This method is equivalent to MEDCouplingMesh::buildPart method except that here the cell ids are specified using slice
+ * \a beginCellIds \a endCellIds and \a stepCellIds.
+ * \b WARNING , there is a big difference compared to MEDCouplingMesh::buildPart method.
+ * If the input range is equal all cells in \a this, \a this is returned !
+ *
+ * \return a new ref to be managed by the caller. Warning this ref can be equal to \a this if input slice is exactly equal to the whole cells in the same order.
  *
  * \sa MEDCouplingUMesh::buildPartOfMySelf2
  */
-MEDCouplingMesh *MEDCouplingPointSet::buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
+MEDCouplingMesh *MEDCouplingPointSet::buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const
 {
-  return buildPartOfMySelf2(beginCellIds,endCellIds,stepCellIds,true);
+  if(beginCellIds==0 && endCellIds==getNumberOfCells() && stepCellIds==1)
+    {
+      MEDCouplingMesh *ret(const_cast<MEDCouplingPointSet *>(this));
+      ret->incrRef();
+      return ret;
+    }
+  else
+    {
+      return buildPartOfMySelf2(beginCellIds,endCellIds,stepCellIds,true);
+    }
 }
 
 /*!
@@ -1113,7 +1155,7 @@ MEDCouplingMesh *MEDCouplingPointSet::buildPartRange(int beginCellIds, int endCe
  * 
  * \sa MEDCouplingUMesh::buildPartOfMySelf2
  */
-MEDCouplingMesh *MEDCouplingPointSet::buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt*& arr) const throw(INTERP_KERNEL::Exception)
+MEDCouplingMesh *MEDCouplingPointSet::buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt*& arr) const
 {
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingPointSet> ret=buildPartOfMySelf2(beginCellIds,endCellIds,stepCellIds,true);
   arr=ret->zipCoordsTraducer();
@@ -1180,7 +1222,7 @@ void MEDCouplingPointSet::project2DCellOnXY(const int *startConn, const int *end
     {
       std::vector<double> cpy(res);
       int nbNodes=(int)std::distance(startConn,endConn);
-      INTERP_KERNEL::PlanarIntersector<DummyClsMCPS,int>::projection(&res[0],&cpy[0],nbNodes,nbNodes,1.e-12,0.,0.,true);
+      INTERP_KERNEL::PlanarIntersector<DummyClsMCPS,int>::Projection(&res[0],&cpy[0],nbNodes,nbNodes,1.e-12,0./*max distance*/,-1./*min dot*/,0.,true);
       res.resize(2*nbNodes);
       for(int i=0;i<nbNodes;i++)
         {
@@ -1258,7 +1300,7 @@ bool MEDCouplingPointSet::areCellsFrom2MeshEqual(const MEDCouplingPointSet *othe
  *  \throw If the coordinates array of \a other is not set.
  *  \throw If the coordinates of \a this and \a other do not match.
  */
-void MEDCouplingPointSet::tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception)
+void MEDCouplingPointSet::tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon)
 {
   const DataArrayDouble *coords=other.getCoords();
   if(!coords)
@@ -1298,7 +1340,7 @@ MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelf(const int *begin, co
   return ret.retn();
 }
 
-MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelf2(int start, int end, int step, bool keepCoords) const throw(INTERP_KERNEL::Exception)
+MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelf2(int start, int end, int step, bool keepCoords) const
 {
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingPointSet> ret=buildPartOfMySelfKeepCoords2(start,end,step);
   if(!keepCoords)
@@ -1324,8 +1366,10 @@ MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelf2(int start, int end,
  *  \throw If the nodal connectivity of cells is not defined.
  *  \throw If any node id in \a begin is not valid.
  *
+ *  \if ENABLE_EXAMPLES
  *  \ref cpp_mcumesh_buildPartOfMySelfNode "Here is a C++ example".<br>
  *  \ref  py_mcumesh_buildPartOfMySelfNode "Here is a Python example".
+ *  \endif
  */
 MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelfNode(const int *begin, const int *end, bool fullyIn) const
 {
@@ -1361,10 +1405,12 @@ MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelfNode(const int *begin
  *  \throw If the nodal connectivity of cells is not defined.
  *  \throw If the nodal connectivity includes an invalid id.
  *
+ *  \if ENABLE_EXAMPLES
  *  \ref cpp_mcumesh_zipConnectivityTraducer "Here is a C++ example".<br>
  *  \ref  py_mcumesh_zipConnectivityTraducer "Here is a Python example".
+ *  \endif
  */
-DataArrayInt *MEDCouplingPointSet::zipConnectivityTraducer(int compType, int startCellId) throw(INTERP_KERNEL::Exception)
+DataArrayInt *MEDCouplingPointSet::zipConnectivityTraducer(int compType, int startCellId)
 {
   DataArrayInt *commonCells=0,*commonCellsI=0;
   findCommonCells(compType,startCellId,commonCells,commonCellsI);
@@ -1378,6 +1424,20 @@ DataArrayInt *MEDCouplingPointSet::zipConnectivityTraducer(int compType, int sta
   return ret.retn();
 }
 
+/*!
+ * This const method states if the nodal connectivity of this fetches all nodes in \a this.
+ * In other words, this method looks is there are no orphan nodes in \a this.
+ * \sa zipCoordsTraducer, getNodeIdsInUse, computeFetchedNodeIds.
+ */
+bool MEDCouplingPointSet::areAllNodesFetched() const
+{
+  checkFullyDefined();
+  int nbNodes(getNumberOfNodes());
+  std::vector<bool> fetchedNodes(nbNodes,false);
+  computeNodeIdsAlg(fetchedNodes);
+  return std::find(fetchedNodes.begin(),fetchedNodes.end(),false)==fetchedNodes.end();
+}
+
 /*!
  * Checks if \a this and \a other meshes are geometrically equivalent, else an
  * exception is thrown. The meshes are
@@ -1395,11 +1455,13 @@ DataArrayInt *MEDCouplingPointSet::zipConnectivityTraducer(int compType, int sta
  *         to delete this array using decrRef() as it is no more needed.
  *  \throw If the two meshes do not match.
  *
+ *  \if ENABLE_EXAMPLES
  *  \ref cpp_mcumesh_checkDeepEquivalWith "Here is a C++ example".<br>
  *  \ref  py_mcumesh_checkDeepEquivalWith "Here is a Python example".
+ *  \endif
  */
 void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
-                                               DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const throw(INTERP_KERNEL::Exception)
+                                               DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const
 {
   if(!other)
     throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkDeepEquivalWith : input is null !");
@@ -1412,7 +1474,7 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int
   int oldNbOfNodes=getNumberOfNodes();
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=m->buildPermArrayForMergeNode(prec,oldNbOfNodes,areNodesMerged,newNbOfNodes);
   //mergeNodes
-  if(!areNodesMerged)
+  if(!areNodesMerged && oldNbOfNodes != 0)
     throw INTERP_KERNEL::Exception("checkDeepEquivalWith : Nodes are incompatible ! ");
   const int *pt=std::find_if(da->getConstPointer()+oldNbOfNodes,da->getConstPointer()+da->getNbOfElems(),std::bind2nd(std::greater<int>(),oldNbOfNodes-1));
   if(pt!=da->getConstPointer()+da->getNbOfElems())
@@ -1424,12 +1486,19 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int
   //
   da=m->zipConnectivityTraducer(cellCompPol);
   int nbCells=getNumberOfCells();
-  int maxId=-1;
-  if(nbCells!=0)
-    maxId=*std::max_element(da->getConstPointer(),da->getConstPointer()+nbCells);
-  pt=std::find_if(da->getConstPointer()+nbCells,da->getConstPointer()+da->getNbOfElems(),std::bind2nd(std::greater<int>(),maxId));
-  if(pt!=da->getConstPointer()+da->getNbOfElems())
+  if (nbCells != other->getNumberOfCells())
     throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some cells in other are not in this !");
+  int dan(da->getNumberOfTuples());
+  if (dan)
+    {
+      MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da1(DataArrayInt::New()),da2(DataArrayInt::New());
+      da1->alloc(dan/2,1); da2->alloc(dan/2,1);
+      std::copy(da->getConstPointer(), da->getConstPointer()+dan/2, da1->getPointer());
+      std::copy(da->getConstPointer()+dan/2, da->getConstPointer()+dan, da2->getPointer());
+      da1->sort(); da2->sort();
+      if (!da1->isEqualWithoutConsideringStr(*da2))
+        throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some cells in other are not in this !");
+    }
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellCor2=da->selectByTupleId2(nbCells,da->getNbOfElems(),1);
   nodeCor=nodeCor2->isIdentity()?0:nodeCor2.retn();
   cellCor=cellCor2->isIdentity()?0:cellCor2.retn();
@@ -1449,11 +1518,13 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int
  *         to delete this array using decrRef() as it is no more needed.
  *  \throw If the two meshes do not match.
  *
+ * \if ENABLE_EXAMPLES
  * \ref cpp_mcumesh_checkDeepEquivalWith "Here is a C++ example".<br>
  * \ref  py_mcumesh_checkDeepEquivalWith "Here is a Python example".
+ * \endif
  */
 void MEDCouplingPointSet::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
-                                                       DataArrayInt *&cellCor) const throw(INTERP_KERNEL::Exception)
+                                                       DataArrayInt *&cellCor) const
 {
   if(!other)
     throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkDeepEquivalOnSameNodesWith : input is null !");
@@ -1474,7 +1545,7 @@ void MEDCouplingPointSet::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh
   cellCor=cellCor2->isIdentity()?0:cellCor2.retn();
 }
 
-void MEDCouplingPointSet::checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
+void MEDCouplingPointSet::checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const
 {
   MEDCouplingMesh::checkFastEquivalWith(other,prec);
   //other not null checked by the line before
@@ -1508,14 +1579,16 @@ void MEDCouplingPointSet::checkFastEquivalWith(const MEDCouplingMesh *other, dou
  *
  * \sa MEDCouplingPointSet::getCellIdsFullyIncludedInNodeIds
  *
+ *  \if ENABLE_EXAMPLES
  *  \ref cpp_mcumesh_getCellIdsLyingOnNodes "Here is a C++ example".<br>
  *  \ref  py_mcumesh_getCellIdsLyingOnNodes "Here is a Python example".
+ *  \endif
  */
 DataArrayInt *MEDCouplingPointSet::getCellIdsLyingOnNodes(const int *begin, const int *end, bool fullyIn) const
 {
   DataArrayInt *cellIdsKept=0;
   fillCellIdsToKeepFromNodeIds(begin,end,fullyIn,cellIdsKept);
-  cellIdsKept->setName(getName().c_str());
+  cellIdsKept->setName(getName());
   return cellIdsKept;
 }
 
@@ -1534,8 +1607,10 @@ DataArrayInt *MEDCouplingPointSet::getCellIdsLyingOnNodes(const int *begin, cons
  * 
  * \sa MEDCouplingPointSet::getCellIdsLyingOnNodes
  *
+ *  \if ENABLE_EXAMPLES
  *  \ref cpp_mcumesh_getCellIdsFullyIncludedInNodeIds "Here is a C++ example".<br>
  *  \ref  py_mcumesh_getCellIdsFullyIncludedInNodeIds "Here is a Python example".
+ *  \endif
  */
 DataArrayInt *MEDCouplingPointSet::getCellIdsFullyIncludedInNodeIds(const int *partBg, const int *partEnd) const
 {
@@ -1553,10 +1628,12 @@ DataArrayInt *MEDCouplingPointSet::getCellIdsFullyIncludedInNodeIds(const int *p
  *  \throw If the nodal connectivity of cells is not defined.
  *  \throw If the nodal connectivity includes an invalid id.
  *
+ *  \if ENABLE_EXAMPLES
  *  \ref cpp_mcumesh_zipCoordsTraducer "Here is a C++ example".<br>
  *  \ref  py_mcumesh_zipCoordsTraducer "Here is a Python example".
+ *  \endif
  */
-DataArrayInt *MEDCouplingPointSet::zipCoordsTraducer() throw(INTERP_KERNEL::Exception)
+DataArrayInt *MEDCouplingPointSet::zipCoordsTraducer()
 {
   int newNbOfNodes=-1;
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> traducer=getNodeIdsInUse(newNbOfNodes);
@@ -1572,13 +1649,15 @@ DataArrayInt *MEDCouplingPointSet::zipCoordsTraducer() throw(INTERP_KERNEL::Exce
  *  \param [out] areNodesMerged - is set to \c true if any coincident nodes removed.
  *  \param [out] newNbOfNodes - number of nodes remaining after the removal.
  *  \return DataArrayInt * - the permutation array in "Old to New" mode. For more 
- *          info on "Old to New" mode see \ref MEDCouplingArrayRenumbering. The caller
+ *          info on "Old to New" mode see \ref numbering. The caller
  *          is to delete this array using decrRef() as it is no more needed.
  *  \throw If the coordinates array is not set.
  *  \throw If the nodal connectivity of cells is not defined.
  *
+ *  \if ENABLE_EXAMPLES
  *  \ref cpp_mcumesh_mergeNodes "Here is a C++ example".<br>
  *  \ref  py_mcumesh_mergeNodes "Here is a Python example".
+ *  \endif
  */
 DataArrayInt *MEDCouplingPointSet::mergeNodes(double precision, bool& areNodesMerged, int& newNbOfNodes)
 {
@@ -1597,13 +1676,15 @@ DataArrayInt *MEDCouplingPointSet::mergeNodes(double precision, bool& areNodesMe
  *  \param [out] areNodesMerged - is set to \c true if any coincident nodes removed.
  *  \param [out] newNbOfNodes - number of nodes remaining after the removal.
  *  \return DataArrayInt * - the permutation array in "Old to New" mode. For more 
- *          info on "Old to New" mode see \ref MEDCouplingArrayRenumbering. The caller
+ *          info on "Old to New" mode see \ref numbering. The caller
  *          is to delete this array using decrRef() as it is no more needed.
  *  \throw If the coordinates array is not set.
  *  \throw If the nodal connectivity of cells is not defined.
  *
+ *  \if ENABLE_EXAMPLES
  *  \ref cpp_mcumesh_mergeNodes "Here is a C++ example".<br>
  *  \ref  py_mcumesh_mergeNodes "Here is a Python example".
+ *  \endif
  */
 DataArrayInt *MEDCouplingPointSet::mergeNodes2(double precision, bool& areNodesMerged, int& newNbOfNodes)
 {