-/*!
- * Checks if \a this and \a other meshes are geometrically equivalent, else an
- * exception is thrown. The meshes are
- * considered equivalent if (1) \a this mesh contains the same nodes as the \a other
- * mesh (with a specified precision) and (2) \a this mesh contains the same cells as
- * the \a other mesh (with use of a specified cell comparison technique). The mapping
- * from \a other to \a this for nodes and cells is returned via out parameters.
- * \param [in] other - the mesh to compare with.
- * \param [in] cellCompPol - id [0-2] of cell comparison method. See meaning of
- * each method in description of MEDCouplingUMesh::zipConnectivityTraducer().
- * \param [in] prec - the precision used to compare nodes of the two meshes.
- * \param [out] cellCor - a cell permutation array in "Old to New" mode. The caller is
- * to delete this array using decrRef() as it is no more needed.
- * \param [out] nodeCor - a node permutation array in "Old to New" mode. The caller is
- * to delete this array using decrRef() as it is no more needed.
- * \throw If the two meshes do not match.
- *
- * \ref cpp_mcumesh_checkDeepEquivalWith "Here is a C++ example".<br>
- * \ref py_mcumesh_checkDeepEquivalWith "Here is a Python example".
- */
-void MEDCouplingUMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const throw(INTERP_KERNEL::Exception)
-{
- const MEDCouplingUMesh *otherC=dynamic_cast<const MEDCouplingUMesh *>(other);
- if(!otherC)
- throw INTERP_KERNEL::Exception("checkDeepEquivalWith : Two meshes are not not unstructured !");
- MEDCouplingMesh::checkFastEquivalWith(other,prec);
- if(_types!=otherC->_types)
- throw INTERP_KERNEL::Exception("checkDeepEquivalWith : Types are not equal !");
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m=MergeUMeshes(this,otherC);
- bool areNodesMerged;
- int newNbOfNodes;
- int oldNbOfNodes=getNumberOfNodes();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=m->buildPermArrayForMergeNode(prec,oldNbOfNodes,areNodesMerged,newNbOfNodes);
- //mergeNodes
- if(!areNodesMerged)
- 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())
- throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some nodes in other are not in this !");
- m->renumberNodes(da->getConstPointer(),newNbOfNodes);
- //
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nodeCor2=da->substr(oldNbOfNodes);
- da=m->mergeNodes(prec,areNodesMerged,newNbOfNodes);
-
- //
- 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())
- 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();
-}
-
-/*!
- * Checks if \a this and \a other meshes are geometrically equivalent, else an
- * exception is thrown. The meshes are considered equivalent if (1) they share one
- * node coordinates array and (2) they contain the same cells (with use of a specified
- * cell comparison technique). The mapping from cells of the \a other to ones of \a this
- * is returned via an out parameter.
- * \param [in] other - the mesh to compare with.
- * \param [in] cellCompPol - id [0-2] of cell comparison method. See the meaning of
- * each method in description of MEDCouplingUMesh::zipConnectivityTraducer().
- * \param [in] prec - a not used parameter.
- * \param [out] cellCor - the permutation array in "Old to New" mode. The caller is
- * to delete this array using decrRef() as it is no more needed.
- * \throw If the two meshes do not match.
- *
- * \ref cpp_mcumesh_checkDeepEquivalWith "Here is a C++ example".<br>
- * \ref py_mcumesh_checkDeepEquivalWith "Here is a Python example".
- */
-void MEDCouplingUMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
- DataArrayInt *&cellCor) const throw(INTERP_KERNEL::Exception)
-{
- const MEDCouplingUMesh *otherC=dynamic_cast<const MEDCouplingUMesh *>(other);
- if(!otherC)
- throw INTERP_KERNEL::Exception("checkDeepEquivalOnSameNodesWith : Two meshes are not not unstructured !");
- MEDCouplingMesh::checkFastEquivalWith(other,prec);
- if(_types!=otherC->_types)
- throw INTERP_KERNEL::Exception("checkDeepEquivalOnSameNodesWith : Types are not equal !");
- if(_coords!=otherC->_coords)
- throw INTERP_KERNEL::Exception("checkDeepEquivalOnSameNodesWith : meshes do not share the same coordinates ! Use tryToShareSameCoordinates or call checkDeepEquivalWith !");
- std::vector<const MEDCouplingUMesh *> ms(2);
- ms[0]=this;
- ms[1]=otherC;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m=MergeUMeshesOnSameCoords(ms);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=m->zipConnectivityTraducer(cellCompPol);
- int maxId=*std::max_element(da->getConstPointer(),da->getConstPointer()+getNumberOfCells());
- const int *pt=std::find_if(da->getConstPointer()+getNumberOfCells(),da->getConstPointer()+da->getNbOfElems(),std::bind2nd(std::greater<int>(),maxId));
- if(pt!=da->getConstPointer()+da->getNbOfElems())
- {
- throw INTERP_KERNEL::Exception("checkDeepEquivalOnSameNodesWith : some cells in other are not in this !");
- }
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellCor2=da->selectByTupleId2(getNumberOfCells(),da->getNbOfElems(),1);
- cellCor=cellCor2->isIdentity()?0:cellCor2.retn();
-}
-