An alternative (and more compact) way to do it : ::
- ds=[d.deepCpy() for i in xrange(len(translationToPerform))]
+ ds=[d.deepCopy() for i in xrange(len(translationToPerform))]
for (elt,t) in zip(ds,translationToPerform) : elt+=t
Aggregating DataArrayDouble
The format 'old-2-new' is systematically used for all renumbering operations (one-to-one correspondence).
-The static method DataArrayInt.BuildOld2NewArrayFromSurjectiveFormat2() performs the conversion from one storage mode to the other (c, cI to o2n).
+The static method DataArrayInt.ConvertIndexArrayToO2N() performs the conversion from one storage mode to the other (c, cI to o2n).
We get for free the number of elements in Y, i.e. the variable newNbOfTuples. ::
- o2n,newNbOfTuples=DataArrayInt.BuildOld2NewArrayFromSurjectiveFormat2(oldNbOfTuples,c,cI)
+ o2n,newNbOfTuples=DataArrayInt.ConvertIndexArrayToO2N(oldNbOfTuples,c,cI)
print "Have I got the right result? %s"%(str(myNewNbOfTuples==newNbOfTuples))
Using o2n and newNbOfTuples invoke DataArrayDouble.renumberAndReduce() on d2. ::
Finally thanks to o2n we know the connectivity of all 7 hexagons using the coordinates stored in d3.
-Do not forget to invoke MEDCouplingUMesh.finishInsertingCells() (this last bit should disappear after the release 6.6) ::
-
for i in xrange(7):
m.insertNextCell(NORM_POLYGON,o2n[6*i:6*(i+1)].getValues())
pass
- m.finishInsertingCells()
Check that m is coherent. ::
- m.checkCoherency()
+ m.checkConsistencyLight()
To visually check m, write it in a VTU file ("My7hexagons.vtu") and display it in ParaVis. ::