+/*!
+ * This method starts from an unstructured mesh that hides in reality a cartesian mesh.
+ * If it is not the case, an exception will be thrown.
+ * This method returns three objects : The cartesian mesh geometrically equivalent to \a this (within a precision of \a eps) and a permutation of cells
+ * and a permutation of nodes.
+ *
+ * - this[cellPerm[i]]=ret[i]
+ *
+ * \param [out] cellPerm the permutation array of size \c this->getNumberOfCells()
+ * \param [out] nodePerm the permutation array of size \c this->getNumberOfNodes()
+ * \return MEDCouplingCMesh * - a newly allocated mesh that is the result of the structurization of \a this.
+ */
+MEDCouplingCMesh *MEDCoupling1SGTUMesh::structurizeMe(DataArrayIdType *& cellPerm, DataArrayIdType *& nodePerm, double eps) const
+{
+ checkConsistencyLight();
+ int spaceDim(getSpaceDimension()),meshDim(getMeshDimension()); mcIdType nbNodes(getNumberOfNodes());
+ if(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(meshDim)!=getCellModelEnum())
+ throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::structurizeMe : the unique geo type in this is not compatible with the geometric type regarding mesh dimension !");
+ MCAuto<MEDCouplingCMesh> cm(MEDCouplingCMesh::New());
+ for(int i=0;i<spaceDim;i++)
+ {
+ std::vector<std::size_t> tmp(1,i);
+ MCAuto<DataArrayDouble> elt(static_cast<DataArrayDouble*>(getCoords()->keepSelectedComponents(tmp)));
+ elt=elt->getDifferentValues(eps);
+ elt->sort(true);
+ cm->setCoordsAt(i,elt);
+ }
+ if(nbNodes!=cm->getNumberOfNodes())
+ throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::structurizeMe : considering the number of nodes after split per components in space this can't be a cartesian mesh ! Maybe your epsilon parameter is invalid ?");
+ try
+ { cm->copyTinyInfoFrom(this); }
+ catch(INTERP_KERNEL::Exception&) { }
+ MCAuto<MEDCouplingUMesh> um(cm->buildUnstructured()),self(buildUnstructured());
+ self->checkGeoEquivalWith(um,12,eps,cellPerm,nodePerm);
+ return cm.retn();
+}
+