}
/*!
- * This method renumbers nodes in connectivity only without any reference with coords.
- * Use it with care !
- * @param 'newNodeNumbers' in old2New convention
+ * This method renumbers nodes \b in \b connectivity \b only \b without \b any \b reference \b to \b coords.
+ * This method performs no check on the fact that new coordinate ids are valid. \b Use \b it \b with \b care !
+ * This method is an generalization of \ref ParaMEDMEM::MEDCouplingUMesh::shiftNodeNumbersInConn "shiftNodeNumbersInConn method".
+ * @param [in] newNodeNumbers in old2New convention
*/
void MEDCouplingUMesh::renumberNodesInConn(const int *newNodeNumbersO2N)
{
+ checkConnectivityFullyDefined();
int *conn=getNodalConnectivity()->getPointer();
const int *connIndex=getNodalConnectivityIndex()->getConstPointer();
int nbOfCells=getNumberOfCells();
updateTime();
}
+/*!
+ * This method renumbers nodes \b in \b connectivity \b only \b without \b any \b reference \b to \b coords.
+ * This method performs no check on the fact that new coordinate ids are valid. \b Use \b it \b with \b care !
+ * This method is an specialization of \ref ParaMEDMEM::MEDCouplingUMesh::renumberNodesInConn "renumberNodesInConn method".
+ *
+ * @param [in] delta specifies the shift size applied to nodeId in nodal connectivity in \b this.
+ */
+void MEDCouplingUMesh::shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception)
+{
+ checkConnectivityFullyDefined();
+ int *conn=getNodalConnectivity()->getPointer();
+ const int *connIndex=getNodalConnectivityIndex()->getConstPointer();
+ int nbOfCells=getNumberOfCells();
+ for(int i=0;i<nbOfCells;i++)
+ for(int iconn=connIndex[i]+1;iconn!=connIndex[i+1];iconn++)
+ {
+ int& node=conn[iconn];
+ if(node>=0)//avoid polyhedron separator
+ {
+ node+=delta;
+ }
+ }
+ _nodal_connec->declareAsNew();
+ updateTime();
+}
+
/*!
* This method renumbers cells of 'this' using the array specified by [old2NewBg;old2NewBg+getNumberOfCells())
*
MEDCOUPLING_EXPORT void renumberNodes(const int *newNodeNumbers, int newNbOfNodes);
MEDCOUPLING_EXPORT void renumberNodes2(const int *newNodeNumbers, int newNbOfNodes);
MEDCOUPLING_EXPORT void renumberNodesInConn(const int *newNodeNumbersO2N);
+ MEDCOUPLING_EXPORT void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void renumberCells(const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void getCellsInBoundingBox(const double *bbox, double eps, std::vector<int>& elems) const;
MEDCOUPLING_EXPORT void getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps, std::vector<int>& elems);
std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
//tools
+ void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
DataArrayInt *findCellsIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
#
mesh3D_2=mesh3D.deepCpy();
mesh2D_2=mesh2D.deepCpy();
+ oldNbOf3DNodes=mesh3D.getNumberOfNodes();
renumNodes=DataArrayInt.New();
renumNodes.alloc(mesh2D.getNumberOfNodes(),1);
- renumNodes.iota(mesh3D.getNumberOfNodes());
+ renumNodes.iota(oldNbOf3DNodes);
coo=DataArrayDouble.Aggregate(mesh3D.getCoords(),mesh2D.getCoords());
mesh3D.setCoords(coo);
mesh2D.setCoords(coo);
mesh2DCpy=mesh2D.deepCpy()
+ mesh2D_3=mesh2D.deepCpy();
+ mesh2D_3.shiftNodeNumbersInConn(oldNbOf3DNodes);
mesh2D.renumberNodesInConn(renumNodes);
mesh2DCpy.renumberNodesInConn(renumNodes.getValues());
self.assertTrue(mesh2D.isEqual(mesh2DCpy,1e-12))
+ self.assertTrue(mesh2D.isEqual(mesh2D_3,1e-12))
#
da1,da2=mesh3D.checkGeoEquivalWith(mesh3D_2,10,1e-12);
self.assertTrue(da1==None);