From: abn Date: Wed, 20 Jan 2016 12:55:31 +0000 (+0100) Subject: MEDCoupling API change - stage #1 X-Git-Tag: V8_0_0b1~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3b1d77efdd048ef4aad858e96138bf79318119df;p=tools%2Fmedcoupling.git MEDCoupling API change - stage #1 Automatic renaming through script medcoup7to8.py. Following names have been changed: Interpolation ------------- RevIntegral / IntensiveConservation ConservativeVolumic / IntensiveMaximum IntegralGlobConstraint / ExtensiveConservation Integral / ExtensiveMaximum All classes ----------- deepCpy / deepCopy performCpy / performCopyOrIncrRef Auto-pointeur ------------- MEDCouplingAutoRefCountObjectPtr / MCAuto MEDCouplingExtrudedMesh ----------------------- MEDCouplingExtrudedMesh / MEDCouplingMappedExtrudedMesh MEDCouplingMesh --------------- getBarycenterAndOwner / computeCellCenterOfMass checkCoherency / checkConsistencyLight checkCoherency1 / checkConsistency MEDCouplingPointSet ------------------- mergeNodes2 / mergeNodesCenter renumberNodes2 / renumberNodesCenter buildPartOfMySelf2 / buildPartOfMySelfSlice buildPartOfMySelfKeepCoords2 / buildPartOfMySelfKeepCoordsSlice deepCpyConnectivityOnly / deepCopyConnectivityOnly MEDCoupling1DGTUMesh -------------------- checkCoherencyOfConnectivity / checkConsistencyOfConnectivity MEDCouplingUMesh ---------------- getMeshLength / getNodalConnectivityArrayLen AreCellsEqual0 / AreCellsEqualPolicy0 AreCellsEqual1 / AreCellsEqualPolicy1 AreCellsEqual2 / AreCellsEqualPolicy2 AreCellsEqual7 / AreCellsEqualPolicy7 AreCellsEqual3 / AreCellsEqualPolicy2NoType areCellsIncludedIn2 / areCellsIncludedInPolicy7 setPartOfMySelf2 / setPartOfMySelfSlice ExtractFromIndexedArrays2 / ExtractFromIndexedArraysSlice SetPartOfIndexedArrays2 / SetPartOfIndexedArraysSlice SetPartOfIndexedArraysSameIdx2 / SetPartOfIndexedArraysSameIdxSlice deepCpyConnectivityOnly / deepCopyConnectivityOnly DataArray --------- setContigPartOfSelectedValues2 / setContigPartOfSelectedValuesSlice selectByTupleId2 / selectByTupleIdSafe GetAxTypeRepr / GetAxisTypeRepr cpyFrom / deepCopyFrom DataArrayInt ------------ isIdentity2 / isIota selectByTupleId2 / selectByTupleIdSlice BuildOld2NewArrayFromSurjectiveFormat2 / ConvertIndexArrayToO2N getIdsEqual / findIdsEqual getIdsNotEqual / findIdsNotEqual getIdsEqualList / findIdsEqualList getIdsNotEqualList / findIdsNotEqualList getIdsEqualTuple / findIdsEqualTuple locateValue / findIdFirstEqual locateTuple / findIdFirstEqualTuple getIdsInRange / findIdsInRange getIdsNotInRange / findIdsNotInRange getIdsStrictlyNegative / findIdsStricltyNegative searchRangesInListOfIds / findIdsRangesInListOfIds computeOffsets2 / computeOffsetsFull DataArrayDouble --------------- applyFunc2 / applyFuncCompo applyFunc3 / applyFuncNamedCompo MEDCouplingFieldDouble ---------------------- getIdsInRange / findIdsInRange fillFromAnalytic2 / fillFromAnalyticCompo fillFromAnalytic3 / fillFromAnalyticNamedCompo applyFunc2 / applyFuncCompo applyFunc3 / applyFuncNamedCompo mergeNodes2 / mergeNodesCenter MEDFileMesh ----------- setAxType / setAxisType getAxType / getAxisType --- diff --git a/doc/tutorial/atestMEDCouplingCorba1.rst b/doc/tutorial/atestMEDCouplingCorba1.rst index ceeb689e2..761a5312a 100644 --- a/doc/tutorial/atestMEDCouplingCorba1.rst +++ b/doc/tutorial/atestMEDCouplingCorba1.rst @@ -34,4 +34,4 @@ Visualiser une instance de MEDCoupling dans ParaViS à travers CORBA src1 = pvs.ParaMEDCorbaPluginSource() src1.IORCorba = ior # This is where we need the CORBA reference of the object created dr = pvs.Show(src1) - \ No newline at end of file + diff --git a/doc/tutorial/atestMEDCouplingCube.rst b/doc/tutorial/atestMEDCouplingCube.rst index 61e4bd404..e8e3ddd25 100644 --- a/doc/tutorial/atestMEDCouplingCube.rst +++ b/doc/tutorial/atestMEDCouplingCube.rst @@ -71,7 +71,7 @@ myCoords = DataArrayDouble.New() myCoords.setValues(coordinates,nbOfNodes,3) mesh.setCoords(myCoords) - mesh.checkCoherency() + mesh.checkConsistencyLight() print "6 ********************" # Extraction of surfacic meshing @@ -81,7 +81,7 @@ mesh2D = mesh.buildFacePartOfMySelfNode(nodes,True) #print mesh2D mesh2D.setName("3Dcube") - mesh2D.checkCoherency() + mesh2D.checkConsistencyLight() print "7 ********************" # Creation of field : with following definition @@ -91,12 +91,12 @@ field = MEDCouplingFieldDouble.New(ON_CELLS) field.setMesh(mesh) field.setName("field") - field.setNature(Integral) + field.setNature(ExtensiveMaximum) # Computing and setting field values myCoords=DataArrayDouble.New() sampleTab=[] - bar = mesh.getBarycenterAndOwner() + bar = mesh.computeCellCenterOfMass() print bar.getNbOfElems() for i in range(nbOfCells): x = bar.getIJ(i+1,1) @@ -113,7 +113,7 @@ fBF = MEDCouplingFieldDouble.New(ON_CELLS) fBF.setMesh(mesh2D) fBF.setName("fieldBottomFace") - fBF.setNature(Integral) + fBF.setNature(ExtensiveMaximum) Cval = 10. myCoords2D=DataArrayDouble.New() sampleTab=[] diff --git a/doc/tutorial/atestMEDCouplingDataArray1.rst b/doc/tutorial/atestMEDCouplingDataArray1.rst index e168e44bc..6af7ac16d 100644 --- a/doc/tutorial/atestMEDCouplingDataArray1.rst +++ b/doc/tutorial/atestMEDCouplingDataArray1.rst @@ -35,7 +35,7 @@ Playing with regular hexagons using DataArrayDouble a = cI.deltaShiftIndex() b = a - 1 myNewNbOfTuples = oldNbOfTuples - sum(b.getValues()) - o2n, newNbOfTuples = mc.DataArrayInt.BuildOld2NewArrayFromSurjectiveFormat2(oldNbOfTuples,c,cI) + o2n, newNbOfTuples = mc.DataArrayInt.ConvertIndexArrayToO2N(oldNbOfTuples,c,cI) print "Have I got the right number of tuples?" print "myNewNbOfTuples = %d, newNbOfTuples = %d" % (myNewNbOfTuples, newNbOfTuples) assert(myNewNbOfTuples == newNbOfTuples) @@ -57,7 +57,7 @@ Playing with regular hexagons using DataArrayDouble m.insertNextCell(mc.NORM_POLYGON, cell_connec.getValues()) pass # Check that everything is coherent (will throw if not) - m.checkCoherency() + m.checkConsistencyLight() # Write the result into a VTU file that can be read with ParaView m.writeVTK("My7hexagons.vtu") diff --git a/doc/tutorial/atestMEDCouplingFieldDouble1.rst b/doc/tutorial/atestMEDCouplingFieldDouble1.rst index 1cf20c922..63e4fc23f 100644 --- a/doc/tutorial/atestMEDCouplingFieldDouble1.rst +++ b/doc/tutorial/atestMEDCouplingFieldDouble1.rst @@ -26,13 +26,13 @@ Playing with fields print "Are f and f2 equal?", f.isEqualWithoutConsideringStr(f2,1e-12,1e-12) # da1 = f.getArray() # a DataArrayDouble, which is a direct reference (not a copy) of the field's values - ids1 = da1.getIdsInRange(0.,5.) + ids1 = da1.findIdsInRange(0.,5.) fPart1 = f.buildSubPart(ids1) fPart1.writeVTK("ExoField_fPart1.vtu") - ids2 = f.getArray().getIdsInRange(50.,1.e300) + ids2 = f.getArray().findIdsInRange(50.,1.e300) fPart2 = f.buildSubPart(ids2) # Renumbering cells to follow MED file rules - fPart1Cpy = fPart1.deepCpy() + fPart1Cpy = fPart1.deepCopy() o2n = fPart1Cpy.getMesh().sortCellsInMEDFileFrmt() fPart1Cpy.getArray().renumberInPlace(o2n) # Check that fPart1Cpy and fPart1 are the same @@ -43,13 +43,13 @@ Playing with fields fPart12 = mc.MEDCouplingFieldDouble.MergeFields([fPart1,fPart2]) fPart12.writeVTK("ExoField_fPart12.vtu") # Evaluation on points - bary = fPart12.getMesh().getBarycenterAndOwner() + bary = fPart12.getMesh().computeCellCenterOfMass() arr1 = fPart12.getValueOnMulti(bary) arr2 = f.getValueOnMulti(bary) delta = arr1-arr2 delta.abs() print "Is field evaluation matching?", (delta.accumulate()[0]<1e-12) - # Integral computations + # ExtensiveMaximum computations integ1 = fPart12.integral(0,True) integ1_bis = fPart12.getArray().accumulate()[0] print "First integral matching ?", ( abs(integ1 - integ1_bis) < 1e-8 ) diff --git a/doc/tutorial/atestMEDCouplingLoaderEx1.rst b/doc/tutorial/atestMEDCouplingLoaderEx1.rst index 2057adcaf..b8d1cfcca 100644 --- a/doc/tutorial/atestMEDCouplingLoaderEx1.rst +++ b/doc/tutorial/atestMEDCouplingLoaderEx1.rst @@ -19,7 +19,7 @@ Agitateur - Swirler fMc = f1ts.getFieldAtLevel(ml.ON_CELLS,0) arr = fMc.getArray() arr.getMinMaxPerComponent() # just to see the field variation range per component - ids = arr.getIdsInRange(0.,1.) + ids = arr.findIdsInRange(0.,1.) f2Mc = fMc[ids] # Extract pression field on the swirler pressMts = data.getFields()["PRESSION_ELEM_DOM"] @@ -32,7 +32,7 @@ Agitateur - Swirler agitateurMesh3DMc = pressOnAgitateurMc.getMesh() m3DSurf,desc,descI,revDesc,revDescI = agitateurMesh3DMc.buildDescendingConnectivity() nbOf3DCellSharing = revDescI.deltaShiftIndex() - ids2 = nbOf3DCellSharing.getIdsEqual(1) + ids2 = nbOf3DCellSharing.findIdsEqual(1) agitateurSkinMc = m3DSurf[ids2] offsetsOfTupleIdsInField = revDescI[ids2] tupleIdsInField = revDesc[offsetsOfTupleIdsInField] @@ -48,9 +48,9 @@ Agitateur - Swirler # Torque computation singlePolyhedron = agitateurMesh3DMc.buildSpreadZonesWithPoly() singlePolyhedron.orientCorrectlyPolyhedrons() - centerOfMass = singlePolyhedron.getBarycenterAndOwner() + centerOfMass = singlePolyhedron.computeCellCenterOfMass() - barySkin=agitateurSkinMc.getBarycenterAndOwner() + barySkin=agitateurSkinMc.computeCellCenterOfMass() posSkin = barySkin-centerOfMass torquePerCellOnSkin = ml.DataArrayDouble.CrossProduct(posSkin,forceVectSkin) @@ -81,17 +81,17 @@ Agitateur - Swirler def computeAngle(locAgitateur1ts): fMc = locAgitateur1ts.getFieldAtLevel(ml.ON_CELLS,0) arr = fMc.getArray() - ids = arr.getIdsInRange(0.,1.) + ids = arr.findIdsInRange(0.,1.) f2Mc = fMc[ids] m3DSurf,desc,descI,revDesc,revDescI = f2Mc.getMesh().buildDescendingConnectivity() nbOf3DCellSharing = revDescI.deltaShiftIndex() - ids2 = nbOf3DCellSharing.getIdsEqual(1) + ids2 = nbOf3DCellSharing.findIdsEqual(1) agitateurSkinMc = m3DSurf[ids2] # singlePolyhedron = agitateurMesh3DMc.buildSpreadZonesWithPoly() singlePolyhedron.orientCorrectlyPolyhedrons() - centerOfMass = singlePolyhedron.getBarycenterAndOwner() - bary = agitateurSkinMc.getBarycenterAndOwner() + centerOfMass = singlePolyhedron.computeCellCenterOfMass() + bary = agitateurSkinMc.computeCellCenterOfMass() posSkin = bary-centerOfMass x2=posSkin[:,0]*posSkin[:,0] ; x2=x2.accumulate()[0] y2=posSkin[:,1]*posSkin[:,1] ; y2=y2.accumulate()[0] diff --git a/doc/tutorial/atestMEDCouplingLoaderEx2.rst b/doc/tutorial/atestMEDCouplingLoaderEx2.rst index 3ea615ab9..6e08df496 100644 --- a/doc/tutorial/atestMEDCouplingLoaderEx2.rst +++ b/doc/tutorial/atestMEDCouplingLoaderEx2.rst @@ -9,7 +9,7 @@ Intersection géométrique de maillages import MEDLoader as ml def displayVTK(m,fname): - tmp = m.deepCpy() + tmp = m.deepCopy() tmp.tessellate2D(0.1) tmp.writeVTK(fname) return @@ -25,10 +25,10 @@ Intersection géométrique de maillages mobm = mobile.getMeshAtLevel(0) mobm.mergeNodes(1e-10) # Visualize fixm and mobm with PARAVIEW - fixm2 = fixm.deepCpy() # tessellate2D() modifies the current mesh + fixm2 = fixm.deepCopy() # tessellate2D() modifies the current mesh fixm2.tessellate2D(0.1) fixm2.writeVTK("fixm2.vtu") - mobm2 = mobm.deepCpy() + mobm2 = mobm.deepCopy() mobm2.tessellate2D(0.1) mobm2.writeVTK("mobm2.vtu") # mobm2 is in several pieces, take the first one @@ -46,7 +46,7 @@ Intersection géométrique de maillages partFixMob, iPart, iMob = ml.MEDCouplingUMesh.Intersect2DMeshes(partFixm,zone1Mobm,1e-10) partFixMob.mergeNodes(1e-10) # Get the part of partFixm not included in zone1Mobm using partFixMob - ids3 = iMob.getIdsEqual(-1) + ids3 = iMob.findIdsEqual(-1) partFixmWithoutZone1Mobm = partFixMob[ids3] displayVTK(partFixmWithoutZone1Mobm,"partFixmWithoutZone1Mobm.vtu") # Check that intersection worked properly @@ -62,14 +62,14 @@ Intersection géométrique de maillages areaZone1Mobm = zone1Mobm.getMeasureField(ml.ON_CELLS).getArray() areaZone1Mobm.abs() val3 = areaZone1Mobm.accumulate()[0] - ids4 = iMob.getIdsNotEqual(-1) + ids4 = iMob.findIdsNotEqual(-1) areaPartFixMob2 = areaPartFixMob[ids4] val4 = areaPartFixMob2.accumulate()[0] print "Check #1 %lf == %lf with precision 1e-8 ? %s" % (val3,val4,str(abs(val3-val4)<1e-8)) # Check #2 isCheck2OK = True for icell in xrange(partFixm.getNumberOfCells()): - ids5 = iPart.getIdsEqual(icell) + ids5 = iPart.findIdsEqual(icell) areaOfCells = areaPartFixMob[ids5] areaOfCells.abs() if abs(areaOfCells.accumulate()[0] - areaPartFixm[icell]) > 1e-9: @@ -79,14 +79,14 @@ Intersection géométrique de maillages print "Check #2? %s" % (str(isCheck2OK)) # Indicator field creation f = ml.MEDCouplingFieldDouble(ml.ON_CELLS,ml.ONE_TIME) - m = partFixMob.deepCpy() + m = partFixMob.deepCopy() m.tessellate2D(0.1) f.setMesh(m) arr = ml.DataArrayDouble(partFixMob.getNumberOfCells(),1) - arr[iMob.getIdsEqual(-1)] = 0. - arr[iMob.getIdsNotEqual(-1)] = 1. + arr[iMob.findIdsEqual(-1)] = 0. + arr[iMob.findIdsNotEqual(-1)] = 1. f.setArray(arr) - f.checkCoherency() + f.checkConsistencyLight() f.setName("Zone") ml.MEDCouplingFieldDouble.WriteVTK("Zone.vtu",[f]) # Other zones @@ -95,21 +95,21 @@ Intersection géométrique de maillages partFixMob2,iPart2,iMob2 = ml.MEDCouplingUMesh.Intersect2DMeshes(partFixm,zonesMobm,1e-10) partFixMob2.mergeNodes(1e-10) f2 = ml.MEDCouplingFieldDouble(ml.ON_CELLS, ml.ONE_TIME) - m2 = partFixMob2.deepCpy() + m2 = partFixMob2.deepCopy() m2.tessellate2D(0.1) f2.setMesh(m2) arr = ml.DataArrayDouble(partFixMob2.getNumberOfCells(),1) - arr[iMob2.getIdsEqual(-1)]=0. + arr[iMob2.findIdsEqual(-1)]=0. st = 0 end = st + len(zonesInMobm[0]) - arr[iMob2.getIdsInRange(st,end)] = 1. + arr[iMob2.findIdsInRange(st,end)] = 1. st += len(zonesInMobm[0]) ; end = st + len(zonesInMobm[1]) - arr[iMob2.getIdsInRange(st,end)] = 2. + arr[iMob2.findIdsInRange(st,end)] = 2. st += len(zonesInMobm[1]) end = st + len(zonesInMobm[2]) - arr[iMob2.getIdsInRange(st,end)] = 3. + arr[iMob2.findIdsInRange(st,end)] = 3. f2.setArray(arr) - f2.checkCoherency() + f2.checkConsistencyLight() f2.setName("Zone2") ml.MEDCouplingFieldDouble.WriteVTK("Zone2.vtu",[f2]) diff --git a/doc/tutorial/atestMEDCouplingNumPy.rst b/doc/tutorial/atestMEDCouplingNumPy.rst index c3641f1a5..0400b1763 100644 --- a/doc/tutorial/atestMEDCouplingNumPy.rst +++ b/doc/tutorial/atestMEDCouplingNumPy.rst @@ -73,6 +73,6 @@ Playing with NumPy and SciPy mat = rem.getCrudeCSRMatrix() indptr = mc.DataArrayInt(mat.indptr) indptr2 = indptr.deltaShiftIndex() - cellIdsOfSkin = indptr2.getIdsEqual(1) + cellIdsOfSkin = indptr2.findIdsEqual(1) skin = skinAndNCFaces[cellIdsOfSkin] skin.writeVTK("skin.vtu") diff --git a/doc/tutorial/atestMEDCouplingPoly.rst b/doc/tutorial/atestMEDCouplingPoly.rst index 949fe3091..0b60b84c7 100644 --- a/doc/tutorial/atestMEDCouplingPoly.rst +++ b/doc/tutorial/atestMEDCouplingPoly.rst @@ -91,7 +91,7 @@ pass print "5 ********************" - mesh.checkCoherency() + mesh.checkConsistencyLight() medFileName = "MEDCoupling_Fleur.med" MEDLoader.WriteUMesh(medFileName,mesh,True) diff --git a/doc/tutorial/atestMEDCouplingRead.rst b/doc/tutorial/atestMEDCouplingRead.rst index c0f4c476e..5da356bf2 100644 --- a/doc/tutorial/atestMEDCouplingRead.rst +++ b/doc/tutorial/atestMEDCouplingRead.rst @@ -32,7 +32,7 @@ Read med File res=f.getValueOn(pos) # Verify if value is OK - bar = mesh3D.getBarycenterAndOwner() + bar = mesh3D.computeCellCenterOfMass() x=bar.getIJ(1,1) y=bar.getIJ(1,2) z=bar.getIJ(1,3) diff --git a/doc/tutorial/atestMEDCouplingRemapper.rst b/doc/tutorial/atestMEDCouplingRemapper.rst index 06a3beba2..73029fbc7 100644 --- a/doc/tutorial/atestMEDCouplingRemapper.rst +++ b/doc/tutorial/atestMEDCouplingRemapper.rst @@ -45,24 +45,24 @@ Interpoler avec MEDCouplingRemapper srcField.getArray().setInfoOnComponent(0, "powercell [W]") # Transfer field #remap.transferField(srcField, 1e300) - srcField.setNature(mc.ConservativeVolumic) + srcField.setNature(mc.IntensiveMaximum) trgFieldCV = remap.transferField(srcField,1e300) - # ConservativeVolumic + # IntensiveMaximum integSource = srcField.integral(True)[0] integTarget = trgFieldCV.integral(True)[0] - print "ConservativeVolumic -- integrals: %lf == %lf" % (integSource, integTarget) + print "IntensiveMaximum -- integrals: %lf == %lf" % (integSource, integTarget) accSource = srcField.getArray().accumulate()[0] accTarget = trgFieldCV.getArray().accumulate()[0] - print "ConservativeVolumic -- sums: %lf != %lf" % (accSource, accTarget) - # IntegralGlobConstraint - srcField.setNature(mc.IntegralGlobConstraint) + print "IntensiveMaximum -- sums: %lf != %lf" % (accSource, accTarget) + # ExtensiveConservation + srcField.setNature(mc.ExtensiveConservation) trgFieldI = remap.transferField(srcField,1e300) # integSource = srcField.integral(True)[0] integTarget = trgFieldI.integral(True)[0] - print "IntegralGlobConstraint -- integrals: %lf != %lf" % (integSource, integTarget) + print "ExtensiveConservation -- integrals: %lf != %lf" % (integSource, integTarget) accSource = srcField.getArray().accumulate()[0] accTarget = trgFieldI.getArray().accumulate()[0] - print "IntegralGlobConstraint -- sums: %lf == %lf" % (accSource, accTarget) + print "ExtensiveConservation -- sums: %lf == %lf" % (accSource, accTarget) diff --git a/doc/tutorial/atestMEDCouplingUMesh1.rst b/doc/tutorial/atestMEDCouplingUMesh1.rst index 6734be770..6b18f9b80 100644 --- a/doc/tutorial/atestMEDCouplingUMesh1.rst +++ b/doc/tutorial/atestMEDCouplingUMesh1.rst @@ -34,7 +34,7 @@ Playing with unstructured mesh mesh3D.setCoords(myCoords); mesh3D.orientCorrectlyPolyhedrons() mesh3D.sortCellsInMEDFileFrmt() - mesh3D.checkCoherency() + mesh3D.checkConsistencyLight() renum = mc.DataArrayInt(60) ; renum[:15]=range(15,30) ; renum[15:30]=range(15) ; renum[30:45]=range(45,60) ; renum[45:]=range(30,45) mesh3D.renumberNodes(renum,60) # Scale coordinates from meters to centimeters @@ -47,13 +47,13 @@ Playing with unstructured mesh # Extract cells from a given Z level - Solution 1 tmp,cellIdsSol1 = mesh3D.buildSlice3D([0.,0.,(zLev[1]+zLev[2])/2],[0.,0.,1.],1e-12) # Idem - Solution 2 - bary = mesh3D.getBarycenterAndOwner() + bary = mesh3D.computeCellCenterOfMass() baryZ = bary[:,2] - cellIdsSol2 = baryZ.getIdsInRange(zLev[1],zLev[2]) + cellIdsSol2 = baryZ.findIdsInRange(zLev[1],zLev[2]) # Idem - Solution 3 nodeIds = mesh3D.findNodesOnPlane([0.,0.,zLev[0]],[0.,0.,1.],1e-10) mesh2D = mesh3D.buildFacePartOfMySelfNode(nodeIds,True) - extMesh = mc.MEDCouplingExtrudedMesh(mesh3D,mesh2D,0) + extMesh = mc.MEDCouplingMappedExtrudedMesh(mesh3D,mesh2D,0) n_cells = mesh2D.getNumberOfCells() cellIdsSol3 = extMesh.getMesh3DIds()[n_cells:2*n_cells] # Compare the 3 methods @@ -72,12 +72,12 @@ Playing with unstructured mesh baryXY = bary[:,[0,1]] baryXY -= [250.,150.] magn = baryXY.magnitude() - cellIds2Sol1 = magn.getIdsInRange(0.,1e-12) + cellIds2Sol1 = magn.findIdsInRange(0.,1e-12) # Extract cells along a line - Solution 2 - bary2 = mesh2D.getBarycenterAndOwner()[:,[0,1]] + bary2 = mesh2D.computeCellCenterOfMass()[:,[0,1]] bary2 -= [250.,150.] magn = bary2.magnitude() - ids = magn.getIdsInRange(0.,1e-12) + ids = magn.findIdsInRange(0.,1e-12) idStart = int(ids) # ids is assumed to contain only one value, if not an exception is thrown ze_range = range(idStart,mesh3D.getNumberOfCells(),mesh2D.getNumberOfCells()) cellIds2Sol2 = extMesh.getMesh3DIds()[ze_range] @@ -85,14 +85,14 @@ Playing with unstructured mesh mesh3DSlice2 = mesh3D[cellIds2Sol1] mesh3DSlice2.zipCoords() # Aggregate two meshes, one being the translated version of the original - mesh3DSlice2bis = mesh3DSlice2.deepCpy() + mesh3DSlice2bis = mesh3DSlice2.deepCopy() mesh3DSlice2bis.translate([0.,1000.,0.]) mesh3DSlice2All = mc.MEDCouplingUMesh.MergeUMeshes([mesh3DSlice2,mesh3DSlice2bis]) mesh3DSlice2All.writeVTK("mesh3DSlice2All.vtu") # Discover descending connectivity mesh3DSurf,desc,descIndx,revDesc,revDescIndx = mesh3D.buildDescendingConnectivity() numberOf3DCellSharing = revDescIndx.deltaShiftIndex() - cellIds = numberOf3DCellSharing.getIdsNotEqual(1) + cellIds = numberOf3DCellSharing.findIdsNotEqual(1) mesh3DSurfInside = mesh3DSurf[cellIds] mesh3DSurfInside.writeVTK("mesh3DSurfInside.vtu") diff --git a/doc/tutorial/atestMEDLoaderAdvancedAPI1.rst b/doc/tutorial/atestMEDLoaderAdvancedAPI1.rst index 788093ccc..100fc8efa 100644 --- a/doc/tutorial/atestMEDLoaderAdvancedAPI1.rst +++ b/doc/tutorial/atestMEDLoaderAdvancedAPI1.rst @@ -62,7 +62,7 @@ Reading, Writing a MED file using MEDLoader advanced API # f = ml.MEDCouplingFieldDouble(ml.ON_CELLS, ml.ONE_TIME) f.setTime(5.6,7,8) - f.setArray(targetMesh.getBarycenterAndOwner()) + f.setArray(targetMesh.computeCellCenterOfMass()) f.setMesh(targetMesh) f.setName("AFieldName") # Prepare field for writing diff --git a/doc/tutorial/atestMEDLoaderBasicAPI1.rst b/doc/tutorial/atestMEDLoaderBasicAPI1.rst index c610ae616..a0c0564c7 100644 --- a/doc/tutorial/atestMEDLoaderBasicAPI1.rst +++ b/doc/tutorial/atestMEDLoaderBasicAPI1.rst @@ -29,7 +29,7 @@ Reading, Writing a MED file using MEDLoader basic API # Writing a field and its support mesh in one go f = ml.MEDCouplingFieldDouble.New(ml.ON_CELLS, ml.ONE_TIME) f.setTime(5.6,7,8) # Declare the timestep associated to the field - f.setArray(targetMesh.getBarycenterAndOwner()) + f.setArray(targetMesh.computeCellCenterOfMass()) f.setMesh(targetMesh) f.setName("AFieldName") MEDLoader.WriteField("MyFirstField.med",f,True) diff --git a/doc/tutorial/atestMEDLoaderSplitAndMerge1.rst b/doc/tutorial/atestMEDLoaderSplitAndMerge1.rst index aa498a873..20231f119 100644 --- a/doc/tutorial/atestMEDLoaderSplitAndMerge1.rst +++ b/doc/tutorial/atestMEDLoaderSplitAndMerge1.rst @@ -53,7 +53,7 @@ Splitting and Merging a MED file using MEDLoader cellField0_read = MEDLoader.ReadFieldCell("proc0.med","mesh",0,"CellField",5,6) cellField1_read = MEDLoader.ReadFieldCell("proc1.med","mesh",0,"CellField",5,6) cellField_read = ml.MEDCouplingFieldDouble.MergeFields([cellField0_read,cellField1_read]) - cellFieldCpy = cellField.deepCpy() + cellFieldCpy = cellField.deepCopy() cellFieldCpy.substractInPlaceDM(cellField_read,10,1e-12) cellFieldCpy.getArray().abs() print cellFieldCpy.getArray().isUniform(0.,1e-12) @@ -62,7 +62,7 @@ Splitting and Merging a MED file using MEDLoader nodeField1_read = MEDLoader.ReadFieldNode("proc1.med","mesh",0,"NodeField",5,6) nodeField_read = ml.MEDCouplingFieldDouble.MergeFields([nodeField0_read, nodeField1_read]) nodeField_read.mergeNodes(1e-10) - nodeFieldCpy = nodeField.deepCpy() + nodeFieldCpy = nodeField.deepCopy() nodeFieldCpy.mergeNodes(1e-10) nodeFieldCpy.substractInPlaceDM(nodeField_read,10,1e-12) print nodeFieldCpy.getArray().isUniform(0.,1e-12) @@ -114,7 +114,7 @@ Splitting and Merging a MED file using MEDLoader if typp == ml.ON_CELLS: arr.renumberInPlace(o2nML[lev]) mcf = ml.MEDCouplingFieldDouble(typp,ml.ONE_TIME) ; mcf.setName(fieldName) ; mcf.setTime(tim,dt,it) ; mcf.setArray(arr) - mcf.setMesh(mergeMLMesh.getMeshAtLevel(lev)) ; mcf.checkCoherency() + mcf.setMesh(mergeMLMesh.getMeshAtLevel(lev)) ; mcf.checkConsistencyLight() mergeField.appendFieldNoProfileSBT(mcf) pass pass diff --git a/doc/tutorial/medcoupling_2Dpolygon.rst b/doc/tutorial/medcoupling_2Dpolygon.rst index 3f0764385..706875736 100644 --- a/doc/tutorial/medcoupling_2Dpolygon.rst +++ b/doc/tutorial/medcoupling_2Dpolygon.rst @@ -96,7 +96,7 @@ For each hexagon of the mesh, you have to give its connectivity: the list of the for i in range(6): mesh.insertNextCell(NORM_POLYGON,6,connectivity[6*i:6*(i+1)]) pass - mesh.checkCoherency() + mesh.checkConsistencyLight() Saving the mesh in a med file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/tutorial/medcoupling_3Dcube.rst b/doc/tutorial/medcoupling_3Dcube.rst index 2564f7863..86f462769 100644 --- a/doc/tutorial/medcoupling_3Dcube.rst +++ b/doc/tutorial/medcoupling_3Dcube.rst @@ -95,7 +95,7 @@ For each hexahedron of the mesh, you have to give its connectivity: the list of pass # Check mesh consistency: - mesh.checkCoherency() + mesh.checkConsistencyLight() Method by extrusion ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -257,12 +257,12 @@ The field will be a sin function dependant of distance of the barycenter of each field = MEDCouplingFieldDouble.New(ON_CELLS) field.setMesh(mesh) field.setName("field") - field.setNature(Integral) + field.setNature(ExtensiveMaximum) # Computing and setting field values myCoords=DataArrayDouble.New() sampleTab=[] - bar = mesh.getBarycenterAndOwner() + bar = mesh.computeCellCenterOfMass() print bar.getNbOfElems() for i in range(nbOfCells): x = bar.getIJ(...) @@ -307,7 +307,7 @@ The connectivity must respect following figure: mesh2D = mesh.buildFacePartOfMySelfNode(nodes,True) #print mesh2D mesh2D.setName("3Dcube") - mesh2D.checkCoherency() + mesh2D.checkConsistencyLight() medFileName = "MEDCoupling_cube3D.med" meshes=[mesh2D,mesh] diff --git a/doc/tutorial/medcoupling_Read.rst b/doc/tutorial/medcoupling_Read.rst index d954bfdab..94ca960d1 100644 --- a/doc/tutorial/medcoupling_Read.rst +++ b/doc/tutorial/medcoupling_Read.rst @@ -68,7 +68,7 @@ Retrieving field values res=f.getValueOn(pos) # Verify if value is OK - bar = mesh3D.getBarycenterAndOwner() + bar = mesh3D.computeCellCenterOfMass() x=bar.getIJ(...) y=bar.getIJ(...) z=bar.getIJ(...) diff --git a/doc/tutorial/medcoupling_dataarray1_en.rst b/doc/tutorial/medcoupling_dataarray1_en.rst index eeb8d6d69..befd97778 100644 --- a/doc/tutorial/medcoupling_dataarray1_en.rst +++ b/doc/tutorial/medcoupling_dataarray1_en.rst @@ -122,7 +122,7 @@ Create the len(translationToPerform) copies of d and apply the corresponding tra 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 @@ -190,10 +190,10 @@ This storage method takes the form of a DataArrayInt 'o2n' made of Card(X) tuple 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. :: @@ -243,7 +243,7 @@ Finally thanks to o2n we know the connectivity of all 7 hexagons using the coord 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. :: diff --git a/doc/tutorial/medcoupling_dataarray1_fr.rst b/doc/tutorial/medcoupling_dataarray1_fr.rst index 5dae2410e..dc9cac5ed 100644 --- a/doc/tutorial/medcoupling_dataarray1_fr.rst +++ b/doc/tutorial/medcoupling_dataarray1_fr.rst @@ -248,11 +248,11 @@ tuples uniques (non doublons) dans l'ensemble de départ. .. note:: Pour toutes les opérations de renumérotation en MEDCoupling (bijection), le format "old-2-new" est systématiquement utilisé. -La méthode statique ``DataArrayInt.BuildOld2NewArrayFromSurjectiveFormat2()`` (nom un peu barbare, on vous l'accorde) +La méthode statique ``DataArrayInt.ConvertIndexArrayToO2N()`` (nom un peu barbare, on vous l'accorde) permet de passer du mode de stockage de cette surjection ``c``, ``cI`` au format ``o2n``. On récupère au passage card(Y) c'est-à-dire le ``newNbOfTuples``. :: - o2n, newNbOfTuples = mc.DataArrayInt.BuildOld2NewArrayFromSurjectiveFormat2(oldNbOfTuples,c,cI) + o2n, newNbOfTuples = mc.DataArrayInt.ConvertIndexArrayToO2N(oldNbOfTuples,c,cI) print "Have I got the right number of tuples?" print "myNewNbOfTuples = %d, newNbOfTuples = %d" % (myNewNbOfTuples, newNbOfTuples) assert(myNewNbOfTuples == newNbOfTuples) @@ -315,7 +315,7 @@ des 7 hexagones utilisant les coordonnées ``d3``. :: Vérifier que ``m`` est correct et ne contient pas d'anomalie. :: - m.checkCoherency() + m.checkConsistencyLight() .. note:: Il est toujours une bonne idée d'appeler cette méthode après la construction "from scratch" d'un maillage. Cela assure qu'il n'y a pas de gros "couacs" dans la connectivité, etc ... diff --git a/doc/tutorial/medcoupling_fielddouble1_en.rst b/doc/tutorial/medcoupling_fielddouble1_en.rst index 7f3bca89c..89e1587c6 100644 --- a/doc/tutorial/medcoupling_fielddouble1_en.rst +++ b/doc/tutorial/medcoupling_fielddouble1_en.rst @@ -73,16 +73,16 @@ Compare f and f2 with a precision of 1e-12 on coordinates and 1e-12 on values. : Builing of a subpart of a field ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Store in ids1 the list of tuple ids whose value is within [0.0,5.0] (DataArrayDouble.getIdsInRange) . From ids1 build the sub-part fPart1 of the field "f". :: +Store in ids1 the list of tuple ids whose value is within [0.0,5.0] (DataArrayDouble.findIdsInRange) . From ids1 build the sub-part fPart1 of the field "f". :: - ids1=f.getArray().getIdsInRange(0.,5.) + ids1=f.getArray().findIdsInRange(0.,5.) fPart1=f.buildSubPart(ids1) .. image:: images/FieldDouble1_1.png Select the part "fPart2" of the field "f" whose values are in [50.,infinity). :: - ids2=f.getArray().getIdsInRange(50.,1.e300) + ids2=f.getArray().findIdsInRange(50.,1.e300) fPart2=f.buildSubPart(ids2) Renumbering cells @@ -91,7 +91,7 @@ Renumbering cells The generated file "fPart1" is valid for MEDCoupling, but its cells are not sorted by geometric type: it is not valid from a MED file point of view. By using MEDCouplingUMesh.sortCellsInMEDFileFrmt and DataArrayDouble.renumberInPlace renumber manually fPart1 starting from a deep copy of fPart1. :: - fPart1Cpy=fPart1.deepCpy() + fPart1Cpy=fPart1.deepCopy() o2n=fPart1Cpy.getMesh().sortCellsInMEDFileFrmt() fPart1Cpy.getArray().renumberInPlace(o2n) @@ -124,7 +124,7 @@ Evaluation of a MEDCouplingFieldDouble on given space points Evaluate the values of the computed field "fPart12" on the barycenters of its mesh. Evaluate the field "f" on the same barycenters. The method used is MEDCouplingFieldDouble.getValueOnMulti(). :: - bary=fPart12.getMesh().getBarycenterAndOwner() + bary=fPart12.getMesh().computeCellCenterOfMass() arr1=fPart12.getValueOnMulti(bary) arr2=f.getValueOnMulti(bary) delta=arr1-arr2 diff --git a/doc/tutorial/medcoupling_fielddouble1_fr.rst b/doc/tutorial/medcoupling_fielddouble1_fr.rst index d6bf354e1..02a7a42f2 100644 --- a/doc/tutorial/medcoupling_fielddouble1_fr.rst +++ b/doc/tutorial/medcoupling_fielddouble1_fr.rst @@ -98,11 +98,11 @@ Construire une sous-partie d'un champ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Récupérer dans une variable ``ids1`` la liste des identifiants de cellules pour lesquelles la valeur du champ est dans le -range [0.0,5.0]. Utiliser pour cela la méthode ``DataArrayDouble.getIdsInRange()``. Avec ce résultat, construire la +range [0.0,5.0]. Utiliser pour cela la méthode ``DataArrayDouble.findIdsInRange()``. Avec ce résultat, construire la sous-partie ``fPart1`` du champ ``f``. :: da1 = f.getArray() # a DataArrayDouble, which is a direct reference (not a copy) of the field's values - ids1 = da1.getIdsInRange(0., 5.) + ids1 = da1.findIdsInRange(0., 5.) fPart1 = f.buildSubPart(ids1) fPart1.writeVTK("ExoField_fPart1.vtu") @@ -111,7 +111,7 @@ sous-partie ``fPart1`` du champ ``f``. :: Sélectionner la partie ``fPart2`` du champ ``f`` dont toutes les valeurs de tuples sont dans ``[50.,+infinity)``. :: - ids2 = f.getArray().getIdsInRange(50., 1.e300) + ids2 = f.getArray().findIdsInRange(50., 1.e300) fPart2 = f.buildSubPart(ids2) Ce genre de technique permet d'extraire facilement les parties d'un champ relatives à un groupe de mailles par exemple. @@ -127,7 +127,7 @@ par type géométrique. L'idée est d'utiliser les deux méthodes ``MEDCouplingUMesh.sortCellsInMEDFileFrmt()`` et ``DataArrayDouble.renumberInPlace()`` pour renuméroter manuellement une *copie* de ``fPart1``: :: - fPart1Cpy = fPart1.deepCpy() + fPart1Cpy = fPart1.deepCopy() o2n = fPart1Cpy.getMesh().sortCellsInMEDFileFrmt() fPart1Cpy.getArray().renumberInPlace(o2n) @@ -163,14 +163,14 @@ Evaluation d'un champ en des points donnés de l'espace Evaluer la valeur du champ ``fPart12`` calculé précédemment sur les barycentres des cellules de son maillage (variable ``bary``) et mettre le résultat dans ``arr1``. -Utiliser pour cela les méthodes ``MEDCouplingFieldDouble.getValueOnMulti()`` et ``MEDCouplingMesh.getBarycenterAndOwner()``. +Utiliser pour cela les méthodes ``MEDCouplingFieldDouble.getValueOnMulti()`` et ``MEDCouplingMesh.computeCellCenterOfMass()``. De manière similaire, évaluer ensuite directement le champ ``f`` en utilisant la même liste de points que précédemment (``bary``) et mettre le résultat dans ``arr2``. Vérifier ensuite que ``arr1`` et ``arr2`` sont bien égaux: :: - bary = fPart12.getMesh().getBarycenterAndOwner() + bary = fPart12.getMesh().computeCellCenterOfMass() arr1 = fPart12.getValueOnMulti(bary) arr2 = f.getValueOnMulti(bary) delta = arr1-arr2 diff --git a/doc/tutorial/medcoupling_umesh1_en.rst b/doc/tutorial/medcoupling_umesh1_en.rst index c7c319f39..0c23f2752 100644 --- a/doc/tutorial/medcoupling_umesh1_en.rst +++ b/doc/tutorial/medcoupling_umesh1_en.rst @@ -56,7 +56,7 @@ Copy paste the following lines. :: mesh3D.setCoords(myCoords) mesh3D.orientCorrectlyPolyhedrons() mesh3D.sortCellsInMEDFileFrmt() - mesh3D.checkCoherency() + mesh3D.checkConsistencyLight() renum=DataArrayInt.New(60) ; renum[:15]=range(15,30) ; renum[15:30]=range(15) ; renum[30:45]=range(45,60) ; renum[45:]=range(30,45) mesh3D.renumberNodes(renum,60) @@ -97,14 +97,14 @@ and foreach 2D cell in slicemesh, the corresponding cell id into mesh3D. :: Firstly, compute the barycenters of the 3D cells. Then select the 2nd component of the barycenter of the cells. Finally select the tuple ids (corresponding to cell ids) falling in the range [zLev[1],zLev[2]]. :: - bary=mesh3D.getBarycenterAndOwner() + bary=mesh3D.computeCellCenterOfMass() baryZ=bary[:,2] - cellIdsSol2=baryZ.getIdsInRange(zLev[1],zLev[2]) + cellIdsSol2=baryZ.findIdsInRange(zLev[1],zLev[2]) -* Using MEDCouplingExtrudedMesh : +* Using MEDCouplingMappedExtrudedMesh : This is the safest method since it only uses the nodal connectivity to compute the extrusion. The coordinates are ignored. -Two things are needed to build a MEDCouplingExtrudedMesh. The 3D mesh you expect to be an extruded mesh, and a 2D mesh +Two things are needed to build a MEDCouplingMappedExtrudedMesh. The 3D mesh you expect to be an extruded mesh, and a 2D mesh lying on the same coordinates, from which the extrusion will be computed. Let's begin with the build of the 2D mesh. We build it from all the nodes on a plane going through point [0.,0.,zLev[0]] and with normal vector [0.,0.,1.] (MEDCouplingUMesh.findNodesOnPlane()). Then invoke MEDCouplingUMesh.buildFacePartOfMySelfNode to build mesh2D (read the documentation of buildFacePartOfMySelfNode()). :: @@ -114,7 +114,7 @@ Then invoke MEDCouplingUMesh.buildFacePartOfMySelfNode to build mesh2D (read the Then it is possible to compute an extrusion from mesh3D and mesh2D. :: - extMesh=MEDCouplingExtrudedMesh.New(mesh3D,mesh2D,0) + extMesh=MEDCouplingMappedExtrudedMesh.New(mesh3D,mesh2D,0) Then simply request the 2nd row. :: @@ -161,14 +161,14 @@ There are 2 solutions to do that. baryXY=bary[:,[0,1]] baryXY-=[250.,150.] magn=baryXY.magnitude() - cellIds2Sol1=magn.getIdsInRange(0.,1e-12) + cellIds2Sol1=magn.findIdsInRange(0.,1e-12) -* using extrusion extMesh: starting from the unique cell in mesh2D whose center is at [250.,150.,0.] MEDCouplingExtrudedMesh.getMesh3DIds retrieves the cell IDs sorted by slice. :: +* using extrusion extMesh: starting from the unique cell in mesh2D whose center is at [250.,150.,0.] MEDCouplingMappedExtrudedMesh.getMesh3DIds retrieves the cell IDs sorted by slice. :: - bary2=mesh2D.getBarycenterAndOwner()[:,[0,1]] + bary2=mesh2D.computeCellCenterOfMass()[:,[0,1]] bary2-=[250.,150.] magn=bary2.magnitude() - ids=magn.getIdsInRange(0.,1e-12) + ids=magn.findIdsInRange(0.,1e-12) idStart=int(ids) # ids is assumed to contain only one value, if not an exception is thrown cellIds2Sol2=extMesh.getMesh3DIds()[range(idStart,mesh3D.getNumberOfCells(),mesh2D.getNumberOfCells())] @@ -185,7 +185,7 @@ This part of the exercise shows how to perform copy and aggregation. This can be Perform a deep copy of mesh3DSlice2. On this copy perform a translation v=[0.,1000.,0.]. Then aggregate mesh3DSlice2 with its translated copy, using MEDCouplingUMesh.MergeUMeshes. :: - mesh3DSlice2bis=mesh3DSlice2.deepCpy() + mesh3DSlice2bis=mesh3DSlice2.deepCopy() mesh3DSlice2bis.translate([0.,1000.,0.]) mesh3DSlice2All=MEDCouplingUMesh.MergeUMeshes([mesh3DSlice2,mesh3DSlice2bis]) @@ -203,7 +203,7 @@ A face from "mesh3DSurf" is said to be internal if and only if it is shared by m mesh3DSurf,desc,descIndx,revDesc,revDescIndx=mesh3D.buildDescendingConnectivity() numberOf3DCellSharing=revDescIndx.deltaShiftIndex() - cellIds=numberOf3DCellSharing.getIdsNotEqual(1) + cellIds=numberOf3DCellSharing.findIdsNotEqual(1) mesh3DSurfInside=mesh3DSurf[cellIds] mesh3DSurfInside.writeVTK("mesh3DSurfInside.vtu") diff --git a/doc/tutorial/medcoupling_umesh1_fr.rst b/doc/tutorial/medcoupling_umesh1_fr.rst index 74993cdc6..5555dcc5d 100644 --- a/doc/tutorial/medcoupling_umesh1_fr.rst +++ b/doc/tutorial/medcoupling_umesh1_fr.rst @@ -59,7 +59,7 @@ Faire un bon gros copier-coller des lignes suivantes pour construire la mesh (l' mesh3D.setCoords(myCoords) mesh3D.orientCorrectlyPolyhedrons() mesh3D.sortCellsInMEDFileFrmt() - mesh3D.checkCoherency() + mesh3D.checkConsistencyLight() renum = mc.DataArrayInt(60); renum[:15]=range(15,30) ; renum[15:30]=range(15) ; renum[30:45]=range(45,60) ; renum[45:]=range(30,45) mesh3D.renumberNodes(renum,60) @@ -110,22 +110,22 @@ Il y a 3 possibilités pour faire cela. Nous allons les voir du plus simple au p L'utilisation des barycentres est une technique classique pour identifier un ensemble de cellules répondant à certains critères géométriques. Il s'agit d'abord de calculer les barycentres des cellules 3D de ``mesh3D`` (méthode - ``MEDCouplingUMesh.getBarycenterAndOwner()``). + ``MEDCouplingUMesh.computeCellCenterOfMass()``). (*Note*: le nom -- un peu trop long -- de cette méthode hérite du passé. Le "AndOwner" indique le fait qu'en C++ l'appelant est responsable de la désallocation de l'objet retourné : il prend l'*ownership* du résultat). Ensuite sélectionner la composante #2 des barycentres des cellules et mettre le résultat dans ``baryZ``. Ensuite il suffit de selectionner dans ``baryZ`` les tuples qui sont dans l'intervalle ``[zLev[1], zLev[2]]``. Les identifiants de ces tuples (i.e. leur index dans ``baryZ``) est directement un identifiant de cellule - car ``getBarycenterAndOwner()`` retourne un tableau indéxé par les numéros de cellule.:: + car ``computeCellCenterOfMass()`` retourne un tableau indéxé par les numéros de cellule.:: - bary = mesh3D.getBarycenterAndOwner() + bary = mesh3D.computeCellCenterOfMass() baryZ = bary[:,2] - cellIdsSol2 = baryZ.getIdsInRange(zLev[1], zLev[2]) + cellIdsSol2 = baryZ.findIdsInRange(zLev[1], zLev[2]) -* En utilisant ``MEDCouplingExtrudedMesh`` : +* En utilisant ``MEDCouplingMappedExtrudedMesh`` : C'est la méthode exclusivement basée sur la connectivité nodale pour déduire l'extrusion. Les coordonnées sont ici ignorées. - Pour construire un ``MEDCouplingExtrudedMesh`` deux objets sont requis. Le maillage non-structuré 3D + Pour construire un ``MEDCouplingMappedExtrudedMesh`` deux objets sont requis. Le maillage non-structuré 3D représentant en fait un maillage *extrudé*, et un maillage non structuré 3D surfacique (mesh-dim 2) reposant sur les mêmes coordonnéees, à partir duquel l'extrusion sera calculée. Commencer par construire le maillage 3D surfacique. Pour ce faire il suffit de repérer les noeuds appartenant @@ -143,10 +143,10 @@ Il y a 3 possibilités pour faire cela. Nous allons les voir du plus simple au p plante. Le maillage 2D est forcément en haut ou en bas du 3D volumique, et le dernier entier spécifie la cellule à partir de laquelle le fil de fer 1D guidant l'extrusion sera construit : :: - extMesh = mc.MEDCouplingExtrudedMesh(mesh3D, mesh2D, 0) + extMesh = mc.MEDCouplingMappedExtrudedMesh(mesh3D, mesh2D, 0) On a alors la garantie que, dans ``extMesh``, les cellules sont ordonnées par niveau Z croissant. - Il suffit de récupérer le 2ème niveau (``MEDCouplingExtrudedMesh.getMesh3DIds()``). :: + Il suffit de récupérer le 2ème niveau (``MEDCouplingMappedExtrudedMesh.getMesh3DIds()``). :: n_cells = mesh2D.getNumberOfCells() cellIdsSol3 = extMesh.getMesh3DIds()[n_cells:2*n_cells] @@ -211,16 +211,16 @@ Il y a deux solutions. baryXY = bary[:,[0,1]] baryXY -= [250.,150.] magn = baryXY.magnitude() - cellIds2Sol1 = magn.getIdsInRange(0.,1e-12) + cellIds2Sol1 = magn.findIdsInRange(0.,1e-12) * utiliser le maillage extrudé ``extMesh`` : partant de l'unique cellule dans ``mesh2D`` dont le centre est - en ``[250.,150.,0.]``, la méthdode ``MEDCouplingExtrudedMesh.getMesh3DIds()`` retourne les identifiants de + en ``[250.,150.,0.]``, la méthdode ``MEDCouplingMappedExtrudedMesh.getMesh3DIds()`` retourne les identifiants de cellules rangée par rangée. :: - bary2 = mesh2D.getBarycenterAndOwner()[:,[0,1]] + bary2 = mesh2D.computeCellCenterOfMass()[:,[0,1]] bary2 -= [250.,150.] magn = bary2.magnitude() - ids = magn.getIdsInRange(0.,1e-12) + ids = magn.findIdsInRange(0.,1e-12) idStart = int(ids) # ids is assumed to contain only one value, if not an exception is thrown ze_range = range(idStart,mesh3D.getNumberOfCells(),mesh2D.getNumberOfCells()) cellIds2Sol2 = extMesh.getMesh3DIds()[ze_range] @@ -242,7 +242,7 @@ Effectuer une copie complète de ``mesh3DSlice2`` (aussi appelée *deep copy*) s Sur cette copie effectuer une translation de ``v=[0.,1000.,0.]``. Puis aggréger ``mesh3DSlice2`` avec sa copie translatée ``mesh3DSlice2bis``, en utilisant ``MEDCouplingUMesh.MergeUMeshes()``. :: - mesh3DSlice2bis = mesh3DSlice2.deepCpy() + mesh3DSlice2bis = mesh3DSlice2.deepCopy() mesh3DSlice2bis.translate([0.,1000.,0.]) mesh3DSlice2All = mc.MEDCouplingUMesh.MergeUMeshes([mesh3DSlice2,mesh3DSlice2bis]) mesh3DSlice2All.writeVTK("mesh3DSlice2All.vtu") @@ -278,7 +278,7 @@ Ce lien est exprimé au format *indirect index* vu dans le premier exercice :ref mesh3DSurf, desc, descIndx, revDesc, revDescIndx = mesh3D.buildDescendingConnectivity() numberOf3DCellSharing = revDescIndx.deltaShiftIndex() - cellIds = numberOf3DCellSharing.getIdsNotEqual(1) + cellIds = numberOf3DCellSharing.findIdsNotEqual(1) mesh3DSurfInside = mesh3DSurf[cellIds] mesh3DSurfInside.writeVTK("mesh3DSurfInside.vtu") diff --git a/doc/tutorial/medcouplingloaderex1_en.rst b/doc/tutorial/medcouplingloaderex1_en.rst index 23c825193..fa32b3975 100644 --- a/doc/tutorial/medcouplingloaderex1_en.rst +++ b/doc/tutorial/medcouplingloaderex1_en.rst @@ -47,7 +47,7 @@ only the field part having a value within [0.0, 1.0] (variable "ids"). :: fMc=f1ts.getFieldAtLevel(ON_CELLS,0) arr=fMc.getArray() arr.getMinMaxPerComponent() # just to see the variation range of the field per component - ids=arr.getIdsInRange(0.,1.) + ids=arr.findIdsInRange(0.,1.) f2Mc=fMc[ids] Using the field "PRESSION_ELEM_DOM" find the 3D pression field applied on the agitator. @@ -72,7 +72,7 @@ To achieve this use the constituting mesh MEDCouplingUMesh.buildDescendingConnec agitateurMesh3DMc=pressOnAgitateurMc.getMesh() m3DSurf,desc,descI,revDesc,revDescI=agitateurMesh3DMc.buildDescendingConnectivity() nbOf3DCellSharing=revDescI.deltaShiftIndex() - ids2=nbOf3DCellSharing.getIdsEqual(1) + ids2=nbOf3DCellSharing.findIdsEqual(1) agitateurSkinMc=m3DSurf[ids2] OffsetsOfTupleIdsInField=revDescI[ids2] tupleIdsInField=revDesc[OffsetsOfTupleIdsInField] @@ -101,7 +101,7 @@ Compute the polyhedron representing the 3D mesh hull of the agitator "agitateurM singlePolyhedron=agitateurMesh3DMc.buildSpreadZonesWithPoly() singlePolyhedron.orientCorrectlyPolyhedrons() - centerOfMass=singlePolyhedron.getBarycenterAndOwner() + centerOfMass=singlePolyhedron.computeCellCenterOfMass() .. note:: The call to MEDCouplingUMesh.orientCorrectlyPolyhedrons() is not mandatory but is recommended: if the polyhedron happens to be mis-oriented, its center of mass will @@ -111,7 +111,7 @@ Compute for each skin cell the torque with respect to the center of mass "cente To this end compute "posSkin", a DataArrayDouble giving for each skin cell the vector centerOfMass -> G, where G represents the center of mass of the current cell. :: - barySkin=agitateurSkinMc.getBarycenterAndOwner() + barySkin=agitateurSkinMc.computeCellCenterOfMass() posSkin=barySkin-centerOfMass Compute the cross product for each cell of "posSkin" using "forceVectSkin" diff --git a/doc/tutorial/medcouplingloaderex1_fr.rst b/doc/tutorial/medcouplingloaderex1_fr.rst index 9f13cc24a..52a3a7c95 100644 --- a/doc/tutorial/medcouplingloaderex1_fr.rst +++ b/doc/tutorial/medcouplingloaderex1_fr.rst @@ -47,7 +47,7 @@ de cellules correspondant dans ``ids`` : :: fMc = f1ts.getFieldAtLevel(ml.ON_CELLS,0) arr = fMc.getArray() arr.getMinMaxPerComponent() # just to see the field variation range per component - ids = arr.getIdsInRange(0.,1.) + ids = arr.findIdsInRange(0.,1.) f2Mc = fMc[ids] A l'aide du champ "PRESSION_ELEM_DOM" trouver le champ de pression 3D qu'applique l'agitateur. Mettre le résultat dans @@ -71,7 +71,7 @@ Pour ce faire passer par le maillage descendant ``MEDCouplingUMesh.buildDescendi agitateurMesh3DMc = pressOnAgitateurMc.getMesh() m3DSurf,desc,descI,revDesc,revDescI = agitateurMesh3DMc.buildDescendingConnectivity() nbOf3DCellSharing = revDescI.deltaShiftIndex() - ids2 = nbOf3DCellSharing.getIdsEqual(1) # Cells with only one neighbor are on the boundary, i.e. on the skin + ids2 = nbOf3DCellSharing.findIdsEqual(1) # Cells with only one neighbor are on the boundary, i.e. on the skin agitateurSkinMc = m3DSurf[ids2] offsetsOfTupleIdsInField = revDescI[ids2] tupleIdsInField = revDesc[offsetsOfTupleIdsInField] @@ -100,7 +100,7 @@ Calculer le polyèdre représentant l'enveloppe du maillage 3D de l'agitateur `` singlePolyhedron = agitateurMesh3DMc.buildSpreadZonesWithPoly() singlePolyhedron.orientCorrectlyPolyhedrons() - centerOfMass = singlePolyhedron.getBarycenterAndOwner() + centerOfMass = singlePolyhedron.computeCellCenterOfMass() .. note:: L'appel à ``MEDCouplingUMesh.orientCorrectlyPolyhedrons()`` n'est pas obligatoire mais conseillé car si par malheur le polyhèdre est mal orienté, son barycentre sera incorrect ! @@ -110,7 +110,7 @@ de l'agitateur. Pour ce faire calculer ``posSkin`` le ``DataArrayDouble`` donnant pour chaque cellule de la peau de l'agitateur le vecteur ``centerOfMass`` -> ``G``, avec ``G`` le barycentre de la cellule courante. :: - barySkin=agitateurSkinMc.getBarycenterAndOwner() + barySkin=agitateurSkinMc.computeCellCenterOfMass() posSkin = barySkin-centerOfMass Appliquer maintenant la formule classique de calcul du moment : calculer le produit diff --git a/doc/tutorial/medcouplingloaderex2_en.rst b/doc/tutorial/medcouplingloaderex2_en.rst index cfb29bf12..4feaa7272 100644 --- a/doc/tutorial/medcouplingloaderex2_en.rst +++ b/doc/tutorial/medcouplingloaderex2_en.rst @@ -70,17 +70,17 @@ and those have to be split into smaller linear segments to be able to represent It only take a cut fineness parameter (0.1 will suffice (angle expressed in rd)). Remember not to modify neither "fixm" nor "mobm"! :: - fixm2=fixm.deepCpy() # tessellate2D is non const - a mesh copy is required + fixm2=fixm.deepCopy() # tessellate2D is non const - a mesh copy is required fixm2.tessellate2D(0.1) fixm2.writeVTK("fixm2.vtu") - mobm2=mobm.deepCpy() + mobm2=mobm.deepCopy() mobm2.tessellate2D(0.1) mobm2.writeVTK("mobm2.vtu") Define a small method displayVTK() which we will use later on. :: def displayVTK(m,fname): - tmp=m.deepCpy() + tmp=m.deepCopy() tmp.tessellate2D(0.1) tmp.writeVTK(fname) return @@ -131,7 +131,7 @@ In partFixMob merge common nodes with a threshold of 1e-10. :: Get and display partFixm part which is not in zone1Mobm. Call this mesh partFixmWithoutZone1Mobm. :: - ids3=iMob.getIdsEqual(-1) + ids3=iMob.findIdsEqual(-1) partFixmWithoutZone1Mobm=partFixMob[ids3] displayVTK(partFixmWithoutZone1Mobm,"partFixmWithoutZone1Mobm.vtu") @@ -170,7 +170,7 @@ Now check#1. Same spirit as in check#0. :: areaZone1Mobm=zone1Mobm.getMeasureField(ON_CELLS).getArray() areaZone1Mobm.abs() val3=areaZone1Mobm.accumulate()[0] - ids4=iMob.getIdsNotEqual(-1) + ids4=iMob.findIdsNotEqual(-1) areaPartFixMob2=areaPartFixMob[ids4] val4=areaPartFixMob2.accumulate()[0] print "Check #1 %lf == %lf a 1e-8 ? %s"%(val3,val4,str(abs(val3-val4)<1e-8)) @@ -179,7 +179,7 @@ Finally check#2. :: isCheck2OK=True for icell in xrange(partFixm.getNumberOfCells()): - ids5=iPart.getIdsEqual(icell) + ids5=iPart.findIdsEqual(icell) areaOfCells=areaPartFixMob[ids5] areaOfCells.abs() if abs(areaOfCells.accumulate()[0]-areaPartFixm[icell])>1e-9: @@ -196,13 +196,13 @@ Now create a cell field on partFixMob by setting it to 0 on the part covering on part. Visualize it in a VTK file. :: f=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) - m=partFixMob.deepCpy() ; m.tessellate2D(0.1) + m=partFixMob.deepCopy() ; m.tessellate2D(0.1) f.setMesh(m) arr=DataArrayDouble(partFixMob.getNumberOfCells(),1) - arr[iMob.getIdsEqual(-1)]=0. - arr[iMob.getIdsNotEqual(-1)]=1. + arr[iMob.findIdsEqual(-1)]=0. + arr[iMob.findIdsNotEqual(-1)]=1. f.setArray(arr) - f.checkCoherency() + f.checkConsistencyLight() f.setName("Zone") MEDCouplingFieldDouble.WriteVTK("Zone.vtu",[f]) @@ -217,18 +217,18 @@ Create a cell field whose value is 0 in the zone being exclusively part of fixm, partFixMob2,iPart2,iMob2=MEDCouplingUMesh.Intersect2DMeshes(partFixm,zonesMobm,1e-10) partFixMob2.mergeNodes(1e-10) f2=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) - m2=partFixMob2.deepCpy() ; m2.tessellate2D(0.1) + m2=partFixMob2.deepCopy() ; m2.tessellate2D(0.1) f2.setMesh(m2) arr=DataArrayDouble(partFixMob2.getNumberOfCells(),1) - arr[iMob2.getIdsEqual(-1)]=0. + arr[iMob2.findIdsEqual(-1)]=0. st=0 ; end=st+len(zonesInMobm[0]) - arr[iMob2.getIdsInRange(st,end)]=1. + arr[iMob2.findIdsInRange(st,end)]=1. st+=len(zonesInMobm[0]) ; end=st+len(zonesInMobm[1]) - arr[iMob2.getIdsInRange(st,end)]=2. + arr[iMob2.findIdsInRange(st,end)]=2. st+=len(zonesInMobm[1]) ; end=st+len(zonesInMobm[2]) - arr[iMob2.getIdsInRange(st,end)]=3. + arr[iMob2.findIdsInRange(st,end)]=3. f2.setArray(arr) - f2.checkCoherency() + f2.checkConsistencyLight() f2.setName("Zone2") MEDCouplingFieldDouble.WriteVTK("Zone2.vtu",[f2]) diff --git a/doc/tutorial/medcouplingloaderex2_fr.rst b/doc/tutorial/medcouplingloaderex2_fr.rst index 9c24d45ed..51685da66 100644 --- a/doc/tutorial/medcouplingloaderex2_fr.rst +++ b/doc/tutorial/medcouplingloaderex2_fr.rst @@ -73,17 +73,17 @@ Nous voudrions visualiser ces deux maillages dans PARAVIS/ParaView, mais nous re le maillage. Nous faisons donc une copie préalable. Nous passons en paramètre la finesse de découpage (0.1 est suffisant -- angle en radian). Attention donc à ne pas modifer ni ``fixm`` ni ``mobm`` ! :: - fixm2 = fixm.deepCpy() # tessellate2D() modifies the current mesh + fixm2 = fixm.deepCopy() # tessellate2D() modifies the current mesh fixm2.tessellate2D(0.1) fixm2.writeVTK("fixm2.vtu") - mobm2 = mobm.deepCpy() + mobm2 = mobm.deepCopy() mobm2.tessellate2D(0.1) mobm2.writeVTK("mobm2.vtu") Faire une petite méthode ``displayVTK()``, faisant le travail qui nous servira souvent après. :: def displayVTK(m,fname): - tmp = m.deepCpy() + tmp = m.deepCopy() tmp.tessellate2D(0.1) tmp.writeVTK(fname) return @@ -134,7 +134,7 @@ Sur ``partFixMob`` merger les noeuds à 1e-10 près. :: Récupérer et afficher la partie de ``partFixm`` qui n'est pas dans ``zone1Mobm``. Appeler ce maillage ``partFixmWithoutZone1Mobm``. :: - ids3 = iMob.getIdsEqual(-1) + ids3 = iMob.findIdsEqual(-1) partFixmWithoutZone1Mobm = partFixMob[ids3] displayVTK(partFixmWithoutZone1Mobm,"partFixmWithoutZone1Mobm.vtu") @@ -174,7 +174,7 @@ On peut passer au **Check #1**. L'esprit est le même que le **Check #0**. :: areaZone1Mobm = zone1Mobm.getMeasureField(ml.ON_CELLS).getArray() areaZone1Mobm.abs() val3 = areaZone1Mobm.accumulate()[0] - ids4 = iMob.getIdsNotEqual(-1) + ids4 = iMob.findIdsNotEqual(-1) areaPartFixMob2 = areaPartFixMob[ids4] val4 = areaPartFixMob2.accumulate()[0] print "Check #1 %lf == %lf with precision 1e-8 ? %s" % (val3,val4,str(abs(val3-val4)<1e-8)) @@ -183,7 +183,7 @@ Puis le **Check #2**. :: isCheck2OK = True for icell in xrange(partFixm.getNumberOfCells()): - ids5 = iPart.getIdsEqual(icell) + ids5 = iPart.findIdsEqual(icell) areaOfCells = areaPartFixMob[ids5] areaOfCells.abs() if abs(areaOfCells.accumulate()[0] - areaPartFixm[icell]) > 1e-9: @@ -202,14 +202,14 @@ exclusive ``partFixm`` et 1 sur la partie couverte. Nous créons donc un champ r Le visualiser en utilisant un fichier VTK (ne pas oublier l'option *Triangulate* de ParaView). :: f = ml.MEDCouplingFieldDouble(ml.ON_CELLS,ml.ONE_TIME) - m = partFixMob.deepCpy() + m = partFixMob.deepCopy() m.tessellate2D(0.1) f.setMesh(m) arr = ml.DataArrayDouble(partFixMob.getNumberOfCells(),1) - arr[iMob.getIdsEqual(-1)] = 0. - arr[iMob.getIdsNotEqual(-1)] = 1. + arr[iMob.findIdsEqual(-1)] = 0. + arr[iMob.findIdsNotEqual(-1)] = 1. f.setArray(arr) - f.checkCoherency() + f.checkConsistencyLight() f.setName("Zone") ml.MEDCouplingFieldDouble.WriteVTK("Zone.vtu",[f]) @@ -224,22 +224,22 @@ Plus généralement prendre les zones 0, 1 et 5. Faire un champ aux cellules qui partFixMob2,iPart2,iMob2 = ml.MEDCouplingUMesh.Intersect2DMeshes(partFixm,zonesMobm,1e-10) partFixMob2.mergeNodes(1e-10) f2 = ml.MEDCouplingFieldDouble(ml.ON_CELLS, ml.ONE_TIME) - m2 = partFixMob2.deepCpy() + m2 = partFixMob2.deepCopy() m2.tessellate2D(0.1) f2.setMesh(m2) arr = ml.DataArrayDouble(partFixMob2.getNumberOfCells(),1) - arr[iMob2.getIdsEqual(-1)]=0. + arr[iMob2.findIdsEqual(-1)]=0. st = 0 end = st + len(zonesInMobm[0]) - arr[iMob2.getIdsInRange(st,end)] = 1. + arr[iMob2.findIdsInRange(st,end)] = 1. st += len(zonesInMobm[0]) ; end = st + len(zonesInMobm[1]) - arr[iMob2.getIdsInRange(st,end)] = 2. + arr[iMob2.findIdsInRange(st,end)] = 2. st += len(zonesInMobm[1]) end = st + len(zonesInMobm[2]) - arr[iMob2.getIdsInRange(st,end)] = 3. + arr[iMob2.findIdsInRange(st,end)] = 3. f2.setArray(arr) - f2.checkCoherency() + f2.checkConsistencyLight() f2.setName("Zone2") ml.MEDCouplingFieldDouble.WriteVTK("Zone2.vtu",[f2]) diff --git a/doc/tutorial/medcouplingnumpy_en.rst b/doc/tutorial/medcouplingnumpy_en.rst index a6dc90e50..ccc2911b4 100644 --- a/doc/tutorial/medcouplingnumpy_en.rst +++ b/doc/tutorial/medcouplingnumpy_en.rst @@ -169,7 +169,7 @@ l'ensemble des lignes de la matrice ``mat`` ayant exactement un élément non nu indptr = mc.DataArrayInt(mat.indptr) indptr2 = indptr.deltaShiftIndex() - cellIdsOfSkin = indptr2.getIdsEqual(1) + cellIdsOfSkin = indptr2.findIdsEqual(1) C'est presque fini. Créer le sous maillage contenant uniquement la peau et l'écrire dans un fichier VTK ou MED pour le visualiser avec ParaView. :: diff --git a/doc/tutorial/medcouplingnumpy_fr.rst b/doc/tutorial/medcouplingnumpy_fr.rst index a6dc90e50..ccc2911b4 100644 --- a/doc/tutorial/medcouplingnumpy_fr.rst +++ b/doc/tutorial/medcouplingnumpy_fr.rst @@ -169,7 +169,7 @@ l'ensemble des lignes de la matrice ``mat`` ayant exactement un élément non nu indptr = mc.DataArrayInt(mat.indptr) indptr2 = indptr.deltaShiftIndex() - cellIdsOfSkin = indptr2.getIdsEqual(1) + cellIdsOfSkin = indptr2.findIdsEqual(1) C'est presque fini. Créer le sous maillage contenant uniquement la peau et l'écrire dans un fichier VTK ou MED pour le visualiser avec ParaView. :: diff --git a/doc/tutorial/medcouplingremapper_en.rst b/doc/tutorial/medcouplingremapper_en.rst index 42e16e305..a27df2e9d 100644 --- a/doc/tutorial/medcouplingremapper_en.rst +++ b/doc/tutorial/medcouplingremapper_en.rst @@ -94,28 +94,28 @@ Apply the interpolation using MEDCouplingRemapper.transferField(): :: .. note:: An exception is raised since "srcField" hasn't got an explicitly defined nature. In what follows the impact of this attribute on the final result will be explained. -Set the nature of "srcField" to ConservativeVolumic (intensive field, e.g. a temperature). :: +Set the nature of "srcField" to IntensiveMaximum (intensive field, e.g. a temperature). :: - srcField.setNature(ConservativeVolumic) + srcField.setNature(IntensiveMaximum) trgFieldCV=remap.transferField(srcField,1e300) Check that with this nature the field integral is conserved. On the other side the sum on cells (accumulation) is NOT conserved. :: - print "ConservativeVolumic %lf == %lf"%(srcField.integral(True)[0],trgFieldCV.integral(True)[0]) - print "ConservativeVolumic %lf != %lf"%(srcField.getArray().accumulate()[0],trgFieldCV.getArray().accumulate()[0]) + print "IntensiveMaximum %lf == %lf"%(srcField.integral(True)[0],trgFieldCV.integral(True)[0]) + print "IntensiveMaximum %lf != %lf"%(srcField.getArray().accumulate()[0],trgFieldCV.getArray().accumulate()[0]) -Set the nature of "srcField" to IntegralGlobConstraint (extensive field, e.g. a power). :: +Set the nature of "srcField" to ExtensiveConservation (extensive field, e.g. a power). :: - srcField.setNature(IntegralGlobConstraint) + srcField.setNature(ExtensiveConservation) trgFieldI=remap.transferField(srcField,1e300) Check that given this nature the field integral is NOT conserved. On the other side the cumulative sum on cells is conserved. :: :: - print "IntegralGlobConstraint %lf != %lf"%(srcField.integral(True)[0],trgFieldI.integral(True)[0]) - print "IntegralGlobConstraint %lf == %lf"%(srcField.getArray().accumulate()[0],trgFieldI.getArray().accumulate()[0]) + print "ExtensiveConservation %lf != %lf"%(srcField.integral(True)[0],trgFieldI.integral(True)[0]) + print "ExtensiveConservation %lf == %lf"%(srcField.getArray().accumulate()[0],trgFieldI.getArray().accumulate()[0]) Visualize the fields using ParaViS. diff --git a/doc/tutorial/medcouplingremapper_fr.rst b/doc/tutorial/medcouplingremapper_fr.rst index 8ea9dfa2f..1cebe80df 100644 --- a/doc/tutorial/medcouplingremapper_fr.rst +++ b/doc/tutorial/medcouplingremapper_fr.rst @@ -107,40 +107,40 @@ Appliquer l'interpolation avec ``MEDCouplingRemapper.transferField()`` : :: .. note:: Une exception est envoyée car ``srcField`` n'a pas de *nature* définie. Nous allons voir dans la suite l'impact de cet attribut sur le résultat final. -Mettre la nature de ``srcField`` à ``ConservativeVolumic``. Cela signifie que le champ doit être interprété commé étant +Mettre la nature de ``srcField`` à ``IntensiveMaximum``. Cela signifie que le champ doit être interprété commé étant intensif (une température par exemple). :: - srcField.setNature(mc.ConservativeVolumic) + srcField.setNature(mc.IntensiveMaximum) trgFieldCV = remap.transferField(srcField,1e300) -Vérifier qu'avec la nature ``ConservativeVolumic``, l'intégrale du champ est conservée. Par contre, +Vérifier qu'avec la nature ``IntensiveMaximum``, l'intégrale du champ est conservée. Par contre, la somme sur les cellules (accumulation) n'est **pas** conservée ! :: integSource = srcField.integral(True)[0] integTarget = trgFieldCV.integral(True)[0] - print "ConservativeVolumic -- integrals: %lf == %lf" % (integSource, integTarget) + print "IntensiveMaximum -- integrals: %lf == %lf" % (integSource, integTarget) accSource = srcField.getArray().accumulate()[0] accTarget = trgFieldCV.getArray().accumulate()[0] - print "ConservativeVolumic -- sums: %lf != %lf" % (accSource, accTarget) + print "IntensiveMaximum -- sums: %lf != %lf" % (accSource, accTarget) -Maintenant mettre la nature de ``srcField`` à ``IntegralGlobConstraint``. Le champ doit être interprété commé étant +Maintenant mettre la nature de ``srcField`` à ``ExtensiveConservation``. Le champ doit être interprété commé étant extensif (par exemple une puissance ou un volume). :: - srcField.setNature(mc.IntegralGlobConstraint) + srcField.setNature(mc.ExtensiveConservation) trgFieldI = remap.transferField(srcField,1e300) -Vérifier qu'avec la nature ``IntegralGlobConstraint``, l'intégrale du champ n'est **pas** conservée. +Vérifier qu'avec la nature ``ExtensiveConservation``, l'intégrale du champ n'est **pas** conservée. Par contre, la somme sur les cellules est conservée. :: integSource = srcField.integral(True)[0] integTarget = trgFieldI.integral(True)[0] - print "IntegralGlobConstraint -- integrals: %lf != %lf" % (integSource, integTarget) + print "ExtensiveConservation -- integrals: %lf != %lf" % (integSource, integTarget) accSource = srcField.getArray().accumulate()[0] accTarget = trgFieldI.getArray().accumulate()[0] - print "IntegralGlobConstraint -- sums: %lf == %lf" % (accSource, accTarget) + print "ExtensiveConservation -- sums: %lf == %lf" % (accSource, accTarget) Visualiser les champs avec ParaViS, ou en les écrivant dans un fichier. diff --git a/doc/tutorial/medloader_SplitAndMerge1_en.rst b/doc/tutorial/medloader_SplitAndMerge1_en.rst index 8a2f4d0b3..72e3fac0b 100644 --- a/doc/tutorial/medloader_SplitAndMerge1_en.rst +++ b/doc/tutorial/medloader_SplitAndMerge1_en.rst @@ -86,7 +86,7 @@ In the two files "proc0.med" and "proc1.med" read the respective "CellField" wit Compare "CellField_read" and "CellField0". Problem: because of the constraint on the MED file numbering, the initial numbering has been lost. Or more exactly there is no standard way to retrieve it. This means that a call to MEDCouplingFieldDouble.isEqual() won't succeed. Let's use the method MEDCouplingFieldDouble.substractInPlaceDM() which operates a renumbering based on a given policy (see HTML doc). To this end, create a deep copy of "CellField" into "CellFieldCpy" and invoke substractInPlaceDM() on it (DM stands for "Different Meshes", contrarily to substract() which only succeeds if the fields share the same mesh). :: - CellFieldCpy=CellField.deepCpy() + CellFieldCpy=CellField.deepCopy() CellFieldCpy.substractInPlaceDM(CellField_read,10,1e-12) CellFieldCpy.getArray().abs() print CellFieldCpy.getArray().isUniform(0.,1e-12) @@ -103,7 +103,7 @@ Invoke MEDCouplingUMesh.mergeNodes() on "NodeField_read" to remove duplicate nod Make a deep copy called "NodeFieldCpy" from "NodeField" and call MEDCouplingUMesh.mergeNodes(). :: NodeField_read.mergeNodes(1e-10) - NodeFieldCpy=NodeField.deepCpy() + NodeFieldCpy=NodeField.deepCopy() NodeFieldCpy.mergeNodes(1e-10) .. note:: mergeNodes() takes two epsilons: the first classical one on the absolute distance between nodes, and the second expressing a tolerance on the values. If the field value of two nodes to be merged is bigger than this an exception is raised. @@ -170,7 +170,7 @@ MEDFileUMesh.getNonEmptyLevels() on the instance coming from "proc0.med". :: if typp==ON_CELLS: arr.renumberInPlace(o2nML[lev]) mcf=MEDCouplingFieldDouble(typp,ONE_TIME) ; mcf.setName(fieldName) ; mcf.setTime(tim,dt,it) ; mcf.setArray(arr) - mcf.setMesh(mergeMLMesh.getMeshAtLevel(lev)) ; mcf.checkCoherency() + mcf.setMesh(mergeMLMesh.getMeshAtLevel(lev)) ; mcf.checkConsistencyLight() mergeField.appendFieldNoProfileSBT(mcf) pass pass diff --git a/doc/tutorial/medloader_SplitAndMerge1_fr.rst b/doc/tutorial/medloader_SplitAndMerge1_fr.rst index 181505051..a08d860cd 100644 --- a/doc/tutorial/medloader_SplitAndMerge1_fr.rst +++ b/doc/tutorial/medloader_SplitAndMerge1_fr.rst @@ -111,7 +111,7 @@ Pour ce faire une copie profonde (*deep copy*) de ``cellField`` vers ``cellField un ``substractInPlaceDM`` (DM pour "Different Meshes", contrairement à ``substract`` qui ne marche que s'ils partagent le même maillage): :: - cellFieldCpy = cellField.deepCpy() + cellFieldCpy = cellField.deepCopy() cellFieldCpy.substractInPlaceDM(cellField_read,10,1e-12) cellFieldCpy.getArray().abs() print cellFieldCpy.getArray().isUniform(0.,1e-12) @@ -131,7 +131,7 @@ Faire une deep copy appelée ``nodeFieldCpy`` de ``nodeField`` et supprimer encore les doublons : :: nodeField_read.mergeNodes(1e-10) - nodeFieldCpy = nodeField.deepCpy() + nodeFieldCpy = nodeField.deepCopy() nodeFieldCpy.mergeNodes(1e-10) .. note:: A noter que ``mergeNodes()`` possède deux paramètres de précisions (*epsilons*), le premier, @@ -204,7 +204,7 @@ différents types géométriques : :: if typp == ml.ON_CELLS: arr.renumberInPlace(o2nML[lev]) mcf = ml.MEDCouplingFieldDouble(typp,ml.ONE_TIME) ; mcf.setName(fieldName) ; mcf.setTime(tim,dt,it) ; mcf.setArray(arr) - mcf.setMesh(mergeMLMesh.getMeshAtLevel(lev)) ; mcf.checkCoherency() + mcf.setMesh(mergeMLMesh.getMeshAtLevel(lev)) ; mcf.checkConsistencyLight() mergeField.appendFieldNoProfileSBT(mcf) pass pass diff --git a/doc/tutorial/medloader_advancedAPI1_en.rst b/doc/tutorial/medloader_advancedAPI1_en.rst index 5be2a6e8c..0b9e403ce 100644 --- a/doc/tutorial/medloader_advancedAPI1_en.rst +++ b/doc/tutorial/medloader_advancedAPI1_en.rst @@ -102,7 +102,7 @@ Creation of a simple vector field on cells called f. :: f=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME) f.setTime(5.6,7,8) - f.setArray(targetMesh.getBarycenterAndOwner()) + f.setArray(targetMesh.computeCellCenterOfMass()) f.setMesh(targetMesh) f.setName("AFieldName") diff --git a/doc/tutorial/medloader_advancedAPI1_fr.rst b/doc/tutorial/medloader_advancedAPI1_fr.rst index cad6678a5..074871f48 100644 --- a/doc/tutorial/medloader_advancedAPI1_fr.rst +++ b/doc/tutorial/medloader_advancedAPI1_fr.rst @@ -131,7 +131,7 @@ Créons un champ de vecteurs simple, aux cellules (P0), avec un seul pas de temp f = ml.MEDCouplingFieldDouble(ml.ON_CELLS, ml.ONE_TIME) f.setTime(5.6,7,8) - f.setArray(targetMesh.getBarycenterAndOwner()) + f.setArray(targetMesh.computeCellCenterOfMass()) f.setMesh(targetMesh) f.setName("AFieldName") diff --git a/doc/tutorial/medloader_basicAPI1_en.rst b/doc/tutorial/medloader_basicAPI1_en.rst index e20241881..5dc9503d5 100644 --- a/doc/tutorial/medloader_basicAPI1_en.rst +++ b/doc/tutorial/medloader_basicAPI1_en.rst @@ -58,7 +58,7 @@ Creation of a vector field "f" on cell supported by "targetMesh". :: f=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME) f.setTime(5.6,7,8) - f.setArray(targetMesh.getBarycenterAndOwner()) + f.setArray(targetMesh.computeCellCenterOfMass()) f.setMesh(targetMesh) f.setName("AFieldName") MEDLoader.WriteField("MyFirstField.med",f,True) diff --git a/doc/tutorial/medloader_basicAPI1_fr.rst b/doc/tutorial/medloader_basicAPI1_fr.rst index d542c0dc3..b92752093 100644 --- a/doc/tutorial/medloader_basicAPI1_fr.rst +++ b/doc/tutorial/medloader_basicAPI1_fr.rst @@ -70,7 +70,7 @@ fonctions de l'API se basent sur les deux derniers entiers. :: f = ml.MEDCouplingFieldDouble.New(ml.ON_CELLS, ml.ONE_TIME) f.setTime(5.6,7,8) # Declare the timestep associated to the field - f.setArray(targetMesh.getBarycenterAndOwner()) + f.setArray(targetMesh.computeCellCenterOfMass()) f.setMesh(targetMesh) f.setName("AFieldName") MEDLoader.WriteField("MyFirstField.med",f,True) diff --git a/doc/user/doxygen/Doxyfile_med_user.in b/doc/user/doxygen/Doxyfile_med_user.in index db1b3aee4..2587de8d9 100644 --- a/doc/user/doxygen/Doxyfile_med_user.in +++ b/doc/user/doxygen/Doxyfile_med_user.in @@ -138,7 +138,7 @@ FILE_PATTERNS = InterpKernelDEC.* \ MEDCouplingIMesh.* \ MEDCouplingStructuredMesh.* \ MEDCouplingCurveLinearMesh.* \ - MEDCouplingExtrudedMesh.* \ + MEDCouplingMappedExtrudedMesh.* \ MEDCouplingFieldDouble.* \ MEDCouplingField.* \ MEDCouplingNatureOfFieldEnum \ @@ -150,7 +150,7 @@ FILE_PATTERNS = InterpKernelDEC.* \ MEDCouplingCartesianAMRMesh.* \ MEDCouplingTimeLabel.* \ MEDCouplingRefCountObject.* \ - MEDCouplingAutoRefCountObjectPtr.* \ + MCAuto.* \ MEDCouplingMemArray.* \ MEDCouplingGaussLocalization.* \ MEDCouplingRemapper.* \ diff --git a/doc/user/doxygen/doxfiles/appendix/appendix.dox b/doc/user/doxygen/doxfiles/appendix/appendix.dox index b00011ba4..20de8ecc6 100644 --- a/doc/user/doxygen/doxfiles/appendix/appendix.dox +++ b/doc/user/doxygen/doxfiles/appendix/appendix.dox @@ -14,4 +14,4 @@ Implementation details: - \subpage interpkernel - \ref MPIAccess-det -*/ \ No newline at end of file +*/ diff --git a/doc/user/doxygen/doxfiles/appendix/references.dox b/doc/user/doxygen/doxfiles/appendix/references.dox index 312ec046e..d0d0a47f3 100644 --- a/doc/user/doxygen/doxfiles/appendix/references.dox +++ b/doc/user/doxygen/doxfiles/appendix/references.dox @@ -10,4 +10,4 @@ Here follows a list of useful references : -# Jeffrey Grandy, Conservative remapping and region overlays by intersecting arbitrary polyhedra, Journal of Computational Physics, vol 148, 433-466 (1999) -# F. Preparata and M. Shamos Computational Geometry. Springer-Verlag, New York, 1985 -*/ \ No newline at end of file +*/ diff --git a/doc/user/doxygen/doxfiles/examples/examples.dox b/doc/user/doxygen/doxfiles/examples/examples.dox index 29f9fa9a3..6edb60a9c 100644 --- a/doc/user/doxygen/doxfiles/examples/examples.dox +++ b/doc/user/doxygen/doxfiles/examples/examples.dox @@ -8,4 +8,4 @@ Be sure to take a look at the page \ref python-api before proceeding with the Py - \subpage medcouplingpyexamples - \subpage medcouplingcppexamples -*/ \ No newline at end of file +*/ diff --git a/doc/user/doxygen/doxfiles/faq.dox b/doc/user/doxygen/doxfiles/faq.dox index 1da276da0..1b81cb079 100644 --- a/doc/user/doxygen/doxfiles/faq.dox +++ b/doc/user/doxygen/doxfiles/faq.dox @@ -84,8 +84,8 @@ Take a look at this example: \ref medcouplingpyexamplesFieldDoubleBuild1 For starter, take a look at the \ref MEDLoaderBasicAPIPage "basic MEDLoader API". \subsubsection f-coher "How to control the validity of my mesh" -Use the methods \ref MEDCoupling::MEDCouplingUMesh::checkCoherency() "MEDCouplingUMesh::checkCoherency()" or -\ref MEDCoupling::MEDCouplingUMesh::checkCoherency1() "MEDCouplingUMesh::checkCoherency1()" +Use the methods \ref MEDCoupling::MEDCouplingUMesh::checkConsistencyLight() "MEDCouplingUMesh::checkConsistencyLight()" or +\ref MEDCoupling::MEDCouplingUMesh::checkConsistency() "MEDCouplingUMesh::checkConsistency()" \subsubsection f-groups "How can I read/write groups on a mesh" Take a look at \ref AdvMEDLoaderAPIMeshReading and \ref AdvMEDLoaderAPIMeshWriting. @@ -117,7 +117,7 @@ Re-compile in debug mode (with \c CMAKE_BUILD_TYPE=Debug), and use either valgri to spot the place where the segfault happens. The most common source of mistake is some memory mis-allocation and/or deallocation. With this respect using the auto pointer class -\ref MEDCoupling::MEDCouplingAutoRefCountObjectPtr "MEDCouplingAutoRefCountObjectPtr" +\ref MEDCoupling::MCAuto "MCAuto" can be of great help. \n @@ -171,4 +171,4 @@ can be of great help. \n -*/ \ No newline at end of file +*/ diff --git a/doc/user/doxygen/doxfiles/reference/arrays/arrays.dox b/doc/user/doxygen/doxfiles/reference/arrays/arrays.dox index 9c6e81d74..198740e51 100644 --- a/doc/user/doxygen/doxfiles/reference/arrays/arrays.dox +++ b/doc/user/doxygen/doxfiles/reference/arrays/arrays.dox @@ -118,8 +118,8 @@ like MEDCoupling::MEDCouplingFieldDouble the concept of copy (shallow or deep) i \subsection MEDCouplingArrayBasicsCopyDeep Deep copy of DataArray As for all potentially heavy memory consumer objects in \ref medcoupling "MEDCoupling", \ref MEDCoupling::DataArray "DataArrays" implement - method \c deepCpy. This method deeply copies an instance. The life cycle of the returned object is *fully* independent from the instance on which the method -\c deepCpy has been invoked. + method \c deepCopy. This method deeply copies an instance. The life cycle of the returned object is *fully* independent from the instance on which the method +\c deepCopy has been invoked. \if ENABLE_EXAMPLES \ref cpp_mcdataarray_deepcopy "Here is a C++ example."
@@ -259,17 +259,17 @@ Considering the previous warning, let's try to perform an application of functio of \c dd. \n The expression \c "a+c" will add component #0 to component #1 as seen in warning section !!!! It can appear silly, but this strategy has been chosen in order to support different set of variables. -\n \ref MEDCoupling::DataArrayDouble::applyFunc2 "applyFunc2" and \ref MEDCoupling::DataArrayDouble::applyFunc3 "applyFunc3" methods have been developed to remedy to that feature that can be surprising. -\n These two methods are explained respectively \ref MEDCouplingArrayApplyFunc2 "here for applyFunc2" and \ref MEDCouplingArrayApplyFunc3 "here for applyFunc3". +\n \ref MEDCoupling::DataArrayDouble::applyFuncCompo "applyFuncCompo" and \ref MEDCoupling::DataArrayDouble::applyFuncNamedCompo "applyFuncNamedCompo" methods have been developed to remedy to that feature that can be surprising. +\n These two methods are explained respectively \ref MEDCouplingArrayApplyFunc2 "here for applyFuncCompo" and \ref MEDCouplingArrayApplyFunc3 "here for applyFuncNamedCompo". Whatever it is possible to find a workaround using \ref MEDCoupling::DataArrayDouble::applyFunc(int,const std::string &, bool) const applyFunc with 2 parameters. \n Here is a solution to compute \c dd2 : \snippet MEDCouplingExamplesTest.py PySnippetDataArrayApplyFunc1_6 -\subsection MEDCouplingArrayApplyFunc2 applyFunc2 method +\subsection MEDCouplingArrayApplyFunc2 applyFuncCompo method -The method that implements it is \ref MEDCoupling::DataArrayDouble::applyFunc2 here. +The method that implements it is \ref MEDCoupling::DataArrayDouble::applyFuncCompo here. This method is very close to \ref MEDCouplingArrayApplyFunc1 "applyFunc method with only two parameters". @@ -283,13 +283,13 @@ To compute the sum of the first component (component #0) and the third component \snippet MEDCouplingExamplesTest.py PySnippetDataArrayApplyFunc1_8 -\subsection MEDCouplingArrayApplyFunc3 applyFunc3 method +\subsection MEDCouplingArrayApplyFunc3 applyFuncNamedCompo method -The method that implements it is \ref MEDCoupling::DataArrayDouble::applyFunc3 here. +The method that implements it is \ref MEDCoupling::DataArrayDouble::applyFuncNamedCompo here. -This method is very close to \ref MEDCouplingArrayApplyFunc1 "applyFunc method with only two parameters" and \ref MEDCouplingArrayApplyFunc2 "applyFunc2". +This method is very close to \ref MEDCouplingArrayApplyFunc1 "applyFunc method with only two parameters" and \ref MEDCouplingArrayApplyFunc2 "applyFuncCompo". -The only difference is the mapping between variables found in expression and tuple id. Rather than using rank in string sorting as in \ref MEDCouplingArrayApplyFunc1 "applyFunc method with only two parameters uses" or the component information as in \ref MEDCouplingArrayApplyFunc2 "applyFunc2", here an explicit vector is given in input. +The only difference is the mapping between variables found in expression and tuple id. Rather than using rank in string sorting as in \ref MEDCouplingArrayApplyFunc1 "applyFunc method with only two parameters uses" or the component information as in \ref MEDCouplingArrayApplyFunc2 "applyFuncCompo", here an explicit vector is given in input. Let's consider DataArrayDouble instance \c ddd constituted with 4 tuples containing each 3 components. To add first component (component #0) and the third component (component #2) simply do that : diff --git a/doc/user/doxygen/doxfiles/reference/arrays/numbering.dox b/doc/user/doxygen/doxfiles/reference/arrays/numbering.dox index 00adb9f56..602ef2b30 100644 --- a/doc/user/doxygen/doxfiles/reference/arrays/numbering.dox +++ b/doc/user/doxygen/doxfiles/reference/arrays/numbering.dox @@ -76,7 +76,7 @@ Method in new-to-old mode that works on surjective applications : - \ref MEDCoupling::DataArrayDouble::selectByTupleId "DataArrayDouble::selectByTupleId" - \ref MEDCoupling::DataArrayDouble::selectByTupleIdSafe "DataArrayDouble::selectByTupleIdSafe" -- \ref MEDCoupling::DataArrayDouble::selectByTupleId2 "DataArrayDouble::selectByTupleId2" +- \ref MEDCoupling::DataArrayDouble::selectByTupleIdSafeSlice "DataArrayDouble::selectByTupleIdSafeSlice" - \ref MEDCoupling::DataArrayDouble::selectByTupleRanges "DataArrayDouble::selectByTupleRanges" \section numbering-indirect Indirect indexing @@ -108,6 +108,6 @@ many functions, e.g.: Some functions in the API to manipulate this format: - \ref MEDCoupling::DataArrayInt::changeSurjectiveFormat "DataArrayInt::changeSurjectiveFormat" - \ref MEDCoupling::MEDCouplingUMesh::ExtractFromIndexedArrays "(static) MEDCouplingUMesh::ExtractFromIndexedArrays" -- \ref MEDCoupling::MEDCouplingUMesh::ExtractFromIndexedArrays2 "(static) MEDCouplingUMesh::ExtractFromIndexedArrays2" +- \ref MEDCoupling::MEDCouplingUMesh::ExtractFromIndexedArraysSlice "(static) MEDCouplingUMesh::ExtractFromIndexedArraysSlice" -*/ \ No newline at end of file +*/ diff --git a/doc/user/doxygen/doxfiles/reference/cpp/cpp.dox b/doc/user/doxygen/doxfiles/reference/cpp/cpp.dox index e59fc583b..1cf36efc5 100644 --- a/doc/user/doxygen/doxfiles/reference/cpp/cpp.dox +++ b/doc/user/doxygen/doxfiles/reference/cpp/cpp.dox @@ -4,7 +4,7 @@ Using the C++ API provided by MED requires you to be familiar with some specificities which are not visible to the Python user. -- \ref MEDCoupling::MEDCouplingAutoRefCountObjectPtr "MEDCouplingAutoRefCountObjectPtr" +- \ref MEDCoupling::MCAuto "MCAuto" - \subpage MEDCouplingTimeLabelPage \b Note: all the standard (sequential) MEDCoupling API lies in the \ref MEDCoupling "MEDCoupling namespace". @@ -12,7 +12,7 @@ This is quite unfortunate but due to historical reasons. The true parallel funct of the \ref library "MED library" are detailed here: \ref parallel The memory management of the various strucutres is eased by the class -\ref MEDCoupling::MEDCouplingAutoRefCountObjectPtr "MEDCouplingAutoRefCountObjectPtr". It acts as an auto pointer and takes care of deleting the +\ref MEDCoupling::MCAuto "MCAuto". It acts as an auto pointer and takes care of deleting the memory automatically when going out of scope. See an example usage in \ref cpp_mcfielddouble_WriteVTK . Beware however that not all functions return a pointer that should be deleted when going out of scope. Some methods only return an observer to the data, see for example \ref MEDCoupling::MEDCouplingPointSet::getCoords() "getCoords()". The API documentation of each method indicates whether the caller is responsible of the returned diff --git a/doc/user/doxygen/doxfiles/reference/fields/fields.dox b/doc/user/doxygen/doxfiles/reference/fields/fields.dox index 28ff75f49..fa8f8899d 100644 --- a/doc/user/doxygen/doxfiles/reference/fields/fields.dox +++ b/doc/user/doxygen/doxfiles/reference/fields/fields.dox @@ -18,4 +18,4 @@ interpolation pages: - \ref NatureOfField -*/ \ No newline at end of file +*/ diff --git a/doc/user/doxygen/doxfiles/reference/interpolation/NatureOfField.dox b/doc/user/doxygen/doxfiles/reference/interpolation/NatureOfField.dox index b005a9cc5..48cef0212 100644 --- a/doc/user/doxygen/doxfiles/reference/interpolation/NatureOfField.dox +++ b/doc/user/doxygen/doxfiles/reference/interpolation/NatureOfField.dox @@ -9,14 +9,14 @@ It has five possible values: - "NoNature", the default value, does not allow the use of any interpolation tools For intensive fields: -- \ref TableNatureOfFieldExampleConservVol "ConservativeVolumic", for intensive field with the maximum principle favored over conservativity. Relevant for temperature, pressure fields. +- \ref TableNatureOfFieldExampleConservVol "IntensiveMaximum", for intensive field with the maximum principle favored over conservativity. Relevant for temperature, pressure fields. -- \ref TableNatureOfFieldExampleRevIntegral "RevIntegral", for intensive field with the conservativity favored over maximum principle. Relevant for power density fields. +- \ref TableNatureOfFieldExampleRevIntegral "IntensiveConservation", for intensive field with the conservativity favored over maximum principle. Relevant for power density fields. For extensive fields: -- \ref TableNatureOfFieldExampleIntegral "Integral", for extensive field with the maximum principle favored over conservativity. Relevant for power fields. +- \ref TableNatureOfFieldExampleIntegral "ExtensiveMaximum", for extensive field with the maximum principle favored over conservativity. Relevant for power fields. -- \ref TableNatureOfFieldExampleIntegralGlobConstraint "IntegralGlobConstraint", for extensive fields with conservativity favored over the maximum principle. Relevant for power fields. +- \ref TableNatureOfFieldExampleIntegralGlobConstraint "ExtensiveConservation", for extensive fields with conservativity favored over the maximum principle. Relevant for power fields. \n @@ -55,7 +55,7 @@ MEDCouplingFieldDouble *sourceField=MEDLoader::ReadFieldCell(sourceFileName,"Sou const char targetFileName[]="target.med"; MEDCouplingUMesh *med_target_mesh=MEDLoader::ReadUMeshFromFile(targetFileName,"Target_Mesh",0); // -sourceField->setNature(ConservativeVolumic); +sourceField->setNature(IntensiveMaximum); ... \endcode diff --git a/doc/user/doxygen/doxfiles/reference/interpolation/interptheory.dox b/doc/user/doxygen/doxfiles/reference/interpolation/interptheory.dox index 6ac5a2014..1c09b892f 100644 --- a/doc/user/doxygen/doxfiles/reference/interpolation/interptheory.dox +++ b/doc/user/doxygen/doxfiles/reference/interpolation/interptheory.dox @@ -113,8 +113,8 @@ In the case of fields with a P0 representation (cell based) and when the meshes * * - * - * + * + * *
Intensive extensive
Conservation \f[\frac{Vol(T_i\cap S_j)}{ Vol(T_i)}\f]
\ref TableNatureOfFieldExampleRevIntegral "RevIntegral"
\f[ \frac{Vol(T_i\cap S_j)}{ \sum_{T_i} Vol(S_j\cap T_i) }\f]
\ref TableNatureOfFieldExampleIntegralGlobConstraint "IntegralGlobConstraint"
Maximum principle \f[\frac{Vol(T_i\cap S_j)}{ \sum_{S_j} Vol(T_i\cap S_j)}\f]
\ref TableNatureOfFieldExampleConservVol "ConservativeVolumic"
\f[\frac{Vol(T_i\cap S_j)}{ Vol(S_j) }\f]
\ref TableNatureOfFieldExampleIntegral "Integral"
Conservation \f[\frac{Vol(T_i\cap S_j)}{ Vol(T_i)}\f]
\ref TableNatureOfFieldExampleRevIntegral "IntensiveConservation"
\f[ \frac{Vol(T_i\cap S_j)}{ \sum_{T_i} Vol(S_j\cap T_i) }\f]
\ref TableNatureOfFieldExampleIntegralGlobConstraint "ExtensiveConservation"
Maximum principle \f[\frac{Vol(T_i\cap S_j)}{ \sum_{S_j} Vol(T_i\cap S_j)}\f]
\ref TableNatureOfFieldExampleConservVol "IntensiveMaximum"
\f[\frac{Vol(T_i\cap S_j)}{ Vol(S_j) }\f]
\ref TableNatureOfFieldExampleIntegral "ExtensiveMaximum"
\section TableNatureOfFieldExample Illustration of a non overlapping P0P0 interpolation @@ -164,12 +164,12 @@ If we apply the formula \ref TableNatureOfField "above" it leads to the followin As we can see here the maximum principle is respected.This nature of field is particularly recommended to interpolate an intensive field such as \b temperature or \b pressure. -\subsection TableNatureOfFieldExampleIntegral Integral case +\subsection TableNatureOfFieldExampleIntegral ExtensiveMaximum case -If we apply the formula \ref TableNatureOfField "above" it leads to the following \f$ M_{Integral} \f$ matrix : +If we apply the formula \ref TableNatureOfField "above" it leads to the following \f$ M_{ExtensiveMaximum} \f$ matrix : \f[ - M_{Integral}=\left[\begin{tabular}{cc} + M_{ExtensiveMaximum}=\left[\begin{tabular}{cc} $\displaystyle{\frac{0.125}{9}}$ & $\displaystyle{\frac{0.75}{3}}$ \\ \end{tabular}\right]=\left[\begin{tabular}{cc} 0.013888 & 0.25 \\ @@ -204,12 +204,12 @@ In the particular case treated \ref TableNatureOfFieldEx1 "here", it means that So from the 104 W of the source field \f$ FS \f$, only 25.055 W are transmitted in the target field using this nature of field. In order to treat differently a power field, another policy, \ref TableNatureOfFieldExampleIntegralGlobConstraint "integral global constraint nature" is available. -\subsection TableNatureOfFieldExampleIntegralGlobConstraint Integral with global constraints case +\subsection TableNatureOfFieldExampleIntegralGlobConstraint ExtensiveMaximum with global constraints case -If we apply the formula \ref TableNatureOfField "above" it leads to the following \f$ M_{IntegralGlobConstraint} \f$ matrix : +If we apply the formula \ref TableNatureOfField "above" it leads to the following \f$ M_{ExtensiveConservation} \f$ matrix : \f[ - M_{IntegralGlobConstraint}=\left[\begin{tabular}{cc} + M_{ExtensiveConservation}=\left[\begin{tabular}{cc} $\displaystyle{\frac{0.125}{0.125}}$ & ${\displaystyle\frac{0.75}{0.75}}$ \\ \end{tabular}\right]=\left[\begin{tabular}{cc} 1 & 1 \\ @@ -236,10 +236,10 @@ intercepted source cells. \subsection TableNatureOfFieldExampleRevIntegral Reverse integral case -If we apply the formula \ref TableNatureOfField "above" it leads to the following \f$ M_{RevIntegral} \f$ matrix : +If we apply the formula \ref TableNatureOfField "above" it leads to the following \f$ M_{IntensiveConservation} \f$ matrix : \f[ - M_{RevIntegral}=\left[\begin{tabular}{cc} + M_{IntensiveConservation}=\left[\begin{tabular}{cc} $\displaystyle{\frac{0.125}{1.5}}$ & $\displaystyle{\frac{0.75}{1.5}}$ \\ \end{tabular}\right]=\left[\begin{tabular}{cc} 0.083333 & 0.5 \\ diff --git a/doc/user/doxygen/doxfiles/reference/interpolation/intersec-specifics.dox b/doc/user/doxygen/doxfiles/reference/interpolation/intersec-specifics.dox index 4bbcbf129..e71739b5d 100644 --- a/doc/user/doxygen/doxfiles/reference/interpolation/intersec-specifics.dox +++ b/doc/user/doxygen/doxfiles/reference/interpolation/intersec-specifics.dox @@ -137,4 +137,4 @@ The use of the SPLIT_NODES_6 splitting policy would lead to a 6 tetrahedra decom \endverbatim -*/ \ No newline at end of file +*/ diff --git a/doc/user/doxygen/doxfiles/reference/medcoupling.dox b/doc/user/doxygen/doxfiles/reference/medcoupling.dox index 271204fb6..70d8167b3 100644 --- a/doc/user/doxygen/doxfiles/reference/medcoupling.dox +++ b/doc/user/doxygen/doxfiles/reference/medcoupling.dox @@ -36,4 +36,4 @@ The MEDCoupling also implements a set of algorithms linked to this data structur -*/ \ No newline at end of file +*/ diff --git a/doc/user/doxygen/doxfiles/reference/medloader/medloader.dox b/doc/user/doxygen/doxfiles/reference/medloader/medloader.dox index 641af911a..a0dc2e358 100644 --- a/doc/user/doxygen/doxfiles/reference/medloader/medloader.dox +++ b/doc/user/doxygen/doxfiles/reference/medloader/medloader.dox @@ -13,4 +13,4 @@ extension). More information on the MED file format itself can be found at: - \ref med-file -*/ \ No newline at end of file +*/ diff --git a/doc/user/doxygen/doxfiles/reference/meshes/MEDCouplingExtruded.dox b/doc/user/doxygen/doxfiles/reference/meshes/MEDCouplingExtruded.dox index e86b5d6f4..55a272b36 100644 --- a/doc/user/doxygen/doxfiles/reference/meshes/MEDCouplingExtruded.dox +++ b/doc/user/doxygen/doxfiles/reference/meshes/MEDCouplingExtruded.dox @@ -13,5 +13,5 @@ The advantage of this structure is that the interpolation time is highly improve This class is also useful for users that want to map the 3D unstructured mesh cell ids level by level along an axis. -The class that incarnates this concept in MEDCoupling is : \ref MEDCoupling::MEDCouplingExtrudedMesh. +The class that incarnates this concept in MEDCoupling is : \ref MEDCoupling::MEDCouplingMappedExtrudedMesh. */ diff --git a/doc/user/doxygen/doxfiles/reference/misc/misc.dox b/doc/user/doxygen/doxfiles/reference/misc/misc.dox index 111192a7a..529c6fce2 100644 --- a/doc/user/doxygen/doxfiles/reference/misc/misc.dox +++ b/doc/user/doxygen/doxfiles/reference/misc/misc.dox @@ -9,4 +9,4 @@ anywhere else in the documentation. - \subpage MEDCouplingFieldTemplatesPage -*/ \ No newline at end of file +*/ diff --git a/doc/user/doxygen/doxfiles/start/functionalities.dox b/doc/user/doxygen/doxfiles/start/functionalities.dox index 10869924c..4d3233458 100644 --- a/doc/user/doxygen/doxfiles/start/functionalities.dox +++ b/doc/user/doxygen/doxfiles/start/functionalities.dox @@ -8,7 +8,7 @@ It is by no mean exhaustive, but gives an overview of the capabilities of the co \subsection directOperations_creation Field creation - From scratch: \b New -- Copy: \b clone*, \b deepCpy +- Copy: \b clone*, \b deepCopy \subsection directOperations_modification Partial modifications - Creation: \b New, \b setMesh, \b setArray* \n diff --git a/doc/user/doxygen/doxfiles/start/python-api.dox b/doc/user/doxygen/doxfiles/start/python-api.dox index 4fddf102e..648d809c2 100644 --- a/doc/user/doxygen/doxfiles/start/python-api.dox +++ b/doc/user/doxygen/doxfiles/start/python-api.dox @@ -32,4 +32,4 @@ help(mc.DataArrayDouble.getNumberOfTuples) \endcode -*/ \ No newline at end of file +*/ diff --git a/doc/user/doxygen/doxfiles/tutorial.dox b/doc/user/doxygen/doxfiles/tutorial.dox index edf6943f9..dcedf411e 100644 --- a/doc/user/doxygen/doxfiles/tutorial.dox +++ b/doc/user/doxygen/doxfiles/tutorial.dox @@ -5,4 +5,4 @@ The %MEDCoupling/%MEDLoader Python tutorial is accessible here: - MEDCoupling tutorial -*/ \ No newline at end of file +*/ diff --git a/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx b/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx index 1a35c5a97..5eb4324aa 100644 --- a/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx +++ b/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx @@ -85,7 +85,7 @@ void LeafExprVal::replaceValues(const std::vector& valuesInExpr) _value=valuesInExpr[pos]; } -LeafExprVal *LeafExprVal::deepCpy() const +LeafExprVal *LeafExprVal::deepCopy() const { return new LeafExprVal(*this); } @@ -171,7 +171,7 @@ bool LeafExprVar::isRecognizedKeyVar(const std::string& var, int& pos) return true; } -LeafExprVar *LeafExprVar::deepCpy() const +LeafExprVar *LeafExprVar::deepCopy() const { return new LeafExprVar(*this); } @@ -201,10 +201,10 @@ void ExprParserOfEval::sortMemory() for(std::vector::iterator it=_sub_parts.begin();it!=_sub_parts.end();it++) (*it).sortMemory(); if(_leaf) - _leaf=_leaf->deepCpy(); + _leaf=_leaf->deepCopy(); for(std::vector::iterator it=_funcs.begin();it!=_funcs.end();it++) if(*it) - *it=(*it)->deepCpy(); + *it=(*it)->deepCopy(); } ExprParser::ExprParser(const std::string& expr, ExprParser *father):_father(father),_is_parsed(false),_leaf(0),_is_parsing_ok(false),_expr(expr) diff --git a/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.hxx b/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.hxx index 0b1642a14..6178c16e1 100644 --- a/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.hxx +++ b/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.hxx @@ -44,7 +44,7 @@ namespace INTERP_KERNEL INTERPKERNEL_EXPORT virtual void compileX86(std::vector& ass) const = 0; INTERPKERNEL_EXPORT virtual void compileX86_64(std::vector& ass) const = 0; INTERPKERNEL_EXPORT virtual void replaceValues(const std::vector& valuesInExpr) = 0; - INTERPKERNEL_EXPORT virtual LeafExpr *deepCpy() const = 0; + INTERPKERNEL_EXPORT virtual LeafExpr *deepCopy() const = 0; INTERPKERNEL_EXPORT static LeafExpr *buildInstanceFrom(const std::string& expr); }; @@ -58,7 +58,7 @@ namespace INTERP_KERNEL INTERPKERNEL_EXPORT void compileX86_64(std::vector& ass) const; INTERPKERNEL_EXPORT void fillValue(Value *val) const; INTERPKERNEL_EXPORT void replaceValues(const std::vector& valuesInExpr); - INTERPKERNEL_EXPORT LeafExprVal *deepCpy() const; + INTERPKERNEL_EXPORT LeafExprVal *deepCopy() const; private: double _value; }; @@ -79,7 +79,7 @@ namespace INTERP_KERNEL INTERPKERNEL_EXPORT void prepareExprEvaluationVec() const; INTERPKERNEL_EXPORT void replaceValues(const std::vector& valuesInExpr); INTERPKERNEL_EXPORT static bool isRecognizedKeyVar(const std::string& var, int& pos); - INTERPKERNEL_EXPORT LeafExprVar *deepCpy() const; + INTERPKERNEL_EXPORT LeafExprVar *deepCopy() const; public: static const char END_OF_RECOGNIZED_VAR[]; private: diff --git a/src/INTERP_KERNEL/ExprEval/InterpKernelFunction.hxx b/src/INTERP_KERNEL/ExprEval/InterpKernelFunction.hxx index 8f5cf489e..f7f83e9b7 100644 --- a/src/INTERP_KERNEL/ExprEval/InterpKernelFunction.hxx +++ b/src/INTERP_KERNEL/ExprEval/InterpKernelFunction.hxx @@ -53,7 +53,7 @@ namespace INTERP_KERNEL virtual void operateStackOfDoubleSafe(std::vector& stck) const { operateStackOfDouble(stck); } virtual const char *getRepr() const = 0; virtual bool isACall() const = 0; - virtual Function *deepCpy() const = 0; + virtual Function *deepCopy() const = 0; }; class INTERPKERNEL_EXPORT UnaryFunction : public Function @@ -71,7 +71,7 @@ namespace INTERP_KERNEL void operateStackOfDouble(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - IdentityFunction *deepCpy() const { return new IdentityFunction; } + IdentityFunction *deepCopy() const { return new IdentityFunction; } public: static const char REPR[]; }; @@ -85,7 +85,7 @@ namespace INTERP_KERNEL void operateStackOfDouble(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - PositiveFunction *deepCpy() const { return new PositiveFunction; } + PositiveFunction *deepCopy() const { return new PositiveFunction; } public: static const char REPR[]; }; @@ -99,7 +99,7 @@ namespace INTERP_KERNEL void operateStackOfDouble(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - NegateFunction *deepCpy() const { return new NegateFunction; } + NegateFunction *deepCopy() const { return new NegateFunction; } public: static const char REPR[]; }; @@ -113,7 +113,7 @@ namespace INTERP_KERNEL void operateStackOfDouble(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - CosFunction *deepCpy() const { return new CosFunction; } + CosFunction *deepCopy() const { return new CosFunction; } public: static const char REPR[]; }; @@ -127,7 +127,7 @@ namespace INTERP_KERNEL void operateStackOfDouble(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - SinFunction *deepCpy() const { return new SinFunction; } + SinFunction *deepCopy() const { return new SinFunction; } public: static const char REPR[]; }; @@ -141,7 +141,7 @@ namespace INTERP_KERNEL void operateStackOfDouble(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - TanFunction *deepCpy() const { return new TanFunction; } + TanFunction *deepCopy() const { return new TanFunction; } public: static const char REPR[]; }; @@ -156,7 +156,7 @@ namespace INTERP_KERNEL void operateStackOfDoubleSafe(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - ACosFunction *deepCpy() const { return new ACosFunction; } + ACosFunction *deepCopy() const { return new ACosFunction; } public: static const char REPR[]; }; @@ -171,7 +171,7 @@ namespace INTERP_KERNEL void operateStackOfDoubleSafe(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - ASinFunction *deepCpy() const { return new ASinFunction; } + ASinFunction *deepCopy() const { return new ASinFunction; } public: static const char REPR[]; }; @@ -185,7 +185,7 @@ namespace INTERP_KERNEL void operateStackOfDouble(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - ATanFunction *deepCpy() const { return new ATanFunction; } + ATanFunction *deepCopy() const { return new ATanFunction; } public: static const char REPR[]; }; @@ -199,7 +199,7 @@ namespace INTERP_KERNEL void operateStackOfDouble(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - CoshFunction *deepCpy() const { return new CoshFunction; } + CoshFunction *deepCopy() const { return new CoshFunction; } public: static const char REPR[]; }; @@ -213,7 +213,7 @@ namespace INTERP_KERNEL void operateStackOfDouble(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - SinhFunction *deepCpy() const { return new SinhFunction; } + SinhFunction *deepCopy() const { return new SinhFunction; } public: static const char REPR[]; }; @@ -227,7 +227,7 @@ namespace INTERP_KERNEL void operateStackOfDouble(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - TanhFunction *deepCpy() const { return new TanhFunction; } + TanhFunction *deepCopy() const { return new TanhFunction; } public: static const char REPR[]; }; @@ -242,7 +242,7 @@ namespace INTERP_KERNEL void operateStackOfDoubleSafe(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - SqrtFunction *deepCpy() const { return new SqrtFunction; } + SqrtFunction *deepCopy() const { return new SqrtFunction; } public: static const char REPR[]; }; @@ -256,7 +256,7 @@ namespace INTERP_KERNEL void operateStackOfDouble(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - AbsFunction *deepCpy() const { return new AbsFunction; } + AbsFunction *deepCopy() const { return new AbsFunction; } public: static const char REPR[]; }; @@ -270,7 +270,7 @@ namespace INTERP_KERNEL void operateStackOfDouble(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - ExpFunction *deepCpy() const { return new ExpFunction; } + ExpFunction *deepCopy() const { return new ExpFunction; } public: static const char REPR[]; }; @@ -285,7 +285,7 @@ namespace INTERP_KERNEL void operateStackOfDoubleSafe(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - LnFunction *deepCpy() const { return new LnFunction; } + LnFunction *deepCopy() const { return new LnFunction; } public: static const char REPR[]; }; @@ -300,7 +300,7 @@ namespace INTERP_KERNEL void operateStackOfDoubleSafe(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - LogFunction *deepCpy() const { return new LogFunction; } + LogFunction *deepCopy() const { return new LogFunction; } public: static const char REPR[]; }; @@ -315,7 +315,7 @@ namespace INTERP_KERNEL void operateStackOfDoubleSafe(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - Log10Function *deepCpy() const { return new Log10Function; } + Log10Function *deepCopy() const { return new Log10Function; } public: static const char REPR[]; }; @@ -335,7 +335,7 @@ namespace INTERP_KERNEL void operateStackOfDouble(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - PlusFunction *deepCpy() const { return new PlusFunction; } + PlusFunction *deepCopy() const { return new PlusFunction; } public: static const char REPR[]; }; @@ -349,7 +349,7 @@ namespace INTERP_KERNEL void operateStackOfDouble(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - MinusFunction *deepCpy() const { return new MinusFunction; } + MinusFunction *deepCopy() const { return new MinusFunction; } public: static const char REPR[]; }; @@ -363,7 +363,7 @@ namespace INTERP_KERNEL void operateStackOfDouble(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - MultFunction *deepCpy() const { return new MultFunction; } + MultFunction *deepCopy() const { return new MultFunction; } public: static const char REPR[]; }; @@ -378,7 +378,7 @@ namespace INTERP_KERNEL void operateStackOfDoubleSafe(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - DivFunction *deepCpy() const { return new DivFunction; } + DivFunction *deepCopy() const { return new DivFunction; } public: static const char REPR[]; }; @@ -393,7 +393,7 @@ namespace INTERP_KERNEL void operateStackOfDoubleSafe(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - PowFunction *deepCpy() const { return new PowFunction; } + PowFunction *deepCopy() const { return new PowFunction; } public: static const char REPR[]; }; @@ -407,7 +407,7 @@ namespace INTERP_KERNEL void operateStackOfDouble(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - MaxFunction *deepCpy() const { return new MaxFunction; } + MaxFunction *deepCopy() const { return new MaxFunction; } public: static const char REPR[]; }; @@ -421,7 +421,7 @@ namespace INTERP_KERNEL void operateStackOfDouble(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - MinFunction *deepCpy() const { return new MinFunction; } + MinFunction *deepCopy() const { return new MinFunction; } public: static const char REPR[]; }; @@ -435,7 +435,7 @@ namespace INTERP_KERNEL void operateStackOfDouble(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - GreaterThanFunction *deepCpy() const { return new GreaterThanFunction; } + GreaterThanFunction *deepCopy() const { return new GreaterThanFunction; } public: static const char REPR[]; }; @@ -449,7 +449,7 @@ namespace INTERP_KERNEL void operateStackOfDouble(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - LowerThanFunction *deepCpy() const { return new LowerThanFunction; } + LowerThanFunction *deepCopy() const { return new LowerThanFunction; } public: static const char REPR[]; }; @@ -470,7 +470,7 @@ namespace INTERP_KERNEL void operateStackOfDoubleSafe(std::vector& stck) const; const char *getRepr() const; bool isACall() const; - IfFunction *deepCpy() const { return new IfFunction; } + IfFunction *deepCopy() const { return new IfFunction; } public: static const char REPR[]; }; diff --git a/src/INTERP_KERNELTest/Interpolation3DTest.cxx b/src/INTERP_KERNELTest/Interpolation3DTest.cxx index 54f9709f7..f9bc93df1 100644 --- a/src/INTERP_KERNELTest/Interpolation3DTest.cxx +++ b/src/INTERP_KERNELTest/Interpolation3DTest.cxx @@ -73,7 +73,7 @@ double Interpolation3DTest::sumCol(const IntersectionMatrix& m, int i) const void Interpolation3DTest::getVolumes(MEDCoupling::MEDCouplingUMesh& mesh, double *tab) const { - MEDCouplingAutoRefCountObjectPtr vol=mesh->getMeasureField(true); + MCAuto vol=mesh->getMeasureField(true); std::copy(vol->getArray()->begin(),vol->getArray()->end(),tab); } diff --git a/src/INTERP_KERNELTest/MEDMeshMaker.cxx b/src/INTERP_KERNELTest/MEDMeshMaker.cxx index cbb9a91f4..f7cb5bcb7 100644 --- a/src/INTERP_KERNELTest/MEDMeshMaker.cxx +++ b/src/INTERP_KERNELTest/MEDMeshMaker.cxx @@ -17,7 +17,7 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "MEDCouplingCMesh.hxx" #include "MEDMeshMaker.hxx" @@ -26,8 +26,8 @@ using namespace MEDCoupling; MEDCoupling::MEDCouplingUMesh *MEDMeshMaker(int dim, int nbedge) { - MEDCouplingAutoRefCountObjectPtr c=MEDCouplingCMesh::New(); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::New(); + MCAuto c=MEDCouplingCMesh::New(); + MCAuto arr=DataArrayDouble::New(); arr->alloc(nbedge+1,1); arr->iota(0.); arr->applyLin(1./double(nbedge),0.); switch(dim) { diff --git a/src/INTERP_KERNELTest/MeshTestToolkit.txx b/src/INTERP_KERNELTest/MeshTestToolkit.txx index 0256d65fa..d263cc8a0 100644 --- a/src/INTERP_KERNELTest/MeshTestToolkit.txx +++ b/src/INTERP_KERNELTest/MeshTestToolkit.txx @@ -106,7 +106,7 @@ namespace INTERP_TEST template void MeshTestToolkit::getVolumes(MEDCoupling::MEDCouplingUMesh& mesh, double *tab) const { - MEDCouplingAutoRefCountObjectPtr vol=mesh.getMeasureField(true); + MCAuto vol=mesh.getMeasureField(true); std::copy(vol->getArray()->begin(),vol->getArray()->end(),tab); } @@ -347,12 +347,12 @@ namespace INTERP_TEST LOG(1, std::endl << "=== -> intersecting src = " << mesh1path << ", target = " << mesh2path ); LOG(5, "Loading " << mesh1 << " from " << mesh1path); - MEDCouplingAutoRefCountObjectPtr sMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh1path).c_str(),mesh1); - MEDCouplingAutoRefCountObjectPtr sMesh=sMeshML->getMeshAtLevel(0); + MCAuto sMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh1path).c_str(),mesh1); + MCAuto sMesh=sMeshML->getMeshAtLevel(0); LOG(5, "Loading " << mesh2 << " from " << mesh2path); - MEDCouplingAutoRefCountObjectPtr tMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh2path).c_str(),mesh2); - MEDCouplingAutoRefCountObjectPtr tMesh=tMeshML->getMeshAtLevel(0); + MCAuto tMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh2path).c_str(),mesh2); + MCAuto tMesh=tMeshML->getMeshAtLevel(0); MEDCouplingNormalizedUnstructuredMesh sMesh_wrapper(sMesh); MEDCouplingNormalizedUnstructuredMesh tMesh_wrapper(tMesh); diff --git a/src/INTERP_KERNELTest/PerfTest.cxx b/src/INTERP_KERNELTest/PerfTest.cxx index be60bcb0d..4309df0ab 100644 --- a/src/INTERP_KERNELTest/PerfTest.cxx +++ b/src/INTERP_KERNELTest/PerfTest.cxx @@ -67,13 +67,13 @@ namespace INTERP_TEST LOG(1, std::endl << "=== -> intersecting src = " << mesh1 << ", target = " << mesh2 ); LOG(5, "Loading " << mesh1 << " from " << mesh1path); - MEDCouplingAutoRefCountObjectPtr sMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh1path).c_str(),mesh1); - MEDCouplingAutoRefCountObjectPtr sMesh=sMeshML->getMeshAtLevel(0); + MCAuto sMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh1path).c_str(),mesh1); + MCAuto sMesh=sMeshML->getMeshAtLevel(0); LOG(5, "Loading " << mesh2 << " from " << mesh2path); - MEDCouplingAutoRefCountObjectPtr tMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh2path).c_str(),mesh2); - MEDCouplingAutoRefCountObjectPtr tMesh=tMeshML->getMeshAtLevel(0); + MCAuto tMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh2path).c_str(),mesh2); + MCAuto tMesh=tMeshML->getMeshAtLevel(0); MEDCouplingNormalizedUnstructuredMesh<3,3> sMesh_wrapper(sMesh); MEDCouplingNormalizedUnstructuredMesh<3,3> tMesh_wrapper(tMesh); diff --git a/src/INTERP_KERNELTest/ThreeDSurfProjectionTest.cxx b/src/INTERP_KERNELTest/ThreeDSurfProjectionTest.cxx index 2a84b503a..5767d9d37 100644 --- a/src/INTERP_KERNELTest/ThreeDSurfProjectionTest.cxx +++ b/src/INTERP_KERNELTest/ThreeDSurfProjectionTest.cxx @@ -83,7 +83,7 @@ void INTERP_TEST::ThreeDSurfProjectionTest::test1() void INTERP_TEST::ThreeDSurfProjectionTest::test2() {// here the two triangles have their center of inertia very close (eps) but the angle between the two planes is "big" //coo=DataArrayDouble([0.,0.,0.,1.,0.,0.,0.,1.,0.],3,3) - //coocpy=coo.deepCpy() + //coocpy=coo.deepCopy() //MEDCouplingPointSet.Rotate3DAlg([0.,0.,0.],[-1,-1.,0.],pi/3,coocpy) //coocpy+=[eps*sqrt(3)/2,eps/2,eps*0.] // diff --git a/src/MEDCoupling/CMakeLists.txt b/src/MEDCoupling/CMakeLists.txt index ec1570ace..8faedff2e 100644 --- a/src/MEDCoupling/CMakeLists.txt +++ b/src/MEDCoupling/CMakeLists.txt @@ -48,7 +48,7 @@ SET(medcoupling_SOURCES MEDCouplingRefCountObject.cxx MEDCouplingPointSet.cxx MEDCouplingFieldTemplate.cxx - MEDCouplingExtrudedMesh.cxx + MEDCouplingMappedExtrudedMesh.cxx MEDCouplingMesh.cxx MEDCouplingGaussLocalization.cxx MEDCouplingNatureOfField.cxx diff --git a/src/MEDCoupling/MCAuto.hxx b/src/MEDCoupling/MCAuto.hxx new file mode 100644 index 000000000..e7b2b65d4 --- /dev/null +++ b/src/MEDCoupling/MCAuto.hxx @@ -0,0 +1,79 @@ +// 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, 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 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : Anthony Geay (CEA/DEN) + +#ifndef __PARAMEDMEM_MEDCOUPLINGAUTOREFCOUNTOBJECTPTR_HXX__ +#define __PARAMEDMEM_MEDCOUPLINGAUTOREFCOUNTOBJECTPTR_HXX__ + +#include "MEDCouplingRefCountObject.hxx" +#include "InterpKernelException.hxx" + +namespace MEDCoupling +{ + template + class MCAuto + { + public: + MCAuto(const MCAuto& other):_ptr(0) { referPtr(other._ptr); } + MCAuto(T *ptr=0):_ptr(ptr) { } + ~MCAuto() { destroyPtr(); } + bool operator==(const MCAuto& other) const { return _ptr==other._ptr; } + bool operator==(const T *other) const { return _ptr==other; } + MCAuto &operator=(const MCAuto& other) { if(_ptr!=other._ptr) { destroyPtr(); referPtr(other._ptr); } return *this; } + MCAuto &operator=(T *ptr) { if(_ptr!=ptr) { destroyPtr(); _ptr=ptr; } return *this; } + T *operator->() { return _ptr ; } + const T *operator->() const { return _ptr; } + T& operator*() { return *_ptr; } + const T& operator*() const { return *_ptr; } + operator T *() { return _ptr; } + operator const T *() const { return _ptr; } + T *retn() { if(_ptr) _ptr->incrRef(); return _ptr; } + private: + void referPtr(T *ptr) { _ptr=ptr; if(_ptr) _ptr->incrRef(); } + void destroyPtr() { if(_ptr) _ptr->decrRef(); } + private: + T *_ptr; + }; + + template + typename MEDCoupling::MCAuto DynamicCast(typename MEDCoupling::MCAuto& autoSubPtr) throw() + { + T *subPtr(autoSubPtr); + U *ptr(dynamic_cast(subPtr)); + typename MEDCoupling::MCAuto ret(ptr); + if(ptr) + ptr->incrRef(); + return ret; + } + + template + typename MEDCoupling::MCAuto DynamicCastSafe(typename MEDCoupling::MCAuto& autoSubPtr) + { + T *subPtr(autoSubPtr); + U *ptr(dynamic_cast(subPtr)); + if(subPtr && !ptr) + throw INTERP_KERNEL::Exception("DynamicCastSafe : U is not a subtype of T !"); + typename MEDCoupling::MCAuto ret(ptr); + if(ptr) + ptr->incrRef(); + return ret; + } +} + +#endif diff --git a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx index e92d045b0..5dafba902 100644 --- a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx +++ b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx @@ -95,7 +95,7 @@ int MEDCoupling1GTUMesh::getMeshDimension() const */ DataArrayInt *MEDCoupling1GTUMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const { - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); if(type==getCellModelEnum()) ret->alloc(getNumberOfCells(),1); else @@ -187,7 +187,7 @@ void MEDCoupling1GTUMesh::splitProfilePerType(const DataArrayInt *profile, std:: code.resize(3); idsInPflPerType.resize(1); code[0]=(int)getCellModelEnum(); code[1]=nbTuples; idsInPflPerType.resize(1); - if(profile->isIdentity2(nbOfCells)) + if(profile->isIota(nbOfCells)) { code[2]=-1; idsInPflPerType[0]=const_cast(profile); idsInPflPerType[0]->incrRef(); @@ -243,7 +243,7 @@ DataArrayInt *MEDCoupling1GTUMesh::checkTypeConsistencyAndContig(const std::vect void MEDCoupling1GTUMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const { - MEDCouplingAutoRefCountObjectPtr m=buildUnstructured(); + MCAuto m=buildUnstructured(); m->writeVTKLL(ofs,cellData,pointData,byteData); } @@ -296,30 +296,30 @@ bool MEDCoupling1GTUMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *ot return true; } -void MEDCoupling1GTUMesh::checkCoherency() const +void MEDCoupling1GTUMesh::checkConsistencyLight() const { - MEDCouplingPointSet::checkCoherency(); + MEDCouplingPointSet::checkConsistencyLight(); } -DataArrayDouble *MEDCoupling1GTUMesh::getBarycenterAndOwner() const +DataArrayDouble *MEDCoupling1GTUMesh::computeCellCenterOfMass() const { - MEDCouplingAutoRefCountObjectPtr m=buildUnstructured(); - MEDCouplingAutoRefCountObjectPtr ret=m->getBarycenterAndOwner(); + MCAuto m=buildUnstructured(); + MCAuto ret=m->computeCellCenterOfMass(); return ret.retn(); } MEDCouplingFieldDouble *MEDCoupling1GTUMesh::getMeasureField(bool isAbs) const { - MEDCouplingAutoRefCountObjectPtr m=buildUnstructured(); - MEDCouplingAutoRefCountObjectPtr ret=m->getMeasureField(isAbs); + MCAuto m=buildUnstructured(); + MCAuto ret=m->getMeasureField(isAbs); ret->setMesh(this); return ret.retn(); } MEDCouplingFieldDouble *MEDCoupling1GTUMesh::getMeasureFieldOnNode(bool isAbs) const { - MEDCouplingAutoRefCountObjectPtr m=buildUnstructured(); - MEDCouplingAutoRefCountObjectPtr ret=m->getMeasureFieldOnNode(isAbs); + MCAuto m=buildUnstructured(); + MCAuto ret=m->getMeasureFieldOnNode(isAbs); ret->setMesh(this); return ret.retn(); } @@ -329,51 +329,51 @@ MEDCouplingFieldDouble *MEDCoupling1GTUMesh::getMeasureFieldOnNode(bool isAbs) c */ int MEDCoupling1GTUMesh::getCellContainingPoint(const double *pos, double eps) const { - MEDCouplingAutoRefCountObjectPtr m=buildUnstructured(); + MCAuto m=buildUnstructured(); return m->getCellContainingPoint(pos,eps); } MEDCouplingFieldDouble *MEDCoupling1GTUMesh::buildOrthogonalField() const { - MEDCouplingAutoRefCountObjectPtr m=buildUnstructured(); - MEDCouplingAutoRefCountObjectPtr ret=m->buildOrthogonalField(); + MCAuto m=buildUnstructured(); + MCAuto ret=m->buildOrthogonalField(); ret->setMesh(this); return ret.retn(); } DataArrayInt *MEDCoupling1GTUMesh::getCellsInBoundingBox(const double *bbox, double eps) const { - MEDCouplingAutoRefCountObjectPtr m=buildUnstructured(); + MCAuto m=buildUnstructured(); return m->getCellsInBoundingBox(bbox,eps); } DataArrayInt *MEDCoupling1GTUMesh::getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) { - MEDCouplingAutoRefCountObjectPtr m=buildUnstructured(); + MCAuto m=buildUnstructured(); return m->getCellsInBoundingBox(bbox,eps); } MEDCouplingPointSet *MEDCoupling1GTUMesh::buildFacePartOfMySelfNode(const int *start, const int *end, bool fullyIn) const { - MEDCouplingAutoRefCountObjectPtr m=buildUnstructured(); + MCAuto m=buildUnstructured(); return m->buildFacePartOfMySelfNode(start,end,fullyIn); } DataArrayInt *MEDCoupling1GTUMesh::findBoundaryNodes() const { - MEDCouplingAutoRefCountObjectPtr m=buildUnstructured(); + MCAuto m=buildUnstructured(); return m->findBoundaryNodes(); } MEDCouplingPointSet *MEDCoupling1GTUMesh::buildBoundaryMesh(bool keepCoords) const { - MEDCouplingAutoRefCountObjectPtr m=buildUnstructured(); + MCAuto m=buildUnstructured(); return m->buildBoundaryMesh(keepCoords); } void MEDCoupling1GTUMesh::findCommonCells(int compType, int startCellId, DataArrayInt *& commonCellsArr, DataArrayInt *& commonCellsIArr) const { - MEDCouplingAutoRefCountObjectPtr m=buildUnstructured(); + MCAuto m=buildUnstructured(); m->findCommonCells(compType,startCellId,commonCellsArr,commonCellsIArr); } @@ -411,7 +411,7 @@ MEDCouplingUMesh *MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(const std::v throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh : the first instance in input parts is null !"); const DataArrayDouble *coords(firstPart->getCoords()); int meshDim(firstPart->getMeshDimension()); - MEDCouplingAutoRefCountObjectPtr ret(MEDCouplingUMesh::New(firstPart->getName(),meshDim)); ret->setDescription(firstPart->getDescription()); + MCAuto ret(MEDCouplingUMesh::New(firstPart->getName(),meshDim)); ret->setDescription(firstPart->getDescription()); ret->setCoords(coords); int nbOfCells(0),connSize(0); for(std::vector< const MEDCoupling1GTUMesh *>::const_iterator it=parts.begin();it!=parts.end();it++) @@ -425,7 +425,7 @@ MEDCouplingUMesh *MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(const std::v nbOfCells+=(*it)->getNumberOfCells(); connSize+=(*it)->getNodalConnectivityLength(); } - MEDCouplingAutoRefCountObjectPtr conn(DataArrayInt::New()),connI(DataArrayInt::New()); + MCAuto conn(DataArrayInt::New()),connI(DataArrayInt::New()); connI->alloc(nbOfCells+1,1); conn->alloc(connSize+nbOfCells,1); int *c(conn->getPointer()),*ci(connI->getPointer()); *ci=0; for(std::vector< const MEDCoupling1GTUMesh *>::const_iterator it=parts.begin();it!=parts.end();it++) @@ -470,7 +470,7 @@ MEDCoupling1SGTUMesh::MEDCoupling1SGTUMesh(const MEDCoupling1SGTUMesh& other, bo { const DataArrayInt *c(other._conn); if(c) - _conn=c->deepCpy(); + _conn=c->deepCopy(); } } @@ -508,11 +508,11 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::New(const MEDCouplingUMesh *m) if(gts.size()!=1) throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::New : input mesh must have exactly one geometric type !"); int geoType((int)*gts.begin()); - MEDCouplingAutoRefCountObjectPtr ret(MEDCoupling1SGTUMesh::New(m->getName(),*gts.begin())); + MCAuto ret(MEDCoupling1SGTUMesh::New(m->getName(),*gts.begin())); ret->setCoords(m->getCoords()); ret->setDescription(m->getDescription()); int nbCells(m->getNumberOfCells()); int nbOfNodesPerCell(ret->getNumberOfNodesPerCell()); - MEDCouplingAutoRefCountObjectPtr conn(DataArrayInt::New()); conn->alloc(nbCells*nbOfNodesPerCell,1); + MCAuto conn(DataArrayInt::New()); conn->alloc(nbCells*nbOfNodesPerCell,1); int *c(conn->getPointer()); const int *cin(m->getNodalConnectivity()->begin()),*ciin(m->getNodalConnectivityIndex()->begin()); for(int i=0;i ret(clone(false)); - MEDCouplingAutoRefCountObjectPtr c(_conn->deepCpy()); + checkConsistencyLight(); + MCAuto ret(clone(false)); + MCAuto c(_conn->deepCopy()); ret->setNodalConnectivity(c); return ret.retn(); } @@ -591,7 +591,7 @@ std::vector MEDCoupling1SGTUMesh::getDirectChildrenWith return ret; } -MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::deepCpy() const +MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::deepCopy() const { return clone(true); } @@ -644,7 +644,7 @@ bool MEDCoupling1SGTUMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *o return true; } -void MEDCoupling1SGTUMesh::checkCoherencyOfConnectivity() const +void MEDCoupling1SGTUMesh::checkConsistencyOfConnectivity() const { const DataArrayInt *c1(_conn); if(c1) @@ -659,21 +659,21 @@ void MEDCoupling1SGTUMesh::checkCoherencyOfConnectivity() const throw INTERP_KERNEL::Exception("Nodal connectivity array not defined !"); } -void MEDCoupling1SGTUMesh::checkCoherency() const +void MEDCoupling1SGTUMesh::checkConsistencyLight() const { - MEDCouplingPointSet::checkCoherency(); - checkCoherencyOfConnectivity(); + MEDCouplingPointSet::checkConsistencyLight(); + checkConsistencyOfConnectivity(); } -void MEDCoupling1SGTUMesh::checkCoherency1(double eps) const +void MEDCoupling1SGTUMesh::checkConsistency(double eps) const { - checkCoherency(); + checkConsistencyLight(); const DataArrayInt *c1(_conn); int nbOfTuples=c1->getNumberOfTuples(); int nbOfNodesPerCell=(int)_cm->getNumberOfNodes(); if(nbOfTuples%nbOfNodesPerCell!=0) { - std::ostringstream oss; oss << "MEDCoupling1SGTUMesh::checkCoherency1 : the nb of tuples in conn is " << nbOfTuples << " and number of nodes per cell is " << nbOfNodesPerCell << ". But " << nbOfTuples << "%" << nbOfNodesPerCell << " !=0 !"; + std::ostringstream oss; oss << "MEDCoupling1SGTUMesh::checkConsistency : the nb of tuples in conn is " << nbOfTuples << " and number of nodes per cell is " << nbOfNodesPerCell << ". But " << nbOfTuples << "%" << nbOfNodesPerCell << " !=0 !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } int nbOfNodes=getNumberOfNodes(); @@ -716,7 +716,7 @@ int MEDCoupling1SGTUMesh::getNumberOfNodesPerCell() const DataArrayInt *MEDCoupling1SGTUMesh::computeNbOfNodesPerCell() const { checkNonDynamicGeoType(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(getNumberOfCells(),1); ret->fillWithValue((int)_cm->getNumberOfNodes()); return ret.retn(); @@ -725,7 +725,7 @@ DataArrayInt *MEDCoupling1SGTUMesh::computeNbOfNodesPerCell() const DataArrayInt *MEDCoupling1SGTUMesh::computeNbOfFacesPerCell() const { checkNonDynamicGeoType(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(getNumberOfCells(),1); ret->fillWithValue((int)_cm->getNumberOfSons()); return ret.retn(); @@ -734,7 +734,7 @@ DataArrayInt *MEDCoupling1SGTUMesh::computeNbOfFacesPerCell() const DataArrayInt *MEDCoupling1SGTUMesh::computeEffectiveNbOfNodesPerCell() const { checkNonDynamicGeoType(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); int nbCells(getNumberOfCells()); ret->alloc(nbCells,1); int *retPtr(ret->getPointer()); @@ -852,9 +852,9 @@ std::string MEDCoupling1SGTUMesh::advancedRepr() const DataArrayDouble *MEDCoupling1SGTUMesh::computeIsoBarycenterOfNodesPerCell() const { - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); int spaceDim=getSpaceDimension(); - int nbOfCells=getNumberOfCells();//checkCoherency() + int nbOfCells=getNumberOfCells();//checkConsistencyLight() int nbOfNodes=getNumberOfNodes(); ret->alloc(nbOfCells,spaceDim); double *ptToFill=ret->getPointer(); @@ -881,15 +881,15 @@ DataArrayDouble *MEDCoupling1SGTUMesh::computeIsoBarycenterOfNodesPerCell() cons void MEDCoupling1SGTUMesh::renumberCells(const int *old2NewBg, bool check) { int nbCells=getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr o2n=DataArrayInt::New(); + MCAuto o2n=DataArrayInt::New(); o2n->useArray(old2NewBg,false,C_DEALLOC,nbCells,1); if(check) o2n=o2n->checkAndPreparePermutation(); // const int *conn=_conn->begin(); - MEDCouplingAutoRefCountObjectPtr n2o=o2n->invertArrayO2N2N2O(nbCells); + MCAuto n2o=o2n->invertArrayO2N2N2O(nbCells); const int *n2oPtr=n2o->begin(); - MEDCouplingAutoRefCountObjectPtr newConn=DataArrayInt::New(); + MCAuto newConn=DataArrayInt::New(); newConn->alloc(_conn->getNumberOfTuples(),1); newConn->copyStringInfoFrom(*_conn); int sz=getNumberOfNodesPerCell(); @@ -917,7 +917,7 @@ void MEDCoupling1SGTUMesh::renumberCells(const int *old2NewBg, bool check) void MEDCoupling1SGTUMesh::fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, DataArrayInt *&cellIdsKeptArr) const { int nbOfCells=getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr cellIdsKept=DataArrayInt::New(); cellIdsKept->alloc(0,1); + MCAuto cellIdsKept=DataArrayInt::New(); cellIdsKept->alloc(0,1); int tmp=-1; int sz=_conn->getMaxValue(tmp); sz=std::max(sz,0)+1; std::vector fastFinder(sz,false); @@ -952,20 +952,20 @@ MEDCouplingMesh *MEDCoupling1SGTUMesh::mergeMyselfWith(const MEDCouplingMesh *ot MEDCouplingUMesh *MEDCoupling1SGTUMesh::buildUnstructured() const { - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingUMesh::New(getName(),getMeshDimension()); + MCAuto ret=MEDCouplingUMesh::New(getName(),getMeshDimension()); ret->setCoords(getCoords()); const int *nodalConn=_conn->begin(); int nbCells=getNumberOfCells(); int nbNodesPerCell=getNumberOfNodesPerCell(); int geoType=(int)getCellModelEnum(); - MEDCouplingAutoRefCountObjectPtr c=DataArrayInt::New(); c->alloc(nbCells*(nbNodesPerCell+1),1); + MCAuto c=DataArrayInt::New(); c->alloc(nbCells*(nbNodesPerCell+1),1); int *cPtr=c->getPointer(); for(int i=0;i cI=DataArrayInt::Range(0,(nbCells+1)*(nbNodesPerCell+1),nbNodesPerCell+1); + MCAuto cI=DataArrayInt::Range(0,(nbCells+1)*(nbNodesPerCell+1),nbNodesPerCell+1); ret->setConnectivity(c,cI,true); try { ret->copyTinyInfoFrom(this); } @@ -1011,12 +1011,12 @@ struct MEDCouplingAccVisit */ DataArrayInt *MEDCoupling1SGTUMesh::computeFetchedNodeIds() const { - checkCoherencyOfConnectivity(); + checkConsistencyOfConnectivity(); int nbNodes(getNumberOfNodes()); std::vector fetchedNodes(nbNodes,false); computeNodeIdsAlg(fetchedNodes); int sz((int)std::count(fetchedNodes.begin(),fetchedNodes.end(),true)); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); ret->alloc(sz,1); + MCAuto ret(DataArrayInt::New()); ret->alloc(sz,1); int *retPtr(ret->getPointer()); for(int i=0;i ret(DataArrayInt::New()); + MCAuto ret(DataArrayInt::New()); ret->alloc(nbOfNodes,1); int *traducer=ret->getPointer(); std::fill(traducer,traducer+nbOfNodes,-1); @@ -1144,7 +1144,7 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::Merge1SGTUMeshes(std::vectorgetCellModel())!=cm) throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::Merge1SGTUMeshes : all items must have the same geo type !"); - std::vector< MEDCouplingAutoRefCountObjectPtr > bb(sz); + std::vector< MCAuto > bb(sz); std::vector< const MEDCoupling1SGTUMesh * > aa(sz); int spaceDim=-3; for(std::size_t i=0;igetCoords()) throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords : not lying on same coords !"); } - MEDCouplingAutoRefCountObjectPtr ret(new MEDCoupling1SGTUMesh("merge",*cm)); + MCAuto ret(new MEDCoupling1SGTUMesh("merge",*cm)); ret->setCoords(coords); ret->_conn=DataArrayInt::Aggregate(ncs); return ret.retn(); @@ -1218,10 +1218,10 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::Merge1SGTUMeshesLL(std::vector aps(a.size()); std::copy(a.begin(),a.end(),aps.begin()); - MEDCouplingAutoRefCountObjectPtr pts=MergeNodesArray(aps); - MEDCouplingAutoRefCountObjectPtr ret(new MEDCoupling1SGTUMesh("merge",*cm)); + MCAuto pts=MergeNodesArray(aps); + MCAuto ret(new MEDCoupling1SGTUMesh("merge",*cm)); ret->setCoords(pts); - MEDCouplingAutoRefCountObjectPtr c=DataArrayInt::New(); + MCAuto c=DataArrayInt::New(); c->alloc(nbOfCells*nbNodesPerCell,1); int *cPtr=c->getPointer(); int offset=0; @@ -1240,12 +1240,12 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::Merge1SGTUMeshesLL(std::vector ret(new MEDCoupling1SGTUMesh(getName(),*_cm)); + MCAuto ret(new MEDCoupling1SGTUMesh(getName(),*_cm)); ret->setCoords(_coords); std::size_t nbOfElemsRet=std::distance(begin,end); const int *inConn=_conn->getConstPointer(); int sz=getNumberOfNodesPerCell(); - MEDCouplingAutoRefCountObjectPtr connRet=DataArrayInt::New(); connRet->alloc((int)nbOfElemsRet*sz,1); + MCAuto connRet=DataArrayInt::New(); connRet->alloc((int)nbOfElemsRet*sz,1); int *connPtr=connRet->getPointer(); for(const int *work=begin;work!=end;work++,connPtr+=sz) { @@ -1262,15 +1262,15 @@ MEDCouplingPointSet *MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoords(const int return ret.retn(); } -MEDCouplingPointSet *MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoords2(int start, int end, int step) const +MEDCouplingPointSet *MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const { int ncell=getNumberOfCells(); - int nbOfElemsRet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoords2 : "); - MEDCouplingAutoRefCountObjectPtr ret(new MEDCoupling1SGTUMesh(getName(),*_cm)); + int nbOfElemsRet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoordsSlice : "); + MCAuto ret(new MEDCoupling1SGTUMesh(getName(),*_cm)); ret->setCoords(_coords); const int *inConn=_conn->getConstPointer(); int sz=getNumberOfNodesPerCell(); - MEDCouplingAutoRefCountObjectPtr connRet=DataArrayInt::New(); connRet->alloc((int)nbOfElemsRet*sz,1); + MCAuto connRet=DataArrayInt::New(); connRet->alloc((int)nbOfElemsRet*sz,1); int *connPtr=connRet->getPointer(); int curId=start; for(int i=0;i& nodeIdsInUse) co MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::buildSetInstanceFromThis(int spaceDim) const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDCoupling1SGTUMesh(getName(),*_cm)); - MEDCouplingAutoRefCountObjectPtr tmp1; + MCAuto ret(new MEDCoupling1SGTUMesh(getName(),*_cm)); + MCAuto tmp1; const DataArrayInt *nodalConn(_conn); if(!nodalConn) { @@ -1317,7 +1317,7 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::buildSetInstanceFromThis(int spaceDi ret->_conn=tmp1; if(!_coords) { - MEDCouplingAutoRefCountObjectPtr coords=DataArrayDouble::New(); coords->alloc(0,spaceDim); + MCAuto coords=DataArrayDouble::New(); coords->alloc(0,spaceDim); ret->setCoords(coords); } else @@ -1330,8 +1330,8 @@ DataArrayInt *MEDCoupling1SGTUMesh::simplexizePol0() int nbOfCells=getNumberOfCells(); if(getCellModelEnum()!=INTERP_KERNEL::NORM_QUAD4) return DataArrayInt::Range(0,nbOfCells,1); - MEDCouplingAutoRefCountObjectPtr newConn=DataArrayInt::New(); newConn->alloc(2*3*nbOfCells,1); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); ret->alloc(2*nbOfCells,1); + MCAuto newConn=DataArrayInt::New(); newConn->alloc(2*3*nbOfCells,1); + MCAuto ret=DataArrayInt::New(); ret->alloc(2*nbOfCells,1); const int *c(_conn->begin()); int *retPtr(ret->getPointer()),*newConnPtr(newConn->getPointer()); for(int i=0;i newConn=DataArrayInt::New(); newConn->alloc(2*3*nbOfCells,1); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); ret->alloc(2*nbOfCells,1); + MCAuto newConn=DataArrayInt::New(); newConn->alloc(2*3*nbOfCells,1); + MCAuto ret=DataArrayInt::New(); ret->alloc(2*nbOfCells,1); const int *c(_conn->begin()); int *retPtr(ret->getPointer()),*newConnPtr(newConn->getPointer()); for(int i=0;i newConn=DataArrayInt::New(); newConn->alloc(5*4*nbOfCells,1); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); ret->alloc(5*nbOfCells,1); + MCAuto newConn=DataArrayInt::New(); newConn->alloc(5*4*nbOfCells,1); + MCAuto ret=DataArrayInt::New(); ret->alloc(5*nbOfCells,1); const int *c(_conn->begin()); int *retPtr(ret->getPointer()),*newConnPtr(newConn->getPointer()); for(int i=0;i newConn=DataArrayInt::New(); newConn->alloc(6*4*nbOfCells,1); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); ret->alloc(6*nbOfCells,1); + MCAuto newConn=DataArrayInt::New(); newConn->alloc(6*4*nbOfCells,1); + MCAuto ret=DataArrayInt::New(); ret->alloc(6*nbOfCells,1); const int *c(_conn->begin()); int *retPtr(ret->getPointer()),*newConnPtr(newConn->getPointer()); for(int i=0;ibegin()); - MEDCouplingAutoRefCountObjectPtr ret(MEDCoupling1SGTUMesh::New(getName(),INTERP_KERNEL::NORM_QUAD4)); - MEDCouplingAutoRefCountObjectPtr c(DataArrayInt::New()); c->alloc(nbHexa8*6*4,1); + MCAuto ret(MEDCoupling1SGTUMesh::New(getName(),INTERP_KERNEL::NORM_QUAD4)); + MCAuto c(DataArrayInt::New()); c->alloc(nbHexa8*6*4,1); int *cPtr(c->getPointer()); for(int i=0;i cm(MEDCouplingCMesh::New()); + MCAuto cm(MEDCouplingCMesh::New()); for(int i=0;i tmp(1,i); - MEDCouplingAutoRefCountObjectPtr elt(static_cast(getCoords()->keepSelectedComponents(tmp))); + MCAuto elt(static_cast(getCoords()->keepSelectedComponents(tmp))); elt=elt->getDifferentValues(eps); elt->sort(true); cm->setCoordsAt(i,elt); @@ -1761,7 +1761,7 @@ MEDCouplingCMesh *MEDCoupling1SGTUMesh::structurizeMe(DataArrayInt *& cellPerm, try { cm->copyTinyInfoFrom(this); } catch(INTERP_KERNEL::Exception&) { } - MEDCouplingAutoRefCountObjectPtr um(cm->buildUnstructured()),self(buildUnstructured()); + MCAuto um(cm->buildUnstructured()),self(buildUnstructured()); self->checkGeoEquivalWith(um,12,eps,cellPerm,nodePerm); return cm.retn(); } @@ -1850,13 +1850,13 @@ bool UpdateHexa8Cell(int validAxis, int neighId, const int *validConnQuad4NeighS */ DataArrayInt *MEDCoupling1SGTUMesh::sortHexa8EachOther() { - MEDCouplingAutoRefCountObjectPtr quads(explodeEachHexa8To6Quad4());//checks that only hexa8 + MCAuto quads(explodeEachHexa8To6Quad4());//checks that only hexa8 int nbHexa8(getNumberOfCells()),*cQuads(quads->getNodalConnectivity()->getPointer()); - MEDCouplingAutoRefCountObjectPtr neighOfQuads(DataArrayInt::New()); neighOfQuads->alloc(nbHexa8*6,1); neighOfQuads->fillWithValue(-1); + MCAuto neighOfQuads(DataArrayInt::New()); neighOfQuads->alloc(nbHexa8*6,1); neighOfQuads->fillWithValue(-1); int *ptNeigh(neighOfQuads->getPointer()); {//neighOfQuads tells for each face of each Quad8 which cell (if!=-1) is connected to this face. - MEDCouplingAutoRefCountObjectPtr quadsTmp(quads->buildUnstructured()); - MEDCouplingAutoRefCountObjectPtr ccSafe,cciSafe; + MCAuto quadsTmp(quads->buildUnstructured()); + MCAuto ccSafe,cciSafe; DataArrayInt *cc(0),*cci(0); quadsTmp->findCommonCells(3,0,cc,cci); ccSafe=cc; cciSafe=cci; @@ -1864,7 +1864,7 @@ DataArrayInt *MEDCoupling1SGTUMesh::sortHexa8EachOther() for(int i=0;i ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); std::vector fetched(nbHexa8,false); std::vector::iterator it(std::find(fetched.begin(),fetched.end(),false)); while(it!=fetched.end())//it will turns as time as number of connected zones @@ -1927,24 +1927,24 @@ MEDCoupling1DGTUMesh *MEDCoupling1SGTUMesh::computeDualMesh3D() const if(getCellModelEnum()!=INTERP_KERNEL::NORM_TETRA4) throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::computeDualMesh3D : only TETRA4 supported !"); checkFullyDefined(); - MEDCouplingAutoRefCountObjectPtr thisu(buildUnstructured()); - MEDCouplingAutoRefCountObjectPtr revNodArr(DataArrayInt::New()),revNodIArr(DataArrayInt::New()); + MCAuto thisu(buildUnstructured()); + MCAuto revNodArr(DataArrayInt::New()),revNodIArr(DataArrayInt::New()); thisu->getReverseNodalConnectivity(revNodArr,revNodIArr); const int *revNod(revNodArr->begin()),*revNodI(revNodIArr->begin()),*nodal(_conn->begin()); - MEDCouplingAutoRefCountObjectPtr d1Arr(DataArrayInt::New()),di1Arr(DataArrayInt::New()),rd1Arr(DataArrayInt::New()),rdi1Arr(DataArrayInt::New()); - MEDCouplingAutoRefCountObjectPtr edges(thisu->explode3DMeshTo1D(d1Arr,di1Arr,rd1Arr,rdi1Arr)); + MCAuto d1Arr(DataArrayInt::New()),di1Arr(DataArrayInt::New()),rd1Arr(DataArrayInt::New()),rdi1Arr(DataArrayInt::New()); + MCAuto edges(thisu->explode3DMeshTo1D(d1Arr,di1Arr,rd1Arr,rdi1Arr)); const int *d1(d1Arr->begin()); - MEDCouplingAutoRefCountObjectPtr d2Arr(DataArrayInt::New()),di2Arr(DataArrayInt::New()),rd2Arr(DataArrayInt::New()),rdi2Arr(DataArrayInt::New()); - MEDCouplingAutoRefCountObjectPtr faces(thisu->buildDescendingConnectivity(d2Arr,di2Arr,rd2Arr,rdi2Arr)); thisu=0; + MCAuto d2Arr(DataArrayInt::New()),di2Arr(DataArrayInt::New()),rd2Arr(DataArrayInt::New()),rdi2Arr(DataArrayInt::New()); + MCAuto faces(thisu->buildDescendingConnectivity(d2Arr,di2Arr,rd2Arr,rdi2Arr)); thisu=0; const int *d2(d2Arr->begin()),*rdi2(rdi2Arr->begin()); - MEDCouplingAutoRefCountObjectPtr edgesBaryArr(edges->getBarycenterAndOwner()),facesBaryArr(faces->getBarycenterAndOwner()),baryArr(getBarycenterAndOwner()); + MCAuto edgesBaryArr(edges->computeCellCenterOfMass()),facesBaryArr(faces->computeCellCenterOfMass()),baryArr(computeCellCenterOfMass()); const int nbOfNodes(getNumberOfNodes()),offset0(nbOfNodes+faces->getNumberOfCells()),offset1(offset0+edges->getNumberOfCells()); edges=0; faces=0; std::vector v(4); v[0]=getCoords(); v[1]=facesBaryArr; v[2]=edgesBaryArr; v[3]=baryArr; - MEDCouplingAutoRefCountObjectPtr zeArr(DataArrayDouble::Aggregate(v)); baryArr=0; edgesBaryArr=0; facesBaryArr=0; + MCAuto zeArr(DataArrayDouble::Aggregate(v)); baryArr=0; edgesBaryArr=0; facesBaryArr=0; std::string name("DualOf_"); name+=getName(); - MEDCouplingAutoRefCountObjectPtr ret(MEDCoupling1DGTUMesh::New(name,INTERP_KERNEL::NORM_POLYHED)); ret->setCoords(zeArr); - MEDCouplingAutoRefCountObjectPtr cArr(DataArrayInt::New()),ciArr(DataArrayInt::New()); ciArr->alloc(nbOfNodes+1,1); ciArr->setIJ(0,0,0); cArr->alloc(0,1); + MCAuto ret(MEDCoupling1DGTUMesh::New(name,INTERP_KERNEL::NORM_POLYHED)); ret->setCoords(zeArr); + MCAuto cArr(DataArrayInt::New()),ciArr(DataArrayInt::New()); ciArr->alloc(nbOfNodes+1,1); ciArr->setIJ(0,0,0); cArr->alloc(0,1); for(int i=0;i thisu(buildUnstructured()); - MEDCouplingAutoRefCountObjectPtr revNodArr(DataArrayInt::New()),revNodIArr(DataArrayInt::New()); + MCAuto thisu(buildUnstructured()); + MCAuto revNodArr(DataArrayInt::New()),revNodIArr(DataArrayInt::New()); thisu->getReverseNodalConnectivity(revNodArr,revNodIArr); const int *revNod(revNodArr->begin()),*revNodI(revNodIArr->begin()),*nodal(_conn->begin()); - MEDCouplingAutoRefCountObjectPtr d2Arr(DataArrayInt::New()),di2Arr(DataArrayInt::New()),rd2Arr(DataArrayInt::New()),rdi2Arr(DataArrayInt::New()); - MEDCouplingAutoRefCountObjectPtr edges(thisu->buildDescendingConnectivity(d2Arr,di2Arr,rd2Arr,rdi2Arr)); thisu=0; + MCAuto d2Arr(DataArrayInt::New()),di2Arr(DataArrayInt::New()),rd2Arr(DataArrayInt::New()),rdi2Arr(DataArrayInt::New()); + MCAuto edges(thisu->buildDescendingConnectivity(d2Arr,di2Arr,rd2Arr,rdi2Arr)); thisu=0; const int *d2(d2Arr->begin()),*rdi2(rdi2Arr->begin()); - MEDCouplingAutoRefCountObjectPtr edgesBaryArr(edges->getBarycenterAndOwner()),baryArr(getBarycenterAndOwner()); + MCAuto edgesBaryArr(edges->computeCellCenterOfMass()),baryArr(computeCellCenterOfMass()); const int nbOfNodes(getNumberOfNodes()),offset0(nbOfNodes+edges->getNumberOfCells()); edges=0; std::vector v(3); v[0]=getCoords(); v[1]=edgesBaryArr; v[2]=baryArr; - MEDCouplingAutoRefCountObjectPtr zeArr(DataArrayDouble::Aggregate(v)); baryArr=0; edgesBaryArr=0; + MCAuto zeArr(DataArrayDouble::Aggregate(v)); baryArr=0; edgesBaryArr=0; std::string name("DualOf_"); name+=getName(); - MEDCouplingAutoRefCountObjectPtr ret(MEDCoupling1DGTUMesh::New(name,INTERP_KERNEL::NORM_POLYGON)); ret->setCoords(zeArr); - MEDCouplingAutoRefCountObjectPtr cArr(DataArrayInt::New()),ciArr(DataArrayInt::New()); ciArr->alloc(nbOfNodes+1,1); ciArr->setIJ(0,0,0); cArr->alloc(0,1); + MCAuto ret(MEDCoupling1DGTUMesh::New(name,INTERP_KERNEL::NORM_POLYGON)); ret->setCoords(zeArr); + MCAuto cArr(DataArrayInt::New()),ciArr(DataArrayInt::New()); ciArr->alloc(nbOfNodes+1,1); ciArr->setIJ(0,0,0); cArr->alloc(0,1); for(int i=0;i ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); + MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); double *bbox(ret->getPointer()); for(int i=0;i ret(MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME)); + MCAuto ret(MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME)); int nbCells(getNumberOfCells()); - MEDCouplingAutoRefCountObjectPtr arr(DataArrayDouble::New()); + MCAuto arr(DataArrayDouble::New()); arr->alloc(nbCells,1); INTERP_KERNEL::AutoCppPtr dc(_cm->buildInstanceOfDiameterCalulator(getSpaceDimension())); dc->computeFor1SGTUMeshFrmt(nbCells,_conn->begin(),getCoords()->begin(),arr->getPointer()); @@ -2163,10 +2163,10 @@ MEDCoupling1DGTUMesh::MEDCoupling1DGTUMesh(const MEDCoupling1DGTUMesh& other, bo { const DataArrayInt *c(other._conn); if(c) - _conn=c->deepCpy(); + _conn=c->deepCopy(); c=other._conn_indx; if(c) - _conn_indx=c->deepCpy(); + _conn_indx=c->deepCopy(); } } @@ -2176,17 +2176,17 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::clone(bool recDeepCpy) const } /*! - * This method behaves mostly like MEDCoupling1DGTUMesh::deepCpy method, except that only nodal connectivity arrays are deeply copied. + * This method behaves mostly like MEDCoupling1DGTUMesh::deepCopy method, except that only nodal connectivity arrays are deeply copied. * The coordinates are shared between \a this and the returned instance. * * \return MEDCoupling1DGTUMesh * - A new object instance holding the copy of \a this (deep for connectivity, shallow for coordiantes) - * \sa MEDCoupling1DGTUMesh::deepCpy + * \sa MEDCoupling1DGTUMesh::deepCopy */ -MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::deepCpyConnectivityOnly() const +MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::deepCopyConnectivityOnly() const { - checkCoherency(); - MEDCouplingAutoRefCountObjectPtr ret(clone(false)); - MEDCouplingAutoRefCountObjectPtr c(_conn->deepCpy()),ci(_conn_indx->deepCpy()); + checkConsistencyLight(); + MCAuto ret(clone(false)); + MCAuto c(_conn->deepCopy()),ci(_conn_indx->deepCopy()); ret->setNodalConnectivity(c,ci); return ret.retn(); } @@ -2215,7 +2215,7 @@ std::vector MEDCoupling1DGTUMesh::getDirectChildrenWith return ret; } -MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::deepCpy() const +MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::deepCopy() const { return clone(true); } @@ -2331,7 +2331,7 @@ void MEDCoupling1DGTUMesh::checkFastEquivalWith(const MEDCouplingMesh *other, do } } -void MEDCoupling1DGTUMesh::checkCoherencyOfConnectivity() const +void MEDCoupling1DGTUMesh::checkConsistencyOfConnectivity() const { const DataArrayInt *c1(_conn); if(c1) @@ -2378,7 +2378,7 @@ void MEDCoupling1DGTUMesh::checkCoherencyOfConnectivity() const int szOfC1Exp=_conn_indx->back(); if(sz2getNumberOfTuples() << " !"; + std::ostringstream oss; oss << "MEDCoupling1DGTUMesh::checkConsistencyOfConnectivity : The expected length of nodal connectivity array regarding index is " << szOfC1Exp << " but the actual size of it is " << c1->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } } @@ -2388,18 +2388,18 @@ void MEDCoupling1DGTUMesh::checkCoherencyOfConnectivity() const * In addition you are sure that the length of nodal connectivity index array is bigger than or equal to one. * In addition you are also sure that length of nodal connectivity is coherent with the content of the last value in the index array. */ -void MEDCoupling1DGTUMesh::checkCoherency() const +void MEDCoupling1DGTUMesh::checkConsistencyLight() const { - MEDCouplingPointSet::checkCoherency(); - checkCoherencyOfConnectivity(); + MEDCouplingPointSet::checkConsistencyLight(); + checkConsistencyOfConnectivity(); } -void MEDCoupling1DGTUMesh::checkCoherency1(double eps) const +void MEDCoupling1DGTUMesh::checkConsistency(double eps) const { - checkCoherency(); + checkConsistencyLight(); const DataArrayInt *c1(_conn),*c2(_conn_indx); if(!c2->isMonotonic(true)) - throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::checkCoherency1 : the nodal connectivity index is expected to be increasing monotinic !"); + throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::checkConsistency : the nodal connectivity index is expected to be increasing monotinic !"); // int nbOfTuples=c1->getNumberOfTuples(); int nbOfNodes=getNumberOfNodes(); @@ -2417,7 +2417,7 @@ void MEDCoupling1DGTUMesh::checkCoherency1(double eps) const int MEDCoupling1DGTUMesh::getNumberOfCells() const { - checkCoherencyOfConnectivity();//do not remove + checkConsistencyOfConnectivity();//do not remove return _conn_indx->getNumberOfTuples()-1; } @@ -2431,13 +2431,13 @@ int MEDCoupling1DGTUMesh::getNumberOfCells() const */ DataArrayInt *MEDCoupling1DGTUMesh::computeNbOfNodesPerCell() const { - checkCoherency(); + checkConsistencyLight(); _conn_indx->checkMonotonic(true); if(getCellModelEnum()!=INTERP_KERNEL::NORM_POLYHED) return _conn_indx->deltaShiftIndex(); // for polyhedrons int nbOfCells=_conn_indx->getNumberOfTuples()-1; - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfCells,1); int *retPtr=ret->getPointer(); const int *ci=_conn_indx->begin(),*c=_conn->begin(); @@ -2454,19 +2454,19 @@ DataArrayInt *MEDCoupling1DGTUMesh::computeNbOfNodesPerCell() const */ DataArrayInt *MEDCoupling1DGTUMesh::computeNbOfFacesPerCell() const { - checkCoherency(); + checkConsistencyLight(); _conn_indx->checkMonotonic(true); if(getCellModelEnum()!=INTERP_KERNEL::NORM_POLYHED && getCellModelEnum()!=INTERP_KERNEL::NORM_QPOLYG) return _conn_indx->deltaShiftIndex(); if(getCellModelEnum()==INTERP_KERNEL::NORM_QPOLYG) { - MEDCouplingAutoRefCountObjectPtr ret=_conn_indx->deltaShiftIndex(); + MCAuto ret=_conn_indx->deltaShiftIndex(); ret->applyDivideBy(2); return ret.retn(); } // for polyhedrons int nbOfCells=_conn_indx->getNumberOfTuples()-1; - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfCells,1); int *retPtr=ret->getPointer(); const int *ci=_conn_indx->begin(),*c=_conn->begin(); @@ -2484,10 +2484,10 @@ DataArrayInt *MEDCoupling1DGTUMesh::computeNbOfFacesPerCell() const */ DataArrayInt *MEDCoupling1DGTUMesh::computeEffectiveNbOfNodesPerCell() const { - checkCoherency(); + checkConsistencyLight(); _conn_indx->checkMonotonic(true); int nbOfCells(_conn_indx->getNumberOfTuples()-1); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfCells,1); int *retPtr(ret->getPointer()); const int *ci(_conn_indx->begin()),*c(_conn->begin()); @@ -2573,7 +2573,7 @@ std::string MEDCoupling1DGTUMesh::simpleRepr() const ret << msg0 << "\n"; ret << "Number of cells : "; bool isOK=true; - try { checkCoherency(); } catch(INTERP_KERNEL::Exception& /* e */) + try { checkConsistencyLight(); } catch(INTERP_KERNEL::Exception& /* e */) { ret << "Nodal connectivity arrays are not set or badly set !\n"; isOK=false; @@ -2596,7 +2596,7 @@ std::string MEDCoupling1DGTUMesh::advancedRepr() const ret << "\n\nNodal Connectivity : \n____________________\n\n"; // bool isOK=true; - try { checkCoherency1(); } catch(INTERP_KERNEL::Exception& /* e */) + try { checkConsistency(); } catch(INTERP_KERNEL::Exception& /* e */) { ret << "Nodal connectivity arrays are not set or badly set !\n"; isOK=false; @@ -2616,9 +2616,9 @@ std::string MEDCoupling1DGTUMesh::advancedRepr() const DataArrayDouble *MEDCoupling1DGTUMesh::computeIsoBarycenterOfNodesPerCell() const { - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); int spaceDim=getSpaceDimension(); - int nbOfCells=getNumberOfCells();//checkCoherency() + int nbOfCells=getNumberOfCells();//checkConsistencyLight() int nbOfNodes=getNumberOfNodes(); ret->alloc(nbOfCells,spaceDim); double *ptToFill=ret->getPointer(); @@ -2694,15 +2694,15 @@ DataArrayDouble *MEDCoupling1DGTUMesh::computeIsoBarycenterOfNodesPerCell() cons void MEDCoupling1DGTUMesh::renumberCells(const int *old2NewBg, bool check) { int nbCells=getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr o2n=DataArrayInt::New(); + MCAuto o2n=DataArrayInt::New(); o2n->useArray(old2NewBg,false,C_DEALLOC,nbCells,1); if(check) o2n=o2n->checkAndPreparePermutation(); // const int *o2nPtr=o2n->getPointer(); const int *conn=_conn->begin(),*conni=_conn_indx->begin(); - MEDCouplingAutoRefCountObjectPtr newConn=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr newConnI=DataArrayInt::New(); + MCAuto newConn=DataArrayInt::New(); + MCAuto newConnI=DataArrayInt::New(); newConn->alloc(_conn->getNumberOfTuples(),1); newConnI->alloc(nbCells,1); newConn->copyStringInfoFrom(*_conn); newConnI->copyStringInfoFrom(*_conn_indx); // @@ -2719,7 +2719,7 @@ void MEDCoupling1DGTUMesh::renumberCells(const int *old2NewBg, bool check) throw INTERP_KERNEL::Exception(oss.str().c_str()); } } - newConnI->computeOffsets2(); newCI=newConnI->getPointer(); + newConnI->computeOffsetsFull(); newCI=newConnI->getPointer(); // for(int i=0;i ret=MEDCouplingUMesh::New(getName(),getMeshDimension()); + MCAuto ret=MEDCouplingUMesh::New(getName(),getMeshDimension()); ret->setCoords(getCoords()); const int *nodalConn=_conn->begin(),*nodalConnI=_conn_indx->begin(); - int nbCells=getNumberOfCells();//checkCoherency + int nbCells=getNumberOfCells();//checkConsistencyLight int geoType=(int)getCellModelEnum(); - MEDCouplingAutoRefCountObjectPtr c=DataArrayInt::New(); c->alloc(nbCells+_conn->getNumberOfTuples(),1); - MEDCouplingAutoRefCountObjectPtr cI=DataArrayInt::New(); cI->alloc(nbCells+1); + MCAuto c=DataArrayInt::New(); c->alloc(nbCells+_conn->getNumberOfTuples(),1); + MCAuto cI=DataArrayInt::New(); cI->alloc(nbCells+1); int *cPtr=c->getPointer(),*ciPtr=cI->getPointer(); ciPtr[0]=0; for(int i=0;i ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfCells,1); ret->iota(0); return ret.retn(); @@ -2794,7 +2794,7 @@ void MEDCoupling1DGTUMesh::reprQuickOverview(std::ostream& stream) const stream << " Space dimension : " << _coords->getNumberOfComponents() << "." << std::endl; stream << "Number of nodes : " << _coords->getNumberOfTuples() << "."; bool isOK=true; - try { checkCoherency(); } catch(INTERP_KERNEL::Exception& /* e */) + try { checkConsistencyLight(); } catch(INTERP_KERNEL::Exception& /* e */) { stream << std::endl << "Nodal connectivity NOT set properly !\n"; isOK=false; @@ -2828,31 +2828,31 @@ MEDCouplingPointSet *MEDCoupling1DGTUMesh::mergeMyselfWithOnSameCoords(const MED MEDCouplingPointSet *MEDCoupling1DGTUMesh::buildPartOfMySelfKeepCoords(const int *begin, const int *end) const { - checkCoherency(); - MEDCouplingAutoRefCountObjectPtr ret(new MEDCoupling1DGTUMesh(getName(),*_cm)); + checkConsistencyLight(); + MCAuto ret(new MEDCoupling1DGTUMesh(getName(),*_cm)); ret->setCoords(_coords); DataArrayInt *c=0,*ci=0; MEDCouplingUMesh::ExtractFromIndexedArrays(begin,end,_conn,_conn_indx,c,ci); - MEDCouplingAutoRefCountObjectPtr cSafe(c),ciSafe(ci); + MCAuto cSafe(c),ciSafe(ci); ret->setNodalConnectivity(c,ci); return ret.retn(); } -MEDCouplingPointSet *MEDCoupling1DGTUMesh::buildPartOfMySelfKeepCoords2(int start, int end, int step) const +MEDCouplingPointSet *MEDCoupling1DGTUMesh::buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const { - checkCoherency(); - MEDCouplingAutoRefCountObjectPtr ret(new MEDCoupling1DGTUMesh(getName(),*_cm)); + checkConsistencyLight(); + MCAuto ret(new MEDCoupling1DGTUMesh(getName(),*_cm)); ret->setCoords(_coords); DataArrayInt *c=0,*ci=0; - MEDCouplingUMesh::ExtractFromIndexedArrays2(start,end,step,_conn,_conn_indx,c,ci); - MEDCouplingAutoRefCountObjectPtr cSafe(c),ciSafe(ci); + MEDCouplingUMesh::ExtractFromIndexedArraysSlice(start,end,step,_conn,_conn_indx,c,ci); + MCAuto cSafe(c),ciSafe(ci); ret->setNodalConnectivity(c,ci); return ret.retn(); } void MEDCoupling1DGTUMesh::computeNodeIdsAlg(std::vector& nodeIdsInUse) const { - checkCoherency1(); + checkConsistency(); int sz((int)nodeIdsInUse.size()); for(const int *conn=_conn->begin();conn!=_conn->end();conn++) { @@ -2980,8 +2980,8 @@ void MEDCoupling1DGTUMesh::resizeForUnserialization(const std::vector& tiny std::vector tinyInfo2(tinyInfo.begin()+9,tinyInfo.begin()+9+tinyInfo[6]); std::vector tinyInfo1(tinyInfo.begin()+9+tinyInfo[6],tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7]); std::vector tinyInfo12(tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7],tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7]+tinyInfo[8]); - MEDCouplingAutoRefCountObjectPtr p1(DataArrayInt::New()); p1->resizeForUnserialization(tinyInfo1); - MEDCouplingAutoRefCountObjectPtr p2(DataArrayInt::New()); p2->resizeForUnserialization(tinyInfo12); + MCAuto p1(DataArrayInt::New()); p1->resizeForUnserialization(tinyInfo1); + MCAuto p2(DataArrayInt::New()); p2->resizeForUnserialization(tinyInfo12); std::vector v(2); v[0]=p1; v[1]=p2; p2=DataArrayInt::Aggregate(v); a2->resizeForUnserialization(tinyInfo2); @@ -3061,12 +3061,12 @@ void MEDCoupling1DGTUMesh::unserialization(const std::vector& tinyInfoD, */ DataArrayInt *MEDCoupling1DGTUMesh::computeFetchedNodeIds() const { - checkCoherency1(); + checkConsistency(); int nbNodes(getNumberOfNodes()); std::vector fetchedNodes(nbNodes,false); computeNodeIdsAlg(fetchedNodes); int sz((int)std::count(fetchedNodes.begin(),fetchedNodes.end(),true)); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); ret->alloc(sz,1); + MCAuto ret(DataArrayInt::New()); ret->alloc(sz,1); int *retPtr(ret->getPointer()); for(int i=0;i ret=DataArrayInt::New(); + int nbOfCells=getNumberOfCells();//checkConsistencyLight + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfNodes,1); int *traducer=ret->getPointer(); std::fill(traducer,traducer+nbOfNodes,-1); @@ -3222,7 +3222,7 @@ void MEDCoupling1DGTUMesh::renumberNodesInConn(const int *newNodeNumbersO2N) void MEDCoupling1DGTUMesh::fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, DataArrayInt *&cellIdsKeptArr) const { int nbOfCells=getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr cellIdsKept=DataArrayInt::New(); cellIdsKept->alloc(0,1); + MCAuto cellIdsKept=DataArrayInt::New(); cellIdsKept->alloc(0,1); int tmp=-1; int sz=_conn->getMaxValue(tmp); sz=std::max(sz,0)+1; std::vector fastFinder(sz,false); @@ -3344,10 +3344,10 @@ DataArrayInt *MEDCoupling1DGTUMesh::getNodalConnectivityIndex() const */ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::copyWithNodalConnectivityPacked(bool& isShallowCpyOfNodalConnn) const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDCoupling1DGTUMesh(getName(),*_cm)); + MCAuto ret(new MEDCoupling1DGTUMesh(getName(),*_cm)); DataArrayInt *nc=0,*nci=0; isShallowCpyOfNodalConnn=retrievePackedNodalConnectivity(nc,nci); - MEDCouplingAutoRefCountObjectPtr ncs(nc),ncis(nci); + MCAuto ncs(nc),ncis(nci); ret->_conn=ncs; ret->_conn_indx=ncis; ret->setCoords(getCoords()); return ret.retn(); @@ -3372,11 +3372,11 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::copyWithNodalConnectivityPacked(bool * \return bool - an indication of the content of the 2 output parameters. If true, \a this looks packed (general case), if true, \a this is not packed then * output parameters are newly created objects. * - * \throw if \a this does not pass MEDCoupling1DGTUMesh::checkCoherency test + * \throw if \a this does not pass MEDCoupling1DGTUMesh::checkConsistencyLight test */ bool MEDCoupling1DGTUMesh::retrievePackedNodalConnectivity(DataArrayInt *&nodalConn, DataArrayInt *&nodalConnIndx) const { - if(isPacked())//performs the checkCoherency + if(isPacked())//performs the checkConsistencyLight { const DataArrayInt *c0(_conn),*c1(_conn_indx); nodalConn=const_cast(c0); nodalConnIndx=const_cast(c1); @@ -3384,8 +3384,8 @@ bool MEDCoupling1DGTUMesh::retrievePackedNodalConnectivity(DataArrayInt *&nodalC return true; } int bg=_conn_indx->front(),end=_conn_indx->back(); - MEDCouplingAutoRefCountObjectPtr nc(_conn->selectByTupleId2(bg,end,1)); - MEDCouplingAutoRefCountObjectPtr nci(_conn_indx->deepCpy()); + MCAuto nc(_conn->selectByTupleIdSafeSlice(bg,end,1)); + MCAuto nci(_conn_indx->deepCopy()); nci->applyLin(1,-bg); nodalConn=nc.retn(); nodalConnIndx=nci.retn(); return false; @@ -3397,11 +3397,11 @@ bool MEDCoupling1DGTUMesh::retrievePackedNodalConnectivity(DataArrayInt *&nodalC * If nodal connectivity index points to a subpart of nodal connectivity index false will be returned. * \return bool - true if \a this looks packed, false is not. * - * \throw if \a this does not pass MEDCoupling1DGTUMesh::checkCoherency test + * \throw if \a this does not pass MEDCoupling1DGTUMesh::checkConsistencyLight test */ bool MEDCoupling1DGTUMesh::isPacked() const { - checkCoherency(); + checkConsistencyLight(); return _conn_indx->front()==0 && _conn_indx->back()==_conn->getNumberOfTuples(); } @@ -3427,7 +3427,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::Merge1DGTUMeshes(std::vectorgetCellModel())!=cm) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::Merge1DGTUMeshes : all items must have the same geo type !"); - std::vector< MEDCouplingAutoRefCountObjectPtr > bb(sz); + std::vector< MCAuto > bb(sz); std::vector< const MEDCoupling1DGTUMesh * > aa(sz); int spaceDim=-3; for(std::size_t i=0;i::const_iterator it=a.begin(); if(!(*it)) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords : null instance in the first element of input vector !"); - std::vector< MEDCouplingAutoRefCountObjectPtr > objs(a.size()); + std::vector< MCAuto > objs(a.size()); std::vector ncs(a.size()),ncis(a.size()); (*it)->getNumberOfCells();//to check that all is OK const DataArrayDouble *coords=(*it)->getCoords(); @@ -3479,7 +3479,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(std::ve if(coords!=(*it)->getCoords()) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords : not lying on same coords !"); } - MEDCouplingAutoRefCountObjectPtr ret(new MEDCoupling1DGTUMesh("merge",*cm)); + MCAuto ret(new MEDCoupling1DGTUMesh("merge",*cm)); ret->setCoords(coords); ret->_conn=DataArrayInt::Aggregate(ncs); ret->_conn_indx=DataArrayInt::AggregateIndexes(ncis); @@ -3493,7 +3493,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::Merge1DGTUMeshesLL(std::vector > objs(a.size()); + std::vector< MCAuto > objs(a.size()); std::vector ncs(a.size()),ncis(a.size()); std::vector::const_iterator it=a.begin(); std::vector nbNodesPerElt(a.size()); @@ -3517,8 +3517,8 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::Merge1DGTUMeshesLL(std::vector aps(a.size()); std::copy(a.begin(),a.end(),aps.begin()); - MEDCouplingAutoRefCountObjectPtr pts=MergeNodesArray(aps); - MEDCouplingAutoRefCountObjectPtr ret(new MEDCoupling1DGTUMesh("merge",*cm)); + MCAuto pts=MergeNodesArray(aps); + MCAuto ret(new MEDCoupling1DGTUMesh("merge",*cm)); ret->setCoords(pts); ret->_conn=AggregateNodalConnAndShiftNodeIds(ncs,nbNodesPerElt); ret->_conn_indx=DataArrayInt::AggregateIndexes(ncis); @@ -3527,8 +3527,8 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::Merge1DGTUMeshesLL(std::vector ret(new MEDCoupling1DGTUMesh(getName(),*_cm)); - MEDCouplingAutoRefCountObjectPtr tmp1,tmp2; + MCAuto ret(new MEDCoupling1DGTUMesh(getName(),*_cm)); + MCAuto tmp1,tmp2; const DataArrayInt *nodalConn(_conn),*nodalConnI(_conn_indx); if(!nodalConn) { @@ -3548,7 +3548,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::buildSetInstanceFromThis(int spaceDi // if(!_coords) { - MEDCouplingAutoRefCountObjectPtr coords=DataArrayDouble::New(); coords->alloc(0,spaceDim); + MCAuto coords=DataArrayDouble::New(); coords->alloc(0,spaceDim); ret->setCoords(coords); } else @@ -3570,7 +3570,7 @@ DataArrayDouble *MEDCoupling1DGTUMesh::getBoundingBoxForBBTree(double arcDetEps) { checkFullyDefined(); int spaceDim(getSpaceDimension()),nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes()); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); + MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); double *bbox(ret->getPointer()); for(int i=0;igetNumberOfTuples(); } - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); ret->alloc(nbOfTuples,1); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuples,1); int *pt=ret->getPointer(); int i=0; for(std::vector::const_iterator it=nodalConns.begin();it!=nodalConns.end();it++,i++) @@ -3696,11 +3696,11 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::New(const MEDCouplingUMesh *m) if(gts.size()!=1) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::New : input mesh must have exactly one geometric type !"); int geoType((int)*gts.begin()); - MEDCouplingAutoRefCountObjectPtr ret(MEDCoupling1DGTUMesh::New(m->getName(),*gts.begin())); + MCAuto ret(MEDCoupling1DGTUMesh::New(m->getName(),*gts.begin())); ret->setCoords(m->getCoords()); ret->setDescription(m->getDescription()); int nbCells(m->getNumberOfCells()); - MEDCouplingAutoRefCountObjectPtr conn(DataArrayInt::New()),connI(DataArrayInt::New()); - conn->alloc(m->getMeshLength()-nbCells,1); connI->alloc(nbCells+1,1); + MCAuto conn(DataArrayInt::New()),connI(DataArrayInt::New()); + conn->alloc(m->getNodalConnectivityArrayLen()-nbCells,1); connI->alloc(nbCells+1,1); int *c(conn->getPointer()),*ci(connI->getPointer()); *ci=0; const int *cin(m->getNodalConnectivity()->begin()),*ciin(m->getNodalConnectivityIndex()->begin()); for(int i=0;i& nodeIdsInUse) const; MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const; MEDCOUPLING_EXPORT void checkFullyDefined() const; @@ -139,7 +139,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *computeDiameterField() const; // overload of MEDCoupling1GTUMesh - MEDCOUPLING_EXPORT void checkCoherencyOfConnectivity() const; + MEDCOUPLING_EXPORT void checkConsistencyOfConnectivity() const; MEDCOUPLING_EXPORT void allocateCells(int nbOfCells=0); MEDCOUPLING_EXPORT void insertNextCell(const int *nodalConnOfCellBg, const int *nodalConnOfCellEnd); public://specific @@ -174,7 +174,7 @@ namespace MEDCoupling MEDCoupling1DGTUMesh *computeDualMesh3D() const; MEDCoupling1DGTUMesh *computeDualMesh2D() const; private: - MEDCouplingAutoRefCountObjectPtr _conn; + MCAuto _conn; public: static const int HEXA8_FACE_PAIRS[6]; }; @@ -188,8 +188,8 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static MEDCoupling1DGTUMesh *New(); // Copy methods MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *clone(bool recDeepCpy) const; - MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *deepCpy() const; - MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *deepCpyConnectivityOnly() const; + MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *deepCopy() const; + MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *deepCopyConnectivityOnly() const; // overload of TimeLabel and RefCountObject MEDCOUPLING_EXPORT void updateTime() const; @@ -200,8 +200,8 @@ namespace MEDCoupling MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const; MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const; MEDCOUPLING_EXPORT void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const; - MEDCOUPLING_EXPORT void checkCoherency() const; - MEDCOUPLING_EXPORT void checkCoherency1(double eps=1e-12) const; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; + MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const; MEDCOUPLING_EXPORT int getNumberOfCells() const; MEDCOUPLING_EXPORT DataArrayInt *computeNbOfNodesPerCell() const; MEDCOUPLING_EXPORT DataArrayInt *computeNbOfFacesPerCell() const; @@ -219,7 +219,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other); MEDCOUPLING_EXPORT MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const; MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoords(const int *begin, const int *end) const; - MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoords2(int start, int end, int step) const; + MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const; MEDCOUPLING_EXPORT void computeNodeIdsAlg(std::vector& nodeIdsInUse) const; MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const; MEDCOUPLING_EXPORT void checkFullyDefined() const; @@ -234,7 +234,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *computeDiameterField() const; // overload of MEDCoupling1GTUMesh - MEDCOUPLING_EXPORT void checkCoherencyOfConnectivity() const; + MEDCOUPLING_EXPORT void checkConsistencyOfConnectivity() const; MEDCOUPLING_EXPORT void allocateCells(int nbOfCells=0); MEDCOUPLING_EXPORT void insertNextCell(const int *nodalConnOfCellBg, const int *nodalConnOfCellEnd); public://specific @@ -264,8 +264,8 @@ namespace MEDCoupling void checkDynamicGeoT2ype() const; static MEDCoupling1DGTUMesh *Merge1DGTUMeshesLL(std::vector& a); private: - MEDCouplingAutoRefCountObjectPtr _conn_indx; - MEDCouplingAutoRefCountObjectPtr _conn; + MCAuto _conn_indx; + MCAuto _conn; }; } diff --git a/src/MEDCoupling/MEDCouplingAMRAttribute.cxx b/src/MEDCoupling/MEDCouplingAMRAttribute.cxx index 28e6f2793..dbe1001a6 100644 --- a/src/MEDCoupling/MEDCouplingAMRAttribute.cxx +++ b/src/MEDCoupling/MEDCouplingAMRAttribute.cxx @@ -34,7 +34,7 @@ DataArrayDoubleCollection *DataArrayDoubleCollection::New(const std::vector< std return new DataArrayDoubleCollection(fieldNames); } -DataArrayDoubleCollection *DataArrayDoubleCollection::deepCpy() const +DataArrayDoubleCollection *DataArrayDoubleCollection::deepCopy() const { return new DataArrayDoubleCollection(*this); } @@ -64,7 +64,7 @@ void DataArrayDoubleCollection::copyFrom(const DataArrayDoubleCollection& other) const DataArrayDouble *otherArr(other._arrs[i].first); if(!thisArr || !otherArr) throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::copyFrom : empty DataArray !"); - thisArr->cpyFrom(*otherArr); + thisArr->deepCopyFrom(*otherArr); } } @@ -132,7 +132,7 @@ std::vector DataArrayDoubleCollection::retrieveFields() const const DataArrayDouble *DataArrayDoubleCollection::getFieldWithName(const std::string& name) const { std::vector vec; - for(std::vector< std::pair< MEDCouplingAutoRefCountObjectPtr, NatureOfField > >::const_iterator it=_arrs.begin();it!=_arrs.end();it++) + for(std::vector< std::pair< MCAuto, NatureOfField > >::const_iterator it=_arrs.begin();it!=_arrs.end();it++) { const DataArrayDouble *obj((*it).first); if(obj) @@ -151,7 +151,7 @@ const DataArrayDouble *DataArrayDoubleCollection::getFieldWithName(const std::st DataArrayDouble *DataArrayDoubleCollection::getFieldWithName(const std::string& name) { std::vector vec; - for(std::vector< std::pair< MEDCouplingAutoRefCountObjectPtr, NatureOfField > >::iterator it=_arrs.begin();it!=_arrs.end();it++) + for(std::vector< std::pair< MCAuto, NatureOfField > >::iterator it=_arrs.begin();it!=_arrs.end();it++) { DataArrayDouble *obj((*it).first); if(obj) @@ -306,7 +306,7 @@ DataArrayDoubleCollection::DataArrayDoubleCollection(const std::vector< std::pai _arrs[i].first->alloc(0,info.second); _arrs[i].first->setName(info.first); names[i]=info.second; - _arrs[i].second=ConservativeVolumic; + _arrs[i].second=IntensiveMaximum; } CheckDiscriminantNames(names); } @@ -319,28 +319,28 @@ DataArrayDoubleCollection::DataArrayDoubleCollection(const DataArrayDoubleCollec _arrs[i].second=other._arrs[i].second; const DataArrayDouble *da(other._arrs[i].first); if(da) - _arrs[i].first=da->deepCpy(); + _arrs[i].first=da->deepCopy(); } } std::size_t DataArrayDoubleCollection::getHeapMemorySizeWithoutChildren() const { std::size_t ret(sizeof(DataArrayDoubleCollection)); - ret+=_arrs.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr); + ret+=_arrs.capacity()*sizeof(MCAuto); return ret; } std::vector DataArrayDoubleCollection::getDirectChildrenWithNull() const { std::vector ret; - for(std::vector< std::pair< MEDCouplingAutoRefCountObjectPtr, NatureOfField > >::const_iterator it=_arrs.begin();it!=_arrs.end();it++) + for(std::vector< std::pair< MCAuto, NatureOfField > >::const_iterator it=_arrs.begin();it!=_arrs.end();it++) ret.push_back((const DataArrayDouble *)(*it).first); return ret; } void DataArrayDoubleCollection::updateTime() const { - for(std::vector< std::pair< MEDCouplingAutoRefCountObjectPtr, NatureOfField > >::const_iterator it=_arrs.begin();it!=_arrs.end();it++) + for(std::vector< std::pair< MCAuto, NatureOfField > >::const_iterator it=_arrs.begin();it!=_arrs.end();it++) { const DataArrayDouble *pt((*it).first); if(pt) @@ -358,7 +358,7 @@ void DataArrayDoubleCollection::CheckDiscriminantNames(const std::vector > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) + for(std::vector< std::pair > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) { int nbTuples((*it).first->getNumberOfCellsAtCurrentLevelGhost(ghostLev)); DataArrayDoubleCollection *dadc((*it).second); @@ -400,7 +400,7 @@ void MEDCouplingGridCollection::alloc(int ghostLev) void MEDCouplingGridCollection::dealloc() { - for(std::vector< std::pair > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) + for(std::vector< std::pair > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) { DataArrayDoubleCollection *dadc((*it).second); if(dadc) @@ -412,13 +412,13 @@ void MEDCouplingGridCollection::dealloc() void MEDCouplingGridCollection::spillInfoOnComponents(const std::vector< std::vector >& compNames) { - for(std::vector< std::pair > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) + for(std::vector< std::pair > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) (*it).second->spillInfoOnComponents(compNames); } void MEDCouplingGridCollection::spillNatures(const std::vector& nfs) { - for(std::vector< std::pair > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) + for(std::vector< std::pair > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) (*it).second->spillNatures(nfs); } @@ -445,7 +445,7 @@ std::vector MEDCouplingGridCollection::getNatures() const bool MEDCouplingGridCollection::presenceOf(const MEDCouplingCartesianAMRMeshGen *m, int& pos) const { int ret(0); - for(std::vector< std::pair > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++,ret++) + for(std::vector< std::pair > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++,ret++) { if((*it).first==m) { @@ -477,13 +477,13 @@ DataArrayDoubleCollection& MEDCouplingGridCollection::getFieldsAt(int pos) */ void MEDCouplingGridCollection::copyOverlappedZoneFrom(int ghostLev, const MEDCouplingGridCollection& other) { - for(std::vector< std::pair > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) + for(std::vector< std::pair > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) { std::vector deltaThis,deltaOther; std::vector< std::pair > rgThis((*it).first->positionRelativeToGodFather(deltaThis)); std::vector thisSt((*it).first->getImageMesh()->getCellGridStructure()); std::transform(thisSt.begin(),thisSt.end(),thisSt.begin(),std::bind2nd(std::plus(),2*ghostLev)); - for(std::vector< std::pair > >::const_iterator it2=other._map_of_dadc.begin();it2!=other._map_of_dadc.end();it2++) + for(std::vector< std::pair > >::const_iterator it2=other._map_of_dadc.begin();it2!=other._map_of_dadc.end();it2++) { std::vector< std::pair > rgOther((*it2).first->positionRelativeToGodFather(deltaOther)); if(MEDCouplingStructuredMesh::AreRangesIntersect(rgThis,rgOther)) @@ -501,7 +501,7 @@ void MEDCouplingGridCollection::copyOverlappedZoneFrom(int ghostLev, const MEDCo { const DataArrayDouble *otherArr((*it2).second->at(i)); DataArrayDouble *thisArr((*it).second->at(i)); - MEDCouplingAutoRefCountObjectPtr partOfOther(MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(otherSt,otherArr,pOther)); + MCAuto partOfOther(MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(otherSt,otherArr,pOther)); MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(thisSt,thisArr,pThis,partOfOther); } } @@ -513,14 +513,14 @@ void MEDCouplingGridCollection::SynchronizeFineToCoarse(int ghostLev, const MEDC { if(!fine || !coarse) throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::SynchronizeFineToCoarse : one or more input pointer is NULL !"); - const std::vector< std::pair > >& mf(fine->_map_of_dadc); - const std::vector< std::pair > >& mc(coarse->_map_of_dadc); - for(std::vector< std::pair > >::const_iterator it=mf.begin();it!=mf.end();it++) + const std::vector< std::pair > >& mf(fine->_map_of_dadc); + const std::vector< std::pair > >& mc(coarse->_map_of_dadc); + for(std::vector< std::pair > >::const_iterator it=mf.begin();it!=mf.end();it++) { const MEDCouplingCartesianAMRMeshGen *fineMesh((*it).first); const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh(fineMesh->getFather()); bool found(false); - for(std::vector< std::pair > >::const_iterator it0=mc.begin();it0!=mc.end() && !found;it0++) + for(std::vector< std::pair > >::const_iterator it0=mc.begin();it0!=mc.end() && !found;it0++) { if((*it0).first==fatherOfFineMesh) { @@ -540,14 +540,14 @@ void MEDCouplingGridCollection::SynchronizeCoarseToFine(int ghostLev, const MEDC { if(!fine || !coarse) throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::SynchronizeCoarseToFine : one or more input pointer is NULL !"); - const std::vector< std::pair > >& mf(fine->_map_of_dadc); - const std::vector< std::pair > >& mc(coarse->_map_of_dadc); - for(std::vector< std::pair > >::const_iterator it=mf.begin();it!=mf.end();it++) + const std::vector< std::pair > >& mf(fine->_map_of_dadc); + const std::vector< std::pair > >& mc(coarse->_map_of_dadc); + for(std::vector< std::pair > >::const_iterator it=mf.begin();it!=mf.end();it++) { const MEDCouplingCartesianAMRMeshGen *fineMesh((*it).first); const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh(fineMesh->getFather()); bool found(false); - for(std::vector< std::pair > >::const_iterator it0=mc.begin();it0!=mc.end() && !found;it0++) + for(std::vector< std::pair > >::const_iterator it0=mc.begin();it0!=mc.end() && !found;it0++) { if((*it0).first==fatherOfFineMesh) { @@ -610,7 +610,7 @@ std::vector< std::pair > ret; std::map > m; - for(std::vector< std::pair > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) + for(std::vector< std::pair > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) { const MEDCouplingCartesianAMRMeshGen *fineMesh((*it).first); const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh(fineMesh->getFather()); @@ -639,14 +639,14 @@ void MEDCouplingGridCollection::SynchronizeCoarseToFineOnlyInGhostZone(int ghost { if(!fine || !coarse) throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::SynchronizeCoarseToFineOnlyInGhostZone : one or more input pointer is NULL !"); - const std::vector< std::pair > >& mf(fine->_map_of_dadc); - const std::vector< std::pair > >& mc(coarse->_map_of_dadc); - for(std::vector< std::pair > >::const_iterator it=mf.begin();it!=mf.end();it++) + const std::vector< std::pair > >& mf(fine->_map_of_dadc); + const std::vector< std::pair > >& mc(coarse->_map_of_dadc); + for(std::vector< std::pair > >::const_iterator it=mf.begin();it!=mf.end();it++) { const MEDCouplingCartesianAMRMeshGen *fineMesh((*it).first); const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh(fineMesh->getFather()); bool found(false); - for(std::vector< std::pair > >::const_iterator it0=mc.begin();it0!=mc.end() && !found;it0++) + for(std::vector< std::pair > >::const_iterator it0=mc.begin();it0!=mc.end() && !found;it0++) { if((*it0).first==fatherOfFineMesh) { @@ -664,7 +664,7 @@ void MEDCouplingGridCollection::SynchronizeCoarseToFineOnlyInGhostZone(int ghost void MEDCouplingGridCollection::fillIfInTheProgenyOf(const std::string& fieldName, const MEDCouplingCartesianAMRMeshGen *head, std::vector& recurseArrs) const { - for(std::vector< std::pair > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) + for(std::vector< std::pair > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) { const MEDCouplingCartesianAMRMeshGen *a((*it).first); if(head==a || head->isObjectInTheProgeny(a)) @@ -696,28 +696,28 @@ MEDCouplingGridCollection::MEDCouplingGridCollection(const MEDCouplingGridCollec _map_of_dadc[i].first=newGf->getMeshAtPosition(pos); const DataArrayDoubleCollection *dac(other._map_of_dadc[i].second); if(dac) - _map_of_dadc[i].second=dac->deepCpy(); + _map_of_dadc[i].second=dac->deepCopy(); } } std::size_t MEDCouplingGridCollection::getHeapMemorySizeWithoutChildren() const { std::size_t ret(sizeof(MEDCouplingGridCollection)); - ret+=_map_of_dadc.capacity()*sizeof(std::pair >); + ret+=_map_of_dadc.capacity()*sizeof(std::pair >); return ret; } std::vector MEDCouplingGridCollection::getDirectChildrenWithNull() const { std::vector ret; - for(std::vector< std::pair > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) + for(std::vector< std::pair > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) ret.push_back((const DataArrayDoubleCollection *)(*it).second); return ret; } void MEDCouplingGridCollection::updateTime() const { - for(std::vector< std::pair > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) + for(std::vector< std::pair > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) { const MEDCouplingCartesianAMRMeshGen *a((*it).first); if(a) @@ -771,7 +771,7 @@ MEDCouplingDataForGodFather::MEDCouplingDataForGodFather(const MEDCouplingDataFo { const MEDCouplingCartesianAMRMesh *gf(other._gf); if(gf) - _gf=gf->deepCpy(0); + _gf=gf->deepCopy(0); _tlc.keepTrackOfNewTL(_gf); } } @@ -795,7 +795,7 @@ MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::New(MEDCouplingCartesianAMRMes fieldNames2[i].second=(int)fieldNames[i].second.size(); compNames[i]=fieldNames[i].second; } - MEDCouplingAutoRefCountObjectPtr ret(New(gf,fieldNames2,ghostLev)); + MCAuto ret(New(gf,fieldNames2,ghostLev)); ret->spillInfoOnComponents(compNames); return ret.retn(); } @@ -809,7 +809,7 @@ MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::New(MEDCouplingCartesianAMRMes void MEDCouplingAMRAttribute::spillInfoOnComponents(const std::vector< std::vector >& compNames) { _tlc.checkConst(); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_levs.begin();it!=_levs.end();it++) + for(std::vector< MCAuto >::iterator it=_levs.begin();it!=_levs.end();it++) (*it)->spillInfoOnComponents(compNames); } @@ -820,11 +820,11 @@ void MEDCouplingAMRAttribute::spillInfoOnComponents(const std::vector< std::vect void MEDCouplingAMRAttribute::spillNatures(const std::vector& nfs) { _tlc.checkConst(); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_levs.begin();it!=_levs.end();it++) + for(std::vector< MCAuto >::iterator it=_levs.begin();it!=_levs.end();it++) (*it)->spillNatures(nfs); } -MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::deepCpy() const +MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::deepCopy() const { return new MEDCouplingAMRAttribute(*this,true); } @@ -853,7 +853,7 @@ int MEDCouplingAMRAttribute::getNumberOfLevels() const */ std::vector MEDCouplingAMRAttribute::retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_levs.begin();it!=_levs.end();it++) + for(std::vector< MCAuto >::const_iterator it=_levs.begin();it!=_levs.end();it++) { int tmp(-1); if((*it)->presenceOf(mesh,tmp)) @@ -870,7 +870,7 @@ std::vector MEDCouplingAMRAttribute::retrieveFieldsOn(MEDCoup */ const DataArrayDouble *MEDCouplingAMRAttribute::getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_levs.begin();it!=_levs.end();it++) + for(std::vector< MCAuto >::const_iterator it=_levs.begin();it!=_levs.end();it++) { int tmp(-1); if((*it)->presenceOf(mesh,tmp)) @@ -884,7 +884,7 @@ const DataArrayDouble *MEDCouplingAMRAttribute::getFieldOn(MEDCouplingCartesianA DataArrayDouble *MEDCouplingAMRAttribute::getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_levs.begin();it!=_levs.end();it++) + for(std::vector< MCAuto >::iterator it=_levs.begin();it!=_levs.end();it++) { int tmp(-1); if((*it)->presenceOf(mesh,tmp)) @@ -906,7 +906,7 @@ MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnRecurseWithoutO { std::vector recurseArrs; std::size_t lev(0); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_levs.begin();it!=_levs.end();it++,lev++) + for(std::vector< MCAuto >::const_iterator it=_levs.begin();it!=_levs.end();it++,lev++) { int tmp(-1); if((*it)->presenceOf(mesh,tmp)) @@ -936,7 +936,7 @@ MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnRecurseWithoutO MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnWithGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const { const DataArrayDouble *arr(0); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_levs.begin();it!=_levs.end();it++) + for(std::vector< MCAuto >::const_iterator it=_levs.begin();it!=_levs.end();it++) { int tmp(-1); if((*it)->presenceOf(mesh,tmp)) @@ -947,8 +947,8 @@ MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnWithGhost(MEDCo } if(!arr) throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::buildCellFieldOnWithGhost : the mesh specified is not in the progeny of this !"); - MEDCouplingAutoRefCountObjectPtr im(mesh->getImageMesh()->buildWithGhost(_ghost_lev)); - MEDCouplingAutoRefCountObjectPtr ret(MEDCouplingFieldDouble::New(ON_CELLS)); + MCAuto im(mesh->getImageMesh()->buildWithGhost(_ghost_lev)); + MCAuto ret(MEDCouplingFieldDouble::New(ON_CELLS)); ret->setMesh(im); ret->setArray(const_cast(arr)); ret->setName(arr->getName()); @@ -966,7 +966,7 @@ MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnWithGhost(MEDCo MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const { const DataArrayDouble *arr(0); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_levs.begin();it!=_levs.end();it++) + for(std::vector< MCAuto >::const_iterator it=_levs.begin();it!=_levs.end();it++) { int tmp(-1); if((*it)->presenceOf(mesh,tmp)) @@ -978,9 +978,9 @@ MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost(ME if(!arr) throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost : the mesh specified is not in the progeny of this !"); // - MEDCouplingAutoRefCountObjectPtr im(mesh->getImageMesh()->buildWithGhost(_ghost_lev)); + MCAuto im(mesh->getImageMesh()->buildWithGhost(_ghost_lev)); std::vector cgs(mesh->getImageMesh()->getCellGridStructure()),cgsWG(im->getCellGridStructure()); - MEDCouplingAutoRefCountObjectPtr arr2(DataArrayDouble::New()); + MCAuto arr2(DataArrayDouble::New()); arr2->alloc(mesh->getImageMesh()->getNumberOfCells(),arr->getNumberOfComponents()); std::vector< std::pair > cgs2(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(cgs)); MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(cgs2,_ghost_lev); @@ -988,7 +988,7 @@ MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost(ME MEDCouplingIMesh::SpreadCoarseToFine(arr,cgsWG,arr2,cgs2,fakeFactors); arr2->copyStringInfoFrom(*arr); // - MEDCouplingAutoRefCountObjectPtr ret(MEDCouplingFieldDouble::New(ON_CELLS)); + MCAuto ret(MEDCouplingFieldDouble::New(ON_CELLS)); ret->setMesh(mesh->getImageMesh()); ret->setArray(arr2); ret->setName(arr->getName()); @@ -1027,7 +1027,7 @@ std::string MEDCouplingAMRAttribute::writeVTHB(const std::string& fileName) cons { std::vector patches(gf->retrieveGridsAt(i)); std::size_t sz(patches.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr > patchesSafe(sz); + std::vector< MCAuto > patchesSafe(sz); for(std::size_t j=0;jgetFieldsAt(tmp)); std::vector arrs(ddc.retrieveFields()); std::size_t nbFields(arrs.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr > arrsSafe(nbFields),arrs2Safe(nbFields); + std::vector< MCAuto > arrsSafe(nbFields),arrs2Safe(nbFields); std::vector< const MEDCouplingFieldDouble *> fields(nbFields); - std::vector< MEDCouplingAutoRefCountObjectPtr > fieldsSafe(nbFields); + std::vector< MCAuto > fieldsSafe(nbFields); for(std::size_t pp=0;pp im(mesh->getImageMesh()->buildWithGhost(_ghost_lev)); + MCAuto im(mesh->getImageMesh()->buildWithGhost(_ghost_lev)); std::vector cgs(mesh->getImageMesh()->getCellGridStructure()),cgsWG(im->getCellGridStructure()); arrs2Safe[pp]=DataArrayDouble::New(); arrs2Safe[pp]->alloc(mesh->getImageMesh()->getNumberOfCells(),arrs[pp]->getNumberOfComponents()); @@ -1127,7 +1127,7 @@ MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::projectTo(MEDCouplingCartesian if(!lev0) throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::projectTo : lev0 is NULL !"); std::vector< std::pair < std::string, std::vector > > fieldNames(lev0->getInfoOnComponents()); - MEDCouplingAutoRefCountObjectPtr ret(MEDCouplingAMRAttribute::New(targetGF,fieldNames,_ghost_lev)); + MCAuto ret(MEDCouplingAMRAttribute::New(targetGF,fieldNames,_ghost_lev)); ret->spillNatures(lev0->getNatures()); ret->alloc(); int nbLevs(getNumberOfLevels()); @@ -1352,7 +1352,7 @@ void MEDCouplingAMRAttribute::synchronizeAllGhostZonesAtASpecifiedLevelUsingOnly void MEDCouplingAMRAttribute::alloc() { _tlc.resetState(); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_levs.begin();it!=_levs.end();it++) + for(std::vector< MCAuto >::iterator it=_levs.begin();it!=_levs.end();it++) { MEDCouplingGridCollection *elt(*it); if(elt) @@ -1369,7 +1369,7 @@ void MEDCouplingAMRAttribute::alloc() void MEDCouplingAMRAttribute::dealloc() { _tlc.checkConst(); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_levs.begin();it!=_levs.end();it++) + for(std::vector< MCAuto >::iterator it=_levs.begin();it!=_levs.end();it++) { MEDCouplingGridCollection *elt(*it); if(elt) @@ -1388,14 +1388,14 @@ bool MEDCouplingAMRAttribute::changeGodFather(MEDCouplingCartesianAMRMesh *gf) std::size_t MEDCouplingAMRAttribute::getHeapMemorySizeWithoutChildren() const { std::size_t ret(sizeof(MEDCouplingAMRAttribute)); - ret+=_levs.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr); + ret+=_levs.capacity()*sizeof(MCAuto); return ret; } std::vector MEDCouplingAMRAttribute::getDirectChildrenWithNull() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_levs.begin();it!=_levs.end();it++) + for(std::vector< MCAuto >::const_iterator it=_levs.begin();it!=_levs.end();it++) ret.push_back((const MEDCouplingGridCollection *)*it); return ret; } @@ -1413,7 +1413,7 @@ MEDCouplingAMRAttribute::MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf { std::vector patches(gf->retrieveGridsAt(i)); std::size_t sz(patches.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr > patchesSafe(patches.size()); + std::vector< MCAuto > patchesSafe(patches.size()); for(std::size_t j=0;j ms(sz); @@ -1460,7 +1460,7 @@ MEDCouplingAMRAttribute::MEDCouplingAMRAttribute(const MEDCouplingAMRAttribute& const MEDCouplingGridCollection *elt(other._levs[i]); if(elt) { - _levs[i]=other._levs[i]->deepCpy(_gf,other._gf); + _levs[i]=other._levs[i]->deepCopy(_gf,other._gf); } } //_cross_lev_neighbors(other._cross_lev_neighbors) @@ -1506,7 +1506,7 @@ MEDCouplingAMRAttribute::MEDCouplingAMRAttribute(const MEDCouplingAMRAttribute& const DataArrayDoubleCollection& MEDCouplingAMRAttribute::findCollectionAttachedTo(const MEDCouplingCartesianAMRMeshGen *m) const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_levs.begin();it!=_levs.end();it++) + for(std::vector< MCAuto >::const_iterator it=_levs.begin();it!=_levs.end();it++) { const MEDCouplingGridCollection *elt(*it); if(elt) diff --git a/src/MEDCoupling/MEDCouplingAMRAttribute.hxx b/src/MEDCoupling/MEDCouplingAMRAttribute.hxx index 4b46ad4c4..389942cf2 100644 --- a/src/MEDCoupling/MEDCouplingAMRAttribute.hxx +++ b/src/MEDCoupling/MEDCouplingAMRAttribute.hxx @@ -32,7 +32,7 @@ namespace MEDCoupling { public: static DataArrayDoubleCollection *New(const std::vector< std::pair >& fieldNames); - DataArrayDoubleCollection *deepCpy() const; + DataArrayDoubleCollection *deepCopy() const; void allocTuples(int nbOfTuples); void dellocTuples(); void copyFrom(const DataArrayDoubleCollection& other); @@ -64,14 +64,14 @@ namespace MEDCoupling static void CheckSameNatures(NatureOfField n1, NatureOfField n2); static void CheckValidNature(NatureOfField n); private: - std::vector< std::pair< MEDCouplingAutoRefCountObjectPtr, NatureOfField > > _arrs; + std::vector< std::pair< MCAuto, NatureOfField > > _arrs; }; class MEDCouplingGridCollection : public RefCountObject, public TimeLabel { public: static MEDCouplingGridCollection *New(const std::vector& ms, const std::vector< std::pair >& fieldNames); - MEDCouplingGridCollection *deepCpy(const MEDCouplingCartesianAMRMeshGen *newGf, const MEDCouplingCartesianAMRMeshGen *oldGf) const; + MEDCouplingGridCollection *deepCopy(const MEDCouplingCartesianAMRMeshGen *newGf, const MEDCouplingCartesianAMRMeshGen *oldGf) const; void alloc(int ghostLev); void dealloc(); void spillInfoOnComponents(const std::vector< std::vector >& compNames); @@ -96,7 +96,7 @@ namespace MEDCoupling std::vector getDirectChildrenWithNull() const; void updateTime() const; private: - std::vector< std::pair > > _map_of_dadc; + std::vector< std::pair > > _map_of_dadc; }; /// @endcond @@ -124,7 +124,7 @@ namespace MEDCoupling virtual bool changeGodFather(MEDCouplingCartesianAMRMesh *gf); MEDCouplingDataForGodFather(const MEDCouplingDataForGodFather& other, bool deepCpyGF); protected: - MEDCouplingAutoRefCountObjectPtr _gf; + MCAuto _gf; TimeLabelConstOverseer _tlc; }; @@ -135,7 +135,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair > >& fieldNames, int ghostLev); MEDCOUPLING_EXPORT void spillInfoOnComponents(const std::vector< std::vector >& compNames); MEDCOUPLING_EXPORT void spillNatures(const std::vector& nfs); - MEDCOUPLING_EXPORT MEDCouplingAMRAttribute *deepCpy() const; + MEDCOUPLING_EXPORT MEDCouplingAMRAttribute *deepCopy() const; MEDCOUPLING_EXPORT MEDCouplingAMRAttribute *deepCpyWithoutGodFather() const; MEDCOUPLING_EXPORT int getNumberOfLevels() const; MEDCOUPLING_EXPORT std::vector retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const; @@ -172,7 +172,7 @@ namespace MEDCoupling void synchronizeCoarseToFineByOneLevel(int level); private: int _ghost_lev; - std::vector< MEDCouplingAutoRefCountObjectPtr > _levs; + std::vector< MCAuto > _levs; std::vector< std::vector< std::pair > > _neighbors; std::vector< std::pair > _mixed_lev_neighbors; std::vector< std::vector< std::pair > > _cross_lev_neighbors; diff --git a/src/MEDCoupling/MEDCouplingAutoRefCountObjectPtr.hxx b/src/MEDCoupling/MEDCouplingAutoRefCountObjectPtr.hxx deleted file mode 100644 index 6194853e3..000000000 --- a/src/MEDCoupling/MEDCouplingAutoRefCountObjectPtr.hxx +++ /dev/null @@ -1,79 +0,0 @@ -// 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, 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 -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : Anthony Geay (CEA/DEN) - -#ifndef __PARAMEDMEM_MEDCOUPLINGAUTOREFCOUNTOBJECTPTR_HXX__ -#define __PARAMEDMEM_MEDCOUPLINGAUTOREFCOUNTOBJECTPTR_HXX__ - -#include "MEDCouplingRefCountObject.hxx" -#include "InterpKernelException.hxx" - -namespace MEDCoupling -{ - template - class MEDCouplingAutoRefCountObjectPtr - { - public: - MEDCouplingAutoRefCountObjectPtr(const MEDCouplingAutoRefCountObjectPtr& other):_ptr(0) { referPtr(other._ptr); } - MEDCouplingAutoRefCountObjectPtr(T *ptr=0):_ptr(ptr) { } - ~MEDCouplingAutoRefCountObjectPtr() { destroyPtr(); } - bool operator==(const MEDCouplingAutoRefCountObjectPtr& other) const { return _ptr==other._ptr; } - bool operator==(const T *other) const { return _ptr==other; } - MEDCouplingAutoRefCountObjectPtr &operator=(const MEDCouplingAutoRefCountObjectPtr& other) { if(_ptr!=other._ptr) { destroyPtr(); referPtr(other._ptr); } return *this; } - MEDCouplingAutoRefCountObjectPtr &operator=(T *ptr) { if(_ptr!=ptr) { destroyPtr(); _ptr=ptr; } return *this; } - T *operator->() { return _ptr ; } - const T *operator->() const { return _ptr; } - T& operator*() { return *_ptr; } - const T& operator*() const { return *_ptr; } - operator T *() { return _ptr; } - operator const T *() const { return _ptr; } - T *retn() { if(_ptr) _ptr->incrRef(); return _ptr; } - private: - void referPtr(T *ptr) { _ptr=ptr; if(_ptr) _ptr->incrRef(); } - void destroyPtr() { if(_ptr) _ptr->decrRef(); } - private: - T *_ptr; - }; - - template - typename MEDCoupling::MEDCouplingAutoRefCountObjectPtr DynamicCast(typename MEDCoupling::MEDCouplingAutoRefCountObjectPtr& autoSubPtr) throw() - { - T *subPtr(autoSubPtr); - U *ptr(dynamic_cast(subPtr)); - typename MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret(ptr); - if(ptr) - ptr->incrRef(); - return ret; - } - - template - typename MEDCoupling::MEDCouplingAutoRefCountObjectPtr DynamicCastSafe(typename MEDCoupling::MEDCouplingAutoRefCountObjectPtr& autoSubPtr) - { - T *subPtr(autoSubPtr); - U *ptr(dynamic_cast(subPtr)); - if(subPtr && !ptr) - throw INTERP_KERNEL::Exception("DynamicCastSafe : U is not a subtype of T !"); - typename MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret(ptr); - if(ptr) - ptr->incrRef(); - return ret; - } -} - -#endif diff --git a/src/MEDCoupling/MEDCouplingCMesh.cxx b/src/MEDCoupling/MEDCouplingCMesh.cxx index c8949e32d..870af2c38 100644 --- a/src/MEDCoupling/MEDCouplingCMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCMesh.cxx @@ -41,15 +41,15 @@ MEDCouplingCMesh::MEDCouplingCMesh(const MEDCouplingCMesh& other, bool deepCopy) if(deepCopy) { if(other._x_array) - _x_array=other._x_array->deepCpy(); + _x_array=other._x_array->deepCopy(); else _x_array=0; if(other._y_array) - _y_array=other._y_array->deepCpy(); + _y_array=other._y_array->deepCopy(); else _y_array=0; if(other._z_array) - _z_array=other._z_array->deepCpy(); + _z_array=other._z_array->deepCopy(); else _z_array=0; } @@ -89,7 +89,7 @@ MEDCouplingCMesh *MEDCouplingCMesh::New(const std::string& meshName) return ret; } -MEDCouplingCMesh *MEDCouplingCMesh::deepCpy() const +MEDCouplingCMesh *MEDCouplingCMesh::deepCopy() const { return clone(true); } @@ -101,14 +101,14 @@ MEDCouplingCMesh *MEDCouplingCMesh::clone(bool recDeepCpy) const MEDCouplingCurveLinearMesh *MEDCouplingCMesh::buildCurveLinear() const { - checkCoherency(); + checkConsistencyLight(); int dim(getSpaceDimension()); - MEDCouplingAutoRefCountObjectPtr ret(MEDCouplingCurveLinearMesh::New()); + MCAuto ret(MEDCouplingCurveLinearMesh::New()); ret->MEDCouplingStructuredMesh::operator=(*this); INTERP_KERNEL::AutoPtr ngs(new int[dim]); getNodeGridStructure(ngs); ret->setNodeGridStructure(ngs,ngs+dim); - MEDCouplingAutoRefCountObjectPtr coo(getCoordinatesAndOwner()); + MCAuto coo(getCoordinatesAndOwner()); ret->setCoords(coo); return ret.retn(); } @@ -225,7 +225,7 @@ void MEDCouplingCMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *ot throw INTERP_KERNEL::Exception("MEDCouplingCMesh::checkDeepEquivalOnSameNodesWith : Meshes are not the same !"); } -void MEDCouplingCMesh::checkCoherency() const +void MEDCouplingCMesh::checkConsistencyLight() const { const char msg0[]="Invalid "; const char msg1[]=" array ! Must contain more than 1 element."; @@ -272,9 +272,9 @@ void MEDCouplingCMesh::checkCoherency() const } } -void MEDCouplingCMesh::checkCoherency1(double eps) const +void MEDCouplingCMesh::checkConsistency(double eps) const { - checkCoherency(); + checkConsistencyLight(); if(_x_array) _x_array->checkMonotonic(true, eps); if(_y_array) @@ -325,17 +325,17 @@ std::vector MEDCouplingCMesh::getNodeGridStructure() const MEDCouplingStructuredMesh *MEDCouplingCMesh::buildStructuredSubPart(const std::vector< std::pair >& cellPart) const { - checkCoherency(); + checkConsistencyLight(); int dim(getSpaceDimension()); if(dim!=(int)cellPart.size()) { std::ostringstream oss; oss << "MEDCouplingCMesh::buildStructuredSubPart : the space dimension is " << dim << " and cell part size is " << cellPart.size() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDCouplingAutoRefCountObjectPtr ret(dynamic_cast(deepCpy())); + MCAuto ret(dynamic_cast(deepCopy())); for(int i=0;i tmp(ret->getCoordsAt(i)->selectByTupleId2(cellPart[i].first,cellPart[i].second+1,1)); + MCAuto tmp(ret->getCoordsAt(i)->selectByTupleIdSafeSlice(cellPart[i].first,cellPart[i].second+1,1)); ret->setCoordsAt(i,tmp); } return ret.retn(); @@ -691,7 +691,7 @@ MEDCouplingMesh *MEDCouplingCMesh::mergeMyselfWith(const MEDCouplingMesh *other) */ DataArrayDouble *MEDCouplingCMesh::getCoordinatesAndOwner() const { - MEDCouplingAutoRefCountObjectPtr ret(DataArrayDouble::New()); + MCAuto ret(DataArrayDouble::New()); int spaceDim(getSpaceDimension()),nbNodes(getNumberOfNodes()); ret->alloc(nbNodes,spaceDim); double *pt(ret->getPointer()); @@ -722,7 +722,7 @@ DataArrayDouble *MEDCouplingCMesh::getCoordinatesAndOwner() const * components. The caller is to delete this array using decrRef() as it is * no more needed. */ -DataArrayDouble *MEDCouplingCMesh::getBarycenterAndOwner() const +DataArrayDouble *MEDCouplingCMesh::computeCellCenterOfMass() const { DataArrayDouble *ret=DataArrayDouble::New(); int spaceDim=getSpaceDimension(); @@ -754,7 +754,7 @@ DataArrayDouble *MEDCouplingCMesh::getBarycenterAndOwner() const DataArrayDouble *MEDCouplingCMesh::computeIsoBarycenterOfNodesPerCell() const { - return MEDCouplingCMesh::getBarycenterAndOwner(); + return MEDCouplingCMesh::computeCellCenterOfMass(); } void MEDCouplingCMesh::renumberCells(const int *old2NewBg, bool check) @@ -865,7 +865,7 @@ void MEDCouplingCMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData thisArr[i]->writeVTK(ofs,8,"Array",byteData); else { - MEDCouplingAutoRefCountObjectPtr coo=DataArrayDouble::New(); coo->alloc(1,1); + MCAuto coo=DataArrayDouble::New(); coo->alloc(1,1); coo->setIJ(0,0,0.); coo->writeVTK(ofs,8,"Array",byteData); } diff --git a/src/MEDCoupling/MEDCouplingCMesh.hxx b/src/MEDCoupling/MEDCouplingCMesh.hxx index 02df848e2..40eab56be 100644 --- a/src/MEDCoupling/MEDCouplingCMesh.hxx +++ b/src/MEDCoupling/MEDCouplingCMesh.hxx @@ -33,7 +33,7 @@ namespace MEDCoupling public: MEDCOUPLING_EXPORT static MEDCouplingCMesh *New(); MEDCOUPLING_EXPORT static MEDCouplingCMesh *New(const std::string& meshName); - MEDCOUPLING_EXPORT MEDCouplingCMesh *deepCpy() const; + MEDCOUPLING_EXPORT MEDCouplingCMesh *deepCopy() const; MEDCOUPLING_EXPORT MEDCouplingCMesh *clone(bool recDeepCpy) const; MEDCOUPLING_EXPORT MEDCouplingCurveLinearMesh *buildCurveLinear() const; MEDCOUPLING_EXPORT void updateTime() const; @@ -47,8 +47,8 @@ namespace MEDCoupling DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const; MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, DataArrayInt *&cellCor) const; - MEDCOUPLING_EXPORT void checkCoherency() const; - MEDCOUPLING_EXPORT void checkCoherency1(double eps=1e-12) const; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; + MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const; MEDCOUPLING_EXPORT int getSpaceDimension() const; MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector& coo) const; MEDCOUPLING_EXPORT std::string simpleRepr() const; @@ -69,7 +69,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void scale(const double *point, double factor); MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const; MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const; - MEDCOUPLING_EXPORT DataArrayDouble *getBarycenterAndOwner() const; + MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const; MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const; MEDCOUPLING_EXPORT void renumberCells(const int *old2NewBg, bool check=true); //some useful methods @@ -86,7 +86,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT std::string getVTKFileExtension() const; private: MEDCouplingCMesh(); - MEDCouplingCMesh(const MEDCouplingCMesh& other, bool deepCpy); + MEDCouplingCMesh(const MEDCouplingCMesh& other, bool deepCopy); ~MEDCouplingCMesh(); void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const; std::string getVTKDataSetType() const; diff --git a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx index 669cee2b6..b8ee9e24e 100644 --- a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx @@ -59,7 +59,7 @@ MEDCouplingCartesianAMRPatchGen::MEDCouplingCartesianAMRPatchGen(const MEDCoupli { const MEDCouplingCartesianAMRMeshGen *mesh(other._mesh); if(mesh) - _mesh=mesh->deepCpy(father); + _mesh=mesh->deepCopy(father); } const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRPatchGen::getMeshSafe() const @@ -97,7 +97,7 @@ MEDCouplingCartesianAMRPatch::MEDCouplingCartesianAMRPatch(MEDCouplingCartesianA throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch constructor : space dimension of father and input bottomLeft/topRight size mismatches !"); } -MEDCouplingCartesianAMRPatch *MEDCouplingCartesianAMRPatch::deepCpy(MEDCouplingCartesianAMRMeshGen *father) const +MEDCouplingCartesianAMRPatch *MEDCouplingCartesianAMRPatch::deepCopy(MEDCouplingCartesianAMRMeshGen *father) const { return new MEDCouplingCartesianAMRPatch(*this,father); } @@ -372,7 +372,7 @@ void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoMixedLev(int ghost std::vector< std::pair > p2RefinedAbs(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dimsP2NotRefined)); std::vector dimsP2RefinedGhost(dimsP2Refined.size()); std::transform(dimsP2Refined.begin(),dimsP2Refined.end(),dimsP2RefinedGhost.begin(),std::bind2nd(std::plus(),2*ghostLev)); - MEDCouplingAutoRefCountObjectPtr fineP2(DataArrayDouble::New()); fineP2->alloc(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(dimsP2RefinedGhost),dataOnP2->getNumberOfComponents()); + MCAuto fineP2(DataArrayDouble::New()); fineP2->alloc(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(dimsP2RefinedGhost),dataOnP2->getNumberOfComponents()); MEDCouplingIMesh::SpreadCoarseToFineGhost(dataOnP2,dimsP2NotRefined,fineP2,p2RefinedAbs,factors,ghostLev); if(isConservative) { @@ -526,7 +526,7 @@ void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoInternal(int ghost ApplyFactorsOnCompactFrmt(dimsFine,factors); ApplyAllGhostOnCompactFrmt(dimsFine,ghostLev); // - MEDCouplingAutoRefCountObjectPtr ghostVals(MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(dimsFine),dataOnP2,tmp2)); + MCAuto ghostVals(MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(dimsFine),dataOnP2,tmp2)); MEDCouplingIMesh::CondenseFineToCoarse(dimsCoarse,ghostVals,interstRange,fakeFactors,dataOnP1); } @@ -572,7 +572,7 @@ MEDCouplingCartesianAMRPatchGF::MEDCouplingCartesianAMRPatchGF(MEDCouplingCartes { } -MEDCouplingCartesianAMRPatchGF *MEDCouplingCartesianAMRPatchGF::deepCpy(MEDCouplingCartesianAMRMeshGen *father) const +MEDCouplingCartesianAMRPatchGF *MEDCouplingCartesianAMRPatchGF::deepCopy(MEDCouplingCartesianAMRMeshGen *father) const { return new MEDCouplingCartesianAMRPatchGF(*this,father); } @@ -613,7 +613,7 @@ void MEDCouplingCartesianAMRMeshGen::setFactors(const std::vector& newFacto int MEDCouplingCartesianAMRMeshGen::getMaxNumberOfLevelsRelativeToThis() const { int ret(1); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_patches.begin();it!=_patches.end();it++) + for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) ret=std::max(ret,(*it)->getMaxNumberOfLevelsRelativeToThis()+1); return ret; } @@ -637,7 +637,7 @@ int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsAtCurrentLevel() const */ int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsAtCurrentLevelGhost(int ghostLev) const { - MEDCouplingAutoRefCountObjectPtr tmp(_mesh->buildWithGhost(ghostLev)); + MCAuto tmp(_mesh->buildWithGhost(ghostLev)); return tmp->getNumberOfCells(); } @@ -648,7 +648,7 @@ int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsAtCurrentLevelGhost(int ghos int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithOverlap() const { int ret(_mesh->getNumberOfCells()); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_patches.begin();it!=_patches.end();it++) + for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) { ret+=(*it)->getNumberOfCellsRecursiveWithOverlap(); } @@ -665,7 +665,7 @@ int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithOverlap() const int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithoutOverlap() const { int ret(_mesh->getNumberOfCells()); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_patches.begin();it!=_patches.end();it++) + for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) { ret-=(*it)->getNumberOfOverlapedCellsForFather(); ret+=(*it)->getNumberOfCellsRecursiveWithoutOverlap(); @@ -746,10 +746,10 @@ std::vector MEDCouplingCartesianAMRMeshGen::r void MEDCouplingCartesianAMRMeshGen::addPatch(const std::vector< std::pair >& bottomLeftTopRight, const std::vector& factors) { checkFactorsAndIfNotSetAssign(factors); - MEDCouplingAutoRefCountObjectPtr mesh(static_cast(_mesh->buildStructuredSubPart(bottomLeftTopRight))); + MCAuto mesh(static_cast(_mesh->buildStructuredSubPart(bottomLeftTopRight))); mesh->refineWithFactor(factors); - MEDCouplingAutoRefCountObjectPtr zeMesh(new MEDCouplingCartesianAMRMeshSub(this,mesh)); - MEDCouplingAutoRefCountObjectPtr elt(new MEDCouplingCartesianAMRPatch(zeMesh,bottomLeftTopRight)); + MCAuto zeMesh(new MEDCouplingCartesianAMRMeshSub(this,mesh)); + MCAuto elt(new MEDCouplingCartesianAMRPatch(zeMesh,bottomLeftTopRight)); _patches.push_back(elt); declareAsNew(); } @@ -775,8 +775,8 @@ public: double getEfficiencyPerAxis(int axisId) const { return (double)_nb_of_true/((double)(_part[axisId].second-_part[axisId].first)); } void zipToFitOnCriterion(int minPatchLgth); void updateNumberOfTrue() const; - MEDCouplingAutoRefCountObjectPtr extractPart(const std::vector< std::pair >&partInGlobal) const; - MEDCouplingAutoRefCountObjectPtr deepCpy() const; + MCAuto extractPart(const std::vector< std::pair >&partInGlobal) const; + MCAuto deepCopy() const; protected: ~InternalPatch() { } private: @@ -803,9 +803,9 @@ void InternalPatch::updateNumberOfTrue() const _nb_of_true=(int)std::count(_crit.begin(),_crit.end(),true); } -MEDCouplingAutoRefCountObjectPtr InternalPatch::extractPart(const std::vector< std::pair >&partInGlobal) const +MCAuto InternalPatch::extractPart(const std::vector< std::pair >&partInGlobal) const { - MEDCouplingAutoRefCountObjectPtr ret(new InternalPatch); + MCAuto ret(new InternalPatch); std::vector cgs(computeCGS()); std::vector< std::pair > newPart; MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(_part,partInGlobal,newPart); @@ -815,9 +815,9 @@ MEDCouplingAutoRefCountObjectPtr InternalPatch::extractPart(const return ret; } -MEDCouplingAutoRefCountObjectPtr InternalPatch::deepCpy() const +MCAuto InternalPatch::deepCopy() const { - MEDCouplingAutoRefCountObjectPtr ret(new InternalPatch); + MCAuto ret(new InternalPatch); (*ret)=*this; return ret; } @@ -839,7 +839,7 @@ void DissectBigPatch(const INTERP_KERNEL::BoxSplittingOptions& bso, const Intern rectH[axisId].second=patchToBeSplit->getConstPart()[axisId].first+i; else rectH[axisId].first=patchToBeSplit->getConstPart()[axisId].first+i; - MEDCouplingAutoRefCountObjectPtr p(patchToBeSplit->deepCpy()); + MCAuto p(patchToBeSplit->deepCopy()); p->zipToFitOnCriterion(bso.getMinimumPatchLength()); efficiencyPerAxis[h]=p->getEfficiencyPerAxis(axisId); } @@ -1006,16 +1006,16 @@ bool TryAction4(const INTERP_KERNEL::BoxSplittingOptions& bso, const InternalPat return true; } -MEDCouplingAutoRefCountObjectPtr DealWithNoCut(const InternalPatch *patch) +MCAuto DealWithNoCut(const InternalPatch *patch) { - MEDCouplingAutoRefCountObjectPtr ret(const_cast(patch)); + MCAuto ret(const_cast(patch)); ret->incrRef(); return ret; } -void DealWithCut(double minPatchLgth, const InternalPatch *patchToBeSplit, int axisId, int cutPlace, std::vector >& listOfPatches) +void DealWithCut(double minPatchLgth, const InternalPatch *patchToBeSplit, int axisId, int cutPlace, std::vector >& listOfPatches) { - MEDCouplingAutoRefCountObjectPtr leftPart,rightPart; + MCAuto leftPart,rightPart; std::vector< std::pair > rect(patchToBeSplit->getConstPart()); std::vector< std::pair > leftRect(rect),rightRect(rect); leftRect[axisId].second=cutPlace+1; @@ -1039,7 +1039,7 @@ void MEDCouplingCartesianAMRMeshGen::removePatch(int patchId) { checkPatchId(patchId); int sz((int)_patches.size()),j(0); - std::vector< MEDCouplingAutoRefCountObjectPtr > patches(sz-1); + std::vector< MCAuto > patches(sz-1); for(int i=0;i cgs(_mesh->getCellGridStructure()); - std::vector< MEDCouplingAutoRefCountObjectPtr > listOfPatches,listOfPatchesOK; + std::vector< MCAuto > listOfPatches,listOfPatchesOK; // - MEDCouplingAutoRefCountObjectPtr p(new InternalPatch); + MCAuto p(new InternalPatch); p->setNumberOfTrue(MEDCouplingStructuredMesh::FindMinimalPartOf(bso.getMinimumPatchLength(),cgs,criterion,p->getCriterion(),p->getPart())); if(p->presenceOfTrue()) listOfPatches.push_back(p); while(!listOfPatches.empty()) { - std::vector< MEDCouplingAutoRefCountObjectPtr > listOfPatchesTmp; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=listOfPatches.begin();it!=listOfPatches.end();it++) + std::vector< MCAuto > listOfPatchesTmp; + for(std::vector< MCAuto >::iterator it=listOfPatches.begin();it!=listOfPatches.end();it++) { // int axisId,largestLength,cutPlace; @@ -1108,7 +1108,7 @@ void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KER } listOfPatches=listOfPatchesTmp; } - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=listOfPatchesOK.begin();it!=listOfPatchesOK.end();it++) + for(std::vector< MCAuto >::const_iterator it=listOfPatchesOK.begin();it!=listOfPatchesOK.end();it++) addPatch((*it)->getConstPart(),factors); declareAsNew(); } @@ -1137,7 +1137,7 @@ void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KER int MEDCouplingCartesianAMRMeshGen::getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const { int ret(0); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_patches.begin();it!=_patches.end();it++,ret++) + for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++,ret++) { if((*it)->getMesh()==mesh) return ret; @@ -1189,7 +1189,7 @@ DataArrayDouble *MEDCouplingCartesianAMRMeshGen::createCellFieldOnPatch(int patc throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::createCellFieldOnPatch : the input cell field array is NULL or not allocated !"); const MEDCouplingCartesianAMRPatch *patch(getPatch(patchId)); const MEDCouplingIMesh *fine(patch->getMesh()->getImageMesh()); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayDouble::New()); ret->alloc(fine->getNumberOfCells(),cellFieldOnThis->getNumberOfComponents()); + MCAuto ret(DataArrayDouble::New()); ret->alloc(fine->getNumberOfCells(),cellFieldOnThis->getNumberOfComponents()); ret->copyStringInfoFrom(*cellFieldOnThis); MEDCouplingIMesh::SpreadCoarseToFine(cellFieldOnThis,_mesh->getCellGridStructure(),ret,patch->getBLTRRange(),getFactors()); return ret.retn(); @@ -1377,7 +1377,7 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldComingFromPatchGhost(int patch DataArrayInt *MEDCouplingCartesianAMRMeshGen::findPatchesInTheNeighborhoodOf(int patchId, int ghostLev) const { int nbp(getNumberOfPatches()); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); for(int i=0;i part(_mesh->buildUnstructured()); + MCAuto part(_mesh->buildUnstructured()); std::vector bs(_mesh->getNumberOfCells(),false); std::vector cgs(_mesh->getCellGridStructure()); - std::vector< MEDCouplingAutoRefCountObjectPtr > msSafe(_patches.size()+1); + std::vector< MCAuto > msSafe(_patches.size()+1); std::size_t ii(0); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_patches.begin();it!=_patches.end();it++,ii++) + for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++,ii++) { MEDCouplingStructuredMesh::SwitchOnIdsFrom(cgs,(*it)->getBLTRRange(),bs); msSafe[ii+1]=(*it)->getMesh()->buildUnstructured(); } - MEDCouplingAutoRefCountObjectPtr eltsOff(DataArrayInt::BuildListOfSwitchedOff(bs)); + MCAuto eltsOff(DataArrayInt::BuildListOfSwitchedOff(bs)); msSafe[0]=static_cast(part->buildPartOfMySelf(eltsOff->begin(),eltsOff->end(),false)); std::vector< const MEDCouplingUMesh * > ms(msSafe.size()); for(std::size_t i=0;i cells; - std::vector< MEDCouplingAutoRefCountObjectPtr > cellsSafe; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_patches.begin();it!=_patches.end();it++) + std::vector< MCAuto > cellsSafe; + for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) { const MEDCouplingCartesianAMRPatch *patch(*it); if(patch) { - MEDCouplingAutoRefCountObjectPtr cell(patch->getMesh()->getImageMesh()->asSingleCell()); - MEDCouplingAutoRefCountObjectPtr cell1SGT(cell->build1SGTUnstructured()); + MCAuto cell(patch->getMesh()->getImageMesh()->asSingleCell()); + MCAuto cell1SGT(cell->build1SGTUnstructured()); cellsSafe.push_back(cell1SGT); cells.push_back(cell1SGT); } } @@ -1433,13 +1433,13 @@ MEDCoupling1SGTUMesh *MEDCouplingCartesianAMRMeshGen::buildMeshFromPatchEnvelop( MEDCoupling1SGTUMesh *MEDCouplingCartesianAMRMeshGen::buildMeshOfDirectChildrenOnly() const { std::vector patches; - std::vector< MEDCouplingAutoRefCountObjectPtr > patchesSafe; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_patches.begin();it!=_patches.end();it++) + std::vector< MCAuto > patchesSafe; + for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) { const MEDCouplingCartesianAMRPatch *patch(*it); if(patch) { - MEDCouplingAutoRefCountObjectPtr patchMesh(patch->getMesh()->getImageMesh()->build1SGTUnstructured()); + MCAuto patchMesh(patch->getMesh()->getImageMesh()->build1SGTUnstructured()); patchesSafe.push_back(patchMesh); patches.push_back(patchMesh); } } @@ -1458,23 +1458,23 @@ MEDCouplingFieldDouble *MEDCouplingCartesianAMRMeshGen::buildCellFieldOnRecurseW // std::vector bs(_mesh->getNumberOfCells(),false); std::vector cgs(_mesh->getCellGridStructure()); - std::vector< MEDCouplingAutoRefCountObjectPtr > msSafe(_patches.size()+1); + std::vector< MCAuto > msSafe(_patches.size()+1); std::size_t ii(0); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_patches.begin();it!=_patches.end();it++,ii++) + for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++,ii++) { MEDCouplingStructuredMesh::SwitchOnIdsFrom(cgs,(*it)->getBLTRRange(),bs); std::vector tmpArrs(extractSubTreeFromGlobalFlatten((*it)->getMesh(),recurseArrs)); msSafe[ii+1]=(*it)->getMesh()->buildCellFieldOnRecurseWithoutOverlapWithoutGhost(ghostSz,tmpArrs); } - MEDCouplingAutoRefCountObjectPtr eltsOff(DataArrayInt::BuildListOfSwitchedOff(bs)); + MCAuto eltsOff(DataArrayInt::BuildListOfSwitchedOff(bs)); // - MEDCouplingAutoRefCountObjectPtr ret(MEDCouplingFieldDouble::New(ON_CELLS)); - MEDCouplingAutoRefCountObjectPtr arr2(extractGhostFrom(ghostSz,recurseArrs[0])); + MCAuto ret(MEDCouplingFieldDouble::New(ON_CELLS)); + MCAuto arr2(extractGhostFrom(ghostSz,recurseArrs[0])); arr2=arr2->selectByTupleIdSafe(eltsOff->begin(),eltsOff->end()); ret->setArray(arr2); ret->setName(arr2->getName()); - MEDCouplingAutoRefCountObjectPtr part(_mesh->buildUnstructured()); - MEDCouplingAutoRefCountObjectPtr mesh(part->buildPartOfMySelf(eltsOff->begin(),eltsOff->end(),false)); + MCAuto part(_mesh->buildUnstructured()); + MCAuto mesh(part->buildPartOfMySelf(eltsOff->begin(),eltsOff->end(),false)); ret->setMesh(mesh); msSafe[0]=ret; // @@ -1495,7 +1495,7 @@ DataArrayDouble *MEDCouplingCartesianAMRMeshGen::extractGhostFrom(int ghostSz, c std::vector< std::pair > p(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(st)); std::transform(st.begin(),st.end(),st.begin(),std::bind2nd(std::plus(),2*ghostSz)); MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(p,ghostSz); - MEDCouplingAutoRefCountObjectPtr ret(MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,arr,p)); + MCAuto ret(MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,arr,p)); return ret.retn(); } @@ -1543,13 +1543,13 @@ MEDCouplingCartesianAMRMeshGen::MEDCouplingCartesianAMRMeshGen(const MEDCoupling { const MEDCouplingIMesh *mesh(other._mesh); if(mesh) - _mesh=static_cast(mesh->deepCpy()); + _mesh=static_cast(mesh->deepCopy()); std::size_t sz(other._patches.size()); for(std::size_t i=0;ideepCpy(this); + _patches[i]=patch->deepCopy(this); } } @@ -1563,7 +1563,7 @@ MEDCouplingCartesianAMRMeshGen::MEDCouplingCartesianAMRMeshGen(MEDCouplingIMesh { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen(MEDCouplingIMesh *mesh) constructor : The input mesh is null !"); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); _mesh=mesh; _mesh->incrRef(); } @@ -1592,29 +1592,29 @@ void MEDCouplingCartesianAMRMeshGen::checkFactorsAndIfNotSetAssign(const std::ve } } -void MEDCouplingCartesianAMRMeshGen::retrieveGridsAtInternal(int lev, std::vector< MEDCouplingAutoRefCountObjectPtr >& grids) const +void MEDCouplingCartesianAMRMeshGen::retrieveGridsAtInternal(int lev, std::vector< MCAuto >& grids) const { if(lev==0) { const MEDCouplingCartesianAMRMesh *thisc(dynamic_cast(this));//tony - MEDCouplingAutoRefCountObjectPtr elt(new MEDCouplingCartesianAMRPatchGF(const_cast(thisc))); + MCAuto elt(new MEDCouplingCartesianAMRPatchGF(const_cast(thisc))); grids.push_back(DynamicCastSafe(elt)); } else if(lev==1) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_patches.begin();it!=_patches.end();it++) + for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) { const MEDCouplingCartesianAMRPatch *pt(*it); if(pt) { - MEDCouplingAutoRefCountObjectPtr tmp1(*it); + MCAuto tmp1(*it); grids.push_back(DynamicCastSafe(tmp1)); } } } else { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_patches.begin();it!=_patches.end();it++) + for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) { const MEDCouplingCartesianAMRPatch *pt(*it); if(pt) @@ -1676,7 +1676,7 @@ std::vector MEDCouplingCartesianAMRMeshGen::extractSubT void MEDCouplingCartesianAMRMeshGen::dumpPatchesOf(const std::string& varName, std::ostream& oss) const { std::size_t j(0); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_patches.begin();it!=_patches.end();it++) + for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) { const MEDCouplingCartesianAMRPatch *patch(*it); if(patch) @@ -1709,7 +1709,7 @@ std::vector MEDCouplingCartesianAMRMeshGen::getDirectCh { std::vector ret; ret.push_back((const MEDCouplingIMesh *)_mesh); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_patches.begin();it!=_patches.end();it++) + for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) ret.push_back((const MEDCouplingCartesianAMRPatch*)*it); return ret; } @@ -1718,7 +1718,7 @@ void MEDCouplingCartesianAMRMeshGen::updateTime() const { if((const MEDCouplingIMesh *)_mesh) updateTimeWith(*_mesh); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_patches.begin();it!=_patches.end();it++) + for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) { const MEDCouplingCartesianAMRPatch *elt(*it); if(!elt) @@ -1815,7 +1815,7 @@ MEDCouplingCartesianAMRMeshSub::MEDCouplingCartesianAMRMeshSub(const MEDCoupling { } -MEDCouplingCartesianAMRMeshSub *MEDCouplingCartesianAMRMeshSub::deepCpy(MEDCouplingCartesianAMRMeshGen *fath) const +MEDCouplingCartesianAMRMeshSub *MEDCouplingCartesianAMRMeshSub::deepCopy(MEDCouplingCartesianAMRMeshGen *fath) const { return new MEDCouplingCartesianAMRMeshSub(*this,fath); } @@ -1880,7 +1880,7 @@ int MEDCouplingCartesianAMRMesh::getAbsoluteLevelRelativeTo(const MEDCouplingCar std::vector MEDCouplingCartesianAMRMesh::retrieveGridsAt(int absoluteLev) const { - std::vector< MEDCouplingAutoRefCountObjectPtr > rets; + std::vector< MCAuto > rets; retrieveGridsAtInternal(absoluteLev,rets); std::vector< MEDCouplingCartesianAMRPatchGen * > ret(rets.size()); for(std::size_t i=0;i MEDCouplingCartesianAMRMesh::retr return ret; } -MEDCouplingCartesianAMRMesh *MEDCouplingCartesianAMRMesh::deepCpy(MEDCouplingCartesianAMRMeshGen *father) const +MEDCouplingCartesianAMRMesh *MEDCouplingCartesianAMRMesh::deepCopy(MEDCouplingCartesianAMRMeshGen *father) const { if(father) - throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::deepCpy : specifying a not null father for a God Father object !"); + throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::deepCopy : specifying a not null father for a God Father object !"); return new MEDCouplingCartesianAMRMesh(*this); } @@ -1926,17 +1926,17 @@ void MEDCouplingCartesianAMRMesh::createPatchesFromCriterionML(const std::vector // std::vector elts(retrieveGridsAt((int)(i))); std::size_t sz(elts.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr > elts2(sz); - std::vector< MEDCouplingAutoRefCountObjectPtr > elts3(sz); + std::vector< MCAuto > elts2(sz); + std::vector< MCAuto > elts3(sz); for(std::size_t ii=0;ii > fieldNames(1); fieldNames[0].first=TMP_STR; fieldNames[0].second=1; - MEDCouplingAutoRefCountObjectPtr att(MEDCouplingAMRAttribute::New(this,fieldNames,0)); + MCAuto att(MEDCouplingAMRAttribute::New(this,fieldNames,0)); att->alloc(); DataArrayDouble *tmpDa(const_cast(att->getFieldOn(this,TMP_STR))); - tmpDa->cpyFrom(*criterion); + tmpDa->deepCopyFrom(*criterion); att->synchronizeCoarseToFine(); for(std::size_t ii=0;ii getDirectChildrenWithNull() const; protected: - MEDCouplingAutoRefCountObjectPtr _mesh; + MCAuto _mesh; }; /*! @@ -72,7 +72,7 @@ namespace MEDCoupling { public: MEDCouplingCartesianAMRPatch(MEDCouplingCartesianAMRMeshGen *mesh, const std::vector< std::pair >& bottomLeftTopRight); - MEDCouplingCartesianAMRPatch *deepCpy(MEDCouplingCartesianAMRMeshGen *father) const; + MEDCouplingCartesianAMRPatch *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const; // direct forward to _mesh MEDCOUPLING_EXPORT void addPatch(const std::vector< std::pair >& bottomLeftTopRight, const std::vector& factors); // end of direct forward to _mesh @@ -115,7 +115,7 @@ namespace MEDCoupling { public: MEDCouplingCartesianAMRPatchGF(MEDCouplingCartesianAMRMesh *mesh); - MEDCouplingCartesianAMRPatchGF *deepCpy(MEDCouplingCartesianAMRMeshGen *father) const; + MEDCouplingCartesianAMRPatchGF *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const; private: std::size_t getHeapMemorySizeWithoutChildren() const; private: @@ -132,7 +132,7 @@ namespace MEDCoupling class MEDCouplingCartesianAMRMeshGen : public RefCountObject, public TimeLabel { public: - MEDCOUPLING_EXPORT virtual MEDCouplingCartesianAMRMeshGen *deepCpy(MEDCouplingCartesianAMRMeshGen *father) const = 0; + MEDCOUPLING_EXPORT virtual MEDCouplingCartesianAMRMeshGen *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const = 0; MEDCOUPLING_EXPORT int getSpaceDimension() const; MEDCOUPLING_EXPORT const std::vector& getFactors() const { return _factors; } MEDCOUPLING_EXPORT void setFactors(const std::vector& newFactors); @@ -194,7 +194,7 @@ namespace MEDCoupling MEDCouplingCartesianAMRMeshGen(MEDCouplingIMesh *mesh); void checkPatchId(int patchId) const; void checkFactorsAndIfNotSetAssign(const std::vector& factors); - void retrieveGridsAtInternal(int lev, std::vector< MEDCouplingAutoRefCountObjectPtr >& grids) const; + void retrieveGridsAtInternal(int lev, std::vector< MCAuto >& grids) const; static int GetGhostLevelInFineRef(int ghostLev, const std::vector& factors); std::vector extractSubTreeFromGlobalFlatten(const MEDCouplingCartesianAMRMeshGen *head, const std::vector& all) const; void dumpPatchesOf(const std::string& varName, std::ostream& oss) const; @@ -205,8 +205,8 @@ namespace MEDCoupling MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; MEDCOUPLING_EXPORT void updateTime() const; protected: - MEDCouplingAutoRefCountObjectPtr _mesh; - std::vector< MEDCouplingAutoRefCountObjectPtr > _patches; + MCAuto _mesh; + std::vector< MCAuto > _patches; std::vector _factors; }; @@ -222,7 +222,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT int getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const; private: MEDCouplingCartesianAMRMeshSub(const MEDCouplingCartesianAMRMeshSub& other, MEDCouplingCartesianAMRMeshGen *father); - MEDCouplingCartesianAMRMeshSub *deepCpy(MEDCouplingCartesianAMRMeshGen *father) const; + MEDCouplingCartesianAMRMeshSub *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const; void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector& ret) const; protected: MEDCouplingCartesianAMRMeshGen *_father; @@ -241,7 +241,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT std::vector< std::pair > positionRelativeToGodFather(std::vector& st) const; MEDCOUPLING_EXPORT int getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const; MEDCOUPLING_EXPORT std::vector retrieveGridsAt(int absoluteLev) const; - MEDCouplingCartesianAMRMesh *deepCpy(MEDCouplingCartesianAMRMeshGen *father) const; + MEDCouplingCartesianAMRMesh *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const; MEDCOUPLING_EXPORT void createPatchesFromCriterionML(const std::vector& bso, const DataArrayDouble *criterion, const std::vector< std::vector >& factors, double eps); private: void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector& ret) const; diff --git a/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx b/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx index b5586fea1..92c9c96d4 100644 --- a/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx @@ -42,7 +42,7 @@ MEDCouplingCurveLinearMesh::MEDCouplingCurveLinearMesh(const MEDCouplingCurveLin if(deepCopy) { if((const DataArrayDouble *)other._coords) - _coords=other._coords->deepCpy(); + _coords=other._coords->deepCopy(); } else _coords=other._coords; @@ -64,7 +64,7 @@ MEDCouplingCurveLinearMesh *MEDCouplingCurveLinearMesh::New(const std::string& m return ret; } -MEDCouplingCurveLinearMesh *MEDCouplingCurveLinearMesh::deepCpy() const +MEDCouplingCurveLinearMesh *MEDCouplingCurveLinearMesh::deepCopy() const { return clone(true); } @@ -176,44 +176,44 @@ void MEDCouplingCurveLinearMesh::checkDeepEquivalOnSameNodesWith(const MEDCoupli throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkDeepEquivalOnSameNodesWith : Meshes are not the same !"); } -void MEDCouplingCurveLinearMesh::checkCoherency() const +void MEDCouplingCurveLinearMesh::checkConsistencyLight() const { std::size_t sz=_structure.size(),i=0,nbOfNodes=1; if(sz<1) - throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkCoherency : structure should have a lgth of size 1 at least !"); + throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkConsistencyLight : structure should have a lgth of size 1 at least !"); for(std::vector::const_iterator it=_structure.begin();it!=_structure.end();it++,i++) { if((*it)<1) - { std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::checkCoherency : At pos #" << i << " of structure value is " << *it << "should be >= 1 !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } + { std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::checkConsistencyLight : At pos #" << i << " of structure value is " << *it << "should be >= 1 !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } nbOfNodes*=*it; } if(!((const DataArrayDouble *)_coords)) - throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkCoherency : the array is not set !"); + throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkConsistencyLight : the array is not set !"); if(!_coords->isAllocated()) - throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkCoherency : the array is not allocated !"); + throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkConsistencyLight : the array is not allocated !"); if(_coords->getNumberOfComponents()<1) - throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkCoherency : the array should have >= 1 components !"); + throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkConsistencyLight : the array should have >= 1 components !"); if(_coords->getNumberOfTuples()!=(int)nbOfNodes) { - std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::checkCoherency : structure said that number of nodes should be equal to " << nbOfNodes << " but number of tuples in array is equal to " << _coords->getNumberOfTuples() << " !"; + std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::checkConsistencyLight : structure said that number of nodes should be equal to " << nbOfNodes << " but number of tuples in array is equal to " << _coords->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } } -void MEDCouplingCurveLinearMesh::checkCoherency1(double eps) const +void MEDCouplingCurveLinearMesh::checkConsistency(double eps) const { - checkCoherency(); + checkConsistencyLight(); } int MEDCouplingCurveLinearMesh::getNumberOfCells() const { - checkCoherency(); + checkConsistencyLight(); return MEDCouplingStructuredMesh::getNumberOfCells(); } int MEDCouplingCurveLinearMesh::getNumberOfNodes() const { - checkCoherency(); + checkConsistencyLight(); return MEDCouplingStructuredMesh::getNumberOfNodes(); } @@ -313,7 +313,7 @@ std::vector MEDCouplingCurveLinearMesh::getNodeGridStructure() const MEDCouplingStructuredMesh *MEDCouplingCurveLinearMesh::buildStructuredSubPart(const std::vector< std::pair >& cellPart) const { - checkCoherency(); + checkConsistencyLight(); int dim(getSpaceDimension()); std::vector dims(getMeshDimension()); if(dim!=(int)cellPart.size()) @@ -324,12 +324,12 @@ MEDCouplingStructuredMesh *MEDCouplingCurveLinearMesh::buildStructuredSubPart(co std::vector< std::pair > nodePartFormat(cellPart); for(std::vector< std::pair >::iterator it=nodePartFormat.begin();it!=nodePartFormat.end();it++) (*it).second++; - MEDCouplingAutoRefCountObjectPtr tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat)); - MEDCouplingAutoRefCountObjectPtr ret(dynamic_cast(deepCpy())); + MCAuto tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat)); + MCAuto ret(dynamic_cast(deepCopy())); const DataArrayDouble *coo(ret->getCoords()); if(coo) { - MEDCouplingAutoRefCountObjectPtr coo2(coo->selectByTupleIdSafe(tmp1->begin(),tmp1->end())); + MCAuto coo2(coo->selectByTupleIdSafe(tmp1->begin(),tmp1->end())); ret->setCoords(coo2); } for(int i=0;i field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); + MCAuto field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); field->setName(name); field->setMesh(const_cast(this)); field->synchronizeTimeWithMesh(); switch(meshDim) { @@ -377,7 +377,7 @@ void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim1(bool isAbs, MEDCoupling { int nbnodes=getNumberOfNodes(); int spaceDim=getSpaceDimension(); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::New(); field->setArray(arr); + MCAuto arr=DataArrayDouble::New(); field->setArray(arr); if(nbnodes==0) { arr->alloc(0,1); return; } if(spaceDim==1) @@ -389,9 +389,9 @@ void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim1(bool isAbs, MEDCoupling } else { - MEDCouplingAutoRefCountObjectPtr tmp=DataArrayDouble::New(); tmp->alloc(nbnodes-1,spaceDim); + MCAuto tmp=DataArrayDouble::New(); tmp->alloc(nbnodes-1,spaceDim); std::transform(_coords->begin()+spaceDim,_coords->end(),_coords->begin(),tmp->getPointer(),std::minus()); - MEDCouplingAutoRefCountObjectPtr tmp2=tmp->magnitude(); field->setArray(tmp2); + MCAuto tmp2=tmp->magnitude(); field->setArray(tmp2); } } @@ -405,7 +405,7 @@ void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim2(bool isAbs, MEDCoupling int spaceDim=getSpaceDimension(); if(spaceDim!=2 && spaceDim!=3) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim2 : with meshDim 2 only space dimension 2 and 3 are possible !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::New(); field->setArray(arr); + MCAuto arr=DataArrayDouble::New(); field->setArray(arr); arr->alloc(nbcells,1); double *pt=arr->getPointer(); const double *coords=_coords->begin(); @@ -431,7 +431,7 @@ void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim3(bool isAbs, MEDCoupling int spaceDim=getSpaceDimension(); if(spaceDim!=3) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim3 : with meshDim 3 only space dimension 3 is possible !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::New(); field->setArray(arr); + MCAuto arr=DataArrayDouble::New(); field->setArray(arr); arr->alloc(nbcells,1); double *pt=arr->getPointer(); const double *coords=_coords->begin(); @@ -502,7 +502,7 @@ namespace MEDCoupling int MEDCouplingCurveLinearMesh::getCellContainingPoint(const double *pos, double eps) const { - checkCoherency(); + checkConsistencyLight(); int spaceDim=getSpaceDimension(); const double *coords=_coords->getConstPointer(); int nodeId=-1; @@ -694,10 +694,10 @@ DataArrayDouble *MEDCouplingCurveLinearMesh::getCoordinatesAndOwner() const return ret; } -DataArrayDouble *MEDCouplingCurveLinearMesh::getBarycenterAndOwner() const +DataArrayDouble *MEDCouplingCurveLinearMesh::computeCellCenterOfMass() const { - checkCoherency(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + checkConsistencyLight(); + MCAuto ret=DataArrayDouble::New(); int spaceDim=getSpaceDimension(); int meshDim=getMeshDimension(); int nbOfCells=getNumberOfCells(); @@ -712,18 +712,18 @@ DataArrayDouble *MEDCouplingCurveLinearMesh::getBarycenterAndOwner() const case 1: { getBarycenterAndOwnerMeshDim1(ret); return ret.retn(); } default: - throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getBarycenterAndOwner : mesh dimension must be in [1,2,3] !"); + throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::computeCellCenterOfMass : mesh dimension must be in [1,2,3] !"); } } DataArrayDouble *MEDCouplingCurveLinearMesh::computeIsoBarycenterOfNodesPerCell() const { - return MEDCouplingCurveLinearMesh::getBarycenterAndOwner(); + return MEDCouplingCurveLinearMesh::computeCellCenterOfMass(); } /*! * \param [in,out] bary Barycenter array feeded with good values. - * \sa MEDCouplingCurveLinearMesh::getBarycenterAndOwner + * \sa MEDCouplingCurveLinearMesh::computeCellCenterOfMass */ void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim3(DataArrayDouble *bary) const { @@ -749,7 +749,7 @@ void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim3(DataArrayDouble * /*! * \param [in,out] bary Barycenter array feeded with good values. - * \sa MEDCouplingCurveLinearMesh::getBarycenterAndOwner + * \sa MEDCouplingCurveLinearMesh::computeCellCenterOfMass */ void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim2(DataArrayDouble *bary) const { @@ -772,7 +772,7 @@ void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim2(DataArrayDouble * /*! * \param [in,out] bary Barycenter array feeded with good values. - * \sa MEDCouplingCurveLinearMesh::getBarycenterAndOwner + * \sa MEDCouplingCurveLinearMesh::computeCellCenterOfMass */ void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim1(DataArrayDouble *bary) const { @@ -880,7 +880,7 @@ void MEDCouplingCurveLinearMesh::writeVTKLL(std::ostream& ofs, const std::string _coords->writeVTK(ofs,8,"Points",byteData); else { - MEDCouplingAutoRefCountObjectPtr coo=_coords->changeNbOfComponents(3,0.); + MCAuto coo=_coords->changeNbOfComponents(3,0.); coo->writeVTK(ofs,8,"Points",byteData); } ofs << " \n"; diff --git a/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx b/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx index d1f99c83a..70ee505f9 100644 --- a/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx +++ b/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx @@ -23,7 +23,7 @@ #include "MEDCoupling.hxx" #include "MEDCouplingStructuredMesh.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" namespace MEDCoupling { @@ -32,7 +32,7 @@ namespace MEDCoupling public: MEDCOUPLING_EXPORT static MEDCouplingCurveLinearMesh *New(); MEDCOUPLING_EXPORT static MEDCouplingCurveLinearMesh *New(const std::string& meshName); - MEDCOUPLING_EXPORT MEDCouplingCurveLinearMesh *deepCpy() const; + MEDCOUPLING_EXPORT MEDCouplingCurveLinearMesh *deepCopy() const; MEDCOUPLING_EXPORT MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const; MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; @@ -45,8 +45,8 @@ namespace MEDCoupling DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const; MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, DataArrayInt *&cellCor) const; - MEDCOUPLING_EXPORT void checkCoherency() const; - MEDCOUPLING_EXPORT void checkCoherency1(double eps=1e-12) const; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; + MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const; MEDCOUPLING_EXPORT int getNumberOfCells() const; MEDCOUPLING_EXPORT int getNumberOfNodes() const; MEDCOUPLING_EXPORT int getSpaceDimension() const; @@ -70,7 +70,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void scale(const double *point, double factor); MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const; MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const; - MEDCOUPLING_EXPORT DataArrayDouble *getBarycenterAndOwner() const; + MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const; MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const; MEDCOUPLING_EXPORT void renumberCells(const int *old2NewBg, bool check=true); //some useful methods @@ -92,12 +92,12 @@ namespace MEDCoupling void getBarycenterAndOwnerMeshDim1(DataArrayDouble *bary) const; private: MEDCouplingCurveLinearMesh(); - MEDCouplingCurveLinearMesh(const MEDCouplingCurveLinearMesh& other, bool deepCpy); + MEDCouplingCurveLinearMesh(const MEDCouplingCurveLinearMesh& other, bool deepCopy); ~MEDCouplingCurveLinearMesh(); void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const; std::string getVTKDataSetType() const; private: - MEDCouplingAutoRefCountObjectPtr _coords; + MCAuto _coords; std::vector _structure; }; } diff --git a/src/MEDCoupling/MEDCouplingDefinitionTime.cxx b/src/MEDCoupling/MEDCouplingDefinitionTime.cxx index 0fc7b1b76..489db0894 100644 --- a/src/MEDCoupling/MEDCouplingDefinitionTime.cxx +++ b/src/MEDCoupling/MEDCouplingDefinitionTime.cxx @@ -528,7 +528,7 @@ void MEDCouplingDefinitionTime::getIdsOnTime(double tm, std::vector& meshId { std::vector ids; int id=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_slices.begin();it!=_slices.end();it++,id++) + for(std::vector< MCAuto >::const_iterator it=_slices.begin();it!=_slices.end();it++,id++) if((*it)->isContaining(tm,_eps)) ids.push_back(id); if(ids.empty()) @@ -548,7 +548,7 @@ void MEDCouplingDefinitionTime::getIdsOnTime(double tm, std::vector& meshId std::vector MEDCouplingDefinitionTime::getHotSpotsTime() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_slices.begin();it!=_slices.end();it++) + for(std::vector< MCAuto >::const_iterator it=_slices.begin();it!=_slices.end();it++) { std::vector tmp; (*it)->getHotSpotsTime(tmp); @@ -568,7 +568,7 @@ std::vector MEDCouplingDefinitionTime::getHotSpotsTime() const void MEDCouplingDefinitionTime::appendRepr(std::ostream& stream) const { stream << "Time definition :\n"; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_slices.begin();it!=_slices.end();it++) + for(std::vector< MCAuto >::const_iterator it=_slices.begin();it!=_slices.end();it++) { stream << " - "; (*it)->appendRepr(stream); diff --git a/src/MEDCoupling/MEDCouplingDefinitionTime.hxx b/src/MEDCoupling/MEDCouplingDefinitionTime.hxx index f54e6679d..5c460f92e 100644 --- a/src/MEDCoupling/MEDCouplingDefinitionTime.hxx +++ b/src/MEDCoupling/MEDCouplingDefinitionTime.hxx @@ -22,7 +22,7 @@ #define __PARAMEDMEM_MEDCOUPLINGDEFINITIONTIME_HXX__ #include "MEDCouplingRefCountObject.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "InterpKernelException.hxx" @@ -159,7 +159,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void unserialize(const std::vector& tinyInfoI, const std::vector& tinyInfoD); private: double _eps; - std::vector< MEDCouplingAutoRefCountObjectPtr > _slices; + std::vector< MCAuto > _slices; static const double EPS_DFT; }; } diff --git a/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx b/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx deleted file mode 100644 index db939264d..000000000 --- a/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx +++ /dev/null @@ -1,956 +0,0 @@ -// 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, 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 -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : Anthony Geay (CEA/DEN) - -#include "MEDCouplingExtrudedMesh.hxx" -#include "MEDCouplingUMesh.hxx" -#include "MEDCouplingMemArray.hxx" -#include "MEDCouplingFieldDouble.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" -#include "CellModel.hxx" - -#include "InterpolationUtils.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace MEDCoupling; - -/*! - * Build an extruded mesh instance from 3D and 2D unstructured mesh lying on the \b same \b coords. - * @param mesh3D 3D unstructured mesh. - * @param mesh2D 2D unstructured mesh lying on the same coordinates than mesh3D. \b Warning mesh2D is \b not \b const - * because the mesh is aggregated and potentially modified by rotate or translate method. - * @param cell2DId Id of cell in mesh2D mesh where the computation of 1D mesh will be done. - */ -MEDCouplingExtrudedMesh *MEDCouplingExtrudedMesh::New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) -{ - return new MEDCouplingExtrudedMesh(mesh3D,mesh2D,cell2DId); -} - -/*! - * This constructor is here only for unserialisation process. - * This constructor is normally completely useless for end user. - */ -MEDCouplingExtrudedMesh *MEDCouplingExtrudedMesh::New() -{ - return new MEDCouplingExtrudedMesh; -} - -MEDCouplingMeshType MEDCouplingExtrudedMesh::getType() const -{ - return EXTRUDED; -} - -std::size_t MEDCouplingExtrudedMesh::getHeapMemorySizeWithoutChildren() const -{ - return MEDCouplingMesh::getHeapMemorySizeWithoutChildren(); -} - -std::vector MEDCouplingExtrudedMesh::getDirectChildrenWithNull() const -{ - std::vector ret; - ret.push_back(_mesh2D); - ret.push_back(_mesh1D); - ret.push_back(_mesh3D_ids); - return ret; -} - -/*! - * This method copyies all tiny strings from other (name and components name). - * @throw if other and this have not same mesh type. - */ -void MEDCouplingExtrudedMesh::copyTinyStringsFrom(const MEDCouplingMesh *other) -{ - const MEDCouplingExtrudedMesh *otherC=dynamic_cast(other); - if(!otherC) - throw INTERP_KERNEL::Exception("MEDCouplingExtrudedMesh::copyTinyStringsFrom : meshes have not same type !"); - MEDCouplingMesh::copyTinyStringsFrom(other); - _mesh2D->copyTinyStringsFrom(otherC->_mesh2D); - _mesh1D->copyTinyStringsFrom(otherC->_mesh1D); -} - -MEDCouplingExtrudedMesh::MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) -try:_mesh2D(const_cast(mesh2D)),_mesh1D(MEDCouplingUMesh::New()),_mesh3D_ids(0),_cell_2D_id(cell2DId) -{ - if(_mesh2D!=0) - _mesh2D->incrRef(); - computeExtrusion(mesh3D); - setName(mesh3D->getName()); -} -catch(INTERP_KERNEL::Exception& e) -{ - if(_mesh2D) - _mesh2D->decrRef(); - if(_mesh1D) - _mesh1D->decrRef(); - if(_mesh3D_ids) - _mesh3D_ids->decrRef(); - throw e; -} - -MEDCouplingExtrudedMesh::MEDCouplingExtrudedMesh():_mesh2D(0),_mesh1D(0),_mesh3D_ids(0),_cell_2D_id(-1) -{ -} - -MEDCouplingExtrudedMesh::MEDCouplingExtrudedMesh(const MEDCouplingExtrudedMesh& other, bool deepCopy):MEDCouplingMesh(other),_cell_2D_id(other._cell_2D_id) -{ - if(deepCopy) - { - _mesh2D=other._mesh2D->clone(true); - _mesh1D=other._mesh1D->clone(true); - _mesh3D_ids=other._mesh3D_ids->deepCpy(); - } - else - { - _mesh2D=other._mesh2D; - if(_mesh2D) - _mesh2D->incrRef(); - _mesh1D=other._mesh1D; - if(_mesh1D) - _mesh1D->incrRef(); - _mesh3D_ids=other._mesh3D_ids; - if(_mesh3D_ids) - _mesh3D_ids->incrRef(); - } -} - -int MEDCouplingExtrudedMesh::getNumberOfCells() const -{ - return _mesh2D->getNumberOfCells()*_mesh1D->getNumberOfCells(); -} - -int MEDCouplingExtrudedMesh::getNumberOfNodes() const -{ - return _mesh2D->getNumberOfNodes(); -} - -int MEDCouplingExtrudedMesh::getSpaceDimension() const -{ - return 3; -} - -int MEDCouplingExtrudedMesh::getMeshDimension() const -{ - return 3; -} - -MEDCouplingExtrudedMesh *MEDCouplingExtrudedMesh::deepCpy() const -{ - return clone(true); -} - -MEDCouplingExtrudedMesh *MEDCouplingExtrudedMesh::clone(bool recDeepCpy) const -{ - return new MEDCouplingExtrudedMesh(*this,recDeepCpy); -} - -bool MEDCouplingExtrudedMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const -{ - if(!other) - throw INTERP_KERNEL::Exception("MEDCouplingExtrudedMesh::isEqualIfNotWhy : input other pointer is null !"); - const MEDCouplingExtrudedMesh *otherC=dynamic_cast(other); - std::ostringstream oss; - if(!otherC) - { - reason="mesh given in input is not castable in MEDCouplingExtrudedMesh !"; - return false; - } - if(!MEDCouplingMesh::isEqualIfNotWhy(other,prec,reason)) - return false; - if(!_mesh2D->isEqualIfNotWhy(otherC->_mesh2D,prec,reason)) - { - reason.insert(0,"Mesh2D unstructured meshes differ : "); - return false; - } - if(!_mesh1D->isEqualIfNotWhy(otherC->_mesh1D,prec,reason)) - { - reason.insert(0,"Mesh1D unstructured meshes differ : "); - return false; - } - if(!_mesh3D_ids->isEqualIfNotWhy(*otherC->_mesh3D_ids,reason)) - { - reason.insert(0,"Mesh3D ids DataArrayInt instances differ : "); - return false; - } - if(_cell_2D_id!=otherC->_cell_2D_id) - { - oss << "Cell 2D id of the two extruded mesh differ : this = " << _cell_2D_id << " other = " << otherC->_cell_2D_id; - reason=oss.str(); - return false; - } - return true; -} - -bool MEDCouplingExtrudedMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const -{ - const MEDCouplingExtrudedMesh *otherC=dynamic_cast(other); - if(!otherC) - return false; - if(!_mesh2D->isEqualWithoutConsideringStr(otherC->_mesh2D,prec)) - return false; - if(!_mesh1D->isEqualWithoutConsideringStr(otherC->_mesh1D,prec)) - return false; - if(!_mesh3D_ids->isEqualWithoutConsideringStr(*otherC->_mesh3D_ids)) - return false; - if(_cell_2D_id!=otherC->_cell_2D_id) - return false; - return true; -} - -void MEDCouplingExtrudedMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const -{ - throw INTERP_KERNEL::Exception("MEDCouplingExtrudedMesh::checkDeepEquivalWith : not implemented yet !"); -} - -void MEDCouplingExtrudedMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayInt *&cellCor) const -{ - throw INTERP_KERNEL::Exception("MEDCouplingExtrudedMesh::checkDeepEquivalOnSameNodesWith : not implemented yet !"); -} - -INTERP_KERNEL::NormalizedCellType MEDCouplingExtrudedMesh::getTypeOfCell(int cellId) const -{ - const int *ids=_mesh3D_ids->getConstPointer(); - int nbOf3DCells=_mesh3D_ids->getNumberOfTuples(); - const int *where=std::find(ids,ids+nbOf3DCells,cellId); - if(where==ids+nbOf3DCells) - throw INTERP_KERNEL::Exception("Invalid cellId specified >= getNumberOfCells() !"); - int nbOfCells2D=_mesh2D->getNumberOfCells(); - int locId=((int)std::distance(ids,where))%nbOfCells2D; - INTERP_KERNEL::NormalizedCellType tmp=_mesh2D->getTypeOfCell(locId); - return INTERP_KERNEL::CellModel::GetCellModel(tmp).getExtrudedType(); -} - -std::set MEDCouplingExtrudedMesh::getAllGeoTypes() const -{ - std::set ret2D(_mesh2D->getAllGeoTypes()); - std::set ret; - for(std::set::const_iterator it=ret2D.begin();it!=ret2D.end();it++) - ret.insert(INTERP_KERNEL::CellModel::GetCellModel(*it).getExtrudedType()); - return ret; -} - -DataArrayInt *MEDCouplingExtrudedMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const -{ - const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); - INTERP_KERNEL::NormalizedCellType revExtTyp=cm.getReverseExtrudedType(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); - if(revExtTyp==INTERP_KERNEL::NORM_ERROR) - { - ret->alloc(0,1); - return ret.retn(); - } - MEDCouplingAutoRefCountObjectPtr tmp=_mesh2D->giveCellsWithType(revExtTyp); - int nbOfLevs=_mesh1D->getNumberOfCells(); - int nbOfCells2D=_mesh2D->getNumberOfCells(); - int nbOfTuples=tmp->getNumberOfTuples(); - ret->alloc(nbOfLevs*nbOfTuples,1); - int *pt=ret->getPointer(); - for(int i=0;ibegin(),tmp->end(),pt,std::bind2nd(std::plus(),i*nbOfCells2D)); - MEDCouplingAutoRefCountObjectPtr ret2=ret->renumberR(_mesh3D_ids->begin()); - ret2->sort(); - return ret2.retn(); -} - -DataArrayInt *MEDCouplingExtrudedMesh::computeNbOfNodesPerCell() const -{ - MEDCouplingAutoRefCountObjectPtr ret2D=_mesh2D->computeNbOfNodesPerCell(); - int nbOfLevs=_mesh1D->getNumberOfCells(); - int nbOfCells2D=_mesh2D->getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr ret3D=DataArrayInt::New(); ret3D->alloc(nbOfLevs*nbOfCells2D,1); - int *pt=ret3D->getPointer(); - for(int i=0;ibegin(),ret2D->end(),pt); - ret3D->applyLin(2,0,0); - return ret3D->renumberR(_mesh3D_ids->begin()); -} - -DataArrayInt *MEDCouplingExtrudedMesh::computeNbOfFacesPerCell() const -{ - MEDCouplingAutoRefCountObjectPtr ret2D=_mesh2D->computeNbOfNodesPerCell(); - int nbOfLevs=_mesh1D->getNumberOfCells(); - int nbOfCells2D=_mesh2D->getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr ret3D=DataArrayInt::New(); ret3D->alloc(nbOfLevs*nbOfCells2D,1); - int *pt=ret3D->getPointer(); - for(int i=0;ibegin(),ret2D->end(),pt); - ret3D->applyLin(2,2,0); - return ret3D->renumberR(_mesh3D_ids->begin()); -} - -DataArrayInt *MEDCouplingExtrudedMesh::computeEffectiveNbOfNodesPerCell() const -{ - return computeNbOfNodesPerCell(); -} - -int MEDCouplingExtrudedMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const -{ - int ret=0; - int nbOfCells2D=_mesh2D->getNumberOfCells(); - for(int i=0;igetTypeOfCell(i); - if(INTERP_KERNEL::CellModel::GetCellModel(t).getExtrudedType()==type) - ret++; - } - return ret*_mesh1D->getNumberOfCells(); -} - -void MEDCouplingExtrudedMesh::getNodeIdsOfCell(int cellId, std::vector& conn) const -{ - int nbOfCells2D=_mesh2D->getNumberOfCells(); - int nbOfNodes2D=_mesh2D->getNumberOfNodes(); - int locId=cellId%nbOfCells2D; - int lev=cellId/nbOfCells2D; - std::vector tmp,tmp2; - _mesh2D->getNodeIdsOfCell(locId,tmp); - tmp2=tmp; - std::transform(tmp.begin(),tmp.end(),tmp.begin(),std::bind2nd(std::plus(),nbOfNodes2D*lev)); - std::transform(tmp2.begin(),tmp2.end(),tmp2.begin(),std::bind2nd(std::plus(),nbOfNodes2D*(lev+1))); - conn.insert(conn.end(),tmp.begin(),tmp.end()); - conn.insert(conn.end(),tmp2.begin(),tmp2.end()); -} - -void MEDCouplingExtrudedMesh::getCoordinatesOfNode(int nodeId, std::vector& coo) const -{ - int nbOfNodes2D=_mesh2D->getNumberOfNodes(); - int locId=nodeId%nbOfNodes2D; - int lev=nodeId/nbOfNodes2D; - std::vector tmp,tmp2; - _mesh2D->getCoordinatesOfNode(locId,tmp); - tmp2=tmp; - int spaceDim=_mesh1D->getSpaceDimension(); - const double *z=_mesh1D->getCoords()->getConstPointer(); - std::transform(tmp.begin(),tmp.end(),z+lev*spaceDim,tmp.begin(),std::plus()); - std::transform(tmp2.begin(),tmp2.end(),z+(lev+1)*spaceDim,tmp2.begin(),std::plus()); - coo.insert(coo.end(),tmp.begin(),tmp.end()); - coo.insert(coo.end(),tmp2.begin(),tmp2.end()); -} - -std::string MEDCouplingExtrudedMesh::simpleRepr() const -{ - std::ostringstream ret; - ret << "3D Extruded mesh from a 2D Surf Mesh with name : \"" << getName() << "\"\n"; - ret << "Description of mesh : \"" << getDescription() << "\"\n"; - int tmpp1,tmpp2; - double tt=getTime(tmpp1,tmpp2); - ret << "Time attached to the mesh [unit] : " << tt << " [" << getTimeUnit() << "]\n"; - ret << "Iteration : " << tmpp1 << " Order : " << tmpp2 << "\n"; - ret << "Cell id where 1D mesh has been deduced : " << _cell_2D_id << "\n"; - ret << "Number of cells : " << getNumberOfCells() << "(" << _mesh2D->getNumberOfCells() << "x" << _mesh1D->getNumberOfCells() << ")\n"; - ret << "1D Mesh info : _____________________\n\n\n"; - ret << _mesh1D->simpleRepr(); - ret << "\n\n\n2D Mesh info : _____________________\n\n\n" << _mesh2D->simpleRepr() << "\n\n\n"; - return ret.str(); -} - -std::string MEDCouplingExtrudedMesh::advancedRepr() const -{ - std::ostringstream ret; - ret << "3D Extruded mesh from a 2D Surf Mesh with name : \"" << getName() << "\"\n"; - ret << "Description of mesh : \"" << getDescription() << "\"\n"; - int tmpp1,tmpp2; - double tt=getTime(tmpp1,tmpp2); - ret << "Time attached to the mesh (unit) : " << tt << " (" << getTimeUnit() << ")\n"; - ret << "Iteration : " << tmpp1 << " Order : " << tmpp2 << "\n"; - ret << "Cell id where 1D mesh has been deduced : " << _cell_2D_id << "\n"; - ret << "Number of cells : " << getNumberOfCells() << "(" << _mesh2D->getNumberOfCells() << "x" << _mesh1D->getNumberOfCells() << ")\n"; - ret << "1D Mesh info : _____________________\n\n\n"; - ret << _mesh1D->advancedRepr(); - ret << "\n\n\n2D Mesh info : _____________________\n\n\n" << _mesh2D->advancedRepr() << "\n\n\n"; - ret << "3D cell ids per level :\n"; - return ret.str(); -} - -void MEDCouplingExtrudedMesh::checkCoherency() const -{ -} - -void MEDCouplingExtrudedMesh::checkCoherency1(double eps) const -{ - checkCoherency(); -} - -void MEDCouplingExtrudedMesh::getBoundingBox(double *bbox) const -{ - double bbox2D[6]; - _mesh2D->getBoundingBox(bbox2D); - const double *nodes1D=_mesh1D->getCoords()->getConstPointer(); - int nbOfNodes1D=_mesh1D->getNumberOfNodes(); - double bbox1DMin[3],bbox1DMax[3],tmp[3]; - std::fill(bbox1DMin,bbox1DMin+3,std::numeric_limits::max()); - std::fill(bbox1DMax,bbox1DMax+3,-(std::numeric_limits::max())); - for(int i=0;i(std::min)); - std::transform(nodes1D+3*i,nodes1D+3*(i+1),bbox1DMax,bbox1DMax,static_cast(std::max)); - } - std::transform(bbox1DMax,bbox1DMax+3,bbox1DMin,tmp,std::minus()); - int id=(int)std::distance(tmp,std::max_element(tmp,tmp+3)); - bbox[0]=bbox1DMin[0]; bbox[1]=bbox1DMax[0]; - bbox[2]=bbox1DMin[1]; bbox[3]=bbox1DMax[1]; - bbox[4]=bbox1DMin[2]; bbox[5]=bbox1DMax[2]; - bbox[2*id+1]+=tmp[id]; -} - -void MEDCouplingExtrudedMesh::updateTime() const -{ - if(_mesh2D) - { - updateTimeWith(*_mesh2D); - } - if(_mesh1D) - { - updateTimeWith(*_mesh1D); - } -} - -void MEDCouplingExtrudedMesh::renumberCells(const int *old2NewBg, bool check) -{ - throw INTERP_KERNEL::Exception("Functionnality of renumbering cells unavailable for ExtrudedMesh"); -} - -MEDCouplingUMesh *MEDCouplingExtrudedMesh::build3DUnstructuredMesh() const -{ - MEDCouplingUMesh *ret=_mesh2D->buildExtrudedMesh(_mesh1D,0); - const int *renum=_mesh3D_ids->getConstPointer(); - ret->renumberCells(renum,false); - ret->setName(getName()); - return ret; -} - -MEDCouplingUMesh *MEDCouplingExtrudedMesh::buildUnstructured() const -{ - return build3DUnstructuredMesh(); -} - -MEDCouplingFieldDouble *MEDCouplingExtrudedMesh::getMeasureField(bool) const -{ - std::string name="MeasureOfMesh_"; - name+=getName(); - MEDCouplingFieldDouble *ret2D=_mesh2D->getMeasureField(true); - MEDCouplingFieldDouble *ret1D=_mesh1D->getMeasureField(true); - const double *ret2DPtr=ret2D->getArray()->getConstPointer(); - const double *ret1DPtr=ret1D->getArray()->getConstPointer(); - int nbOf2DCells=_mesh2D->getNumberOfCells(); - int nbOf1DCells=_mesh1D->getNumberOfCells(); - int nbOf3DCells=nbOf2DCells*nbOf1DCells; - const int *renum=_mesh3D_ids->getConstPointer(); - MEDCouplingFieldDouble *ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); - ret->setMesh(this); - ret->synchronizeTimeWithMesh(); - DataArrayDouble *da=DataArrayDouble::New(); - da->alloc(nbOf3DCells,1); - double *retPtr=da->getPointer(); - for(int i=0;isetArray(da); - da->decrRef(); - ret->setName(name); - ret2D->decrRef(); - ret1D->decrRef(); - return ret; -} - -MEDCouplingFieldDouble *MEDCouplingExtrudedMesh::getMeasureFieldOnNode(bool isAbs) const -{ - //not implemented yet - return 0; -} - -MEDCouplingFieldDouble *MEDCouplingExtrudedMesh::buildOrthogonalField() const -{ - throw INTERP_KERNEL::Exception("MEDCouplingExtrudedMesh::buildOrthogonalField : This method has no sense for MEDCouplingExtrudedMesh that is 3D !"); -} - -int MEDCouplingExtrudedMesh::getCellContainingPoint(const double *pos, double eps) const -{ - throw INTERP_KERNEL::Exception("MEDCouplingExtrudedMesh::getCellContainingPoint : not implemented yet !"); -} - -MEDCouplingExtrudedMesh::~MEDCouplingExtrudedMesh() -{ - if(_mesh2D) - _mesh2D->decrRef(); - if(_mesh1D) - _mesh1D->decrRef(); - if(_mesh3D_ids) - _mesh3D_ids->decrRef(); -} - -void MEDCouplingExtrudedMesh::computeExtrusion(const MEDCouplingUMesh *mesh3D) -{ - const char errMsg1[]="2D mesh is empty unable to compute extrusion !"; - const char errMsg2[]="Coords between 2D and 3D meshes are not the same ! Try MEDCouplingPointSet::tryToShareSameCoords method"; - const char errMsg3[]="No chance to find extrusion pattern in mesh3D,mesh2D couple because nbCells3D%nbCells2D!=0 !"; - if(_mesh2D==0 || mesh3D==0) - throw INTERP_KERNEL::Exception(errMsg1); - if(_mesh2D->getCoords()!=mesh3D->getCoords()) - throw INTERP_KERNEL::Exception(errMsg2); - if(mesh3D->getNumberOfCells()%_mesh2D->getNumberOfCells()!=0) - throw INTERP_KERNEL::Exception(errMsg3); - if(!_mesh3D_ids) - _mesh3D_ids=DataArrayInt::New(); - if(!_mesh1D) - _mesh1D=MEDCouplingUMesh::New(); - computeExtrusionAlg(mesh3D); -} - -void MEDCouplingExtrudedMesh::build1DExtrusion(int idIn3DDesc, int newId, int nbOf1DLev, MEDCouplingUMesh *subMesh, - const int *desc3D, const int *descIndx3D, - const int *revDesc3D, const int *revDescIndx3D, - bool computeMesh1D) -{ - int nbOf2DCells=_mesh2D->getNumberOfCells(); - int start=revDescIndx3D[idIn3DDesc]; - int end=revDescIndx3D[idIn3DDesc+1]; - if(end-start!=1) - { - std::ostringstream ost; ost << "Invalid bases 2D mesh specified : 2D cell # " << idIn3DDesc; - ost << " shared by more than 1 3D cell !!!"; - throw INTERP_KERNEL::Exception(ost.str().c_str()); - } - int current3DCell=revDesc3D[start]; - int current2DCell=idIn3DDesc; - int *mesh3DIDs=_mesh3D_ids->getPointer(); - mesh3DIDs[newId]=current3DCell; - const int *conn2D=subMesh->getNodalConnectivity()->getConstPointer(); - const int *conn2DIndx=subMesh->getNodalConnectivityIndex()->getConstPointer(); - for(int i=1;i conn(conn2D+conn2DIndx[current2DCell]+1,conn2D+conn2DIndx[current2DCell+1]); - std::sort(conn.begin(),conn.end()); - if(computeMesh1D) - computeBaryCenterOfFace(conn,i-1); - current2DCell=findOppositeFaceOf(current2DCell,current3DCell,conn, - desc3D,descIndx3D,conn2D,conn2DIndx); - start=revDescIndx3D[current2DCell]; - end=revDescIndx3D[current2DCell+1]; - if(end-start!=2) - { - std::ostringstream ost; ost << "Expecting to have 2 3D cells attached to 2D cell " << current2DCell << "!"; - ost << " : Impossible or call tryToShareSameCoords method !"; - throw INTERP_KERNEL::Exception(ost.str().c_str()); - } - if(revDesc3D[start]!=current3DCell) - current3DCell=revDesc3D[start]; - else - current3DCell=revDesc3D[start+1]; - mesh3DIDs[i*nbOf2DCells+newId]=current3DCell; - } - if(computeMesh1D) - { - std::vector conn(conn2D+conn2DIndx[current2DCell]+1,conn2D+conn2DIndx[current2DCell+1]); - std::sort(conn.begin(),conn.end()); - computeBaryCenterOfFace(conn,nbOf1DLev-1); - current2DCell=findOppositeFaceOf(current2DCell,current3DCell,conn, - desc3D,descIndx3D,conn2D,conn2DIndx); - conn.clear(); - conn.insert(conn.end(),conn2D+conn2DIndx[current2DCell]+1,conn2D+conn2DIndx[current2DCell+1]); - std::sort(conn.begin(),conn.end()); - computeBaryCenterOfFace(conn,nbOf1DLev); - } -} - -int MEDCouplingExtrudedMesh::findOppositeFaceOf(int current2DCell, int current3DCell, const std::vector& connSorted, - const int *desc3D, const int *descIndx3D, - const int *conn2D, const int *conn2DIndx) -{ - int start=descIndx3D[current3DCell]; - int end=descIndx3D[current3DCell+1]; - bool found=false; - for(const int *candidate2D=desc3D+start;candidate2D!=desc3D+end && !found;candidate2D++) - { - if(*candidate2D!=current2DCell) - { - std::vector conn2(conn2D+conn2DIndx[*candidate2D]+1,conn2D+conn2DIndx[*candidate2D+1]); - std::sort(conn2.begin(),conn2.end()); - std::list intersect; - std::set_intersection(connSorted.begin(),connSorted.end(),conn2.begin(),conn2.end(), - std::insert_iterator< std::list >(intersect,intersect.begin())); - if(intersect.empty()) - return *candidate2D; - } - } - std::ostringstream ost; ost << "Impossible to find an opposite 2D face of face # " << current2DCell; - ost << " in 3D cell # " << current3DCell << " : Impossible or call tryToShareSameCoords method !"; - throw INTERP_KERNEL::Exception(ost.str().c_str()); -} - -void MEDCouplingExtrudedMesh::computeBaryCenterOfFace(const std::vector& nodalConnec, int lev1DId) -{ - double *zoneToUpdate=_mesh1D->getCoords()->getPointer()+lev1DId*3; - std::fill(zoneToUpdate,zoneToUpdate+3,0.); - const double *coords=_mesh2D->getCoords()->getConstPointer(); - for(std::vector::const_iterator iter=nodalConnec.begin();iter!=nodalConnec.end();iter++) - std::transform(zoneToUpdate,zoneToUpdate+3,coords+3*(*iter),zoneToUpdate,std::plus()); - std::transform(zoneToUpdate,zoneToUpdate+3,zoneToUpdate,std::bind2nd(std::multiplies(),(double)(1./(int)nodalConnec.size()))); -} - -int MEDCouplingExtrudedMesh::FindCorrespCellByNodalConn(const std::vector& nodalConnec, const int *revNodalPtr, const int *revNodalIndxPtr) -{ - std::vector::const_iterator iter=nodalConnec.begin(); - std::set s1(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1]); - iter++; - for(;iter!=nodalConnec.end();iter++) - { - std::set s2(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1]); - std::set s3; - std::set_intersection(s1.begin(),s1.end(),s2.begin(),s2.end(),std::insert_iterator< std::set >(s3,s3.end())); - s1=s3; - } - if(s1.size()==1) - return *(s1.begin()); - std::ostringstream ostr; - ostr << "Cell with nodal connec : "; - std::copy(nodalConnec.begin(),nodalConnec.end(),std::ostream_iterator(ostr," ")); - ostr << " is not part of mesh"; - throw INTERP_KERNEL::Exception(ostr.str().c_str()); -} - -/*! - * This method is callable on 1Dmeshes (meshDim==1 && spaceDim==3) returned by MEDCouplingExtrudedMesh::getMesh1D typically. - * These 1Dmeshes (meshDim==1 && spaceDim==3) have a special semantic because these meshes do not specify a static location but a translation along a path. - * This method checks that 'm1' and 'm2' are compatible, if not an exception is thrown. In case these meshes ('m1' and 'm2') are compatible 2 corresponding meshes - * are created ('m1r' and 'm2r') that can be used for interpolation. - * @param m1 input mesh with meshDim==1 and spaceDim==3 - * @param m2 input mesh with meshDim==1 and spaceDim==3 - * @param eps tolerance acceptable to determine compatibility - * @param m1r output mesh with ref count equal to 1 with meshDim==1 and spaceDim==1 - * @param m2r output mesh with ref count equal to 1 with meshDim==1 and spaceDim==1 - * @param v is the output normalized vector of the common direction of 'm1' and 'm2' - * @throw in case that m1 and m2 are not compatible each other. - */ -void MEDCouplingExtrudedMesh::Project1DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps, - MEDCouplingUMesh *&m1r, MEDCouplingUMesh *&m2r, double *v) -{ - if(m1->getSpaceDimension()!=3 || m1->getSpaceDimension()!=3) - throw INTERP_KERNEL::Exception("Input meshes are expected to have a spaceDim==3 for Projec1D !"); - m1r=m1->clone(true); - m2r=m2->clone(true); - m1r->changeSpaceDimension(1); - m2r->changeSpaceDimension(1); - std::vector c; - std::vector ref,ref2; - m1->getNodeIdsOfCell(0,c); - m1->getCoordinatesOfNode(c[0],ref); - m1->getCoordinatesOfNode(c[1],ref2); - std::transform(ref2.begin(),ref2.end(),ref.begin(),v,std::minus()); - double n=INTERP_KERNEL::norm<3>(v); - std::transform(v,v+3,v,std::bind2nd(std::multiplies(),1/n)); - m1->project1D(&ref[0],v,eps,m1r->getCoords()->getPointer()); - m2->project1D(&ref[0],v,eps,m2r->getCoords()->getPointer()); -} - -void MEDCouplingExtrudedMesh::rotate(const double *center, const double *vector, double angle) -{ - _mesh2D->rotate(center,vector,angle); - _mesh1D->rotate(center,vector,angle); -} - -void MEDCouplingExtrudedMesh::translate(const double *vector) -{ - _mesh2D->translate(vector); - _mesh1D->translate(vector); -} - -void MEDCouplingExtrudedMesh::scale(const double *point, double factor) -{ - _mesh2D->scale(point,factor); - _mesh1D->scale(point,factor); -} - -std::vector MEDCouplingExtrudedMesh::getDistributionOfTypes() const -{ - throw INTERP_KERNEL::Exception("Not implemented yet !"); -} - -DataArrayInt *MEDCouplingExtrudedMesh::checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const -{ - throw INTERP_KERNEL::Exception("Not implemented yet !"); -} - -void MEDCouplingExtrudedMesh::splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType) const -{ - throw INTERP_KERNEL::Exception("Not implemented yet !"); -} - -MEDCouplingMesh *MEDCouplingExtrudedMesh::buildPart(const int *start, const int *end) const -{ - // not implemented yet ! - return 0; -} - -MEDCouplingMesh *MEDCouplingExtrudedMesh::buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const -{ - // not implemented yet ! - return 0; -} - -DataArrayInt *MEDCouplingExtrudedMesh::simplexize(int policy) -{ - throw INTERP_KERNEL::Exception("MEDCouplingExtrudedMesh::simplexize : unavailable for such a type of mesh : Extruded !"); -} - -MEDCouplingMesh *MEDCouplingExtrudedMesh::mergeMyselfWith(const MEDCouplingMesh *other) const -{ - // not implemented yet ! - return 0; -} - -DataArrayDouble *MEDCouplingExtrudedMesh::getCoordinatesAndOwner() const -{ - DataArrayDouble *arr2D=_mesh2D->getCoords(); - DataArrayDouble *arr1D=_mesh1D->getCoords(); - DataArrayDouble *ret=DataArrayDouble::New(); - ret->alloc(getNumberOfNodes(),3); - int nbOf1DLev=_mesh1D->getNumberOfNodes(); - int nbOf2DNodes=_mesh2D->getNumberOfNodes(); - const double *ptSrc=arr2D->getConstPointer(); - double *pt=ret->getPointer(); - std::copy(ptSrc,ptSrc+3*nbOf2DNodes,pt); - for(int i=1;igetConstPointer()+3*i,arr1D->getConstPointer()+3*(i+1),vec); - std::transform(arr1D->getConstPointer()+3*(i-1),arr1D->getConstPointer()+3*i,vec,vec,std::minus()); - for(int j=0;j()); - } - return ret; -} - -DataArrayDouble *MEDCouplingExtrudedMesh::getBarycenterAndOwner() const -{ - throw INTERP_KERNEL::Exception("MEDCouplingExtrudedMesh::getBarycenterAndOwner : not yet implemented !"); -} - -DataArrayDouble *MEDCouplingExtrudedMesh::computeIsoBarycenterOfNodesPerCell() const -{ - throw INTERP_KERNEL::Exception("MEDCouplingExtrudedMesh::computeIsoBarycenterOfNodesPerCell: not yet implemented !"); -} - -void MEDCouplingExtrudedMesh::getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const -{ - MEDCouplingAutoRefCountObjectPtr m(buildUnstructured()); - m->getReverseNodalConnectivity(revNodal,revNodalIndx); -} - -void MEDCouplingExtrudedMesh::computeExtrusionAlg(const MEDCouplingUMesh *mesh3D) -{ - _mesh3D_ids->alloc(mesh3D->getNumberOfCells(),1); - int nbOf1DLev=mesh3D->getNumberOfCells()/_mesh2D->getNumberOfCells(); - _mesh1D->setMeshDimension(1); - _mesh1D->allocateCells(nbOf1DLev); - int tmpConn[2]; - for(int i=0;iinsertNextCell(INTERP_KERNEL::NORM_SEG2,2,tmpConn); - } - _mesh1D->finishInsertingCells(); - DataArrayDouble *myCoords=DataArrayDouble::New(); - myCoords->alloc(nbOf1DLev+1,3); - _mesh1D->setCoords(myCoords); - myCoords->decrRef(); - DataArrayInt *desc,*descIndx,*revDesc,*revDescIndx; - desc=DataArrayInt::New(); descIndx=DataArrayInt::New(); revDesc=DataArrayInt::New(); revDescIndx=DataArrayInt::New(); - MEDCouplingUMesh *subMesh=mesh3D->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); - DataArrayInt *revNodal2D,*revNodalIndx2D; - revNodal2D=DataArrayInt::New(); revNodalIndx2D=DataArrayInt::New(); - subMesh->getReverseNodalConnectivity(revNodal2D,revNodalIndx2D); - const int *nodal2D=_mesh2D->getNodalConnectivity()->getConstPointer(); - const int *nodal2DIndx=_mesh2D->getNodalConnectivityIndex()->getConstPointer(); - const int *revNodal2DPtr=revNodal2D->getConstPointer(); - const int *revNodalIndx2DPtr=revNodalIndx2D->getConstPointer(); - const int *descP=desc->getConstPointer(); - const int *descIndxP=descIndx->getConstPointer(); - const int *revDescP=revDesc->getConstPointer(); - const int *revDescIndxP=revDescIndx->getConstPointer(); - // - int nbOf2DCells=_mesh2D->getNumberOfCells(); - for(int i=0;i nodalConnec(nodal2D+nodal2DIndx[i]+1,nodal2D+nodal2DIndx[i+1]); - try - { - idInSubMesh=FindCorrespCellByNodalConn(nodalConnec,revNodal2DPtr,revNodalIndx2DPtr); - } - catch(INTERP_KERNEL::Exception& e) - { - std::ostringstream ostr; ostr << "mesh2D cell # " << i << " is not part of any cell of 3D mesh !\n"; - ostr << e.what(); - throw INTERP_KERNEL::Exception(ostr.str().c_str()); - } - build1DExtrusion(idInSubMesh,i,nbOf1DLev,subMesh,descP,descIndxP,revDescP,revDescIndxP,i==_cell_2D_id); - } - // - revNodal2D->decrRef(); - revNodalIndx2D->decrRef(); - subMesh->decrRef(); - desc->decrRef(); - descIndx->decrRef(); - revDesc->decrRef(); - revDescIndx->decrRef(); -} - -void MEDCouplingExtrudedMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const -{ - std::vector tinyInfo1; - std::vector ls1; - std::vector ls3; - _mesh2D->getTinySerializationInformation(ls3,tinyInfo1,ls1); - std::vector tinyInfo2; - std::vector ls2; - std::vector ls4; - _mesh1D->getTinySerializationInformation(ls4,tinyInfo2,ls2); - tinyInfo.clear(); littleStrings.clear(); - tinyInfo.insert(tinyInfo.end(),tinyInfo1.begin(),tinyInfo1.end()); - littleStrings.insert(littleStrings.end(),ls1.begin(),ls1.end()); - tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end()); - littleStrings.insert(littleStrings.end(),ls2.begin(),ls2.end()); - tinyInfo.push_back(_cell_2D_id); - tinyInfo.push_back((int)tinyInfo1.size()); - tinyInfo.push_back(_mesh3D_ids->getNbOfElems()); - littleStrings.push_back(getName()); - littleStrings.push_back(getDescription()); -} - -void MEDCouplingExtrudedMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const -{ - std::size_t sz=tinyInfo.size(); - int sz1=tinyInfo[sz-2]; - std::vector ti1(tinyInfo.begin(),tinyInfo.begin()+sz1); - std::vector ti2(tinyInfo.begin()+sz1,tinyInfo.end()-3); - MEDCouplingUMesh *um=MEDCouplingUMesh::New(); - DataArrayInt *a1tmp=DataArrayInt::New(); - DataArrayDouble *a2tmp=DataArrayDouble::New(); - int la1=0,la2=0; - std::vector ls1,ls2; - um->resizeForUnserialization(ti1,a1tmp,a2tmp,ls1); - la1+=a1tmp->getNbOfElems(); la2+=a2tmp->getNbOfElems(); - a1tmp->decrRef(); a2tmp->decrRef(); - a1tmp=DataArrayInt::New(); a2tmp=DataArrayDouble::New(); - um->resizeForUnserialization(ti2,a1tmp,a2tmp,ls2); - la1+=a1tmp->getNbOfElems(); la2+=a2tmp->getNbOfElems(); - a1tmp->decrRef(); a2tmp->decrRef(); - um->decrRef(); - // - a1->alloc(la1+tinyInfo[sz-1],1); - a2->alloc(la2,1); - littleStrings.resize(ls1.size()+ls2.size()+2); -} - -void MEDCouplingExtrudedMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const -{ - a1=DataArrayInt::New(); a2=DataArrayDouble::New(); - DataArrayInt *a1_1=0,*a1_2=0; - DataArrayDouble *a2_1=0,*a2_2=0; - _mesh2D->serialize(a1_1,a2_1); - _mesh1D->serialize(a1_2,a2_2); - a1->alloc(a1_1->getNbOfElems()+a1_2->getNbOfElems()+_mesh3D_ids->getNbOfElems(),1); - int *ptri=a1->getPointer(); - ptri=std::copy(a1_1->getConstPointer(),a1_1->getConstPointer()+a1_1->getNbOfElems(),ptri); - a1_1->decrRef(); - ptri=std::copy(a1_2->getConstPointer(),a1_2->getConstPointer()+a1_2->getNbOfElems(),ptri); - a1_2->decrRef(); - std::copy(_mesh3D_ids->getConstPointer(),_mesh3D_ids->getConstPointer()+_mesh3D_ids->getNbOfElems(),ptri); - a2->alloc(a2_1->getNbOfElems()+a2_2->getNbOfElems(),1); - double *ptrd=a2->getPointer(); - ptrd=std::copy(a2_1->getConstPointer(),a2_1->getConstPointer()+a2_1->getNbOfElems(),ptrd); - a2_1->decrRef(); - std::copy(a2_2->getConstPointer(),a2_2->getConstPointer()+a2_2->getNbOfElems(),ptrd); - a2_2->decrRef(); -} - -void MEDCouplingExtrudedMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings) -{ - setName(littleStrings[littleStrings.size()-2]); - setDescription(littleStrings.back()); - std::size_t sz=tinyInfo.size(); - int sz1=tinyInfo[sz-2]; - _cell_2D_id=tinyInfo[sz-3]; - std::vector ti1(tinyInfo.begin(),tinyInfo.begin()+sz1); - std::vector ti2(tinyInfo.begin()+sz1,tinyInfo.end()-3); - DataArrayInt *a1tmp=DataArrayInt::New(); - DataArrayDouble *a2tmp=DataArrayDouble::New(); - const int *a1Ptr=a1->getConstPointer(); - const double *a2Ptr=a2->getConstPointer(); - _mesh2D=MEDCouplingUMesh::New(); - std::vector ls1,ls2; - _mesh2D->resizeForUnserialization(ti1,a1tmp,a2tmp,ls1); - std::copy(a2Ptr,a2Ptr+a2tmp->getNbOfElems(),a2tmp->getPointer()); - std::copy(a1Ptr,a1Ptr+a1tmp->getNbOfElems(),a1tmp->getPointer()); - a2Ptr+=a2tmp->getNbOfElems(); - a1Ptr+=a1tmp->getNbOfElems(); - ls2.insert(ls2.end(),littleStrings.begin(),littleStrings.begin()+ls1.size()); - std::vector d1(1); - _mesh2D->unserialization(d1,ti1,a1tmp,a2tmp,ls2); - a1tmp->decrRef(); a2tmp->decrRef(); - // - ls2.clear(); - ls2.insert(ls2.end(),littleStrings.begin()+ls1.size(),littleStrings.end()-2); - _mesh1D=MEDCouplingUMesh::New(); - a1tmp=DataArrayInt::New(); a2tmp=DataArrayDouble::New(); - _mesh1D->resizeForUnserialization(ti2,a1tmp,a2tmp,ls1); - std::copy(a2Ptr,a2Ptr+a2tmp->getNbOfElems(),a2tmp->getPointer()); - std::copy(a1Ptr,a1Ptr+a1tmp->getNbOfElems(),a1tmp->getPointer()); - a1Ptr+=a1tmp->getNbOfElems(); - _mesh1D->unserialization(d1,ti2,a1tmp,a2tmp,ls2); - a1tmp->decrRef(); a2tmp->decrRef(); - // - _mesh3D_ids=DataArrayInt::New(); - int szIds=(int)std::distance(a1Ptr,a1->getConstPointer()+a1->getNbOfElems()); - _mesh3D_ids->alloc(szIds,1); - std::copy(a1Ptr,a1Ptr+szIds,_mesh3D_ids->getPointer()); -} - -void MEDCouplingExtrudedMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const -{ - MEDCouplingAutoRefCountObjectPtr m=buildUnstructured(); - m->writeVTKLL(ofs,cellData,pointData,byteData); -} - -void MEDCouplingExtrudedMesh::reprQuickOverview(std::ostream& stream) const -{ - stream << "MEDCouplingExtrudedMesh C++ instance at " << this << ". Name : \"" << getName() << "\"."; -} - -std::string MEDCouplingExtrudedMesh::getVTKFileExtension() const -{ - return _mesh2D->getVTKFileExtension(); -} - -std::string MEDCouplingExtrudedMesh::getVTKDataSetType() const -{ - return _mesh2D->getVTKDataSetType(); -} diff --git a/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx b/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx deleted file mode 100644 index aa0e65698..000000000 --- a/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx +++ /dev/null @@ -1,134 +0,0 @@ -// 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, 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 -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : Anthony Geay (CEA/DEN) - -#ifndef __PARAMEDMEM_MEDCOUPLINGEXTRUDEDMESH_HXX__ -#define __PARAMEDMEM_MEDCOUPLINGEXTRUDEDMESH_HXX__ - -#include "MEDCoupling.hxx" -#include "MEDCouplingMesh.hxx" - -#include - -namespace MEDCoupling -{ - class DataArrayInt; - class DataArrayDouble; - class MEDCouplingUMesh; - class MEDCouplingFieldDouble; - - class MEDCouplingExtrudedMesh : public MEDCouplingMesh - { - public: - MEDCOUPLING_EXPORT static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId); - MEDCOUPLING_EXPORT static MEDCouplingExtrudedMesh *New(); - MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const; - MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; - MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; - MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other); - MEDCOUPLING_EXPORT int getNumberOfCells() const; - MEDCOUPLING_EXPORT int getNumberOfNodes() const; - MEDCOUPLING_EXPORT int getSpaceDimension() const; - MEDCOUPLING_EXPORT int getMeshDimension() const; - MEDCOUPLING_EXPORT MEDCouplingExtrudedMesh *deepCpy() const; - MEDCouplingExtrudedMesh *clone(bool recDeepCpy) const; - MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const; - MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const; - MEDCOUPLING_EXPORT void checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const; - MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayInt *&cellCor) const; - MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const; - MEDCOUPLING_EXPORT std::set getAllGeoTypes() const; - MEDCOUPLING_EXPORT DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; - MEDCOUPLING_EXPORT DataArrayInt *computeNbOfNodesPerCell() const; - MEDCOUPLING_EXPORT DataArrayInt *computeNbOfFacesPerCell() const; - MEDCOUPLING_EXPORT DataArrayInt *computeEffectiveNbOfNodesPerCell() const; - MEDCOUPLING_EXPORT int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; - MEDCOUPLING_EXPORT void getNodeIdsOfCell(int cellId, std::vector& conn) const; - MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector& coo) const; - MEDCOUPLING_EXPORT std::string simpleRepr() const; - MEDCOUPLING_EXPORT std::string advancedRepr() const; - MEDCOUPLING_EXPORT void checkCoherency() const; - MEDCOUPLING_EXPORT void checkCoherency1(double eps=1e-12) const; - MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const; - MEDCOUPLING_EXPORT void updateTime() const; - MEDCOUPLING_EXPORT void renumberCells(const int *old2NewBg, bool check=true); - MEDCOUPLING_EXPORT MEDCouplingUMesh *getMesh2D() const { return _mesh2D; } - MEDCOUPLING_EXPORT MEDCouplingUMesh *getMesh1D() const { return _mesh1D; } - MEDCOUPLING_EXPORT DataArrayInt *getMesh3DIds() const { return _mesh3D_ids; } - MEDCOUPLING_EXPORT MEDCouplingUMesh *build3DUnstructuredMesh() const; - MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool) const; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool) const; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const; - MEDCOUPLING_EXPORT int getCellContainingPoint(const double *pos, double eps) const; - MEDCOUPLING_EXPORT static int FindCorrespCellByNodalConn(const std::vector& nodalConnec, - const int *revNodalPtr, const int *revNodalIndxPtr); - MEDCOUPLING_EXPORT static void Project1DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps, - MEDCouplingUMesh *&m1r, MEDCouplingUMesh *&m2r, double *v); - MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle); - MEDCOUPLING_EXPORT void translate(const double *vector); - MEDCOUPLING_EXPORT void scale(const double *point, double factor); - MEDCOUPLING_EXPORT std::vector getDistributionOfTypes() const; - MEDCOUPLING_EXPORT DataArrayInt *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const; - MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType) const; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildPart(const int *start, const int *end) const; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const; - MEDCOUPLING_EXPORT DataArrayInt *simplexize(int policy); - MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const; - MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const; - MEDCOUPLING_EXPORT DataArrayDouble *getBarycenterAndOwner() const; - MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const; - MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const; - //Serialization unserialisation - MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; - MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, - const std::vector& littleStrings); - MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; - MEDCOUPLING_EXPORT std::string getVTKFileExtension() const; - private: - MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId); - MEDCouplingExtrudedMesh(const MEDCouplingExtrudedMesh& other, bool deepCopy); - MEDCouplingExtrudedMesh(); - void computeExtrusion(const MEDCouplingUMesh *mesh3D); - void computeExtrusionAlg(const MEDCouplingUMesh *mesh3D); - void build1DExtrusion(int idIn3DDesc, int newId, int nbOf1DLev, MEDCouplingUMesh *subMesh, - const int *desc3D, const int *descIndx3D, - const int *revDesc3D, const int *revDescIndx3D, - bool computeMesh1D); - int findOppositeFaceOf(int current2DCell, int current3DCell, const std::vector& connSorted, - const int *desc3D, const int *descIndx3D, - const int *conn2D, const int *conn2DIndx); - void computeBaryCenterOfFace(const std::vector& nodalConnec, int lev1DId); - ~MEDCouplingExtrudedMesh(); - void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const; - std::string getVTKDataSetType() const; - private: - MEDCouplingUMesh *_mesh2D; - MEDCouplingUMesh *_mesh1D; - //! New to old 3D cell Ids Array - DataArrayInt *_mesh3D_ids; - int _cell_2D_id; - }; -} - -#endif diff --git a/src/MEDCoupling/MEDCouplingField.hxx b/src/MEDCoupling/MEDCouplingField.hxx index 1aa4ddeeb..04438b1e4 100644 --- a/src/MEDCoupling/MEDCouplingField.hxx +++ b/src/MEDCoupling/MEDCouplingField.hxx @@ -26,7 +26,7 @@ #include "MEDCouplingNatureOfField.hxx" #include "MEDCouplingRefCountObject.hxx" #include "NormalizedUnstructuredMesh.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "MEDCouplingFieldDiscretization.hxx" #include "InterpKernelException.hxx" @@ -44,7 +44,7 @@ namespace MEDCoupling class MEDCouplingField : public RefCountObject, public TimeLabel { public: - MEDCOUPLING_EXPORT virtual void checkCoherency() const = 0; + MEDCOUPLING_EXPORT virtual void checkConsistencyLight() const = 0; MEDCOUPLING_EXPORT virtual bool areCompatibleForMerge(const MEDCouplingField *other) const; MEDCOUPLING_EXPORT virtual bool areStrictlyCompatible(const MEDCouplingField *other) const; MEDCOUPLING_EXPORT virtual bool areStrictlyCompatibleForMulDiv(const MEDCouplingField *other) const; @@ -101,7 +101,7 @@ namespace MEDCoupling std::string _desc; NatureOfField _nature; const MEDCouplingMesh *_mesh; - MEDCouplingAutoRefCountObjectPtr _type; + MCAuto _type; }; } diff --git a/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx b/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx index 1416eb699..9da7ee6b4 100644 --- a/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx @@ -22,7 +22,7 @@ #include "MEDCouplingCMesh.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingFieldDouble.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "CellModel.hxx" #include "InterpolationUtils.hxx" @@ -189,7 +189,7 @@ bool MEDCouplingFieldDiscretization::isEqualWithoutConsideringStr(const MEDCoupl * This method is an alias of MEDCouplingFieldDiscretization::clone. It is only here for coherency with all the remaining of MEDCoupling. * \sa MEDCouplingFieldDiscretization::clone. */ -MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretization::deepCpy() const +MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretization::deepCopy() const { return clone(); } @@ -234,7 +234,7 @@ std::vector MEDCouplingFieldDiscretization::getDirectCh */ void MEDCouplingFieldDiscretization::normL1(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const { - MEDCouplingAutoRefCountObjectPtr vol=getMeasureField(mesh,true); + MCAuto vol=getMeasureField(mesh,true); int nbOfCompo=arr->getNumberOfComponents(); int nbOfElems=getNumberOfTuples(mesh); std::fill(res,res+nbOfCompo,0.); @@ -258,7 +258,7 @@ void MEDCouplingFieldDiscretization::normL1(const MEDCouplingMesh *mesh, const D */ void MEDCouplingFieldDiscretization::normL2(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const { - MEDCouplingAutoRefCountObjectPtr vol=getMeasureField(mesh,true); + MCAuto vol=getMeasureField(mesh,true); int nbOfCompo=arr->getNumberOfComponents(); int nbOfElems=getNumberOfTuples(mesh); std::fill(res,res+nbOfCompo,0.); @@ -287,7 +287,7 @@ void MEDCouplingFieldDiscretization::integral(const MEDCouplingMesh *mesh, const throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::integral : mesh is NULL !"); if(!arr) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::integral : input array is NULL !"); - MEDCouplingAutoRefCountObjectPtr vol=getMeasureField(mesh,isWAbs); + MCAuto vol=getMeasureField(mesh,isWAbs); int nbOfCompo=arr->getNumberOfComponents(); int nbOfElems=getNumberOfTuples(mesh); if(nbOfElems!=arr->getNumberOfTuples()) @@ -319,7 +319,7 @@ void MEDCouplingFieldDiscretization::integral(const MEDCouplingMesh *mesh, const */ MEDCouplingMesh *MEDCouplingFieldDiscretization::buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const { - MEDCouplingAutoRefCountObjectPtr da=DataArrayInt::Range(beginCellIds,endCellIds,stepCellIds); + MCAuto da=DataArrayInt::Range(beginCellIds,endCellIds,stepCellIds); return buildSubMeshData(mesh,da->begin(),da->end(),di); } @@ -433,7 +433,7 @@ void MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr(double eps, cons int oldNbOfElems=arr->getNumberOfTuples(); int nbOfComp=arr->getNumberOfComponents(); int newNbOfTuples=newNbOfEntity; - MEDCouplingAutoRefCountObjectPtr arrCpy=arr->deepCpy(); + MCAuto arrCpy=arr->deepCopy(); const double *ptSrc=arrCpy->getConstPointer(); arr->reAlloc(newNbOfTuples); double *ptToFill=arr->getPointer(); @@ -467,7 +467,7 @@ void MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr(double eps, cons void MEDCouplingFieldDiscretization::RenumberEntitiesFromN2OArr(const int *new2OldPtr, int new2OldSz, DataArrayDouble *arr, const std::string& msg) { int nbOfComp=arr->getNumberOfComponents(); - MEDCouplingAutoRefCountObjectPtr arrCpy=arr->deepCpy(); + MCAuto arrCpy=arr->deepCopy(); const double *ptSrc=arrCpy->getConstPointer(); arr->reAlloc(new2OldSz); double *ptToFill=arr->getPointer(); @@ -488,9 +488,9 @@ TypeOfField MEDCouplingFieldDiscretizationP0::getEnum() const } /*! - * This method is simply called by MEDCouplingFieldDiscretization::deepCpy. It performs the deep copy of \a this. + * This method is simply called by MEDCouplingFieldDiscretization::deepCopy. It performs the deep copy of \a this. * - * \sa MEDCouplingFieldDiscretization::deepCpy. + * \sa MEDCouplingFieldDiscretization::deepCopy. */ MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretizationP0::clone() const { @@ -605,7 +605,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationP0::getLocalizationOfDiscValues(c { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getLocalizationOfDiscValues : NULL input mesh !"); - return mesh->getBarycenterAndOwner(); + return mesh->computeCellCenterOfMass(); } void MEDCouplingFieldDiscretizationP0::computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd, @@ -613,10 +613,10 @@ void MEDCouplingFieldDiscretizationP0::computeMeshRestrictionFromTupleIds(const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::computeMeshRestrictionFromTupleIds : NULL input mesh !"); - MEDCouplingAutoRefCountObjectPtr tmp=DataArrayInt::New(); + MCAuto tmp=DataArrayInt::New(); tmp->alloc((int)std::distance(tupleIdsBg,tupleIdsEnd),1); std::copy(tupleIdsBg,tupleIdsEnd,tmp->getPointer()); - MEDCouplingAutoRefCountObjectPtr tmp2(tmp->deepCpy()); + MCAuto tmp2(tmp->deepCopy()); cellRestriction=tmp.retn(); trueTupleRestriction=tmp2.retn(); } @@ -673,12 +673,12 @@ DataArrayDouble *MEDCouplingFieldDiscretizationP0::getValueOnMulti(const DataArr { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getValueOnMulti : NULL input mesh !"); - MEDCouplingAutoRefCountObjectPtr eltsArr,eltsIndexArr; + MCAuto eltsArr,eltsIndexArr; mesh->getCellsContainingPoints(loc,nbOfPoints,_precision,eltsArr,eltsIndexArr); const int *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin()); int spaceDim=mesh->getSpaceDimension(); int nbOfComponents=arr->getNumberOfComponents(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); ret->alloc(nbOfPoints,nbOfComponents); double *ptToFill=ret->getPointer(); for(int i=0;i ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc((int)std::distance(startCellIds,endCellIds),1); std::copy(startCellIds,endCellIds,ret->getPointer()); return ret.retn(); @@ -738,8 +738,8 @@ MEDCouplingMesh *MEDCouplingFieldDiscretizationP0::buildSubMeshData(const MEDCou { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::buildSubMeshData : NULL input mesh !"); - MEDCouplingAutoRefCountObjectPtr ret=mesh->buildPart(start,end); - MEDCouplingAutoRefCountObjectPtr diSafe=DataArrayInt::New(); + MCAuto ret=mesh->buildPart(start,end); + MCAuto diSafe=DataArrayInt::New(); diSafe->alloc((int)std::distance(start,end),1); std::copy(start,end,diSafe->getPointer()); di=diSafe.retn(); @@ -760,7 +760,7 @@ MEDCouplingMesh *MEDCouplingFieldDiscretizationP0::buildSubMeshDataRange(const M { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::buildSubMeshDataRange : NULL input mesh !"); - MEDCouplingAutoRefCountObjectPtr ret=mesh->buildPartRange(beginCellIds,endCellIds,stepCellIds); + MCAuto ret=mesh->buildPartRange(beginCellIds,endCellIds,stepCellIds); di=0; beginOut=beginCellIds; endOut=endCellIds; stepOut=stepCellIds; return ret.retn(); } @@ -848,12 +848,12 @@ void MEDCouplingFieldDiscretizationOnNodes::computeMeshRestrictionFromTupleIds(c { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationOnNodes::computeMeshRestrictionFromTupleIds : NULL input mesh !"); - MEDCouplingAutoRefCountObjectPtr ret1=mesh->getCellIdsFullyIncludedInNodeIds(tupleIdsBg,tupleIdsEnd); + MCAuto ret1=mesh->getCellIdsFullyIncludedInNodeIds(tupleIdsBg,tupleIdsEnd); const MEDCouplingUMesh *meshc=dynamic_cast(mesh); if(!meshc) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationOnNodes::computeMeshRestrictionFromTupleIds : trying to subpart field on nodes by node ids ! Your mesh has to be unstructured !"); - MEDCouplingAutoRefCountObjectPtr meshPart=static_cast(meshc->buildPartOfMySelf(ret1->begin(),ret1->end(),true)); - MEDCouplingAutoRefCountObjectPtr ret2=meshPart->computeFetchedNodeIds(); + MCAuto meshPart=static_cast(meshc->buildPartOfMySelf(ret1->begin(),ret1->end(),true)); + MCAuto ret2=meshPart->computeFetchedNodeIds(); cellRestriction=ret1.retn(); trueTupleRestriction=ret2.retn(); } @@ -881,9 +881,9 @@ MEDCouplingMesh *MEDCouplingFieldDiscretizationOnNodes::buildSubMeshData(const M if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationNodes::buildSubMeshData : NULL input mesh !"); DataArrayInt *diTmp=0; - MEDCouplingAutoRefCountObjectPtr ret=mesh->buildPartAndReduceNodes(start,end,diTmp); - MEDCouplingAutoRefCountObjectPtr diTmpSafe(diTmp); - MEDCouplingAutoRefCountObjectPtr di2=diTmpSafe->invertArrayO2N2N2O(ret->getNumberOfNodes()); + MCAuto ret=mesh->buildPartAndReduceNodes(start,end,diTmp); + MCAuto diTmpSafe(diTmp); + MCAuto di2=diTmpSafe->invertArrayO2N2N2O(ret->getNumberOfNodes()); di=di2.retn(); return ret.retn(); } @@ -903,11 +903,11 @@ MEDCouplingMesh *MEDCouplingFieldDiscretizationOnNodes::buildSubMeshDataRange(co if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationOnNodes::buildSubMeshDataRange : NULL input mesh !"); DataArrayInt *diTmp=0; - MEDCouplingAutoRefCountObjectPtr ret=mesh->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,beginOut,endOut,stepOut,diTmp); + MCAuto ret=mesh->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,beginOut,endOut,stepOut,diTmp); if(diTmp) { - MEDCouplingAutoRefCountObjectPtr diTmpSafe(diTmp); - MEDCouplingAutoRefCountObjectPtr di2=diTmpSafe->invertArrayO2N2N2O(ret->getNumberOfNodes()); + MCAuto diTmpSafe(diTmp); + MCAuto di2=diTmpSafe->invertArrayO2N2N2O(ret->getNumberOfNodes()); di=di2.retn(); } return ret.retn(); @@ -925,8 +925,8 @@ DataArrayInt *MEDCouplingFieldDiscretizationOnNodes::computeTupleIdsToSelectFrom { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP1::computeTupleIdsToSelectFromCellIds : NULL input mesh !"); - const MEDCouplingAutoRefCountObjectPtr umesh=mesh->buildUnstructured(); - MEDCouplingAutoRefCountObjectPtr umesh2=static_cast(umesh->buildPartOfMySelf(startCellIds,endCellIds,true)); + const MCAuto umesh=mesh->buildUnstructured(); + MCAuto umesh2=static_cast(umesh->buildPartOfMySelf(startCellIds,endCellIds,true)); return umesh2->computeFetchedNodeIds(); } @@ -964,9 +964,9 @@ TypeOfField MEDCouplingFieldDiscretizationP1::getEnum() const } /*! - * This method is simply called by MEDCouplingFieldDiscretization::deepCpy. It performs the deep copy of \a this. + * This method is simply called by MEDCouplingFieldDiscretization::deepCopy. It performs the deep copy of \a this. * - * \sa MEDCouplingFieldDiscretization::deepCpy. + * \sa MEDCouplingFieldDiscretization::deepCopy. */ MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretizationP1::clone() const { @@ -999,8 +999,8 @@ bool MEDCouplingFieldDiscretizationP1::isEqualIfNotWhy(const MEDCouplingFieldDis void MEDCouplingFieldDiscretizationP1::checkCompatibilityWithNature(NatureOfField nat) const { - if(nat!=ConservativeVolumic) - throw INTERP_KERNEL::Exception("Invalid nature for P1 field : expected ConservativeVolumic !"); + if(nat!=IntensiveMaximum) + throw INTERP_KERNEL::Exception("Invalid nature for P1 field : expected IntensiveMaximum !"); } MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationP1::getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const @@ -1058,12 +1058,12 @@ DataArrayDouble *MEDCouplingFieldDiscretizationP1::getValueOnMulti(const DataArr { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP1::getValueOnMulti : NULL input mesh !"); - MEDCouplingAutoRefCountObjectPtr eltsArr,eltsIndexArr; + MCAuto eltsArr,eltsIndexArr; mesh->getCellsContainingPoints(loc,nbOfPoints,_precision,eltsArr,eltsIndexArr); const int *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin()); int spaceDim=mesh->getSpaceDimension(); int nbOfComponents=arr->getNumberOfComponents(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); ret->alloc(nbOfPoints,nbOfComponents); double *ptToFill=ret->getPointer(); for(int i=0;ideepCpy(); + _discr_per_cell=arr->deepCopy(); else _discr_per_cell=arr->selectByTupleIdSafe(startCellIds,endCellIds); } @@ -1114,7 +1114,7 @@ MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell(con DataArrayInt *arr=other._discr_per_cell; if(arr) { - _discr_per_cell=arr->selectByTupleId2(beginCellIds,endCellIds,stepCellIds); + _discr_per_cell=arr->selectByTupleIdSafeSlice(beginCellIds,endCellIds,stepCellIds); } } @@ -1220,7 +1220,7 @@ void MEDCouplingFieldDiscretizationPerCell::checkNoOrphanCells() const { if(!_discr_per_cell) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell::checkNoOrphanCells : no discretization defined !"); - MEDCouplingAutoRefCountObjectPtr test=_discr_per_cell->getIdsEqual(DFT_INVALID_LOCID_VALUE); + MCAuto test=_discr_per_cell->findIdsEqual(DFT_INVALID_LOCID_VALUE); if(test->getNumberOfTuples()!=0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell::checkNoOrphanCells : presence of orphan cells !"); } @@ -1325,9 +1325,9 @@ bool MEDCouplingFieldDiscretizationGauss::isEqualWithoutConsideringStr(const MED } /*! - * This method is simply called by MEDCouplingFieldDiscretization::deepCpy. It performs the deep copy of \a this. + * This method is simply called by MEDCouplingFieldDiscretization::deepCopy. It performs the deep copy of \a this. * - * \sa MEDCouplingFieldDiscretization::deepCpy. + * \sa MEDCouplingFieldDiscretization::deepCopy. */ MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretizationGauss::clone() const { @@ -1456,14 +1456,14 @@ int MEDCouplingFieldDiscretizationGauss::getNumberOfMeshPlaces(const MEDCoupling /*! * This method is redevelopped for performance reasons, but it is equivalent to a call to MEDCouplingFieldDiscretizationGauss::buildNbOfGaussPointPerCellField - * and a call to DataArrayDouble::computeOffsets2 on the returned array. + * and a call to DataArrayDouble::computeOffsetsFull on the returned array. */ DataArrayInt *MEDCouplingFieldDiscretizationGauss::getOffsetArr(const MEDCouplingMesh *mesh) const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getOffsetArr : NULL input mesh !"); int nbOfTuples=mesh->getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuples+1,1); int *retPtr=ret->getPointer(); const int *start=_discr_per_cell->getConstPointer(); @@ -1521,16 +1521,16 @@ DataArrayDouble *MEDCouplingFieldDiscretizationGauss::getLocalizationOfDiscValue if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getLocalizationOfDiscValues : NULL input mesh !"); checkNoOrphanCells(); - MEDCouplingAutoRefCountObjectPtr umesh=mesh->buildUnstructured();//in general do nothing + MCAuto umesh=mesh->buildUnstructured();//in general do nothing int nbOfTuples=getNumberOfTuples(mesh); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); int spaceDim=mesh->getSpaceDimension(); ret->alloc(nbOfTuples,spaceDim); std::vector< int > locIds; std::vector parts=splitIntoSingleGaussDicrPerCellType(locIds); - std::vector< MEDCouplingAutoRefCountObjectPtr > parts2(parts.size()); + std::vector< MCAuto > parts2(parts.size()); std::copy(parts.begin(),parts.end(),parts2.begin()); - MEDCouplingAutoRefCountObjectPtr offsets=buildNbOfGaussPointPerCellField(); + MCAuto offsets=buildNbOfGaussPointPerCellField(); offsets->computeOffsets(); const int *ptrOffsets=offsets->getConstPointer(); const double *coords=umesh->getCoords()->getConstPointer(); @@ -1561,13 +1561,13 @@ void MEDCouplingFieldDiscretizationGauss::computeMeshRestrictionFromTupleIds(con { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::computeMeshRestrictionFromTupleIds : NULL input mesh !"); - MEDCouplingAutoRefCountObjectPtr tmp=DataArrayInt::New(); tmp->alloc((int)std::distance(tupleIdsBg,tupleIdsEnd),1); + MCAuto tmp=DataArrayInt::New(); tmp->alloc((int)std::distance(tupleIdsBg,tupleIdsEnd),1); std::copy(tupleIdsBg,tupleIdsEnd,tmp->getPointer()); tmp->sort(true); tmp=tmp->buildUnique(); - MEDCouplingAutoRefCountObjectPtr nbOfNodesPerCell=buildNbOfGaussPointPerCellField(); - nbOfNodesPerCell->computeOffsets2(); - nbOfNodesPerCell->searchRangesInListOfIds(tmp,cellRestriction,trueTupleRestriction); + MCAuto nbOfNodesPerCell=buildNbOfGaussPointPerCellField(); + nbOfNodesPerCell->computeOffsetsFull(); + nbOfNodesPerCell->findIdsRangesInListOfIds(tmp,cellRestriction,trueTupleRestriction); } /*! @@ -1658,7 +1658,7 @@ void MEDCouplingFieldDiscretizationGauss::checkCoherencyBetween(const MEDCouplin throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::checkCoherencyBetween : NULL input mesh or DataArray !"); MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween(mesh,da); for(std::vector::const_iterator iter=_loc.begin();iter!=_loc.end();iter++) - (*iter).checkCoherency(); + (*iter).checkConsistencyLight(); int nbOfDesc=(int)_loc.size(); int nbOfCells=mesh->getNumberOfCells(); const int *dc=_discr_per_cell->getConstPointer(); @@ -1692,9 +1692,9 @@ MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGauss::getMeasureField(con { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getMeasureField : mesh instance specified is NULL !"); - MEDCouplingAutoRefCountObjectPtr vol=mesh->getMeasureField(isAbs); + MCAuto vol=mesh->getMeasureField(isAbs); const double *volPtr=vol->getArray()->begin(); - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingFieldDouble::New(ON_GAUSS_PT); + MCAuto ret=MEDCouplingFieldDouble::New(ON_GAUSS_PT); ret->setMesh(mesh); ret->setDiscretization(const_cast(this)); if(!_discr_per_cell) @@ -1704,15 +1704,15 @@ MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGauss::getMeasureField(con throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getMeasureField : no discr per cell array defined but with nb of components different from 1 !"); if(_discr_per_cell->getNumberOfTuples()!=vol->getNumberOfTuples()) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getMeasureField : no discr per cell array defined but mismatch between nb of cells of mesh and size of spatial disr array !"); - MEDCouplingAutoRefCountObjectPtr offset=getOffsetArr(mesh); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::New(); arr->alloc(getNumberOfTuples(mesh),1); + MCAuto offset=getOffsetArr(mesh); + MCAuto arr=DataArrayDouble::New(); arr->alloc(getNumberOfTuples(mesh),1); ret->setArray(arr); double *arrPtr=arr->getPointer(); const int *offsetPtr=offset->getConstPointer(); int maxGaussLoc=(int)_loc.size(); std::vector locIds; std::vector ids=splitIntoSingleGaussDicrPerCellType(locIds); - std::vector< MEDCouplingAutoRefCountObjectPtr > ids2(ids.size()); std::copy(ids.begin(),ids.end(),ids2.begin()); + std::vector< MCAuto > ids2(ids.size()); std::copy(ids.begin(),ids.end(),ids2.begin()); for(std::size_t i=0;i diSafe=computeTupleIdsToSelectFromCellIds(mesh,start,end); - MEDCouplingAutoRefCountObjectPtr ret=mesh->buildPart(start,end); + MCAuto diSafe=computeTupleIdsToSelectFromCellIds(mesh,start,end); + MCAuto ret=mesh->buildPart(start,end); di=diSafe.retn(); return ret.retn(); } @@ -1805,7 +1805,7 @@ MEDCouplingMesh *MEDCouplingFieldDiscretizationGauss::buildSubMeshDataRange(cons else { std::ostringstream oss; oss << msg << i << " is detected as orphan !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } } - MEDCouplingAutoRefCountObjectPtr ret=mesh->buildPartRange(beginCellIds,endCellIds,stepCellIds); + MCAuto ret=mesh->buildPartRange(beginCellIds,endCellIds,stepCellIds); return ret.retn(); } @@ -1820,12 +1820,12 @@ DataArrayInt *MEDCouplingFieldDiscretizationGauss::computeTupleIdsToSelectFromCe { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::computeTupleIdsToSelectFromCellIds : null mesh !"); - MEDCouplingAutoRefCountObjectPtr nbOfNodesPerCell=buildNbOfGaussPointPerCellField();//check of _discr_per_cell not NULL pointer + MCAuto nbOfNodesPerCell=buildNbOfGaussPointPerCellField();//check of _discr_per_cell not NULL pointer int nbOfCells=mesh->getNumberOfCells(); if(_discr_per_cell->getNumberOfTuples()!=nbOfCells) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::computeTupleIdsToSelectFromCellIds : mismatch of nb of tuples of cell ids array and number of cells !"); - nbOfNodesPerCell->computeOffsets2(); - MEDCouplingAutoRefCountObjectPtr sel=DataArrayInt::New(); sel->useArray(startCellIds,false,CPP_DEALLOC,(int)std::distance(startCellIds,endCellIds),1); + nbOfNodesPerCell->computeOffsetsFull(); + MCAuto sel=DataArrayInt::New(); sel->useArray(startCellIds,false,CPP_DEALLOC,(int)std::distance(startCellIds,endCellIds),1); return sel->buildExplicitArrByRanges(nbOfNodesPerCell); } @@ -2013,7 +2013,7 @@ DataArrayInt *MEDCouplingFieldDiscretizationGauss::buildNbOfGaussPointPerCellFie if(!_discr_per_cell) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::buildNbOfGaussPointPerCellField : no discretization array set !"); int nbOfTuples=_discr_per_cell->getNumberOfTuples(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); const int *w=_discr_per_cell->begin(); ret->alloc(nbOfTuples,1); int *valsToFill=ret->getPointer(); @@ -2100,9 +2100,9 @@ TypeOfField MEDCouplingFieldDiscretizationGaussNE::getEnum() const } /*! - * This method is simply called by MEDCouplingFieldDiscretization::deepCpy. It performs the deep copy of \a this. + * This method is simply called by MEDCouplingFieldDiscretization::deepCopy. It performs the deep copy of \a this. * - * \sa MEDCouplingFieldDiscretization::deepCpy. + * \sa MEDCouplingFieldDiscretization::deepCopy. */ MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretizationGaussNE::clone() const { @@ -2261,8 +2261,8 @@ DataArrayDouble *MEDCouplingFieldDiscretizationGaussNE::getLocalizationOfDiscVal { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getLocalizationOfDiscValues : NULL input mesh !"); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); - MEDCouplingAutoRefCountObjectPtr umesh=mesh->buildUnstructured();//in general do nothing + MCAuto ret=DataArrayDouble::New(); + MCAuto umesh=mesh->buildUnstructured();//in general do nothing int nbOfTuples=getNumberOfTuples(umesh); int spaceDim=mesh->getSpaceDimension(); ret->alloc(nbOfTuples,spaceDim); @@ -2288,10 +2288,10 @@ void MEDCouplingFieldDiscretizationGaussNE::integral(const MEDCouplingMesh *mesh int nbOfCompo=arr->getNumberOfComponents(); std::fill(res,res+nbOfCompo,0.); // - MEDCouplingAutoRefCountObjectPtr vol=mesh->getMeasureField(isWAbs); + MCAuto vol=mesh->getMeasureField(isWAbs); std::set types=mesh->getAllGeoTypes(); - MEDCouplingAutoRefCountObjectPtr nbOfNodesPerCell=mesh->computeNbOfNodesPerCell(); - nbOfNodesPerCell->computeOffsets2(); + MCAuto nbOfNodesPerCell=mesh->computeNbOfNodesPerCell(); + nbOfNodesPerCell->computeOffsetsFull(); const double *arrPtr=arr->begin(),*volPtr=vol->getArray()->begin(); for(std::set::const_iterator it=types.begin();it!=types.end();it++) { @@ -2300,8 +2300,8 @@ void MEDCouplingFieldDiscretizationGaussNE::integral(const MEDCouplingMesh *mesh INTERP_KERNEL::AutoPtr wArr2=new double[wArrSz]; double sum=std::accumulate(wArr,wArr+wArrSz,0.); std::transform(wArr,wArr+wArrSz,(double *)wArr2,std::bind2nd(std::multiplies(),1./sum)); - MEDCouplingAutoRefCountObjectPtr ids=mesh->giveCellsWithType(*it); - MEDCouplingAutoRefCountObjectPtr ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell); + MCAuto ids=mesh->giveCellsWithType(*it); + MCAuto ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell); const int *ptIds2=ids2->begin(),*ptIds=ids->begin(); int nbOfCellsWithCurGeoType=ids->getNumberOfTuples(); for(int i=0;i tmp=DataArrayInt::New(); tmp->alloc((int)std::distance(tupleIdsBg,tupleIdsEnd),1); + MCAuto tmp=DataArrayInt::New(); tmp->alloc((int)std::distance(tupleIdsBg,tupleIdsEnd),1); std::copy(tupleIdsBg,tupleIdsEnd,tmp->getPointer()); tmp->sort(true); tmp=tmp->buildUnique(); - MEDCouplingAutoRefCountObjectPtr nbOfNodesPerCell=mesh->computeNbOfNodesPerCell(); - nbOfNodesPerCell->computeOffsets2(); - nbOfNodesPerCell->searchRangesInListOfIds(tmp,cellRestriction,trueTupleRestriction); + MCAuto nbOfNodesPerCell=mesh->computeNbOfNodesPerCell(); + nbOfNodesPerCell->computeOffsetsFull(); + nbOfNodesPerCell->findIdsRangesInListOfIds(tmp,cellRestriction,trueTupleRestriction); } void MEDCouplingFieldDiscretizationGaussNE::checkCompatibilityWithNature(NatureOfField nat) const @@ -2599,16 +2599,16 @@ MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGaussNE::getMeasureField(c { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getMeasureField : mesh instance specified is NULL !"); - MEDCouplingAutoRefCountObjectPtr vol=mesh->getMeasureField(isAbs); + MCAuto vol=mesh->getMeasureField(isAbs); const double *volPtr=vol->getArray()->begin(); - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingFieldDouble::New(ON_GAUSS_NE); + MCAuto ret=MEDCouplingFieldDouble::New(ON_GAUSS_NE); ret->setMesh(mesh); // std::set types=mesh->getAllGeoTypes(); - MEDCouplingAutoRefCountObjectPtr nbOfNodesPerCell=mesh->computeNbOfNodesPerCell(); + MCAuto nbOfNodesPerCell=mesh->computeNbOfNodesPerCell(); int nbTuples=nbOfNodesPerCell->accumulate(0); - nbOfNodesPerCell->computeOffsets2(); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::New(); arr->alloc(nbTuples,1); + nbOfNodesPerCell->computeOffsetsFull(); + MCAuto arr=DataArrayDouble::New(); arr->alloc(nbTuples,1); ret->setArray(arr); double *arrPtr=arr->getPointer(); for(std::set::const_iterator it=types.begin();it!=types.end();it++) @@ -2618,8 +2618,8 @@ MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGaussNE::getMeasureField(c INTERP_KERNEL::AutoPtr wArr2=new double[wArrSz]; double sum=std::accumulate(wArr,wArr+wArrSz,0.); std::transform(wArr,wArr+wArrSz,(double *)wArr2,std::bind2nd(std::multiplies(),1./sum)); - MEDCouplingAutoRefCountObjectPtr ids=mesh->giveCellsWithType(*it); - MEDCouplingAutoRefCountObjectPtr ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell); + MCAuto ids=mesh->giveCellsWithType(*it); + MCAuto ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell); const int *ptIds2=ids2->begin(),*ptIds=ids->begin(); int nbOfCellsWithCurGeoType=ids->getNumberOfTuples(); for(int i=0;i diSafe=computeTupleIdsToSelectFromCellIds(mesh,start,end); - MEDCouplingAutoRefCountObjectPtr ret=mesh->buildPart(start,end); + MCAuto diSafe=computeTupleIdsToSelectFromCellIds(mesh,start,end); + MCAuto ret=mesh->buildPart(start,end); di=diSafe.retn(); return ret.retn(); } @@ -2687,7 +2687,7 @@ MEDCouplingMesh *MEDCouplingFieldDiscretizationGaussNE::buildSubMeshDataRange(co if(i>=endCellIds) break; } - MEDCouplingAutoRefCountObjectPtr ret=mesh->buildPartRange(beginCellIds,endCellIds,stepCellIds); + MCAuto ret=mesh->buildPartRange(beginCellIds,endCellIds,stepCellIds); return ret.retn(); } @@ -2703,9 +2703,9 @@ DataArrayInt *MEDCouplingFieldDiscretizationGaussNE::computeTupleIdsToSelectFrom { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::computeTupleIdsToSelectFromCellIds : null mesh !"); - MEDCouplingAutoRefCountObjectPtr nbOfNodesPerCell=mesh->computeNbOfNodesPerCell(); - nbOfNodesPerCell->computeOffsets2(); - MEDCouplingAutoRefCountObjectPtr sel=DataArrayInt::New(); sel->useArray(startCellIds,false,CPP_DEALLOC,(int)std::distance(startCellIds,endCellIds),1); + MCAuto nbOfNodesPerCell=mesh->computeNbOfNodesPerCell(); + nbOfNodesPerCell->computeOffsetsFull(); + MCAuto sel=DataArrayInt::New(); sel->useArray(startCellIds,false,CPP_DEALLOC,(int)std::distance(startCellIds,endCellIds),1); return sel->buildExplicitArrByRanges(nbOfNodesPerCell); } @@ -2746,9 +2746,9 @@ const char *MEDCouplingFieldDiscretizationKriging::getRepr() const } /*! - * This method is simply called by MEDCouplingFieldDiscretization::deepCpy. It performs the deep copy of \a this. + * This method is simply called by MEDCouplingFieldDiscretization::deepCopy. It performs the deep copy of \a this. * - * \sa MEDCouplingFieldDiscretization::deepCpy. + * \sa MEDCouplingFieldDiscretization::deepCopy. */ MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretizationKriging::clone() const { @@ -2762,8 +2762,8 @@ std::string MEDCouplingFieldDiscretizationKriging::getStringRepr() const void MEDCouplingFieldDiscretizationKriging::checkCompatibilityWithNature(NatureOfField nat) const { - if(nat!=ConservativeVolumic) - throw INTERP_KERNEL::Exception("Invalid nature for Kriging field : expected ConservativeVolumic !"); + if(nat!=IntensiveMaximum) + throw INTERP_KERNEL::Exception("Invalid nature for Kriging field : expected IntensiveMaximum !"); } bool MEDCouplingFieldDiscretizationKriging::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const @@ -2789,7 +2789,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationKriging::getMeasureField(c void MEDCouplingFieldDiscretizationKriging::getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const { - MEDCouplingAutoRefCountObjectPtr res2=MEDCouplingFieldDiscretizationKriging::getValueOnMulti(arr,mesh,loc,1); + MCAuto res2=MEDCouplingFieldDiscretizationKriging::getValueOnMulti(arr,mesh,loc,1); std::copy(res2->begin(),res2->end(),res); } @@ -2804,8 +2804,8 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::getValueOnMulti(const Da throw INTERP_KERNEL::Exception(oss.str().c_str()); } int nbCols(-1),nbCompo(arr->getNumberOfComponents()); - MEDCouplingAutoRefCountObjectPtr m(computeEvaluationMatrixOnGivenPts(mesh,loc,nbOfTargetPoints,nbCols)); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayDouble::New()); + MCAuto m(computeEvaluationMatrixOnGivenPts(mesh,loc,nbOfTargetPoints,nbCols)); + MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfTargetPoints,nbCompo); INTERP_KERNEL::matrixProduct(m->begin(),nbOfTargetPoints,nbCols,arr->begin(),nbOfRows,nbCompo,ret->getPointer()); return ret.retn(); @@ -2824,18 +2824,18 @@ void MEDCouplingFieldDiscretizationKriging::reprQuickOverview(std::ostream& stre DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeEvaluationMatrixOnGivenPts(const MEDCouplingMesh *mesh, const double *loc, int nbOfTargetPoints, int& nbCols) const { int isDrift(-1),nbRows(-1); - MEDCouplingAutoRefCountObjectPtr matrixInv(computeInverseMatrix(mesh,isDrift,nbRows)); + MCAuto matrixInv(computeInverseMatrix(mesh,isDrift,nbRows)); // - MEDCouplingAutoRefCountObjectPtr coords=getLocalizationOfDiscValues(mesh); + MCAuto coords=getLocalizationOfDiscValues(mesh); int nbOfPts(coords->getNumberOfTuples()),dimension(coords->getNumberOfComponents()); - MEDCouplingAutoRefCountObjectPtr locArr=DataArrayDouble::New(); + MCAuto locArr=DataArrayDouble::New(); locArr->useArray(loc,false,CPP_DEALLOC,nbOfTargetPoints,dimension); nbCols=nbOfPts; // - MEDCouplingAutoRefCountObjectPtr matrix2=coords->buildEuclidianDistanceDenseMatrixWith(locArr); + MCAuto matrix2=coords->buildEuclidianDistanceDenseMatrixWith(locArr); operateOnDenseMatrix(mesh->getSpaceDimension(),nbOfTargetPoints*nbOfPts,matrix2->getPointer()); // - MEDCouplingAutoRefCountObjectPtr matrix3=DataArrayDouble::New(); + MCAuto matrix3=DataArrayDouble::New(); matrix3->alloc(nbOfTargetPoints*nbRows,1); double *work=matrix3->getPointer(); const double *workCst(matrix2->begin()),*workCst2(loc); @@ -2847,10 +2847,10 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeEvaluationMatrixO for(int j=0;j ret(DataArrayDouble::New()); + MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfTargetPoints,nbRows); INTERP_KERNEL::matrixProduct(matrix3->begin(),nbOfTargetPoints,nbRows,matrixInv->begin(),nbRows,nbRows,ret->getPointer()); - MEDCouplingAutoRefCountObjectPtr ret2(DataArrayDouble::New()); + MCAuto ret2(DataArrayDouble::New()); ret2->alloc(nbOfTargetPoints*nbOfPts,1); workCst=ret->begin(); work=ret2->getPointer(); for(int i=0;i matrixWithDrift(computeMatrix(mesh,isDrift,matSz)); - MEDCouplingAutoRefCountObjectPtr matrixInv(DataArrayDouble::New()); + MCAuto matrixWithDrift(computeMatrix(mesh,isDrift,matSz)); + MCAuto matrixInv(DataArrayDouble::New()); matrixInv->alloc(matSz*matSz,1); INTERP_KERNEL::inverseMatrix(matrixWithDrift->getConstPointer(),matSz,matrixInv->getPointer()); return matrixInv.retn(); @@ -2885,12 +2885,12 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeMatrix(const MEDC { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::computeMatrix : NULL input mesh !"); - MEDCouplingAutoRefCountObjectPtr coords(getLocalizationOfDiscValues(mesh)); + MCAuto coords(getLocalizationOfDiscValues(mesh)); int nbOfPts(coords->getNumberOfTuples()); - MEDCouplingAutoRefCountObjectPtr matrix(coords->buildEuclidianDistanceDenseMatrix()); + MCAuto matrix(coords->buildEuclidianDistanceDenseMatrix()); operateOnDenseMatrix(mesh->getSpaceDimension(),nbOfPts*nbOfPts,matrix->getPointer()); // Drift - MEDCouplingAutoRefCountObjectPtr matrixWithDrift(performDrift(matrix,coords,isDrift)); + MCAuto matrixWithDrift(performDrift(matrix,coords,isDrift)); matSz=nbOfPts+isDrift; return matrixWithDrift.retn(); } @@ -2908,10 +2908,10 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeMatrix(const MEDC DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeVectorOfCoefficients(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, int& isDrift) const { int nbRows(-1); - MEDCouplingAutoRefCountObjectPtr matrixInv(computeInverseMatrix(mesh,isDrift,nbRows)); - MEDCouplingAutoRefCountObjectPtr KnewiK(DataArrayDouble::New()); + MCAuto matrixInv(computeInverseMatrix(mesh,isDrift,nbRows)); + MCAuto KnewiK(DataArrayDouble::New()); KnewiK->alloc(nbRows*1,1); - MEDCouplingAutoRefCountObjectPtr arr2(PerformDriftOfVec(arr,isDrift)); + MCAuto arr2(PerformDriftOfVec(arr,isDrift)); INTERP_KERNEL::matrixProduct(matrixInv->getConstPointer(),nbRows,nbRows,arr2->getConstPointer(),arr2->getNumberOfTuples(),1,KnewiK->getPointer()); return KnewiK.retn(); } @@ -2985,7 +2985,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::PerformDriftRect(const D int nbOfCols(nbOfEltInMatrx/nbOfPts); if(nbOfEltInMatrx%nbOfPts!=0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::PerformDriftRect : size of input dense matrix and input arrays mismatch ! NbOfElems in matrix % nb of tuples in array must be equal to 0 !"); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayDouble::New()); ret->alloc(nbOfPts*(nbOfCols+delta)); + MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfPts*(nbOfCols+delta)); double *retPtr(ret->getPointer()); const double *mPtr(matr->begin()),*aPtr(arr->begin()); for(int i=0;i=0 !"); - MEDCouplingAutoRefCountObjectPtr arr2(DataArrayDouble::New()); + MCAuto arr2(DataArrayDouble::New()); arr2->alloc((arr->getNumberOfTuples()+isDrift)*1,1); double *work(std::copy(arr->begin(),arr->end(),arr2->getPointer())); std::fill(work,work+isDrift,0.); @@ -3032,7 +3032,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::performDrift(const DataA int szOfMatrix=arr->getNumberOfTuples(); if(szOfMatrix*szOfMatrix!=matr->getNumberOfTuples()) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::performDrift : invalid size"); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); ret->alloc((szOfMatrix+delta)*(szOfMatrix+delta),1); const double *srcWork=matr->getConstPointer(); const double *srcWork2=arr->getConstPointer(); @@ -3047,7 +3047,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::performDrift(const DataA } std::fill(destWork,destWork+szOfMatrix,1.); destWork+=szOfMatrix; std::fill(destWork,destWork+spaceDimension+1,0.); destWork+=spaceDimension+1; - MEDCouplingAutoRefCountObjectPtr arrNoI=arr->toNoInterlace(); + MCAuto arrNoI=arr->toNoInterlace(); srcWork2=arrNoI->getConstPointer(); for(int i=0;i #include @@ -55,7 +55,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual bool isEqual(const MEDCouplingFieldDiscretization *other, double eps) const; MEDCOUPLING_EXPORT virtual bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const = 0; MEDCOUPLING_EXPORT virtual bool isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double eps) const; - MEDCOUPLING_EXPORT virtual MEDCouplingFieldDiscretization *deepCpy() const; + MEDCOUPLING_EXPORT virtual MEDCouplingFieldDiscretization *deepCopy() const; MEDCOUPLING_EXPORT virtual MEDCouplingFieldDiscretization *clone() const = 0; MEDCOUPLING_EXPORT virtual MEDCouplingFieldDiscretization *clonePart(const int *startCellIds, const int *endCellIds) const; MEDCOUPLING_EXPORT virtual MEDCouplingFieldDiscretization *clonePartRange(int beginCellIds, int endCellIds, int stepCellIds) const; diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.cxx b/src/MEDCoupling/MEDCouplingFieldDouble.cxx index d5a15b2d4..d86ec428a 100644 --- a/src/MEDCoupling/MEDCouplingFieldDouble.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.cxx @@ -23,7 +23,7 @@ #include "MEDCouplingUMesh.hxx" #include "MEDCouplingTimeDiscretization.hxx" #include "MEDCouplingFieldDiscretization.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "MEDCouplingNatureOfField.hxx" #include "InterpKernelAutoPtr.hxx" @@ -123,7 +123,7 @@ void MEDCouplingFieldDouble::synchronizeTimeWithSupport() * \c clone(false) is rather dedicated for advanced users that want to limit the amount * of memory. It allows the user to perform methods like operator+(), operator*() * etc. with \a this and the returned field. If the user wants to duplicate deeply the - * underlying mesh he should call cloneWithMesh() method or deepCpy() instead. + * underlying mesh he should call cloneWithMesh() method or deepCopy() instead. * \warning The underlying \b mesh of the returned field is **always the same** * (pointer) as \a this one **whatever the value** of \a recDeepCpy parameter. * \param [in] recDeepCpy - if \c true, the copy of the underlying data arrays is @@ -148,7 +148,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::clone(bool recDeepCpy) const * * This method behaves exactly like clone() except that here the underlying **mesh is * always deeply duplicated**, whatever the value \a recDeepCpy parameter. - * The result of \c cloneWithMesh(true) is exactly the same as that of deepCpy(). + * The result of \c cloneWithMesh(true) is exactly the same as that of deepCopy(). * So the resulting field can not be used together with \a this one in the methods * like operator+(), operator*() etc. To avoid deep copying the underlying mesh, * the user can call clone(). @@ -160,10 +160,10 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::clone(bool recDeepCpy) const */ MEDCouplingFieldDouble *MEDCouplingFieldDouble::cloneWithMesh(bool recDeepCpy) const { - MEDCouplingAutoRefCountObjectPtr ret=clone(recDeepCpy); + MCAuto ret=clone(recDeepCpy); if(_mesh) { - MEDCouplingAutoRefCountObjectPtr mCpy=_mesh->deepCpy(); + MCAuto mCpy=_mesh->deepCopy(); ret->setMesh(mCpy); } return ret.retn(); @@ -180,7 +180,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::cloneWithMesh(bool recDeepCpy) c * caller is to delete this field using decrRef() as it is no more needed. * \sa cloneWithMesh() */ -MEDCouplingFieldDouble *MEDCouplingFieldDouble::deepCpy() const +MEDCouplingFieldDouble *MEDCouplingFieldDouble::deepCopy() const { return cloneWithMesh(true); } @@ -209,10 +209,10 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::deepCpy() const MEDCouplingFieldDouble *MEDCouplingFieldDouble::buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const { MEDCouplingTimeDiscretization *tdo=_time_discr->buildNewTimeReprFromThis(td,deepCopy); - MEDCouplingAutoRefCountObjectPtr disc; + MCAuto disc; if(_type) disc=_type->clone(); - MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(getNature(),tdo,disc.retn()); + MCAuto ret=new MEDCouplingFieldDouble(getNature(),tdo,disc.retn()); ret->setMesh(getMesh()); ret->setName(getName()); ret->setDescription(getDescription()); @@ -227,25 +227,25 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::buildNewTimeReprFromThis(TypeOfT * \return MEDCouplingFieldDouble* - a new instance of MEDCouplingFieldDouble. The * caller is to delete this field using decrRef() as it is no more needed. The returned field will share the same mesh object object than those in \a this. * \throw If \a this spatial discretization is empty or not ON_NODES. - * \throw If \a this is not coherent (see MEDCouplingFieldDouble::checkCoherency). + * \throw If \a this is not coherent (see MEDCouplingFieldDouble::checkConsistencyLight). * * \warning This method is a \b non \b conservative method of remapping from node spatial discretization to cell spatial discretization. * If a conservative method of interpolation is required MEDCoupling::MEDCouplingRemapper class should be used instead with "P1P0" method. */ MEDCouplingFieldDouble *MEDCouplingFieldDouble::nodeToCellDiscretization() const { - checkCoherency(); + checkConsistencyLight(); TypeOfField tf(getTypeOfField()); if(tf!=ON_NODES) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::nodeToCellDiscretization : this field is expected to be on ON_NODES !"); - MEDCouplingAutoRefCountObjectPtr ret(clone(false)); - MEDCouplingAutoRefCountObjectPtr nsp(new MEDCouplingFieldDiscretizationP0); + MCAuto ret(clone(false)); + MCAuto nsp(new MEDCouplingFieldDiscretizationP0); ret->setDiscretization(nsp); - const MEDCouplingMesh *m(getMesh());//m is non empty thanks to checkCoherency call + const MEDCouplingMesh *m(getMesh());//m is non empty thanks to checkConsistencyLight call int nbCells(m->getNumberOfCells()); std::vector arrs(getArrays()); std::size_t sz(arrs.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr > outArrsSafe(sz); std::vector outArrs(sz); + std::vector< MCAuto > outArrsSafe(sz); std::vector outArrs(sz); for(std::size_t j=0;jgetNumberOfComponents()); @@ -283,31 +283,31 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::nodeToCellDiscretization() const * \return MEDCouplingFieldDouble* - a new instance of MEDCouplingFieldDouble. The * caller is to delete this field using decrRef() as it is no more needed. The returned field will share the same mesh object object than those in \a this. * \throw If \a this spatial discretization is empty or not ON_CELLS. - * \throw If \a this is not coherent (see MEDCouplingFieldDouble::checkCoherency). + * \throw If \a this is not coherent (see MEDCouplingFieldDouble::checkConsistencyLight). * * \warning This method is a \b non \b conservative method of remapping from cell spatial discretization to node spatial discretization. * If a conservative method of interpolation is required MEDCoupling::MEDCouplingRemapper class should be used instead with "P0P1" method. */ MEDCouplingFieldDouble *MEDCouplingFieldDouble::cellToNodeDiscretization() const { - checkCoherency(); + checkConsistencyLight(); TypeOfField tf(getTypeOfField()); if(tf!=ON_CELLS) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::cellToNodeDiscretization : this field is expected to be on ON_CELLS !"); - MEDCouplingAutoRefCountObjectPtr ret(clone(false)); - MEDCouplingAutoRefCountObjectPtr nsp(new MEDCouplingFieldDiscretizationP1); + MCAuto ret(clone(false)); + MCAuto nsp(new MEDCouplingFieldDiscretizationP1); ret->setDiscretization(nsp); - const MEDCouplingMesh *m(getMesh());//m is non empty thanks to checkCoherency call - MEDCouplingAutoRefCountObjectPtr rn(DataArrayInt::New()),rni(DataArrayInt::New()); + const MEDCouplingMesh *m(getMesh());//m is non empty thanks to checkConsistencyLight call + MCAuto rn(DataArrayInt::New()),rni(DataArrayInt::New()); m->getReverseNodalConnectivity(rn,rni); - MEDCouplingAutoRefCountObjectPtr rni2(rni->deltaShiftIndex()); - MEDCouplingAutoRefCountObjectPtr rni3(rni2->convertToDblArr()); rni2=0; + MCAuto rni2(rni->deltaShiftIndex()); + MCAuto rni3(rni2->convertToDblArr()); rni2=0; std::vector arrs(getArrays()); std::size_t sz(arrs.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr > outArrsSafe(sz); std::vector outArrs(sz); + std::vector< MCAuto > outArrsSafe(sz); std::vector outArrs(sz); for(std::size_t j=0;j tmp(arrs[j]->selectByTupleIdSafe(rn->begin(),rn->end())); + MCAuto tmp(arrs[j]->selectByTupleIdSafe(rn->begin(),rn->end())); outArrsSafe[j]=(tmp->accumulatePerChunck(rni->begin(),rni->end())); tmp=0; outArrsSafe[j]->divideEqual(rni3); outArrsSafe[j]->copyStringInfoFrom(*arrs[j]); @@ -605,7 +605,7 @@ bool MEDCouplingFieldDouble::areCompatibleForMeld(const MEDCouplingFieldDouble * void MEDCouplingFieldDouble::renumberCells(const int *old2NewBg, bool check) { renumberCellsWithoutMesh(old2NewBg,check); - MEDCouplingAutoRefCountObjectPtr m=_mesh->deepCpy(); + MCAuto m=_mesh->deepCopy(); m->renumberCells(old2NewBg,check); setMesh(m); updateTime(); @@ -673,7 +673,7 @@ void MEDCouplingFieldDouble::renumberNodes(const int *old2NewBg, double eps) if(!meshC) throw INTERP_KERNEL::Exception("Invalid mesh to apply renumberNodes on it !"); int nbOfNodes=meshC->getNumberOfNodes(); - MEDCouplingAutoRefCountObjectPtr meshC2((MEDCouplingPointSet *)meshC->deepCpy()); + MCAuto meshC2((MEDCouplingPointSet *)meshC->deepCopy()); int newNbOfNodes=*std::max_element(old2NewBg,old2NewBg+nbOfNodes)+1; renumberNodesWithoutMesh(old2NewBg,newNbOfNodes,eps); meshC2->renumberNodes(old2NewBg,newNbOfNodes); @@ -715,7 +715,7 @@ void MEDCouplingFieldDouble::renumberNodesWithoutMesh(const int *old2NewBg, int /*! * Returns all tuple ids of \a this scalar field that fit the range [\a vmin, - * \a vmax]. This method calls DataArrayDouble::getIdsInRange(). + * \a vmax]. This method calls DataArrayDouble::findIdsInRange(). * \param [in] vmin - a lower boundary of the range. Tuples with values less than \a * vmin are not included in the result array. * \param [in] vmax - an upper boundary of the range. Tuples with values more than \a @@ -726,11 +726,11 @@ void MEDCouplingFieldDouble::renumberNodesWithoutMesh(const int *old2NewBg, int * \throw If the data array is not set. * \throw If \a this->getNumberOfComponents() != 1. */ -DataArrayInt *MEDCouplingFieldDouble::getIdsInRange(double vmin, double vmax) const +DataArrayInt *MEDCouplingFieldDouble::findIdsInRange(double vmin, double vmax) const { if(getArray()==0) - throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::getIdsInRange : no default array set !"); - return getArray()->getIdsInRange(vmin,vmax); + throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::findIdsInRange : no default array set !"); + return getArray()->findIdsInRange(vmin,vmax); } /*! @@ -773,7 +773,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::buildSubPart(const DataArrayInt /*! * Builds a newly created field, that the caller will have the responsability to deal with. - * \n This method makes the assumption that \a this field is correctly defined when this method is called (\a this->checkCoherency() returns without any exception thrown), **no check of this will be done**. + * \n This method makes the assumption that \a this field is correctly defined when this method is called (\a this->checkConsistencyLight() returns without any exception thrown), **no check of this will be done**. * \n This method returns a restriction of \a this so that only tuple ids specified in [ \a partBg , \a partEnd ) will be contained in the returned field. * \n Parameter [\a partBg, \a partEnd ) specifies **cell ids whatever the spatial discretization** of \a this ( * \ref MEDCoupling::ON_CELLS "ON_CELLS", @@ -809,17 +809,17 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::buildSubPart(const int *partBg, if(!((const MEDCouplingFieldDiscretization *)_type)) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : Expecting a not NULL spatial discretization !"); DataArrayInt *arrSelect; - MEDCouplingAutoRefCountObjectPtr m=_type->buildSubMeshData(_mesh,partBg,partEnd,arrSelect); - MEDCouplingAutoRefCountObjectPtr arrSelect2(arrSelect); - MEDCouplingAutoRefCountObjectPtr ret=clone(false);//quick shallow copy. + MCAuto m=_type->buildSubMeshData(_mesh,partBg,partEnd,arrSelect); + MCAuto arrSelect2(arrSelect); + MCAuto ret=clone(false);//quick shallow copy. const MEDCouplingFieldDiscretization *disc=getDiscretization(); if(disc) - ret->setDiscretization(MEDCouplingAutoRefCountObjectPtr(disc->clonePart(partBg,partEnd))); + ret->setDiscretization(MCAuto(disc->clonePart(partBg,partEnd))); ret->setMesh(m); std::vector arrays; _time_discr->getArrays(arrays); std::vector arrs; - std::vector< MEDCouplingAutoRefCountObjectPtr > arrsSafe; + std::vector< MCAuto > arrsSafe; const int *arrSelBg=arrSelect->begin(); const int *arrSelEnd=arrSelect->end(); for(std::vector::const_iterator iter=arrays.begin();iter!=arrays.end();iter++) @@ -845,17 +845,17 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::buildSubPartRange(int begin, int throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : Expecting a not NULL spatial discretization !"); DataArrayInt *arrSelect; int beginOut,endOut,stepOut; - MEDCouplingAutoRefCountObjectPtr m=_type->buildSubMeshDataRange(_mesh,begin,end,step,beginOut,endOut,stepOut,arrSelect); - MEDCouplingAutoRefCountObjectPtr arrSelect2(arrSelect); - MEDCouplingAutoRefCountObjectPtr ret=clone(false);//quick shallow copy. + MCAuto m=_type->buildSubMeshDataRange(_mesh,begin,end,step,beginOut,endOut,stepOut,arrSelect); + MCAuto arrSelect2(arrSelect); + MCAuto ret=clone(false);//quick shallow copy. const MEDCouplingFieldDiscretization *disc=getDiscretization(); if(disc) - ret->setDiscretization(MEDCouplingAutoRefCountObjectPtr(disc->clonePartRange(begin,end,step))); + ret->setDiscretization(MCAuto(disc->clonePartRange(begin,end,step))); ret->setMesh(m); std::vector arrays; _time_discr->getArrays(arrays); std::vector arrs; - std::vector< MEDCouplingAutoRefCountObjectPtr > arrsSafe; + std::vector< MCAuto > arrsSafe; for(std::vector::const_iterator iter=arrays.begin();iter!=arrays.end();iter++) { DataArrayDouble *arr=0; @@ -868,7 +868,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::buildSubPartRange(int begin, int arr=(*iter)->selectByTupleIdSafe(arrSelBg,arrSelEnd); } else - arr=(*iter)->selectByTupleId2(beginOut,endOut,stepOut); + arr=(*iter)->selectByTupleIdSafeSlice(beginOut,endOut,stepOut); } arrs.push_back(arr); arrsSafe.push_back(arr); } @@ -900,7 +900,7 @@ MEDCouplingFieldDouble::MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& f } MEDCouplingFieldDouble::MEDCouplingFieldDouble(const MEDCouplingFieldDouble& other, bool deepCopy):MEDCouplingField(other,deepCopy), - _time_discr(other._time_discr->performCpy(deepCopy)) + _time_discr(other._time_discr->performCopyOrIncrRef(deepCopy)) { } @@ -922,13 +922,13 @@ MEDCouplingFieldDouble::~MEDCouplingFieldDouble() * \throw If the temporal discretization data is incorrect. * \throw If mesh data does not correspond to field data. */ -void MEDCouplingFieldDouble::checkCoherency() const +void MEDCouplingFieldDouble::checkConsistencyLight() const { if(!_mesh) throw INTERP_KERNEL::Exception("Field invalid because no mesh specified !"); if(!((const MEDCouplingFieldDiscretization *)_type)) - throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::checkCoherency : no spatial discretization !"); - _time_discr->checkCoherency(); + throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::checkConsistencyLight : no spatial discretization !"); + _time_discr->checkConsistencyLight(); _type->checkCoherencyBetween(_mesh,getArray()); } @@ -1006,7 +1006,7 @@ double MEDCouplingFieldDouble::getMaxValue2(DataArrayInt*& tupleIds) const double ret=-std::numeric_limits::max(); bool isExistingArr=false; tupleIds=0; - MEDCouplingAutoRefCountObjectPtr ret1; + MCAuto ret1; for(std::vector::const_iterator iter=arrays.begin();iter!=arrays.end();iter++) { if(*iter) @@ -1014,7 +1014,7 @@ double MEDCouplingFieldDouble::getMaxValue2(DataArrayInt*& tupleIds) const isExistingArr=true; DataArrayInt *tmp; ret=std::max(ret,(*iter)->getMaxValue2(tmp)); - MEDCouplingAutoRefCountObjectPtr tmpSafe(tmp); + MCAuto tmpSafe(tmp); if(!((const DataArrayInt *)ret1)) ret1=tmpSafe; } @@ -1070,7 +1070,7 @@ double MEDCouplingFieldDouble::getMinValue2(DataArrayInt*& tupleIds) const double ret=-std::numeric_limits::max(); bool isExistingArr=false; tupleIds=0; - MEDCouplingAutoRefCountObjectPtr ret1; + MCAuto ret1; for(std::vector::const_iterator iter=arrays.begin();iter!=arrays.end();iter++) { if(*iter) @@ -1078,7 +1078,7 @@ double MEDCouplingFieldDouble::getMinValue2(DataArrayInt*& tupleIds) const isExistingArr=true; DataArrayInt *tmp; ret=std::max(ret,(*iter)->getMinValue2(tmp)); - MEDCouplingAutoRefCountObjectPtr tmpSafe(tmp); + MCAuto tmpSafe(tmp); if(!((const DataArrayInt *)ret1)) ret1=tmpSafe; } @@ -1146,9 +1146,9 @@ void MEDCouplingFieldDouble::getWeightedAverageValue(double *res, bool isWAbs) c { if(getArray()==0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::getWeightedAverageValue : no default array defined !"); - MEDCouplingAutoRefCountObjectPtr w=buildMeasureField(isWAbs); + MCAuto w=buildMeasureField(isWAbs); double deno=w->getArray()->accumulate(0); - MEDCouplingAutoRefCountObjectPtr arr=getArray()->deepCpy(); + MCAuto arr=getArray()->deepCopy(); arr->multiplyEqual(w->getArray()); arr->accumulate(res); int nCompo = getArray()->getNumberOfComponents(); @@ -1506,7 +1506,7 @@ void MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, FunctionToEvaluate f throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::fillFromAnalytic : no mesh defined !"); if(!((const MEDCouplingFieldDiscretization *)_type)) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform fillFromAnalytic !"); - MEDCouplingAutoRefCountObjectPtr loc=_type->getLocalizationOfDiscValues(_mesh); + MCAuto loc=_type->getLocalizationOfDiscValues(_mesh); _time_discr->fillFromAnalytic(loc,nbOfComp,func); } @@ -1553,7 +1553,7 @@ void MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const std::string& f throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::fillFromAnalytic : no mesh defined !"); if(!((const MEDCouplingFieldDiscretization *)_type)) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform fillFromAnalytic !"); - MEDCouplingAutoRefCountObjectPtr loc=_type->getLocalizationOfDiscValues(_mesh); + MCAuto loc=_type->getLocalizationOfDiscValues(_mesh); _time_discr->fillFromAnalytic(loc,nbOfComp,func); } @@ -1596,14 +1596,14 @@ void MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const std::string& f * \ref py_mcfielddouble_fillFromAnalytic2 "Here is a Python example". * \endif */ -void MEDCouplingFieldDouble::fillFromAnalytic2(int nbOfComp, const std::string& func) +void MEDCouplingFieldDouble::fillFromAnalyticCompo(int nbOfComp, const std::string& func) { if(!_mesh) - throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::fillFromAnalytic2 : no mesh defined !"); + throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::fillFromAnalyticCompo : no mesh defined !"); if(!((const MEDCouplingFieldDiscretization *)_type)) - throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform fillFromAnalytic2 !"); - MEDCouplingAutoRefCountObjectPtr loc=_type->getLocalizationOfDiscValues(_mesh); - _time_discr->fillFromAnalytic2(loc,nbOfComp,func); + throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform fillFromAnalyticCompo !"); + MCAuto loc=_type->getLocalizationOfDiscValues(_mesh); + _time_discr->fillFromAnalyticCompo(loc,nbOfComp,func); } /*! @@ -1645,14 +1645,14 @@ void MEDCouplingFieldDouble::fillFromAnalytic2(int nbOfComp, const std::string& * \ref py_mcfielddouble_fillFromAnalytic3 "Here is a Python example". * \endif */ -void MEDCouplingFieldDouble::fillFromAnalytic3(int nbOfComp, const std::vector& varsOrder, const std::string& func) +void MEDCouplingFieldDouble::fillFromAnalyticNamedCompo(int nbOfComp, const std::vector& varsOrder, const std::string& func) { if(!_mesh) - throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::fillFromAnalytic2 : no mesh defined !"); + throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::fillFromAnalyticCompo : no mesh defined !"); if(!((const MEDCouplingFieldDiscretization *)_type)) - throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform fillFromAnalytic3 !"); - MEDCouplingAutoRefCountObjectPtr loc=_type->getLocalizationOfDiscValues(_mesh); - _time_discr->fillFromAnalytic3(loc,nbOfComp,varsOrder,func); + throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform fillFromAnalyticNamedCompo !"); + MCAuto loc=_type->getLocalizationOfDiscValues(_mesh); + _time_discr->fillFromAnalyticNamedCompo(loc,nbOfComp,varsOrder,func); } /*! @@ -1768,9 +1768,9 @@ void MEDCouplingFieldDouble::applyFunc(int nbOfComp, const std::string& func) * \ref py_mcfielddouble_applyFunc2 "Here is a Python example". * \endif */ -void MEDCouplingFieldDouble::applyFunc2(int nbOfComp, const std::string& func) +void MEDCouplingFieldDouble::applyFuncCompo(int nbOfComp, const std::string& func) { - _time_discr->applyFunc2(nbOfComp,func); + _time_discr->applyFuncCompo(nbOfComp,func); } /*! @@ -1807,9 +1807,9 @@ void MEDCouplingFieldDouble::applyFunc2(int nbOfComp, const std::string& func) * \ref py_mcfielddouble_applyFunc3 "Here is a Python example". * \endif */ -void MEDCouplingFieldDouble::applyFunc3(int nbOfComp, const std::vector& varsOrder, const std::string& func) +void MEDCouplingFieldDouble::applyFuncNamedCompo(int nbOfComp, const std::vector& varsOrder, const std::string& func) { - _time_discr->applyFunc3(nbOfComp,varsOrder,func); + _time_discr->applyFuncNamedCompo(nbOfComp,varsOrder,func); } /*! @@ -1893,7 +1893,7 @@ int MEDCouplingFieldDouble::getNumberOfComponents() const * data array (Sorry, it is confusing !). * So \b this \b method \b behaves \b exactly \b as MEDCouplingField::getNumberOfTuplesExpected \b method. * - * \warning No checkCoherency() is done here. + * \warning No checkConsistencyLight() is done here. * For more info on the data arrays, see \ref arrays. * \return int - the number of tuples. * \throw If the mesh is not set. @@ -2189,7 +2189,7 @@ void MEDCouplingFieldDouble::changeUnderlyingMesh(const MEDCouplingMesh *other, throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::changeUnderlyingMesh : is expected to operate on not null meshes !"); DataArrayInt *cellCor=0,*nodeCor=0; other->checkGeoEquivalWith(_mesh,levOfCheck,precOnMesh,cellCor,nodeCor); - MEDCouplingAutoRefCountObjectPtr cellCor2(cellCor),nodeCor2(nodeCor); + MCAuto cellCor2(cellCor),nodeCor2(nodeCor); if(cellCor) renumberCellsWithoutMesh(cellCor->getConstPointer(),false); if(nodeCor) @@ -2208,7 +2208,7 @@ void MEDCouplingFieldDouble::changeUnderlyingMesh(const MEDCouplingMesh *other, * The job of this method consists in calling * \a this->changeUnderlyingMesh() with \a f->getMesh() as the first parameter, and then * \a this -= \a f.
- * This method requires that \a f and \a this are coherent (checkCoherency()) and that \a f + * This method requires that \a f and \a this are coherent (checkConsistencyLight()) and that \a f * and \a this are coherent for a merge.
* "DM" in the method name stands for "different meshes". * \param [in] f - the field to subtract from this. @@ -2234,10 +2234,10 @@ void MEDCouplingFieldDouble::changeUnderlyingMesh(const MEDCouplingMesh *other, */ void MEDCouplingFieldDouble::substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps) { - checkCoherency(); + checkConsistencyLight(); if(!f) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::substractInPlaceDM : input field is NULL !"); - f->checkCoherency(); + f->checkConsistencyLight(); if(!areCompatibleForMerge(f)) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::substractInPlaceDM : Fields are not compatible ; unable to apply mergeFields on them !"); changeUnderlyingMesh(f->getMesh(),levOfCheck,precOnMesh,eps); @@ -2266,10 +2266,10 @@ bool MEDCouplingFieldDouble::mergeNodes(double eps, double epsOnVals) throw INTERP_KERNEL::Exception("Invalid support mesh to apply mergeNodes on it : must be a MEDCouplingPointSet one !"); if(!((const MEDCouplingFieldDiscretization *)_type)) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform mergeNodes !"); - MEDCouplingAutoRefCountObjectPtr meshC2((MEDCouplingPointSet *)meshC->deepCpy()); + MCAuto meshC2((MEDCouplingPointSet *)meshC->deepCopy()); bool ret; int ret2; - MEDCouplingAutoRefCountObjectPtr arr=meshC2->mergeNodes(eps,ret,ret2); + MCAuto arr=meshC2->mergeNodes(eps,ret,ret2); if(!ret)//no nodes have been merged. return ret; std::vector arrays; @@ -2298,17 +2298,17 @@ bool MEDCouplingFieldDouble::mergeNodes(double eps, double epsOnVals) * \throw If the data array is not set. * \throw If field values at merged nodes (if any) deffer more than \a epsOnVals. */ -bool MEDCouplingFieldDouble::mergeNodes2(double eps, double epsOnVals) +bool MEDCouplingFieldDouble::mergeNodesCenter(double eps, double epsOnVals) { const MEDCouplingPointSet *meshC=dynamic_cast(_mesh); if(!meshC) throw INTERP_KERNEL::Exception("Invalid support mesh to apply mergeNodes on it : must be a MEDCouplingPointSet one !"); if(!((const MEDCouplingFieldDiscretization *)_type)) - throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform mergeNodes2 !"); - MEDCouplingAutoRefCountObjectPtr meshC2((MEDCouplingPointSet *)meshC->deepCpy()); + throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform mergeNodesCenter !"); + MCAuto meshC2((MEDCouplingPointSet *)meshC->deepCopy()); bool ret; int ret2; - MEDCouplingAutoRefCountObjectPtr arr=meshC2->mergeNodes2(eps,ret,ret2); + MCAuto arr=meshC2->mergeNodesCenter(eps,ret,ret2); if(!ret)//no nodes have been merged. return ret; std::vector arrays; @@ -2342,9 +2342,9 @@ bool MEDCouplingFieldDouble::zipCoords(double epsOnVals) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::zipCoords : Invalid support mesh to apply zipCoords on it : must be a MEDCouplingPointSet one !"); if(!((const MEDCouplingFieldDiscretization *)_type)) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform zipCoords !"); - MEDCouplingAutoRefCountObjectPtr meshC2((MEDCouplingPointSet *)meshC->deepCpy()); + MCAuto meshC2((MEDCouplingPointSet *)meshC->deepCopy()); int oldNbOfNodes=meshC2->getNumberOfNodes(); - MEDCouplingAutoRefCountObjectPtr arr=meshC2->zipCoordsTraducer(); + MCAuto arr=meshC2->zipCoordsTraducer(); if(meshC2->getNumberOfNodes()!=oldNbOfNodes) { std::vector arrays; @@ -2383,9 +2383,9 @@ bool MEDCouplingFieldDouble::zipConnectivity(int compType, double epsOnVals) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::zipConnectivity : Invalid support mesh to apply zipCoords on it : must be a MEDCouplingPointSet one !"); if(!((const MEDCouplingFieldDiscretization *)_type)) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform zipConnectivity !"); - MEDCouplingAutoRefCountObjectPtr meshC2((MEDCouplingUMesh *)meshC->deepCpy()); + MCAuto meshC2((MEDCouplingUMesh *)meshC->deepCopy()); int oldNbOfCells=meshC2->getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr arr=meshC2->zipConnectivityTraducer(compType); + MCAuto arr=meshC2->zipConnectivityTraducer(compType); if(meshC2->getNumberOfCells()!=oldNbOfCells) { std::vector arrays; @@ -2412,19 +2412,19 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::extractSlice3D(const double *ori throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::extractSlice3D : underlying mesh is null !"); if(getTypeOfField()!=ON_CELLS) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::extractSlice3D : only implemented for fields on cells !"); - const MEDCouplingAutoRefCountObjectPtr umesh(mesh->buildUnstructured()); - MEDCouplingAutoRefCountObjectPtr ret=clone(false); + const MCAuto umesh(mesh->buildUnstructured()); + MCAuto ret=clone(false); ret->setMesh(umesh); DataArrayInt *cellIds=0; - MEDCouplingAutoRefCountObjectPtr mesh2=umesh->buildSlice3D(origin,vec,eps,cellIds); - MEDCouplingAutoRefCountObjectPtr cellIds2=cellIds; + MCAuto mesh2=umesh->buildSlice3D(origin,vec,eps,cellIds); + MCAuto cellIds2=cellIds; ret->setMesh(mesh2); - MEDCouplingAutoRefCountObjectPtr tupleIds=computeTupleIdsToSelectFromCellIds(cellIds->begin(),cellIds->end()); + MCAuto tupleIds=computeTupleIdsToSelectFromCellIds(cellIds->begin(),cellIds->end()); std::vector arrays; _time_discr->getArrays(arrays); int i=0; std::vector newArr(arrays.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr > newArr2(arrays.size()); + std::vector< MCAuto > newArr2(arrays.size()); for(std::vector::const_iterator iter=arrays.begin();iter!=arrays.end();iter++,i++) { if(*iter) @@ -2459,8 +2459,8 @@ bool MEDCouplingFieldDouble::simplexize(int policy) if(!((const MEDCouplingFieldDiscretization *)_type)) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform simplexize !"); int oldNbOfCells=_mesh->getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr meshC2(_mesh->deepCpy()); - MEDCouplingAutoRefCountObjectPtr arr=meshC2->simplexize(policy); + MCAuto meshC2(_mesh->deepCopy()); + MCAuto arr=meshC2->simplexize(policy); int newNbOfCells=meshC2->getNumberOfCells(); if(oldNbOfCells==newNbOfCells) return false; @@ -2490,7 +2490,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::doublyContractedProduct() const throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform doublyContractedProduct !"); MEDCouplingTimeDiscretization *td=_time_discr->doublyContractedProduct(); td->copyTinyAttrFrom(*_time_discr); - MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone()); + MCAuto ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone()); ret->setName("DoublyContractedProduct"); ret->setMesh(getMesh()); return ret.retn(); @@ -2513,7 +2513,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::determinant() const throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform determinant !"); MEDCouplingTimeDiscretization *td=_time_discr->determinant(); td->copyTinyAttrFrom(*_time_discr); - MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone()); + MCAuto ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone()); ret->setName("Determinant"); ret->setMesh(getMesh()); return ret.retn(); @@ -2537,7 +2537,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::eigenValues() const throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform eigenValues !"); MEDCouplingTimeDiscretization *td=_time_discr->eigenValues(); td->copyTinyAttrFrom(*_time_discr); - MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone()); + MCAuto ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone()); ret->setName("EigenValues"); ret->setMesh(getMesh()); return ret.retn(); @@ -2560,7 +2560,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::eigenVectors() const throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform eigenVectors !"); MEDCouplingTimeDiscretization *td=_time_discr->eigenVectors(); td->copyTinyAttrFrom(*_time_discr); - MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone()); + MCAuto ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone()); ret->setName("EigenVectors"); ret->setMesh(getMesh()); return ret.retn(); @@ -2585,7 +2585,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::inverse() const throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform inverse !"); MEDCouplingTimeDiscretization *td=_time_discr->inverse(); td->copyTinyAttrFrom(*_time_discr); - MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone()); + MCAuto ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone()); ret->setName("Inversion"); ret->setMesh(getMesh()); return ret.retn(); @@ -2610,7 +2610,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::trace() const throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform trace !"); MEDCouplingTimeDiscretization *td=_time_discr->trace(); td->copyTinyAttrFrom(*_time_discr); - MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone()); + MCAuto ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone()); ret->setName("Trace"); ret->setMesh(getMesh()); return ret.retn(); @@ -2634,7 +2634,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::deviator() const throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform deviator !"); MEDCouplingTimeDiscretization *td=_time_discr->deviator(); td->copyTinyAttrFrom(*_time_discr); - MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone()); + MCAuto ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone()); ret->setName("Deviator"); ret->setMesh(getMesh()); return ret.retn(); @@ -2656,7 +2656,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::magnitude() const throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform magnitude !"); MEDCouplingTimeDiscretization *td=_time_discr->magnitude(); td->copyTinyAttrFrom(*_time_discr); - MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone()); + MCAuto ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone()); ret->setName("Magnitude"); ret->setMesh(getMesh()); return ret.retn(); @@ -2676,7 +2676,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::maxPerTuple() const throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform maxPerTuple !"); MEDCouplingTimeDiscretization *td=_time_discr->maxPerTuple(); td->copyTinyAttrFrom(*_time_discr); - MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone()); + MCAuto ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone()); std::ostringstream oss; oss << "Max_" << getName(); ret->setName(oss.str()); @@ -2717,7 +2717,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::keepSelectedComponents(const std throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform keepSelectedComponents !"); MEDCouplingTimeDiscretization *td=_time_discr->keepSelectedComponents(compoIds); td->copyTinyAttrFrom(*_time_discr); - MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone()); + MCAuto ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone()); ret->setName(getName()); ret->setMesh(getMesh()); return ret.retn(); @@ -2780,12 +2780,12 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::MergeFields(const MEDCouplingFie throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::MergeFields : no spatial discr of f1 !"); MEDCouplingTimeDiscretization *td=f1->_time_discr->aggregate(f2->_time_discr); td->copyTinyAttrFrom(*f1->_time_discr); - MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone()); + MCAuto ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone()); ret->setName(f1->getName()); ret->setDescription(f1->getDescription()); if(m1) { - MEDCouplingAutoRefCountObjectPtr m=m1->mergeMyselfWith(m2); + MCAuto m=m1->mergeMyselfWith(m2); ret->setMesh(m); } return ret.retn(); @@ -2814,7 +2814,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::MergeFields(const std::vector= 1 !"); - std::vector< MEDCouplingAutoRefCountObjectPtr > ms(a.size()); + std::vector< MCAuto > ms(a.size()); std::vector< const MEDCouplingUMesh *> ms2(a.size()); std::vector< const MEDCouplingTimeDiscretization *> tds(a.size()); std::vector::const_iterator it=a.begin(); @@ -2834,12 +2834,12 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::MergeFields(const std::vectoraggregate(tds); td->copyTinyAttrFrom(*(a[0]->_time_discr)); - MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(a[0]->getNature(),td,a[0]->_type->clone()); + MCAuto ret=new MEDCouplingFieldDouble(a[0]->getNature(),td,a[0]->_type->clone()); ret->setName(a[0]->getName()); ret->setDescription(a[0]->getDescription()); if(ms2[0]) { - MEDCouplingAutoRefCountObjectPtr m=MEDCouplingUMesh::MergeUMeshes(ms2); + MCAuto m=MEDCouplingUMesh::MergeUMeshes(ms2); m->copyTinyInfoFrom(ms2[0]); ret->setMesh(m); } @@ -2867,7 +2867,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::MeldFields(const MEDCouplingFiel throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply MeldFields on them ! Check support mesh, field nature, and spatial and time discretisation."); MEDCouplingTimeDiscretization *td=f1->_time_discr->meld(f2->_time_discr); td->copyTinyAttrFrom(*f1->_time_discr); - MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone()); + MCAuto ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone()); ret->setMesh(f1->getMesh()); return ret.retn(); } @@ -2925,7 +2925,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::CrossProductFields(const MEDCoup throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply CrossProductFields on them! Check support mesh, and spatial and time discretisation."); MEDCouplingTimeDiscretization *td=f1->_time_discr->crossProduct(f2->_time_discr); td->copyTinyAttrFrom(*f1->_time_discr); - MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(NoNature,td,f1->_type->clone()); + MCAuto ret=new MEDCouplingFieldDouble(NoNature,td,f1->_type->clone()); ret->setMesh(f1->getMesh()); return ret.retn(); } @@ -2955,7 +2955,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::MaxFields(const MEDCouplingField throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply MaxFields on them! Check support mesh, field nature, and spatial and time discretisation."); MEDCouplingTimeDiscretization *td=f1->_time_discr->max(f2->_time_discr); td->copyTinyAttrFrom(*f1->_time_discr); - MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone()); + MCAuto ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone()); ret->setMesh(f1->getMesh()); return ret.retn(); } @@ -2985,7 +2985,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::MinFields(const MEDCouplingField throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply MinFields on them! Check support mesh, field nature, and spatial and time discretisation."); MEDCouplingTimeDiscretization *td=f1->_time_discr->min(f2->_time_discr); td->copyTinyAttrFrom(*f1->_time_discr); - MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone()); + MCAuto ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone()); ret->setMesh(f1->getMesh()); return ret.retn(); } @@ -3005,7 +3005,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::negate() const throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform negate !"); MEDCouplingTimeDiscretization *td=_time_discr->negate(); td->copyTinyAttrFrom(*_time_discr); - MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone()); + MCAuto ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone()); ret->setMesh(getMesh()); return ret.retn(); } @@ -3031,7 +3031,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::AddFields(const MEDCouplingField throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply AddFields on them! Check support mesh, field nature, and spatial and time discretisation."); MEDCouplingTimeDiscretization *td=f1->_time_discr->add(f2->_time_discr); td->copyTinyAttrFrom(*f1->_time_discr); - MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone()); + MCAuto ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone()); ret->setMesh(f1->getMesh()); return ret.retn(); } @@ -3075,7 +3075,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::SubstractFields(const MEDCouplin throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply SubstractFields on them! Check support mesh, field nature, and spatial and time discretisation."); MEDCouplingTimeDiscretization *td=f1->_time_discr->substract(f2->_time_discr); td->copyTinyAttrFrom(*f1->_time_discr); - MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone()); + MCAuto ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone()); ret->setMesh(f1->getMesh()); return ret.retn(); } @@ -3126,7 +3126,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::MultiplyFields(const MEDCoupling throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply MultiplyFields on them! Check support mesh, and spatial and time discretisation."); MEDCouplingTimeDiscretization *td=f1->_time_discr->multiply(f2->_time_discr); td->copyTinyAttrFrom(*f1->_time_discr); - MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(NoNature,td,f1->_type->clone()); + MCAuto ret=new MEDCouplingFieldDouble(NoNature,td,f1->_type->clone()); ret->setMesh(f1->getMesh()); return ret.retn(); } @@ -3187,7 +3187,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::DivideFields(const MEDCouplingFi throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply DivideFields on them! Check support mesh, and spatial and time discretisation."); MEDCouplingTimeDiscretization *td=f1->_time_discr->divide(f2->_time_discr); td->copyTinyAttrFrom(*f1->_time_discr); - MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(NoNature,td,f1->_type->clone()); + MCAuto ret=new MEDCouplingFieldDouble(NoNature,td,f1->_type->clone()); ret->setMesh(f1->getMesh()); return ret.retn(); } @@ -3231,7 +3231,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::PowFields(const MEDCouplingField throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply PowFields on them! Check support mesh, and spatial and time discretisation."); MEDCouplingTimeDiscretization *td=f1->_time_discr->pow(f2->_time_discr); td->copyTinyAttrFrom(*f1->_time_discr); - MEDCouplingAutoRefCountObjectPtr ret=new MEDCouplingFieldDouble(NoNature,td,f1->_type->clone()); + MCAuto ret=new MEDCouplingFieldDouble(NoNature,td,f1->_type->clone()); ret->setMesh(f1->getMesh()); return ret.retn(); } @@ -3289,7 +3289,7 @@ std::string MEDCouplingFieldDouble::WriteVTK(const std::string& fileName, const if(!m) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::WriteVTK : Fields are lying on a same mesh but it is empty !"); std::string ret(m->getVTKFileNameOf(fileName)); - MEDCouplingAutoRefCountObjectPtr byteArr; + MCAuto byteArr; if(isBinary) { byteArr=DataArrayByte::New(); byteArr->alloc(0,1); } std::ostringstream coss,noss; diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.hxx b/src/MEDCoupling/MEDCouplingFieldDouble.hxx index 883cab4fc..226c93d5a 100644 --- a/src/MEDCoupling/MEDCouplingFieldDouble.hxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.hxx @@ -55,18 +55,18 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void renumberCellsWithoutMesh(const int *old2NewBg, bool check=true); MEDCOUPLING_EXPORT void renumberNodes(const int *old2NewBg, double eps=1e-15); MEDCOUPLING_EXPORT void renumberNodesWithoutMesh(const int *old2NewBg, int newNbOfNodes, double eps=1e-15); - MEDCOUPLING_EXPORT DataArrayInt *getIdsInRange(double vmin, double vmax) const; + MEDCOUPLING_EXPORT DataArrayInt *findIdsInRange(double vmin, double vmax) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildSubPart(const DataArrayInt *part) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildSubPart(const int *partBg, const int *partEnd) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *deepCpy() const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *deepCopy() const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *clone(bool recDeepCpy) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *nodeToCellDiscretization() const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *cellToNodeDiscretization() const; MEDCOUPLING_EXPORT TypeOfTimeDiscretization getTimeDiscretization() const; - MEDCOUPLING_EXPORT void checkCoherency() const; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; MEDCOUPLING_EXPORT void setNature(NatureOfField nat); MEDCOUPLING_EXPORT void setTimeTolerance(double val) { _time_discr->setTimeTolerance(val); } MEDCOUPLING_EXPORT double getTimeTolerance() const { return _time_discr->getTimeTolerance(); } @@ -119,13 +119,13 @@ namespace MEDCoupling MEDCOUPLING_EXPORT MEDCouplingFieldDouble &operator=(double value); MEDCOUPLING_EXPORT void fillFromAnalytic(int nbOfComp, FunctionToEvaluate func); MEDCOUPLING_EXPORT void fillFromAnalytic(int nbOfComp, const std::string& func); - MEDCOUPLING_EXPORT void fillFromAnalytic2(int nbOfComp, const std::string& func); - MEDCOUPLING_EXPORT void fillFromAnalytic3(int nbOfComp, const std::vector& varsOrder, const std::string& func); + MEDCOUPLING_EXPORT void fillFromAnalyticCompo(int nbOfComp, const std::string& func); + MEDCOUPLING_EXPORT void fillFromAnalyticNamedCompo(int nbOfComp, const std::vector& varsOrder, const std::string& func); MEDCOUPLING_EXPORT void applyFunc(int nbOfComp, FunctionToEvaluate func); MEDCOUPLING_EXPORT void applyFunc(int nbOfComp, double val); MEDCOUPLING_EXPORT void applyFunc(int nbOfComp, const std::string& func); - MEDCOUPLING_EXPORT void applyFunc2(int nbOfComp, const std::string& func); - MEDCOUPLING_EXPORT void applyFunc3(int nbOfComp, const std::vector& varsOrder, const std::string& func); + MEDCOUPLING_EXPORT void applyFuncCompo(int nbOfComp, const std::string& func); + MEDCOUPLING_EXPORT void applyFuncNamedCompo(int nbOfComp, const std::vector& varsOrder, const std::string& func); MEDCOUPLING_EXPORT void applyFunc(const std::string& func); MEDCOUPLING_EXPORT void applyFuncFast32(const std::string& func); MEDCOUPLING_EXPORT void applyFuncFast64(const std::string& func); @@ -147,7 +147,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15); MEDCOUPLING_EXPORT void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15); MEDCOUPLING_EXPORT bool mergeNodes(double eps, double epsOnVals=1e-15); - MEDCOUPLING_EXPORT bool mergeNodes2(double eps, double epsOnVals=1e-15); + MEDCOUPLING_EXPORT bool mergeNodesCenter(double eps, double epsOnVals=1e-15); MEDCOUPLING_EXPORT bool zipCoords(double epsOnVals=1e-15); MEDCOUPLING_EXPORT bool zipConnectivity(int compType, double epsOnVals=1e-15); MEDCOUPLING_EXPORT MEDCouplingFieldDouble *extractSlice3D(const double *origin, const double *vec, double eps) const; diff --git a/src/MEDCoupling/MEDCouplingFieldOverTime.cxx b/src/MEDCoupling/MEDCouplingFieldOverTime.cxx index 7cd277246..e1702406c 100644 --- a/src/MEDCoupling/MEDCouplingFieldOverTime.cxx +++ b/src/MEDCoupling/MEDCouplingFieldOverTime.cxx @@ -32,7 +32,7 @@ MEDCouplingFieldOverTime *MEDCouplingFieldOverTime::New(const std::vector >::const_iterator it=_fs.begin(); + std::vector< MCAuto >::const_iterator it=_fs.begin(); if(_fs.empty()) throw INTERP_KERNEL::Exception("MEDCouplingFieldOverTime::getTimeTolerance : empty set !"); for(;it!=_fs.end();it++) @@ -41,14 +41,14 @@ double MEDCouplingFieldOverTime::getTimeTolerance() const throw INTERP_KERNEL::Exception("MEDCouplingFieldOverTime::getTimeTolerance : only empty fields in this !"); } -void MEDCouplingFieldOverTime::checkCoherency() const +void MEDCouplingFieldOverTime::checkConsistencyLight() const { - MEDCouplingMultiFields::checkCoherency(); - std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fs.begin(); + MEDCouplingMultiFields::checkConsistencyLight(); + std::vector< MCAuto >::const_iterator it=_fs.begin(); for(;it!=_fs.end();it++) if((*it)->getTimeDiscretization()==NO_TIME) { - std::ostringstream oss; oss << "MEDCouplingFieldOverTime::checkCoherency : At rank #" << std::distance(_fs.begin(),it) << " the field has no time !"; + std::ostringstream oss; oss << "MEDCouplingFieldOverTime::checkConsistencyLight : At rank #" << std::distance(_fs.begin(),it) << " the field has no time !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } if(_fs.empty()) @@ -68,7 +68,7 @@ void MEDCouplingFieldOverTime::checkCoherency() const } double curt=(*it)->getStartTime(tt1,tt2); if(curtgetEndTime(tt1,tt2); } } @@ -123,25 +123,25 @@ bool MEDCouplingFieldOverTime::isEqualWithoutConsideringStr(const MEDCouplingMul std::vector MEDCouplingFieldOverTime::getMeshes() const { - checkCoherency(); + checkConsistencyLight(); return MEDCouplingMultiFields::getMeshes(); } std::vector MEDCouplingFieldOverTime::getDifferentMeshes(std::vector& refs) const { - checkCoherency(); + checkConsistencyLight(); return MEDCouplingMultiFields::getDifferentMeshes(refs); } std::vector MEDCouplingFieldOverTime::getArrays() const { - checkCoherency(); + checkConsistencyLight(); return MEDCouplingMultiFields::getArrays(); } std::vector MEDCouplingFieldOverTime::getDifferentArrays(std::vector< std::vector >& refs) const { - checkCoherency(); + checkConsistencyLight(); return MEDCouplingMultiFields::getDifferentArrays(refs); } @@ -157,7 +157,7 @@ MEDCouplingDefinitionTime MEDCouplingFieldOverTime::getDefinitionTimeZone() cons MEDCouplingFieldOverTime::MEDCouplingFieldOverTime(const std::vector& fs):MEDCouplingMultiFields(fs) { - checkCoherency(); + checkConsistencyLight(); } MEDCouplingFieldOverTime::MEDCouplingFieldOverTime() diff --git a/src/MEDCoupling/MEDCouplingFieldOverTime.hxx b/src/MEDCoupling/MEDCouplingFieldOverTime.hxx index 578e181a4..e2b72dfbe 100644 --- a/src/MEDCoupling/MEDCouplingFieldOverTime.hxx +++ b/src/MEDCoupling/MEDCouplingFieldOverTime.hxx @@ -33,7 +33,7 @@ namespace MEDCoupling { public: MEDCOUPLING_EXPORT static MEDCouplingFieldOverTime *New(const std::vector& fs); - MEDCOUPLING_EXPORT void checkCoherency() const; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; MEDCOUPLING_EXPORT double getTimeTolerance() const; MEDCOUPLING_EXPORT std::string simpleRepr() const; MEDCOUPLING_EXPORT bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const; diff --git a/src/MEDCoupling/MEDCouplingFieldTemplate.cxx b/src/MEDCoupling/MEDCouplingFieldTemplate.cxx index 92fc73213..023e6716d 100644 --- a/src/MEDCoupling/MEDCouplingFieldTemplate.cxx +++ b/src/MEDCoupling/MEDCouplingFieldTemplate.cxx @@ -43,17 +43,17 @@ MEDCouplingFieldTemplate *MEDCouplingFieldTemplate::New(TypeOfField type) MEDCouplingFieldTemplate::MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f):MEDCouplingField(f,false) { forceTimeOfThis(f); - checkCoherency(); + checkConsistencyLight(); } MEDCouplingFieldTemplate::MEDCouplingFieldTemplate(TypeOfField type):MEDCouplingField(type) { } -void MEDCouplingFieldTemplate::checkCoherency() const +void MEDCouplingFieldTemplate::checkConsistencyLight() const { if(_mesh==0) - throw INTERP_KERNEL::Exception("MEDCouplingFieldTemplate::checkCoherency : Empty mesh !"); + throw INTERP_KERNEL::Exception("MEDCouplingFieldTemplate::checkConsistencyLight : Empty mesh !"); } std::string MEDCouplingFieldTemplate::simpleRepr() const diff --git a/src/MEDCoupling/MEDCouplingFieldTemplate.hxx b/src/MEDCoupling/MEDCouplingFieldTemplate.hxx index fe6928d1c..20e4cb0f2 100644 --- a/src/MEDCoupling/MEDCouplingFieldTemplate.hxx +++ b/src/MEDCoupling/MEDCouplingFieldTemplate.hxx @@ -43,7 +43,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static MEDCouplingFieldTemplate *New(TypeOfField type); MEDCOUPLING_EXPORT std::string simpleRepr() const; MEDCOUPLING_EXPORT std::string advancedRepr() const; - MEDCOUPLING_EXPORT void checkCoherency() const; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; // MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector& tinyInfo) const; diff --git a/src/MEDCoupling/MEDCouplingGaussLocalization.cxx b/src/MEDCoupling/MEDCouplingGaussLocalization.cxx index 54253dd1d..3a91cc71f 100644 --- a/src/MEDCoupling/MEDCouplingGaussLocalization.cxx +++ b/src/MEDCoupling/MEDCouplingGaussLocalization.cxx @@ -31,7 +31,7 @@ MEDCoupling::MEDCouplingGaussLocalization::MEDCouplingGaussLocalization(INTERP_K const std::vector& gsCoo, const std::vector& w) try:_type(type),_ref_coord(refCoo),_gauss_coord(gsCoo),_weight(w) { - checkCoherency(); + checkConsistencyLight(); } catch(INTERP_KERNEL::Exception& e) { @@ -59,7 +59,7 @@ void MEDCoupling::MEDCouplingGaussLocalization::setType(INTERP_KERNEL::Normalize _type=typ; } -void MEDCoupling::MEDCouplingGaussLocalization::checkCoherency() const +void MEDCoupling::MEDCouplingGaussLocalization::checkConsistencyLight() const { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_type); int nbNodes=cm.getNumberOfNodes(); diff --git a/src/MEDCoupling/MEDCouplingGaussLocalization.hxx b/src/MEDCoupling/MEDCouplingGaussLocalization.hxx index e1ebe3c27..067b3b4df 100644 --- a/src/MEDCoupling/MEDCouplingGaussLocalization.hxx +++ b/src/MEDCoupling/MEDCouplingGaussLocalization.hxx @@ -44,7 +44,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT int getNumberOfPtsInRefCell() const; MEDCOUPLING_EXPORT std::string getStringRepr() const; MEDCOUPLING_EXPORT std::size_t getMemorySize() const; - MEDCOUPLING_EXPORT void checkCoherency() const; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; MEDCOUPLING_EXPORT bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const; MEDCOUPLING_EXPORT void pushTinySerializationIntInfo(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void pushTinySerializationDblInfo(std::vector& tinyInfo) const; diff --git a/src/MEDCoupling/MEDCouplingIMesh.cxx b/src/MEDCoupling/MEDCouplingIMesh.cxx index e1878c9ad..107fbeb21 100644 --- a/src/MEDCoupling/MEDCouplingIMesh.cxx +++ b/src/MEDCoupling/MEDCouplingIMesh.cxx @@ -56,7 +56,7 @@ MEDCouplingIMesh *MEDCouplingIMesh::New() MEDCouplingIMesh *MEDCouplingIMesh::New(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop, const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop) { - MEDCouplingAutoRefCountObjectPtr ret(new MEDCouplingIMesh); + MCAuto ret(new MEDCouplingIMesh); ret->setName(meshName); ret->setSpaceDimension(spaceDim); ret->setNodeStruct(nodeStrctStart,nodeStrctStop); @@ -65,7 +65,7 @@ MEDCouplingIMesh *MEDCouplingIMesh::New(const std::string& meshName, int spaceDi return ret.retn(); } -MEDCouplingIMesh *MEDCouplingIMesh::deepCpy() const +MEDCouplingIMesh *MEDCouplingIMesh::deepCopy() const { return clone(true); } @@ -87,7 +87,7 @@ MEDCouplingIMesh *MEDCouplingIMesh::buildWithGhost(int ghostLev) const { if(ghostLev<0) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::buildWithGhost : the ghostLev must be >= 0 !"); - checkCoherency(); + checkConsistencyLight(); int spaceDim(getSpaceDimension()); double origin[3],dxyz[3]; int structure[3]; @@ -97,7 +97,7 @@ MEDCouplingIMesh *MEDCouplingIMesh::buildWithGhost(int ghostLev) const dxyz[i]=_dxyz[i]; structure[i]=_structure[i]+2*ghostLev; } - MEDCouplingAutoRefCountObjectPtr ret(MEDCouplingIMesh::New(getName(),spaceDim,structure,structure+spaceDim,origin,origin+spaceDim,dxyz,dxyz+spaceDim)); + MCAuto ret(MEDCouplingIMesh::New(getName(),spaceDim,structure,structure+spaceDim,origin,origin+spaceDim,dxyz,dxyz+spaceDim)); ret->copyTinyInfoFrom(this); return ret.retn(); } @@ -170,7 +170,7 @@ std::string MEDCouplingIMesh::getAxisUnit() const */ double MEDCouplingIMesh::getMeasureOfAnyCell() const { - checkCoherency(); + checkConsistencyLight(); int dim(getSpaceDimension()); double ret(1.); for(int i=0;i ret(MEDCouplingCMesh::New()); + checkConsistencyLight(); + MCAuto ret(MEDCouplingCMesh::New()); try { ret->copyTinyInfoFrom(this); } catch(INTERP_KERNEL::Exception& ) { } @@ -196,7 +196,7 @@ MEDCouplingCMesh *MEDCouplingIMesh::convertToCartesian() const std::vector infos(buildInfoOnComponents()); for(int i=0;i arr(DataArrayDouble::New()); arr->alloc(_structure[i],1); arr->setInfoOnComponent(0,infos[i]); + MCAuto arr(DataArrayDouble::New()); arr->alloc(_structure[i],1); arr->setInfoOnComponent(0,infos[i]); arr->iota(); arr->applyLin(_dxyz[i],_origin[i]); ret->setCoordsAt(i,arr); } @@ -213,7 +213,7 @@ void MEDCouplingIMesh::refineWithFactor(const std::vector& factors) { if((int)factors.size()!=_space_dim) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::refineWithFactor : refinement factors must have size equal to spaceDim !"); - checkCoherency(); + checkConsistencyLight(); std::vector structure(_structure,_structure+3); std::vector dxyz(_dxyz,_dxyz+3); for(int i=0;i<_space_dim;i++) @@ -238,11 +238,11 @@ void MEDCouplingIMesh::refineWithFactor(const std::vector& factors) * * \return MEDCouplingIMesh * - A newly created object (to be managed by the caller with decrRef) containing simply one cell. * - * \throw if \a this does not pass the \c checkCoherency test. + * \throw if \a this does not pass the \c checkConsistencyLight test. */ MEDCouplingIMesh *MEDCouplingIMesh::asSingleCell() const { - checkCoherency(); + checkConsistencyLight(); int spaceDim(getSpaceDimension()),nodeSt[3]; double dxyz[3]; for(int i=0;i ret(MEDCouplingIMesh::New(getName(),getSpaceDimension(),nodeSt,nodeSt+spaceDim,_origin,_origin+spaceDim,dxyz,dxyz+spaceDim)); + MCAuto ret(MEDCouplingIMesh::New(getName(),getSpaceDimension(),nodeSt,nodeSt+spaceDim,_origin,_origin+spaceDim,dxyz,dxyz+spaceDim)); ret->copyTinyInfoFrom(this); return ret.retn(); } @@ -933,20 +933,20 @@ void MEDCouplingIMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *ot throw INTERP_KERNEL::Exception("MEDCouplingIMesh::checkDeepEquivalOnSameNodesWith : Meshes are not the same !"); } -void MEDCouplingIMesh::checkCoherency() const +void MEDCouplingIMesh::checkConsistencyLight() const { checkSpaceDimension(); for(int i=0;i<_space_dim;i++) if(_structure[i]<1) { - std::ostringstream oss; oss << "MEDCouplingIMesh::checkCoherency : On axis " << i << "/" << _space_dim << ", number of nodes is equal to " << _structure[i] << " ! must be >=1 !"; + std::ostringstream oss; oss << "MEDCouplingIMesh::checkConsistencyLight : On axis " << i << "/" << _space_dim << ", number of nodes is equal to " << _structure[i] << " ! must be >=1 !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } } -void MEDCouplingIMesh::checkCoherency1(double eps) const +void MEDCouplingIMesh::checkConsistency(double eps) const { - checkCoherency(); + checkConsistencyLight(); } void MEDCouplingIMesh::getNodeGridStructure(int *res) const @@ -964,7 +964,7 @@ std::vector MEDCouplingIMesh::getNodeGridStructure() const MEDCouplingStructuredMesh *MEDCouplingIMesh::buildStructuredSubPart(const std::vector< std::pair >& cellPart) const { - checkCoherency(); + checkConsistencyLight(); int dim(getSpaceDimension()); if(dim!=(int)cellPart.size()) { @@ -973,7 +973,7 @@ MEDCouplingStructuredMesh *MEDCouplingIMesh::buildStructuredSubPart(const std::v } double retOrigin[3]={0.,0.,0.}; int retStruct[3]={0,0,0}; - MEDCouplingAutoRefCountObjectPtr ret(dynamic_cast(deepCpy())); + MCAuto ret(dynamic_cast(deepCopy())); for(int i=0;isetNodeStruct(retStruct,retStruct+dim); ret->setOrigin(retOrigin,retOrigin+dim); - ret->checkCoherency(); + ret->checkConsistencyLight(); return ret.retn(); } @@ -1044,7 +1044,7 @@ std::string MEDCouplingIMesh::advancedRepr() const void MEDCouplingIMesh::getBoundingBox(double *bbox) const { - checkCoherency(); + checkConsistencyLight(); int dim(getSpaceDimension()); for(int idim=0; idim ret(DataArrayDouble::New()); + checkConsistencyLight(); + MCAuto ret(DataArrayDouble::New()); int spaceDim(getSpaceDimension()),nbNodes(getNumberOfNodes()); ret->alloc(nbNodes,spaceDim); double *pt(ret->getPointer()); @@ -1194,10 +1194,10 @@ DataArrayDouble *MEDCouplingIMesh::getCoordinatesAndOwner() const * components. The caller is to delete this array using decrRef() as it is * no more needed. */ -DataArrayDouble *MEDCouplingIMesh::getBarycenterAndOwner() const +DataArrayDouble *MEDCouplingIMesh::computeCellCenterOfMass() const { - checkCoherency(); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayDouble::New()); + checkConsistencyLight(); + MCAuto ret(DataArrayDouble::New()); int spaceDim(getSpaceDimension()),nbCells(getNumberOfCells()),tmp[3],tmp2[3]; ret->alloc(nbCells,spaceDim); double *pt(ret->getPointer()),shiftOrigin[3]; @@ -1216,7 +1216,7 @@ DataArrayDouble *MEDCouplingIMesh::getBarycenterAndOwner() const DataArrayDouble *MEDCouplingIMesh::computeIsoBarycenterOfNodesPerCell() const { - return MEDCouplingIMesh::getBarycenterAndOwner(); + return MEDCouplingIMesh::computeCellCenterOfMass(); } void MEDCouplingIMesh::renumberCells(const int *old2NewBg, bool check) @@ -1275,7 +1275,7 @@ void MEDCouplingIMesh::unserialization(const std::vector& tinyInfoD, con void MEDCouplingIMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const { - checkCoherency(); + checkConsistencyLight(); std::ostringstream extent,origin,spacing; for(int i=0;i<3;i++) { diff --git a/src/MEDCoupling/MEDCouplingIMesh.hxx b/src/MEDCoupling/MEDCouplingIMesh.hxx index cb3d7041f..ea9b35b16 100644 --- a/src/MEDCoupling/MEDCouplingIMesh.hxx +++ b/src/MEDCoupling/MEDCouplingIMesh.hxx @@ -54,7 +54,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, int ghostSize); MEDCOUPLING_EXPORT static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, int ghostSize); // - MEDCOUPLING_EXPORT MEDCouplingIMesh *deepCpy() const; + MEDCOUPLING_EXPORT MEDCouplingIMesh *deepCopy() const; MEDCOUPLING_EXPORT MEDCouplingIMesh *clone(bool recDeepCpy) const; MEDCOUPLING_EXPORT MEDCouplingIMesh *buildWithGhost(int ghostLev) const; MEDCOUPLING_EXPORT void updateTime() const; @@ -68,8 +68,8 @@ namespace MEDCoupling DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const; MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, DataArrayInt *&cellCor) const; - MEDCOUPLING_EXPORT void checkCoherency() const; - MEDCOUPLING_EXPORT void checkCoherency1(double eps=1e-12) const; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; + MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const; MEDCOUPLING_EXPORT int getSpaceDimension() const; MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector& coo) const; MEDCOUPLING_EXPORT std::string simpleRepr() const; @@ -84,7 +84,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void scale(const double *point, double factor); MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const; MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const; - MEDCOUPLING_EXPORT DataArrayDouble *getBarycenterAndOwner() const; + MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const; MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const; MEDCOUPLING_EXPORT void renumberCells(const int *old2NewBg, bool check=true); //some useful methods @@ -101,7 +101,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT std::string getVTKFileExtension() const; private: MEDCouplingIMesh(); - MEDCouplingIMesh(const MEDCouplingIMesh& other, bool deepCpy); + MEDCouplingIMesh(const MEDCouplingIMesh& other, bool deepCopy); ~MEDCouplingIMesh(); void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const; std::string getVTKDataSetType() const; diff --git a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx new file mode 100644 index 000000000..d98a92b81 --- /dev/null +++ b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx @@ -0,0 +1,956 @@ +// 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, 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 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : Anthony Geay (CEA/DEN) + +#include "MEDCouplingMappedExtrudedMesh.hxx" +#include "MEDCouplingUMesh.hxx" +#include "MEDCouplingMemArray.hxx" +#include "MEDCouplingFieldDouble.hxx" +#include "MCAuto.hxx" +#include "CellModel.hxx" + +#include "InterpolationUtils.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace MEDCoupling; + +/*! + * Build an extruded mesh instance from 3D and 2D unstructured mesh lying on the \b same \b coords. + * @param mesh3D 3D unstructured mesh. + * @param mesh2D 2D unstructured mesh lying on the same coordinates than mesh3D. \b Warning mesh2D is \b not \b const + * because the mesh is aggregated and potentially modified by rotate or translate method. + * @param cell2DId Id of cell in mesh2D mesh where the computation of 1D mesh will be done. + */ +MEDCouplingMappedExtrudedMesh *MEDCouplingMappedExtrudedMesh::New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) +{ + return new MEDCouplingMappedExtrudedMesh(mesh3D,mesh2D,cell2DId); +} + +/*! + * This constructor is here only for unserialisation process. + * This constructor is normally completely useless for end user. + */ +MEDCouplingMappedExtrudedMesh *MEDCouplingMappedExtrudedMesh::New() +{ + return new MEDCouplingMappedExtrudedMesh; +} + +MEDCouplingMeshType MEDCouplingMappedExtrudedMesh::getType() const +{ + return EXTRUDED; +} + +std::size_t MEDCouplingMappedExtrudedMesh::getHeapMemorySizeWithoutChildren() const +{ + return MEDCouplingMesh::getHeapMemorySizeWithoutChildren(); +} + +std::vector MEDCouplingMappedExtrudedMesh::getDirectChildrenWithNull() const +{ + std::vector ret; + ret.push_back(_mesh2D); + ret.push_back(_mesh1D); + ret.push_back(_mesh3D_ids); + return ret; +} + +/*! + * This method copyies all tiny strings from other (name and components name). + * @throw if other and this have not same mesh type. + */ +void MEDCouplingMappedExtrudedMesh::copyTinyStringsFrom(const MEDCouplingMesh *other) +{ + const MEDCouplingMappedExtrudedMesh *otherC=dynamic_cast(other); + if(!otherC) + throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::copyTinyStringsFrom : meshes have not same type !"); + MEDCouplingMesh::copyTinyStringsFrom(other); + _mesh2D->copyTinyStringsFrom(otherC->_mesh2D); + _mesh1D->copyTinyStringsFrom(otherC->_mesh1D); +} + +MEDCouplingMappedExtrudedMesh::MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) +try:_mesh2D(const_cast(mesh2D)),_mesh1D(MEDCouplingUMesh::New()),_mesh3D_ids(0),_cell_2D_id(cell2DId) +{ + if(_mesh2D!=0) + _mesh2D->incrRef(); + computeExtrusion(mesh3D); + setName(mesh3D->getName()); +} +catch(INTERP_KERNEL::Exception& e) +{ + if(_mesh2D) + _mesh2D->decrRef(); + if(_mesh1D) + _mesh1D->decrRef(); + if(_mesh3D_ids) + _mesh3D_ids->decrRef(); + throw e; +} + +MEDCouplingMappedExtrudedMesh::MEDCouplingMappedExtrudedMesh():_mesh2D(0),_mesh1D(0),_mesh3D_ids(0),_cell_2D_id(-1) +{ +} + +MEDCouplingMappedExtrudedMesh::MEDCouplingMappedExtrudedMesh(const MEDCouplingMappedExtrudedMesh& other, bool deepCopy):MEDCouplingMesh(other),_cell_2D_id(other._cell_2D_id) +{ + if(deepCopy) + { + _mesh2D=other._mesh2D->clone(true); + _mesh1D=other._mesh1D->clone(true); + _mesh3D_ids=other._mesh3D_ids->deepCopy(); + } + else + { + _mesh2D=other._mesh2D; + if(_mesh2D) + _mesh2D->incrRef(); + _mesh1D=other._mesh1D; + if(_mesh1D) + _mesh1D->incrRef(); + _mesh3D_ids=other._mesh3D_ids; + if(_mesh3D_ids) + _mesh3D_ids->incrRef(); + } +} + +int MEDCouplingMappedExtrudedMesh::getNumberOfCells() const +{ + return _mesh2D->getNumberOfCells()*_mesh1D->getNumberOfCells(); +} + +int MEDCouplingMappedExtrudedMesh::getNumberOfNodes() const +{ + return _mesh2D->getNumberOfNodes(); +} + +int MEDCouplingMappedExtrudedMesh::getSpaceDimension() const +{ + return 3; +} + +int MEDCouplingMappedExtrudedMesh::getMeshDimension() const +{ + return 3; +} + +MEDCouplingMappedExtrudedMesh *MEDCouplingMappedExtrudedMesh::deepCopy() const +{ + return clone(true); +} + +MEDCouplingMappedExtrudedMesh *MEDCouplingMappedExtrudedMesh::clone(bool recDeepCpy) const +{ + return new MEDCouplingMappedExtrudedMesh(*this,recDeepCpy); +} + +bool MEDCouplingMappedExtrudedMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const +{ + if(!other) + throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::isEqualIfNotWhy : input other pointer is null !"); + const MEDCouplingMappedExtrudedMesh *otherC=dynamic_cast(other); + std::ostringstream oss; + if(!otherC) + { + reason="mesh given in input is not castable in MEDCouplingMappedExtrudedMesh !"; + return false; + } + if(!MEDCouplingMesh::isEqualIfNotWhy(other,prec,reason)) + return false; + if(!_mesh2D->isEqualIfNotWhy(otherC->_mesh2D,prec,reason)) + { + reason.insert(0,"Mesh2D unstructured meshes differ : "); + return false; + } + if(!_mesh1D->isEqualIfNotWhy(otherC->_mesh1D,prec,reason)) + { + reason.insert(0,"Mesh1D unstructured meshes differ : "); + return false; + } + if(!_mesh3D_ids->isEqualIfNotWhy(*otherC->_mesh3D_ids,reason)) + { + reason.insert(0,"Mesh3D ids DataArrayInt instances differ : "); + return false; + } + if(_cell_2D_id!=otherC->_cell_2D_id) + { + oss << "Cell 2D id of the two extruded mesh differ : this = " << _cell_2D_id << " other = " << otherC->_cell_2D_id; + reason=oss.str(); + return false; + } + return true; +} + +bool MEDCouplingMappedExtrudedMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const +{ + const MEDCouplingMappedExtrudedMesh *otherC=dynamic_cast(other); + if(!otherC) + return false; + if(!_mesh2D->isEqualWithoutConsideringStr(otherC->_mesh2D,prec)) + return false; + if(!_mesh1D->isEqualWithoutConsideringStr(otherC->_mesh1D,prec)) + return false; + if(!_mesh3D_ids->isEqualWithoutConsideringStr(*otherC->_mesh3D_ids)) + return false; + if(_cell_2D_id!=otherC->_cell_2D_id) + return false; + return true; +} + +void MEDCouplingMappedExtrudedMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec, + DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const +{ + throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::checkDeepEquivalWith : not implemented yet !"); +} + +void MEDCouplingMappedExtrudedMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, + DataArrayInt *&cellCor) const +{ + throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::checkDeepEquivalOnSameNodesWith : not implemented yet !"); +} + +INTERP_KERNEL::NormalizedCellType MEDCouplingMappedExtrudedMesh::getTypeOfCell(int cellId) const +{ + const int *ids=_mesh3D_ids->getConstPointer(); + int nbOf3DCells=_mesh3D_ids->getNumberOfTuples(); + const int *where=std::find(ids,ids+nbOf3DCells,cellId); + if(where==ids+nbOf3DCells) + throw INTERP_KERNEL::Exception("Invalid cellId specified >= getNumberOfCells() !"); + int nbOfCells2D=_mesh2D->getNumberOfCells(); + int locId=((int)std::distance(ids,where))%nbOfCells2D; + INTERP_KERNEL::NormalizedCellType tmp=_mesh2D->getTypeOfCell(locId); + return INTERP_KERNEL::CellModel::GetCellModel(tmp).getExtrudedType(); +} + +std::set MEDCouplingMappedExtrudedMesh::getAllGeoTypes() const +{ + std::set ret2D(_mesh2D->getAllGeoTypes()); + std::set ret; + for(std::set::const_iterator it=ret2D.begin();it!=ret2D.end();it++) + ret.insert(INTERP_KERNEL::CellModel::GetCellModel(*it).getExtrudedType()); + return ret; +} + +DataArrayInt *MEDCouplingMappedExtrudedMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const +{ + const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); + INTERP_KERNEL::NormalizedCellType revExtTyp=cm.getReverseExtrudedType(); + MCAuto ret=DataArrayInt::New(); + if(revExtTyp==INTERP_KERNEL::NORM_ERROR) + { + ret->alloc(0,1); + return ret.retn(); + } + MCAuto tmp=_mesh2D->giveCellsWithType(revExtTyp); + int nbOfLevs=_mesh1D->getNumberOfCells(); + int nbOfCells2D=_mesh2D->getNumberOfCells(); + int nbOfTuples=tmp->getNumberOfTuples(); + ret->alloc(nbOfLevs*nbOfTuples,1); + int *pt=ret->getPointer(); + for(int i=0;ibegin(),tmp->end(),pt,std::bind2nd(std::plus(),i*nbOfCells2D)); + MCAuto ret2=ret->renumberR(_mesh3D_ids->begin()); + ret2->sort(); + return ret2.retn(); +} + +DataArrayInt *MEDCouplingMappedExtrudedMesh::computeNbOfNodesPerCell() const +{ + MCAuto ret2D=_mesh2D->computeNbOfNodesPerCell(); + int nbOfLevs=_mesh1D->getNumberOfCells(); + int nbOfCells2D=_mesh2D->getNumberOfCells(); + MCAuto ret3D=DataArrayInt::New(); ret3D->alloc(nbOfLevs*nbOfCells2D,1); + int *pt=ret3D->getPointer(); + for(int i=0;ibegin(),ret2D->end(),pt); + ret3D->applyLin(2,0,0); + return ret3D->renumberR(_mesh3D_ids->begin()); +} + +DataArrayInt *MEDCouplingMappedExtrudedMesh::computeNbOfFacesPerCell() const +{ + MCAuto ret2D=_mesh2D->computeNbOfNodesPerCell(); + int nbOfLevs=_mesh1D->getNumberOfCells(); + int nbOfCells2D=_mesh2D->getNumberOfCells(); + MCAuto ret3D=DataArrayInt::New(); ret3D->alloc(nbOfLevs*nbOfCells2D,1); + int *pt=ret3D->getPointer(); + for(int i=0;ibegin(),ret2D->end(),pt); + ret3D->applyLin(2,2,0); + return ret3D->renumberR(_mesh3D_ids->begin()); +} + +DataArrayInt *MEDCouplingMappedExtrudedMesh::computeEffectiveNbOfNodesPerCell() const +{ + return computeNbOfNodesPerCell(); +} + +int MEDCouplingMappedExtrudedMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const +{ + int ret=0; + int nbOfCells2D=_mesh2D->getNumberOfCells(); + for(int i=0;igetTypeOfCell(i); + if(INTERP_KERNEL::CellModel::GetCellModel(t).getExtrudedType()==type) + ret++; + } + return ret*_mesh1D->getNumberOfCells(); +} + +void MEDCouplingMappedExtrudedMesh::getNodeIdsOfCell(int cellId, std::vector& conn) const +{ + int nbOfCells2D=_mesh2D->getNumberOfCells(); + int nbOfNodes2D=_mesh2D->getNumberOfNodes(); + int locId=cellId%nbOfCells2D; + int lev=cellId/nbOfCells2D; + std::vector tmp,tmp2; + _mesh2D->getNodeIdsOfCell(locId,tmp); + tmp2=tmp; + std::transform(tmp.begin(),tmp.end(),tmp.begin(),std::bind2nd(std::plus(),nbOfNodes2D*lev)); + std::transform(tmp2.begin(),tmp2.end(),tmp2.begin(),std::bind2nd(std::plus(),nbOfNodes2D*(lev+1))); + conn.insert(conn.end(),tmp.begin(),tmp.end()); + conn.insert(conn.end(),tmp2.begin(),tmp2.end()); +} + +void MEDCouplingMappedExtrudedMesh::getCoordinatesOfNode(int nodeId, std::vector& coo) const +{ + int nbOfNodes2D=_mesh2D->getNumberOfNodes(); + int locId=nodeId%nbOfNodes2D; + int lev=nodeId/nbOfNodes2D; + std::vector tmp,tmp2; + _mesh2D->getCoordinatesOfNode(locId,tmp); + tmp2=tmp; + int spaceDim=_mesh1D->getSpaceDimension(); + const double *z=_mesh1D->getCoords()->getConstPointer(); + std::transform(tmp.begin(),tmp.end(),z+lev*spaceDim,tmp.begin(),std::plus()); + std::transform(tmp2.begin(),tmp2.end(),z+(lev+1)*spaceDim,tmp2.begin(),std::plus()); + coo.insert(coo.end(),tmp.begin(),tmp.end()); + coo.insert(coo.end(),tmp2.begin(),tmp2.end()); +} + +std::string MEDCouplingMappedExtrudedMesh::simpleRepr() const +{ + std::ostringstream ret; + ret << "3D Extruded mesh from a 2D Surf Mesh with name : \"" << getName() << "\"\n"; + ret << "Description of mesh : \"" << getDescription() << "\"\n"; + int tmpp1,tmpp2; + double tt=getTime(tmpp1,tmpp2); + ret << "Time attached to the mesh [unit] : " << tt << " [" << getTimeUnit() << "]\n"; + ret << "Iteration : " << tmpp1 << " Order : " << tmpp2 << "\n"; + ret << "Cell id where 1D mesh has been deduced : " << _cell_2D_id << "\n"; + ret << "Number of cells : " << getNumberOfCells() << "(" << _mesh2D->getNumberOfCells() << "x" << _mesh1D->getNumberOfCells() << ")\n"; + ret << "1D Mesh info : _____________________\n\n\n"; + ret << _mesh1D->simpleRepr(); + ret << "\n\n\n2D Mesh info : _____________________\n\n\n" << _mesh2D->simpleRepr() << "\n\n\n"; + return ret.str(); +} + +std::string MEDCouplingMappedExtrudedMesh::advancedRepr() const +{ + std::ostringstream ret; + ret << "3D Extruded mesh from a 2D Surf Mesh with name : \"" << getName() << "\"\n"; + ret << "Description of mesh : \"" << getDescription() << "\"\n"; + int tmpp1,tmpp2; + double tt=getTime(tmpp1,tmpp2); + ret << "Time attached to the mesh (unit) : " << tt << " (" << getTimeUnit() << ")\n"; + ret << "Iteration : " << tmpp1 << " Order : " << tmpp2 << "\n"; + ret << "Cell id where 1D mesh has been deduced : " << _cell_2D_id << "\n"; + ret << "Number of cells : " << getNumberOfCells() << "(" << _mesh2D->getNumberOfCells() << "x" << _mesh1D->getNumberOfCells() << ")\n"; + ret << "1D Mesh info : _____________________\n\n\n"; + ret << _mesh1D->advancedRepr(); + ret << "\n\n\n2D Mesh info : _____________________\n\n\n" << _mesh2D->advancedRepr() << "\n\n\n"; + ret << "3D cell ids per level :\n"; + return ret.str(); +} + +void MEDCouplingMappedExtrudedMesh::checkConsistencyLight() const +{ +} + +void MEDCouplingMappedExtrudedMesh::checkConsistency(double eps) const +{ + checkConsistencyLight(); +} + +void MEDCouplingMappedExtrudedMesh::getBoundingBox(double *bbox) const +{ + double bbox2D[6]; + _mesh2D->getBoundingBox(bbox2D); + const double *nodes1D=_mesh1D->getCoords()->getConstPointer(); + int nbOfNodes1D=_mesh1D->getNumberOfNodes(); + double bbox1DMin[3],bbox1DMax[3],tmp[3]; + std::fill(bbox1DMin,bbox1DMin+3,std::numeric_limits::max()); + std::fill(bbox1DMax,bbox1DMax+3,-(std::numeric_limits::max())); + for(int i=0;i(std::min)); + std::transform(nodes1D+3*i,nodes1D+3*(i+1),bbox1DMax,bbox1DMax,static_cast(std::max)); + } + std::transform(bbox1DMax,bbox1DMax+3,bbox1DMin,tmp,std::minus()); + int id=(int)std::distance(tmp,std::max_element(tmp,tmp+3)); + bbox[0]=bbox1DMin[0]; bbox[1]=bbox1DMax[0]; + bbox[2]=bbox1DMin[1]; bbox[3]=bbox1DMax[1]; + bbox[4]=bbox1DMin[2]; bbox[5]=bbox1DMax[2]; + bbox[2*id+1]+=tmp[id]; +} + +void MEDCouplingMappedExtrudedMesh::updateTime() const +{ + if(_mesh2D) + { + updateTimeWith(*_mesh2D); + } + if(_mesh1D) + { + updateTimeWith(*_mesh1D); + } +} + +void MEDCouplingMappedExtrudedMesh::renumberCells(const int *old2NewBg, bool check) +{ + throw INTERP_KERNEL::Exception("Functionnality of renumbering cells unavailable for ExtrudedMesh"); +} + +MEDCouplingUMesh *MEDCouplingMappedExtrudedMesh::build3DUnstructuredMesh() const +{ + MEDCouplingUMesh *ret=_mesh2D->buildExtrudedMesh(_mesh1D,0); + const int *renum=_mesh3D_ids->getConstPointer(); + ret->renumberCells(renum,false); + ret->setName(getName()); + return ret; +} + +MEDCouplingUMesh *MEDCouplingMappedExtrudedMesh::buildUnstructured() const +{ + return build3DUnstructuredMesh(); +} + +MEDCouplingFieldDouble *MEDCouplingMappedExtrudedMesh::getMeasureField(bool) const +{ + std::string name="MeasureOfMesh_"; + name+=getName(); + MEDCouplingFieldDouble *ret2D=_mesh2D->getMeasureField(true); + MEDCouplingFieldDouble *ret1D=_mesh1D->getMeasureField(true); + const double *ret2DPtr=ret2D->getArray()->getConstPointer(); + const double *ret1DPtr=ret1D->getArray()->getConstPointer(); + int nbOf2DCells=_mesh2D->getNumberOfCells(); + int nbOf1DCells=_mesh1D->getNumberOfCells(); + int nbOf3DCells=nbOf2DCells*nbOf1DCells; + const int *renum=_mesh3D_ids->getConstPointer(); + MEDCouplingFieldDouble *ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); + ret->setMesh(this); + ret->synchronizeTimeWithMesh(); + DataArrayDouble *da=DataArrayDouble::New(); + da->alloc(nbOf3DCells,1); + double *retPtr=da->getPointer(); + for(int i=0;isetArray(da); + da->decrRef(); + ret->setName(name); + ret2D->decrRef(); + ret1D->decrRef(); + return ret; +} + +MEDCouplingFieldDouble *MEDCouplingMappedExtrudedMesh::getMeasureFieldOnNode(bool isAbs) const +{ + //not implemented yet + return 0; +} + +MEDCouplingFieldDouble *MEDCouplingMappedExtrudedMesh::buildOrthogonalField() const +{ + throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::buildOrthogonalField : This method has no sense for MEDCouplingMappedExtrudedMesh that is 3D !"); +} + +int MEDCouplingMappedExtrudedMesh::getCellContainingPoint(const double *pos, double eps) const +{ + throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::getCellContainingPoint : not implemented yet !"); +} + +MEDCouplingMappedExtrudedMesh::~MEDCouplingMappedExtrudedMesh() +{ + if(_mesh2D) + _mesh2D->decrRef(); + if(_mesh1D) + _mesh1D->decrRef(); + if(_mesh3D_ids) + _mesh3D_ids->decrRef(); +} + +void MEDCouplingMappedExtrudedMesh::computeExtrusion(const MEDCouplingUMesh *mesh3D) +{ + const char errMsg1[]="2D mesh is empty unable to compute extrusion !"; + const char errMsg2[]="Coords between 2D and 3D meshes are not the same ! Try MEDCouplingPointSet::tryToShareSameCoords method"; + const char errMsg3[]="No chance to find extrusion pattern in mesh3D,mesh2D couple because nbCells3D%nbCells2D!=0 !"; + if(_mesh2D==0 || mesh3D==0) + throw INTERP_KERNEL::Exception(errMsg1); + if(_mesh2D->getCoords()!=mesh3D->getCoords()) + throw INTERP_KERNEL::Exception(errMsg2); + if(mesh3D->getNumberOfCells()%_mesh2D->getNumberOfCells()!=0) + throw INTERP_KERNEL::Exception(errMsg3); + if(!_mesh3D_ids) + _mesh3D_ids=DataArrayInt::New(); + if(!_mesh1D) + _mesh1D=MEDCouplingUMesh::New(); + computeExtrusionAlg(mesh3D); +} + +void MEDCouplingMappedExtrudedMesh::build1DExtrusion(int idIn3DDesc, int newId, int nbOf1DLev, MEDCouplingUMesh *subMesh, + const int *desc3D, const int *descIndx3D, + const int *revDesc3D, const int *revDescIndx3D, + bool computeMesh1D) +{ + int nbOf2DCells=_mesh2D->getNumberOfCells(); + int start=revDescIndx3D[idIn3DDesc]; + int end=revDescIndx3D[idIn3DDesc+1]; + if(end-start!=1) + { + std::ostringstream ost; ost << "Invalid bases 2D mesh specified : 2D cell # " << idIn3DDesc; + ost << " shared by more than 1 3D cell !!!"; + throw INTERP_KERNEL::Exception(ost.str().c_str()); + } + int current3DCell=revDesc3D[start]; + int current2DCell=idIn3DDesc; + int *mesh3DIDs=_mesh3D_ids->getPointer(); + mesh3DIDs[newId]=current3DCell; + const int *conn2D=subMesh->getNodalConnectivity()->getConstPointer(); + const int *conn2DIndx=subMesh->getNodalConnectivityIndex()->getConstPointer(); + for(int i=1;i conn(conn2D+conn2DIndx[current2DCell]+1,conn2D+conn2DIndx[current2DCell+1]); + std::sort(conn.begin(),conn.end()); + if(computeMesh1D) + computeBaryCenterOfFace(conn,i-1); + current2DCell=findOppositeFaceOf(current2DCell,current3DCell,conn, + desc3D,descIndx3D,conn2D,conn2DIndx); + start=revDescIndx3D[current2DCell]; + end=revDescIndx3D[current2DCell+1]; + if(end-start!=2) + { + std::ostringstream ost; ost << "Expecting to have 2 3D cells attached to 2D cell " << current2DCell << "!"; + ost << " : Impossible or call tryToShareSameCoords method !"; + throw INTERP_KERNEL::Exception(ost.str().c_str()); + } + if(revDesc3D[start]!=current3DCell) + current3DCell=revDesc3D[start]; + else + current3DCell=revDesc3D[start+1]; + mesh3DIDs[i*nbOf2DCells+newId]=current3DCell; + } + if(computeMesh1D) + { + std::vector conn(conn2D+conn2DIndx[current2DCell]+1,conn2D+conn2DIndx[current2DCell+1]); + std::sort(conn.begin(),conn.end()); + computeBaryCenterOfFace(conn,nbOf1DLev-1); + current2DCell=findOppositeFaceOf(current2DCell,current3DCell,conn, + desc3D,descIndx3D,conn2D,conn2DIndx); + conn.clear(); + conn.insert(conn.end(),conn2D+conn2DIndx[current2DCell]+1,conn2D+conn2DIndx[current2DCell+1]); + std::sort(conn.begin(),conn.end()); + computeBaryCenterOfFace(conn,nbOf1DLev); + } +} + +int MEDCouplingMappedExtrudedMesh::findOppositeFaceOf(int current2DCell, int current3DCell, const std::vector& connSorted, + const int *desc3D, const int *descIndx3D, + const int *conn2D, const int *conn2DIndx) +{ + int start=descIndx3D[current3DCell]; + int end=descIndx3D[current3DCell+1]; + bool found=false; + for(const int *candidate2D=desc3D+start;candidate2D!=desc3D+end && !found;candidate2D++) + { + if(*candidate2D!=current2DCell) + { + std::vector conn2(conn2D+conn2DIndx[*candidate2D]+1,conn2D+conn2DIndx[*candidate2D+1]); + std::sort(conn2.begin(),conn2.end()); + std::list intersect; + std::set_intersection(connSorted.begin(),connSorted.end(),conn2.begin(),conn2.end(), + std::insert_iterator< std::list >(intersect,intersect.begin())); + if(intersect.empty()) + return *candidate2D; + } + } + std::ostringstream ost; ost << "Impossible to find an opposite 2D face of face # " << current2DCell; + ost << " in 3D cell # " << current3DCell << " : Impossible or call tryToShareSameCoords method !"; + throw INTERP_KERNEL::Exception(ost.str().c_str()); +} + +void MEDCouplingMappedExtrudedMesh::computeBaryCenterOfFace(const std::vector& nodalConnec, int lev1DId) +{ + double *zoneToUpdate=_mesh1D->getCoords()->getPointer()+lev1DId*3; + std::fill(zoneToUpdate,zoneToUpdate+3,0.); + const double *coords=_mesh2D->getCoords()->getConstPointer(); + for(std::vector::const_iterator iter=nodalConnec.begin();iter!=nodalConnec.end();iter++) + std::transform(zoneToUpdate,zoneToUpdate+3,coords+3*(*iter),zoneToUpdate,std::plus()); + std::transform(zoneToUpdate,zoneToUpdate+3,zoneToUpdate,std::bind2nd(std::multiplies(),(double)(1./(int)nodalConnec.size()))); +} + +int MEDCouplingMappedExtrudedMesh::FindCorrespCellByNodalConn(const std::vector& nodalConnec, const int *revNodalPtr, const int *revNodalIndxPtr) +{ + std::vector::const_iterator iter=nodalConnec.begin(); + std::set s1(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1]); + iter++; + for(;iter!=nodalConnec.end();iter++) + { + std::set s2(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1]); + std::set s3; + std::set_intersection(s1.begin(),s1.end(),s2.begin(),s2.end(),std::insert_iterator< std::set >(s3,s3.end())); + s1=s3; + } + if(s1.size()==1) + return *(s1.begin()); + std::ostringstream ostr; + ostr << "Cell with nodal connec : "; + std::copy(nodalConnec.begin(),nodalConnec.end(),std::ostream_iterator(ostr," ")); + ostr << " is not part of mesh"; + throw INTERP_KERNEL::Exception(ostr.str().c_str()); +} + +/*! + * This method is callable on 1Dmeshes (meshDim==1 && spaceDim==3) returned by MEDCouplingMappedExtrudedMesh::getMesh1D typically. + * These 1Dmeshes (meshDim==1 && spaceDim==3) have a special semantic because these meshes do not specify a static location but a translation along a path. + * This method checks that 'm1' and 'm2' are compatible, if not an exception is thrown. In case these meshes ('m1' and 'm2') are compatible 2 corresponding meshes + * are created ('m1r' and 'm2r') that can be used for interpolation. + * @param m1 input mesh with meshDim==1 and spaceDim==3 + * @param m2 input mesh with meshDim==1 and spaceDim==3 + * @param eps tolerance acceptable to determine compatibility + * @param m1r output mesh with ref count equal to 1 with meshDim==1 and spaceDim==1 + * @param m2r output mesh with ref count equal to 1 with meshDim==1 and spaceDim==1 + * @param v is the output normalized vector of the common direction of 'm1' and 'm2' + * @throw in case that m1 and m2 are not compatible each other. + */ +void MEDCouplingMappedExtrudedMesh::Project1DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps, + MEDCouplingUMesh *&m1r, MEDCouplingUMesh *&m2r, double *v) +{ + if(m1->getSpaceDimension()!=3 || m1->getSpaceDimension()!=3) + throw INTERP_KERNEL::Exception("Input meshes are expected to have a spaceDim==3 for Projec1D !"); + m1r=m1->clone(true); + m2r=m2->clone(true); + m1r->changeSpaceDimension(1); + m2r->changeSpaceDimension(1); + std::vector c; + std::vector ref,ref2; + m1->getNodeIdsOfCell(0,c); + m1->getCoordinatesOfNode(c[0],ref); + m1->getCoordinatesOfNode(c[1],ref2); + std::transform(ref2.begin(),ref2.end(),ref.begin(),v,std::minus()); + double n=INTERP_KERNEL::norm<3>(v); + std::transform(v,v+3,v,std::bind2nd(std::multiplies(),1/n)); + m1->project1D(&ref[0],v,eps,m1r->getCoords()->getPointer()); + m2->project1D(&ref[0],v,eps,m2r->getCoords()->getPointer()); +} + +void MEDCouplingMappedExtrudedMesh::rotate(const double *center, const double *vector, double angle) +{ + _mesh2D->rotate(center,vector,angle); + _mesh1D->rotate(center,vector,angle); +} + +void MEDCouplingMappedExtrudedMesh::translate(const double *vector) +{ + _mesh2D->translate(vector); + _mesh1D->translate(vector); +} + +void MEDCouplingMappedExtrudedMesh::scale(const double *point, double factor) +{ + _mesh2D->scale(point,factor); + _mesh1D->scale(point,factor); +} + +std::vector MEDCouplingMappedExtrudedMesh::getDistributionOfTypes() const +{ + throw INTERP_KERNEL::Exception("Not implemented yet !"); +} + +DataArrayInt *MEDCouplingMappedExtrudedMesh::checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const +{ + throw INTERP_KERNEL::Exception("Not implemented yet !"); +} + +void MEDCouplingMappedExtrudedMesh::splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType) const +{ + throw INTERP_KERNEL::Exception("Not implemented yet !"); +} + +MEDCouplingMesh *MEDCouplingMappedExtrudedMesh::buildPart(const int *start, const int *end) const +{ + // not implemented yet ! + return 0; +} + +MEDCouplingMesh *MEDCouplingMappedExtrudedMesh::buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const +{ + // not implemented yet ! + return 0; +} + +DataArrayInt *MEDCouplingMappedExtrudedMesh::simplexize(int policy) +{ + throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::simplexize : unavailable for such a type of mesh : Extruded !"); +} + +MEDCouplingMesh *MEDCouplingMappedExtrudedMesh::mergeMyselfWith(const MEDCouplingMesh *other) const +{ + // not implemented yet ! + return 0; +} + +DataArrayDouble *MEDCouplingMappedExtrudedMesh::getCoordinatesAndOwner() const +{ + DataArrayDouble *arr2D=_mesh2D->getCoords(); + DataArrayDouble *arr1D=_mesh1D->getCoords(); + DataArrayDouble *ret=DataArrayDouble::New(); + ret->alloc(getNumberOfNodes(),3); + int nbOf1DLev=_mesh1D->getNumberOfNodes(); + int nbOf2DNodes=_mesh2D->getNumberOfNodes(); + const double *ptSrc=arr2D->getConstPointer(); + double *pt=ret->getPointer(); + std::copy(ptSrc,ptSrc+3*nbOf2DNodes,pt); + for(int i=1;igetConstPointer()+3*i,arr1D->getConstPointer()+3*(i+1),vec); + std::transform(arr1D->getConstPointer()+3*(i-1),arr1D->getConstPointer()+3*i,vec,vec,std::minus()); + for(int j=0;j()); + } + return ret; +} + +DataArrayDouble *MEDCouplingMappedExtrudedMesh::computeCellCenterOfMass() const +{ + throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::computeCellCenterOfMass : not yet implemented !"); +} + +DataArrayDouble *MEDCouplingMappedExtrudedMesh::computeIsoBarycenterOfNodesPerCell() const +{ + throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::computeIsoBarycenterOfNodesPerCell: not yet implemented !"); +} + +void MEDCouplingMappedExtrudedMesh::getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const +{ + MCAuto m(buildUnstructured()); + m->getReverseNodalConnectivity(revNodal,revNodalIndx); +} + +void MEDCouplingMappedExtrudedMesh::computeExtrusionAlg(const MEDCouplingUMesh *mesh3D) +{ + _mesh3D_ids->alloc(mesh3D->getNumberOfCells(),1); + int nbOf1DLev=mesh3D->getNumberOfCells()/_mesh2D->getNumberOfCells(); + _mesh1D->setMeshDimension(1); + _mesh1D->allocateCells(nbOf1DLev); + int tmpConn[2]; + for(int i=0;iinsertNextCell(INTERP_KERNEL::NORM_SEG2,2,tmpConn); + } + _mesh1D->finishInsertingCells(); + DataArrayDouble *myCoords=DataArrayDouble::New(); + myCoords->alloc(nbOf1DLev+1,3); + _mesh1D->setCoords(myCoords); + myCoords->decrRef(); + DataArrayInt *desc,*descIndx,*revDesc,*revDescIndx; + desc=DataArrayInt::New(); descIndx=DataArrayInt::New(); revDesc=DataArrayInt::New(); revDescIndx=DataArrayInt::New(); + MEDCouplingUMesh *subMesh=mesh3D->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); + DataArrayInt *revNodal2D,*revNodalIndx2D; + revNodal2D=DataArrayInt::New(); revNodalIndx2D=DataArrayInt::New(); + subMesh->getReverseNodalConnectivity(revNodal2D,revNodalIndx2D); + const int *nodal2D=_mesh2D->getNodalConnectivity()->getConstPointer(); + const int *nodal2DIndx=_mesh2D->getNodalConnectivityIndex()->getConstPointer(); + const int *revNodal2DPtr=revNodal2D->getConstPointer(); + const int *revNodalIndx2DPtr=revNodalIndx2D->getConstPointer(); + const int *descP=desc->getConstPointer(); + const int *descIndxP=descIndx->getConstPointer(); + const int *revDescP=revDesc->getConstPointer(); + const int *revDescIndxP=revDescIndx->getConstPointer(); + // + int nbOf2DCells=_mesh2D->getNumberOfCells(); + for(int i=0;i nodalConnec(nodal2D+nodal2DIndx[i]+1,nodal2D+nodal2DIndx[i+1]); + try + { + idInSubMesh=FindCorrespCellByNodalConn(nodalConnec,revNodal2DPtr,revNodalIndx2DPtr); + } + catch(INTERP_KERNEL::Exception& e) + { + std::ostringstream ostr; ostr << "mesh2D cell # " << i << " is not part of any cell of 3D mesh !\n"; + ostr << e.what(); + throw INTERP_KERNEL::Exception(ostr.str().c_str()); + } + build1DExtrusion(idInSubMesh,i,nbOf1DLev,subMesh,descP,descIndxP,revDescP,revDescIndxP,i==_cell_2D_id); + } + // + revNodal2D->decrRef(); + revNodalIndx2D->decrRef(); + subMesh->decrRef(); + desc->decrRef(); + descIndx->decrRef(); + revDesc->decrRef(); + revDescIndx->decrRef(); +} + +void MEDCouplingMappedExtrudedMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const +{ + std::vector tinyInfo1; + std::vector ls1; + std::vector ls3; + _mesh2D->getTinySerializationInformation(ls3,tinyInfo1,ls1); + std::vector tinyInfo2; + std::vector ls2; + std::vector ls4; + _mesh1D->getTinySerializationInformation(ls4,tinyInfo2,ls2); + tinyInfo.clear(); littleStrings.clear(); + tinyInfo.insert(tinyInfo.end(),tinyInfo1.begin(),tinyInfo1.end()); + littleStrings.insert(littleStrings.end(),ls1.begin(),ls1.end()); + tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end()); + littleStrings.insert(littleStrings.end(),ls2.begin(),ls2.end()); + tinyInfo.push_back(_cell_2D_id); + tinyInfo.push_back((int)tinyInfo1.size()); + tinyInfo.push_back(_mesh3D_ids->getNbOfElems()); + littleStrings.push_back(getName()); + littleStrings.push_back(getDescription()); +} + +void MEDCouplingMappedExtrudedMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const +{ + std::size_t sz=tinyInfo.size(); + int sz1=tinyInfo[sz-2]; + std::vector ti1(tinyInfo.begin(),tinyInfo.begin()+sz1); + std::vector ti2(tinyInfo.begin()+sz1,tinyInfo.end()-3); + MEDCouplingUMesh *um=MEDCouplingUMesh::New(); + DataArrayInt *a1tmp=DataArrayInt::New(); + DataArrayDouble *a2tmp=DataArrayDouble::New(); + int la1=0,la2=0; + std::vector ls1,ls2; + um->resizeForUnserialization(ti1,a1tmp,a2tmp,ls1); + la1+=a1tmp->getNbOfElems(); la2+=a2tmp->getNbOfElems(); + a1tmp->decrRef(); a2tmp->decrRef(); + a1tmp=DataArrayInt::New(); a2tmp=DataArrayDouble::New(); + um->resizeForUnserialization(ti2,a1tmp,a2tmp,ls2); + la1+=a1tmp->getNbOfElems(); la2+=a2tmp->getNbOfElems(); + a1tmp->decrRef(); a2tmp->decrRef(); + um->decrRef(); + // + a1->alloc(la1+tinyInfo[sz-1],1); + a2->alloc(la2,1); + littleStrings.resize(ls1.size()+ls2.size()+2); +} + +void MEDCouplingMappedExtrudedMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const +{ + a1=DataArrayInt::New(); a2=DataArrayDouble::New(); + DataArrayInt *a1_1=0,*a1_2=0; + DataArrayDouble *a2_1=0,*a2_2=0; + _mesh2D->serialize(a1_1,a2_1); + _mesh1D->serialize(a1_2,a2_2); + a1->alloc(a1_1->getNbOfElems()+a1_2->getNbOfElems()+_mesh3D_ids->getNbOfElems(),1); + int *ptri=a1->getPointer(); + ptri=std::copy(a1_1->getConstPointer(),a1_1->getConstPointer()+a1_1->getNbOfElems(),ptri); + a1_1->decrRef(); + ptri=std::copy(a1_2->getConstPointer(),a1_2->getConstPointer()+a1_2->getNbOfElems(),ptri); + a1_2->decrRef(); + std::copy(_mesh3D_ids->getConstPointer(),_mesh3D_ids->getConstPointer()+_mesh3D_ids->getNbOfElems(),ptri); + a2->alloc(a2_1->getNbOfElems()+a2_2->getNbOfElems(),1); + double *ptrd=a2->getPointer(); + ptrd=std::copy(a2_1->getConstPointer(),a2_1->getConstPointer()+a2_1->getNbOfElems(),ptrd); + a2_1->decrRef(); + std::copy(a2_2->getConstPointer(),a2_2->getConstPointer()+a2_2->getNbOfElems(),ptrd); + a2_2->decrRef(); +} + +void MEDCouplingMappedExtrudedMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings) +{ + setName(littleStrings[littleStrings.size()-2]); + setDescription(littleStrings.back()); + std::size_t sz=tinyInfo.size(); + int sz1=tinyInfo[sz-2]; + _cell_2D_id=tinyInfo[sz-3]; + std::vector ti1(tinyInfo.begin(),tinyInfo.begin()+sz1); + std::vector ti2(tinyInfo.begin()+sz1,tinyInfo.end()-3); + DataArrayInt *a1tmp=DataArrayInt::New(); + DataArrayDouble *a2tmp=DataArrayDouble::New(); + const int *a1Ptr=a1->getConstPointer(); + const double *a2Ptr=a2->getConstPointer(); + _mesh2D=MEDCouplingUMesh::New(); + std::vector ls1,ls2; + _mesh2D->resizeForUnserialization(ti1,a1tmp,a2tmp,ls1); + std::copy(a2Ptr,a2Ptr+a2tmp->getNbOfElems(),a2tmp->getPointer()); + std::copy(a1Ptr,a1Ptr+a1tmp->getNbOfElems(),a1tmp->getPointer()); + a2Ptr+=a2tmp->getNbOfElems(); + a1Ptr+=a1tmp->getNbOfElems(); + ls2.insert(ls2.end(),littleStrings.begin(),littleStrings.begin()+ls1.size()); + std::vector d1(1); + _mesh2D->unserialization(d1,ti1,a1tmp,a2tmp,ls2); + a1tmp->decrRef(); a2tmp->decrRef(); + // + ls2.clear(); + ls2.insert(ls2.end(),littleStrings.begin()+ls1.size(),littleStrings.end()-2); + _mesh1D=MEDCouplingUMesh::New(); + a1tmp=DataArrayInt::New(); a2tmp=DataArrayDouble::New(); + _mesh1D->resizeForUnserialization(ti2,a1tmp,a2tmp,ls1); + std::copy(a2Ptr,a2Ptr+a2tmp->getNbOfElems(),a2tmp->getPointer()); + std::copy(a1Ptr,a1Ptr+a1tmp->getNbOfElems(),a1tmp->getPointer()); + a1Ptr+=a1tmp->getNbOfElems(); + _mesh1D->unserialization(d1,ti2,a1tmp,a2tmp,ls2); + a1tmp->decrRef(); a2tmp->decrRef(); + // + _mesh3D_ids=DataArrayInt::New(); + int szIds=(int)std::distance(a1Ptr,a1->getConstPointer()+a1->getNbOfElems()); + _mesh3D_ids->alloc(szIds,1); + std::copy(a1Ptr,a1Ptr+szIds,_mesh3D_ids->getPointer()); +} + +void MEDCouplingMappedExtrudedMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const +{ + MCAuto m=buildUnstructured(); + m->writeVTKLL(ofs,cellData,pointData,byteData); +} + +void MEDCouplingMappedExtrudedMesh::reprQuickOverview(std::ostream& stream) const +{ + stream << "MEDCouplingMappedExtrudedMesh C++ instance at " << this << ". Name : \"" << getName() << "\"."; +} + +std::string MEDCouplingMappedExtrudedMesh::getVTKFileExtension() const +{ + return _mesh2D->getVTKFileExtension(); +} + +std::string MEDCouplingMappedExtrudedMesh::getVTKDataSetType() const +{ + return _mesh2D->getVTKDataSetType(); +} diff --git a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx new file mode 100644 index 000000000..939f2460d --- /dev/null +++ b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx @@ -0,0 +1,134 @@ +// 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, 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 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : Anthony Geay (CEA/DEN) + +#ifndef __PARAMEDMEM_MEDCOUPLINGEXTRUDEDMESH_HXX__ +#define __PARAMEDMEM_MEDCOUPLINGEXTRUDEDMESH_HXX__ + +#include "MEDCoupling.hxx" +#include "MEDCouplingMesh.hxx" + +#include + +namespace MEDCoupling +{ + class DataArrayInt; + class DataArrayDouble; + class MEDCouplingUMesh; + class MEDCouplingFieldDouble; + + class MEDCouplingMappedExtrudedMesh : public MEDCouplingMesh + { + public: + MEDCOUPLING_EXPORT static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId); + MEDCOUPLING_EXPORT static MEDCouplingMappedExtrudedMesh *New(); + MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const; + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; + MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other); + MEDCOUPLING_EXPORT int getNumberOfCells() const; + MEDCOUPLING_EXPORT int getNumberOfNodes() const; + MEDCOUPLING_EXPORT int getSpaceDimension() const; + MEDCOUPLING_EXPORT int getMeshDimension() const; + MEDCOUPLING_EXPORT MEDCouplingMappedExtrudedMesh *deepCopy() const; + MEDCouplingMappedExtrudedMesh *clone(bool recDeepCpy) const; + MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const; + MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const; + MEDCOUPLING_EXPORT void checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec, + DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const; + MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, + DataArrayInt *&cellCor) const; + MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const; + MEDCOUPLING_EXPORT std::set getAllGeoTypes() const; + MEDCOUPLING_EXPORT DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; + MEDCOUPLING_EXPORT DataArrayInt *computeNbOfNodesPerCell() const; + MEDCOUPLING_EXPORT DataArrayInt *computeNbOfFacesPerCell() const; + MEDCOUPLING_EXPORT DataArrayInt *computeEffectiveNbOfNodesPerCell() const; + MEDCOUPLING_EXPORT int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; + MEDCOUPLING_EXPORT void getNodeIdsOfCell(int cellId, std::vector& conn) const; + MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector& coo) const; + MEDCOUPLING_EXPORT std::string simpleRepr() const; + MEDCOUPLING_EXPORT std::string advancedRepr() const; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; + MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const; + MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const; + MEDCOUPLING_EXPORT void updateTime() const; + MEDCOUPLING_EXPORT void renumberCells(const int *old2NewBg, bool check=true); + MEDCOUPLING_EXPORT MEDCouplingUMesh *getMesh2D() const { return _mesh2D; } + MEDCOUPLING_EXPORT MEDCouplingUMesh *getMesh1D() const { return _mesh1D; } + MEDCOUPLING_EXPORT DataArrayInt *getMesh3DIds() const { return _mesh3D_ids; } + MEDCOUPLING_EXPORT MEDCouplingUMesh *build3DUnstructuredMesh() const; + MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool) const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool) const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const; + MEDCOUPLING_EXPORT int getCellContainingPoint(const double *pos, double eps) const; + MEDCOUPLING_EXPORT static int FindCorrespCellByNodalConn(const std::vector& nodalConnec, + const int *revNodalPtr, const int *revNodalIndxPtr); + MEDCOUPLING_EXPORT static void Project1DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps, + MEDCouplingUMesh *&m1r, MEDCouplingUMesh *&m2r, double *v); + MEDCOUPLING_EXPORT void rotate(const double *center, const double *vector, double angle); + MEDCOUPLING_EXPORT void translate(const double *vector); + MEDCOUPLING_EXPORT void scale(const double *point, double factor); + MEDCOUPLING_EXPORT std::vector getDistributionOfTypes() const; + MEDCOUPLING_EXPORT DataArrayInt *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const; + MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType) const; + MEDCOUPLING_EXPORT MEDCouplingMesh *buildPart(const int *start, const int *end) const; + MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const; + MEDCOUPLING_EXPORT DataArrayInt *simplexize(int policy); + MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const; + MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const; + MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const; + MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const; + MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const; + //Serialization unserialisation + MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const; + MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; + MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, + const std::vector& littleStrings); + MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; + MEDCOUPLING_EXPORT std::string getVTKFileExtension() const; + private: + MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId); + MEDCouplingMappedExtrudedMesh(const MEDCouplingMappedExtrudedMesh& other, bool deepCopy); + MEDCouplingMappedExtrudedMesh(); + void computeExtrusion(const MEDCouplingUMesh *mesh3D); + void computeExtrusionAlg(const MEDCouplingUMesh *mesh3D); + void build1DExtrusion(int idIn3DDesc, int newId, int nbOf1DLev, MEDCouplingUMesh *subMesh, + const int *desc3D, const int *descIndx3D, + const int *revDesc3D, const int *revDescIndx3D, + bool computeMesh1D); + int findOppositeFaceOf(int current2DCell, int current3DCell, const std::vector& connSorted, + const int *desc3D, const int *descIndx3D, + const int *conn2D, const int *conn2DIndx); + void computeBaryCenterOfFace(const std::vector& nodalConnec, int lev1DId); + ~MEDCouplingMappedExtrudedMesh(); + void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const; + std::string getVTKDataSetType() const; + private: + MEDCouplingUMesh *_mesh2D; + MEDCouplingUMesh *_mesh1D; + //! New to old 3D cell Ids Array + DataArrayInt *_mesh3D_ids; + int _cell_2D_id; + }; +} + +#endif diff --git a/src/MEDCoupling/MEDCouplingMatrix.cxx b/src/MEDCoupling/MEDCouplingMatrix.cxx index 6376bddd8..eda2ca1af 100644 --- a/src/MEDCoupling/MEDCouplingMatrix.cxx +++ b/src/MEDCoupling/MEDCouplingMatrix.cxx @@ -34,16 +34,16 @@ DenseMatrix *DenseMatrix::New(DataArrayDouble *array, int nbRows, int nbCols) return new DenseMatrix(array,nbRows,nbCols); } -DenseMatrix *DenseMatrix::deepCpy() const +DenseMatrix *DenseMatrix::deepCopy() const { - MEDCouplingAutoRefCountObjectPtr arr(getData()->deepCpy()); - MEDCouplingAutoRefCountObjectPtr ret(DenseMatrix::New(arr,getNumberOfRows(),getNumberOfCols())); + MCAuto arr(getData()->deepCopy()); + MCAuto ret(DenseMatrix::New(arr,getNumberOfRows(),getNumberOfCols())); return ret.retn(); } DenseMatrix *DenseMatrix::shallowCpy() const { - MEDCouplingAutoRefCountObjectPtr ret(DenseMatrix::New(const_cast(getData()),getNumberOfRows(),getNumberOfCols())); + MCAuto ret(DenseMatrix::New(const_cast(getData()),getNumberOfRows(),getNumberOfCols())); return ret.retn(); } @@ -177,7 +177,7 @@ DataArrayDouble *DenseMatrix::MatVecMult(const DenseMatrix *mat, const DataArray throw INTERP_KERNEL::Exception("DenseMatrix::MatVecMult : input vector must have only one component !"); if(vec->getNumberOfTuples()!=mat->getNumberOfCols()) throw INTERP_KERNEL::Exception("DenseMatrix::MatVecMult : Number of columns of this must be equal to number of tuples of vec !"); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayDouble::New()); ret->alloc(mat->getNumberOfRows(),1); + MCAuto ret(DataArrayDouble::New()); ret->alloc(mat->getNumberOfRows(),1); INTERP_KERNEL::matrixProduct(mat->getData()->begin(),mat->getNumberOfRows(),mat->getNumberOfCols(),vec->begin(),vec->getNumberOfTuples(),1,ret->getPointer()); return ret.retn(); } @@ -187,8 +187,8 @@ DenseMatrix *DenseMatrix::Add(const DenseMatrix *a1, const DenseMatrix *a2) if(!a1 || !a2) throw INTERP_KERNEL::Exception("DenseMatrix::Add : input matrices must be not NULL !"); CheckSameSize(a1,a2); - MEDCouplingAutoRefCountObjectPtr data(DataArrayDouble::Add(a1->getData(),a2->getData())); - MEDCouplingAutoRefCountObjectPtr ret(DenseMatrix::New(data,a1->getNumberOfRows(),a1->getNumberOfCols())); + MCAuto data(DataArrayDouble::Add(a1->getData(),a2->getData())); + MCAuto ret(DenseMatrix::New(data,a1->getNumberOfRows(),a1->getNumberOfCols())); return ret.retn(); } @@ -205,8 +205,8 @@ DenseMatrix *DenseMatrix::Substract(const DenseMatrix *a1, const DenseMatrix *a2 if(!a1 || !a2) throw INTERP_KERNEL::Exception("DenseMatrix::Substract : input matrices must be not NULL !"); CheckSameSize(a1,a2); - MEDCouplingAutoRefCountObjectPtr data(DataArrayDouble::Substract(a1->getData(),a2->getData())); - MEDCouplingAutoRefCountObjectPtr ret(DenseMatrix::New(data,a1->getNumberOfRows(),a1->getNumberOfCols())); + MCAuto data(DataArrayDouble::Substract(a1->getData(),a2->getData())); + MCAuto ret(DenseMatrix::New(data,a1->getNumberOfRows(),a1->getNumberOfCols())); return ret.retn(); } @@ -224,8 +224,8 @@ DenseMatrix *DenseMatrix::Multiply(const DenseMatrix *a1, const DenseMatrix *a2) throw INTERP_KERNEL::Exception("DenseMatrix::Multiply : input matrices must be not NULL !"); CheckCompatibleSizeForMul(a1,a2); int nbr(a1->getNumberOfRows()),nbc(a2->getNumberOfCols()); - MEDCouplingAutoRefCountObjectPtr data(DataArrayDouble::New()); data->alloc(nbr*nbc,1); - MEDCouplingAutoRefCountObjectPtr ret(DenseMatrix::New(data,a1->getNumberOfRows(),a2->getNumberOfCols())); + MCAuto data(DataArrayDouble::New()); data->alloc(nbr*nbc,1); + MCAuto ret(DenseMatrix::New(data,a1->getNumberOfRows(),a2->getNumberOfCols())); INTERP_KERNEL::matrixProduct(a1->getData()->begin(),a1->getNumberOfRows(),a1->getNumberOfCols(),a2->getData()->begin(),a2->getNumberOfRows(),a2->getNumberOfCols(),data->getPointer()); return ret.retn(); } @@ -236,7 +236,7 @@ DenseMatrix *DenseMatrix::Multiply(const DenseMatrix *a1, const DataArrayDouble throw INTERP_KERNEL::Exception("DenseMatrix::Multiply #2 : input matrices must be not NULL and a2 allocated !"); if(a2->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DenseMatrix::Multiply #2 : The 2nd member must have exactly one component !"); - MEDCouplingAutoRefCountObjectPtr a2Bis(DenseMatrix::New(const_cast(a2),a2->getNumberOfTuples(),1)); + MCAuto a2Bis(DenseMatrix::New(const_cast(a2),a2->getNumberOfTuples(),1)); return DenseMatrix::Multiply(a1,a2Bis); } diff --git a/src/MEDCoupling/MEDCouplingMatrix.hxx b/src/MEDCoupling/MEDCouplingMatrix.hxx index 8e98ac43b..80c3f14a8 100644 --- a/src/MEDCoupling/MEDCouplingMatrix.hxx +++ b/src/MEDCoupling/MEDCouplingMatrix.hxx @@ -25,7 +25,7 @@ #include "MEDCouplingTimeLabel.hxx" #include "MEDCouplingRefCountObject.hxx" #include "MEDCouplingMemArray.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "InterpKernelException.hxx" @@ -40,7 +40,7 @@ namespace MEDCoupling public: MEDCOUPLING_EXPORT static DenseMatrix *New(int nbRows, int nbCols); MEDCOUPLING_EXPORT static DenseMatrix *New(DataArrayDouble *array, int nbRows, int nbCols); - MEDCOUPLING_EXPORT DenseMatrix *deepCpy() const; + MEDCOUPLING_EXPORT DenseMatrix *deepCopy() const; MEDCOUPLING_EXPORT DenseMatrix *shallowCpy() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; @@ -79,7 +79,7 @@ namespace MEDCoupling private: int _nb_rows; int _nb_cols; - MEDCouplingAutoRefCountObjectPtr _data; + MCAuto _data; }; } diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx index c60f89d9a..75979d5eb 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -19,7 +19,7 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDCouplingMemArray.txx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "BBTree.txx" #include "GenMathFormulae.hxx" @@ -434,7 +434,7 @@ std::string DataArray::BuildInfoFromVarAndUnit(const std::string& var, const std return oss.str(); } -std::string DataArray::GetAxTypeRepr(MEDCouplingAxisType at) +std::string DataArray::GetAxisTypeRepr(MEDCouplingAxisType at) { switch(at) { @@ -445,7 +445,7 @@ std::string DataArray::GetAxTypeRepr(MEDCouplingAxisType at) case AX_SPHER: return std::string("AX_SPHER"); default: - throw INTERP_KERNEL::Exception("DataArray::GetAxTypeRepr : unrecognized axis type enum !"); + throw INTERP_KERNEL::Exception("DataArray::GetAxisTypeRepr : unrecognized axis type enum !"); } } @@ -825,7 +825,7 @@ bool DataArrayDouble::empty() const * \return DataArrayDouble * - a new instance of DataArrayDouble. The caller is to * delete this array using decrRef() as it is no more needed. */ -DataArrayDouble *DataArrayDouble::deepCpy() const +DataArrayDouble *DataArrayDouble::deepCopy() const { return new DataArrayDouble(*this); } @@ -837,10 +837,10 @@ DataArrayDouble *DataArrayDouble::deepCpy() const * \return DataArrayDouble * - either a new instance of DataArrayDouble (if \a dCpy * == \a true) or \a this instance (if \a dCpy == \a false). */ -DataArrayDouble *DataArrayDouble::performCpy(bool dCpy) const +DataArrayDouble *DataArrayDouble::performCopyOrIncrRef(bool dCpy) const { if(dCpy) - return deepCpy(); + return deepCopy(); else { incrRef(); @@ -854,7 +854,7 @@ DataArrayDouble *DataArrayDouble::performCpy(bool dCpy) const * \param [in] other - another instance of DataArrayDouble to copy data from. * \throw If the \a other is not allocated. */ -void DataArrayDouble::cpyFrom(const DataArrayDouble& other) +void DataArrayDouble::deepCopyFrom(const DataArrayDouble& other) { other.checkAllocated(); int nbOfTuples=other.getNumberOfTuples(); @@ -1541,7 +1541,7 @@ DataArrayDouble *DataArrayDouble::renumber(const int *old2New) const checkAllocated(); int nbTuples=getNumberOfTuples(); int nbOfCompo=getNumberOfComponents(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); ret->alloc(nbTuples,nbOfCompo); ret->copyStringInfoFrom(*this); const double *iptr=getConstPointer(); @@ -1568,7 +1568,7 @@ DataArrayDouble *DataArrayDouble::renumberR(const int *new2Old) const checkAllocated(); int nbTuples=getNumberOfTuples(); int nbOfCompo=getNumberOfComponents(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); ret->alloc(nbTuples,nbOfCompo); ret->copyStringInfoFrom(*this); const double *iptr=getConstPointer(); @@ -1597,7 +1597,7 @@ DataArrayDouble *DataArrayDouble::renumberAndReduce(const int *old2New, int newN checkAllocated(); int nbTuples=getNumberOfTuples(); int nbOfCompo=getNumberOfComponents(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); ret->alloc(newNbOfTuple,nbOfCompo); const double *iptr=getConstPointer(); double *optr=ret->getPointer(); @@ -1630,7 +1630,7 @@ DataArrayDouble *DataArrayDouble::renumberAndReduce(const int *old2New, int newN DataArrayDouble *DataArrayDouble::selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const { checkAllocated(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); int nbComp=getNumberOfComponents(); ret->alloc((int)std::distance(new2OldBg,new2OldEnd),nbComp); ret->copyStringInfoFrom(*this); @@ -1670,7 +1670,7 @@ DataArrayDouble *DataArrayDouble::selectByTupleId(const DataArrayInt & di) const DataArrayDouble *DataArrayDouble::selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const { checkAllocated(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); int nbComp=getNumberOfComponents(); int oldNbOfTuples=getNumberOfTuples(); ret->alloc((int)std::distance(new2OldBg,new2OldEnd),nbComp); @@ -1702,12 +1702,12 @@ DataArrayDouble *DataArrayDouble::selectByTupleIdSafe(const int *new2OldBg, cons * is to delete using decrRef() as it is no more needed. * \sa DataArrayDouble::substr. */ -DataArrayDouble *DataArrayDouble::selectByTupleId2(int bg, int end2, int step) const +DataArrayDouble *DataArrayDouble::selectByTupleIdSafeSlice(int bg, int end2, int step) const { checkAllocated(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); int nbComp=getNumberOfComponents(); - int newNbOfTuples=GetNumberOfItemGivenBESRelative(bg,end2,step,"DataArrayDouble::selectByTupleId2 : "); + int newNbOfTuples=GetNumberOfItemGivenBESRelative(bg,end2,step,"DataArrayDouble::selectByTupleIdSafeSlice : "); ret->alloc(newNbOfTuples,nbComp); double *pt=ret->getPointer(); const double *srcPt=getConstPointer()+bg*nbComp; @@ -1770,8 +1770,8 @@ DataArray *DataArrayDouble::selectByTupleRanges(const std::vector ret=DataArrayDouble::New(); + return deepCopy(); + MCAuto ret=DataArrayDouble::New(); ret->alloc(nbOfTuples,nbOfComp); ret->copyStringInfoFrom(*this); const double *src=getConstPointer(); @@ -1785,7 +1785,7 @@ DataArray *DataArrayDouble::selectByTupleRanges(const std::vector \a this->getNumberOfTuples(). \throw If \a tupleIdEnd != -1 && \a tupleIdEnd < \a this->getNumberOfTuples(). - * \sa DataArrayDouble::selectByTupleId2 + * \sa DataArrayDouble::selectByTupleIdSafeSlice */ DataArrayDouble *DataArrayDouble::substr(int tupleIdBg, int tupleIdEnd) const { @@ -1813,7 +1813,7 @@ DataArrayDouble *DataArrayDouble::substr(int tupleIdBg, int tupleIdEnd) const else trueEnd=nbt; int nbComp=getNumberOfComponents(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); ret->alloc(trueEnd-tupleIdBg,nbComp); ret->copyStringInfoFrom(*this); std::copy(getConstPointer()+tupleIdBg*nbComp,getConstPointer()+trueEnd*nbComp,ret->getPointer()); @@ -1836,7 +1836,7 @@ DataArrayDouble *DataArrayDouble::substr(int tupleIdBg, int tupleIdEnd) const DataArrayDouble *DataArrayDouble::changeNbOfComponents(int newNbOfComp, double dftValue) const { checkAllocated(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); ret->alloc(getNumberOfTuples(),newNbOfComp); const double *oldc=getConstPointer(); double *nc=ret->getPointer(); @@ -1921,7 +1921,7 @@ void DataArrayDouble::transpose() DataArrayDouble *DataArrayDouble::keepSelectedComponents(const std::vector& compoIds) const { checkAllocated(); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayDouble::New()); + MCAuto ret(DataArrayDouble::New()); std::size_t newNbOfCompo=compoIds.size(); int oldNbOfCompo=getNumberOfComponents(); for(std::vector::const_iterator it=compoIds.begin();it!=compoIds.end();it++) @@ -1996,13 +1996,13 @@ bool DataArrayDouble::areIncludedInMe(const DataArrayDouble *other, double prec, checkAllocated(); other->checkAllocated(); if(getNumberOfComponents()!=other->getNumberOfComponents()) throw INTERP_KERNEL::Exception("DataArrayDouble::areIncludedInMe : the number of components does not match !"); - MEDCouplingAutoRefCountObjectPtr a=DataArrayDouble::Aggregate(this,other); + MCAuto a=DataArrayDouble::Aggregate(this,other); DataArrayInt *c=0,*ci=0; a->findCommonTuples(prec,getNumberOfTuples(),c,ci); - MEDCouplingAutoRefCountObjectPtr cSafe(c),ciSafe(ci); + MCAuto cSafe(c),ciSafe(ci); int newNbOfTuples=-1; - MEDCouplingAutoRefCountObjectPtr ids=DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(a->getNumberOfTuples(),c->begin(),ci->begin(),ci->end(),newNbOfTuples); - MEDCouplingAutoRefCountObjectPtr ret1=ids->selectByTupleId2(getNumberOfTuples(),a->getNumberOfTuples(),1); + MCAuto ids=DataArrayInt::ConvertIndexArrayToO2N(a->getNumberOfTuples(),c->begin(),ci->begin(),ci->end(),newNbOfTuples); + MCAuto ret1=ids->selectByTupleIdSafeSlice(getNumberOfTuples(),a->getNumberOfTuples(),1); tupleIds=ret1.retn(); return newNbOfTuples==getNumberOfTuples(); } @@ -2038,7 +2038,7 @@ bool DataArrayDouble::areIncludedInMe(const DataArrayDouble *other, double prec, * * \ref py_mcdataarraydouble_findcommontuples "Here is a Python example". * \endif - * \sa DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(), DataArrayDouble::areIncludedInMe + * \sa DataArrayInt::ConvertIndexArrayToO2N(), DataArrayDouble::areIncludedInMe */ void DataArrayDouble::findCommonTuples(double prec, int limitTupleId, DataArrayInt *&comm, DataArrayInt *&commIndex) const { @@ -2049,7 +2049,7 @@ void DataArrayDouble::findCommonTuples(double prec, int limitTupleId, DataArrayI int nbOfTuples=getNumberOfTuples(); // - MEDCouplingAutoRefCountObjectPtr c(DataArrayInt::New()),cI(DataArrayInt::New()); c->alloc(0,1); cI->pushBackSilent(0); + MCAuto c(DataArrayInt::New()),cI(DataArrayInt::New()); c->alloc(0,1); cI->pushBackSilent(0); switch(nbOfCompo) { case 4: @@ -2087,7 +2087,7 @@ DataArrayDouble *DataArrayDouble::duplicateEachTupleNTimes(int nbTimes) const throw INTERP_KERNEL::Exception("DataArrayDouble::duplicateEachTupleNTimes : nb times should be >= 1 !"); int nbTuples=getNumberOfTuples(); const double *inPtr=getConstPointer(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); ret->alloc(nbTimes*nbTuples,1); + MCAuto ret=DataArrayDouble::New(); ret->alloc(nbTimes*nbTuples,1); double *retPtr=ret->getPointer(); for(int i=0;i part1=findClosestTupleId(other); + MCAuto part1=findClosestTupleId(other); int nbOfCompo(getNumberOfComponents()); int otherNbTuples(other->getNumberOfTuples()); const double *thisPt(begin()),*otherPt(other->begin()); @@ -2150,7 +2150,7 @@ DataArrayInt *DataArrayDouble::findClosestTupleId(const DataArrayDouble *other) } int nbOfTuples=other->getNumberOfTuples(); int thisNbOfTuples=getNumberOfTuples(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); ret->alloc(nbOfTuples,1); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuples,1); double bounds[6]; getMinMaxPerComponent(bounds); switch(nbOfCompo) @@ -2215,7 +2215,7 @@ DataArrayInt *DataArrayDouble::computeNbOfInteractionsWith(const DataArrayDouble std::ostringstream oss; oss << "DataArrayDouble::computeNbOfInteractionsWith : Number of components (" << nbOfComp << ") is not even ! It should be to be compatible with bbox format !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); ret->alloc(nbOfTuples,1); + MCAuto ret(DataArrayInt::New()); ret->alloc(nbOfTuples,1); const double *thisBBPtr(begin()); int *retPtr(ret->getPointer()); switch(nbOfComp/2) @@ -2273,9 +2273,9 @@ DataArrayDouble *DataArrayDouble::getDifferentValues(double prec, int limitTuple checkAllocated(); DataArrayInt *c0=0,*cI0=0; findCommonTuples(prec,limitTupleId,c0,cI0); - MEDCouplingAutoRefCountObjectPtr c(c0),cI(cI0); + MCAuto c(c0),cI(cI0); int newNbOfTuples=-1; - MEDCouplingAutoRefCountObjectPtr o2n=DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(getNumberOfTuples(),c0->begin(),cI0->begin(),cI0->end(),newNbOfTuples); + MCAuto o2n=DataArrayInt::ConvertIndexArrayToO2N(getNumberOfTuples(),c0->begin(),cI0->begin(),cI0->end(),newNbOfTuples); return renumberAndReduce(o2n->getConstPointer(),newNbOfTuples); } @@ -2931,27 +2931,27 @@ void DataArrayDouble::setContigPartOfSelectedValues(int tupleIdStart, const Data * non-empty range of increasing indices or indices are out of a valid range * for the array \a aBase. */ -void DataArrayDouble::setContigPartOfSelectedValues2(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step) +void DataArrayDouble::setContigPartOfSelectedValuesSlice(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step) { if(!aBase) - throw INTERP_KERNEL::Exception("DataArrayDouble::setContigPartOfSelectedValues2 : input DataArray is NULL !"); + throw INTERP_KERNEL::Exception("DataArrayDouble::setContigPartOfSelectedValuesSlice : input DataArray is NULL !"); const DataArrayDouble *a=dynamic_cast(aBase); if(!a) - throw INTERP_KERNEL::Exception("DataArrayDouble::setContigPartOfSelectedValues2 : input DataArray aBase is not a DataArrayDouble !"); + throw INTERP_KERNEL::Exception("DataArrayDouble::setContigPartOfSelectedValuesSlice : input DataArray aBase is not a DataArrayDouble !"); checkAllocated(); a->checkAllocated(); int nbOfComp=getNumberOfComponents(); - const char msg[]="DataArrayDouble::setContigPartOfSelectedValues2"; + const char msg[]="DataArrayDouble::setContigPartOfSelectedValuesSlice"; int nbOfTupleToWrite=DataArray::GetNumberOfItemGivenBES(bg,end2,step,msg); if(nbOfComp!=a->getNumberOfComponents()) - throw INTERP_KERNEL::Exception("DataArrayDouble::setContigPartOfSelectedValues2 : This and a do not have the same number of components !"); + throw INTERP_KERNEL::Exception("DataArrayDouble::setContigPartOfSelectedValuesSlice : This and a do not have the same number of components !"); int thisNt=getNumberOfTuples(); int aNt=a->getNumberOfTuples(); double *valsToSet=getPointer()+tupleIdStart*nbOfComp; if(tupleIdStart+nbOfTupleToWrite>thisNt) - throw INTERP_KERNEL::Exception("DataArrayDouble::setContigPartOfSelectedValues2 : invalid number range of values to write !"); + throw INTERP_KERNEL::Exception("DataArrayDouble::setContigPartOfSelectedValuesSlice : invalid number range of values to write !"); if(end2>aNt) - throw INTERP_KERNEL::Exception("DataArrayDouble::setContigPartOfSelectedValues2 : invalid range of values to read !"); + throw INTERP_KERNEL::Exception("DataArrayDouble::setContigPartOfSelectedValuesSlice : invalid range of values to read !"); const double *valsSrc=a->getConstPointer()+bg*nbOfComp; for(int i=0;i bbox=DataArrayDouble::New(); + MCAuto bbox=DataArrayDouble::New(); bbox->alloc(nbTuples,2*nbOfCompo); double *bboxPtr=bbox->getPointer(); for(int i=0;igetNumberOfTuples(); - MEDCouplingAutoRefCountObjectPtr cArr(DataArrayInt::New()),cIArr(DataArrayInt::New()); cArr->alloc(0,1); cIArr->pushBackSilent(0); + MCAuto cArr(DataArrayInt::New()),cIArr(DataArrayInt::New()); cArr->alloc(0,1); cIArr->pushBackSilent(0); switch(nbOfCompo) { case 3: @@ -3270,7 +3270,7 @@ double DataArrayDouble::getMaxValue2(DataArrayInt*& tupleIds) const int tmp; tupleIds=0; double ret=getMaxValue(tmp); - tupleIds=getIdsInRange(ret,ret); + tupleIds=findIdsInRange(ret,ret); return ret; } @@ -3322,7 +3322,7 @@ double DataArrayDouble::getMinValue2(DataArrayInt*& tupleIds) const int tmp; tupleIds=0; double ret=getMinValue(tmp); - tupleIds=getIdsInRange(ret,ret); + tupleIds=findIdsInRange(ret,ret); return ret; } @@ -3537,7 +3537,7 @@ DataArrayDouble *DataArrayDouble::accumulatePerChunck(const int *bgOfIndex, cons if(sz<1) throw INTERP_KERNEL::Exception("DataArrayDouble::accumulatePerChunck : invalid size of input index array !"); sz--; - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); ret->alloc(sz,nbCompo); + MCAuto ret=DataArrayDouble::New(); ret->alloc(sz,nbCompo); const int *w=bgOfIndex; if(*w<0 || *w>=nbOfTuples) throw INTERP_KERNEL::Exception("DataArrayDouble::accumulatePerChunck : The first element of the input index not in [0,nbOfTuples) !"); @@ -3673,11 +3673,11 @@ DataArrayDouble *DataArrayDouble::cartesianize(MEDCouplingAxisType atOfThis) con { checkAllocated(); int nbOfComp(getNumberOfComponents()); - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; switch(atOfThis) { case AX_CART: - ret=deepCpy(); + ret=deepCopy(); case AX_CYL: if(nbOfComp==3) { @@ -3998,7 +3998,7 @@ DataArrayDouble *DataArrayDouble::sumPerTuple() const { checkAllocated(); int nbOfComp(getNumberOfComponents()),nbOfTuple(getNumberOfTuples()); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayDouble::New()); + MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfTuple,1); const double *src(getConstPointer()); double *dest(ret->getPointer()); @@ -4020,7 +4020,7 @@ DataArrayDouble *DataArrayDouble::maxPerTuple() const { checkAllocated(); int nbOfComp=getNumberOfComponents(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); int nbOfTuple=getNumberOfTuples(); ret->alloc(nbOfTuple,1); const double *src=getConstPointer(); @@ -4047,8 +4047,8 @@ DataArrayDouble *DataArrayDouble::maxPerTupleWithCompoId(DataArrayInt* &compoIdO { checkAllocated(); int nbOfComp=getNumberOfComponents(); - MEDCouplingAutoRefCountObjectPtr ret0=DataArrayDouble::New(); - MEDCouplingAutoRefCountObjectPtr ret1=DataArrayInt::New(); + MCAuto ret0=DataArrayDouble::New(); + MCAuto ret1=DataArrayInt::New(); int nbOfTuple=getNumberOfTuples(); ret0->alloc(nbOfTuple,1); ret1->alloc(nbOfTuple,1); const double *src=getConstPointer(); @@ -4083,7 +4083,7 @@ DataArrayDouble *DataArrayDouble::buildEuclidianDistanceDenseMatrix() const int nbOfComp=getNumberOfComponents(); int nbOfTuples=getNumberOfTuples(); const double *inData=getConstPointer(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); ret->alloc(nbOfTuples*nbOfTuples,1); double *outData=ret->getPointer(); for(int i=0;igetNumberOfTuples(); const double *inData=getConstPointer(); const double *inDataOther=other->getConstPointer(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); ret->alloc(otherNbOfTuples*nbOfTuples,1); double *outData=ret->getPointer(); for(int i=0;i vars; expr.getTrueSetOfVars(vars); std::vector varsV(vars.begin(),vars.end()); - return applyFunc3(nbOfComp,varsV,func,isSafe); + return applyFuncNamedCompo(nbOfComp,varsV,func,isSafe); } /*! @@ -4457,7 +4457,7 @@ DataArrayDouble *DataArrayDouble::applyFunc(const std::string& func, bool isSafe throw INTERP_KERNEL::Exception("DataArrayDouble::applyFunc : output number of component must be > 0 !"); checkAllocated(); int nbOfTuples(getNumberOfTuples()); - MEDCouplingAutoRefCountObjectPtr newArr(DataArrayDouble::New()); + MCAuto newArr(DataArrayDouble::New()); newArr->alloc(nbOfTuples,nbOfComp); INTERP_KERNEL::ExprParser expr(func); expr.parse(); @@ -4465,7 +4465,7 @@ DataArrayDouble *DataArrayDouble::applyFunc(const std::string& func, bool isSafe expr.getTrueSetOfVars(vars); if((int)vars.size()>1) { - std::ostringstream oss; oss << "DataArrayDouble::applyFunc : this method works only with at most one var func expression ! If you need to map comps on variables please use applyFunc2 or applyFunc3 instead ! Vars in expr are : "; + std::ostringstream oss; oss << "DataArrayDouble::applyFunc : this method works only with at most one var func expression ! If you need to map comps on variables please use applyFuncCompo or applyFuncNamedCompo instead ! Vars in expr are : "; std::copy(vars.begin(),vars.end(),std::ostream_iterator(oss," ")); throw INTERP_KERNEL::Exception(oss.str().c_str()); } @@ -4548,7 +4548,7 @@ void DataArrayDouble::applyFuncOnThis(const std::string& func, bool isSafe) expr.getTrueSetOfVars(vars); if((int)vars.size()>1) { - std::ostringstream oss; oss << "DataArrayDouble::applyFuncOnThis : this method works only with at most one var func expression ! If you need to map comps on variables please use applyFunc2 or applyFunc3 instead ! Vars in expr are : "; + std::ostringstream oss; oss << "DataArrayDouble::applyFuncOnThis : this method works only with at most one var func expression ! If you need to map comps on variables please use applyFuncCompo or applyFuncNamedCompo instead ! Vars in expr are : "; std::copy(vars.begin(),vars.end(),std::ostream_iterator(oss," ")); throw INTERP_KERNEL::Exception(oss.str().c_str()); } @@ -4623,9 +4623,9 @@ void DataArrayDouble::applyFuncOnThis(const std::string& func, bool isSafe) * \throw If \a func contains vars that are not in \a this->getInfoOnComponent(). * \throw If computing \a func fails. */ -DataArrayDouble *DataArrayDouble::applyFunc2(int nbOfComp, const std::string& func, bool isSafe) const +DataArrayDouble *DataArrayDouble::applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe) const { - return applyFunc3(nbOfComp,getVarsOnComponent(),func,isSafe); + return applyFuncNamedCompo(nbOfComp,getVarsOnComponent(),func,isSafe); } /*! @@ -4646,10 +4646,10 @@ DataArrayDouble *DataArrayDouble::applyFunc2(int nbOfComp, const std::string& fu * \throw If \a func contains vars not in \a varsOrder. * \throw If computing \a func fails. */ -DataArrayDouble *DataArrayDouble::applyFunc3(int nbOfComp, const std::vector& varsOrder, const std::string& func, bool isSafe) const +DataArrayDouble *DataArrayDouble::applyFuncNamedCompo(int nbOfComp, const std::vector& varsOrder, const std::string& func, bool isSafe) const { if(nbOfComp<=0) - throw INTERP_KERNEL::Exception("DataArrayDouble::applyFunc3 : output number of component must be > 0 !"); + throw INTERP_KERNEL::Exception("DataArrayDouble::applyFuncNamedCompo : output number of component must be > 0 !"); std::vector varsOrder2(varsOrder); int oldNbOfComp(getNumberOfComponents()); for(int i=(int)varsOrder.size();i(oss," ")); throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDCouplingAutoRefCountObjectPtr newArr(DataArrayDouble::New()); + MCAuto newArr(DataArrayDouble::New()); newArr->alloc(nbOfTuples,nbOfComp); INTERP_KERNEL::AutoPtr buff(new double[oldNbOfComp]); double *buffPtr(buff),*ptrToFill; @@ -4763,20 +4763,20 @@ DataArrayDoubleIterator *DataArrayDouble::iterator() * needed. * \throw If \a this->getNumberOfComponents() != 1. * - * \sa DataArrayDouble::getIdsNotInRange + * \sa DataArrayDouble::findIdsNotInRange * * \if ENABLE_EXAMPLES * \ref cpp_mcdataarraydouble_getidsinrange "Here is a C++ example".
* \ref py_mcdataarraydouble_getidsinrange "Here is a Python example". * \endif */ -DataArrayInt *DataArrayDouble::getIdsInRange(double vmin, double vmax) const +DataArrayInt *DataArrayDouble::findIdsInRange(double vmin, double vmax) const { checkAllocated(); if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayDouble::getIdsInRange : this must have exactly one component !"); + throw INTERP_KERNEL::Exception("DataArrayDouble::findIdsInRange : this must have exactly one component !"); const double *cptr(begin()); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); int nbOfTuples(getNumberOfTuples()); for(int i=0;i=vmin && *cptr<=vmax) @@ -4794,15 +4794,15 @@ DataArrayInt *DataArrayDouble::getIdsInRange(double vmin, double vmax) const * needed. * \throw If \a this->getNumberOfComponents() != 1. * - * \sa DataArrayDouble::getIdsInRange + * \sa DataArrayDouble::findIdsInRange */ -DataArrayInt *DataArrayDouble::getIdsNotInRange(double vmin, double vmax) const +DataArrayInt *DataArrayDouble::findIdsNotInRange(double vmin, double vmax) const { checkAllocated(); if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayDouble::getIdsNotInRange : this must have exactly one component !"); + throw INTERP_KERNEL::Exception("DataArrayDouble::findIdsNotInRange : this must have exactly one component !"); const double *cptr(begin()); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); int nbOfTuples(getNumberOfTuples()); for(int i=0;ivmax) @@ -4863,7 +4863,7 @@ DataArrayDouble *DataArrayDouble::Aggregate(const std::vectorgetNumberOfTuples(); } - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); ret->alloc(nbt,nbOfComp); double *pt=ret->getPointer(); for(it=a.begin();it!=a.end();it++) @@ -5143,7 +5143,7 @@ DataArrayDouble *DataArrayDouble::Add(const DataArrayDouble *a1, const DataArray int nbOfTuple2=a2->getNumberOfTuples(); int nbOfComp=a1->getNumberOfComponents(); int nbOfComp2=a2->getNumberOfComponents(); - MEDCouplingAutoRefCountObjectPtr ret=0; + MCAuto ret=0; if(nbOfTuple==nbOfTuple2) { if(nbOfComp==nbOfComp2) @@ -5303,7 +5303,7 @@ DataArrayDouble *DataArrayDouble::Substract(const DataArrayDouble *a1, const Dat { if(nbOfComp1==nbOfComp2) { - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); ret->alloc(nbOfTuple2,nbOfComp1); std::transform(a1->begin(),a1->end(),a2->begin(),ret->getPointer(),std::minus()); ret->copyStringInfoFrom(*a1); @@ -5311,7 +5311,7 @@ DataArrayDouble *DataArrayDouble::Substract(const DataArrayDouble *a1, const Dat } else if(nbOfComp2==1) { - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); ret->alloc(nbOfTuple1,nbOfComp1); const double *a2Ptr=a2->getConstPointer(); const double *a1Ptr=a1->getConstPointer(); @@ -5330,7 +5330,7 @@ DataArrayDouble *DataArrayDouble::Substract(const DataArrayDouble *a1, const Dat else if(nbOfTuple2==1) { a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Substract !"); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); ret->alloc(nbOfTuple1,nbOfComp1); const double *a1ptr=a1->getConstPointer(),*a2ptr=a2->getConstPointer(); double *pt=ret->getPointer(); @@ -5440,7 +5440,7 @@ DataArrayDouble *DataArrayDouble::Multiply(const DataArrayDouble *a1, const Data int nbOfTuple2=a2->getNumberOfTuples(); int nbOfComp=a1->getNumberOfComponents(); int nbOfComp2=a2->getNumberOfComponents(); - MEDCouplingAutoRefCountObjectPtr ret=0; + MCAuto ret=0; if(nbOfTuple==nbOfTuple2) { if(nbOfComp==nbOfComp2) @@ -5601,7 +5601,7 @@ DataArrayDouble *DataArrayDouble::Divide(const DataArrayDouble *a1, const DataAr { if(nbOfComp1==nbOfComp2) { - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); ret->alloc(nbOfTuple2,nbOfComp1); std::transform(a1->begin(),a1->end(),a2->begin(),ret->getPointer(),std::divides()); ret->copyStringInfoFrom(*a1); @@ -5609,7 +5609,7 @@ DataArrayDouble *DataArrayDouble::Divide(const DataArrayDouble *a1, const DataAr } else if(nbOfComp2==1) { - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); ret->alloc(nbOfTuple1,nbOfComp1); const double *a2Ptr=a2->getConstPointer(); const double *a1Ptr=a1->getConstPointer(); @@ -5628,7 +5628,7 @@ DataArrayDouble *DataArrayDouble::Divide(const DataArrayDouble *a1, const DataAr else if(nbOfTuple2==1) { a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Divide !"); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); ret->alloc(nbOfTuple1,nbOfComp1); const double *a1ptr=a1->getConstPointer(),*a2ptr=a2->getConstPointer(); double *pt=ret->getPointer(); @@ -5732,7 +5732,7 @@ DataArrayDouble *DataArrayDouble::Pow(const DataArrayDouble *a1, const DataArray throw INTERP_KERNEL::Exception("DataArrayDouble::Pow : number of tuples mismatches !"); if(nbOfComp!=1 || nbOfComp2!=1) throw INTERP_KERNEL::Exception("DataArrayDouble::Pow : number of components of both arrays must be equal to 1 !"); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); ret->alloc(nbOfTuple,1); + MCAuto ret=DataArrayDouble::New(); ret->alloc(nbOfTuple,1); const double *ptr1(a1->begin()),*ptr2(a2->begin()); double *ptr=ret->getPointer(); for(int i=0;i rintstart; rintstart bg(arrEnd);//OK no problem because size of 'arr' is greater or equal 2 rintstart end2(arrBg); - MEDCouplingAutoRefCountObjectPtr ret1=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr ret2=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr ret3=DataArrayInt::New(); + MCAuto ret1=DataArrayInt::New(); + MCAuto ret2=DataArrayInt::New(); + MCAuto ret3=DataArrayInt::New(); ret1->alloc(nbOfTuples,1); ret2->alloc(nbOfTuples,1); int *ret1Ptr=ret1->getPointer(); @@ -6670,7 +6670,7 @@ DataArrayInt *DataArrayInt::transformWithIndArrR(const int *indArrBg, const int int nbElemsIn=(int)std::distance(indArrBg,indArrEnd); int nbOfTuples=getNumberOfTuples(); const int *pt=getConstPointer(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuples,1); ret->fillWithValue(-1); int *tmp=ret->getPointer(); @@ -6713,7 +6713,7 @@ DataArrayInt *DataArrayInt::transformWithIndArrR(const int *indArrBg, const int */ DataArrayInt *DataArrayInt::invertArrayO2N2N2O(int newNbOfElem) const { - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(newNbOfElem,1); int nbOfOldNodes=getNumberOfTuples(); const int *old2New=getConstPointer(); @@ -6741,7 +6741,7 @@ DataArrayInt *DataArrayInt::invertArrayO2N2N2O(int newNbOfElem) const */ DataArrayInt *DataArrayInt::invertArrayO2N2N2OBis(int newNbOfElem) const { - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(newNbOfElem,1); int nbOfOldNodes=getNumberOfTuples(); const int *old2New=getConstPointer(); @@ -6782,7 +6782,7 @@ DataArrayInt *DataArrayInt::invertArrayO2N2N2OBis(int newNbOfElem) const DataArrayInt *DataArrayInt::invertArrayN2O2O2N(int oldNbOfElem) const { checkAllocated(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(oldNbOfElem,1); const int *new2Old=getConstPointer(); int *pt=ret->getPointer(); @@ -6850,8 +6850,8 @@ bool DataArrayInt::isEqualWithoutConsideringStr(const DataArrayInt& other) const */ bool DataArrayInt::isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const { - MEDCouplingAutoRefCountObjectPtr a=deepCpy(); - MEDCouplingAutoRefCountObjectPtr b=other.deepCpy(); + MCAuto a=deepCopy(); + MCAuto b=other.deepCopy(); a->sort(); b->sort(); return a->isEqualWithoutConsideringStr(*b); @@ -6950,7 +6950,7 @@ DataArrayInt *DataArrayInt::sumPerTuple() const { checkAllocated(); int nbOfComp(getNumberOfComponents()),nbOfTuple(getNumberOfTuples()); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); + MCAuto ret(DataArrayInt::New()); ret->alloc(nbOfTuple,1); const int *src(getConstPointer()); int *dest(ret->getPointer()); @@ -7111,7 +7111,7 @@ DataArrayInt *DataArrayInt::buildPermutationArr(const DataArrayInt& other) const other.checkAllocated(); if(nbTuple!=other.getNumberOfTuples()) throw INTERP_KERNEL::Exception("DataArrayInt::buildPermutationArr : 'this' and 'other' must have the same number of tuple !"); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbTuple,1); ret->fillWithValue(-1); const int *pt=getConstPointer(); @@ -7283,7 +7283,7 @@ DataArrayInt *DataArrayInt::renumber(const int *old2New) const checkAllocated(); int nbTuples=getNumberOfTuples(); int nbOfCompo=getNumberOfComponents(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbTuples,nbOfCompo); ret->copyStringInfoFrom(*this); const int *iptr=getConstPointer(); @@ -7310,7 +7310,7 @@ DataArrayInt *DataArrayInt::renumberR(const int *new2Old) const checkAllocated(); int nbTuples=getNumberOfTuples(); int nbOfCompo=getNumberOfComponents(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbTuples,nbOfCompo); ret->copyStringInfoFrom(*this); const int *iptr=getConstPointer(); @@ -7339,7 +7339,7 @@ DataArrayInt *DataArrayInt::renumberAndReduce(const int *old2New, int newNbOfTup checkAllocated(); int nbTuples=getNumberOfTuples(); int nbOfCompo=getNumberOfComponents(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(newNbOfTuple,nbOfCompo); const int *iptr=getConstPointer(); int *optr=ret->getPointer(); @@ -7372,7 +7372,7 @@ DataArrayInt *DataArrayInt::renumberAndReduce(const int *old2New, int newNbOfTup DataArrayInt *DataArrayInt::selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const { checkAllocated(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); int nbComp=getNumberOfComponents(); ret->alloc((int)std::distance(new2OldBg,new2OldEnd),nbComp); ret->copyStringInfoFrom(*this); @@ -7407,7 +7407,7 @@ DataArrayInt *DataArrayInt::selectByTupleId(const int *new2OldBg, const int *new DataArrayInt *DataArrayInt::selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const { checkAllocated(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); int nbComp=getNumberOfComponents(); int oldNbOfTuples=getNumberOfTuples(); ret->alloc((int)std::distance(new2OldBg,new2OldEnd),nbComp); @@ -7439,12 +7439,12 @@ DataArrayInt *DataArrayInt::selectByTupleIdSafe(const int *new2OldBg, const int * is to delete using decrRef() as it is no more needed. * \sa DataArrayInt::substr. */ -DataArrayInt *DataArrayInt::selectByTupleId2(int bg, int end2, int step) const +DataArrayInt *DataArrayInt::selectByTupleIdSafeSlice(int bg, int end2, int step) const { checkAllocated(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); int nbComp=getNumberOfComponents(); - int newNbOfTuples=GetNumberOfItemGivenBESRelative(bg,end2,step,"DataArrayInt::selectByTupleId2 : "); + int newNbOfTuples=GetNumberOfItemGivenBESRelative(bg,end2,step,"DataArrayInt::selectByTupleIdSafeSlice : "); ret->alloc(newNbOfTuples,nbComp); int *pt=ret->getPointer(); const int *srcPt=getConstPointer()+bg*nbComp; @@ -7473,7 +7473,7 @@ DataArray *DataArrayInt::selectByTupleRanges(const std::vector ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(0,nbOfComp); ret->copyStringInfoFrom(*this); return ret.retn(); @@ -7507,8 +7507,8 @@ DataArray *DataArrayInt::selectByTupleRanges(const std::vector ret=DataArrayInt::New(); + return deepCopy(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuples,nbOfComp); ret->copyStringInfoFrom(*this); const int *src=getConstPointer(); @@ -7571,8 +7571,8 @@ DataArrayInt *DataArrayInt::FindPermutationFromFirstToSecond(const DataArrayInt std::ostringstream oss; oss << "DataArrayInt::FindPermutationFromFirstToSecond : first array has " << ids1->getNumberOfTuples() << " tuples and the second one " << ids2->getNumberOfTuples() << " tuples ! No chance to find a permutation between the 2 arrays !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDCouplingAutoRefCountObjectPtr p1(ids1->deepCpy()); - MEDCouplingAutoRefCountObjectPtr p2(ids2->deepCpy()); + MCAuto p1(ids1->deepCopy()); + MCAuto p2(ids2->deepCopy()); p1->sort(true); p2->sort(true); if(!p1->isEqualWithoutConsideringStr(*p2)) throw INTERP_KERNEL::Exception("DataArrayInt::FindPermutationFromFirstToSecond : the two arrays are not lying on same ids ! Impossible to find a permutation between the 2 arrays !"); @@ -7624,8 +7624,8 @@ void DataArrayInt::changeSurjectiveFormat(int targetNb, DataArrayInt *&arr, Data if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayInt::changeSurjectiveFormat : number of components must == 1 !"); int nbOfTuples=getNumberOfTuples(); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); - MEDCouplingAutoRefCountObjectPtr retI(DataArrayInt::New()); + MCAuto ret(DataArrayInt::New()); + MCAuto retI(DataArrayInt::New()); retI->alloc(targetNb+1,1); const int *input=getConstPointer(); std::vector< std::vector > tmp(targetNb); @@ -7680,9 +7680,9 @@ void DataArrayInt::changeSurjectiveFormat(int targetNb, DataArrayInt *&arr, Data * array using decrRef() as it is no more needed. * \throw If any value of \a arr breaks condition ( 0 <= \a arr[ i ] < \a nbOfOldTuples ). */ -DataArrayInt *DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, const int *arr, const int *arrIBg, const int *arrIEnd, int &newNbOfTuples) +DataArrayInt *DataArrayInt::ConvertIndexArrayToO2N(int nbOfOldTuples, const int *arr, const int *arrIBg, const int *arrIEnd, int &newNbOfTuples) { - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfOldTuples,1); int *pt=ret->getPointer(); std::fill(pt,pt+nbOfOldTuples,-1); @@ -7706,7 +7706,7 @@ DataArrayInt *DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTu pt[arr[j]]=newNb; else { - std::ostringstream oss; oss << "DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2 : With element #" << j << " value is " << arr[j] << " should be in [0," << nbOfOldTuples << ") !"; + std::ostringstream oss; oss << "DataArrayInt::ConvertIndexArrayToO2N : With element #" << j << " value is " << arr[j] << " should be in [0," << nbOfOldTuples << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } } @@ -7740,7 +7740,7 @@ DataArrayInt *DataArrayInt::buildPermArrPerLevel() const int nbOfTuples=getNumberOfTuples(); const int *pt=getConstPointer(); std::map m; - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuples,1); int *opt=ret->getPointer(); for(int i=0;igetNumberOfComponents() != 1. */ -bool DataArrayInt::isIdentity2(int sizeExpected) const +bool DataArrayInt::isIota(int sizeExpected) const { checkAllocated(); if(getNumberOfComponents()!=1) @@ -7842,7 +7842,7 @@ DataArrayDouble *DataArrayInt::convertToDblArr() const * Returns a shorten copy of \a this array. The new DataArrayInt contains all * tuples starting from the \a tupleIdBg-th tuple and including all tuples located before * the \a tupleIdEnd-th one. This methods has a similar behavior as std::string::substr(). - * This method is a specialization of selectByTupleId2(). + * This method is a specialization of selectByTupleIdSafeSlice(). * \param [in] tupleIdBg - index of the first tuple to copy from \a this array. * \param [in] tupleIdEnd - index of the tuple before which the tuples to copy are located. * If \a tupleIdEnd == -1, all the tuples till the end of \a this array are copied. @@ -7851,7 +7851,7 @@ DataArrayDouble *DataArrayInt::convertToDblArr() const * \throw If \a tupleIdBg < 0. * \throw If \a tupleIdBg > \a this->getNumberOfTuples(). \throw If \a tupleIdEnd != -1 && \a tupleIdEnd < \a this->getNumberOfTuples(). - * \sa DataArrayInt::selectByTupleId2 + * \sa DataArrayInt::selectByTupleIdSafeSlice */ DataArrayInt *DataArrayInt::substr(int tupleIdBg, int tupleIdEnd) const { @@ -7870,7 +7870,7 @@ DataArrayInt *DataArrayInt::substr(int tupleIdBg, int tupleIdEnd) const else trueEnd=nbt; int nbComp=getNumberOfComponents(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(trueEnd-tupleIdBg,nbComp); ret->copyStringInfoFrom(*this); std::copy(getConstPointer()+tupleIdBg*nbComp,getConstPointer()+trueEnd*nbComp,ret->getPointer()); @@ -7936,7 +7936,7 @@ void DataArrayInt::transpose() DataArrayInt *DataArrayInt::changeNbOfComponents(int newNbOfComp, int dftValue) const { checkAllocated(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(getNumberOfTuples(),newNbOfComp); const int *oldc=getConstPointer(); int *nc=ret->getPointer(); @@ -7995,7 +7995,7 @@ void DataArrayInt::reAlloc(int nbOfTuples) DataArrayInt *DataArrayInt::keepSelectedComponents(const std::vector& compoIds) const { checkAllocated(); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); + MCAuto ret(DataArrayInt::New()); int newNbOfCompo=(int)compoIds.size(); int oldNbOfCompo=getNumberOfComponents(); for(std::vector::const_iterator it=compoIds.begin();it!=compoIds.end();it++) @@ -8673,27 +8673,27 @@ void DataArrayInt::setContigPartOfSelectedValues(int tupleIdStart, const DataArr * non-empty range of increasing indices or indices are out of a valid range * for the array \a aBase. */ -void DataArrayInt::setContigPartOfSelectedValues2(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step) +void DataArrayInt::setContigPartOfSelectedValuesSlice(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step) { if(!aBase) - throw INTERP_KERNEL::Exception("DataArrayInt::setContigPartOfSelectedValues2 : input DataArray is NULL !"); + throw INTERP_KERNEL::Exception("DataArrayInt::setContigPartOfSelectedValuesSlice : input DataArray is NULL !"); const DataArrayInt *a=dynamic_cast(aBase); if(!a) - throw INTERP_KERNEL::Exception("DataArrayInt::setContigPartOfSelectedValues2 : input DataArray aBase is not a DataArrayInt !"); + throw INTERP_KERNEL::Exception("DataArrayInt::setContigPartOfSelectedValuesSlice : input DataArray aBase is not a DataArrayInt !"); checkAllocated(); a->checkAllocated(); int nbOfComp=getNumberOfComponents(); - const char msg[]="DataArrayInt::setContigPartOfSelectedValues2"; + const char msg[]="DataArrayInt::setContigPartOfSelectedValuesSlice"; int nbOfTupleToWrite=DataArray::GetNumberOfItemGivenBES(bg,end2,step,msg); if(nbOfComp!=a->getNumberOfComponents()) - throw INTERP_KERNEL::Exception("DataArrayInt::setContigPartOfSelectedValues2 : This and a do not have the same number of components !"); + throw INTERP_KERNEL::Exception("DataArrayInt::setContigPartOfSelectedValuesSlice : This and a do not have the same number of components !"); int thisNt=getNumberOfTuples(); int aNt=a->getNumberOfTuples(); int *valsToSet=getPointer()+tupleIdStart*nbOfComp; if(tupleIdStart+nbOfTupleToWrite>thisNt) - throw INTERP_KERNEL::Exception("DataArrayInt::setContigPartOfSelectedValues2 : invalid number range of values to write !"); + throw INTERP_KERNEL::Exception("DataArrayInt::setContigPartOfSelectedValuesSlice : invalid number range of values to write !"); if(end2>aNt) - throw INTERP_KERNEL::Exception("DataArrayInt::setContigPartOfSelectedValues2 : invalid range of values to read !"); + throw INTERP_KERNEL::Exception("DataArrayInt::setContigPartOfSelectedValuesSlice : invalid range of values to read !"); const int *valsSrc=a->getConstPointer()+bg*nbOfComp; for(int i=0;igetNumberOfComponents() != 1. - * \sa DataArrayInt::getIdsEqualTuple + * \sa DataArrayInt::findIdsEqualTuple */ -DataArrayInt *DataArrayInt::getIdsEqual(int val) const +DataArrayInt *DataArrayInt::findIdsEqual(int val) const { checkAllocated(); if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqual : the array must have only one component, you can call 'rearrange' method before !"); + throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqual : the array must have only one component, you can call 'rearrange' method before !"); const int *cptr(getConstPointer()); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); int nbOfTuples=getNumberOfTuples(); for(int i=0;igetNumberOfComponents() != 1. */ -DataArrayInt *DataArrayInt::getIdsNotEqual(int val) const +DataArrayInt *DataArrayInt::findIdsNotEqual(int val) const { checkAllocated(); if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqual : the array must have only one component, you can call 'rearrange' method before !"); + throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqual : the array must have only one component, you can call 'rearrange' method before !"); const int *cptr(getConstPointer()); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); int nbOfTuples=getNumberOfTuples(); for(int i=0;igetNumberOfComponents() != std::distance(tupleBg,tupleEnd). * \throw If \a this->getNumberOfComponents() is equal to 0. - * \sa DataArrayInt::getIdsEqual + * \sa DataArrayInt::findIdsEqual */ -DataArrayInt *DataArrayInt::getIdsEqualTuple(const int *tupleBg, const int *tupleEnd) const +DataArrayInt *DataArrayInt::findIdsEqualTuple(const int *tupleBg, const int *tupleEnd) const { std::size_t nbOfCompoExp(std::distance(tupleBg,tupleEnd)); checkAllocated(); if(getNumberOfComponents()!=(int)nbOfCompoExp) { - std::ostringstream oss; oss << "DataArrayInt::getIdsEqualTuple : mismatch of number of components. Input tuple has " << nbOfCompoExp << " whereas this array has " << getNumberOfComponents() << " components !"; + std::ostringstream oss; oss << "DataArrayInt::findIdsEqualTuple : mismatch of number of components. Input tuple has " << nbOfCompoExp << " whereas this array has " << getNumberOfComponents() << " components !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } if(nbOfCompoExp==0) - throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualTuple : number of components should be > 0 !"); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); ret->alloc(0,1); + throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualTuple : number of components should be > 0 !"); + MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); const int *bg(begin()),*end2(end()),*work(begin()); while(work!=end2) { @@ -8916,15 +8916,15 @@ int DataArrayInt::changeValue(int oldValue, int newValue) * array using decrRef() as it is no more needed. * \throw If \a this->getNumberOfComponents() != 1. */ -DataArrayInt *DataArrayInt::getIdsEqualList(const int *valsBg, const int *valsEnd) const +DataArrayInt *DataArrayInt::findIdsEqualList(const int *valsBg, const int *valsEnd) const { if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : the array must have only one component, you can call 'rearrange' method before !"); + throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : the array must have only one component, you can call 'rearrange' method before !"); std::set vals2(valsBg,valsEnd); const int *cptr(getConstPointer()); std::vector res; int nbOfTuples(getNumberOfTuples()); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); for(int i=0;ipushBackSilent(i); @@ -8941,15 +8941,15 @@ DataArrayInt *DataArrayInt::getIdsEqualList(const int *valsBg, const int *valsEn * array using decrRef() as it is no more needed. * \throw If \a this->getNumberOfComponents() != 1. */ -DataArrayInt *DataArrayInt::getIdsNotEqualList(const int *valsBg, const int *valsEnd) const +DataArrayInt *DataArrayInt::findIdsNotEqualList(const int *valsBg, const int *valsEnd) const { if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : the array must have only one component, you can call 'rearrange' method before !"); + throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : the array must have only one component, you can call 'rearrange' method before !"); std::set vals2(valsBg,valsEnd); const int *cptr=getConstPointer(); std::vector res; int nbOfTuples=getNumberOfTuples(); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); for(int i=0;ipushBackSilent(i); @@ -8957,7 +8957,7 @@ DataArrayInt *DataArrayInt::getIdsNotEqualList(const int *valsBg, const int *val } /*! - * This method is an extension of DataArrayInt::locateValue method because this method works for DataArrayInt with + * This method is an extension of DataArrayInt::findIdFirstEqual method because this method works for DataArrayInt with * any number of components excepted 0 (an INTERP_KERNEL::Exception is thrown in this case). * This method searches in \b this is there is a tuple that matched the input parameter \b tupl. * If any the tuple id is returned. If not -1 is returned. @@ -8968,15 +8968,15 @@ DataArrayInt *DataArrayInt::getIdsNotEqualList(const int *valsBg, const int *val * \return tuple id where \b tupl is. -1 if no such tuple exists in \b this. * \sa DataArrayInt::search, DataArrayInt::presenceOfTuple. */ -int DataArrayInt::locateTuple(const std::vector& tupl) const +int DataArrayInt::findIdFirstEqualTuple(const std::vector& tupl) const { checkAllocated(); int nbOfCompo=getNumberOfComponents(); if(nbOfCompo==0) - throw INTERP_KERNEL::Exception("DataArrayInt::locateTuple : 0 components in 'this' !"); + throw INTERP_KERNEL::Exception("DataArrayInt::findIdFirstEqualTuple : 0 components in 'this' !"); if(nbOfCompo!=(int)tupl.size()) { - std::ostringstream oss; oss << "DataArrayInt::locateTuple : 'this' contains " << nbOfCompo << " components and searching for a tuple of length " << tupl.size() << " !"; + std::ostringstream oss; oss << "DataArrayInt::findIdFirstEqualTuple : 'this' contains " << nbOfCompo << " components and searching for a tuple of length " << tupl.size() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } const int *cptr=getConstPointer(); @@ -8998,8 +8998,8 @@ int DataArrayInt::locateTuple(const std::vector& tupl) const /*! * This method searches the sequence specified in input parameter \b vals in \b this. * This works only for DataArrayInt having number of components equal to one (if not an INTERP_KERNEL::Exception will be thrown). - * This method differs from DataArrayInt::locateTuple in that the position is internal raw data is not considered here contrary to DataArrayInt::locateTuple. - * \sa DataArrayInt::locateTuple + * This method differs from DataArrayInt::findIdFirstEqualTuple in that the position is internal raw data is not considered here contrary to DataArrayInt::findIdFirstEqualTuple. + * \sa DataArrayInt::findIdFirstEqualTuple */ int DataArrayInt::search(const std::vector& vals) const { @@ -9021,7 +9021,7 @@ int DataArrayInt::search(const std::vector& vals) const * If not any tuple contains \b value -1 is returned. * \sa DataArrayInt::presenceOfValue */ -int DataArrayInt::locateValue(int value) const +int DataArrayInt::findIdFirstEqual(int value) const { checkAllocated(); if(getNumberOfComponents()!=1) @@ -9040,7 +9040,7 @@ int DataArrayInt::locateValue(int value) const * If not any tuple contains one of the values contained in 'vals' -1 is returned. * \sa DataArrayInt::presenceOfValue */ -int DataArrayInt::locateValue(const std::vector& vals) const +int DataArrayInt::findIdFirstEqual(const std::vector& vals) const { checkAllocated(); if(getNumberOfComponents()!=1) @@ -9083,11 +9083,11 @@ int DataArrayInt::count(int value) const * This method searches in \b this is there is a tuple that matched the input parameter \b tupl. * This method throws an INTERP_KERNEL::Exception if the number of components in \b this mismatches with the size of * the input vector. An INTERP_KERNEL::Exception is thrown too if \b this is not allocated. - * \sa DataArrayInt::locateTuple + * \sa DataArrayInt::findIdFirstEqualTuple */ bool DataArrayInt::presenceOfTuple(const std::vector& tupl) const { - return locateTuple(tupl)!=-1; + return findIdFirstEqualTuple(tupl)!=-1; } @@ -9097,22 +9097,22 @@ bool DataArrayInt::presenceOfTuple(const std::vector& tupl) const * \return bool - \a true in case if \a value is present within \a this array. * \throw If \a this is not allocated. * \throw If \a this->getNumberOfComponents() != 1. - * \sa locateValue() + * \sa findIdFirstEqual() */ bool DataArrayInt::presenceOfValue(int value) const { - return locateValue(value)!=-1; + return findIdFirstEqual(value)!=-1; } /*! * This method expects to be called when number of components of this is equal to one. * This method returns true if it exists a tuple so that the value is contained in \b vals. * If not any tuple contains one of the values contained in 'vals' false is returned. - * \sa DataArrayInt::locateValue + * \sa DataArrayInt::findIdFirstEqual */ bool DataArrayInt::presenceOfValue(const std::vector& vals) const { - return locateValue(vals)!=-1; + return findIdFirstEqual(vals)!=-1; } /*! @@ -9174,7 +9174,7 @@ DataArrayInt *DataArrayInt::accumulatePerChunck(const int *bgOfIndex, const int if(sz<1) throw INTERP_KERNEL::Exception("DataArrayInt::accumulatePerChunck : invalid size of input index array !"); sz--; - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); ret->alloc(sz,nbCompo); + MCAuto ret=DataArrayInt::New(); ret->alloc(sz,nbCompo); const int *w=bgOfIndex; if(*w<0 || *w>=nbOfTuples) throw INTERP_KERNEL::Exception("DataArrayInt::accumulatePerChunck : The first element of the input index not in [0,nbOfTuples) !"); @@ -9272,7 +9272,7 @@ DataArrayInt *DataArrayInt::Aggregate(const std::vector& a throw INTERP_KERNEL::Exception("DataArrayInt::Aggregate : Nb of components mismatch for array aggregation !"); nbt+=(*it)->getNumberOfTuples(); } - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbt,nbOfComp); int *pt=ret->getPointer(); for(it=a.begin();it!=a.end();it++) @@ -9323,7 +9323,7 @@ DataArrayInt *DataArrayInt::AggregateIndexes(const std::vector ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(retSz,1); int *pt=ret->getPointer(); *pt++=0; for(std::vector::const_iterator it=arrs.begin();it!=arrs.end();it++) @@ -9599,15 +9599,15 @@ void DataArrayInt::applyModulus(int val) * \param [in] vmax end of range. This value is \b not included in range (excluded). * \return a newly allocated data array that the caller should deal with. * - * \sa DataArrayInt::getIdsNotInRange , DataArrayInt::getIdsStrictlyNegative + * \sa DataArrayInt::findIdsNotInRange , DataArrayInt::findIdsStricltyNegative */ -DataArrayInt *DataArrayInt::getIdsInRange(int vmin, int vmax) const +DataArrayInt *DataArrayInt::findIdsInRange(int vmin, int vmax) const { checkAllocated(); if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::getIdsInRange : this must have exactly one component !"); + throw INTERP_KERNEL::Exception("DataArrayInt::findIdsInRange : this must have exactly one component !"); const int *cptr(begin()); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); int nbOfTuples(getNumberOfTuples()); for(int i=0;i=vmin && *cptr ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); int nbOfTuples(getNumberOfTuples()); for(int i=0;i=vmax) @@ -9644,15 +9644,15 @@ DataArrayInt *DataArrayInt::getIdsNotInRange(int vmin, int vmax) const * This method works only on data array with one component. This method returns a newly allocated array storing stored ascendantly of tuple ids in \a this so that this[id]<0. * * \return a newly allocated data array that the caller should deal with. - * \sa DataArrayInt::getIdsInRange + * \sa DataArrayInt::findIdsInRange */ -DataArrayInt *DataArrayInt::getIdsStrictlyNegative() const +DataArrayInt *DataArrayInt::findIdsStricltyNegative() const { checkAllocated(); if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::getIdsStrictlyNegative : this must have exactly one component !"); + throw INTERP_KERNEL::Exception("DataArrayInt::findIdsStricltyNegative : this must have exactly one component !"); const int *cptr(getConstPointer()); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); int nbOfTuples(getNumberOfTuples()); for(int i=0;i::const_iterator it4=groups.begin();it4!=groups.end();it4++) if(*it4) groups2.push_back(*it4); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(newNb,1); int *retPtr=ret->getPointer(); std::fill(retPtr,retPtr+newNb,0); @@ -10051,7 +10051,7 @@ namespace MEDCouplingImpl DataArrayInt *DataArrayInt::BuildListOfSwitchedOn(const std::vector& v) { int sz((int)std::count(v.begin(),v.end(),true)); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); ret->alloc(sz,1); + MCAuto ret(DataArrayInt::New()); ret->alloc(sz,1); std::for_each(v.begin(),v.end(),MEDCouplingImpl::OpSwitchedOn(ret->getPointer())); return ret.retn(); } @@ -10062,7 +10062,7 @@ DataArrayInt *DataArrayInt::BuildListOfSwitchedOn(const std::vector& v) DataArrayInt *DataArrayInt::BuildListOfSwitchedOff(const std::vector& v) { int sz((int)std::count(v.begin(),v.end(),false)); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); ret->alloc(sz,1); + MCAuto ret(DataArrayInt::New()); ret->alloc(sz,1); std::for_each(v.begin(),v.end(),MEDCouplingImpl::OpSwitchedOff(ret->getPointer())); return ret.retn(); } @@ -10078,7 +10078,7 @@ DataArrayInt *DataArrayInt::BuildListOfSwitchedOff(const std::vector& v) void DataArrayInt::PutIntoToSkylineFrmt(const std::vector< std::vector >& v, DataArrayInt *& data, DataArrayInt *& dataIndex) { int sz((int)v.size()); - MEDCouplingAutoRefCountObjectPtr ret0(DataArrayInt::New()),ret1(DataArrayInt::New()); + MCAuto ret0(DataArrayInt::New()),ret1(DataArrayInt::New()); ret1->alloc(sz+1,1); int *pt(ret1->getPointer()); *pt=0; for(int i=0;igetNumberOfComponents()!=1) throw INTERP_KERNEL::Exception(MSG); const int *pt1Bg(begin()),*pt1End(end()),*pt2Bg(other->begin()),*pt2End(other->end()); const int *work1(pt1Bg),*work2(pt2Bg); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); for(;work1!=pt1End;work1++) { if(work2!=pt2End && *work1==*work2) @@ -10244,10 +10244,10 @@ DataArrayInt *DataArrayInt::buildUnique() const if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayInt::buildUnique : only single component allowed !"); int nbOfTuples=getNumberOfTuples(); - MEDCouplingAutoRefCountObjectPtr tmp=deepCpy(); + MCAuto tmp=deepCopy(); int *data=tmp->getPointer(); int *last=std::unique(data,data+nbOfTuples); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(std::distance(data,last),1); std::copy(data,last,ret->getPointer()); return ret.retn(); @@ -10272,7 +10272,7 @@ DataArrayInt *DataArrayInt::buildUniqueNotSorted() const getMinMaxValues(minVal,maxVal); std::vector b(maxVal-minVal+1,false); const int *ptBg(begin()),*endBg(end()); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); for(const int *pt=ptBg;pt!=endBg;pt++) { if(!b[*pt-minVal]) @@ -10292,7 +10292,7 @@ DataArrayInt *DataArrayInt::buildUniqueNotSorted() const * "MEDCouplingUMesh::buildDescendingConnectivity" and * \ref MEDCoupling::MEDCouplingUMesh::getNodalConnectivityIndex * "MEDCouplingUMesh::getNodalConnectivityIndex" etc. - * This method preforms the reverse operation of DataArrayInt::computeOffsets2. + * This method preforms the reverse operation of DataArrayInt::computeOffsetsFull. * \return DataArrayInt * - a new instance of DataArrayInt, whose number of tuples * equals to \a this->getNumberOfComponents() - 1, and number of components is 1. * The caller is to delete this array using decrRef() as it is no more needed. @@ -10305,7 +10305,7 @@ DataArrayInt *DataArrayInt::buildUniqueNotSorted() const * - result array contains [2,3,1,0,2,6], * where 2 = 3 - 1, 3 = 6 - 3, 1 = 7 - 6 etc. * - * \sa DataArrayInt::computeOffsets2 + * \sa DataArrayInt::computeOffsetsFull */ DataArrayInt *DataArrayInt::deltaShiftIndex() const { @@ -10329,7 +10329,7 @@ DataArrayInt *DataArrayInt::deltaShiftIndex() const * Or: for each i>0 new[i]=new[i-1]+old[i-1] for i==0 new[i]=0. Number of tuples * and components remains the same.
* This method is useful for allToAllV in MPI with contiguous policy. This method - * differs from computeOffsets2() in that the number of tuples is \b not changed by + * differs from computeOffsetsFull() in that the number of tuples is \b not changed by * this one. * \throw If \a this is not allocated. * \throw If \a this->getNumberOfComponents() != 1. @@ -10377,11 +10377,11 @@ void DataArrayInt::computeOffsets() * - After \a this contains [0,3,8,9,11,11,19]
* \sa DataArrayInt::deltaShiftIndex */ -void DataArrayInt::computeOffsets2() +void DataArrayInt::computeOffsetsFull() { checkAllocated(); if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::computeOffsets2 : only single component allowed !"); + throw INTERP_KERNEL::Exception("DataArrayInt::computeOffsetsFull : only single component allowed !"); int nbOfTuples=getNumberOfTuples(); int *ret=(int *)malloc((nbOfTuples+1)*sizeof(int)); const int *work=getConstPointer(); @@ -10394,7 +10394,7 @@ void DataArrayInt::computeOffsets2() /*! * Returns two new DataArrayInt instances whose contents is computed from that of \a this and \a listOfIds arrays as follows. - * \a this is expected to be an offset format ( as returned by DataArrayInt::computeOffsets2 ) that is to say with one component + * \a this is expected to be an offset format ( as returned by DataArrayInt::computeOffsetsFull ) that is to say with one component * and ** sorted strictly increasingly **. \a listOfIds is expected to be sorted ascendingly (not strictly needed for \a listOfIds). * This methods searches in \a this, considered as a set of contiguous \c this->getNumberOfComponents() ranges, all ids in \a listOfIds * filling completely one of the ranges in \a this. @@ -10404,7 +10404,7 @@ void DataArrayInt::computeOffsets2() * \param [out] idsInInputListThatFetch contains the list of ids in \a listOfIds that are \b fully included in a range in \a this. So * \a idsInInputListThatFetch is a part of input \a listOfIds. * - * \sa DataArrayInt::computeOffsets2 + * \sa DataArrayInt::computeOffsetsFull * * \b Example:
* - \a this : [0,3,7,9,15,18] @@ -10414,17 +10414,17 @@ void DataArrayInt::computeOffsets2() * In this example id 3 in input \a listOfIds is alone so it do not appear in output \a idsInInputListThatFetch. *
*/ -void DataArrayInt::searchRangesInListOfIds(const DataArrayInt *listOfIds, DataArrayInt *& rangeIdsFetched, DataArrayInt *& idsInInputListThatFetch) const +void DataArrayInt::findIdsRangesInListOfIds(const DataArrayInt *listOfIds, DataArrayInt *& rangeIdsFetched, DataArrayInt *& idsInInputListThatFetch) const { if(!listOfIds) - throw INTERP_KERNEL::Exception("DataArrayInt::searchRangesInListOfIds : input list of ids is null !"); + throw INTERP_KERNEL::Exception("DataArrayInt::findIdsRangesInListOfIds : input list of ids is null !"); listOfIds->checkAllocated(); checkAllocated(); if(listOfIds->getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::searchRangesInListOfIds : input list of ids must have exactly one component !"); + throw INTERP_KERNEL::Exception("DataArrayInt::findIdsRangesInListOfIds : input list of ids must have exactly one component !"); if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::searchRangesInListOfIds : this must have exactly one component !"); - MEDCouplingAutoRefCountObjectPtr ret0=DataArrayInt::New(); ret0->alloc(0,1); - MEDCouplingAutoRefCountObjectPtr ret1=DataArrayInt::New(); ret1->alloc(0,1); + throw INTERP_KERNEL::Exception("DataArrayInt::findIdsRangesInListOfIds : this must have exactly one component !"); + MCAuto ret0=DataArrayInt::New(); ret0->alloc(0,1); + MCAuto ret1=DataArrayInt::New(); ret1->alloc(0,1); const int *tupEnd(listOfIds->end()),*offBg(begin()),*offEnd(end()-1); const int *tupPtr(listOfIds->begin()),*offPtr(offBg); while(tupPtr!=tupEnd && offPtr!=offEnd) @@ -10506,7 +10506,7 @@ DataArrayInt *DataArrayInt::buildExplicitArrByRanges(const DataArrayInt *offsets throw INTERP_KERNEL::Exception(oss.str().c_str()); } } - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(retNbOftuples,1); int *retPtr=ret->getPointer(); for(int i=0;i ret(DataArrayInt::New()); ret->alloc(sz,1); + MCAuto ret(DataArrayInt::New()); ret->alloc(sz,1); int *retPtr(ret->getPointer()); pos=bg; for(int i=0;i ret=DataArrayInt::New(); ret->alloc(nbTuples,1); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbTuples,1); int nbOfRanges=ranges->getNumberOfTuples(); const int *rangesPtr=ranges->getConstPointer(); int *retPtr=ret->getPointer(); @@ -10656,7 +10656,7 @@ DataArrayInt *DataArrayInt::findIdInRangeForEachTuple(const DataArrayInt *ranges if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayInt::findIdInRangeForEachTuple : this should have only one component !"); int nbTuples=getNumberOfTuples(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); ret->alloc(nbTuples,1); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbTuples,1); int nbOfRanges=ranges->getNumberOfTuples(); const int *rangesPtr=ranges->getConstPointer(); int *retPtr=ret->getPointer(); @@ -10757,7 +10757,7 @@ DataArrayInt *DataArrayInt::duplicateEachTupleNTimes(int nbTimes) const throw INTERP_KERNEL::Exception("DataArrayInt::duplicateEachTupleNTimes : nb times should be >= 1 !"); int nbTuples=getNumberOfTuples(); const int *inPtr=getConstPointer(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); ret->alloc(nbTimes*nbTuples,1); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbTimes*nbTuples,1); int *retPtr=ret->getPointer(); for(int i=0;i ret; ret.insert(begin(),end()); - MEDCouplingAutoRefCountObjectPtr ret2=DataArrayInt::New(); ret2->alloc((int)ret.size(),1); + MCAuto ret2=DataArrayInt::New(); ret2->alloc((int)ret.size(),1); std::copy(ret.begin(),ret.end(),ret2->getPointer()); return ret2.retn(); } @@ -10888,7 +10888,7 @@ DataArrayInt *DataArrayInt::Add(const DataArrayInt *a1, const DataArrayInt *a2) int nbOfTuple2=a2->getNumberOfTuples(); int nbOfComp=a1->getNumberOfComponents(); int nbOfComp2=a2->getNumberOfComponents(); - MEDCouplingAutoRefCountObjectPtr ret=0; + MCAuto ret=0; if(nbOfTuple==nbOfTuple2) { if(nbOfComp==nbOfComp2) @@ -11047,7 +11047,7 @@ DataArrayInt *DataArrayInt::Substract(const DataArrayInt *a1, const DataArrayInt { if(nbOfComp1==nbOfComp2) { - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuple2,nbOfComp1); std::transform(a1->begin(),a1->end(),a2->begin(),ret->getPointer(),std::minus()); ret->copyStringInfoFrom(*a1); @@ -11055,7 +11055,7 @@ DataArrayInt *DataArrayInt::Substract(const DataArrayInt *a1, const DataArrayInt } else if(nbOfComp2==1) { - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuple1,nbOfComp1); const int *a2Ptr=a2->getConstPointer(); const int *a1Ptr=a1->getConstPointer(); @@ -11074,7 +11074,7 @@ DataArrayInt *DataArrayInt::Substract(const DataArrayInt *a1, const DataArrayInt else if(nbOfTuple2==1) { a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Substract !"); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuple1,nbOfComp1); const int *a1ptr=a1->getConstPointer(),*a2ptr=a2->getConstPointer(); int *pt=ret->getPointer(); @@ -11178,7 +11178,7 @@ DataArrayInt *DataArrayInt::Multiply(const DataArrayInt *a1, const DataArrayInt int nbOfTuple2=a2->getNumberOfTuples(); int nbOfComp=a1->getNumberOfComponents(); int nbOfComp2=a2->getNumberOfComponents(); - MEDCouplingAutoRefCountObjectPtr ret=0; + MCAuto ret=0; if(nbOfTuple==nbOfTuple2) { if(nbOfComp==nbOfComp2) @@ -11340,7 +11340,7 @@ DataArrayInt *DataArrayInt::Divide(const DataArrayInt *a1, const DataArrayInt *a { if(nbOfComp1==nbOfComp2) { - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuple2,nbOfComp1); std::transform(a1->begin(),a1->end(),a2->begin(),ret->getPointer(),std::divides()); ret->copyStringInfoFrom(*a1); @@ -11348,7 +11348,7 @@ DataArrayInt *DataArrayInt::Divide(const DataArrayInt *a1, const DataArrayInt *a } else if(nbOfComp2==1) { - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuple1,nbOfComp1); const int *a2Ptr=a2->getConstPointer(); const int *a1Ptr=a1->getConstPointer(); @@ -11367,7 +11367,7 @@ DataArrayInt *DataArrayInt::Divide(const DataArrayInt *a1, const DataArrayInt *a else if(nbOfTuple2==1) { a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Divide !"); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuple1,nbOfComp1); const int *a1ptr=a1->getConstPointer(),*a2ptr=a2->getConstPointer(); int *pt=ret->getPointer(); @@ -11483,7 +11483,7 @@ DataArrayInt *DataArrayInt::Modulus(const DataArrayInt *a1, const DataArrayInt * { if(nbOfComp1==nbOfComp2) { - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuple2,nbOfComp1); std::transform(a1->begin(),a1->end(),a2->begin(),ret->getPointer(),std::modulus()); ret->copyStringInfoFrom(*a1); @@ -11491,7 +11491,7 @@ DataArrayInt *DataArrayInt::Modulus(const DataArrayInt *a1, const DataArrayInt * } else if(nbOfComp2==1) { - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuple1,nbOfComp1); const int *a2Ptr=a2->getConstPointer(); const int *a1Ptr=a1->getConstPointer(); @@ -11510,7 +11510,7 @@ DataArrayInt *DataArrayInt::Modulus(const DataArrayInt *a1, const DataArrayInt * else if(nbOfTuple2==1) { a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Modulus !"); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuple1,nbOfComp1); const int *a1ptr=a1->getConstPointer(),*a2ptr=a2->getConstPointer(); int *pt=ret->getPointer(); @@ -11613,7 +11613,7 @@ DataArrayInt *DataArrayInt::Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw INTERP_KERNEL::Exception("DataArrayInt::Pow : number of tuples mismatches !"); if(nbOfComp!=1 || nbOfComp2!=1) throw INTERP_KERNEL::Exception("DataArrayInt::Pow : number of components of both arrays must be equal to 1 !"); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); ret->alloc(nbOfTuple,1); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuple,1); const int *ptr1(a1->begin()),*ptr2(a2->begin()); int *ptr=ret->getPointer(); for(int i=0;i ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuples,1); int *ptr=ret->getPointer(); if(step>0) diff --git a/src/MEDCoupling/MEDCouplingMemArray.hxx b/src/MEDCoupling/MEDCouplingMemArray.hxx index 0b12610ce..1232b7b1e 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.hxx +++ b/src/MEDCoupling/MEDCouplingMemArray.hxx @@ -146,7 +146,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void setInfoOnComponent(int i, const std::string& info); MEDCOUPLING_EXPORT int getNumberOfComponents() const { return (int)_info_on_compo.size(); } MEDCOUPLING_EXPORT void setPartOfValuesBase3(const DataArray *aBase, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true); - MEDCOUPLING_EXPORT virtual DataArray *deepCpy() const = 0; + MEDCOUPLING_EXPORT virtual DataArray *deepCopy() const = 0; MEDCOUPLING_EXPORT virtual bool isAllocated() const = 0; MEDCOUPLING_EXPORT virtual void checkAllocated() const = 0; MEDCOUPLING_EXPORT virtual void desallocate() = 0; @@ -158,12 +158,12 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual void renumberInPlace(const int *old2New) = 0; MEDCOUPLING_EXPORT virtual void renumberInPlaceR(const int *new2Old) = 0; MEDCOUPLING_EXPORT virtual void setContigPartOfSelectedValues(int tupleIdStart, const DataArray *aBase, const DataArrayInt *tuplesSelec) = 0; - MEDCOUPLING_EXPORT virtual void setContigPartOfSelectedValues2(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step) = 0; + MEDCOUPLING_EXPORT virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step) = 0; MEDCOUPLING_EXPORT virtual DataArray *selectByTupleRanges(const std::vector >& ranges) const = 0; MEDCOUPLING_EXPORT virtual DataArray *keepSelectedComponents(const std::vector& compoIds) const = 0; MEDCOUPLING_EXPORT virtual DataArray *selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const = 0; MEDCOUPLING_EXPORT virtual DataArray *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const = 0; - MEDCOUPLING_EXPORT virtual DataArray *selectByTupleId2(int bg, int end2, int step) const = 0; + MEDCOUPLING_EXPORT virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const = 0; MEDCOUPLING_EXPORT virtual void rearrange(int newNbOfCompo) = 0; MEDCOUPLING_EXPORT void checkNbOfTuples(int nbOfTuples, const std::string& msg) const; MEDCOUPLING_EXPORT void checkNbOfComps(int nbOfCompo, const std::string& msg) const; @@ -177,7 +177,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static std::string GetVarNameFromInfo(const std::string& info); MEDCOUPLING_EXPORT static std::string GetUnitFromInfo(const std::string& info); MEDCOUPLING_EXPORT static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit); - MEDCOUPLING_EXPORT static std::string GetAxTypeRepr(MEDCouplingAxisType at); + MEDCOUPLING_EXPORT static std::string GetAxisTypeRepr(MEDCouplingAxisType at); MEDCOUPLING_EXPORT static DataArray *Aggregate(const std::vector& arrs); MEDCOUPLING_EXPORT virtual void reprStream(std::ostream& stream) const = 0; MEDCOUPLING_EXPORT virtual void reprZipStream(std::ostream& stream) const = 0; @@ -217,9 +217,9 @@ namespace MEDCoupling MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDCOUPLING_EXPORT double doubleValue() const; MEDCOUPLING_EXPORT bool empty() const; - MEDCOUPLING_EXPORT DataArrayDouble *deepCpy() const; - MEDCOUPLING_EXPORT DataArrayDouble *performCpy(bool deepCpy) const; - MEDCOUPLING_EXPORT void cpyFrom(const DataArrayDouble& other); + MEDCOUPLING_EXPORT DataArrayDouble *deepCopy() const; + MEDCOUPLING_EXPORT DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const; + MEDCOUPLING_EXPORT void deepCopyFrom(const DataArrayDouble& other); MEDCOUPLING_EXPORT void reserve(std::size_t nbOfElems); MEDCOUPLING_EXPORT void pushBackSilent(double val); MEDCOUPLING_EXPORT void pushBackValsSilent(const double *valsBg, const double *valsEnd); @@ -264,7 +264,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const; MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleId(const DataArrayInt & di) const; MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const; - MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleId2(int bg, int end2, int step) const; + MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleIdSafeSlice(int bg, int end2, int step) const; MEDCOUPLING_EXPORT DataArray *selectByTupleRanges(const std::vector >& ranges) const; MEDCOUPLING_EXPORT DataArrayDouble *substr(int tupleIdBg, int tupleIdEnd=-1) const; MEDCOUPLING_EXPORT void rearrange(int newNbOfCompo); @@ -290,7 +290,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void setPartOfValuesSimple4(double a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp); MEDCOUPLING_EXPORT void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec); MEDCOUPLING_EXPORT void setContigPartOfSelectedValues(int tupleIdStart, const DataArray *aBase, const DataArrayInt *tuplesSelec); - MEDCOUPLING_EXPORT void setContigPartOfSelectedValues2(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step); + MEDCOUPLING_EXPORT void setContigPartOfSelectedValuesSlice(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step); MEDCOUPLING_EXPORT void getTuple(int tupleId, double *res) const { std::copy(_mem.getConstPointerLoc(tupleId*_info_on_compo.size()),_mem.getConstPointerLoc((tupleId+1)*_info_on_compo.size()),res); } MEDCOUPLING_EXPORT double getIJ(int tupleId, int compoId) const { return _mem[tupleId*_info_on_compo.size()+compoId]; } MEDCOUPLING_EXPORT double front() const; @@ -359,12 +359,12 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const; MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const; MEDCOUPLING_EXPORT void applyFuncOnThis(const std::string& func, bool isSafe=true); - MEDCOUPLING_EXPORT DataArrayDouble *applyFunc2(int nbOfComp, const std::string& func, bool isSafe=true) const; - MEDCOUPLING_EXPORT DataArrayDouble *applyFunc3(int nbOfComp, const std::vector& varsOrder, const std::string& func, bool isSafe=true) const; + MEDCOUPLING_EXPORT DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const; + MEDCOUPLING_EXPORT DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector& varsOrder, const std::string& func, bool isSafe=true) const; MEDCOUPLING_EXPORT void applyFuncFast32(const std::string& func); MEDCOUPLING_EXPORT void applyFuncFast64(const std::string& func); - MEDCOUPLING_EXPORT DataArrayInt *getIdsInRange(double vmin, double vmax) const; - MEDCOUPLING_EXPORT DataArrayInt *getIdsNotInRange(double vmin, double vmax) const; + MEDCOUPLING_EXPORT DataArrayInt *findIdsInRange(double vmin, double vmax) const; + MEDCOUPLING_EXPORT DataArrayInt *findIdsNotInRange(double vmin, double vmax) const; MEDCOUPLING_EXPORT static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2); MEDCOUPLING_EXPORT static DataArrayDouble *Aggregate(const std::vector& arr); MEDCOUPLING_EXPORT static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2); @@ -453,9 +453,9 @@ namespace MEDCoupling MEDCOUPLING_EXPORT int intValue() const; MEDCOUPLING_EXPORT int getHashCode() const; MEDCOUPLING_EXPORT bool empty() const; - MEDCOUPLING_EXPORT DataArrayInt *deepCpy() const; - MEDCOUPLING_EXPORT DataArrayInt *performCpy(bool deepCpy) const; - MEDCOUPLING_EXPORT void cpyFrom(const DataArrayInt& other); + MEDCOUPLING_EXPORT DataArrayInt *deepCopy() const; + MEDCOUPLING_EXPORT DataArrayInt *performCopyOrIncrRef(bool deepCopy) const; + MEDCOUPLING_EXPORT void deepCopyFrom(const DataArrayInt& other); MEDCOUPLING_EXPORT void reserve(std::size_t nbOfElems); MEDCOUPLING_EXPORT void pushBackSilent(int val); MEDCOUPLING_EXPORT void pushBackValsSilent(const int *valsBg, const int *valsEnd); @@ -513,14 +513,14 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayInt *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const; MEDCOUPLING_EXPORT DataArrayInt *selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const; MEDCOUPLING_EXPORT DataArrayInt *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const; - MEDCOUPLING_EXPORT DataArrayInt *selectByTupleId2(int bg, int end, int step) const; + MEDCOUPLING_EXPORT DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const; MEDCOUPLING_EXPORT DataArray *selectByTupleRanges(const std::vector >& ranges) const; MEDCOUPLING_EXPORT DataArrayInt *checkAndPreparePermutation() const; MEDCOUPLING_EXPORT static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2); MEDCOUPLING_EXPORT void changeSurjectiveFormat(int targetNb, DataArrayInt *&arr, DataArrayInt *&arrI) const; - MEDCOUPLING_EXPORT static DataArrayInt *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, const int *arr, const int *arrIBg, const int *arrIEnd, int &newNbOfTuples); + MEDCOUPLING_EXPORT static DataArrayInt *ConvertIndexArrayToO2N(int nbOfOldTuples, const int *arr, const int *arrIBg, const int *arrIEnd, int &newNbOfTuples); MEDCOUPLING_EXPORT DataArrayInt *buildPermArrPerLevel() const; - MEDCOUPLING_EXPORT bool isIdentity2(int sizeExpected) const; + MEDCOUPLING_EXPORT bool isIota(int sizeExpected) const; MEDCOUPLING_EXPORT bool isUniform(int val) const; MEDCOUPLING_EXPORT DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const; MEDCOUPLING_EXPORT void rearrange(int newNbOfCompo); @@ -539,7 +539,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void setPartOfValuesSimple4(int a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp); MEDCOUPLING_EXPORT void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec); MEDCOUPLING_EXPORT void setContigPartOfSelectedValues(int tupleIdStart, const DataArray *aBase, const DataArrayInt *tuplesSelec); - MEDCOUPLING_EXPORT void setContigPartOfSelectedValues2(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step); + MEDCOUPLING_EXPORT void setContigPartOfSelectedValuesSlice(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step); MEDCOUPLING_EXPORT void getTuple(int tupleId, int *res) const { std::copy(_mem.getConstPointerLoc(tupleId*_info_on_compo.size()),_mem.getConstPointerLoc((tupleId+1)*_info_on_compo.size()),res); } MEDCOUPLING_EXPORT int getIJ(int tupleId, int compoId) const { return _mem[tupleId*_info_on_compo.size()+compoId]; } MEDCOUPLING_EXPORT int getIJSafe(int tupleId, int compoId) const; @@ -553,15 +553,15 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayIntIterator *iterator(); MEDCOUPLING_EXPORT const int *begin() const { return getConstPointer(); } MEDCOUPLING_EXPORT const int *end() const { return getConstPointer()+getNbOfElems(); } - MEDCOUPLING_EXPORT DataArrayInt *getIdsEqual(int val) const; - MEDCOUPLING_EXPORT DataArrayInt *getIdsNotEqual(int val) const; - MEDCOUPLING_EXPORT DataArrayInt *getIdsEqualList(const int *valsBg, const int *valsEnd) const; - MEDCOUPLING_EXPORT DataArrayInt *getIdsNotEqualList(const int *valsBg, const int *valsEnd) const; - MEDCOUPLING_EXPORT DataArrayInt *getIdsEqualTuple(const int *tupleBg, const int *tupleEnd) const; + MEDCOUPLING_EXPORT DataArrayInt *findIdsEqual(int val) const; + MEDCOUPLING_EXPORT DataArrayInt *findIdsNotEqual(int val) const; + MEDCOUPLING_EXPORT DataArrayInt *findIdsEqualList(const int *valsBg, const int *valsEnd) const; + MEDCOUPLING_EXPORT DataArrayInt *findIdsNotEqualList(const int *valsBg, const int *valsEnd) const; + MEDCOUPLING_EXPORT DataArrayInt *findIdsEqualTuple(const int *tupleBg, const int *tupleEnd) const; MEDCOUPLING_EXPORT int changeValue(int oldValue, int newValue); - MEDCOUPLING_EXPORT int locateTuple(const std::vector& tupl) const; - MEDCOUPLING_EXPORT int locateValue(int value) const; - MEDCOUPLING_EXPORT int locateValue(const std::vector& vals) const; + MEDCOUPLING_EXPORT int findIdFirstEqualTuple(const std::vector& tupl) const; + MEDCOUPLING_EXPORT int findIdFirstEqual(int value) const; + MEDCOUPLING_EXPORT int findIdFirstEqual(const std::vector& vals) const; MEDCOUPLING_EXPORT int search(const std::vector& vals) const; MEDCOUPLING_EXPORT bool presenceOfTuple(const std::vector& tupl) const; MEDCOUPLING_EXPORT bool presenceOfValue(int value) const; @@ -586,9 +586,9 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void applyRModulus(int val); MEDCOUPLING_EXPORT void applyPow(int val); MEDCOUPLING_EXPORT void applyRPow(int val); - MEDCOUPLING_EXPORT DataArrayInt *getIdsInRange(int vmin, int vmax) const; - MEDCOUPLING_EXPORT DataArrayInt *getIdsNotInRange(int vmin, int vmax) const; - MEDCOUPLING_EXPORT DataArrayInt *getIdsStrictlyNegative() const; + MEDCOUPLING_EXPORT DataArrayInt *findIdsInRange(int vmin, int vmax) const; + MEDCOUPLING_EXPORT DataArrayInt *findIdsNotInRange(int vmin, int vmax) const; + MEDCOUPLING_EXPORT DataArrayInt *findIdsStricltyNegative() const; MEDCOUPLING_EXPORT bool checkAllIdsInRange(int vmin, int vmax) const; MEDCOUPLING_EXPORT static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2); MEDCOUPLING_EXPORT static DataArrayInt *Aggregate(const std::vector& arr); @@ -610,8 +610,8 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayInt *buildUniqueNotSorted() const; MEDCOUPLING_EXPORT DataArrayInt *deltaShiftIndex() const; MEDCOUPLING_EXPORT void computeOffsets(); - MEDCOUPLING_EXPORT void computeOffsets2(); - MEDCOUPLING_EXPORT void searchRangesInListOfIds(const DataArrayInt *listOfIds, DataArrayInt *& rangeIdsFetched, DataArrayInt *& idsInInputListThatFetch) const; + MEDCOUPLING_EXPORT void computeOffsetsFull(); + MEDCOUPLING_EXPORT void findIdsRangesInListOfIds(const DataArrayInt *listOfIds, DataArrayInt *& rangeIdsFetched, DataArrayInt *& idsInInputListThatFetch) const; MEDCOUPLING_EXPORT DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const; MEDCOUPLING_EXPORT DataArrayInt *buildExplicitArrOfSliceOnScaledArr(int begin, int stop, int step) const; MEDCOUPLING_EXPORT DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const; @@ -699,7 +699,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDCOUPLING_EXPORT int getHashCode() const; MEDCOUPLING_EXPORT bool empty() const; - MEDCOUPLING_EXPORT void cpyFrom(const DataArrayChar& other); + MEDCOUPLING_EXPORT void deepCopyFrom(const DataArrayChar& other); MEDCOUPLING_EXPORT void reserve(std::size_t nbOfElems); MEDCOUPLING_EXPORT void pushBackSilent(char val); MEDCOUPLING_EXPORT void pushBackValsSilent(const char *valsBg, const char *valsEnd); @@ -725,7 +725,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const; MEDCOUPLING_EXPORT DataArrayChar *selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const; MEDCOUPLING_EXPORT DataArrayChar *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const; - MEDCOUPLING_EXPORT DataArrayChar *selectByTupleId2(int bg, int end, int step) const; + MEDCOUPLING_EXPORT DataArrayChar *selectByTupleIdSafeSlice(int bg, int end, int step) const; MEDCOUPLING_EXPORT bool isUniform(char val) const; MEDCOUPLING_EXPORT void rearrange(int newNbOfCompo); MEDCOUPLING_EXPORT DataArrayChar *substr(int tupleIdBg, int tupleIdEnd=-1) const; @@ -742,7 +742,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void setPartOfValuesSimple4(char a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp); MEDCOUPLING_EXPORT void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec); MEDCOUPLING_EXPORT void setContigPartOfSelectedValues(int tupleIdStart, const DataArray *aBase, const DataArrayInt *tuplesSelec); - MEDCOUPLING_EXPORT void setContigPartOfSelectedValues2(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step); + MEDCOUPLING_EXPORT void setContigPartOfSelectedValuesSlice(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step); MEDCOUPLING_EXPORT DataArray *selectByTupleRanges(const std::vector >& ranges) const; MEDCOUPLING_EXPORT void getTuple(int tupleId, char *res) const { std::copy(_mem.getConstPointerLoc(tupleId*_info_on_compo.size()),_mem.getConstPointerLoc((tupleId+1)*_info_on_compo.size()),res); } MEDCOUPLING_EXPORT char getIJ(int tupleId, int compoId) const { return _mem[tupleId*_info_on_compo.size()+compoId]; } @@ -755,12 +755,12 @@ namespace MEDCoupling MEDCOUPLING_EXPORT const char *getConstPointer() const { return _mem.getConstPointer(); } MEDCOUPLING_EXPORT const char *begin() const { return getConstPointer(); } MEDCOUPLING_EXPORT const char *end() const { return getConstPointer()+getNbOfElems(); } - MEDCOUPLING_EXPORT DataArrayInt *getIdsEqual(char val) const; - MEDCOUPLING_EXPORT DataArrayInt *getIdsNotEqual(char val) const; + MEDCOUPLING_EXPORT DataArrayInt *findIdsEqual(char val) const; + MEDCOUPLING_EXPORT DataArrayInt *findIdsNotEqual(char val) const; MEDCOUPLING_EXPORT int search(const std::vector& vals) const; - MEDCOUPLING_EXPORT int locateTuple(const std::vector& tupl) const; - MEDCOUPLING_EXPORT int locateValue(char value) const; - MEDCOUPLING_EXPORT int locateValue(const std::vector& vals) const; + MEDCOUPLING_EXPORT int findIdFirstEqualTuple(const std::vector& tupl) const; + MEDCOUPLING_EXPORT int findIdFirstEqual(char value) const; + MEDCOUPLING_EXPORT int findIdFirstEqual(const std::vector& vals) const; MEDCOUPLING_EXPORT bool presenceOfTuple(const std::vector& tupl) const; MEDCOUPLING_EXPORT bool presenceOfValue(char value) const; MEDCOUPLING_EXPORT bool presenceOfValue(const std::vector& vals) const; @@ -768,7 +768,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT char getMaxValueInArray() const; MEDCOUPLING_EXPORT char getMinValue(int& tupleId) const; MEDCOUPLING_EXPORT char getMinValueInArray() const; - MEDCOUPLING_EXPORT DataArrayInt *getIdsInRange(char vmin, char vmax) const; + MEDCOUPLING_EXPORT DataArrayInt *findIdsInRange(char vmin, char vmax) const; MEDCOUPLING_EXPORT static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2); MEDCOUPLING_EXPORT static DataArrayChar *Aggregate(const std::vector& arr); MEDCOUPLING_EXPORT static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2); @@ -799,8 +799,8 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static DataArrayByte *New(); MEDCOUPLING_EXPORT DataArrayChar *buildEmptySpecializedDAChar() const; MEDCOUPLING_EXPORT DataArrayByteIterator *iterator(); - MEDCOUPLING_EXPORT DataArrayByte *deepCpy() const; - MEDCOUPLING_EXPORT DataArrayByte *performCpy(bool deepCpy) const; + MEDCOUPLING_EXPORT DataArrayByte *deepCopy() const; + MEDCOUPLING_EXPORT DataArrayByte *performCopyOrIncrRef(bool deepCopy) const; MEDCOUPLING_EXPORT char byteValue() const; MEDCOUPLING_EXPORT void reprStream(std::ostream& stream) const; MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const; @@ -857,8 +857,8 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static DataArrayAsciiChar *New(const std::vector& vst, char defaultChar); MEDCOUPLING_EXPORT DataArrayChar *buildEmptySpecializedDAChar() const; MEDCOUPLING_EXPORT DataArrayAsciiCharIterator *iterator(); - MEDCOUPLING_EXPORT DataArrayAsciiChar *deepCpy() const; - MEDCOUPLING_EXPORT DataArrayAsciiChar *performCpy(bool deepCpy) const; + MEDCOUPLING_EXPORT DataArrayAsciiChar *deepCopy() const; + MEDCOUPLING_EXPORT DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const; MEDCOUPLING_EXPORT char asciiCharValue() const; MEDCOUPLING_EXPORT void reprStream(std::ostream& stream) const; MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const; diff --git a/src/MEDCoupling/MEDCouplingMemArrayChar.cxx b/src/MEDCoupling/MEDCouplingMemArrayChar.cxx index 78b224821..99d19fbff 100644 --- a/src/MEDCoupling/MEDCouplingMemArrayChar.cxx +++ b/src/MEDCoupling/MEDCouplingMemArrayChar.cxx @@ -19,7 +19,7 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDCouplingMemArray.txx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include #include @@ -104,7 +104,7 @@ bool DataArrayChar::empty() const * \param [in] other - another instance of DataArrayChar to copy data from. * \throw If the \a other is not allocated. */ -void DataArrayChar::cpyFrom(const DataArrayChar& other) +void DataArrayChar::deepCopyFrom(const DataArrayChar& other) { other.checkAllocated(); int nbOfTuples=other.getNumberOfTuples(); @@ -437,7 +437,7 @@ DataArrayChar *DataArrayChar::renumber(const int *old2New) const checkAllocated(); int nbTuples=getNumberOfTuples(); int nbOfCompo=getNumberOfComponents(); - MEDCouplingAutoRefCountObjectPtr ret=buildEmptySpecializedDAChar(); + MCAuto ret=buildEmptySpecializedDAChar(); ret->alloc(nbTuples,nbOfCompo); ret->copyStringInfoFrom(*this); const char *iptr=getConstPointer(); @@ -464,7 +464,7 @@ DataArrayChar *DataArrayChar::renumberR(const int *new2Old) const checkAllocated(); int nbTuples=getNumberOfTuples(); int nbOfCompo=getNumberOfComponents(); - MEDCouplingAutoRefCountObjectPtr ret=buildEmptySpecializedDAChar(); + MCAuto ret=buildEmptySpecializedDAChar(); ret->alloc(nbTuples,nbOfCompo); ret->copyStringInfoFrom(*this); const char *iptr=getConstPointer(); @@ -493,7 +493,7 @@ DataArrayChar *DataArrayChar::renumberAndReduce(const int *old2New, int newNbOfT checkAllocated(); int nbTuples=getNumberOfTuples(); int nbOfCompo=getNumberOfComponents(); - MEDCouplingAutoRefCountObjectPtr ret=buildEmptySpecializedDAChar(); + MCAuto ret=buildEmptySpecializedDAChar(); ret->alloc(newNbOfTuple,nbOfCompo); const char *iptr=getConstPointer(); char *optr=ret->getPointer(); @@ -550,7 +550,7 @@ DataArrayChar *DataArrayChar::selectByTupleId(const int *new2OldBg, const int *n DataArrayChar *DataArrayChar::selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const { checkAllocated(); - MEDCouplingAutoRefCountObjectPtr ret=buildEmptySpecializedDAChar(); + MCAuto ret=buildEmptySpecializedDAChar(); int nbComp=getNumberOfComponents(); int oldNbOfTuples=getNumberOfTuples(); ret->alloc((int)std::distance(new2OldBg,new2OldEnd),nbComp); @@ -583,12 +583,12 @@ DataArrayChar *DataArrayChar::selectByTupleIdSafe(const int *new2OldBg, const in * \throw If (\a end2 < \a bg) or (\a step <= 0). * \sa DataArrayChar::substr. */ -DataArrayChar *DataArrayChar::selectByTupleId2(int bg, int end2, int step) const +DataArrayChar *DataArrayChar::selectByTupleIdSafeSlice(int bg, int end2, int step) const { checkAllocated(); - MEDCouplingAutoRefCountObjectPtr ret=buildEmptySpecializedDAChar(); + MCAuto ret=buildEmptySpecializedDAChar(); int nbComp=getNumberOfComponents(); - int newNbOfTuples=GetNumberOfItemGivenBESRelative(bg,end2,step,"DataArrayInt::selectByTupleId2 : "); + int newNbOfTuples=GetNumberOfItemGivenBESRelative(bg,end2,step,"DataArrayInt::selectByTupleIdSafeSlice : "); ret->alloc(newNbOfTuples,nbComp); char *pt=ret->getPointer(); const char *srcPt=getConstPointer()+bg*nbComp; @@ -648,7 +648,7 @@ void DataArrayChar::rearrange(int newNbOfCompo) * Returns a shorten copy of \a this array. The new DataArrayChar contains all * tuples starting from the \a tupleIdBg-th tuple and including all tuples located before * the \a tupleIdEnd-th one. This methods has a similar behavior as std::string::substr(). - * This method is a specialization of selectByTupleId2(). + * This method is a specialization of selectByTupleIdSafeSlice(). * \param [in] tupleIdBg - index of the first tuple to copy from \a this array. * \param [in] tupleIdEnd - index of the tuple before which the tuples to copy are located. * If \a tupleIdEnd == -1, all the tuples till the end of \a this array are copied. @@ -657,7 +657,7 @@ void DataArrayChar::rearrange(int newNbOfCompo) * \throw If \a tupleIdBg < 0. * \throw If \a tupleIdBg > \a this->getNumberOfTuples(). \throw If \a tupleIdEnd != -1 && \a tupleIdEnd < \a this->getNumberOfTuples(). - * \sa DataArrayChar::selectByTupleId2 + * \sa DataArrayChar::selectByTupleIdSafeSlice */ DataArrayChar *DataArrayChar::substr(int tupleIdBg, int tupleIdEnd) const { @@ -676,7 +676,7 @@ DataArrayChar *DataArrayChar::substr(int tupleIdBg, int tupleIdEnd) const else trueEnd=nbt; int nbComp=getNumberOfComponents(); - MEDCouplingAutoRefCountObjectPtr ret=buildEmptySpecializedDAChar(); + MCAuto ret=buildEmptySpecializedDAChar(); ret->alloc(trueEnd-tupleIdBg,nbComp); ret->copyStringInfoFrom(*this); std::copy(getConstPointer()+tupleIdBg*nbComp,getConstPointer()+trueEnd*nbComp,ret->getPointer()); @@ -699,7 +699,7 @@ DataArrayChar *DataArrayChar::substr(int tupleIdBg, int tupleIdEnd) const DataArrayChar *DataArrayChar::changeNbOfComponents(int newNbOfComp, char dftValue) const { checkAllocated(); - MEDCouplingAutoRefCountObjectPtr ret=buildEmptySpecializedDAChar(); + MCAuto ret=buildEmptySpecializedDAChar(); ret->alloc(getNumberOfTuples(),newNbOfComp); const char *oldc=getConstPointer(); char *nc=ret->getPointer(); @@ -741,7 +741,7 @@ DataArrayChar *DataArrayChar::changeNbOfComponents(int newNbOfComp, char dftValu DataArrayChar *DataArrayChar::keepSelectedComponents(const std::vector& compoIds) const { checkAllocated(); - MEDCouplingAutoRefCountObjectPtr ret(buildEmptySpecializedDAChar()); + MCAuto ret(buildEmptySpecializedDAChar()); int newNbOfCompo=(int)compoIds.size(); int oldNbOfCompo=getNumberOfComponents(); for(std::vector::const_iterator it=compoIds.begin();it!=compoIds.end();it++) @@ -1386,27 +1386,27 @@ void DataArrayChar::setContigPartOfSelectedValues(int tupleIdStart, const DataAr * non-empty range of increasing indices or indices are out of a valid range * for the array \a aBase. */ -void DataArrayChar::setContigPartOfSelectedValues2(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step) +void DataArrayChar::setContigPartOfSelectedValuesSlice(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step) { if(!aBase) - throw INTERP_KERNEL::Exception("DataArrayChar::setContigPartOfSelectedValues2 : input DataArray is NULL !"); + throw INTERP_KERNEL::Exception("DataArrayChar::setContigPartOfSelectedValuesSlice : input DataArray is NULL !"); const DataArrayChar *a=dynamic_cast(aBase); if(!a) - throw INTERP_KERNEL::Exception("DataArrayChar::setContigPartOfSelectedValues2 : input DataArray aBase is not a DataArrayChar !"); + throw INTERP_KERNEL::Exception("DataArrayChar::setContigPartOfSelectedValuesSlice : input DataArray aBase is not a DataArrayChar !"); checkAllocated(); a->checkAllocated(); int nbOfComp=getNumberOfComponents(); - const char msg[]="DataArrayChar::setContigPartOfSelectedValues2"; + const char msg[]="DataArrayChar::setContigPartOfSelectedValuesSlice"; int nbOfTupleToWrite=DataArray::GetNumberOfItemGivenBES(bg,end2,step,msg); if(nbOfComp!=a->getNumberOfComponents()) - throw INTERP_KERNEL::Exception("DataArrayChar::setContigPartOfSelectedValues2 : This and a do not have the same number of components !"); + throw INTERP_KERNEL::Exception("DataArrayChar::setContigPartOfSelectedValuesSlice : This and a do not have the same number of components !"); int thisNt=getNumberOfTuples(); int aNt=a->getNumberOfTuples(); char *valsToSet=getPointer()+tupleIdStart*nbOfComp; if(tupleIdStart+nbOfTupleToWrite>thisNt) - throw INTERP_KERNEL::Exception("DataArrayChar::setContigPartOfSelectedValues2 : invalid number range of values to write !"); + throw INTERP_KERNEL::Exception("DataArrayChar::setContigPartOfSelectedValuesSlice : invalid number range of values to write !"); if(end2>aNt) - throw INTERP_KERNEL::Exception("DataArrayChar::setContigPartOfSelectedValues2 : invalid range of values to read !"); + throw INTERP_KERNEL::Exception("DataArrayChar::setContigPartOfSelectedValuesSlice : invalid range of values to read !"); const char *valsSrc=a->getConstPointer()+bg*nbOfComp; for(int i=0;i ret=buildEmptySpecializedDAChar(); + MCAuto ret=buildEmptySpecializedDAChar(); ret->alloc(0,nbOfComp); ret->copyStringInfoFrom(*this); return ret.retn(); @@ -1467,8 +1467,8 @@ DataArray *DataArrayChar::selectByTupleRanges(const std::vector ret=buildEmptySpecializedDAChar(); + return deepCopy(); + MCAuto ret=buildEmptySpecializedDAChar(); ret->alloc(nbOfTuples,nbOfComp); ret->copyStringInfoFrom(*this); const char *src=getConstPointer(); @@ -1551,13 +1551,13 @@ char DataArrayChar::back() const * \throw If \a this is not allocated. * \throw If \a this->getNumberOfComponents() != 1. */ -DataArrayInt *DataArrayChar::getIdsEqual(char val) const +DataArrayInt *DataArrayChar::findIdsEqual(char val) const { checkAllocated(); if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayChar::getIdsEqual : the array must have only one component, you can call 'rearrange' method before !"); + throw INTERP_KERNEL::Exception("DataArrayChar::findIdsEqual : the array must have only one component, you can call 'rearrange' method before !"); const char *cptr=getConstPointer(); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); int nbOfTuples=getNumberOfTuples(); for(int i=0;igetNumberOfComponents() != 1. */ -DataArrayInt *DataArrayChar::getIdsNotEqual(char val) const +DataArrayInt *DataArrayChar::findIdsNotEqual(char val) const { checkAllocated(); if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayChar::getIdsNotEqual : the array must have only one component, you can call 'rearrange' method before !"); + throw INTERP_KERNEL::Exception("DataArrayChar::findIdsNotEqual : the array must have only one component, you can call 'rearrange' method before !"); const char *cptr=getConstPointer(); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); int nbOfTuples=getNumberOfTuples(); for(int i=0;i& vals) const { @@ -1609,7 +1609,7 @@ int DataArrayChar::search(const std::vector& vals) const } /*! - * This method is an extension of DataArrayChar::locateValue method because this method works for DataArrayChar with + * This method is an extension of DataArrayChar::findIdFirstEqual method because this method works for DataArrayChar with * any number of components excepted 0 (an INTERP_KERNEL::Exception is thrown in this case). * This method searches in \b this is there is a tuple that matched the input parameter \b tupl. * If any the tuple id is returned. If not -1 is returned. @@ -1620,15 +1620,15 @@ int DataArrayChar::search(const std::vector& vals) const * \return tuple id where \b tupl is. -1 if no such tuple exists in \b this. * \sa DataArrayChar::search. */ -int DataArrayChar::locateTuple(const std::vector& tupl) const +int DataArrayChar::findIdFirstEqualTuple(const std::vector& tupl) const { checkAllocated(); int nbOfCompo=getNumberOfComponents(); if(nbOfCompo==0) - throw INTERP_KERNEL::Exception("DataArrayChar::locateTuple : 0 components in 'this' !"); + throw INTERP_KERNEL::Exception("DataArrayChar::findIdFirstEqualTuple : 0 components in 'this' !"); if(nbOfCompo!=(int)tupl.size()) { - std::ostringstream oss; oss << "DataArrayChar::locateTuple : 'this' contains " << nbOfCompo << " components and searching for a tuple of length " << tupl.size() << " !"; + std::ostringstream oss; oss << "DataArrayChar::findIdFirstEqualTuple : 'this' contains " << nbOfCompo << " components and searching for a tuple of length " << tupl.size() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } const char *cptr=getConstPointer(); @@ -1653,11 +1653,11 @@ int DataArrayChar::locateTuple(const std::vector& tupl) const * This method searches in \b this is there is a tuple that matched the input parameter \b tupl. * This method throws an INTERP_KERNEL::Exception if the number of components in \b this mismatches with the size of * the input vector. An INTERP_KERNEL::Exception is thrown too if \b this is not allocated. - * \sa DataArrayChar::locateTuple + * \sa DataArrayChar::findIdFirstEqualTuple */ bool DataArrayChar::presenceOfTuple(const std::vector& tupl) const { - return locateTuple(tupl)!=-1; + return findIdFirstEqualTuple(tupl)!=-1; } /*! @@ -1666,22 +1666,22 @@ bool DataArrayChar::presenceOfTuple(const std::vector& tupl) const * \return bool - \a true in case if \a value is present within \a this array. * \throw If \a this is not allocated. * \throw If \a this->getNumberOfComponents() != 1. - * \sa locateValue() + * \sa findIdFirstEqual() */ bool DataArrayChar::presenceOfValue(char value) const { - return locateValue(value)!=-1; + return findIdFirstEqual(value)!=-1; } /*! * This method expects to be called when number of components of this is equal to one. * This method returns true if it exists a tuple so that the value is contained in \b vals. * If not any tuple contains one of the values contained in 'vals' false is returned. - * \sa DataArrayChar::locateValue + * \sa DataArrayChar::findIdFirstEqual */ bool DataArrayChar::presenceOfValue(const std::vector& vals) const { - return locateValue(vals)!=-1; + return findIdFirstEqual(vals)!=-1; } /*! @@ -1690,7 +1690,7 @@ bool DataArrayChar::presenceOfValue(const std::vector& vals) const * If not any tuple contains \b value -1 is returned. * \sa DataArrayChar::presenceOfValue */ -int DataArrayChar::locateValue(char value) const +int DataArrayChar::findIdFirstEqual(char value) const { checkAllocated(); if(getNumberOfComponents()!=1) @@ -1709,7 +1709,7 @@ int DataArrayChar::locateValue(char value) const * If not any tuple contains one of the values contained in 'vals' false is returned. * \sa DataArrayChar::presenceOfValue */ -int DataArrayChar::locateValue(const std::vector& vals) const +int DataArrayChar::findIdFirstEqual(const std::vector& vals) const { checkAllocated(); if(getNumberOfComponents()!=1) @@ -1800,13 +1800,13 @@ char DataArrayChar::getMinValueInArray() const * \param [in] vmax end of range. This value is \b not included in range. * \return a newly allocated data array that the caller should deal with. */ -DataArrayInt *DataArrayChar::getIdsInRange(char vmin, char vmax) const +DataArrayInt *DataArrayChar::findIdsInRange(char vmin, char vmax) const { checkAllocated(); if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayChar::getIdsInRange : this must have exactly one component !"); + throw INTERP_KERNEL::Exception("DataArrayChar::findIdsInRange : this must have exactly one component !"); const char *cptr=getConstPointer(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); ret->alloc(0,1); + MCAuto ret=DataArrayInt::New(); ret->alloc(0,1); int nbOfTuples=getNumberOfTuples(); for(int i=0;i=vmin && *cptr throw INTERP_KERNEL::Exception("DataArrayChar::Aggregate : Nb of components mismatch for array aggregation !"); nbt+=(*it)->getNumberOfTuples(); } - MEDCouplingAutoRefCountObjectPtr ret=a[0]->buildEmptySpecializedDAChar(); + MCAuto ret=a[0]->buildEmptySpecializedDAChar(); ret->alloc(nbt,nbOfComp); char *pt=ret->getPointer(); for(it=a.begin();it!=a.end();it++) @@ -2002,7 +2002,7 @@ DataArrayByteIterator *DataArrayByte::iterator() * \ref MEDCouplingArrayBasicsCopyDeep. * \return DataArrayByte * - a new instance of DataArrayByte. */ -DataArrayByte *DataArrayByte::deepCpy() const +DataArrayByte *DataArrayByte::deepCopy() const { return new DataArrayByte(*this); } @@ -2014,10 +2014,10 @@ DataArrayByte *DataArrayByte::deepCpy() const * \return DataArrayByte * - either a new instance of DataArrayByte (if \a dCpy * == \a true) or \a this instance (if \a dCpy == \a false). */ -DataArrayByte *DataArrayByte::performCpy(bool dCpy) const +DataArrayByte *DataArrayByte::performCopyOrIncrRef(bool dCpy) const { if(dCpy) - return deepCpy(); + return deepCopy(); else { incrRef(); @@ -2354,7 +2354,7 @@ DataArrayAsciiCharIterator *DataArrayAsciiChar::iterator() * \ref MEDCouplingArrayBasicsCopyDeep. * \return DataArrayAsciiChar * - a new instance of DataArrayAsciiChar. */ -DataArrayAsciiChar *DataArrayAsciiChar::deepCpy() const +DataArrayAsciiChar *DataArrayAsciiChar::deepCopy() const { return new DataArrayAsciiChar(*this); } @@ -2366,10 +2366,10 @@ DataArrayAsciiChar *DataArrayAsciiChar::deepCpy() const * \return DataArrayAsciiChar * - either a new instance of DataArrayAsciiChar (if \a dCpy * == \a true) or \a this instance (if \a dCpy == \a false). */ -DataArrayAsciiChar *DataArrayAsciiChar::performCpy(bool dCpy) const +DataArrayAsciiChar *DataArrayAsciiChar::performCopyOrIncrRef(bool dCpy) const { if(dCpy) - return deepCpy(); + return deepCopy(); else { incrRef(); diff --git a/src/MEDCoupling/MEDCouplingMesh.cxx b/src/MEDCoupling/MEDCouplingMesh.cxx index 1489d823a..cb391ce16 100644 --- a/src/MEDCoupling/MEDCouplingMesh.cxx +++ b/src/MEDCoupling/MEDCouplingMesh.cxx @@ -23,7 +23,7 @@ #include "MEDCouplingMemArray.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingFieldDiscretization.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include #include @@ -269,7 +269,7 @@ MEDCouplingMesh *MEDCouplingMesh::buildPartRange(int beginCellIds, int endCellId } else { - MEDCouplingAutoRefCountObjectPtr cellIds=DataArrayInt::Range(beginCellIds,endCellIds,stepCellIds); + MCAuto cellIds=DataArrayInt::Range(beginCellIds,endCellIds,stepCellIds); return buildPart(cellIds->begin(),cellIds->end()); } } @@ -281,7 +281,7 @@ MEDCouplingMesh *MEDCouplingMesh::buildPartRange(int beginCellIds, int endCellId */ MEDCouplingMesh *MEDCouplingMesh::buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt*& arr) const { - MEDCouplingAutoRefCountObjectPtr cellIds=DataArrayInt::Range(beginCellIds,endCellIds,stepCellIds); + MCAuto cellIds=DataArrayInt::Range(beginCellIds,endCellIds,stepCellIds); return buildPartAndReduceNodes(cellIds->begin(),cellIds->end(),arr); } @@ -303,7 +303,7 @@ MEDCouplingMesh *MEDCouplingMesh::buildPartRangeAndReduceNodes(int beginCellIds, */ MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic(TypeOfField t, int nbOfComp, FunctionToEvaluate func) const { - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingFieldDouble::New(t,ONE_TIME); + MCAuto ret=MEDCouplingFieldDouble::New(t,ONE_TIME); ret->setMesh(this); ret->fillFromAnalytic(nbOfComp,func); ret->synchronizeTimeWithSupport(); @@ -378,7 +378,7 @@ void MEDCouplingMesh::copyTinyInfoFrom(const MEDCouplingMesh *other) */ MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const { - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingFieldDouble::New(t,ONE_TIME); + MCAuto ret=MEDCouplingFieldDouble::New(t,ONE_TIME); ret->setMesh(this); ret->fillFromAnalytic(nbOfComp,func); ret->synchronizeTimeWithSupport(); @@ -428,11 +428,11 @@ MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic(TypeOfField t, int nbO * \ref py_mcmesh_fillFromAnalytic2 "Here is a Python example". * \endif */ -MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const +MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalyticCompo(TypeOfField t, int nbOfComp, const std::string& func) const { - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingFieldDouble::New(t,ONE_TIME); + MCAuto ret=MEDCouplingFieldDouble::New(t,ONE_TIME); ret->setMesh(this); - ret->fillFromAnalytic2(nbOfComp,func); + ret->fillFromAnalyticCompo(nbOfComp,func); ret->synchronizeTimeWithSupport(); return ret.retn(); } @@ -481,11 +481,11 @@ MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic2(TypeOfField t, int nb * \ref py_mcmesh_fillFromAnalytic3 "Here is a Python example". * \endif */ -MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector& varsOrder, const std::string& func) const +MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalyticNamedCompo(TypeOfField t, int nbOfComp, const std::vector& varsOrder, const std::string& func) const { - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingFieldDouble::New(t,ONE_TIME); + MCAuto ret=MEDCouplingFieldDouble::New(t,ONE_TIME); ret->setMesh(this); - ret->fillFromAnalytic3(nbOfComp,varsOrder,func); + ret->fillFromAnalyticNamedCompo(nbOfComp,varsOrder,func); ret->synchronizeTimeWithSupport(); return ret.retn(); } @@ -532,7 +532,7 @@ MEDCouplingMesh *MEDCouplingMesh::MergeMeshes(const MEDCouplingMesh *mesh1, cons */ MEDCouplingMesh *MEDCouplingMesh::MergeMeshes(std::vector& meshes) { - std::vector< MEDCouplingAutoRefCountObjectPtr > ms1(meshes.size()); + std::vector< MCAuto > ms1(meshes.size()); std::vector< const MEDCouplingUMesh * > ms2(meshes.size()); for(std::size_t i=0;i& elts, MEDCouplingAutoRefCountObjectPtr& eltsIndex) const +void MEDCouplingMesh::getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const { eltsIndex=DataArrayInt::New(); elts=DataArrayInt::New(); eltsIndex->alloc(nbOfPoints+1,1); eltsIndex->setIJ(0,0,0); elts->alloc(0,1); int *eltsIndexPtr(eltsIndex->getPointer()); @@ -700,7 +700,7 @@ std::string MEDCouplingMesh::writeVTK(const std::string& fileName, bool isBinary std::string ret(getVTKFileNameOf(fileName)); // std::string cda,pda; - MEDCouplingAutoRefCountObjectPtr byteArr; + MCAuto byteArr; if(isBinary) { byteArr=DataArrayByte::New(); byteArr->alloc(0,1); } writeVTKAdvanced(ret,cda,pda,byteArr); diff --git a/src/MEDCoupling/MEDCouplingMesh.hxx b/src/MEDCoupling/MEDCouplingMesh.hxx index bd7ff08d9..8e8986ecb 100644 --- a/src/MEDCoupling/MEDCouplingMesh.hxx +++ b/src/MEDCoupling/MEDCouplingMesh.hxx @@ -25,7 +25,7 @@ #include "MEDCouplingTimeLabel.hxx" #include "MEDCouplingRefCountObject.hxx" #include "NormalizedUnstructuredMesh.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "InterpKernelException.hxx" @@ -67,7 +67,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual MEDCouplingMeshType getType() const = 0; MEDCOUPLING_EXPORT bool isStructured() const; // Copy methods - MEDCOUPLING_EXPORT virtual MEDCouplingMesh *deepCpy() const = 0; + MEDCOUPLING_EXPORT virtual MEDCouplingMesh *deepCopy() const = 0; MEDCOUPLING_EXPORT virtual MEDCouplingMesh *clone(bool recDeepCpy) const = 0; MEDCOUPLING_EXPORT virtual void copyTinyStringsFrom(const MEDCouplingMesh *other); MEDCOUPLING_EXPORT virtual void copyTinyInfoFrom(const MEDCouplingMesh *other); @@ -83,14 +83,14 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec, DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const; // - MEDCOUPLING_EXPORT virtual void checkCoherency() const = 0; - MEDCOUPLING_EXPORT virtual void checkCoherency1(double eps=1e-12) const = 0; + MEDCOUPLING_EXPORT virtual void checkConsistencyLight() const = 0; + MEDCOUPLING_EXPORT virtual void checkConsistency(double eps=1e-12) const = 0; MEDCOUPLING_EXPORT virtual int getNumberOfCells() const = 0; MEDCOUPLING_EXPORT virtual int getNumberOfNodes() const = 0; MEDCOUPLING_EXPORT virtual int getSpaceDimension() const = 0; MEDCOUPLING_EXPORT virtual int getMeshDimension() const = 0; MEDCOUPLING_EXPORT virtual DataArrayDouble *getCoordinatesAndOwner() const = 0; - MEDCOUPLING_EXPORT virtual DataArrayDouble *getBarycenterAndOwner() const = 0; + MEDCOUPLING_EXPORT virtual DataArrayDouble *computeCellCenterOfMass() const = 0; MEDCOUPLING_EXPORT virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const = 0; MEDCOUPLING_EXPORT virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const = 0; MEDCOUPLING_EXPORT virtual DataArrayInt *computeNbOfNodesPerCell() const = 0; @@ -113,11 +113,11 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const = 0; MEDCOUPLING_EXPORT virtual int getCellContainingPoint(const double *pos, double eps) const = 0; MEDCOUPLING_EXPORT virtual void getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const; - MEDCOUPLING_EXPORT virtual void getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, MEDCouplingAutoRefCountObjectPtr& elts, MEDCouplingAutoRefCountObjectPtr& eltsIndex) const; + MEDCOUPLING_EXPORT virtual void getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const; MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, FunctionToEvaluate func) const; MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const; - MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const; - MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector& varsOrder, const std::string& func) const; + MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *fillFromAnalyticCompo(TypeOfField t, int nbOfComp, const std::string& func) const; + MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *fillFromAnalyticNamedCompo(TypeOfField t, int nbOfComp, const std::vector& varsOrder, const std::string& func) const; MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *buildOrthogonalField() const = 0; MEDCOUPLING_EXPORT virtual void rotate(const double *center, const double *vector, double angle) = 0; MEDCOUPLING_EXPORT virtual void translate(const double *vector) = 0; diff --git a/src/MEDCoupling/MEDCouplingMultiFields.cxx b/src/MEDCoupling/MEDCouplingMultiFields.cxx index d7d4e9b89..11c41877d 100644 --- a/src/MEDCoupling/MEDCouplingMultiFields.cxx +++ b/src/MEDCoupling/MEDCouplingMultiFields.cxx @@ -22,7 +22,7 @@ #include "MEDCouplingFieldTemplate.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingMesh.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include #include @@ -39,7 +39,7 @@ MEDCouplingMultiFields *MEDCouplingMultiFields::New() return new MEDCouplingMultiFields; } -MEDCouplingMultiFields *MEDCouplingMultiFields::deepCpy() const +MEDCouplingMultiFields *MEDCouplingMultiFields::deepCopy() const { return new MEDCouplingMultiFields(*this); } @@ -80,7 +80,7 @@ bool MEDCouplingMultiFields::isEqual(const MEDCouplingMultiFields *other, double std::string MEDCouplingMultiFields::getName() const { - std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fs.begin(); + std::vector< MCAuto >::const_iterator it=_fs.begin(); for(;it!=_fs.end();it++) if((const MEDCouplingFieldDouble *)(*it)) return (*it)->getName(); @@ -89,7 +89,7 @@ std::string MEDCouplingMultiFields::getName() const std::string MEDCouplingMultiFields::getDescription() const { - std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fs.begin(); + std::vector< MCAuto >::const_iterator it=_fs.begin(); for(;it!=_fs.end();it++) if((const MEDCouplingFieldDouble *)(*it)) return (*it)->getDescription(); @@ -98,7 +98,7 @@ std::string MEDCouplingMultiFields::getDescription() const std::string MEDCouplingMultiFields::getTimeUnit() const { - std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fs.begin(); + std::vector< MCAuto >::const_iterator it=_fs.begin(); for(;it!=_fs.end();it++) if((const MEDCouplingFieldDouble *)(*it)) return (*it)->getTimeUnit(); @@ -107,7 +107,7 @@ std::string MEDCouplingMultiFields::getTimeUnit() const double MEDCouplingMultiFields::getTimeResolution() const { - std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fs.begin(); + std::vector< MCAuto >::const_iterator it=_fs.begin(); for(;it!=_fs.end();it++) if((const MEDCouplingFieldDouble *)(*it)) return (*it)->getTimeTolerance(); @@ -180,7 +180,7 @@ const MEDCouplingFieldDouble *MEDCouplingMultiFields::getFieldAtPos(int id) cons void MEDCouplingMultiFields::updateTime() const { - std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fs.begin(); + std::vector< MCAuto >::const_iterator it=_fs.begin(); for(;it!=_fs.end();it++) if((const MEDCouplingFieldDouble *)(*it)) (*it)->updateTime(); @@ -198,7 +198,7 @@ std::size_t MEDCouplingMultiFields::getHeapMemorySizeWithoutChildren() const std::vector MEDCouplingMultiFields::getDirectChildrenWithNull() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fs.begin();it!=_fs.end();it++) + for(std::vector< MCAuto >::const_iterator it=_fs.begin();it!=_fs.end();it++) ret.push_back((const MEDCouplingFieldDouble *)*it); return ret; } @@ -206,7 +206,7 @@ std::vector MEDCouplingMultiFields::getDirectChildrenWi std::vector MEDCouplingMultiFields::getMeshes() const { std::vector ms; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fs.begin();it!=_fs.end();it++) + for(std::vector< MCAuto >::const_iterator it=_fs.begin();it!=_fs.end();it++) { const MEDCouplingMesh *m=0; if((const MEDCouplingFieldDouble *)(*it)) @@ -221,7 +221,7 @@ std::vector MEDCouplingMultiFields::getDifferentMeshes(std::v refs.resize(_fs.size()); std::vector ms; int id=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fs.begin();it!=_fs.end();it++,id++) + for(std::vector< MCAuto >::const_iterator it=_fs.begin();it!=_fs.end();it++,id++) { const MEDCouplingMesh *m=0; if((const MEDCouplingFieldDouble *)(*it)) @@ -246,7 +246,7 @@ std::vector MEDCouplingMultiFields::getDifferentMeshes(std::v std::vector MEDCouplingMultiFields::getArrays() const { std::vector tmp; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fs.begin();it!=_fs.end();it++) + for(std::vector< MCAuto >::const_iterator it=_fs.begin();it!=_fs.end();it++) { std::vector tmp2=(*it)->getArrays(); tmp.insert(tmp.end(),tmp2.begin(),tmp2.end()); @@ -259,7 +259,7 @@ std::vector MEDCouplingMultiFields::getDifferentArrays(std::v refs.resize(_fs.size()); int id=0; std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fs.begin();it!=_fs.end();it++,id++) + for(std::vector< MCAuto >::const_iterator it=_fs.begin();it!=_fs.end();it++,id++) { std::vector tmp2; if((const MEDCouplingFieldDouble *)(*it)) @@ -290,14 +290,14 @@ std::vector MEDCouplingMultiFields::getDifferentArrays(std::v return ret; } -void MEDCouplingMultiFields::checkCoherency() const +void MEDCouplingMultiFields::checkConsistencyLight() const { - std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fs.begin(); + std::vector< MCAuto >::const_iterator it=_fs.begin(); for(;it!=_fs.end();it++) { if((const MEDCouplingFieldDouble *)(*it)==0) - throw INTERP_KERNEL::Exception("MEDCouplingMultiFields::checkCoherency : There is an empty Field in array..."); - (*it)->checkCoherency(); + throw INTERP_KERNEL::Exception("MEDCouplingMultiFields::checkConsistencyLight : There is an empty Field in array..."); + (*it)->checkConsistencyLight(); } } @@ -310,14 +310,14 @@ MEDCouplingMultiFields::MEDCouplingMultiFields(const std::vectorincrRef(); else throw INTERP_KERNEL::Exception("MEDCouplingMultiFields constructor : empty field found in vector !"); - (*it)->checkCoherency(); + (*it)->checkConsistencyLight(); _fs[id]=*it; } } /*! - * Performs deepCpy. + * Performs deepCopy. */ MEDCouplingMultiFields::MEDCouplingMultiFields(const MEDCouplingMultiFields& other):RefCountObject(other) { @@ -327,14 +327,14 @@ MEDCouplingMultiFields::MEDCouplingMultiFields(const MEDCouplingMultiFields& oth std::vector< std::vector > refs2; std::vector ms=other.getDifferentMeshes(refs); std::size_t msLgh=ms.size(); - std::vector< MEDCouplingAutoRefCountObjectPtr > ms2(msLgh); + std::vector< MCAuto > ms2(msLgh); for(std::size_t i=0;ideepCpy(); + ms2[i]=ms[i]->deepCopy(); std::vector das=other.getDifferentArrays(refs2); std::size_t dasLgth=das.size(); - std::vector< MEDCouplingAutoRefCountObjectPtr > das2(dasLgth); + std::vector< MCAuto > das2(dasLgth); for(std::size_t i=0;ideepCpy(); + das2[i]=das[i]->deepCopy(); for(std::size_t i=0;i& fs); MEDCOUPLING_EXPORT static MEDCouplingMultiFields *New(); - MEDCOUPLING_EXPORT MEDCouplingMultiFields *deepCpy() const; + MEDCOUPLING_EXPORT MEDCouplingMultiFields *deepCopy() const; MEDCOUPLING_EXPORT std::string getName() const; MEDCOUPLING_EXPORT std::string getDescription() const; MEDCOUPLING_EXPORT std::string getTimeUnit() const; @@ -65,13 +65,13 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& ft, const std::vector& ms, const std::vector& das); - MEDCOUPLING_EXPORT virtual void checkCoherency() const; + MEDCOUPLING_EXPORT virtual void checkConsistencyLight() const; protected: MEDCOUPLING_EXPORT MEDCouplingMultiFields(const std::vector& fs); MEDCOUPLING_EXPORT MEDCouplingMultiFields(const MEDCouplingMultiFields& other); MEDCOUPLING_EXPORT MEDCouplingMultiFields(); protected: - std::vector< MEDCouplingAutoRefCountObjectPtr > _fs; + std::vector< MCAuto > _fs; }; } diff --git a/src/MEDCoupling/MEDCouplingNatureOfField.cxx b/src/MEDCoupling/MEDCouplingNatureOfField.cxx index 34cf41cd1..94bd56c6c 100644 --- a/src/MEDCoupling/MEDCouplingNatureOfField.cxx +++ b/src/MEDCoupling/MEDCouplingNatureOfField.cxx @@ -27,10 +27,10 @@ namespace MEDCoupling { const char *MEDCouplingNatureOfField::REPR_OF_NATUREOFFIELD[NB_OF_POSSIBILITIES]= { "NoNature", - "ConservativeVolumic", - "Integral", - "IntegralGlobConstraint", - "RevIntegral"}; + "IntensiveMaximum", + "ExtensiveMaximum", + "ExtensiveConservation", + "IntensiveConservation"}; const int MEDCouplingNatureOfField::POS_OF_NATUREOFFIELD[NB_OF_POSSIBILITIES]={17,26,32,35,37}; diff --git a/src/MEDCoupling/MEDCouplingNatureOfFieldEnum b/src/MEDCoupling/MEDCouplingNatureOfFieldEnum index 45823ce61..877d19439 100644 --- a/src/MEDCoupling/MEDCouplingNatureOfFieldEnum +++ b/src/MEDCoupling/MEDCouplingNatureOfFieldEnum @@ -26,10 +26,10 @@ namespace MEDCoupling typedef enum { NoNature = 17, - ConservativeVolumic = 26, - Integral = 32, - IntegralGlobConstraint = 35, - RevIntegral = 37 + IntensiveMaximum = 26, + ExtensiveMaximum = 32, + ExtensiveConservation = 35, + IntensiveConservation = 37 } NatureOfField; } diff --git a/src/MEDCoupling/MEDCouplingPartDefinition.cxx b/src/MEDCoupling/MEDCouplingPartDefinition.cxx index 5113adf1b..86b07eb82 100644 --- a/src/MEDCoupling/MEDCouplingPartDefinition.cxx +++ b/src/MEDCoupling/MEDCouplingPartDefinition.cxx @@ -32,17 +32,17 @@ PartDefinition *PartDefinition::New(DataArrayInt *listOfIds) return DataArrayPartDefinition::New(listOfIds); } -PartDefinition *PartDefinition::Unserialize(std::vector& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr >& bigArraysI) +PartDefinition *PartDefinition::Unserialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) { if(tinyInt.empty()) { - MEDCouplingAutoRefCountObjectPtr ret(DataArrayPartDefinition::New(bigArraysI.back())); + MCAuto ret(DataArrayPartDefinition::New(bigArraysI.back())); bigArraysI.pop_back(); return ret.retn(); } else if(tinyInt.size()==3) { - MEDCouplingAutoRefCountObjectPtr ret(SlicePartDefinition::New(tinyInt[0],tinyInt[1],tinyInt[2])); + MCAuto ret(SlicePartDefinition::New(tinyInt[0],tinyInt[1],tinyInt[2])); tinyInt.erase(tinyInt.begin(),tinyInt.begin()+3); return ret.retn(); } @@ -90,11 +90,11 @@ bool DataArrayPartDefinition::isEqual(const PartDefinition *other, std::string& return true; } -DataArrayPartDefinition *DataArrayPartDefinition::deepCpy() const +DataArrayPartDefinition *DataArrayPartDefinition::deepCopy() const { const DataArrayInt *arr(_arr); if(!arr) - throw INTERP_KERNEL::Exception("DataArrayPartDefinition::deepCpy : array is null !"); + throw INTERP_KERNEL::Exception("DataArrayPartDefinition::deepCopy : array is null !"); return DataArrayPartDefinition::New(const_cast(arr)); } @@ -137,8 +137,8 @@ PartDefinition *DataArrayPartDefinition::composeWith(const PartDefinition *other { if(!other) throw INTERP_KERNEL::Exception("DataArrayPartDefinition::composeWith : input PartDef must be not NULL !"); - checkCoherency(); - other->checkCoherency(); + checkConsistencyLight(); + other->checkConsistencyLight(); const SlicePartDefinition *spd(dynamic_cast(other)); if(spd) {//special case for optim @@ -146,19 +146,19 @@ PartDefinition *DataArrayPartDefinition::composeWith(const PartDefinition *other spd->getSlice(a,b,c); if(c==1) { - MEDCouplingAutoRefCountObjectPtr arr(DataArrayInt::New()); + MCAuto arr(DataArrayInt::New()); arr->alloc(_arr->getNumberOfTuples(),1); std::transform(_arr->begin(),_arr->end(),arr->getPointer(),std::bind2nd(std::plus(),a)); return DataArrayPartDefinition::New(arr); } } // - MEDCouplingAutoRefCountObjectPtr arr1(other->toDAI()); - MEDCouplingAutoRefCountObjectPtr arr2(arr1->selectByTupleIdSafe(_arr->begin(),_arr->end())); + MCAuto arr1(other->toDAI()); + MCAuto arr2(arr1->selectByTupleIdSafe(_arr->begin(),_arr->end())); return DataArrayPartDefinition::New(arr2); } -void DataArrayPartDefinition::checkCoherency() const +void DataArrayPartDefinition::checkConsistencyLight() const { CheckInternalArrayOK(_arr); } @@ -170,7 +170,7 @@ void DataArrayPartDefinition::checkCoherency() const */ PartDefinition *DataArrayPartDefinition::tryToSimplify() const { - checkCoherency(); + checkConsistencyLight(); int a(0),b(0),c(0); if(_arr->isRange(a,b,c)) { @@ -184,7 +184,7 @@ PartDefinition *DataArrayPartDefinition::tryToSimplify() const } } -void DataArrayPartDefinition::serialize(std::vector& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr >& bigArraysI) const +void DataArrayPartDefinition::serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const { bigArraysI.push_back(_arr); } @@ -235,16 +235,16 @@ std::vector DataArrayPartDefinition::getDirectChildrenW DataArrayPartDefinition *DataArrayPartDefinition::add1(const DataArrayPartDefinition *other) const { - MEDCouplingAutoRefCountObjectPtr a1(toDAI()),a2(other->toDAI()); - MEDCouplingAutoRefCountObjectPtr a3(DataArrayInt::Aggregate(a1,a2,0)); + MCAuto a1(toDAI()),a2(other->toDAI()); + MCAuto a3(DataArrayInt::Aggregate(a1,a2,0)); a3->sort(); return DataArrayPartDefinition::New(a3); } DataArrayPartDefinition *DataArrayPartDefinition::add2(const SlicePartDefinition *other) const { - MEDCouplingAutoRefCountObjectPtr a1(toDAI()),a2(other->toDAI()); - MEDCouplingAutoRefCountObjectPtr a3(DataArrayInt::Aggregate(a1,a2,0)); + MCAuto a1(toDAI()),a2(other->toDAI()); + MCAuto a3(DataArrayInt::Aggregate(a1,a2,0)); a3->sort(); return DataArrayPartDefinition::New(a3); } @@ -280,7 +280,7 @@ bool SlicePartDefinition::isEqual(const PartDefinition *other, std::string& what return true; } -SlicePartDefinition *SlicePartDefinition::deepCpy() const +SlicePartDefinition *SlicePartDefinition::deepCopy() const { return SlicePartDefinition::New(_start,_stop,_step); } @@ -317,17 +317,17 @@ PartDefinition *SlicePartDefinition::composeWith(const PartDefinition *other) co { if(!other) throw INTERP_KERNEL::Exception("SlicePartDefinition::composeWith : input PartDef must be not NULL !"); - checkCoherency(); - other->checkCoherency(); - MEDCouplingAutoRefCountObjectPtr arr(other->toDAI()); - MEDCouplingAutoRefCountObjectPtr arr1(arr->selectByTupleId2(_start,_stop,_step)); + checkConsistencyLight(); + other->checkConsistencyLight(); + MCAuto arr(other->toDAI()); + MCAuto arr1(arr->selectByTupleIdSafeSlice(_start,_stop,_step)); return DataArrayPartDefinition::New(arr1); } /*! * Do nothing it is not a bug. */ -void SlicePartDefinition::checkCoherency() const +void SlicePartDefinition::checkConsistencyLight() const { } @@ -343,7 +343,7 @@ PartDefinition *SlicePartDefinition::tryToSimplify() const return ret; } -void SlicePartDefinition::serialize(std::vector& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr >& bigArraysI) const +void SlicePartDefinition::serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const { tinyInt.push_back(_start); tinyInt.push_back(_stop); @@ -393,8 +393,8 @@ std::vector SlicePartDefinition::getDirectChildrenWithN DataArrayPartDefinition *SlicePartDefinition::add1(const DataArrayPartDefinition *other) const { - MEDCouplingAutoRefCountObjectPtr a1(toDAI()),a2(other->toDAI()); - MEDCouplingAutoRefCountObjectPtr a3(DataArrayInt::Aggregate(a1,a2,0)); + MCAuto a1(toDAI()),a2(other->toDAI()); + MCAuto a3(DataArrayInt::Aggregate(a1,a2,0)); a3->sort(); return DataArrayPartDefinition::New(a3); } @@ -407,8 +407,8 @@ PartDefinition *SlicePartDefinition::add2(const SlicePartDefinition *other) cons } else { - MEDCouplingAutoRefCountObjectPtr a1(toDAI()),a2(other->toDAI()); - MEDCouplingAutoRefCountObjectPtr a3(DataArrayInt::Aggregate(a1,a2,0)); + MCAuto a1(toDAI()),a2(other->toDAI()); + MCAuto a3(DataArrayInt::Aggregate(a1,a2,0)); a3->sort(); return DataArrayPartDefinition::New(a3); } diff --git a/src/MEDCoupling/MEDCouplingPartDefinition.hxx b/src/MEDCoupling/MEDCouplingPartDefinition.hxx index ed106edb4..096cb877f 100644 --- a/src/MEDCoupling/MEDCouplingPartDefinition.hxx +++ b/src/MEDCoupling/MEDCouplingPartDefinition.hxx @@ -23,7 +23,7 @@ #include "MEDCoupling.hxx" #include "MEDCouplingMemArray.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" namespace MEDCoupling { @@ -32,17 +32,17 @@ namespace MEDCoupling public: MEDCOUPLING_EXPORT static PartDefinition *New(int start, int stop, int step); MEDCOUPLING_EXPORT static PartDefinition *New(DataArrayInt *listOfIds); - MEDCOUPLING_EXPORT static PartDefinition *Unserialize(std::vector& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr >& bigArraysI); + MEDCOUPLING_EXPORT static PartDefinition *Unserialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI); MEDCOUPLING_EXPORT virtual bool isEqual(const PartDefinition *other, std::string& what) const = 0; - MEDCOUPLING_EXPORT virtual PartDefinition *deepCpy() const = 0; + MEDCOUPLING_EXPORT virtual PartDefinition *deepCopy() const = 0; MEDCOUPLING_EXPORT virtual DataArrayInt *toDAI() const = 0; MEDCOUPLING_EXPORT virtual int getNumberOfElems() const = 0; MEDCOUPLING_EXPORT virtual PartDefinition *operator+(const PartDefinition& other) const = 0; MEDCOUPLING_EXPORT virtual std::string getRepr() const = 0; MEDCOUPLING_EXPORT virtual PartDefinition *composeWith(const PartDefinition *other) const = 0; - MEDCOUPLING_EXPORT virtual void checkCoherency() const = 0; + MEDCOUPLING_EXPORT virtual void checkConsistencyLight() const = 0; MEDCOUPLING_EXPORT virtual PartDefinition *tryToSimplify() const = 0; - MEDCOUPLING_EXPORT virtual void serialize(std::vector& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr >& bigArraysI) const = 0; + MEDCOUPLING_EXPORT virtual void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const = 0; protected: virtual ~PartDefinition(); }; @@ -54,15 +54,15 @@ namespace MEDCoupling public: MEDCOUPLING_EXPORT static DataArrayPartDefinition *New(DataArrayInt *listOfIds); MEDCOUPLING_EXPORT bool isEqual(const PartDefinition *other, std::string& what) const; - MEDCOUPLING_EXPORT DataArrayPartDefinition *deepCpy() const; + MEDCOUPLING_EXPORT DataArrayPartDefinition *deepCopy() const; MEDCOUPLING_EXPORT DataArrayInt *toDAI() const; MEDCOUPLING_EXPORT int getNumberOfElems() const; MEDCOUPLING_EXPORT PartDefinition *operator+(const PartDefinition& other) const; MEDCOUPLING_EXPORT std::string getRepr() const; MEDCOUPLING_EXPORT PartDefinition *composeWith(const PartDefinition *other) const; - MEDCOUPLING_EXPORT void checkCoherency() const; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; MEDCOUPLING_EXPORT PartDefinition *tryToSimplify() const; - MEDCOUPLING_EXPORT void serialize(std::vector& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr >& bigArraysI) const; + MEDCOUPLING_EXPORT void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const; private: DataArrayPartDefinition(DataArrayInt *listOfIds); void checkInternalArrayOK() const; @@ -74,7 +74,7 @@ namespace MEDCoupling DataArrayPartDefinition *add2(const SlicePartDefinition *other) const; virtual ~DataArrayPartDefinition(); private: - MEDCouplingAutoRefCountObjectPtr _arr; + MCAuto _arr; }; class SlicePartDefinition : public PartDefinition @@ -82,15 +82,15 @@ namespace MEDCoupling public: MEDCOUPLING_EXPORT static SlicePartDefinition *New(int start, int stop, int step); MEDCOUPLING_EXPORT bool isEqual(const PartDefinition *other, std::string& what) const; - MEDCOUPLING_EXPORT SlicePartDefinition *deepCpy() const; + MEDCOUPLING_EXPORT SlicePartDefinition *deepCopy() const; MEDCOUPLING_EXPORT DataArrayInt *toDAI() const; MEDCOUPLING_EXPORT int getNumberOfElems() const; MEDCOUPLING_EXPORT PartDefinition *operator+(const PartDefinition& other) const; MEDCOUPLING_EXPORT std::string getRepr() const; MEDCOUPLING_EXPORT PartDefinition *composeWith(const PartDefinition *other) const; - MEDCOUPLING_EXPORT void checkCoherency() const; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; MEDCOUPLING_EXPORT PartDefinition *tryToSimplify() const; - MEDCOUPLING_EXPORT void serialize(std::vector& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr >& bigArraysI) const; + MEDCOUPLING_EXPORT void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const; //specific method MEDCOUPLING_EXPORT int getEffectiveStop() const; MEDCOUPLING_EXPORT void getSlice(int& start, int& stop, int& step) const; diff --git a/src/MEDCoupling/MEDCouplingPointSet.cxx b/src/MEDCoupling/MEDCouplingPointSet.cxx index 10ad943d0..1710b932d 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.cxx +++ b/src/MEDCoupling/MEDCouplingPointSet.cxx @@ -19,7 +19,7 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDCouplingPointSet.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "MEDCoupling1GTUMesh.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingMemArray.hxx" @@ -42,7 +42,7 @@ MEDCouplingPointSet::MEDCouplingPointSet():_coords(0) MEDCouplingPointSet::MEDCouplingPointSet(const MEDCouplingPointSet& other, bool deepCopy):MEDCouplingMesh(other),_coords(0) { if(other._coords) - _coords=other._coords->performCpy(deepCopy); + _coords=other._coords->performCopyOrIncrRef(deepCopy); } MEDCouplingPointSet::~MEDCouplingPointSet() @@ -265,7 +265,7 @@ DataArrayInt *MEDCouplingPointSet::buildPermArrayForMergeNode(double precision, DataArrayInt *comm,*commI; findCommonNodes(precision,limitNodeId,comm,commI); int oldNbOfNodes=getNumberOfNodes(); - MEDCouplingAutoRefCountObjectPtr ret=buildNewNumberingFromCommonNodesFormat(comm,commI,newNbOfNodes); + MCAuto ret=buildNewNumberingFromCommonNodesFormat(comm,commI,newNbOfNodes); areNodesMerged=(oldNbOfNodes!=newNbOfNodes); comm->decrRef(); commI->decrRef(); @@ -326,7 +326,7 @@ DataArrayInt *MEDCouplingPointSet::getNodeIdsNearPoint(const double *pos, double { DataArrayInt *c=0,*cI=0; getNodeIdsNearPoints(pos,1,eps,c,cI); - MEDCouplingAutoRefCountObjectPtr cITmp(cI); + MCAuto cITmp(cI); return c; } @@ -362,7 +362,7 @@ void MEDCouplingPointSet::getNodeIdsNearPoints(const double *pos, int nbOfPoints if(!_coords) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getNodeIdsNearPoint : no coordiantes set !"); int spaceDim=getSpaceDimension(); - MEDCouplingAutoRefCountObjectPtr points=DataArrayDouble::New(); + MCAuto points=DataArrayDouble::New(); points->useArray(pos,false,CPP_DEALLOC,nbOfPoints,spaceDim); _coords->computeTupleIdsNearTuples(points,eps,c,cI); } @@ -377,7 +377,7 @@ DataArrayInt *MEDCouplingPointSet::buildNewNumberingFromCommonNodesFormat(const { if(!_coords) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::buildNewNumberingFromCommonNodesFormat : no coords specified !"); - return DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(getNumberOfNodes(),comm->begin(),commIndex->begin(),commIndex->end(),newNbOfNodes); + return DataArrayInt::ConvertIndexArrayToO2N(getNumberOfNodes(),comm->begin(),commIndex->begin(),commIndex->end(),newNbOfNodes); } /*! @@ -401,7 +401,7 @@ void MEDCouplingPointSet::renumberNodes(const int *newNodeNumbers, int newNbOfNo { if(!_coords) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::renumberNodes : no coords specified !"); - MEDCouplingAutoRefCountObjectPtr newCoords=_coords->renumberAndReduce(newNodeNumbers,newNbOfNodes); + MCAuto newCoords=_coords->renumberAndReduce(newNodeNumbers,newNbOfNodes); renumberNodesInConn(newNodeNumbers); setCoords(newCoords);//let it here not before renumberNodesInConn because old number of nodes is sometimes used... } @@ -425,7 +425,7 @@ void MEDCouplingPointSet::renumberNodes(const int *newNodeNumbers, int newNbOfNo * \ref py_mcumesh_renumberNodes "Here is a Python example". * \endif */ -void MEDCouplingPointSet::renumberNodes2(const int *newNodeNumbers, int newNbOfNodes) +void MEDCouplingPointSet::renumberNodesCenter(const int *newNodeNumbers, int newNbOfNodes) { DataArrayDouble *newCoords=DataArrayDouble::New(); std::vector div(newNbOfNodes); @@ -674,8 +674,8 @@ void MEDCouplingPointSet::duplicateNodesInCoords(const int *nodeIdsToDuplicateBg { if(!_coords) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : no coords set !"); - MEDCouplingAutoRefCountObjectPtr newCoords=_coords->selectByTupleIdSafe(nodeIdsToDuplicateBg,nodeIdsToDuplicateEnd); - MEDCouplingAutoRefCountObjectPtr newCoords2=DataArrayDouble::Aggregate(_coords,newCoords); + MCAuto newCoords=_coords->selectByTupleIdSafe(nodeIdsToDuplicateBg,nodeIdsToDuplicateEnd); + MCAuto newCoords2=DataArrayDouble::Aggregate(_coords,newCoords); setCoords(newCoords2); } @@ -947,10 +947,10 @@ void MEDCouplingPointSet::unserialization(const std::vector& tinyInfoD, } } -void MEDCouplingPointSet::checkCoherency() const +void MEDCouplingPointSet::checkConsistencyLight() const { if(!_coords) - throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkCoherency : no coordinates set !"); + throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkConsistencyLight : no coordinates set !"); } /*! @@ -1081,7 +1081,7 @@ DataArrayInt *MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells(const MED { if(!srcMesh || !trgMesh) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells : the input meshes must be not NULL !"); - MEDCouplingAutoRefCountObjectPtr sbbox(srcMesh->getBoundingBoxForBBTree()),tbbox(trgMesh->getBoundingBoxForBBTree()); + MCAuto sbbox(srcMesh->getBoundingBoxForBBTree()),tbbox(trgMesh->getBoundingBoxForBBTree()); return tbbox->computeNbOfInteractionsWith(sbbox,eps); } @@ -1115,7 +1115,7 @@ MEDCouplingMesh *MEDCouplingPointSet::buildPart(const int *start, const int *end */ MEDCouplingMesh *MEDCouplingPointSet::buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const { - MEDCouplingAutoRefCountObjectPtr ret=buildPartOfMySelf(start,end,true); + MCAuto ret=buildPartOfMySelf(start,end,true); arr=ret->zipCoordsTraducer(); return ret.retn(); } @@ -1129,7 +1129,7 @@ MEDCouplingMesh *MEDCouplingPointSet::buildPartAndReduceNodes(const int *start, * * \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 + * \sa MEDCouplingUMesh::buildPartOfMySelfSlice */ MEDCouplingMesh *MEDCouplingPointSet::buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const { @@ -1141,7 +1141,7 @@ MEDCouplingMesh *MEDCouplingPointSet::buildPartRange(int beginCellIds, int endCe } else { - return buildPartOfMySelf2(beginCellIds,endCellIds,stepCellIds,true); + return buildPartOfMySelfSlice(beginCellIds,endCellIds,stepCellIds,true); } } @@ -1153,11 +1153,11 @@ MEDCouplingMesh *MEDCouplingPointSet::buildPartRange(int beginCellIds, int endCe * \param [out] stepOut valid only if \a arr not NULL ! * \param [out] arr correspondance old to new in node ids. * - * \sa MEDCouplingUMesh::buildPartOfMySelf2 + * \sa MEDCouplingUMesh::buildPartOfMySelfSlice */ MEDCouplingMesh *MEDCouplingPointSet::buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt*& arr) const { - MEDCouplingAutoRefCountObjectPtr ret=buildPartOfMySelf2(beginCellIds,endCellIds,stepCellIds,true); + MCAuto ret=buildPartOfMySelfSlice(beginCellIds,endCellIds,stepCellIds,true); arr=ret->zipCoordsTraducer(); return ret.retn(); } @@ -1308,13 +1308,13 @@ void MEDCouplingPointSet::tryToShareSameCoordsPermute(const MEDCouplingPointSet& if(!_coords) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::tryToShareSameCoordsPermute : No coords specified in this whereas there is any in other !"); int otherNbOfNodes=other.getNumberOfNodes(); - MEDCouplingAutoRefCountObjectPtr newCoords=MergeNodesArray(&other,this); + MCAuto newCoords=MergeNodesArray(&other,this); _coords->incrRef(); - MEDCouplingAutoRefCountObjectPtr oldCoords=_coords; + MCAuto oldCoords=_coords; setCoords(newCoords); bool areNodesMerged; int newNbOfNodes; - MEDCouplingAutoRefCountObjectPtr da=buildPermArrayForMergeNode(epsilon,otherNbOfNodes,areNodesMerged,newNbOfNodes); + MCAuto da=buildPermArrayForMergeNode(epsilon,otherNbOfNodes,areNodesMerged,newNbOfNodes); if(!areNodesMerged) { setCoords(oldCoords); @@ -1334,15 +1334,15 @@ void MEDCouplingPointSet::tryToShareSameCoordsPermute(const MEDCouplingPointSet& MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelf(const int *begin, const int *end, bool keepCoords) const { - MEDCouplingAutoRefCountObjectPtr ret=buildPartOfMySelfKeepCoords(begin,end); + MCAuto ret=buildPartOfMySelfKeepCoords(begin,end); if(!keepCoords) ret->zipCoords(); return ret.retn(); } -MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelf2(int start, int end, int step, bool keepCoords) const +MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelfSlice(int start, int end, int step, bool keepCoords) const { - MEDCouplingAutoRefCountObjectPtr ret=buildPartOfMySelfKeepCoords2(start,end,step); + MCAuto ret=buildPartOfMySelfKeepCoordsSlice(start,end,step); if(!keepCoords) ret->zipCoords(); return ret.retn(); @@ -1375,7 +1375,7 @@ MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelfNode(const int *begin { DataArrayInt *cellIdsKept=0; fillCellIdsToKeepFromNodeIds(begin,end,fullyIn,cellIdsKept); - MEDCouplingAutoRefCountObjectPtr cellIdsKept2(cellIdsKept); + MCAuto cellIdsKept2(cellIdsKept); return buildPartOfMySelf(cellIdsKept->begin(),cellIdsKept->end(),true); } @@ -1414,12 +1414,12 @@ DataArrayInt *MEDCouplingPointSet::zipConnectivityTraducer(int compType, int sta { DataArrayInt *commonCells=0,*commonCellsI=0; findCommonCells(compType,startCellId,commonCells,commonCellsI); - MEDCouplingAutoRefCountObjectPtr commonCellsTmp(commonCells),commonCellsITmp(commonCellsI); + MCAuto commonCellsTmp(commonCells),commonCellsITmp(commonCellsI); int newNbOfCells=-1; - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(getNumberOfCells(),commonCells->begin(),commonCellsI->begin(), + MCAuto ret=DataArrayInt::ConvertIndexArrayToO2N(getNumberOfCells(),commonCells->begin(),commonCellsI->begin(), commonCellsI->end(),newNbOfCells); - MEDCouplingAutoRefCountObjectPtr ret2=ret->invertArrayO2N2N2O(newNbOfCells); - MEDCouplingAutoRefCountObjectPtr self=buildPartOfMySelf(ret2->begin(),ret2->end(),true); + MCAuto ret2=ret->invertArrayO2N2N2O(newNbOfCells); + MCAuto self=buildPartOfMySelf(ret2->begin(),ret2->end(),true); shallowCopyConnectivityFrom(self); return ret.retn(); } @@ -1468,11 +1468,11 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int const MEDCouplingPointSet *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkDeepEquivalWith : other is not a PointSet mesh !"); - MEDCouplingAutoRefCountObjectPtr m=dynamic_cast(mergeMyselfWith(otherC)); + MCAuto m=dynamic_cast(mergeMyselfWith(otherC)); bool areNodesMerged; int newNbOfNodes; int oldNbOfNodes=getNumberOfNodes(); - MEDCouplingAutoRefCountObjectPtr da=m->buildPermArrayForMergeNode(prec,oldNbOfNodes,areNodesMerged,newNbOfNodes); + MCAuto da=m->buildPermArrayForMergeNode(prec,oldNbOfNodes,areNodesMerged,newNbOfNodes); //mergeNodes if(!areNodesMerged && oldNbOfNodes != 0) throw INTERP_KERNEL::Exception("checkDeepEquivalWith : Nodes are incompatible ! "); @@ -1481,7 +1481,7 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some nodes in other are not in this !"); m->renumberNodes(da->getConstPointer(),newNbOfNodes); // - MEDCouplingAutoRefCountObjectPtr nodeCor2=da->substr(oldNbOfNodes); + MCAuto nodeCor2=da->substr(oldNbOfNodes); da=m->mergeNodes(prec,areNodesMerged,newNbOfNodes); // da=m->zipConnectivityTraducer(cellCompPol); @@ -1491,7 +1491,7 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int int dan(da->getNumberOfTuples()); if (dan) { - MEDCouplingAutoRefCountObjectPtr da1(DataArrayInt::New()),da2(DataArrayInt::New()); + MCAuto 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()); @@ -1499,9 +1499,9 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int if (!da1->isEqualWithoutConsideringStr(*da2)) throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some cells in other are not in this !"); } - MEDCouplingAutoRefCountObjectPtr cellCor2=da->selectByTupleId2(nbCells,da->getNbOfElems(),1); - nodeCor=nodeCor2->isIdentity2(nodeCor2->getNumberOfTuples())?0:nodeCor2.retn(); - cellCor=cellCor2->isIdentity2(cellCor2->getNumberOfTuples())?0:cellCor2.retn(); + MCAuto cellCor2=da->selectByTupleIdSafeSlice(nbCells,da->getNbOfElems(),1); + nodeCor=nodeCor2->isIota(nodeCor2->getNumberOfTuples())?0:nodeCor2.retn(); + cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?0:cellCor2.retn(); } /*! @@ -1533,16 +1533,16 @@ void MEDCouplingPointSet::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkDeepEquivalOnSameNodesWith : other is not a PointSet mesh !"); if(_coords!=otherC->_coords) throw INTERP_KERNEL::Exception("checkDeepEquivalOnSameNodesWith : meshes do not share the same coordinates ! Use tryToShareSameCoordinates or call checkDeepEquivalWith !"); - MEDCouplingAutoRefCountObjectPtr m=mergeMyselfWithOnSameCoords(otherC); - MEDCouplingAutoRefCountObjectPtr da=m->zipConnectivityTraducer(cellCompPol); + MCAuto m=mergeMyselfWithOnSameCoords(otherC); + MCAuto 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(),maxId)); if(pt!=da->getConstPointer()+da->getNbOfElems()) { throw INTERP_KERNEL::Exception("checkDeepEquivalOnSameNodesWith : some cells in other are not in this !"); } - MEDCouplingAutoRefCountObjectPtr cellCor2=da->selectByTupleId2(getNumberOfCells(),da->getNbOfElems(),1); - cellCor=cellCor2->isIdentity2(cellCor2->getNumberOfTuples())?0:cellCor2.retn(); + MCAuto cellCor2=da->selectByTupleIdSafeSlice(getNumberOfCells(),da->getNbOfElems(),1); + cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?0:cellCor2.retn(); } void MEDCouplingPointSet::checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const @@ -1636,7 +1636,7 @@ DataArrayInt *MEDCouplingPointSet::getCellIdsFullyIncludedInNodeIds(const int *p DataArrayInt *MEDCouplingPointSet::zipCoordsTraducer() { int newNbOfNodes=-1; - MEDCouplingAutoRefCountObjectPtr traducer=getNodeIdsInUse(newNbOfNodes); + MCAuto traducer=getNodeIdsInUse(newNbOfNodes); renumberNodes(traducer->getConstPointer(),newNbOfNodes); return traducer.retn(); } @@ -1661,7 +1661,7 @@ DataArrayInt *MEDCouplingPointSet::zipCoordsTraducer() */ DataArrayInt *MEDCouplingPointSet::mergeNodes(double precision, bool& areNodesMerged, int& newNbOfNodes) { - MEDCouplingAutoRefCountObjectPtr ret=buildPermArrayForMergeNode(precision,-1,areNodesMerged,newNbOfNodes); + MCAuto ret=buildPermArrayForMergeNode(precision,-1,areNodesMerged,newNbOfNodes); if(areNodesMerged) renumberNodes(ret->begin(),newNbOfNodes); return ret.retn(); @@ -1686,10 +1686,10 @@ DataArrayInt *MEDCouplingPointSet::mergeNodes(double precision, bool& areNodesMe * \ref py_mcumesh_mergeNodes "Here is a Python example". * \endif */ -DataArrayInt *MEDCouplingPointSet::mergeNodes2(double precision, bool& areNodesMerged, int& newNbOfNodes) +DataArrayInt *MEDCouplingPointSet::mergeNodesCenter(double precision, bool& areNodesMerged, int& newNbOfNodes) { DataArrayInt *ret=buildPermArrayForMergeNode(precision,-1,areNodesMerged,newNbOfNodes); if(areNodesMerged) - renumberNodes2(ret->getConstPointer(),newNbOfNodes); + renumberNodesCenter(ret->getConstPointer(),newNbOfNodes); return ret; } diff --git a/src/MEDCoupling/MEDCouplingPointSet.hxx b/src/MEDCoupling/MEDCouplingPointSet.hxx index 312a24e60..c31af02ab 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.hxx +++ b/src/MEDCoupling/MEDCouplingPointSet.hxx @@ -73,10 +73,10 @@ namespace MEDCoupling MEDCOUPLING_EXPORT bool areCoordsEqualIfNotWhy(const MEDCouplingPointSet& other, double prec, std::string& reason) const; MEDCOUPLING_EXPORT bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const; MEDCOUPLING_EXPORT bool areCoordsEqualWithoutConsideringStr(const MEDCouplingPointSet& other, double prec) const; - MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const = 0; + MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *deepCopyConnectivityOnly() const = 0; MEDCOUPLING_EXPORT virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) = 0; MEDCOUPLING_EXPORT virtual DataArrayInt *mergeNodes(double precision, bool& areNodesMerged, int& newNbOfNodes); - MEDCOUPLING_EXPORT virtual DataArrayInt *mergeNodes2(double precision, bool& areNodesMerged, int& newNbOfNodes); + MEDCOUPLING_EXPORT virtual DataArrayInt *mergeNodesCenter(double precision, bool& areNodesMerged, int& newNbOfNodes); MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const = 0; MEDCOUPLING_EXPORT virtual void computeNodeIdsAlg(std::vector& nodeIdsInUse) const = 0; MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector& coo) const; @@ -113,9 +113,9 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayInt *getCellIdsFullyIncludedInNodeIds(const int *partBg, const int *partEnd) const; MEDCOUPLING_EXPORT DataArrayInt *getCellIdsLyingOnNodes(const int *begin, const int *end, bool fullyIn) const; MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelf(const int *start, const int *end, bool keepCoords=true) const; - MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step, bool keepCoords=true) const; + MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelfSlice(int start, int end, int step, bool keepCoords=true) const; MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelfKeepCoords(const int *begin, const int *end) const = 0; - MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelfKeepCoords2(int start, int end, int step) const = 0; + MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const = 0; MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelfNode(const int *start, const int *end, bool fullyIn) const; MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildFacePartOfMySelfNode(const int *start, const int *end, bool fullyIn) const = 0; MEDCOUPLING_EXPORT virtual DataArrayInt *findBoundaryNodes() const = 0; @@ -128,7 +128,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual void renumberNodesInConn(const INTERP_KERNEL::HashMap& newNodeNumbersO2N) = 0; MEDCOUPLING_EXPORT virtual void renumberNodesWithOffsetInConn(int offset) = 0; MEDCOUPLING_EXPORT virtual void renumberNodes(const int *newNodeNumbers, int newNbOfNodes); - MEDCOUPLING_EXPORT virtual void renumberNodes2(const int *newNodeNumbers, int newNbOfNodes); + MEDCOUPLING_EXPORT virtual void renumberNodesCenter(const int *newNodeNumbers, int newNbOfNodes); MEDCOUPLING_EXPORT virtual bool isEmptyMesh(const std::vector& tinyInfo) const = 0; MEDCOUPLING_EXPORT virtual void checkFullyDefined() const = 0; MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; @@ -147,7 +147,7 @@ namespace MEDCoupling public: MEDCOUPLING_EXPORT bool areCellsFrom2MeshEqual(const MEDCouplingPointSet *other, int cellId, double prec) const; protected: - MEDCOUPLING_EXPORT void checkCoherency() const; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; MEDCOUPLING_EXPORT static bool intersectsBoundingBox(const double* bb1, const double* bb2, int dim, double eps); MEDCOUPLING_EXPORT static bool intersectsBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bb1, const double* bb2, int dim, double eps); MEDCOUPLING_EXPORT void rotate2D(const double *center, double angle); diff --git a/src/MEDCoupling/MEDCouplingRemapper.cxx b/src/MEDCoupling/MEDCouplingRemapper.cxx index 3b20e7d8f..0c1140961 100644 --- a/src/MEDCoupling/MEDCouplingRemapper.cxx +++ b/src/MEDCoupling/MEDCouplingRemapper.cxx @@ -23,7 +23,7 @@ #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingFieldTemplate.hxx" #include "MEDCouplingFieldDiscretization.hxx" -#include "MEDCouplingExtrudedMesh.hxx" +#include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingCMesh.hxx" #include "MEDCouplingNormalizedUnstructuredMesh.txx" #include "MEDCouplingNormalizedCartesianMesh.txx" @@ -73,9 +73,9 @@ int MEDCouplingRemapper::prepare(const MEDCouplingMesh *srcMesh, const MEDCoupli throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepare : presence of NULL input pointer !"); std::string srcMethod,targetMethod; INTERP_KERNEL::Interpolation::CheckAndSplitInterpolationMethod(method,srcMethod,targetMethod); - MEDCouplingAutoRefCountObjectPtr src=MEDCouplingFieldTemplate::New(MEDCouplingFieldDiscretization::GetTypeOfFieldFromStringRepr(srcMethod)); + MCAuto src=MEDCouplingFieldTemplate::New(MEDCouplingFieldDiscretization::GetTypeOfFieldFromStringRepr(srcMethod)); src->setMesh(srcMesh); - MEDCouplingAutoRefCountObjectPtr target=MEDCouplingFieldTemplate::New(MEDCouplingFieldDiscretization::GetTypeOfFieldFromStringRepr(targetMethod)); + MCAuto target=MEDCouplingFieldTemplate::New(MEDCouplingFieldDiscretization::GetTypeOfFieldFromStringRepr(targetMethod)); target->setMesh(targetMesh); return prepareEx(src,target); } @@ -205,7 +205,7 @@ void MEDCouplingRemapper::reverseTransfer(MEDCouplingFieldDouble *srcField, cons if(!srcField || !targetField) throw INTERP_KERNEL::Exception("MEDCouplingRemapper::reverseTransfer : input fields must be both not NULL !"); checkPrepare(); - targetField->checkCoherency(); + targetField->checkConsistencyLight(); if(_src_ft->getDiscretization()->getStringRepr()!=srcField->getDiscretization()->getStringRepr()) throw INTERP_KERNEL::Exception("Incoherency with prepare call for source field"); if(_target_ft->getDiscretization()->getStringRepr()!=targetField->getDiscretization()->getStringRepr()) @@ -223,13 +223,13 @@ void MEDCouplingRemapper::reverseTransfer(MEDCouplingFieldDouble *srcField, cons int trgNbOfCompo=targetField->getNumberOfComponents(); if(array) { - srcField->checkCoherency(); + srcField->checkConsistencyLight(); if(trgNbOfCompo!=srcField->getNumberOfTuplesExpected()) throw INTERP_KERNEL::Exception("Number of components mismatch !"); } else { - MEDCouplingAutoRefCountObjectPtr tmp(DataArrayDouble::New()); + MCAuto tmp(DataArrayDouble::New()); tmp->alloc(srcField->getNumberOfTuplesExpected(),trgNbOfCompo); srcField->setArray(tmp); } @@ -257,7 +257,7 @@ MEDCouplingFieldDouble *MEDCouplingRemapper::transferField(const MEDCouplingFiel checkPrepare(); if(!srcField) throw INTERP_KERNEL::Exception("MEDCouplingRemapper::transferField : input srcField is NULL !"); - srcField->checkCoherency(); + srcField->checkConsistencyLight(); if(_src_ft->getDiscretization()->getStringRepr()!=srcField->getDiscretization()->getStringRepr()) throw INTERP_KERNEL::Exception("Incoherency with prepare call for source field"); MEDCouplingFieldDouble *ret=MEDCouplingFieldDouble::New(*_target_ft,srcField->getTimeDiscretization()); @@ -271,7 +271,7 @@ MEDCouplingFieldDouble *MEDCouplingRemapper::reverseTransferField(const MEDCoupl { if(!targetField) throw INTERP_KERNEL::Exception("MEDCouplingRemapper::transferField : input targetField is NULL !"); - targetField->checkCoherency(); + targetField->checkConsistencyLight(); checkPrepare(); if(_target_ft->getDiscretization()->getStringRepr()!=targetField->getDiscretization()->getStringRepr()) throw INTERP_KERNEL::Exception("Incoherency with prepare call for target field"); @@ -616,8 +616,8 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyEE() { std::string srcMeth,trgMeth; std::string methC=checkAndGiveInterpolationMethodStr(srcMeth,trgMeth); - const MEDCouplingExtrudedMesh *src_mesh=static_cast(_src_ft->getMesh()); - const MEDCouplingExtrudedMesh *target_mesh=static_cast(_target_ft->getMesh()); + const MEDCouplingMappedExtrudedMesh *src_mesh=static_cast(_src_ft->getMesh()); + const MEDCouplingMappedExtrudedMesh *target_mesh=static_cast(_target_ft->getMesh()); if(methC!="P0P0") throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnlyEE : Only P0P0 method implemented for Extruded/Extruded meshes !"); MEDCouplingNormalizedUnstructuredMesh<3,2> source_mesh_wrapper(src_mesh->getMesh2D()); @@ -627,7 +627,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyEE() int nbCols2D=interpolation2D.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,matrix2D,methC); MEDCouplingUMesh *s1D,*t1D; double v[3]; - MEDCouplingExtrudedMesh::Project1DMeshes(src_mesh->getMesh1D(),target_mesh->getMesh1D(),getPrecision(),s1D,t1D,v); + MEDCouplingMappedExtrudedMesh::Project1DMeshes(src_mesh->getMesh1D(),target_mesh->getMesh1D(),getPrecision(),s1D,t1D,v); MEDCouplingNormalizedUnstructuredMesh<1,1> s1DWrapper(s1D); MEDCouplingNormalizedUnstructuredMesh<1,1> t1DWrapper(t1D); std::vector > matrix1D; @@ -807,10 +807,10 @@ int MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss() { if(getIntersectionType()!=INTERP_KERNEL::PointLocator) throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss : The intersection type is not supported ! Only PointLocator is supported for Gauss->Gauss interpolation ! Please invoke setIntersectionType(PointLocator) on the MEDCouplingRemapper instance !"); - MEDCouplingAutoRefCountObjectPtr trgLoc=_target_ft->getLocalizationOfDiscr(); + MCAuto trgLoc=_target_ft->getLocalizationOfDiscr(); const double *trgLocPtr=trgLoc->begin(); int trgSpaceDim=trgLoc->getNumberOfComponents(); - MEDCouplingAutoRefCountObjectPtr srcOffsetArr=_src_ft->getDiscretization()->getOffsetArr(_src_ft->getMesh()); + MCAuto srcOffsetArr=_src_ft->getDiscretization()->getOffsetArr(_src_ft->getMesh()); if(trgSpaceDim!=_src_ft->getMesh()->getSpaceDimension()) { std::ostringstream oss; oss << "MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss : space dimensions mismatch between source and target !"; @@ -819,15 +819,15 @@ int MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss() throw INTERP_KERNEL::Exception(oss.str().c_str()); } const int *srcOffsetArrPtr=srcOffsetArr->begin(); - MEDCouplingAutoRefCountObjectPtr srcLoc=_src_ft->getLocalizationOfDiscr(); + MCAuto srcLoc=_src_ft->getLocalizationOfDiscr(); const double *srcLocPtr=srcLoc->begin(); - MEDCouplingAutoRefCountObjectPtr eltsArr,eltsIndexArr; + MCAuto eltsArr,eltsIndexArr; int trgNbOfGaussPts=trgLoc->getNumberOfTuples(); _matrix.resize(trgNbOfGaussPts); _src_ft->getMesh()->getCellsContainingPoints(trgLoc->begin(),trgNbOfGaussPts,getPrecision(),eltsArr,eltsIndexArr); const int *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin()); - MEDCouplingAutoRefCountObjectPtr nbOfSrcCellsShTrgPts(eltsIndexArr->deltaShiftIndex()); - MEDCouplingAutoRefCountObjectPtr ids0=nbOfSrcCellsShTrgPts->getIdsNotEqual(0); + MCAuto nbOfSrcCellsShTrgPts(eltsIndexArr->deltaShiftIndex()); + MCAuto ids0=nbOfSrcCellsShTrgPts->findIdsNotEqual(0); for(const int *trgId=ids0->begin();trgId!=ids0->end();trgId++) { const double *ptTrg=trgLocPtr+trgSpaceDim*(*trgId); @@ -847,9 +847,9 @@ int MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss() } if(ids0->getNumberOfTuples()!=trgNbOfGaussPts) { - MEDCouplingAutoRefCountObjectPtr orphanTrgIds=nbOfSrcCellsShTrgPts->getIdsEqual(0); - MEDCouplingAutoRefCountObjectPtr orphanTrg=trgLoc->selectByTupleId(orphanTrgIds->begin(),orphanTrgIds->end()); - MEDCouplingAutoRefCountObjectPtr srcIdPerTrg=srcLoc->findClosestTupleId(orphanTrg); + MCAuto orphanTrgIds=nbOfSrcCellsShTrgPts->findIdsEqual(0); + MCAuto orphanTrg=trgLoc->selectByTupleId(orphanTrgIds->begin(),orphanTrgIds->end()); + MCAuto srcIdPerTrg=srcLoc->findClosestTupleId(orphanTrg); const int *srcIdPerTrgPtr=srcIdPerTrg->begin(); for(const int *orphanTrgId=orphanTrgIds->begin();orphanTrgId!=orphanTrgIds->end();orphanTrgId++,srcIdPerTrgPtr++) _matrix[*orphanTrgId][*srcIdPerTrgPtr]=2.; @@ -976,7 +976,7 @@ void MEDCouplingRemapper::transferUnderground(const MEDCouplingFieldDouble *srcF { if(!srcField || !targetField) throw INTERP_KERNEL::Exception("MEDCouplingRemapper::transferUnderground : srcField or targetField is NULL !"); - srcField->checkCoherency(); + srcField->checkConsistencyLight(); checkPrepare(); if(_src_ft->getDiscretization()->getStringRepr()!=srcField->getDiscretization()->getStringRepr()) throw INTERP_KERNEL::Exception("Incoherency with prepare call for source field"); @@ -995,7 +995,7 @@ void MEDCouplingRemapper::transferUnderground(const MEDCouplingFieldDouble *srcF int srcNbOfCompo(srcField->getNumberOfComponents()); if(array) { - targetField->checkCoherency(); + targetField->checkConsistencyLight(); if(srcNbOfCompo!=targetField->getNumberOfComponents()) throw INTERP_KERNEL::Exception("Number of components mismatch !"); } @@ -1003,7 +1003,7 @@ void MEDCouplingRemapper::transferUnderground(const MEDCouplingFieldDouble *srcF { if(!isDftVal) throw INTERP_KERNEL::Exception("MEDCouplingRemapper::partialTransfer : This method requires that the array of target field exists ! Allocate it or call MEDCouplingRemapper::transfer instead !"); - MEDCouplingAutoRefCountObjectPtr tmp(DataArrayDouble::New()); + MCAuto tmp(DataArrayDouble::New()); tmp->alloc(targetField->getNumberOfTuples(),srcNbOfCompo); targetField->setArray(tmp); } @@ -1029,12 +1029,12 @@ void MEDCouplingRemapper::computeDenoFromScratch(NatureOfField nat, const MEDCou _time_deno_update=getTimeOfThis(); switch(_nature_of_deno) { - case ConservativeVolumic: + case IntensiveMaximum: { ComputeRowSumAndColSum(_matrix,_deno_multiply,_deno_reverse_multiply); break; } - case Integral: + case ExtensiveMaximum: { MEDCouplingFieldDouble *deno=srcField->getDiscretization()->getMeasureField(srcField->getMesh(),getMeasureAbsStatus()); MEDCouplingFieldDouble *denoR=trgField->getDiscretization()->getMeasureField(trgField->getMesh(),getMeasureAbsStatus()); @@ -1061,12 +1061,12 @@ void MEDCouplingRemapper::computeDenoFromScratch(NatureOfField nat, const MEDCou denoR->decrRef(); break; } - case IntegralGlobConstraint: + case ExtensiveConservation: { ComputeColSumAndRowSum(_matrix,_deno_multiply,_deno_reverse_multiply); break; } - case RevIntegral: + case IntensiveConservation: { MEDCouplingFieldDouble *deno=trgField->getDiscretization()->getMeasureField(trgField->getMesh(),getMeasureAbsStatus()); MEDCouplingFieldDouble *denoR=srcField->getDiscretization()->getMeasureField(srcField->getMesh(),getMeasureAbsStatus()); diff --git a/src/MEDCoupling/MEDCouplingRemapper.hxx b/src/MEDCoupling/MEDCouplingRemapper.hxx index 8b1329a7e..954d164a7 100644 --- a/src/MEDCoupling/MEDCouplingRemapper.hxx +++ b/src/MEDCoupling/MEDCouplingRemapper.hxx @@ -25,7 +25,7 @@ #include "MEDCouplingTimeLabel.hxx" #include "InterpolationOptions.hxx" #include "MEDCouplingNatureOfField.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "InterpKernelException.hxx" @@ -109,8 +109,8 @@ namespace MEDCoupling static void ComputeColSumAndRowSum(const std::vector >& matrixDeno, std::vector >& deno, std::vector >& denoReverse); private: - MEDCouplingAutoRefCountObjectPtr _src_ft; - MEDCouplingAutoRefCountObjectPtr _target_ft; + MCAuto _src_ft; + MCAuto _target_ft; InterpolationMatrixPolicy _interp_matrix_pol; NatureOfField _nature_of_deno; unsigned int _time_deno_update; diff --git a/src/MEDCoupling/MEDCouplingSkyLineArray.hxx b/src/MEDCoupling/MEDCouplingSkyLineArray.hxx index 5ca56755a..0772a5e32 100644 --- a/src/MEDCoupling/MEDCouplingSkyLineArray.hxx +++ b/src/MEDCoupling/MEDCouplingSkyLineArray.hxx @@ -22,7 +22,7 @@ #include "MEDCoupling.hxx" #include "MEDCouplingMemArray.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include @@ -31,8 +31,8 @@ namespace MEDCoupling class MEDCOUPLING_EXPORT MEDCouplingSkyLineArray { private: - MEDCouplingAutoRefCountObjectPtr _index; - MEDCouplingAutoRefCountObjectPtr _value; + MCAuto _index; + MCAuto _value; public: MEDCouplingSkyLineArray(); MEDCouplingSkyLineArray( const MEDCouplingSkyLineArray &myArray ); diff --git a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx index fc06293a2..9ea7ddb93 100644 --- a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx +++ b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx @@ -97,7 +97,7 @@ int MEDCouplingStructuredMesh::getNumberOfCellsWithType(INTERP_KERNEL::Normalize DataArrayInt *MEDCouplingStructuredMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const { - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); if(getTypeOfCell(0)==type) { ret->alloc(getNumberOfCells(),1); @@ -111,7 +111,7 @@ DataArrayInt *MEDCouplingStructuredMesh::giveCellsWithType(INTERP_KERNEL::Normal DataArrayInt *MEDCouplingStructuredMesh::computeNbOfNodesPerCell() const { int nbCells=getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbCells,1); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(getTypeOfCell(0)); ret->fillWithValue((int)cm.getNumberOfNodes()); @@ -121,7 +121,7 @@ DataArrayInt *MEDCouplingStructuredMesh::computeNbOfNodesPerCell() const DataArrayInt *MEDCouplingStructuredMesh::computeNbOfFacesPerCell() const { int nbCells=getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbCells,1); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(getTypeOfCell(0)); ret->fillWithValue((int)cm.getNumberOfSons()); @@ -321,10 +321,10 @@ void MEDCouplingStructuredMesh::splitProfilePerType(const DataArrayInt *profile, code.resize(3); idsInPflPerType.resize(1); code[0]=(int)getTypeOfCell(0); code[1]=nbOfCells; idsInPflPerType.resize(1); - if(profile->isIdentity2(nbOfCells)) + if(profile->isIota(nbOfCells)) { code[2]=-1; - idsInPflPerType[0]=profile->deepCpy(); + idsInPflPerType[0]=profile->deepCopy(); idsPerType.clear(); return ; } @@ -332,7 +332,7 @@ void MEDCouplingStructuredMesh::splitProfilePerType(const DataArrayInt *profile, code[2]=0; profile->checkAllIdsInRange(0,nbOfCells); idsPerType.resize(1); - idsPerType[0]=profile->deepCpy(); + idsPerType[0]=profile->deepCopy(); idsInPflPerType[0]=DataArrayInt::Range(0,nbTuples,1); } @@ -347,11 +347,11 @@ MEDCoupling1SGTUMesh *MEDCouplingStructuredMesh::build1SGTUnstructured() const int meshDim(getMeshDimension()),spaceDim(getSpaceDimensionOnNodeStruct()); if((meshDim<0 || meshDim>3) || (spaceDim<0 || spaceDim>3)) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::build1SGTUnstructured : meshdim and spacedim must be in [1,2,3] !"); - MEDCouplingAutoRefCountObjectPtr coords(getCoordinatesAndOwner()); + MCAuto coords(getCoordinatesAndOwner()); int ns[3]; getNodeGridStructure(ns); - MEDCouplingAutoRefCountObjectPtr conn(Build1GTNodalConnectivity(ns,ns+spaceDim)); - MEDCouplingAutoRefCountObjectPtr ret(MEDCoupling1SGTUMesh::New(getName(),GetGeoTypeGivenMeshDimension(meshDim))); + MCAuto conn(Build1GTNodalConnectivity(ns,ns+spaceDim)); + MCAuto ret(MEDCoupling1SGTUMesh::New(getName(),GetGeoTypeGivenMeshDimension(meshDim))); ret->setNodalConnectivity(conn); ret->setCoords(coords); try { ret->copyTinyInfoFrom(this); } @@ -370,11 +370,11 @@ MEDCoupling1SGTUMesh *MEDCouplingStructuredMesh::build1SGTSubLevelMesh() const int meshDim(getMeshDimension()); if(meshDim<1 || meshDim>3) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::build1SGTSubLevelMesh : meshdim must be in [2,3] !"); - MEDCouplingAutoRefCountObjectPtr coords(getCoordinatesAndOwner()); + MCAuto coords(getCoordinatesAndOwner()); int ns[3]; getNodeGridStructure(ns); - MEDCouplingAutoRefCountObjectPtr conn(Build1GTNodalConnectivityOfSubLevelMesh(ns,ns+meshDim)); - MEDCouplingAutoRefCountObjectPtr ret(MEDCoupling1SGTUMesh::New(getName(),GetGeoTypeGivenMeshDimension(meshDim-1))); + MCAuto conn(Build1GTNodalConnectivityOfSubLevelMesh(ns,ns+meshDim)); + MCAuto ret(MEDCoupling1SGTUMesh::New(getName(),GetGeoTypeGivenMeshDimension(meshDim-1))); ret->setNodalConnectivity(conn); ret->setCoords(coords); return ret.retn(); } @@ -387,7 +387,7 @@ MEDCoupling1SGTUMesh *MEDCouplingStructuredMesh::build1SGTSubLevelMesh() const */ MEDCouplingUMesh *MEDCouplingStructuredMesh::buildUnstructured() const { - MEDCouplingAutoRefCountObjectPtr ret0(build1SGTUnstructured()); + MCAuto ret0(build1SGTUnstructured()); return ret0->buildUnstructured(); } @@ -415,14 +415,14 @@ MEDCouplingMesh *MEDCouplingStructuredMesh::buildPartAndReduceNodes(const int *s std::vector< std::pair > cellPartFormat,nodePartFormat; if(IsPartStructured(start,end,cgs,cellPartFormat)) { - MEDCouplingAutoRefCountObjectPtr ret(buildStructuredSubPart(cellPartFormat)); + MCAuto ret(buildStructuredSubPart(cellPartFormat)); nodePartFormat=cellPartFormat; for(std::vector< std::pair >::iterator it=nodePartFormat.begin();it!=nodePartFormat.end();it++) (*it).second++; - MEDCouplingAutoRefCountObjectPtr tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat)); - MEDCouplingAutoRefCountObjectPtr tmp2(DataArrayInt::New()); tmp2->alloc(getNumberOfNodes(),1); + MCAuto tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat)); + MCAuto tmp2(DataArrayInt::New()); tmp2->alloc(getNumberOfNodes(),1); tmp2->fillWithValue(-1); - MEDCouplingAutoRefCountObjectPtr tmp3(DataArrayInt::New()); tmp3->alloc(tmp1->getNumberOfTuples(),1); tmp3->iota(0); + MCAuto tmp3(DataArrayInt::New()); tmp3->alloc(tmp1->getNumberOfTuples(),1); tmp3->iota(0); tmp2->setPartOfValues3(tmp3,tmp1->begin(),tmp1->end(),0,1,1); arr=tmp2.retn(); return ret.retn(); @@ -632,7 +632,7 @@ DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity(const int *no { case 0: { - MEDCouplingAutoRefCountObjectPtr conn(DataArrayInt::New()); + MCAuto conn(DataArrayInt::New()); conn->alloc(1,1); conn->setIJ(0,0,0); return conn.retn(); } @@ -674,7 +674,7 @@ DataArrayInt *MEDCouplingStructuredMesh::ComputeCornersGhost(const std::vector= 0 !"); std::size_t dim(st.size()); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); + MCAuto ret(DataArrayInt::New()); switch(dim) { case 1: @@ -963,7 +963,7 @@ std::vector< std::vector > MEDCouplingStructuredMesh::ComputeSignaturePerAx DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity1D(const int *nodeStBg) { int nbOfCells(*nodeStBg-1); - MEDCouplingAutoRefCountObjectPtr conn(DataArrayInt::New()); + MCAuto conn(DataArrayInt::New()); conn->alloc(2*nbOfCells,1); int *cp=conn->getPointer(); for(int i=0;i conn(DataArrayInt::New()); + MCAuto conn(DataArrayInt::New()); conn->alloc(4*n1*n2,1); int *cp=conn->getPointer(); int pos=0; @@ -998,7 +998,7 @@ DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity3D(const int * int n1=nodeStBg[0]-1; int n2=nodeStBg[1]-1; int n3=nodeStBg[2]-1; - MEDCouplingAutoRefCountObjectPtr conn(DataArrayInt::New()); + MCAuto conn(DataArrayInt::New()); conn->alloc(8*n1*n2*n3,1); int *cp=conn->getPointer(); int pos=0; @@ -1024,7 +1024,7 @@ DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh std::vector ngs(3); int n0(nodeStBg[0]-1),n1(nodeStBg[1]-1),n2(nodeStBg[2]-1); ngs[0]=n0; ngs[1]=n1; ngs[2]=n2; int off0(nodeStBg[0]),off1(nodeStBg[0]*nodeStBg[1]); - MEDCouplingAutoRefCountObjectPtr conn(DataArrayInt::New()); + MCAuto conn(DataArrayInt::New()); conn->alloc(4*GetNumberOfCellsOfSubLevelMesh(ngs,3)); int *cp(conn->getPointer()); //X @@ -1189,7 +1189,7 @@ DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh std::vector ngs(2); int n0(nodeStBg[0]-1),n1(nodeStBg[1]-1); ngs[0]=n0; ngs[1]=n1; int off0(nodeStBg[0]); - MEDCouplingAutoRefCountObjectPtr conn(DataArrayInt::New()); + MCAuto conn(DataArrayInt::New()); conn->alloc(2*GetNumberOfCellsOfSubLevelMesh(ngs,2)); int *cp(conn->getPointer()); //X @@ -1713,7 +1713,7 @@ DataArrayDouble *MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(const std:: throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom : invalid size of input array of double regarding the structure !"); std::vector dims(GetDimensionsFromCompactFrmt(partCompactFormat)); int nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims)),nbComp(fieldOfDbl->getNumberOfComponents()); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayDouble::New()); ret->alloc(nbOfTuplesOfOutField,nbComp); + MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfTuplesOfOutField,nbComp); ret->copyStringInfoFrom(*fieldOfDbl); double *ptRet(ret->getPointer()); const double *fieldOfDblPtr(fieldOfDbl->begin()); @@ -1909,7 +1909,7 @@ DataArrayInt *MEDCouplingStructuredMesh::BuildExplicitIdsFrom(const std::vector< dims[i]=partCompactFormat[i].second-partCompactFormat[i].first; nbOfItems*=dims[i]; } - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); + MCAuto ret(DataArrayInt::New()); ret->alloc(nbOfItems,1); int *pt(ret->getPointer()); switch(st.size()) diff --git a/src/MEDCoupling/MEDCouplingStructuredMesh.hxx b/src/MEDCoupling/MEDCouplingStructuredMesh.hxx index 3c37a889f..707d8e611 100644 --- a/src/MEDCoupling/MEDCouplingStructuredMesh.hxx +++ b/src/MEDCoupling/MEDCouplingStructuredMesh.hxx @@ -117,7 +117,7 @@ namespace MEDCoupling static int ZipNodeStructure(const int *nodeStBg, const int *nodeStEnd, int zipNodeSt[3]); protected: MEDCOUPLING_EXPORT MEDCouplingStructuredMesh(); - MEDCOUPLING_EXPORT MEDCouplingStructuredMesh(const MEDCouplingStructuredMesh& other, bool deepCpy); + MEDCOUPLING_EXPORT MEDCouplingStructuredMesh(const MEDCouplingStructuredMesh& other, bool deepCopy); MEDCOUPLING_EXPORT ~MEDCouplingStructuredMesh(); }; } diff --git a/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx b/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx index 763cba778..b2064b5fd 100644 --- a/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx +++ b/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx @@ -19,7 +19,7 @@ // Author : Anthony Geay (CEA/DEN) #include "MEDCouplingTimeDiscretization.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "MEDCouplingMemArray.hxx" #include "MEDCouplingMesh.hxx" @@ -79,7 +79,7 @@ void MEDCouplingTimeDiscretization::copyTinyStringsFrom(const MEDCouplingTimeDis _array->copyStringInfoFrom(*other._array); } -void MEDCouplingTimeDiscretization::checkCoherency() const +void MEDCouplingTimeDiscretization::checkConsistencyLight() const { if(!_array) throw INTERP_KERNEL::Exception("Field invalid because no values set !"); @@ -217,14 +217,14 @@ bool MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(const MEDCoupli return _array->isEqualWithoutConsideringStr(*other->_array,prec); } -MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::buildNewTimeReprFromThis(TypeOfTimeDiscretization type, bool deepCpy) const +MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::buildNewTimeReprFromThis(TypeOfTimeDiscretization type, bool deepCopy) const { MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(type); ret->setTimeUnit(getTimeUnit()); const DataArrayDouble *arrSrc=getArray(); - MEDCouplingAutoRefCountObjectPtr arr; + MCAuto arr; if(arrSrc) - arr=arrSrc->performCpy(deepCpy); + arr=arrSrc->performCopyOrIncrRef(deepCopy); ret->setArray(arr,0); return ret; } @@ -300,10 +300,10 @@ MEDCouplingTimeDiscretization::MEDCouplingTimeDiscretization():_time_tolerance(T { } -MEDCouplingTimeDiscretization::MEDCouplingTimeDiscretization(const MEDCouplingTimeDiscretization& other, bool deepCpy):_time_unit(other._time_unit),_time_tolerance(other._time_tolerance) +MEDCouplingTimeDiscretization::MEDCouplingTimeDiscretization(const MEDCouplingTimeDiscretization& other, bool deepCopy):_time_unit(other._time_unit),_time_tolerance(other._time_tolerance) { if(other._array) - _array=other._array->performCpy(deepCpy); + _array=other._array->performCopyOrIncrRef(deepCopy); else _array=0; } @@ -378,7 +378,7 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::doublyContractedPr ret->setTimeUnit(getTimeUnit()); std::vector arrays; getArrays(arrays); - std::vector< MEDCouplingAutoRefCountObjectPtr > arrays2(arrays.size()); + std::vector< MCAuto > arrays2(arrays.size()); for(std::size_t j=0;j arrays; getArrays(arrays); - std::vector< MEDCouplingAutoRefCountObjectPtr > arrays2(arrays.size()); + std::vector< MCAuto > arrays2(arrays.size()); for(std::size_t j=0;j arrays; getArrays(arrays); - std::vector< MEDCouplingAutoRefCountObjectPtr > arrays2(arrays.size()); + std::vector< MCAuto > arrays2(arrays.size()); for(std::size_t j=0;j arrays; getArrays(arrays); - std::vector< MEDCouplingAutoRefCountObjectPtr > arrays2(arrays.size()); + std::vector< MCAuto > arrays2(arrays.size()); for(std::size_t j=0;j arrays; getArrays(arrays); - std::vector< MEDCouplingAutoRefCountObjectPtr > arrays2(arrays.size()); + std::vector< MCAuto > arrays2(arrays.size()); for(std::size_t j=0;j arrays; getArrays(arrays); - std::vector< MEDCouplingAutoRefCountObjectPtr > arrays2(arrays.size()); + std::vector< MCAuto > arrays2(arrays.size()); for(std::size_t j=0;j arrays; getArrays(arrays); - std::vector< MEDCouplingAutoRefCountObjectPtr > arrays2(arrays.size()); + std::vector< MCAuto > arrays2(arrays.size()); for(std::size_t j=0;j arrays; getArrays(arrays); - std::vector< MEDCouplingAutoRefCountObjectPtr > arrays2(arrays.size()); + std::vector< MCAuto > arrays2(arrays.size()); for(std::size_t j=0;j arrays; getArrays(arrays); - std::vector< MEDCouplingAutoRefCountObjectPtr > arrays2(arrays.size()); + std::vector< MCAuto > arrays2(arrays.size()); for(std::size_t j=0;j arrays; getArrays(arrays); - std::vector< MEDCouplingAutoRefCountObjectPtr > arrays2(arrays.size()); + std::vector< MCAuto > arrays2(arrays.size()); for(std::size_t j=0;j arrays; getArrays(arrays); - std::vector< MEDCouplingAutoRefCountObjectPtr > arrays2(arrays.size()); + std::vector< MCAuto > arrays2(arrays.size()); for(std::size_t j=0;j arrays; getArrays(arrays); - std::vector< MEDCouplingAutoRefCountObjectPtr > arrays2(arrays.size()); + std::vector< MCAuto > arrays2(arrays.size()); for(std::size_t j=0;j arrays; getArrays(arrays); - std::vector< MEDCouplingAutoRefCountObjectPtr > arrays2(arrays.size()); + std::vector< MCAuto > arrays2(arrays.size()); for(std::size_t j=0;j arrays; getArrays(arrays); - std::vector< MEDCouplingAutoRefCountObjectPtr > arrays2(arrays.size()); + std::vector< MCAuto > arrays2(arrays.size()); bool newArr=false; for(std::size_t j=0;j arrays; getArrays(arrays); - std::vector< MEDCouplingAutoRefCountObjectPtr > arrays2(arrays.size()); + std::vector< MCAuto > arrays2(arrays.size()); for(std::size_t j=0;j arrays; getArrays(arrays); - std::vector< MEDCouplingAutoRefCountObjectPtr > arrays2(arrays.size()); + std::vector< MCAuto > arrays2(arrays.size()); for(std::size_t j=0;j arrays; getArrays(arrays); - std::vector< MEDCouplingAutoRefCountObjectPtr > arrays2(arrays.size()); + std::vector< MCAuto > arrays2(arrays.size()); for(std::size_t j=0;japplyFunc2(nbOfComp,func); + arrays2[j]=arrays[j]->applyFuncCompo(nbOfComp,func); else arrays2[j]=0; } @@ -779,15 +779,15 @@ void MEDCouplingTimeDiscretization::applyFunc2(int nbOfComp, const std::string& setArrays(arrays3,0); } -void MEDCouplingTimeDiscretization::applyFunc3(int nbOfComp, const std::vector& varsOrder, const std::string& func) +void MEDCouplingTimeDiscretization::applyFuncNamedCompo(int nbOfComp, const std::vector& varsOrder, const std::string& func) { std::vector arrays; getArrays(arrays); - std::vector< MEDCouplingAutoRefCountObjectPtr > arrays2(arrays.size()); + std::vector< MCAuto > arrays2(arrays.size()); for(std::size_t j=0;japplyFunc3(nbOfComp,varsOrder,func); + arrays2[j]=arrays[j]->applyFuncNamedCompo(nbOfComp,varsOrder,func); else arrays2[j]=0; } @@ -801,7 +801,7 @@ void MEDCouplingTimeDiscretization::applyFunc(const std::string& func) { std::vector arrays; getArrays(arrays); - std::vector< MEDCouplingAutoRefCountObjectPtr > arrays2(arrays.size()); + std::vector< MCAuto > arrays2(arrays.size()); for(std::size_t j=0;j arrays; getArrays(arrays); - std::vector< MEDCouplingAutoRefCountObjectPtr > arrays2(arrays.size()); + std::vector< MCAuto > arrays2(arrays.size()); for(std::size_t j=0;japplyFunc(nbOfComp,func); std::vector arrays3(arrays.size()); @@ -854,7 +854,7 @@ void MEDCouplingTimeDiscretization::fillFromAnalytic(const DataArrayDouble *loc, { std::vector arrays; getArrays(arrays); - std::vector< MEDCouplingAutoRefCountObjectPtr > arrays2(arrays.size()); + std::vector< MCAuto > arrays2(arrays.size()); for(std::size_t j=0;japplyFunc(nbOfComp,func); std::vector arrays3(arrays.size()); @@ -863,26 +863,26 @@ void MEDCouplingTimeDiscretization::fillFromAnalytic(const DataArrayDouble *loc, setArrays(arrays3,0); } -void MEDCouplingTimeDiscretization::fillFromAnalytic2(const DataArrayDouble *loc, int nbOfComp, const std::string& func) +void MEDCouplingTimeDiscretization::fillFromAnalyticCompo(const DataArrayDouble *loc, int nbOfComp, const std::string& func) { std::vector arrays; getArrays(arrays); - std::vector< MEDCouplingAutoRefCountObjectPtr > arrays2(arrays.size()); + std::vector< MCAuto > arrays2(arrays.size()); for(std::size_t j=0;japplyFunc2(nbOfComp,func); + arrays2[j]=loc->applyFuncCompo(nbOfComp,func); std::vector arrays3(arrays.size()); for(std::size_t j=0;j& varsOrder, const std::string& func) +void MEDCouplingTimeDiscretization::fillFromAnalyticNamedCompo(const DataArrayDouble *loc, int nbOfComp, const std::vector& varsOrder, const std::string& func) { std::vector arrays; getArrays(arrays); - std::vector< MEDCouplingAutoRefCountObjectPtr > arrays2(arrays.size()); + std::vector< MCAuto > arrays2(arrays.size()); for(std::size_t j=0;japplyFunc3(nbOfComp,varsOrder,func); + arrays2[j]=loc->applyFuncNamedCompo(nbOfComp,varsOrder,func); std::vector arrays3(arrays.size()); for(std::size_t j=0;j(other); if(!otherC) throw INTERP_KERNEL::Exception("NoTimeLabel::aggregation on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Aggregate(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Aggregate(getArray(),other->getArray()); MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel; ret->setArray(arr,0); return ret; @@ -994,7 +994,7 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::aggregate(const std::vect throw INTERP_KERNEL::Exception("NoTimeLabel::aggregate on mismatched time discretization !"); a[i]=itC->getArray(); } - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Aggregate(a); + MCAuto arr=DataArrayDouble::Aggregate(a); MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel; ret->setArray(arr,0); return ret; @@ -1005,7 +1005,7 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::meld(const MEDCouplingTim const MEDCouplingNoTimeLabel *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("NoTimeLabel::meld on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Meld(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Meld(getArray(),other->getArray()); MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel; ret->setTimeTolerance(getTimeTolerance()); ret->setArray(arr,0); @@ -1017,7 +1017,7 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::dot(const MEDCouplingTime const MEDCouplingNoTimeLabel *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("NoTimeLabel::dot on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Dot(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Dot(getArray(),other->getArray()); MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel; ret->setArray(arr,0); return ret; @@ -1028,7 +1028,7 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::crossProduct(const MEDCou const MEDCouplingNoTimeLabel *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("NoTimeLabel::crossProduct on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::CrossProduct(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::CrossProduct(getArray(),other->getArray()); MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel; ret->setArray(arr,0); return ret; @@ -1039,7 +1039,7 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::max(const MEDCouplingTime const MEDCouplingNoTimeLabel *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("NoTimeLabel::max on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Max(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Max(getArray(),other->getArray()); MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel; ret->setArray(arr,0); return ret; @@ -1050,7 +1050,7 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::min(const MEDCouplingTime const MEDCouplingNoTimeLabel *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("NoTimeLabel::max on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Min(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Min(getArray(),other->getArray()); MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel; ret->setArray(arr,0); return ret; @@ -1061,7 +1061,7 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::add(const MEDCouplingTime const MEDCouplingNoTimeLabel *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("NoTimeLabel::add on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Add(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Add(getArray(),other->getArray()); MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel; ret->setArray(arr,0); return ret; @@ -1084,7 +1084,7 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::substract(const MEDCoupli throw INTERP_KERNEL::Exception("NoTimeLabel::substract on mismatched time discretization !"); if(!getArray()) throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::substract : Data Array is NULL !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Substract(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Substract(getArray(),other->getArray()); MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel; ret->setArray(arr,0); return ret; @@ -1105,7 +1105,7 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::multiply(const MEDCouplin const MEDCouplingNoTimeLabel *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("NoTimeLabel::multiply on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Multiply(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Multiply(getArray(),other->getArray()); MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel; ret->setArray(arr,0); return ret; @@ -1126,7 +1126,7 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::divide(const MEDCouplingT const MEDCouplingNoTimeLabel *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("divide on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Divide(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Divide(getArray(),other->getArray()); MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel; ret->setArray(arr,0); return ret; @@ -1147,7 +1147,7 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::pow(const MEDCouplingTime const MEDCouplingNoTimeLabel *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("pow on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Pow(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Pow(getArray(),other->getArray()); MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel; ret->setArray(arr,0); return ret; @@ -1163,9 +1163,9 @@ void MEDCouplingNoTimeLabel::powEqual(const MEDCouplingTimeDiscretization *other getArray()->powEqual(other->getArray()); } -MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::performCpy(bool deepCpy) const +MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::performCopyOrIncrRef(bool deepCopy) const { - return new MEDCouplingNoTimeLabel(*this,deepCpy); + return new MEDCouplingNoTimeLabel(*this,deepCopy); } void MEDCouplingNoTimeLabel::checkTimePresence(double time) const @@ -1278,7 +1278,7 @@ void MEDCouplingNoTimeLabel::finishUnserialization2(const std::vector& tiny _time_tolerance=tinyInfoD[0]; } -MEDCouplingWithTimeStep::MEDCouplingWithTimeStep(const MEDCouplingWithTimeStep& other, bool deepCpy):MEDCouplingTimeDiscretization(other,deepCpy), +MEDCouplingWithTimeStep::MEDCouplingWithTimeStep(const MEDCouplingWithTimeStep& other, bool deepCopy):MEDCouplingTimeDiscretization(other,deepCopy), _time(other._time),_iteration(other._iteration),_order(other._order) { } @@ -1461,7 +1461,7 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::aggregate(const MEDCoupl const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::aggregation on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Aggregate(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Aggregate(getArray(),other->getArray()); MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep; ret->setArray(arr,0); return ret; @@ -1478,7 +1478,7 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::aggregate(const std::vec throw INTERP_KERNEL::Exception("WithTimeStep::aggregate on mismatched time discretization !"); a[i]=itC->getArray(); } - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Aggregate(a); + MCAuto arr=DataArrayDouble::Aggregate(a); MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep; ret->setArray(arr,0); return ret; @@ -1489,7 +1489,7 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::meld(const MEDCouplingTi const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::meld on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Meld(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Meld(getArray(),other->getArray()); MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep; ret->setArray(arr,0); return ret; @@ -1501,7 +1501,7 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::dot(const MEDCouplingTim if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::dot on mismatched time discretization !"); MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep; - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Dot(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Dot(getArray(),other->getArray()); ret->setArray(arr,0); return ret; } @@ -1511,7 +1511,7 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::crossProduct(const MEDCo const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::crossProduct on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::CrossProduct(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::CrossProduct(getArray(),other->getArray()); MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep; ret->setArray(arr,0); return ret; @@ -1522,7 +1522,7 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::max(const MEDCouplingTim const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::max on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Max(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Max(getArray(),other->getArray()); MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep; ret->setArray(arr,0); return ret; @@ -1533,7 +1533,7 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::min(const MEDCouplingTim const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::min on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Min(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Min(getArray(),other->getArray()); MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep; ret->setArray(arr,0); return ret; @@ -1544,7 +1544,7 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::add(const MEDCouplingTim const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::add on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Add(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Add(getArray(),other->getArray()); MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep; ret->setArray(arr,0); int tmp1,tmp2; @@ -1568,7 +1568,7 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::substract(const MEDCoupl const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::substract on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Substract(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Substract(getArray(),other->getArray()); MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep; ret->setArray(arr,0); int tmp1,tmp2; @@ -1592,7 +1592,7 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::multiply(const MEDCoupli const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::multiply on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Multiply(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Multiply(getArray(),other->getArray()); MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep; ret->setArray(arr,0); int tmp1,tmp2; @@ -1616,7 +1616,7 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::divide(const MEDCoupling const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::divide on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Divide(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Divide(getArray(),other->getArray()); MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep; ret->setArray(arr,0); int tmp1,tmp2; @@ -1640,7 +1640,7 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::pow(const MEDCouplingTim const MEDCouplingWithTimeStep *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("WithTimeStep::pow on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Pow(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Pow(getArray(),other->getArray()); MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep; ret->setArray(arr,0); int tmp1,tmp2; @@ -1659,9 +1659,9 @@ void MEDCouplingWithTimeStep::powEqual(const MEDCouplingTimeDiscretization *othe getArray()->powEqual(other->getArray()); } -MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::performCpy(bool deepCpy) const +MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::performCopyOrIncrRef(bool deepCopy) const { - return new MEDCouplingWithTimeStep(*this,deepCpy); + return new MEDCouplingWithTimeStep(*this,deepCopy); } void MEDCouplingWithTimeStep::checkNoTimePresence() const @@ -1800,8 +1800,8 @@ void MEDCouplingConstOnTimeInterval::finishUnserialization2(const std::vector MEDCouplingConstOnTimeInterval::getArraysForTime(double time) const @@ -2003,7 +2003,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::aggregate(const M const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("ConstOnTimeInterval::aggregation on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Aggregate(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Aggregate(getArray(),other->getArray()); MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval; ret->setArray(arr,0); return ret; @@ -2020,7 +2020,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::aggregate(const s throw INTERP_KERNEL::Exception("ConstOnTimeInterval::aggregate on mismatched time discretization !"); a[i]=itC->getArray(); } - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Aggregate(a); + MCAuto arr=DataArrayDouble::Aggregate(a); MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval; ret->setArray(arr,0); return ret; @@ -2031,7 +2031,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::meld(const MEDCou const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("ConstOnTimeInterval::meld on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Meld(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Meld(getArray(),other->getArray()); MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval; ret->setTimeTolerance(getTimeTolerance()); ret->setArray(arr,0); @@ -2043,7 +2043,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::dot(const MEDCoup const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("ConstOnTimeInterval::dot on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Dot(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Dot(getArray(),other->getArray()); MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval; ret->setArray(arr,0); return ret; @@ -2054,7 +2054,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::crossProduct(cons const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("ConstOnTimeInterval::crossProduct on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::CrossProduct(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::CrossProduct(getArray(),other->getArray()); MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval; ret->setArray(arr,0); return ret; @@ -2065,7 +2065,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::max(const MEDCoup const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("ConstOnTimeInterval::max on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Max(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Max(getArray(),other->getArray()); MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval; ret->setArray(arr,0); return ret; @@ -2076,7 +2076,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::min(const MEDCoup const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("ConstOnTimeInterval::min on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Min(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Min(getArray(),other->getArray()); MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval; ret->setArray(arr,0); return ret; @@ -2087,7 +2087,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::add(const MEDCoup const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("ConstOnTimeInterval::add on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Add(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Add(getArray(),other->getArray()); MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval; ret->setArray(arr,0); int tmp1,tmp2; @@ -2113,7 +2113,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::substract(const M const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("ConstOnTimeInterval::substract on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Substract(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Substract(getArray(),other->getArray()); MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval; ret->setArray(arr,0); int tmp1,tmp2; @@ -2139,7 +2139,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::multiply(const ME const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("multiply on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Multiply(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Multiply(getArray(),other->getArray()); MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval; ret->setArray(arr,0); int tmp1,tmp2; @@ -2165,7 +2165,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::divide(const MEDC const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("divide on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Divide(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Divide(getArray(),other->getArray()); MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval; ret->setArray(arr,0); int tmp1,tmp2; @@ -2191,7 +2191,7 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::pow(const MEDCoup const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("pow on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Pow(getArray(),other->getArray()); + MCAuto arr=DataArrayDouble::Pow(getArray(),other->getArray()); MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval; ret->setArray(arr,0); int tmp1,tmp2; @@ -2212,13 +2212,13 @@ void MEDCouplingConstOnTimeInterval::powEqual(const MEDCouplingTimeDiscretizatio getArray()->powEqual(other->getArray()); } -MEDCouplingTwoTimeSteps::MEDCouplingTwoTimeSteps(const MEDCouplingTwoTimeSteps& other, bool deepCpy):MEDCouplingTimeDiscretization(other,deepCpy), +MEDCouplingTwoTimeSteps::MEDCouplingTwoTimeSteps(const MEDCouplingTwoTimeSteps& other, bool deepCopy):MEDCouplingTimeDiscretization(other,deepCopy), _start_time(other._start_time),_end_time(other._end_time), _start_iteration(other._start_iteration),_end_iteration(other._end_iteration), _start_order(other._start_order),_end_order(other._end_order) { if(other._end_array) - _end_array=other._end_array->performCpy(deepCpy); + _end_array=other._end_array->performCopyOrIncrRef(deepCopy); else _end_array=0; } @@ -2288,9 +2288,9 @@ DataArrayDouble *MEDCouplingTwoTimeSteps::getEndArray() return _end_array; } -void MEDCouplingTwoTimeSteps::checkCoherency() const +void MEDCouplingTwoTimeSteps::checkConsistencyLight() const { - MEDCouplingTimeDiscretization::checkCoherency(); + MEDCouplingTimeDiscretization::checkConsistencyLight(); if(!_end_array) throw INTERP_KERNEL::Exception("No end array specified !"); if(_array->getNumberOfComponents()!=_end_array->getNumberOfComponents()) @@ -2578,7 +2578,7 @@ void MEDCouplingTwoTimeSteps::setArrays(const std::vector& ar setEndArray(arrays.back(),owner); } -MEDCouplingLinearTime::MEDCouplingLinearTime(const MEDCouplingLinearTime& other, bool deepCpy):MEDCouplingTwoTimeSteps(other,deepCpy) +MEDCouplingLinearTime::MEDCouplingLinearTime(const MEDCouplingLinearTime& other, bool deepCopy):MEDCouplingTwoTimeSteps(other,deepCopy) { } @@ -2595,16 +2595,16 @@ std::string MEDCouplingLinearTime::getStringRepr() const return stream.str(); } -void MEDCouplingLinearTime::checkCoherency() const +void MEDCouplingLinearTime::checkConsistencyLight() const { - MEDCouplingTwoTimeSteps::checkCoherency(); + MEDCouplingTwoTimeSteps::checkConsistencyLight(); if(std::fabs(_start_time-_end_time)<_time_tolerance) throw INTERP_KERNEL::Exception("Start time and end time are equals regarding time tolerance."); } -MEDCouplingTimeDiscretization *MEDCouplingLinearTime::performCpy(bool deepCpy) const +MEDCouplingTimeDiscretization *MEDCouplingLinearTime::performCopyOrIncrRef(bool deepCopy) const { - return new MEDCouplingLinearTime(*this,deepCpy); + return new MEDCouplingLinearTime(*this,deepCopy); } bool MEDCouplingLinearTime::areCompatible(const MEDCouplingTimeDiscretization *other) const @@ -2725,8 +2725,8 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::aggregate(const MEDCouplin const MEDCouplingLinearTime *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::aggregation on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr1=DataArrayDouble::Aggregate(getArray(),other->getArray()); - MEDCouplingAutoRefCountObjectPtr arr2=DataArrayDouble::Aggregate(getEndArray(),other->getEndArray()); + MCAuto arr1=DataArrayDouble::Aggregate(getArray(),other->getArray()); + MCAuto arr2=DataArrayDouble::Aggregate(getEndArray(),other->getEndArray()); MEDCouplingLinearTime *ret=new MEDCouplingLinearTime; ret->setArray(arr1,0); ret->setEndArray(arr2,0); @@ -2746,8 +2746,8 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::aggregate(const std::vecto a[i]=itC->getArray(); b[i]=itC->getEndArray(); } - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::Aggregate(a); - MEDCouplingAutoRefCountObjectPtr arr2=DataArrayDouble::Aggregate(b); + MCAuto arr=DataArrayDouble::Aggregate(a); + MCAuto arr2=DataArrayDouble::Aggregate(b); MEDCouplingLinearTime *ret=new MEDCouplingLinearTime; ret->setArray(arr,0); ret->setEndArray(arr2,0); @@ -2759,8 +2759,8 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::meld(const MEDCouplingTime const MEDCouplingLinearTime *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::meld on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr1=DataArrayDouble::Meld(getArray(),other->getArray()); - MEDCouplingAutoRefCountObjectPtr arr2=DataArrayDouble::Meld(getEndArray(),other->getEndArray()); + MCAuto arr1=DataArrayDouble::Meld(getArray(),other->getArray()); + MCAuto arr2=DataArrayDouble::Meld(getEndArray(),other->getEndArray()); MEDCouplingLinearTime *ret=new MEDCouplingLinearTime; ret->setTimeTolerance(getTimeTolerance()); ret->setArray(arr1,0); @@ -2773,8 +2773,8 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::dot(const MEDCouplingTimeD const MEDCouplingLinearTime *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::dot on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr1=DataArrayDouble::Dot(getArray(),other->getArray()); - MEDCouplingAutoRefCountObjectPtr arr2=DataArrayDouble::Dot(getEndArray(),other->getEndArray()); + MCAuto arr1=DataArrayDouble::Dot(getArray(),other->getArray()); + MCAuto arr2=DataArrayDouble::Dot(getEndArray(),other->getEndArray()); MEDCouplingLinearTime *ret=new MEDCouplingLinearTime; ret->setArray(arr1,0); ret->setEndArray(arr2,0); @@ -2786,8 +2786,8 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::crossProduct(const MEDCoup const MEDCouplingLinearTime *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::crossProduct on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr1=DataArrayDouble::CrossProduct(getArray(),other->getArray()); - MEDCouplingAutoRefCountObjectPtr arr2=DataArrayDouble::CrossProduct(getEndArray(),other->getEndArray()); + MCAuto arr1=DataArrayDouble::CrossProduct(getArray(),other->getArray()); + MCAuto arr2=DataArrayDouble::CrossProduct(getEndArray(),other->getEndArray()); MEDCouplingLinearTime *ret=new MEDCouplingLinearTime; ret->setArray(arr1,0); ret->setEndArray(arr2,0); @@ -2800,8 +2800,8 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::max(const MEDCouplingTimeD if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::max on mismatched time discretization !"); MEDCouplingLinearTime *ret=new MEDCouplingLinearTime; - MEDCouplingAutoRefCountObjectPtr arr1=DataArrayDouble::Max(getArray(),other->getArray()); - MEDCouplingAutoRefCountObjectPtr arr2=DataArrayDouble::Max(getEndArray(),other->getEndArray()); + MCAuto arr1=DataArrayDouble::Max(getArray(),other->getArray()); + MCAuto arr2=DataArrayDouble::Max(getEndArray(),other->getEndArray()); ret->setArray(arr1,0); ret->setEndArray(arr2,0); return ret; @@ -2812,8 +2812,8 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::min(const MEDCouplingTimeD const MEDCouplingLinearTime *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::min on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr1=DataArrayDouble::Min(getArray(),other->getArray()); - MEDCouplingAutoRefCountObjectPtr arr2=DataArrayDouble::Min(getEndArray(),other->getEndArray()); + MCAuto arr1=DataArrayDouble::Min(getArray(),other->getArray()); + MCAuto arr2=DataArrayDouble::Min(getEndArray(),other->getEndArray()); MEDCouplingLinearTime *ret=new MEDCouplingLinearTime; ret->setArray(arr1,0); ret->setEndArray(arr2,0); @@ -2825,8 +2825,8 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::add(const MEDCouplingTimeD const MEDCouplingLinearTime *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::add on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr1=DataArrayDouble::Add(getArray(),other->getArray()); - MEDCouplingAutoRefCountObjectPtr arr2=DataArrayDouble::Add(getEndArray(),other->getEndArray()); + MCAuto arr1=DataArrayDouble::Add(getArray(),other->getArray()); + MCAuto arr2=DataArrayDouble::Add(getEndArray(),other->getEndArray()); MEDCouplingLinearTime *ret=new MEDCouplingLinearTime; ret->setArray(arr1,0); ret->setEndArray(arr2,0); @@ -2851,8 +2851,8 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::substract(const MEDCouplin const MEDCouplingLinearTime *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::substract on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr1=DataArrayDouble::Substract(getArray(),other->getArray()); - MEDCouplingAutoRefCountObjectPtr arr2=DataArrayDouble::Substract(getEndArray(),other->getEndArray()); + MCAuto arr1=DataArrayDouble::Substract(getArray(),other->getArray()); + MCAuto arr2=DataArrayDouble::Substract(getEndArray(),other->getEndArray()); MEDCouplingLinearTime *ret=new MEDCouplingLinearTime; ret->setArray(arr1,0); ret->setEndArray(arr2,0); @@ -2877,8 +2877,8 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::multiply(const MEDCoupling const MEDCouplingLinearTime *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::multiply on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr1=DataArrayDouble::Multiply(getArray(),other->getArray()); - MEDCouplingAutoRefCountObjectPtr arr2=DataArrayDouble::Multiply(getEndArray(),other->getEndArray()); + MCAuto arr1=DataArrayDouble::Multiply(getArray(),other->getArray()); + MCAuto arr2=DataArrayDouble::Multiply(getEndArray(),other->getEndArray()); MEDCouplingLinearTime *ret=new MEDCouplingLinearTime; ret->setArray(arr1,0); ret->setEndArray(arr2,0); @@ -2903,8 +2903,8 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::divide(const MEDCouplingTi const MEDCouplingLinearTime *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::divide on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr1=DataArrayDouble::Divide(getArray(),other->getArray()); - MEDCouplingAutoRefCountObjectPtr arr2=DataArrayDouble::Divide(getEndArray(),other->getEndArray()); + MCAuto arr1=DataArrayDouble::Divide(getArray(),other->getArray()); + MCAuto arr2=DataArrayDouble::Divide(getEndArray(),other->getEndArray()); MEDCouplingLinearTime *ret=new MEDCouplingLinearTime; ret->setArray(arr1,0); ret->setEndArray(arr2,0); @@ -2929,8 +2929,8 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::pow(const MEDCouplingTimeD const MEDCouplingLinearTime *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("LinearTime::pow on mismatched time discretization !"); - MEDCouplingAutoRefCountObjectPtr arr1=DataArrayDouble::Pow(getArray(),other->getArray()); - MEDCouplingAutoRefCountObjectPtr arr2=DataArrayDouble::Pow(getEndArray(),other->getEndArray()); + MCAuto arr1=DataArrayDouble::Pow(getArray(),other->getArray()); + MCAuto arr2=DataArrayDouble::Pow(getEndArray(),other->getEndArray()); MEDCouplingLinearTime *ret=new MEDCouplingLinearTime; ret->setArray(arr1,0); ret->setEndArray(arr2,0); diff --git a/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx b/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx index 1a3991d92..03b2ccc34 100644 --- a/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx +++ b/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx @@ -38,7 +38,7 @@ namespace MEDCoupling { protected: MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization(); - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization(const MEDCouplingTimeDiscretization& other, bool deepCpy); + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization(const MEDCouplingTimeDiscretization& other, bool deepCopy); public: MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT virtual std::size_t getHeapMemorySizeWithoutChildren() const; @@ -48,7 +48,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT std::string getTimeUnit() const { return _time_unit; } MEDCOUPLING_EXPORT virtual void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other); MEDCOUPLING_EXPORT virtual void copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other); - MEDCOUPLING_EXPORT virtual void checkCoherency() const; + MEDCOUPLING_EXPORT virtual void checkConsistencyLight() const; MEDCOUPLING_EXPORT virtual bool areCompatible(const MEDCouplingTimeDiscretization *other) const; MEDCOUPLING_EXPORT virtual bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const; MEDCOUPLING_EXPORT virtual bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const; @@ -57,7 +57,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const; MEDCOUPLING_EXPORT virtual bool isEqual(const MEDCouplingTimeDiscretization *other, double prec) const; MEDCOUPLING_EXPORT virtual bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const; - MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *buildNewTimeReprFromThis(TypeOfTimeDiscretization type, bool deepCpy) const; + MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *buildNewTimeReprFromThis(TypeOfTimeDiscretization type, bool deepCopy) const; MEDCOUPLING_EXPORT virtual std::string getStringRepr() const = 0; MEDCOUPLING_EXPORT virtual TypeOfTimeDiscretization getEnum() const = 0; MEDCOUPLING_EXPORT virtual void synchronizeTimeWith(const MEDCouplingMesh *mesh) = 0; @@ -87,7 +87,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual void getTinySerializationIntInformation2(std::vector& tinyInfo) const = 0; MEDCOUPLING_EXPORT virtual void getTinySerializationDbleInformation2(std::vector& tinyInfo) const = 0; MEDCOUPLING_EXPORT virtual void finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD) = 0; - MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const = 0; + MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *performCopyOrIncrRef(bool deepCopy) const = 0; MEDCOUPLING_EXPORT void setTimeTolerance(double val) { _time_tolerance=val; } MEDCOUPLING_EXPORT double getTimeTolerance() const { return _time_tolerance; } MEDCOUPLING_EXPORT virtual void checkNoTimePresence() const = 0; @@ -142,15 +142,15 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual void applyLin(double a, double b); MEDCOUPLING_EXPORT virtual void applyFunc(int nbOfComp, FunctionToEvaluate func); MEDCOUPLING_EXPORT virtual void applyFunc(int nbOfComp, const std::string& func); - MEDCOUPLING_EXPORT virtual void applyFunc2(int nbOfComp, const std::string& func); - MEDCOUPLING_EXPORT virtual void applyFunc3(int nbOfComp, const std::vector& varsOrder, const std::string& func); + MEDCOUPLING_EXPORT virtual void applyFuncCompo(int nbOfComp, const std::string& func); + MEDCOUPLING_EXPORT virtual void applyFuncNamedCompo(int nbOfComp, const std::vector& varsOrder, const std::string& func); MEDCOUPLING_EXPORT virtual void applyFunc(const std::string& func); MEDCOUPLING_EXPORT virtual void applyFuncFast32(const std::string& func); MEDCOUPLING_EXPORT virtual void applyFuncFast64(const std::string& func); MEDCOUPLING_EXPORT virtual void fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, FunctionToEvaluate func); MEDCOUPLING_EXPORT virtual void fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, const std::string& func); - MEDCOUPLING_EXPORT virtual void fillFromAnalytic2(const DataArrayDouble *loc, int nbOfComp, const std::string& func); - MEDCOUPLING_EXPORT virtual void fillFromAnalytic3(const DataArrayDouble *loc, int nbOfComp, const std::vector& varsOrder, const std::string& func); + MEDCOUPLING_EXPORT virtual void fillFromAnalyticCompo(const DataArrayDouble *loc, int nbOfComp, const std::string& func); + MEDCOUPLING_EXPORT virtual void fillFromAnalyticNamedCompo(const DataArrayDouble *loc, int nbOfComp, const std::vector& varsOrder, const std::string& func); // MEDCOUPLING_EXPORT virtual ~MEDCouplingTimeDiscretization(); protected: @@ -165,7 +165,7 @@ namespace MEDCoupling { public: MEDCOUPLING_EXPORT MEDCouplingNoTimeLabel(); - MEDCOUPLING_EXPORT MEDCouplingNoTimeLabel(const MEDCouplingTimeDiscretization& other, bool deepCpy); + MEDCOUPLING_EXPORT MEDCouplingNoTimeLabel(const MEDCouplingTimeDiscretization& other, bool deepCopy); MEDCOUPLING_EXPORT std::string getStringRepr() const; MEDCOUPLING_EXPORT TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; } MEDCOUPLING_EXPORT void synchronizeTimeWith(const MEDCouplingMesh *mesh); @@ -193,7 +193,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const; MEDCOUPLING_EXPORT bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretization *other) const; MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCopyOrIncrRef(bool deepCopy) const; MEDCOUPLING_EXPORT void checkNoTimePresence() const { } MEDCOUPLING_EXPORT void checkTimePresence(double time) const; MEDCOUPLING_EXPORT std::vector< const DataArrayDouble *> getArraysForTime(double time) const; @@ -225,7 +225,7 @@ namespace MEDCoupling class MEDCouplingWithTimeStep : public MEDCouplingTimeDiscretization { protected: - MEDCOUPLING_EXPORT MEDCouplingWithTimeStep(const MEDCouplingWithTimeStep& other, bool deepCpy); + MEDCOUPLING_EXPORT MEDCouplingWithTimeStep(const MEDCouplingWithTimeStep& other, bool deepCopy); public: MEDCOUPLING_EXPORT MEDCouplingWithTimeStep(); MEDCOUPLING_EXPORT std::string getStringRepr() const; @@ -262,7 +262,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD); - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCopyOrIncrRef(bool deepCopy) const; MEDCOUPLING_EXPORT void checkNoTimePresence() const; MEDCOUPLING_EXPORT void checkTimePresence(double time) const; MEDCOUPLING_EXPORT void setStartTime(double time, int iteration, int order) { _time=time; _iteration=iteration; _order=order; } @@ -293,7 +293,7 @@ namespace MEDCoupling class MEDCouplingConstOnTimeInterval : public MEDCouplingTimeDiscretization { protected: - MEDCOUPLING_EXPORT MEDCouplingConstOnTimeInterval(const MEDCouplingConstOnTimeInterval& other, bool deepCpy); + MEDCOUPLING_EXPORT MEDCouplingConstOnTimeInterval(const MEDCouplingConstOnTimeInterval& other, bool deepCopy); public: MEDCOUPLING_EXPORT MEDCouplingConstOnTimeInterval(); MEDCOUPLING_EXPORT void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other); @@ -303,7 +303,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD); - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCopyOrIncrRef(bool deepCopy) const; MEDCOUPLING_EXPORT bool areCompatible(const MEDCouplingTimeDiscretization *other) const; MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const; MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const; @@ -364,7 +364,7 @@ namespace MEDCoupling class MEDCouplingTwoTimeSteps : public MEDCouplingTimeDiscretization { protected: - MEDCOUPLING_EXPORT MEDCouplingTwoTimeSteps(const MEDCouplingTwoTimeSteps& other, bool deepCpy); + MEDCOUPLING_EXPORT MEDCouplingTwoTimeSteps(const MEDCouplingTwoTimeSteps& other, bool deepCopy); MEDCOUPLING_EXPORT MEDCouplingTwoTimeSteps(); MEDCOUPLING_EXPORT ~MEDCouplingTwoTimeSteps(); public: @@ -376,7 +376,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other); MEDCOUPLING_EXPORT const DataArrayDouble *getEndArray() const; MEDCOUPLING_EXPORT DataArrayDouble *getEndArray(); - MEDCOUPLING_EXPORT void checkCoherency() const; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const; MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const; MEDCOUPLING_EXPORT void checkNoTimePresence() const; @@ -419,13 +419,13 @@ namespace MEDCoupling class MEDCouplingLinearTime : public MEDCouplingTwoTimeSteps { protected: - MEDCOUPLING_EXPORT MEDCouplingLinearTime(const MEDCouplingLinearTime& other, bool deepCpy); + MEDCOUPLING_EXPORT MEDCouplingLinearTime(const MEDCouplingLinearTime& other, bool deepCopy); public: MEDCOUPLING_EXPORT MEDCouplingLinearTime(); MEDCOUPLING_EXPORT std::string getStringRepr() const; MEDCOUPLING_EXPORT TypeOfTimeDiscretization getEnum() const { return DISCRETIZATION; } - MEDCOUPLING_EXPORT void checkCoherency() const; - MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; + MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *performCopyOrIncrRef(bool deepCopy) const; MEDCOUPLING_EXPORT bool areCompatible(const MEDCouplingTimeDiscretization *other) const; MEDCOUPLING_EXPORT bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const; MEDCOUPLING_EXPORT bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const; diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 0d5dd70af..ff320449f 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -76,7 +76,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::New(const std::string& meshName, int meshDim * \return MEDCouplingUMesh * - a new instance of MEDCouplingMesh. The caller is to * delete this mesh using decrRef() as it is no more needed. */ -MEDCouplingUMesh *MEDCouplingUMesh::deepCpy() const +MEDCouplingUMesh *MEDCouplingUMesh::deepCopy() const { return clone(true); } @@ -95,17 +95,17 @@ MEDCouplingUMesh *MEDCouplingUMesh::clone(bool recDeepCpy) const } /*! - * This method behaves mostly like MEDCouplingUMesh::deepCpy method, except that only nodal connectivity arrays are deeply copied. + * This method behaves mostly like MEDCouplingUMesh::deepCopy method, except that only nodal connectivity arrays are deeply copied. * The coordinates are shared between \a this and the returned instance. * * \return MEDCouplingUMesh * - A new object instance holding the copy of \a this (deep for connectivity, shallow for coordiantes) - * \sa MEDCouplingUMesh::deepCpy + * \sa MEDCouplingUMesh::deepCopy */ -MEDCouplingUMesh *MEDCouplingUMesh::deepCpyConnectivityOnly() const +MEDCouplingUMesh *MEDCouplingUMesh::deepCopyConnectivityOnly() const { checkConnectivityFullyDefined(); - MEDCouplingAutoRefCountObjectPtr ret=clone(false); - MEDCouplingAutoRefCountObjectPtr c(getNodalConnectivity()->deepCpy()),ci(getNodalConnectivityIndex()->deepCpy()); + MCAuto ret=clone(false); + MCAuto c(getNodalConnectivity()->deepCopy()),ci(getNodalConnectivityIndex()->deepCopy()); ret->setConnectivity(c,ci); return ret.retn(); } @@ -165,12 +165,12 @@ MEDCouplingUMesh::MEDCouplingUMesh():_mesh_dim(-2),_nodal_connec(0),_nodal_conne * \throw If the connectivity index data array has more than one component. * \throw If the connectivity index data array has a named component. */ -void MEDCouplingUMesh::checkCoherency() const +void MEDCouplingUMesh::checkConsistencyLight() const { if(_mesh_dim<-1) throw INTERP_KERNEL::Exception("No mesh dimension specified !"); if(_mesh_dim!=-1) - MEDCouplingPointSet::checkCoherency(); + MEDCouplingPointSet::checkConsistencyLight(); for(std::set::const_iterator iter=_types.begin();iter!=_types.end();iter++) { if((int)INTERP_KERNEL::CellModel::GetCellModel(*iter).getDimension()!=_mesh_dim) @@ -205,7 +205,7 @@ void MEDCouplingUMesh::checkCoherency() const /*! * Checks if \a this mesh is well defined. If no exception is thrown by this method, * then \a this mesh is most probably is writable, exchangeable and available for all - * algorithms.
In addition to the checks performed by checkCoherency(), this + * algorithms.
In addition to the checks performed by checkConsistencyLight(), this * method thoroughly checks the nodal connectivity. * \param [in] eps - a not used parameter. * \throw If the mesh dimension is not set. @@ -218,9 +218,9 @@ void MEDCouplingUMesh::checkCoherency() const * \throw If number of nodes defining an element does not correspond to the type of element. * \throw If the nodal connectivity includes an invalid node id. */ -void MEDCouplingUMesh::checkCoherency1(double eps) const +void MEDCouplingUMesh::checkConsistency(double eps) const { - checkCoherency(); + checkConsistencyLight(); if(_mesh_dim==-1) return ; int meshDim=getMeshDimension(); @@ -234,7 +234,7 @@ void MEDCouplingUMesh::checkCoherency1(double eps) const if((int)cm.getDimension()!=meshDim) { std::ostringstream oss; - oss << "MEDCouplingUMesh::checkCoherency1 : cell << #" << i<< " with type Type " << cm.getRepr() << " in 'this' whereas meshdim == " << meshDim << " !"; + oss << "MEDCouplingUMesh::checkConsistency : cell << #" << i<< " with type Type " << cm.getRepr() << " in 'this' whereas meshdim == " << meshDim << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } int nbOfNodesInCell=ptrI[i+1]-ptrI[i]-1; @@ -242,7 +242,7 @@ void MEDCouplingUMesh::checkCoherency1(double eps) const if(nbOfNodesInCell!=(int)cm.getNumberOfNodes()) { std::ostringstream oss; - oss << "MEDCouplingUMesh::checkCoherency1 : cell #" << i << " with static Type '" << cm.getRepr() << "' has " << cm.getNumberOfNodes(); + oss << "MEDCouplingUMesh::checkConsistency : cell #" << i << " with static Type '" << cm.getRepr() << "' has " << cm.getNumberOfNodes(); oss << " nodes whereas in connectivity there is " << nbOfNodesInCell << " nodes ! Looks very bad !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } @@ -250,7 +250,7 @@ void MEDCouplingUMesh::checkCoherency1(double eps) const if (nbOfNodesInCell % 2 || nbOfNodesInCell < 4) { std::ostringstream oss; - oss << "MEDCouplingUMesh::checkCoherency1 : cell #" << i << " with quadratic type '" << cm.getRepr() << "' has " << nbOfNodesInCell; + oss << "MEDCouplingUMesh::checkConsistency : cell #" << i << " with quadratic type '" << cm.getRepr() << "' has " << nbOfNodesInCell; oss << " nodes. This should be even, and greater or equal than 4!! Looks very bad!"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } @@ -438,7 +438,7 @@ std::vector MEDCouplingUMesh::getAllGeoTypesS int nbOfCells(getNumberOfCells()); if(nbOfCells==0) return ret; - if(getMeshLength()<1) + if(getNodalConnectivityArrayLen()<1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getAllGeoTypesSorted : the connectivity in this seems invalid !"); const int *c(_nodal_connec->begin()),*ci(_nodal_connec_index->begin()); ret.push_back((INTERP_KERNEL::NormalizedCellType)c[*ci++]); @@ -813,11 +813,11 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivity2(DataArrayInt *d */ void MEDCouplingUMesh::computeNeighborsOfCells(DataArrayInt *&neighbors, DataArrayInt *&neighborsIndx) const { - MEDCouplingAutoRefCountObjectPtr desc=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr descIndx=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr revDesc=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr revDescIndx=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); + MCAuto desc=DataArrayInt::New(); + MCAuto descIndx=DataArrayInt::New(); + MCAuto revDesc=DataArrayInt::New(); + MCAuto revDescIndx=DataArrayInt::New(); + MCAuto meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); meshDM1=0; ComputeNeighborsOfCellsAdv(desc,descIndx,revDesc,revDescIndx,neighbors,neighborsIndx); } @@ -853,8 +853,8 @@ void MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, cons const int *revDescIPtr=revDescIndx->getConstPointer(); // int nbCells=descIndx->getNumberOfTuples()-1; - MEDCouplingAutoRefCountObjectPtr out0=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr out1=DataArrayInt::New(); out1->alloc(nbCells+1,1); + MCAuto out0=DataArrayInt::New(); + MCAuto out1=DataArrayInt::New(); out1->alloc(nbCells+1,1); int *out1Ptr=out1->getPointer(); *out1Ptr++=0; out0->reserve(desc->getNumberOfTuples()); @@ -891,8 +891,8 @@ void MEDCouplingUMesh::computeNeighborsOfNodes(DataArrayInt *&neighbors, DataArr { checkFullyDefined(); int mdim(getMeshDimension()),nbNodes(getNumberOfNodes()); - MEDCouplingAutoRefCountObjectPtr desc(DataArrayInt::New()),descIndx(DataArrayInt::New()),revDesc(DataArrayInt::New()),revDescIndx(DataArrayInt::New()); - MEDCouplingAutoRefCountObjectPtr mesh1D; + MCAuto desc(DataArrayInt::New()),descIndx(DataArrayInt::New()),revDesc(DataArrayInt::New()),revDescIndx(DataArrayInt::New()); + MCAuto mesh1D; switch(mdim) { case 3: @@ -918,7 +918,7 @@ void MEDCouplingUMesh::computeNeighborsOfNodes(DataArrayInt *&neighbors, DataArr } desc=DataArrayInt::New(); descIndx=DataArrayInt::New(); revDesc=0; revDescIndx=0; mesh1D->getReverseNodalConnectivity(desc,descIndx); - MEDCouplingAutoRefCountObjectPtr ret0(DataArrayInt::New()); + MCAuto ret0(DataArrayInt::New()); ret0->alloc(desc->getNumberOfTuples(),1); int *r0Pt(ret0->getPointer()); const int *c1DPtr(mesh1D->getNodalConnectivity()->begin()),*rn(desc->begin()),*rni(descIndx->begin()); @@ -945,16 +945,16 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivityGen(DataArrayInt checkConnectivityFullyDefined(); int nbOfCells=getNumberOfCells(); int nbOfNodes=getNumberOfNodes(); - MEDCouplingAutoRefCountObjectPtr revNodalIndx=DataArrayInt::New(); revNodalIndx->alloc(nbOfNodes+1,1); revNodalIndx->fillWithZero(); + MCAuto revNodalIndx=DataArrayInt::New(); revNodalIndx->alloc(nbOfNodes+1,1); revNodalIndx->fillWithZero(); int *revNodalIndxPtr=revNodalIndx->getPointer(); const int *conn=_nodal_connec->getConstPointer(); const int *connIndex=_nodal_connec_index->getConstPointer(); std::string name="Mesh constituent of "; name+=getName(); - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingUMesh::New(name,getMeshDimension()-SonsGenerator::DELTA); + MCAuto ret=MEDCouplingUMesh::New(name,getMeshDimension()-SonsGenerator::DELTA); ret->setCoords(getCoords()); ret->allocateCells(2*nbOfCells); descIndx->alloc(nbOfCells+1,1); - MEDCouplingAutoRefCountObjectPtr revDesc2(DataArrayInt::New()); revDesc2->reserve(2*nbOfCells); + MCAuto revDesc2(DataArrayInt::New()); revDesc2->reserve(2*nbOfCells); int *descIndxPtr=descIndx->getPointer(); *descIndxPtr++=0; for(int eltId=0;eltIdgetNumberOfCells(); std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus()); - MEDCouplingAutoRefCountObjectPtr revNodal=DataArrayInt::New(); revNodal->alloc(revNodalIndx->back(),1); + MCAuto revNodal=DataArrayInt::New(); revNodal->alloc(revNodalIndx->back(),1); std::fill(revNodal->getPointer(),revNodal->getPointer()+revNodalIndx->back(),-1); int *revNodalPtr=revNodal->getPointer(); const int *connM1=ret->getNodalConnectivity()->getConstPointer(); @@ -994,19 +994,19 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivityGen(DataArrayInt // DataArrayInt *commonCells=0,*commonCellsI=0; FindCommonCellsAlg(3,0,ret->getNodalConnectivity(),ret->getNodalConnectivityIndex(),revNodal,revNodalIndx,commonCells,commonCellsI); - MEDCouplingAutoRefCountObjectPtr commonCellsTmp(commonCells),commonCellsITmp(commonCellsI); + MCAuto commonCellsTmp(commonCells),commonCellsITmp(commonCellsI); const int *commonCellsPtr(commonCells->getConstPointer()),*commonCellsIPtr(commonCellsI->getConstPointer()); int newNbOfCellsM1=-1; - MEDCouplingAutoRefCountObjectPtr o2nM1=DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfCellsM1,commonCells->begin(), + MCAuto o2nM1=DataArrayInt::ConvertIndexArrayToO2N(nbOfCellsM1,commonCells->begin(), commonCellsI->begin(),commonCellsI->end(),newNbOfCellsM1); std::vector isImpacted(nbOfCellsM1,false); for(const int *work=commonCellsI->begin();work!=commonCellsI->end()-1;work++) for(int work2=work[0];work2!=work[1];work2++) isImpacted[commonCellsPtr[work2]]=true; const int *o2nM1Ptr=o2nM1->getConstPointer(); - MEDCouplingAutoRefCountObjectPtr n2oM1=o2nM1->invertArrayO2N2N2OBis(newNbOfCellsM1); + MCAuto n2oM1=o2nM1->invertArrayO2N2N2OBis(newNbOfCellsM1); const int *n2oM1Ptr=n2oM1->getConstPointer(); - MEDCouplingAutoRefCountObjectPtr ret2=static_cast(ret->buildPartOfMySelf(n2oM1->begin(),n2oM1->end(),true)); + MCAuto ret2=static_cast(ret->buildPartOfMySelf(n2oM1->begin(),n2oM1->end(),true)); ret2->copyTinyInfoFrom(this); desc->alloc(descIndx->back(),1); int *descPtr=desc->getPointer(); @@ -1115,7 +1115,7 @@ void MEDCouplingUMesh::convertToPolyTypes(const int *cellIdsToConvertBg, const i { int *connIndex(_nodal_connec_index->getPointer()); const int *connOld(_nodal_connec->getConstPointer()); - MEDCouplingAutoRefCountObjectPtr connNew(DataArrayInt::New()),connNewI(DataArrayInt::New()); connNew->alloc(0,1); connNewI->alloc(1,1); connNewI->setIJ(0,0,0); + MCAuto connNew(DataArrayInt::New()),connNewI(DataArrayInt::New()); connNew->alloc(0,1); connNewI->alloc(1,1); connNewI->setIJ(0,0,0); std::vector toBeDone(nbOfCells,false); for(const int *iter=cellIdsToConvertBg;iter!=cellIdsToConvertEnd;iter++) { @@ -1213,7 +1213,7 @@ void MEDCouplingUMesh::convertExtrudedPolyhedra() if(getMeshDimension()!=3 || getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertExtrudedPolyhedra works on umeshes with meshdim equal to 3 and spaceDim equal to 3 too!"); int nbOfCells=getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr newCi=DataArrayInt::New(); + MCAuto newCi=DataArrayInt::New(); newCi->alloc(nbOfCells+1,1); int *newci=newCi->getPointer(); const int *ci=_nodal_connec_index->getConstPointer(); @@ -1241,7 +1241,7 @@ void MEDCouplingUMesh::convertExtrudedPolyhedra() else newci[i+1]=(ci[i+1]-ci[i])+newci[i]; } - MEDCouplingAutoRefCountObjectPtr newC=DataArrayInt::New(); + MCAuto newC=DataArrayInt::New(); newC->alloc(newci[nbOfCells],1); int *newc=newC->getPointer(); for(int i=0;igetPointer(); int *index=_nodal_connec_index->getPointer(); int posOfCurCell=0; @@ -1366,16 +1366,16 @@ void MEDCouplingUMesh::simplifyPolyhedra(double eps) checkFullyDefined(); if(getMeshDimension()!=3 || getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplifyPolyhedra : works on meshdimension 3 and spaceDimension 3 !"); - MEDCouplingAutoRefCountObjectPtr coords=getCoords()->deepCpy(); + MCAuto coords=getCoords()->deepCopy(); coords->recenterForMaxPrecision(eps); // int nbOfCells=getNumberOfCells(); const int *conn=_nodal_connec->getConstPointer(); const int *index=_nodal_connec_index->getConstPointer(); - MEDCouplingAutoRefCountObjectPtr connINew=DataArrayInt::New(); + MCAuto connINew=DataArrayInt::New(); connINew->alloc(nbOfCells+1,1); int *connINewPtr=connINew->getPointer(); *connINewPtr++=0; - MEDCouplingAutoRefCountObjectPtr connNew=DataArrayInt::New(); connNew->alloc(0,1); + MCAuto connNew=DataArrayInt::New(); connNew->alloc(0,1); bool changed=false; for(int i=0;i ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfNodes,1); int *traducer=ret->getPointer(); std::fill(traducer,traducer+nbOfNodes,-1); @@ -1508,7 +1508,7 @@ DataArrayInt *MEDCouplingUMesh::computeNbOfNodesPerCell() const { checkConnectivityFullyDefined(); int nbOfCells=getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfCells,1); int *retPtr=ret->getPointer(); const int *conn=getNodalConnectivity()->getConstPointer(); @@ -1534,7 +1534,7 @@ DataArrayInt *MEDCouplingUMesh::computeEffectiveNbOfNodesPerCell() const { checkConnectivityFullyDefined(); int nbOfCells=getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfCells,1); int *retPtr=ret->getPointer(); const int *conn=getNodalConnectivity()->getConstPointer(); @@ -1563,7 +1563,7 @@ DataArrayInt *MEDCouplingUMesh::computeNbOfFacesPerCell() const { checkConnectivityFullyDefined(); int nbOfCells=getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfCells,1); int *retPtr=ret->getPointer(); const int *conn=getNodalConnectivity()->getConstPointer(); @@ -1607,15 +1607,15 @@ int MEDCouplingUMesh::AreCellsEqual(const int *conn, const int *connI, int cell1 switch(compType) { case 0: - return AreCellsEqual0(conn,connI,cell1,cell2); + return AreCellsEqualPolicy0(conn,connI,cell1,cell2); case 1: - return AreCellsEqual1(conn,connI,cell1,cell2); + return AreCellsEqualPolicy1(conn,connI,cell1,cell2); case 2: - return AreCellsEqual2(conn,connI,cell1,cell2); + return AreCellsEqualPolicy2(conn,connI,cell1,cell2); case 3: - return AreCellsEqual3(conn,connI,cell1,cell2); + return AreCellsEqualPolicy2NoType(conn,connI,cell1,cell2); case 7: - return AreCellsEqual7(conn,connI,cell1,cell2); + return AreCellsEqualPolicy7(conn,connI,cell1,cell2); } throw INTERP_KERNEL::Exception("Unknown comparison asked ! Must be in 0,1,2,3 or 7."); } @@ -1623,7 +1623,7 @@ int MEDCouplingUMesh::AreCellsEqual(const int *conn, const int *connI, int cell1 /*! * This method is the last step of the MEDCouplingPointSet::zipConnectivityTraducer with policy 0. */ -int MEDCouplingUMesh::AreCellsEqual0(const int *conn, const int *connI, int cell1, int cell2) +int MEDCouplingUMesh::AreCellsEqualPolicy0(const int *conn, const int *connI, int cell1, int cell2) { if(connI[cell1+1]-connI[cell1]==connI[cell2+1]-connI[cell2]) return std::equal(conn+connI[cell1]+1,conn+connI[cell1+1],conn+connI[cell2]+1)?1:0; @@ -1633,7 +1633,7 @@ int MEDCouplingUMesh::AreCellsEqual0(const int *conn, const int *connI, int cell /*! * This method is the last step of the MEDCouplingPointSet::zipConnectivityTraducer with policy 1. */ -int MEDCouplingUMesh::AreCellsEqual1(const int *conn, const int *connI, int cell1, int cell2) +int MEDCouplingUMesh::AreCellsEqualPolicy1(const int *conn, const int *connI, int cell1, int cell2) { int sz=connI[cell1+1]-connI[cell1]; if(sz==connI[cell2+1]-connI[cell2]) @@ -1657,7 +1657,7 @@ int MEDCouplingUMesh::AreCellsEqual1(const int *conn, const int *connI, int cell return std::equal(conn+connI[cell1]+1,conn+connI[cell1+1],conn+connI[cell2]+1)?1:0;//case of SEG2 and SEG3 } else - throw INTERP_KERNEL::Exception("MEDCouplingUMesh::AreCellsEqual1 : not implemented yet for meshdim == 3 !"); + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::AreCellsEqualPolicy1 : not implemented yet for meshdim == 3 !"); } } return 0; @@ -1666,7 +1666,7 @@ int MEDCouplingUMesh::AreCellsEqual1(const int *conn, const int *connI, int cell /*! * This method is the last step of the MEDCouplingPointSet::zipConnectivityTraducer with policy 2. */ -int MEDCouplingUMesh::AreCellsEqual2(const int *conn, const int *connI, int cell1, int cell2) +int MEDCouplingUMesh::AreCellsEqualPolicy2(const int *conn, const int *connI, int cell1, int cell2) { if(connI[cell1+1]-connI[cell1]==connI[cell2+1]-connI[cell2]) { @@ -1681,9 +1681,9 @@ int MEDCouplingUMesh::AreCellsEqual2(const int *conn, const int *connI, int cell } /*! - * This method is less restrictive than AreCellsEqual2. Here the geometric type is absolutely not taken into account ! + * This method is less restrictive than AreCellsEqualPolicy2. Here the geometric type is absolutely not taken into account ! */ -int MEDCouplingUMesh::AreCellsEqual3(const int *conn, const int *connI, int cell1, int cell2) +int MEDCouplingUMesh::AreCellsEqualPolicy2NoType(const int *conn, const int *connI, int cell1, int cell2) { if(connI[cell1+1]-connI[cell1]==connI[cell2+1]-connI[cell2]) { @@ -1697,7 +1697,7 @@ int MEDCouplingUMesh::AreCellsEqual3(const int *conn, const int *connI, int cell /*! * This method is the last step of the MEDCouplingPointSet::zipConnectivityTraducer with policy 7. */ -int MEDCouplingUMesh::AreCellsEqual7(const int *conn, const int *connI, int cell1, int cell2) +int MEDCouplingUMesh::AreCellsEqualPolicy7(const int *conn, const int *connI, int cell1, int cell2) { int sz=connI[cell1+1]-connI[cell1]; if(sz==connI[cell2+1]-connI[cell2]) @@ -1750,7 +1750,7 @@ int MEDCouplingUMesh::AreCellsEqual7(const int *conn, const int *connI, int cell } } else - throw INTERP_KERNEL::Exception("MEDCouplingUMesh::AreCellsEqual7 : not implemented yet for meshdim == 3 !"); + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::AreCellsEqualPolicy7 : not implemented yet for meshdim == 3 !"); } } return 0; @@ -1809,7 +1809,7 @@ bool MEDCouplingUMesh::AreCellsEqualInPool(const std::vector& candidates, i */ void MEDCouplingUMesh::findCommonCells(int compType, int startCellId, DataArrayInt *& commonCellsArr, DataArrayInt *& commonCellsIArr) const { - MEDCouplingAutoRefCountObjectPtr revNodal=DataArrayInt::New(),revNodalI=DataArrayInt::New(); + MCAuto revNodal=DataArrayInt::New(),revNodalI=DataArrayInt::New(); getReverseNodalConnectivity(revNodal,revNodalI); FindCommonCellsAlg(compType,startCellId,_nodal_connec,_nodal_connec_index,revNodal,revNodalI,commonCellsArr,commonCellsIArr); } @@ -1817,7 +1817,7 @@ void MEDCouplingUMesh::findCommonCells(int compType, int startCellId, DataArrayI void MEDCouplingUMesh::FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI, DataArrayInt *& commonCellsArr, DataArrayInt *& commonCellsIArr) { - MEDCouplingAutoRefCountObjectPtr commonCells=DataArrayInt::New(),commonCellsI=DataArrayInt::New(); commonCells->alloc(0,1); + MCAuto commonCells=DataArrayInt::New(),commonCellsI=DataArrayInt::New(); commonCells->alloc(0,1); int nbOfCells=nodalI->getNumberOfTuples()-1; commonCellsI->reserve(1); commonCellsI->pushBackSilent(0); const int *revNodalPtr=revNodal->getConstPointer(),*revNodalIPtr=revNodalI->getConstPointer(); @@ -1921,7 +1921,7 @@ void MEDCouplingUMesh::FindCommonCellsAlg(int compType, int startCellId, const D */ bool MEDCouplingUMesh::areCellsIncludedIn(const MEDCouplingUMesh *other, int compType, DataArrayInt *& arr) const { - MEDCouplingAutoRefCountObjectPtr mesh=MergeUMeshesOnSameCoords(this,other); + MCAuto mesh=MergeUMeshesOnSameCoords(this,other); int nbOfCells=getNumberOfCells(); static const int possibleCompType[]={0,1,2}; if(std::find(possibleCompType,possibleCompType+sizeof(possibleCompType)/sizeof(int),compType)==possibleCompType+sizeof(possibleCompType)/sizeof(int)) @@ -1931,7 +1931,7 @@ bool MEDCouplingUMesh::areCellsIncludedIn(const MEDCouplingUMesh *other, int com oss << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDCouplingAutoRefCountObjectPtr o2n=mesh->zipConnectivityTraducer(compType,nbOfCells); + MCAuto o2n=mesh->zipConnectivityTraducer(compType,nbOfCells); arr=o2n->substr(nbOfCells); arr->setName(other->getName()); int tmp; @@ -1950,16 +1950,16 @@ bool MEDCouplingUMesh::areCellsIncludedIn(const MEDCouplingUMesh *other, int com * \param arr is an output parameter that returns a \b newly created instance. This array is of size 'other->getNumberOfCells()'. * \return If \a other is fully included in 'this 'true is returned. If not false is returned. */ -bool MEDCouplingUMesh::areCellsIncludedIn2(const MEDCouplingUMesh *other, DataArrayInt *& arr) const +bool MEDCouplingUMesh::areCellsIncludedInPolicy7(const MEDCouplingUMesh *other, DataArrayInt *& arr) const { - MEDCouplingAutoRefCountObjectPtr mesh=MergeUMeshesOnSameCoords(this,other); + MCAuto mesh=MergeUMeshesOnSameCoords(this,other); DataArrayInt *commonCells=0,*commonCellsI=0; int thisNbCells=getNumberOfCells(); mesh->findCommonCells(7,thisNbCells,commonCells,commonCellsI); - MEDCouplingAutoRefCountObjectPtr commonCellsTmp(commonCells),commonCellsITmp(commonCellsI); + MCAuto commonCellsTmp(commonCells),commonCellsITmp(commonCellsI); const int *commonCellsPtr=commonCells->getConstPointer(),*commonCellsIPtr=commonCellsI->getConstPointer(); int otherNbCells=other->getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr arr2=DataArrayInt::New(); + MCAuto arr2=DataArrayInt::New(); arr2->alloc(otherNbCells,1); arr2->fillWithZero(); int *arr2Ptr=arr2->getPointer(); @@ -2012,13 +2012,13 @@ MEDCouplingUMesh *MEDCouplingUMesh::mergeMyselfWithOnSameCoords(const MEDCouplin * \warning This method modifies can generate an unstructured mesh whose cells are not sorted by geometric type order. * In view of the MED file writing, a renumbering of cells of returned unstructured mesh (using MEDCouplingUMesh::sortCellsInMEDFileFrmt) should be necessary. */ -MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelf2(int start, int end, int step, bool keepCoords) const +MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfSlice(int start, int end, int step, bool keepCoords) const { if(getMeshDimension()!=-1) - return static_cast(MEDCouplingPointSet::buildPartOfMySelf2(start,end,step,keepCoords)); + return static_cast(MEDCouplingPointSet::buildPartOfMySelfSlice(start,end,step,keepCoords)); else { - int newNbOfCells=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::buildPartOfMySelf2 for -1 dimension mesh "); + int newNbOfCells=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::buildPartOfMySelfSlice for -1 dimension mesh "); if(newNbOfCells!=1) throw INTERP_KERNEL::Exception("-1D mesh has only one cell !"); if(start!=0) @@ -2122,27 +2122,27 @@ void MEDCouplingUMesh::setPartOfMySelf(const int *cellIdsBg, const int *cellIdsE DataArrayInt *arrOut=0,*arrIOut=0; MEDCouplingUMesh::SetPartOfIndexedArrays(cellIdsBg,cellIdsEnd,_nodal_connec,_nodal_connec_index,otherOnSameCoordsThanThis._nodal_connec,otherOnSameCoordsThanThis._nodal_connec_index, arrOut,arrIOut); - MEDCouplingAutoRefCountObjectPtr arrOutAuto(arrOut),arrIOutAuto(arrIOut); + MCAuto arrOutAuto(arrOut),arrIOutAuto(arrIOut); setConnectivity(arrOut,arrIOut,true); } } -void MEDCouplingUMesh::setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) +void MEDCouplingUMesh::setPartOfMySelfSlice(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) { checkConnectivityFullyDefined(); otherOnSameCoordsThanThis.checkConnectivityFullyDefined(); if(getCoords()!=otherOnSameCoordsThanThis.getCoords()) - throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf2 : coordinates pointer are not the same ! Invoke setCoords or call tryToShareSameCoords method !"); + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelfSlice : coordinates pointer are not the same ! Invoke setCoords or call tryToShareSameCoords method !"); if(getMeshDimension()!=otherOnSameCoordsThanThis.getMeshDimension()) { - std::ostringstream oss; oss << "MEDCouplingUMesh::setPartOfMySelf2 : Mismatch of meshdimensions ! this is equal to " << getMeshDimension(); + std::ostringstream oss; oss << "MEDCouplingUMesh::setPartOfMySelfSlice : Mismatch of meshdimensions ! this is equal to " << getMeshDimension(); oss << ", whereas other mesh dimension is set equal to " << otherOnSameCoordsThanThis.getMeshDimension() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - int nbOfCellsToModify=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::setPartOfMySelf2 : "); + int nbOfCellsToModify=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::setPartOfMySelfSlice : "); if(nbOfCellsToModify!=otherOnSameCoordsThanThis.getNumberOfCells()) { - std::ostringstream oss; oss << "MEDCouplingUMesh::setPartOfMySelf2 : cells ids length (" << nbOfCellsToModify << ") do not match the number of cells of other mesh (" << otherOnSameCoordsThanThis.getNumberOfCells() << ") !"; + std::ostringstream oss; oss << "MEDCouplingUMesh::setPartOfMySelfSlice : cells ids length (" << nbOfCellsToModify << ") do not match the number of cells of other mesh (" << otherOnSameCoordsThanThis.getNumberOfCells() << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } int nbOfCells=getNumberOfCells(); @@ -2158,21 +2158,21 @@ void MEDCouplingUMesh::setPartOfMySelf2(int start, int end, int step, const MEDC } else { - std::ostringstream oss; oss << "MEDCouplingUMesh::setPartOfMySelf2 : On pos #" << i << " id is equal to " << it << " which is not in [0," << nbOfCells << ") !"; + std::ostringstream oss; oss << "MEDCouplingUMesh::setPartOfMySelfSlice : On pos #" << i << " id is equal to " << it << " which is not in [0," << nbOfCells << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } } if(easyAssign) { - MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx2(start,end,step,_nodal_connec,_nodal_connec_index,otherOnSameCoordsThanThis._nodal_connec,otherOnSameCoordsThanThis._nodal_connec_index); + MEDCouplingUMesh::SetPartOfIndexedArraysSameIdxSlice(start,end,step,_nodal_connec,_nodal_connec_index,otherOnSameCoordsThanThis._nodal_connec,otherOnSameCoordsThanThis._nodal_connec_index); computeTypes(); } else { DataArrayInt *arrOut=0,*arrIOut=0; - MEDCouplingUMesh::SetPartOfIndexedArrays2(start,end,step,_nodal_connec,_nodal_connec_index,otherOnSameCoordsThanThis._nodal_connec,otherOnSameCoordsThanThis._nodal_connec_index, + MEDCouplingUMesh::SetPartOfIndexedArraysSlice(start,end,step,_nodal_connec,_nodal_connec_index,otherOnSameCoordsThanThis._nodal_connec,otherOnSameCoordsThanThis._nodal_connec_index, arrOut,arrIOut); - MEDCouplingAutoRefCountObjectPtr arrOutAuto(arrOut),arrIOutAuto(arrIOut); + MCAuto arrOutAuto(arrOut),arrIOutAuto(arrIOut); setConnectivity(arrOut,arrIOut,true); } } @@ -2190,7 +2190,7 @@ void MEDCouplingUMesh::setPartOfMySelf2(int start, int end, int step, const MEDC */ void MEDCouplingUMesh::fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, DataArrayInt *&cellIdsKeptArr) const { - MEDCouplingAutoRefCountObjectPtr cellIdsKept=DataArrayInt::New(); cellIdsKept->alloc(0,1); + MCAuto cellIdsKept=DataArrayInt::New(); cellIdsKept->alloc(0,1); checkConnectivityFullyDefined(); int tmp=-1; int sz=getNodalConnectivity()->getMaxValue(tmp); sz=std::max(sz,0)+1; @@ -2243,9 +2243,9 @@ void MEDCouplingUMesh::fillCellIdsToKeepFromNodeIds(const int *begin, const int */ MEDCouplingUMesh *MEDCouplingUMesh::buildFacePartOfMySelfNode(const int *begin, const int *end, bool fullyIn) const { - MEDCouplingAutoRefCountObjectPtr desc,descIndx,revDesc,revDescIndx; + MCAuto desc,descIndx,revDesc,revDescIndx; desc=DataArrayInt::New(); descIndx=DataArrayInt::New(); revDesc=DataArrayInt::New(); revDescIndx=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr subMesh=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); + MCAuto subMesh=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); desc=0; descIndx=0; revDesc=0; revDescIndx=0; return static_cast(subMesh->buildPartOfMySelfNode(begin,end,fullyIn)); } @@ -2273,7 +2273,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildBoundaryMesh(bool keepCoords) const DataArrayInt *revDesc=DataArrayInt::New(); DataArrayInt *revDescIndx=DataArrayInt::New(); // - MEDCouplingAutoRefCountObjectPtr meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); + MCAuto meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); revDesc->decrRef(); desc->decrRef(); descIndx->decrRef(); @@ -2296,16 +2296,16 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildBoundaryMesh(bool keepCoords) const DataArrayInt *MEDCouplingUMesh::findCellIdsOnBoundary() const { checkFullyDefined(); - MEDCouplingAutoRefCountObjectPtr desc=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr descIndx=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr revDesc=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr revDescIndx=DataArrayInt::New(); + MCAuto desc=DataArrayInt::New(); + MCAuto descIndx=DataArrayInt::New(); + MCAuto revDesc=DataArrayInt::New(); + MCAuto revDescIndx=DataArrayInt::New(); // buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx)->decrRef(); desc=(DataArrayInt*)0; descIndx=(DataArrayInt*)0; // - MEDCouplingAutoRefCountObjectPtr tmp=revDescIndx->deltaShiftIndex(); - MEDCouplingAutoRefCountObjectPtr faceIds=tmp->getIdsEqual(1); tmp=(DataArrayInt*)0; + MCAuto tmp=revDescIndx->deltaShiftIndex(); + MCAuto faceIds=tmp->findIdsEqual(1); tmp=(DataArrayInt*)0; const int *revDescPtr=revDesc->getConstPointer(); const int *revDescIndxPtr=revDescIndx->getConstPointer(); int nbOfCells=getNumberOfCells(); @@ -2352,21 +2352,21 @@ void MEDCouplingUMesh::findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSa otherDimM1OnSameCoords.checkConnectivityFullyDefined(); if(getMeshDimension()-1!=otherDimM1OnSameCoords.getMeshDimension()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::findCellIdsLyingOn : invalid mesh dimension of input mesh regarding meshdimesion of this !"); - MEDCouplingAutoRefCountObjectPtr fetchedNodeIds1=otherDimM1OnSameCoords.computeFetchedNodeIds(); - MEDCouplingAutoRefCountObjectPtr s0arr=getCellIdsLyingOnNodes(fetchedNodeIds1->begin(),fetchedNodeIds1->end(),false); - MEDCouplingAutoRefCountObjectPtr thisPart=static_cast(buildPartOfMySelf(s0arr->begin(),s0arr->end(),true)); - MEDCouplingAutoRefCountObjectPtr descThisPart=DataArrayInt::New(),descIThisPart=DataArrayInt::New(),revDescThisPart=DataArrayInt::New(),revDescIThisPart=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr thisPartConsti=thisPart->buildDescendingConnectivity(descThisPart,descIThisPart,revDescThisPart,revDescIThisPart); + MCAuto fetchedNodeIds1=otherDimM1OnSameCoords.computeFetchedNodeIds(); + MCAuto s0arr=getCellIdsLyingOnNodes(fetchedNodeIds1->begin(),fetchedNodeIds1->end(),false); + MCAuto thisPart=static_cast(buildPartOfMySelf(s0arr->begin(),s0arr->end(),true)); + MCAuto descThisPart=DataArrayInt::New(),descIThisPart=DataArrayInt::New(),revDescThisPart=DataArrayInt::New(),revDescIThisPart=DataArrayInt::New(); + MCAuto thisPartConsti=thisPart->buildDescendingConnectivity(descThisPart,descIThisPart,revDescThisPart,revDescIThisPart); const int *revDescThisPartPtr=revDescThisPart->getConstPointer(),*revDescIThisPartPtr=revDescIThisPart->getConstPointer(); DataArrayInt *idsOtherInConsti=0; bool b=thisPartConsti->areCellsIncludedIn(&otherDimM1OnSameCoords,2,idsOtherInConsti); - MEDCouplingAutoRefCountObjectPtr idsOtherInConstiAuto(idsOtherInConsti); + MCAuto idsOtherInConstiAuto(idsOtherInConsti); if(!b) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::findCellIdsLyingOn : the given mdim-1 mesh in other is not a constituent of this !"); std::set s1; for(const int *idOther=idsOtherInConsti->begin();idOther!=idsOtherInConsti->end();idOther++) s1.insert(revDescThisPartPtr+revDescIThisPartPtr[*idOther],revDescThisPartPtr+revDescIThisPartPtr[*idOther+1]); - MEDCouplingAutoRefCountObjectPtr s1arr_renum1=DataArrayInt::New(); s1arr_renum1->alloc((int)s1.size(),1); std::copy(s1.begin(),s1.end(),s1arr_renum1->getPointer()); + MCAuto s1arr_renum1=DataArrayInt::New(); s1arr_renum1->alloc((int)s1.size(),1); std::copy(s1.begin(),s1.end(),s1arr_renum1->getPointer()); s1arr_renum1->sort(); cellIdsRk0=s0arr.retn(); //cellIdsRk1=s_renum1.retn(); @@ -2381,15 +2381,15 @@ void MEDCouplingUMesh::findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSa */ MEDCouplingUMesh *MEDCouplingUMesh::computeSkin() const { - MEDCouplingAutoRefCountObjectPtr desc=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr descIndx=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr revDesc=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr revDescIndx=DataArrayInt::New(); + MCAuto desc=DataArrayInt::New(); + MCAuto descIndx=DataArrayInt::New(); + MCAuto revDesc=DataArrayInt::New(); + MCAuto revDescIndx=DataArrayInt::New(); // - MEDCouplingAutoRefCountObjectPtr meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); + MCAuto meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); revDesc=0; desc=0; descIndx=0; - MEDCouplingAutoRefCountObjectPtr revDescIndx2=revDescIndx->deltaShiftIndex(); - MEDCouplingAutoRefCountObjectPtr part=revDescIndx2->getIdsEqual(1); + MCAuto revDescIndx2=revDescIndx->deltaShiftIndex(); + MCAuto part=revDescIndx2->findIdsEqual(1); return static_cast(meshDM1->buildPartOfMySelf(part->begin(),part->end(),true)); } @@ -2408,7 +2408,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::computeSkin() const */ DataArrayInt *MEDCouplingUMesh::findBoundaryNodes() const { - MEDCouplingAutoRefCountObjectPtr skin=computeSkin(); + MCAuto skin=computeSkin(); return skin->computeFetchedNodeIds(); } @@ -2436,7 +2436,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildUnstructured() const void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayInt *& nodeIdsToDuplicate, DataArrayInt *& cellIdsNeededToBeRenum, DataArrayInt *& cellIdsNotModified) const { - typedef MEDCouplingAutoRefCountObjectPtr DAInt; + typedef MCAuto DAInt; checkFullyDefined(); otherDimM1OnSameCoords.checkFullyDefined(); @@ -2449,16 +2449,16 @@ void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1On DAInt cellIdsRk0Auto(cellIdsRk0),cellIdsRk1Auto(cellIdsRk1); DAInt s0=cellIdsRk1->buildComplement(cellIdsRk0->getNumberOfTuples()); s0->transformWithIndArr(cellIdsRk0Auto->begin(),cellIdsRk0Auto->end()); - MEDCouplingAutoRefCountObjectPtr m0Part=static_cast(buildPartOfMySelf(s0->begin(),s0->end(),true)); + MCAuto m0Part=static_cast(buildPartOfMySelf(s0->begin(),s0->end(),true)); DAInt s1=m0Part->computeFetchedNodeIds(); DAInt s2=otherDimM1OnSameCoords.computeFetchedNodeIds(); DAInt s3=s2->buildSubstraction(s1); cellIdsRk1->transformWithIndArr(cellIdsRk0Auto->begin(),cellIdsRk0Auto->end()); // - MEDCouplingAutoRefCountObjectPtr m0Part2=static_cast(buildPartOfMySelf(cellIdsRk1->begin(),cellIdsRk1->end(),true)); + MCAuto m0Part2=static_cast(buildPartOfMySelf(cellIdsRk1->begin(),cellIdsRk1->end(),true)); int nCells2 = m0Part2->getNumberOfCells(); DAInt desc00=DataArrayInt::New(),descI00=DataArrayInt::New(),revDesc00=DataArrayInt::New(),revDescI00=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr m01=m0Part2->buildDescendingConnectivity(desc00,descI00,revDesc00,revDescI00); + MCAuto m01=m0Part2->buildDescendingConnectivity(desc00,descI00,revDesc00,revDescI00); // Neighbor information of the mesh without considering the crack (serves to count how many connex pieces it is made of) DataArrayInt *tmp00=0,*tmp11=0; MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc00,descI00,revDesc00,revDescI00, tmp00, tmp11); @@ -2489,7 +2489,7 @@ void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1On cellsToModifyConn0_torenum->alloc(0,1); while (nIter < nIterMax) { - DAInt t = hitCells->getIdsEqual(-1); + DAInt t = hitCells->findIdsEqual(-1); if (!t->getNumberOfTuples()) break; // Connex zone without the crack (to compute the next seed really) @@ -2503,7 +2503,7 @@ void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1On cellsToModifyConn0_torenum = DataArrayInt::Aggregate(cellsToModifyConn0_torenum, spreadZone, 0); // Compute next seed, i.e. a cell in another connex part, which was not covered by the previous iterations DAInt comple = cellsToModifyConn0_torenum->buildComplement(nCells2); - DAInt nonHitCells = hitCells->getIdsEqual(-1); + DAInt nonHitCells = hitCells->findIdsEqual(-1); DAInt intersec = nonHitCells->buildIntersection(comple); if (intersec->getNumberOfTuples()) { seed = intersec->getIJ(0,0); } @@ -2730,13 +2730,13 @@ void MEDCouplingUMesh::renumberCells(const int *old2NewBg, bool check) // const int *conn=_nodal_connec->getConstPointer(); const int *connI=_nodal_connec_index->getConstPointer(); - MEDCouplingAutoRefCountObjectPtr o2n=DataArrayInt::New(); o2n->useArray(array,false,C_DEALLOC,nbCells,1); - MEDCouplingAutoRefCountObjectPtr n2o=o2n->invertArrayO2N2N2O(nbCells); + MCAuto o2n=DataArrayInt::New(); o2n->useArray(array,false,C_DEALLOC,nbCells,1); + MCAuto n2o=o2n->invertArrayO2N2N2O(nbCells); const int *n2oPtr=n2o->begin(); - MEDCouplingAutoRefCountObjectPtr newConn=DataArrayInt::New(); + MCAuto newConn=DataArrayInt::New(); newConn->alloc(_nodal_connec->getNumberOfTuples(),_nodal_connec->getNumberOfComponents()); newConn->copyStringInfoFrom(*_nodal_connec); - MEDCouplingAutoRefCountObjectPtr newConnI=DataArrayInt::New(); + MCAuto newConnI=DataArrayInt::New(); newConnI->alloc(_nodal_connec_index->getNumberOfTuples(),_nodal_connec_index->getNumberOfComponents()); newConnI->copyStringInfoFrom(*_nodal_connec_index); // @@ -2779,7 +2779,7 @@ void MEDCouplingUMesh::renumberCells(const int *old2NewBg, bool check) */ DataArrayInt *MEDCouplingUMesh::getCellsInBoundingBox(const double *bbox, double eps) const { - MEDCouplingAutoRefCountObjectPtr elems=DataArrayInt::New(); elems->alloc(0,1); + MCAuto elems=DataArrayInt::New(); elems->alloc(0,1); if(getMeshDimension()==-1) { elems->pushBackSilent(0); @@ -2830,7 +2830,7 @@ DataArrayInt *MEDCouplingUMesh::getCellsInBoundingBox(const double *bbox, double */ DataArrayInt *MEDCouplingUMesh::getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) { - MEDCouplingAutoRefCountObjectPtr elems=DataArrayInt::New(); elems->alloc(0,1); + MCAuto elems=DataArrayInt::New(); elems->alloc(0,1); if(getMeshDimension()==-1) { elems->pushBackSilent(0); @@ -2905,7 +2905,7 @@ INTERP_KERNEL::NormalizedCellType MEDCouplingUMesh::getTypeOfCell(int cellId) co DataArrayInt *MEDCouplingUMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const { - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(0,1); checkConnectivityFullyDefined(); int nbCells=getNumberOfCells(); @@ -3057,8 +3057,8 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSetInstanceFromThis(int spaceDim) const int mdim=getMeshDimension(); if(mdim<0) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSetInstanceFromThis : invalid mesh dimension ! Should be >= 0 !"); - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingUMesh::New(getName(),mdim); - MEDCouplingAutoRefCountObjectPtr tmp1,tmp2; + MCAuto ret=MEDCouplingUMesh::New(getName(),mdim); + MCAuto tmp1,tmp2; bool needToCpyCT=true; if(!_nodal_connec) { @@ -3085,7 +3085,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSetInstanceFromThis(int spaceDim) const ret->_types=_types; if(!_coords) { - MEDCouplingAutoRefCountObjectPtr coords=DataArrayDouble::New(); coords->alloc(0,spaceDim); + MCAuto coords=DataArrayDouble::New(); coords->alloc(0,spaceDim); ret->setCoords(coords); } else @@ -3165,7 +3165,7 @@ void MEDCouplingUMesh::setConnectivity(DataArrayInt *conn, DataArrayInt *connInd } /*! - * Copy constructor. If 'deepCpy' is false \a this is a shallow copy of other. + * Copy constructor. If 'deepCopy' is false \a this is a shallow copy of other. * If 'deeCpy' is true all arrays (coordinates and connectivities) are deeply copied. */ MEDCouplingUMesh::MEDCouplingUMesh(const MEDCouplingUMesh& other, bool deepCopy):MEDCouplingPointSet(other,deepCopy),_mesh_dim(other._mesh_dim), @@ -3173,9 +3173,9 @@ MEDCouplingUMesh::MEDCouplingUMesh(const MEDCouplingUMesh& other, bool deepCopy) _types(other._types) { if(other._nodal_connec) - _nodal_connec=other._nodal_connec->performCpy(deepCopy); + _nodal_connec=other._nodal_connec->performCopyOrIncrRef(deepCopy); if(other._nodal_connec_index) - _nodal_connec_index=other._nodal_connec_index->performCpy(deepCopy); + _nodal_connec_index=other._nodal_connec_index->performCopyOrIncrRef(deepCopy); } MEDCouplingUMesh::~MEDCouplingUMesh() @@ -3248,7 +3248,7 @@ int MEDCouplingUMesh::getMeshDimension() const * user. For more info see \ref MEDCouplingUMeshNodalConnectivity. * \return int - the length of the nodal connectivity array. */ -int MEDCouplingUMesh::getMeshLength() const +int MEDCouplingUMesh::getNodalConnectivityArrayLen() const { return _nodal_connec->getNbOfElems(); } @@ -3262,7 +3262,7 @@ void MEDCouplingUMesh::getTinySerializationInformation(std::vector& tiny tinyInfo.push_back(getMeshDimension()); tinyInfo.push_back(getNumberOfCells()); if(_nodal_connec) - tinyInfo.push_back(getMeshLength()); + tinyInfo.push_back(getNodalConnectivityArrayLen()); else tinyInfo.push_back(-1); } @@ -3298,12 +3298,12 @@ void MEDCouplingUMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const if(getMeshDimension()>-1) { a1=DataArrayInt::New(); - a1->alloc(getMeshLength()+getNumberOfCells()+1,1); + a1->alloc(getNodalConnectivityArrayLen()+getNumberOfCells()+1,1); int *ptA1=a1->getPointer(); const int *conn=getNodalConnectivity()->getConstPointer(); const int *index=getNodalConnectivityIndex()->getConstPointer(); ptA1=std::copy(index,index+getNumberOfCells()+1,ptA1); - std::copy(conn,conn+getMeshLength(),ptA1); + std::copy(conn,conn+getNodalConnectivityArrayLen(),ptA1); } else a1=0; @@ -3321,10 +3321,10 @@ void MEDCouplingUMesh::unserialization(const std::vector& tinyInfoD, con { // Connectivity const int *recvBuffer=a1->getConstPointer(); - MEDCouplingAutoRefCountObjectPtr myConnecIndex=DataArrayInt::New(); + MCAuto myConnecIndex=DataArrayInt::New(); myConnecIndex->alloc(tinyInfo[6]+1,1); std::copy(recvBuffer,recvBuffer+tinyInfo[6]+1,myConnecIndex->getPointer()); - MEDCouplingAutoRefCountObjectPtr myConnec=DataArrayInt::New(); + MCAuto myConnec=DataArrayInt::New(); myConnec->alloc(tinyInfo[7],1); std::copy(recvBuffer+tinyInfo[6]+1,recvBuffer+tinyInfo[6]+1+tinyInfo[7],myConnec->getPointer()); setConnectivity(myConnec, myConnecIndex); @@ -3332,18 +3332,18 @@ void MEDCouplingUMesh::unserialization(const std::vector& tinyInfoD, con } /*! - * This is the low algorithm of MEDCouplingUMesh::buildPartOfMySelf2. + * This is the low algorithm of MEDCouplingUMesh::buildPartOfMySelfSlice. * CellIds are given using range specified by a start an end and step. */ -MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords2(int start, int end, int step) const +MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const { checkFullyDefined(); int ncell=getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingUMesh::New(); + MCAuto ret=MEDCouplingUMesh::New(); ret->_mesh_dim=_mesh_dim; ret->setCoords(_coords); - int newNbOfCells=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::buildPartOfMySelfKeepCoords2 : "); - MEDCouplingAutoRefCountObjectPtr newConnI=DataArrayInt::New(); newConnI->alloc(newNbOfCells+1,1); + int newNbOfCells=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::buildPartOfMySelfKeepCoordsSlice : "); + MCAuto newConnI=DataArrayInt::New(); newConnI->alloc(newNbOfCells+1,1); int *newConnIPtr=newConnI->getPointer(); *newConnIPtr=0; int work=start; const int *conn=_nodal_connec->getConstPointer(); @@ -3356,11 +3356,11 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords2(int start, int } else { - std::ostringstream oss; oss << "MEDCouplingUMesh::buildPartOfMySelfKeepCoords2 : On pos #" << i << " input cell id =" << work << " should be in [0," << ncell << ") !"; + std::ostringstream oss; oss << "MEDCouplingUMesh::buildPartOfMySelfKeepCoordsSlice : On pos #" << i << " input cell id =" << work << " should be in [0," << ncell << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } } - MEDCouplingAutoRefCountObjectPtr newConn=DataArrayInt::New(); newConn->alloc(newConnIPtr[0],1); + MCAuto newConn=DataArrayInt::New(); newConn->alloc(newConnIPtr[0],1); int *newConnPtr=newConn->getPointer(); std::set types; work=start; @@ -3384,7 +3384,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords(const int *begin { checkConnectivityFullyDefined(); int ncell=getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingUMesh::New(); + MCAuto ret=MEDCouplingUMesh::New(); ret->_mesh_dim=_mesh_dim; ret->setCoords(_coords); std::size_t nbOfElemsRet=std::distance(begin,end); @@ -3412,9 +3412,9 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords(const int *begin types.insert((INTERP_KERNEL::NormalizedCellType)conn[connIndex[*work]]); connRetWork=std::copy(conn+connIndex[*work],conn+connIndex[*work+1],connRetWork); } - MEDCouplingAutoRefCountObjectPtr connRetArr=DataArrayInt::New(); + MCAuto connRetArr=DataArrayInt::New(); connRetArr->useArray(connRet,true,C_DEALLOC,connIndexRet[nbOfElemsRet],1); - MEDCouplingAutoRefCountObjectPtr connIndexRetArr=DataArrayInt::New(); + MCAuto connIndexRetArr=DataArrayInt::New(); connIndexRetArr->useArray(connIndexRet,true,C_DEALLOC,(int)nbOfElemsRet+1,1); ret->setConnectivity(connRetArr,connIndexRetArr,false); ret->_types=types; @@ -3439,9 +3439,9 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getMeasureField(bool isAbs) const std::string name="MeasureOfMesh_"; name+=getName(); int nbelem=getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); + MCAuto field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); field->setName(name); - MEDCouplingAutoRefCountObjectPtr array=DataArrayDouble::New(); + MCAuto array=DataArrayDouble::New(); array->alloc(nbelem,1); double *area_vol=array->getPointer(); field->setArray(array) ; array=0; @@ -3496,7 +3496,7 @@ DataArrayDouble *MEDCouplingUMesh::getPartMeasureField(bool isAbs, const int *be std::string name="PartMeasureOfMesh_"; name+=getName(); int nbelem=(int)std::distance(begin,end); - MEDCouplingAutoRefCountObjectPtr array=DataArrayDouble::New(); + MCAuto array=DataArrayDouble::New(); array->setName(name); array->alloc(nbelem,1); double *area_vol=array->getPointer(); @@ -3541,19 +3541,19 @@ DataArrayDouble *MEDCouplingUMesh::getPartMeasureField(bool isAbs, const int *be */ MEDCouplingFieldDouble *MEDCouplingUMesh::getMeasureFieldOnNode(bool isAbs) const { - MEDCouplingAutoRefCountObjectPtr tmp=getMeasureField(isAbs); + MCAuto tmp=getMeasureField(isAbs); std::string name="MeasureOnNodeOfMesh_"; name+=getName(); int nbNodes=getNumberOfNodes(); - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingFieldDouble::New(ON_NODES); + MCAuto ret=MEDCouplingFieldDouble::New(ON_NODES); double cst=1./((double)getMeshDimension()+1.); - MEDCouplingAutoRefCountObjectPtr array=DataArrayDouble::New(); + MCAuto array=DataArrayDouble::New(); array->alloc(nbNodes,1); double *valsToFill=array->getPointer(); std::fill(valsToFill,valsToFill+nbNodes,0.); const double *values=tmp->getArray()->getConstPointer(); - MEDCouplingAutoRefCountObjectPtr da=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr daInd=DataArrayInt::New(); + MCAuto da=DataArrayInt::New(); + MCAuto daInd=DataArrayInt::New(); getReverseNodalConnectivity(da,daInd); const int *daPtr=da->getConstPointer(); const int *daIPtr=daInd->getConstPointer(); @@ -3586,8 +3586,8 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildOrthogonalField() const { if((getMeshDimension()!=2) && (getMeshDimension()!=1 || getSpaceDimension()!=2)) throw INTERP_KERNEL::Exception("Expected a umesh with ( meshDim == 2 spaceDim == 2 or 3 ) or ( meshDim == 1 spaceDim == 2 ) !"); - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); - MEDCouplingAutoRefCountObjectPtr array=DataArrayDouble::New(); + MCAuto ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); + MCAuto array=DataArrayDouble::New(); int nbOfCells=getNumberOfCells(); int nbComp=getMeshDimension()+1; array->alloc(nbOfCells,nbComp); @@ -3599,7 +3599,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildOrthogonalField() const { if(getSpaceDimension()==3) { - MEDCouplingAutoRefCountObjectPtr loc=getBarycenterAndOwner(); + MCAuto loc=computeCellCenterOfMass(); const double *locPtr=loc->getConstPointer(); for(int i=0;i isAbs=getMeasureField(false); + MCAuto isAbs=getMeasureField(false); const double *isAbsPtr=isAbs->getArray()->begin(); for(int i=0;i0.?1.:-1.; } @@ -3665,8 +3665,8 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildPartOrthogonalField(const int *be { if((getMeshDimension()!=2) && (getMeshDimension()!=1 || getSpaceDimension()!=2)) throw INTERP_KERNEL::Exception("Expected a umesh with ( meshDim == 2 spaceDim == 2 or 3 ) or ( meshDim == 1 spaceDim == 2 ) !"); - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); - MEDCouplingAutoRefCountObjectPtr array=DataArrayDouble::New(); + MCAuto ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); + MCAuto array=DataArrayDouble::New(); std::size_t nbelems=std::distance(begin,end); int nbComp=getMeshDimension()+1; array->alloc((int)nbelems,nbComp); @@ -3678,7 +3678,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildPartOrthogonalField(const int *be { if(getSpaceDimension()==3) { - MEDCouplingAutoRefCountObjectPtr loc=getPartBarycenterAndOwner(begin,end); + MCAuto loc=getPartBarycenterAndOwner(begin,end); const double *locPtr=loc->getConstPointer(); for(const int *i=begin;i!=end;i++,vals+=3,locPtr+=3) { @@ -3731,8 +3731,8 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildDirectionVectorField() const throw INTERP_KERNEL::Exception("Expected a umesh with meshDim == 1 for buildDirectionVectorField !"); if(_types.size()!=1 || *(_types.begin())!=INTERP_KERNEL::NORM_SEG2) throw INTERP_KERNEL::Exception("Expected a umesh with only NORM_SEG2 type of elements for buildDirectionVectorField !"); - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); - MEDCouplingAutoRefCountObjectPtr array=DataArrayDouble::New(); + MCAuto ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); + MCAuto array=DataArrayDouble::New(); int nbOfCells=getNumberOfCells(); int spaceDim=getSpaceDimension(); array->alloc(nbOfCells,spaceDim); @@ -3780,23 +3780,23 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSlice3D(const double *origin, const dou checkFullyDefined(); if(getMeshDimension()!=3 || getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3D works on umeshes with meshdim equal to 3 and spaceDim equal to 3 too!"); - MEDCouplingAutoRefCountObjectPtr candidates=getCellIdsCrossingPlane(origin,vec,eps); + MCAuto candidates=getCellIdsCrossingPlane(origin,vec,eps); if(candidates->empty()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3D : No 3D cells in this intercepts the specified plane considering bounding boxes !"); std::vector nodes; DataArrayInt *cellIds1D=0; - MEDCouplingAutoRefCountObjectPtr subMesh=static_cast(buildPartOfMySelf(candidates->begin(),candidates->end(),false)); + MCAuto subMesh=static_cast(buildPartOfMySelf(candidates->begin(),candidates->end(),false)); subMesh->findNodesOnPlane(origin,vec,eps,nodes); - MEDCouplingAutoRefCountObjectPtr desc1=DataArrayInt::New(),desc2=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr descIndx1=DataArrayInt::New(),descIndx2=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr revDesc1=DataArrayInt::New(),revDesc2=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr revDescIndx1=DataArrayInt::New(),revDescIndx2=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr mDesc2=subMesh->buildDescendingConnectivity(desc2,descIndx2,revDesc2,revDescIndx2);//meshDim==2 spaceDim==3 + MCAuto desc1=DataArrayInt::New(),desc2=DataArrayInt::New(); + MCAuto descIndx1=DataArrayInt::New(),descIndx2=DataArrayInt::New(); + MCAuto revDesc1=DataArrayInt::New(),revDesc2=DataArrayInt::New(); + MCAuto revDescIndx1=DataArrayInt::New(),revDescIndx2=DataArrayInt::New(); + MCAuto mDesc2=subMesh->buildDescendingConnectivity(desc2,descIndx2,revDesc2,revDescIndx2);//meshDim==2 spaceDim==3 revDesc2=0; revDescIndx2=0; - MEDCouplingAutoRefCountObjectPtr mDesc1=mDesc2->buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1);//meshDim==1 spaceDim==3 + MCAuto mDesc1=mDesc2->buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1);//meshDim==1 spaceDim==3 revDesc1=0; revDescIndx1=0; mDesc1->fillCellIdsToKeepFromNodeIds(&nodes[0],&nodes[0]+nodes.size(),true,cellIds1D); - MEDCouplingAutoRefCountObjectPtr cellIds1DTmp(cellIds1D); + MCAuto cellIds1DTmp(cellIds1D); // std::vector cut3DCurve(mDesc1->getNumberOfCells(),-2); for(const int *it=cellIds1D->begin();it!=cellIds1D->end();it++) @@ -3806,12 +3806,12 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSlice3D(const double *origin, const dou AssemblyForSplitFrom3DCurve(cut3DCurve,nodes,mDesc2->getNodalConnectivity()->getConstPointer(),mDesc2->getNodalConnectivityIndex()->getConstPointer(), mDesc1->getNodalConnectivity()->getConstPointer(),mDesc1->getNodalConnectivityIndex()->getConstPointer(), desc1->getConstPointer(),descIndx1->getConstPointer(),cut3DSurf); - MEDCouplingAutoRefCountObjectPtr conn(DataArrayInt::New()),connI(DataArrayInt::New()),cellIds2(DataArrayInt::New()); + MCAuto conn(DataArrayInt::New()),connI(DataArrayInt::New()),cellIds2(DataArrayInt::New()); connI->pushBackSilent(0); conn->alloc(0,1); cellIds2->alloc(0,1); subMesh->assemblyForSplitFrom3DSurf(cut3DSurf,desc2->getConstPointer(),descIndx2->getConstPointer(),conn,connI,cellIds2); if(cellIds2->empty()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3D : No 3D cells in this intercepts the specified plane !"); - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingUMesh::New("Slice3D",2); + MCAuto ret=MEDCouplingUMesh::New("Slice3D",2); ret->setCoords(mDesc1->getCoords()); ret->setConnectivity(conn,connI,true); cellIds=candidates->selectByTupleId(cellIds2->begin(),cellIds2->end()); @@ -3846,20 +3846,20 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSlice3DSurf(const double *origin, const checkFullyDefined(); if(getMeshDimension()!=2 || getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3DSurf works on umeshes with meshdim equal to 2 and spaceDim equal to 3 !"); - MEDCouplingAutoRefCountObjectPtr candidates=getCellIdsCrossingPlane(origin,vec,eps); + MCAuto candidates=getCellIdsCrossingPlane(origin,vec,eps); if(candidates->empty()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3DSurf : No 3D surf cells in this intercepts the specified plane considering bounding boxes !"); std::vector nodes; DataArrayInt *cellIds1D=0; - MEDCouplingAutoRefCountObjectPtr subMesh=static_cast(buildPartOfMySelf(candidates->begin(),candidates->end(),false)); + MCAuto subMesh=static_cast(buildPartOfMySelf(candidates->begin(),candidates->end(),false)); subMesh->findNodesOnPlane(origin,vec,eps,nodes); - MEDCouplingAutoRefCountObjectPtr desc1=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr descIndx1=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr revDesc1=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr revDescIndx1=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr mDesc1=subMesh->buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1);//meshDim==1 spaceDim==3 + MCAuto desc1=DataArrayInt::New(); + MCAuto descIndx1=DataArrayInt::New(); + MCAuto revDesc1=DataArrayInt::New(); + MCAuto revDescIndx1=DataArrayInt::New(); + MCAuto mDesc1=subMesh->buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1);//meshDim==1 spaceDim==3 mDesc1->fillCellIdsToKeepFromNodeIds(&nodes[0],&nodes[0]+nodes.size(),true,cellIds1D); - MEDCouplingAutoRefCountObjectPtr cellIds1DTmp(cellIds1D); + MCAuto cellIds1DTmp(cellIds1D); // std::vector cut3DCurve(mDesc1->getNumberOfCells(),-2); for(const int *it=cellIds1D->begin();it!=cellIds1D->end();it++) @@ -3870,7 +3870,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSlice3DSurf(const double *origin, const AssemblyForSplitFrom3DCurve(cut3DCurve,nodes,subMesh->getNodalConnectivity()->getConstPointer(),subMesh->getNodalConnectivityIndex()->getConstPointer(), mDesc1->getNodalConnectivity()->getConstPointer(),mDesc1->getNodalConnectivityIndex()->getConstPointer(), desc1->getConstPointer(),descIndx1->getConstPointer(),cut3DSurf); - MEDCouplingAutoRefCountObjectPtr conn(DataArrayInt::New()),connI(DataArrayInt::New()),cellIds2(DataArrayInt::New()); connI->pushBackSilent(0); + MCAuto conn(DataArrayInt::New()),connI(DataArrayInt::New()),cellIds2(DataArrayInt::New()); connI->pushBackSilent(0); conn->alloc(0,1); const int *nodal=subMesh->getNodalConnectivity()->getConstPointer(); const int *nodalI=subMesh->getNodalConnectivityIndex()->getConstPointer(); @@ -3900,7 +3900,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSlice3DSurf(const double *origin, const } if(cellIds2->empty()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3DSurf : No 3DSurf cells in this intercepts the specified plane !"); - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingUMesh::New("Slice3DSurf",1); + MCAuto ret=MEDCouplingUMesh::New("Slice3DSurf",1); ret->setCoords(mDesc1->getCoords()); ret->setConnectivity(conn,connI,true); cellIds=candidates->selectByTupleId(cellIds2->begin(),cellIds2->end()); @@ -3933,15 +3933,15 @@ DataArrayInt *MEDCouplingUMesh::getCellIdsCrossingPlane(const double *origin, co double vec2[3]; vec2[0]=vec[1]; vec2[1]=-vec[0]; vec2[2]=0.;//vec2 is the result of cross product of vec with (0,0,1) double angle=acos(vec[2]/normm); - MEDCouplingAutoRefCountObjectPtr cellIds; + MCAuto cellIds; double bbox[6]; if(angle>eps) { - MEDCouplingAutoRefCountObjectPtr coo=_coords->deepCpy(); + MCAuto coo=_coords->deepCopy(); double normm2(sqrt(vec2[0]*vec2[0]+vec2[1]*vec2[1]+vec2[2]*vec2[2])); if(normm2/normm>1e-6) MEDCouplingPointSet::Rotate3DAlg(origin,vec2,angle,coo->getNumberOfTuples(),coo->getPointer()); - MEDCouplingAutoRefCountObjectPtr mw=clone(false);//false -> shallow copy + MCAuto mw=clone(false);//false -> shallow copy mw->setCoords(coo); mw->getBoundingBox(bbox); bbox[4]=origin[2]-eps; bbox[5]=origin[2]+eps; @@ -3998,7 +3998,7 @@ void MEDCouplingUMesh::project1D(const double *pt, const double *v, double eps, throw INTERP_KERNEL::Exception("Expected a umesh with only NORM_SEG2 type of elements for project1D !"); if(getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("Expected a umesh with spaceDim==3 for project1D !"); - MEDCouplingAutoRefCountObjectPtr f=buildDirectionVectorField(); + MCAuto f=buildDirectionVectorField(); const double *fPtr=f->getArray()->getConstPointer(); double tmp[3]; for(int i=0;i pts=DataArrayDouble::New(); pts->useArray(ptBg,false,C_DEALLOC,1,spaceDim); - MEDCouplingAutoRefCountObjectPtr ret0=distanceToPoints(pts,ret1); - MEDCouplingAutoRefCountObjectPtr ret1Safe(ret1); + MCAuto pts=DataArrayDouble::New(); pts->useArray(ptBg,false,C_DEALLOC,1,spaceDim); + MCAuto ret0=distanceToPoints(pts,ret1); + MCAuto ret1Safe(ret1); cellId=*ret1Safe->begin(); return *ret0->begin(); } @@ -4101,11 +4101,11 @@ DataArrayDouble *MEDCouplingUMesh::distanceToPoints(const DataArrayDouble *pts, if(nbCells==0) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoints : no cells in this !"); int nbOfPts=pts->getNumberOfTuples(); - MEDCouplingAutoRefCountObjectPtr ret0=DataArrayDouble::New(); ret0->alloc(nbOfPts,1); - MEDCouplingAutoRefCountObjectPtr ret1=DataArrayInt::New(); ret1->alloc(nbOfPts,1); + MCAuto ret0=DataArrayDouble::New(); ret0->alloc(nbOfPts,1); + MCAuto ret1=DataArrayInt::New(); ret1->alloc(nbOfPts,1); const int *nc=_nodal_connec->begin(),*ncI=_nodal_connec_index->begin(); const double *coords=_coords->begin(); double *ret0Ptr=ret0->getPointer(); int *ret1Ptr=ret1->getPointer(); const double *ptsPtr=pts->begin(); - MEDCouplingAutoRefCountObjectPtr bboxArr(getBoundingBoxForBBTree()); + MCAuto bboxArr(getBoundingBoxForBBTree()); const double *bbox(bboxArr->begin()); switch(spaceDim) { @@ -4262,7 +4262,7 @@ int MEDCouplingUMesh::getCellContainingPoint(const double *pos, double eps) cons */ void MEDCouplingUMesh::getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const { - MEDCouplingAutoRefCountObjectPtr eltsUg,eltsIndexUg; + MCAuto eltsUg,eltsIndexUg; getCellsContainingPoints(pos,1,eps,eltsUg,eltsIndexUg); elts.clear(); elts.insert(elts.end(),eltsUg->begin(),eltsUg->end()); } @@ -4288,10 +4288,10 @@ namespace MEDCoupling // end }; - INTERP_KERNEL::Edge *MEDCouplingUMeshBuildQPFromEdge2(INTERP_KERNEL::NormalizedCellType typ, const int *bg, const double *coords2D, std::map< MEDCouplingAutoRefCountObjectPtr,int>& m) + INTERP_KERNEL::Edge *MEDCouplingUMeshBuildQPFromEdge2(INTERP_KERNEL::NormalizedCellType typ, const int *bg, const double *coords2D, std::map< MCAuto,int>& m) { INTERP_KERNEL::Edge *ret(0); - MEDCouplingAutoRefCountObjectPtr n0(new INTERP_KERNEL::Node(coords2D[2*bg[0]],coords2D[2*bg[0]+1])),n1(new INTERP_KERNEL::Node(coords2D[2*bg[1]],coords2D[2*bg[1]+1])); + MCAuto n0(new INTERP_KERNEL::Node(coords2D[2*bg[0]],coords2D[2*bg[0]+1])),n1(new INTERP_KERNEL::Node(coords2D[2*bg[1]],coords2D[2*bg[1]+1])); m[n0]=bg[0]; m[n1]=bg[1]; switch(typ) { @@ -4431,11 +4431,11 @@ namespace MEDCoupling template void MEDCouplingUMesh::getCellsContainingPointsAlg(const double *coords, const double *pos, int nbOfPoints, - double eps, MEDCouplingAutoRefCountObjectPtr& elts, MEDCouplingAutoRefCountObjectPtr& eltsIndex) const + double eps, MCAuto& elts, MCAuto& eltsIndex) const { elts=DataArrayInt::New(); eltsIndex=DataArrayInt::New(); eltsIndex->alloc(nbOfPoints+1,1); eltsIndex->setIJ(0,0,0); elts->alloc(0,1); int *eltsIndexPtr(eltsIndex->getPointer()); - MEDCouplingAutoRefCountObjectPtr bboxArr(getBoundingBoxForBBTree(eps)); + MCAuto bboxArr(getBoundingBoxForBBTree(eps)); const double *bbox(bboxArr->begin()); int nbOfCells=getNumberOfCells(); const int *conn=_nodal_connec->getConstPointer(); @@ -4520,7 +4520,7 @@ void MEDCouplingUMesh::getCellsContainingPointsAlg(const double *coords, const d * \endif */ void MEDCouplingUMesh::getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, - MEDCouplingAutoRefCountObjectPtr& elts, MEDCouplingAutoRefCountObjectPtr& eltsIndex) const + MCAuto& elts, MCAuto& eltsIndex) const { int spaceDim=getSpaceDimension(); int mDim=getMeshDimension(); @@ -4620,15 +4620,15 @@ DataArrayInt *MEDCouplingUMesh::convexEnvelop2D() checkFullyDefined(); const double *coords=getCoords()->getConstPointer(); int nbOfCells=getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr nodalConnecIndexOut=DataArrayInt::New(); + MCAuto nodalConnecIndexOut=DataArrayInt::New(); nodalConnecIndexOut->alloc(nbOfCells+1,1); - MEDCouplingAutoRefCountObjectPtr nodalConnecOut(DataArrayInt::New()); + MCAuto nodalConnecOut(DataArrayInt::New()); int *workIndexOut=nodalConnecIndexOut->getPointer(); *workIndexOut=0; const int *nodalConnecIn=_nodal_connec->getConstPointer(); const int *nodalConnecIndexIn=_nodal_connec_index->getConstPointer(); std::set types; - MEDCouplingAutoRefCountObjectPtr isChanged(DataArrayInt::New()); + MCAuto isChanged(DataArrayInt::New()); isChanged->alloc(0,1); for(int i=0;i newCoords; + MCAuto newCoords; switch(policy) { case 0: @@ -4696,7 +4696,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildExtrudedMesh(const MEDCouplingUMesh *me throw INTERP_KERNEL::Exception("Not implemented extrusion policy : must be in (0) !"); } setCoords(newCoords); - MEDCouplingAutoRefCountObjectPtr ret(buildExtrudedMeshFromThisLowLev(oldNbOfNodes,isQuad)); + MCAuto ret(buildExtrudedMeshFromThisLowLev(oldNbOfNodes,isQuad)); updateTime(); return ret.retn(); } @@ -4759,7 +4759,7 @@ void MEDCouplingUMesh::split3DCurveWithPlane(const double *origin, const double if(!addCoo.empty()) { int newNbOfNodes=nnodes+((int)addCoo.size())/3; - MEDCouplingAutoRefCountObjectPtr coo2=DataArrayDouble::New(); + MCAuto coo2=DataArrayDouble::New(); coo2->alloc(newNbOfNodes,3); double *tmp=coo2->getPointer(); tmp=std::copy(_coords->begin(),_coords->end(),tmp); @@ -4841,13 +4841,13 @@ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation2D(con int nbOf1DCells=mesh1D->getNumberOfCells(); if(nbOf1DCells<2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation2D : impossible to detect any angle of rotation ! Change extrusion policy 1->0 !"); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); int nbOfLevsInVec=nbOf1DCells+1; ret->alloc(oldNbOfNodes*nbOfLevsInVec,2); double *retPtr=ret->getPointer(); retPtr=std::copy(getCoords()->getConstPointer(),getCoords()->getConstPointer()+getCoords()->getNbOfElems(),retPtr); - MEDCouplingAutoRefCountObjectPtr tmp=MEDCouplingUMesh::New(); - MEDCouplingAutoRefCountObjectPtr tmp2=getCoords()->deepCpy(); + MCAuto tmp=MEDCouplingUMesh::New(); + MCAuto tmp2=getCoords()->deepCopy(); tmp->setCoords(tmp2); const double *coo1D=mesh1D->getCoords()->getConstPointer(); const int *conn1D=mesh1D->getNodalConnectivity()->getConstPointer(); @@ -4885,13 +4885,13 @@ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation3D(con int nbOf1DCells=mesh1D->getNumberOfCells(); if(nbOf1DCells<2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation3D : impossible to detect any angle of rotation ! Change extrusion policy 1->0 !"); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); int nbOfLevsInVec=nbOf1DCells+1; ret->alloc(oldNbOfNodes*nbOfLevsInVec,3); double *retPtr=ret->getPointer(); retPtr=std::copy(getCoords()->getConstPointer(),getCoords()->getConstPointer()+getCoords()->getNbOfElems(),retPtr); - MEDCouplingAutoRefCountObjectPtr tmp=MEDCouplingUMesh::New(); - MEDCouplingAutoRefCountObjectPtr tmp2=getCoords()->deepCpy(); + MCAuto tmp=MEDCouplingUMesh::New(); + MCAuto tmp2=getCoords()->deepCopy(); tmp->setCoords(tmp2); const double *coo1D=mesh1D->getCoords()->getConstPointer(); const int *conn1D=mesh1D->getNodalConnectivity()->getConstPointer(); @@ -4951,7 +4951,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildExtrudedMeshFromThisLowLev(int nbOfNode int nbOf3DCells(nbOf2DCells*nbOf1DCells); MEDCouplingUMesh *ret(MEDCouplingUMesh::New("Extruded",getMeshDimension()+1)); const int *conn(_nodal_connec->begin()),*connI(_nodal_connec_index->begin()); - MEDCouplingAutoRefCountObjectPtr newConn(DataArrayInt::New()),newConnI(DataArrayInt::New()); + MCAuto newConn(DataArrayInt::New()),newConnI(DataArrayInt::New()); newConnI->alloc(nbOf3DCells+1,1); int *newConnIPtr(newConnI->getPointer()); *newConnIPtr++=0; @@ -5060,10 +5060,10 @@ void MEDCouplingUMesh::convertQuadraticCellsToLinear() } if(delta==0) return ; - MEDCouplingAutoRefCountObjectPtr newConn=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr newConnI=DataArrayInt::New(); + MCAuto newConn=DataArrayInt::New(); + MCAuto newConnI=DataArrayInt::New(); const int *icptr=_nodal_connec->getConstPointer(); - newConn->alloc(getMeshLength()-delta,1); + newConn->alloc(getNodalConnectivityArrayLen()-delta,1); newConnI->alloc(nbOfCells+1,1); int *ocptr=newConn->getPointer(); int *ociptr=newConnI->getPointer(); @@ -5117,8 +5117,8 @@ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic(int conversionType DataArrayDouble *coords=0; std::set types; checkFullyDefined(); - MEDCouplingAutoRefCountObjectPtr ret,connSafe,connISafe; - MEDCouplingAutoRefCountObjectPtr coordsSafe; + MCAuto ret,connSafe,connISafe; + MCAuto coordsSafe; int meshDim=getMeshDimension(); switch(conversionType) { @@ -5244,7 +5244,7 @@ void MEDCouplingUMesh::splitSomeEdgesOf2DMesh(const DataArrayInt *nodeIdsToAdd, throw INTERP_KERNEL::Exception("MEDCouplingUMesh::splitSomeEdgesOf2DMesh : mesh1Desc must be the explosion of this with spaceDim=2 and meshDim = 1 !"); //DataArrayInt *out0(0),*outi0(0); //MEDCouplingUMesh::ExtractFromIndexedArrays(idsInDesc2DToBeRefined->begin(),idsInDesc2DToBeRefined->end(),dd3,dd4,out0,outi0); - //MEDCouplingAutoRefCountObjectPtr out0s(out0),outi0s(outi0); + //MCAuto out0s(out0),outi0s(outi0); //out0s=out0s->buildUnique(); out0s->sort(true); } #endif @@ -5256,10 +5256,10 @@ void MEDCouplingUMesh::splitSomeEdgesOf2DMesh(const DataArrayInt *nodeIdsToAdd, */ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic1D0(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set& types) const { - MEDCouplingAutoRefCountObjectPtr bary=getBarycenterAndOwner(); - MEDCouplingAutoRefCountObjectPtr newConn=DataArrayInt::New(); newConn->alloc(0,1); - MEDCouplingAutoRefCountObjectPtr newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); ret->alloc(0,1); + MCAuto bary=computeCellCenterOfMass(); + MCAuto newConn=DataArrayInt::New(); newConn->alloc(0,1); + MCAuto newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0); + MCAuto ret=DataArrayInt::New(); ret->alloc(0,1); int nbOfCells=getNumberOfCells(); int nbOfNodes=getNumberOfNodes(); const int *cPtr=_nodal_connec->getConstPointer(); @@ -5286,24 +5286,24 @@ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic1D0(DataArrayInt *& newConn->pushBackValsSilent(cPtr+icPtr[0],cPtr+icPtr[1]); } } - MEDCouplingAutoRefCountObjectPtr tmp=bary->selectByTupleIdSafe(ret->begin(),ret->end()); + MCAuto tmp=bary->selectByTupleIdSafe(ret->begin(),ret->end()); coords=DataArrayDouble::Aggregate(getCoords(),tmp); conn=newConn.retn(); connI=newConnI.retn(); return ret.retn(); } DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic2DAnd3D0(const MEDCouplingUMesh *m1D, const DataArrayInt *desc, const DataArrayInt *descI, DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set& types) const { - MEDCouplingAutoRefCountObjectPtr newConn=DataArrayInt::New(); newConn->alloc(0,1); - MEDCouplingAutoRefCountObjectPtr newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); ret->alloc(0,1); + MCAuto newConn=DataArrayInt::New(); newConn->alloc(0,1); + MCAuto newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0); + MCAuto ret=DataArrayInt::New(); ret->alloc(0,1); // const int *descPtr(desc->begin()),*descIPtr(descI->begin()); DataArrayInt *conn1D=0,*conn1DI=0; std::set types1D; DataArrayDouble *coordsTmp=0; - MEDCouplingAutoRefCountObjectPtr ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=0; - MEDCouplingAutoRefCountObjectPtr coordsTmpSafe(coordsTmp); - MEDCouplingAutoRefCountObjectPtr conn1DSafe(conn1D),conn1DISafe(conn1DI); + MCAuto ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=0; + MCAuto coordsTmpSafe(coordsTmp); + MCAuto conn1DSafe(conn1D),conn1DISafe(conn1DI); const int *c1DPtr=conn1D->begin(); const int *c1DIPtr=conn1DI->begin(); int nbOfCells=getNumberOfCells(); @@ -5344,28 +5344,28 @@ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic2DAnd3D0(const MEDC */ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic2D0(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set& types) const { - MEDCouplingAutoRefCountObjectPtr desc(DataArrayInt::New()),descI(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New()); - MEDCouplingAutoRefCountObjectPtr m1D=buildDescendingConnectivity(desc,descI,tmp2,tmp3); tmp2=0; tmp3=0; + MCAuto desc(DataArrayInt::New()),descI(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New()); + MCAuto m1D=buildDescendingConnectivity(desc,descI,tmp2,tmp3); tmp2=0; tmp3=0; return convertLinearCellsToQuadratic2DAnd3D0(m1D,desc,descI,conn,connI,coords,types); } DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic2D1(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set& types) const { - MEDCouplingAutoRefCountObjectPtr desc(DataArrayInt::New()),descI(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New()); - MEDCouplingAutoRefCountObjectPtr m1D=buildDescendingConnectivity(desc,descI,tmp2,tmp3); tmp2=0; tmp3=0; + MCAuto desc(DataArrayInt::New()),descI(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New()); + MCAuto m1D=buildDescendingConnectivity(desc,descI,tmp2,tmp3); tmp2=0; tmp3=0; // - MEDCouplingAutoRefCountObjectPtr newConn=DataArrayInt::New(); newConn->alloc(0,1); - MEDCouplingAutoRefCountObjectPtr newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); ret->alloc(0,1); + MCAuto newConn=DataArrayInt::New(); newConn->alloc(0,1); + MCAuto newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0); + MCAuto ret=DataArrayInt::New(); ret->alloc(0,1); // - MEDCouplingAutoRefCountObjectPtr bary=getBarycenterAndOwner(); + MCAuto bary=computeCellCenterOfMass(); const int *descPtr(desc->begin()),*descIPtr(descI->begin()); DataArrayInt *conn1D=0,*conn1DI=0; std::set types1D; DataArrayDouble *coordsTmp=0; - MEDCouplingAutoRefCountObjectPtr ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=0; - MEDCouplingAutoRefCountObjectPtr coordsTmpSafe(coordsTmp); - MEDCouplingAutoRefCountObjectPtr conn1DSafe(conn1D),conn1DISafe(conn1DI); + MCAuto ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=0; + MCAuto coordsTmpSafe(coordsTmp); + MCAuto conn1DSafe(conn1D),conn1DISafe(conn1DI); const int *c1DPtr=conn1D->begin(); const int *c1DIPtr=conn1DI->begin(); int nbOfCells=getNumberOfCells(); @@ -5396,7 +5396,7 @@ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic2D1(DataArrayInt *& newConn->pushBackValsSilent(cPtr+icPtr[0],cPtr+icPtr[1]); } } - MEDCouplingAutoRefCountObjectPtr tmp=bary->selectByTupleIdSafe(ret->begin(),ret->end()); + MCAuto tmp=bary->selectByTupleIdSafe(ret->begin(),ret->end()); coords=DataArrayDouble::Aggregate(coordsTmpSafe,tmp); conn=newConn.retn(); connI=newConnI.retn(); return ret.retn(); } @@ -5408,33 +5408,33 @@ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic2D1(DataArrayInt *& */ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic3D0(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set& types) const { - MEDCouplingAutoRefCountObjectPtr desc(DataArrayInt::New()),descI(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New()); - MEDCouplingAutoRefCountObjectPtr m1D=explode3DMeshTo1D(desc,descI,tmp2,tmp3); tmp2=0; tmp3=0; + MCAuto desc(DataArrayInt::New()),descI(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New()); + MCAuto m1D=explode3DMeshTo1D(desc,descI,tmp2,tmp3); tmp2=0; tmp3=0; return convertLinearCellsToQuadratic2DAnd3D0(m1D,desc,descI,conn,connI,coords,types); } DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic3D1(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set& types) const { - MEDCouplingAutoRefCountObjectPtr desc2(DataArrayInt::New()),desc2I(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New()); - MEDCouplingAutoRefCountObjectPtr m2D=buildDescendingConnectivityGen(desc2,desc2I,tmp2,tmp3,MEDCouplingFastNbrer); tmp2=0; tmp3=0; - MEDCouplingAutoRefCountObjectPtr desc1(DataArrayInt::New()),desc1I(DataArrayInt::New()),tmp4(DataArrayInt::New()),tmp5(DataArrayInt::New()); - MEDCouplingAutoRefCountObjectPtr m1D=explode3DMeshTo1D(desc1,desc1I,tmp4,tmp5); tmp4=0; tmp5=0; + MCAuto desc2(DataArrayInt::New()),desc2I(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New()); + MCAuto m2D=buildDescendingConnectivityGen(desc2,desc2I,tmp2,tmp3,MEDCouplingFastNbrer); tmp2=0; tmp3=0; + MCAuto desc1(DataArrayInt::New()),desc1I(DataArrayInt::New()),tmp4(DataArrayInt::New()),tmp5(DataArrayInt::New()); + MCAuto m1D=explode3DMeshTo1D(desc1,desc1I,tmp4,tmp5); tmp4=0; tmp5=0; // - MEDCouplingAutoRefCountObjectPtr newConn=DataArrayInt::New(); newConn->alloc(0,1); - MEDCouplingAutoRefCountObjectPtr newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(),ret2=DataArrayInt::New(); ret->alloc(0,1); ret2->alloc(0,1); + MCAuto newConn=DataArrayInt::New(); newConn->alloc(0,1); + MCAuto newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0); + MCAuto ret=DataArrayInt::New(),ret2=DataArrayInt::New(); ret->alloc(0,1); ret2->alloc(0,1); // - MEDCouplingAutoRefCountObjectPtr bary=getBarycenterAndOwner(); + MCAuto bary=computeCellCenterOfMass(); const int *descPtr(desc1->begin()),*descIPtr(desc1I->begin()),*desc2Ptr(desc2->begin()),*desc2IPtr(desc2I->begin()); DataArrayInt *conn1D=0,*conn1DI=0,*conn2D=0,*conn2DI=0; std::set types1D,types2D; DataArrayDouble *coordsTmp=0,*coordsTmp2=0; - MEDCouplingAutoRefCountObjectPtr ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=DataArrayInt::New(); ret1D->alloc(0,1); - MEDCouplingAutoRefCountObjectPtr conn1DSafe(conn1D),conn1DISafe(conn1DI); - MEDCouplingAutoRefCountObjectPtr coordsTmpSafe(coordsTmp); - MEDCouplingAutoRefCountObjectPtr ret2D=m2D->convertLinearCellsToQuadratic2D1(conn2D,conn2DI,coordsTmp2,types2D); ret2D=DataArrayInt::New(); ret2D->alloc(0,1); - MEDCouplingAutoRefCountObjectPtr coordsTmp2Safe(coordsTmp2); - MEDCouplingAutoRefCountObjectPtr conn2DSafe(conn2D),conn2DISafe(conn2DI); + MCAuto ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=DataArrayInt::New(); ret1D->alloc(0,1); + MCAuto conn1DSafe(conn1D),conn1DISafe(conn1DI); + MCAuto coordsTmpSafe(coordsTmp); + MCAuto ret2D=m2D->convertLinearCellsToQuadratic2D1(conn2D,conn2DI,coordsTmp2,types2D); ret2D=DataArrayInt::New(); ret2D->alloc(0,1); + MCAuto coordsTmp2Safe(coordsTmp2); + MCAuto conn2DSafe(conn2D),conn2DISafe(conn2DI); const int *c1DPtr=conn1D->begin(),*c1DIPtr=conn1DI->begin(),*c2DPtr=conn2D->begin(),*c2DIPtr=conn2DI->begin(); int nbOfCells=getNumberOfCells(); const int *cPtr=_nodal_connec->getConstPointer(); @@ -5476,10 +5476,10 @@ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic3D1(DataArrayInt *& newConn->pushBackValsSilent(cPtr+icPtr[0],cPtr+icPtr[1]); } } - MEDCouplingAutoRefCountObjectPtr diffRet2D=ret2D->getDifferentValues(); - MEDCouplingAutoRefCountObjectPtr o2nRet2D=diffRet2D->invertArrayN2O2O2N(coordsTmp2Safe->getNumberOfTuples()); + MCAuto diffRet2D=ret2D->getDifferentValues(); + MCAuto o2nRet2D=diffRet2D->invertArrayN2O2O2N(coordsTmp2Safe->getNumberOfTuples()); coordsTmp2Safe=coordsTmp2Safe->selectByTupleId(diffRet2D->begin(),diffRet2D->end()); - MEDCouplingAutoRefCountObjectPtr tmp=bary->selectByTupleIdSafe(ret->begin(),ret->end()); + MCAuto tmp=bary->selectByTupleIdSafe(ret->begin(),ret->end()); std::vector v(3); v[0]=coordsTmpSafe; v[1]=coordsTmp2Safe; v[2]=tmp; int *c=newConn->getPointer(); const int *cI(newConnI->begin()); @@ -5576,15 +5576,15 @@ DataArrayInt *MEDCouplingUMesh::simplexizePol0() if(getMeshDimension()!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexizePol0 : this policy is only available for mesh with meshdim == 2 !"); int nbOfCells=getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); int nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4); ret->alloc(nbOfCells+nbOfCutCells,1); if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); } int *retPt=ret->getPointer(); - MEDCouplingAutoRefCountObjectPtr newConn=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr newConnI=DataArrayInt::New(); + MCAuto newConn=DataArrayInt::New(); + MCAuto newConnI=DataArrayInt::New(); newConnI->alloc(nbOfCells+nbOfCutCells+1,1); - newConn->alloc(getMeshLength()+3*nbOfCutCells,1); + newConn->alloc(getNodalConnectivityArrayLen()+3*nbOfCutCells,1); int *pt=newConn->getPointer(); int *ptI=newConnI->getPointer(); ptI[0]=0; @@ -5629,15 +5629,15 @@ DataArrayInt *MEDCouplingUMesh::simplexizePol1() if(getMeshDimension()!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexizePol0 : this policy is only available for mesh with meshdim == 2 !"); int nbOfCells=getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); int nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4); ret->alloc(nbOfCells+nbOfCutCells,1); if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); } int *retPt=ret->getPointer(); - MEDCouplingAutoRefCountObjectPtr newConn=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr newConnI=DataArrayInt::New(); + MCAuto newConn=DataArrayInt::New(); + MCAuto newConnI=DataArrayInt::New(); newConnI->alloc(nbOfCells+nbOfCutCells+1,1); - newConn->alloc(getMeshLength()+3*nbOfCutCells,1); + newConn->alloc(getNodalConnectivityArrayLen()+3*nbOfCutCells,1); int *pt=newConn->getPointer(); int *ptI=newConnI->getPointer(); ptI[0]=0; @@ -5682,15 +5682,15 @@ DataArrayInt *MEDCouplingUMesh::simplexizePlanarFace5() if(getMeshDimension()!=3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexizePlanarFace5 : this policy is only available for mesh with meshdim == 3 !"); int nbOfCells=getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); int nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8); ret->alloc(nbOfCells+4*nbOfCutCells,1); if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); } int *retPt=ret->getPointer(); - MEDCouplingAutoRefCountObjectPtr newConn=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr newConnI=DataArrayInt::New(); + MCAuto newConn=DataArrayInt::New(); + MCAuto newConnI=DataArrayInt::New(); newConnI->alloc(nbOfCells+4*nbOfCutCells+1,1); - newConn->alloc(getMeshLength()+16*nbOfCutCells,1);//21 + newConn->alloc(getNodalConnectivityArrayLen()+16*nbOfCutCells,1);//21 int *pt=newConn->getPointer(); int *ptI=newConnI->getPointer(); ptI[0]=0; @@ -5734,15 +5734,15 @@ DataArrayInt *MEDCouplingUMesh::simplexizePlanarFace6() if(getMeshDimension()!=3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexizePlanarFace6 : this policy is only available for mesh with meshdim == 3 !"); int nbOfCells=getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); int nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8); ret->alloc(nbOfCells+5*nbOfCutCells,1); if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); } int *retPt=ret->getPointer(); - MEDCouplingAutoRefCountObjectPtr newConn=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr newConnI=DataArrayInt::New(); + MCAuto newConn=DataArrayInt::New(); + MCAuto newConnI=DataArrayInt::New(); newConnI->alloc(nbOfCells+5*nbOfCutCells+1,1); - newConn->alloc(getMeshLength()+21*nbOfCutCells,1); + newConn->alloc(getNodalConnectivityArrayLen()+21*nbOfCutCells,1); int *pt=newConn->getPointer(); int *ptI=newConnI->getPointer(); ptI[0]=0; @@ -5799,8 +5799,8 @@ void MEDCouplingUMesh::tessellate2DInternal(double eps) double epsa=fabs(eps); if(epsa::min()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::tessellate2DInternal : epsilon is null ! Please specify a higher epsilon. If too tiny it can lead to a huge amount of nodes and memory !"); - MEDCouplingAutoRefCountObjectPtr desc1(DataArrayInt::New()),descIndx1(DataArrayInt::New()),revDesc1(DataArrayInt::New()),revDescIndx1(DataArrayInt::New()); - MEDCouplingAutoRefCountObjectPtr mDesc(buildDescendingConnectivity2(desc1,descIndx1,revDesc1,revDescIndx1)); + MCAuto desc1(DataArrayInt::New()),descIndx1(DataArrayInt::New()),revDesc1(DataArrayInt::New()),revDescIndx1(DataArrayInt::New()); + MCAuto mDesc(buildDescendingConnectivity2(desc1,descIndx1,revDesc1,revDescIndx1)); revDesc1=0; revDescIndx1=0; mDesc->tessellate2D(eps); subDivide2DMesh(mDesc->_nodal_connec->getConstPointer(),mDesc->_nodal_connec_index->getConstPointer(),desc1->getConstPointer(),descIndx1->getConstPointer()); @@ -5833,7 +5833,7 @@ void MEDCouplingUMesh::tessellate2DCurveInternal(double eps) const double *coords=_coords->getConstPointer(); std::vector addCoo; std::vector newConn;//no direct DataArrayInt because interface with Geometric2D - MEDCouplingAutoRefCountObjectPtr newConnI(DataArrayInt::New()); + MCAuto newConnI(DataArrayInt::New()); newConnI->alloc(nbCells+1,1); int *newConnIPtr=newConnI->getPointer(); *newConnIPtr=0; @@ -5876,11 +5876,11 @@ void MEDCouplingUMesh::tessellate2DCurveInternal(double eps) return ; _types=types; DataArrayInt::SetArrayIn(newConnI,_nodal_connec_index); - MEDCouplingAutoRefCountObjectPtr newConnArr=DataArrayInt::New(); + MCAuto newConnArr=DataArrayInt::New(); newConnArr->alloc((int)newConn.size(),1); std::copy(newConn.begin(),newConn.end(),newConnArr->getPointer()); DataArrayInt::SetArrayIn(newConnArr,_nodal_connec); - MEDCouplingAutoRefCountObjectPtr newCoords=DataArrayDouble::New(); + MCAuto newCoords=DataArrayDouble::New(); newCoords->alloc(nbNodes+((int)addCoo.size())/2,2); double *work=std::copy(_coords->begin(),_coords->end(),newCoords->getPointer()); std::copy(addCoo.begin(),addCoo.end(),work); @@ -5942,7 +5942,7 @@ void MEDCouplingUMesh::subDivide2DMesh(const int *nodeSubdived, const int *nodeI connI[1]=newConnLgth; } // - MEDCouplingAutoRefCountObjectPtr newConn=DataArrayInt::New(); + MCAuto newConn=DataArrayInt::New(); newConn->alloc(newConnLgth,1); int *work=newConn->getPointer(); for(int i=0;igetPointer(); int *index=_nodal_connec_index->getPointer(); int posOfCurCell=0; @@ -6235,7 +6235,7 @@ DataArrayInt *MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells() int *conn=_nodal_connec->getPointer(); const int *connI=_nodal_connec_index->getConstPointer(); const double *coo=getCoords()->getConstPointer(); - MEDCouplingAutoRefCountObjectPtr cells(DataArrayInt::New()); cells->alloc(0,1); + MCAuto cells(DataArrayInt::New()); cells->alloc(0,1); for(int i=0;igetPointer(); const int *connI=_nodal_connec_index->getConstPointer(); const double *coordsPtr=_coords->getConstPointer(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); ret->alloc(0,1); + MCAuto ret=DataArrayInt::New(); ret->alloc(0,1); for(int i=0;i ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); + MCAuto ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); ret->setMesh(this); int nbOfCells=getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::New(); + MCAuto arr=DataArrayDouble::New(); arr->alloc(nbOfCells,1); double *pt=arr->getPointer(); ret->setArray(arr);//In case of throw to avoid mem leaks arr will be used after decrRef. @@ -6434,17 +6434,17 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getEdgeRatioField() const */ MEDCouplingFieldDouble *MEDCouplingUMesh::getAspectRatioField() const { - checkCoherency(); + checkConsistencyLight(); int spaceDim=getSpaceDimension(); int meshDim=getMeshDimension(); if(spaceDim!=2 && spaceDim!=3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getAspectRatioField : SpaceDimension must be equal to 2 or 3 !"); if(meshDim!=2 && meshDim!=3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getAspectRatioField : MeshDimension must be equal to 2 or 3 !"); - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); + MCAuto ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); ret->setMesh(this); int nbOfCells=getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::New(); + MCAuto arr=DataArrayDouble::New(); arr->alloc(nbOfCells,1); double *pt=arr->getPointer(); ret->setArray(arr);//In case of throw to avoid mem leaks arr will be used after decrRef. @@ -6505,17 +6505,17 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getAspectRatioField() const */ MEDCouplingFieldDouble *MEDCouplingUMesh::getWarpField() const { - checkCoherency(); + checkConsistencyLight(); int spaceDim=getSpaceDimension(); int meshDim=getMeshDimension(); if(spaceDim!=3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getWarpField : SpaceDimension must be equal to 3 !"); if(meshDim!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getWarpField : MeshDimension must be equal to 2 !"); - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); + MCAuto ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); ret->setMesh(this); int nbOfCells=getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::New(); + MCAuto arr=DataArrayDouble::New(); arr->alloc(nbOfCells,1); double *pt=arr->getPointer(); ret->setArray(arr);//In case of throw to avoid mem leaks arr will be used after decrRef. @@ -6565,17 +6565,17 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getWarpField() const */ MEDCouplingFieldDouble *MEDCouplingUMesh::getSkewField() const { - checkCoherency(); + checkConsistencyLight(); int spaceDim=getSpaceDimension(); int meshDim=getMeshDimension(); if(spaceDim!=3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getSkewField : SpaceDimension must be equal to 3 !"); if(meshDim!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getSkewField : MeshDimension must be equal to 2 !"); - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); + MCAuto ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); ret->setMesh(this); int nbOfCells=getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::New(); + MCAuto arr=DataArrayDouble::New(); arr->alloc(nbOfCells,1); double *pt=arr->getPointer(); ret->setArray(arr);//In case of throw to avoid mem leaks arr will be used after decrRef. @@ -6613,18 +6613,18 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getSkewField() const */ MEDCouplingFieldDouble *MEDCouplingUMesh::computeDiameterField() const { - checkCoherency(); - MEDCouplingAutoRefCountObjectPtr ret(MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME)); + checkConsistencyLight(); + MCAuto ret(MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME)); ret->setMesh(this); std::set types; ComputeAllTypesInternal(types,_nodal_connec,_nodal_connec_index); int spaceDim(getSpaceDimension()),nbCells(getNumberOfCells()); - MEDCouplingAutoRefCountObjectPtr arr(DataArrayDouble::New()); + MCAuto arr(DataArrayDouble::New()); arr->alloc(nbCells,1); for(std::set::const_iterator it=types.begin();it!=types.end();it++) { INTERP_KERNEL::AutoCppPtr dc(INTERP_KERNEL::CellModel::GetCellModel(*it).buildInstanceOfDiameterCalulator(spaceDim)); - MEDCouplingAutoRefCountObjectPtr cellIds(giveCellsWithType(*it)); + MCAuto cellIds(giveCellsWithType(*it)); dc->computeForListOfCellIdsUMeshFrmt(cellIds->begin(),cellIds->end(),_nodal_connec_index->begin(),_nodal_connec->begin(),getCoords()->begin(),arr->getPointer()); } ret->setArray(arr); @@ -6680,7 +6680,7 @@ DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTreeFast() const { checkFullyDefined(); int spaceDim(getSpaceDimension()),nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes()); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); + MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); double *bbox(ret->getPointer()); for(int i=0;i ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); + MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); double *bbox(ret->getPointer()); const double *coords(_coords->getConstPointer()); const int *conn(_nodal_connec->getConstPointer()),*connI(_nodal_connec_index->getConstPointer()); @@ -6779,7 +6779,7 @@ DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic(double arc int spaceDim(getSpaceDimension()),mDim(getMeshDimension()),nbOfCells(getNumberOfCells()); if(spaceDim!=2 || mDim!=1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic : This method should be applied on mesh with mesh dimension equal to 1 and space dimension also equal to 2!"); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); + MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); double *bbox(ret->getPointer()); const double *coords(_coords->getConstPointer()); const int *conn(_nodal_connec->getConstPointer()),*connI(_nodal_connec_index->getConstPointer()); @@ -6914,7 +6914,7 @@ DataArrayInt *MEDCouplingUMesh::checkTypeConsistencyAndContig(const std::vector< if(types.size()==_types.size()) return 0; } - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nb,1); int *retPtr=ret->getPointer(); const int *connI=_nodal_connec_index->getConstPointer(); @@ -7012,23 +7012,23 @@ void MEDCouplingUMesh::splitProfilePerType(const DataArrayInt *profile, std::vec // DataArrayInt *castArr=0,*rankInsideCast=0,*castsPresent=0; profile->splitByValueRange(&typeRangeVals[0],&typeRangeVals[0]+typeRangeVals.size(),castArr,rankInsideCast,castsPresent); - MEDCouplingAutoRefCountObjectPtr tmp0=castArr; - MEDCouplingAutoRefCountObjectPtr tmp1=rankInsideCast; - MEDCouplingAutoRefCountObjectPtr tmp2=castsPresent; + MCAuto tmp0=castArr; + MCAuto tmp1=rankInsideCast; + MCAuto tmp2=castsPresent; // int nbOfCastsFinal=castsPresent->getNumberOfTuples(); code.resize(3*nbOfCastsFinal); - std::vector< MEDCouplingAutoRefCountObjectPtr > idsInPflPerType2; - std::vector< MEDCouplingAutoRefCountObjectPtr > idsPerType2; + std::vector< MCAuto > idsInPflPerType2; + std::vector< MCAuto > idsPerType2; for(int i=0;igetIJ(i,0); - MEDCouplingAutoRefCountObjectPtr tmp3=castArr->getIdsEqual(castId); + MCAuto tmp3=castArr->findIdsEqual(castId); idsInPflPerType2.push_back(tmp3); code[3*i]=(int)types[castId]; code[3*i+1]=tmp3->getNumberOfTuples(); - MEDCouplingAutoRefCountObjectPtr tmp4=rankInsideCast->selectByTupleId(tmp3->getConstPointer(),tmp3->getConstPointer()+tmp3->getNumberOfTuples()); - if(!tmp4->isIdentity2(typeRangeVals[castId+1]-typeRangeVals[castId])) + MCAuto tmp4=rankInsideCast->selectByTupleId(tmp3->getConstPointer(),tmp3->getConstPointer()+tmp3->getNumberOfTuples()); + if(!tmp4->isIota(typeRangeVals[castId+1]-typeRangeVals[castId])) { tmp4->copyStringInfoFrom(*profile); idsPerType2.push_back(tmp4); @@ -7071,12 +7071,12 @@ MEDCouplingUMesh *MEDCouplingUMesh::emulateMEDMEMBDC(const MEDCouplingUMesh *nM1 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::emulateMEDMEMBDC : The mesh passed as first argument should have a meshDim equal to this->getMeshDimension()-1 !" ); if(_coords!=nM1LevMesh->getCoords()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::emulateMEDMEMBDC : 'this' and mesh in first argument should share the same coords : Use tryToShareSameCoords method !"); - MEDCouplingAutoRefCountObjectPtr tmp0=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr tmp1=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr ret1=buildDescendingConnectivity(desc,descIndx,tmp0,tmp1); - MEDCouplingAutoRefCountObjectPtr ret0=ret1->sortCellsInMEDFileFrmt(); + MCAuto tmp0=DataArrayInt::New(); + MCAuto tmp1=DataArrayInt::New(); + MCAuto ret1=buildDescendingConnectivity(desc,descIndx,tmp0,tmp1); + MCAuto ret0=ret1->sortCellsInMEDFileFrmt(); desc->transformWithIndArr(ret0->getConstPointer(),ret0->getConstPointer()+ret0->getNbOfElems()); - MEDCouplingAutoRefCountObjectPtr tmp=MEDCouplingUMesh::New(); + MCAuto tmp=MEDCouplingUMesh::New(); tmp->setConnectivity(tmp0,tmp1); tmp->renumberCells(ret0->getConstPointer(),false); revDesc=tmp->getNodalConnectivity(); @@ -7111,7 +7111,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::emulateMEDMEMBDC(const MEDCouplingUMesh *nM1 DataArrayInt *MEDCouplingUMesh::sortCellsInMEDFileFrmt() { checkConnectivityFullyDefined(); - MEDCouplingAutoRefCountObjectPtr ret=getRenumArrForMEDFileFrmt(); + MCAuto ret=getRenumArrForMEDFileFrmt(); renumberCells(ret->getConstPointer(),false); return ret.retn(); } @@ -7202,8 +7202,8 @@ DataArrayInt *MEDCouplingUMesh::getLevArrPerCellTypes(const INTERP_KERNEL::Norma int nbOfCells=getNumberOfCells(); const int *conn=_nodal_connec->getConstPointer(); const int *connI=_nodal_connec_index->getConstPointer(); - MEDCouplingAutoRefCountObjectPtr tmpa=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr tmpb=DataArrayInt::New(); + MCAuto tmpa=DataArrayInt::New(); + MCAuto tmpb=DataArrayInt::New(); tmpa->alloc(nbOfCells,1); tmpb->alloc((int)std::distance(orderBg,orderEnd),1); tmpb->fillWithZero(); @@ -7251,7 +7251,7 @@ DataArrayInt *MEDCouplingUMesh::getRenumArrForMEDFileFrmt() const DataArrayInt *MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const { DataArrayInt *nbPerType=0; - MEDCouplingAutoRefCountObjectPtr tmpa=getLevArrPerCellTypes(orderBg,orderEnd,nbPerType); + MCAuto tmpa=getLevArrPerCellTypes(orderBg,orderEnd,nbPerType); nbPerType->decrRef(); return tmpa->buildPermArrPerLevel(); } @@ -7339,12 +7339,12 @@ MEDCoupling1GTUMesh *MEDCouplingUMesh::convertIntoSingleGeoTypeMesh() const if(_types.size()!=1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertIntoSingleGeoTypeMesh : current mesh does not contain exactly one geometric type !"); INTERP_KERNEL::NormalizedCellType typ=*_types.begin(); - MEDCouplingAutoRefCountObjectPtr ret=MEDCoupling1GTUMesh::New(getName(),typ); + MCAuto ret=MEDCoupling1GTUMesh::New(getName(),typ); ret->setCoords(getCoords()); MEDCoupling1SGTUMesh *retC=dynamic_cast((MEDCoupling1GTUMesh*)ret); if(retC) { - MEDCouplingAutoRefCountObjectPtr c=convertNodalConnectivityToStaticGeoTypeMesh(); + MCAuto c=convertNodalConnectivityToStaticGeoTypeMesh(); retC->setNodalConnectivity(c); } else @@ -7354,7 +7354,7 @@ MEDCoupling1GTUMesh *MEDCouplingUMesh::convertIntoSingleGeoTypeMesh() const throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertIntoSingleGeoTypeMesh : Internal error !"); DataArrayInt *c=0,*ci=0; convertNodalConnectivityToDynamicGeoTypeMesh(c,ci); - MEDCouplingAutoRefCountObjectPtr cs(c),cis(ci); + MCAuto cs(c),cis(ci); retD->setNodalConnectivity(cs,cis); } return ret.retn(); @@ -7376,7 +7376,7 @@ DataArrayInt *MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh() co int nbCells=getNumberOfCells(); int typi=(int)typ; int nbNodesPerCell=(int)cm.getNumberOfNodes(); - MEDCouplingAutoRefCountObjectPtr connOut=DataArrayInt::New(); connOut->alloc(nbCells*nbNodesPerCell,1); + MCAuto connOut=DataArrayInt::New(); connOut->alloc(nbCells*nbNodesPerCell,1); int *outPtr=connOut->getPointer(); const int *conn=_nodal_connec->begin(); const int *connI=_nodal_connec_index->begin(); @@ -7402,14 +7402,14 @@ DataArrayInt *MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh() co */ void MEDCouplingUMesh::convertNodalConnectivityToDynamicGeoTypeMesh(DataArrayInt *&nodalConn, DataArrayInt *&nodalConnIndex) const { - static const char msg0[]="MEDCouplingUMesh::convertNodalConnectivityToDynamicGeoTypeMesh : nodal connectivity in this are invalid ! Call checkCoherency1 !"; + static const char msg0[]="MEDCouplingUMesh::convertNodalConnectivityToDynamicGeoTypeMesh : nodal connectivity in this are invalid ! Call checkConsistency !"; checkConnectivityFullyDefined(); if(_types.size()!=1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertNodalConnectivityToDynamicGeoTypeMesh : current mesh does not contain exactly one geometric type !"); int nbCells=getNumberOfCells(),lgth=_nodal_connec->getNumberOfTuples(); if(lgth c(DataArrayInt::New()),ci(DataArrayInt::New()); + MCAuto c(DataArrayInt::New()),ci(DataArrayInt::New()); c->alloc(lgth-nbCells,1); ci->alloc(nbCells+1,1); int *cp(c->getPointer()),*cip(ci->getPointer()); const int *incp(_nodal_connec->begin()),*incip(_nodal_connec_index->begin()); @@ -7464,12 +7464,12 @@ MEDCouplingUMesh *MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(cons const DataArrayDouble *refCoo=ms2[0]->getCoords(); int meshDim=ms2[0]->getMeshDimension(); std::vector m1ssm; - std::vector< MEDCouplingAutoRefCountObjectPtr > m1ssmAuto; + std::vector< MCAuto > m1ssmAuto; // std::vector m1ssmSingle; - std::vector< MEDCouplingAutoRefCountObjectPtr > m1ssmSingleAuto; + std::vector< MCAuto > m1ssmSingleAuto; int fake=0,rk=0; - MEDCouplingAutoRefCountObjectPtr ret1(DataArrayInt::New()),ret2(DataArrayInt::New()); + MCAuto ret1(DataArrayInt::New()),ret2(DataArrayInt::New()); ret1->alloc(0,1); ret2->alloc(0,1); for(std::vector::const_iterator it=ms2.begin();it!=ms2.end();it++,rk++) { @@ -7479,7 +7479,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(cons throw INTERP_KERNEL::Exception("MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords : meshes are not shared by a single coordinates coords !"); std::vector sp=(*it)->splitByType(); std::copy(sp.begin(),sp.end(),std::back_insert_iterator< std::vector >(m1ssm)); - std::copy(sp.begin(),sp.end(),std::back_insert_iterator< std::vector > >(m1ssmAuto)); + std::copy(sp.begin(),sp.end(),std::back_insert_iterator< std::vector > >(m1ssmAuto)); for(std::vector::const_iterator it2=sp.begin();it2!=sp.end();it2++) { MEDCouplingUMesh *singleCell=static_cast((*it2)->buildPartOfMySelf(&fake,&fake+1,true)); @@ -7488,12 +7488,12 @@ MEDCouplingUMesh *MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(cons ret1->pushBackSilent((*it2)->getNumberOfCells()); ret2->pushBackSilent(rk); } } - MEDCouplingAutoRefCountObjectPtr m1ssmSingle2=MEDCouplingUMesh::MergeUMeshesOnSameCoords(m1ssmSingle); - MEDCouplingAutoRefCountObjectPtr renum=m1ssmSingle2->sortCellsInMEDFileFrmt(); + MCAuto m1ssmSingle2=MEDCouplingUMesh::MergeUMeshesOnSameCoords(m1ssmSingle); + MCAuto renum=m1ssmSingle2->sortCellsInMEDFileFrmt(); std::vector m1ssmfinal(m1ssm.size()); for(std::size_t i=0;igetIJ(i,0)]=m1ssm[i]; - MEDCouplingAutoRefCountObjectPtr ret0=MEDCouplingUMesh::MergeUMeshesOnSameCoords(m1ssmfinal); + MCAuto ret0=MEDCouplingUMesh::MergeUMeshesOnSameCoords(m1ssmfinal); szOfCellGrpOfSameType=ret1->renumber(renum->getConstPointer()); idInMsOfCellGrpOfSameType=ret2->renumber(renum->getConstPointer()); return ret0.retn(); @@ -7508,7 +7508,7 @@ DataArrayInt *MEDCouplingUMesh::keepCellIdsByType(INTERP_KERNEL::NormalizedCellT checkFullyDefined(); const int *conn=_nodal_connec->getConstPointer(); const int *connIndex=_nodal_connec_index->getConstPointer(); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); for(const int *w=begin;w!=end;w++) if((INTERP_KERNEL::NormalizedCellType)conn[connIndex[*w]]==type) ret->pushBackSilent(*w); @@ -7571,7 +7571,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::keepSpecifiedCells(INTERP_KERNEL::Normalized oss << ". It should be in [0," << szOfType << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDCouplingAutoRefCountObjectPtr idsTokeep=DataArrayInt::New(); idsTokeep->alloc(sz+(int)std::distance(idsPerGeoTypeBg,idsPerGeoTypeEnd),1); + MCAuto idsTokeep=DataArrayInt::New(); idsTokeep->alloc(sz+(int)std::distance(idsPerGeoTypeBg,idsPerGeoTypeEnd),1); int *idsPtr=idsTokeep->getPointer(); int offset=0; for(std::size_t i=0;i(),offset)); offset+=code[3*i+1]; } - MEDCouplingAutoRefCountObjectPtr ret=static_cast(buildPartOfMySelf(idsTokeep->begin(),idsTokeep->end(),true)); + MCAuto ret=static_cast(buildPartOfMySelf(idsTokeep->begin(),idsTokeep->end(),true)); ret->copyTinyInfoFrom(this); return ret.retn(); } @@ -7630,9 +7630,9 @@ MEDCouplingMesh *MEDCouplingUMesh::mergeMyselfWith(const MEDCouplingMesh *other) * \throw If the nodal connectivity of cells is not defined. * \sa MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell */ -DataArrayDouble *MEDCouplingUMesh::getBarycenterAndOwner() const +DataArrayDouble *MEDCouplingUMesh::computeCellCenterOfMass() const { - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); int spaceDim=getSpaceDimension(); int nbOfCells=getNumberOfCells(); ret->alloc(nbOfCells,spaceDim); @@ -7652,19 +7652,19 @@ DataArrayDouble *MEDCouplingUMesh::getBarycenterAndOwner() const /*! * This method computes for each cell in \a this, the location of the iso barycenter of nodes constituting - * the cell. Contrary to badly named MEDCouplingUMesh::getBarycenterAndOwner method that returns the center of inertia of the + * the cell. Contrary to badly named MEDCouplingUMesh::computeCellCenterOfMass method that returns the center of inertia of the * * \return a newly allocated DataArrayDouble instance that the caller has to deal with. The returned * DataArrayDouble instance will have \c this->getNumberOfCells() tuples and \c this->getSpaceDimension() components. * - * \sa MEDCouplingUMesh::getBarycenterAndOwner + * \sa MEDCouplingUMesh::computeCellCenterOfMass * \throw If \a this is not fully defined (coordinates and connectivity) * \throw If there is presence in nodal connectivity in \a this of node ids not in [0, \c this->getNumberOfNodes() ) */ DataArrayDouble *MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell() const { checkFullyDefined(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); int spaceDim=getSpaceDimension(); int nbOfCells=getNumberOfCells(); int nbOfNodes=getNumberOfNodes(); @@ -7778,7 +7778,7 @@ DataArrayDouble *MEDCouplingUMesh::getPartBarycenterAndOwner(const int *begin, c */ DataArrayDouble *MEDCouplingUMesh::computePlaneEquationOf3DFaces() const { - MEDCouplingAutoRefCountObjectPtr ret(DataArrayDouble::New()); + MCAuto ret(DataArrayDouble::New()); int nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes()); if(getSpaceDimension()!=3 || getMeshDimension()!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::computePlaneEquationOf3DFaces : This method must be applied on a mesh having meshDimension equal 2 and a spaceDimension equal to 3 !"); @@ -7823,11 +7823,11 @@ MEDCouplingUMesh *MEDCouplingUMesh::Build0DMeshFromCoords(DataArrayDouble *da) if(!da) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Build0DMeshFromCoords : instance of DataArrayDouble must be not null !"); da->checkAllocated(); - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingUMesh::New(da->getName(),0); + MCAuto ret=MEDCouplingUMesh::New(da->getName(),0); ret->setCoords(da); int nbOfTuples=da->getNumberOfTuples(); - MEDCouplingAutoRefCountObjectPtr c=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr cI=DataArrayInt::New(); + MCAuto c=DataArrayInt::New(); + MCAuto cI=DataArrayInt::New(); c->alloc(2*nbOfTuples,1); cI->alloc(nbOfTuples+1,1); int *cp=c->getPointer(); @@ -7888,7 +7888,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshes(std::vector > bb(sz); + std::vector< MCAuto > bb(sz); std::vector< const MEDCouplingUMesh * > aa(sz); int spaceDim=-3; for(std::size_t i=0;i::const_iterator it=a.begin(); int meshDim=(*it)->getMeshDimension(); int nbOfCells=(*it)->getNumberOfCells(); - int meshLgth=(*it++)->getMeshLength(); + int meshLgth=(*it++)->getNodalConnectivityArrayLen(); for(;it!=a.end();it++) { if(meshDim!=(*it)->getMeshDimension()) throw INTERP_KERNEL::Exception("Mesh dimensions mismatches, MergeUMeshes impossible !"); nbOfCells+=(*it)->getNumberOfCells(); - meshLgth+=(*it)->getMeshLength(); + meshLgth+=(*it)->getNodalConnectivityArrayLen(); } std::vector aps(a.size()); std::copy(a.begin(),a.end(),aps.begin()); - MEDCouplingAutoRefCountObjectPtr pts=MergeNodesArray(aps); - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingUMesh::New("merge",meshDim); + MCAuto pts=MergeNodesArray(aps); + MCAuto ret=MEDCouplingUMesh::New("merge",meshDim); ret->setCoords(pts); - MEDCouplingAutoRefCountObjectPtr c=DataArrayInt::New(); + MCAuto c=DataArrayInt::New(); c->alloc(meshLgth,1); int *cPtr=c->getPointer(); - MEDCouplingAutoRefCountObjectPtr cI=DataArrayInt::New(); + MCAuto cI=DataArrayInt::New(); cI->alloc(nbOfCells+1,1); int *cIPtr=cI->getPointer(); *cIPtr++=0; @@ -8025,13 +8025,13 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesOnSameCoords(const std::vectorgetMeshDimension()) throw INTERP_KERNEL::Exception("Mesh dimensions mismatches, FuseUMeshesOnSameCoords impossible !"); - meshLgth+=(*iter)->getMeshLength(); + meshLgth+=(*iter)->getNodalConnectivityArrayLen(); meshIndexLgth+=(*iter)->getNumberOfCells(); } - MEDCouplingAutoRefCountObjectPtr nodal=DataArrayInt::New(); + MCAuto nodal=DataArrayInt::New(); nodal->alloc(meshLgth,1); int *nodalPtr=nodal->getPointer(); - MEDCouplingAutoRefCountObjectPtr nodalIndex=DataArrayInt::New(); + MCAuto nodalIndex=DataArrayInt::New(); nodalIndex->alloc(meshIndexLgth+1,1); int *nodalIndexPtr=nodalIndex->getPointer(); int offset=0; @@ -8040,7 +8040,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesOnSameCoords(const std::vectorgetNodalConnectivity()->getConstPointer(); const int *index=(*iter)->getNodalConnectivityIndex()->getConstPointer(); int nbOfCells=(*iter)->getNumberOfCells(); - int meshLgth2=(*iter)->getMeshLength(); + int meshLgth2=(*iter)->getNodalConnectivityArrayLen(); nodalPtr=std::copy(nod,nod+meshLgth2,nodalPtr); if(iter!=meshes.begin()) nodalIndexPtr=std::transform(index+1,index+nbOfCells+1,nodalIndexPtr,std::bind2nd(std::plus(),offset)); @@ -8083,8 +8083,8 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesOnSameCoords(const std::vector& meshes, int compType, std::vector& corr) { //All checks are delegated to MergeUMeshesOnSameCoords - MEDCouplingAutoRefCountObjectPtr ret=MergeUMeshesOnSameCoords(meshes); - MEDCouplingAutoRefCountObjectPtr o2n=ret->zipConnectivityTraducer(compType); + MCAuto ret=MergeUMeshesOnSameCoords(meshes); + MCAuto o2n=ret->zipConnectivityTraducer(compType); corr.resize(meshes.size()); std::size_t nbOfMeshes=meshes.size(); int offset=0; @@ -8144,7 +8144,7 @@ void MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(const std::vector res=DataArrayDouble::Aggregate(coords); + MCAuto res=DataArrayDouble::Aggregate(coords); std::vector::const_iterator it=meshes.begin(); int offset=(*it)->getNumberOfNodes(); (*it++)->setCoords(res); @@ -8195,13 +8195,13 @@ void MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(const std::vectorfindCommonTuples(eps,-1,comm,commI); - MEDCouplingAutoRefCountObjectPtr tmp1(comm),tmp2(commI); + MCAuto tmp1(comm),tmp2(commI); int oldNbOfNodes=coo->getNumberOfTuples(); int newNbOfNodes; - MEDCouplingAutoRefCountObjectPtr o2n=DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(oldNbOfNodes,comm->begin(),commI->begin(),commI->end(),newNbOfNodes); + MCAuto o2n=DataArrayInt::ConvertIndexArrayToO2N(oldNbOfNodes,comm->begin(),commI->begin(),commI->end(),newNbOfNodes); if(oldNbOfNodes==newNbOfNodes) return ; - MEDCouplingAutoRefCountObjectPtr newCoords=coo->renumberAndReduce(o2n->getConstPointer(),newNbOfNodes); + MCAuto newCoords=coo->renumberAndReduce(o2n->getConstPointer(),newNbOfNodes); for(std::vector::const_iterator it=meshes.begin();it!=meshes.end();it++) { (*it)->renumberNodesInConn(o2n->getConstPointer()); @@ -8394,7 +8394,7 @@ bool MEDCouplingUMesh::IsTetra4WellOriented(const int *begin, const int *end, co { std::size_t sz=std::distance(begin,end); if(sz!=4) - throw INTERP_KERNEL::Exception("MEDCouplingUMesh::IsTetra4WellOriented : Tetra4 cell with not 4 nodes ! Call checkCoherency1 !"); + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::IsTetra4WellOriented : Tetra4 cell with not 4 nodes ! Call checkConsistency !"); double vec0[3],vec1[3]; const double *pt0=coords+3*begin[0],*pt1=coords+3*begin[1],*pt2=coords+3*begin[2],*pt3=coords+3*begin[3]; vec0[0]=pt1[0]-pt0[0]; vec0[1]=pt1[1]-pt0[1]; vec0[2]=pt1[2]-pt0[2]; vec1[0]=pt2[0]-pt0[0]; vec1[1]=pt2[1]-pt0[1]; vec1[2]=pt2[2]-pt0[2]; @@ -8405,7 +8405,7 @@ bool MEDCouplingUMesh::IsPyra5WellOriented(const int *begin, const int *end, con { std::size_t sz=std::distance(begin,end); if(sz!=5) - throw INTERP_KERNEL::Exception("MEDCouplingUMesh::IsPyra5WellOriented : Pyra5 cell with not 5 nodes ! Call checkCoherency1 !"); + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::IsPyra5WellOriented : Pyra5 cell with not 5 nodes ! Call checkConsistency !"); double vec0[3]; INTERP_KERNEL::areaVectorOfPolygon(begin,4,coords,vec0); const double *pt0=coords+3*begin[0],*pt1=coords+3*begin[4]; @@ -8426,9 +8426,9 @@ bool MEDCouplingUMesh::IsPyra5WellOriented(const int *begin, const int *end, con void MEDCouplingUMesh::SimplifyPolyhedronCell(double eps, const DataArrayDouble *coords, const int *begin, const int *end, DataArrayInt *res) { int nbFaces=std::count(begin+1,end,-1)+1; - MEDCouplingAutoRefCountObjectPtr v=DataArrayDouble::New(); v->alloc(nbFaces,3); + MCAuto v=DataArrayDouble::New(); v->alloc(nbFaces,3); double *vPtr=v->getPointer(); - MEDCouplingAutoRefCountObjectPtr p=DataArrayDouble::New(); p->alloc(nbFaces,1); + MCAuto p=DataArrayDouble::New(); p->alloc(nbFaces,1); double *pPtr=p->getPointer(); const int *stFaceConn=begin+1; for(int i=0;igetPointer(); vPtr=v->getPointer(); DataArrayInt *comm1=0,*commI1=0; v->findCommonTuples(eps,-1,comm1,commI1); - MEDCouplingAutoRefCountObjectPtr comm1Auto(comm1),commI1Auto(commI1); + MCAuto comm1Auto(comm1),commI1Auto(commI1); const int *comm1Ptr=comm1->getConstPointer(); const int *commI1Ptr=commI1->getConstPointer(); int nbOfGrps1=commI1Auto->getNumberOfTuples()-1; res->pushBackSilent((int)INTERP_KERNEL::NORM_POLYHED); // - MEDCouplingAutoRefCountObjectPtr mm=MEDCouplingUMesh::New("",3); + MCAuto mm=MEDCouplingUMesh::New("",3); mm->setCoords(const_cast(coords)); mm->allocateCells(1); mm->insertNextCell(INTERP_KERNEL::NORM_POLYHED,(int)std::distance(begin+1,end),begin+1); mm->finishInsertingCells(); // for(int i=0;i tmpgrp2=p->selectByTupleId(comm1Ptr+commI1Ptr[i],comm1Ptr+commI1Ptr[i+1]); + MCAuto tmpgrp2=p->selectByTupleId(comm1Ptr+commI1Ptr[i],comm1Ptr+commI1Ptr[i+1]); DataArrayInt *comm2=0,*commI2=0; tmpgrp2->findCommonTuples(eps,-1,comm2,commI2); - MEDCouplingAutoRefCountObjectPtr comm2Auto(comm2),commI2Auto(commI2); + MCAuto comm2Auto(comm2),commI2Auto(commI2); const int *comm2Ptr=comm2->getConstPointer(); const int *commI2Ptr=commI2->getConstPointer(); int nbOfGrps2=commI2Auto->getNumberOfTuples()-1; @@ -8470,13 +8470,13 @@ void MEDCouplingUMesh::SimplifyPolyhedronCell(double eps, const DataArrayDouble else { int pointId=comm1Ptr[commI1Ptr[i]+comm2Ptr[commI2Ptr[j]]]; - MEDCouplingAutoRefCountObjectPtr ids2=comm2->selectByTupleId2(commI2Ptr[j],commI2Ptr[j+1],1); + MCAuto ids2=comm2->selectByTupleIdSafeSlice(commI2Ptr[j],commI2Ptr[j+1],1); ids2->transformWithIndArr(comm1Ptr+commI1Ptr[i],comm1Ptr+commI1Ptr[i+1]); DataArrayInt *tmp0=DataArrayInt::New(),*tmp1=DataArrayInt::New(),*tmp2=DataArrayInt::New(),*tmp3=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr mm2=mm->buildDescendingConnectivity(tmp0,tmp1,tmp2,tmp3); tmp0->decrRef(); tmp1->decrRef(); tmp2->decrRef(); tmp3->decrRef(); - MEDCouplingAutoRefCountObjectPtr mm3=static_cast(mm2->buildPartOfMySelf(ids2->begin(),ids2->end(),true)); - MEDCouplingAutoRefCountObjectPtr idsNodeTmp=mm3->zipCoordsTraducer(); - MEDCouplingAutoRefCountObjectPtr idsNode=idsNodeTmp->invertArrayO2N2N2O(mm3->getNumberOfNodes()); + MCAuto mm2=mm->buildDescendingConnectivity(tmp0,tmp1,tmp2,tmp3); tmp0->decrRef(); tmp1->decrRef(); tmp2->decrRef(); tmp3->decrRef(); + MCAuto mm3=static_cast(mm2->buildPartOfMySelf(ids2->begin(),ids2->end(),true)); + MCAuto idsNodeTmp=mm3->zipCoordsTraducer(); + MCAuto idsNode=idsNodeTmp->invertArrayO2N2N2O(mm3->getNumberOfNodes()); const int *idsNodePtr=idsNode->getConstPointer(); double center[3]; center[0]=pPtr[pointId]*vPtr[3*vecId]; center[1]=pPtr[pointId]*vPtr[3*vecId+1]; center[2]=pPtr[pointId]*vPtr[3*vecId+2]; double vec[3]; vec[0]=vPtr[3*vecId+1]; vec[1]=-vPtr[3*vecId]; vec[2]=0.; @@ -8487,7 +8487,7 @@ void MEDCouplingUMesh::SimplifyPolyhedronCell(double eps, const DataArrayDouble mm3->rotate(center,vec,angle); } mm3->changeSpaceDimension(2); - MEDCouplingAutoRefCountObjectPtr mm4=mm3->buildSpreadZonesWithPoly(); + MCAuto mm4=mm3->buildSpreadZonesWithPoly(); const int *conn4=mm4->getNodalConnectivity()->getConstPointer(); const int *connI4=mm4->getNodalConnectivityIndex()->getConstPointer(); int nbOfCells=mm4->getNumberOfCells(); @@ -8636,12 +8636,12 @@ DataArrayInt *MEDCouplingUMesh::buildUnionOf2DMeshLinear(const MEDCouplingUMesh { int nbOfNodesExpected(skin->getNumberOfNodes()); const int *n2oPtr(n2o->getConstPointer()); - MEDCouplingAutoRefCountObjectPtr revNodal(DataArrayInt::New()),revNodalI(DataArrayInt::New()); + MCAuto revNodal(DataArrayInt::New()),revNodalI(DataArrayInt::New()); skin->getReverseNodalConnectivity(revNodal,revNodalI); const int *revNodalPtr(revNodal->getConstPointer()),*revNodalIPtr(revNodalI->getConstPointer()); const int *nodalPtr(skin->getNodalConnectivity()->getConstPointer()); const int *nodalIPtr(skin->getNodalConnectivityIndex()->getConstPointer()); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); ret->alloc(nbOfNodesExpected+1,1); + MCAuto ret(DataArrayInt::New()); ret->alloc(nbOfNodesExpected+1,1); int *work(ret->getPointer()); *work++=INTERP_KERNEL::NORM_POLYGON; if(nbOfNodesExpected<1) return ret.retn(); @@ -8681,12 +8681,12 @@ DataArrayInt *MEDCouplingUMesh::buildUnionOf2DMeshQuadratic(const MEDCouplingUMe int nbOfNodesExpected(skin->getNumberOfNodes()); int nbOfTurn(nbOfNodesExpected/2); const int *n2oPtr(n2o->getConstPointer()); - MEDCouplingAutoRefCountObjectPtr revNodal(DataArrayInt::New()),revNodalI(DataArrayInt::New()); + MCAuto revNodal(DataArrayInt::New()),revNodalI(DataArrayInt::New()); skin->getReverseNodalConnectivity(revNodal,revNodalI); const int *revNodalPtr(revNodal->getConstPointer()),*revNodalIPtr(revNodalI->getConstPointer()); const int *nodalPtr(skin->getNodalConnectivity()->getConstPointer()); const int *nodalIPtr(skin->getNodalConnectivityIndex()->getConstPointer()); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); ret->alloc(nbOfNodesExpected+1,1); + MCAuto ret(DataArrayInt::New()); ret->alloc(nbOfNodesExpected+1,1); int *work(ret->getPointer()); *work++=INTERP_KERNEL::NORM_QPOLYG; if(nbOfNodesExpected<1) return ret.retn(); @@ -8734,11 +8734,11 @@ DataArrayInt *MEDCouplingUMesh::buildUnionOf2DMesh() const { if(getMeshDimension()!=2 || getSpaceDimension()!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildUnionOf2DMesh : meshdimension, spacedimension must be equal to 2 !"); - MEDCouplingAutoRefCountObjectPtr skin(computeSkin()); + MCAuto skin(computeSkin()); int oldNbOfNodes(skin->getNumberOfNodes()); - MEDCouplingAutoRefCountObjectPtr o2n(skin->zipCoordsTraducer()); + MCAuto o2n(skin->zipCoordsTraducer()); int nbOfNodesExpected(skin->getNumberOfNodes()); - MEDCouplingAutoRefCountObjectPtr n2o(o2n->invertArrayO2N2N2O(oldNbOfNodes)); + MCAuto n2o(o2n->invertArrayO2N2N2O(oldNbOfNodes)); int nbCells(skin->getNumberOfCells()); if(nbCells==nbOfNodesExpected) return buildUnionOf2DMeshLinear(skin,n2o); @@ -8758,11 +8758,11 @@ DataArrayInt *MEDCouplingUMesh::buildUnionOf3DMesh() const { if(getMeshDimension()!=3 || getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildUnionOf3DMesh : meshdimension, spacedimension must be equal to 2 !"); - MEDCouplingAutoRefCountObjectPtr m=computeSkin(); + MCAuto m=computeSkin(); const int *conn=m->getNodalConnectivity()->getConstPointer(); const int *connI=m->getNodalConnectivityIndex()->getConstPointer(); int nbOfCells=m->getNumberOfCells(); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); ret->alloc(m->getNodalConnectivity()->getNumberOfTuples(),1); + MCAuto ret=DataArrayInt::New(); ret->alloc(m->getNodalConnectivity()->getNumberOfTuples(),1); int *work=ret->getPointer(); *work++=INTERP_KERNEL::NORM_POLYHED; if(nbOfCells<1) return ret.retn(); @@ -8890,17 +8890,17 @@ void MEDCouplingUMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData _coords->writeVTK(ofs,8,"Points",byteData); else { - MEDCouplingAutoRefCountObjectPtr coo=_coords->changeNbOfComponents(3,0.); + MCAuto coo=_coords->changeNbOfComponents(3,0.); coo->writeVTK(ofs,8,"Points",byteData); } ofs << " \n"; ofs << " \n"; const int *cPtr=_nodal_connec->getConstPointer(); const int *cIPtr=_nodal_connec_index->getConstPointer(); - MEDCouplingAutoRefCountObjectPtr faceoffsets=DataArrayInt::New(); faceoffsets->alloc(nbOfCells,1); - MEDCouplingAutoRefCountObjectPtr types=DataArrayInt::New(); types->alloc(nbOfCells,1); - MEDCouplingAutoRefCountObjectPtr offsets=DataArrayInt::New(); offsets->alloc(nbOfCells,1); - MEDCouplingAutoRefCountObjectPtr connectivity=DataArrayInt::New(); connectivity->alloc(_nodal_connec->getNumberOfTuples()-nbOfCells,1); + MCAuto faceoffsets=DataArrayInt::New(); faceoffsets->alloc(nbOfCells,1); + MCAuto types=DataArrayInt::New(); types->alloc(nbOfCells,1); + MCAuto offsets=DataArrayInt::New(); offsets->alloc(nbOfCells,1); + MCAuto connectivity=DataArrayInt::New(); connectivity->alloc(_nodal_connec->getNumberOfTuples()-nbOfCells,1); int *w1=faceoffsets->getPointer(),*w2=types->getPointer(),*w3=offsets->getPointer(),*w4=connectivity->getPointer(); int szFaceOffsets=0,szConn=0; for(int i=0;ireAlloc(szConn); faceoffsets->writeVTK(ofs,8,"Int32","faceoffsets",byteData); - MEDCouplingAutoRefCountObjectPtr faces=DataArrayInt::New(); faces->alloc(szFaceOffsets,1); + MCAuto faces=DataArrayInt::New(); faces->alloc(szFaceOffsets,1); w1=faces->getPointer(); for(int i=0;idecrRef(); revDescIndx1->decrRef(); revDesc2->decrRef(); revDescIndx2->decrRef(); - MEDCouplingAutoRefCountObjectPtr dd1(desc1),dd2(descIndx1),dd3(desc2),dd4(descIndx2); - MEDCouplingAutoRefCountObjectPtr dd5(m1Desc),dd6(m2Desc); + MCAuto dd1(desc1),dd2(descIndx1),dd3(desc2),dd4(descIndx2); + MCAuto dd5(m1Desc),dd6(m2Desc); // Step 2: re-order newly created nodes according to the ordering found in m2 std::vector< std::vector > intersectEdge2; @@ -9051,20 +9051,20 @@ MEDCouplingUMesh *MEDCouplingUMesh::Intersect2DMeshes(const MEDCouplingUMesh *m1 /* outputs -> */addCoordsQuadratic,cr,crI,cNb1,cNb2); // Step 4: Prepare final result: - MEDCouplingAutoRefCountObjectPtr addCooDa(DataArrayDouble::New()); + MCAuto addCooDa(DataArrayDouble::New()); addCooDa->alloc((int)(addCoo.size())/2,2); std::copy(addCoo.begin(),addCoo.end(),addCooDa->getPointer()); - MEDCouplingAutoRefCountObjectPtr addCoordsQuadraticDa(DataArrayDouble::New()); + MCAuto addCoordsQuadraticDa(DataArrayDouble::New()); addCoordsQuadraticDa->alloc((int)(addCoordsQuadratic.size())/2,2); std::copy(addCoordsQuadratic.begin(),addCoordsQuadratic.end(),addCoordsQuadraticDa->getPointer()); std::vector coordss(4); coordss[0]=m1->getCoords(); coordss[1]=m2->getCoords(); coordss[2]=addCooDa; coordss[3]=addCoordsQuadraticDa; - MEDCouplingAutoRefCountObjectPtr coo(DataArrayDouble::Aggregate(coordss)); - MEDCouplingAutoRefCountObjectPtr ret(MEDCouplingUMesh::New("Intersect2D",2)); - MEDCouplingAutoRefCountObjectPtr conn(DataArrayInt::New()); conn->alloc((int)cr.size(),1); std::copy(cr.begin(),cr.end(),conn->getPointer()); - MEDCouplingAutoRefCountObjectPtr connI(DataArrayInt::New()); connI->alloc((int)crI.size(),1); std::copy(crI.begin(),crI.end(),connI->getPointer()); - MEDCouplingAutoRefCountObjectPtr c1(DataArrayInt::New()); c1->alloc((int)cNb1.size(),1); std::copy(cNb1.begin(),cNb1.end(),c1->getPointer()); - MEDCouplingAutoRefCountObjectPtr c2(DataArrayInt::New()); c2->alloc((int)cNb2.size(),1); std::copy(cNb2.begin(),cNb2.end(),c2->getPointer()); + MCAuto coo(DataArrayDouble::Aggregate(coordss)); + MCAuto ret(MEDCouplingUMesh::New("Intersect2D",2)); + MCAuto conn(DataArrayInt::New()); conn->alloc((int)cr.size(),1); std::copy(cr.begin(),cr.end(),conn->getPointer()); + MCAuto connI(DataArrayInt::New()); connI->alloc((int)crI.size(),1); std::copy(crI.begin(),crI.end(),connI->getPointer()); + MCAuto c1(DataArrayInt::New()); c1->alloc((int)cNb1.size(),1); std::copy(cNb1.begin(),cNb1.end(),c1->getPointer()); + MCAuto c2(DataArrayInt::New()); c2->alloc((int)cNb2.size(),1); std::copy(cNb2.begin(),cNb2.end(),c2->getPointer()); ret->setConnectivity(conn,connI,true); ret->setCoords(coo); cellNb1=c1.retn(); cellNb2=c2.retn(); @@ -9097,7 +9097,7 @@ bool IsColinearOfACellOf(const std::vector< std::vector >& intersectEdge1, } MEDCouplingUMesh *BuildMesh1DCutFrom(const MEDCouplingUMesh *mesh1D, const std::vector< std::vector >& intersectEdge2, const DataArrayDouble *coords1, const std::vector& addCoo, const std::map& mergedNodes, const std::vector< std::vector >& colinear2, const std::vector< std::vector >& intersectEdge1, - MEDCouplingAutoRefCountObjectPtr& idsInRetColinear, MEDCouplingAutoRefCountObjectPtr& idsInMesh1DForIdsInRetColinear) + MCAuto& idsInRetColinear, MCAuto& idsInMesh1DForIdsInRetColinear) { idsInRetColinear=DataArrayInt::New(); idsInRetColinear->alloc(0,1); idsInMesh1DForIdsInRetColinear=DataArrayInt::New(); idsInMesh1DForIdsInRetColinear->alloc(0,1); @@ -9111,18 +9111,18 @@ MEDCouplingUMesh *BuildMesh1DCutFrom(const MEDCouplingUMesh *mesh1D, const std:: int offset2(offset1+coo2->getNumberOfTuples()); int offset3(offset2+addCoo.size()/2); std::vector addCooQuad; - MEDCouplingAutoRefCountObjectPtr cOut(DataArrayInt::New()),ciOut(DataArrayInt::New()); cOut->alloc(0,1); ciOut->alloc(1,1); ciOut->setIJ(0,0,0); + MCAuto cOut(DataArrayInt::New()),ciOut(DataArrayInt::New()); cOut->alloc(0,1); ciOut->alloc(1,1); ciOut->setIJ(0,0,0); int tmp[4],cicnt(0),kk(0); for(int i=0;i,int> m; + std::map,int> m; INTERP_KERNEL::Edge *e(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)c[ci[i]],c+ci[i]+1,coo2Ptr,m)); const std::vector& subEdges(intersectEdge2[i]); int nbSubEdge(subEdges.size()/2); for(int j=0;j n1(MEDCouplingUMeshBuildQPNode(subEdges[2*j],coords1->begin(),offset1,coo2Ptr,offset2,addCoo)),n2(MEDCouplingUMeshBuildQPNode(subEdges[2*j+1],coords1->begin(),offset1,coo2Ptr,offset2,addCoo)); - MEDCouplingAutoRefCountObjectPtr e2(e->buildEdgeLyingOnMe(n1,n2)); + MCAuto n1(MEDCouplingUMeshBuildQPNode(subEdges[2*j],coords1->begin(),offset1,coo2Ptr,offset2,addCoo)),n2(MEDCouplingUMeshBuildQPNode(subEdges[2*j+1],coords1->begin(),offset1,coo2Ptr,offset2,addCoo)); + MCAuto e2(e->buildEdgeLyingOnMe(n1,n2)); INTERP_KERNEL::Edge *e2Ptr(e2); std::map::const_iterator itm; if(dynamic_cast(e2Ptr)) @@ -9159,14 +9159,14 @@ MEDCouplingUMesh *BuildMesh1DCutFrom(const MEDCouplingUMesh *mesh1D, const std:: } e->decrRef(); } - MEDCouplingAutoRefCountObjectPtr ret(MEDCouplingUMesh::New(mesh1D->getName(),1)); + MCAuto ret(MEDCouplingUMesh::New(mesh1D->getName(),1)); ret->setConnectivity(cOut,ciOut,true); - MEDCouplingAutoRefCountObjectPtr arr3(DataArrayDouble::New()); + MCAuto arr3(DataArrayDouble::New()); arr3->useArray(&addCoo[0],false,C_DEALLOC,(int)addCoo.size()/2,2); - MEDCouplingAutoRefCountObjectPtr arr4(DataArrayDouble::New()); arr4->useArray(&addCooQuad[0],false,C_DEALLOC,(int)addCooQuad.size()/2,2); + MCAuto arr4(DataArrayDouble::New()); arr4->useArray(&addCooQuad[0],false,C_DEALLOC,(int)addCooQuad.size()/2,2); std::vector coordss(4); coordss[0]=coords1; coordss[1]=mesh1D->getCoords(); coordss[2]=arr3; coordss[3]=arr4; - MEDCouplingAutoRefCountObjectPtr arr(DataArrayDouble::Aggregate(coordss)); + MCAuto arr(DataArrayDouble::Aggregate(coordss)); ret->setCoords(arr); return ret.retn(); } @@ -9186,7 +9186,7 @@ MEDCouplingUMesh *BuildRefined2DCellLinear(const DataArrayDouble *coords, const if(nb%2!=0) throw INTERP_KERNEL::Exception("BuildRefined2DCellLinear : internal error 1 !"); std::size_t nbOfEdgesOf2DCellSplit(nb/2); - MEDCouplingAutoRefCountObjectPtr ret(MEDCouplingUMesh::New("",2)); + MCAuto ret(MEDCouplingUMesh::New("",2)); ret->setCoords(coords); ret->allocateCells(1); std::vector connOut(nbOfEdgesOf2DCellSplit); @@ -9207,7 +9207,7 @@ MEDCouplingUMesh *BuildRefined2DCellQuadratic(const DataArrayDouble *coords, con INTERP_KERNEL::AutoPtr tmpPtr(new int[ci[cellIdInMesh2D+1]-ci[cellIdInMesh2D]]); std::vector allEdges,centers; const double *coordsPtr(coords->begin()); - MEDCouplingAutoRefCountObjectPtr addCoo(DataArrayDouble::New()); addCoo->alloc(0,1); + MCAuto addCoo(DataArrayDouble::New()); addCoo->alloc(0,1); int offset(coords->getNumberOfTuples()); for(const int *it2(descBg);it2!=descEnd;it2++,ii++) { @@ -9223,8 +9223,8 @@ MEDCouplingUMesh *BuildRefined2DCellQuadratic(const DataArrayDouble *coords, con else {//the current edge has been subsplit -> create corresponding centers. std::size_t nbOfCentersToAppend(edge1.size()/2); - std::map< MEDCouplingAutoRefCountObjectPtr,int> m; - MEDCouplingAutoRefCountObjectPtr ee(MEDCouplingUMeshBuildQPFromEdge2(typeOfSon,tmpPtr,coordsPtr,m)); + std::map< MCAuto,int> m; + MCAuto ee(MEDCouplingUMeshBuildQPFromEdge2(typeOfSon,tmpPtr,coordsPtr,m)); std::vector::const_iterator it3(allEdges.end()-edge1.size()); for(std::size_t k=0;k ret(MEDCouplingUMesh::New("",2)); + MCAuto ret(MEDCouplingUMesh::New("",2)); if(addCoo->empty()) ret->setCoords(coords); else @@ -9274,10 +9274,10 @@ MEDCouplingUMesh *BuildRefined2DCell(const DataArrayDouble *coords, const MEDCou return BuildRefined2DCellQuadratic(coords,mesh2D,cellIdInMesh2D,descBg,descEnd,intersectEdge1); } -void AddCellInMesh2D(MEDCouplingUMesh *mesh2D, const std::vector& conn, const std::vector< MEDCouplingAutoRefCountObjectPtr >& edges) +void AddCellInMesh2D(MEDCouplingUMesh *mesh2D, const std::vector& conn, const std::vector< MCAuto >& edges) { bool isQuad(false); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=edges.begin();it!=edges.end();it++) + for(std::vector< MCAuto >::const_iterator it=edges.begin();it!=edges.end();it++) { const INTERP_KERNEL::Edge *ee(*it); if(dynamic_cast(ee)) @@ -9312,8 +9312,8 @@ void AddCellInMesh2D(MEDCouplingUMesh *mesh2D, const std::vector& conn, con * This method cuts in 2 parts the input 2D cell given using boundaries description (\a edge1Bis and \a edge1BisPtr) using * a set of edges defined in \a splitMesh1D. */ -void BuildMesh2DCutInternal2(const MEDCouplingUMesh *splitMesh1D, const std::vector& edge1Bis, const std::vector< MEDCouplingAutoRefCountObjectPtr >& edge1BisPtr, - std::vector< std::vector >& out0, std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr > >& out1) +void BuildMesh2DCutInternal2(const MEDCouplingUMesh *splitMesh1D, const std::vector& edge1Bis, const std::vector< MCAuto >& edge1BisPtr, + std::vector< std::vector >& out0, std::vector< std::vector< MCAuto > >& out1) { std::size_t nb(edge1Bis.size()/2); std::size_t nbOfEdgesOf2DCellSplit(nb/2); @@ -9330,7 +9330,7 @@ void BuildMesh2DCutInternal2(const MEDCouplingUMesh *splitMesh1D, const std::vec out0.resize(1); out1.resize(1); std::vector& connOut(out0[0]); connOut.resize(nbOfEdgesOf2DCellSplit); - std::vector< MEDCouplingAutoRefCountObjectPtr >& edgesPtr(out1[0]); + std::vector< MCAuto >& edgesPtr(out1[0]); edgesPtr.resize(nbOfEdgesOf2DCellSplit); for(std::size_t kk=0;kk& connOutLeft(out0[0]); std::vector& connOutRight(out0[1]);//connOutLeft should end with edge1Bis[2*ii] and connOutRight should end with edge1Bis[2*jj+1] - std::vector< MEDCouplingAutoRefCountObjectPtr >& eleft(out1[0]); - std::vector< MEDCouplingAutoRefCountObjectPtr >& eright(out1[1]); + std::vector< MCAuto >& eleft(out1[0]); + std::vector< MCAuto >& eright(out1[1]); for(std::size_t k=ii;k > ees(iEnd); + std::vector< MCAuto > ees(iEnd); for(int ik=0;ik,int> m; - MEDCouplingAutoRefCountObjectPtr ee(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)cSplitPtr[ciSplitPtr[ik]],cSplitPtr+ciSplitPtr[ik]+1,splitMesh1D->getCoords()->begin(),m)); + std::map< MCAuto,int> m; + MCAuto ee(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)cSplitPtr[ciSplitPtr[ik]],cSplitPtr+ciSplitPtr[ik]+1,splitMesh1D->getCoords()->begin(),m)); ees[ik]=ee; } for(int ik=iEnd-1;ik>=0;ik--) @@ -9374,16 +9374,16 @@ struct CellInfo { public: CellInfo() { } - CellInfo(const std::vector& edges, const std::vector< MEDCouplingAutoRefCountObjectPtr >& edgesPtr); + CellInfo(const std::vector& edges, const std::vector< MCAuto >& edgesPtr); public: std::vector _edges; - std::vector< MEDCouplingAutoRefCountObjectPtr > _edges_ptr; + std::vector< MCAuto > _edges_ptr; }; -CellInfo::CellInfo(const std::vector& edges, const std::vector< MEDCouplingAutoRefCountObjectPtr >& edgesPtr) +CellInfo::CellInfo(const std::vector& edges, const std::vector< MCAuto >& edgesPtr) { std::size_t nbe(edges.size()); - std::vector edges2(2*nbe); std::vector< MEDCouplingAutoRefCountObjectPtr > edgesPtr2(2*nbe); + std::vector edges2(2*nbe); std::vector< MCAuto > edgesPtr2(2*nbe); for(std::size_t i=0;i& edges, const std::vector< MEDCoupling class EdgeInfo { public: - EdgeInfo(int istart, int iend, const MEDCouplingAutoRefCountObjectPtr& mesh):_istart(istart),_iend(iend),_mesh(mesh),_left(-7),_right(-7) { } - EdgeInfo(int istart, int iend, int pos, const MEDCouplingAutoRefCountObjectPtr& edge):_istart(istart),_iend(iend),_edge(edge),_left(pos),_right(pos+1) { } + EdgeInfo(int istart, int iend, const MCAuto& mesh):_istart(istart),_iend(iend),_mesh(mesh),_left(-7),_right(-7) { } + EdgeInfo(int istart, int iend, int pos, const MCAuto& edge):_istart(istart),_iend(iend),_edge(edge),_left(pos),_right(pos+1) { } bool isInMyRange(int pos) const { return pos>=_istart && pos<_iend; } - void somethingHappendAt(int pos, const std::vector< MEDCouplingAutoRefCountObjectPtr >& newLeft, const std::vector< MEDCouplingAutoRefCountObjectPtr >& newRight); + void somethingHappendAt(int pos, const std::vector< MCAuto >& newLeft, const std::vector< MCAuto >& newRight); void feedEdgeInfoAt(double eps, const MEDCouplingUMesh *mesh2D, int offset, int neighbors[2]) const; private: int _istart; int _iend; - MEDCouplingAutoRefCountObjectPtr _mesh; - MEDCouplingAutoRefCountObjectPtr _edge; + MCAuto _mesh; + MCAuto _edge; int _left; int _right; }; -void EdgeInfo::somethingHappendAt(int pos, const std::vector< MEDCouplingAutoRefCountObjectPtr >& newLeft, const std::vector< MEDCouplingAutoRefCountObjectPtr >& newRight) +void EdgeInfo::somethingHappendAt(int pos, const std::vector< MCAuto >& newLeft, const std::vector< MCAuto >& newRight) { const MEDCouplingUMesh *mesh(_mesh); if(mesh) @@ -9468,7 +9468,7 @@ void EdgeInfo::feedEdgeInfoAt(double eps, const MEDCouplingUMesh *mesh2D, int of } else { - MEDCouplingAutoRefCountObjectPtr barys(mesh->getBarycenterAndOwner()); + MCAuto barys(mesh->computeCellCenterOfMass()); int cellId(mesh2D->getCellContainingPoint(barys->begin(),eps)); if(cellId==-1) throw INTERP_KERNEL::Exception("EdgeInfo::feedEdgeInfoAt : internal error !"); @@ -9480,26 +9480,26 @@ void EdgeInfo::feedEdgeInfoAt(double eps, const MEDCouplingUMesh *mesh2D, int of class VectorOfCellInfo { public: - VectorOfCellInfo(const std::vector& edges, const std::vector< MEDCouplingAutoRefCountObjectPtr >& edgesPtr); + VectorOfCellInfo(const std::vector& edges, const std::vector< MCAuto >& edgesPtr); std::size_t size() const { return _pool.size(); } int getPositionOf(double eps, const MEDCouplingUMesh *mesh) const; - void setMeshAt(int pos, const MEDCouplingAutoRefCountObjectPtr& mesh, int istart, int iend, const MEDCouplingAutoRefCountObjectPtr& mesh1DInCase, const std::vector< std::vector >& edges, const std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr > >& edgePtrs); + void setMeshAt(int pos, const MCAuto& mesh, int istart, int iend, const MCAuto& mesh1DInCase, const std::vector< std::vector >& edges, const std::vector< std::vector< MCAuto > >& edgePtrs); const std::vector& getConnOf(int pos) const { return get(pos)._edges; } - const std::vector< MEDCouplingAutoRefCountObjectPtr >& getEdgePtrOf(int pos) const { return get(pos)._edges_ptr; } - MEDCouplingAutoRefCountObjectPtr getZeMesh() const { return _ze_mesh; } + const std::vector< MCAuto >& getEdgePtrOf(int pos) const { return get(pos)._edges_ptr; } + MCAuto getZeMesh() const { return _ze_mesh; } void feedEdgeInfoAt(double eps, int pos, int offset, int neighbors[2]) const; private: int getZePosOfEdgeGivenItsGlobalId(int pos) const; - void updateEdgeInfo(int pos, const std::vector< MEDCouplingAutoRefCountObjectPtr >& newLeft, const std::vector< MEDCouplingAutoRefCountObjectPtr >& newRight); + void updateEdgeInfo(int pos, const std::vector< MCAuto >& newLeft, const std::vector< MCAuto >& newRight); const CellInfo& get(int pos) const; CellInfo& get(int pos); private: std::vector _pool; - MEDCouplingAutoRefCountObjectPtr _ze_mesh; + MCAuto _ze_mesh; std::vector _edge_info; }; -VectorOfCellInfo::VectorOfCellInfo(const std::vector& edges, const std::vector< MEDCouplingAutoRefCountObjectPtr >& edgesPtr):_pool(1) +VectorOfCellInfo::VectorOfCellInfo(const std::vector& edges, const std::vector< MCAuto >& edgesPtr):_pool(1) { _pool[0]._edges=edges; _pool[0]._edges_ptr=edgesPtr; @@ -9514,11 +9514,11 @@ int VectorOfCellInfo::getPositionOf(double eps, const MEDCouplingUMesh *mesh) co const MEDCouplingUMesh *zeMesh(_ze_mesh); if(!zeMesh) throw INTERP_KERNEL::Exception("VectorOfCellSplitter::getPositionOf : null aggregated mesh !"); - MEDCouplingAutoRefCountObjectPtr barys(mesh->getBarycenterAndOwner()); + MCAuto barys(mesh->computeCellCenterOfMass()); return zeMesh->getCellContainingPoint(barys->begin(),eps); } -void VectorOfCellInfo::setMeshAt(int pos, const MEDCouplingAutoRefCountObjectPtr& mesh, int istart, int iend, const MEDCouplingAutoRefCountObjectPtr& mesh1DInCase, const std::vector< std::vector >& edges, const std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr > >& edgePtrs) +void VectorOfCellInfo::setMeshAt(int pos, const MCAuto& mesh, int istart, int iend, const MCAuto& mesh1DInCase, const std::vector< std::vector >& edges, const std::vector< std::vector< MCAuto > >& edgePtrs) { get(pos);//to check pos bool isFast(pos==0 && _pool.size()==1); @@ -9547,16 +9547,16 @@ void VectorOfCellInfo::setMeshAt(int pos, const MEDCouplingAutoRefCountObjectPtr return ; } // - std::vector< MEDCouplingAutoRefCountObjectPtr > ms; + std::vector< MCAuto > ms; if(pos>0) { - MEDCouplingAutoRefCountObjectPtr elt(static_cast(_ze_mesh->buildPartOfMySelf2(0,pos,true))); + MCAuto elt(static_cast(_ze_mesh->buildPartOfMySelfSlice(0,pos,true))); ms.push_back(elt); } ms.push_back(mesh); if(pos<_ze_mesh->getNumberOfCells()-1) { - MEDCouplingAutoRefCountObjectPtr elt(static_cast(_ze_mesh->buildPartOfMySelf2(pos+1,_ze_mesh->getNumberOfCells(),true))); + MCAuto elt(static_cast(_ze_mesh->buildPartOfMySelfSlice(pos+1,_ze_mesh->getNumberOfCells(),true))); ms.push_back(elt); } std::vector< const MEDCouplingUMesh *> ms2(ms.size()); @@ -9583,7 +9583,7 @@ int VectorOfCellInfo::getZePosOfEdgeGivenItsGlobalId(int pos) const throw INTERP_KERNEL::Exception("VectorOfCellInfo::getZePosOfEdgeGivenItsGlobalId : invalid id !"); } -void VectorOfCellInfo::updateEdgeInfo(int pos, const std::vector< MEDCouplingAutoRefCountObjectPtr >& newLeft, const std::vector< MEDCouplingAutoRefCountObjectPtr >& newRight) +void VectorOfCellInfo::updateEdgeInfo(int pos, const std::vector< MCAuto >& newLeft, const std::vector< MCAuto >& newRight) { get(pos);//to check; if(_edge_info.empty()) @@ -9618,8 +9618,8 @@ CellInfo& VectorOfCellInfo::get(int pos) * * \param [in] allEdges a list of pairs (beginNode, endNode). Linked with \a allEdgesPtr to get the equation of edge. */ -MEDCouplingUMesh *BuildMesh2DCutInternal(double eps, const MEDCouplingUMesh *splitMesh1D, const std::vector& allEdges, const std::vector< MEDCouplingAutoRefCountObjectPtr >& allEdgesPtr, int offset, - MEDCouplingAutoRefCountObjectPtr& idsLeftRight) +MEDCouplingUMesh *BuildMesh2DCutInternal(double eps, const MEDCouplingUMesh *splitMesh1D, const std::vector& allEdges, const std::vector< MCAuto >& allEdgesPtr, int offset, + MCAuto& idsLeftRight) { int nbCellsInSplitMesh1D(splitMesh1D->getNumberOfCells()); if(nbCellsInSplitMesh1D==0) @@ -9629,7 +9629,7 @@ MEDCouplingUMesh *BuildMesh2DCutInternal(double eps, const MEDCouplingUMesh *spl if(nb%2!=0) throw INTERP_KERNEL::Exception("BuildMesh2DCutFrom : internal error 2 !"); std::vector edge1Bis(nb*2); - std::vector< MEDCouplingAutoRefCountObjectPtr > edge1BisPtr(nb*2); + std::vector< MCAuto > edge1BisPtr(nb*2); std::copy(allEdges.begin(),allEdges.end(),edge1Bis.begin()); std::copy(allEdges.begin(),allEdges.end(),edge1Bis.begin()+nb); std::copy(allEdgesPtr.begin(),allEdgesPtr.end(),edge1BisPtr.begin()); @@ -9652,15 +9652,15 @@ MEDCouplingUMesh *BuildMesh2DCutInternal(double eps, const MEDCouplingUMesh *spl if(iEnd partOfSplitMesh1D(static_cast(splitMesh1D->buildPartOfMySelf2(iStart,iEnd,1,true))); + MCAuto partOfSplitMesh1D(static_cast(splitMesh1D->buildPartOfMySelfSlice(iStart,iEnd,1,true))); int pos(pool.getPositionOf(eps,partOfSplitMesh1D)); // - MEDCouplingAutoRefCountObjectPtrretTmp(MEDCouplingUMesh::New("",2)); + MCAutoretTmp(MEDCouplingUMesh::New("",2)); retTmp->setCoords(splitMesh1D->getCoords()); retTmp->allocateCells(); std::vector< std::vector > out0; - std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr > > out1; + std::vector< std::vector< MCAuto > > out1; BuildMesh2DCutInternal2(partOfSplitMesh1D,pool.getConnOf(pos),pool.getEdgePtrOf(pos),out0,out1); for(std::size_t cnt=0;cnt >& intersectEdge1, int offset, - MEDCouplingAutoRefCountObjectPtr& idsLeftRight) + MCAuto& idsLeftRight) { const int *cdescPtr(mesh2DDesc->getNodalConnectivity()->begin()),*cidescPtr(mesh2DDesc->getNodalConnectivityIndex()->begin()); // std::vector allEdges; - std::vector< MEDCouplingAutoRefCountObjectPtr > allEdgesPtr; // for each sub edge in splitMesh2D the uncut Edge object of the original mesh2D + std::vector< MCAuto > allEdgesPtr; // for each sub edge in splitMesh2D the uncut Edge object of the original mesh2D for(const int *it(descBg);it!=descEnd;it++) // for all edges in the descending connectivity of the 2D mesh in relative Fortran mode { int edgeId(std::abs(*it)-1); - std::map< MEDCouplingAutoRefCountObjectPtr,int> m; - MEDCouplingAutoRefCountObjectPtr ee(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)cdescPtr[cidescPtr[edgeId]],cdescPtr+cidescPtr[edgeId]+1,mesh2DDesc->getCoords()->begin(),m)); + std::map< MCAuto,int> m; + MCAuto ee(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)cdescPtr[cidescPtr[edgeId]],cdescPtr+cidescPtr[edgeId]+1,mesh2DDesc->getCoords()->begin(),m)); const std::vector& edge1(intersectEdge1[edgeId]); if(*it>0) allEdges.insert(allEdges.end(),edge1.begin(),edge1.end()); @@ -9751,14 +9751,14 @@ int FindRightCandidateAmong(const MEDCouplingUMesh *mesh2DSplit, const int *cand if(std::distance(candidatesIn2DBg,candidatesIn2DEnd)==1) return *candidatesIn2DBg; int edgeId(std::abs(cellIdInMesh1DSplitRelative)-1); - MEDCouplingAutoRefCountObjectPtr cur1D(static_cast(mesh1DSplit->buildPartOfMySelf(&edgeId,&edgeId+1,true))); + MCAuto cur1D(static_cast(mesh1DSplit->buildPartOfMySelf(&edgeId,&edgeId+1,true))); if(cellIdInMesh1DSplitRelative<0) cur1D->changeOrientationOfCells(); const int *c1D(cur1D->getNodalConnectivity()->begin()); const INTERP_KERNEL::CellModel& ref1DType(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)c1D[0])); for(const int *it=candidatesIn2DBg;it!=candidatesIn2DEnd;it++) { - MEDCouplingAutoRefCountObjectPtr cur2D(static_cast(mesh2DSplit->buildPartOfMySelf(it,it+1,true))); + MCAuto cur2D(static_cast(mesh2DSplit->buildPartOfMySelf(it,it+1,true))); const int *c(cur2D->getNodalConnectivity()->begin()),*ci(cur2D->getNodalConnectivityIndex()->begin()); const INTERP_KERNEL::CellModel &cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)c[ci[0]])); unsigned sz(cm.getNumberOfSons2(c+ci[0]+1,ci[1]-ci[0]-1)); @@ -9815,8 +9815,8 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, // // Build desc connectivity DataArrayInt *desc1(DataArrayInt::New()),*descIndx1(DataArrayInt::New()),*revDesc1(DataArrayInt::New()),*revDescIndx1(DataArrayInt::New()); - MEDCouplingAutoRefCountObjectPtr dd1(desc1),dd2(descIndx1),dd3(revDesc1),dd4(revDescIndx1); - MEDCouplingAutoRefCountObjectPtr m1Desc(mesh2D->buildDescendingConnectivity2(desc1,descIndx1,revDesc1,revDescIndx1)); + MCAuto dd1(desc1),dd2(descIndx1),dd3(revDesc1),dd4(revDescIndx1); + MCAuto m1Desc(mesh2D->buildDescendingConnectivity2(desc1,descIndx1,revDesc1,revDescIndx1)); std::map mergedNodes; Intersect1DMeshes(m1Desc,mesh1D,eps,intersectEdge1,colinear2,subDiv2,addCoo,mergedNodes); // use mergeNodes to fix intersectEdge1 @@ -9833,47 +9833,47 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, (*it0)[2*n-1]=(*it1).second; } // - MEDCouplingAutoRefCountObjectPtr addCooDa(DataArrayDouble::New()); + MCAuto addCooDa(DataArrayDouble::New()); addCooDa->useArray(&addCoo[0],false,C_DEALLOC,(int)addCoo.size()/2,2); // Step 2: re-order newly created nodes according to the ordering found in m2 std::vector< std::vector > intersectEdge2; BuildIntersectEdges(m1Desc,mesh1D,addCoo,subDiv2,intersectEdge2); subDiv2.clear(); // Step 3: compute splitMesh1D - MEDCouplingAutoRefCountObjectPtr idsInRet1Colinear,idsInDescMesh2DForIdsInRetColinear; - MEDCouplingAutoRefCountObjectPtr ret2(DataArrayInt::New()); ret2->alloc(0,1); - MEDCouplingAutoRefCountObjectPtr ret1(BuildMesh1DCutFrom(mesh1D,intersectEdge2,mesh2D->getCoords(),addCoo,mergedNodes,colinear2,intersectEdge1, + MCAuto idsInRet1Colinear,idsInDescMesh2DForIdsInRetColinear; + MCAuto ret2(DataArrayInt::New()); ret2->alloc(0,1); + MCAuto ret1(BuildMesh1DCutFrom(mesh1D,intersectEdge2,mesh2D->getCoords(),addCoo,mergedNodes,colinear2,intersectEdge1, idsInRet1Colinear,idsInDescMesh2DForIdsInRetColinear)); - MEDCouplingAutoRefCountObjectPtr ret3(DataArrayInt::New()); ret3->alloc(ret1->getNumberOfCells()*2,1); ret3->fillWithValue(std::numeric_limits::max()); ret3->rearrange(2); - MEDCouplingAutoRefCountObjectPtr idsInRet1NotColinear(idsInRet1Colinear->buildComplement(ret1->getNumberOfCells())); + MCAuto ret3(DataArrayInt::New()); ret3->alloc(ret1->getNumberOfCells()*2,1); ret3->fillWithValue(std::numeric_limits::max()); ret3->rearrange(2); + MCAuto idsInRet1NotColinear(idsInRet1Colinear->buildComplement(ret1->getNumberOfCells())); // deal with cells in mesh2D that are not cut but only some of their edges are - MEDCouplingAutoRefCountObjectPtr idsInDesc2DToBeRefined(idsInDescMesh2DForIdsInRetColinear->deepCpy()); + MCAuto idsInDesc2DToBeRefined(idsInDescMesh2DForIdsInRetColinear->deepCopy()); idsInDesc2DToBeRefined->abs(); idsInDesc2DToBeRefined->applyLin(1,-1); idsInDesc2DToBeRefined=idsInDesc2DToBeRefined->buildUnique(); - MEDCouplingAutoRefCountObjectPtr out0s;//ids in mesh2D that are impacted by the fact that some edges of \a mesh1D are part of the edges of those cells + MCAuto out0s;//ids in mesh2D that are impacted by the fact that some edges of \a mesh1D are part of the edges of those cells if(!idsInDesc2DToBeRefined->empty()) { DataArrayInt *out0(0),*outi0(0); MEDCouplingUMesh::ExtractFromIndexedArrays(idsInDesc2DToBeRefined->begin(),idsInDesc2DToBeRefined->end(),dd3,dd4,out0,outi0); - MEDCouplingAutoRefCountObjectPtr outi0s(outi0); + MCAuto outi0s(outi0); out0s=out0; out0s=out0s->buildUnique(); out0s->sort(true); } // - MEDCouplingAutoRefCountObjectPtr ret1NonCol(static_cast(ret1->buildPartOfMySelf(idsInRet1NotColinear->begin(),idsInRet1NotColinear->end()))); - MEDCouplingAutoRefCountObjectPtr baryRet1(ret1NonCol->getBarycenterAndOwner()); - MEDCouplingAutoRefCountObjectPtr elts,eltsIndex; + MCAuto ret1NonCol(static_cast(ret1->buildPartOfMySelf(idsInRet1NotColinear->begin(),idsInRet1NotColinear->end()))); + MCAuto baryRet1(ret1NonCol->computeCellCenterOfMass()); + MCAuto elts,eltsIndex; mesh2D->getCellsContainingPoints(baryRet1->begin(),baryRet1->getNumberOfTuples(),eps,elts,eltsIndex); - MEDCouplingAutoRefCountObjectPtr eltsIndex2(eltsIndex->deltaShiftIndex()); - MEDCouplingAutoRefCountObjectPtr eltsIndex3(eltsIndex2->getIdsEqual(1)); + MCAuto eltsIndex2(eltsIndex->deltaShiftIndex()); + MCAuto eltsIndex3(eltsIndex2->findIdsEqual(1)); if(eltsIndex2->count(0)+eltsIndex3->getNumberOfTuples()!=ret1NonCol->getNumberOfCells()) throw INTERP_KERNEL::Exception("Intersect2DMeshWith1DLine : internal error 1 !"); - MEDCouplingAutoRefCountObjectPtr cellsToBeModified(elts->buildUnique()); - MEDCouplingAutoRefCountObjectPtr untouchedCells(cellsToBeModified->buildComplement(mesh2D->getNumberOfCells())); + MCAuto cellsToBeModified(elts->buildUnique()); + MCAuto untouchedCells(cellsToBeModified->buildComplement(mesh2D->getNumberOfCells())); if((DataArrayInt *)out0s) untouchedCells=untouchedCells->buildSubstraction(out0s);//if some edges in ret1 are colinear to descending mesh of mesh2D remove cells from untouched one - std::vector< MEDCouplingAutoRefCountObjectPtr > outMesh2DSplit; + std::vector< MCAuto > outMesh2DSplit; // OK all is ready to insert in ret2 mesh if(!untouchedCells->empty()) {// the most easy part, cells in mesh2D not impacted at all @@ -9883,7 +9883,7 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, } if((DataArrayInt *)out0s) {// here dealing with cells in out0s but not in cellsToBeModified - MEDCouplingAutoRefCountObjectPtr fewModifiedCells(out0s->buildSubstraction(cellsToBeModified)); + MCAuto fewModifiedCells(out0s->buildSubstraction(cellsToBeModified)); const int *rdptr(dd3->begin()),*rdiptr(dd4->begin()),*dptr(dd1->begin()),*diptr(dd2->begin()); for(const int *it=fewModifiedCells->begin();it!=fewModifiedCells->end();it++) { @@ -9892,7 +9892,7 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, } int offset(ret2->getNumberOfTuples()); ret2->pushBackValsSilent(fewModifiedCells->begin(),fewModifiedCells->end()); - MEDCouplingAutoRefCountObjectPtr partOfRet3(DataArrayInt::New()); partOfRet3->alloc(2*idsInRet1Colinear->getNumberOfTuples(),1); + MCAuto partOfRet3(DataArrayInt::New()); partOfRet3->alloc(2*idsInRet1Colinear->getNumberOfTuples(),1); partOfRet3->fillWithValue(std::numeric_limits::max()); partOfRet3->rearrange(2); int kk(0),*ret3ptr(partOfRet3->getPointer()); for(const int *it=idsInDescMesh2DForIdsInRetColinear->begin();it!=idsInDescMesh2DForIdsInRetColinear->end();it++,kk++) @@ -9900,7 +9900,7 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, int faceId(std::abs(*it)-1); for(const int *it2=rdptr+rdiptr[faceId];it2!=rdptr+rdiptr[faceId+1];it2++) { - int tmp(fewModifiedCells->locateValue(*it2)); + int tmp(fewModifiedCells->findIdFirstEqual(*it2)); if(tmp!=-1) { if(std::find(dptr+diptr[*it2],dptr+diptr[*it2+1],-(*it))!=dptr+diptr[*it2+1]) @@ -9923,19 +9923,19 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, if(!outMesh2DSplit.empty()) { DataArrayDouble *da(outMesh2DSplit.back()->getCoords()); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator itt=outMesh2DSplit.begin();itt!=outMesh2DSplit.end();itt++) + for(std::vector< MCAuto >::iterator itt=outMesh2DSplit.begin();itt!=outMesh2DSplit.end();itt++) (*itt)->setCoords(da); } } cellsToBeModified=cellsToBeModified->buildUniqueNotSorted(); for(const int *it=cellsToBeModified->begin();it!=cellsToBeModified->end();it++) { - MEDCouplingAutoRefCountObjectPtr idsNonColPerCell(elts->getIdsEqual(*it)); + MCAuto idsNonColPerCell(elts->findIdsEqual(*it)); idsNonColPerCell->transformWithIndArr(eltsIndex3->begin(),eltsIndex3->end()); - MEDCouplingAutoRefCountObjectPtr idsNonColPerCell2(idsInRet1NotColinear->selectByTupleId(idsNonColPerCell->begin(),idsNonColPerCell->end())); - MEDCouplingAutoRefCountObjectPtr partOfMesh1CuttingCur2DCell(static_cast(ret1NonCol->buildPartOfMySelf(idsNonColPerCell->begin(),idsNonColPerCell->end()))); - MEDCouplingAutoRefCountObjectPtr partOfRet3; - MEDCouplingAutoRefCountObjectPtr splitOfOneCell(BuildMesh2DCutFrom(eps,*it,m1Desc,partOfMesh1CuttingCur2DCell,dd1->begin()+dd2->getIJ(*it,0),dd1->begin()+dd2->getIJ((*it)+1,0),intersectEdge1,ret2->getNumberOfTuples(),partOfRet3)); + MCAuto idsNonColPerCell2(idsInRet1NotColinear->selectByTupleId(idsNonColPerCell->begin(),idsNonColPerCell->end())); + MCAuto partOfMesh1CuttingCur2DCell(static_cast(ret1NonCol->buildPartOfMySelf(idsNonColPerCell->begin(),idsNonColPerCell->end()))); + MCAuto partOfRet3; + MCAuto splitOfOneCell(BuildMesh2DCutFrom(eps,*it,m1Desc,partOfMesh1CuttingCur2DCell,dd1->begin()+dd2->getIJ(*it,0),dd1->begin()+dd2->getIJ((*it)+1,0),intersectEdge1,ret2->getNumberOfTuples(),partOfRet3)); ret3->setPartOfValues3(partOfRet3,idsNonColPerCell2->begin(),idsNonColPerCell2->end(),0,2,1,true); outMesh2DSplit.push_back(splitOfOneCell); for(int i=0;igetNumberOfCells();i++) @@ -9948,14 +9948,14 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, tmp[i]=outMesh2DSplit[i]; // ret1->getCoords()->setInfoOnComponents(compNames); - MEDCouplingAutoRefCountObjectPtr ret2D(MEDCouplingUMesh::MergeUMeshesOnSameCoords(tmp)); + MCAuto ret2D(MEDCouplingUMesh::MergeUMeshesOnSameCoords(tmp)); // To finish - filter ret3 - std::numeric_limits::max() -> -1 - negate values must be resolved. ret3->rearrange(1); - MEDCouplingAutoRefCountObjectPtr edgesToDealWith(ret3->getIdsStrictlyNegative()); + MCAuto edgesToDealWith(ret3->findIdsStricltyNegative()); for(const int *it=edgesToDealWith->begin();it!=edgesToDealWith->end();it++) { int old2DCellId(-ret3->getIJ(*it,0)-1); - MEDCouplingAutoRefCountObjectPtr candidates(ret2->getIdsEqual(old2DCellId)); + MCAuto candidates(ret2->findIdsEqual(old2DCellId)); ret3->setIJ(*it,0,FindRightCandidateAmong(ret2D,candidates->begin(),candidates->end(),ret1,*it%2==0?-((*it)/2+1):(*it)/2+1,eps));// div by 2 because 2 components natively in ret3 } ret3->changeValue(std::numeric_limits::max(),-1); @@ -9989,7 +9989,7 @@ void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCo const int *conn2(m2->getNodalConnectivity()->getConstPointer()),*connI2(m2->getNodalConnectivityIndex()->getConstPointer()); int offset2(offset1+m2->getNumberOfNodes()); int offset3(offset2+((int)addCoords.size())/2); - MEDCouplingAutoRefCountObjectPtr bbox1Arr(m1->getBoundingBoxForBBTree()),bbox2Arr(m2->getBoundingBoxForBBTree()); + MCAuto bbox1Arr(m1->getBoundingBoxForBBTree()),bbox2Arr(m2->getBoundingBoxForBBTree()); const double *bbox1(bbox1Arr->begin()),*bbox2(bbox2Arr->begin()); // Here a BBTree on 2D-cells, not on segments: BBTree myTree(bbox2,0,0,m2->getNumberOfCells(),eps); @@ -10075,20 +10075,20 @@ DataArrayInt *MEDCouplingUMesh::orderConsecutiveCells1D() const throw INTERP_KERNEL::Exception("MEDCouplingUMesh::orderConsecutiveCells1D works on unstructured mesh with meshdim = 1 !"); // Check that this is a line (and not a more complex 1D mesh) - each point is used at most by 2 segments: - MEDCouplingAutoRefCountObjectPtr _d(DataArrayInt::New()),_dI(DataArrayInt::New()); - MEDCouplingAutoRefCountObjectPtr _rD(DataArrayInt::New()),_rDI(DataArrayInt::New()); - MEDCouplingAutoRefCountObjectPtr m_points(buildDescendingConnectivity(_d, _dI, _rD, _rDI)); + MCAuto _d(DataArrayInt::New()),_dI(DataArrayInt::New()); + MCAuto _rD(DataArrayInt::New()),_rDI(DataArrayInt::New()); + MCAuto m_points(buildDescendingConnectivity(_d, _dI, _rD, _rDI)); const int *d(_d->getConstPointer()), *dI(_dI->getConstPointer()); const int *rD(_rD->getConstPointer()), *rDI(_rDI->getConstPointer()); - MEDCouplingAutoRefCountObjectPtr _dsi(_rDI->deltaShiftIndex()); + MCAuto _dsi(_rDI->deltaShiftIndex()); const int * dsi(_dsi->getConstPointer()); - MEDCouplingAutoRefCountObjectPtr dsii = _dsi->getIdsNotInRange(0,3); + MCAuto dsii = _dsi->findIdsNotInRange(0,3); m_points=0; if (dsii->getNumberOfTuples()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::orderConsecutiveCells1D only work with a mesh being a (piecewise) connected line!"); int nc(getNumberOfCells()); - MEDCouplingAutoRefCountObjectPtr result(DataArrayInt::New()); + MCAuto result(DataArrayInt::New()); result->alloc(nc,1); // set of edges not used so far @@ -10142,10 +10142,10 @@ DataArrayInt *MEDCouplingUMesh::orderConsecutiveCells1D() const /// @cond INTERNAL -void IKGeo2DInternalMapper2(INTERP_KERNEL::Node *n, const std::map,int>& m, int forbVal0, int forbVal1, std::vector& isect) +void IKGeo2DInternalMapper2(INTERP_KERNEL::Node *n, const std::map,int>& m, int forbVal0, int forbVal1, std::vector& isect) { - MEDCouplingAutoRefCountObjectPtr nTmp(n); nTmp->incrRef(); - std::map,int>::const_iterator it(m.find(nTmp)); + MCAuto nTmp(n); nTmp->incrRef(); + std::map,int>::const_iterator it(m.find(nTmp)); if(it==m.end()) throw INTERP_KERNEL::Exception("Internal error in remapping !"); int v((*it).second); @@ -10155,7 +10155,7 @@ void IKGeo2DInternalMapper2(INTERP_KERNEL::Node *n, const std::map,int>& m, int forbVal0, int forbVal1, std::vector& isect) +bool IKGeo2DInternalMapper(const INTERP_KERNEL::ComposedEdge& c, const std::map,int>& m, int forbVal0, int forbVal1, std::vector& isect) { int sz(c.size()); if(sz<=1) @@ -10236,13 +10236,13 @@ int MEDCouplingUMesh::split2DCells(const DataArrayInt *desc, const DataArrayInt DataArrayInt *MEDCouplingUMesh::conformize2D(double eps) { static const int SPACEDIM=2; - checkCoherency(); + checkConsistencyLight(); if(getSpaceDimension()!=2 || getMeshDimension()!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::conformize2D : This method only works for meshes with spaceDim=2 and meshDim=2 !"); - MEDCouplingAutoRefCountObjectPtr desc1(DataArrayInt::New()),descIndx1(DataArrayInt::New()),revDesc1(DataArrayInt::New()),revDescIndx1(DataArrayInt::New()); - MEDCouplingAutoRefCountObjectPtr mDesc(buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1)); + MCAuto desc1(DataArrayInt::New()),descIndx1(DataArrayInt::New()),revDesc1(DataArrayInt::New()),revDescIndx1(DataArrayInt::New()); + MCAuto mDesc(buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1)); const int *c(mDesc->getNodalConnectivity()->getConstPointer()),*ci(mDesc->getNodalConnectivityIndex()->getConstPointer()),*rd(revDesc1->getConstPointer()),*rdi(revDescIndx1->getConstPointer()); - MEDCouplingAutoRefCountObjectPtr bboxArr(mDesc->getBoundingBoxForBBTree()); + MCAuto bboxArr(mDesc->getBoundingBoxForBBTree()); const double *bbox(bboxArr->begin()),*coords(getCoords()->begin()); int nCell(getNumberOfCells()),nDescCell(mDesc->getNumberOfCells()); std::vector< std::vector > intersectEdge(nDescCell),overlapEdge(nDescCell); @@ -10257,7 +10257,7 @@ DataArrayInt *MEDCouplingUMesh::conformize2D(double eps) for(std::vector::const_iterator it=candidates.begin();it!=candidates.end();it++) if(*it>i) { - std::map,int> m; + std::map,int> m; INTERP_KERNEL::Edge *e1(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)c[ci[i]],c+ci[i]+1,coords,m)), *e2(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)c[ci[*it]],c+ci[*it]+1,coords,m)); INTERP_KERNEL::MergePoints merge; @@ -10281,7 +10281,7 @@ DataArrayInt *MEDCouplingUMesh::conformize2D(double eps) int sz((int)isect.size()); if(sz>1) { - std::map,int> m; + std::map,int> m; INTERP_KERNEL::Edge *e(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)c[ci[i]],c+ci[i]+1,coords,m)); e->sortSubNodesAbs(coords,isect); e->decrRef(); @@ -10322,7 +10322,7 @@ DataArrayInt *MEDCouplingUMesh::conformize2D(double eps) } } } - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()),notRet(DataArrayInt::New()); ret->alloc(nbOf2DCellsToBeSplit,1); + MCAuto ret(DataArrayInt::New()),notRet(DataArrayInt::New()); ret->alloc(nbOf2DCellsToBeSplit,1); if(nbOf2DCellsToBeSplit==0) return ret.retn(); // @@ -10331,20 +10331,20 @@ DataArrayInt *MEDCouplingUMesh::conformize2D(double eps) if(cells2DToTreat[i]) *retPtr++=i; // - MEDCouplingAutoRefCountObjectPtr mSafe,nSafe,oSafe,pSafe,qSafe,rSafe; + MCAuto mSafe,nSafe,oSafe,pSafe,qSafe,rSafe; DataArrayInt *m(0),*n(0),*o(0),*p(0),*q(0),*r(0); MEDCouplingUMesh::ExtractFromIndexedArrays(ret->begin(),ret->end(),desc1,descIndx1,m,n); mSafe=m; nSafe=n; DataArrayInt::PutIntoToSkylineFrmt(intersectEdge,o,p); oSafe=o; pSafe=p; if(middleNeedsToBeUsed) { DataArrayInt::PutIntoToSkylineFrmt(middle,q,r); qSafe=q; rSafe=r; } - MEDCouplingAutoRefCountObjectPtr modif(static_cast(buildPartOfMySelf(ret->begin(),ret->end(),true))); + MCAuto modif(static_cast(buildPartOfMySelf(ret->begin(),ret->end(),true))); int nbOfNodesCreated(modif->split2DCells(mSafe,nSafe,oSafe,pSafe,qSafe,rSafe)); setCoords(modif->getCoords());//if nbOfNodesCreated==0 modif and this have the same coordinates pointer so this line has no effect. But for quadratic cases this line is important. setPartOfMySelf(ret->begin(),ret->end(),*modif); { bool areNodesMerged; int newNbOfNodes; if(nbOfNodesCreated!=0) - MEDCouplingAutoRefCountObjectPtr tmp(mergeNodes(eps,areNodesMerged,newNbOfNodes)); + MCAuto tmp(mergeNodes(eps,areNodesMerged,newNbOfNodes)); } return ret.retn(); } @@ -10372,16 +10372,16 @@ DataArrayInt *MEDCouplingUMesh::conformize2D(double eps) */ DataArrayInt *MEDCouplingUMesh::colinearize2D(double eps) { - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); ret->alloc(0,1); - checkCoherency(); + MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); + checkConsistencyLight(); if(getSpaceDimension()!=2 || getMeshDimension()!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::colinearize2D : This method only works for meshes with spaceDim=2 and meshDim=2 !"); INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=eps; INTERP_KERNEL::QUADRATIC_PLANAR::_precision=eps; int nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes()); const int *cptr(_nodal_connec->begin()),*ciptr(_nodal_connec_index->begin()); - MEDCouplingAutoRefCountObjectPtr newc(DataArrayInt::New()),newci(DataArrayInt::New()); newci->alloc(nbOfCells+1,1); newc->alloc(0,1); newci->setIJ(0,0,0); - MEDCouplingAutoRefCountObjectPtr appendedCoords(DataArrayDouble::New()); appendedCoords->alloc(0,1);//1 not 2 it is not a bug. + MCAuto newc(DataArrayInt::New()),newci(DataArrayInt::New()); newci->alloc(nbOfCells+1,1); newc->alloc(0,1); newci->setIJ(0,0,0); + MCAuto appendedCoords(DataArrayDouble::New()); appendedCoords->alloc(0,1);//1 not 2 it is not a bug. const double *coords(_coords->begin()); int *newciptr(newci->getPointer()); for(int i=0;iempty()) { appendedCoords->rearrange(2); - MEDCouplingAutoRefCountObjectPtr newCoords(DataArrayDouble::Aggregate(getCoords(),appendedCoords));//treat info on components + MCAuto newCoords(DataArrayDouble::Aggregate(getCoords(),appendedCoords));//treat info on components //non const part setCoords(newCoords); } @@ -10422,7 +10422,7 @@ void MEDCouplingUMesh::Intersect1DMeshes(const MEDCouplingUMesh *m1Desc, const M INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=eps; const int *c1(m1Desc->getNodalConnectivity()->getConstPointer()),*ci1(m1Desc->getNodalConnectivityIndex()->getConstPointer()); // Build BB tree of all edges in the tool mesh (second mesh) - MEDCouplingAutoRefCountObjectPtr bbox1Arr(m1Desc->getBoundingBoxForBBTree()),bbox2Arr(m2Desc->getBoundingBoxForBBTree()); + MCAuto bbox1Arr(m1Desc->getBoundingBoxForBBTree()),bbox2Arr(m2Desc->getBoundingBoxForBBTree()); const double *bbox1(bbox1Arr->begin()),*bbox2(bbox2Arr->begin()); int nDescCell1(m1Desc->getNumberOfCells()),nDescCell2(m2Desc->getNumberOfCells()); intersectEdge1.resize(nDescCell1); @@ -10449,7 +10449,7 @@ void MEDCouplingUMesh::Intersect1DMeshes(const MEDCouplingUMesh *m1Desc, const M std::set nodes; pol1->getAllNodes(nodes); pol2->getAllNodes(nodes); std::size_t szz(nodes.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr > nodesSafe(szz); + std::vector< MCAuto > nodesSafe(szz); std::set::const_iterator itt(nodes.begin()); for(std::size_t iii=0;iiiincrRef(); nodesSafe[iii]=*itt; } @@ -10483,11 +10483,11 @@ void MEDCouplingUMesh::IntersectDescending2DMeshes(const MEDCouplingUMesh *m1, c descIndx2=DataArrayInt::New(); revDesc2=DataArrayInt::New(); revDescIndx2=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr dd1(desc1),dd2(descIndx1),dd3(revDesc1),dd4(revDescIndx1); - MEDCouplingAutoRefCountObjectPtr dd5(desc2),dd6(descIndx2),dd7(revDesc2),dd8(revDescIndx2); + MCAuto dd1(desc1),dd2(descIndx1),dd3(revDesc1),dd4(revDescIndx1); + MCAuto dd5(desc2),dd6(descIndx2),dd7(revDesc2),dd8(revDescIndx2); m1Desc=m1->buildDescendingConnectivity2(desc1,descIndx1,revDesc1,revDescIndx1); m2Desc=m2->buildDescendingConnectivity2(desc2,descIndx2,revDesc2,revDescIndx2); - MEDCouplingAutoRefCountObjectPtr dd9(m1Desc),dd10(m2Desc); + MCAuto dd9(m1Desc),dd10(m2Desc); std::map notUsedMap; Intersect1DMeshes(m1Desc,m2Desc,eps,intersectEdge1,colinear2,subDiv2,addCoo,notUsedMap); m1Desc->incrRef(); desc1->incrRef(); descIndx1->incrRef(); revDesc1->incrRef(); revDescIndx1->incrRef(); @@ -10872,7 +10872,7 @@ bool MEDCouplingUMesh::RemoveIdsFromIndexedArrays(const int *idsToRemoveBg, cons * \param [in] arrIndxIn is the input index array allowing to walk into \b arrIn * \param [out] arrOut the resulting array * \param [out] arrIndexOut the index array of the resulting array \b arrOut - * \sa MEDCouplingUMesh::ExtractFromIndexedArrays2 + * \sa MEDCouplingUMesh::ExtractFromIndexedArraysSlice */ void MEDCouplingUMesh::ExtractFromIndexedArrays(const int *idsOfSelectBg, const int *idsOfSelectEnd, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, DataArrayInt* &arrOut, DataArrayInt* &arrIndexOut) @@ -10889,8 +10889,8 @@ void MEDCouplingUMesh::ExtractFromIndexedArrays(const int *idsOfSelectBg, const if(nbOfGrps<0) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : The format of \"arrIndxIn\" is invalid ! Its nb of tuples should be >=1 !"); int maxSizeOfArr=arrIn->getNumberOfTuples(); - MEDCouplingAutoRefCountObjectPtr arro=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr arrIo=DataArrayInt::New(); + MCAuto arro=DataArrayInt::New(); + MCAuto arrIo=DataArrayInt::New(); arrIo->alloc((int)(sz+1),1); const int *idsIt=idsOfSelectBg; int *work=arrIo->getPointer(); @@ -10948,23 +10948,23 @@ void MEDCouplingUMesh::ExtractFromIndexedArrays(const int *idsOfSelectBg, const * \param [out] arrIndexOut the index array of the resulting array \b arrOut * \sa MEDCouplingUMesh::ExtractFromIndexedArrays */ -void MEDCouplingUMesh::ExtractFromIndexedArrays2(int idsOfSelectStart, int idsOfSelectStop, int idsOfSelectStep, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, +void MEDCouplingUMesh::ExtractFromIndexedArraysSlice(int idsOfSelectStart, int idsOfSelectStop, int idsOfSelectStep, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, DataArrayInt* &arrOut, DataArrayInt* &arrIndexOut) { if(!arrIn || !arrIndxIn) - throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays2 : input pointer is NULL !"); + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArraysSlice : input pointer is NULL !"); arrIn->checkAllocated(); arrIndxIn->checkAllocated(); if(arrIn->getNumberOfComponents()!=1 || arrIndxIn->getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays2 : input arrays must have exactly one component !"); - int sz=DataArrayInt::GetNumberOfItemGivenBESRelative(idsOfSelectStart,idsOfSelectStop,idsOfSelectStep,"MEDCouplingUMesh::ExtractFromIndexedArrays2 : Input slice "); + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArraysSlice : input arrays must have exactly one component !"); + int sz=DataArrayInt::GetNumberOfItemGivenBESRelative(idsOfSelectStart,idsOfSelectStop,idsOfSelectStep,"MEDCouplingUMesh::ExtractFromIndexedArraysSlice : Input slice "); const int *arrInPtr=arrIn->getConstPointer(); const int *arrIndxPtr=arrIndxIn->getConstPointer(); int nbOfGrps=arrIndxIn->getNumberOfTuples()-1; if(nbOfGrps<0) - throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays2 : The format of \"arrIndxIn\" is invalid ! Its nb of tuples should be >=1 !"); + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArraysSlice : The format of \"arrIndxIn\" is invalid ! Its nb of tuples should be >=1 !"); int maxSizeOfArr=arrIn->getNumberOfTuples(); - MEDCouplingAutoRefCountObjectPtr arro=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr arrIo=DataArrayInt::New(); + MCAuto arro=DataArrayInt::New(); + MCAuto arrIo=DataArrayInt::New(); arrIo->alloc((int)(sz+1),1); int idsIt=idsOfSelectStart; int *work=arrIo->getPointer(); @@ -10976,14 +10976,14 @@ void MEDCouplingUMesh::ExtractFromIndexedArrays2(int idsOfSelectStart, int idsOf lgth+=arrIndxPtr[idsIt+1]-arrIndxPtr[idsIt]; else { - std::ostringstream oss; oss << "MEDCouplingUMesh::ExtractFromIndexedArrays2 : id located on pos #" << i << " value is " << idsIt << " ! Must be in [0," << nbOfGrps << ") !"; + std::ostringstream oss; oss << "MEDCouplingUMesh::ExtractFromIndexedArraysSlice : id located on pos #" << i << " value is " << idsIt << " ! Must be in [0," << nbOfGrps << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } if(lgth>=work[-1]) *work=lgth; else { - std::ostringstream oss; oss << "MEDCouplingUMesh::ExtractFromIndexedArrays2 : id located on pos #" << i << " value is " << idsIt << " and at this pos arrIndxIn[" << idsIt; + std::ostringstream oss; oss << "MEDCouplingUMesh::ExtractFromIndexedArraysSlice : id located on pos #" << i << " value is " << idsIt << " and at this pos arrIndxIn[" << idsIt; oss << "+1]-arrIndxIn[" << idsIt << "] < 0 ! The input index array is bugged !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } @@ -10997,7 +10997,7 @@ void MEDCouplingUMesh::ExtractFromIndexedArrays2(int idsOfSelectStart, int idsOf work=std::copy(arrInPtr+arrIndxPtr[idsIt],arrInPtr+arrIndxPtr[idsIt+1],work); else { - std::ostringstream oss; oss << "MEDCouplingUMesh::ExtractFromIndexedArrays2 : id located on pos #" << i << " value is " << idsIt << " arrIndx[" << idsIt << "] must be >= 0 and arrIndx["; + std::ostringstream oss; oss << "MEDCouplingUMesh::ExtractFromIndexedArraysSlice : id located on pos #" << i << " value is " << idsIt << " arrIndx[" << idsIt << "] must be >= 0 and arrIndx["; oss << idsIt << "+1] <= " << maxSizeOfArr << " (the size of arrIn)!"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } @@ -11029,8 +11029,8 @@ void MEDCouplingUMesh::SetPartOfIndexedArrays(const int *idsOfSelectBg, const in { if(arrIn==0 || arrIndxIn==0 || srcArr==0 || srcArrIndex==0) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : presence of null pointer in input parameter !"); - MEDCouplingAutoRefCountObjectPtr arro=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr arrIo=DataArrayInt::New(); + MCAuto arro=DataArrayInt::New(); + MCAuto arrIo=DataArrayInt::New(); int nbOfTuples=arrIndxIn->getNumberOfTuples()-1; std::vector v(nbOfTuples,true); int offset=0; @@ -11202,7 +11202,7 @@ DataArrayInt *MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeedAlg(std::vecto } int lgth=(int)std::count(fetched2.begin(),fetched2.end(),true); i=0; - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); ret->alloc(lgth,1); + MCAuto ret=DataArrayInt::New(); ret->alloc(lgth,1); int *retPtr=ret->getPointer(); for(std::vector::const_iterator it=fetched2.begin();it!=fetched2.end();it++,i++) if(*it) @@ -11228,19 +11228,19 @@ DataArrayInt *MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeedAlg(std::vecto * * \sa MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx MEDCouplingUMesh::SetPartOfIndexedArrays */ -void MEDCouplingUMesh::SetPartOfIndexedArrays2(int start, int end, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, +void MEDCouplingUMesh::SetPartOfIndexedArraysSlice(int start, int end, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex, DataArrayInt* &arrOut, DataArrayInt* &arrIndexOut) { if(arrIn==0 || arrIndxIn==0 || srcArr==0 || srcArrIndex==0) - throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays2 : presence of null pointer in input parameter !"); - MEDCouplingAutoRefCountObjectPtr arro=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr arrIo=DataArrayInt::New(); + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSlice : presence of null pointer in input parameter !"); + MCAuto arro=DataArrayInt::New(); + MCAuto arrIo=DataArrayInt::New(); int nbOfTuples=arrIndxIn->getNumberOfTuples()-1; int offset=0; const int *arrIndxInPtr=arrIndxIn->getConstPointer(); const int *srcArrIndexPtr=srcArrIndex->getConstPointer(); - int nbOfElemsToSet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::SetPartOfIndexedArrays2 : "); + int nbOfElemsToSet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::SetPartOfIndexedArraysSlice : "); int it=start; for(int i=0;igetNumberOfTuples()-1; const int *arrIndxInPtr=arrIndxIn->getConstPointer(); const int *srcArrIndexPtr=srcArrIndex->getConstPointer(); int *arrInOutPtr=arrInOut->getPointer(); const int *srcArrPtr=srcArr->getConstPointer(); - int nbOfElemsToSet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx2 : "); + int nbOfElemsToSet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::SetPartOfIndexedArraysSameIdxSlice : "); int it=start; for(int i=0;i partition=partitionBySpreadZone(); - std::vector< MEDCouplingAutoRefCountObjectPtr > partitionAuto; partitionAuto.reserve(partition.size()); - std::copy(partition.begin(),partition.end(),std::back_insert_iterator > >(partitionAuto)); - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingUMesh::New(getName(),mdim); + std::vector< MCAuto > partitionAuto; partitionAuto.reserve(partition.size()); + std::copy(partition.begin(),partition.end(),std::back_insert_iterator > >(partitionAuto)); + MCAuto ret=MEDCouplingUMesh::New(getName(),mdim); ret->setCoords(getCoords()); ret->allocateCells((int)partition.size()); // for(std::vector::const_iterator it=partition.begin();it!=partition.end();it++) { - MEDCouplingAutoRefCountObjectPtr tmp=static_cast(buildPartOfMySelf((*it)->begin(),(*it)->end(),true)); - MEDCouplingAutoRefCountObjectPtr cell; + MCAuto tmp=static_cast(buildPartOfMySelf((*it)->begin(),(*it)->end(),true)); + MCAuto cell; switch(mdim) { case 2: @@ -11382,9 +11382,9 @@ std::vector MEDCouplingUMesh::partitionBySpreadZone() const return ret; DataArrayInt *neigh=0,*neighI=0; computeNeighborsOfCells(neigh,neighI); - MEDCouplingAutoRefCountObjectPtr neighAuto(neigh),neighIAuto(neighI); + MCAuto neighAuto(neigh),neighIAuto(neighI); std::vector fetchedCells(nbOfCellsCur,false); - std::vector< MEDCouplingAutoRefCountObjectPtr > ret2; + std::vector< MCAuto > ret2; int seed=0; while(seed MEDCouplingUMesh::partitionBySpreadZone() const ret2.push_back(ComputeSpreadZoneGraduallyFromSeedAlg(fetchedCells,&seed,&seed+1,neigh,neighI,-1,nbOfPeelPerformed)); seed=(int)std::distance(fetchedCells.begin(),std::find(fetchedCells.begin()+seed,fetchedCells.end(),false)); } - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=ret2.begin();it!=ret2.end();it++) + for(std::vector< MCAuto >::iterator it=ret2.begin();it!=ret2.end();it++) ret.push_back((*it).retn()); return ret; } @@ -11407,7 +11407,7 @@ std::vector MEDCouplingUMesh::partitionBySpreadZone() const */ DataArrayInt *MEDCouplingUMesh::ComputeRangesFromTypeDistribution(const std::vector& code) { - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); std::size_t nb=code.size()/3; if(code.size()%3!=0) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ComputeRangesFromTypeDistribution : invalid input code !"); @@ -11452,11 +11452,11 @@ MEDCoupling1SGTUMesh *MEDCouplingUMesh::tetrahedrize(int policy, DataArrayInt *& if(getMeshDimension()!=3 || getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::tetrahedrize : only available for mesh with meshdim == 3 and spacedim == 3 !"); int nbOfCells(getNumberOfCells()),nbNodes(getNumberOfNodes()); - MEDCouplingAutoRefCountObjectPtr ret0(MEDCoupling1SGTUMesh::New(getName(),INTERP_KERNEL::NORM_TETRA4)); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); ret->alloc(nbOfCells,1); + MCAuto ret0(MEDCoupling1SGTUMesh::New(getName(),INTERP_KERNEL::NORM_TETRA4)); + MCAuto ret(DataArrayInt::New()); ret->alloc(nbOfCells,1); int *retPt(ret->getPointer()); - MEDCouplingAutoRefCountObjectPtr newConn(DataArrayInt::New()); newConn->alloc(0,1); - MEDCouplingAutoRefCountObjectPtr addPts(DataArrayDouble::New()); addPts->alloc(0,1); + MCAuto newConn(DataArrayInt::New()); newConn->alloc(0,1); + MCAuto addPts(DataArrayDouble::New()); addPts->alloc(0,1); const int *oldc(_nodal_connec->begin()); const int *oldci(_nodal_connec_index->begin()); const double *coords(_coords->begin()); @@ -11491,7 +11491,7 @@ MEDCoupling1SGTUMesh *MEDCouplingUMesh::tetrahedrize(int policy, DataArrayInt *& } ret0->setNodalConnectivity(newConn); // - ret->computeOffsets2(); + ret->computeOffsetsFull(); n2oCells=ret->buildExplicitArrOfSliceOnScaledArr(0,nbOfCells,1); return ret0.retn(); } @@ -11504,8 +11504,8 @@ MEDCoupling1SGTUMesh *MEDCouplingUMesh::tetrahedrize(int policy, DataArrayInt *& void MEDCouplingUMesh::split2DCellsLinear(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI) { checkConnectivityFullyDefined(); - int ncells(getNumberOfCells()),lgthToReach(getMeshLength()+subNodesInSeg->getNumberOfTuples()); - MEDCouplingAutoRefCountObjectPtr c(DataArrayInt::New()); c->alloc((std::size_t)lgthToReach); + int ncells(getNumberOfCells()),lgthToReach(getNodalConnectivityArrayLen()+subNodesInSeg->getNumberOfTuples()); + MCAuto c(DataArrayInt::New()); c->alloc((std::size_t)lgthToReach); const int *subPtr(subNodesInSeg->begin()),*subIPtr(subNodesInSegI->begin()),*descPtr(desc->begin()),*descIPtr(descI->begin()),*oldConn(getNodalConnectivity()->begin()); int *cPtr(c->getPointer()),*ciPtr(getNodalConnectivityIndex()->getPointer()); int prevPosOfCi(ciPtr[0]); @@ -11639,7 +11639,7 @@ bool MEDCouplingUMesh::Colinearize2DCell(const double *coords, const int *connBg for(;(nbOfTurn+nbOfHit),int> m; + std::map,int> m; INTERP_KERNEL::Edge *e(MEDCouplingUMeshBuildQPFromEdge2(typeOfSon,tmpConn,coords,m)); posEndElt = posBaseElt+1; @@ -11711,10 +11711,10 @@ bool MEDCouplingUMesh::Colinearize2DCell(const double *coords, const int *connBg */ int MEDCouplingUMesh::split2DCellsQuadratic(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI, const DataArrayInt *mid, const DataArrayInt *midI) { - checkCoherency(); - int ncells(getNumberOfCells()),lgthToReach(getMeshLength()+2*subNodesInSeg->getNumberOfTuples()),nodesCnt(getNumberOfNodes()); - MEDCouplingAutoRefCountObjectPtr c(DataArrayInt::New()); c->alloc((std::size_t)lgthToReach); - MEDCouplingAutoRefCountObjectPtr addCoo(DataArrayDouble::New()); addCoo->alloc(0,1); + checkConsistencyLight(); + int ncells(getNumberOfCells()),lgthToReach(getNodalConnectivityArrayLen()+2*subNodesInSeg->getNumberOfTuples()),nodesCnt(getNumberOfNodes()); + MCAuto c(DataArrayInt::New()); c->alloc((std::size_t)lgthToReach); + MCAuto addCoo(DataArrayDouble::New()); addCoo->alloc(0,1); const int *subPtr(subNodesInSeg->begin()),*subIPtr(subNodesInSegI->begin()),*descPtr(desc->begin()),*descIPtr(descI->begin()),*oldConn(getNodalConnectivity()->begin()); const int *midPtr(mid->begin()),*midIPtr(midI->begin()); const double *oldCoordsPtr(getCoords()->begin()); @@ -11740,7 +11740,7 @@ int MEDCouplingUMesh::split2DCellsQuadratic(const DataArrayInt *desc, const Data ns[0]=new INTERP_KERNEL::Node(oldCoordsPtr[2*oldConn[prevPosOfCi+1+j]],oldCoordsPtr[2*oldConn[prevPosOfCi+1+j]+1]); ns[1]=new INTERP_KERNEL::Node(oldCoordsPtr[2*oldConn[prevPosOfCi+1+(1+j)%sz]],oldCoordsPtr[2*oldConn[prevPosOfCi+1+(1+j)%sz]+1]); ns[2]=new INTERP_KERNEL::Node(oldCoordsPtr[2*oldConn[prevPosOfCi+1+sz+j]],oldCoordsPtr[2*oldConn[prevPosOfCi+1+sz+j]+1]); - MEDCouplingAutoRefCountObjectPtr e(INTERP_KERNEL::QuadraticPolygon::BuildArcCircleEdge(ns)); + MCAuto e(INTERP_KERNEL::QuadraticPolygon::BuildArcCircleEdge(ns)); for(int k=0;kdecrRef(); _nodal_connec=c.retn(); _types.clear(); _types.insert(INTERP_KERNEL::NORM_QPOLYG); addCoo->rearrange(2); - MEDCouplingAutoRefCountObjectPtr coo(DataArrayDouble::Aggregate(getCoords(),addCoo));//info are copied from getCoords() by using Aggregate + MCAuto coo(DataArrayDouble::Aggregate(getCoords(),addCoo));//info are copied from getCoords() by using Aggregate setCoords(coo); return addCoo->getNumberOfTuples(); } diff --git a/src/MEDCoupling/MEDCouplingUMesh.hxx b/src/MEDCoupling/MEDCouplingUMesh.hxx index b60a97777..7f21dbd18 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.hxx +++ b/src/MEDCoupling/MEDCouplingUMesh.hxx @@ -43,9 +43,9 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static MEDCouplingUMesh *New(); MEDCOUPLING_EXPORT static MEDCouplingUMesh *New(const std::string& meshName, int meshDim); // Copy methods - MEDCOUPLING_EXPORT MEDCouplingUMesh *deepCpy() const;; + MEDCOUPLING_EXPORT MEDCouplingUMesh *deepCopy() const;; MEDCOUPLING_EXPORT MEDCouplingUMesh *clone(bool recDeepCpy) const; - MEDCOUPLING_EXPORT MEDCouplingUMesh *deepCpyConnectivityOnly() const; + MEDCOUPLING_EXPORT MEDCouplingUMesh *deepCopyConnectivityOnly() const; MEDCOUPLING_EXPORT void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other); MEDCOUPLING_EXPORT void updateTime() const; @@ -55,8 +55,8 @@ namespace MEDCoupling MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const; MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const; MEDCOUPLING_EXPORT void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const; - MEDCOUPLING_EXPORT void checkCoherency() const; - MEDCOUPLING_EXPORT void checkCoherency1(double eps=1e-12) const; + MEDCOUPLING_EXPORT void checkConsistencyLight() const; + MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const; MEDCOUPLING_EXPORT void setMeshDimension(int meshDim); MEDCOUPLING_EXPORT void allocateCells(int nbOfCells=0); MEDCOUPLING_EXPORT void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, const int *nodalConnOfCell); @@ -83,7 +83,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT int getNumberOfNodesInCell(int cellId) const; MEDCOUPLING_EXPORT int getNumberOfCells() const; MEDCOUPLING_EXPORT int getMeshDimension() const; - MEDCOUPLING_EXPORT int getMeshLength() const; + MEDCOUPLING_EXPORT int getNodalConnectivityArrayLen() const; MEDCOUPLING_EXPORT void computeTypes(); //! size of returned tinyInfo must be always the same. MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; @@ -97,11 +97,11 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; //tools MEDCOUPLING_EXPORT static int AreCellsEqual(const int *conn, const int *connI, int cell1, int cell2, int compType); - MEDCOUPLING_EXPORT static int AreCellsEqual0(const int *conn, const int *connI, int cell1, int cell2); - MEDCOUPLING_EXPORT static int AreCellsEqual1(const int *conn, const int *connI, int cell1, int cell2); - MEDCOUPLING_EXPORT static int AreCellsEqual2(const int *conn, const int *connI, int cell1, int cell2); - MEDCOUPLING_EXPORT static int AreCellsEqual3(const int *conn, const int *connI, int cell1, int cell2); - MEDCOUPLING_EXPORT static int AreCellsEqual7(const int *conn, const int *connI, int cell1, int cell2); + MEDCOUPLING_EXPORT static int AreCellsEqualPolicy0(const int *conn, const int *connI, int cell1, int cell2); + MEDCOUPLING_EXPORT static int AreCellsEqualPolicy1(const int *conn, const int *connI, int cell1, int cell2); + MEDCOUPLING_EXPORT static int AreCellsEqualPolicy2(const int *conn, const int *connI, int cell1, int cell2); + MEDCOUPLING_EXPORT static int AreCellsEqualPolicy2NoType(const int *conn, const int *connI, int cell1, int cell2); + MEDCOUPLING_EXPORT static int AreCellsEqualPolicy7(const int *conn, const int *connI, int cell1, int cell2); MEDCOUPLING_EXPORT void convertToPolyTypes(const int *cellIdsToConvertBg, const int *cellIdsToConvertEnd); MEDCOUPLING_EXPORT void convertAllToPoly(); MEDCOUPLING_EXPORT void convertExtrudedPolyhedra(); @@ -118,7 +118,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayInt *zipCoordsTraducer(); MEDCOUPLING_EXPORT void findCommonCells(int compType, int startCellId, DataArrayInt *& commonCellsArr, DataArrayInt *& commonCellsIArr) const; MEDCOUPLING_EXPORT bool areCellsIncludedIn(const MEDCouplingUMesh *other, int compType, DataArrayInt *& arr) const; - MEDCOUPLING_EXPORT bool areCellsIncludedIn2(const MEDCouplingUMesh *other, DataArrayInt *& arr) const; + MEDCOUPLING_EXPORT bool areCellsIncludedInPolicy7(const MEDCouplingUMesh *other, DataArrayInt *& arr) const; MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const; MEDCOUPLING_EXPORT MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const; MEDCOUPLING_EXPORT MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const; @@ -129,9 +129,9 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void computeNeighborsOfNodes(DataArrayInt *&neighbors, DataArrayInt *&neighborsIdx) const; MEDCOUPLING_EXPORT MEDCouplingUMesh *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const; MEDCOUPLING_EXPORT MEDCouplingUMesh *buildPartOfMySelf(const int *begin, const int *end, bool keepCoords=true) const; - MEDCOUPLING_EXPORT MEDCouplingUMesh *buildPartOfMySelf2(int start, int end, int step, bool keepCoords=true) const; + MEDCOUPLING_EXPORT MEDCouplingUMesh *buildPartOfMySelfSlice(int start, int end, int step, bool keepCoords=true) const; MEDCOUPLING_EXPORT void setPartOfMySelf(const int *cellIdsBg, const int *cellIdsEnd, const MEDCouplingUMesh& otherOnSameCoordsThanThis); - MEDCOUPLING_EXPORT void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis); + MEDCOUPLING_EXPORT void setPartOfMySelfSlice(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis); MEDCOUPLING_EXPORT MEDCouplingUMesh *buildFacePartOfMySelfNode(const int *begin, const int *end, bool fullyIn) const; MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const; MEDCOUPLING_EXPORT DataArrayInt *findBoundaryNodes() const; @@ -165,7 +165,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayDouble *distanceToPoints(const DataArrayDouble *pts, DataArrayInt *& cellIds) const; MEDCOUPLING_EXPORT int getCellContainingPoint(const double *pos, double eps) const; MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const; - MEDCOUPLING_EXPORT void getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, MEDCouplingAutoRefCountObjectPtr& elts, MEDCouplingAutoRefCountObjectPtr& eltsIndex) const; + MEDCOUPLING_EXPORT void getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const; MEDCOUPLING_EXPORT void checkButterflyCells(std::vector& cells, double eps=1e-12) const; MEDCOUPLING_EXPORT DataArrayInt *convexEnvelop2D(); MEDCOUPLING_EXPORT DataArrayInt *findAndCorrectBadOriented3DExtrudedCells(); @@ -222,7 +222,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT std::vector getQuadraticStatus() const; // MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const; - MEDCOUPLING_EXPORT DataArrayDouble *getBarycenterAndOwner() const; + MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const; MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const; MEDCOUPLING_EXPORT DataArrayDouble *getPartBarycenterAndOwner(const int *begin, const int *end) const; MEDCOUPLING_EXPORT DataArrayDouble *computePlaneEquationOf3DFaces() const; @@ -253,17 +253,17 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static bool RemoveIdsFromIndexedArrays(const int *idsToRemoveBg, const int *idsToRemoveEnd, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0); MEDCOUPLING_EXPORT static void ExtractFromIndexedArrays(const int *idsOfSelectBg, const int *idsOfSelectEnd, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, DataArrayInt* &arrOut, DataArrayInt* &arrIndexOut); - MEDCOUPLING_EXPORT static void ExtractFromIndexedArrays2(int idsOfSelectStart, int idsOfSelectStop, int idsOfSelectStep, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, + MEDCOUPLING_EXPORT static void ExtractFromIndexedArraysSlice(int idsOfSelectStart, int idsOfSelectStop, int idsOfSelectStep, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, DataArrayInt* &arrOut, DataArrayInt* &arrIndexOut); MEDCOUPLING_EXPORT static void SetPartOfIndexedArrays(const int *idsOfSelectBg, const int *idsOfSelectEnd, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex, DataArrayInt* &arrOut, DataArrayInt* &arrIndexOut); MEDCOUPLING_EXPORT static void SetPartOfIndexedArraysSameIdx(const int *idsOfSelectBg, const int *idsOfSelectEnd, DataArrayInt *arrInOut, const DataArrayInt *arrIndxIn, const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex); - MEDCOUPLING_EXPORT static void SetPartOfIndexedArrays2(int start, int end, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, + MEDCOUPLING_EXPORT static void SetPartOfIndexedArraysSlice(int start, int end, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex, DataArrayInt* &arrOut, DataArrayInt* &arrIndexOut); - MEDCOUPLING_EXPORT static void SetPartOfIndexedArraysSameIdx2(int start, int end, int step, DataArrayInt *arrInOut, const DataArrayInt *arrIndxIn, + MEDCOUPLING_EXPORT static void SetPartOfIndexedArraysSameIdxSlice(int start, int end, int step, DataArrayInt *arrInOut, const DataArrayInt *arrIndxIn, const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex); MEDCOUPLING_EXPORT static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn); MEDCOUPLING_EXPORT static DataArrayInt *ComputeSpreadZoneGraduallyFromSeed(const int *seedBg, const int *seedEnd, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling, int& nbOfDepthPeelingPerformed); @@ -297,7 +297,7 @@ namespace MEDCoupling DataArrayDouble *fillExtCoordsUsingTranslAndAutoRotation3D(const MEDCouplingUMesh *mesh1D, bool isQuad) const; static bool AreCellsEqualInPool(const std::vector& candidates, int compType, const int *conn, const int *connI, DataArrayInt *result) ; MEDCouplingUMesh *buildPartOfMySelfKeepCoords(const int *begin, const int *end) const; - MEDCouplingUMesh *buildPartOfMySelfKeepCoords2(int start, int end, int step) const; + MEDCouplingUMesh *buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const; DataArrayInt *convertLinearCellsToQuadratic1D0(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set& types) const; DataArrayInt *convertLinearCellsToQuadratic2DAnd3D0(const MEDCouplingUMesh *m1D, const DataArrayInt *desc, const DataArrayInt *descI, DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set& types) const; DataArrayInt *convertLinearCellsToQuadratic2D0(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set& types) const; @@ -308,7 +308,7 @@ namespace MEDCoupling DataArrayInt *buildUnionOf2DMeshQuadratic(const MEDCouplingUMesh *skin, const DataArrayInt *n2o) const; template void getCellsContainingPointsAlg(const double *coords, const double *pos, int nbOfPoints, - double eps, MEDCouplingAutoRefCountObjectPtr& elts, MEDCouplingAutoRefCountObjectPtr& eltsIndex) const; + double eps, MCAuto& elts, MCAuto& eltsIndex) const; /// @cond INTERNAL static MEDCouplingUMesh *MergeUMeshesLL(std::vector& a); typedef int (*DimM1DescNbrer)(int id, unsigned nb, const INTERP_KERNEL::CellModel& cm, bool compute, const int *conn1, const int *conn2); diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest0.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest0.cxx index 4036642b2..d8d829bab 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest0.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest0.cxx @@ -20,7 +20,7 @@ #include "MEDCouplingBasicsTest.hxx" #include "MEDCouplingUMesh.hxx" -#include "MEDCouplingExtrudedMesh.hxx" +#include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingMemArray.hxx" #include "MEDCouplingMultiFields.hxx" @@ -819,7 +819,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build2DTargetMesh_3() std::copy(coords,coords+22,myCoords->getPointer()); ret->setCoords(myCoords); myCoords->decrRef(); - ret->checkCoherency(); + ret->checkConsistencyLight(); return ret; } diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx index 662558686..bd99d6729 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx @@ -21,7 +21,7 @@ #include "MEDCouplingBasicsTest1.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingCMesh.hxx" -#include "MEDCouplingExtrudedMesh.hxx" +#include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingMemArray.hxx" @@ -170,7 +170,7 @@ void MEDCouplingBasicsTest1::testMesh() mesh->setCoords(myCoords); myCoords->decrRef(); CPPUNIT_ASSERT_EQUAL(nbOfCells,mesh->getNumberOfCells()); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); //test 1 - no copy ownership C++ myCoords=DataArrayDouble::New(); double *tmp=new double[3*nbOfNodes]; @@ -179,7 +179,7 @@ void MEDCouplingBasicsTest1::testMesh() mesh->setCoords(myCoords); myCoords->decrRef(); CPPUNIT_ASSERT_EQUAL(nbOfCells,mesh->getNumberOfCells()); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); //test 2 - no copy ownership C myCoords=DataArrayDouble::New(); tmp=(double *)malloc(3*nbOfNodes*sizeof(double)); @@ -188,7 +188,7 @@ void MEDCouplingBasicsTest1::testMesh() mesh->setCoords(myCoords); myCoords->decrRef(); CPPUNIT_ASSERT_EQUAL(nbOfNodes,mesh->getNumberOfNodes()); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); //test 3 - copy. myCoords=DataArrayDouble::New(); myCoords->alloc(nbOfNodes,3); @@ -202,12 +202,12 @@ void MEDCouplingBasicsTest1::testMesh() mesh->setCoords(myCoords); myCoords->decrRef(); CPPUNIT_ASSERT_EQUAL(nbOfNodes,mesh->getNumberOfNodes()); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); // test clone not recursively MEDCouplingUMesh *mesh2=mesh->clone(false); CPPUNIT_ASSERT(mesh2!=mesh); - mesh2->checkCoherency(); + mesh2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(nbOfCells,mesh2->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(nbOfNodes,mesh2->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(3,mesh2->getSpaceDimension()); @@ -222,7 +222,7 @@ void MEDCouplingBasicsTest1::testMesh() // test clone not recursively MEDCouplingUMesh *mesh3=mesh->clone(true); CPPUNIT_ASSERT(mesh3!=mesh); - mesh3->checkCoherency(); + mesh3->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(nbOfCells,mesh3->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(nbOfNodes,mesh3->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(3,mesh3->getSpaceDimension()); @@ -245,11 +245,11 @@ void MEDCouplingBasicsTest1::testMesh() std::fill(tmp,tmp+9*nbOfCells,7.); //content of field changed -> declare it. fieldOnCells->declareAsNew(); - fieldOnCells->checkCoherency(); + fieldOnCells->checkConsistencyLight(); // testing clone of fields - no recursive MEDCouplingFieldDouble *fieldOnCells2=fieldOnCells->clone(false); CPPUNIT_ASSERT(fieldOnCells2!=fieldOnCells); - fieldOnCells2->checkCoherency(); + fieldOnCells2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(nbOfCells,fieldOnCells2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(9,fieldOnCells2->getNumberOfComponents()); CPPUNIT_ASSERT(fieldOnCells2->getArray()==fieldOnCells->getArray()); @@ -258,7 +258,7 @@ void MEDCouplingBasicsTest1::testMesh() // testing clone of fields - recursive MEDCouplingFieldDouble *fieldOnCells3=fieldOnCells->clone(true); CPPUNIT_ASSERT(fieldOnCells3!=fieldOnCells); - fieldOnCells3->checkCoherency(); + fieldOnCells3->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(nbOfCells,fieldOnCells3->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(9,fieldOnCells3->getNumberOfComponents()); CPPUNIT_ASSERT(fieldOnCells3->getArray()!=fieldOnCells->getArray()); @@ -288,14 +288,14 @@ void MEDCouplingBasicsTest1::testMeshPointsCloud() targetMesh->insertNextCell(INTERP_KERNEL::NORM_POINT1,1,targetConn+6); targetMesh->insertNextCell(INTERP_KERNEL::NORM_POINT1,1,targetConn+7); targetMesh->finishInsertingCells(); - CPPUNIT_ASSERT_THROW(targetMesh->checkCoherency(),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(targetMesh->checkConsistencyLight(),INTERP_KERNEL::Exception); DataArrayDouble *myCoords=DataArrayDouble::New(); myCoords->alloc(9,3); std::copy(targetCoords,targetCoords+27,myCoords->getPointer()); targetMesh->setCoords(myCoords); myCoords->decrRef(); // - targetMesh->checkCoherency(); + targetMesh->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(3,targetMesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(8,targetMesh->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(9,targetMesh->getNumberOfNodes()); @@ -312,9 +312,9 @@ void MEDCouplingBasicsTest1::testMeshM1D() CPPUNIT_ASSERT_THROW(meshM1D->getNumberOfCells(),INTERP_KERNEL::Exception); CPPUNIT_ASSERT_THROW(meshM1D->setMeshDimension(-2),INTERP_KERNEL::Exception); CPPUNIT_ASSERT_THROW(meshM1D->setMeshDimension(-10),INTERP_KERNEL::Exception); - CPPUNIT_ASSERT_THROW(meshM1D->checkCoherency(),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(meshM1D->checkConsistencyLight(),INTERP_KERNEL::Exception); meshM1D->setMeshDimension(-1); - meshM1D->checkCoherency(); + meshM1D->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(-1,meshM1D->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(1,meshM1D->getNumberOfCells()); CPPUNIT_ASSERT_THROW(meshM1D->getNumberOfNodes(),INTERP_KERNEL::Exception); @@ -330,7 +330,7 @@ void MEDCouplingBasicsTest1::testMeshM1D() double *tmp=array->getPointer(); array->decrRef(); std::fill(tmp,tmp+6,7.); - fieldOnCells->checkCoherency(); + fieldOnCells->checkConsistencyLight(); // fieldOnCells->decrRef(); meshM1D->decrRef(); @@ -343,7 +343,7 @@ void MEDCouplingBasicsTest1::testDeepCopy() std::fill(array->getPointer(),array->getPointer()+5*3,7.); CPPUNIT_ASSERT_DOUBLES_EQUAL(7.,array->getIJ(3,2),1e-14); double *tmp1=array->getPointer(); - DataArrayDouble *array2=array->deepCpy(); + DataArrayDouble *array2=array->deepCopy(); double *tmp2=array2->getPointer(); CPPUNIT_ASSERT(tmp1!=tmp2); array->decrRef(); @@ -355,7 +355,7 @@ void MEDCouplingBasicsTest1::testDeepCopy() std::fill(array3->getPointer(),array3->getPointer()+5*3,17); CPPUNIT_ASSERT_EQUAL(17,array3->getIJ(3,2)); int *tmp3=array3->getPointer(); - DataArrayInt *array4=array3->deepCpy(); + DataArrayInt *array4=array3->deepCopy(); int *tmp4=array4->getPointer(); CPPUNIT_ASSERT(tmp3!=tmp4); array3->decrRef(); @@ -390,7 +390,7 @@ void MEDCouplingBasicsTest1::testConvertToPolyTypes() const int elts[2]={1,3}; std::vector eltsV(elts,elts+2); mesh->convertToPolyTypes(&eltsV[0],&eltsV[0]+eltsV.size()); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(5,mesh->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(23,mesh->getNodalConnectivity()->getNumberOfTuples()); const int *pt=mesh->getNodalConnectivity()->getConstPointer(); @@ -401,11 +401,11 @@ void MEDCouplingBasicsTest1::testConvertToPolyTypes() ////// 3D mesh=build3DTargetMesh_1(); mesh->convertToPolyTypes(&eltsV[0],&eltsV[0]+eltsV.size()); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(8,mesh->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(114,mesh->getNodalConnectivity()->getNumberOfTuples()); mesh->convertToPolyTypes(&eltsV[0],&eltsV[0]+eltsV.size()); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(8,mesh->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(114,mesh->getNodalConnectivity()->getNumberOfTuples()); // @@ -421,7 +421,7 @@ void MEDCouplingBasicsTest1::testDescConn2D() DataArrayInt *revDescIndx=DataArrayInt::New(); // MEDCouplingUMesh *mesh2=mesh->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); - mesh2->checkCoherency(); + mesh2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(1,mesh2->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(13,mesh2->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL((std::size_t)14,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(14,revDescIndx->getNumberOfTuples()); @@ -452,7 +452,7 @@ void MEDCouplingBasicsTest1::testDescConn2D() const int elts[2]={1,3}; std::vector eltsV(elts,elts+2); mesh->convertToPolyTypes(&eltsV[0],&eltsV[0]+eltsV.size()); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); // desc=DataArrayInt::New(); descIndx=DataArrayInt::New(); @@ -460,7 +460,7 @@ void MEDCouplingBasicsTest1::testDescConn2D() revDescIndx=DataArrayInt::New(); // mesh2=mesh->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); - mesh2->checkCoherency(); + mesh2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(1,mesh2->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(13,mesh2->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL((std::size_t)14,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(14,revDescIndx->getNumberOfTuples()); @@ -493,7 +493,7 @@ void MEDCouplingBasicsTest1::testDescConn3D() DataArrayInt *revDescIndx=DataArrayInt::New(); // MEDCouplingUMesh *mesh2=mesh->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); - mesh2->checkCoherency(); + mesh2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(2,mesh2->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(36,mesh2->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL((std::size_t)37,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(37,revDescIndx->getNumberOfTuples()); @@ -530,13 +530,13 @@ void MEDCouplingBasicsTest1::testDescConn3D() const int elts[2]={1,3}; std::vector eltsV(elts,elts+2); mesh->convertToPolyTypes(&eltsV[0],&eltsV[0]+eltsV.size()); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); desc=DataArrayInt::New(); descIndx=DataArrayInt::New(); revDesc=DataArrayInt::New(); revDescIndx=DataArrayInt::New(); mesh2=mesh->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); - mesh2->checkCoherency(); + mesh2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(2,mesh2->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(36,mesh2->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL((std::size_t)37,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(37,revDescIndx->getNumberOfTuples()); @@ -892,7 +892,7 @@ void MEDCouplingBasicsTest1::testEqualFieldDouble() CPPUNIT_ASSERT(fieldOnCells1->isEqual(fieldOnCells2,1e-12,1e-15)); CPPUNIT_ASSERT(fieldOnCells2->isEqual(fieldOnCells1,1e-12,1e-15)); // - DataArrayDouble *arr2=arr->deepCpy(); + DataArrayDouble *arr2=arr->deepCopy(); fieldOnCells2->setArray(arr2); arr2->decrRef(); CPPUNIT_ASSERT(fieldOnCells1->isEqual(fieldOnCells2,1e-12,1e-15)); @@ -928,14 +928,14 @@ void MEDCouplingBasicsTest1::testEqualFieldDouble() void MEDCouplingBasicsTest1::testNatureChecking() { MEDCouplingFieldDouble *field=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME); - field->setNature(Integral); - field->setNature(ConservativeVolumic); - field->setNature(IntegralGlobConstraint); + field->setNature(ExtensiveMaximum); + field->setNature(IntensiveMaximum); + field->setNature(ExtensiveConservation); field->decrRef(); field=MEDCouplingFieldDouble::New(ON_NODES,NO_TIME); - field->setNature(ConservativeVolumic); - CPPUNIT_ASSERT_THROW(field->setNature(Integral),INTERP_KERNEL::Exception); - CPPUNIT_ASSERT_THROW(field->setNature(IntegralGlobConstraint),INTERP_KERNEL::Exception); + field->setNature(IntensiveMaximum); + CPPUNIT_ASSERT_THROW(field->setNature(ExtensiveMaximum),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(field->setNature(ExtensiveConservation),INTERP_KERNEL::Exception); field->decrRef(); } @@ -982,7 +982,7 @@ void MEDCouplingBasicsTest1::testExtrudedMesh1() { MEDCouplingUMesh *mesh2D=0; MEDCouplingUMesh *mesh3D=build3DExtrudedUMesh_1(mesh2D); - MEDCouplingExtrudedMesh *ext=MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,1); + MEDCouplingMappedExtrudedMesh *ext=MEDCouplingMappedExtrudedMesh::New(mesh3D,mesh2D,1); CPPUNIT_ASSERT_EQUAL(18,ext->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(60,ext->getNumberOfNodes()); DataArrayInt *ids3D=ext->getMesh3DIds(); @@ -1024,7 +1024,7 @@ void MEDCouplingBasicsTest1::testExtrudedMesh2() mTT->findNodesOnPlane(pt,v,1e-12,n); CPPUNIT_ASSERT_EQUAL(43,(int)n.size()); MEDCouplingUMesh *mTT3dSurf=(MEDCouplingUMesh *)mTT->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true); - MEDCouplingExtrudedMesh *meTT=MEDCouplingExtrudedMesh::New(mTT,mTT3dSurf,0); + MEDCouplingMappedExtrudedMesh *meTT=MEDCouplingMappedExtrudedMesh::New(mTT,mTT3dSurf,0); CPPUNIT_ASSERT_EQUAL(200,meTT->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(10,meTT->getMesh2D()->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(20,meTT->getMesh1D()->getNumberOfCells()); @@ -1038,7 +1038,7 @@ void MEDCouplingBasicsTest1::testExtrudedMesh2() mN->findNodesOnPlane(pt,v,1e-12,n); CPPUNIT_ASSERT_EQUAL(30,(int)n.size()); MEDCouplingUMesh *mN3dSurf=(MEDCouplingUMesh *)mN->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true); - MEDCouplingExtrudedMesh *meN=MEDCouplingExtrudedMesh::New(mN,mN3dSurf,0); + MEDCouplingMappedExtrudedMesh *meN=MEDCouplingMappedExtrudedMesh::New(mN,mN3dSurf,0); CPPUNIT_ASSERT_EQUAL(40,meN->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(20,meN->getMesh2D()->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(2,meN->getMesh1D()->getNumberOfCells()); @@ -1052,7 +1052,7 @@ void MEDCouplingBasicsTest1::testExtrudedMesh2() mTF->findNodesOnPlane(pt,v,1e-12,n); CPPUNIT_ASSERT_EQUAL(27,(int)n.size()); MEDCouplingUMesh *mTF3dSurf=(MEDCouplingUMesh *)mTF->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true); - MEDCouplingExtrudedMesh *meTF=MEDCouplingExtrudedMesh::New(mTF,mTF3dSurf,0); + MEDCouplingMappedExtrudedMesh *meTF=MEDCouplingMappedExtrudedMesh::New(mTF,mTF3dSurf,0); CPPUNIT_ASSERT_EQUAL(340,meTF->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(17,meTF->getMesh2D()->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(20,meTF->getMesh1D()->getNumberOfCells()); @@ -1081,7 +1081,7 @@ void MEDCouplingBasicsTest1::testExtrudedMesh3() m2->rotate(center,vector,-M_PI/2.); MEDCouplingUMesh *m3=m1->buildExtrudedMesh(m2,0); // - MEDCouplingExtrudedMesh *m4=MEDCouplingExtrudedMesh::New(m3,m1,0); + MEDCouplingMappedExtrudedMesh *m4=MEDCouplingMappedExtrudedMesh::New(m3,m1,0); CPPUNIT_ASSERT_EQUAL(15,m4->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(5,m4->getMesh2D()->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(3,m4->getMesh1D()->getNumberOfCells()); @@ -1092,7 +1092,7 @@ void MEDCouplingBasicsTest1::testExtrudedMesh3() //some random in cells to check that extrusion alg find it correctly const int expected1[15]={1,3,2,0,6,5,7,10,11,8,12,9,14,13,4}; m3->renumberCells(expected1,false); - m4=MEDCouplingExtrudedMesh::New(m3,m1,0); + m4=MEDCouplingMappedExtrudedMesh::New(m3,m1,0); CPPUNIT_ASSERT_EQUAL(15,m4->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(5,m4->getMesh2D()->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(3,m4->getMesh1D()->getNumberOfCells()); @@ -1111,7 +1111,7 @@ void MEDCouplingBasicsTest1::testExtrudedMesh3() CPPUNIT_ASSERT_EQUAL((int)INTERP_KERNEL::NORM_POLYHED,(int)m3->getTypeOfCell(3)); CPPUNIT_ASSERT_EQUAL((int)INTERP_KERNEL::NORM_HEXA8,(int)m3->getTypeOfCell(4)); m3->renumberCells(expected1,false); - m4=MEDCouplingExtrudedMesh::New(m3,m1,0); + m4=MEDCouplingMappedExtrudedMesh::New(m3,m1,0); CPPUNIT_ASSERT_EQUAL(15,m4->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(5,m4->getMesh2D()->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(3,m4->getMesh1D()->getNumberOfCells()); @@ -1126,7 +1126,7 @@ void MEDCouplingBasicsTest1::testExtrudedMesh3() } /*! - * This test check MEDCouplingUMesh::buildExtrudedMesh method, but also, MEDCouplingExtrudedMesh following methods : + * This test check MEDCouplingUMesh::buildExtrudedMesh method, but also, MEDCouplingMappedExtrudedMesh following methods : * getCellContainingPoint getMeasureField getNodeIdsOfCell getCoordinateOfNode getTypeOfCell build3DUnstructuredMesh. */ void MEDCouplingBasicsTest1::testExtrudedMesh4() @@ -1145,7 +1145,7 @@ void MEDCouplingBasicsTest1::testExtrudedMesh4() const int expected1[15]= {1,3,2,0,6,5,7,10,11,8,12,9,14,13,4}; const int rexpected1[15]={3, 0, 2, 1, 14, 5, 4, 6, 9, 11, 7, 8, 10, 13, 12}; m3->renumberCells(expected1,false); - MEDCouplingExtrudedMesh *m4=MEDCouplingExtrudedMesh::New(m3,m1,0); + MEDCouplingMappedExtrudedMesh *m4=MEDCouplingMappedExtrudedMesh::New(m3,m1,0); CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_HEXA8,m4->getTypeOfCell(0)); CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_HEXA8,m4->getTypeOfCell(1)); CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_POLYHED,m4->getTypeOfCell(2)); @@ -1313,7 +1313,7 @@ void MEDCouplingBasicsTest1::testMergeMesh1() MEDCouplingMesh *m3=m1->mergeMyselfWith(m2); MEDCouplingUMesh *m3C=dynamic_cast(m3); CPPUNIT_ASSERT(m3C); - m3->checkCoherency(); + m3->checkConsistencyLight(); MEDCouplingUMesh *m4=build2DTargetMeshMerged_1(); CPPUNIT_ASSERT(m3->isEqual(m4,1.e-12)); m4->decrRef(); @@ -1343,7 +1343,7 @@ void MEDCouplingBasicsTest1::testMergeMeshOnSameCoords1() std::vector meshes; meshes.push_back(m1); meshes.push_back(m2); meshes.push_back(m3); MEDCouplingUMesh *m4=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes); - m4->checkCoherency(); + m4->checkConsistencyLight(); CPPUNIT_ASSERT(m4->getCoords()==m1->getCoords()); CPPUNIT_ASSERT_EQUAL(15,m4->getNumberOfCells()); const int cells1[5]={0,1,2,3,4}; @@ -1375,7 +1375,7 @@ void MEDCouplingBasicsTest1::testMergeField1() MEDCouplingFieldDouble *f1=m1->getMeasureField(true); MEDCouplingFieldDouble *f2=m2->getMeasureField(true); MEDCouplingFieldDouble *f3=MEDCouplingFieldDouble::MergeFields(f1,f2); - f3->checkCoherency(); + f3->checkConsistencyLight(); MEDCouplingUMesh *m4=build2DTargetMeshMerged_1(); CPPUNIT_ASSERT(f3->getMesh()->isEqual(m4,1.e-12)); std::string name=f3->getName(); @@ -1433,7 +1433,7 @@ void MEDCouplingBasicsTest1::testFillFromAnalytic() CPPUNIT_ASSERT_DOUBLES_EQUAL(3.4,f1->getTime(a,b),1.e-14); CPPUNIT_ASSERT_EQUAL(5,a); CPPUNIT_ASSERT_EQUAL(6,b); CPPUNIT_ASSERT_EQUAL(std::string(f1->getTimeUnit()),std::string("us")); - f1->checkCoherency(); + f1->checkConsistencyLight(); CPPUNIT_ASSERT(f1->getTypeOfField()==ON_CELLS); CPPUNIT_ASSERT(f1->getTimeDiscretization()==ONE_TIME); CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents()); @@ -1447,7 +1447,7 @@ void MEDCouplingBasicsTest1::testFillFromAnalytic() f1->decrRef(); // f1=m->fillFromAnalytic(ON_NODES,1,func1); - f1->checkCoherency(); + f1->checkConsistencyLight(); CPPUNIT_ASSERT(f1->getTypeOfField()==ON_NODES); CPPUNIT_ASSERT(f1->getTimeDiscretization()==ONE_TIME); CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents()); @@ -1461,7 +1461,7 @@ void MEDCouplingBasicsTest1::testFillFromAnalytic() f1->decrRef(); // f1=m->fillFromAnalytic(ON_NODES,2,func2); - f1->checkCoherency(); + f1->checkConsistencyLight(); CPPUNIT_ASSERT(f1->getTypeOfField()==ON_NODES); CPPUNIT_ASSERT(f1->getTimeDiscretization()==ONE_TIME); CPPUNIT_ASSERT_EQUAL(2,f1->getNumberOfComponents()); @@ -1490,7 +1490,7 @@ void MEDCouplingBasicsTest1::testFillFromAnalytic2() { MEDCouplingUMesh *m=build2DTargetMesh_1(); MEDCouplingFieldDouble *f1=m->fillFromAnalytic(ON_CELLS,1,"y+x"); - f1->checkCoherency(); + f1->checkConsistencyLight(); CPPUNIT_ASSERT(f1->getTypeOfField()==ON_CELLS); CPPUNIT_ASSERT(f1->getTimeDiscretization()==ONE_TIME); CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents()); @@ -1504,7 +1504,7 @@ void MEDCouplingBasicsTest1::testFillFromAnalytic2() f1->decrRef(); // f1=m->fillFromAnalytic(ON_NODES,1,"y+2*x"); - f1->checkCoherency(); + f1->checkConsistencyLight(); CPPUNIT_ASSERT(f1->getTypeOfField()==ON_NODES); CPPUNIT_ASSERT(f1->getTimeDiscretization()==ONE_TIME); CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents()); @@ -1517,7 +1517,7 @@ void MEDCouplingBasicsTest1::testFillFromAnalytic2() CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12); f1->decrRef(); f1=m->fillFromAnalytic(ON_NODES,1,"2.*x+y"); - f1->checkCoherency(); + f1->checkConsistencyLight(); CPPUNIT_ASSERT(f1->getTypeOfField()==ON_NODES); CPPUNIT_ASSERT(f1->getTimeDiscretization()==ONE_TIME); CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents()); @@ -1531,7 +1531,7 @@ void MEDCouplingBasicsTest1::testFillFromAnalytic2() f1->decrRef(); // f1=m->fillFromAnalytic(ON_NODES,2,"(x+y)*IVec+2*(x+y)*JVec"); - f1->checkCoherency(); + f1->checkConsistencyLight(); CPPUNIT_ASSERT(f1->getTypeOfField()==ON_NODES); CPPUNIT_ASSERT(f1->getTimeDiscretization()==ONE_TIME); CPPUNIT_ASSERT_EQUAL(2,f1->getNumberOfComponents()); @@ -1560,7 +1560,7 @@ void MEDCouplingBasicsTest1::testApplyFunc() { MEDCouplingUMesh *m=build2DTargetMesh_1(); MEDCouplingFieldDouble *f1=m->fillFromAnalytic(ON_NODES,2,func2); - f1->checkCoherency(); + f1->checkConsistencyLight(); CPPUNIT_ASSERT(f1->getTypeOfField()==ON_NODES); CPPUNIT_ASSERT(f1->getTimeDiscretization()==ONE_TIME); CPPUNIT_ASSERT_EQUAL(2,f1->getNumberOfComponents()); @@ -1584,7 +1584,7 @@ void MEDCouplingBasicsTest1::testApplyFunc2() { MEDCouplingUMesh *m=build2DTargetMesh_1(); MEDCouplingFieldDouble *f1=m->fillFromAnalytic(ON_NODES,2,func2); - f1->checkCoherency(); + f1->checkConsistencyLight(); CPPUNIT_ASSERT(f1->getTypeOfField()==ON_NODES); CPPUNIT_ASSERT(f1->getTimeDiscretization()==ONE_TIME); CPPUNIT_ASSERT_EQUAL(2,f1->getNumberOfComponents()); @@ -1631,10 +1631,10 @@ void MEDCouplingBasicsTest1::testOperationsOnFields() MEDCouplingUMesh *m=build2DTargetMesh_1(); MEDCouplingFieldDouble *f1=m->fillFromAnalytic(ON_NODES,1,func1); MEDCouplingFieldDouble *f2=m->fillFromAnalytic(ON_NODES,1,func1); - f1->checkCoherency(); - f2->checkCoherency(); + f1->checkConsistencyLight(); + f2->checkConsistencyLight(); MEDCouplingFieldDouble *f3=(*f1)+(*f2); - f3->checkCoherency(); + f3->checkConsistencyLight(); CPPUNIT_ASSERT(f3->getTypeOfField()==ON_NODES); CPPUNIT_ASSERT(f3->getTimeDiscretization()==ONE_TIME); double values1[9]={-1.2,-0.2,0.8,-0.2,0.8,1.8,0.8,1.8,2.8}; @@ -1646,7 +1646,7 @@ void MEDCouplingBasicsTest1::testOperationsOnFields() f3->decrRef(); // f3=(*f1)*(*f2); - f3->checkCoherency(); + f3->checkConsistencyLight(); CPPUNIT_ASSERT(f3->getTypeOfField()==ON_NODES); CPPUNIT_ASSERT(f3->getTimeDiscretization()==ONE_TIME); double values2[9]={0.36,0.01,0.16,0.01,0.16,0.81,0.16,0.81,1.96}; @@ -1659,7 +1659,7 @@ void MEDCouplingBasicsTest1::testOperationsOnFields() // f3=(*f1)+(*f2); MEDCouplingFieldDouble *f4=(*f1)-(*f3); - f4->checkCoherency(); + f4->checkConsistencyLight(); CPPUNIT_ASSERT(f4->getTypeOfField()==ON_NODES); CPPUNIT_ASSERT(f4->getTimeDiscretization()==ONE_TIME); double values3[9]={0.6,0.1,-0.4,0.1,-0.4,-0.9,-0.4,-0.9,-1.4}; @@ -1673,7 +1673,7 @@ void MEDCouplingBasicsTest1::testOperationsOnFields() // f3=(*f1)+(*f2); f4=(*f3)/(*f2); - f4->checkCoherency(); + f4->checkConsistencyLight(); CPPUNIT_ASSERT(f4->getTypeOfField()==ON_NODES); CPPUNIT_ASSERT(f4->getTimeDiscretization()==ONE_TIME); tmp=f4->getArray()->getConstPointer(); @@ -1683,7 +1683,7 @@ void MEDCouplingBasicsTest1::testOperationsOnFields() f4->decrRef(); // f4=f2->buildNewTimeReprFromThis(NO_TIME,false); - f4->checkCoherency(); + f4->checkConsistencyLight(); CPPUNIT_ASSERT(f4->getArray()==f2->getArray()); CPPUNIT_ASSERT(f4->getTypeOfField()==ON_NODES); CPPUNIT_ASSERT(f4->getTimeDiscretization()==NO_TIME); @@ -1704,7 +1704,7 @@ void MEDCouplingBasicsTest1::testOperationsOnFields() f3->decrRef(); // f4=f2->buildNewTimeReprFromThis(NO_TIME,true); - f4->checkCoherency(); + f4->checkConsistencyLight(); CPPUNIT_ASSERT(f4->getArray()!=f2->getArray()); CPPUNIT_ASSERT(f4->getTypeOfField()==ON_NODES); CPPUNIT_ASSERT(f4->getTimeDiscretization()==NO_TIME); @@ -1738,7 +1738,7 @@ void MEDCouplingBasicsTest1::testOperationsOnFields2() MEDCouplingFieldDouble *f1=m->fillFromAnalytic(ON_NODES,1,"x+y+z"); MEDCouplingFieldDouble *f2=m->fillFromAnalytic(ON_NODES,1,"a*a+b+c*c"); MEDCouplingFieldDouble *f3=(*f1)/(*f2); - f3->checkCoherency(); + f3->checkConsistencyLight(); CPPUNIT_ASSERT(f3->getTypeOfField()==ON_NODES); CPPUNIT_ASSERT(f3->getTimeDiscretization()==ONE_TIME); const double expected1[9]={-2.4999999999999991, 1.2162162162162162, 0.77868852459016391, @@ -1783,7 +1783,7 @@ void MEDCouplingBasicsTest1::testOperationsOnFields3() MEDCouplingFieldDouble *f1=m->fillFromAnalytic(ON_NODES,1,"x+y+z"); MEDCouplingFieldDouble *f2=m->fillFromAnalytic(ON_NODES,1,"a*a+b+c*c"); (*f1)/=(*f2); - f1->checkCoherency(); + f1->checkConsistencyLight(); CPPUNIT_ASSERT(f1->getTypeOfField()==ON_NODES); CPPUNIT_ASSERT(f1->getTimeDiscretization()==ONE_TIME); const double expected1[9]={-2.4999999999999991, 1.2162162162162162, 0.77868852459016391, @@ -1835,7 +1835,7 @@ void MEDCouplingBasicsTest1::testOperationsOnFields4() std::copy(arr1,arr1+15,tmp); f1->setStartTime(2.,0,0); f1->setEndTime(3.,0,0); - f1->checkCoherency(); + f1->checkConsistencyLight(); double res[3]; const double pos[2]={0.3,-0.2}; f1->getValueOn(pos,res); @@ -1854,14 +1854,14 @@ void MEDCouplingBasicsTest1::testOperationsOnFields4() f2->setArray(f1->getArray()); f2->setStartTime(2.,3,0); f2->setEndTime(4.,13,0); - CPPUNIT_ASSERT_THROW(f2->checkCoherency(),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(f2->checkConsistencyLight(),INTERP_KERNEL::Exception); DataArrayDouble *array2=DataArrayDouble::New(); array2->alloc(nbOfCells,3); tmp=array2->getPointer(); std::copy(arr2,arr2+15,tmp); f2->setEndArray(array2); array2->decrRef(); - f2->checkCoherency(); + f2->checkConsistencyLight(); // std::fill(res,res+3,0.); f2->getValueOn(pos,3.21,res); @@ -2164,7 +2164,7 @@ void MEDCouplingBasicsTest1::testGetCellsContainingPoint() { MEDCouplingUMesh *targetMesh=build2DTargetMesh_1(); double pos[12]={0.,0.,0.4,0.4,0.,0.4,0.1,0.1,0.25,0.,0.65,0.}; - MEDCouplingAutoRefCountObjectPtr t1,t2; + MCAuto t1,t2; //2D basic targetMesh->getCellsContainingPoints(pos,6,1e-12,t1,t2); CPPUNIT_ASSERT_EQUAL(6,(int)t1->getNbOfElems()); @@ -2327,7 +2327,7 @@ void MEDCouplingBasicsTest1::testCMesh0() CPPUNIT_ASSERT_DOUBLES_EQUAL(6.,res[0],1e-12); fieldOnCells->decrRef(); // - MEDCouplingMesh* meshDeepCopy=mesh->deepCpy(); + MEDCouplingMesh* meshDeepCopy=mesh->deepCopy(); MEDCouplingCMesh* meshClone=mesh->clone(false); CPPUNIT_ASSERT_THROW(meshEmpty->copyTinyStringsFrom(0),INTERP_KERNEL::Exception); @@ -2399,8 +2399,8 @@ void MEDCouplingBasicsTest1::testCMesh1() CPPUNIT_ASSERT(mesh1->isEqual(mesh2,1e-5)); CPPUNIT_ASSERT(!mesh1->isEqual(mesh2,1e-7)); - CPPUNIT_ASSERT_THROW(mesh3->checkCoherency1(1e-12),INTERP_KERNEL::Exception); - mesh1->checkCoherency1(1e-12); + CPPUNIT_ASSERT_THROW(mesh3->checkConsistency(1e-12),INTERP_KERNEL::Exception); + mesh1->checkConsistency(1e-12); CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_HEXA8,mesh1->getTypeOfCell(1)); CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_HEXA8,*((mesh1->getAllGeoTypes()).begin())); @@ -2628,7 +2628,7 @@ void MEDCouplingBasicsTest1::testFindNodeOnPlane() mesh->findNodesOnPlane(pt,v,1e-12,n); CPPUNIT_ASSERT_EQUAL(9,(int)n.size()); MEDCouplingUMesh *m3dSurf=(MEDCouplingUMesh *)mesh->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true); - MEDCouplingExtrudedMesh *me=MEDCouplingExtrudedMesh::New(mesh,m3dSurf,0); + MEDCouplingMappedExtrudedMesh *me=MEDCouplingMappedExtrudedMesh::New(mesh,m3dSurf,0); const DataArrayInt *da=me->getMesh3DIds(); CPPUNIT_ASSERT_EQUAL(8,me->getNumberOfCells()); const int expected[8]={0,1,2,3,4,5,6,7}; diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx index 5b26b3f39..7b75d55bb 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx @@ -21,7 +21,7 @@ #include "MEDCouplingBasicsTest2.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingCMesh.hxx" -#include "MEDCouplingExtrudedMesh.hxx" +#include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingMemArray.hxx" #include "MEDCouplingGaussLocalization.hxx" @@ -70,13 +70,13 @@ void MEDCouplingBasicsTest2::testGaussPointField1() f->setArray(array); f->setName("MyFirstFieldOnGaussPoint"); array->decrRef(); - f->checkCoherency(); + f->checkConsistencyLight(); CPPUNIT_ASSERT_DOUBLES_EQUAL(27.,f->getIJK(2,5,0),1e-14); CPPUNIT_ASSERT_DOUBLES_EQUAL(16.,f->getIJK(1,5,1),1e-14); // f->clearGaussLocalizations(); CPPUNIT_ASSERT_EQUAL(0,f->getNbOfGaussLocalization()); - CPPUNIT_ASSERT_THROW(f->checkCoherency(),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(f->checkConsistencyLight(),INTERP_KERNEL::Exception); int ids1[4]={0,1,3,4}; CPPUNIT_ASSERT_THROW(f->setGaussLocalizationOnCells(ids1,ids1+4,_refCoo2,_gsCoo1,_wg1),INTERP_KERNEL::Exception); CPPUNIT_ASSERT_EQUAL(0,f->getNbOfGaussLocalization()); @@ -91,7 +91,7 @@ void MEDCouplingBasicsTest2::testGaussPointField1() CPPUNIT_ASSERT_EQUAL(0,f->getGaussLocalizationIdOfOneCell(0)); CPPUNIT_ASSERT_EQUAL(1,f->getGaussLocalizationIdOfOneCell(1)); CPPUNIT_ASSERT_EQUAL(1,f->getGaussLocalizationIdOfOneCell(2)); - CPPUNIT_ASSERT_THROW(f->checkCoherency(),INTERP_KERNEL::Exception);//<- cell 3 has no localization + CPPUNIT_ASSERT_THROW(f->checkConsistencyLight(),INTERP_KERNEL::Exception);//<- cell 3 has no localization int ids4[1]={3}; std::vector _gsCoo2(_gsCoo1); std::vector _wg2(_wg1); @@ -102,11 +102,11 @@ void MEDCouplingBasicsTest2::testGaussPointField1() f->getCellIdsHavingGaussLocalization(0,tmpIds); CPPUNIT_ASSERT_EQUAL(2,(int)tmpIds.size()); CPPUNIT_ASSERT(std::equal(ids2,ids2+2,tmpIds.begin())); - CPPUNIT_ASSERT_THROW(f->checkCoherency(),INTERP_KERNEL::Exception);//<- it's always not ok because undelying array not with the good size. + CPPUNIT_ASSERT_THROW(f->checkConsistencyLight(),INTERP_KERNEL::Exception);//<- it's always not ok because undelying array not with the good size. DataArrayDouble *array2=f->getArray()->substr(0,10); f->setArray(array2); array2->decrRef(); - f->checkCoherency();//<- here it is OK + f->checkConsistencyLight();//<- here it is OK MEDCouplingFieldDouble *f2=f->clone(true); CPPUNIT_ASSERT(f->isEqual(f2,1e-14,1e-14)); MEDCouplingGaussLocalization& gl1=f2->getGaussLocalization(0); @@ -117,7 +117,7 @@ void MEDCouplingBasicsTest2::testGaussPointField1() gl1.setGaussCoord(1,1,tmp); CPPUNIT_ASSERT(f->isEqual(f2,1e-14,1e-14)); f->decrRef(); - f2->checkCoherency(); + f2->checkConsistencyLight(); // f2->decrRef(); m->decrRef(); @@ -139,7 +139,7 @@ void MEDCouplingBasicsTest2::testGaussPointNEField1() f->setArray(array); array->decrRef(); // - f->checkCoherency(); + f->checkConsistencyLight(); MEDCouplingFieldDouble *f2=f->clone(true); CPPUNIT_ASSERT(f->isEqual(f2,1e-14,1e-14)); CPPUNIT_ASSERT_DOUBLES_EQUAL(21.,f->getIJK(2,0,0),1e-14); @@ -198,7 +198,7 @@ void MEDCouplingBasicsTest2::testCellOrientation2() res1.clear(); m2->arePolyhedronsNotCorrectlyOriented(res1); CPPUNIT_ASSERT(res1.empty()); - m2->checkCoherency(); + m2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(18,m2->getNumberOfCells()); int cellIds[3]={0,6,12}; std::vector cellIds2(cellIds,cellIds+3); @@ -241,7 +241,7 @@ void MEDCouplingBasicsTest2::testCellOrientation2() for(int i=0;i<15;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(std::abs(expected1[i]),f3Ptr[i],1e-12); f3->decrRef(); - DataArrayDouble *f4=m5->getBarycenterAndOwner(); + DataArrayDouble *f4=m5->computeCellCenterOfMass(); CPPUNIT_ASSERT_EQUAL(15,f4->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(3,f4->getNumberOfComponents()); const double *f4Ptr=f4->getConstPointer(); @@ -311,14 +311,14 @@ void MEDCouplingBasicsTest2::testPolyhedronBarycenter() std::copy(coords,coords+27,myCoords->getPointer()); meshN->setCoords(myCoords); myCoords->decrRef(); - meshN->checkCoherency(); + meshN->checkConsistencyLight(); // std::vector res1; meshN->arePolyhedronsNotCorrectlyOriented(res1); meshN->orientCorrectlyPolyhedrons(); CPPUNIT_ASSERT(res1.empty()); const double *ref,*daPtr; - DataArrayDouble *da=meshN->getBarycenterAndOwner(); + DataArrayDouble *da=meshN->computeCellCenterOfMass(); CPPUNIT_ASSERT_EQUAL(1,da->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(3,da->getNumberOfComponents()); daPtr=da->getConstPointer(); @@ -329,7 +329,7 @@ void MEDCouplingBasicsTest2::testPolyhedronBarycenter() // const double center[]={0.,0.,0.}; const double vec[]={0.,2.78,0.}; - da=meshN->getBarycenterAndOwner(); + da=meshN->computeCellCenterOfMass(); daPtr=da->getConstPointer(); ref=meshN->getCoords()->getConstPointer()+24; for(int i=0;i<3;i++) @@ -338,7 +338,7 @@ void MEDCouplingBasicsTest2::testPolyhedronBarycenter() // meshN->rotate(center,vec,M_PI/7.); meshN->translate(vec); - da=meshN->getBarycenterAndOwner(); + da=meshN->computeCellCenterOfMass(); daPtr=da->getConstPointer(); ref=meshN->getCoords()->getConstPointer()+24; for(int i=0;i<3;i++) @@ -349,7 +349,7 @@ void MEDCouplingBasicsTest2::testPolyhedronBarycenter() const double vec2[]={4.5,9.3,2.8}; meshN->rotate(center2,vec2,M_E); meshN->translate(vec2); - da=meshN->getBarycenterAndOwner(); + da=meshN->computeCellCenterOfMass(); daPtr=da->getConstPointer(); ref=meshN->getCoords()->getConstPointer()+24; for(int i=0;i<3;i++) @@ -372,7 +372,7 @@ void MEDCouplingBasicsTest2::testNormL12Integ1D() array->decrRef(); // const double *ptr; - DataArrayDouble *f3=m1->getBarycenterAndOwner(); + DataArrayDouble *f3=m1->computeCellCenterOfMass(); CPPUNIT_ASSERT_EQUAL(4,f3->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,f3->getNumberOfComponents()); double expected9[4]={0.75,5.105,0.8,5.155}; @@ -451,7 +451,7 @@ void MEDCouplingBasicsTest2::testNormL12Integ1D() CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i]*sqrt(2.),ptr[i],1e-12); f2->decrRef(); //bary - f3=m1->getBarycenterAndOwner(); + f3=m1->computeCellCenterOfMass(); CPPUNIT_ASSERT_EQUAL(4,f3->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,f3->getNumberOfComponents()); double expected10[8]={0.75,0.75,5.105,5.105,0.8,0.8,5.155,5.155}; @@ -500,7 +500,7 @@ void MEDCouplingBasicsTest2::testAreaBary2D() for(int i=0;i<10;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(std::abs(expected1[i]),ptr[i],1e-12); f1->decrRef(); - DataArrayDouble *f2=m1->getBarycenterAndOwner(); + DataArrayDouble *f2=m1->computeCellCenterOfMass(); CPPUNIT_ASSERT_EQUAL(10,f2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,f2->getNumberOfComponents()); double expected2[20]={ @@ -519,7 +519,7 @@ void MEDCouplingBasicsTest2::testAreaBary2D() for(int i=0;i<10;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(std::abs(expected1[i]),ptr[i],1e-12); f1->decrRef(); - f2=m1->getBarycenterAndOwner(); + f2=m1->computeCellCenterOfMass(); CPPUNIT_ASSERT_EQUAL(10,f2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(3,f2->getNumberOfComponents()); ptr=f2->getConstPointer(); @@ -611,7 +611,7 @@ void MEDCouplingBasicsTest2::testAreaBary3D() std::copy(coords,coords+207,myCoords->getPointer()); meshN->setCoords(myCoords); myCoords->decrRef(); - meshN->checkCoherency(); + meshN->checkConsistencyLight(); std::vector res1; meshN->arePolyhedronsNotCorrectlyOriented(res1); meshN->orientCorrectlyPolyhedrons(); @@ -619,7 +619,7 @@ void MEDCouplingBasicsTest2::testAreaBary3D() meshN->arePolyhedronsNotCorrectlyOriented(res1); CPPUNIT_ASSERT(res1.empty()); // - DataArrayDouble *da=meshN->getBarycenterAndOwner(); + DataArrayDouble *da=meshN->computeCellCenterOfMass(); CPPUNIT_ASSERT_EQUAL(4,da->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(3,da->getNumberOfComponents()); const double *daPtr=da->getConstPointer(); @@ -689,7 +689,7 @@ void MEDCouplingBasicsTest2::testRenumberCellsForFields() std::copy(values2,values2+36,arr->getPointer()); f->setArray(arr); arr->decrRef(); - f->checkCoherency(); + f->checkConsistencyLight(); MEDCouplingFieldDouble *fCpy=f->clone(true); CPPUNIT_ASSERT(f->isEqual(fCpy,1e-12,1e-12)); f->renumberCells(renumber1,false); @@ -712,7 +712,7 @@ void MEDCouplingBasicsTest2::testRenumberCellsForFields() std::copy(values3,values3+36,arr->getPointer()); f->setArray(arr); arr->decrRef(); - f->checkCoherency(); + f->checkConsistencyLight(); fCpy=f->clone(true); CPPUNIT_ASSERT(f->isEqual(fCpy,1e-12,1e-12)); f->renumberCells(renumber1,false); @@ -742,7 +742,7 @@ void MEDCouplingBasicsTest2::testRenumberNodesForFields() arr->decrRef(); const double values1[27]={7.,107.,10007.,8.,108.,10008.,9.,109.,10009.,10.,110.,10010.,11.,111.,10011.,12.,112.,10012.,13.,113.,10013.,14.,114.,10014.,15.,115.,10015.}; std::copy(values1,values1+27,arr->getPointer()); - f->checkCoherency(); + f->checkConsistencyLight(); const int renumber1[9]={0,4,1,3,5,2,6,7,8}; double res[3]; const double loc[]={0.5432,-0.2432, 0.5478,0.1528}; @@ -778,23 +778,23 @@ void MEDCouplingBasicsTest2::testRenumberNodesForFields() void MEDCouplingBasicsTest2::testConvertQuadraticCellsToLinear() { MEDCouplingUMesh *mesh=build2DTargetMesh_3(); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); std::set types=mesh->getAllGeoTypes(); CPPUNIT_ASSERT_EQUAL(5,(int)types.size()); INTERP_KERNEL::NormalizedCellType expected1[5]={INTERP_KERNEL::NORM_POLYGON, INTERP_KERNEL::NORM_TRI3, INTERP_KERNEL::NORM_QUAD4, INTERP_KERNEL::NORM_TRI6, INTERP_KERNEL::NORM_QUAD8}; std::set expected1Bis(expected1,expected1+5); CPPUNIT_ASSERT(expected1Bis==types); CPPUNIT_ASSERT(mesh->isPresenceOfQuadratic()); - CPPUNIT_ASSERT_EQUAL(62,mesh->getMeshLength()); + CPPUNIT_ASSERT_EQUAL(62,mesh->getNodalConnectivityArrayLen()); MEDCouplingFieldDouble *f1=mesh->getMeasureField(false); // mesh->convertQuadraticCellsToLinear(); CPPUNIT_ASSERT(!mesh->isPresenceOfQuadratic()); // - mesh->checkCoherency(); + mesh->checkConsistencyLight(); MEDCouplingFieldDouble *f2=mesh->getMeasureField(false); CPPUNIT_ASSERT(f1->getArray()->isEqual(*f2->getArray(),1e-12)); - CPPUNIT_ASSERT_EQUAL(48,mesh->getMeshLength()); + CPPUNIT_ASSERT_EQUAL(48,mesh->getNodalConnectivityArrayLen()); std::set types2=mesh->getAllGeoTypes(); CPPUNIT_ASSERT_EQUAL(3,(int)types2.size()); INTERP_KERNEL::NormalizedCellType expected2[3]={INTERP_KERNEL::NORM_POLYGON, INTERP_KERNEL::NORM_TRI3, INTERP_KERNEL::NORM_QUAD4}; @@ -942,7 +942,7 @@ void MEDCouplingBasicsTest2::testCopyTinyStringsFromOnFields() a1->fillWithZero(); a1->setInfoOnComponent(0,"c"); a1->setInfoOnComponent(1,"d"); - DataArrayDouble *a2=a1->deepCpy(); + DataArrayDouble *a2=a1->deepCopy(); a2->setInfoOnComponent(0,"e"); a2->setInfoOnComponent(1,"f"); f->setArray(a1); @@ -955,7 +955,7 @@ void MEDCouplingBasicsTest2::testCopyTinyStringsFromOnFields() m->getCoords()->setInfoOnComponent(1,"i"); m->getCoords()->setInfoOnComponent(2,"j"); // - f->checkCoherency(); + f->checkConsistencyLight(); MEDCouplingFieldDouble *f2=f->clone(true); CPPUNIT_ASSERT(f2->isEqual(f,1e-12,1e-12)); f2->setName("smth"); @@ -1025,8 +1025,8 @@ void MEDCouplingBasicsTest2::testTryToShareSameCoordsPermute2() std::copy(targetCoords,targetCoords+8,myCoords->getPointer()); m2->setCoords(myCoords); myCoords->decrRef(); - m2->checkCoherency(); - m1->checkCoherency(); + m2->checkConsistencyLight(); + m1->checkConsistencyLight(); // const double expected1[5]={0.25,0.125,0.125,0.25,0.25}; MEDCouplingFieldDouble *f1=m1->getMeasureField(false); @@ -1121,7 +1121,7 @@ void MEDCouplingBasicsTest2::testGetMaxValue1() f->setArray(a1); f->setEndArray(a2); f->setEndTime(3.,3,4); - f->checkCoherency(); + f->checkConsistencyLight(); // CPPUNIT_ASSERT_DOUBLES_EQUAL(8.,f->getMaxValue(),1e-14); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,f->getMinValue(),1e-14); @@ -1307,13 +1307,13 @@ void MEDCouplingBasicsTest2::testGetIdsInRange1() f1->setArray(array); array->decrRef(); // - f1->checkCoherency(); - DataArrayInt *da=f1->getIdsInRange(2.9,7.1); + f1->checkConsistencyLight(); + DataArrayInt *da=f1->findIdsInRange(2.9,7.1); CPPUNIT_ASSERT_EQUAL((std::size_t)5,da->getNbOfElems()); const int expected1[5]={2,3,5,7,9}; CPPUNIT_ASSERT(std::equal(expected1,expected1+5,da->getConstPointer())); da->decrRef(); - da=f1->getIdsInRange(8.,12.); + da=f1->findIdsInRange(8.,12.); CPPUNIT_ASSERT_EQUAL((std::size_t)4,da->getNbOfElems()); const int expected2[4]={1,4,6,8}; CPPUNIT_ASSERT(std::equal(expected2,expected2+4,da->getConstPointer())); @@ -1349,7 +1349,7 @@ void MEDCouplingBasicsTest2::testBuildSubPart1() CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension()); MEDCouplingUMesh *m2C=dynamic_cast(const_cast(f2->getMesh())); - CPPUNIT_ASSERT_EQUAL(13,m2C->getMeshLength()); + CPPUNIT_ASSERT_EQUAL(13,m2C->getNodalConnectivityArrayLen()); const double expected2[12]={0.2, -0.3, 0.7, -0.3, 0.2, 0.2, 0.7, 0.2, 0.2, 0.7, 0.7, 0.7}; for(int i=0;i<12;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],m2C->getCoords()->getIJ(0,i),1.e-12); @@ -1381,7 +1381,7 @@ void MEDCouplingBasicsTest2::testBuildSubPart1() CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension()); m2C=dynamic_cast(const_cast(f2->getMesh())); - CPPUNIT_ASSERT_EQUAL(8,m2C->getMeshLength()); + CPPUNIT_ASSERT_EQUAL(8,m2C->getNodalConnectivityArrayLen()); for(int i=0;i<8;i++)//8 is not an error CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],m2C->getCoords()->getIJ(0,i),1.e-12); CPPUNIT_ASSERT(std::equal(expected3,expected3+4,m2C->getNodalConnectivity()->getConstPointer()+4)); @@ -1404,7 +1404,7 @@ void MEDCouplingBasicsTest2::testBuildSubPart1() CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension()); m2C=dynamic_cast(const_cast(f2->getMesh())); - CPPUNIT_ASSERT_EQUAL(8,m2C->getMeshLength()); + CPPUNIT_ASSERT_EQUAL(8,m2C->getNodalConnectivityArrayLen()); for(int i=0;i<8;i++)//8 is not an error CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],m2C->getCoords()->getIJ(0,i),1.e-12); CPPUNIT_ASSERT(std::equal(expected3,expected3+4,m2C->getNodalConnectivity()->getConstPointer()+4)); @@ -1424,7 +1424,7 @@ void MEDCouplingBasicsTest2::testBuildSubPart1() CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension()); m2C=dynamic_cast(const_cast(f2->getMesh())); - CPPUNIT_ASSERT_EQUAL(13,m2C->getMeshLength()); + CPPUNIT_ASSERT_EQUAL(13,m2C->getNodalConnectivityArrayLen()); for(int i=0;i<12;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],m2C->getCoords()->getIJ(0,i),1.e-12); CPPUNIT_ASSERT(std::equal(expected3,expected3+4,m2C->getNodalConnectivity()->getConstPointer()+4)); @@ -1448,10 +1448,10 @@ void MEDCouplingBasicsTest2::testDoublyContractedProduct1() std::copy(arr1,arr1+30,array->getPointer()); f1->setArray(array); array->decrRef(); - f1->checkCoherency(); + f1->checkConsistencyLight(); // MEDCouplingFieldDouble *f2=f1->doublyContractedProduct(); - f2->checkCoherency(); + f2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(1,f2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples()); for(int i=0;i<5;i++) @@ -1476,9 +1476,9 @@ void MEDCouplingBasicsTest2::testDeterminant1() f1->setArray(array); array->decrRef(); //4 components - f1->checkCoherency(); + f1->checkConsistencyLight(); MEDCouplingFieldDouble *f2=f1->determinant(); - f2->checkCoherency(); + f2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(CONST_ON_TIME_INTERVAL,f2->getTimeDiscretization()); CPPUNIT_ASSERT_EQUAL(1,f2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfValues()); @@ -1498,7 +1498,7 @@ void MEDCouplingBasicsTest2::testDeterminant1() std::copy(arr2,arr2+54,array->getPointer()); f1->setArray(array); array->decrRef(); - CPPUNIT_ASSERT_THROW(f1->checkCoherency(),INTERP_KERNEL::Exception);//no end array specified ! + CPPUNIT_ASSERT_THROW(f1->checkConsistencyLight(),INTERP_KERNEL::Exception);//no end array specified ! // f2=f1->determinant(); CPPUNIT_ASSERT_EQUAL(LINEAR_TIME,f2->getTimeDiscretization()); @@ -1515,9 +1515,9 @@ void MEDCouplingBasicsTest2::testDeterminant1() std::copy(arr3,arr3+54,array->getPointer()); f1->setEndArray(array); array->decrRef(); - f1->checkCoherency(); + f1->checkConsistencyLight(); f2=f1->determinant(); - f2->checkCoherency(); + f2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(LINEAR_TIME,f2->getTimeDiscretization()); CPPUNIT_ASSERT_EQUAL(1,f2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(9,f2->getNumberOfTuples()); @@ -1544,9 +1544,9 @@ void MEDCouplingBasicsTest2::testDeterminant1() f1->setArray(array); array->decrRef(); // - f1->checkCoherency(); + f1->checkConsistencyLight(); f2=f1->determinant(); - f2->checkCoherency(); + f2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(ONE_TIME,f2->getTimeDiscretization()); CPPUNIT_ASSERT_EQUAL(1,f2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples()); @@ -1571,10 +1571,10 @@ void MEDCouplingBasicsTest2::testEigenValues1() std::copy(arr1,arr1+30,array->getPointer()); f1->setArray(array); array->decrRef(); - f1->checkCoherency(); + f1->checkConsistencyLight(); // MEDCouplingFieldDouble *f2=f1->eigenValues(); - f2->checkCoherency(); + f2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(3,f2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples()); const double expected1[3]={13.638813677891717,-4.502313844635971,-2.2364998332557486}; @@ -1601,10 +1601,10 @@ void MEDCouplingBasicsTest2::testEigenVectors1() std::copy(arr1,arr1+30,array->getPointer()); f1->setArray(array); array->decrRef(); - f1->checkCoherency(); + f1->checkConsistencyLight(); // MEDCouplingFieldDouble *f2=f1->eigenVectors(); - f2->checkCoherency(); + f2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(9,f2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples()); const double expected1[9]={ @@ -1641,10 +1641,10 @@ void MEDCouplingBasicsTest2::testInverse1() std::copy(arr1,arr1+45,array->getPointer()); f1->setArray(array); array->decrRef(); - f1->checkCoherency(); + f1->checkConsistencyLight(); // MEDCouplingFieldDouble *f2=f1->inverse(); - f2->checkCoherency(); + f2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(9,f2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples()); const double expected1[9]={-2.6538108356290113, 2.855831037649208, -1.1111111111111067, 3.461891643709813, -4.775022956841121, 2.2222222222222143, -1.1111111111111054, 2.222222222222214, -1.1111111111111072}; @@ -1668,10 +1668,10 @@ void MEDCouplingBasicsTest2::testInverse1() std::copy(arr3,arr3+30,array->getPointer()); f1->setArray(array); array->decrRef(); - f1->checkCoherency(); + f1->checkConsistencyLight(); // f2=f1->inverse(); - f2->checkCoherency(); + f2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(6,f2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples()); const double expected3[6]={-0.3617705098531818, -0.8678630828458127, -0.026843764174972983, 0.5539957431465833, 0.13133439560823013, -0.05301294502145887}; @@ -1692,10 +1692,10 @@ void MEDCouplingBasicsTest2::testInverse1() std::copy(arr2,arr2+20,array->getPointer()); f1->setArray(array); array->decrRef(); - f1->checkCoherency(); + f1->checkConsistencyLight(); // f2=f1->inverse(); - f2->checkCoherency(); + f2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(4,f2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples()); const double expected2[4]={-1.8595041322314059, 0.9504132231404963, 1.404958677685951, -0.49586776859504156}; @@ -1723,10 +1723,10 @@ void MEDCouplingBasicsTest2::testTrace1() std::copy(arr1,arr1+45,array->getPointer()); f1->setArray(array); array->decrRef(); - f1->checkCoherency(); + f1->checkConsistencyLight(); // MEDCouplingFieldDouble *f2=f1->trace(); - f2->checkCoherency(); + f2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(1,f2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples()); for(int i=0;i<5;i++) @@ -1739,10 +1739,10 @@ void MEDCouplingBasicsTest2::testTrace1() std::copy(arr3,arr3+30,array->getPointer()); f1->setArray(array); array->decrRef(); - f1->checkCoherency(); + f1->checkConsistencyLight(); // f2=f1->trace(); - f2->checkCoherency(); + f2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(1,f2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples()); for(int i=0;i<5;i++) @@ -1755,10 +1755,10 @@ void MEDCouplingBasicsTest2::testTrace1() std::copy(arr2,arr2+20,array->getPointer()); f1->setArray(array); array->decrRef(); - f1->checkCoherency(); + f1->checkConsistencyLight(); // f2=f1->trace(); - f2->checkCoherency(); + f2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(1,f2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples()); for(int i=0;i<5;i++) @@ -1780,10 +1780,10 @@ void MEDCouplingBasicsTest2::testDeviator1() std::copy(arr1,arr1+30,array->getPointer()); f1->setArray(array); array->decrRef(); - f1->checkCoherency(); + f1->checkConsistencyLight(); // MEDCouplingFieldDouble *f2=f1->deviator(); - f2->checkCoherency(); + f2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(6,f2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples()); const double expected1[6]={-1.1,0.,1.1,4.5,5.6,6.7}; @@ -1813,10 +1813,10 @@ void MEDCouplingBasicsTest2::testMagnitude1() std::copy(arr1,arr1+25,array->getPointer()); f1->setArray(array); array->decrRef(); - f1->checkCoherency(); + f1->checkConsistencyLight(); // MEDCouplingFieldDouble *f2=f1->magnitude(); - f2->checkCoherency(); + f2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(1,f2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples()); for(int i=0;i<5;i++) @@ -1838,10 +1838,10 @@ void MEDCouplingBasicsTest2::testMaxPerTuple1() std::copy(arr1,arr1+25,array->getPointer()); f1->setArray(array); array->decrRef(); - f1->checkCoherency(); + f1->checkConsistencyLight(); // MEDCouplingFieldDouble *f2=f1->maxPerTuple(); - f2->checkCoherency(); + f2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(1,f2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples()); for(int i=0;i<5;i++) @@ -1875,17 +1875,17 @@ void MEDCouplingBasicsTest2::testChangeNbOfComponents() std::copy(arr1,arr1+25,array->getPointer()); f1->setArray(array); array->decrRef(); - f1->checkCoherency(); + f1->checkConsistencyLight(); // f1->changeNbOfComponents(3,7.77); - f1->checkCoherency(); + f1->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(3,f1->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfTuples()); const double expected1[15]={1.2,2.3,3.4, 1.2,3.4,4.5, 3.4,4.5,5.6, 5.6,1.2,2.3, 4.5,5.6,1.2}; for(int i=0;i<15;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f1->getIJ(0,i),1e-13); f1->changeNbOfComponents(4,7.77); - f1->checkCoherency(); + f1->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(4,f1->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfTuples()); const double expected2[20]={1.2,2.3,3.4,7.77, 1.2,3.4,4.5,7.77, 3.4,4.5,5.6,7.77, 5.6,1.2,2.3,7.77, 4.5,5.6,1.2,7.77}; @@ -1907,10 +1907,10 @@ void MEDCouplingBasicsTest2::testSortPerTuple1() std::copy(arr1,arr1+25,array->getPointer()); f1->setArray(array); array->decrRef(); - f1->checkCoherency(); + f1->checkConsistencyLight(); // f1->sortPerTuple(true); - f1->checkCoherency(); + f1->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfTuples()); for(int i=0;i<5;i++) @@ -1923,7 +1923,7 @@ void MEDCouplingBasicsTest2::testSortPerTuple1() } // f1->sortPerTuple(false); - f1->checkCoherency(); + f1->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfTuples()); for(int i=0;i<5;i++) @@ -2069,7 +2069,7 @@ void MEDCouplingBasicsTest2::testFillFromAnalytic3() f1->setMesh(m); f1->setName("myField"); f1->fillFromAnalytic(1,"y+x"); - f1->checkCoherency(); + f1->checkConsistencyLight(); CPPUNIT_ASSERT(std::string(f1->getName())=="myField"); CPPUNIT_ASSERT(f1->getTypeOfField()==ON_CELLS); CPPUNIT_ASSERT(f1->getTimeDiscretization()==ONE_TIME); @@ -2087,7 +2087,7 @@ void MEDCouplingBasicsTest2::testFillFromAnalytic3() f1->setMesh(m); f1->setEndTime(1.2,3,4); f1->fillFromAnalytic(1,"y+2*x"); - f1->checkCoherency(); + f1->checkConsistencyLight(); CPPUNIT_ASSERT(f1->getTypeOfField()==ON_NODES); CPPUNIT_ASSERT(f1->getTimeDiscretization()==CONST_ON_TIME_INTERVAL); CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents()); @@ -2103,7 +2103,7 @@ void MEDCouplingBasicsTest2::testFillFromAnalytic3() f1->setMesh(m); f1->setEndTime(1.2,3,4); f1->fillFromAnalytic(1,"2.*x+y"); - f1->checkCoherency(); + f1->checkConsistencyLight(); CPPUNIT_ASSERT(f1->getTypeOfField()==ON_NODES); CPPUNIT_ASSERT(f1->getTimeDiscretization()==LINEAR_TIME); CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents()); @@ -2125,7 +2125,7 @@ void MEDCouplingBasicsTest2::testFillFromAnalytic3() f1=MEDCouplingFieldDouble::New(ON_NODES,NO_TIME); f1->setMesh(m); f1->fillFromAnalytic(2,"(x+y)*IVec+2*(x+y)*JVec"); - f1->checkCoherency(); + f1->checkConsistencyLight(); CPPUNIT_ASSERT(f1->getTypeOfField()==ON_NODES); CPPUNIT_ASSERT(f1->getTimeDiscretization()==NO_TIME); CPPUNIT_ASSERT_EQUAL(2,f1->getNumberOfComponents()); @@ -2160,13 +2160,13 @@ void MEDCouplingBasicsTest2::testFieldDoubleOpEqual1() CPPUNIT_ASSERT_THROW((*f1)=0.07,INTERP_KERNEL::Exception); f1->setMesh(m); (*f1)=0.07; - f1->checkCoherency(); + f1->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfTuples()); for(int i=0;i<5;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(0.07,f1->getIJ(i,0),1e-16); (*f1)=0.09; - f1->checkCoherency(); + f1->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfTuples()); for(int i=0;i<5;i++) @@ -2177,7 +2177,7 @@ void MEDCouplingBasicsTest2::testFieldDoubleOpEqual1() f1->setEndTime(4.5,2,3); f1->setMesh(m); (*f1)=0.08; - f1->checkCoherency(); + f1->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(9,f1->getNumberOfTuples()); for(int i=0;i<9;i++) @@ -2246,7 +2246,7 @@ void MEDCouplingBasicsTest2::testAreaBary3D2() std::transform(tmpConn,tmpConn+8,tmpConn,std::bind2nd(std::plus(),6)); mesh->insertNextCell(INTERP_KERNEL::NORM_PYRA5,5,tmpConn); mesh->finishInsertingCells(); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); bool isMerged; int newNebOfNodes; DataArrayInt *da=mesh->mergeNodes(1e-7,isMerged,newNebOfNodes); @@ -2259,7 +2259,7 @@ void MEDCouplingBasicsTest2::testAreaBary3D2() CPPUNIT_ASSERT_DOUBLES_EQUAL(volPenta6,vols->getIJ(1,0),1e-7); CPPUNIT_ASSERT_DOUBLES_EQUAL(volPyra5,vols->getIJ(2,0),1e-7); vols->decrRef(); - DataArrayDouble *bary=mesh->getBarycenterAndOwner(); + DataArrayDouble *bary=mesh->computeCellCenterOfMass(); CPPUNIT_ASSERT_EQUAL(3,bary->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(3,bary->getNumberOfComponents()); CPPUNIT_ASSERT_DOUBLES_EQUAL(baryHexa8[0],bary->getIJ(0,0),1e-11); diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest3.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest3.cxx index 2c799a88d..27d40f496 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest3.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest3.cxx @@ -21,7 +21,7 @@ #include "MEDCouplingBasicsTest3.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingCMesh.hxx" -#include "MEDCouplingExtrudedMesh.hxx" +#include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingMemArray.hxx" #include "MEDCouplingGaussLocalization.hxx" @@ -43,7 +43,7 @@ void MEDCouplingBasicsTest3::testGetMeasureFieldCMesh1() std::copy(discX,discX+4,da->getPointer()); m->setCoordsAt(0,da); da->decrRef(); - m->checkCoherency(); + m->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(4,m->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(3,m->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(1,m->getSpaceDimension()); @@ -60,7 +60,7 @@ void MEDCouplingBasicsTest3::testGetMeasureFieldCMesh1() for(int i=0;i<4;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(discX[i],coords->getIJ(i,0),1e-12); coords->decrRef(); - coords=m->getBarycenterAndOwner(); + coords=m->computeCellCenterOfMass(); CPPUNIT_ASSERT_EQUAL(3,coords->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,coords->getNumberOfComponents()); const double expected1_3[3]={2.85,4.6,8.}; @@ -73,7 +73,7 @@ void MEDCouplingBasicsTest3::testGetMeasureFieldCMesh1() std::copy(discY,discY+3,da->getPointer()); m->setCoordsAt(1,da); da->decrRef(); - m->checkCoherency(); + m->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(12,m->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(6,m->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(2,m->getSpaceDimension()); @@ -91,7 +91,7 @@ void MEDCouplingBasicsTest3::testGetMeasureFieldCMesh1() for(int i=0;i<24;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2_2[i],coords->getIJ(0,i),1e-12); coords->decrRef(); - coords=m->getBarycenterAndOwner(); + coords=m->computeCellCenterOfMass(); CPPUNIT_ASSERT_EQUAL(6,coords->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,coords->getNumberOfComponents()); const double expected2_3[12]={2.85,17.85,4.6,17.85,8.,17.85, 2.85,34.6,4.6,34.6,8.,34.6}; @@ -104,7 +104,7 @@ void MEDCouplingBasicsTest3::testGetMeasureFieldCMesh1() std::copy(discZ,discZ+5,da->getPointer()); m->setCoordsAt(2,da); da->decrRef(); - m->checkCoherency(); + m->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(60,m->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(24,m->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(3,m->getSpaceDimension()); @@ -128,7 +128,7 @@ void MEDCouplingBasicsTest3::testGetMeasureFieldCMesh1() for(int i=0;i<180;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected3_2[i],coords->getIJ(0,i),1e-12); coords->decrRef(); - coords=m->getBarycenterAndOwner(); + coords=m->computeCellCenterOfMass(); CPPUNIT_ASSERT_EQUAL(24,coords->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(3,coords->getNumberOfComponents()); const double expected3_3[72]={ @@ -150,19 +150,19 @@ void MEDCouplingBasicsTest3::testFieldDoubleZipCoords1() MEDCouplingFieldDouble *f=m->fillFromAnalytic(ON_NODES,2,"x*2."); f->getArray()->setInfoOnComponent(0,"titi"); f->getArray()->setInfoOnComponent(1,"tutu"); - f->checkCoherency(); + f->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(18,f->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,f->getNumberOfComponents()); const double expected1[36]={-0.6, -0.6, 0.4, 0.4, 1.4, 1.4, -0.6, -0.6, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 1.4, 1.4, -0.6, -0.6, 0.4, 0.4, 1.4, 1.4, -0.6, -0.6, 1.4, 1.4, -0.6, -0.6, 0.4, 0.4, 1.4, 1.4, 0.4, 0.4}; for(int i=0;i<36;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f->getIJ(0,i),1e-12); CPPUNIT_ASSERT(f->zipCoords()); - f->checkCoherency(); + f->checkConsistencyLight(); const double expected2[30]={-0.6, -0.6, 1.4, 1.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 1.4, 1.4, -0.6, -0.6, 0.4, 0.4, 1.4, 1.4, 1.4, 1.4, -0.6, -0.6, 0.4, 0.4, 1.4, 1.4, 0.4, 0.4}; for(int i=0;i<30;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],f->getIJ(0,i),1e-12); CPPUNIT_ASSERT(!f->zipCoords()); - f->checkCoherency(); + f->checkConsistencyLight(); for(int i=0;i<30;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],f->getIJ(0,i),1e-12); CPPUNIT_ASSERT(std::string(f->getArray()->getInfoOnComponent(0))=="titi"); @@ -206,7 +206,7 @@ void MEDCouplingBasicsTest3::testFieldDoubleZipConnectivity1() CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f->getIJ(0,i),1e-12); f->getArray()->setInfoOnComponent(0,"titi"); f->getArray()->setInfoOnComponent(1,"tutu"); - f->checkCoherency(); + f->checkConsistencyLight(); CPPUNIT_ASSERT(f->zipConnectivity(0)); const double expected2[14]={-0.05, -0.05, 0.3666666666666667, 0.3666666666666667, 0.53333333333333321, 0.53333333333333321, -0.05, -0.05, 0.45, 0.45, 0.36666666666666659, 0.36666666666666659, 0.033333333333333326, 0.033333333333333326}; @@ -502,7 +502,7 @@ void MEDCouplingBasicsTest3::testFieldDoubleGetMinMaxValues2() a->decrRef(); f->setMesh(m2); // - f->checkCoherency(); + f->checkConsistencyLight(); double m=f->getMaxValue(); CPPUNIT_ASSERT_DOUBLES_EQUAL(8.71,m,1e-12); DataArrayInt *ws; @@ -517,7 +517,7 @@ void MEDCouplingBasicsTest3::testFieldDoubleGetMinMaxValues2() // const double arr2[18]={-8.71,-4.53,12.41,-8.71,8.71,-8.7099,-4.55,-8.71,-5.55,-6.77,1e-200,-4.55,-8.7099,0.,-1.23,0.,-2.22,-8.71}; std::copy(arr2,arr2+18,a->getPointer()); - f->checkCoherency(); + f->checkConsistencyLight(); m=f->getMinValue(); CPPUNIT_ASSERT_DOUBLES_EQUAL(-8.71,m,1e-12); m=f->getMinValue2(ws); @@ -543,7 +543,7 @@ void MEDCouplingBasicsTest3::testBuildUnstructuredCMesh1() std::copy(discX,discX+4,da->getPointer()); m->setCoordsAt(0,da); da->decrRef(); - m->checkCoherency(); + m->checkConsistencyLight(); double pos=2.4; CPPUNIT_ASSERT_EQUAL(0,m->getCellContainingPoint(&pos,1e-12)); pos=3.7; @@ -556,7 +556,7 @@ void MEDCouplingBasicsTest3::testBuildUnstructuredCMesh1() CPPUNIT_ASSERT_EQUAL(-1,m->getCellContainingPoint(&pos,1e-12)); // MEDCouplingUMesh *m2=m->buildUnstructured(); - m2->checkCoherency(); + m2->checkConsistencyLight(); MEDCouplingFieldDouble *f1=m->getMeasureField(false); MEDCouplingFieldDouble *f2=m2->getMeasureField(false); CPPUNIT_ASSERT_EQUAL(f1->getNumberOfTuples(),3); @@ -575,7 +575,7 @@ void MEDCouplingBasicsTest3::testBuildUnstructuredCMesh1() f2->decrRef(); // m2=m->buildUnstructured(); - m2->checkCoherency(); + m2->checkConsistencyLight(); f1=m->getMeasureField(false); f2=m2->getMeasureField(false); CPPUNIT_ASSERT_EQUAL(f1->getNumberOfTuples(),6); @@ -594,7 +594,7 @@ void MEDCouplingBasicsTest3::testBuildUnstructuredCMesh1() m->setCoordsAt(2,da); da->decrRef(); m2=m->buildUnstructured(); - m2->checkCoherency(); + m2->checkConsistencyLight(); f1=m->getMeasureField(false); f2=m2->getMeasureField(false); CPPUNIT_ASSERT_EQUAL(f1->getNumberOfTuples(),24); @@ -764,7 +764,7 @@ void MEDCouplingBasicsTest3::testKeepSetSelectedComponent2() f1->setMesh(m1); f1->setName("f1"); f1->setArray(a1); - f1->checkCoherency(); + f1->checkConsistencyLight(); // const int arr2[6]={1,2,1,2,0,0}; std::vector arr2V(arr2,arr2+6); @@ -775,7 +775,7 @@ void MEDCouplingBasicsTest3::testKeepSetSelectedComponent2() CPPUNIT_ASSERT_DOUBLES_EQUAL(2.3,f2->getTime(dt,it),1e-13); CPPUNIT_ASSERT_EQUAL(4,dt); CPPUNIT_ASSERT_EQUAL(5,it); - f2->checkCoherency(); + f2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(6,f2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples()); CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(0))=="bbbb"); @@ -794,13 +794,13 @@ void MEDCouplingBasicsTest3::testKeepSetSelectedComponent2() f5->setTime(6.7,8,9); f5->getArray()->setInfoOnComponent(0,"eeee"); f5->getArray()->setInfoOnComponent(1,"ffff"); - f5->checkCoherency(); + f5->checkConsistencyLight(); const int arr4[2]={1,2}; std::vector arr4V(arr4,arr4+2); f2->setSelectedComponents(f5,arr4V); CPPUNIT_ASSERT_EQUAL(6,f2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples()); - f2->checkCoherency(); + f2->checkConsistencyLight(); CPPUNIT_ASSERT_DOUBLES_EQUAL(2.3,f2->getTime(dt,it),1e-13); CPPUNIT_ASSERT_EQUAL(4,dt); CPPUNIT_ASSERT_EQUAL(5,it); @@ -940,7 +940,7 @@ void MEDCouplingBasicsTest3::testElementaryDAThrowAndSpecialCases() CPPUNIT_ASSERT(!((ret.str().find("Float32"))==std::string::npos)); CPPUNIT_ASSERT(!((ret.str().find("16 15 14 13 12 11 10"))==std::string::npos)); - CPPUNIT_ASSERT_THROW(dbl->selectByTupleId2(0,1,-1),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(dbl->selectByTupleIdSafeSlice(0,1,-1),INTERP_KERNEL::Exception); CPPUNIT_ASSERT_THROW(dbl->substr(-1,1),INTERP_KERNEL::Exception); CPPUNIT_ASSERT_THROW(dbl->substr(8,1),INTERP_KERNEL::Exception); CPPUNIT_ASSERT_THROW(dbl->substr(0,8),INTERP_KERNEL::Exception); @@ -988,7 +988,7 @@ void MEDCouplingBasicsTest3::testElementaryDAThrowAndSpecialCases() dbl3->setIJ(6,0,0.); CPPUNIT_ASSERT_THROW(dbl3->checkNoNullValues(),INTERP_KERNEL::Exception); CPPUNIT_ASSERT_THROW(dbl3->applyInv(1.),INTERP_KERNEL::Exception); //div by zero - CPPUNIT_ASSERT_THROW(dbl2->getIdsInRange(1.,2.),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(dbl2->findIdsInRange(1.,2.),INTERP_KERNEL::Exception); std::vector a(0); //input list must be NON EMPTY CPPUNIT_ASSERT_THROW(DataArrayDouble::Aggregate(a),INTERP_KERNEL::Exception); CPPUNIT_ASSERT_THROW(DataArrayDouble::Meld(a),INTERP_KERNEL::Exception); @@ -1029,7 +1029,7 @@ void MEDCouplingBasicsTest3::testDAIGetIdsEqual1() DataArrayInt *da=DataArrayInt::New(); da->alloc(7,1); std::copy(tab1,tab1+7,da->getPointer()); - DataArrayInt *da2=da->getIdsEqual(-2); + DataArrayInt *da2=da->findIdsEqual(-2); CPPUNIT_ASSERT_EQUAL(3,da2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,da2->getNumberOfComponents()); const int expected1[3]={1,3,6}; @@ -1046,7 +1046,7 @@ void MEDCouplingBasicsTest3::testDAIGetIdsEqualList1() std::copy(tab1,tab1+7,da->getPointer()); const int tab2[3]={3,-2,0}; std::vector tab2V(tab2,tab2+3); - DataArrayInt *da2=da->getIdsEqualList(&tab2V[0],&tab2V[0]+tab2V.size()); + DataArrayInt *da2=da->findIdsEqualList(&tab2V[0],&tab2V[0]+tab2V.size()); CPPUNIT_ASSERT_EQUAL(4,da2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,da2->getNumberOfComponents()); const int expected1[4]={1,3,4,6}; @@ -1172,7 +1172,7 @@ void MEDCouplingBasicsTest3::testUnPolyze1() mesh->convertToPolyTypes(&eltsV[0],&eltsV[0]+eltsV.size()); mesh->unPolyze(); MEDCouplingUMesh *mesh2=build3DTargetMesh_1(); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); CPPUNIT_ASSERT(mesh->isEqual(mesh2,1e-12)); mesh->convertToPolyTypes(&eltsV[0],&eltsV[0]+eltsV.size()); CPPUNIT_ASSERT(!mesh->isEqual(mesh2,1e-12)); @@ -1220,7 +1220,7 @@ void MEDCouplingBasicsTest3::testConvertDegeneratedCells1() mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,conn+16); mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,conn+24); mesh->finishInsertingCells(); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(4,mesh->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_HEXA8,mesh->getTypeOfCell(0)); CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_HEXA8,mesh->getTypeOfCell(1)); @@ -1228,7 +1228,7 @@ void MEDCouplingBasicsTest3::testConvertDegeneratedCells1() CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_HEXA8,mesh->getTypeOfCell(3)); MEDCouplingFieldDouble *f1=mesh->getMeasureField(true); mesh->convertDegeneratedCells(); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); MEDCouplingFieldDouble *f2=mesh->getMeasureField(true); CPPUNIT_ASSERT_EQUAL(4,mesh->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_PENTA6,mesh->getTypeOfCell(0)); @@ -1405,7 +1405,7 @@ void MEDCouplingBasicsTest3::testExtrudedMesh5() CPPUNIT_ASSERT_EQUAL(37,tmp3); tmp->decrRef(); i->convertDegeneratedCells(); - i->checkCoherency(); + i->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(36,i->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(37,i->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(12,i->getNumberOfCellsWithType(INTERP_KERNEL::NORM_TRI3)); @@ -1416,7 +1416,7 @@ void MEDCouplingBasicsTest3::testExtrudedMesh5() for(int k=0;k<3;k++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[k],j->getIJ(0,ii*3+k),1e-10); const double expected2[72]={0.62200846792814113, 0.16666666666681595, 1.4513530918323276, 0.38888888888923495, 2.6293994326053212, 0.7045454545460802, 0.45534180126145435, 0.45534180126150181, 1.0624642029433926, 1.0624642029435025, 1.9248539780597826, 1.9248539780599816, 0.16666666666661334, 0.62200846792815856, 0.38888888888876294, 1.4513530918323678, 0.70454545454522521, 2.629399432605394, -0.16666666666674007, 0.62200846792812436, -0.38888888888906142, 1.4513530918322881, -0.70454545454576778, 2.6293994326052488, -0.45534180126154766, 0.45534180126140844, -1.0624642029436118, 1.0624642029432834, -1.9248539780601803, 1.9248539780595841, -0.62200846792817499, 0.1666666666665495, -1.451353091832408, 0.388888888888613, -2.6293994326054668, 0.70454545454495332, -0.62200846792810593, -0.16666666666680507, -1.451353091832247, -0.38888888888921297, -2.6293994326051746, -0.70454545454604123, -0.45534180126135926, -0.45534180126159562, -1.0624642029431723, -1.0624642029437235, -1.9248539780593836, -1.9248539780603811, -0.1666666666664828, -0.62200846792819242, -0.38888888888846079, -1.4513530918324489, -0.70454545454467987, -2.6293994326055397, 0.16666666666687083, -0.62200846792808862, 0.38888888888936374, -1.4513530918322073, 0.70454545454631357, -2.6293994326051022, 0.45534180126164348, -0.45534180126131207, 1.0624642029438327, -1.0624642029430627, 1.9248539780605791, -1.9248539780591853, 0.62200846792821063, -0.16666666666641802, 1.4513530918324888, -0.38888888888831086, 2.6293994326056125, -0.70454545454440853}; - DataArrayDouble *m=i->getBarycenterAndOwner(); + DataArrayDouble *m=i->computeCellCenterOfMass(); for(int ii=0;ii<72;ii++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[ii],m->getIJ(0,ii),1e-10); // @@ -1461,14 +1461,14 @@ void MEDCouplingBasicsTest3::testExtrudedMesh6() const double center[2]={0.,0.}; f->rotate(center,0,M_PI/3); MEDCouplingUMesh *g=c->buildExtrudedMesh(f,0); - g->checkCoherency(); + g->checkConsistencyLight(); const double expected1[]={ 0.4330127018922193, 0.4330127018922193, 0.649519052838329, 1.2990381056766578, 1.299038105676658, 1.948557158514987, 2.1650635094610955, 2.1650635094610964, 3.2475952641916446, 3.031088913245533, 3.0310889132455352, 4.546633369868303 }; MEDCouplingFieldDouble *f1=g->getMeasureField(true); for(int i=0;i<12;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f1->getIJ(0,i),1e-12); const double expected2[]={0.625, 0.21650635094610962, 1.625, 0.21650635094610959, 2.8750000000000004, 0.21650635094610965, 1.1250000000000002, 1.0825317547305482, 2.125, 1.0825317547305482, 3.3750000000000004, 1.0825317547305484, 2.125, 2.8145825622994254, 3.125, 2.8145825622994254, 4.375, 2.8145825622994254, 3.6250000000000009, 5.4126587736527414, 4.625, 5.4126587736527414, 5.875, 5.4126587736527414}; - DataArrayDouble *f2=g->getBarycenterAndOwner(); + DataArrayDouble *f2=g->computeCellCenterOfMass(); for(int i=0;i<24;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],f2->getIJ(0,i),1e-12); // @@ -1560,7 +1560,7 @@ void MEDCouplingBasicsTest3::testSimplexize1() const int expected2[7]={0,0,1,2,3,4,4}; for(int i=0;i<7;i++) CPPUNIT_ASSERT_EQUAL(expected2[i],da->getIJ(i,0)); - m->checkCoherency(); + m->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(7,m->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(0)); CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(1)); @@ -1589,7 +1589,7 @@ void MEDCouplingBasicsTest3::testSimplexize1() CPPUNIT_ASSERT_EQUAL(1,da->getNumberOfComponents()); for(int i=0;i<7;i++) CPPUNIT_ASSERT_EQUAL(expected2[i],da->getIJ(i,0)); - m->checkCoherency(); + m->checkConsistencyLight(); types=m->getAllGeoTypes(); CPPUNIT_ASSERT_EQUAL(2,(int)types.size()); CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,*(types.begin())); @@ -1625,9 +1625,9 @@ void MEDCouplingBasicsTest3::testSimplexize2() f1->setArray(arr); arr->decrRef(); // - f1->checkCoherency(); + f1->checkConsistencyLight(); CPPUNIT_ASSERT(f1->simplexize(0)); - f1->checkCoherency(); + f1->checkConsistencyLight(); const double expected1[14]={10.,110.,10.,110.,20.,120.,30.,130.,40.,140.,50.,150.,50.,150.}; for(int i=0;i<14;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f1->getIJ(0,i),1e-10); @@ -1656,7 +1656,7 @@ void MEDCouplingBasicsTest3::testDAMeld1() da3->setInfoOnComponent(1,"c1da3"); da3->setInfoOnComponent(2,"c2da3"); // - DataArrayDouble *da1C=da1->deepCpy(); + DataArrayDouble *da1C=da1->deepCopy(); da1->meldWith(da3); CPPUNIT_ASSERT_EQUAL(5,da1->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(7,da1->getNumberOfTuples()); @@ -1729,19 +1729,19 @@ void MEDCouplingBasicsTest3::testFieldMeld1() da1->setInfoOnComponent(0,"aaa"); f1->setArray(da1); f1->setTime(3.4,2,1); - f1->checkCoherency(); + f1->checkConsistencyLight(); // - MEDCouplingFieldDouble *f2=f1->deepCpy(); + MEDCouplingFieldDouble *f2=f1->deepCopy(); f2->setMesh(f1->getMesh()); - f2->checkCoherency(); + f2->checkConsistencyLight(); f2->changeNbOfComponents(2,5.); (*f2)=5.; f2->getArray()->setInfoOnComponent(0,"bbb"); f2->getArray()->setInfoOnComponent(1,"ccc"); - f2->checkCoherency(); + f2->checkConsistencyLight(); // MEDCouplingFieldDouble *f3=MEDCouplingFieldDouble::MeldFields(f2,f1); - f3->checkCoherency(); + f3->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(5,f3->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(3,f3->getNumberOfComponents()); CPPUNIT_ASSERT(f3->getArray()->getInfoOnComponent(0)=="bbb"); @@ -1759,7 +1759,7 @@ void MEDCouplingBasicsTest3::testFieldMeld1() MEDCouplingFieldDouble *f4=f2->buildNewTimeReprFromThis(NO_TIME,false); MEDCouplingFieldDouble *f5=f1->buildNewTimeReprFromThis(NO_TIME,false); MEDCouplingFieldDouble *f6=MEDCouplingFieldDouble::MeldFields(f4,f5); - f6->checkCoherency(); + f6->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(5,f6->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(3,f6->getNumberOfComponents()); CPPUNIT_ASSERT(f6->getArray()->getInfoOnComponent(0)=="bbb"); @@ -1791,7 +1791,7 @@ void MEDCouplingBasicsTest3::testMergeNodes2() MEDCouplingUMesh *m3=MEDCouplingUMesh::MergeUMeshes(tmp); bool b; int newNbOfNodes; - DataArrayInt *da=m3->mergeNodes2(0.01,b,newNbOfNodes); + DataArrayInt *da=m3->mergeNodesCenter(0.01,b,newNbOfNodes); CPPUNIT_ASSERT_EQUAL(9,m3->getNumberOfNodes()); const double expected1[18]={-0.299,-0.3, 0.201,-0.3, 0.701,-0.3, -0.299,0.2, 0.201,0.2, 0.701,0.2, -0.299,0.7, 0.201,0.7, 0.701,0.7}; for(int i=0;i<18;i++) @@ -2051,7 +2051,7 @@ void MEDCouplingBasicsTest3::testUMInsertNextCell1() std::copy(targetCoords,targetCoords+18,myCoords->getPointer()); targetMesh->setCoords(myCoords); myCoords->decrRef(); - targetMesh->checkCoherency(); + targetMesh->checkConsistencyLight(); targetMesh->decrRef(); } @@ -2072,11 +2072,11 @@ void MEDCouplingBasicsTest3::testFieldOperatorDivDiffComp1() MEDCouplingFieldDouble *f2=MEDCouplingFieldDouble::New(ON_CELLS); f2->setArray(arr); f2->setMesh(m1); - f2->checkCoherency(); + f2->checkConsistencyLight(); // MEDCouplingFieldDouble *f3=(*f1)/(*f2); CPPUNIT_ASSERT_THROW((*f2)/(*f1),INTERP_KERNEL::Exception); - f3->checkCoherency(); + f3->checkConsistencyLight(); (*f1)/=(*f2); CPPUNIT_ASSERT(f1->isEqual(f3,1e-10,1e-10)); CPPUNIT_ASSERT_THROW((*f2)/=(*f1),INTERP_KERNEL::Exception); @@ -2395,10 +2395,10 @@ void MEDCouplingBasicsTest3::testMergeUMeshes2() ms2[0]=m1; ms2[1]=m2_2; ms2[2]=m3_2; // MEDCouplingUMesh *m4=MEDCouplingUMesh::MergeUMeshes(ms); - m4->checkCoherency(); + m4->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(10,m4->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(20,m4->getNumberOfNodes()); - CPPUNIT_ASSERT_EQUAL(45,m4->getMeshLength()); + CPPUNIT_ASSERT_EQUAL(45,m4->getNodalConnectivityArrayLen()); // MEDCouplingMesh *m4bis=MEDCouplingMesh::MergeMeshes(ms2); CPPUNIT_ASSERT(m4->isEqual(m4bis,1e-12)); @@ -2444,7 +2444,7 @@ void MEDCouplingBasicsTest3::testBuild0DMeshFromCoords1() coo->setName("My0D"); std::copy(sourceCoords,sourceCoords+12,coo->getPointer()); MEDCouplingUMesh *m=MEDCouplingUMesh::Build0DMeshFromCoords(coo); - m->checkCoherency(); + m->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(4,m->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(4,m->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(3,m->getSpaceDimension()); diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx index f6317f098..7c0bf9c6f 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx @@ -21,7 +21,7 @@ #include "MEDCouplingBasicsTest4.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingCMesh.hxx" -#include "MEDCouplingExtrudedMesh.hxx" +#include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingMemArray.hxx" #include "MEDCouplingGaussLocalization.hxx" @@ -40,7 +40,7 @@ void MEDCouplingBasicsTest4::testDescriptionInMeshTimeUnit1() MEDCouplingUMesh *m=build2DTargetMesh_1(); m->setDescription(text1); CPPUNIT_ASSERT(std::string(m->getDescription())==text1); - MEDCouplingUMesh *m2=(MEDCouplingUMesh *)m->deepCpy(); + MEDCouplingUMesh *m2=(MEDCouplingUMesh *)m->deepCopy(); CPPUNIT_ASSERT(m->isEqual(m2,1e-12)); CPPUNIT_ASSERT(std::string(m2->getDescription())==text1); m2->setDescription("ggg"); @@ -50,7 +50,7 @@ void MEDCouplingBasicsTest4::testDescriptionInMeshTimeUnit1() MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); f->setTimeUnit(text1); CPPUNIT_ASSERT(std::string(f->getTimeUnit())==text1); - MEDCouplingFieldDouble *f2=f->deepCpy(); + MEDCouplingFieldDouble *f2=f->deepCopy(); CPPUNIT_ASSERT(std::string(f2->getTimeUnit())==text1); f2->decrRef(); // @@ -73,7 +73,7 @@ void MEDCouplingBasicsTest4::testMultiFields1() CPPUNIT_ASSERT_EQUAL(6,(int)das.size()); CPPUNIT_ASSERT_EQUAL(5,(int)das2.size()); // - MEDCouplingMultiFields *mfs2=mfs->deepCpy(); + MEDCouplingMultiFields *mfs2=mfs->deepCopy(); CPPUNIT_ASSERT(mfs->isEqual(mfs2,1e-12,1e-12)); mfs2->decrRef(); // @@ -179,7 +179,7 @@ void MEDCouplingBasicsTest4::testDAICheckAndPreparePermutation1() da->iota(0); da2=da->checkAndPreparePermutation(); CPPUNIT_ASSERT_EQUAL(1,da2->getNumberOfComponents()); - CPPUNIT_ASSERT(da2->isIdentity2(8)); + CPPUNIT_ASSERT(da2->isIota(8)); da2->decrRef(); da->decrRef(); // @@ -237,7 +237,7 @@ void MEDCouplingBasicsTest4::testUMeshFindCellIdsOnBoundary1() { MEDCouplingUMesh *m=build3DSurfTargetMesh_1(); DataArrayInt *da5=m->findCellIdsOnBoundary(); - CPPUNIT_ASSERT(da5->isIdentity2(5)); + CPPUNIT_ASSERT(da5->isIota(5)); // da5->decrRef(); m->decrRef(); @@ -273,7 +273,7 @@ void MEDCouplingBasicsTest4::testMeshSetTime1() CPPUNIT_ASSERT(!m1->isEqual(m2,1e-12)); // m1->setTime(10.34,55,12); - MEDCouplingUMesh *m3=(MEDCouplingUMesh *)m1->deepCpy(); + MEDCouplingUMesh *m3=(MEDCouplingUMesh *)m1->deepCopy(); CPPUNIT_ASSERT(m1->isEqual(m3,1e-12)); tmp3=m3->getTime(tmp1,tmp2); CPPUNIT_ASSERT_EQUAL(55,tmp1); @@ -297,7 +297,7 @@ void MEDCouplingBasicsTest4::testMeshSetTime1() CPPUNIT_ASSERT_EQUAL(8,tmp1); CPPUNIT_ASSERT_EQUAL(100,tmp2); CPPUNIT_ASSERT_DOUBLES_EQUAL(5.67,tmp3,1e-12); - MEDCouplingCMesh *c=(MEDCouplingCMesh *)b->deepCpy(); + MEDCouplingCMesh *c=(MEDCouplingCMesh *)b->deepCopy(); CPPUNIT_ASSERT(c->isEqual(b,1e-12)); tmp3=c->getTime(tmp1,tmp2); CPPUNIT_ASSERT_EQUAL(8,tmp1); @@ -319,16 +319,16 @@ void MEDCouplingBasicsTest4::testApplyFuncTwo1() std::copy(vals,vals+15,da->getPointer()); f1->setArray(da); // - CPPUNIT_ASSERT_THROW(da->applyFunc2(1,"y+z"),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(da->applyFuncCompo(1,"y+z"),INTERP_KERNEL::Exception); da->setInfoOnComponent(0,"x [m]"); da->setInfoOnComponent(1,"y [mm]"); da->setInfoOnComponent(2,"z [km]"); - CPPUNIT_ASSERT_THROW(da->applyFunc2(1,"x+y+zz+zzz"),INTERP_KERNEL::Exception); - CPPUNIT_ASSERT_THROW(da->applyFunc2(1,"toto(x+y)"),INTERP_KERNEL::Exception); - CPPUNIT_ASSERT_THROW(da->applyFunc2(1,"x/0"),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(da->applyFuncCompo(1,"x+y+zz+zzz"),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(da->applyFuncCompo(1,"toto(x+y)"),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(da->applyFuncCompo(1,"x/0"),INTERP_KERNEL::Exception); - DataArrayDouble *da2=da->applyFunc2(1,"y+z"); + DataArrayDouble *da2=da->applyFuncCompo(1,"y+z"); CPPUNIT_ASSERT_EQUAL(1,da2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,da2->getNumberOfTuples()); const double expected1[5]={32.,34.,36.,38.,40.}; @@ -343,7 +343,7 @@ void MEDCouplingBasicsTest4::testApplyFuncTwo1() // CPPUNIT_ASSERT_EQUAL(3,f1->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfTuples()); - f1->applyFunc2(1,"y+z"); + f1->applyFuncCompo(1,"y+z"); CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfTuples()); for(int i=0;i<5;i++) @@ -368,21 +368,21 @@ void MEDCouplingBasicsTest4::testApplyFuncThree1() // std::vector vs(3); vs[0]="x"; vs[1]="Y"; vs[2]="z"; - CPPUNIT_ASSERT_THROW(da->applyFunc3(1,vs,"y+z"),INTERP_KERNEL::Exception); - CPPUNIT_ASSERT_THROW(da->applyFunc3(1,vs,"x+Y+z+zz+zzz"),INTERP_KERNEL::Exception); - CPPUNIT_ASSERT_THROW(da->applyFunc3(1,vs,"x/0."),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(da->applyFuncNamedCompo(1,vs,"y+z"),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(da->applyFuncNamedCompo(1,vs,"x+Y+z+zz+zzz"),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(da->applyFuncNamedCompo(1,vs,"x/0."),INTERP_KERNEL::Exception); vs[1]="y"; - DataArrayDouble *da2=da->applyFunc3(1,vs,"y+z"); + DataArrayDouble *da2=da->applyFuncNamedCompo(1,vs,"y+z"); const double expected1[5]={32.,34.,36.,38.,40.}; for(int i=0;i<5;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],da2->getIJ(0,i),1e-12); da2->decrRef(); std::vector vs2(4); vs2[0]="x"; vs2[1]="y"; vs2[2]="z"; vs2[3]="a"; - CPPUNIT_ASSERT_THROW(da->applyFunc3(1,vs2,"x+a"),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(da->applyFuncNamedCompo(1,vs2,"x+a"),INTERP_KERNEL::Exception); f1->setArray(da); CPPUNIT_ASSERT_EQUAL(3,f1->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfTuples()); - f1->applyFunc3(1,vs,"y+z"); + f1->applyFuncNamedCompo(1,vs,"y+z"); CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfTuples()); for(int i=0;i<5;i++) @@ -398,11 +398,11 @@ void MEDCouplingBasicsTest4::testFillFromAnalyticTwo1() MEDCouplingUMesh *m1=build3DSurfTargetMesh_1(); m1->setTime(3.4,5,6); m1->setTimeUnit("us"); int a,b; - CPPUNIT_ASSERT_THROW(m1->fillFromAnalytic2(ON_NODES,1,"y+z"),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(m1->fillFromAnalyticCompo(ON_NODES,1,"y+z"),INTERP_KERNEL::Exception); m1->getCoords()->setInfoOnComponent(0,"x [m]"); m1->getCoords()->setInfoOnComponent(1,"y"); m1->getCoords()->setInfoOnComponent(2,"z"); - MEDCouplingFieldDouble *f1=m1->fillFromAnalytic2(ON_NODES,1,"y+z"); + MEDCouplingFieldDouble *f1=m1->fillFromAnalyticCompo(ON_NODES,1,"y+z"); CPPUNIT_ASSERT_DOUBLES_EQUAL(3.4,f1->getTime(a,b),1.e-14); CPPUNIT_ASSERT_EQUAL(5,a); CPPUNIT_ASSERT_EQUAL(6,b); CPPUNIT_ASSERT_EQUAL(std::string(f1->getTimeUnit()),std::string("us")); @@ -422,9 +422,9 @@ void MEDCouplingBasicsTest4::testFillFromAnalyticThree1() int a,b; std::vector vs(3); vs[0]="x"; vs[1]="Y"; vs[2]="z"; - CPPUNIT_ASSERT_THROW(m1->fillFromAnalytic3(ON_NODES,1,vs,"y+z"),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(m1->fillFromAnalyticNamedCompo(ON_NODES,1,vs,"y+z"),INTERP_KERNEL::Exception); vs[1]="y"; - MEDCouplingFieldDouble *f1=m1->fillFromAnalytic3(ON_NODES,1,vs,"y+z"); + MEDCouplingFieldDouble *f1=m1->fillFromAnalyticNamedCompo(ON_NODES,1,vs,"y+z"); CPPUNIT_ASSERT_DOUBLES_EQUAL(3.4,f1->getTime(a,b),1.e-14); CPPUNIT_ASSERT_EQUAL(5,a); CPPUNIT_ASSERT_EQUAL(6,b); CPPUNIT_ASSERT_EQUAL(std::string(f1->getTimeUnit()),std::string("us")); @@ -741,7 +741,7 @@ void MEDCouplingBasicsTest4::testGetValueOn2() const double values1[15]={7.,107.,10007.,8.,108.,10008.,9.,109.,10009.,10.,110.,10010.,11.,111.,10011.}; std::copy(values1,values1+15,arr->getPointer()); const double loc[10]={-0.05,-0.05, 0.55,-0.25, 0.55,0.15, -0.05,0.45, 0.45,0.45}; - f->checkCoherency(); + f->checkConsistencyLight(); DataArrayDouble *locs=f->getValueOnMulti(loc,5); CPPUNIT_ASSERT_EQUAL(5,locs->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(3,locs->getNumberOfComponents()); @@ -761,7 +761,7 @@ void MEDCouplingBasicsTest4::testGetValueOn2() std::copy(values2,values2+27,arr->getPointer()); const double loc2[8]={0.5432,-0.2432, 0.5478,0.1528, 0.5432,-0.2432, 0.5432,-0.2432}; const double expected2[12]={9.0272, 109.0272, 10009.0272, 11.4124,111.4124,10011.4124, 9.0272, 109.0272, 10009.0272, 9.0272, 109.0272, 10009.0272}; - f->checkCoherency(); + f->checkConsistencyLight(); locs=f->getValueOnMulti(loc2,4); CPPUNIT_ASSERT_EQUAL(4,locs->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(3,locs->getNumberOfComponents()); @@ -779,18 +779,18 @@ void MEDCouplingBasicsTest4::testDAIGetIdsNotEqual1() const int vals1[10]={2,3,5,6,8,5,5,6,1,-5}; d->alloc(10,1); std::copy(vals1,vals1+10,d->getPointer()); - DataArrayInt *d2=d->getIdsNotEqual(5); + DataArrayInt *d2=d->findIdsNotEqual(5); CPPUNIT_ASSERT_EQUAL(7,d2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,d2->getNumberOfComponents()); const int expected1[7]={0,1,3,4,7,8,9}; for(int i=0;i<7;i++) CPPUNIT_ASSERT_EQUAL(expected1[i],d2->getIJ(0,i)); d->rearrange(2); - CPPUNIT_ASSERT_THROW(d->getIdsNotEqual(5),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(d->findIdsNotEqual(5),INTERP_KERNEL::Exception); const int vals2[3]={-4,5,6}; std::vector vals3(vals2,vals2+3); d->rearrange(1); - DataArrayInt *d3=d->getIdsNotEqualList(&vals3[0],&vals3[0]+vals3.size()); + DataArrayInt *d3=d->findIdsNotEqualList(&vals3[0],&vals3[0]+vals3.size()); CPPUNIT_ASSERT_EQUAL(5,d3->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,d3->getNumberOfComponents()); const int expected2[5]={0,1,4,8,9}; @@ -833,12 +833,12 @@ void MEDCouplingBasicsTest4::testUMeshHexagonPrism1() mesh->finishInsertingCells(); coo->decrRef(); // - mesh->checkCoherency(); + mesh->checkConsistencyLight(); MEDCouplingFieldDouble *vols=mesh->getMeasureField(false); CPPUNIT_ASSERT_EQUAL(1,vols->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,vols->getNumberOfComponents()); CPPUNIT_ASSERT_DOUBLES_EQUAL(-5.196152422706632,vols->getIJ(0,0),1e-12); - DataArrayDouble *bary=mesh->getBarycenterAndOwner(); + DataArrayDouble *bary=mesh->computeCellCenterOfMass(); CPPUNIT_ASSERT_EQUAL(1,bary->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(3,bary->getNumberOfComponents()); const double expected1[3]={0.,0.,1.}; @@ -871,7 +871,7 @@ void MEDCouplingBasicsTest4::testUMeshHexagonPrism1() CPPUNIT_ASSERT(INTERP_KERNEL::NORM_POLYHED==mesh->getTypeOfCell(0)); mesh->unPolyze(); CPPUNIT_ASSERT(INTERP_KERNEL::NORM_HEXGP12==mesh->getTypeOfCell(0)); - CPPUNIT_ASSERT_EQUAL(13,mesh->getMeshLength()); + CPPUNIT_ASSERT_EQUAL(13,mesh->getNodalConnectivityArrayLen()); // vols->decrRef(); bary->decrRef(); @@ -901,43 +901,43 @@ void MEDCouplingBasicsTest4::testDADCheckIsMonotonic() void MEDCouplingBasicsTest4::testCheckCoherencyDeeper1() { MEDCouplingUMesh *m=build3DSourceMesh_1(); - m->checkCoherency(); - m->checkCoherency1(); + m->checkConsistencyLight(); + m->checkConsistency(); m->getNodalConnectivity()->setIJ(8,0,-1); - m->checkCoherency(); - CPPUNIT_ASSERT_THROW(m->checkCoherency1(),INTERP_KERNEL::Exception); + m->checkConsistencyLight(); + CPPUNIT_ASSERT_THROW(m->checkConsistency(),INTERP_KERNEL::Exception); m->getNodalConnectivity()->setIJ(8,0,-6); - m->checkCoherency(); - CPPUNIT_ASSERT_THROW(m->checkCoherency1(),INTERP_KERNEL::Exception); + m->checkConsistencyLight(); + CPPUNIT_ASSERT_THROW(m->checkConsistency(),INTERP_KERNEL::Exception); m->getNodalConnectivity()->setIJ(8,0,9);//9>=NbOfNodes - m->checkCoherency(); - CPPUNIT_ASSERT_THROW(m->checkCoherency1(),INTERP_KERNEL::Exception); + m->checkConsistencyLight(); + CPPUNIT_ASSERT_THROW(m->checkConsistency(),INTERP_KERNEL::Exception); m->getNodalConnectivity()->setIJ(8,0,8);//OK - m->checkCoherency(); - m->checkCoherency1(); + m->checkConsistencyLight(); + m->checkConsistency(); const int elts[2]={1,5}; std::vector eltsV(elts,elts+2); m->convertToPolyTypes(&eltsV[0],&eltsV[0]+eltsV.size()); - m->checkCoherency(); - m->checkCoherency1(); + m->checkConsistencyLight(); + m->checkConsistency(); m->getNodalConnectivity()->setIJ(2,0,9);//9>=NbOfNodes - m->checkCoherency(); - CPPUNIT_ASSERT_THROW(m->checkCoherency1(),INTERP_KERNEL::Exception); + m->checkConsistencyLight(); + CPPUNIT_ASSERT_THROW(m->checkConsistency(),INTERP_KERNEL::Exception); m->getNodalConnectivity()->setIJ(2,0,-3); - m->checkCoherency(); - CPPUNIT_ASSERT_THROW(m->checkCoherency1(),INTERP_KERNEL::Exception); + m->checkConsistencyLight(); + CPPUNIT_ASSERT_THROW(m->checkConsistency(),INTERP_KERNEL::Exception); m->getNodalConnectivity()->setIJ(2,0,-1); - m->checkCoherency(); - CPPUNIT_ASSERT_THROW(m->checkCoherency1(),INTERP_KERNEL::Exception);//Throw because cell#0 is not a polyhedron + m->checkConsistencyLight(); + CPPUNIT_ASSERT_THROW(m->checkConsistency(),INTERP_KERNEL::Exception);//Throw because cell#0 is not a polyhedron m->getNodalConnectivity()->setIJ(2,0,4); - m->checkCoherency(); - m->checkCoherency1(); + m->checkConsistencyLight(); + m->checkConsistency(); m->getNodalConnectivity()->setIJ(7,0,-1); - m->checkCoherency(); - m->checkCoherency1();//OK because we are in polyhedron connec + m->checkConsistencyLight(); + m->checkConsistency();//OK because we are in polyhedron connec m->getNodalConnectivity()->setIJ(36,0,14); - m->checkCoherency(); - CPPUNIT_ASSERT_THROW(m->checkCoherency1(),INTERP_KERNEL::Exception);//Throw beacause now cell 5 is a TETRA4 (14) so mimatch of number index and static type. + m->checkConsistencyLight(); + CPPUNIT_ASSERT_THROW(m->checkConsistency(),INTERP_KERNEL::Exception);//Throw beacause now cell 5 is a TETRA4 (14) so mimatch of number index and static type. m->decrRef(); } @@ -962,13 +962,13 @@ void MEDCouplingBasicsTest4::testUnPolyze2() m2->convertToPolyTypes(&temp[0],&temp[0]+temp.size()); m2->unPolyze(); CPPUNIT_ASSERT(INTERP_KERNEL::NORM_TETRA4==m2->getTypeOfCell(2)); - CPPUNIT_ASSERT_EQUAL(40,m2->getMeshLength()); + CPPUNIT_ASSERT_EQUAL(40,m2->getNodalConnectivityArrayLen()); std::vector temp2; m2->getNodeIdsOfCell(2,temp2); CPPUNIT_ASSERT(4==(int)temp2.size()); CPPUNIT_ASSERT(std::equal(conn,conn+4,temp2.begin())); - m2->checkCoherency1(); - MEDCouplingMesh *m3=m2->deepCpy(); + m2->checkConsistency(); + MEDCouplingMesh *m3=m2->deepCopy(); m2->unPolyze(); CPPUNIT_ASSERT(m3->isEqual(m2,1e-12)); m3->decrRef(); @@ -989,25 +989,25 @@ void MEDCouplingBasicsTest4::testDACpyFrom1() // DataArrayDouble *d1=DataArrayDouble::New(); CPPUNIT_ASSERT(!d->isEqual(*d1,1e-12)); - d1->cpyFrom(*d); + d1->deepCopyFrom(*d); CPPUNIT_ASSERT(d->isEqual(*d1,1e-12)); - d1->cpyFrom(*d); + d1->deepCopyFrom(*d); CPPUNIT_ASSERT(d->isEqual(*d1,1e-12)); d1->rearrange(2); CPPUNIT_ASSERT(!d->isEqual(*d1,1e-12)); - d1->cpyFrom(*d); + d1->deepCopyFrom(*d); CPPUNIT_ASSERT(d->isEqual(*d1,1e-12)); // DataArrayInt *d2=d->convertToIntArr(); DataArrayInt *d4=DataArrayInt::New(); CPPUNIT_ASSERT(!d2->isEqual(*d4)); - d4->cpyFrom(*d2); + d4->deepCopyFrom(*d2); CPPUNIT_ASSERT(d2->isEqual(*d4)); - d4->cpyFrom(*d2); + d4->deepCopyFrom(*d2); CPPUNIT_ASSERT(d2->isEqual(*d4)); d4->rearrange(2); CPPUNIT_ASSERT(!d2->isEqual(*d4)); - d4->cpyFrom(*d2); + d4->deepCopyFrom(*d2); CPPUNIT_ASSERT(d2->isEqual(*d4)); // d->decrRef(); @@ -1231,7 +1231,7 @@ void MEDCouplingBasicsTest4::testSortCellsInMEDFileFrmt1() { MEDCouplingUMesh *m1=0; MEDCouplingUMesh *m=buildPointe_1(m1); - MEDCouplingUMesh *m2=(MEDCouplingUMesh *)m->deepCpy(); + MEDCouplingUMesh *m2=(MEDCouplingUMesh *)m->deepCopy(); m->setCoords(0); const int vals[16]={0,1,2,14,3,12,4,5,15,6,7,8,9,10,11,13}; DataArrayInt *da=DataArrayInt::New(); @@ -1481,7 +1481,7 @@ void MEDCouplingBasicsTest4::testDAIComputeOffsets2() const int expected1[7]={0,3,8,9,11,11,19}; d->alloc(6,1); std::copy(vals1,vals1+6,d->getPointer()); - d->computeOffsets2(); + d->computeOffsetsFull(); CPPUNIT_ASSERT_EQUAL(7,d->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,d->getNumberOfComponents()); for(int i=0;i<7;i++) @@ -1547,7 +1547,7 @@ void MEDCouplingBasicsTest4::testNorm2_1() std::copy(tab,tab+10,d->getPointer()); f->setArray(d); d->decrRef(); - f->checkCoherency(); + f->checkConsistencyLight(); // CPPUNIT_ASSERT_DOUBLES_EQUAL(11.209371079592289,f->norm2(),1e-14); // @@ -1567,7 +1567,7 @@ void MEDCouplingBasicsTest4::testNormMax1() std::copy(tab,tab+10,d->getPointer()); f->setArray(d); d->decrRef(); - f->checkCoherency(); + f->checkConsistencyLight(); // CPPUNIT_ASSERT_DOUBLES_EQUAL(7.8,f->normMax(),1e-14); // @@ -1645,7 +1645,7 @@ void MEDCouplingBasicsTest4::testConvertExtrudedPolyhedra1() const int expected2[10]={0,5,14,19,42,49,86,95,108,159}; CPPUNIT_ASSERT(std::equal(expected1,expected1+159,da->getConstPointer())); CPPUNIT_ASSERT(std::equal(expected2,expected2+10,dai->getConstPointer())); - m->checkCoherency1(); + m->checkConsistency(); // m->decrRef(); } @@ -1655,7 +1655,7 @@ void MEDCouplingBasicsTest4::testNonRegressionCopyTinyStrings() MEDCouplingUMesh *m=build2DTargetMesh_1(); MEDCouplingFieldDouble *f1=m->getMeasureField(true); f1->getArray()->setInfoOnComponent(0,"P [N/m^2]"); - DataArrayDouble *bary=m->getBarycenterAndOwner(); + DataArrayDouble *bary=m->computeCellCenterOfMass(); MEDCouplingFieldDouble *f2=f1->buildNewTimeReprFromThis(NO_TIME,false); f2->setArray(bary); CPPUNIT_ASSERT_THROW(f1->copyTinyAttrFrom(f2),INTERP_KERNEL::Exception); @@ -1735,7 +1735,7 @@ void MEDCouplingBasicsTest4::testChangeUnderlyingMeshWithCMesh1() coordsX->decrRef(); coordsY->decrRef(); coordsZ->decrRef(); - MEDCouplingMesh *mesh2=mesh->deepCpy(); + MEDCouplingMesh *mesh2=mesh->deepCopy(); // static const int ids1[9]={0,1,2,10,11,12,20,21,22}; for(const int *myId=ids1;myId!=ids1+9;myId++) @@ -1898,13 +1898,13 @@ void MEDCouplingBasicsTest4::testDAIBuildOld2NewArrayFromSurjectiveFormat2() b->alloc(3,1); std::copy(arrI,arrI+3,b->getPointer()); int newNbTuple=-1; - DataArrayInt *ret=DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(10,a->begin(),b->begin(),b->end(),newNbTuple); + DataArrayInt *ret=DataArrayInt::ConvertIndexArrayToO2N(10,a->begin(),b->begin(),b->end(),newNbTuple); const int expected[10]={0,1,2,0,3,4,5,4,6,4}; CPPUNIT_ASSERT_EQUAL((std::size_t)10,ret->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(7,newNbTuple); CPPUNIT_ASSERT_EQUAL(1,ret->getNumberOfComponents()); CPPUNIT_ASSERT(std::equal(expected,expected+10,ret->getConstPointer())); - CPPUNIT_ASSERT_THROW(DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(9,a->begin(),b->begin(),b->end(),newNbTuple),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(DataArrayInt::ConvertIndexArrayToO2N(9,a->begin(),b->begin(),b->end(),newNbTuple),INTERP_KERNEL::Exception); ret->decrRef(); b->decrRef(); a->decrRef(); @@ -1973,7 +1973,7 @@ void MEDCouplingBasicsTest4::testBuildDescendingConnec2() DataArrayInt *revDescIndx=DataArrayInt::New(); // MEDCouplingUMesh *mesh2=mesh->buildDescendingConnectivity2(desc,descIndx,revDesc,revDescIndx); - mesh2->checkCoherency(); + mesh2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(1,mesh2->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(13,mesh2->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL((std::size_t)14,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(14,revDescIndx->getNumberOfTuples()); @@ -2019,7 +2019,7 @@ void MEDCouplingBasicsTest4::testIntersect2DMeshesTmp1() MEDCouplingUMesh *m1=m1c->buildUnstructured(); const int subPart1[3]={3,4,5}; MEDCouplingUMesh *m1bis=static_cast(m1->buildPartOfMySelf(subPart1,subPart1+3,false)); - MEDCouplingUMesh *m2tmp=static_cast(m1->deepCpy()); + MEDCouplingUMesh *m2tmp=static_cast(m1->deepCopy()); const int subPart2[3]={0,1,2}; MEDCouplingUMesh *m2=static_cast(m2tmp->buildPartOfMySelf(subPart2,subPart2+3,false)); const double vec[2]={0.5,0.5}; diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx index b71139e52..48e357654 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx @@ -21,7 +21,7 @@ #include "MEDCouplingBasicsTest5.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingCMesh.hxx" -#include "MEDCouplingExtrudedMesh.hxx" +#include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingMemArray.hxx" #include "MEDCouplingGaussLocalization.hxx" @@ -56,7 +56,7 @@ void MEDCouplingBasicsTest5::testUMeshTessellate2D1() m1->setCoords(myCoords1); myCoords1->decrRef(); // - MEDCouplingUMesh *m11=static_cast(m1->deepCpy()); + MEDCouplingUMesh *m11=static_cast(m1->deepCopy()); m11->tessellate2D(1.); CPPUNIT_ASSERT(m11->getCoords()->isEqual(*m11->getCoords(),1e-12)); const int expected1[48]={5,0,3,11,1,5,3,4,12,2,1,11,5,5,15,3,0,5,6,16,4,3,15,5,5,5,0,7,19,5,6,5,19,7,8,20,5,0,1,23,7,5,1,2,24,8,7,23}; @@ -67,7 +67,7 @@ void MEDCouplingBasicsTest5::testUMeshTessellate2D1() CPPUNIT_ASSERT(std::equal(expected2,expected2+9,m11->getNodalConnectivityIndex()->getConstPointer())); m11->decrRef(); // - MEDCouplingUMesh *m12=static_cast(m1->deepCpy()); + MEDCouplingUMesh *m12=static_cast(m1->deepCopy()); m12->tessellate2D(0.5); CPPUNIT_ASSERT_EQUAL(41,m12->getNumberOfNodes()); const int expected3[60]={5,0,3,25,26,1,5,3,4,27,28,2,1,26,25,5,5,29,30,3,0,5,6,31,32,4,3,30,29,5,5,5,0,7,33,34,5,6,5,34,33,7,8,35,36,5,0,1,37,38,7,5,1,2,39,40,8,7,38,37}; @@ -101,9 +101,9 @@ void MEDCouplingBasicsTest5::testUMeshTessellate2DCurve1() m1->setCoords(myCoords); myCoords->decrRef(); - MEDCouplingUMesh *m2 = static_cast(m1->deepCpy()); + MEDCouplingUMesh *m2 = static_cast(m1->deepCopy()); m2->tessellate2D(0.1); - CPPUNIT_ASSERT_NO_THROW(m2->checkCoherency1(0.0)); // eps param not used + CPPUNIT_ASSERT_NO_THROW(m2->checkConsistency(0.0)); // eps param not used m1->decrRef(); m2->decrRef(); } @@ -375,18 +375,18 @@ void MEDCouplingBasicsTest5::testDataArrayDoubleAdvSetting1() da2->alloc(5,2); std::copy(data2,data2+10,da2->getPointer()); // - DataArrayDouble *dac=da->deepCpy(); - dac->setContigPartOfSelectedValues2(1,da2,2,4,1); + DataArrayDouble *dac=da->deepCopy(); + dac->setContigPartOfSelectedValuesSlice(1,da2,2,4,1); const double expected3[14]={1.,11.,0.,30.,11.,41.,4.,14.,5.,15.,6.,16.,7.,17.}; for(int i=0;i<14;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected3[i],dac->getIJ(0,i),1e-14); dac->decrRef(); // - dac=da->deepCpy(); - CPPUNIT_ASSERT_THROW(dac->setContigPartOfSelectedValues2(3,da2,0,5,1),INTERP_KERNEL::Exception); - CPPUNIT_ASSERT_THROW(dac->setContigPartOfSelectedValues2(0,da2,4,6,1),INTERP_KERNEL::Exception); - CPPUNIT_ASSERT_THROW(dac->setContigPartOfSelectedValues2(3,da2,5,0,1),INTERP_KERNEL::Exception); - dac->setContigPartOfSelectedValues2(3,da2,1,5,1); + dac=da->deepCopy(); + CPPUNIT_ASSERT_THROW(dac->setContigPartOfSelectedValuesSlice(3,da2,0,5,1),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(dac->setContigPartOfSelectedValuesSlice(0,da2,4,6,1),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(dac->setContigPartOfSelectedValuesSlice(3,da2,5,0,1),INTERP_KERNEL::Exception); + dac->setContigPartOfSelectedValuesSlice(3,da2,1,5,1); const double expected4[14]={1.,11.,2.,12.,3.,13.,9.,39.,0.,30.,11.,41.,12.,42.}; for(int i=0;i<14;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected4[i],dac->getIJ(0,i),1e-14); @@ -394,7 +394,7 @@ void MEDCouplingBasicsTest5::testDataArrayDoubleAdvSetting1() // DataArrayInt *ids=DataArrayInt::New(); ids->alloc(3,1); - dac=da->deepCpy(); + dac=da->deepCopy(); ids->setIJ(0,0,2); ids->setIJ(1,0,0); ids->setIJ(2,0,4); dac->setContigPartOfSelectedValues(2,da2,ids); const double expected5[14]={1.,11.,2.,12.,0.,30.,8.,38.,12.,42.,6.,16.,7.,17.}; @@ -402,7 +402,7 @@ void MEDCouplingBasicsTest5::testDataArrayDoubleAdvSetting1() CPPUNIT_ASSERT_DOUBLES_EQUAL(expected5[i],dac->getIJ(0,i),1e-14); dac->decrRef(); // - dac=da->deepCpy(); + dac=da->deepCopy(); ids->setIJ(0,0,2); ids->setIJ(1,0,5); ids->setIJ(2,0,4); CPPUNIT_ASSERT_THROW(dac->setContigPartOfSelectedValues(1,da2,ids),INTERP_KERNEL::Exception); ids->setIJ(0,0,2); ids->setIJ(1,0,2); ids->setIJ(2,0,-1); @@ -412,7 +412,7 @@ void MEDCouplingBasicsTest5::testDataArrayDoubleAdvSetting1() dac->decrRef(); // ids->setIJ(0,0,2); ids->setIJ(1,0,2); ids->setIJ(2,0,1); - dac=da->deepCpy(); + dac=da->deepCopy(); dac->setContigPartOfSelectedValues(4,da2,ids); const double expected6[14]={1.,11.,2.,12.,3.,13.,4.,14.,0.,30.,0.,30.,9.,39.}; for(int i=0;i<14;i++) @@ -469,18 +469,18 @@ void MEDCouplingBasicsTest5::testDataArrayIntAdvSetting1() da2->alloc(5,2); std::copy(data2,data2+10,da2->getPointer()); // - DataArrayInt *dac=da->deepCpy(); - dac->setContigPartOfSelectedValues2(1,da2,2,4,1); + DataArrayInt *dac=da->deepCopy(); + dac->setContigPartOfSelectedValuesSlice(1,da2,2,4,1); const int expected3[14]={1,11,0,30,11,41,4,14,5,15,6,16,7,17}; for(int i=0;i<14;i++) CPPUNIT_ASSERT_EQUAL(expected3[i],dac->getIJ(0,i)); dac->decrRef(); // - dac=da->deepCpy(); - CPPUNIT_ASSERT_THROW(dac->setContigPartOfSelectedValues2(3,da2,0,5,1),INTERP_KERNEL::Exception); - CPPUNIT_ASSERT_THROW(dac->setContigPartOfSelectedValues2(0,da2,4,6,1),INTERP_KERNEL::Exception); - CPPUNIT_ASSERT_THROW(dac->setContigPartOfSelectedValues2(3,da2,5,0,1),INTERP_KERNEL::Exception); - dac->setContigPartOfSelectedValues2(3,da2,1,5,1); + dac=da->deepCopy(); + CPPUNIT_ASSERT_THROW(dac->setContigPartOfSelectedValuesSlice(3,da2,0,5,1),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(dac->setContigPartOfSelectedValuesSlice(0,da2,4,6,1),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(dac->setContigPartOfSelectedValuesSlice(3,da2,5,0,1),INTERP_KERNEL::Exception); + dac->setContigPartOfSelectedValuesSlice(3,da2,1,5,1); const int expected4[14]={1,11,2,12,3,13,9,39,0,30,11,41,12,42}; for(int i=0;i<14;i++) CPPUNIT_ASSERT_EQUAL(expected4[i],dac->getIJ(0,i)); @@ -488,7 +488,7 @@ void MEDCouplingBasicsTest5::testDataArrayIntAdvSetting1() // DataArrayInt *ids=DataArrayInt::New(); ids->alloc(3,1); - dac=da->deepCpy(); + dac=da->deepCopy(); ids->setIJ(0,0,2); ids->setIJ(1,0,0); ids->setIJ(2,0,4); dac->setContigPartOfSelectedValues(2,da2,ids); const int expected5[14]={1,11,2,12,0,30,8,38,12,42,6,16,7,17}; @@ -496,7 +496,7 @@ void MEDCouplingBasicsTest5::testDataArrayIntAdvSetting1() CPPUNIT_ASSERT_EQUAL(expected5[i],dac->getIJ(0,i)); dac->decrRef(); // - dac=da->deepCpy(); + dac=da->deepCopy(); ids->setIJ(0,0,2); ids->setIJ(1,0,5); ids->setIJ(2,0,4); CPPUNIT_ASSERT_THROW(dac->setContigPartOfSelectedValues(1,da2,ids),INTERP_KERNEL::Exception); ids->setIJ(0,0,2); ids->setIJ(1,0,2); ids->setIJ(2,0,-1); @@ -506,7 +506,7 @@ void MEDCouplingBasicsTest5::testDataArrayIntAdvSetting1() dac->decrRef(); // ids->setIJ(0,0,2); ids->setIJ(1,0,2); ids->setIJ(2,0,1); - dac=da->deepCpy(); + dac=da->deepCopy(); dac->setContigPartOfSelectedValues(4,da2,ids); const int expected6[14]={1,11,2,12,3,13,4,14,0,30,0,30,9,39}; for(int i=0;i<14;i++) @@ -527,7 +527,7 @@ void MEDCouplingBasicsTest5::testBuildDescendingConnec2Of3DMesh1() DataArrayInt *revDescIndx=DataArrayInt::New(); // MEDCouplingUMesh *mesh2=mesh->buildDescendingConnectivity2(desc,descIndx,revDesc,revDescIndx); - mesh2->checkCoherency(); + mesh2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(2,mesh2->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(30,mesh2->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL((std::size_t)31,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(31,revDescIndx->getNumberOfTuples()); @@ -578,7 +578,7 @@ void MEDCouplingBasicsTest5::testAre2DCellsNotCorrectlyOriented1() { vec2[0]=3.*cos(M_PI/9.*i); vec2[1]=3.*sin(M_PI/9.*i); - MEDCouplingUMesh *m1Cpy=static_cast(m1->deepCpy()); + MEDCouplingUMesh *m1Cpy=static_cast(m1->deepCopy()); m1Cpy->translate(vec2); std::vector res; CPPUNIT_ASSERT_THROW(m1Cpy->are2DCellsNotCorrectlyOriented(vec1,false,res),INTERP_KERNEL::Exception); @@ -722,7 +722,7 @@ void MEDCouplingBasicsTest5::testRenumberNodesInConn1() std::copy(mesh2DCoords,mesh2DCoords+27,myCoords->getPointer()); mesh2D->setCoords(myCoords); myCoords->decrRef(); - mesh2D->checkCoherency(); + mesh2D->checkConsistencyLight(); // double mesh3DCoords[24]={-0.3,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., 0.2,-0.3,0., -0.3,-0.3,1., -0.3,0.2,1., 0.2,0.2,1., 0.2,-0.3,1. }; int mesh3DConn[8]={0,1,2,3,4,5,6,7}; @@ -735,12 +735,12 @@ void MEDCouplingBasicsTest5::testRenumberNodesInConn1() std::copy(mesh3DCoords,mesh3DCoords+24,myCoords3D->getPointer()); mesh3D->setCoords(myCoords3D); myCoords3D->decrRef(); - mesh3D->checkCoherency(); + mesh3D->checkConsistencyLight(); // - MEDCouplingUMesh *mesh3D_2=dynamic_cast(mesh3D->deepCpy()); - MEDCouplingUMesh *mesh2D_2=dynamic_cast(mesh2D->deepCpy()); - MEDCouplingUMesh *mesh3D_4=dynamic_cast(mesh3D->deepCpy()); - MEDCouplingUMesh *mesh2D_4=dynamic_cast(mesh2D->deepCpy()); + MEDCouplingUMesh *mesh3D_2=dynamic_cast(mesh3D->deepCopy()); + MEDCouplingUMesh *mesh2D_2=dynamic_cast(mesh2D->deepCopy()); + MEDCouplingUMesh *mesh3D_4=dynamic_cast(mesh3D->deepCopy()); + MEDCouplingUMesh *mesh2D_4=dynamic_cast(mesh2D->deepCopy()); DataArrayInt *renumNodes=DataArrayInt::New(); int oldNbOf3DNodes=mesh3D->getNumberOfNodes(); renumNodes->alloc(mesh2D->getNumberOfNodes(),1); @@ -749,7 +749,7 @@ void MEDCouplingBasicsTest5::testRenumberNodesInConn1() mesh3D->setCoords(coo); mesh2D->setCoords(coo); coo->decrRef(); - MEDCouplingUMesh *mesh2D_3=dynamic_cast(mesh2D->deepCpy()); + MEDCouplingUMesh *mesh2D_3=dynamic_cast(mesh2D->deepCopy()); mesh2D_3->shiftNodeNumbersInConn(oldNbOf3DNodes); mesh2D->renumberNodesInConn(renumNodes->getConstPointer()); renumNodes->decrRef(); @@ -775,14 +775,14 @@ void MEDCouplingBasicsTest5::testRenumberNodesInConn1() da2->decrRef(); // const double vect[3]={1.,0.,0.}; - MEDCouplingUMesh *mesh2D_5=dynamic_cast(mesh2D_4->deepCpy()); + MEDCouplingUMesh *mesh2D_5=dynamic_cast(mesh2D_4->deepCopy()); mesh2D_5->translate(vect); std::vector meshes(3); meshes[0]=mesh3D_4; meshes[1]=mesh2D_4; meshes[2]=mesh2D_5; MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes); CPPUNIT_ASSERT(mesh3D_4->getCoords()==mesh2D_4->getCoords()); CPPUNIT_ASSERT(mesh2D_4->getCoords()==mesh2D_5->getCoords()); - mesh3D_4->checkCoherency(); mesh2D_4->checkCoherency(); mesh2D_5->checkCoherency(); + mesh3D_4->checkConsistencyLight(); mesh2D_4->checkConsistencyLight(); mesh2D_5->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(26,mesh3D_4->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(3,mesh3D_4->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(9,mesh3D_4->getNodalConnectivity()->getNumberOfTuples()); @@ -799,7 +799,7 @@ void MEDCouplingBasicsTest5::testRenumberNodesInConn1() CPPUNIT_ASSERT_DOUBLES_EQUAL(expected5[i],mesh3D_4->getCoords()->getIJ(0,i),1e-12); // MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,1e-12); - mesh3D_4->checkCoherency(); mesh2D_4->checkCoherency(); mesh2D_5->checkCoherency(); + mesh3D_4->checkConsistencyLight(); mesh2D_4->checkConsistencyLight(); mesh2D_5->checkConsistencyLight(); CPPUNIT_ASSERT(mesh3D_4->getCoords()==mesh2D_4->getCoords()); CPPUNIT_ASSERT(mesh2D_4->getCoords()==mesh2D_5->getCoords()); CPPUNIT_ASSERT_EQUAL(19,mesh3D_4->getNumberOfNodes()); @@ -858,7 +858,7 @@ void MEDCouplingBasicsTest5::testCheckButterflyCellsBug1() std::copy(mesh2DCoords,mesh2DCoords+10,myCoords->getPointer()); mesh2D->setCoords(myCoords); myCoords->decrRef(); - mesh2D->checkCoherency(); + mesh2D->checkConsistencyLight(); // std::vector v; mesh2D->checkButterflyCells(v); @@ -1115,10 +1115,10 @@ void MEDCouplingBasicsTest5::testConvexEnvelop2D1() std::copy(coords,coords+662,coordsDa->getPointer()); m->setCoords(coordsDa); coordsDa->decrRef(); - m->checkCoherency(); + m->checkConsistencyLight(); // DataArrayInt *da=m->convexEnvelop2D(); - m->checkCoherency(); + m->checkConsistencyLight(); CPPUNIT_ASSERT(coordsDa==m->getCoords()); DataArrayInt *daC=da->buildComplement(331); da->decrRef(); @@ -1138,8 +1138,8 @@ void MEDCouplingBasicsTest5::testConvexEnvelop2D1() vals->substractEqual(ref2); ref2->decrRef(); vals->abs(); - DataArrayInt *theTest=vals->getIdsInRange(-1.,1e-7); - CPPUNIT_ASSERT(theTest->isIdentity2(331)); + DataArrayInt *theTest=vals->findIdsInRange(-1.,1e-7); + CPPUNIT_ASSERT(theTest->isIota(331)); theTest->decrRef(); valsF->decrRef(); // @@ -1157,8 +1157,8 @@ void MEDCouplingBasicsTest5::testDataArraySort1() CPPUNIT_ASSERT_THROW(arr->sort(false),INTERP_KERNEL::Exception);//no one component arr->rearrange(1); std::copy(values,values+6,arr->getPointer()); - DataArrayInt *arr1=arr->deepCpy(); - DataArrayInt *arr2=arr->deepCpy(); + DataArrayInt *arr1=arr->deepCopy(); + DataArrayInt *arr2=arr->deepCopy(); arr1->sort(true); const int expected1[6]={1,2,4,5,6,7}; CPPUNIT_ASSERT_EQUAL(6,arr1->getNumberOfTuples()); @@ -1182,8 +1182,8 @@ void MEDCouplingBasicsTest5::testDataArraySort1() CPPUNIT_ASSERT_THROW(ard->sort(false),INTERP_KERNEL::Exception);//no one component ard->rearrange(1); std::copy(valuesD,valuesD+6,ard->getPointer()); - DataArrayDouble *ard1=ard->deepCpy(); - DataArrayDouble *ard2=ard->deepCpy(); + DataArrayDouble *ard1=ard->deepCopy(); + DataArrayDouble *ard2=ard->deepCopy(); ard1->sort(true); const double expected3[6]={1.,2.,4.,5.,6.,7.}; CPPUNIT_ASSERT_EQUAL(6,ard1->getNumberOfTuples()); @@ -1293,7 +1293,7 @@ void MEDCouplingBasicsTest5::testBuildSlice3D2() DataArrayDouble *arr=DataArrayDouble::New(); arr->alloc(mesh3D->getNumberOfCells(),2); arr->rearrange(1); arr->iota(2.); arr->rearrange(2); f->setArray(arr); - f->checkCoherency(); + f->checkConsistencyLight(); const int exp1[9]={1,3,4,7,9,10,13,15,16}; DataArrayInt *expected1=DataArrayInt::New(); expected1->alloc(9,1); std::copy(exp1,exp1+9,expected1->getPointer()); CPPUNIT_ASSERT(expected1->isEqual(*ids)); @@ -1328,9 +1328,9 @@ void MEDCouplingBasicsTest5::testComputeTupleIdsToSelectFromCellIds1() // const int subPart1[3]={1,5,9}; MEDCouplingFieldDouble *f2=f->buildSubPart(subPart1,subPart1+3); - f2->checkCoherency(); + f2->checkConsistencyLight(); DataArrayInt *cI=m->computeNbOfNodesPerCell(); - cI->computeOffsets2(); + cI->computeOffsetsFull(); const int sel1[3]={1,5,9}; DataArrayInt *sel=DataArrayInt::New(); sel->useArray(sel1,false,CPP_DEALLOC,3,1); DataArrayInt *res=sel->buildExplicitArrByRanges(cI); @@ -1378,7 +1378,7 @@ void MEDCouplingBasicsTest5::testComputeSkin1() MEDCouplingUMesh *part=dynamic_cast(umesh->buildFacePartOfMySelfNode(ids->begin(),ids->end(),true)); part->setName(skin->getName().c_str()); CPPUNIT_ASSERT(part->isEqual(skin,1e-12)); - MEDCouplingUMesh *part2=dynamic_cast(part->buildPartOfMySelf2(1,18,2,true)); + MEDCouplingUMesh *part2=dynamic_cast(part->buildPartOfMySelfSlice(1,18,2,true)); DataArrayInt *ids2=DataArrayInt::Range(0,18,2); part->setPartOfMySelf(ids2->begin(),ids2->end(),*part2); ids2->decrRef(); @@ -1434,8 +1434,8 @@ void MEDCouplingBasicsTest5::testUMeshSetPartOfMySelf2() m->decrRef(); part->decrRef(); // resize with range ids m=build2DTargetMesh_1(); - part=static_cast(m->buildPartOfMySelf2(3,5,1,true)); - m->setPartOfMySelf2(1,3,1,*part); + part=static_cast(m->buildPartOfMySelfSlice(3,5,1,true)); + m->setPartOfMySelfSlice(1,3,1,*part); const int expected5[25]={4,0,3,4,1,4,6,7,4,3,4,7,8,5,4,4,6,7,4,3,4,7,8,5,4}; CPPUNIT_ASSERT(std::equal(expected5,expected5+25,m->getNodalConnectivity()->getConstPointer())); CPPUNIT_ASSERT_EQUAL((std::size_t)25,m->getNodalConnectivity()->getNbOfElems()); @@ -1447,9 +1447,9 @@ void MEDCouplingBasicsTest5::testUMeshSetPartOfMySelf2() m->decrRef(); part->decrRef(); // no resize with range ids m=build2DTargetMesh_1(); - part=static_cast(m->buildPartOfMySelf2(0,5,3,true)); + part=static_cast(m->buildPartOfMySelfSlice(0,5,3,true)); part->convertAllToPoly(); - m->setPartOfMySelf2(3,5,1,*part); + m->setPartOfMySelfSlice(3,5,1,*part); const int expected7[23]={4,0,3,4,1,3,1,4,2,3,4,5,2,5,0,3,4,1,5,6,7,4,3}; CPPUNIT_ASSERT(std::equal(expected7,expected7+23,m->getNodalConnectivity()->getConstPointer())); CPPUNIT_ASSERT_EQUAL((std::size_t)23,m->getNodalConnectivity()->getNbOfElems()); @@ -1461,9 +1461,9 @@ s.clear(); s.insert(INTERP_KERNEL::NORM_TRI3); s.insert(INTERP_KERNEL::NORM_QUAD m->decrRef(); part->decrRef(); // no resize with range ids negative direction m=build2DTargetMesh_1(); - part=static_cast(m->buildPartOfMySelf2(3,-1,-3,true)); + part=static_cast(m->buildPartOfMySelfSlice(3,-1,-3,true)); part->convertAllToPoly(); - m->setPartOfMySelf2(4,2,-1,*part); + m->setPartOfMySelfSlice(4,2,-1,*part); const int expected9[23]={4,0,3,4,1,3,1,4,2,3,4,5,2,5,0,3,4,1,5,6,7,4,3}; CPPUNIT_ASSERT(std::equal(expected9,expected9+23,m->getNodalConnectivity()->getConstPointer())); CPPUNIT_ASSERT_EQUAL((std::size_t)23,m->getNodalConnectivity()->getNbOfElems()); @@ -1489,7 +1489,7 @@ void MEDCouplingBasicsTest5::testUnPolyze3() std::copy(coord,coord+18,coords->getPointer()); m->setCoords(coords); coords->decrRef(); - m->checkCoherency(); + m->checkConsistencyLight(); // MEDCouplingFieldDouble *vol=m->getMeasureField(ON_CELLS); CPPUNIT_ASSERT_EQUAL(1,vol->getArray()->getNumberOfTuples()); @@ -1536,7 +1536,7 @@ void MEDCouplingBasicsTest5::testKrSpatialDiscretization1() srcVals->alloc(nbOfInputPoints,1); std::copy(srcFieldValsOnPoints,srcFieldValsOnPoints+nbOfInputPoints,srcVals->getPointer()); f->setArray(srcVals); - f->checkCoherency(); + f->checkConsistencyLight(); // double *res0=new double[1]; f->getValueOn(targetPointCoordsX,res0); @@ -2002,11 +2002,11 @@ void MEDCouplingBasicsTest5::testSimplexize3() c->useArray(coords,false,CPP_DEALLOC,24,3); m->setCoords(c); c->decrRef(); - m->checkCoherency1(); + m->checkConsistency(); // - MEDCouplingUMesh *m1=static_cast(m->deepCpy()); + MEDCouplingUMesh *m1=static_cast(m->deepCopy()); DataArrayInt *d1=m1->simplexize(INTERP_KERNEL::PLANAR_FACE_5); - m1->checkCoherency1(); + m1->checkConsistency(); MEDCouplingFieldDouble *f1=m1->getMeasureField(ON_CELLS); const double vol1Expected[12]={1./6, 1./6, 1./6,1./6, 1./6, 1./3,1./6, 1./6, 1./6, 1./6, 1./3, 1./6}; CPPUNIT_ASSERT_EQUAL(1,f1->getArray()->getNumberOfComponents()); @@ -2029,9 +2029,9 @@ void MEDCouplingBasicsTest5::testSimplexize3() m1->decrRef(); d1->decrRef(); // - MEDCouplingUMesh *m2=static_cast(m->deepCpy()); + MEDCouplingUMesh *m2=static_cast(m->deepCopy()); DataArrayInt *d2=m2->simplexize(INTERP_KERNEL::PLANAR_FACE_6); - m2->checkCoherency1(); + m2->checkConsistency(); MEDCouplingFieldDouble *f2=m2->getMeasureField(ON_CELLS); const double vol2Expected[14]={1./6, 1./6, 1./6,1./6, 1./6, 1./6,1./6,1./6, 1./6, 1./6, 1./6, 1./6,1./6,1./6}; CPPUNIT_ASSERT_EQUAL(1,f2->getArray()->getNumberOfComponents()); diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx index 8a78447f1..0d6655881 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx @@ -20,7 +20,7 @@ #include "MEDCouplingBasicsTestInterp.hxx" #include "MEDCouplingUMesh.hxx" -#include "MEDCouplingExtrudedMesh.hxx" +#include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingMemArray.hxx" #include "Interpolation2D.txx" diff --git a/src/MEDCoupling/Test/MEDCouplingExamplesTest.cxx b/src/MEDCoupling/Test/MEDCouplingExamplesTest.cxx index b47469267..95dd13578 100644 --- a/src/MEDCoupling/Test/MEDCouplingExamplesTest.cxx +++ b/src/MEDCoupling/Test/MEDCouplingExamplesTest.cxx @@ -21,7 +21,7 @@ #include "MEDCouplingBasicsTest.hxx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingCMesh.hxx" -#include "MEDCouplingExtrudedMesh.hxx" +#include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingMemArray.hxx" #include "MEDCouplingMultiFields.hxx" @@ -33,17 +33,17 @@ void CppExample_MEDCouplingFieldDouble_WriteVTK() //! [CppSnippet_MEDCouplingFieldDouble_WriteVTK_1] // mesh1 const double coords[3] = {0.,2.,4.}; - MEDCouplingAutoRefCountObjectPtr coordsArr = DataArrayDouble::New(); + MCAuto coordsArr = DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess( coords, 3, 1 ); - MEDCouplingAutoRefCountObjectPtr mesh1 = MEDCouplingCMesh::New(); + MCAuto mesh1 = MEDCouplingCMesh::New(); mesh1->setCoords(coordsArr,coordsArr); // mesh becomes a 2D one // 3 fields (lying on the same mesh!) - MEDCouplingAutoRefCountObjectPtr field1 = + MCAuto field1 = mesh1->getMeasureField( true ); - MEDCouplingAutoRefCountObjectPtr field2 = + MCAuto field2 = mesh1->buildOrthogonalField(); - MEDCouplingAutoRefCountObjectPtr field3 = + MCAuto field3 = mesh1->fillFromAnalytic( ON_CELLS, 1, "x"); field2->setName( "Normal" ); // name is necessary! field3->setName( "Barycenter" ); // name is necessary! @@ -68,20 +68,20 @@ void CppExample_MEDCouplingFieldDouble_MaxFields() const double valsMax[4] = {2.,2., 6.,6.}; // expected max field const double valsMin[4] = {0.,0., 4.,4.}; // expected min field // field 1 - MEDCouplingAutoRefCountObjectPtr valsArr1 = DataArrayDouble::New(); + MCAuto valsArr1 = DataArrayDouble::New(); valsArr1->useExternalArrayWithRWAccess( vals1, 2,2 ); // 2 tuples per 2 components - MEDCouplingAutoRefCountObjectPtr field1 = MEDCouplingFieldDouble::New( ON_NODES ); + MCAuto field1 = MEDCouplingFieldDouble::New( ON_NODES ); field1->setArray( valsArr1 ); // field 2 - MEDCouplingAutoRefCountObjectPtr valsArr2 = DataArrayDouble::New(); + MCAuto valsArr2 = DataArrayDouble::New(); valsArr2->useExternalArrayWithRWAccess( vals2, 2,2 ); // 2 tuples per 2 components - MEDCouplingAutoRefCountObjectPtr field2 = MEDCouplingFieldDouble::New( ON_NODES ); + MCAuto field2 = MEDCouplingFieldDouble::New( ON_NODES ); field2->setArray( valsArr2 ); // max field - MEDCouplingAutoRefCountObjectPtr fieldMax = MEDCouplingFieldDouble::MaxFields( field1, field2 ); + MCAuto fieldMax = MEDCouplingFieldDouble::MaxFields( field1, field2 ); CPPUNIT_ASSERT( std::equal( valsMax, valsMax+4, fieldMax->getArray()->getConstPointer() )); // fieldMax == valsMax // min field - MEDCouplingAutoRefCountObjectPtr fieldMin = MEDCouplingFieldDouble::MinFields( field1, field2 ); + MCAuto fieldMin = MEDCouplingFieldDouble::MinFields( field1, field2 ); CPPUNIT_ASSERT( std::equal( valsMin, valsMin+4, fieldMin->getArray()->getConstPointer() )); // fieldMin == valsMin //! [CppSnippet_MEDCouplingFieldDouble_MaxFields_1] } @@ -92,28 +92,28 @@ void CppExample_MEDCouplingFieldDouble_MergeFields() //! [CppSnippet_MEDCouplingFieldDouble_MergeFields_1] // mesh1 const double coords[3] = {0.,2.,4.}; - MEDCouplingAutoRefCountObjectPtr coordsArr = DataArrayDouble::New(); + MCAuto coordsArr = DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess( coords, 3, 1 ); - MEDCouplingAutoRefCountObjectPtr mesh1 = MEDCouplingCMesh::New(); + MCAuto mesh1 = MEDCouplingCMesh::New(); mesh1->setCoords(coordsArr); // mesh becomes a 1D // field1 - MEDCouplingAutoRefCountObjectPtr field1 = + MCAuto field1 = mesh1->fillFromAnalytic( ON_CELLS, 1, "x"); // mesh2 and field2 - MEDCouplingAutoRefCountObjectPtr field2 = + MCAuto field2 = field1->cloneWithMesh( true ); double vec[1] = { 5. }; (const_cast(field2->getMesh()))->translate(vec); // translate mesh2 field2->applyFunc("x + 5"); // "translate" field2 // concatenate field1 and field2 - MEDCouplingAutoRefCountObjectPtr field3 = + MCAuto field3 = MEDCouplingFieldDouble::MergeFields( field1, field2 ); std::vector fields( 2 ); fields[0] = field1; fields[1] = field2; - MEDCouplingAutoRefCountObjectPtr field4 = + MCAuto field4 = MEDCouplingFieldDouble::MergeFields( fields ); //! [CppSnippet_MEDCouplingFieldDouble_MergeFields_1] } @@ -125,22 +125,22 @@ void CppExample_MEDCouplingFieldDouble_substractInPlaceDM() const double coords1[4] = {0.,1.,2.,3.}; const double coords2[4] = {2.,1.,0.,3.}; // #0 <==> #2 // mesh 1 - MEDCouplingAutoRefCountObjectPtr mesh1 = MEDCouplingUMesh::New(); - MEDCouplingAutoRefCountObjectPtr coordsArr = DataArrayDouble::New(); + MCAuto mesh1 = MEDCouplingUMesh::New(); + MCAuto coordsArr = DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess( coords1, 4, 1 ); mesh1->setCoords(coordsArr); mesh1->setMeshDimension(0); mesh1->allocateCells(0); mesh1->finishInsertingCells(); // mesh 2 - MEDCouplingAutoRefCountObjectPtr mesh2 = - (MEDCouplingUMesh*) mesh1->deepCpy(); + MCAuto mesh2 = + (MEDCouplingUMesh*) mesh1->deepCopy(); mesh2->getCoords()->useExternalArrayWithRWAccess( coords2, 4, 1 ); //! [CppSnippet_MEDCouplingFieldDouble_substractInPlaceDM_1] //! [CppSnippet_MEDCouplingFieldDouble_substractInPlaceDM_2] - MEDCouplingAutoRefCountObjectPtr field1 = + MCAuto field1 = mesh1->fillFromAnalytic( MEDCoupling::ON_NODES,1,"x"); // field1 values == coords1 - MEDCouplingAutoRefCountObjectPtr field2 = + MCAuto field2 = mesh2->fillFromAnalytic( MEDCoupling::ON_NODES,1,"x"); // field2 values == coords2 const double levOfCheck = 10; // nodes can be permuted field1->substractInPlaceDM( field2, levOfCheck, 1e-13, 0 ); // values #0 and #2 must swap @@ -158,20 +158,20 @@ void CppExample_MEDCouplingFieldDouble_changeUnderlyingMesh() const double coords1[4] = {0.,1.,2.,3.}; const double coords2[4] = {2.,1.,0.,3.}; // #0 <==> #2 // mesh 1 - MEDCouplingAutoRefCountObjectPtr mesh1 = MEDCouplingUMesh::New(); - MEDCouplingAutoRefCountObjectPtr coordsArr = DataArrayDouble::New(); + MCAuto mesh1 = MEDCouplingUMesh::New(); + MCAuto coordsArr = DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess( coords1, 4, 1 ); mesh1->setCoords(coordsArr); mesh1->setMeshDimension(0); mesh1->allocateCells(0); mesh1->finishInsertingCells(); // mesh 2 - MEDCouplingAutoRefCountObjectPtr mesh2 = - (MEDCouplingUMesh*) mesh1->deepCpy(); + MCAuto mesh2 = + (MEDCouplingUMesh*) mesh1->deepCopy(); mesh2->getCoords()->useExternalArrayWithRWAccess( coords2, 4, 1 ); //! [CppSnippet_MEDCouplingFieldDouble_changeUnderlyingMesh_1] //! [CppSnippet_MEDCouplingFieldDouble_changeUnderlyingMesh_2] - MEDCouplingAutoRefCountObjectPtr field = + MCAuto field = mesh1->fillFromAnalytic( MEDCoupling::ON_NODES,1,"x"); // field values == coords1 const double levOfCheck = 10; // nodes can be permuted field->changeUnderlyingMesh( mesh2, levOfCheck, 1e-13, 0 ); // values #0 and #2 must swap @@ -184,9 +184,9 @@ void CppExample_MEDCouplingFieldDouble_applyFunc_same_nb_comp() using namespace MEDCoupling; //! [CppSnippet_MEDCouplingFieldDouble_applyFunc_same_nb_comp_1] const double v[4] = {1.,2., 3.,4.}; - MEDCouplingAutoRefCountObjectPtr array = DataArrayDouble::New(); + MCAuto array = DataArrayDouble::New(); array->useExternalArrayWithRWAccess( v, 2, 2 ); // 2 tuples per 2 components - MEDCouplingAutoRefCountObjectPtr field = + MCAuto field = MEDCouplingFieldDouble::New( MEDCoupling::ON_CELLS ); field->setArray( array ); const char func[] = "IVec * v + JVec * w*w + 10"; @@ -208,16 +208,16 @@ void CppExample_MEDCouplingFieldDouble_applyFunc3() //! [CppSnippet_MEDCouplingFieldDouble_applyFunc3_1] // create a 2D vector field const double values[4] = {1.,1., 2.,1.}; - MEDCouplingAutoRefCountObjectPtr array = DataArrayDouble::New(); + MCAuto array = DataArrayDouble::New(); array->useExternalArrayWithRWAccess( values, 2, 2 ); // 2 tuples per 2 components - MEDCouplingAutoRefCountObjectPtr field = + MCAuto field = MEDCouplingFieldDouble::New( MEDCoupling::ON_CELLS ); field->setArray( array ); // transform the field to a 3D vector field const char func[] = "IVec * b + JVec * a + KVec * sqrt( a*a + b*b ) + 10"; const char* varNames[2] = { "a", "b" }; // names used to refer to X and Y components std::vector varNamesVec( varNames, varNames+2 ); - field->applyFunc3( 3, varNamesVec, func ); // require 3 components + field->applyFuncNamedCompo( 3, varNamesVec, func ); // require 3 components CPPUNIT_ASSERT( field->getNumberOfComponents() == 3 ); // 3 components as required //! [CppSnippet_MEDCouplingFieldDouble_applyFunc3_1] //! [CppSnippet_MEDCouplingFieldDouble_applyFunc3_2] @@ -236,16 +236,16 @@ void CppExample_MEDCouplingFieldDouble_applyFunc2() //! [CppSnippet_MEDCouplingFieldDouble_applyFunc2_1] // create a 2D vector field const double values[4] = {1.,1., 2.,1.}; - MEDCouplingAutoRefCountObjectPtr array = DataArrayDouble::New(); + MCAuto array = DataArrayDouble::New(); array->useExternalArrayWithRWAccess( values, 2, 2 ); // 2 tuples per 2 components array->setInfoOnComponent(0,"a"); // name used to refer to X component within a function array->setInfoOnComponent(1,"b"); // name used to refer to Y component within a function - MEDCouplingAutoRefCountObjectPtr field = + MCAuto field = MEDCouplingFieldDouble::New( MEDCoupling::ON_CELLS ); field->setArray( array ); // transform the field to a 3D vector field const char func[] = "IVec * b + JVec * a + KVec * sqrt( a*a + b*b ) + 10"; - field->applyFunc2( 3, func ); // require 3 components + field->applyFuncCompo( 3, func ); // require 3 components CPPUNIT_ASSERT( field->getNumberOfComponents() == 3 ); // 3 components as required //! [CppSnippet_MEDCouplingFieldDouble_applyFunc2_1] //! [CppSnippet_MEDCouplingFieldDouble_applyFunc2_2] @@ -264,9 +264,9 @@ void CppExample_MEDCouplingFieldDouble_applyFunc() //! [CppSnippet_MEDCouplingFieldDouble_applyFunc_1] // create a 2D vector field const double values[4] = {1.,1., 2.,1.}; - MEDCouplingAutoRefCountObjectPtr array = DataArrayDouble::New(); + MCAuto array = DataArrayDouble::New(); array->useExternalArrayWithRWAccess( values, 2, 2 ); // 2 tuples per 2 components - MEDCouplingAutoRefCountObjectPtr field = + MCAuto field = MEDCouplingFieldDouble::New( MEDCoupling::ON_CELLS ); field->setArray( array ); // transform the field to a 3D vector field @@ -290,12 +290,12 @@ void CppExample_MEDCouplingFieldDouble_applyFunc_val() //! [Snippet_MEDCouplingFieldDouble_applyFunc_val_1] // mesh const double coords[4] = {0.,2.,4.}; - MEDCouplingAutoRefCountObjectPtr coordsArr = DataArrayDouble::New(); + MCAuto coordsArr = DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess( coords, 3, 1 ); - MEDCouplingAutoRefCountObjectPtr mesh = MEDCouplingCMesh::New(); + MCAuto mesh = MEDCouplingCMesh::New(); mesh->setCoords(coordsArr,coordsArr); // mesh becomes a 2D structured mesh // field - MEDCouplingAutoRefCountObjectPtr field = + MCAuto field = MEDCouplingFieldDouble::New( MEDCoupling::ON_CELLS ); field->setMesh( mesh ); field->fillFromAnalytic(2,"IVec * x + JVec * y"); // 2 components @@ -314,29 +314,29 @@ void CppExample_MEDCouplingFieldDouble_fillFromAnalytic3() using namespace MEDCoupling; //! [CppSnippet_MEDCouplingFieldDouble_fillFromAnalytic3_1] const double coords[4] = {0.,2.,4.,6.}; // 6. is not used - MEDCouplingAutoRefCountObjectPtr x = DataArrayDouble::New(); + MCAuto x = DataArrayDouble::New(); x->useExternalArrayWithRWAccess( coords, 3, 1 ); - MEDCouplingAutoRefCountObjectPtr y = DataArrayDouble::New(); + MCAuto y = DataArrayDouble::New(); y->useExternalArrayWithRWAccess( coords, 2, 1 ); - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingCMesh::New(); + MCAuto mesh=MEDCouplingCMesh::New(); mesh->setCoords(x,y); //! [CppSnippet_MEDCouplingFieldDouble_fillFromAnalytic3_1] //! [CppSnippet_MEDCouplingFieldDouble_fillFromAnalytic3_2] - MEDCouplingAutoRefCountObjectPtr field = + MCAuto field = MEDCouplingFieldDouble::New( MEDCoupling::ON_CELLS ); field->setMesh( mesh ); const char func[] = "IVec * b + JVec * a + KVec * sqrt( a*a + b*b ) + 10"; const char* varNames[2] = { "a", "b" }; // names used to refer to X and Y coord components std::vector varNamesVec( varNames, varNames+2 ); - field->fillFromAnalytic3( 3, varNamesVec, func ); + field->fillFromAnalyticNamedCompo( 3, varNamesVec, func ); //! [CppSnippet_MEDCouplingFieldDouble_fillFromAnalytic3_2] //! [CppSnippet_MEDCouplingFieldDouble_fillFromAnalytic3_3] double val1[3]; // a value (vector) of the cell #1 CPPUNIT_ASSERT( field->getNumberOfComponents() == 3 ); // 3 components in the field field->getArray()->getTuple( 1, val1 ); // - MEDCouplingAutoRefCountObjectPtr bc = - mesh->getBarycenterAndOwner(); // func is applied to barycenters of cells + MCAuto bc = + mesh->computeCellCenterOfMass(); // func is applied to barycenters of cells double bc1[2]; // coordinates of the second point bc->getTuple( 1, bc1 ); // @@ -352,17 +352,17 @@ void CppExample_MEDCouplingFieldDouble_fillFromAnalytic2() using namespace MEDCoupling; //! [CppSnippet_MEDCouplingFieldDouble_fillFromAnalytic2_1] const double coords[4] = {0.,2.,4.}; - MEDCouplingAutoRefCountObjectPtr x = DataArrayDouble::New(); + MCAuto x = DataArrayDouble::New(); x->useExternalArrayWithRWAccess( coords, 3, 1 ); - MEDCouplingAutoRefCountObjectPtr y = DataArrayDouble::New(); + MCAuto y = DataArrayDouble::New(); y->useExternalArrayWithRWAccess( coords, 2, 1 ); x->setInfoOnComponent(0,"a"); // name used to refer to X coordinate within a function y->setInfoOnComponent(0,"b"); // name used to refer to Y coordinate within a function - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingCMesh::New(); + MCAuto mesh=MEDCouplingCMesh::New(); mesh->setCoords(x,y); //! [CppSnippet_MEDCouplingFieldDouble_fillFromAnalytic2_1] //! [CppSnippet_MEDCouplingFieldDouble_fillFromAnalytic2_2] - MEDCouplingAutoRefCountObjectPtr field = + MCAuto field = MEDCouplingFieldDouble::New( MEDCoupling::ON_CELLS ); field->setMesh( mesh ); const char func[] = "IVec * b + JVec * a + KVec * sqrt( a*a + b*b ) + 10"; @@ -373,8 +373,8 @@ void CppExample_MEDCouplingFieldDouble_fillFromAnalytic2() CPPUNIT_ASSERT( field->getNumberOfComponents() == 3 ); // 3 components in the field field->getArray()->getTuple( 1, val1 ); // - MEDCouplingAutoRefCountObjectPtr bc = - mesh->getBarycenterAndOwner(); // func is applied to barycenters of cells + MCAuto bc = + mesh->computeCellCenterOfMass(); // func is applied to barycenters of cells double bc1[2]; // coordinates of the second point bc->getTuple( 1, bc1 ); // @@ -390,16 +390,16 @@ void CppExample_MEDCouplingFieldDouble_fillFromAnalytic() using namespace MEDCoupling; //! [CppSnippet_MEDCouplingFieldDouble_fillFromAnalytic_1] const double coords[3] = {0.,2.,4}; - MEDCouplingAutoRefCountObjectPtr x = DataArrayDouble::New(); + MCAuto x = DataArrayDouble::New(); x->useExternalArrayWithRWAccess( coords, 3, 1 ); - MEDCouplingAutoRefCountObjectPtr y = DataArrayDouble::New(); + MCAuto y = DataArrayDouble::New(); y->useExternalArrayWithRWAccess( coords, 2, 1 ); - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingCMesh::New(); + MCAuto mesh=MEDCouplingCMesh::New(); mesh->setCoords(x,y); //! [CppSnippet_MEDCouplingFieldDouble_fillFromAnalytic_1] //! [CppSnippet_MEDCouplingFieldDouble_fillFromAnalytic_2] const char func[] = "IVec * b + JVec * a + KVec * sqrt( a*a + b*b ) + 10"; - MEDCouplingAutoRefCountObjectPtr field = + MCAuto field = MEDCouplingFieldDouble::New( MEDCoupling::ON_CELLS ); field->setMesh( mesh ); field->fillFromAnalytic( 3, func ); @@ -409,8 +409,8 @@ void CppExample_MEDCouplingFieldDouble_fillFromAnalytic() CPPUNIT_ASSERT( field->getNumberOfComponents() == 3 ); // 3 components in the field field->getArray()->getTuple( 1, val1 ); // - MEDCouplingAutoRefCountObjectPtr bc = - mesh->getBarycenterAndOwner(); // func is applied to barycenters of cells + MCAuto bc = + mesh->computeCellCenterOfMass(); // func is applied to barycenters of cells double bc1[2]; // coordinates of the second point bc->getTuple( 1, bc1 ); // @@ -437,12 +437,12 @@ void CppExample_MEDCouplingFieldDouble_fillFromAnalytic_c_func() //! [Snippet_MEDCouplingFieldDouble_fillFromAnalytic_c_func_1] // mesh const double coords[4] = {0.,2.,4.}; - MEDCouplingAutoRefCountObjectPtr coordsArr = DataArrayDouble::New(); + MCAuto coordsArr = DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess( coords, 3, 1 ); - MEDCouplingAutoRefCountObjectPtr mesh = MEDCouplingCMesh::New(); + MCAuto mesh = MEDCouplingCMesh::New(); mesh->setCoords(coordsArr,coordsArr); // mesh becomes a 2D structured mesh // field - MEDCouplingAutoRefCountObjectPtr field = + MCAuto field = MEDCouplingFieldDouble::New( MEDCoupling::ON_CELLS ); field->setMesh( mesh ); field->fillFromAnalytic( 3, &getNewValue ); // 3 components are required @@ -457,15 +457,15 @@ void CppExample_MEDCouplingFieldDouble_applyFunc_c_func() //! [Snippet_MEDCouplingFieldDouble_applyFunc_c_func_1] // mesh const double coords[4] = {0.,2.,4.}; - MEDCouplingAutoRefCountObjectPtr coordsArr = DataArrayDouble::New(); + MCAuto coordsArr = DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess( coords, 3, 1 ); - MEDCouplingAutoRefCountObjectPtr mesh = MEDCouplingCMesh::New(); + MCAuto mesh = MEDCouplingCMesh::New(); mesh->setCoords(coordsArr,coordsArr); // mesh becomes a 2D structured mesh // field - MEDCouplingAutoRefCountObjectPtr field = + MCAuto field = MEDCouplingFieldDouble::New( MEDCoupling::ON_CELLS ); field->setMesh( mesh ); - MEDCouplingAutoRefCountObjectPtr bc = mesh->getBarycenterAndOwner(); + MCAuto bc = mesh->computeCellCenterOfMass(); field->setArray( bc ); // 2 components here as the mesh is 2D //! [Snippet_MEDCouplingFieldDouble_applyFunc_c_func_1] //! [Snippet_MEDCouplingFieldDouble_applyFunc_c_func_2] @@ -480,17 +480,17 @@ void CppExample_MEDCouplingFieldDouble_getValueOn_time() using namespace MEDCoupling; //! [CppSnippet_MEDCouplingFieldDouble_getValueOn_time_1] const double coords[4] = {0.,2.,4.}; - MEDCouplingAutoRefCountObjectPtr coordsArr = DataArrayDouble::New(); + MCAuto coordsArr = DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess( coords, 3, 1 ); - MEDCouplingAutoRefCountObjectPtr mesh = MEDCouplingCMesh::New(); + MCAuto mesh = MEDCouplingCMesh::New(); mesh->setCoords(coordsArr,coordsArr); //! [CppSnippet_MEDCouplingFieldDouble_getValueOn_time_1] //! [CppSnippet_MEDCouplingFieldDouble_getValueOn_time_2] - MEDCouplingAutoRefCountObjectPtr field = + MCAuto field = MEDCouplingFieldDouble::New( MEDCoupling::ON_CELLS, MEDCoupling::LINEAR_TIME ); field->setMesh( mesh ); field->fillFromAnalytic( 1,"10"); // all values == 10. - MEDCouplingAutoRefCountObjectPtr array2 = + MCAuto array2 = DataArrayDouble::Add( field->getArray(), field->getArray() ); // == 2 * field->getArray() field->setEndArray( array2 ); // all values == 20. const double time1 = 1.1, time2 = 22.; @@ -510,17 +510,17 @@ void CppExample_MEDCouplingFieldDouble_getValueOnMulti() using namespace MEDCoupling; //! [CppSnippet_MEDCouplingFieldDouble_getValueOnMulti_1] const double coords[4] = {0.,2.,4.}; - MEDCouplingAutoRefCountObjectPtr coordsArr = DataArrayDouble::New(); + MCAuto coordsArr = DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess( coords, 3, 1 ); - MEDCouplingAutoRefCountObjectPtr mesh = MEDCouplingCMesh::New(); + MCAuto mesh = MEDCouplingCMesh::New(); mesh->setCoords(coordsArr,coordsArr); - MEDCouplingAutoRefCountObjectPtr field = + MCAuto field = mesh->fillFromAnalytic( MEDCoupling::ON_CELLS,1,"x+y"); //! [CppSnippet_MEDCouplingFieldDouble_getValueOnMulti_1] //! [CppSnippet_MEDCouplingFieldDouble_getValueOnMulti_2] // field values are located at cell barycenters - MEDCouplingAutoRefCountObjectPtr bc = mesh->getBarycenterAndOwner(); - MEDCouplingAutoRefCountObjectPtr valArray = + MCAuto bc = mesh->computeCellCenterOfMass(); + MCAuto valArray = field->getValueOnMulti( bc->getConstPointer(), bc->getNumberOfTuples() ); CPPUNIT_ASSERT( valArray->isEqual( * field->getArray(), 1e-13 )); //! [CppSnippet_MEDCouplingFieldDouble_getValueOnMulti_2] @@ -531,16 +531,16 @@ void CppExample_MEDCouplingFieldDouble_getValueOn() using namespace MEDCoupling; //! [CppSnippet_MEDCouplingFieldDouble_getValueOn_1] const double coords[4] = {0.,2.,4.}; - MEDCouplingAutoRefCountObjectPtr coordsArr = DataArrayDouble::New(); + MCAuto coordsArr = DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess( coords, 3, 1 ); - MEDCouplingAutoRefCountObjectPtr mesh = MEDCouplingCMesh::New(); + MCAuto mesh = MEDCouplingCMesh::New(); mesh->setCoords(coordsArr,coordsArr); - MEDCouplingAutoRefCountObjectPtr field = + MCAuto field = mesh->fillFromAnalytic( MEDCoupling::ON_CELLS,1,"x+y"); //! [CppSnippet_MEDCouplingFieldDouble_getValueOn_1] //! [CppSnippet_MEDCouplingFieldDouble_getValueOn_2] // field values are located at cell barycenters - MEDCouplingAutoRefCountObjectPtr bc = mesh->getBarycenterAndOwner(); + MCAuto bc = mesh->computeCellCenterOfMass(); std::vector vals( field->getNumberOfTuples() ); // array to collect values returned by getValueOn() double cellBC[2]; // we are in 2D space for ( int i = 0; i < bc->getNumberOfTuples(); ++i ) @@ -557,18 +557,18 @@ void CppExample_MEDCouplingFieldDouble_getValueOnPos() using namespace MEDCoupling; //! [CppSnippet_MEDCouplingFieldDouble_getValueOnPos_1] const double coords[4] = {0.,2.,4.}; - MEDCouplingAutoRefCountObjectPtr coordsArr = DataArrayDouble::New(); + MCAuto coordsArr = DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess( coords, 3, 1 ); - MEDCouplingAutoRefCountObjectPtr mesh = MEDCouplingCMesh::New(); + MCAuto mesh = MEDCouplingCMesh::New(); mesh->setCoords(coordsArr,coordsArr); - MEDCouplingAutoRefCountObjectPtr field = + MCAuto field = mesh->fillFromAnalytic( MEDCoupling::ON_CELLS,1,"x+y"); //! [CppSnippet_MEDCouplingFieldDouble_getValueOnPos_1] //! [CppSnippet_MEDCouplingFieldDouble_getValueOnPos_2] double val11[1]; // 1 == field->getNumberOfComponents() field->getValueOnPos( 1,1,-1, val11 ); // field values are located at cell barycenters - MEDCouplingAutoRefCountObjectPtr bc = mesh->getBarycenterAndOwner(); + MCAuto bc = mesh->computeCellCenterOfMass(); CPPUNIT_ASSERT( val11[0] == bc->getIJ(3,0) + bc->getIJ(3,1) ); //! [CppSnippet_MEDCouplingFieldDouble_getValueOnPos_2] } @@ -578,14 +578,14 @@ void CppExample_MEDCouplingFieldDouble_renumberNodes() using namespace MEDCoupling; //! [CppSnippet_MEDCouplingFieldDouble_renumberNodes_1] const double coords[4] = {0.,2.,4.}; - MEDCouplingAutoRefCountObjectPtr coordsArr = DataArrayDouble::New(); + MCAuto coordsArr = DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess( coords, 3, 1 ); - MEDCouplingAutoRefCountObjectPtr cmesh = MEDCouplingCMesh::New(); + MCAuto cmesh = MEDCouplingCMesh::New(); cmesh->setCoords(coordsArr,coordsArr); - MEDCouplingAutoRefCountObjectPtr mesh = cmesh->buildUnstructured(); + MCAuto mesh = cmesh->buildUnstructured(); //! [CppSnippet_MEDCouplingFieldDouble_renumberNodes_1] //! [CppSnippet_MEDCouplingFieldDouble_renumberNodes_2] - MEDCouplingAutoRefCountObjectPtr field = + MCAuto field = mesh->fillFromAnalytic( MEDCoupling::ON_NODES,2,"IVec*x+JVec*y"); const DataArrayDouble* values = field->getArray(); const DataArrayDouble* nodeCoords = mesh->getCoords(); @@ -606,17 +606,17 @@ void CppExample_MEDCouplingFieldDouble_renumberCells() using namespace MEDCoupling; //! [CppSnippet_MEDCouplingFieldDouble_renumberCells_1] const double coords[4] = {0.,2.,4.}; - MEDCouplingAutoRefCountObjectPtr coordsArr = DataArrayDouble::New(); + MCAuto coordsArr = DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess( coords, 3, 1 ); - MEDCouplingAutoRefCountObjectPtr cmesh = MEDCouplingCMesh::New(); + MCAuto cmesh = MEDCouplingCMesh::New(); cmesh->setCoords(coordsArr,coordsArr); - MEDCouplingAutoRefCountObjectPtr mesh = cmesh->buildUnstructured(); + MCAuto mesh = cmesh->buildUnstructured(); //! [CppSnippet_MEDCouplingFieldDouble_renumberCells_1] //! [CppSnippet_MEDCouplingFieldDouble_renumberCells_2] - MEDCouplingAutoRefCountObjectPtr field = + MCAuto field = mesh->fillFromAnalytic( MEDCoupling::ON_CELLS,2,"IVec*x+JVec*y"); const DataArrayDouble* values = field->getArray(); - MEDCouplingAutoRefCountObjectPtr bc = mesh->getBarycenterAndOwner(); + MCAuto bc = mesh->computeCellCenterOfMass(); CPPUNIT_ASSERT( values->isEqualWithoutConsideringStr( *bc, 1e-13 )); //! [CppSnippet_MEDCouplingFieldDouble_renumberCells_2] //! [CppSnippet_MEDCouplingFieldDouble_renumberCells_3] @@ -624,7 +624,7 @@ void CppExample_MEDCouplingFieldDouble_renumberCells() field->renumberCells(renumber,false); const MEDCouplingMesh* mesh2 = field->getMesh(); // field now refers to another mesh values = field->getArray(); - bc = mesh2->getBarycenterAndOwner(); + bc = mesh2->computeCellCenterOfMass(); CPPUNIT_ASSERT( values->isEqualWithoutConsideringStr( *bc, 1e-13 )); //! [CppSnippet_MEDCouplingFieldDouble_renumberCells_3] } @@ -634,16 +634,16 @@ void CppExample_MEDCouplingFieldDouble_buildNewTimeReprFromThis() using namespace MEDCoupling; //! [CppSnippet_MEDCouplingFieldDouble_buildNewTimeReprFromThis_1] const double coords[4] = {0.,2.,4.}; - MEDCouplingAutoRefCountObjectPtr coordsArr = DataArrayDouble::New(); + MCAuto coordsArr = DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess( coords, 3, 1 ); - MEDCouplingAutoRefCountObjectPtr mesh = MEDCouplingCMesh::New(); + MCAuto mesh = MEDCouplingCMesh::New(); mesh->setCoords(coordsArr,coordsArr); - MEDCouplingAutoRefCountObjectPtr field1 = + MCAuto field1 = mesh->fillFromAnalytic( MEDCoupling::ON_NODES,1,"x+y"); CPPUNIT_ASSERT( field1->getTimeDiscretization() == MEDCoupling::ONE_TIME ); //! [CppSnippet_MEDCouplingFieldDouble_buildNewTimeReprFromThis_1] //! [CppSnippet_MEDCouplingFieldDouble_buildNewTimeReprFromThis_2] - MEDCouplingAutoRefCountObjectPtr field2 = + MCAuto field2 = field1->buildNewTimeReprFromThis( MEDCoupling::NO_TIME, false ); CPPUNIT_ASSERT( field2->getTimeDiscretization() == MEDCoupling::NO_TIME ); //! [CppSnippet_MEDCouplingFieldDouble_buildNewTimeReprFromThis_2] @@ -654,27 +654,27 @@ void CppExample_MEDCouplingMesh_fillFromAnalytic3() using namespace MEDCoupling; //! [CppSnippet_MEDCouplingMesh_fillFromAnalytic3_1] const double coords[4] = {0.,2.,4.,6.}; // 6. is not used - MEDCouplingAutoRefCountObjectPtr x = DataArrayDouble::New(); + MCAuto x = DataArrayDouble::New(); x->useExternalArrayWithRWAccess( coords, 3, 1 ); - MEDCouplingAutoRefCountObjectPtr y = DataArrayDouble::New(); + MCAuto y = DataArrayDouble::New(); y->useExternalArrayWithRWAccess( coords, 2, 1 ); - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingCMesh::New(); + MCAuto mesh=MEDCouplingCMesh::New(); mesh->setCoords(x,y); //! [CppSnippet_MEDCouplingMesh_fillFromAnalytic3_1] //! [CppSnippet_MEDCouplingMesh_fillFromAnalytic3_2] const char func[] = "IVec * b + JVec * a + KVec * sqrt( a*a + b*b ) + 10"; const char* varNames[2] = { "a", "b" }; // names used to refer to X and Y coord components std::vector varNamesVec( varNames, varNames+2 ); - MEDCouplingAutoRefCountObjectPtr field = - mesh->fillFromAnalytic3( MEDCoupling::ON_CELLS, 3, varNamesVec, func ); + MCAuto field = + mesh->fillFromAnalyticNamedCompo( MEDCoupling::ON_CELLS, 3, varNamesVec, func ); //! [CppSnippet_MEDCouplingMesh_fillFromAnalytic3_2] //! [CppSnippet_MEDCouplingMesh_fillFromAnalytic3_3] double val1[3]; // a value (vector) of the cell #1 CPPUNIT_ASSERT( field->getNumberOfComponents() == 3 ); // 3 components in the field field->getArray()->getTuple( 1, val1 ); // - MEDCouplingAutoRefCountObjectPtr bc = - mesh->getBarycenterAndOwner(); // func is applied to barycenters of cells + MCAuto bc = + mesh->computeCellCenterOfMass(); // func is applied to barycenters of cells double bc1[2]; // coordinates of the second point bc->getTuple( 1, bc1 ); // @@ -690,27 +690,27 @@ void CppExample_MEDCouplingMesh_fillFromAnalytic2() using namespace MEDCoupling; //! [CppSnippet_MEDCouplingMesh_fillFromAnalytic2_1] const double coords[4] = {0.,2.,4.,6.}; // 6. is not used - MEDCouplingAutoRefCountObjectPtr x = DataArrayDouble::New(); + MCAuto x = DataArrayDouble::New(); x->useExternalArrayWithRWAccess( coords, 3, 1 ); - MEDCouplingAutoRefCountObjectPtr y = DataArrayDouble::New(); + MCAuto y = DataArrayDouble::New(); y->useExternalArrayWithRWAccess( coords, 2, 1 ); x->setInfoOnComponent(0,"a"); // name used to refer to X coordinate within a function y->setInfoOnComponent(0,"b"); // name used to refer to Y coordinate within a function - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingCMesh::New(); + MCAuto mesh=MEDCouplingCMesh::New(); mesh->setCoords(x,y); //! [CppSnippet_MEDCouplingMesh_fillFromAnalytic2_1] //! [CppSnippet_MEDCouplingMesh_fillFromAnalytic2_2] const char func[] = "IVec * b + JVec * a + KVec * sqrt( a*a + b*b ) + 10"; - MEDCouplingAutoRefCountObjectPtr field = - mesh->fillFromAnalytic2( MEDCoupling::ON_CELLS, 3, func ); + MCAuto field = + mesh->fillFromAnalyticCompo( MEDCoupling::ON_CELLS, 3, func ); //! [CppSnippet_MEDCouplingMesh_fillFromAnalytic2_2] //! [CppSnippet_MEDCouplingMesh_fillFromAnalytic2_3] double val1[3]; // a value (vector) of the cell #1 CPPUNIT_ASSERT( field->getNumberOfComponents() == 3 ); // 3 components in the field field->getArray()->getTuple( 1, val1 ); // - MEDCouplingAutoRefCountObjectPtr bc = - mesh->getBarycenterAndOwner(); // func is applied to barycenters of cells + MCAuto bc = + mesh->computeCellCenterOfMass(); // func is applied to barycenters of cells double bc1[2]; // coordinates of the second point bc->getTuple( 1, bc1 ); // @@ -726,16 +726,16 @@ void CppExample_MEDCouplingMesh_fillFromAnalytic() using namespace MEDCoupling; //! [CppSnippet_MEDCouplingMesh_fillFromAnalytic_1] const double coords[4] = {0.,2.,4.,6.}; // 6. is not used - MEDCouplingAutoRefCountObjectPtr x = DataArrayDouble::New(); + MCAuto x = DataArrayDouble::New(); x->useExternalArrayWithRWAccess( coords, 3, 1 ); - MEDCouplingAutoRefCountObjectPtr y = DataArrayDouble::New(); + MCAuto y = DataArrayDouble::New(); y->useExternalArrayWithRWAccess( coords, 2, 1 ); - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingCMesh::New(); + MCAuto mesh=MEDCouplingCMesh::New(); mesh->setCoords(x,y); //! [CppSnippet_MEDCouplingMesh_fillFromAnalytic_1] //! [CppSnippet_MEDCouplingMesh_fillFromAnalytic_2] const char func[] = "IVec * b + JVec * a + KVec * sqrt( a*a + b*b ) + 10"; - MEDCouplingAutoRefCountObjectPtr field = + MCAuto field = mesh->fillFromAnalytic( MEDCoupling::ON_CELLS, 3, func ); //! [CppSnippet_MEDCouplingMesh_fillFromAnalytic_2] //! [CppSnippet_MEDCouplingMesh_fillFromAnalytic_3] @@ -743,8 +743,8 @@ void CppExample_MEDCouplingMesh_fillFromAnalytic() CPPUNIT_ASSERT( field->getNumberOfComponents() == 3 ); // 3 components in the field field->getArray()->getTuple( 1, val1 ); // - MEDCouplingAutoRefCountObjectPtr bc = - mesh->getBarycenterAndOwner(); // func is applied to barycenters of cells + MCAuto bc = + mesh->computeCellCenterOfMass(); // func is applied to barycenters of cells double bc1[2]; // coordinates of the second point bc->getTuple( 1, bc1 ); // @@ -760,9 +760,9 @@ void CppExample_MEDCouplingCMesh_getCoordsAt() using namespace MEDCoupling; //! [CppSnippet_MEDCouplingCMesh_getCoordsAt_1] const double coords[3] = {1.,2.,4.}; - MEDCouplingAutoRefCountObjectPtr x = DataArrayDouble::New(); + MCAuto x = DataArrayDouble::New(); x->useExternalArrayWithRWAccess( coords, 3, 1 ); - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingCMesh::New(); + MCAuto mesh=MEDCouplingCMesh::New(); mesh->setCoordsAt(0,x); const DataArrayDouble* x2=mesh->getCoordsAt(0); CPPUNIT_ASSERT( x2->isEqual( *x, 1e-13 )); @@ -773,7 +773,7 @@ void CppExample_MEDCouplingUMesh_areCellsIncludedIn() { using namespace MEDCoupling; //! [CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_1] - MEDCouplingAutoRefCountObjectPtr mesh1=MEDCouplingUMesh::New(); + MCAuto mesh1=MEDCouplingUMesh::New(); mesh1->setMeshDimension(2); mesh1->allocateCells(5); const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; @@ -783,7 +783,7 @@ void CppExample_MEDCouplingUMesh_areCellsIncludedIn() mesh1->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // #3 mesh1->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // #4 mesh1->finishInsertingCells(); - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->alloc(9,2); const double coords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 }; std::copy(coords,coords+18,coordsArr->getPointer()); @@ -791,7 +791,7 @@ void CppExample_MEDCouplingUMesh_areCellsIncludedIn() //! [CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_1] //! [CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_2] const int cells2[3] = { 4,2,0 }; // even cells selected - MEDCouplingAutoRefCountObjectPtr mesh2 = + MCAuto mesh2 = (MEDCouplingUMesh*) mesh1->buildPartOfMySelf( cells2, cells2+3, true ); //! [CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_2] //! [CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_3] @@ -817,16 +817,16 @@ void CppExample_MEDCouplingUMesh_findAndCorrectBadOriented3DExtrudedCells() //! [CppSnippet_MEDCouplingUMesh_findAndCorrectBadOriented3DExtrudedCells_1] // 2D coordinates of 5 base nodes const double coords[5*2]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2 }; - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess( coords, 5, 2 ); // coordinates of 5 top nodes - MEDCouplingAutoRefCountObjectPtr coordsArr2 = coordsArr->deepCpy(); + MCAuto coordsArr2 = coordsArr->deepCopy(); // 3D coordinates of base + top nodes coordsArr = coordsArr-> changeNbOfComponents( 3, 0 ); coordsArr2 = coordsArr2->changeNbOfComponents( 3, 1 ); coordsArr = DataArrayDouble::Aggregate( coordsArr, coordsArr2 ); // mesh - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setCoords(coordsArr); mesh->setMeshDimension(3); mesh->allocateCells(2); @@ -837,7 +837,7 @@ void CppExample_MEDCouplingUMesh_findAndCorrectBadOriented3DExtrudedCells() mesh->finishInsertingCells(); //! [CppSnippet_MEDCouplingUMesh_findAndCorrectBadOriented3DExtrudedCells_1] //! [CppSnippet_MEDCouplingUMesh_findAndCorrectBadOriented3DExtrudedCells_2] - MEDCouplingAutoRefCountObjectPtr fixedCells = + MCAuto fixedCells = mesh->findAndCorrectBadOriented3DExtrudedCells(); CPPUNIT_ASSERT( fixedCells->getNumberOfTuples() == 2 ); // 2 cells fixed fixedCells = mesh->findAndCorrectBadOriented3DExtrudedCells(); @@ -851,16 +851,16 @@ void CppExample_MEDCouplingUMesh_arePolyhedronsNotCorrectlyOriented() //! [CppSnippet_MEDCouplingUMesh_arePolyhedronsNotCorrectlyOriented_1] // 2D coordinates of 5 base nodes const double coords[5*2]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2 }; - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess( coords, 5, 2 ); // coordinates of 5 top nodes - MEDCouplingAutoRefCountObjectPtr coordsArr2 = coordsArr->deepCpy(); + MCAuto coordsArr2 = coordsArr->deepCopy(); // 3D coordinates of base + top nodes coordsArr = coordsArr-> changeNbOfComponents( 3, 0 ); coordsArr2 = coordsArr2->changeNbOfComponents( 3, 1 ); coordsArr = DataArrayDouble::Aggregate( coordsArr, coordsArr2 ); // mesh - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setCoords(coordsArr); mesh->setMeshDimension(3); mesh->allocateCells(2); @@ -889,7 +889,7 @@ void CppExample_MEDCouplingUMesh_are2DCellsNotCorrectlyOriented() { using namespace MEDCoupling; //! [CppSnippet_MEDCouplingUMesh_are2DCellsNotCorrectlyOriented_1] - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); const int conn[18]={0,3,4,1, 1,2,4, 4,5,2, 6,7,4,3, 7,8,5,4}; @@ -899,7 +899,7 @@ void CppExample_MEDCouplingUMesh_are2DCellsNotCorrectlyOriented() mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3 mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4 mesh->finishInsertingCells(); - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->alloc(9,2); const double coords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 }; std::copy(coords,coords+18,coordsArr->getPointer()); @@ -924,7 +924,7 @@ void CppExample_MEDCouplingUMesh_getCellsContainingPoints() { using namespace MEDCoupling; //! [CppSnippet_MEDCouplingUMesh_getCellsContainingPoints_1] - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; @@ -934,7 +934,7 @@ void CppExample_MEDCouplingUMesh_getCellsContainingPoints() mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); mesh->finishInsertingCells(); - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->alloc(9,2); const double coords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 }; std::copy(coords,coords+18,coordsArr->getPointer()); @@ -945,7 +945,7 @@ void CppExample_MEDCouplingUMesh_getCellsContainingPoints() 0.3, 0.3, // point located somewhere inside the mesh coords[2], coords[3]}; // point at the node #1 const double eps = 1e-4; // ball radius - MEDCouplingAutoRefCountObjectPtr cells, cellsIndex; + MCAuto cells, cellsIndex; mesh->getCellsContainingPoints( pos, 3, eps, cells, cellsIndex ); const int cellsExpected[3]={4, 0, 1}; const int cellsIndexExpected[4]={0, 0, 1, 3}; @@ -958,7 +958,7 @@ void CppExample_MEDCouplingUMesh_getCellsContainingPoint() { using namespace MEDCoupling; //! [CppSnippet_MEDCouplingUMesh_getCellsContainingPoint_1] - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; @@ -968,7 +968,7 @@ void CppExample_MEDCouplingUMesh_getCellsContainingPoint() mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3 mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4 mesh->finishInsertingCells(); - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->alloc(9,2); const double coords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 }; std::copy(coords,coords+18,coordsArr->getPointer()); @@ -988,7 +988,7 @@ void CppExample_MEDCouplingUMesh_buildPartOrthogonalField() { using namespace MEDCoupling; //! [CppSnippet_MEDCouplingUMesh_buildPartOrthogonalField_1] - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; @@ -998,7 +998,7 @@ void CppExample_MEDCouplingUMesh_buildPartOrthogonalField() mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3 mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4 mesh->finishInsertingCells(); - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->alloc(9,2); const double coords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 }; std::copy(coords,coords+18,coordsArr->getPointer()); @@ -1006,7 +1006,7 @@ void CppExample_MEDCouplingUMesh_buildPartOrthogonalField() //! [CppSnippet_MEDCouplingUMesh_buildPartOrthogonalField_1] //! [CppSnippet_MEDCouplingUMesh_buildPartOrthogonalField_2] const int part[4] = {1,2,3,4}; // cell #0 is omitted - MEDCouplingAutoRefCountObjectPtr vecField= + MCAuto vecField= mesh->buildPartOrthogonalField( part, part+4 ); CPPUNIT_ASSERT ( vecField->getArray()->getNumberOfTuples() == 4 ); CPPUNIT_ASSERT ( vecField->getArray()->getNumberOfComponents() == 3 ); @@ -1017,7 +1017,7 @@ void CppExample_MEDCouplingUMesh_getPartMeasureField() { using namespace MEDCoupling; //! [CppSnippet_MEDCouplingUMesh_getPartMeasureField_1] - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); const int conn[18]={0,3,4,1, 1,2,4, 4,5,2, 6,7,4,3, 7,8,5,4}; @@ -1027,7 +1027,7 @@ void CppExample_MEDCouplingUMesh_getPartMeasureField() mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3 mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4 mesh->finishInsertingCells(); - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->alloc(9,2); const double coords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 }; std::copy(coords,coords+18,coordsArr->getPointer()); @@ -1036,7 +1036,7 @@ void CppExample_MEDCouplingUMesh_getPartMeasureField() //! [CppSnippet_MEDCouplingUMesh_getPartMeasureField_2] const bool isAbs = true; const int part[4] = {1,2,3,4}; // cell #0 is omitted - MEDCouplingAutoRefCountObjectPtr areaArr= + MCAuto areaArr= mesh->getPartMeasureField( isAbs, part, part+4 ); CPPUNIT_ASSERT( areaArr->getIJ(0,0) > 0 ); // orientation ignored areaArr=mesh->getPartMeasureField( !isAbs, part, part+4 ); @@ -1045,7 +1045,7 @@ void CppExample_MEDCouplingUMesh_getPartMeasureField() //! [CppSnippet_MEDCouplingUMesh_getPartMeasureField_2] //! [CppSnippet_MEDCouplingUMesh_getPartMeasureField_3] const int cellIds[4] = {1,2,3,4}; // cell #0 is omitted - MEDCouplingAutoRefCountObjectPtr baryCenters= + MCAuto baryCenters= mesh->getPartBarycenterAndOwner( cellIds, cellIds+4 ); CPPUNIT_ASSERT( baryCenters->getNumberOfTuples() == 4 ); CPPUNIT_ASSERT( baryCenters->getNumberOfComponents() == mesh->getSpaceDimension() ); @@ -1056,11 +1056,11 @@ void CppExample_MEDCouplingUMesh_getCellsInBoundingBox() { using namespace MEDCoupling; //! [CppSnippet_MEDCouplingUMesh_getCellsInBoundingBox_1] - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(1); const double coords[3*2]={0.,0., 0.,1., 1.,1}; - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess(coords, 3,2); mesh->setCoords(coordsArr); mesh->allocateCells(1); @@ -1070,7 +1070,7 @@ void CppExample_MEDCouplingUMesh_getCellsInBoundingBox() //! [CppSnippet_MEDCouplingUMesh_getCellsInBoundingBox_1] //! [CppSnippet_MEDCouplingUMesh_getCellsInBoundingBox_2] const double bbox[] = {1., 1., 1.001,1.001}; // xMin, xMax, yMin, yMax - MEDCouplingAutoRefCountObjectPtr cellIdsArr = + MCAuto cellIdsArr = mesh->getCellsInBoundingBox( bbox, 0.0 ); CPPUNIT_ASSERT( cellIdsArr->getNumberOfTuples() == 0 ); cellIdsArr = mesh->getCellsInBoundingBox( bbox, 0.1 ); @@ -1082,7 +1082,7 @@ void CppExample_MEDCouplingUMesh_renumberNodesInConn() { using namespace MEDCoupling; //! [CppSnippet_MEDCouplingUMesh_renumberNodesInConn_1] - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(1); const int conn[4]={4,3,2,1}; @@ -1103,10 +1103,10 @@ void CppExample_MEDCouplingUMesh_renumberNodes() { using namespace MEDCoupling; //! [CppSnippet_MEDCouplingUMesh_renumberNodes_1] - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); const double coords[4*2]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.3}; - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess(coords, 4,2); mesh->setCoords(coordsArr); mesh->allocateCells(0); @@ -1117,17 +1117,17 @@ void CppExample_MEDCouplingUMesh_renumberNodes() mesh->renumberNodes(newIds, 3); coordsArr = mesh->getCoordinatesAndOwner(); // get a shorten array const double coordsExpected[3*2]={0.7,-0.3, 0.2,-0.3, -0.3,-0.3}; - MEDCouplingAutoRefCountObjectPtr coordsExpectedArr=DataArrayDouble::New(); + MCAuto coordsExpectedArr=DataArrayDouble::New(); coordsExpectedArr->useExternalArrayWithRWAccess(coordsExpected, 3,2); CPPUNIT_ASSERT( coordsExpectedArr->isEqual( *coordsArr, 1e-13 )); //! [CppSnippet_MEDCouplingUMesh_renumberNodes_2] //! [CppSnippet_MEDCouplingUMesh_renumberNodes_3] coordsArr->useExternalArrayWithRWAccess(coords, 4,2); // restore old nodes const int newIds2[] = { 2,1,0,2 }; - mesh->renumberNodes2(newIds2, 3); + mesh->renumberNodesCenter(newIds2, 3); coordsArr = mesh->getCoordinatesAndOwner(); // get a shorten array const double coordsExpected2[3*2]={0.7,-0.3, 0.2,-0.3, -0.3, 0.0}; - MEDCouplingAutoRefCountObjectPtr coordsExpectedArr2=DataArrayDouble::New(); + MCAuto coordsExpectedArr2=DataArrayDouble::New(); coordsExpectedArr2->useExternalArrayWithRWAccess(coordsExpected2, 3,2); CPPUNIT_ASSERT( coordsExpectedArr2->isEqual( *coordsArr, 1e-13 )); //! [CppSnippet_MEDCouplingUMesh_renumberNodes_3] @@ -1137,7 +1137,7 @@ void CppExample_MEDCouplingUMesh_findBoundaryNodes() { using namespace MEDCoupling; //! [CppSnippet_MEDCouplingUMesh_findBoundaryNodes_1] - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; @@ -1147,14 +1147,14 @@ void CppExample_MEDCouplingUMesh_findBoundaryNodes() mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); mesh->finishInsertingCells(); - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->alloc(9,2); const double coords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 }; std::copy(coords,coords+18,coordsArr->getPointer()); mesh->setCoords(coordsArr); //! [CppSnippet_MEDCouplingUMesh_findBoundaryNodes_1] //! [CppSnippet_MEDCouplingUMesh_findBoundaryNodes_2] - MEDCouplingAutoRefCountObjectPtr nodeIdsArr=mesh->findBoundaryNodes(); + MCAuto nodeIdsArr=mesh->findBoundaryNodes(); CPPUNIT_ASSERT( nodeIdsArr->getNumberOfTuples() == mesh->getNumberOfNodes() - 1 ); //! [CppSnippet_MEDCouplingUMesh_findBoundaryNodes_2] } @@ -1163,7 +1163,7 @@ void CppExample_MEDCouplingUMesh_buildBoundaryMesh() { using namespace MEDCoupling; //! [CppSnippet_MEDCouplingUMesh_buildBoundaryMesh_1] - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; @@ -1173,15 +1173,15 @@ void CppExample_MEDCouplingUMesh_buildBoundaryMesh() mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); mesh->finishInsertingCells(); - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->alloc(9,2); const double coords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 }; std::copy(coords,coords+18,coordsArr->getPointer()); mesh->setCoords(coordsArr); //! [CppSnippet_MEDCouplingUMesh_buildBoundaryMesh_1] //! [CppSnippet_MEDCouplingUMesh_buildBoundaryMesh_2] - MEDCouplingAutoRefCountObjectPtr mesh1=mesh->buildBoundaryMesh(true); - MEDCouplingAutoRefCountObjectPtr mesh2=mesh->buildBoundaryMesh(false); + MCAuto mesh1=mesh->buildBoundaryMesh(true); + MCAuto mesh2=mesh->buildBoundaryMesh(false); CPPUNIT_ASSERT( coordsArr->isEqual( *mesh1->getCoords(), 1e-13 )); // same nodes CPPUNIT_ASSERT( !coordsArr->isEqual( *mesh2->getCoords(), 1e-13 )); // different nodes //! [CppSnippet_MEDCouplingUMesh_buildBoundaryMesh_2] @@ -1191,7 +1191,7 @@ void CppExample_MEDCouplingUMesh_buildFacePartOfMySelfNode() { using namespace MEDCoupling; //! [CppSnippet_MEDCouplingUMesh_buildFacePartOfMySelfNode_1] - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; @@ -1201,7 +1201,7 @@ void CppExample_MEDCouplingUMesh_buildFacePartOfMySelfNode() mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3 mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4 mesh->finishInsertingCells(); - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->alloc(9,2); const double coords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 }; std::copy(coords,coords+18,coordsArr->getPointer()); @@ -1211,10 +1211,10 @@ void CppExample_MEDCouplingUMesh_buildFacePartOfMySelfNode() std::vector nodes; mesh->getNodeIdsOfCell( 0, nodes ); const bool allNodes = true; - MEDCouplingAutoRefCountObjectPtr mesh1 = + MCAuto mesh1 = (MEDCouplingUMesh*)mesh->buildFacePartOfMySelfNode( &nodes[0],&nodes[0]+nodes.size(),allNodes); CPPUNIT_ASSERT( mesh1->getNumberOfCells() == 4 ); // 4 segments bounding QUAD4 #0 only - MEDCouplingAutoRefCountObjectPtr mesh2 = + MCAuto mesh2 = (MEDCouplingUMesh*)mesh->buildFacePartOfMySelfNode( &nodes[0],&nodes[0]+nodes.size(),!allNodes); CPPUNIT_ASSERT( mesh2->getNumberOfCells() == 9 ); // more segments added //! [CppSnippet_MEDCouplingUMesh_buildFacePartOfMySelfNode_2] @@ -1224,7 +1224,7 @@ void CppExample_MEDCouplingUMesh_buildPartOfMySelfNode() { using namespace MEDCoupling; //! [CppSnippet_MEDCouplingUMesh_buildPartOfMySelfNode_1] - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; @@ -1234,7 +1234,7 @@ void CppExample_MEDCouplingUMesh_buildPartOfMySelfNode() mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3 mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4 mesh->finishInsertingCells(); - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->alloc(9,2); const double coords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 }; std::copy(coords,coords+18,coordsArr->getPointer()); @@ -1244,9 +1244,9 @@ void CppExample_MEDCouplingUMesh_buildPartOfMySelfNode() std::vector nodes; mesh->getNodeIdsOfCell( 0, nodes ); const bool allNodes = true; - MEDCouplingAutoRefCountObjectPtr mesh1 = + MCAuto mesh1 = (MEDCouplingUMesh*)mesh->buildPartOfMySelfNode( &nodes[0], &nodes[0]+nodes.size(), allNodes); - MEDCouplingAutoRefCountObjectPtr mesh2 = + MCAuto mesh2 = (MEDCouplingUMesh*)mesh->buildPartOfMySelfNode( &nodes[0], &nodes[0]+nodes.size(),!allNodes); CPPUNIT_ASSERT_EQUAL( mesh1->getNumberOfCells(), 1 ); CPPUNIT_ASSERT_EQUAL( mesh2->getNumberOfCells(), mesh->getNumberOfCells() ); @@ -1257,7 +1257,7 @@ void CppExample_MEDCouplingUMesh_getCellIdsLyingOnNodes() { using namespace MEDCoupling; //! [CppSnippet_MEDCouplingUMesh_getCellIdsLyingOnNodes_1] - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; @@ -1267,7 +1267,7 @@ void CppExample_MEDCouplingUMesh_getCellIdsLyingOnNodes() mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3 mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4 mesh->finishInsertingCells(); - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->alloc(9,2); const double coords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 }; std::copy(coords,coords+18,coordsArr->getPointer()); @@ -1290,7 +1290,7 @@ void CppExample_MEDCouplingUMesh_getCellIdsFullyIncludedInNodeIds() { using namespace MEDCoupling; //! [CppSnippet_MEDCouplingUMesh_getCellIdsFullyIncludedInNodeIds_1] - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; @@ -1300,7 +1300,7 @@ void CppExample_MEDCouplingUMesh_getCellIdsFullyIncludedInNodeIds() mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); mesh->finishInsertingCells(); - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->alloc(9,2); const double coords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 }; std::copy(coords,coords+18,coordsArr->getPointer()); @@ -1321,7 +1321,7 @@ void CppExample_MEDCouplingUMesh_buildPartOfMySelf() { using namespace MEDCoupling; //! [CppSnippet_MEDCouplingUMesh_buildPartOfMySelf_1] - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; @@ -1331,7 +1331,7 @@ void CppExample_MEDCouplingUMesh_buildPartOfMySelf() mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3 mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4 mesh->finishInsertingCells(); - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->alloc(9,2); const double coords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 }; std::copy(coords,coords+18,coordsArr->getPointer()); @@ -1359,7 +1359,7 @@ void CppExample_MEDCouplingUMesh_mergeNodes() { using namespace MEDCoupling; //! [CppSnippet_MEDCouplingUMesh_mergeNodes_1] - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); const int conn[18]={0,3,4,1, 1,4,2, 4,5,2}; @@ -1373,14 +1373,14 @@ void CppExample_MEDCouplingUMesh_mergeNodes() 1.1,0.0, // #3 1.1,0.0, // #4 == #3 0.3,-0.303}; // #5 ~~ #0 - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->alloc(6,2); std::copy(coords,coords+6*2,coordsArr->getPointer()); mesh->setCoords(coordsArr); //! [CppSnippet_MEDCouplingUMesh_mergeNodes_1] //! [CppSnippet_MEDCouplingUMesh_mergeNodes_2] bool areNodesMerged; int newNbOfNodes; - MEDCouplingAutoRefCountObjectPtr arr= + MCAuto arr= mesh->mergeNodes(0.004,areNodesMerged,newNbOfNodes); const int idsExpected[6] = {0, 1, 0, 2, 2, 0}; CPPUNIT_ASSERT(std::equal(idsExpected,idsExpected+6,arr->getPointer())); @@ -1395,8 +1395,8 @@ void CppExample_MEDCouplingUMesh_mergeNodes() coordsArr->alloc(6,2); std::copy(coords,coords+6*2,coordsArr->getPointer()); mesh->setCoords(coordsArr); - // call mergeNodes2() - arr = mesh->mergeNodes2(0.004,areNodesMerged,newNbOfNodes); + // call mergeNodesCenter() + arr = mesh->mergeNodesCenter(0.004,areNodesMerged,newNbOfNodes); coordsArr=mesh->getCoordinatesAndOwner(); // retrieve a new shorten coord array CPPUNIT_ASSERT_DOUBLES_EQUAL( baryCoords2[1], coordsArr->getIJ(0,1), 13 ); // Y of node #0 equals to that of baryCoords2 //! [CppSnippet_MEDCouplingUMesh_mergeNodes_3] @@ -1406,7 +1406,7 @@ void CppExample_MEDCouplingUMesh_zipConnectivityTraducer() { using namespace MEDCoupling; //! [CppSnippet_MEDCouplingUMesh_zipConnectivityTraducer_1] - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); const int conn[11]={0,3,4,1, 1,4,2, 4,1,0,3}; @@ -1416,7 +1416,7 @@ void CppExample_MEDCouplingUMesh_zipConnectivityTraducer() mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+0); // 3 == 0 mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+7); // 4 ~~ 0 mesh->finishInsertingCells(); - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->alloc(9,2); const double coords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 }; std::copy(coords,coords+18,coordsArr->getPointer()); @@ -1436,7 +1436,7 @@ void CppExample_MEDCouplingUMesh_zipCoordsTraducer() { using namespace MEDCoupling; //! [CppSnippet_MEDCouplingUMesh_zipCoordsTraducer_1] - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; @@ -1446,7 +1446,7 @@ void CppExample_MEDCouplingUMesh_zipCoordsTraducer() mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); mesh->finishInsertingCells(); - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->alloc(9,2); const double coords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 }; std::copy(coords,coords+18,coordsArr->getPointer()); @@ -1469,7 +1469,7 @@ void CppExample_MEDCouplingUMesh_getNodeIdsInUse() { using namespace MEDCoupling; //! [CppSnippet_MEDCouplingUMesh_getNodeIdsInUse_1] - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; @@ -1479,7 +1479,7 @@ void CppExample_MEDCouplingUMesh_getNodeIdsInUse() mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); mesh->finishInsertingCells(); - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->alloc(9,2); const double coords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 }; std::copy(coords,coords+18,coordsArr->getPointer()); @@ -1507,7 +1507,7 @@ void CppExample_MEDCouplingUMesh_convertToPolyTypes() { using namespace MEDCoupling; //! [CppSnippet_MEDCouplingUMesh_convertToPolyTypes_1] - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; @@ -1517,7 +1517,7 @@ void CppExample_MEDCouplingUMesh_convertToPolyTypes() mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3 mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4 mesh->finishInsertingCells(); - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->alloc(9,2); const double coords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 }; std::copy(coords,coords+18,coordsArr->getPointer()); @@ -1537,7 +1537,7 @@ void CppExample_MEDCouplingUMesh_buildDescendingConnectivity2() { using namespace MEDCoupling; //! [CppSnippet_MEDCouplingUMesh_buildDescendingConnectivity2_1] - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; @@ -1547,7 +1547,7 @@ void CppExample_MEDCouplingUMesh_buildDescendingConnectivity2() mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3 mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4 mesh->finishInsertingCells(); - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->alloc(9,2); const double coords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 }; std::copy(coords,coords+18,coordsArr->getPointer()); @@ -1585,7 +1585,7 @@ void CppExample_MEDCouplingUMesh_buildDescendingConnectivity() { using namespace MEDCoupling; //! [CppSnippet_MEDCouplingUMesh_buildDescendingConnectivity_1] - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; @@ -1595,7 +1595,7 @@ void CppExample_MEDCouplingUMesh_buildDescendingConnectivity() mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3 mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4 mesh->finishInsertingCells(); - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->alloc(9,2); const double coords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 }; std::copy(coords,coords+18,coordsArr->getPointer()); @@ -1627,7 +1627,7 @@ void CppExample_MEDCouplingUMesh_getReverseNodalConnectivity() { using namespace MEDCoupling; //! [CppSnippet_MEDCouplingUMesh_getReverseNodalConnectivity_1] - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; @@ -1637,7 +1637,7 @@ void CppExample_MEDCouplingUMesh_getReverseNodalConnectivity() mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3 mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4 mesh->finishInsertingCells(); - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->alloc(9,2); const double coords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 }; std::copy(coords,coords+18,coordsArr->getPointer()); @@ -1668,7 +1668,7 @@ void CppExample_MEDCouplingUMesh_checkDeepEquivalWith() 0.0,1.0}; // #3 { mesh1->setMeshDimension(2); - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess( coords, 4, 2 ); mesh1->setCoords(coordsArr); mesh1->allocateCells(2); @@ -1685,7 +1685,7 @@ void CppExample_MEDCouplingUMesh_checkDeepEquivalWith() 1.0,1.001}; // #3 ~ #2 { mesh2->setMeshDimension(2); - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess( coords2, 4, 2 ); mesh2->setCoords(coordsArr); mesh2->allocateCells(2); @@ -1727,11 +1727,11 @@ void CppExample_MEDCouplingPointSet_scale() using namespace MEDCoupling; //! [CppSnippet_MEDCouplingPointSet_scale_1] double coords[4*2]={0.0,0.0, 1.0,0.0, 1.0,1.0, 0.0,1.0}; // 2D coordinates of 4 nodes - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess(coords, 4,2); - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setCoords(coordsArr); - DataArrayDouble *initCoords = coordsArr->deepCpy(); + DataArrayDouble *initCoords = coordsArr->deepCopy(); //! [CppSnippet_MEDCouplingPointSet_scale_1] //! [CppSnippet_MEDCouplingPointSet_scale_2] const double center[2] = {0.,0.}; @@ -1752,11 +1752,11 @@ void CppExample_MEDCouplingPointSet_translate() using namespace MEDCoupling; //! [CppSnippet_MEDCouplingPointSet_translate_1] double coords[4*2]={0.0,0.0, 1.0,0.0, 1.0,1.0, 0.0,1.0}; // 2D coordinates of 4 nodes - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess(coords, 4,2); - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setCoords(coordsArr); - DataArrayDouble *initCoords = coordsArr->deepCpy(); + DataArrayDouble *initCoords = coordsArr->deepCopy(); //! [CppSnippet_MEDCouplingPointSet_translate_1] //! [CppSnippet_MEDCouplingPointSet_translate_2] double vector[2] = {1.,1.}; @@ -1778,9 +1778,9 @@ void CppExample_MEDCouplingPointSet_rotate() double coords[4*2]={0.0,0.0, 0.1,0.0, 0.1,0.1, 0.0,0.1}; // 2D coordinates of 4 nodes double coordsOrig[4*2]; std::copy(coords,coords+sizeof(coords)/sizeof(double),coordsOrig);//keep tracks of initial values - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess(coords, 4,2); - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setCoords(coordsArr); //! [CppSnippet_MEDCouplingPointSet_rotate_1] //! [CppSnippet_MEDCouplingPointSet_rotate_2] @@ -1806,9 +1806,9 @@ void CppExample_MEDCouplingPointSet_getBoundingBox() //! [CppSnippet_MEDCouplingPointSet_getBoundingBox_1] double cc[2*3]={0.0, 0.1, 0.2, // 3D coordinates of 2 nodes 2.0, 2.1, 2.2}; - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess(cc, 2,3); - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setCoords(coordsArr); //! [CppSnippet_MEDCouplingPointSet_getBoundingBox_1] //! [CppSnippet_MEDCouplingPointSet_getBoundingBox_2] @@ -1832,9 +1832,9 @@ void CppExample_MEDCouplingPointSet_getNodeIdsNearPoint() 0.3,-0.30002, // #2 1.1,0.0, // #3 0.3,-0.30003};// #4 - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess(coords, 5,2); - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setCoords(coordsArr); //! [CppSnippet_MEDCouplingPointSet_getNodeIdsNearPoint_1] //! [CppSnippet_MEDCouplingPointSet_getNodeIdsNearPoint_2] @@ -1843,7 +1843,7 @@ void CppExample_MEDCouplingPointSet_getNodeIdsNearPoint() // check found ids const int expectedIDs[3] = {0,2,4}; - DataArrayInt * okIDs = ids->getIdsEqualList ( expectedIDs, expectedIDs+3 ); + DataArrayInt * okIDs = ids->findIdsEqualList ( expectedIDs, expectedIDs+3 ); CPPUNIT_ASSERT_EQUAL(3, okIDs->getNumberOfTuples()); // release data @@ -1863,9 +1863,9 @@ void CppExample_MEDCouplingPointSet_getNodeIdsNearPoints() 1.1,0.0, // #4 1.1,0.002, // #5 0.3,-0.303};// #6 - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess(coords, 7,2); - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setCoords(coordsArr); //! [CppSnippet_MEDCouplingPointSet_getNodeIdsNearPoints_1] //! [CppSnippet_MEDCouplingPointSet_getNodeIdsNearPoints_2] @@ -1878,7 +1878,7 @@ void CppExample_MEDCouplingPointSet_getNodeIdsNearPoints() // check found ids (i.e. contents of 'ids' array) const int expectedIDs[4] = {1, 3, 4, 5}; - DataArrayInt * okIDs = ids->getIdsEqualList ( expectedIDs, expectedIDs+4 ); + DataArrayInt * okIDs = ids->findIdsEqualList ( expectedIDs, expectedIDs+4 ); CPPUNIT_ASSERT_EQUAL(4, okIDs->getNumberOfTuples()); // release data @@ -1898,9 +1898,9 @@ void CppExample_MEDCouplingPointSet_findCommonNodes() 1.1,0.0, // 3 1.1,0.0, // 4 0.3,-0.303};// 5 - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess(coords, 6,2); - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setCoords(coordsArr); //! [CppSnippet_MEDCouplingPointSet_findCommonNodes_1] //! [CppSnippet_MEDCouplingPointSet_findCommonNodes_2] @@ -1919,9 +1919,9 @@ void CppExample_MEDCouplingPointSet_getCoordinatesOfNode() using namespace MEDCoupling; //! [CppSnippet_MEDCouplingPointSet_getCoordinatesOfNode_1] double coords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3}; - MEDCouplingAutoRefCountObjectPtr coordsArr=DataArrayDouble::New(); + MCAuto coordsArr=DataArrayDouble::New(); coordsArr->useExternalArrayWithRWAccess(coords, 3,2); - MEDCouplingAutoRefCountObjectPtr mesh=MEDCouplingUMesh::New(); + MCAuto mesh=MEDCouplingUMesh::New(); mesh->setCoords(coordsArr); //! [CppSnippet_MEDCouplingPointSet_getCoordinatesOfNode_1] //! [CppSnippet_MEDCouplingPointSet_getCoordinatesOfNode_2] @@ -1998,7 +1998,7 @@ void CppExample_DataArrayDouble_getIdsInRange() da->alloc(10,1); da->iota(); - DataArrayInt* da2 = da->getIdsInRange( 2.5, 6 ); + DataArrayInt* da2 = da->findIdsInRange( 2.5, 6 ); //! [CppSnippet_DataArrayDouble_getIdsInRange_1] da->decrRef(); da2->decrRef(); @@ -2107,7 +2107,7 @@ void CppExampleFieldDoubleBuildSubPart1() CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension()); MEDCoupling::MEDCouplingUMesh *m2C=dynamic_cast(const_cast(f2->getMesh())); - CPPUNIT_ASSERT_EQUAL(13,m2C->getMeshLength()); + CPPUNIT_ASSERT_EQUAL(13,m2C->getNodalConnectivityArrayLen()); const double expected2[12]={0.2, -0.3, 0.7, -0.3, 0.2, 0.2, 0.7, 0.2, 0.2, 0.7, 0.7, 0.7}; for(int i=0;i<12;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],m2C->getCoords()->getIJ(0,i),1.e-12); @@ -2177,7 +2177,7 @@ void CppSnippetUMeshStdBuild1() mesh->setCoords(coordsArr);//coordsArr contains 9 tuples, that is to say mesh contains 9 nodes. coordsArr->decrRef(); //! [CppSnippetUMeshStdBuild1_4] - mesh->checkCoherency(); + mesh->checkConsistencyLight(); //! [CppSnippetUMeshStdBuild1_5] mesh->decrRef(); //! [CppSnippetUMeshStdBuild1_5] @@ -2257,7 +2257,7 @@ void CppSnippetUMeshAdvBuild1() mesh->setCoords(coordsArr);//coordsArr contains 9 tuples, that is to say mesh contains 9 nodes. coordsArr->decrRef(); //! [CppSnippetUMeshAdvBuild1_4] - mesh->checkCoherency(); + mesh->checkConsistencyLight(); //! [CppSnippetUMeshAdvBuild1_5] mesh->decrRef(); //! [CppSnippetUMeshAdvBuild1_5] @@ -2318,7 +2318,7 @@ void CppSnippetDataArrayBuild1() std::copy(coords,coords+3*nbOfNodes,tmp); MEDCoupling::DataArrayDouble *coordsArrCpy=0; //! [CppSnippetDataArrayBuild1_5] - coordsArrCpy=coordsArr->deepCpy(); + coordsArrCpy=coordsArr->deepCopy(); //! [CppSnippetDataArrayBuild1_5] //! [CppSnippetDataArrayBuild1_6] CPPUNIT_ASSERT(coordsArrCpy->isEqual(*coordsArr,1e-12)); @@ -2329,14 +2329,14 @@ void CppSnippetDataArrayBuild1() coordsArrCpy->decrRef(); //! [CppSnippetDataArrayBuild1_7] //! [CppSnippetDataArrayBuild1_5bis] - coordsArrCpy=coordsArr->performCpy(true); + coordsArrCpy=coordsArr->performCopyOrIncrRef(true); //! [CppSnippetDataArrayBuild1_5bis] CPPUNIT_ASSERT(coordsArrCpy->isEqual(*coordsArr,1e-12)); coordsArrCpy->setIJ(0,0,1000.); CPPUNIT_ASSERT(!coordsArrCpy->isEqual(*coordsArr,1e-12));//coordsArrCpy only has been modified coordsArrCpy->decrRef(); //! [CppSnippetDataArrayBuild1_8] - coordsArrCpy=coordsArr->performCpy(false); + coordsArrCpy=coordsArr->performCopyOrIncrRef(false); //! [CppSnippetDataArrayBuild1_8] //! [CppSnippetDataArrayBuild1_9] CPPUNIT_ASSERT(coordsArrCpy->isEqual(*coordsArr,1e-12)); @@ -2350,7 +2350,7 @@ void CppSnippetDataArrayBuild1() coordsArrCpy=MEDCoupling::DataArrayDouble::New(); //! [CppSnippetDataArrayBuild1_11] //! [CppSnippetDataArrayBuild1_12] - coordsArrCpy->cpyFrom(*coordsArr); + coordsArrCpy->deepCopyFrom(*coordsArr); //! [CppSnippetDataArrayBuild1_12] //! [CppSnippetDataArrayBuild1_13] CPPUNIT_ASSERT(coordsArrCpy->isEqual(*coordsArr,1e-12)); diff --git a/src/MEDCoupling/Test/MEDCouplingRemapperTest.cxx b/src/MEDCoupling/Test/MEDCouplingRemapperTest.cxx index 0b1564ccc..a2960a0b6 100644 --- a/src/MEDCoupling/Test/MEDCouplingRemapperTest.cxx +++ b/src/MEDCoupling/Test/MEDCouplingRemapperTest.cxx @@ -20,7 +20,7 @@ #include "MEDCouplingRemapperTest.hxx" #include "MEDCouplingUMesh.hxx" -#include "MEDCouplingExtrudedMesh.hxx" +#include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingFieldTemplate.hxx" #include "MEDCouplingMemArray.hxx" @@ -44,7 +44,7 @@ void MEDCouplingRemapperTest::test2DInterpP0P0_1() CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(sourceMesh,targetMesh,"P0P0")); MEDCouplingFieldDouble *srcField=MEDCouplingFieldDouble::New(ON_CELLS); - srcField->setNature(ConservativeVolumic); + srcField->setNature(IntensiveMaximum); srcField->setMesh(sourceMesh); DataArrayDouble *array=DataArrayDouble::New(); array->alloc(sourceMesh->getNumberOfCells(),1); @@ -62,7 +62,7 @@ void MEDCouplingRemapperTest::test2DInterpP0P0_1() CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected[i0],values[i0],1e-12); trgfield->decrRef(); // - srcField->setNature(IntegralGlobConstraint); + srcField->setNature(ExtensiveConservation); trgfield=remapper.transferField(srcField,4.57); values=trgfield->getArray()->getConstPointer(); const double valuesExpected2[5]={3.75 ,1.75 ,1.75,4.,3.75}; @@ -72,7 +72,7 @@ void MEDCouplingRemapperTest::test2DInterpP0P0_1() CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected2[i0],values[i0],1e-12); trgfield->decrRef(); // - srcField->setNature(ConservativeVolumic); + srcField->setNature(IntensiveMaximum); trgfield=remapper.transferField(srcField,4.57); values=trgfield->getArray()->getConstPointer(); CPPUNIT_ASSERT_EQUAL(5,trgfield->getArray()->getNumberOfTuples()); @@ -81,7 +81,7 @@ void MEDCouplingRemapperTest::test2DInterpP0P0_1() CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected[i0],values[i0],1e-12); trgfield->decrRef(); // - srcField->setNature(IntegralGlobConstraint); + srcField->setNature(ExtensiveConservation); trgfield=remapper.transferField(srcField,4.57); values=trgfield->getArray()->getConstPointer(); CPPUNIT_ASSERT_EQUAL(5,trgfield->getArray()->getNumberOfTuples()); @@ -90,7 +90,7 @@ void MEDCouplingRemapperTest::test2DInterpP0P0_1() CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected2[i0],values[i0],1e-12); trgfield->decrRef(); // - srcField->setNature(Integral); + srcField->setNature(ExtensiveMaximum); trgfield=remapper.transferField(srcField,4.57); values=trgfield->getArray()->getConstPointer(); CPPUNIT_ASSERT_EQUAL(5,trgfield->getArray()->getNumberOfTuples()); @@ -99,7 +99,7 @@ void MEDCouplingRemapperTest::test2DInterpP0P0_1() CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected2[i0],values[i0],1e-12); trgfield->decrRef(); // - srcField->setNature(RevIntegral); + srcField->setNature(IntensiveConservation); trgfield=remapper.transferField(srcField,4.57); values=trgfield->getArray()->getConstPointer(); CPPUNIT_ASSERT_EQUAL(5,trgfield->getArray()->getNumberOfTuples()); @@ -125,7 +125,7 @@ void MEDCouplingRemapperTest::test2DInterpP0P0R_1() CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(sourceMesh,targetMesh,"P0P0")); MEDCouplingFieldDouble *targetField=MEDCouplingFieldDouble::New(ON_CELLS); - targetField->setNature(ConservativeVolumic); + targetField->setNature(IntensiveMaximum); targetField->setMesh(targetMesh); DataArrayDouble *array=DataArrayDouble::New(); array->alloc(targetMesh->getNumberOfCells(),1); @@ -144,7 +144,7 @@ void MEDCouplingRemapperTest::test2DInterpP0P0R_1() CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected[i0],values[i0],1e-12); srcfield->decrRef(); // - targetField->setNature(IntegralGlobConstraint); + targetField->setNature(ExtensiveConservation); srcfield=remapper.reverseTransferField(targetField,4.57); values=srcfield->getArray()->getConstPointer(); const double valuesExpected2[2]={26., 19.}; @@ -168,7 +168,7 @@ void MEDCouplingRemapperTest::test1DInterp_1() MEDCouplingRemapper remapper; CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(sourceMesh,targetMesh,"P0P0")); MEDCouplingFieldDouble *srcField=MEDCouplingFieldDouble::New(ON_CELLS); - srcField->setNature(ConservativeVolumic); + srcField->setNature(IntensiveMaximum); srcField->setMesh(sourceMesh); DataArrayDouble *array=DataArrayDouble::New(); array->alloc(sourceMesh->getNumberOfCells(),1); @@ -187,7 +187,7 @@ void MEDCouplingRemapperTest::test1DInterp_1() CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected1[i0],values[i0],1e-12); trgfield->decrRef(); const double valuesExpected2[2]={24.75,5.75}; - srcField->setNature(Integral); + srcField->setNature(ExtensiveMaximum); trgfield=remapper.transferField(srcField,4.57); values=trgfield->getArray()->getConstPointer(); CPPUNIT_ASSERT_EQUAL(2,trgfield->getArray()->getNumberOfTuples()); @@ -197,7 +197,7 @@ void MEDCouplingRemapperTest::test1DInterp_1() trgfield->decrRef(); // const double valuesExpected3[2]={24.75,9.25}; - srcField->setNature(IntegralGlobConstraint); + srcField->setNature(ExtensiveConservation); trgfield=remapper.transferField(srcField,4.57); values=trgfield->getArray()->getConstPointer(); CPPUNIT_ASSERT_EQUAL(2,trgfield->getArray()->getNumberOfTuples()); @@ -207,7 +207,7 @@ void MEDCouplingRemapperTest::test1DInterp_1() trgfield->decrRef(); // const double valuesExpected4[2]={7.4444444444444446,7.4}; - srcField->setNature(RevIntegral); + srcField->setNature(IntensiveConservation); trgfield=remapper.transferField(srcField,4.57); values=trgfield->getArray()->getConstPointer(); CPPUNIT_ASSERT_EQUAL(2,trgfield->getArray()->getNumberOfTuples()); @@ -224,7 +224,7 @@ void MEDCouplingRemapperTest::test1DInterp_1() targetMesh=MEDCouplingBasicsTest::build2DCurveTargetMesh_2(); CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(sourceMesh,targetMesh,"P0P0")); srcField=MEDCouplingFieldDouble::New(ON_CELLS); - srcField->setNature(ConservativeVolumic); + srcField->setNature(IntensiveMaximum); srcField->setMesh(sourceMesh); array=DataArrayDouble::New(); array->alloc(sourceMesh->getNumberOfCells(),1); @@ -241,7 +241,7 @@ void MEDCouplingRemapperTest::test1DInterp_1() for(int i0=0;i0<2;i0++) CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected1[i0],values[i0],1e-12); trgfield->decrRef(); - srcField->setNature(Integral); + srcField->setNature(ExtensiveMaximum); trgfield=remapper.transferField(srcField,4.57); values=trgfield->getArray()->getConstPointer(); CPPUNIT_ASSERT_EQUAL(2,trgfield->getArray()->getNumberOfTuples()); @@ -250,7 +250,7 @@ void MEDCouplingRemapperTest::test1DInterp_1() CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected2[i0],values[i0],1e-12); trgfield->decrRef(); // - srcField->setNature(IntegralGlobConstraint); + srcField->setNature(ExtensiveConservation); trgfield=remapper.transferField(srcField,4.57); values=trgfield->getArray()->getConstPointer(); CPPUNIT_ASSERT_EQUAL(2,trgfield->getArray()->getNumberOfTuples()); @@ -259,7 +259,7 @@ void MEDCouplingRemapperTest::test1DInterp_1() CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected3[i0],values[i0],1e-12); trgfield->decrRef(); // - srcField->setNature(RevIntegral); + srcField->setNature(IntensiveConservation); trgfield=remapper.transferField(srcField,4.57); values=trgfield->getArray()->getConstPointer(); CPPUNIT_ASSERT_EQUAL(2,trgfield->getArray()->getNumberOfTuples()); @@ -284,7 +284,7 @@ void MEDCouplingRemapperTest::test2DInterpMultiMethods() CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(sourceMesh,targetMesh,"P0P0")); MEDCouplingFieldDouble *srcField=MEDCouplingFieldDouble::New(ON_CELLS); - srcField->setNature(ConservativeVolumic); + srcField->setNature(IntensiveMaximum); srcField->setMesh(sourceMesh); DataArrayDouble *array=DataArrayDouble::New(); array->alloc(sourceMesh->getNumberOfCells(),1); @@ -305,7 +305,7 @@ void MEDCouplingRemapperTest::test2DInterpMultiMethods() // CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(sourceMesh,targetMesh,"P1P0")); srcField=MEDCouplingFieldDouble::New(ON_NODES); - srcField->setNature(ConservativeVolumic); + srcField->setNature(IntensiveMaximum); srcField->setMesh(sourceMesh); array=DataArrayDouble::New(); array->alloc(sourceMesh->getNumberOfNodes(),1); @@ -326,7 +326,7 @@ void MEDCouplingRemapperTest::test2DInterpMultiMethods() // CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(targetMesh,sourceMesh,"P0P1")); srcField=MEDCouplingFieldDouble::New(ON_CELLS); - srcField->setNature(ConservativeVolumic); + srcField->setNature(IntensiveMaximum); srcField->setMesh(targetMesh); array=DataArrayDouble::New(); array->alloc(targetMesh->getNumberOfCells(),1); @@ -352,7 +352,7 @@ void MEDCouplingRemapperTest::test2DInterpMultiMethods() targetMesh=MEDCouplingBasicsTest::build2DTargetMesh_2(); CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(sourceMesh,targetMesh,"P1P1")); srcField=MEDCouplingFieldDouble::New(ON_NODES); - srcField->setNature(ConservativeVolumic); + srcField->setNature(IntensiveMaximum); srcField->setMesh(sourceMesh); array=DataArrayDouble::New(); array->alloc(sourceMesh->getNumberOfNodes(),1); @@ -387,7 +387,7 @@ void MEDCouplingRemapperTest::testMultiDimCombi() remapper.setIntersectionType(INTERP_KERNEL::Triangulation); CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(sourceMesh,targetMesh,"P0P0")); MEDCouplingFieldDouble *srcField=MEDCouplingFieldDouble::New(ON_CELLS); - srcField->setNature(ConservativeVolumic); + srcField->setNature(IntensiveMaximum); srcField->setMesh(sourceMesh); DataArrayDouble *array=DataArrayDouble::New(); array->alloc(sourceMesh->getNumberOfCells(),1); @@ -412,7 +412,7 @@ void MEDCouplingRemapperTest::testMultiDimCombi() targetMesh=MEDCouplingBasicsTest::build3DSurfTargetMesh_1(); CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(sourceMesh,targetMesh,"P0P0")); srcField=MEDCouplingFieldDouble::New(ON_CELLS); - srcField->setNature(ConservativeVolumic); + srcField->setNature(IntensiveMaximum); srcField->setMesh(sourceMesh); array=DataArrayDouble::New(); array->alloc(sourceMesh->getNumberOfCells(),1); @@ -437,7 +437,7 @@ void MEDCouplingRemapperTest::testMultiDimCombi() targetMesh=MEDCouplingBasicsTest::build3DTargetMesh_1(); CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(sourceMesh,targetMesh,"P0P0")); srcField=MEDCouplingFieldDouble::New(ON_CELLS); - srcField->setNature(ConservativeVolumic); + srcField->setNature(IntensiveMaximum); srcField->setMesh(sourceMesh); array=DataArrayDouble::New(); array->alloc(sourceMesh->getNumberOfCells(),1); @@ -464,7 +464,7 @@ void MEDCouplingRemapperTest::testMultiDimCombi() remapper.setIntersectionType(INTERP_KERNEL::PointLocator); CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(sourceMesh,targetMesh,"P0P0")); srcField=MEDCouplingFieldDouble::New(ON_CELLS); - srcField->setNature(ConservativeVolumic); + srcField->setNature(IntensiveMaximum); srcField->setMesh(sourceMesh); array=DataArrayDouble::New(); array->alloc(sourceMesh->getNumberOfCells(),1); @@ -490,7 +490,7 @@ void MEDCouplingRemapperTest::testMultiDimCombi() remapper.setIntersectionType(INTERP_KERNEL::PointLocator); CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(sourceMesh,targetMesh,"P0P0")); srcField=MEDCouplingFieldDouble::New(ON_CELLS); - srcField->setNature(ConservativeVolumic); + srcField->setNature(IntensiveMaximum); srcField->setMesh(sourceMesh); array=DataArrayDouble::New(); array->alloc(sourceMesh->getNumberOfCells(),1); @@ -516,7 +516,7 @@ void MEDCouplingRemapperTest::testMultiDimCombi() remapper.setIntersectionType(INTERP_KERNEL::PointLocator); CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(sourceMesh,targetMesh,"P0P0")); srcField=MEDCouplingFieldDouble::New(ON_CELLS); - srcField->setNature(ConservativeVolumic); + srcField->setNature(IntensiveMaximum); srcField->setMesh(sourceMesh); array=DataArrayDouble::New(); array->alloc(sourceMesh->getNumberOfCells(),1); @@ -540,7 +540,7 @@ void MEDCouplingRemapperTest::testMultiDimCombi() remapper.setIntersectionType(INTERP_KERNEL::PointLocator); CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(sourceMesh,targetMesh,"P0P0")); srcField=MEDCouplingFieldDouble::New(ON_CELLS); - srcField->setNature(ConservativeVolumic); + srcField->setNature(IntensiveMaximum); srcField->setMesh(sourceMesh); array=DataArrayDouble::New(); array->alloc(sourceMesh->getNumberOfCells(),1); @@ -562,7 +562,7 @@ void MEDCouplingRemapperTest::testMultiDimCombi() sourceMesh=MEDCouplingBasicsTest::build2DTargetMesh_1(); targetMesh=MEDCouplingUMesh::New("an example of -1 D mesh",-1); srcField=MEDCouplingFieldDouble::New(ON_CELLS); - srcField->setNature(ConservativeVolumic); + srcField->setNature(IntensiveMaximum); srcField->setMesh(sourceMesh); array=DataArrayDouble::New(); array->alloc(sourceMesh->getNumberOfCells(),1); @@ -585,7 +585,7 @@ void MEDCouplingRemapperTest::testMultiDimCombi() for(int i0=0;i0<5;i0++) CPPUNIT_ASSERT_DOUBLES_EQUAL(9.125,values[i0],1e-14); srcField->decrRef(); - trgField->setNature(Integral); + trgField->setNature(ExtensiveMaximum); srcField=remapper.reverseTransferField(trgField,4.220173); CPPUNIT_ASSERT_EQUAL(5,srcField->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,srcField->getNumberOfComponents()); @@ -598,7 +598,7 @@ void MEDCouplingRemapperTest::testMultiDimCombi() // ------------- -1D -> 2D CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(targetMesh,sourceMesh,"P0P0")); trgField=MEDCouplingFieldDouble::New(ON_CELLS); - trgField->setNature(ConservativeVolumic); + trgField->setNature(IntensiveMaximum); trgField->setMesh(targetMesh); array=DataArrayDouble::New(); array->alloc(targetMesh->getNumberOfCells(),1); @@ -611,14 +611,14 @@ void MEDCouplingRemapperTest::testMultiDimCombi() for(int i0=0;i0<5;i0++) CPPUNIT_ASSERT_DOUBLES_EQUAL(7.,values[i0],1e-14); srcField->decrRef(); - trgField->setNature(IntegralGlobConstraint); + trgField->setNature(ExtensiveConservation); srcField=remapper.transferField(trgField,4.221073); values=srcField->getArray()->getConstPointer(); const double valuesExpected7[5]={1.75,0.875,0.875,1.75,1.75}; for(int i0=0;i0<5;i0++) CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected7[i0],values[i0],1e-14); srcField->decrRef(); - trgField->setNature(Integral); + trgField->setNature(ExtensiveMaximum); srcField=remapper.transferField(trgField,4.221073); values=srcField->getArray()->getConstPointer(); for(int i0=0;i0<5;i0++) @@ -655,7 +655,7 @@ void MEDCouplingRemapperTest::testMultiDimCombi() remapper.setIntersectionType(INTERP_KERNEL::Geometric2D); CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(sourceMesh,targetMesh,"P0P0")); srcField=MEDCouplingFieldDouble::New(ON_CELLS); - srcField->setNature(ConservativeVolumic); + srcField->setNature(IntensiveMaximum); srcField->setMesh(sourceMesh); array=DataArrayDouble::New(); array->alloc(4,1); array->iota(2.); @@ -673,7 +673,7 @@ void MEDCouplingRemapperTest::testMultiDimCombi() remapper.setIntersectionType(INTERP_KERNEL::Geometric2D); CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(targetMesh,sourceMesh,"P0P0")); srcField=MEDCouplingFieldDouble::New(ON_CELLS); - srcField->setNature(ConservativeVolumic); + srcField->setNature(IntensiveMaximum); srcField->setMesh(targetMesh); array=DataArrayDouble::New(); array->alloc(3,1); array->iota(2.); @@ -694,7 +694,7 @@ void MEDCouplingRemapperTest::testMultiDimCombi() remapper.setIntersectionType(INTERP_KERNEL::Triangulation); CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(sourceMesh,targetMesh,"P0P0")); srcField=MEDCouplingFieldDouble::New(ON_CELLS); - srcField->setNature(ConservativeVolumic); + srcField->setNature(IntensiveMaximum); srcField->setMesh(sourceMesh); array=DataArrayDouble::New(); array->alloc(7,1); array->iota(2.); @@ -710,7 +710,7 @@ void MEDCouplingRemapperTest::testMultiDimCombi() //------------- 3D -> 2D CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(targetMesh,sourceMesh,"P0P0")); srcField=MEDCouplingFieldDouble::New(ON_CELLS); - srcField->setNature(ConservativeVolumic); + srcField->setNature(IntensiveMaximum); srcField->setMesh(targetMesh); array=DataArrayDouble::New(); array->alloc(3,1); array->iota(2.); @@ -737,7 +737,7 @@ void MEDCouplingRemapperTest::testNatureOfField() remapper.setIntersectionType(INTERP_KERNEL::Triangulation); CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(sourceMesh,targetMesh,"P0P0")); MEDCouplingFieldDouble *srcField=MEDCouplingFieldDouble::New(ON_CELLS); - srcField->setNature(ConservativeVolumic); + srcField->setNature(IntensiveMaximum); srcField->setMesh(sourceMesh); DataArrayDouble *array=DataArrayDouble::New(); array->alloc(sourceMesh->getNumberOfCells(),1); @@ -755,7 +755,7 @@ void MEDCouplingRemapperTest::testNatureOfField() CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected[i0],values[i0],1e-12); trgfield->decrRef(); // - srcField->setNature(IntegralGlobConstraint); + srcField->setNature(ExtensiveConservation); trgfield=remapper.transferField(srcField,4.220173); values=trgfield->getArray()->getConstPointer(); const double valuesExpected2[4]={2.8374999999999999, 7.3624999999999998, 4.220173, 4.7999999999999998}; @@ -765,7 +765,7 @@ void MEDCouplingRemapperTest::testNatureOfField() CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected2[i0],values[i0],1e-12); trgfield->decrRef(); // - srcField->setNature(Integral); + srcField->setNature(ExtensiveMaximum); trgfield=remapper.transferField(srcField,4.220173); values=trgfield->getArray()->getConstPointer(); const double valuesExpected3[4]={1.24, 4.5199999999999996, 4.220173, 1.9199999999999999}; @@ -775,7 +775,7 @@ void MEDCouplingRemapperTest::testNatureOfField() CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected3[i0],values[i0],1e-12); trgfield->decrRef(); // - srcField->setNature(RevIntegral); + srcField->setNature(IntensiveConservation); trgfield=remapper.transferField(srcField,4.220173); values=trgfield->getArray()->getConstPointer(); const double valuesExpected9[4]={2.48, 3.766666666666666, 4.220173, 1.9199999999999999}; @@ -788,7 +788,7 @@ void MEDCouplingRemapperTest::testNatureOfField() srcField->decrRef(); // REVERSE *********** trgfield=MEDCouplingFieldDouble::New(ON_CELLS); - trgfield->setNature(ConservativeVolumic); + trgfield->setNature(IntensiveMaximum); trgfield->setMesh(targetMesh); array=DataArrayDouble::New(); array->alloc(targetMesh->getNumberOfCells(),1); @@ -816,7 +816,7 @@ void MEDCouplingRemapperTest::testNatureOfField() // CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(sourceMesh,targetMesh,"P0P0")); srcField=MEDCouplingFieldDouble::New(ON_CELLS); - srcField->setNature(ConservativeVolumic); + srcField->setNature(IntensiveMaximum); srcField->setMesh(sourceMesh); array=DataArrayDouble::New(); array->alloc(sourceMesh->getNumberOfCells(),1); @@ -834,7 +834,7 @@ void MEDCouplingRemapperTest::testNatureOfField() CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected5[i0],values[i0],1e-12); trgfield->decrRef(); // - srcField->setNature(IntegralGlobConstraint); + srcField->setNature(ExtensiveConservation); trgfield=remapper.transferField(srcField,4.220173); values=trgfield->getArray()->getConstPointer(); const double valuesExpected6[4]={9.25, 15.75}; @@ -844,7 +844,7 @@ void MEDCouplingRemapperTest::testNatureOfField() CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected6[i0],values[i0],1e-12); trgfield->decrRef(); // - srcField->setNature(Integral); + srcField->setNature(ExtensiveMaximum); trgfield=remapper.transferField(srcField,4.220173); values=trgfield->getArray()->getConstPointer(); const double valuesExpected7[2]={4.56, 4.3466666666666667}; @@ -854,7 +854,7 @@ void MEDCouplingRemapperTest::testNatureOfField() CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected7[i0],values[i0],1e-12); trgfield->decrRef(); // - srcField->setNature(RevIntegral); + srcField->setNature(IntensiveConservation); trgfield=remapper.transferField(srcField,4.220173); values=trgfield->getArray()->getConstPointer(); const double valuesExpected10[2]={5.08, 3.56}; @@ -867,7 +867,7 @@ void MEDCouplingRemapperTest::testNatureOfField() srcField->decrRef(); // REVERSE *********** trgfield=MEDCouplingFieldDouble::New(ON_CELLS); - trgfield->setNature(ConservativeVolumic); + trgfield->setNature(IntensiveMaximum); trgfield->setMesh(targetMesh); array=DataArrayDouble::New(); array->alloc(targetMesh->getNumberOfCells(),1); @@ -895,12 +895,12 @@ void MEDCouplingRemapperTest::testExtruded() { MEDCouplingUMesh *mesh2DS=0; MEDCouplingUMesh *mesh3DS=build3DExtrudedUMesh_1(mesh2DS); - MEDCouplingExtrudedMesh *extS=MEDCouplingExtrudedMesh::New(mesh3DS,mesh2DS,1); + MEDCouplingMappedExtrudedMesh *extS=MEDCouplingMappedExtrudedMesh::New(mesh3DS,mesh2DS,1); mesh3DS->decrRef(); mesh2DS->decrRef(); MEDCouplingUMesh *mesh2DT=0; MEDCouplingUMesh *mesh3DT=build3DExtrudedUMesh_1(mesh2DT); - MEDCouplingExtrudedMesh *extT=MEDCouplingExtrudedMesh::New(mesh3DT,mesh2DT,1); + MEDCouplingMappedExtrudedMesh *extT=MEDCouplingMappedExtrudedMesh::New(mesh3DT,mesh2DT,1); // // mesh3DT->decrRef(); @@ -932,16 +932,16 @@ void MEDCouplingRemapperTest::testExtruded2() MEDCouplingUMesh *meshTF2D=(MEDCouplingUMesh *)meshTF->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true); n.clear(); // - MEDCouplingExtrudedMesh *meshNE=MEDCouplingExtrudedMesh::New(meshN,meshN2D,0); - MEDCouplingExtrudedMesh *meshTTE=MEDCouplingExtrudedMesh::New(meshTT,meshTT2D,0); - MEDCouplingExtrudedMesh *meshTFE=MEDCouplingExtrudedMesh::New(meshTF,meshTF2D,0); + MEDCouplingMappedExtrudedMesh *meshNE=MEDCouplingMappedExtrudedMesh::New(meshN,meshN2D,0); + MEDCouplingMappedExtrudedMesh *meshTTE=MEDCouplingMappedExtrudedMesh::New(meshTT,meshTT2D,0); + MEDCouplingMappedExtrudedMesh *meshTFE=MEDCouplingMappedExtrudedMesh::New(meshTF,meshTF2D,0); // MEDCouplingRemapper remapper; remapper.setPrecision(1e-12); remapper.setIntersectionType(INTERP_KERNEL::Triangulation); CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(meshNE,meshTTE,"P0P0")); MEDCouplingFieldDouble *srcField=MEDCouplingFieldDouble::New(ON_CELLS); - srcField->setNature(IntegralGlobConstraint); + srcField->setNature(ExtensiveConservation); srcField->setMesh(meshNE); DataArrayDouble *array=DataArrayDouble::New(); array->alloc(meshNE->getNumberOfCells(),1); @@ -1011,7 +1011,7 @@ void MEDCouplingRemapperTest::testExtruded2() }; CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(meshNE,meshTTE,"P0P0")); trgField=MEDCouplingFieldDouble::New(ON_CELLS); - trgField->setNature(ConservativeVolumic); + trgField->setNature(IntensiveMaximum); trgField->setMesh(meshTTE); array=DataArrayDouble::New(); array->alloc(meshTTE->getNumberOfCells(),1); @@ -1053,7 +1053,7 @@ void MEDCouplingRemapperTest::testExtruded2() }; CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(meshNE,meshTFE,"P0P0")); trgField=MEDCouplingFieldDouble::New(ON_CELLS); - trgField->setNature(ConservativeVolumic); + trgField->setNature(IntensiveMaximum); trgField->setMesh(meshTFE); array=DataArrayDouble::New(); array->alloc(meshTFE->getNumberOfCells(),1); @@ -1097,7 +1097,7 @@ void MEDCouplingRemapperTest::testPrepareEx1() srcFt->decrRef(); trgFt->decrRef(); MEDCouplingFieldDouble *srcField=MEDCouplingFieldDouble::New(ON_CELLS); - srcField->setNature(ConservativeVolumic); + srcField->setNature(IntensiveMaximum); srcField->setMesh(sourceMesh); DataArrayDouble *array=DataArrayDouble::New(); array->alloc(sourceMesh->getNumberOfCells(),1); @@ -1244,7 +1244,7 @@ void MEDCouplingRemapperTest::testPartialTransfer1() remapper.setIntersectionType(INTERP_KERNEL::PointLocator); CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(sourceMesh,targetMesh,"P0P0")); MEDCouplingFieldDouble *srcField=MEDCouplingFieldDouble::New(ON_CELLS); - srcField->setNature(ConservativeVolumic); + srcField->setNature(IntensiveMaximum); srcField->setMesh(sourceMesh); DataArrayDouble *array=DataArrayDouble::New(); array->alloc(sourceMesh->getNumberOfCells(),1); @@ -1254,7 +1254,7 @@ void MEDCouplingRemapperTest::testPartialTransfer1() ptr[i]=(double)(i+7); array->decrRef(); MEDCouplingFieldDouble *trgField=MEDCouplingFieldDouble::New(ON_CELLS); - trgField->setNature(ConservativeVolumic); + trgField->setNature(IntensiveMaximum); trgField->setMesh(targetMesh); array=DataArrayDouble::New(); array->alloc(targetMesh->getNumberOfCells(),1); diff --git a/src/MEDCoupling_Swig/MEDCoupling.i b/src/MEDCoupling_Swig/MEDCoupling.i index b3bc56581..0425da31b 100644 --- a/src/MEDCoupling_Swig/MEDCoupling.i +++ b/src/MEDCoupling_Swig/MEDCoupling.i @@ -130,7 +130,7 @@ def MEDCouplingIMeshnew(cls,*args): return _MEDCoupling.MEDCouplingIMesh____new___(cls,args) def MEDCouplingExtrudedMeshnew(cls,*args): import _MEDCoupling - return _MEDCoupling.MEDCouplingExtrudedMesh____new___(cls,args) + return _MEDCoupling.MEDCouplingMappedExtrudedMesh____new___(cls,args) %} %include "MEDCouplingFinalize.i" diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest1.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest1.py index 7c00c5653..94e074eae 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest1.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest1.py @@ -122,7 +122,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): myCoords.setValues(coords,nbOfNodes,3); self.assertTrue(myCoords.getIJ(3,2)==-0.305) mesh.setCoords(myCoords); - mesh.checkCoherency(); + mesh.checkConsistencyLight(); self.assertTrue(mesh.getAllGeoTypes()==[4]) myFalseConn=DataArrayInt.New() myFalseConn.setValues(tab4,6,4) @@ -130,7 +130,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): # field=MEDCouplingFieldDouble.New(ON_CELLS) field.setMesh(mesh) - field.setNature(Integral) + field.setNature(ExtensiveMaximum) myCoords=DataArrayDouble.New() sampleTab=[] for i in range(nbOfCells*9): @@ -138,7 +138,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): myCoords.setValues(sampleTab,nbOfCells,9); field.setArray(myCoords) self.assertTrue(3==mesh.getSpaceDimension()) - field.checkCoherency() + field.checkConsistencyLight() mesh2=mesh.clone(False) mesh3=mesh.clone(True) mesh3=0 @@ -166,7 +166,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): targetMesh.insertNextCell(NORM_POINT1,1,[7]); targetMesh.insertNextCell(NORM_POINT1,1,[6]); targetMesh.finishInsertingCells(); - self.assertRaises(InterpKernelException,targetMesh.checkCoherency); + self.assertRaises(InterpKernelException,targetMesh.checkConsistencyLight); myCoords=DataArrayDouble.New(); myCoords.setValues(targetCoords,9,3); targetMesh.setCoords(myCoords); @@ -184,7 +184,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): self.assertRaises(InterpKernelException,meshM1D.setMeshDimension,-2) self.assertRaises(InterpKernelException,meshM1D.setMeshDimension,-10) meshM1D.setMeshDimension(-1); - meshM1D.checkCoherency(); + meshM1D.checkConsistencyLight(); self.assertEqual(meshM1D.getMeshDimension(),-1); self.assertEqual(meshM1D.getNumberOfCells(),1); self.assertRaises(InterpKernelException,meshM1D.getNumberOfNodes); @@ -196,20 +196,20 @@ class MEDCouplingBasicsTest1(unittest.TestCase): array=DataArrayDouble.New(); array.setValues(6*[7.],1,6); fieldOnCells.setArray(array); - fieldOnCells.checkCoherency(); + fieldOnCells.checkConsistencyLight(); pass def testDeepCopy(self): array=DataArrayDouble.New(); array.setValues(5*3*[7.],5,3); self.assertEqual(array.getIJ(3,2),7.); - array2=array.deepCpy(); + array2=array.deepCopy(); self.assertEqual(array2.getIJ(3,2),7.) # array3=DataArrayInt.New(); array3.setValues(5*3*[17],5,3); self.assertEqual(array3.getIJ(3,2),17); - array4=array3.deepCpy(); + array4=array3.deepCopy(); self.assertEqual(array4.getIJ(3,2),17); pass @@ -228,7 +228,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): mesh=MEDCouplingDataForTest.build2DTargetMesh_1(); elts=[1,3]; mesh.convertToPolyTypes(elts); - mesh.checkCoherency(); + mesh.checkConsistencyLight(); self.assertEqual(5,mesh.getNumberOfCells()); self.assertEqual(23,mesh.getNodalConnectivity().getNumberOfTuples()); expected1=[4, 0, 3, 4, 1, 5, 1, 4, 2, 3, 4, 5, 2, 5, 6, 7, 4, 3, 4, 7, 8, 5, 4] @@ -236,11 +236,11 @@ class MEDCouplingBasicsTest1(unittest.TestCase): # mesh=MEDCouplingDataForTest.build3DTargetMesh_1(); mesh.convertToPolyTypes(elts); - mesh.checkCoherency(); + mesh.checkConsistencyLight(); self.assertEqual(8,mesh.getNumberOfCells()); self.assertEqual(114,mesh.getNodalConnectivity().getNumberOfTuples()); mesh.convertToPolyTypes(elts); - mesh.checkCoherency(); + mesh.checkConsistencyLight(); self.assertEqual(8,mesh.getNumberOfCells()); self.assertEqual(114,mesh.getNodalConnectivity().getNumberOfTuples()); pass @@ -252,7 +252,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): revDesc=DataArrayInt.New(); revDescIndx=DataArrayInt.New(); mesh2=mesh.buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); - mesh2.checkCoherency(); + mesh2.checkConsistencyLight(); self.assertEqual(1,mesh2.getMeshDimension()); self.assertEqual(13,mesh2.getNumberOfCells()); self.assertEqual(14,revDescIndx.getNbOfElems()); self.assertEqual(14,revDescIndx.getNumberOfTuples()); @@ -276,7 +276,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): # eltsV=[1,3]; mesh.convertToPolyTypes(eltsV); - mesh.checkCoherency(); + mesh.checkConsistencyLight(); # desc=DataArrayInt.New(); descIndx=DataArrayInt.New(); @@ -284,7 +284,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): revDescIndx=DataArrayInt.New(); # mesh2=mesh.buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); - mesh2.checkCoherency(); + mesh2.checkConsistencyLight(); self.assertEqual(1,mesh2.getMeshDimension()); self.assertEqual(13,mesh2.getNumberOfCells()); self.assertEqual(14,revDescIndx.getNbOfElems()); self.assertEqual(14,revDescIndx.getNumberOfTuples()); @@ -309,7 +309,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): revDescIndx=DataArrayInt.New(); # mesh2=mesh.buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); - mesh2.checkCoherency(); + mesh2.checkConsistencyLight(); self.assertEqual(2,mesh2.getMeshDimension()); self.assertEqual(36,mesh2.getNumberOfCells()); self.assertEqual(37,revDescIndx.getNbOfElems()); self.assertEqual(37,revDescIndx.getNumberOfTuples()); @@ -339,13 +339,13 @@ class MEDCouplingBasicsTest1(unittest.TestCase): # eltsV=[1,3] mesh.convertToPolyTypes(eltsV); - mesh.checkCoherency(); + mesh.checkConsistencyLight(); desc=DataArrayInt.New(); descIndx=DataArrayInt.New(); revDesc=DataArrayInt.New(); revDescIndx=DataArrayInt.New(); mesh2=mesh.buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); - mesh2.checkCoherency(); + mesh2.checkConsistencyLight(); self.assertEqual(2,mesh2.getMeshDimension()); self.assertEqual(36,mesh2.getNumberOfCells()); self.assertEqual(37,revDescIndx.getNbOfElems()); self.assertEqual(37,revDescIndx.getNumberOfTuples()); @@ -634,7 +634,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): self.assertTrue(fieldOnCells1.isEqual(fieldOnCells2,1e-12,1e-15)); self.assertTrue(fieldOnCells2.isEqual(fieldOnCells1,1e-12,1e-15)); # - arr2=arr.deepCpy(); + arr2=arr.deepCopy(); fieldOnCells2.setArray(arr2); self.assertTrue(fieldOnCells1.isEqual(fieldOnCells2,1e-12,1e-15)); self.assertTrue(fieldOnCells2.isEqual(fieldOnCells1,1e-12,1e-15)); @@ -662,13 +662,13 @@ class MEDCouplingBasicsTest1(unittest.TestCase): def testNatureChecking(self): field=MEDCouplingFieldDouble.New(ON_CELLS,NO_TIME); - field.setNature(Integral); - field.setNature(ConservativeVolumic); - field.setNature(IntegralGlobConstraint); + field.setNature(ExtensiveMaximum); + field.setNature(IntensiveMaximum); + field.setNature(ExtensiveConservation); field=MEDCouplingFieldDouble.New(ON_NODES,NO_TIME); - field.setNature(ConservativeVolumic); - self.assertRaises(InterpKernelException,field.setNature,Integral); - self.assertRaises(InterpKernelException,field.setNature,IntegralGlobConstraint); + field.setNature(IntensiveMaximum); + self.assertRaises(InterpKernelException,field.setNature,ExtensiveMaximum); + self.assertRaises(InterpKernelException,field.setNature,ExtensiveConservation); pass def testNatureOperations(self): @@ -678,14 +678,14 @@ class MEDCouplingBasicsTest1(unittest.TestCase): m.setCoordsAt(1, DataArrayDouble([1.0,2.0,3.0])) m = m.buildUnstructured() f1, f2 = MEDCouplingFieldDouble.New(ON_CELLS, NO_TIME), MEDCouplingFieldDouble.New(ON_CELLS, NO_TIME) - f1.setNature(Integral) - f2.setNature(ConservativeVolumic) - self.assertEqual(Integral, f1.getNature()) - self.assertEqual(ConservativeVolumic, f2.getNature()) + f1.setNature(ExtensiveMaximum) + f2.setNature(IntensiveMaximum) + self.assertEqual(ExtensiveMaximum, f1.getNature()) + self.assertEqual(IntensiveMaximum, f2.getNature()) da = DataArrayDouble([1.0,2.0,3.0,4.0]) f1.setMesh(m); f2.setMesh(m) - f1.setArray(da); f2.setArray(da.deepCpy()) + f1.setArray(da); f2.setArray(da.deepCopy()) # All this should complain about nature: self.assertRaises(InterpKernelException, f1.__add__, f2) self.assertRaises(InterpKernelException, f1.__iadd__, f2) @@ -702,19 +702,19 @@ class MEDCouplingBasicsTest1(unittest.TestCase): self.assertEqual(NoNature, f3.getNature()) f3 = f1*f2 self.assertEqual(NoNature, f3.getNature()) - f1Tmp = f1.deepCpy(); f1Tmp.setMesh(m); f1Tmp *= f2 + f1Tmp = f1.deepCopy(); f1Tmp.setMesh(m); f1Tmp *= f2 self.assertEqual(NoNature, f1Tmp.getNature()) f3 = MEDCouplingFieldDouble.DivideFields(f1,f2) self.assertEqual(NoNature, f3.getNature()) f3 = f1/f2 self.assertEqual(NoNature, f3.getNature()) - f1Tmp = f1.deepCpy(); f1Tmp.setMesh(m); f1Tmp /= f2 + f1Tmp = f1.deepCopy(); f1Tmp.setMesh(m); f1Tmp /= f2 self.assertEqual(NoNature, f1Tmp.getNature()) # f3 = MEDCouplingFieldDouble.PowFields(f1,f2) # self.assertEqual(NoNature, f3.getNature()) f3 = f1**f2 self.assertEqual(NoNature, f3.getNature()) - f1Tmp = f1.deepCpy(); f1Tmp.setMesh(m); f1Tmp **= f2 + f1Tmp = f1.deepCopy(); f1Tmp.setMesh(m); f1Tmp **= f2 self.assertEqual(NoNature, f1Tmp.getNature()) f3 = MEDCouplingFieldDouble.DotFields(f1,f2) self.assertEqual(NoNature, f3.getNature()) @@ -722,7 +722,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): self.assertEqual(NoNature, f3.getNature()) da = DataArrayDouble.Meld([da, da, da]) - f1.setArray(da); f2.setArray(da.deepCpy()) + f1.setArray(da); f2.setArray(da.deepCopy()) f3 = MEDCouplingFieldDouble.CrossProductFields(f1,f2) self.assertEqual(NoNature, f3.getNature()) f3 = f1.crossProduct(f2) @@ -757,7 +757,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): def testExtrudedMesh1(self): mesh3D,mesh2D=MEDCouplingDataForTest.build3DExtrudedUMesh_1(); - ext=MEDCouplingExtrudedMesh.New(mesh3D,mesh2D,1); + ext=MEDCouplingMappedExtrudedMesh.New(mesh3D,mesh2D,1); self.assertEqual(18,ext.getNumberOfCells()); self.assertEqual(60,ext.getNumberOfNodes()); ids3D=ext.getMesh3DIds(); @@ -792,7 +792,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): m2.rotate(center,vector,-pi/2.); m3=m1.buildExtrudedMesh(m2,0); # - m4=MEDCouplingExtrudedMesh.New(m3,m1,0); + m4=MEDCouplingMappedExtrudedMesh.New(m3,m1,0); self.assertEqual(15,m4.getNumberOfCells()); self.assertEqual(5,m4.getMesh2D().getNumberOfCells()); self.assertEqual(3,m4.getMesh1D().getNumberOfCells()); @@ -801,7 +801,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): #some random in cells to check that extrusion alg find it correctly expected1=[1,3,2,0,6,5,7,10,11,8,12,9,14,13,4] m3.renumberCells(expected1,False); - m4=MEDCouplingExtrudedMesh.New(m3,m1,0); + m4=MEDCouplingMappedExtrudedMesh.New(m3,m1,0); self.assertEqual(15,m4.getNumberOfCells()); self.assertEqual(5,m4.getMesh2D().getNumberOfCells()); self.assertEqual(3,m4.getMesh1D().getNumberOfCells()); @@ -817,7 +817,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): self.assertEqual(NORM_POLYHED,m3.getTypeOfCell(3)); self.assertEqual(NORM_HEXA8,m3.getTypeOfCell(4)); m3.renumberCells(expected1,False); - m4=MEDCouplingExtrudedMesh.New(m3,m1,0); + m4=MEDCouplingMappedExtrudedMesh.New(m3,m1,0); self.assertEqual(15,m4.getNumberOfCells()); self.assertEqual(5,m4.getMesh2D().getNumberOfCells()); self.assertEqual(3,m4.getMesh1D().getNumberOfCells()); @@ -840,7 +840,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): expected1=[1,3,2,0,6,5,7,10,11,8,12,9,14,13,4] rexpected1=[3, 0, 2, 1, 14, 5, 4, 6, 9, 11, 7, 8, 10, 13, 12] m3.renumberCells(expected1,False); - m4=MEDCouplingExtrudedMesh.New(m3,m1,0); + m4=MEDCouplingMappedExtrudedMesh.New(m3,m1,0); self.assertEqual(NORM_HEXA8,m4.getTypeOfCell(0)); self.assertEqual(NORM_HEXA8,m4.getTypeOfCell(1)); self.assertEqual(NORM_POLYHED,m4.getTypeOfCell(2)); @@ -861,7 +861,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): self.assertTrue(m5.isEqual(m3,1e-12)); f=m5.getMeasureField(True); f.setMesh(m4) - self.assertTrue(isinstance(f.getMesh(),MEDCouplingExtrudedMesh)) + self.assertTrue(isinstance(f.getMesh(),MEDCouplingMappedExtrudedMesh)) arr=f.getArray(); arrPtr=arr.getValues(); for i in xrange(15): @@ -981,7 +981,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): m2.translate(vec); m3=m1.mergeMyselfWith(m2); self.assertTrue(isinstance(m3,MEDCouplingUMesh)); - m3.checkCoherency(); + m3.checkConsistencyLight(); m4=MEDCouplingDataForTest.build2DTargetMeshMerged_1(); self.assertTrue(m3.isEqual(m4,1.e-12)); da,isMerged,newNbOfNodes=m3.mergeNodes(1.e-12); @@ -999,7 +999,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): m3.tryToShareSameCoords(m2,1e-12); meshes=[m1,m2,m3] m4=MEDCouplingUMesh.MergeUMeshesOnSameCoords(meshes); - m4.checkCoherency(); + m4.checkConsistencyLight(); self.assertEqual(15,m4.getNumberOfCells()); cells1=[0,1,2,3,4] m1_1=m4.buildPartOfMySelf(cells1,True); @@ -1023,7 +1023,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): f1=m1.getMeasureField(True); f2=m2.getMeasureField(True); f3=MEDCouplingFieldDouble.MergeFields(f1,f2); - f3.checkCoherency(); + f3.checkConsistencyLight(); m4=MEDCouplingDataForTest.build2DTargetMeshMerged_1(); self.assertTrue(f3.getMesh().isEqual(m4,1.e-12)); name=f3.getName(); @@ -1046,7 +1046,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): f1=m.fillFromAnalytic(ON_CELLS,1,"x+y"); self.assertAlmostEqual(3.4,f1.getTime()[0],12) ; self.assertEqual(5,f1.getTime()[1]) ; self.assertEqual(6,f1.getTime()[2]) self.assertEqual("us",f1.getTimeUnit()) - f1.checkCoherency(); + f1.checkConsistencyLight(); self.assertEqual(f1.getTypeOfField(),ON_CELLS); self.assertEqual(f1.getTimeDiscretization(),ONE_TIME); self.assertEqual(1,f1.getNumberOfComponents()); @@ -1059,7 +1059,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): pass # f1=m.fillFromAnalytic(ON_NODES,1,"x+y"); - f1.checkCoherency(); + f1.checkConsistencyLight(); self.assertEqual(f1.getTypeOfField(),ON_NODES); self.assertEqual(f1.getTimeDiscretization(),ONE_TIME); self.assertEqual(1,f1.getNumberOfComponents()); @@ -1072,7 +1072,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): pass # f1=m.fillFromAnalytic(ON_NODES,2,"(x+y)*IVec+(2*(x+y))*JVec"); - f1.checkCoherency(); + f1.checkConsistencyLight(); self.assertEqual(f1.getTypeOfField(),ON_NODES); self.assertEqual(f1.getTimeDiscretization(),ONE_TIME); self.assertEqual(2,f1.getNumberOfComponents()); @@ -1098,7 +1098,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): def testFillFromAnalytic2(self): m=MEDCouplingDataForTest.build2DTargetMesh_1(); f1=m.fillFromAnalytic(ON_CELLS,1,"y+x"); - f1.checkCoherency(); + f1.checkConsistencyLight(); self.assertEqual(f1.getTypeOfField(),ON_CELLS); self.assertEqual(f1.getTimeDiscretization(),ONE_TIME); self.assertEqual(1,f1.getNumberOfComponents()); @@ -1111,7 +1111,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): pass # f1=m.fillFromAnalytic(ON_NODES,1,"y+2*x"); - f1.checkCoherency(); + f1.checkConsistencyLight(); self.assertEqual(f1.getTypeOfField(),ON_NODES); self.assertEqual(f1.getTimeDiscretization(),ONE_TIME); self.assertEqual(1,f1.getNumberOfComponents()); @@ -1123,7 +1123,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): self.assertTrue(abs(values2[i]-tmp[i])<1.e-12); pass f1=m.fillFromAnalytic(ON_NODES,1,"2.*x+y"); - f1.checkCoherency(); + f1.checkConsistencyLight(); self.assertEqual(f1.getTypeOfField(),ON_NODES); self.assertEqual(f1.getTimeDiscretization(),ONE_TIME); self.assertEqual(1,f1.getNumberOfComponents()); @@ -1136,7 +1136,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): pass # f1=m.fillFromAnalytic(ON_NODES,2,"(x+y)*IVec+2*(x+y)*JVec"); - f1.checkCoherency(); + f1.checkConsistencyLight(); self.assertEqual(f1.getTypeOfField(),ON_NODES); self.assertEqual(f1.getTimeDiscretization(),ONE_TIME); self.assertEqual(2,f1.getNumberOfComponents()); @@ -1158,7 +1158,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): def testApplyFunc(self): m=MEDCouplingDataForTest.build2DTargetMesh_1(); f1=m.fillFromAnalytic(ON_NODES,2,"(x+y)*IVec+(2*(x+y))*JVec"); - f1.checkCoherency(); + f1.checkConsistencyLight(); self.assertEqual(f1.getTypeOfField(),ON_NODES); self.assertEqual(f1.getTimeDiscretization(),ONE_TIME); self.assertEqual(2,f1.getNumberOfComponents()); @@ -1179,7 +1179,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): def testApplyFunc2(self): m=MEDCouplingDataForTest.build2DTargetMesh_1(); f1=m.fillFromAnalytic(ON_NODES,2,"(x+y)*IVec+2*(x+y)*JVec"); - f1.checkCoherency(); + f1.checkConsistencyLight(); self.assertEqual(f1.getTypeOfField(),ON_NODES); self.assertEqual(f1.getTimeDiscretization(),ONE_TIME); self.assertEqual(2,f1.getNumberOfComponents()); @@ -1222,10 +1222,10 @@ class MEDCouplingBasicsTest1(unittest.TestCase): m=MEDCouplingDataForTest.build2DTargetMesh_1(); f1=m.fillFromAnalytic(ON_NODES,1,"x+y"); f2=m.fillFromAnalytic(ON_NODES,1,"x+y"); - f1.checkCoherency(); - f2.checkCoherency(); + f1.checkConsistencyLight(); + f2.checkConsistencyLight(); f3=f1+f2; - f3.checkCoherency(); + f3.checkConsistencyLight(); self.assertEqual(f3.getTypeOfField(),ON_NODES); self.assertEqual(f3.getTimeDiscretization(),ONE_TIME); values1=[-1.2,-0.2,0.8,-0.2,0.8,1.8,0.8,1.8,2.8] @@ -1236,7 +1236,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): pass # f3=f1*f2; - f3.checkCoherency(); + f3.checkConsistencyLight(); self.assertEqual(f3.getTypeOfField(),ON_NODES); self.assertEqual(f3.getTimeDiscretization(),ONE_TIME); values2=[0.36,0.01,0.16,0.01,0.16,0.81,0.16,0.81,1.96] @@ -1248,7 +1248,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): # f3=f1+f2; f4=f1-f3; - f4.checkCoherency(); + f4.checkConsistencyLight(); self.assertEqual(f4.getTypeOfField(),ON_NODES); self.assertEqual(f4.getTimeDiscretization(),ONE_TIME); values3=[0.6,0.1,-0.4,0.1,-0.4,-0.9,-0.4,-0.9,-1.4] @@ -1260,7 +1260,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): # f3=f1+f2; f4=f3/f2; - f4.checkCoherency(); + f4.checkConsistencyLight(); self.assertEqual(f4.getTypeOfField(),ON_NODES); self.assertEqual(f4.getTimeDiscretization(),ONE_TIME); tmp=f4.getArray().getValues(); @@ -1269,7 +1269,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): pass # f4=f2.buildNewTimeReprFromThis(NO_TIME,False); - f4.checkCoherency(); + f4.checkConsistencyLight(); self.assertEqual(f4.getTypeOfField(),ON_NODES); self.assertEqual(f4.getTimeDiscretization(),NO_TIME); self.assertRaises(InterpKernelException,f1.__add__,f4); @@ -1285,7 +1285,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): pass # f4=f2.buildNewTimeReprFromThis(NO_TIME,True); - f4.checkCoherency(); + f4.checkConsistencyLight(); self.assertEqual(f4.getTypeOfField(),ON_NODES); self.assertEqual(f4.getTimeDiscretization(),NO_TIME); self.assertRaises(InterpKernelException,f1.__add__,f4); @@ -1307,7 +1307,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): f1=m.fillFromAnalytic(ON_NODES,1,"x+y+z"); f2=m.fillFromAnalytic(ON_NODES,1,"a*a+b+c*c"); f3=f1/f2; - f3.checkCoherency(); + f3.checkConsistencyLight(); self.assertEqual(f3.getTypeOfField(),ON_NODES); self.assertEqual(f3.getTimeDiscretization(),ONE_TIME); expected1=[-2.4999999999999991, 1.2162162162162162, 0.77868852459016391, @@ -1342,7 +1342,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): f1=m.fillFromAnalytic(ON_NODES,1,"x+y+z"); f2=m.fillFromAnalytic(ON_NODES,1,"a*a+b+c*c"); f1/=f2 - f1.checkCoherency(); + f1.checkConsistencyLight(); self.assertEqual(f1.getTypeOfField(),ON_NODES); self.assertEqual(f1.getTimeDiscretization(),ONE_TIME); expected1=[-2.4999999999999991, 1.2162162162162162, 0.77868852459016391, @@ -1383,7 +1383,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): array.setValues(arr1,nbOfCells,3); f1.setStartTime(2.,0,0); f1.setEndTime(3.,0,0); - f1.checkCoherency(); + f1.checkConsistencyLight(); pos=[0.3,-0.2] res=f1.getValueOn(pos); self.assertTrue(abs(arr1[3]-res[0])<1.e-12); @@ -1401,11 +1401,11 @@ class MEDCouplingBasicsTest1(unittest.TestCase): f2.setArray(f1.getArray()); f2.setStartTime(2.,3,0); f2.setEndTime(4.,13,0); - self.assertRaises(InterpKernelException,f2.checkCoherency) + self.assertRaises(InterpKernelException,f2.checkConsistencyLight) array2=DataArrayDouble.New(); array2.setValues(arr2,nbOfCells,3); f2.setEndArray(array2); - f2.checkCoherency(); + f2.checkConsistencyLight(); # res=None res=f2.getValueOn(pos,3.21); @@ -1781,7 +1781,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): #res=fieldOnCells.getValueOnPos(1,2,1); #self.assertAlmostEqual(6.,res,12); # - meshDeepCopy=mesh.deepCpy(); + meshDeepCopy=mesh.deepCopy(); meshClone=mesh.clone(False); meshEmpty.copyTinyStringsFrom(mesh); @@ -1845,8 +1845,8 @@ class MEDCouplingBasicsTest1(unittest.TestCase): self.assertTrue(mesh1.isEqual(mesh2, 1e-5)); self.assertTrue(not mesh1.isEqual(mesh2, 1e-7)); - self.assertRaises(InterpKernelException, mesh3.checkCoherency1, 1e-12); - mesh1.checkCoherency1(1e-12); + self.assertRaises(InterpKernelException, mesh3.checkConsistency, 1e-12); + mesh1.checkConsistency(1e-12); self.assertEqual(NORM_HEXA8, mesh1.getTypeOfCell(1)); self.assertEqual(NORM_HEXA8, mesh1.getAllGeoTypes()[0]); @@ -2002,7 +2002,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): self.assertEqual(9,len(n)); m3dSurf=mesh.buildFacePartOfMySelfNode(n,True); self.assertTrue(isinstance(m3dSurf,MEDCouplingUMesh)) - me=MEDCouplingExtrudedMesh.New(mesh,m3dSurf,0); + me=MEDCouplingMappedExtrudedMesh.New(mesh,m3dSurf,0); da=me.getMesh3DIds(); self.assertEqual(8,me.getNumberOfCells()); expected=[0,1,2,3,4,5,6,7] @@ -2011,7 +2011,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): # m3dSurf=mesh.buildFacePartOfMySelfNode(n,True); self.assertTrue(isinstance(m3dSurf,MEDCouplingUMesh)) - me=MEDCouplingExtrudedMesh.New(mesh,m3dSurf,0); + me=MEDCouplingMappedExtrudedMesh.New(mesh,m3dSurf,0); da=me.getMesh3DIds(); self.assertEqual(8,me.getNumberOfCells()); expected=[0,1,2,3,4,5,6,7] @@ -2090,13 +2090,13 @@ class MEDCouplingBasicsTest1(unittest.TestCase): ptr=array.getPointer(); f.setArray(array); f.setName("MyFirstFieldOnGaussPoint"); - f.checkCoherency(); + f.checkConsistencyLight(); self.assertAlmostEqual(27.,f.getIJK(2,5,0),14); self.assertAlmostEqual(16.,f.getIJK(1,5,1),14); # f.clearGaussLocalizations(); self.assertEqual(0,f.getNbOfGaussLocalization()); - self.assertRaises(InterpKernelException,f.checkCoherency); + self.assertRaises(InterpKernelException,f.checkConsistencyLight); ids1=[0,1,3,4] self.assertRaises(InterpKernelException,f.setGaussLocalizationOnCells,ids1,_refCoo2,_gsCoo1,_wg1); self.assertEqual(0,f.getNbOfGaussLocalization()); @@ -2111,7 +2111,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): self.assertEqual(0,f.getGaussLocalizationIdOfOneCell(0)); self.assertEqual(1,f.getGaussLocalizationIdOfOneCell(1)); self.assertEqual(1,f.getGaussLocalizationIdOfOneCell(2)); - self.assertRaises(InterpKernelException,f.checkCoherency);#<- cell 3 has no localization + self.assertRaises(InterpKernelException,f.checkConsistencyLight);#<- cell 3 has no localization ids4=[3] _gsCoo2=_gsCoo1; _wg2=_wg1; @@ -2121,10 +2121,10 @@ class MEDCouplingBasicsTest1(unittest.TestCase): self.assertEqual(3,f.getNbOfGaussLocalization()); tmpIds=f.getCellIdsHavingGaussLocalization(0); self.assertEqual(ids2,list(tmpIds.getValues())); - self.assertRaises(InterpKernelException,f.checkCoherency);#<- it's always not ok because undelying array not with the good size. + self.assertRaises(InterpKernelException,f.checkConsistencyLight);#<- it's always not ok because undelying array not with the good size. array2=f.getArray().substr(0,10); f.setArray(array2); - f.checkCoherency();#<- here it is OK + f.checkConsistencyLight();#<- here it is OK f2=f.clone(True); self.assertTrue(f.isEqual(f2,1e-14,1e-14)); gl1=f2.getGaussLocalization(0); @@ -2134,7 +2134,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): self.assertTrue(not f.isEqual(f2,1e-14,1e-14)); gl1.setGaussCoord(1,1,tmp); self.assertTrue(f.isEqual(f2,1e-14,1e-14)); - f2.checkCoherency(); + f2.checkConsistencyLight(); pass def testGaussPointNEField1(self): @@ -2153,7 +2153,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): ptr=array.getPointer(); f.setArray(array); # - f.checkCoherency(); + f.checkConsistencyLight(); f2=f.clone(True); self.assertTrue(f.isEqual(f2,1e-14,1e-14)); self.assertAlmostEqual(21.,f.getIJK(2,0,0),14); @@ -2196,7 +2196,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): m2.orientCorrectlyPolyhedrons(); res1=m2.arePolyhedronsNotCorrectlyOriented(); self.assertTrue(len(res1)==0); - m2.checkCoherency(); + m2.checkConsistencyLight(); self.assertEqual(18,m2.getNumberOfCells()); cellIds2=[0,6,12] m2.convertToPolyTypes(cellIds2); @@ -2231,7 +2231,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): for i in xrange(15): self.assertTrue(abs(expected1[i]-f3Ptr[i])<1e-12); pass - f4=m5.getBarycenterAndOwner(); + f4=m5.computeCellCenterOfMass(); self.assertEqual(15,f4.getNumberOfTuples()); self.assertEqual(3,f4.getNumberOfComponents()); f4Ptr=f4.getValues(); @@ -2274,12 +2274,12 @@ class MEDCouplingBasicsTest1(unittest.TestCase): myCoords=DataArrayDouble.New(); myCoords.setValues(coords,9,3); meshN.setCoords(myCoords); - meshN.checkCoherency(); + meshN.checkConsistencyLight(); # res1=meshN.arePolyhedronsNotCorrectlyOriented(); meshN.orientCorrectlyPolyhedrons(); self.assertTrue(len(res1)==0); - da=meshN.getBarycenterAndOwner(); + da=meshN.computeCellCenterOfMass(); self.assertEqual(1,da.getNumberOfTuples()); self.assertEqual(3,da.getNumberOfComponents()); daPtr=da.getValues(); @@ -2290,7 +2290,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): # center=[0.,0.,0.] vec=[0.,2.78,0.] - da=meshN.getBarycenterAndOwner(); + da=meshN.computeCellCenterOfMass(); daPtr=da.getValues(); ref=meshN.getCoords().getValues()[24:]; for i in xrange(3): @@ -2299,7 +2299,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): # meshN.rotate(center,vec,pi/7.); meshN.translate(vec); - da=meshN.getBarycenterAndOwner(); + da=meshN.computeCellCenterOfMass(); daPtr=da.getValues(); ref=meshN.getCoords().getValues()[24:]; for i in xrange(3): @@ -2310,7 +2310,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): vec2=[4.5,9.3,2.8] meshN.rotate(center2,vec2,e); meshN.translate(vec2); - da=meshN.getBarycenterAndOwner(); + da=meshN.computeCellCenterOfMass(); daPtr=da.getValues(); ref=meshN.getCoords().getValues()[24:]; for i in xrange(3): @@ -2327,7 +2327,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): array.setValues(arr,m1.getNumberOfCells(),3); f1.setArray(array); # - f3=m1.getBarycenterAndOwner(); + f3=m1.computeCellCenterOfMass(); self.assertEqual(4,f3.getNumberOfTuples()); self.assertEqual(1,f3.getNumberOfComponents()); expected9=[0.75,5.105,0.8,5.155] @@ -2408,7 +2408,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): self.assertTrue(abs(expected2[i]*sqrt(2.)-ptr[i])<1e-12); pass #bary - f3=m1.getBarycenterAndOwner(); + f3=m1.computeCellCenterOfMass(); self.assertEqual(4,f3.getNumberOfTuples()); self.assertEqual(2,f3.getNumberOfComponents()); expected10=[0.75,0.75,5.105,5.105,0.8,0.8,5.155,5.155] @@ -2455,7 +2455,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): for i in xrange(10): self.assertTrue(abs(abs(expected1[i])-ptr[i])<1e-12); pass - f2=m1.getBarycenterAndOwner(); + f2=m1.computeCellCenterOfMass(); self.assertEqual(10,f2.getNumberOfTuples()); self.assertEqual(2,f2.getNumberOfComponents()); expected2=[0.5,0.3333333333333333,0.5,0.5,0.5,0.77777777777777777,0.5,0.3333333333333333,0.5,0.5,0.5,0.3333333333333333,0.5,0.5,0.5,0.77777777777777777,0.5,0.3333333333333333,0.5,0.5] @@ -2471,7 +2471,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): for i in xrange(10): self.assertTrue(abs(abs(expected1[i])-ptr[i])<1e-12); pass - f2=m1.getBarycenterAndOwner(); + f2=m1.computeCellCenterOfMass(); self.assertEqual(10,f2.getNumberOfTuples()); self.assertEqual(3,f2.getNumberOfComponents()); ptr=f2.getValues(); @@ -2553,13 +2553,13 @@ class MEDCouplingBasicsTest1(unittest.TestCase): myCoords=DataArrayDouble.New(); myCoords.setValues(coords,69,3); meshN.setCoords(myCoords); - meshN.checkCoherency(); + meshN.checkConsistencyLight(); res1=meshN.arePolyhedronsNotCorrectlyOriented(); meshN.orientCorrectlyPolyhedrons(); res1=meshN.arePolyhedronsNotCorrectlyOriented(); self.assertTrue(len(res1)==0); # - da=meshN.getBarycenterAndOwner(); + da=meshN.computeCellCenterOfMass(); self.assertEqual(4,da.getNumberOfTuples()); self.assertEqual(3,da.getNumberOfComponents()); daPtr=da.getValues(); @@ -2621,7 +2621,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): values2=[1.,1001.,2.,1002., 11.,1011.,12.,1012.,13.,1013.,14.,1014.,15.,1015.,16.,1016., 21.,1021.,22.,1022.,23.,1023.,24.,1024.,25.,1025.,26.,1026., 31.,1031.,32.,1032., 41.,1041.,42.,1042.] arr.setValues(values2,18,2); f.setArray(arr); - f.checkCoherency(); + f.checkConsistencyLight(); fCpy=f.clone(True); self.assertTrue(f.isEqual(fCpy,1e-12,1e-12)); f.renumberCells(renumber1,False); @@ -2641,7 +2641,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): values3=[1.,1001.,2.,1002.,3.,1003.,4.,1004., 11.,1011.,12.,1012.,13.,1013., 21.,1021.,22.,1022.,23.,1023., 31.,1031.,32.,1032.,33.,1033.,34.,1034., 41.,1041.,42.,1042.,43.,1043.,44.,1044.] arr.setValues(values3,18,2); f.setArray(arr); - f.checkCoherency(); + f.checkConsistencyLight(); fCpy=f.clone(True); self.assertTrue(f.isEqual(fCpy,1e-12,1e-12)); f.renumberCells(renumber1,False); @@ -2666,7 +2666,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): values1=[7.,107.,10007.,8.,108.,10008.,9.,109.,10009.,10.,110.,10010.,11.,111.,10011.,12.,112.,10012.,13.,113.,10013.,14.,114.,10014.,15.,115.,10015.] arr.setValues(values1,nbOfNodes,3); f.setArray(arr); - f.checkCoherency(); + f.checkConsistencyLight(); renumber1=[0,4,1,3,5,2,6,7,8] loc=[0.5432,-0.2432, 0.5478,0.1528] expected1=[9.0272, 109.0272, 10009.0272, 11.4124,111.4124,10011.4124] @@ -2697,7 +2697,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): def testConvertQuadraticCellsToLinear(self): mesh=MEDCouplingDataForTest.build2DTargetMesh_3(); - mesh.checkCoherency(); + mesh.checkConsistencyLight(); types=mesh.getAllGeoTypes(); types.sort() self.assertEqual(5,len(types)); @@ -2705,16 +2705,16 @@ class MEDCouplingBasicsTest1(unittest.TestCase): expected1.sort() self.assertEqual(expected1,types); self.assertTrue(mesh.isPresenceOfQuadratic()); - self.assertEqual(62,mesh.getMeshLength()); + self.assertEqual(62,mesh.getNodalConnectivityArrayLen()); f1=mesh.getMeasureField(False); # mesh.convertQuadraticCellsToLinear(); self.assertTrue(not mesh.isPresenceOfQuadratic()); # - mesh.checkCoherency(); + mesh.checkConsistencyLight(); f2=mesh.getMeasureField(False); self.assertTrue(f1.getArray().isEqual(f2.getArray(),1e-12)); - self.assertEqual(48,mesh.getMeshLength()); + self.assertEqual(48,mesh.getNodalConnectivityArrayLen()); types2=mesh.getAllGeoTypes(); types2.sort() self.assertEqual(3,len(types2)); @@ -2846,7 +2846,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): m = MEDCouplingUMesh("tst", 2) m.setCoords(DataArrayDouble([], 0,2)) m.setConnectivity(DataArrayInt([]), DataArrayInt([0])) - m2 = m.deepCpy() + m2 = m.deepCopy() m.checkDeepEquivalWith(m2, 0, eps) # Should not raise! pass @@ -2863,7 +2863,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): a1.fillWithZero(); a1.setInfoOnComponent(0,"c"); a1.setInfoOnComponent(1,"d"); - a2=a1.deepCpy(); + a2=a1.deepCopy(); a2.setInfoOnComponent(0,"e"); a2.setInfoOnComponent(1,"f"); f.setArray(a1); @@ -2874,7 +2874,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): m.getCoords().setInfoOnComponent(1,"i"); m.getCoords().setInfoOnComponent(2,"j"); # - f.checkCoherency(); + f.checkConsistencyLight(); f2=f.clone(True); self.assertTrue(f2.isEqual(f,1e-12,1e-12)); f2.setName("smth"); @@ -2935,8 +2935,8 @@ class MEDCouplingBasicsTest1(unittest.TestCase): myCoords=DataArrayDouble.New(); myCoords.setValues(targetCoords,4,2); m2.setCoords(myCoords); - m2.checkCoherency(); - m1.checkCoherency(); + m2.checkConsistencyLight(); + m1.checkConsistencyLight(); # expected1=[0.25,0.125,0.125,0.25,0.25] f1=m1.getMeasureField(False); @@ -3014,7 +3014,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): f.setArray(a1); f.setEndArray(a2); f.setEndTime(3.,3,4); - f.checkCoherency(); + f.checkConsistencyLight(); # self.assertAlmostEqual(8.,f.getMaxValue(),14); self.assertAlmostEqual(0.,f.getMinValue(),14); diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest2.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest2.py index db3777022..4a63f9ac2 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest2.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest2.py @@ -100,12 +100,12 @@ class MEDCouplingBasicsTest2(unittest.TestCase): array.setValues(arr1,mesh1.getNumberOfCells(),1); f1.setArray(array); # - f1.checkCoherency(); - da=f1.getIdsInRange(2.9,7.1); + f1.checkConsistencyLight(); + da=f1.findIdsInRange(2.9,7.1); self.failUnlessEqual(5,da.getNbOfElems()); expected1=[2,3,5,7,9] self.failUnlessEqual(expected1,list(da.getValues())); - da=f1.getIdsInRange(8.,12.); + da=f1.findIdsInRange(8.,12.); self.failUnlessEqual(4,da.getNbOfElems()); expected2=[1,4,6,8] self.failUnlessEqual(expected2,list(da.getValues())); @@ -136,7 +136,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): self.failUnlessEqual(2,f2.getMesh().getSpaceDimension()); self.failUnlessEqual(2,f2.getMesh().getMeshDimension()); m2C=f2.getMesh(); - self.failUnlessEqual(13,m2C.getMeshLength()); + self.failUnlessEqual(13,m2C.getNodalConnectivityArrayLen()); expected2=[0.2, -0.3, 0.7, -0.3, 0.2, 0.2, 0.7, 0.2, 0.2, 0.7, 0.7, 0.7] for i in xrange(12): self.assertAlmostEqual(expected2[i],m2C.getCoords().getIJ(0,i),12); @@ -166,7 +166,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): self.failUnlessEqual(2,f2.getMesh().getSpaceDimension()); self.failUnlessEqual(2,f2.getMesh().getMeshDimension()); m2C=f2.getMesh(); - self.failUnlessEqual(8,m2C.getMeshLength()); + self.failUnlessEqual(8,m2C.getNodalConnectivityArrayLen()); for i in xrange(8):#8 is not an error self.assertAlmostEqual(expected2[i],m2C.getCoords().getIJ(0,i),12); pass @@ -188,7 +188,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): self.failUnlessEqual(2,f2.getMesh().getSpaceDimension()); self.failUnlessEqual(2,f2.getMesh().getMeshDimension()); m2C=f2.getMesh(); - self.failUnlessEqual(8,m2C.getMeshLength()); + self.failUnlessEqual(8,m2C.getNodalConnectivityArrayLen()); for i in xrange(8):#8 is not an error self.assertAlmostEqual(expected2[i],m2C.getCoords().getIJ(0,i),12); pass @@ -209,7 +209,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): self.failUnlessEqual(2,f2.getMesh().getSpaceDimension()); self.failUnlessEqual(2,f2.getMesh().getMeshDimension()); m2C=f2.getMesh(); - self.failUnlessEqual(13,m2C.getMeshLength()); + self.failUnlessEqual(13,m2C.getNodalConnectivityArrayLen()); for i in xrange(12): self.assertAlmostEqual(expected2[i],m2C.getCoords().getIJ(0,i),12); pass @@ -227,10 +227,10 @@ class MEDCouplingBasicsTest2(unittest.TestCase): arr1=[7.8,8.9,9.1,10.2,23.4,34.5, 7.8,8.9,9.1,10.2,23.4,34.5, 7.8,8.9,9.1,10.2,23.4,34.5, 7.8,8.9,9.1,10.2,23.4,34.5, 7.8,8.9,9.1,10.2,23.4,34.5] array.setValues(arr1,mesh1.getNumberOfCells(),6); f1.setArray(array); - f1.checkCoherency(); + f1.checkConsistencyLight(); # f2=f1.doublyContractedProduct(); - f2.checkCoherency(); + f2.checkConsistencyLight(); self.assertEqual(1,f2.getNumberOfComponents()); self.assertEqual(5,f2.getNumberOfTuples()); for i in xrange(5): @@ -250,9 +250,9 @@ class MEDCouplingBasicsTest2(unittest.TestCase): array.setValues(arr1,mesh1.getNumberOfCells(),4); f1.setArray(array); #4 components - f1.checkCoherency(); + f1.checkConsistencyLight(); f2=f1.determinant(); - f2.checkCoherency(); + f2.checkConsistencyLight(); self.assertEqual(CONST_ON_TIME_INTERVAL,f2.getTimeDiscretization()); self.assertEqual(1,f2.getNumberOfComponents()); self.assertEqual(5,f2.getNumberOfValues()); @@ -269,7 +269,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): 1.2,2.3,3.4,4.5,5.6,6.7, 1.2,2.3,3.4,4.5,5.6,6.7, 1.2,2.3,3.4,4.5,5.6,6.7, 1.2,2.3,3.4,4.5,5.6,6.7] array.setValues(arr2,mesh1.getNumberOfNodes(),6); f1.setArray(array); - self.assertRaises(InterpKernelException,f1.checkCoherency);#no end array specified ! + self.assertRaises(InterpKernelException,f1.checkConsistencyLight);#no end array specified ! # f2=f1.determinant(); self.assertEqual(LINEAR_TIME,f2.getTimeDiscretization()); @@ -284,9 +284,9 @@ class MEDCouplingBasicsTest2(unittest.TestCase): 7.8,8.9,9.1,10.2,23.4,34.5, 7.8,8.9,9.1,10.2,23.4,34.5, 7.8,8.9,9.1,10.2,23.4,34.5, 7.8,8.9,9.1,10.2,23.4,34.5] array.setValues(arr3,mesh1.getNumberOfNodes(),6); f1.setEndArray(array); - f1.checkCoherency(); + f1.checkConsistencyLight(); f2=f1.determinant(); - f2.checkCoherency(); + f2.checkConsistencyLight(); self.assertEqual(LINEAR_TIME,f2.getTimeDiscretization()); self.assertEqual(1,f2.getNumberOfComponents()); self.assertEqual(9,f2.getNumberOfTuples()); @@ -311,9 +311,9 @@ class MEDCouplingBasicsTest2(unittest.TestCase): array.setValues(arr4,mesh1.getNumberOfCells(),9); f1.setArray(array); # - f1.checkCoherency(); + f1.checkConsistencyLight(); f2=f1.determinant(); - f2.checkCoherency(); + f2.checkConsistencyLight(); self.assertEqual(ONE_TIME,f2.getTimeDiscretization()); self.assertEqual(1,f2.getNumberOfComponents()); self.assertEqual(5,f2.getNumberOfTuples()); @@ -334,10 +334,10 @@ class MEDCouplingBasicsTest2(unittest.TestCase): arr1=[1.2,2.3,3.4,4.5,5.6,6.7, 1.2,2.3,3.4,4.5,5.6,6.7, 1.2,2.3,3.4,4.5,5.6,6.7, 1.2,2.3,3.4,4.5,5.6,6.7, 1.2,2.3,3.4,4.5,5.6,6.7] array.setValues(arr1,mesh1.getNumberOfCells(),6); f1.setArray(array); - f1.checkCoherency(); + f1.checkConsistencyLight(); # f2=f1.eigenValues(); - f2.checkCoherency(); + f2.checkConsistencyLight(); self.assertEqual(3,f2.getNumberOfComponents()); self.assertEqual(5,f2.getNumberOfTuples()); expected1=[13.638813677891717,-4.502313844635971,-2.2364998332557486] @@ -356,10 +356,10 @@ class MEDCouplingBasicsTest2(unittest.TestCase): arr1=[1.2,2.3,3.4,4.5,5.6,6.7, 1.2,2.3,3.4,4.5,5.6,6.7, 1.2,2.3,3.4,4.5,5.6,6.7, 1.2,2.3,3.4,4.5,5.6,6.7, 1.2,2.3,3.4,4.5,5.6,6.7] array.setValues(arr1,mesh1.getNumberOfCells(),6); f1.setArray(array); - f1.checkCoherency(); + f1.checkConsistencyLight(); # f2=f1.eigenVectors(); - f2.checkCoherency(); + f2.checkConsistencyLight(); self.assertEqual(9,f2.getNumberOfComponents()); self.assertEqual(5,f2.getNumberOfTuples()); expected1=[0.5424262364180696, 0.5351201064614425, 0.6476266283176001,#eigenvect 0 @@ -388,10 +388,10 @@ class MEDCouplingBasicsTest2(unittest.TestCase): arr1=[1.2,2.3,3.4,4.5,5.6,6.7,7.8,8.9,9.1, 1.2,2.3,3.4,4.5,5.6,6.7,7.8,8.9,9.1, 1.2,2.3,3.4,4.5,5.6,6.7,7.8,8.9,9.1, 1.2,2.3,3.4,4.5,5.6,6.7,7.8,8.9,9.1, 1.2,2.3,3.4,4.5,5.6,6.7,7.8,8.9,9.1] array.setValues(arr1,mesh1.getNumberOfCells(),9); f1.setArray(array); - f1.checkCoherency(); + f1.checkConsistencyLight(); # f2=f1.inverse(); - f2.checkCoherency(); + f2.checkConsistencyLight(); self.assertEqual(9,f2.getNumberOfComponents()); self.assertEqual(5,f2.getNumberOfTuples()); expected1=[-2.6538108356290113, 2.855831037649208, -1.1111111111111067, 3.461891643709813, -4.775022956841121, 2.2222222222222143, -1.1111111111111054, 2.222222222222214, -1.1111111111111072] @@ -411,10 +411,10 @@ class MEDCouplingBasicsTest2(unittest.TestCase): arr3=[7.8,8.9,9.1,10.2,23.4,34.5, 7.8,8.9,9.1,10.2,23.4,34.5, 7.8,8.9,9.1,10.2,23.4,34.5, 7.8,8.9,9.1,10.2,23.4,34.5, 7.8,8.9,9.1,10.2,23.4,34.5] array.setValues(arr3,mesh1.getNumberOfCells(),6); f1.setArray(array); - f1.checkCoherency(); + f1.checkConsistencyLight(); # f2=f1.inverse(); - f2.checkCoherency(); + f2.checkConsistencyLight(); self.assertEqual(6,f2.getNumberOfComponents()); self.assertEqual(5,f2.getNumberOfTuples()); expected3=[-0.3617705098531818, -0.8678630828458127, -0.026843764174972983, 0.5539957431465833, 0.13133439560823013, -0.05301294502145887] @@ -431,10 +431,10 @@ class MEDCouplingBasicsTest2(unittest.TestCase): arr2=[1.2,2.3,3.4,4.5, 1.2,2.3,3.4,4.5, 1.2,2.3,3.4,4.5, 1.2,2.3,3.4,4.5, 1.2,2.3,3.4,4.5] array.setValues(arr2,mesh1.getNumberOfCells(),4); f1.setArray(array); - f1.checkCoherency(); + f1.checkConsistencyLight(); # f2=f1.inverse(); - f2.checkCoherency(); + f2.checkConsistencyLight(); self.assertEqual(4,f2.getNumberOfComponents()); self.assertEqual(5,f2.getNumberOfTuples()); expected2=[-1.8595041322314059, 0.9504132231404963, 1.404958677685951, -0.49586776859504156] @@ -455,10 +455,10 @@ class MEDCouplingBasicsTest2(unittest.TestCase): arr1=[1.2,2.3,3.4,4.5,5.6,6.7,7.8,8.9,9.1, 1.2,2.3,3.4,4.5,5.6,6.7,7.8,8.9,9.1, 1.2,2.3,3.4,4.5,5.6,6.7,7.8,8.9,9.1, 1.2,2.3,3.4,4.5,5.6,6.7,7.8,8.9,9.1, 1.2,2.3,3.4,4.5,5.6,6.7,7.8,8.9,9.1] array.setValues(arr1,mesh1.getNumberOfCells(),9); f1.setArray(array); - f1.checkCoherency(); + f1.checkConsistencyLight(); # f2=f1.trace(); - f2.checkCoherency(); + f2.checkConsistencyLight(); self.assertEqual(1,f2.getNumberOfComponents()); self.assertEqual(5,f2.getNumberOfTuples()); for i in xrange(5): @@ -469,10 +469,10 @@ class MEDCouplingBasicsTest2(unittest.TestCase): arr3=[7.8,8.9,9.1,10.2,23.4,34.5, 7.8,8.9,9.1,10.2,23.4,34.5, 7.8,8.9,9.1,10.2,23.4,34.5, 7.8,8.9,9.1,10.2,23.4,34.5, 7.8,8.9,9.1,10.2,23.4,34.5] array.setValues(arr3,mesh1.getNumberOfCells(),6); f1.setArray(array); - f1.checkCoherency(); + f1.checkConsistencyLight(); # f2=f1.trace(); - f2.checkCoherency(); + f2.checkConsistencyLight(); self.assertEqual(1,f2.getNumberOfComponents()); self.assertEqual(5,f2.getNumberOfTuples()); for i in xrange(5): @@ -483,10 +483,10 @@ class MEDCouplingBasicsTest2(unittest.TestCase): arr2=[1.2,2.3,3.4,4.5, 1.2,2.3,3.4,4.5, 1.2,2.3,3.4,4.5, 1.2,2.3,3.4,4.5, 1.2,2.3,3.4,4.5] array.setValues(arr2,mesh1.getNumberOfCells(),4); f1.setArray(array); - f1.checkCoherency(); + f1.checkConsistencyLight(); # f2=f1.trace(); - f2.checkCoherency(); + f2.checkConsistencyLight(); self.assertEqual(1,f2.getNumberOfComponents()); self.assertEqual(5,f2.getNumberOfTuples()); for i in xrange(5): @@ -503,10 +503,10 @@ class MEDCouplingBasicsTest2(unittest.TestCase): arr1=[1.2,2.3,3.4,4.5,5.6,6.7, 1.2,2.3,3.4,4.5,5.6,6.7, 1.2,2.3,3.4,4.5,5.6,6.7, 1.2,2.3,3.4,4.5,5.6,6.7, 1.2,2.3,3.4,4.5,5.6,6.7] array.setValues(arr1,mesh1.getNumberOfCells(),6); f1.setArray(array); - f1.checkCoherency(); + f1.checkConsistencyLight(); # f2=f1.deviator(); - f2.checkCoherency(); + f2.checkConsistencyLight(); self.assertEqual(6,f2.getNumberOfComponents()); self.assertEqual(5,f2.getNumberOfTuples()); expected1=[-1.1,0.,1.1,4.5,5.6,6.7] @@ -529,10 +529,10 @@ class MEDCouplingBasicsTest2(unittest.TestCase): arr1=[1.2,2.3,3.4,4.5,5.6, 1.2,2.3,3.4,4.5,5.6, 1.2,2.3,3.4,4.5,5.6, 1.2,2.3,3.4,4.5,5.6, 1.2,2.3,3.4,4.5,5.6] array.setValues(arr1,mesh1.getNumberOfCells(),5); f1.setArray(array); - f1.checkCoherency(); + f1.checkConsistencyLight(); # f2=f1.magnitude(); - f2.checkCoherency(); + f2.checkConsistencyLight(); self.assertEqual(1,f2.getNumberOfComponents()); self.assertEqual(5,f2.getNumberOfTuples()); for i in xrange(5): @@ -549,10 +549,10 @@ class MEDCouplingBasicsTest2(unittest.TestCase): arr1=[1.2,2.3,3.4,4.5,5.6, 1.2,3.4,4.5,5.6,2.3, 3.4,4.5,5.6,1.2,2.3, 5.6,1.2,2.3,3.4,4.5, 4.5,5.6,1.2,2.3,3.4] array.setValues(arr1,mesh1.getNumberOfCells(),5); f1.setArray(array); - f1.checkCoherency(); + f1.checkConsistencyLight(); # f2=f1.maxPerTuple(); - f2.checkCoherency(); + f2.checkConsistencyLight(); self.assertEqual(1,f2.getNumberOfComponents()); self.assertEqual(5,f2.getNumberOfTuples()); for i in xrange(5): @@ -576,10 +576,10 @@ class MEDCouplingBasicsTest2(unittest.TestCase): arr1=[1.2,2.3,3.4,4.5,5.6, 1.2,3.4,4.5,5.6,2.3, 3.4,4.5,5.6,1.2,2.3, 5.6,1.2,2.3,3.4,4.5, 4.5,5.6,1.2,2.3,3.4] array.setValues(arr1,mesh1.getNumberOfCells(),5); f1.setArray(array); - f1.checkCoherency(); + f1.checkConsistencyLight(); # f1.changeNbOfComponents(3,7.77); - f1.checkCoherency(); + f1.checkConsistencyLight(); self.assertEqual(3,f1.getNumberOfComponents()); self.assertEqual(5,f1.getNumberOfTuples()); expected1=[1.2,2.3,3.4, 1.2,3.4,4.5, 3.4,4.5,5.6, 5.6,1.2,2.3, 4.5,5.6,1.2] @@ -587,7 +587,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): self.assertAlmostEqual(expected1[i],f1.getIJ(0,i),13); pass f1.changeNbOfComponents(4,7.77); - f1.checkCoherency(); + f1.checkConsistencyLight(); self.assertEqual(4,f1.getNumberOfComponents()); self.assertEqual(5,f1.getNumberOfTuples()); expected2=[1.2,2.3,3.4,7.77, 1.2,3.4,4.5,7.77, 3.4,4.5,5.6,7.77, 5.6,1.2,2.3,7.77, 4.5,5.6,1.2,7.77] @@ -605,10 +605,10 @@ class MEDCouplingBasicsTest2(unittest.TestCase): arr1=[1.2,2.3,3.4,4.5,5.6, 1.2,3.4,4.5,5.6,2.3, 3.4,4.5,5.6,1.2,2.3, 5.6,1.2,2.3,3.4,4.5, 4.5,5.6,1.2,2.3,3.4] array.setValues(arr1,mesh1.getNumberOfCells(),5); f1.setArray(array); - f1.checkCoherency(); + f1.checkConsistencyLight(); # f1.sortPerTuple(True); - f1.checkCoherency(); + f1.checkConsistencyLight(); self.assertEqual(5,f1.getNumberOfComponents()); self.assertEqual(5,f1.getNumberOfTuples()); for i in xrange(5): @@ -620,7 +620,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): pass # f1.sortPerTuple(False); - f1.checkCoherency(); + f1.checkConsistencyLight(); self.assertEqual(5,f1.getNumberOfComponents()); self.assertEqual(5,f1.getNumberOfTuples()); for i in xrange(5): @@ -748,7 +748,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): f1.setMesh(m) f1.setName("myField"); f1.fillFromAnalytic(1,"y+x"); - f1.checkCoherency(); + f1.checkConsistencyLight(); self.assertEqual(f1.getName(),"myField"); self.assertEqual(f1.getTypeOfField(),ON_CELLS); self.assertEqual(f1.getTimeDiscretization(),ONE_TIME); @@ -765,7 +765,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): f1.setMesh(m) f1.fillFromAnalytic(1,"y+2*x"); f1.setEndTime(1.2,3,4); - f1.checkCoherency(); + f1.checkConsistencyLight(); self.assertEqual(f1.getTypeOfField(),ON_NODES); self.assertEqual(f1.getTimeDiscretization(),CONST_ON_TIME_INTERVAL); self.assertEqual(1,f1.getNumberOfComponents()); @@ -780,7 +780,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): f1.setMesh(m) f1.fillFromAnalytic(1,"2.*x+y"); f1.setEndTime(1.2,3,4); - f1.checkCoherency(); + f1.checkConsistencyLight(); self.assertEqual(f1.getTypeOfField(),ON_NODES); self.assertEqual(f1.getTimeDiscretization(),LINEAR_TIME); self.assertEqual(1,f1.getNumberOfComponents()); @@ -800,7 +800,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): f1=MEDCouplingFieldDouble.New(ON_NODES,ONE_TIME); f1.setMesh(m) f1.fillFromAnalytic(2,"(x+y)*IVec+2*(x+y)*JVec"); - f1.checkCoherency(); + f1.checkConsistencyLight(); self.assertEqual(f1.getTypeOfField(),ON_NODES); self.assertEqual(f1.getTimeDiscretization(),ONE_TIME); self.assertEqual(2,f1.getNumberOfComponents()); @@ -829,14 +829,14 @@ class MEDCouplingBasicsTest2(unittest.TestCase): self.assertRaises(InterpKernelException,f1.assign,0.07); f1.setMesh(m); f1.assign(0.07); - f1.checkCoherency(); + f1.checkConsistencyLight(); self.assertEqual(1,f1.getNumberOfComponents()); self.assertEqual(5,f1.getNumberOfTuples()); for i in xrange(5): self.assertAlmostEqual(0.07,f1.getIJ(i,0),16); pass f1.assign(0.09); - f1.checkCoherency(); + f1.checkConsistencyLight(); self.assertEqual(1,f1.getNumberOfComponents()); self.assertEqual(5,f1.getNumberOfTuples()); for i in xrange(5): @@ -847,7 +847,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): f1.setEndTime(4.5,2,3); f1.setMesh(m); f1.assign(0.08); - f1.checkCoherency(); + f1.checkConsistencyLight(); self.assertEqual(1,f1.getNumberOfComponents()); self.assertEqual(9,f1.getNumberOfTuples()); for i in xrange(9): @@ -901,7 +901,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): mesh.insertNextCell(NORM_PENTA6,6,[i+8 for i in tmpConn]) mesh.insertNextCell(NORM_PYRA5,5,[i+14 for i in tmpConn]) mesh.finishInsertingCells(); - mesh.checkCoherency(); + mesh.checkConsistencyLight(); mesh.mergeNodes(1e-7) self.assertEqual(12,mesh.getNumberOfNodes()); vols=mesh.getMeasureField(True); @@ -910,7 +910,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): self.assertAlmostEqual(volHexa8,vols.getIJ(0,0),6); self.assertAlmostEqual(volPenta6,vols.getIJ(1,0),7); self.assertAlmostEqual(volPyra5,vols.getIJ(2,0),7); - bary=mesh.getBarycenterAndOwner(); + bary=mesh.computeCellCenterOfMass(); self.assertEqual(3,bary.getNumberOfTuples()); self.assertEqual(3,bary.getNumberOfComponents()); self.assertAlmostEqual(baryHexa8[0],bary.getIJ(0,0),11); @@ -932,7 +932,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): discZ=[-0.7,1.2,1.25,2.13,2.67] da.setValues(discX,4,1); m.setCoordsAt(0,da); - m.checkCoherency(); + m.checkConsistencyLight(); self.assertEqual(4,m.getNumberOfNodes()); self.assertEqual(3,m.getNumberOfCells()); self.assertEqual(1,m.getSpaceDimension()); @@ -949,7 +949,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): for i in xrange(4): self.assertAlmostEqual(discX[i],coords.getIJ(i,0),12); pass - coords=m.getBarycenterAndOwner(); + coords=m.computeCellCenterOfMass(); self.assertEqual(3,coords.getNumberOfTuples()); self.assertEqual(1,coords.getNumberOfComponents()); expected1_3=[2.85,4.6,8.] @@ -960,7 +960,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): da=DataArrayDouble.New(); da.setValues(discY,3,1); m.setCoordsAt(1,da); - m.checkCoherency(); + m.checkConsistencyLight(); self.assertEqual(12,m.getNumberOfNodes()); self.assertEqual(6,m.getNumberOfCells()); self.assertEqual(2,m.getSpaceDimension()); @@ -978,7 +978,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): for i in xrange(24): self.assertAlmostEqual(expected2_2[i],coords.getIJ(0,i),12); pass - coords=m.getBarycenterAndOwner(); + coords=m.computeCellCenterOfMass(); self.assertEqual(6,coords.getNumberOfTuples()); self.assertEqual(2,coords.getNumberOfComponents()); expected2_3=[2.85,17.85,4.6,17.85,8.,17.85, 2.85,34.6,4.6,34.6,8.,34.6] @@ -989,7 +989,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): da=DataArrayDouble.New(); da.setValues(discZ,5,1); m.setCoordsAt(2,da); - m.checkCoherency(); + m.checkConsistencyLight(); self.assertEqual(60,m.getNumberOfNodes()); self.assertEqual(24,m.getNumberOfCells()); self.assertEqual(3,m.getSpaceDimension()); @@ -1012,7 +1012,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): for i in xrange(180): self.assertAlmostEqual(expected3_2[i],coords.getIJ(0,i),12); pass - coords=m.getBarycenterAndOwner(); + coords=m.computeCellCenterOfMass(); self.assertEqual(24,coords.getNumberOfTuples()); self.assertEqual(3,coords.getNumberOfComponents()); expected3_3=[ @@ -1030,7 +1030,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): f=m.fillFromAnalytic(ON_NODES,2,"x*2."); f.getArray().setInfoOnComponent(0,"titi"); f.getArray().setInfoOnComponent(1,"tutu"); - f.checkCoherency(); + f.checkConsistencyLight(); self.assertEqual(18,f.getNumberOfTuples()); self.assertEqual(2,f.getNumberOfComponents()); expected1=[-0.6, -0.6, 0.4, 0.4, 1.4, 1.4, -0.6, -0.6, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 1.4, 1.4, -0.6, -0.6, 0.4, 0.4, 1.4, 1.4, -0.6, -0.6, 1.4, 1.4, -0.6, -0.6, 0.4, 0.4, 1.4, 1.4, 0.4, 0.4] @@ -1038,13 +1038,13 @@ class MEDCouplingBasicsTest2(unittest.TestCase): self.assertAlmostEqual(expected1[i],f.getIJ(0,i),12); pass self.assertTrue(f.zipCoords()); - f.checkCoherency(); + f.checkConsistencyLight(); expected2=[-0.6, -0.6, 1.4, 1.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 1.4, 1.4, -0.6, -0.6, 0.4, 0.4, 1.4, 1.4, 1.4, 1.4, -0.6, -0.6, 0.4, 0.4, 1.4, 1.4, 0.4, 0.4] for i in xrange(30): self.assertAlmostEqual(expected2[i],f.getIJ(0,i),12); pass self.assertTrue(not f.zipCoords()); - f.checkCoherency(); + f.checkConsistencyLight(); for i in xrange(30): self.assertAlmostEqual(expected2[i],f.getIJ(0,i),12); pass @@ -1078,7 +1078,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): pass f.getArray().setInfoOnComponent(0,"titi"); f.getArray().setInfoOnComponent(1,"tutu"); - f.checkCoherency(); + f.checkConsistencyLight(); self.assertTrue(f.zipConnectivity(0)); expected2=[-0.05, -0.05, 0.3666666666666667, 0.3666666666666667, 0.53333333333333321, 0.53333333333333321, -0.05, -0.05, 0.45, 0.45, 0.36666666666666659, 0.36666666666666659, 0.033333333333333326, 0.033333333333333326]; @@ -1334,7 +1334,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): f.setArray(a); f.setMesh(m2); # - f.checkCoherency(); + f.checkConsistencyLight(); m=f.getMaxValue(); self.assertAlmostEqual(8.71,m,12); m,ws=f.getMaxValue2(); @@ -1348,7 +1348,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): # arr2=[-8.71,-4.53,12.41,-8.71,8.71,-8.7099,-4.55,-8.71,-5.55,-6.77,1e-200,-4.55,-8.7099,0.,-1.23,0.,-2.22,-8.71] a.setValues(arr2,18,1); - f.checkCoherency(); + f.checkConsistencyLight(); m=f.getMinValue(); self.assertAlmostEqual(-8.71,m,12); m,ws=f.getMinValue2(); @@ -1368,7 +1368,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): discZ=[-0.7,1.2,1.25,2.13,2.67] da.setValues(discX,4,1); m.setCoordsAt(0,da); - m.checkCoherency(); + m.checkConsistencyLight(); self.assertEqual(0,m.getCellContainingPoint([2.4],1e-12)); self.assertEqual(1,m.getCellContainingPoint([3.7],1e-12)); self.assertEqual(2,m.getCellContainingPoint([5.9],1e-12)); @@ -1376,7 +1376,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): self.assertEqual(-1,m.getCellContainingPoint([1.3],1e-12)); # m2=m.buildUnstructured(); - m2.checkCoherency(); + m2.checkConsistencyLight(); f1=m.getMeasureField(False); f2=m2.getMeasureField(False); self.assertTrue(isinstance(f1.getMesh(),MEDCouplingCMesh)) @@ -1392,7 +1392,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): m.setCoordsAt(1,da); # m2=m.buildUnstructured(); - m2.checkCoherency(); + m2.checkConsistencyLight(); f1=m.getMeasureField(False); f2=m2.getMeasureField(False); self.assertEqual(f1.getNumberOfTuples(),6); @@ -1407,7 +1407,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): da.setValues(discZ,5,1); m.setCoordsAt(2,da); m2=m.buildUnstructured(); - m2.checkCoherency(); + m2.checkConsistencyLight(); f1=m.getMeasureField(False); f2=m2.getMeasureField(False); self.assertEqual(f1.getNumberOfTuples(),24); @@ -1564,7 +1564,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): f1.setMesh(m1); f1.setName("f1"); f1.setArray(a1); - f1.checkCoherency(); + f1.checkConsistencyLight(); # arr2V=[1,2,1,2,0,0] f2=f1.keepSelectedComponents(arr2V); @@ -1573,7 +1573,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): self.assertAlmostEqual(2.3,t,13); self.assertEqual(4,dt); self.assertEqual(5,it); - f2.checkCoherency(); + f2.checkConsistencyLight(); self.assertEqual(6,f2.getNumberOfComponents()); self.assertEqual(5,f2.getNumberOfTuples()); self.assertTrue(f2.getArray().getInfoOnComponent(0)=="bbbb"); @@ -1592,12 +1592,12 @@ class MEDCouplingBasicsTest2(unittest.TestCase): f5.setTime(6.7,8,9); f5.getArray().setInfoOnComponent(0,"eeee"); f5.getArray().setInfoOnComponent(1,"ffff"); - f5.checkCoherency(); + f5.checkConsistencyLight(); arr4V=[1,2] f2.setSelectedComponents(f5,arr4V); self.assertEqual(6,f2.getNumberOfComponents()); self.assertEqual(5,f2.getNumberOfTuples()); - f2.checkCoherency(); + f2.checkConsistencyLight(); t,dt,it=f2.getTime() self.assertAlmostEqual(2.3,t,13); self.assertEqual(4,dt); @@ -1726,7 +1726,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): self.assertTrue(not ((dd.reprZip().find("Number of components : 1"))==-1)); self.assertTrue(not ((dbl.reprZip().find("Number of components : 1"))==-1)); - self.assertRaises(InterpKernelException, dbl.selectByTupleId2, 0, 1, -1); + self.assertRaises(InterpKernelException, dbl.selectByTupleIdSafeSlice, 0, 1, -1); self.assertRaises(InterpKernelException, dbl.substr, -1, 1); self.assertRaises(InterpKernelException, dbl.substr, 8, 1); self.assertRaises(InterpKernelException, dbl.substr, 0, 8); @@ -1772,7 +1772,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): dbl3.setIJ(5,0,0.); self.assertRaises(InterpKernelException, dbl3.checkNoNullValues); self.assertRaises(InterpKernelException, dbl3.applyInv, 1.); #div by zero - self.assertRaises(InterpKernelException, dbl2.getIdsInRange, 1., 2.); + self.assertRaises(InterpKernelException, dbl2.findIdsInRange, 1., 2.); a=[] self.assertRaises(InterpKernelException, DataArrayDouble_Aggregate, a); self.assertRaises(InterpKernelException, DataArrayDouble_Meld, a); @@ -1800,7 +1800,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): tab1=[5,-2,-4,-2,3,2,-2]; da=DataArrayInt.New(); da.setValues(tab1,7,1); - da2=da.getIdsEqual(-2); + da2=da.findIdsEqual(-2); self.assertEqual(3,da2.getNumberOfTuples()); self.assertEqual(1,da2.getNumberOfComponents()); expected1=[1,3,6]; @@ -1811,7 +1811,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): tab1=[5,-2,-4,-2,3,2,-2]; da=DataArrayInt.New(); da.setValues(tab1,7,1); - da2=da.getIdsEqualList([3,-2,0]); + da2=da.findIdsEqualList([3,-2,0]); self.assertEqual(4,da2.getNumberOfTuples()); self.assertEqual(1,da2.getNumberOfComponents()); expected1=[1,3,4,6]; @@ -1911,7 +1911,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): mesh.convertToPolyTypes(eltsV); mesh.unPolyze(); mesh2=MEDCouplingDataForTest.build3DTargetMesh_1(); - mesh.checkCoherency(); + mesh.checkConsistencyLight(); self.assertTrue(mesh.isEqual(mesh2,1e-12)); mesh.convertToPolyTypes(eltsV); self.assertTrue(not mesh.isEqual(mesh2,1e-12)); @@ -1954,7 +1954,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): mesh.insertNextCell(NORM_HEXA8,8,conn[16:24]) mesh.insertNextCell(NORM_HEXA8,8,conn[24:32]) mesh.finishInsertingCells(); - mesh.checkCoherency(); + mesh.checkConsistencyLight(); self.assertEqual(4,mesh.getNumberOfCells()); self.assertEqual(NORM_HEXA8,mesh.getTypeOfCell(0)); self.assertEqual(NORM_HEXA8,mesh.getTypeOfCell(1)); @@ -1962,7 +1962,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): self.assertEqual(NORM_HEXA8,mesh.getTypeOfCell(3)); f1=mesh.getMeasureField(True); mesh.convertDegeneratedCells(); - mesh.checkCoherency(); + mesh.checkConsistencyLight(); f2=mesh.getMeasureField(True); self.assertEqual(4,mesh.getNumberOfCells()); self.assertEqual(NORM_PENTA6,mesh.getTypeOfCell(0)); @@ -2111,7 +2111,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): self.assertTrue(tmp2); self.assertEqual(37,tmp3); i.convertDegeneratedCells(); - i.checkCoherency(); + i.checkConsistencyLight(); self.assertEqual(36,i.getNumberOfCells()); self.assertEqual(37,i.getNumberOfNodes()); self.assertEqual(12,i.getNumberOfCellsWithType(NORM_TRI3)); @@ -2124,7 +2124,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): pass pass expected2=[0.62200846792814113, 0.16666666666681595, 1.4513530918323276, 0.38888888888923495, 2.6293994326053212, 0.7045454545460802, 0.45534180126145435, 0.45534180126150181, 1.0624642029433926, 1.0624642029435025, 1.9248539780597826, 1.9248539780599816, 0.16666666666661334, 0.62200846792815856, 0.38888888888876294, 1.4513530918323678, 0.70454545454522521, 2.629399432605394, -0.16666666666674007, 0.62200846792812436, -0.38888888888906142, 1.4513530918322881, -0.70454545454576778, 2.6293994326052488, -0.45534180126154766, 0.45534180126140844, -1.0624642029436118, 1.0624642029432834, -1.9248539780601803, 1.9248539780595841, -0.62200846792817499, 0.1666666666665495, -1.451353091832408, 0.388888888888613, -2.6293994326054668, 0.70454545454495332, -0.62200846792810593, -0.16666666666680507, -1.451353091832247, -0.38888888888921297, -2.6293994326051746, -0.70454545454604123, -0.45534180126135926, -0.45534180126159562, -1.0624642029431723, -1.0624642029437235, -1.9248539780593836, -1.9248539780603811, -0.1666666666664828, -0.62200846792819242, -0.38888888888846079, -1.4513530918324489, -0.70454545454467987, -2.6293994326055397, 0.16666666666687083, -0.62200846792808862, 0.38888888888936374, -1.4513530918322073, 0.70454545454631357, -2.6293994326051022, 0.45534180126164348, -0.45534180126131207, 1.0624642029438327, -1.0624642029430627, 1.9248539780605791, -1.9248539780591853, 0.62200846792821063, -0.16666666666641802, 1.4513530918324888, -0.38888888888831086, 2.6293994326056125, -0.70454545454440853] - m=i.getBarycenterAndOwner(); + m=i.computeCellCenterOfMass(); for i in xrange(72): self.assertAlmostEqual(expected2[i],m.getIJ(0,i),10); pass @@ -2154,14 +2154,14 @@ class MEDCouplingBasicsTest2(unittest.TestCase): center=[0.,0.] f.rotate(center,None,pi/3); g=c.buildExtrudedMesh(f,0); - g.checkCoherency(); + g.checkConsistencyLight(); expected1=[ 0.4330127018922193, 0.4330127018922193, 0.649519052838329, 1.2990381056766578, 1.299038105676658, 1.948557158514987, 2.1650635094610955, 2.1650635094610964, 3.2475952641916446, 3.031088913245533, 3.0310889132455352, 4.546633369868303 ] f1=g.getMeasureField(True); for i in xrange(12): self.assertAlmostEqual(expected1[i],f1.getIJ(0,i),12); pass expected2=[0.625, 0.21650635094610962, 1.625, 0.21650635094610959, 2.8750000000000004, 0.21650635094610965, 1.1250000000000002, 1.0825317547305482, 2.125, 1.0825317547305482, 3.3750000000000004, 1.0825317547305484, 2.125, 2.8145825622994254, 3.125, 2.8145825622994254, 4.375, 2.8145825622994254, 3.6250000000000009, 5.4126587736527414, 4.625, 5.4126587736527414, 5.875, 5.4126587736527414] - f2=g.getBarycenterAndOwner(); + f2=g.computeCellCenterOfMass(); for i in xrange(24): self.assertAlmostEqual(expected2[i],f2.getIJ(0,i),12); pass @@ -2220,7 +2220,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): for i in xrange(7): self.assertEqual(expected2[i],da.getIJ(i,0)); pass - m.checkCoherency(); + m.checkConsistencyLight(); self.assertEqual(7,m.getNumberOfCells()); self.assertEqual(NORM_TRI3,m.getTypeOfCell(0)); self.assertEqual(NORM_TRI3,m.getTypeOfCell(1)); @@ -2245,7 +2245,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): for i in xrange(7): self.assertEqual(expected2[i],da.getIJ(i,0)); pass - m.checkCoherency(); + m.checkConsistencyLight(); types=m.getAllGeoTypes(); self.assertEqual([NORM_TRI3,NORM_POLYGON],types); self.assertEqual(7,m.getNumberOfCells()); @@ -2272,9 +2272,9 @@ class MEDCouplingBasicsTest2(unittest.TestCase): arr.setValues(arr1,5,2); f1.setArray(arr); # - f1.checkCoherency(); + f1.checkConsistencyLight(); self.assertTrue(f1.simplexize(0)); - f1.checkCoherency(); + f1.checkConsistencyLight(); expected1=[10.,110.,10.,110.,20.,120.,30.,130.,40.,140.,50.,150.,50.,150.] for i in xrange(14): self.assertAlmostEqual(expected1[i],f1.getIJ(0,i),10); @@ -2302,7 +2302,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): da3.setInfoOnComponent(1,"c1da3"); da3.setInfoOnComponent(2,"c2da3"); # - da1C=da1.deepCpy(); + da1C=da1.deepCopy(); da1.meldWith(da3); self.assertEqual(5,da1.getNumberOfComponents()); self.assertEqual(7,da1.getNumberOfTuples()); @@ -2371,19 +2371,19 @@ class MEDCouplingBasicsTest2(unittest.TestCase): da1.setInfoOnComponent(0,"aaa"); f1.setArray(da1); f1.setTime(3.4,2,1); - f1.checkCoherency(); + f1.checkConsistencyLight(); # - f2=f1.deepCpy(); + f2=f1.deepCopy(); f2.setMesh(f1.getMesh()); - f2.checkCoherency(); + f2.checkConsistencyLight(); f2.changeNbOfComponents(2,5.); f2.assign(5.); f2.getArray().setInfoOnComponent(0,"bbb"); f2.getArray().setInfoOnComponent(1,"ccc"); - f2.checkCoherency(); + f2.checkConsistencyLight(); # f3=MEDCouplingFieldDouble.MeldFields(f2,f1); - f3.checkCoherency(); + f3.checkConsistencyLight(); self.assertEqual(5,f3.getNumberOfTuples()); self.assertEqual(3,f3.getNumberOfComponents()); self.assertTrue(f3.getArray().getInfoOnComponent(0)=="bbb"); @@ -2401,7 +2401,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): f4=f2.buildNewTimeReprFromThis(NO_TIME,False); f5=f1.buildNewTimeReprFromThis(NO_TIME,False); f6=MEDCouplingFieldDouble.MeldFields(f4,f5); - f6.checkCoherency(); + f6.checkConsistencyLight(); self.assertEqual(5,f6.getNumberOfTuples()); self.assertEqual(3,f6.getNumberOfComponents()); self.assertTrue(f6.getArray().getInfoOnComponent(0)=="bbb"); @@ -2420,7 +2420,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): m2.translate(vec); # m3=MEDCouplingUMesh.MergeUMeshes([m1,m2]); - da,b,newNbOfNodes=m3.mergeNodes2(0.01); + da,b,newNbOfNodes=m3.mergeNodesCenter(0.01); self.assertEqual(9,m3.getNumberOfNodes()); expected1=[-0.299,-0.3, 0.201,-0.3, 0.701,-0.3, -0.299,0.2, 0.201,0.2, 0.701,0.2, -0.299,0.7, 0.201,0.7, 0.701,0.7] for i in xrange(18): @@ -2685,7 +2685,7 @@ class MEDCouplingBasicsTest2(unittest.TestCase): myCoords=DataArrayDouble.New(); myCoords.setValues(targetCoords,9,2); targetMesh.setCoords(myCoords); - targetMesh.checkCoherency(); + targetMesh.checkConsistencyLight(); pass def testFieldOperatorDivDiffComp1(self): @@ -2699,11 +2699,11 @@ class MEDCouplingBasicsTest2(unittest.TestCase): f2=MEDCouplingFieldDouble.New(ON_CELLS); f2.setArray(arr); f2.setMesh(m1); - f2.checkCoherency(); + f2.checkConsistencyLight(); # f3=f1/f2; self.assertRaises(InterpKernelException,f2.__div__,f1) - f3.checkCoherency(); + f3.checkConsistencyLight(); f1/=f2; #self.assertRaises(InterpKernelException,f2.__idiv__,f1) # mem leaks self.assertTrue(f1.isEqual(f3,1e-10,1e-10)); diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest3.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest3.py index f6c1c70a7..4b84e34a6 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest3.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest3.py @@ -484,7 +484,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): pass self.assertEqual([4, 3, 2, 7, 6, 5, 10, 9, 8, 13, 12, 11],li) # __setitem__ testing - da3=da.deepCpy() + da3=da.deepCopy() da2=DataArrayInt.New() da2.alloc(12,1) da2.iota(2002) @@ -497,7 +497,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): pass self.assertTrue(da.isEqual(da2)) da=da3 - da3=da.deepCpy() + da3=da.deepCopy() # for it in da: it[:]=5 @@ -505,14 +505,14 @@ class MEDCouplingBasicsTest3(unittest.TestCase): da.rearrange(1) self.assertTrue(da.isUniform(5)) da=da3 - da3=da.deepCpy() + da3=da.deepCopy() # for it in da: it[:]=[8,9,12] pass self.assertEqual([8, 9, 12, 8, 9, 12, 8, 9, 12, 8, 9, 12],da.getValues()) da=da3 - da3=da.deepCpy() + da3=da.deepCopy() # for it in da: it[2]=[7] @@ -542,7 +542,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): pass self.assertEqual([4, 3, 2, 7, 6, 5, 10, 9, 8, 13, 12, 11],li) # __setitem__ testing - da3=da.deepCpy() + da3=da.deepCopy() da2=DataArrayDouble.New() da2.alloc(12,1) da2.iota(2002) @@ -555,7 +555,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): pass self.assertTrue(da.isEqual(da2,1e-12)) da=da3 - da3=da.deepCpy() + da3=da.deepCopy() # for it in da: it[:]=5 @@ -563,14 +563,14 @@ class MEDCouplingBasicsTest3(unittest.TestCase): da.rearrange(1) self.assertTrue(da.isUniform(5,1e-12)) da=da3 - da3=da.deepCpy() + da3=da.deepCopy() # for it in da: it[:]=[8,9,12] pass self.assertEqual([8, 9, 12, 8, 9, 12, 8, 9, 12, 8, 9, 12],da.getValues()) da=da3 - da3=da.deepCpy() + da3=da.deepCopy() # for it in da: it[2]=[7] @@ -642,10 +642,10 @@ class MEDCouplingBasicsTest3(unittest.TestCase): self.assertRaises(InterpKernelException,MEDCouplingUMesh.MergeUMeshes,ms+[None]); self.assertRaises(InterpKernelException,MEDCouplingUMesh.MergeUMeshes,ms+[3.4]) m4=MEDCouplingUMesh.MergeUMeshes(ms); - m4.checkCoherency(); + m4.checkConsistencyLight(); self.assertEqual(10,m4.getNumberOfCells()); self.assertEqual(20,m4.getNumberOfNodes()); - self.assertEqual(45,m4.getMeshLength()); + self.assertEqual(45,m4.getNodalConnectivityArrayLen()); m4bis=MEDCouplingMesh.MergeMeshes(ms); self.assertTrue(m4.isEqual(m4bis,1e-12)) del m4bis @@ -675,7 +675,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): coo.setValues(sourceCoords,4,3); coo.setName("My0D"); m=MEDCouplingUMesh.Build0DMeshFromCoords(coo); - m.checkCoherency(); + m.checkConsistencyLight(); self.assertEqual(4,m.getNumberOfNodes()); self.assertEqual(4,m.getNumberOfCells()); self.assertEqual(3,m.getSpaceDimension()); @@ -695,7 +695,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): m=MEDCouplingDataForTest.build2DTargetMesh_1(); m.setDescription(text1); self.assertEqual(m.getDescription(),text1); - m2=m.deepCpy(); + m2=m.deepCopy(); self.assertTrue(m.isEqual(m2,1e-12)); self.assertEqual(m2.getDescription(),text1); m2.setDescription("ggg"); @@ -704,7 +704,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): f=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME); f.setTimeUnit(text1); self.assertEqual(f.getTimeUnit(),text1); - f2=f.deepCpy(); + f2=f.deepCopy(); self.assertEqual(f2.getTimeUnit(),text1); # pass @@ -725,7 +725,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): self.assertEqual(2,len(dms)); self.assertEqual(6,len(das)); self.assertEqual(5,len(das2)); - mfs2=mfs.deepCpy(); + mfs2=mfs.deepCopy(); self.assertTrue(mfs.isEqual(mfs2,1e-12,1e-12)) pass @@ -814,7 +814,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): da.iota(0); da2=da.checkAndPreparePermutation(); self.assertEqual(1,da2.getNumberOfComponents()); - self.assertTrue(da2.isIdentity2(8)); + self.assertTrue(da2.isIota(8)); # da=DataArrayInt.New(); da.alloc(8,1); @@ -859,7 +859,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): def testUMeshFindCellIdsOnBoundary1(self): m=MEDCouplingDataForTest.build3DSurfTargetMesh_1(); da5=m.findCellIdsOnBoundary(); - self.assertTrue(da5.isIdentity2(5)); + self.assertTrue(da5.isIota(5)); pass def testMeshSetTime1(self): @@ -890,7 +890,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): self.assertTrue(not m1.isEqual(m2,1e-12)); # m1.setTime(10.34,55,12); - m3=m1.deepCpy(); + m3=m1.deepCopy(); self.assertTrue(m1.isEqual(m3,1e-12)); tmp3,tmp1,tmp2=m3.getTime(); self.assertEqual(55,tmp1); @@ -909,7 +909,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): self.assertEqual(8,tmp1); self.assertEqual(100,tmp2); self.assertAlmostEqual(5.67,tmp3,12); - c=b.deepCpy(); + c=b.deepCopy(); self.assertTrue(c.isEqual(b,1e-12)); tmp3,tmp1,tmp2=c.getTime(); self.assertEqual(8,tmp1); @@ -927,16 +927,16 @@ class MEDCouplingBasicsTest3(unittest.TestCase): da.setValues(vals,5,3); f1.setArray(da); # - self.assertRaises(InterpKernelException,da.applyFunc2,1,"y+z"); + self.assertRaises(InterpKernelException,da.applyFuncCompo,1,"y+z"); da.setInfoOnComponent(0,"x [m]"); da.setInfoOnComponent(1,"y [mm]"); da.setInfoOnComponent(2,"z [km]"); - self.assertRaises(InterpKernelException, da.applyFunc2, 1, "x+y+zz+zzz"); - self.assertRaises(InterpKernelException, da.applyFunc2, 1, "toto(x+y)"); - self.assertRaises(InterpKernelException, da.applyFunc2, 1, "x/0"); + self.assertRaises(InterpKernelException, da.applyFuncCompo, 1, "x+y+zz+zzz"); + self.assertRaises(InterpKernelException, da.applyFuncCompo, 1, "toto(x+y)"); + self.assertRaises(InterpKernelException, da.applyFuncCompo, 1, "x/0"); - da2=da.applyFunc2(1,"y+z"); + da2=da.applyFuncCompo(1,"y+z"); self.assertEqual(1,da2.getNumberOfComponents()); self.assertEqual(5,da2.getNumberOfTuples()); expected1=[32.,34.,36.,38.,40.] @@ -951,7 +951,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): # self.assertEqual(3,f1.getNumberOfComponents()); self.assertEqual(5,f1.getNumberOfTuples()); - f1.applyFunc2(1,"y+z"); + f1.applyFuncCompo(1,"y+z"); self.assertEqual(1,f1.getNumberOfComponents()); self.assertEqual(5,f1.getNumberOfTuples()); for i in xrange(5): @@ -972,20 +972,20 @@ class MEDCouplingBasicsTest3(unittest.TestCase): # vs=3*[None]; vs[0]="x"; vs[1]="Y"; vs[2]="z"; - self.assertRaises(InterpKernelException, da.applyFunc3, 1, vs, "y+z"); - self.assertRaises(InterpKernelException, da.applyFunc3, 1, vs, "x+Y+z+zz+zzz"); - self.assertRaises(InterpKernelException, da.applyFunc3, 1, vs, "x/0"); + self.assertRaises(InterpKernelException, da.applyFuncNamedCompo, 1, vs, "y+z"); + self.assertRaises(InterpKernelException, da.applyFuncNamedCompo, 1, vs, "x+Y+z+zz+zzz"); + self.assertRaises(InterpKernelException, da.applyFuncNamedCompo, 1, vs, "x/0"); vs[1]="y"; - da2=da.applyFunc3(1,vs,"y+z"); + da2=da.applyFuncNamedCompo(1,vs,"y+z"); expected1=[32.,34.,36.,38.,40.] for i in xrange(5): self.assertAlmostEqual(expected1[i],da2.getIJ(0,i),12); pass - self.assertRaises(InterpKernelException, da.applyFunc3, 1, ["x","y","z","a"],"x+a") + self.assertRaises(InterpKernelException, da.applyFuncNamedCompo, 1, ["x","y","z","a"],"x+a") f1.setArray(da); self.assertEqual(3,f1.getNumberOfComponents()); self.assertEqual(5,f1.getNumberOfTuples()); - f1.applyFunc3(1,vs,"y+z"); + f1.applyFuncNamedCompo(1,vs,"y+z"); self.assertEqual(1,f1.getNumberOfComponents()); self.assertEqual(5,f1.getNumberOfTuples()); for i in xrange(5): @@ -996,11 +996,11 @@ class MEDCouplingBasicsTest3(unittest.TestCase): def testFillFromAnalyticTwo1(self): m1=MEDCouplingDataForTest.build3DSurfTargetMesh_1(); m1.setTime(3.4,5,6); m1.setTimeUnit("us"); - self.assertRaises(InterpKernelException,m1.fillFromAnalytic2,ON_NODES,1,"y+z"); + self.assertRaises(InterpKernelException,m1.fillFromAnalyticCompo,ON_NODES,1,"y+z"); m1.getCoords().setInfoOnComponent(0,"x [m]"); m1.getCoords().setInfoOnComponent(1,"y"); m1.getCoords().setInfoOnComponent(2,"z"); - f1=m1.fillFromAnalytic2(ON_NODES,1,"y+z"); + f1=m1.fillFromAnalyticCompo(ON_NODES,1,"y+z"); self.assertAlmostEqual(3.4,f1.getTime()[0],12) ; self.assertEqual(5,f1.getTime()[1]) ; self.assertEqual(6,f1.getTime()[2]) self.assertEqual("us",f1.getTimeUnit()) self.assertEqual(1,f1.getNumberOfComponents()); @@ -1016,9 +1016,9 @@ class MEDCouplingBasicsTest3(unittest.TestCase): m1.setTime(3.4,5,6); m1.setTimeUnit("us"); vs=3*[None]; vs[0]="x"; vs[1]="Y"; vs[2]="z"; - self.assertRaises(InterpKernelException,m1.fillFromAnalytic3,ON_NODES,1,vs,"y+z"); + self.assertRaises(InterpKernelException,m1.fillFromAnalyticNamedCompo,ON_NODES,1,vs,"y+z"); vs[1]="y"; - f1=m1.fillFromAnalytic3(ON_NODES,1,vs,"y+z"); + f1=m1.fillFromAnalyticNamedCompo(ON_NODES,1,vs,"y+z"); self.assertAlmostEqual(3.4,f1.getTime()[0],12) ; self.assertEqual(5,f1.getTime()[1]) ; self.assertEqual(6,f1.getTime()[2]) self.assertEqual("us",f1.getTimeUnit()) self.assertEqual(1,f1.getNumberOfComponents()); @@ -1278,7 +1278,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): values1=[7.,107.,10007.,8.,108.,10008.,9.,109.,10009.,10.,110.,10010.,11.,111.,10011.] arr.setValues(values1,nbOfCells,3); loc=[-0.05,-0.05, 0.55,-0.25, 0.55,0.15, -0.05,0.45, 0.45,0.45] - f.checkCoherency(); + f.checkConsistencyLight(); locs=f.getValueOnMulti(loc); self.assertEqual(5,locs.getNumberOfTuples()); self.assertEqual(3,locs.getNumberOfComponents()); @@ -1295,7 +1295,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): arr.setValues(values2,nbOfNodes,3); loc2=[0.5432,-0.2432, 0.5478,0.1528, 0.5432,-0.2432, 0.5432,-0.2432] expected2=[9.0272, 109.0272, 10009.0272, 11.4124,111.4124,10011.4124, 9.0272, 109.0272, 10009.0272, 9.0272, 109.0272, 10009.0272] - f.checkCoherency(); + f.checkConsistencyLight(); loc3=DataArrayDouble.New() loc3.setValues(loc2,4,2); locs=f.getValueOnMulti(loc3); @@ -1311,7 +1311,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): d=DataArrayInt.New(); vals1=[2,3,5,6,8,5,5,6,1,-5] d.setValues(vals1,10,1); - d2=d.getIdsNotEqual(5); + d2=d.findIdsNotEqual(5); self.assertEqual(7,d2.getNumberOfTuples()); self.assertEqual(1,d2.getNumberOfComponents()); expected1=[0,1,3,4,7,8,9] @@ -1319,11 +1319,11 @@ class MEDCouplingBasicsTest3(unittest.TestCase): self.assertEqual(expected1[i],d2.getIJ(0,i)); pass d.rearrange(2); - self.assertRaises(InterpKernelException,d.getIdsNotEqual,5); + self.assertRaises(InterpKernelException,d.findIdsNotEqual,5); vals2=[-4,5,6] vals3=vals2; d.rearrange(1); - d3=d.getIdsNotEqualList(vals3); + d3=d.findIdsNotEqualList(vals3); self.assertEqual(5,d3.getNumberOfTuples()); self.assertEqual(1,d3.getNumberOfComponents()); expected2=[0,1,4,8,9] @@ -1357,12 +1357,12 @@ class MEDCouplingBasicsTest3(unittest.TestCase): mesh.insertNextCell(NORM_HEXGP12,12,conn[0:12]) mesh.finishInsertingCells(); # - mesh.checkCoherency(); + mesh.checkConsistencyLight(); vols=mesh.getMeasureField(False); self.assertEqual(1,vols.getNumberOfTuples()); self.assertEqual(1,vols.getNumberOfComponents()); self.assertAlmostEqual(-5.196152422706632,vols.getIJ(0,0),12); - bary=mesh.getBarycenterAndOwner(); + bary=mesh.computeCellCenterOfMass(); self.assertEqual(1,bary.getNumberOfTuples()); self.assertEqual(3,bary.getNumberOfComponents()); expected1=[0.,0.,1.] @@ -1388,7 +1388,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): self.assertTrue(NORM_POLYHED==mesh.getTypeOfCell(0)); mesh.unPolyze(); self.assertTrue(NORM_HEXGP12==mesh.getTypeOfCell(0)); - self.assertEqual(13,mesh.getMeshLength()); + self.assertEqual(13,mesh.getNodalConnectivityArrayLen()); # pass @@ -1409,42 +1409,42 @@ class MEDCouplingBasicsTest3(unittest.TestCase): def testCheckCoherencyDeeper1(self): m=MEDCouplingDataForTest.build3DSourceMesh_1(); - m.checkCoherency(); - m.checkCoherency1(); + m.checkConsistencyLight(); + m.checkConsistency(); m.getNodalConnectivity().setIJ(8,0,-1); - m.checkCoherency(); - self.assertRaises(InterpKernelException,m.checkCoherency1); + m.checkConsistencyLight(); + self.assertRaises(InterpKernelException,m.checkConsistency); m.getNodalConnectivity().setIJ(8,0,-6); - m.checkCoherency(); - self.assertRaises(InterpKernelException,m.checkCoherency1); + m.checkConsistencyLight(); + self.assertRaises(InterpKernelException,m.checkConsistency); m.getNodalConnectivity().setIJ(8,0,9);#9>=NbOfNodes - m.checkCoherency(); - self.assertRaises(InterpKernelException,m.checkCoherency1); + m.checkConsistencyLight(); + self.assertRaises(InterpKernelException,m.checkConsistency); m.getNodalConnectivity().setIJ(8,0,8);#OK - m.checkCoherency(); - m.checkCoherency1(); + m.checkConsistencyLight(); + m.checkConsistency(); elts=[1,5] m.convertToPolyTypes(elts); - m.checkCoherency(); - m.checkCoherency1(); + m.checkConsistencyLight(); + m.checkConsistency(); m.getNodalConnectivity().setIJ(2,0,9);#9>=NbOfNodes - m.checkCoherency(); - self.assertRaises(InterpKernelException,m.checkCoherency1); + m.checkConsistencyLight(); + self.assertRaises(InterpKernelException,m.checkConsistency); m.getNodalConnectivity().setIJ(2,0,-3); - m.checkCoherency(); - self.assertRaises(InterpKernelException,m.checkCoherency1); + m.checkConsistencyLight(); + self.assertRaises(InterpKernelException,m.checkConsistency); m.getNodalConnectivity().setIJ(2,0,-1); - m.checkCoherency(); - self.assertRaises(InterpKernelException,m.checkCoherency1);#Throw because cell#0 is not a polyhedron + m.checkConsistencyLight(); + self.assertRaises(InterpKernelException,m.checkConsistency);#Throw because cell#0 is not a polyhedron m.getNodalConnectivity().setIJ(2,0,4); - m.checkCoherency(); - m.checkCoherency1(); + m.checkConsistencyLight(); + m.checkConsistency(); m.getNodalConnectivity().setIJ(7,0,-1); - m.checkCoherency(); - m.checkCoherency1();#OK because we are in polyhedron connec + m.checkConsistencyLight(); + m.checkConsistency();#OK because we are in polyhedron connec m.getNodalConnectivity().setIJ(36,0,14); - m.checkCoherency(); - self.assertRaises(InterpKernelException,m.checkCoherency1);#Throw beacause now cell 5 is a TETRA4 (14) so mimatch of number index and static type. + m.checkConsistencyLight(); + self.assertRaises(InterpKernelException,m.checkConsistency);#Throw beacause now cell 5 is a TETRA4 (14) so mimatch of number index and static type. pass def testUnPolyze2(self): @@ -1463,11 +1463,11 @@ class MEDCouplingBasicsTest3(unittest.TestCase): m2.convertToPolyTypes([2]); m2.unPolyze(); self.assertEqual(NORM_TETRA4,m2.getTypeOfCell(2)); - self.assertEqual(40,m2.getMeshLength()); + self.assertEqual(40,m2.getNodalConnectivityArrayLen()); temp2=m2.getNodeIdsOfCell(2); self.assertEqual(temp2,[0,1,2,3]); - m2.checkCoherency1(); - m3=m2.deepCpy(); + m2.checkConsistency(); + m3=m2.deepCopy(); m2.unPolyze(); self.assertTrue(m3.isEqual(m2,1e-12)); pass @@ -1484,25 +1484,25 @@ class MEDCouplingBasicsTest3(unittest.TestCase): # d1=DataArrayDouble.New(); self.assertTrue(not d.isEqual(d1,1e-12)); - d1.cpyFrom(d); + d1.deepCopyFrom(d); self.assertTrue(d.isEqual(d1,1e-12)); - d1.cpyFrom(d); + d1.deepCopyFrom(d); self.assertTrue(d.isEqual(d1,1e-12)); d1.rearrange(2); self.assertTrue(not d.isEqual(d1,1e-12)); - d1.cpyFrom(d); + d1.deepCopyFrom(d); self.assertTrue(d.isEqual(d1,1e-12)); # d2=d.convertToIntArr(); d4=DataArrayInt.New(); self.assertTrue(not d2.isEqual(d4)); - d4.cpyFrom(d2); + d4.deepCopyFrom(d2); self.assertTrue(d2.isEqual(d4)); - d4.cpyFrom(d2); + d4.deepCopyFrom(d2); self.assertTrue(d2.isEqual(d4)); d4.rearrange(2); self.assertTrue(not d2.isEqual(d4)); - d4.cpyFrom(d2); + d4.deepCopyFrom(d2); self.assertTrue(d2.isEqual(d4)); pass @@ -1697,7 +1697,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): def testSortCellsInMEDFileFrmt1(self): m,m1=MEDCouplingDataForTest.buildPointe_1(); - m2=m.deepCpy() + m2=m.deepCopy() da=DataArrayInt.New() da.setValues([0,1,2,14,3,12,4,5,15,6,7,8,9,10,11,13],16,1) daa=da.invertArrayN2O2O2N(16) @@ -1892,7 +1892,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): vals1=[3,5,1,2,0,8] expected1=[0,3,8,9,11,11,19] d.setValues(vals1,6,1); - d.computeOffsets2(); + d.computeOffsetsFull(); self.assertEqual(7,d.getNumberOfTuples()); self.assertEqual(1,d.getNumberOfComponents()); for i in xrange(7): @@ -1945,7 +1945,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): tab=[1.2,1.3,2.2,2.3,3.2,3.3,4.2,4.3,5.2,5.3] d.setValues(tab,5,2); f.setArray(d); - f.checkCoherency(); + f.checkConsistencyLight(); # self.assertAlmostEqual(11.209371079592289,f.norm2(),14); # @@ -1960,7 +1960,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): tab=[2.3,-1.2,6.3,-7.8,2.9,7.7,2.1,0.,3.6,-7.6] d.setValues(tab,5,2); f.setArray(d); - f.checkCoherency(); + f.checkConsistencyLight(); # self.assertAlmostEqual(7.8,f.normMax(),14); # @@ -2023,14 +2023,14 @@ class MEDCouplingBasicsTest3(unittest.TestCase): expected2=[0,5,14,19,42,49,86,95,108,159] self.assertEqual(expected1,da.getValues()); self.assertEqual(expected2,dai.getValues()); - m.checkCoherency1() + m.checkConsistency() pass def testNonRegressionCopyTinyStrings(self): m=MEDCouplingDataForTest.build2DTargetMesh_1() f1=m.getMeasureField(True) f1.getArray().setInfoOnComponent(0,"P [N/m^2]") - bary=m.getBarycenterAndOwner() + bary=m.computeCellCenterOfMass() f2=f1.buildNewTimeReprFromThis(NO_TIME,False) f2.setArray(bary) self.assertRaises(InterpKernelException,f1.copyTinyAttrFrom,f2) @@ -2084,7 +2084,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): coordsZ.setValues(arrZ,4,1); mesh.setCoords(coordsX,coordsY,coordsZ); f=mesh.getMeasureField(True) - mesh2=mesh.deepCpy() + mesh2=mesh.deepCopy() for myId in [0,1,2,10,11,12,20,21,22]: f=mesh.getMeasureField(True) f.changeUnderlyingMesh(mesh2,myId,1e-12); @@ -2201,13 +2201,13 @@ class MEDCouplingBasicsTest3(unittest.TestCase): a.setValues(arr,5,1); b=DataArrayInt.New(); b.setValues(arrI,3,1); - ret,newNbTuple=DataArrayInt.BuildOld2NewArrayFromSurjectiveFormat2(10,a,b); + ret,newNbTuple=DataArrayInt.ConvertIndexArrayToO2N(10,a,b); expected=[0,1,2,0,3,4,5,4,6,4] self.assertEqual(10,ret.getNbOfElems()); self.assertEqual(7,newNbTuple); self.assertEqual(1,ret.getNumberOfComponents()); self.assertEqual(expected,ret.getValues()); - self.assertRaises(InterpKernelException,DataArrayInt.BuildOld2NewArrayFromSurjectiveFormat2,9,a,b); + self.assertRaises(InterpKernelException,DataArrayInt.ConvertIndexArrayToO2N,9,a,b); pass def testDADIReverse1(self): @@ -2259,7 +2259,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): mesh=MEDCouplingDataForTest.build2DTargetMesh_1(); # mesh2,desc,descIndx,revDesc,revDescIndx=mesh.buildDescendingConnectivity2(); - mesh2.checkCoherency(); + mesh2.checkConsistencyLight(); self.assertEqual(1,mesh2.getMeshDimension()); self.assertEqual(13,mesh2.getNumberOfCells()); self.assertEqual(14,revDescIndx.getNbOfElems()); self.assertEqual(14,revDescIndx.getNumberOfTuples()); @@ -2294,7 +2294,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): m1c.setCoordsAt(1,coordsY); m1=m1c.buildUnstructured() m1bis=m1.buildPartOfMySelf([3,4,5],False) - m2=m1.deepCpy() + m2=m1.deepCopy() m2=m2.buildPartOfMySelf([0,1,2],False) m2.translate([0.5,0.5]) # @@ -2466,7 +2466,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): myCoords1.setValues(m1Coords,25,2); m1.setCoords(myCoords1); # - m11=m1.deepCpy(); + m11=m1.deepCopy(); m11.tessellate2D(1.); self.assertTrue(m11.getCoords().isEqual(m11.getCoords(),1e-12)); expected1=[5,0,3,11,1,5,3,4,12,2,1,11,5,5,15,3,0,5,6,16,4,3,15,5,5,5,0,7,19,5,6,5,19,7,8,20,5,0,1,23,7,5,1,2,24,8,7,23] @@ -2476,7 +2476,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): self.assertEqual(expected1,m11.getNodalConnectivity().getValues()); self.assertEqual(expected2,m11.getNodalConnectivityIndex().getValues()); # - m12=m1.deepCpy(); + m12=m1.deepCopy(); m12.tessellate2D(0.5); self.assertEqual(41,m12.getNumberOfNodes()); expected3=[5,0,3,25,26,1,5,3,4,27,28,2,1,26,25,5,5,29,30,3,0,5,6,31,32,4,3,30,29,5,5,5,0,7,33,34,5,6,5,34,33,7,8,35,36,5,0,1,37,38,7,5,1,2,39,40,8,7,38,37] @@ -2504,10 +2504,10 @@ class MEDCouplingBasicsTest3(unittest.TestCase): myCoords = DataArrayDouble.New(mcoords, 3, 2) m1.setCoords(myCoords) - m2 = m1.deepCpy() + m2 = m1.deepCopy() m2.tessellate2D(0.1) # If the following raises, the test will fail automatically: - m2.checkCoherency1(0.0) # eps param not used + m2.checkConsistency(0.0) # eps param not used def testIntersect2DMeshesTmp4(self): m1Coords=[0.,0.,1.,0.,1.5,0.,0.,1.,0.,1.5,-1.,0.,-1.5,0.,0.,-1,0.,-1.5,0.5,0.,1.25,0.,0.70710678118654757,0.70710678118654757,1.0606601717798214,1.0606601717798214,0.,0.5,0.,1.25,-0.70710678118654757,0.70710678118654757,-1.0606601717798214,1.0606601717798214,-0.5,0.,-1.25,0.,-0.70710678118654757,-0.70710678118654757,-1.0606601717798214,-1.0606601717798214,0.,-0.5,0.,-1.25,0.70710678118654757,-0.70710678118654757,1.0606601717798214,-1.0606601717798214]; @@ -2726,18 +2726,18 @@ class MEDCouplingBasicsTest3(unittest.TestCase): da2=DataArrayDouble.New(); da2.setValues(data2,5,2); # - dac=da.deepCpy(); - dac.setContigPartOfSelectedValues2(1,da2,2,4,1); + dac=da.deepCopy(); + dac.setContigPartOfSelectedValuesSlice(1,da2,2,4,1); expected3=[1.,11.,0.,30.,11.,41.,4.,14.,5.,15.,6.,16.,7.,17.] for i in xrange(14): self.assertAlmostEqual(expected3[i],dac.getIJ(0,i),14); pass # - dac=da.deepCpy(); - self.assertRaises(InterpKernelException,dac.setContigPartOfSelectedValues2,3,da2,0,5,1); - self.assertRaises(InterpKernelException,dac.setContigPartOfSelectedValues2,0,da2,4,6,1); - self.assertRaises(InterpKernelException,dac.setContigPartOfSelectedValues2,3,da2,5,0,1); - dac.setContigPartOfSelectedValues2(3,da2,1,5,1); + dac=da.deepCopy(); + self.assertRaises(InterpKernelException,dac.setContigPartOfSelectedValuesSlice,3,da2,0,5,1); + self.assertRaises(InterpKernelException,dac.setContigPartOfSelectedValuesSlice,0,da2,4,6,1); + self.assertRaises(InterpKernelException,dac.setContigPartOfSelectedValuesSlice,3,da2,5,0,1); + dac.setContigPartOfSelectedValuesSlice(3,da2,1,5,1); expected4=[1.,11.,2.,12.,3.,13.,9.,39.,0.,30.,11.,41.,12.,42.] for i in xrange(14): self.assertAlmostEqual(expected4[i],dac.getIJ(0,i),14); @@ -2745,7 +2745,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): # ids=DataArrayInt.New(); ids.alloc(3,1); - dac=da.deepCpy(); + dac=da.deepCopy(); ids.setIJ(0,0,2); ids.setIJ(1,0,0); ids.setIJ(2,0,4); dac.setContigPartOfSelectedValues(2,da2,ids); expected5=[1.,11.,2.,12.,0.,30.,8.,38.,12.,42.,6.,16.,7.,17.] @@ -2753,7 +2753,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): self.assertAlmostEqual(expected5[i],dac.getIJ(0,i),14); pass # - dac=da.deepCpy(); + dac=da.deepCopy(); ids.setIJ(0,0,2); ids.setIJ(1,0,5); ids.setIJ(2,0,4); self.assertRaises(InterpKernelException,dac.setContigPartOfSelectedValues,1,da2,ids); ids.setIJ(0,0,2); ids.setIJ(1,0,2); ids.setIJ(2,0,-1); @@ -2762,7 +2762,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): self.assertRaises(InterpKernelException,dac.setContigPartOfSelectedValues,5,da2,ids); # ids.setIJ(0,0,2); ids.setIJ(1,0,2); ids.setIJ(2,0,1); - dac=da.deepCpy(); + dac=da.deepCopy(); dac.setContigPartOfSelectedValues(4,da2,ids); expected6=[1.,11.,2.,12.,3.,13.,4.,14.,0.,30.,0.,30.,9.,39.] for i in xrange(14): @@ -2809,18 +2809,18 @@ class MEDCouplingBasicsTest3(unittest.TestCase): da2=DataArrayInt.New(); da2.setValues(data2,5,2); # - dac=da.deepCpy(); - dac.setContigPartOfSelectedValues2(1,da2,2,4,1); + dac=da.deepCopy(); + dac.setContigPartOfSelectedValuesSlice(1,da2,2,4,1); expected3=[1,11,0,30,11,41,4,14,5,15,6,16,7,17] for i in xrange(14): self.assertEqual(expected3[i],dac.getIJ(0,i)); pass # - dac=da.deepCpy(); - self.assertRaises(InterpKernelException,dac.setContigPartOfSelectedValues2,3,da2,0,5,1); - self.assertRaises(InterpKernelException,dac.setContigPartOfSelectedValues2,0,da2,4,6,1); - self.assertRaises(InterpKernelException,dac.setContigPartOfSelectedValues2,3,da2,5,0,1); - dac.setContigPartOfSelectedValues2(3,da2,1,5,1); + dac=da.deepCopy(); + self.assertRaises(InterpKernelException,dac.setContigPartOfSelectedValuesSlice,3,da2,0,5,1); + self.assertRaises(InterpKernelException,dac.setContigPartOfSelectedValuesSlice,0,da2,4,6,1); + self.assertRaises(InterpKernelException,dac.setContigPartOfSelectedValuesSlice,3,da2,5,0,1); + dac.setContigPartOfSelectedValuesSlice(3,da2,1,5,1); expected4=[1,11,2,12,3,13,9,39,0,30,11,41,12,42] for i in xrange(14): self.assertEqual(expected4[i],dac.getIJ(0,i)); @@ -2828,7 +2828,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): # ids=DataArrayInt.New(); ids.alloc(3,1); - dac=da.deepCpy(); + dac=da.deepCopy(); ids.setIJ(0,0,2); ids.setIJ(1,0,0); ids.setIJ(2,0,4); dac.setContigPartOfSelectedValues(2,da2,ids); expected5=[1,11,2,12,0,30,8,38,12,42,6,16,7,17] @@ -2836,7 +2836,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): self.assertEqual(expected5[i],dac.getIJ(0,i)); pass # - dac=da.deepCpy(); + dac=da.deepCopy(); ids.setIJ(0,0,2); ids.setIJ(1,0,5); ids.setIJ(2,0,4); self.assertRaises(InterpKernelException,dac.setContigPartOfSelectedValues,1,da2,ids); ids.setIJ(0,0,2); ids.setIJ(1,0,2); ids.setIJ(2,0,-1); @@ -2845,7 +2845,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): self.assertRaises(InterpKernelException,dac.setContigPartOfSelectedValues,5,da2,ids); # ids.setIJ(0,0,2); ids.setIJ(1,0,2); ids.setIJ(2,0,1); - dac=da.deepCpy(); + dac=da.deepCopy(); dac.setContigPartOfSelectedValues(4,da2,ids); expected6=[1,11,2,12,3,13,4,14,0,30,0,30,9,39] for i in xrange(14): @@ -2857,7 +2857,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): mesh=MEDCouplingDataForTest.build3DSourceMesh_1(); # mesh2,desc,descIndx,revDesc,revDescIndx=mesh.buildDescendingConnectivity2(); - mesh2.checkCoherency(); + mesh2.checkConsistencyLight(); self.assertEqual(2,mesh2.getMeshDimension()); self.assertEqual(30,mesh2.getNumberOfCells()); self.assertEqual(31,revDescIndx.getNbOfElems()); self.assertEqual(31,revDescIndx.getNumberOfTuples()); @@ -2895,7 +2895,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): vec1=[0.,0.,1.] for i in xrange(18): vec2=[3.*cos(pi/9.*i),3.*sin(pi/9.*i)]; - m1Cpy=m1.deepCpy(); + m1Cpy=m1.deepCopy(); m1Cpy.translate(vec2); self.assertRaises(InterpKernelException,m1Cpy.are2DCellsNotCorrectlyOriented,vec1,False); m1Cpy.changeSpaceDimension(3); diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest4.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest4.py index 9dc1f9926..76b25ab88 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest4.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest4.py @@ -443,7 +443,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): mesh2D.finishInsertingCells(); myCoords=DataArrayDouble.New(mesh2DCoords,9,3); mesh2D.setCoords(myCoords); - mesh2D.checkCoherency(); + mesh2D.checkConsistencyLight(); # mesh3DCoords=[-0.3,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., 0.2,-0.3,0., -0.3,-0.3,1., -0.3,0.2,1., 0.2,0.2,1., 0.2,-0.3,1. ] mesh3DConn=[0,1,2,3,4,5,6,7] @@ -453,12 +453,12 @@ class MEDCouplingBasicsTest4(unittest.TestCase): mesh3D.finishInsertingCells(); myCoords3D=DataArrayDouble.New(mesh3DCoords,8,3); mesh3D.setCoords(myCoords3D); - mesh3D.checkCoherency(); + mesh3D.checkConsistencyLight(); # - mesh3D_2=mesh3D.deepCpy(); - mesh2D_2=mesh2D.deepCpy(); - mesh3D_4=mesh3D.deepCpy(); - mesh2D_4=mesh2D.deepCpy(); + mesh3D_2=mesh3D.deepCopy(); + mesh2D_2=mesh2D.deepCopy(); + mesh3D_4=mesh3D.deepCopy(); + mesh2D_4=mesh2D.deepCopy(); oldNbOf3DNodes=mesh3D.getNumberOfNodes(); renumNodes=DataArrayInt.New(); renumNodes.alloc(mesh2D.getNumberOfNodes(),1); @@ -466,8 +466,8 @@ class MEDCouplingBasicsTest4(unittest.TestCase): coo=DataArrayDouble.Aggregate(mesh3D.getCoords(),mesh2D.getCoords()); mesh3D.setCoords(coo); mesh2D.setCoords(coo); - mesh2DCpy=mesh2D.deepCpy() - mesh2D_3=mesh2D.deepCpy(); + mesh2DCpy=mesh2D.deepCopy() + mesh2D_3=mesh2D.deepCopy(); mesh2D_3.shiftNodeNumbersInConn(oldNbOf3DNodes); mesh2D.renumberNodesInConn(renumNodes); mesh2DCpy.renumberNodesInConn(renumNodes.getValues()); @@ -491,13 +491,13 @@ class MEDCouplingBasicsTest4(unittest.TestCase): self.assertEqual(8+i,da2.getIJ(i,0)); pass # - mesh2D_5=mesh2D_4.deepCpy(); + mesh2D_5=mesh2D_4.deepCopy(); mesh2D_5.translate([1.,0.,0.]); meshes=[mesh3D_4,mesh2D_4,mesh2D_5]; MEDCouplingUMesh.PutUMeshesOnSameAggregatedCoords(meshes); self.assertTrue(mesh3D_4.getCoords().getHiddenCppPointer()==mesh2D_4.getCoords().getHiddenCppPointer()); self.assertTrue(mesh2D_4.getCoords().getHiddenCppPointer()==mesh2D_5.getCoords().getHiddenCppPointer()); - mesh3D_4.checkCoherency(); mesh2D_4.checkCoherency(); mesh2D_5.checkCoherency(); + mesh3D_4.checkConsistencyLight(); mesh2D_4.checkConsistencyLight(); mesh2D_5.checkConsistencyLight(); self.assertEqual(26,mesh3D_4.getNumberOfNodes()); self.assertEqual(3,mesh3D_4.getSpaceDimension()); self.assertEqual(9,mesh3D_4.getNodalConnectivity().getNumberOfTuples()); @@ -515,7 +515,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): pass # MEDCouplingUMesh.MergeNodesOnUMeshesSharingSameCoords(meshes,1e-12); - mesh3D_4.checkCoherency(); mesh2D_4.checkCoherency(); mesh2D_5.checkCoherency(); + mesh3D_4.checkConsistencyLight(); mesh2D_4.checkConsistencyLight(); mesh2D_5.checkConsistencyLight(); self.assertTrue(mesh3D_4.getCoords().getHiddenCppPointer()==mesh2D_4.getCoords().getHiddenCppPointer()); self.assertTrue(mesh2D_4.getCoords().getHiddenCppPointer()==mesh2D_5.getCoords().getHiddenCppPointer()); self.assertEqual(19,mesh3D_4.getNumberOfNodes()); @@ -558,7 +558,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): mesh2D.finishInsertingCells(); myCoords=DataArrayDouble.New(mesh2DCoords,5,2); mesh2D.setCoords(myCoords); - mesh2D.checkCoherency(); + mesh2D.checkConsistencyLight(); # v=mesh2D.checkButterflyCells(); self.assertTrue(v.empty()); @@ -661,7 +661,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): def testSwigDADISub1(self): mesh3D,mesh2D=MEDCouplingDataForTest.build3DExtrudedUMesh_1(); - bary=mesh3D.getBarycenterAndOwner() + bary=mesh3D.computeCellCenterOfMass() bary=bary[:,:2] pts=bary.getDifferentValues(1e-12) expected=[[0,6,12],[1,7,13],[2,8,14],[3,9,15],[4,10,16],[5,11,17]] @@ -669,7 +669,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): bary2=bary[:,:2] bary2[:]-=pt norm=bary2.magnitude() - self.assertEqual(expected[pos],norm.getIdsInRange(-1.,1e-5).getValues()) + self.assertEqual(expected[pos],norm.findIdsInRange(-1.,1e-5).getValues()) pass expected2=[[3.,54.],[-141.,180.],[21.,54.],[39.,72.],[-15.,90.],[21.,90.]] for pos,pt in enumerate(pts): @@ -933,10 +933,10 @@ class MEDCouplingBasicsTest4(unittest.TestCase): m.finishInsertingCells(); coordsDa=DataArrayDouble.New(coords,331,2); m.setCoords(coordsDa); - m.checkCoherency(); + m.checkConsistencyLight(); # da=m.convexEnvelop2D(); - m.checkCoherency() + m.checkConsistencyLight() self.assertEqual(coordsDa.getHiddenCppPointer(),m.getCoords().getHiddenCppPointer()) daC=da.buildComplement(m.getNumberOfCells()); expected2=DataArrayInt.New([271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,302,303,304,305,306,307,308,309,310,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330]); @@ -946,8 +946,8 @@ class MEDCouplingBasicsTest4(unittest.TestCase): ref=271*[184.69493088478035]+3*[-61.564976961404426,-92.34746544254946,-92.34746544259811,-92.34746544253488,-92.3474654425349,-92.34746544180479,-92.34746544253493,-92.3474654419026,-92.34746544190256,-92.34746544253491]+2*[61.564976961404426,-92.34746544254946,-92.34746544259811,-92.34746544253488,-92.3474654425349,-92.34746544180479,-92.34746544253493,-92.3474654419026,-92.34746544190256,-92.34746544253491]+[-61.564976961404426,-92.34746544254946,-92.34746544259811,-92.34746544253488,-92.3474654425349,-92.34746544180479,-92.34746544253493,-92.3474654419026,-92.34746544190256,-92.34746544253491] vals-=DataArrayDouble.New(ref) vals.abs() - theTest=vals.getIdsInRange(-1.,1e-7) - self.assertTrue(theTest.isIdentity2(331)) + theTest=vals.findIdsInRange(-1.,1e-7) + self.assertTrue(theTest.isIota(331)) pass def testSwigDAIOp8(self): @@ -977,8 +977,8 @@ class MEDCouplingBasicsTest4(unittest.TestCase): self.assertRaises(InterpKernelException,arr.sort,False) arr.rearrange(1); arr.setValues(values,6,1) - arr1=arr.deepCpy(); - arr2=arr.deepCpy(); + arr1=arr.deepCopy(); + arr2=arr.deepCopy(); arr1.sort(True); expected1=[1,2,4,5,6,7] self.assertEqual(6,arr1.getNumberOfTuples()); @@ -999,8 +999,8 @@ class MEDCouplingBasicsTest4(unittest.TestCase): self.assertRaises(InterpKernelException,ard.sort,False) ard.rearrange(1); ard.setValues(valuesD,6,1) - ard1=ard.deepCpy(); - ard2=ard.deepCpy(); + ard1=ard.deepCopy(); + ard2=ard.deepCopy(); ard1.sort(True); expected3=[1.,2.,4.,5.,6.,7.] self.assertEqual(6,ard1.getNumberOfTuples()); @@ -1130,12 +1130,12 @@ class MEDCouplingBasicsTest4(unittest.TestCase): vecs=DataArrayDouble.New([2.,3.,4.,5.,6.,7.],3,2) expected1=[[2.,3.,3.,3.,3.,4.,2.,4.0],[4.,5.,5.,5.,5.,6.,4.,6.0],[6.,7.,7.,7.,7.,8.,6.,8.0]] for pos,vec in enumerate(vecs): - m2=m.deepCpy() + m2=m.deepCopy() m2.translate(vec) self.assertTrue(m2.getCoords().isEqual(DataArrayDouble.New(expected1[pos],4,2),1e-12)) pass for pos,vec in enumerate(vecs): - m2=m.deepCpy() + m2=m.deepCopy() m2.translate(vec.buildDADouble()) self.assertTrue(m2.getCoords().isEqual(DataArrayDouble.New(expected1[pos],4,2),1e-12)) pass @@ -1150,7 +1150,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): dad[:,1]=angles # dad2=dad.fromPolarToCart() - dads=[dad2.deepCpy() for elt in 7*[None]] + dads=[dad2.deepCopy() for elt in 7*[None]] # translationToPerform=[[0.01,0.02],[3./2.*radius,-radius*sqrt(3.)/2],[3./2.*radius,radius*sqrt(3.)/2],[0.,radius*sqrt(3.)],[-3./2.*radius,radius*sqrt(3.)/2],[-3./2.*radius,-radius*sqrt(3.)/2],[0.,-radius*sqrt(3.)]] for d,t in zip(dads,translationToPerform): @@ -1177,7 +1177,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): arr=DataArrayDouble(mesh3D.getNumberOfCells(),2) arr.rearrange(1) ; arr.iota(2.) ; arr.rearrange(2) f.setArray(arr) - f.checkCoherency() + f.checkConsistencyLight() expected1=DataArrayInt([1,3,4,7,9,10,13,15,16]) self.assertTrue(expected1.isEqual(ids)) arr2=arr[expected1] @@ -1197,9 +1197,9 @@ class MEDCouplingBasicsTest4(unittest.TestCase): f.setArray(arr) # f2=f.buildSubPart([1,5,9]) - f2.checkCoherency() + f2.checkConsistencyLight() cI=m.computeNbOfNodesPerCell() - cI.computeOffsets2() + cI.computeOffsetsFull() sel=DataArrayInt([1,5,9]) res=sel.buildExplicitArrByRanges(cI) arr2=arr[res] @@ -1284,7 +1284,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): m.finishInsertingCells(); coords=DataArrayDouble(coord,6,3); m.setCoords(coords); - m.checkCoherency(); + m.checkConsistencyLight(); # vol=m.getMeasureField(ON_CELLS); self.assertEqual(1,vol.getArray().getNumberOfTuples()); @@ -1317,7 +1317,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): f.setMesh(umesh); srcVals=DataArrayDouble.New(srcFieldValsOnPoints,nbOfInputPoints,1); f.setArray(srcVals); - f.checkCoherency(); + f.checkConsistencyLight(); # res0=f.getValueOn(targetPointCoordsX[:1]); self.assertAlmostEqual(targetFieldValsExpected[0],res0[0],10) @@ -1487,7 +1487,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): if 1 in cells: baseMesh.insertNextCell(NORM_QPOLYG, connec3) baseMesh.finishInsertingCells() - baseMesh.checkCoherency() + baseMesh.checkConsistencyLight() return baseMesh eps = 1.0e-7 @@ -1497,7 +1497,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): m3.mergeNodes(eps) m3.convertDegeneratedCells() m3.zipCoords() - m4 = m3.deepCpy() + m4 = m3.deepCopy() m5, _, _ = MEDCouplingUMesh.Intersect2DMeshes(m3, m4, eps) m5.mergeNodes(eps) # Check coordinates: @@ -1564,7 +1564,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): tr=[[0.,0.],[2.,0.], [0.,2.],[2.,2.],[4.,2.],[6.,2.],[8.,2.],[10.,2.],[12.,2.],[0.,4.],[2.,4.],[4.,4.],[6.,4.],[8.,4.],[10.,4.],[12.,4.],[14.,4.],[16.,4.],[18.,4.],[20.,4.],[22.,4.]] ms=2*[mQ4]+7*[mQ8]+11*[mT3] - ms[:]=(elt.deepCpy() for elt in ms) + ms[:]=(elt.deepCopy() for elt in ms) for m,t in zip(ms,tr): d=m.getCoords() ; d+= t pass @@ -1581,13 +1581,13 @@ class MEDCouplingBasicsTest4(unittest.TestCase): self.assertEqual(46,f.getNumberOfTuplesExpected()) vals=DataArrayDouble.New(46*3,1) ; vals.iota(7.7) ; vals.rearrange(3) f.setArray(vals) - f.checkCoherency() + f.checkConsistencyLight() #f.getLocalizationOfDiscr() self.assertRaises(InterpKernelException,f.getGaussLocalizationIdOfOneType,NORM_QUAD8) #throw because several loc self.assertEqual([1,2],f.getGaussLocalizationIdsOfOneType(NORM_QUAD8)) self.assertEqual([0,0,1,1,2,1,2,2,2,3,3,3,3,3,4,4,4,4,4,4],f.getDiscretization().getArrayOfDiscIds().getValues()) fc=f[[1,2,3,8]] - fc.checkCoherency() + fc.checkConsistencyLight() self.assertTrue(DataArrayDouble([13.7,14.7,15.7,16.7,17.7,18.7,19.7,20.7,21.7,22.7,23.7,24.7,25.7,26.7,27.7,28.7,29.7,30.7,31.7,32.7,33.7,34.7,35.7,36.7,82.7,83.7,84.7,85.7,86.7,87.7,88.7,89.7,90.7,91.7,92.7,93.7],12,3).isEqual(fc.getArray(),1e-10)) fc.renumberCells([3,2,0,1]) self.assertTrue(DataArrayDouble([28.7, 29.7, 30.7, 31.7, 32.7, 33.7, 34.7, 35.7, 36.7, 82.7, 83.7, 84.7, 85.7, 86.7, 87.7, 88.7, 89.7, 90.7, 91.7, 92.7, 93.7, 19.7, 20.7, 21.7, 22.7, 23.7, 24.7, 25.7, 26.7, 27.7, 13.7, 14.7, 15.7, 16.7, 17.7, 18.7],12,3).isEqual(fc.getArray(),1e-10)) @@ -1735,7 +1735,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): self.assertEqual(d.getNumberOfTuples(),9) self.assertEqual(d.getNbOfElemAllocated(),16) self.assertTrue(d.isEqual(DataArrayDouble([0.,1.,2.,3.,4.,5.,6.,7.,4.44]),1e-12)) - e=d.deepCpy() + e=d.deepCopy() self.assertEqual(e.getNumberOfTuples(),9) self.assertEqual(e.getNbOfElemAllocated(),9) self.assertTrue(e.isEqual(DataArrayDouble([0.,1.,2.,3.,4.,5.,6.,7.,4.44]),1e-12)) @@ -1769,7 +1769,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): self.assertEqual(d.getNumberOfTuples(),9) self.assertEqual(d.getNbOfElemAllocated(),16) self.assertTrue(d.isEqual(DataArrayInt([0,1,2,3,4,5,6,7,444]))) - e=d.deepCpy() + e=d.deepCopy() self.assertEqual(e.getNumberOfTuples(),9) self.assertEqual(e.getNbOfElemAllocated(),9) self.assertTrue(e.isEqual(DataArrayInt([0,1,2,3,4,5,6,7,444]))) @@ -1964,9 +1964,9 @@ class MEDCouplingBasicsTest4(unittest.TestCase): expected1=DataArrayDouble([0.16666666666666666,0.3333333333333333,0.5,1.,1.]) for v in vects: for i in xrange(nbOfDisc): - mm=m.deepCpy() + mm=m.deepCopy() mm.rotate([0.,0.,0.],[0.3,0.7,0.2],float(i)/float(nbOfDisc)*2*pi) - mm2=mm.deepCpy() + mm2=mm.deepCopy() self.assertTrue(mm.getMeasureField(False).getArray().isEqual(expected1,1e-14)) self.assertTrue(mm.findAndCorrectBadOriented3DCells().empty()) self.assertTrue(mm.isEqual(mm2,1e-14)) @@ -1976,7 +1976,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): pass pass # - mOK=m.deepCpy() + mOK=m.deepCopy() m0=MEDCouplingUMesh("m",3) ; m0.allocateCells(0); m0.insertNextCell(NORM_TETRA4,[0,2,1,3]); #Not well oriented m1=MEDCouplingUMesh("m",3) ; m1.allocateCells(0); m1.insertNextCell(NORM_PYRA5,[0,1,2,3,4]); #Well oriented m2=MEDCouplingUMesh("m",3) ; m2.allocateCells(0); m2.insertNextCell(NORM_PENTA6,[0,1,2,3,4,5]); #Well oriented @@ -1987,16 +1987,16 @@ class MEDCouplingBasicsTest4(unittest.TestCase): expected2=DataArrayDouble([-0.16666666666666666,0.3333333333333333,0.5,-1.,-1.]) for v in vects: for i in xrange(nbOfDisc): - mm=m.deepCpy() + mm=m.deepCopy() mm.rotate([0.,0.,0.],[0.3,0.7,0.2],float(i)/float(nbOfDisc)*2*pi) - mm2=mm.deepCpy() ; mm3=mm.deepCpy() ; mm3.convertAllToPoly() + mm2=mm.deepCopy() ; mm3=mm.deepCopy() ; mm3.convertAllToPoly() self.assertTrue(mm3.getMeasureField(False).getArray().isEqual(expected2,1e-14)) self.assertTrue(mm.getMeasureField(False).getArray().isEqual(expected2,1e-14)) self.assertTrue(mm.findAndCorrectBadOriented3DCells().isEqual(DataArrayInt([0,3,4]))) mOK.setCoords(mm.getCoords()) self.assertTrue(mm.isEqual(mOK,1e-14)) self.assertTrue(mm.getMeasureField(False).getArray().isEqual(expected1,1e-14)) - mmm=mm.deepCpy() + mmm=mm.deepCopy() self.assertTrue(mmm.findAndCorrectBadOriented3DCells().empty()) mm.convertAllToPoly() self.assertTrue(mm.getMeasureField(False).getArray().isEqual(expected1,1e-14)) @@ -2013,16 +2013,16 @@ class MEDCouplingBasicsTest4(unittest.TestCase): expected3=DataArrayDouble([0.16666666666666666,-0.3333333333333333,-0.5,1.,1.]) for v in vects: for i in xrange(nbOfDisc): - mm=m.deepCpy() + mm=m.deepCopy() mm.rotate([0.,0.,0.],[0.3,0.7,0.2],float(i)/float(nbOfDisc)*2*pi) - mm2=mm.deepCpy() ; mm3=mm.deepCpy() ; mm3.convertAllToPoly() + mm2=mm.deepCopy() ; mm3=mm.deepCopy() ; mm3.convertAllToPoly() self.assertTrue(mm3.getMeasureField(False).getArray().isEqual(expected3,1e-14)) self.assertTrue(mm.getMeasureField(False).getArray().isEqual(expected3,1e-14)) self.assertTrue(mm.findAndCorrectBadOriented3DCells().isEqual(DataArrayInt([1,2]))) mOK.setCoords(mm.getCoords()) self.assertTrue(mm.isEqual(mOK,1e-14)) self.assertTrue(mm.getMeasureField(False).getArray().isEqual(expected1,1e-14)) - mmm=mm.deepCpy() + mmm=mm.deepCopy() self.assertTrue(mmm.findAndCorrectBadOriented3DCells().empty()) mm.convertAllToPoly() self.assertTrue(mm.getMeasureField(False).getArray().isEqual(expected1,1e-14)) @@ -2048,7 +2048,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): mesh.insertNextCell(NORM_POLYHED,conn3) mesh.setCoords(coords) mesh.orientCorrectlyPolyhedrons() - self.assertTrue(mesh.getBarycenterAndOwner().isEqual(DataArrayDouble([-0.10803,0.,0.3385],1,3),1e-12)) + self.assertTrue(mesh.computeCellCenterOfMass().isEqual(DataArrayDouble([-0.10803,0.,0.3385],1,3),1e-12)) pass pass @@ -2105,7 +2105,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): m.setCoords(coords) m.allocateCells(0) m.insertNextCell(NORM_QUAD4,[0,1,2,3]) - m.checkCoherency1() + m.checkConsistency() self.assertEqual([4,0,1,2,3],m.getNodalConnectivity().getValues()) a,b=m.distanceToPoint([5.,2.,0.1]) self.assertAlmostEqual(0.1,a,14) ; self.assertEqual(0,b) @@ -2113,7 +2113,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): self.assertAlmostEqual(sqrt(2*2+4*4),a,14) ; self.assertEqual(0,b) m.allocateCells(0) m.insertNextCell(NORM_POLYGON,[0,1,2,3]) - m.checkCoherency1() + m.checkConsistency() self.assertEqual([5,0,1,2,3],m.getNodalConnectivity().getValues()) a,b=m.distanceToPoint([11.,3.,4.]) self.assertAlmostEqual(sqrt(3*3+4*4),a,14) ; self.assertEqual(0,b) @@ -2149,13 +2149,13 @@ class MEDCouplingBasicsTest4(unittest.TestCase): # n,ni=m.computeNeighborsOfCells() a,b=MEDCouplingUMesh.ComputeSpreadZoneGraduallyFromSeed(0,n,ni) - self.assertEqual(13,b) ; self.assertTrue(a.isIdentity2(125)) + self.assertEqual(13,b) ; self.assertTrue(a.isIota(125)) a,b=MEDCouplingUMesh.ComputeSpreadZoneGraduallyFromSeed([1],n,ni) - self.assertEqual(12,b) ; self.assertTrue(a.isIdentity2(125)) + self.assertEqual(12,b) ; self.assertTrue(a.isIota(125)) a,b=MEDCouplingUMesh.ComputeSpreadZoneGraduallyFromSeed((2,),n,ni) - self.assertEqual(11,b) ; self.assertTrue(a.isIdentity2(125)) + self.assertEqual(11,b) ; self.assertTrue(a.isIota(125)) a,b=MEDCouplingUMesh.ComputeSpreadZoneGraduallyFromSeed(DataArrayInt([3]),n,ni) - self.assertEqual(12,b) ; self.assertTrue(a.isIdentity2(125)) + self.assertEqual(12,b) ; self.assertTrue(a.isIota(125)) pass def testSwigUMeshInsertNextCell1(self): @@ -2197,12 +2197,12 @@ class MEDCouplingBasicsTest4(unittest.TestCase): m.setNodeGridStructure([2,3]) coords=DataArrayDouble([0.,0., 2.,0., 0.,1., 1.9,1.1, 0.3,1.9, 2.2,2.1],6,2) m.setCoords(coords) - m.checkCoherency() - m0=m.deepCpy() + m.checkConsistencyLight() + m0=m.deepCopy() self.assertTrue(m0.isEqual(m,1e-12)) m.getCoords().setInfoOnComponents(["X [m]","Y [m]"]) self.assertTrue(not m0.isEqual(m,1e-12)) - m0=m.deepCpy() + m0=m.deepCopy() self.assertTrue(m0.isEqual(m,1e-12)) self.assertEqual(m.getNodeGridStructure(),(2,3)) pass @@ -2224,20 +2224,20 @@ class MEDCouplingBasicsTest4(unittest.TestCase): c4=c1+[6.,0.,0.] c=DataArrayDouble.Aggregate([c1,c2,c3,c4]) m.setCoords(c) - m.checkCoherency1() + m.checkConsistency() # - m1=m.deepCpy() + m1=m.deepCopy() d1=m1.simplexize(PLANAR_FACE_5) - m1.checkCoherency1() + m1.checkConsistency() vol1=m1.getMeasureField(ON_CELLS).getArray() self.assertTrue(vol1.isEqual(DataArrayDouble([1./6, 1./6, 1./6,1./6, 1./6, 1./3,1./6, 1./6, 1./6, 1./6, 1./3, 1./6]),1e-12)) self.assertEqual(m1.getNodalConnectivity().getValues(),[14,0,1,2,3,14,4,9,5,6,14,4,8,9,11,14,4,7,11,6,14,9,11,10,6,14,4,9,6,11,14,12,17,13,14,14,12,16,17,19,14,12,15,19,14,14,17,19,18,14,14,12,17,14,19,14,20,21,22,23]) self.assertEqual(m1.getNodalConnectivityIndex().getValues(),[0,5,10,15,20,25,30,35,40,45,50,55,60]) self.assertTrue(d1.isEqual(DataArrayInt([0,1,1,1,1,1,2,2,2,2,2,3]))) # - m2=m.deepCpy() + m2=m.deepCopy() d2=m2.simplexize(PLANAR_FACE_6) - m2.checkCoherency1() + m2.checkConsistency() vol2=m2.getMeasureField(ON_CELLS).getArray() self.assertTrue(vol2.isEqual(DataArrayDouble([1./6, 1./6, 1./6,1./6, 1./6, 1./6,1./6,1./6, 1./6, 1./6, 1./6, 1./6,1./6,1./6]),1e-12)) self.assertEqual(m2.getNodalConnectivity().getValues(),[14,0,1,2,3,14,4,9,5,10,14,4,5,6,10,14,4,8,9,10,14,4,11,8,10,14,4,6,7,10,14,4,7,11,10,14,12,17,13,18,14,12,13,14,18,14,12,16,17,18,14,12,19,16,18,14,12,14,15,18,14,12,15,19,18,14,20,21,22,23]) @@ -2256,13 +2256,13 @@ class MEDCouplingBasicsTest4(unittest.TestCase): cl=MEDCouplingCurveLinearMesh() cl.setCoords(coo) cl.setNodeGridStructure([4,3]) - cl.checkCoherency1() + cl.checkConsistency() li1=[1.,2.,4.,0.5,1.,2.] self.assertTrue(cl.getMeasureField(False).getArray().isEqual(DataArrayDouble(li1),1e-14)) self.assertTrue(u.getMeasureField(False).getArray().isEqual(DataArrayDouble(li1),1e-14)) li1_1=[0.5,0.5,2.,0.5,5.,0.5,0.5,1.25,2.,1.25,5.,1.25] - self.assertTrue(cl.getBarycenterAndOwner().isEqual(DataArrayDouble(li1_1,6,2),1e-14)) - self.assertTrue(u.getBarycenterAndOwner().isEqual(DataArrayDouble(li1_1,6,2),1e-14)) + self.assertTrue(cl.computeCellCenterOfMass().isEqual(DataArrayDouble(li1_1,6,2),1e-14)) + self.assertTrue(u.computeCellCenterOfMass().isEqual(DataArrayDouble(li1_1,6,2),1e-14)) #3D c.setCoords(arr1,arr2,arr2) u=c.buildUnstructured() @@ -2270,29 +2270,29 @@ class MEDCouplingBasicsTest4(unittest.TestCase): cl=MEDCouplingCurveLinearMesh() cl.setCoords(coo) cl.setNodeGridStructure([4,3,3]) - cl.checkCoherency1() + cl.checkConsistency() li2=[1.,2.,4.,0.5, 1.,2.,0.5,1.,2.,0.25,0.5,1.] li2_1=[0.5,0.5,0.5,2.,0.5,0.5,5.,0.5,0.5,0.5,1.25,0.5,2.,1.25,0.5,5.,1.25,0.5,0.5,0.5,1.25,2.,0.5,1.25,5.,0.5,1.25,0.5,1.25,1.25,2.,1.25,1.25,5.,1.25,1.25] self.assertTrue(cl.getMeasureField(False).getArray().isEqual(DataArrayDouble(li2),1e-14)) self.assertTrue(u.getMeasureField(False).getArray().isEqual(DataArrayDouble(li2),1e-14)) - self.assertTrue(cl.getBarycenterAndOwner().isEqual(DataArrayDouble(li2_1,12,3),1e-14)) - self.assertTrue(u.getBarycenterAndOwner().isEqual(DataArrayDouble(li2_1,12,3),1e-14)) + self.assertTrue(cl.computeCellCenterOfMass().isEqual(DataArrayDouble(li2_1,12,3),1e-14)) + self.assertTrue(u.computeCellCenterOfMass().isEqual(DataArrayDouble(li2_1,12,3),1e-14)) #1D spaceDim 1 coo=DataArrayDouble(5) ; coo.iota(0.) coo=coo*coo cl.setCoords(coo) cl.setNodeGridStructure([5]) - cl.checkCoherency1() + cl.checkConsistency() li3=[1.,3.,5.,7.] li3_1=[0.5,2.5,6.5,12.5] self.assertTrue(cl.getMeasureField(False).getArray().isEqual(DataArrayDouble(li3),1e-14)) self.assertTrue(cl.buildUnstructured().getMeasureField(False).getArray().isEqual(DataArrayDouble(li3),1e-14)) - self.assertTrue(cl.getBarycenterAndOwner().isEqual(DataArrayDouble(li3_1),1e-14)) - self.assertTrue(cl.buildUnstructured().getBarycenterAndOwner().isEqual(DataArrayDouble(li3_1),1e-14)) + self.assertTrue(cl.computeCellCenterOfMass().isEqual(DataArrayDouble(li3_1),1e-14)) + self.assertTrue(cl.buildUnstructured().computeCellCenterOfMass().isEqual(DataArrayDouble(li3_1),1e-14)) #1D spaceDim 2 coo=DataArrayDouble.Meld(coo,coo) cl.setCoords(coo) - cl.checkCoherency1() + cl.checkConsistency() li4=[sqrt(2.)*elt for elt in [1.,3.,5.,7.]] li4_1=[0.5,0.5,2.5,2.5,6.5,6.5,12.5,12.5] self.assertEqual(2,cl.getSpaceDimension()) @@ -2301,8 +2301,8 @@ class MEDCouplingBasicsTest4(unittest.TestCase): self.assertEqual(5,cl.getNumberOfNodes()) self.assertTrue(cl.getMeasureField(False).getArray().isEqual(DataArrayDouble(li4),1e-14)) self.assertTrue(cl.buildUnstructured().getMeasureField(False).getArray().isEqual(DataArrayDouble(li4),1e-14)) - self.assertTrue(cl.getBarycenterAndOwner().isEqual(DataArrayDouble(li4_1,4,2),1e-14)) - self.assertTrue(cl.buildUnstructured().getBarycenterAndOwner().isEqual(DataArrayDouble(li4_1,4,2),1e-14)) + self.assertTrue(cl.computeCellCenterOfMass().isEqual(DataArrayDouble(li4_1,4,2),1e-14)) + self.assertTrue(cl.buildUnstructured().computeCellCenterOfMass().isEqual(DataArrayDouble(li4_1,4,2),1e-14)) pass def testSwig2CurveLinearMeshNonRegression1(self): @@ -2315,7 +2315,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): self.assertTrue(vol.isEqual(DataArrayDouble([0.11450000709295281, 0.10583334351579375,0.11149999939029423,0.08866666863113633, 0.1404166805123294,0.1250000135352219,0.1270833433481557,0.13258334288001067]),1e-12)) self.assertTrue(vol.isEqual(m.buildUnstructured().getMeasureField(False).getArray(),1e-12)) # - self.assertTrue(m.getBarycenterAndOwner().isEqual(m.buildUnstructured().getBarycenterAndOwner(),1e-12)) + self.assertTrue(m.computeCellCenterOfMass().isEqual(m.buildUnstructured().computeCellCenterOfMass(),1e-12)) pass def testSwig2NonRegressionDASetSelectedComponents1(self): @@ -2466,14 +2466,14 @@ class MEDCouplingBasicsTest4(unittest.TestCase): # 2D m2D=MEDCouplingDataForTest.build2DTargetMesh_1() m2D.convertLinearCellsToQuadratic(0) - m2D.checkCoherency1() + m2D.checkConsistency() self.assertEqual(m2D.getNodalConnectivity().getValues(),[8,0,3,4,1,9,10,11,12,6,1,4,2,11,13,14,6,4,5,2,15,16,13,8,6,7,4,3,17,18,10,19,8,7,8,5,4,20,21,15,18]) self.assertEqual(m2D.getNodalConnectivityIndex().getValues(),[0,9,16,23,32,41]) self.assertTrue(m2D.getCoords().isEqual(coordsExp,1e-14)) # 1D m1D=MEDCouplingDataForTest.build2DTargetMesh_1().buildDescendingConnectivity()[0] m1D.convertLinearCellsToQuadratic(0) - m1D.checkCoherency1() + m1D.checkConsistency() self.assertEqual(m1D.getNodalConnectivity().getValues(),[2,0,3,9,2,3,4,10,2,4,1,11,2,1,0,12,2,4,2,13,2,2,1,14,2,4,5,15,2,5,2,16,2,6,7,17,2,7,4,18,2,3,6,19,2,7,8,20,2,8,5,21]) self.assertEqual(m1D.getNodalConnectivityIndex().getValues(),[0,4,8,12,16,20,24,28,32,36,40,44,48,52]) self.assertTrue(m1D.getCoords().isEqual(coordsExp,1e-14)) @@ -2486,7 +2486,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): cooTmp=m2D.getCoords()[:] m3D=m2D.buildExtrudedMesh(m1D,0) m3D.convertLinearCellsToQuadratic(0) - m3D.checkCoherency1() + m3D.checkConsistency() # check of new m3D content coordsExp2=[coordsExp.changeNbOfComponents(3,i) for i in xrange(4)] coordsExp3=[DataArrayDouble.Meld(cooTmp[:,[0,1]],cooTmp[:,2]+(0.5+float(i))) for i in xrange(3)] @@ -2496,7 +2496,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): self.assertEqual(len(m3D.getCoords()),115) a,b=c.findCommonTuples(1e-14) self.assertEqual(len(b),len(coordsExp4)+1) - e,f=DataArrayInt.BuildOld2NewArrayFromSurjectiveFormat2(2*115,a,b) + e,f=DataArrayInt.ConvertIndexArrayToO2N(2*115,a,b) self.assertEqual(f,115) self.assertTrue(e.isEqual(DataArrayInt([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,0,1,2,3,4,5,6,7,8,36,37,38,39,48,49,53,54,58,59,60,66,67,44,47,52,45,46,57,64,65,70,9,10,11,12,13,14,15,16,17,40,41,42,43,50,51,55,56,61,62,63,68,69,75,78,81,76,77,84,88,89,92,18,19,20,21,22,23,24,25,26,71,72,73,74,79,80,82,83,85,86,87,90,91,97,100,103,98,99,106,110,111,114,27,28,29,30,31,32,33,34,35,93,94,95,96,101,102,104,105,107,108,109,112,113]))) self.assertTrue(DataArrayInt([30,0,3,4,1,9,12,13,10,36,37,38,39,40,41,42,43,44,45,46,47,25,1,4,2,10,13,11,38,48,49,42,50,51,47,46,52,25,4,5,2,13,14,11,53,54,48,55,56,50,46,57,52,30,6,7,4,3,15,16,13,12,58,59,37,60,61,62,41,63,64,65,46,45,30,7,8,5,4,16,17,14,13,66,67,53,59,68,69,55,62,65,70,57,46,30,9,12,13,10,18,21,22,19,40,41,42,43,71,72,73,74,75,76,77,78,25,10,13,11,19,22,20,42,50,51,73,79,80,78,77,81,25,13,14,11,22,23,20,55,56,50,82,83,79,77,84,81,30,15,16,13,12,24,25,22,21,61,62,41,63,85,86,72,87,88,89,77,76,30,16,17,14,13,25,26,23,22,68,69,55,62,90,91,82,86,89,92,84,77,30,18,21,22,19,27,30,31,28,71,72,73,74,93,94,95,96,97,98,99,100,25,19,22,20,28,31,29,73,79,80,95,101,102,100,99,103,25,22,23,20,31,32,29,82,83,79,104,105,101,99,106,103,30,24,25,22,21,33,34,31,30,85,86,72,87,107,108,94,109,110,111,99,98,30,25,26,23,22,34,35,32,31,90,91,82,86,112,113,104,108,111,114,106,99]).isEqual(m3D.getNodalConnectivity())) @@ -2551,8 +2551,8 @@ class MEDCouplingBasicsTest4(unittest.TestCase): def testSwig2ConvertLinearCellsToQuadratic2(self): m2D=MEDCouplingDataForTest.build2DTargetMesh_1() ret=m2D.convertLinearCellsToQuadratic(1) - self.assertTrue(ret.isIdentity2(5)) - m2D.checkCoherency1() + self.assertTrue(ret.isIota(5)) + m2D.checkConsistency() coordsExp=DataArrayDouble([-0.3,-0.3,0.2,-0.3,0.7,-0.3,-0.3,0.2,0.2,0.2,0.7,0.2,-0.3,0.7,0.2,0.7,0.7,0.7,-0.3,-0.05,-0.05,0.2,0.2,-0.05,-0.05,-0.3,0.45,-0.05,0.45,-0.3,0.45,0.2,0.7,-0.05,-0.05,0.7,0.2,0.45,-0.3,0.45,0.45,0.7,0.7,0.45,-0.05,-0.05,0.3666666666666667,-0.1333333333333333,0.5333333333333332,0.03333333333333334,-0.05,0.45,0.45,0.45],27,2) self.assertTrue(m2D.getCoords().isEqual(coordsExp,1e-14)) self.assertTrue(m2D.getNodalConnectivity().isEqual(DataArrayInt([9,0,3,4,1,9,10,11,12,22,7,1,4,2,11,13,14,23,7,4,5,2,15,16,13,24,9,6,7,4,3,17,18,10,19,25,9,7,8,5,4,20,21,15,18,26]))) @@ -2566,8 +2566,8 @@ class MEDCouplingBasicsTest4(unittest.TestCase): cooTmp=m2D.getCoords()[:] m3D=m2D.buildExtrudedMesh(m1D,0) ret=m3D.convertLinearCellsToQuadratic(1) - self.assertTrue(ret.isIdentity2(4)) - m3D.checkCoherency1() + self.assertTrue(ret.isIota(4)) + m3D.checkConsistency() coordsExp2=DataArrayDouble([-0.3,-0.3,0.0,0.2,-0.3,0.0,-0.3,0.2,0.0,0.2,0.2,0.0,-0.3,0.7,0.0,0.2,0.7,0.0,-0.3,-0.3,1.0,0.2,-0.3,1.0,-0.3,0.2,1.0,0.2,0.2,1.0,-0.3,0.7,1.0,0.2,0.7,1.0,-0.3,-0.3,2.0,0.2,-0.3,2.0,-0.3,0.2,2.0,0.2,0.2,2.0,-0.3,0.7,2.0,0.2,0.7,2.0,-0.3,-0.05,0.0,-0.05,0.2,0.0,0.2,-0.05,0.0,-0.05,-0.3,0.0,-0.3,-0.05,1.0,-0.05,0.2,1.0,0.2,-0.05,1.0,-0.05,-0.3,1.0,-0.3,-0.3,0.5,-0.3,0.2,0.5,0.2,0.2,0.5,0.2,-0.3,0.5,-0.05,0.7,0.0,0.2,0.45,0.0,-0.3,0.45,0.0,-0.05,0.7,1.0,0.2,0.45,1.0,-0.3,0.45,1.0,-0.3,0.7,0.5,0.2,0.7,0.5,-0.3,-0.05,2.0,-0.05,0.2,2.0,0.2,-0.05,2.0,-0.05,-0.3,2.0,-0.3,-0.3,1.5,-0.3,0.2,1.5,0.2,0.2,1.5,0.2,-0.3,1.5,-0.05,0.7,2.0,0.2,0.45,2.0,-0.3,0.45,2.0,-0.3,0.7,1.5,0.2,0.7,1.5,-0.05,-0.05,0.0,-0.3,-0.05,0.5,-0.05,0.2,0.5,0.2,-0.05,0.5,-0.05,-0.3,0.5,-0.05,-0.05,1.0,-0.05,0.45,0.0,-0.05,0.7,0.5,0.2,0.45,0.5,-0.3,0.45,0.5,-0.05,0.45,1.0,-0.3,-0.05,1.5,-0.05,0.2,1.5,0.2,-0.05,1.5,-0.05,-0.3,1.5,-0.05,-0.05,2.0,-0.05,0.7,1.5,0.2,0.45,1.5,-0.3,0.45,1.5,-0.05,0.45,2.0,-0.05,-0.05,0.5,-0.05,0.45,0.5,-0.05,-0.05,1.5,-0.05,0.45,1.5],75,3) self.assertTrue(m3D.getCoords().isEqual(coordsExp2,1e-14)) self.assertTrue(m3D.getNodalConnectivity().isEqual(DataArrayInt([27,0,2,3,1,6,8,9,7,18,19,20,21,22,23,24,25,26,27,28,29,51,52,53,54,55,56,71,27,4,5,3,2,10,11,9,8,30,31,19,32,33,34,23,35,36,37,28,27,57,58,59,53,60,61,72,27,6,8,9,7,12,14,15,13,22,23,24,25,38,39,40,41,42,43,44,45,56,62,63,64,65,66,73,27,10,11,9,8,16,17,15,14,33,34,23,35,46,47,39,48,49,50,44,43,61,67,68,63,69,70,74]))) @@ -2594,7 +2594,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): arr2=DataArrayDouble(len(arr),2) arr2[:,0]=arr ; arr2[:,1]=arr+100 f.setArray(arr2) - f.checkCoherency() + f.checkConsistencyLight() res=f.integral(False) # a=25./81 ; b=40./81 ; c=64./81 # p1=0.11169079483905 ; p2=0.0549758718227661 @@ -2677,7 +2677,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): for elt in l: elt.reverse() d2i=DataArrayDouble.Meld(l) ids1=pts.findClosestTupleId(d2i) - idsExpectedI=idsExpected.deepCpy() ; idsExpectedI.reverse() + idsExpectedI=idsExpected.deepCopy() ; idsExpectedI.reverse() self.assertTrue(idsExpectedI.isEqual(ids1)) # l=[pts[:,i] for i in [0,1]] @@ -2688,7 +2688,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): self.assertTrue(idsExpected2.isEqual(ids2)) # ids3=ptsi.findClosestTupleId(d2i) - idsExpected3=idsExpected2.deepCpy() ; idsExpected3.reverse() + idsExpected3=idsExpected2.deepCopy() ; idsExpected3.reverse() self.assertTrue(idsExpected3.isEqual(ids3)) pass @@ -2701,7 +2701,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): self.assertEqual(2,d.getNumberOfTuples()) self.assertEqual(26,d.getNbOfElems()) self.assertEqual(13,d.getNumberOfComponents()) - dd=d.deepCpy() + dd=d.deepCopy() self.assertTrue(d.isEqual(dd)) dd.setIJ(0,3,'d') self.assertTrue(not d.isEqual(dd)) @@ -2731,7 +2731,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): d.rearrange(2) # dd.rearrange(2) - dd2=dd.deepCpy() + dd2=dd.deepCopy() dd.renumberInPlace([3,1,2,4,0,11,10,9,8,7,5,12,6]) self.assertEqual(dd.toStrList(),['IJ','Cd','EF','AB','GH','UV','YZ','ST','QR','OP','MN','KL','WX']) dd.renumberInPlaceR([3,1,2,4,0,11,10,9,8,7,5,12,6]) @@ -2743,7 +2743,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): e=dd.renumberAndReduce([1,1,1,1,1,1,1,2,0,0,0,0,0],3) self.assertEqual(['YZ','MN','OP'],e.toStrList()) self.assertEqual(['GH','IJ'],dd.selectByTupleIdSafe([3,4]).toStrList()) - self.assertEqual(['AB','GH','MN','ST','YZ'],dd.selectByTupleId2(0,13,3).toStrList()) + self.assertEqual(['AB','GH','MN','ST','YZ'],dd.selectByTupleIdSafeSlice(0,13,3).toStrList()) dd3=dd.changeNbOfComponents(3,"G") self.assertEqual(['ABG','CdG','EFG','GHG','IJG','KLG','MNG','OPG','QRG','STG','UVG','WXG','YZG'],dd3.toStrList()) dd3.rearrange(1) ; self.assertEqual("G",dd3.back()) ; dd3.rearrange(3) @@ -2756,21 +2756,21 @@ class MEDCouplingBasicsTest4(unittest.TestCase): self.assertRaises(InterpKernelException,dd3.getIJSafe,0,6) self.assertEqual("d",dd3.getIJSafe(1,1)) dd3.rearrange(1) - e=dd3.getIdsEqual("Y") + e=dd3.findIdsEqual("Y") self.assertTrue(e.isEqual(DataArrayInt([3,4,8,9,13,14,18,19,23,24,28,29,33,34,38,39,43,44,48,49,53,54,58,59,60,63,64]))) - e=dd3.getIdsNotEqual("Y") + e=dd3.findIdsNotEqual("Y") self.assertTrue(e.isEqual(DataArrayInt([0,1,2,5,6,7,10,11,12,15,16,17,20,21,22,25,26,27,30,31,32,35,36,37,40,41,42,45,46,47,50,51,52,55,56,57,61,62]))) self.assertEqual(("d",6),dd3.getMaxValue()) self.assertEqual(("A",0),dd3.getMinValue()) self.assertEqual(26,dd3.search("LGYYM")) self.assertEqual(-1,dd3.search("LGYYN")) dd3.rearrange(5) - self.assertEqual(7,dd3.locateTuple("OPGYY")) + self.assertEqual(7,dd3.findIdFirstEqualTuple("OPGYY")) self.assertTrue("OPGYY" in dd3) self.assertEqual(7,dd3.index("OPGYY")) - self.assertEqual(-1,dd3.locateTuple("OPGYP")) + self.assertEqual(-1,dd3.findIdFirstEqualTuple("OPGYP")) dd3.rearrange(1) - self.assertEqual(2,dd3.locateValue("OPGYY")) + self.assertEqual(2,dd3.findIdFirstEqual("OPGYY")) self.assertTrue(dd3.presenceOfValue("OPGYY")) self.assertTrue("O" in dd3) self.assertTrue(not dd3.presenceOfValue("z")) @@ -2824,7 +2824,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): def testSwig2GaussMeasureAndIntegral(self): ft=MEDCouplingDataForTest.buildFieldOnGauss_1() mea=ft.buildMeasureField(False) - mea.checkCoherency() + mea.checkConsistencyLight() self.assertTrue(mea.getArray().isEqual(DataArrayDouble([-0.08504076274779823,-0.06378057206084897,-0.08504076274779869,-0.10630095343474463,-0.12756114412169625,-0.10630095343474734,-0.0637805720608491,-0.0850407627477968,-0.1063009534347449,-0.0850407627477994,-0.10630095343474809,-0.1275611441216954,-0.037205333702161475,-0.037205333702161475,-0.037205333702161475,-0.037205333702161475,-0.047835429045636084,-0.047835429045636084,-0.047835429045636084,-0.047835429045636084,-0.05846552438911087,-0.05846552438911087,-0.05846552438911087,-0.05846552438911087,-0.037205333702161725,-0.037205333702161725,-0.037205333702161725,-0.037205333702161725,-0.047835429045635834,-0.047835429045635834,-0.047835429045635834,-0.047835429045635834,-0.05846552438911058,-0.05846552438911058,-0.05846552438911058,-0.05846552438911058,-0.03879154890291829,-0.03879154890291829,-0.03879154890291829,-0.04120270848015563,-0.04120270848015563,-0.04120270848015563,-0.03393028948486933,-0.03393028948486933,-0.03393028948486933,-0.03151955746491709,-0.03151955746491709,-0.03151955746491709,-0.02424752187358276,-0.02424752187358276,-0.02424752187358276,-0.026657914642918758,-0.026657914642918758,-0.026657914642918758,-0.04120270848015456,-0.04120270848015456,-0.04120270848015456,-0.03879154890291757,-0.03879154890291757,-0.03879154890291757,-0.031519557464916595,-0.031519557464916595,-0.031519557464916595,-0.03393028948487046,-0.03393028948487046,-0.03393028948487046,-0.0266579146429191,-0.0266579146429191,-0.0266579146429191,-0.024247521873582645,-0.024247521873582645,-0.024247521873582645,-0.01851718920904466,-0.01851718920904466,-0.01851718920904466,-0.01851718920904466,-0.029627502734471456,-0.029627502734471456,-0.029627502734471456,-0.029627502734471456,-0.04740400437515433,-0.015150427534672922,-0.015150427534672922,-0.015150427534672922,-0.015150427534672922,-0.024240684055476674,-0.024240684055476674,-0.024240684055476674,-0.024240684055476674,-0.038785094488762675,-0.011783665860301345,-0.011783665860301345,-0.011783665860301345,-0.011783665860301345,-0.018853865376482152,-0.018853865376482152,-0.018853865376482152,-0.018853865376482152,-0.030166184602371443,-0.018517189209044892,-0.018517189209044892,-0.018517189209044892,-0.018517189209044892,-0.029627502734471827,-0.029627502734471827,-0.029627502734471827,-0.029627502734471827,-0.04740400437515492,-0.015150427534672776,-0.015150427534672776,-0.015150427534672776,-0.015150427534672776,-0.02424068405547644,-0.02424068405547644,-0.02424068405547644,-0.02424068405547644,-0.03878509448876231,-0.011783665860301277,-0.011783665860301277,-0.011783665860301277,-0.011783665860301277,-0.01885386537648204,-0.01885386537648204,-0.01885386537648204,-0.01885386537648204,-0.030166184602371266]),1e-14)) f=MEDCouplingFieldDouble(ft) arr=DataArrayDouble(126,2) @@ -2832,7 +2832,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): arr[:,1]=range(126) arr[:,1]+=1000 f.setArray(arr) - f.checkCoherency() + f.checkConsistencyLight() self.assertTrue(DataArrayDouble(f.integral(False)).isEqual(DataArrayDouble([-211.66121638700983,-4863.9563007698835]),1e-11)) self.assertTrue(DataArrayDouble(f.getWeightedAverageValue()).isEqual(DataArrayDouble([45.4960858131136,1045.496085813114]),1e-11)) self.assertTrue(DataArrayDouble(f.normL1()).isEqual(DataArrayDouble([45.49608581311362,1045.496085813114]),1e-11)) @@ -2869,7 +2869,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): # d=DataArrayInt([0,3,7,9,15,18]) e=DataArrayInt([0,1,2,3,7,8,15,16,17]) - a,b=d.searchRangesInListOfIds(e) + a,b=d.findIdsRangesInListOfIds(e) self.assertTrue(a.isEqual(DataArrayInt([0,2,4]))) self.assertTrue(b.isEqual(DataArrayInt([0,1,2,7,8,15,16,17]))) pass @@ -2914,7 +2914,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): def testSwigDAPow1(self): d=DataArrayInt(10) d.iota(0) - d1=d.deepCpy() + d1=d.deepCopy() d.setIJ(2,0,-2) self.assertTrue((d**2).isEqual(DataArrayInt([0,1,4,9,16,25,36,49,64,81]))) self.assertTrue((d**3).isEqual(DataArrayInt([0,1,-8,27,64,125,216,343,512,729]))) @@ -2932,7 +2932,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): # d=DataArrayDouble(10) d.iota(0) - d1=d.deepCpy() + d1=d.deepCopy() d.setIJ(2,0,-2.) self.assertTrue((d**2).isEqual(DataArrayDouble([0,1,4,9,16,25,36,49,64,81]),1e-12)) self.assertTrue((d**3).isEqual(DataArrayDouble([0,1,-8,27,64,125,216,343,512,729]),1e-12)) @@ -2950,7 +2950,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): self.assertTrue(d2.isEqual(DataArrayDouble([1,1,1./2,1./sqrt(27.)]),1e-14)) d3=-1./d1[1:5] self.assertTrue((3**d3).isEqual(DataArrayDouble([0.3333333333333333,0.5773502691896257,0.6933612743506348,0.7598356856515925]),1e-14)) - d4=d3.deepCpy() ; d4.abs() + d4=d3.deepCopy() ; d4.abs() self.assertTrue((d4**d3).isEqual(DataArrayDouble([1.,sqrt(2.),1.4422495703074083,sqrt(2.)]),1e-14)) d4**=d3 self.assertTrue(d4.isEqual(DataArrayDouble([1.,sqrt(2.),1.4422495703074083,sqrt(2.)]),1e-14)) @@ -2962,7 +2962,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): m2.allocateCells(0) m2.insertNextCell(NORM_POLYGON,[0,1,2]) m2.setCoords(coo) - m2.checkCoherency1() + m2.checkConsistency() # coo2=DataArrayDouble([0.,0.,0.,0.,0.,0.,0.,0.,2.],3,3) m1=MEDCouplingUMesh("mesh",1) @@ -2970,13 +2970,13 @@ class MEDCouplingBasicsTest4(unittest.TestCase): m1.insertNextCell(NORM_SEG2,[0,1]) m1.insertNextCell(NORM_SEG2,[1,2]) m1.setCoords(coo2) - m1.checkCoherency1() + m1.checkConsistency() # m3=m2.buildExtrudedMesh(m1,0) m3.insertNextCell(NORM_POLYHED,[3,4,5,-1,8,7,6,-1,4,3,6,7,-1,5,4,7,8,-1,5,4,-1,3,5,8,6])# addition of face #4 with null surface - self.assertTrue(m3.getBarycenterAndOwner().isEqual(DataArrayDouble([0.3333333333333333,0.3333333333333333,0.,0.3333333333333333,0.3333333333333333,1.,0.3333333333333333,0.3333333333333333,1.],3,3),1e-13)) + self.assertTrue(m3.computeCellCenterOfMass().isEqual(DataArrayDouble([0.3333333333333333,0.3333333333333333,0.,0.3333333333333333,0.3333333333333333,1.,0.3333333333333333,0.3333333333333333,1.],3,3),1e-13)) m4,a,b,c,d=m3.buildDescendingConnectivity() - self.assertTrue(m4.getBarycenterAndOwner().isEqual(DataArrayDouble([0.3333333333333333,0.3333333333333333,0.,0.3333333333333333,0.3333333333333333,0.,0.5,0.,0.,0.5,0.5,0.,0.,0.5,0.,0.3333333333333333,0.3333333333333333,2.,0.5,0.,1.,0.5,0.5,1.,0.,0.5,1.,0.5,0.5,0.],10,3),1e-13)) + self.assertTrue(m4.computeCellCenterOfMass().isEqual(DataArrayDouble([0.3333333333333333,0.3333333333333333,0.,0.3333333333333333,0.3333333333333333,0.,0.5,0.,0.,0.5,0.5,0.,0.,0.5,0.,0.3333333333333333,0.3333333333333333,2.,0.5,0.,1.,0.5,0.5,1.,0.,0.5,1.,0.5,0.5,0.],10,3),1e-13)) pass def testSwigRepr1(self): @@ -3044,7 +3044,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): m.insertNextCell(NORM_POLYHED,[4,5,0,1,6,7,-1,19,18,13,12,17,16,-1,5,4,16,17,-1,0,5,17,12,-1,1,0,12,13,-1,6,1,13,18,-1,7,6,18,19,-1,4,7,19,16]) m.insertNextCell(NORM_POLYHED,[9,10,11,3,2,8,-1,20,14,15,23,22,21,-1,10,9,21,22,-1,11,10,22,23,-1,3,11,23,15,-1,2,3,15,14,-1,8,2,14,20,-1,9,8,20,21]) m.setCoords(coo) - m.checkCoherency1() + m.checkConsistency() # dReference=DataArrayDouble([(34.900130952189848,0.,200),(17.450065476094931,30.2244,200.)]) self.assertTrue(m.computeIsoBarycenterOfNodesPerCell().isEqual(dReference,1e-12)) @@ -3069,7 +3069,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): m.allocateCells(0) m.insertNextCell(NORM_HEXA20,[0,3,5,1,12,18,16,14,7,4,6,2,19,17,15,13,8,11,10,9]) m.setCoords(coo) - m.checkCoherency1() + m.checkConsistency() # a,b,c,d,e=m.buildDescendingConnectivity() m2=MEDCouplingUMesh('mesh',2) @@ -3162,9 +3162,9 @@ class MEDCouplingBasicsTest4(unittest.TestCase): # NodeField_read=MEDCouplingFieldDouble.MergeFields([NodeField0,NodeField1]) NodeField_read.mergeNodes(1e-10) - NodeFieldCpy=NodeField.deepCpy() + NodeFieldCpy=NodeField.deepCopy() NodeFieldCpy.mergeNodes(1e-10) - NodeField.checkCoherency() + NodeField.checkConsistencyLight() self.assertTrue(not NodeField.getArray().isUniform(0.,1e-12)) NodeField.substractInPlaceDM(NodeField_read,10,1e-12) self.assertTrue(NodeField.getArray().isUniform(0.,1e-12)) @@ -3191,15 +3191,15 @@ class MEDCouplingBasicsTest4(unittest.TestCase): f.getArray().alloc(5,2) f.getArray()[:,0]=range(5) ; f.getArray()[:,1]=f.getArray()[:,0]+7 ff=f+2 - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(2,9),(3,10),(4,11),(5,12),(6,13)]),1e-12)) ff=f+arr - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(0,7),(2,10),(4,13),(6,16),(8,19)]),1e-12)) self.assertRaises(InterpKernelException,f.__add__,f2) f2.setArray(arr) ff=f+f2 - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(0,7),(2,10),(4,13),(6,16),(8,19)]),1e-12)) ff=f+[5,8] self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(5,15),(6,16),(7,17),(8,18),(9,19)]),1e-12)) @@ -3223,15 +3223,15 @@ class MEDCouplingBasicsTest4(unittest.TestCase): f.getArray().alloc(5,2) f.getArray()[:,0]=range(5) ; f.getArray()[:,1]=f.getArray()[:,0]+7 ff=f-2 - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(-2,5),(-1,6),(0,7),(1,8),(2,9)]),1e-12)) ff=f-arr - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(0,7),(0,6),(0,5),(0,4),(0,3)]),1e-12)) self.assertRaises(InterpKernelException,f.__sub__,f2) f2.setArray(arr) ff=f-f2 - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(0,7),(0,6),(0,5),(0,4),(0,3)]),1e-12)) ff=f-[5,8] self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(-5,-1),(-4,0),(-3,1),(-2,2),(-1,3)]),1e-12)) @@ -3255,15 +3255,15 @@ class MEDCouplingBasicsTest4(unittest.TestCase): f.getArray().alloc(5,2) f.getArray()[:,0]=range(5) ; f.getArray()[:,1]=f.getArray()[:,0]+7 ff=f*2 - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(0,14),(2,16),(4,18),(6,20),(8,22)]),1e-12)) ff=f*arr - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(0,0),(1,16),(4,36),(9,60),(16,88)]),1e-12)) self.assertRaises(InterpKernelException,f.__mul__,f2) f2.setArray(arr) ff=f*f2 - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(0,0),(1,16),(4,36),(9,60),(16,88)]),1e-12)) ff=f*[5,8] self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(0,56),(5,64),(10,72),(15,80),(20,88)]),1e-12)) @@ -3288,15 +3288,15 @@ class MEDCouplingBasicsTest4(unittest.TestCase): f.getArray()[:,0]=range(5) ; f.getArray()[:,1]=f.getArray()[:,0]+7 self.assertRaises(InterpKernelException,f.__div__,0) ff=f/2 - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(0,3.5),(0.5,4),(1,4.5),(1.5,5),(2,5.5)]),1e-12)) ff=f/arr - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(0,3.5),(0.5,2),(0.6666666666666666,1.5),(0.75,1.25),(0.8,1.1)]),1e-12)) self.assertRaises(InterpKernelException,f.__div__,f2) f2.setArray(arr) ff=f/f2 - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(0,3.5),(0.5,2),(0.6666666666666666,1.5),(0.75,1.25),(0.8,1.1)]),1e-12)) ff=f/[5,8] self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(0,0.875),(0.2,1),(0.4,1.125),(0.6,1.25),(0.8,1.375)]),1e-12)) @@ -3320,14 +3320,14 @@ class MEDCouplingBasicsTest4(unittest.TestCase): f.getArray().alloc(5,1) f.getArray()[:]=range(2,7) ff=f**2 - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue(ff.getArray().isEqual(DataArrayDouble([4,9,16,25,36]),1e-12)) ff=f**arr - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue(ff.getArray().isEqual(DataArrayDouble([2,3,64,25,1]),1e-12)) f2.setArray(arr) ff=f**f2 - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue(ff.getArray().isEqual(DataArrayDouble([2,3,64,25,1]),1e-12)) ## MEDCouplingFieldDouble.__iadd__ m=MEDCouplingDataForTest.build2DTargetMesh_1() @@ -3347,19 +3347,19 @@ class MEDCouplingBasicsTest4(unittest.TestCase): self.assertRaises(InterpKernelException,f.__iadd__,f2) f.getArray().alloc(5,2) f.getArray()[:,0]=range(5) ; f.getArray()[:,1]=f.getArray()[:,0]+7 - f.checkCoherency() + f.checkConsistencyLight() f+=2 - f.checkCoherency() + f.checkConsistencyLight() self.assertTrue(f.getArray().isEqual(DataArrayDouble([(2,9),(3,10),(4,11),(5,12),(6,13)]),1e-12)) f+=arr - f.checkCoherency() + f.checkConsistencyLight() self.assertTrue(f.getArray().isEqual(DataArrayDouble([(2,9),(4,12),(6,15),(8,18),(10,21)]),1e-12)) f2.setArray(arr) f+=f2 - f.checkCoherency() + f.checkConsistencyLight() self.assertTrue(f.getArray().isEqual(DataArrayDouble([(2,9),(5,14),(8,19),(11,24),(14,29)]),1e-12)) f+=[0.1,0.2] - f.checkCoherency() + f.checkConsistencyLight() self.assertTrue(f.getArray().isEqual(DataArrayDouble([(2.1,9.2),(5.1,14.2),(8.1,19.2),(11.1,24.2),(14.1,29.2)]),1e-12)) ## MEDCouplingFieldDouble.__isub__ m=MEDCouplingDataForTest.build2DTargetMesh_1() @@ -3379,19 +3379,19 @@ class MEDCouplingBasicsTest4(unittest.TestCase): self.assertRaises(InterpKernelException,f.__isub__,f2) f.getArray().alloc(5,2) f.getArray()[:,0]=range(5) ; f.getArray()[:,1]=f.getArray()[:,0]+7 - f.checkCoherency() + f.checkConsistencyLight() f-=2 - f.checkCoherency() + f.checkConsistencyLight() self.assertTrue(f.getArray().isEqual(DataArrayDouble([(-2,5),(-1,6),(0,7),(1,8),(2,9)]),1e-12)) f-=arr - f.checkCoherency() + f.checkConsistencyLight() self.assertTrue(f.getArray().isEqual(DataArrayDouble([(-2,5),(-2,4),(-2,3),(-2,2),(-2,1)]),1e-12)) f2.setArray(arr) f-=f2 - f.checkCoherency() + f.checkConsistencyLight() self.assertTrue(f.getArray().isEqual(DataArrayDouble([(-2,5),(-3,2),(-4,-1),(-5,-4),(-6,-7)]),1e-12)) f-=[0.1,0.2] - f.checkCoherency() + f.checkConsistencyLight() self.assertTrue(f.getArray().isEqual(DataArrayDouble([(-2.1,4.8),(-3.1,1.8),(-4.1,-1.2),(-5.1,-4.2),(-6.1,-7.2)]),1e-12)) ## MEDCouplingFieldDouble.__imul__ m=MEDCouplingDataForTest.build2DTargetMesh_1() @@ -3411,19 +3411,19 @@ class MEDCouplingBasicsTest4(unittest.TestCase): self.assertRaises(InterpKernelException,f.__imul__,f2) f.getArray().alloc(5,2) f.getArray()[:,0]=range(5) ; f.getArray()[:,1]=f.getArray()[:,0]+7 - f.checkCoherency() + f.checkConsistencyLight() f*=2 - f.checkCoherency() + f.checkConsistencyLight() self.assertTrue(f.getArray().isEqual(DataArrayDouble([(0,14),(2,16),(4,18),(6,20),(8,22)]),1e-12)) f*=arr - f.checkCoherency() + f.checkConsistencyLight() self.assertTrue(f.getArray().isEqual(DataArrayDouble([(0,0),(2,32),(8,72),(18,120),(32,176)]),1e-12)) f2.setArray(arr) f*=f2 - f.checkCoherency() + f.checkConsistencyLight() self.assertTrue(f.getArray().isEqual(DataArrayDouble([(0,0),(2,64),(16,288),(54,720),(128,1408)]),1e-12)) f*=[0.1,0.2] - f.checkCoherency() + f.checkConsistencyLight() self.assertTrue(f.getArray().isEqual(DataArrayDouble([(0,0),(0.2,12.8),(1.6,57.6),(5.4,144),(12.8,281.6)]),1e-12)) ## MEDCouplingFieldDouble.__idiv__ m=MEDCouplingDataForTest.build2DTargetMesh_1() @@ -3443,19 +3443,19 @@ class MEDCouplingBasicsTest4(unittest.TestCase): self.assertRaises(InterpKernelException,f.__idiv__,f2) f.getArray().alloc(5,2) f.getArray()[:,0]=range(5) ; f.getArray()[:,1]=f.getArray()[:,0]+7 - f.checkCoherency() + f.checkConsistencyLight() f/=2 - f.checkCoherency() + f.checkConsistencyLight() self.assertTrue(f.getArray().isEqual(DataArrayDouble([(0,3.5),(0.5,4),(1,4.5),(1.5,5),(2,5.5)]),1e-12)) f/=arr - f.checkCoherency() + f.checkConsistencyLight() self.assertTrue(f.getArray().isEqual(DataArrayDouble([(0,1.75),(0.25,1),(0.3333333333333333,0.75),(0.375,0.625),(0.4,0.55)]),1e-12)) f2.setArray(arr) f/=f2 - f.checkCoherency() + f.checkConsistencyLight() self.assertTrue(f.getArray().isEqual(DataArrayDouble([(0,0.875),(0.125,0.25),(0.1111111111111111,0.125),(0.09375,0.078125),(0.08,0.055)]),1e-12)) f/=[0.1,0.2] - f.checkCoherency() + f.checkConsistencyLight() self.assertTrue(f.getArray().isEqual(DataArrayDouble([(0,4.375),(1.25,1.25),(1.1111111111111111,0.625),(0.9375,0.390625),(0.8,0.275)]),1e-12)) ## MEDCouplingFieldDouble.__ipow__ m=MEDCouplingDataForTest.build2DTargetMesh_1() @@ -3475,9 +3475,9 @@ class MEDCouplingBasicsTest4(unittest.TestCase): self.assertRaises(InterpKernelException,f.__ipow__,f2) f.getArray().alloc(5,2) f.getArray()[:,0]=range(5) ; f.getArray()[:,1]=f.getArray()[:,0]+7 - f.checkCoherency() + f.checkConsistencyLight() f**=2 - f.checkCoherency() + f.checkConsistencyLight() self.assertTrue(f.getArray().isEqual(DataArrayDouble([(0,49),(1,64),(4,81),(9,100),(16,121)]),1e-12)) ## MEDCouplingFieldDouble.__radd__ m=MEDCouplingDataForTest.build2DTargetMesh_1() @@ -3499,10 +3499,10 @@ class MEDCouplingBasicsTest4(unittest.TestCase): f.getArray().alloc(5,2) f.getArray()[:,0]=range(5) ; f.getArray()[:,1]=f.getArray()[:,0]+7 ff=2+f - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(2,9),(3,10),(4,11),(5,12),(6,13)]),1e-12)) ff=arr+f - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(0,7),(2,10),(4,13),(6,16),(8,19)]),1e-12)) self.assertRaises(InterpKernelException,f.__radd__,f2) ff=[5,8]+f @@ -3527,10 +3527,10 @@ class MEDCouplingBasicsTest4(unittest.TestCase): f.getArray().alloc(5,2) f.getArray()[:,0]=range(5) ; f.getArray()[:,1]=f.getArray()[:,0]+7 ff=2-f - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(2,-5),(1,-6),(0,-7),(-1,-8),(-2,-9)]),1e-12)) ff=arr-f - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(0,-7),(0,-6),(0,-5),(0,-4),(0,-3)]),1e-12)) self.assertRaises(InterpKernelException,f.__rsub__,f2) ### MEDCouplingFieldDouble.__rmul__ @@ -3553,10 +3553,10 @@ class MEDCouplingBasicsTest4(unittest.TestCase): f.getArray().alloc(5,2) f.getArray()[:,0]=range(5) ; f.getArray()[:,1]=f.getArray()[:,0]+7 ff=2*f - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(0,14),(2,16),(4,18),(6,20),(8,22)]),1e-12)) ff=arr*f - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(0,0),(1,16),(4,36),(9,60),(16,88)]),1e-12)) self.assertRaises(InterpKernelException,f.__rmul__,f2) ff=f*[5,8] @@ -3581,10 +3581,10 @@ class MEDCouplingBasicsTest4(unittest.TestCase): f.getArray().alloc(5,2) f.getArray()[:,0]=range(1,6) ; f.getArray()[:,1]=f.getArray()[:,0]+7 ff=2/f - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(2,0.25),(1,0.22222222222222221),(0.66666666666666663,0.20000000000000001),(0.5,0.18181818181818182),(0.40000000000000002,0.16666666666666666)]),1e-12)) ff=arr/f - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue(ff.getArray().isEqual(DataArrayDouble([(1,0.25),(1,0.44444444444444442),(1,0.59999999999999998),(1,0.72727272727272729),(1,0.83333333333333337)]),1e-12)) self.assertRaises(InterpKernelException,f.__rdiv__,f2) pass diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py index 6175c30b5..a91a165ac 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py @@ -33,9 +33,9 @@ class MEDCouplingBasicsTest5(unittest.TestCase): f.setMesh(m) arr=DataArrayDouble(5,2) ; arr[:,0]=range(7,12) ; arr[:,1]=100+arr[:,0] f.setArray(arr) - f.checkCoherency() + f.checkConsistencyLight() ff=f[1:-1:2] - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue((m.buildPartOfMySelf([1,3],True)).isEqual(ff.getMesh(),1e-12)) self.assertTrue(9,ff.getMesh().getNumberOfNodes()) self.assertTrue(2,ff.getMesh().getNumberOfCells()) @@ -45,14 +45,14 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertTrue(m.buildPartOfMySelf([2,3,4],True).isEqual(a,1e-12)) self.assertEqual(b,slice(2,5,1)) ff=f[2:] - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue((m.buildPartOfMySelf([2,3,4],True)).isEqual(ff.getMesh(),1e-12)) self.assertTrue(9,ff.getMesh().getNumberOfNodes()) self.assertTrue(3,ff.getMesh().getNumberOfCells()) self.assertTrue(ff.getArray().isEqual(arr[[2,3,4]],1e-12)) # ff=f[-2:0:-1] - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue((m.buildPartOfMySelf([3,2,1],True)).isEqual(ff.getMesh(),1e-12)) self.assertTrue(9,ff.getMesh().getNumberOfNodes()) self.assertTrue(3,ff.getMesh().getNumberOfCells()) @@ -63,9 +63,9 @@ class MEDCouplingBasicsTest5(unittest.TestCase): f.setMesh(m) arr=DataArrayDouble(9,2) ; arr[:,0]=range(7,16) ; arr[:,1]=100+arr[:,0] f.setArray(arr) - f.checkCoherency() + f.checkConsistencyLight() ff=f[1:-1:2] - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue((m.buildPartOfMySelf([1,3],False)).isEqual(ff.getMesh(),1e-12)) self.assertTrue(6,ff.getMesh().getNumberOfNodes()) self.assertTrue(2,ff.getMesh().getNumberOfCells()) @@ -80,14 +80,14 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertTrue(m.buildPartOfMySelf([2,3,4],False).isEqual(a,1e-12)) self.assertTrue(b.isEqual(DataArrayInt([2,3,4,5,6,7,8]))) ff=f[2:] - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue((m.buildPartOfMySelf([2,3,4],False)).isEqual(ff.getMesh(),1e-12)) self.assertTrue(7,ff.getMesh().getNumberOfNodes()) self.assertTrue(3,ff.getMesh().getNumberOfCells()) self.assertTrue(ff.getArray().isEqual(arr[[2,3,4,5,6,7,8]],1e-12)) # ff=f[-2:0:-1] - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue((m.buildPartOfMySelf([3,2,1],False)).isEqual(ff.getMesh(),1e-12)) self.assertTrue(7,ff.getMesh().getNumberOfNodes()) self.assertTrue(3,ff.getMesh().getNumberOfCells()) @@ -98,9 +98,9 @@ class MEDCouplingBasicsTest5(unittest.TestCase): f.setMesh(m) arr=DataArrayDouble(18,2) ; arr[:,0]=range(7,25) ; arr[:,1]=100+arr[:,0] f.setArray(arr) - f.checkCoherency() + f.checkConsistencyLight() ff=f[1:-1:2] - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue((m.buildPartOfMySelf([1,3],True)).isEqual(ff.getMesh(),1e-12)) self.assertTrue(9,ff.getMesh().getNumberOfNodes()) self.assertTrue(2,ff.getMesh().getNumberOfCells()) @@ -110,14 +110,14 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertTrue(m.buildPartOfMySelf([2,3,4],True).isEqual(a,1e-12)) self.assertEqual(b,slice(7,18,1)) ff=f[2:] - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue((m.buildPartOfMySelf([2,3,4],True)).isEqual(ff.getMesh(),1e-12)) self.assertTrue(9,ff.getMesh().getNumberOfNodes()) self.assertTrue(3,ff.getMesh().getNumberOfCells()) self.assertTrue(ff.getArray().isEqual(arr[[7,8,9,10,11,12,13,14,15,16,17]],1e-12)) # ff=f[-2:0:-1] - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue((m.buildPartOfMySelf([3,2,1],True)).isEqual(ff.getMesh(),1e-12)) self.assertTrue(9,ff.getMesh().getNumberOfNodes()) self.assertTrue(3,ff.getMesh().getNumberOfCells()) @@ -132,9 +132,9 @@ class MEDCouplingBasicsTest5(unittest.TestCase): f.setGaussLocalizationOnCells([2],[0,0,1,0,1,0],[1.1,1.1,2.2,2.2,3.,3.,4.,4.,5.,5.],[0.1,0.1,0.4,0.3,0.1]); arr=DataArrayDouble(16,2) ; arr[:,0]=range(7,23) ; arr[:,1]=100+arr[:,0] f.setArray(arr) - f.checkCoherency() + f.checkConsistencyLight() ff=f[1:-1:2] - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue((m.buildPartOfMySelf([1,3],True)).isEqual(ff.getMesh(),1e-12)) self.assertTrue(9,ff.getMesh().getNumberOfNodes()) self.assertTrue(2,ff.getMesh().getNumberOfCells()) @@ -144,14 +144,14 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertTrue(m.buildPartOfMySelf([2,3,4],True).isEqual(a,1e-12)) self.assertEqual(b,slice(6,16,1)) ff=f[2:] - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue((m.buildPartOfMySelf([2,3,4],True)).isEqual(ff.getMesh(),1e-12)) self.assertTrue(9,ff.getMesh().getNumberOfNodes()) self.assertTrue(3,ff.getMesh().getNumberOfCells()) self.assertTrue(ff.getArray().isEqual(arr[[6,7,8,9,10,11,12,13,14,15]],1e-12)) # ff=f[-2:0:-1] - ff.checkCoherency() + ff.checkConsistencyLight() self.assertTrue((m.buildPartOfMySelf([3,2,1],True)).isEqual(ff.getMesh(),1e-12)) self.assertTrue(9,ff.getMesh().getNumberOfNodes()) self.assertTrue(3,ff.getMesh().getNumberOfCells()) @@ -163,19 +163,19 @@ class MEDCouplingBasicsTest5(unittest.TestCase): f=MEDCouplingFieldDouble(ON_CELLS) f.setMesh(MEDCouplingDataForTest.build2DTargetMesh_1()) f.applyFunc(3,700.) - f.checkCoherency() + f.checkConsistencyLight() self.assertEqual(3,f.getArray().getNumberOfComponents()) f.getArray().rearrange(1) self.assertTrue(f.getArray().isUniform(700.,1e-10)) f.getArray().rearrange(3) - f.checkCoherency() + f.checkConsistencyLight() f.applyFunc(4,800.) - f.checkCoherency() + f.checkConsistencyLight() self.assertEqual(4,f.getArray().getNumberOfComponents()) f.getArray().rearrange(1) self.assertTrue(f.getArray().isUniform(800.,1e-10)) f.getArray().rearrange(4) - f.checkCoherency() + f.checkConsistencyLight() pass def testSwig2ComputeTupleIdsNearTupleBug1(self): @@ -203,11 +203,11 @@ class MEDCouplingBasicsTest5(unittest.TestCase): mesh1.allocateCells(0); mesh1.finishInsertingCells(); # mesh 2 - mesh2=mesh1.deepCpy(); + mesh2=mesh1.deepCopy(); coordsArr=DataArrayDouble.New(coords2,4,1); mesh2.setCoords(coordsArr); field = mesh1.fillFromAnalytic(ON_NODES,1,"x") - field.checkCoherency() + field.checkConsistencyLight() levOfCheck = 10 field.changeUnderlyingMesh( mesh2, levOfCheck, 1e-13, 0 ) self.assertTrue( field.getArray().getValues() == coords2 ) @@ -261,7 +261,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): for i in xrange(24): m.insertNextCell(NORM_QUAD4,conn[4*i:4*i+4]) pass - m.checkCoherency1() + m.checkConsistency() m0=m[3] ; m0.zipCoords() expectedDist=0.8452994616207476 a,b=m0.distanceToPoint(pt) @@ -289,15 +289,15 @@ class MEDCouplingBasicsTest5(unittest.TestCase): d=d.fromPolarToCart() d+=zeBary m=MEDCouplingUMesh("quad8",2) ; m.allocateCells() ; m.insertNextCell(NORM_QUAD8,range(8)) ; m.setCoords(d) - self.assertTrue(m.getBarycenterAndOwner().isEqual(DataArrayDouble(zeBary,1,2),1e-13)) + self.assertTrue(m.computeCellCenterOfMass().isEqual(DataArrayDouble(zeBary,1,2),1e-13)) self.assertAlmostEqual(float(m.getMeasureField(False).getArray()),pi*zeRadius*zeRadius,12) tri32D=m.buildDescendingConnectivity()[0][0] ; tri32D.zipCoords() # spaceDim=3 QUAD8 becomes QUAD4 ... for the moment m.setCoords(m.getCoords().changeNbOfComponents(3,0.)) - m2=m.deepCpy() + m2=m.deepCopy() m2.convertQuadraticCellsToLinear() self.assertAlmostEqual(float(m.getMeasureField(False).getArray()),float(m2.getMeasureField(False).getArray()),12) - self.assertTrue(m.getBarycenterAndOwner().isEqual(m2.getBarycenterAndOwner(),1e-13)) + self.assertTrue(m.computeCellCenterOfMass().isEqual(m2.computeCellCenterOfMass(),1e-13)) #TRI6 representing a circle of center zeBary and radius zeRadius zeBary=[5,6] zeRadius=3 @@ -308,14 +308,14 @@ class MEDCouplingBasicsTest5(unittest.TestCase): d=d.fromPolarToCart() d+=zeBary m=MEDCouplingUMesh("tri6",2) ; m.allocateCells() ; m.insertNextCell(NORM_TRI6,range(6)) ; m.setCoords(d) - self.assertTrue(m.getBarycenterAndOwner().isEqual(DataArrayDouble(zeBary,1,2),1e-13)) + self.assertTrue(m.computeCellCenterOfMass().isEqual(DataArrayDouble(zeBary,1,2),1e-13)) self.assertAlmostEqual(float(m.getMeasureField(False).getArray()),pi*zeRadius*zeRadius,12) # spaceDim=3 TRI6 becomes TRI3 ... for the moment m.setCoords(m.getCoords().changeNbOfComponents(3,0.)) - m2=m.deepCpy() + m2=m.deepCopy() m2.convertQuadraticCellsToLinear() self.assertAlmostEqual(float(m.getMeasureField(False).getArray()),float(m2.getMeasureField(False).getArray()),12) - self.assertTrue(m.getBarycenterAndOwner().isEqual(m2.getBarycenterAndOwner(),1e-13)) + self.assertTrue(m.computeCellCenterOfMass().isEqual(m2.computeCellCenterOfMass(),1e-13)) # QPOLYG representing a circle of center zeBary and radius zeRadius zeBary=[5,6] zeRadius=3 @@ -326,24 +326,24 @@ class MEDCouplingBasicsTest5(unittest.TestCase): d=d.fromPolarToCart() d+=zeBary m=MEDCouplingUMesh("qpolyg",2) ; m.allocateCells() ; m.insertNextCell(NORM_QPOLYG,range(10)) ; m.setCoords(d) - self.assertTrue(m.getBarycenterAndOwner().isEqual(DataArrayDouble(zeBary,1,2),1e-13)) + self.assertTrue(m.computeCellCenterOfMass().isEqual(DataArrayDouble(zeBary,1,2),1e-13)) self.assertAlmostEqual(float(m.getMeasureField(False).getArray()),pi*zeRadius*zeRadius,12) # spaceDim=3 QPOLYG becomes POLYG ... for the moment m.setCoords(m.getCoords().changeNbOfComponents(3,0.)) - m2=m.deepCpy() - m2.convertQuadraticCellsToLinear() ; m2.checkCoherency1() + m2=m.deepCopy() + m2.convertQuadraticCellsToLinear() ; m2.checkConsistency() self.assertTrue(m2.getAllGeoTypes()==[NORM_POLYGON] and m2.getNodalConnectivity().getValues()==[5,0,1,2,3,4]) self.assertAlmostEqual(float(m.getMeasureField(False).getArray()),float(m2.getMeasureField(False).getArray()),12) - self.assertTrue(m.getBarycenterAndOwner().isEqual(m2.getBarycenterAndOwner(),1e-13)) + self.assertTrue(m.computeCellCenterOfMass().isEqual(m2.computeCellCenterOfMass(),1e-13)) # TRI3 self.assertAlmostEqual(float(tri32D.getMeasureField(False).getArray()),(87+100)*pi/180*zeRadius,13) exp=DataArrayDouble(1,2) ; exp[:,0]=3 ; exp[:,1]=(87-100)/2. ; exp[:,1]*=pi/180. ; exp=exp.fromPolarToCart() ; exp+=DataArrayDouble([5,6],1,2) - self.assertTrue(tri32D.getBarycenterAndOwner().isEqual(exp,1e-12)) + self.assertTrue(tri32D.computeCellCenterOfMass().isEqual(exp,1e-12)) # spaceDim=3 TRI3 becomes TRI2 ... for the moment tri32D.changeSpaceDimension(3) - tri2=tri32D.deepCpy() ; tri2.convertQuadraticCellsToLinear() + tri2=tri32D.deepCopy() ; tri2.convertQuadraticCellsToLinear() self.assertAlmostEqual(float(tri32D.getMeasureField(False).getArray()),float(tri2.getMeasureField(False).getArray()),13) - self.assertTrue(tri32D.getBarycenterAndOwner().isEqual(tri2.getBarycenterAndOwner(),1e-12)) + self.assertTrue(tri32D.computeCellCenterOfMass().isEqual(tri2.computeCellCenterOfMass(),1e-12)) tri32D.changeSpaceDimension(1) self.assertAlmostEqual(float(tri32D.getMeasureField(False).getArray()),-0.67795240172962323,12) pass @@ -355,7 +355,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): dataArray[:]=0. dataArray[0]=[0.,1,3] m.setCoords(dataArray[0]) - m1=m.deepCpy() + m1=m.deepCopy() m.rotate([0.,0.,3.],[1.,0.,0.],0.5*pi) self.assertTrue(m.getCoords().isEqual(DataArrayDouble([0.,0.,4.],1,3),1e-15)) # @@ -364,7 +364,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): vec=[[1.,0.,0.],[(1.,0.,0.)],DataArrayDouble([1.,0.,0.],1,3),list(d2)[0]] for p in pts: for v in vec: - m2=m1.deepCpy() + m2=m1.deepCopy() m2.rotate(p,v,0.5*pi) self.assertTrue(m2.getCoords().isEqual(DataArrayDouble([0.,0.,4.],1,3),1e-15)) pass @@ -521,13 +521,13 @@ class MEDCouplingBasicsTest5(unittest.TestCase): f=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) ; f.setMesh(m) f.fillFromAnalytic(1,formula) f.setName("Field1") ; f.setTime(1.1,1,-1) - f.checkCoherency() + f.checkConsistencyLight() # arr=f.getArray() arr2=DataArrayDouble(len(arr),2) ; arr2[:,0]=arr arr2=DataArrayDouble(len(arr),2) ; arr2[:,0]=arr ; arr2[:,1]=2*arr f.setArray(arr2) - f.checkCoherency() + f.checkConsistencyLight() # here the compact code to obviously put field on cell to nodes rn,rni=f.getMesh().getReverseNodalConnectivity() arr2=f.getArray()[rn] @@ -538,7 +538,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): maxNbCSN=nbOfCellsSharingNodes.getMaxValue()[0] arr3=DataArrayDouble(f.getMesh().getNumberOfNodes(),f.getArray().getNumberOfComponents()) ; arr3[:]=0. for i in xrange(1,maxNbCSN+1): - ids=nbOfCellsSharingNodes.getIdsEqual(i) + ids=nbOfCellsSharingNodes.findIdsEqual(i) if len(ids)==0: continue for j in range(i): @@ -549,7 +549,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): pass fNode=MEDCouplingFieldDouble(ON_NODES,ONE_TIME) ; fNode.setMesh(m) fNode.setName("Field1Node") ; fNode.setTime(1.1,1,-1) - fNode.setArray(arr3) ; fNode.checkCoherency() + fNode.setArray(arr3) ; fNode.checkConsistencyLight() self.assertTrue(arr3.isEqual(arr4,1e-12)) # d=DataArrayInt.Range(0,20,1) @@ -560,10 +560,10 @@ class MEDCouplingBasicsTest5(unittest.TestCase): ids=DataArrayInt([]) self.assertEqual(len(a[ids]),0) self.assertEqual(len(b[ids]),0) - a2=a.deepCpy() ; a2[ids]+=b[ids] ; self.assertTrue(a2.isEqual(a,1e-15)) - a2=a.deepCpy() ; a2[ids]*=b[ids] ; self.assertTrue(a2.isEqual(a,1e-15)) - a2=a.deepCpy() ; a2[ids]/=b[ids] ; self.assertTrue(a2.isEqual(a,1e-15)) - a2=a.deepCpy() ; a2[ids]-=b[ids] ; self.assertTrue(a2.isEqual(a,1e-15)) + a2=a.deepCopy() ; a2[ids]+=b[ids] ; self.assertTrue(a2.isEqual(a,1e-15)) + a2=a.deepCopy() ; a2[ids]*=b[ids] ; self.assertTrue(a2.isEqual(a,1e-15)) + a2=a.deepCopy() ; a2[ids]/=b[ids] ; self.assertTrue(a2.isEqual(a,1e-15)) + a2=a.deepCopy() ; a2[ids]-=b[ids] ; self.assertTrue(a2.isEqual(a,1e-15)) pass def testSwig2CheckAndPreparePermutation1(self): @@ -590,8 +590,8 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertTrue(DataArrayInt([6]).isEqual(m.computeNbOfNodesPerCell())) self.assertTrue(DataArrayInt([5]).isEqual(m.computeNbOfFacesPerCell())) m.__repr__() ; m.__str__() - m.checkCoherency() - m.checkCoherency1() + m.checkConsistencyLight() + m.checkConsistency() # cm=MEDCouplingCMesh() ; cm.setName("m") arr0=DataArrayDouble(6) ; arr0.iota() @@ -641,7 +641,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): m1c=m1.convertIntoSingleGeoTypeMesh() self.assertTrue(isinstance(m1c,MEDCoupling1SGTUMesh)) self.assertEqual(m1c.getCoords().getHiddenCppPointer(),m.getCoords().getHiddenCppPointer()) - m1c.checkCoherency1() + m1c.checkConsistency() self.assertTrue(m1c.getNodalConnectivity().isEqual(DataArrayInt([1,0,6,7,2,1,7,8,3,2,8,9,4,3,9,10,5,4,10,11]))) self.assertEqual(20,m1c.getNodalConnectivityLength()) self.assertTrue(m.isEqual(m1c,1e-12)) @@ -649,7 +649,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertTrue(not m.isEqual(m1c,1e-12)) m.getNodalConnectivity().setIJ(1,0,0) self.assertTrue(m.isEqual(m1c,1e-12)) - m1c.setCoords(m.getCoords().deepCpy()) + m1c.setCoords(m.getCoords().deepCopy()) self.assertTrue(m.isEqual(m1c,1e-12)) m1c.getCoords().setIJ(0,1,0.1) self.assertTrue(not m.isEqual(m1c,1e-12)) @@ -662,7 +662,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): m.setName("m2") self.assertTrue(not m.isEqual(m1c,1e-12) and m.isEqualWithoutConsideringStr(m1c,1e-12)) # - m.checkCoherency() ; m.checkCoherency1() ; m.checkCoherency1() + m.checkConsistencyLight() ; m.checkConsistency() ; m.checkConsistency() self.assertEqual(m.getMeshDimension(),2) self.assertTrue(m.giveCellsWithType(NORM_QUAD4).isEqual(DataArrayInt([0,1,2,3,4]))) self.assertTrue(m.giveCellsWithType(NORM_TRI3).isEqual(DataArrayInt([]))) @@ -721,8 +721,8 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertTrue(m.computeIsoBarycenterOfNodesPerCell().isEqual(DataArrayDouble([(0.5,0.5,0),(1.5,0.5,0),(2.5,0.5,0),(3.5,0.5,0),(4.5,0.5,0)]),1e-13)) ## ref=m.getCoords().getHiddenCppPointer() - mcpy=m.deepCpy() ; mcpy.insertNextCell([1,0,6,7]) - c=m.getNodalConnectivity().deepCpy() + mcpy=m.deepCopy() ; mcpy.insertNextCell([1,0,6,7]) + c=m.getNodalConnectivity().deepCopy() o2n=DataArrayInt([2,0,1,4,3]) m.renumberCells(o2n,False) c.rearrange(4) ; c.renumberInPlace(o2n) ; c.rearrange(1) @@ -736,7 +736,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertTrue(m2.getNodalConnectivity().isEqual(DataArrayInt([1,0,6,7,2,1,7,8,3,2,8,9,4,3,9,10,5,4,10,11,1,0,6,7,26,25,31,32,27,26,32,33,25,24,30,31,29,28,34,35,28,27,33,34]))) ## mu=m.buildUnstructured() - mu.checkCoherency1() + mu.checkConsistency() self.assertEqual(mu.getCoords().getHiddenCppPointer(),m.getCoords().getHiddenCppPointer()) self.assertEqual(2,mu.getMeshDimension()) self.assertEqual([NORM_QUAD4],mu.getAllGeoTypes()) @@ -744,7 +744,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertTrue(mu.getNodalConnectivityIndex().isEqual(DataArrayInt([0,5,10,15,20,25]))) ## for typ in [0,1]: - mcpy2=m.deepCpy() ; umcpy2=mcpy2.buildUnstructured() + mcpy2=m.deepCopy() ; umcpy2=mcpy2.buildUnstructured() ids=mcpy2.simplexize(typ) ; ids2=umcpy2.simplexize(typ) self.assertTrue(ids.isEqual(ids2)) mcpy3=umcpy2.convertIntoSingleGeoTypeMesh() @@ -753,7 +753,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): um1=um.convertIntoSingleGeoTypeMesh() self.assertEqual(8,um1.getNumberOfNodesPerCell()) for typ in [PLANAR_FACE_5,PLANAR_FACE_6]: - mcpy2=um1.deepCpy() ; umcpy2=mcpy2.buildUnstructured() + mcpy2=um1.deepCopy() ; umcpy2=mcpy2.buildUnstructured() ids=mcpy2.simplexize(typ) ; ids2=umcpy2.simplexize(typ) self.assertTrue(ids.isEqual(ids2)) mcpy3=umcpy2.convertIntoSingleGeoTypeMesh() @@ -769,12 +769,12 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertEqual(m3.getCoords().getHiddenCppPointer(),mcpy.getCoords().getHiddenCppPointer()) self.assertTrue(m3.getNodalConnectivity().isEqual(DataArrayInt([1,0,6,7,2,1,7,8,3,2,8,9,4,3,9,10,5,4,10,11,1,0,6,7,2,1,7,8,3,2,8,9,1,0,6,7,5,4,10,11,4,3,9,10]))) ## - ref=mcpy.getCoords().deepCpy() + ref=mcpy.getCoords().deepCopy() c3=mcpy.getNodalConnectivity()[:] - mcpy.getNodalConnectivity().setIJ(int(c3.getIdsEqual(11)),0,24) + mcpy.getNodalConnectivity().setIJ(int(c3.findIdsEqual(11)),0,24) c2=DataArrayDouble.Aggregate([mcpy.getCoords(),mcpy.getCoords()[11:]]) mcpy.setCoords(c2) - mcpy.checkCoherency1() + mcpy.checkConsistency() a,b=mcpy.getNodeIdsInUse() self.assertEqual(12,b) self.assertTrue(a.isEqual(DataArrayInt([0,1,2,3,4,5,6,7,8,9,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]))) @@ -782,7 +782,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertTrue(ids.isEqual(DataArrayInt([0,1,2,3,4,5,6,7,8,9,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]))) self.assertTrue(mcpy.getCoords().isEqual(ref[:12],1e-12)) self.assertTrue(mcpy.getNodalConnectivity().isEqual(c3)) - mcpy.checkCoherency1() + mcpy.checkConsistency() ## m4=mcpy[DataArrayInt([0,3,4])] m5=mcpy.buildPartOfMySelfKeepCoords(DataArrayInt([0,3,4])) @@ -794,9 +794,9 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertTrue(m6.getNodalConnectivity().isEqual(DataArrayInt([1,0,6,7,3,2,8,9,5,4,10,11]))) ## mcpy.setCoords(DataArrayDouble.Aggregate([mcpy.getCoords(),mcpy.getCoords()])) - mcpy.checkCoherency1() + mcpy.checkConsistency() ## - mcppy=mcpy.deepCpyConnectivityOnly() + mcppy=mcpy.deepCopyConnectivityOnly() self.assertTrue(mcppy.isEqual(mcpy,1e-12)) self.assertTrue(mcppy.getCoords().getHiddenCppPointer()==mcpy.getCoords().getHiddenCppPointer()) self.assertTrue(mcppy.getNodalConnectivity().isEqual(mcpy.getNodalConnectivity())) @@ -816,7 +816,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): ## self.assertTrue(mcpy.fillCellIdsToKeepFromNodeIds(DataArrayInt([6,7]),False).isEqual(DataArrayInt([0,1,5]))) ## - mcpy2=mcpy.deepCpy() + mcpy2=mcpy.deepCopy() self.assertEqual([None,None],mcpy.checkGeoEquivalWith(mcpy2,1,1e-12))#fast equal mcpy.checkFastEquivalWith(mcpy2,1e-12) mcpy2.renumberCells([0,2,4,3,1,5]) @@ -836,7 +836,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertEqual(a1[3:].front(),11) self.assertEqual(a1[4:].convertToDblArr().front(),14.) a1c=DataArrayInt([5,7,1,2, 8,11,0, 5,6,3,12, 1,5,2, 13,12,11,7, 6,1,0, 20,21,19,17]) - d,e=MEDCouplingUMesh.ExtractFromIndexedArrays2(1,5,2,a1c,a1) + d,e=MEDCouplingUMesh.ExtractFromIndexedArraysSlice(1,5,2,a1c,a1) self.assertTrue(d.isEqual(DataArrayInt([8,11,0,1,5,2]))) self.assertTrue(e.isEqual(DataArrayInt([0,3,6]))) # @@ -859,14 +859,14 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertTrue(DataArrayInt([8]).isEqual(m.computeNbOfNodesPerCell())) self.assertTrue(DataArrayInt([2]).isEqual(m.computeNbOfFacesPerCell())) m.__repr__() ; m.__str__() - m.checkCoherency() - m.checkCoherency1() + m.checkConsistencyLight() + m.checkConsistency() # cm=MEDCouplingCMesh() ; cm.setName("m") arr0=DataArrayDouble(6) ; arr0.iota() arr1=DataArrayDouble([0,1]) cm.setCoords(arr0,arr1,arr1) ; um=cm.buildUnstructured() ; um.convertAllToPoly() - um2=um.deepCpyConnectivityOnly() + um2=um.deepCopyConnectivityOnly() self.assertTrue(um2.isEqual(um,1e-12)) self.assertEqual(um2.getCoords().getHiddenCppPointer(),um.getCoords().getHiddenCppPointer()) self.assertTrue(um2.getNodalConnectivity().isEqual(um.getNodalConnectivity())) @@ -886,13 +886,13 @@ class MEDCouplingBasicsTest5(unittest.TestCase): m.insertNextCell([3,2,8,9]) m.insertNextCell([4,3,9,10,-1,5,3,9]) m.insertNextCell([5,4,10,11,-1,11,10,-1,5]) - m.checkCoherency() - m.checkCoherency1() + m.checkConsistencyLight() + m.checkConsistency() self.assertEqual(5,m.getNumberOfCells()) self.assertTrue(m.getNodalConnectivityIndex().isEqual(DataArrayInt([0,8,19,23,31,40]))) self.assertTrue(m.getNodalConnectivity().isEqual(DataArrayInt([1,0,6,7,-1,7,6,1,2,1,7,8,-1,2,1,-1,8,-1,7,3,2,8,9,4,3,9,10,-1,5,3,9,5,4,10,11,-1,11,10,-1,5]))) # - m4=m.deepCpy() + m4=m.deepCopy() self.assertTrue(m.isEqual(m4,1e-12)) m4.getNodalConnectivity().setIJ(2,0,5) self.assertTrue(not m.isEqual(m4,1e-12)) @@ -924,8 +924,8 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertTrue(DataArrayDouble([(0.5714285714285714,0.5714285714285714,0),(1.5,0.5,0),(2.5,0.5,0),(3.5714285714285712,0.42857142857142855,0),(4.5714285714285712,0.5714285714285714,0)]).isEqual(f,1e-14)) mu0=m.buildUnstructured() o2n=[1,2,0,4,3] - m2=m.deepCpy() - m3=m.deepCpyConnectivityOnly() + m2=m.deepCopy() + m3=m.deepCopyConnectivityOnly() self.assertTrue(m3.isEqual(m,1e-12)) self.assertEqual(m3.getCoords().getHiddenCppPointer(),m.getCoords().getHiddenCppPointer()) self.assertTrue(m3.getNodalConnectivity().getHiddenCppPointer()!=m.getNodalConnectivity().getHiddenCppPointer()) @@ -943,8 +943,8 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertTrue(mcpy0.getNodalConnectivity().isEqual(DataArrayInt([31,3,2,8,9,31,1,0,6,7,-1,7,6,1,31,2,1,7,8,-1,2,1,-1,8,-1,7,31,5,4,10,11,-1,11,10,-1,5,31,4,3,9,10,-1,5,3,9]))) self.assertTrue(mcpy0.getNodalConnectivityIndex().isEqual(DataArrayInt([0,5,14,26,36,45]))) self.assertEqual(mcpy0.getAllGeoTypes(),[NORM_POLYHED]) - mcpy0.checkCoherency() - mcpy0.checkCoherency1() + mcpy0.checkConsistencyLight() + mcpy0.checkConsistency() mcpy1=mcpy0.convertIntoSingleGeoTypeMesh() self.assertTrue(mcpy1.isEqual(m,1e-12)) # @@ -963,11 +963,11 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertTrue(m_mrg2.isPacked()) self.assertEqual(120,m_mrg2.getNodalConnectivityIndex().popBackSilent()) self.assertEqual(m_mrg2.getNumberOfCells(),14) - m_mrg2.checkCoherency1() + m_mrg2.checkConsistency() self.assertTrue(not m_mrg2.isPacked()) m_mrg4,b=m_mrg2.copyWithNodalConnectivityPacked() self.assertTrue(not b) - m_mrg4.checkCoherency1() + m_mrg4.checkConsistency() self.assertEqual(m_mrg4.getNumberOfCells(),14) self.assertTrue(m_mrg4.getNodalConnectivityIndex().isEqual(m_mrg2.getNodalConnectivityIndex())) self.assertEqual(len(m_mrg4.getNodalConnectivity()),111) @@ -1073,13 +1073,13 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertEqual(27,c.getNumberOfCells()) self.assertEqual(40,c.getNumberOfNodes()) self.assertEqual(2,c.getMeshDimension()) - c.checkCoherency() + c.checkConsistencyLight() # arr2=MEDCouplingStructuredMesh.BuildExplicitIdsFrom([9,3],[(1,5),(0,3)]) self.assertTrue(arr2.isEqual(DataArrayInt([1,2,3,4,10,11,12,13,19,20,21,22]))) # CMesh c2=c.buildStructuredSubPart([(1,5),(0,3)]) - c2.checkCoherency() + c2.checkConsistencyLight() self.assertTrue(isinstance(c2,MEDCouplingCMesh)) self.assertEqual(12,c2.getNumberOfCells()) self.assertEqual(20,c2.getNumberOfNodes()) @@ -1089,7 +1089,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertTrue(c2.getCoordsAt(1).isEqual(DataArrayDouble([3.,4.,5.,6.]),1e-12)) # a,b=c.buildPartAndReduceNodes(d20) - a.checkCoherency() + a.checkConsistencyLight() exp2=DataArrayInt([-1,0,1,2,3,4,-1,-1,-1,-1,-1,5,6,7,8,9,-1,-1,-1,-1,-1,10,11,12,13,14,-1,-1,-1,-1,-1,15,16,17,18,19,-1,-1,-1,-1]) self.assertTrue(exp2.isEqual(b)) self.assertTrue(isinstance(a,MEDCouplingCMesh)) @@ -1098,9 +1098,9 @@ class MEDCouplingBasicsTest5(unittest.TestCase): c2=MEDCouplingCurveLinearMesh() ; c2.setName("toto") c2.setCoords(c.buildUnstructured().getCoords()) c2.setNodeGridStructure([10,4]) - c2.checkCoherency() + c2.checkConsistencyLight() a,b=c2.buildPartAndReduceNodes(d20) - a.checkCoherency() + a.checkConsistencyLight() self.assertTrue(exp2.isEqual(b)) self.assertTrue(isinstance(a,MEDCouplingCurveLinearMesh)) self.assertTrue(a.buildUnstructured().isEqual(c2.buildUnstructured().buildPartAndReduceNodes(d20)[0],1e-12)) @@ -1215,7 +1215,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertTrue(m12.isEqual(m11,1e-12)) m12.setCoords(m0.getCoords()) # m12 is not OK geometrically but the aim of the test is only connectivity values m3=MEDCoupling1GTUMesh.AggregateOnSameCoordsToUMesh([m12,m0]) - m3.checkCoherency() + m3.checkConsistencyLight() self.assertEqual(m3.getCoords().getHiddenCppPointer(),m12.getCoords().getHiddenCppPointer()) self.assertTrue(m3.getNodalConnectivity().isEqual(DataArrayInt([18,1,0,3,4,10,9,12,13,18,2,1,4,5,11,10,13,14,18,4,3,6,7,13,12,15,16,18,5,4,7,8,14,13,16,17,18,10,9,12,13,19,18,21,22,18,11,10,13,14,20,19,22,23,18,13,12,15,16,22,21,24,25,18,14,13,16,17,23,22,25,26,31,0,1,3,4,2,-1,1,5,6,7,0,-1,0,7,8,10,11,9,2,-1,1,5,12,14,15,13,3,-1,16,9,2,4,17,-1,4,3,13,18,17,-1,5,6,19,21,20,12,-1,6,7,8,23,22,19,-1,23,24,10,8,-1,25,11,9,16,-1,24,26,25,11,10,-1,12,14,20,-1,27,28,29,15,13,18,-1,14,15,29,30,21,20,-1,26,27,18,17,16,25,-1,22,19,21,30,31,-1,22,31,28,27,26,24,23,-1,31,30,29,28,31,0,7,8,10,11,9,2,-1,32,0,7,35,34,33,-1,32,0,2,37,36,-1,35,7,8,40,39,38,-1,2,37,41,9,-1,40,8,10,44,43,42,-1,41,9,11,44,43,-1,44,11,10,-1,32,33,45,47,46,36,-1,33,34,48,45,-1,35,34,48,50,49,38,-1,41,43,42,46,36,37,-1,38,39,51,49,-1,39,40,42,46,47,52,51,-1,45,47,52,50,48,-1,52,51,49,50,31,6,7,8,23,22,19,-1,6,35,7,-1,6,35,38,19,-1,35,7,8,40,39,38,-1,53,22,19,38,39,54,-1,23,53,54,40,8,-1,53,22,23,-1,39,54,40,31,35,34,48,50,49,38,-1,6,35,34,56,55,5,-1,6,35,38,19,-1,34,56,57,59,58,48,-1,60,61,21,19,38,49,-1,62,50,48,58,-1,60,63,64,62,50,49,-1,5,6,19,21,20,12,-1,55,5,12,65,-1,66,67,65,55,56,57,-1,63,66,57,59,64,-1,64,62,58,59,-1,60,63,66,67,68,61,-1,61,68,20,21,-1,67,68,20,12,65]))) self.assertTrue(m3.getNodalConnectivityIndex().isEqual(DataArrayInt([0,9,18,27,36,45,54,63,72,186,286,330,423]))) @@ -1231,7 +1231,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): m.insertNextCell(NORM_PENTA6,[1,2,0,4,5,3]) st=m.getCoords().getHiddenCppPointer() c,a,b=m.tetrahedrize(PLANAR_FACE_5) - c.checkCoherency1() + c.checkConsistency() self.assertTrue(a.isEqual(DataArrayInt([0,0,0]))) self.assertEqual(0,b) self.assertEqual(m.getCoords().getHiddenCppPointer(),c.getCoords().getHiddenCppPointer()) @@ -1244,7 +1244,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): m2.allocateCells() m2.insertNextCell(NORM_HEXGP12,[3,2,1,0,5,4,9,8,7,6,11,10]) c,a,b=m2.tetrahedrize(PLANAR_FACE_5) - c.checkCoherency1() + c.checkConsistency() self.assertTrue(a.isEqual(DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0]))) self.assertEqual(0,b) self.assertEqual(c.getCoords().getHiddenCppPointer(),coords.getHiddenCppPointer()) @@ -1258,7 +1258,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): m3.insertNextCell(NORM_HEXA8,[3,2,1,0,7,6,5,4]) st=m3.getCoords().getHiddenCppPointer() c,a,b=m3.tetrahedrize(PLANAR_FACE_5) - c.checkCoherency1() + c.checkConsistency() a.isEqual(DataArrayInt([0,0,0,0,0])) self.assertEqual(0,b) self.assertEqual(m3.getCoords().getHiddenCppPointer(),coords.getHiddenCppPointer()) @@ -1269,7 +1269,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): m4.allocateCells(0) m4.insertNextCell(NORM_HEXA8,[3,2,1,0,7,6,5,4]) c,a,b=m4.tetrahedrize(PLANAR_FACE_6) - c.checkCoherency1() + c.checkConsistency() a.isEqual(DataArrayInt([0,0,0,0,0,0])) self.assertEqual(0,b) self.assertEqual(c.getCoords().getHiddenCppPointer(),coords.getHiddenCppPointer()) @@ -1281,7 +1281,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): m4.insertNextCell(NORM_HEXA8,[3,2,1,0,7,6,5,4]) st=m4.getCoords().getHiddenCppPointer() c,a,b=m4.tetrahedrize(GENERAL_24) - c.checkCoherency1() + c.checkConsistency() a.isEqual(DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])) self.assertEqual(7,b) self.assertTrue(c.getCoords().getHiddenCppPointer()!=coords.getHiddenCppPointer()) @@ -1298,7 +1298,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): m6.insertNextCell(NORM_HEXA8,[3,2,1,0,7,6,5,4]) st=m6.getCoords().getHiddenCppPointer() c,a,b=m6.tetrahedrize(GENERAL_48) - c.checkCoherency1() + c.checkConsistency() a.isEqual(DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])) self.assertEqual(19,b) self.assertTrue(c.getCoords().getHiddenCppPointer()!=coords.getHiddenCppPointer()) @@ -1315,7 +1315,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): m7.allocateCells() m7.insertNextCell(NORM_POLYHED,[3,2,1,0,5,4,-1,9,10,11,6,7,8,-1,3,9,8,2,-1,2,8,7,1,-1,1,7,6,0,-1,0,6,11,5,-1,5,11,10,4,-1,4,10,9,3]) c,a,b=m7.tetrahedrize(PLANAR_FACE_5) - c.checkCoherency1() + c.checkConsistency() self.assertTrue(a.isEqual(DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]))) self.assertEqual(9,b) self.assertTrue(c.getNodalConnectivity().isEqual(DataArrayInt([3,2,12,20,2,1,12,20,1,0,12,20,0,5,12,20,5,4,12,20,4,3,12,20,9,10,13,20,10,11,13,20,11,6,13,20,6,7,13,20,7,8,13,20,8,9,13,20,3,9,14,20,9,8,14,20,8,2,14,20,2,3,14,20,2,8,15,20,8,7,15,20,7,1,15,20,1,2,15,20,1,7,16,20,7,6,16,20,6,0,16,20,0,1,16,20,0,6,17,20,6,11,17,20,11,5,17,20,5,0,17,20,5,11,18,20,11,10,18,20,10,4,18,20,4,5,18,20,4,10,19,20,10,9,19,20,9,3,19,20,3,4,19,20]))) @@ -1333,7 +1333,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): st=m8.getCoords().getHiddenCppPointer() c,a,b=m8.tetrahedrize(PLANAR_FACE_5) self.assertEqual(m8.getCoords().getHiddenCppPointer(),coords.getHiddenCppPointer()) - c.checkCoherency1() + c.checkConsistency() self.assertTrue(a.isEqual(DataArrayInt([0,0]))) self.assertEqual(0,b) self.assertTrue(c.getNodalConnectivity().isEqual(DataArrayInt([3,2,1,7,3,1,0,7]))) @@ -1397,7 +1397,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): mesh.setCoords(srcPointCoordsXY); f.setMesh(mesh); f.setArray(srcFieldValsOnPoints); - f.checkCoherency(); + f.checkConsistencyLight(); # res0=f.getValueOn([-0.5,-0.5]); self.assertAlmostEqual(targetFieldValsExpected.getIJ(0,0),res0[0],10) @@ -1425,7 +1425,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): srcFieldValsOnPoints2=DataArrayDouble(4,2) ; srcFieldValsOnPoints2[:,0]=srcFieldValsOnPoints[:4] ; srcFieldValsOnPoints2[:,1]=2*srcFieldValsOnPoints[:4] n0=srcFieldValsOnPoints2.toNumPyArray() ; n0=n0.reshape(4,2) ; n0=np.matrix(n0) # - f=MEDCouplingFieldDouble.New(ON_NODES_KR,ONE_TIME) ; f.setMesh(mesh) ; f.setArray(srcFieldValsOnPoints2) ; f.checkCoherency() + f=MEDCouplingFieldDouble.New(ON_NODES_KR,ONE_TIME) ; f.setMesh(mesh) ; f.setArray(srcFieldValsOnPoints2) ; f.checkConsistencyLight() self.assertTrue(DataArrayDouble(np.array((m0*n0))).isEqual(f.getValueOnMulti(pts3),1e-14)) pass # @@ -1450,7 +1450,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): def testSwig2MergeFieldsOnFieldsHavingNoMesh(self): a=DataArrayDouble(4) ; a.iota() ; a*=1.5 c=MEDCouplingCMesh() ; c.setCoords(a,a) ; f1=c.getMeasureField(False) - f1.setMesh(None) ; f2=f1.deepCpy() ; f2*=2 + f1.setMesh(None) ; f2=f1.deepCopy() ; f2*=2 f3=MEDCouplingFieldDouble.MergeFields(f1,f2) daExp=DataArrayDouble([2.25,2.25,2.25,2.25,2.25,2.25,2.25,2.25,2.25,4.5,4.5,4.5,4.5,4.5,4.5,4.5,4.5,4.5]) self.assertTrue(f3.getArray().isEqual(daExp,1e-12)) @@ -1514,7 +1514,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): m.changeSpaceDimension(3) m.orientCorrectly2DCells([0.,0.,-1.],False) # - m.checkCoherency() + m.checkConsistencyLight() self.assertTrue(m.getNodalConnectivity().isEqual(DataArrayInt([6,3,2,0,4,5,1, 32,3,2,0,4,5,1]))) self.assertTrue(m.getNodalConnectivityIndex().isEqual(DataArrayInt([0,7,14]))) m.changeSpaceDimension(2) @@ -1535,7 +1535,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): src.insertNextCell(NORM_HEXA8,[4,5,7,6,12,13,15,14]) src.insertNextCell(NORM_HEXA8,[8,9,12,11,16,17,20,19]) src.insertNextCell(NORM_HEXA8,[9,10,13,12,17,18,21,20]) - src.checkCoherency1() + src.checkConsistency() # trg is useless here but I keep it in case of MEDCouplingRemapper were expected to do something about warped NORM_HEXA8 trgCoo=DataArrayDouble([0.0960891897852753,0.105088620541845,6.8598,0.0599574480546212,0.118434267436059,6.8598,0.113514510609589,0.14874473653263,6.8598,0.0831322609794463,0.167319109733883,6.8598,0.0960891897852753,0.105088620541845,6.92146666666667,0.0599574480546212,0.118434267436059,6.92146666666667,0.113514510609589,0.14874473653263,6.92146666666667,0.0831322609794463,0.167319109733883,6.92146666666667],8,3) trg=MEDCouplingUMesh("MESH",3) ; trg.setCoords(trgCoo) @@ -1551,9 +1551,9 @@ class MEDCouplingBasicsTest5(unittest.TestCase): pts=lambd*eqFaces[:,:-1]+srcFace.getCoords()[conn[:,nodeIdInCell]]#pts represent the projection of the last points of each NORM_QUAD4 to the plane defined by the 3 first points of the NORM_QUAD4 cell shouldBeZero=(pts*eqFaces[:,:-1]).sumPerTuple()+eqFaces[:,3]# this line is useless only to be sure that pts are on the plane. check=(pts-srcFace.getCoords()[conn[:,nodeIdInCell]]).magnitude() # check contains the distance of the last point to its plane - idsToTest=check.getIdsNotInRange(0.,1e-10) + idsToTest=check.findIdsNotInRange(0.,1e-10) self.assertTrue(idsToTest.isEqual(DataArrayInt([17,18,19,20,22,23,24]))) - idsToTest2=idsToTest.getIdsNotInRange(18,22) + idsToTest2=idsToTest.findIdsNotInRange(18,22) self.assertTrue(idsToTest2.isEqual(DataArrayInt([0,4,5,6]))) idsToTest2.rearrange(2) self.assertTrue(idsToTest2.sumPerTuple().isEqual(DataArrayInt([4,11]))) @@ -1566,15 +1566,15 @@ class MEDCouplingBasicsTest5(unittest.TestCase): coords1=DataArrayDouble([(-0.5,0.5,-0.5),(0.5,-0.5,-0.5),(-0.5,-0.5,0.5),(-0.5,-0.5,-0.5),(0.5,-0.5,0.5),(-0.5,0.5,0.5),(0.5,0.5,0.5),(0.5,0.5,-0.5)]) m1=MEDCouplingUMesh("m1",3) ; m1.setCoords(coords1) m1.allocateCells() ; m1.insertNextCell(NORM_HEXA8,[7,1,3,0,6,4,2,5]) - m1.checkCoherency() + m1.checkConsistencyLight() # - m2=m1.deepCpy() ; m2.setName("m2") + m2=m1.deepCopy() ; m2.setName("m2") # trs=[[0.,0.,-1.],[0.,0.,1.],[1.,0.,0.],[0.,-1.,0.],[-1.,0.,0.],[0.,1.,0.]] for i,t in enumerate(trs): for j in xrange(64): j2=(j//16) ; j1=((j%16)//4) ; j0=(j%4) - m11=m1.deepCpy() + m11=m1.deepCopy() m11.rotate([0.,0.,0.],[0.,0.,1.],float(j0)*pi/2) m11.rotate([0.,0.,0.],[0.,1.,0.],float(j1)*pi/2) m11.rotate([0.,0.,0.],[1.,0.,0.],float(j2)*pi/2) @@ -1595,7 +1595,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): d=DataArrayDouble([4,-5,2,6.1,-7.33,1,-1,3e2,0.07,-0.009,-6,-1e30],4,3) d.setInfoOnComponents(["XX [m]","YYY [km]","ABSJJ [MW]"]) d0=d.computeAbs() - dExp=d.deepCpy() ; dExp.abs() + dExp=d.deepCopy() ; dExp.abs() self.assertTrue(dExp.isEqual(d0,1e-12)) e=d0-DataArrayDouble([4,5,2,6.1,7.33,1,1,3e2,0.07,0.009,6,1e30],4,3) self.assertAlmostEqual(0.,e.normMin(),13) @@ -1604,7 +1604,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): di=DataArrayInt([3,-12,5,6,14,16,-23,100,23,-1,0,-6],4,3) di.setInfoOnComponents(["XX [m]","YYY [km]","ABSJJ [MW]"]) d0i=di.computeAbs() - diExp=di.deepCpy() ; diExp.abs() + diExp=di.deepCopy() ; diExp.abs() self.assertTrue(diExp.isEqual(d0i)) self.assertEqual([3,12,5,6,14,16,23,100,23,1,0,6],d0i.getValues()) pass @@ -1614,7 +1614,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): m=MEDCouplingUMesh("Intersect2D",2) ; m.setCoords(coo) ; m.allocateCells() m.insertNextCell(NORM_POLYGON,[6,3,4,5]) m.insertNextCell(NORM_POLYGON,[4,0,1,2,6,5]) - m.checkCoherency1() + m.checkConsistency() # self.assertTrue(m.getCellsContainingPoint((0.4,-0.4),1e-12).isEqual(DataArrayInt([0]))) self.assertTrue(m.getCellsContainingPoint((-0.4,-0.4),1e-12).isEqual(DataArrayInt([1]))) @@ -1630,22 +1630,22 @@ class MEDCouplingBasicsTest5(unittest.TestCase): m.insertNextCell(NORM_QPOLYG,[15,1,2,3,16,20,6,7,19,17]) m.insertNextCell(NORM_QPOLYG,[15,5,8,16,22,10,21,18]) m.insertNextCell(NORM_QPOLYG,[16,3,0,1,15,19,11,12,20,18]) - m.checkCoherency1() + m.checkConsistency() self.assertTrue(m.getCellsContainingPoint([0.,0.27],1e-12).isEqual(DataArrayInt([2]))) pass def testSwig2DAIGetIdsEqualTuple1(self): da=DataArrayInt([0,7,1,2,4,1,2,1,1,2,0,1,2,1,5,1,1,2],9,2) - self.assertTrue(da.getIdsEqualTuple([1,2]).isEqual(DataArrayInt([1,4,8]))) - self.assertTrue(da.getIdsEqualTuple((1,2)).isEqual(DataArrayInt([1,4,8]))) - self.assertTrue(da.getIdsEqualTuple(DataArrayInt([1,2])).isEqual(DataArrayInt([1,4,8]))) + self.assertTrue(da.findIdsEqualTuple([1,2]).isEqual(DataArrayInt([1,4,8]))) + self.assertTrue(da.findIdsEqualTuple((1,2)).isEqual(DataArrayInt([1,4,8]))) + self.assertTrue(da.findIdsEqualTuple(DataArrayInt([1,2])).isEqual(DataArrayInt([1,4,8]))) da.rearrange(3) - self.assertRaises(InterpKernelException,da.getIdsEqualTuple,[1,2])# mismatch nb of compo (3) and nb of elts in input tuple (2) - self.assertTrue(da.getIdsEqualTuple([2,0,1]).isEqual(DataArrayInt([3]))) - self.assertTrue(da.getIdsEqualTuple([2,0,7]).isEqual(DataArrayInt([]))) + self.assertRaises(InterpKernelException,da.findIdsEqualTuple,[1,2])# mismatch nb of compo (3) and nb of elts in input tuple (2) + self.assertTrue(da.findIdsEqualTuple([2,0,1]).isEqual(DataArrayInt([3]))) + self.assertTrue(da.findIdsEqualTuple([2,0,7]).isEqual(DataArrayInt([]))) da.rearrange(1) - self.assertTrue(da.getIdsEqualTuple(2).isEqual(DataArrayInt([3,6,9,12,17]))) - self.assertTrue(da.getIdsEqualTuple(2).isEqual(da.getIdsEqual(2))) + self.assertTrue(da.findIdsEqualTuple(2).isEqual(DataArrayInt([3,6,9,12,17]))) + self.assertTrue(da.findIdsEqualTuple(2).isEqual(da.findIdsEqual(2))) pass def testSwig2GaussNEStaticInfo1(self): @@ -1713,12 +1713,12 @@ class MEDCouplingBasicsTest5(unittest.TestCase): arr=DataArrayDouble(12) ; arr.iota() arr=DataArrayDouble.Meld(arr,arr+100.) ; arr.setInfoOnComponents(["aaa","bbb"]) f.setArray(arr) - f.checkCoherency() + f.checkConsistencyLight() # ref=DataArrayDouble([0.,0.5,1.5,2.5,3.,2.,2.5,3.5,4.5,5.,6.,6.5,7.5,8.5,9.,8.,8.5,9.5,10.5,11.]) ref=DataArrayDouble.Meld(ref,ref+100.) ; ref.setInfoOnComponents(["aaa","bbb"]) f2=f.cellToNodeDiscretization() - f2.checkCoherency() + f2.checkConsistencyLight() self.assertEqual(f2.getTime()[1:],[5,6]) self.assertAlmostEqual(f2.getTime()[0],1.1,15) self.assertEqual(f2.getMesh().getHiddenCppPointer(),m.getHiddenCppPointer()) @@ -1731,7 +1731,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): # u=m.buildUnstructured() ; f.setMesh(u) ; del m f3=f.cellToNodeDiscretization() - f3.checkCoherency() + f3.checkConsistencyLight() self.assertEqual(f3.getTime()[1:],[5,6]) self.assertAlmostEqual(f3.getTime()[0],1.1,15) self.assertEqual(f3.getMesh().getHiddenCppPointer(),u.getHiddenCppPointer()) @@ -1801,7 +1801,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): m.setCoords(cooArr) m.setConnectivity(DataArrayInt(conn),DataArrayInt(connI)) m.mergeNodes(eps) - m.checkCoherency() + m.checkConsistencyLight() self.assertTrue(m.conformize2D(eps).isEqual(DataArrayInt([3]))) self.assertEqual(m.getCoords().getHiddenCppPointer(),cooArr.getHiddenCppPointer()) # check that coordinates remain the same here self.assertTrue(m.getNodalConnectivity().isEqual(DataArrayInt([5,5,2,6,4,5,6,3,0,1,5,4,5,10,8,11,9,5,11,2,5,1,7,10,9]))) @@ -1863,7 +1863,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): m=m.buildUnstructured() m.convertLinearCellsToQuadratic() self.assertEqual(42,m.getNumberOfNodes()) - oldCoo=m.getCoords().deepCpy() + oldCoo=m.getCoords().deepCopy() m.conformize2D(eps) self.assertTrue(m.getCoords()[:42].isEqual(oldCoo,1e-12)) self.assertTrue(m.getNodalConnectivity().isEqual(DataArrayInt([32,2,3,7,6,5,18,19,20,42,43,32,13,12,16,17,14,44,38,23,24,25,32,4,10,11,12,13,8,6,5,26,45,39,44,31,34,42,29,8,9,14,13,8,30,25,31,32,8,8,9,7,6,32,33,20,34,32,5,4,0,1,2,29,35,36,46,43,8,16,12,11,15,38,39,40,41]))) @@ -2228,11 +2228,11 @@ class MEDCouplingBasicsTest5(unittest.TestCase): coo=DataArrayDouble([(0,0),(0,0.5),(0,1),(1,1),(1,0),(0.5,0)]) m=MEDCouplingUMesh("mesh",2) ; m.setCoords(coo) m.allocateCells() ; m.insertNextCell(NORM_POLYGON,[0,1,2,3,4,5]) - m.checkCoherency1() + m.checkConsistency() refPtr=m.getCoords().getHiddenCppPointer() # m.colinearize2D(1e-12) - m.checkCoherency1() + m.checkConsistency() self.assertEqual(refPtr,m.getCoords().getHiddenCppPointer()) self.assertTrue(m.getNodalConnectivity().isEqual(DataArrayInt([NORM_POLYGON,0,2,3,4]))) self.assertTrue(m.getNodalConnectivityIndex().isEqual(DataArrayInt([0,5]))) @@ -2246,7 +2246,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): c, cI = [DataArrayInt(l) for l in [[NORM_POLYGON, 0,1,2], [0,4]] ] m.setCoords(coo); m.setConnectivity(c, cI) m.colinearize2D(1e-10) - m.checkCoherency1() + m.checkConsistency() self.assertEqual(c.getValues(), m.getNodalConnectivity().getValues()) self.assertEqual(cI.getValues(), m.getNodalConnectivityIndex().getValues()) @@ -2255,7 +2255,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): c, cI = [DataArrayInt(l) for l in [[NORM_QPOLYG, 0,1, 2,3], [0,5]] ] m.setCoords(coo); m.setConnectivity(c, cI) m.colinearize2D(1e-10) - m.checkCoherency1() + m.checkConsistency() self.assertEqual(c.getValues(), m.getNodalConnectivity().getValues()) self.assertEqual(cI.getValues(), m.getNodalConnectivityIndex().getValues()) @@ -2264,7 +2264,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): c, cI = [DataArrayInt(l) for l in [[NORM_POLYGON, 0,1,2,3], [0,5]] ] m.setCoords(coo); m.setConnectivity(c, cI) m.colinearize2D(1e-10) - m.checkCoherency1() + m.checkConsistency() self.assertEqual([NORM_POLYGON, 3,1,2], m.getNodalConnectivity().getValues()) self.assertEqual([0,4], m.getNodalConnectivityIndex().getValues()) @@ -2273,7 +2273,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): c, cI = [DataArrayInt(l) for l in [[NORM_QPOLYG, 0,1,3, 3,2,4], [0,7]] ] m.setCoords(coo); m.setConnectivity(c, cI) m.colinearize2D(1e-10) - m.checkCoherency1() + m.checkConsistency() self.assertEqual([NORM_QPOLYG, 3,1, 5,2], m.getNodalConnectivity().getValues()) self.assertTrue( m.getCoords()[5].isEqual( DataArrayDouble([(1.5,0.0)]), 1.0e-12 ) ) self.assertEqual([0,5], m.getNodalConnectivityIndex().getValues()) @@ -2282,7 +2282,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): m = MEDCouplingDataForTest.buildCircle2(0.0, 0.0, 1.0) c, cI = [DataArrayInt(l) for l in [[NORM_QPOLYG, 7,5,3,1, 6,4,2,0], [0,9]] ] m.colinearize2D(1e-10) - m.checkCoherency1() + m.checkConsistency() self.assertEqual([NORM_QPOLYG, 3,5, 8,4], m.getNodalConnectivity().getValues()) self.assertTrue( m.getCoords()[8].isEqual( DataArrayDouble([(1.0,0.0)]), 1.0e-12 ) ) self.assertEqual([0,5], m.getNodalConnectivityIndex().getValues()) @@ -2415,7 +2415,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertTrue(not m.isEqual(m2,1e-12)) m2.setDXYZ(DataArrayDouble((0.5,0.25,1.))) self.assertTrue(m.isEqual(m2,1e-12)) - m2bis=m2.deepCpy() + m2bis=m2.deepCopy() self.assertTrue(m2bis.isEqual(m2,1e-12)) # self.assertEqual(6,m2bis.getNumberOfCells())#3,2,4 @@ -2428,18 +2428,18 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertEqual(3,m.getMeshDimension()) self.assertAlmostEqual(0.125,m.getMeasureOfAnyCell(),16); mu=MEDCoupling1SGTUMesh(m.buildUnstructured()) - mu.checkCoherency1() + mu.checkConsistency() cooExp=DataArrayDouble([(1.5,3.5,2.5),(2,3.5,2.5),(2.5,3.5,2.5),(1.5,3.75,2.5),(2,3.75,2.5),(2.5,3.75,2.5),(1.5,3.5,3.5),(2,3.5,3.5),(2.5,3.5,3.5),(1.5,3.75,3.5),(2,3.75,3.5),(2.5,3.75,3.5),(1.5,3.5,4.5),(2,3.5,4.5),(2.5,3.5,4.5),(1.5,3.75,4.5),(2,3.75,4.5),(2.5,3.75,4.5),(1.5,3.5,5.5),(2,3.5,5.5),(2.5,3.5,5.5),(1.5,3.75,5.5),(2,3.75,5.5),(2.5,3.75,5.5)]) ; cooExp.setInfoOnComponents(["X [m]","Y [m]","Z [m]"]) self.assertTrue(isinstance(mu,MEDCoupling1SGTUMesh)) self.assertEqual(NORM_HEXA8,mu.getCellModelEnum()) self.assertTrue(mu.getCoords().isEqual(cooExp,1e-12)) self.assertTrue(mu.getNodalConnectivity().isEqual(DataArrayInt([1,0,3,4,7,6,9,10,2,1,4,5,8,7,10,11,7,6,9,10,13,12,15,16,8,7,10,11,14,13,16,17,13,12,15,16,19,18,21,22,14,13,16,17,20,19,22,23]))) - bary=m.getBarycenterAndOwner() + bary=m.computeCellCenterOfMass() baryExp=DataArrayDouble([(1.75,3.625,3),(2.25,3.625,3),(1.75,3.625,4),(2.25,3.625,4),(1.75,3.625,5),(2.25,3.625,5)]) ; baryExp.setInfoOnComponents(["X [m]","Y [m]","Z [m]"]) self.assertTrue(bary.isEqual(baryExp,1e-12)) # c=m.convertToCartesian() - c.checkCoherency() + c.checkConsistencyLight() self.assertEqual([1.1,0,3],c.getTime()) self.assertEqual("ms",c.getTimeUnit()) self.assertEqual(3,c.getMeshDimension()) @@ -2486,7 +2486,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertEqual(12,m4.getNumberOfNodes()) self.assertEqual(6,m4.getNumberOfCells()) mu=MEDCoupling1SGTUMesh(m4.buildUnstructured()) - mu.checkCoherency1() + mu.checkConsistency() self.assertTrue(isinstance(mu,MEDCoupling1SGTUMesh)) self.assertEqual(NORM_QUAD4,mu.getCellModelEnum()) coordsExp=DataArrayDouble([(1.5,2.5,3.5),(2,2.5,3.5),(2.5,2.5,3.5),(1.5,2.5,3.75),(2,2.5,3.75),(2.5,2.5,3.75),(1.5,2.5,4),(2,2.5,4),(2.5,2.5,4),(1.5,2.5,4.25),(2,2.5,4.25),(2.5,2.5,4.25)]) ; coordsExp.setInfoOnComponents(["X [km]","Y [km]","Z [km]"]) @@ -2595,7 +2595,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertEqual(m0.getNumberOfCols(),3) self.assertEqual(m0.getNbOfElems(),6) ref=m0.getData().getHiddenCppPointer() - m00=m0.deepCpy() + m00=m0.deepCopy() self.assertTrue(m0.isEqual(m00,1e-12)) m00.getData().setIJ(0,0,2.1) self.assertTrue(not m0.isEqual(m00,1e-12)) @@ -2619,11 +2619,11 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertEqual(m0.getNumberOfCols(),3) self.assertTrue(m0.getData().isEqual(DataArrayDouble([2,3,4,5,1,6]),1e-12)) #m0np=m0.getData().toNumPyArray() ; m0np=matrix(m0np.reshape(m0.getNumberOfRows(),m0.getNumberOfCols())) - m1=m0.deepCpy() + m1=m0.deepCopy() self.assertEqual(m1.getNumberOfRows(),2) self.assertEqual(m1.getNumberOfCols(),3) self.assertTrue(m1.getData().isEqual(DataArrayDouble([2,3,4,5,1,6]),1e-12)) - m11=m0.deepCpy() ; m11+=m1 + m11=m0.deepCopy() ; m11+=m1 self.assertEqual(m11.getNumberOfRows(),2) self.assertEqual(m11.getNumberOfCols(),3) self.assertTrue(m11.getData().isEqual(DataArrayDouble([4,6,8,10,2,12]),1e-12)) @@ -2679,8 +2679,8 @@ class MEDCouplingBasicsTest5(unittest.TestCase): fine=DataArrayDouble(3*2*3*4*4*4) ; fine.iota(0) #X=3,Y=2,Z=3 refined by 4 MEDCouplingIMesh.SpreadCoarseToFine(coarse,[5,7,5],fine,[(1,4),(2,4),(1,4)],[4,4,4]) self.assertTrue(fine.isEqual(DataArrayDouble([46.,46.,46.,46.,47.,47.,47.,47.,48.,48.,48.,48.,46.,46.,46.,46.,47.,47.,47.,47.,48.,48.,48.,48.,46.,46.,46.,46.,47.,47.,47.,47.,48.,48.,48.,48.,46.,46.,46.,46.,47.,47.,47.,47.,48.,48.,48.,48.,51.,51.,51.,51.,52.,52.,52.,52.,53.,53.,53.,53.,51.,51.,51.,51.,52.,52.,52.,52.,53.,53.,53.,53.,51.,51.,51.,51.,52.,52.,52.,52.,53.,53.,53.,53.,51.,51.,51.,51.,52.,52.,52.,52.,53.,53.,53.,53.,46.,46.,46.,46.,47.,47.,47.,47.,48.,48.,48.,48.,46.,46.,46.,46.,47.,47.,47.,47.,48.,48.,48.,48.,46.,46.,46.,46.,47.,47.,47.,47.,48.,48.,48.,48.,46.,46.,46.,46.,47.,47.,47.,47.,48.,48.,48.,48.,51.,51.,51.,51.,52.,52.,52.,52.,53.,53.,53.,53.,51.,51.,51.,51.,52.,52.,52.,52.,53.,53.,53.,53.,51.,51.,51.,51.,52.,52.,52.,52.,53.,53.,53.,53.,51.,51.,51.,51.,52.,52.,52.,52.,53.,53.,53.,53.,46.,46.,46.,46.,47.,47.,47.,47.,48.,48.,48.,48.,46.,46.,46.,46.,47.,47.,47.,47.,48.,48.,48.,48.,46.,46.,46.,46.,47.,47.,47.,47.,48.,48.,48.,48.,46.,46.,46.,46.,47.,47.,47.,47.,48.,48.,48.,48.,51.,51.,51.,51.,52.,52.,52.,52.,53.,53.,53.,53.,51.,51.,51.,51.,52.,52.,52.,52.,53.,53.,53.,53.,51.,51.,51.,51.,52.,52.,52.,52.,53.,53.,53.,53.,51.,51.,51.,51.,52.,52.,52.,52.,53.,53.,53.,53.,46.,46.,46.,46.,47.,47.,47.,47.,48.,48.,48.,48.,46.,46.,46.,46.,47.,47.,47.,47.,48.,48.,48.,48.,46.,46.,46.,46.,47.,47.,47.,47.,48.,48.,48.,48.,46.,46.,46.,46.,47.,47.,47.,47.,48.,48.,48.,48.,51.,51.,51.,51.,52.,52.,52.,52.,53.,53.,53.,53.,51.,51.,51.,51.,52.,52.,52.,52.,53.,53.,53.,53.,51.,51.,51.,51.,52.,52.,52.,52.,53.,53.,53.,53.,51.,51.,51.,51.,52.,52.,52.,52.,53.,53.,53.,53.,81.,81.,81.,81.,82.,82.,82.,82.,83.,83.,83.,83.,81.,81.,81.,81.,82.,82.,82.,82.,83.,83.,83.,83.,81.,81.,81.,81.,82.,82.,82.,82.,83.,83.,83.,83.,81.,81.,81.,81.,82.,82.,82.,82.,83.,83.,83.,83.,86.,86.,86.,86.,87.,87.,87.,87.,88.,88.,88.,88.,86.,86.,86.,86.,87.,87.,87.,87.,88.,88.,88.,88.,86.,86.,86.,86.,87.,87.,87.,87.,88.,88.,88.,88.,86.,86.,86.,86.,87.,87.,87.,87.,88.,88.,88.,88.,81.,81.,81.,81.,82.,82.,82.,82.,83.,83.,83.,83.,81.,81.,81.,81.,82.,82.,82.,82.,83.,83.,83.,83.,81.,81.,81.,81.,82.,82.,82.,82.,83.,83.,83.,83.,81.,81.,81.,81.,82.,82.,82.,82.,83.,83.,83.,83.,86.,86.,86.,86.,87.,87.,87.,87.,88.,88.,88.,88.,86.,86.,86.,86.,87.,87.,87.,87.,88.,88.,88.,88.,86.,86.,86.,86.,87.,87.,87.,87.,88.,88.,88.,88.,86.,86.,86.,86.,87.,87.,87.,87.,88.,88.,88.,88.,81.,81.,81.,81.,82.,82.,82.,82.,83.,83.,83.,83.,81.,81.,81.,81.,82.,82.,82.,82.,83.,83.,83.,83.,81.,81.,81.,81.,82.,82.,82.,82.,83.,83.,83.,83.,81.,81.,81.,81.,82.,82.,82.,82.,83.,83.,83.,83.,86.,86.,86.,86.,87.,87.,87.,87.,88.,88.,88.,88.,86.,86.,86.,86.,87.,87.,87.,87.,88.,88.,88.,88.,86.,86.,86.,86.,87.,87.,87.,87.,88.,88.,88.,88.,86.,86.,86.,86.,87.,87.,87.,87.,88.,88.,88.,88.,81.,81.,81.,81.,82.,82.,82.,82.,83.,83.,83.,83.,81.,81.,81.,81.,82.,82.,82.,82.,83.,83.,83.,83.,81.,81.,81.,81.,82.,82.,82.,82.,83.,83.,83.,83.,81.,81.,81.,81.,82.,82.,82.,82.,83.,83.,83.,83.,86.,86.,86.,86.,87.,87.,87.,87.,88.,88.,88.,88.,86.,86.,86.,86.,87.,87.,87.,87.,88.,88.,88.,88.,86.,86.,86.,86.,87.,87.,87.,87.,88.,88.,88.,88.,86.,86.,86.,86.,87.,87.,87.,87.,88.,88.,88.,88.,116.,116.,116.,116.,117.,117.,117.,117.,118.,118.,118.,118.,116.,116.,116.,116.,117.,117.,117.,117.,118.,118.,118.,118.,116.,116.,116.,116.,117.,117.,117.,117.,118.,118.,118.,118.,116.,116.,116.,116.,117.,117.,117.,117.,118.,118.,118.,118.,121.,121.,121.,121.,122.,122.,122.,122.,123.,123.,123.,123.,121.,121.,121.,121.,122.,122.,122.,122.,123.,123.,123.,123.,121.,121.,121.,121.,122.,122.,122.,122.,123.,123.,123.,123.,121.,121.,121.,121.,122.,122.,122.,122.,123.,123.,123.,123.,116.,116.,116.,116.,117.,117.,117.,117.,118.,118.,118.,118.,116.,116.,116.,116.,117.,117.,117.,117.,118.,118.,118.,118.,116.,116.,116.,116.,117.,117.,117.,117.,118.,118.,118.,118.,116.,116.,116.,116.,117.,117.,117.,117.,118.,118.,118.,118.,121.,121.,121.,121.,122.,122.,122.,122.,123.,123.,123.,123.,121.,121.,121.,121.,122.,122.,122.,122.,123.,123.,123.,123.,121.,121.,121.,121.,122.,122.,122.,122.,123.,123.,123.,123.,121.,121.,121.,121.,122.,122.,122.,122.,123.,123.,123.,123.,116.,116.,116.,116.,117.,117.,117.,117.,118.,118.,118.,118.,116.,116.,116.,116.,117.,117.,117.,117.,118.,118.,118.,118.,116.,116.,116.,116.,117.,117.,117.,117.,118.,118.,118.,118.,116.,116.,116.,116.,117.,117.,117.,117.,118.,118.,118.,118.,121.,121.,121.,121.,122.,122.,122.,122.,123.,123.,123.,123.,121.,121.,121.,121.,122.,122.,122.,122.,123.,123.,123.,123.,121.,121.,121.,121.,122.,122.,122.,122.,123.,123.,123.,123.,121.,121.,121.,121.,122.,122.,122.,122.,123.,123.,123.,123.,116.,116.,116.,116.,117.,117.,117.,117.,118.,118.,118.,118.,116.,116.,116.,116.,117.,117.,117.,117.,118.,118.,118.,118.,116.,116.,116.,116.,117.,117.,117.,117.,118.,118.,118.,118.,116.,116.,116.,116.,117.,117.,117.,117.,118.,118.,118.,118.,121.,121.,121.,121.,122.,122.,122.,122.,123.,123.,123.,123.,121.,121.,121.,121.,122.,122.,122.,122.,123.,123.,123.,123.,121.,121.,121.,121.,122.,122.,122.,122.,123.,123.,123.,123.,121.,121.,121.,121.,122.,122.,122.,122.,123.,123.,123.,123.]),1e-12)) - f=MEDCouplingFieldDouble(ON_CELLS) ; f.setMesh(MEDCouplingIMesh("",3,DataArrayInt([6,8,6]),[0.,0.,0.],DataArrayDouble((1.,1.,1.)))) ; f.setArray(coarse) ; f.setName("tutu") ; f.checkCoherency() - f=MEDCouplingFieldDouble(ON_CELLS) ; f.setMesh(MEDCouplingIMesh("",3,DataArrayInt([13,9,13]),[1.,2.,1.],DataArrayDouble((0.25,0.25,0.25)))) ; f.setArray(fine) ; f.setName("tutu") ; f.checkCoherency() + f=MEDCouplingFieldDouble(ON_CELLS) ; f.setMesh(MEDCouplingIMesh("",3,DataArrayInt([6,8,6]),[0.,0.,0.],DataArrayDouble((1.,1.,1.)))) ; f.setArray(coarse) ; f.setName("tutu") ; f.checkConsistencyLight() + f=MEDCouplingFieldDouble(ON_CELLS) ; f.setMesh(MEDCouplingIMesh("",3,DataArrayInt([13,9,13]),[1.,2.,1.],DataArrayDouble((0.25,0.25,0.25)))) ; f.setArray(fine) ; f.setName("tutu") ; f.checkConsistencyLight() # 1D coarse=DataArrayDouble(5) ; coarse.iota(0) #X=5 fine=DataArrayDouble(3*4) ; fine.iota(0) #X=3 refined by 4 @@ -2691,8 +2691,8 @@ class MEDCouplingBasicsTest5(unittest.TestCase): def testSwig2AMR4(self): """This test focuses on MEDCouplingCartesianAMRMesh.createPatchesFromCriterion method. To test it a field containing 0 everywhere except in the annulus (centered on the center of the mesh) value is 1.""" im=MEDCouplingIMesh("mesh",2,[51,51],[0.,0.],[0.04,0.04]) - b=im.getBarycenterAndOwner() ; b-=[1.,1.] ; b=b.magnitude() - ids=b.getIdsInRange(0.4,0.7) + b=im.computeCellCenterOfMass() ; b-=[1.,1.] ; b=b.magnitude() + ids=b.findIdsInRange(0.4,0.7) f=MEDCouplingFieldDouble(ON_CELLS) ; f.setMesh(im) ; f.setName("toto") ; arr=DataArrayDouble(im.getNumberOfCells()) ; arr[:]=0. ; arr[ids]=1. ; f.setArray(arr) # f.write("test.vti") amr=MEDCouplingCartesianAMRMesh(MEDCouplingIMesh("mesh",2,[51,51],[0.,0.],[0.04,0.04])) @@ -2730,12 +2730,12 @@ class MEDCouplingBasicsTest5(unittest.TestCase): fine=DataArrayDouble((3*4+2*1)*(2*4+2*1)) ; fine.iota(1000) #X=3,Y=2 refined by 4 MEDCouplingIMesh.SpreadCoarseToFineGhost(coarse,[5,7],fine,[(1,4),(2,4)],[4,4],1) self.assertTrue(fine.isEqual(DataArrayDouble([15.,16.,16.,16.,16.,17.,17.,17.,17.,18.,18.,18.,18.,19.,22.,23.,23.,23.,23.,24.,24.,24.,24.,25.,25.,25.,25.,26.,22.,23.,23.,23.,23.,24.,24.,24.,24.,25.,25.,25.,25.,26.,22.,23.,23.,23.,23.,24.,24.,24.,24.,25.,25.,25.,25.,26.,22.,23.,23.,23.,23.,24.,24.,24.,24.,25.,25.,25.,25.,26.,29.,30.,30.,30.,30.,31.,31.,31.,31.,32.,32.,32.,32.,33.,29.,30.,30.,30.,30.,31.,31.,31.,31.,32.,32.,32.,32.,33.,29.,30.,30.,30.,30.,31.,31.,31.,31.,32.,32.,32.,32.,33.,29.,30.,30.,30.,30.,31.,31.,31.,31.,32.,32.,32.,32.,33.,36.,37.,37.,37.,37.,38.,38.,38.,38.,39.,39.,39.,39.,40.]),1e-12)) - f=MEDCouplingFieldDouble(ON_CELLS) ; f.setMesh(MEDCouplingIMesh("",2,DataArrayInt([8,10]),[0.,0.],DataArrayDouble((1.,1.)))) ; f.setArray(coarse) ; f.setName("tutu") ; f.checkCoherency() + f=MEDCouplingFieldDouble(ON_CELLS) ; f.setMesh(MEDCouplingIMesh("",2,DataArrayInt([8,10]),[0.,0.],DataArrayDouble((1.,1.)))) ; f.setArray(coarse) ; f.setName("tutu") ; f.checkConsistencyLight() coarse.iota(-1000) fine2=DataArrayDouble.Meld(fine,3*fine) ; coarse2=DataArrayDouble.Meld(coarse,3*coarse) MEDCouplingIMesh.CondenseFineToCoarseGhost([5,7],fine,[(1,4),(2,4)],[4,4],coarse,1) MEDCouplingIMesh.CondenseFineToCoarseGhost([5,7],fine2,[(1,4),(2,4)],[4,4],coarse2,1) - f=MEDCouplingFieldDouble(ON_CELLS) ; f.setMesh(MEDCouplingIMesh("",2,DataArrayInt([8,10]),[0.,0.],DataArrayDouble((1.,1.)))) ; f.setArray(coarse) ; f.setName("tutu") ; f.checkCoherency() + f=MEDCouplingFieldDouble(ON_CELLS) ; f.setMesh(MEDCouplingIMesh("",2,DataArrayInt([8,10]),[0.,0.],DataArrayDouble((1.,1.)))) ; f.setArray(coarse) ; f.setName("tutu") ; f.checkConsistencyLight() coarseExp=DataArrayDouble([-1000.,-999.,-998.,-997.,-996.,-995.,-994.,-993.,-992.,-991.,-990.,-989.,-988.,-987.,-986.,-985.,-984.,-983.,-982.,-981.,-980.,-979.,-978.,368.,384.,400.,-974.,-973.,-972.,-971.,480.,496.,512.,-967.,-966.,-965.,-964.,-963.,-962.,-961.,-960.,-959.,-958.,-957.,-956.,-955.,-954.,-953.,-952.,-951.,-950.,-949.,-948.,-947.,-946.,-945.,-944.,-943.,-942.,-941.,-940.,-939.,-938.]) self.assertTrue(coarse.isEqual(coarseExp,1e-12)) self.assertTrue(coarse2[:,0].isEqual(coarseExp,1e-12)) @@ -2758,18 +2758,18 @@ class MEDCouplingBasicsTest5(unittest.TestCase): da4=DataArrayDouble((1*4+2)*(3*4+2)) ; da4.iota() ; da4[:]+=0.8 self.assertEqual(5,amr.getNumberOfPatches()) l=[da0,da1,da2,da3,da4] - lCpy=[elt.deepCpy() for elt in l] + lCpy=[elt.deepCopy() for elt in l] l2=[DataArrayDouble.Meld(elt,3*elt) for elt in l] amr.fillCellFieldOnPatchGhostAdv(0,da,1,l,False) amr.fillCellFieldOnPatchGhostAdv(0,DataArrayDouble.Meld(da,3*da),1,l2,False) amr.fillCellFieldOnPatchOnlyOnGhostZone(0,da,lCpy[0],1) # f=MEDCouplingFieldDouble(ON_CELLS) ; f.setMesh(amr.getImageMesh().buildWithGhost(1)) ; f.setArray(da) ; f.setName("all") - f0=MEDCouplingFieldDouble(ON_CELLS) ; f0.setMesh(amr[0].getMesh().getImageMesh().buildWithGhost(1)) ; f0.setArray(da0) ; f0.setName("p0") ; f0.checkCoherency() - f1=MEDCouplingFieldDouble(ON_CELLS) ; f1.setMesh(amr[1].getMesh().getImageMesh().buildWithGhost(1)) ; f1.setArray(da1) ; f1.setName("p1") ; f1.checkCoherency() - f2=MEDCouplingFieldDouble(ON_CELLS) ; f2.setMesh(amr[2].getMesh().getImageMesh().buildWithGhost(1)) ; f2.setArray(da2) ; f2.setName("p2") ; f2.checkCoherency() - f3=MEDCouplingFieldDouble(ON_CELLS) ; f3.setMesh(amr[3].getMesh().getImageMesh().buildWithGhost(1)) ; f3.setArray(da3) ; f3.setName("p3") ; f3.checkCoherency() - f4=MEDCouplingFieldDouble(ON_CELLS) ; f4.setMesh(amr[4].getMesh().getImageMesh().buildWithGhost(1)) ; f4.setArray(da4) ; f4.setName("p4") ; f4.checkCoherency() + f0=MEDCouplingFieldDouble(ON_CELLS) ; f0.setMesh(amr[0].getMesh().getImageMesh().buildWithGhost(1)) ; f0.setArray(da0) ; f0.setName("p0") ; f0.checkConsistencyLight() + f1=MEDCouplingFieldDouble(ON_CELLS) ; f1.setMesh(amr[1].getMesh().getImageMesh().buildWithGhost(1)) ; f1.setArray(da1) ; f1.setName("p1") ; f1.checkConsistencyLight() + f2=MEDCouplingFieldDouble(ON_CELLS) ; f2.setMesh(amr[2].getMesh().getImageMesh().buildWithGhost(1)) ; f2.setArray(da2) ; f2.setName("p2") ; f2.checkConsistencyLight() + f3=MEDCouplingFieldDouble(ON_CELLS) ; f3.setMesh(amr[3].getMesh().getImageMesh().buildWithGhost(1)) ; f3.setArray(da3) ; f3.setName("p3") ; f3.checkConsistencyLight() + f4=MEDCouplingFieldDouble(ON_CELLS) ; f4.setMesh(amr[4].getMesh().getImageMesh().buildWithGhost(1)) ; f4.setArray(da4) ; f4.setName("p4") ; f4.checkConsistencyLight() # da0Exp=DataArrayDouble([28.8,16.9,16.9,16.9,16.9,17.9,17.9,17.9,17.9,18.9,18.9,18.9,18.9,25.7,34.8,23.9,23.9,23.9,23.9,24.9,24.9,24.9,24.9,25.9,25.9,25.9,25.9,31.7,40.8,23.9,23.9,23.9,23.9,24.9,24.9,24.9,24.9,25.9,25.9,25.9,25.9,37.7,46.8,23.9,23.9,23.9,23.9,24.9,24.9,24.9,24.9,25.9,25.9,25.9,25.9,43.7,52.8,23.9,23.9,23.9,23.9,24.9,24.9,24.9,24.9,25.9,25.9,25.9,25.9,49.7,58.8,30.9,30.9,30.9,30.9,31.9,31.9,31.9,31.9,32.9,32.9,32.9,32.9,7.6,64.8,30.9,30.9,30.9,30.9,31.9,31.9,31.9,31.9,32.9,32.9,32.9,32.9,13.6,70.8,30.9,30.9,30.9,30.9,31.9,31.9,31.9,31.9,32.9,32.9,32.9,32.9,19.6,76.8,30.9,30.9,30.9,30.9,31.9,31.9,31.9,31.9,32.9,32.9,32.9,32.9,25.6,36.9,37.9,37.9,37.9,37.9,38.9,38.9,38.9,38.9,39.9,39.9,39.9,39.9,40.9]) da0Exp2=DataArrayDouble([15.9,16.9,16.9,16.9,16.9,17.9,17.9,17.9,17.9,18.9,18.9,18.9,18.9,19.9,22.9,15.2,16.2,17.2,18.2,19.2,20.2,21.2,22.2,23.2,24.2,25.2,26.2,26.9,22.9,29.2,30.2,31.2,32.2,33.2,34.2,35.2,36.2,37.2,38.2,39.2,40.2,26.9,22.9,43.2,44.2,45.2,46.2,47.2,48.2,49.2,50.2,51.2,52.2,53.2,54.2,26.9,22.9,57.2,58.2,59.2,60.2,61.2,62.2,63.2,64.2,65.2,66.2,67.2,68.2,26.9,29.9,71.2,72.2,73.2,74.2,75.2,76.2,77.2,78.2,79.2,80.2,81.2,82.2,33.9,29.9,85.2,86.2,87.2,88.2,89.2,90.2,91.2,92.2,93.2,94.2,95.2,96.2,33.9,29.9,99.2,100.2,101.2,102.2,103.2,104.2,105.2,106.2,107.2,108.2,109.2,110.2,33.9,29.9,113.2,114.2,115.2,116.2,117.2,118.2,119.2,120.2,121.2,122.2,123.2,124.2,33.9,36.9,37.9,37.9,37.9,37.9,38.9,38.9,38.9,38.9,39.9,39.9,39.9,39.9,40.9]) @@ -2798,15 +2798,15 @@ class MEDCouplingBasicsTest5(unittest.TestCase): da1=DataArrayDouble(1*4+2) ; da1.iota() ; da1[:]+=0.4 self.assertEqual(2,amr.getNumberOfPatches()) l=[da0,da1] - lCpy=[elt.deepCpy() for elt in l] + lCpy=[elt.deepCopy() for elt in l] l2=[DataArrayDouble.Meld(elt,3*elt) for elt in l] amr.fillCellFieldOnPatchGhostAdv(0,da,1,l,False) amr.fillCellFieldOnPatchGhostAdv(0,DataArrayDouble.Meld(da,3*da),1,l2,False) amr.fillCellFieldOnPatchOnlyOnGhostZone(0,da,lCpy[0],1) # f=MEDCouplingFieldDouble(ON_CELLS) ; f.setMesh(amr.getImageMesh().buildWithGhost(1)) ; f.setArray(da) ; f.setName("all") - f0=MEDCouplingFieldDouble(ON_CELLS) ; f0.setMesh(amr[0].getMesh().getImageMesh().buildWithGhost(1)) ; f0.setArray(da0) ; f0.setName("p0") ; f0.checkCoherency() - f1=MEDCouplingFieldDouble(ON_CELLS) ; f1.setMesh(amr[1].getMesh().getImageMesh().buildWithGhost(1)) ; f1.setArray(da1) ; f1.setName("p1") ; f1.checkCoherency() + f0=MEDCouplingFieldDouble(ON_CELLS) ; f0.setMesh(amr[0].getMesh().getImageMesh().buildWithGhost(1)) ; f0.setArray(da0) ; f0.setName("p0") ; f0.checkConsistencyLight() + f1=MEDCouplingFieldDouble(ON_CELLS) ; f1.setMesh(amr[1].getMesh().getImageMesh().buildWithGhost(1)) ; f1.setArray(da1) ; f1.setName("p1") ; f1.checkConsistencyLight() # da0Exp=DataArrayDouble([4.4,2.9,2.9,2.9,2.9,3.9,3.9,3.9,3.9,4.9,4.9,4.9,4.9,5.9]) da0Exp2=DataArrayDouble([1.9,1.2,2.2,3.2,4.2,5.2,6.2,7.2,8.2,9.2,10.2,11.2,12.2,5.9]) @@ -2869,8 +2869,8 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertTrue(m.getCoords().isEqualWithoutConsideringStr(DataArrayDouble([0.,0.,1.,0.,2.,0.,3.,0.,4.,0.,5.,0.,0.,1.,1.,1.,2.,1.,3.,1.,4.,1.,5.,1.,0.,2.,1.,2.,2.,2.,3.,2.,4.,2.,5.,2.,0.,3.,1.,3.,4.,3.,5.,3.,0.,4.,1.,4.,2.,4.,3.,4.,4.,4.,1.,5.,2.,5.,3.,5.,4.,5.,5.,5.,1.,6.,2.,6.,3.,6.,4.,6.,5.,6.,1.,2.,1.25,2.,1.5,2.,1.75,2.,2.,2.,2.25,2.,2.5,2.,2.75,2.,3.,2.,3.25,2.,3.5,2.,3.75,2.,4.,2.,1.,2.25,1.25,2.25,1.5,2.25,1.75,2.25,2.,2.25,2.25,2.25,2.5,2.25,2.75,2.25,3.,2.25,3.25,2.25,3.5,2.25,3.75,2.25,4.,2.25,1.,2.5,1.25,2.5,1.5,2.5,1.75,2.5,2.,2.5,2.25,2.5,2.5,2.5,2.75,2.5,3.,2.5,3.25,2.5,3.5,2.5,3.75,2.5,4.,2.5,1.,2.75,1.25,2.75,1.5,2.75,1.75,2.75,2.,2.75,2.25,2.75,2.5,2.75,2.75,2.75,3.,2.75,3.25,2.75,3.5,2.75,3.75,2.75,4.,2.75,1.,3.,1.25,3.,1.5,3.,1.75,3.,2.,3.,2.25,3.,2.5,3.,2.75,3.,3.,3.,3.25,3.,3.5,3.,3.75,3.,4.,3.,1.,3.25,1.25,3.25,1.5,3.25,1.75,3.25,2.,3.25,2.25,3.25,2.5,3.25,2.75,3.25,3.,3.25,3.25,3.25,3.5,3.25,3.75,3.25,4.,3.25,1.,3.5,1.25,3.5,1.5,3.5,1.75,3.5,2.,3.5,2.25,3.5,2.5,3.5,2.75,3.5,3.,3.5,3.25,3.5,3.5,3.5,1.,3.75,1.25,3.75,1.5,3.75,1.75,3.75,2.,3.75,2.25,3.75,2.5,3.75,2.75,3.75,3.,3.75,3.25,3.75,3.5,3.75,1.,4.,1.25,4.,1.5,4.,1.75,4.,2.,4.,2.25,4.,2.5,4.,2.75,4.,3.,4.,3.25,4.,3.5,4.,3.5,3.25,3.625,3.25,3.75,3.25,3.875,3.25,4.,3.25,3.5,3.375,3.625,3.375,3.75,3.375,3.875,3.375,4.,3.375,3.5,3.5,3.625,3.5,3.75,3.5,3.875,3.5,4.,3.5,3.5,3.625,3.625,3.625,3.75,3.625,3.875,3.625,4.,3.625,3.5,3.75,3.625,3.75,3.75,3.75,3.875,3.75,4.,3.75,3.5,3.875,3.625,3.875,3.75,3.875,3.875,3.875,4.,3.875,3.5,4.,3.625,4.,3.75,4.,3.875,4.,4.,4.,4.25,3.,4.5,3.,4.75,3.,5.,3.,4.25,3.25,4.5,3.25,4.75,3.25,5.,3.25,4.25,3.5,4.5,3.5,4.75,3.5,5.,3.5,4.25,3.75,4.5,3.75,4.75,3.75,5.,3.75,4.25,4.,4.5,4.,4.75,4.,5.,4.,4.,4.25,4.25,4.25,4.5,4.25,4.75,4.25,5.,4.25,4.,4.5,4.25,4.5,4.5,4.5,4.75,4.5,5.,4.5,4.,4.75,4.25,4.75,4.5,4.75,4.75,4.75,5.,4.75,4.,5.,4.25,5.,4.5,5.,4.75,5.,5.,5.,4.,3.,4.125,3.,4.25,3.,4.,3.125,4.125,3.125,4.25,3.125,4.,3.25,4.125,3.25,4.25,3.25,4.,3.375,4.125,3.375,4.25,3.375,4.,3.5,4.125,3.5,4.25,3.5,4.,3.625,4.125,3.625,4.25,3.625,4.,3.75,4.125,3.75,4.25,3.75,4.,3.875,4.125,3.875,4.25,3.875,4.,4.,4.125,4.,4.25,4.,4.,4.125,4.125,4.125,4.25,4.125,4.,4.25,4.125,4.25,4.25,4.25,0.,4.,0.25,4.,0.5,4.,0.75,4.,0.,4.25,0.25,4.25,0.5,4.25,0.75,4.25,0.,4.5,0.25,4.5,0.5,4.5,0.75,4.5,0.,4.75,0.25,4.75,0.5,4.75,0.75,4.75,1.,4.75,0.,5.,0.25,5.,0.5,5.,0.75,5.,1.,5.,0.,5.25,0.25,5.25,0.5,5.25,0.75,5.25,1.,5.25,0.,5.5,0.25,5.5,0.5,5.5,0.75,5.5,1.,5.5,0.,5.75,0.25,5.75,0.5,5.75,0.75,5.75,1.,5.75,0.,6.,0.25,6.,0.5,6.,0.75,6.,1.,6.,0.75,4.,0.875,4.,1.,4.,0.75,4.125,0.875,4.125,1.,4.125,0.75,4.25,0.875,4.25,1.,4.25,0.75,4.375,0.875,4.375,1.,4.375,0.75,4.5,0.875,4.5,1.,4.5,0.75,4.625,0.875,4.625,1.,4.625,0.75,4.75,0.875,4.75,1.,4.75],319,2),1e-12)) # the test is here ! To be called after iteration with no remesh att.synchronizeAllGhostZones() - f=att.buildCellFieldOnWithGhost(amr,"Field") ; f.checkCoherency() - ftmp=att.buildCellFieldOnWithoutGhost(amr,"Field") ; ftmp.checkCoherency() ; self.assertTrue(ftmp.getArray().isEqualWithoutConsideringStr(DataArrayDouble([8.1,9.1,10.1,11.1,12.1,15.1,16.1,17.1,18.1,19.1,22.1,23.1,24.1,25.1,26.1,29.1,30.1,31.1,32.1,33.1,36.1,37.1,38.1,39.1,40.1,43.1,44.1,45.1,46.1,47.1]),1e-12)) + f=att.buildCellFieldOnWithGhost(amr,"Field") ; f.checkConsistencyLight() + ftmp=att.buildCellFieldOnWithoutGhost(amr,"Field") ; ftmp.checkConsistencyLight() ; self.assertTrue(ftmp.getArray().isEqualWithoutConsideringStr(DataArrayDouble([8.1,9.1,10.1,11.1,12.1,15.1,16.1,17.1,18.1,19.1,22.1,23.1,24.1,25.1,26.1,29.1,30.1,31.1,32.1,33.1,36.1,37.1,38.1,39.1,40.1,43.1,44.1,45.1,46.1,47.1]),1e-12)) f0=att.buildCellFieldOnWithGhost(amr[0].getMesh(),"Field") f1=att.buildCellFieldOnWithGhost(amr[1].getMesh(),"Field") f2=att.buildCellFieldOnWithGhost(amr[2].getMesh(),"Field") @@ -2972,7 +2972,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): MEDCouplingStructuredMesh.AssignPartOfFieldOfDoubleUsing([3,4],da,[(1,3),(2,3)],DataArrayDouble([7.7,8.8])) self.assertTrue(da.isEqual(DataArrayDouble([0.,1.,2.,3.,4.,5.,6.,7.7,8.8,9.,10.,11.]),1e-12)) att=MEDCouplingAMRAttribute(amr,[("YY",1)],szGhost) - att.spillNatures([ConservativeVolumic]) + att.spillNatures([IntensiveMaximum]) att.alloc() yy=att.getFieldOn(amr,"YY") ; yy.iota(0.01) yy=att.getFieldOn(amr[0].getMesh(),"YY") ; yy.iota(0.02) @@ -2985,7 +2985,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): yy=att.getFieldOn(amr[1][2].getMesh(),"YY") ; yy.iota(0.09) yy=att.getFieldOn(amr[1][3].getMesh(),"YY") ; yy.iota(0.10) yy=att.getFieldOn(amr[2].getMesh(),"YY") ; yy.iota(0.11) - att2=att.deepCpy() ; att3=att2.deepCpy() ; att4=att3.deepCpy() ; att5=att4.deepCpy() ; att6=att5.deepCpy() + att2=att.deepCopy() ; att3=att2.deepCopy() ; att4=att3.deepCopy() ; att5=att4.deepCopy() ; att6=att5.deepCopy() ### att.synchronizeFineToCoarseBetween(2,1) ### @@ -3440,7 +3440,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): m.setCoords(DataArrayDouble([-1., -1., -1., 1., 1., 1., 1., -1.0],4,2)) c, cI = [NORM_POLYGON, 0, 1, 2, 3], [0, 5] m.setConnectivity(DataArrayInt(c), DataArrayInt(cI)) - m.checkCoherency() + m.checkConsistencyLight() coords2 = [0., 1.3, -1.3, 0., -0.6, 0.6, 0., -1.3, -0.5, -0.5] connec2, cI2 = [NORM_SEG3, 0, 1, 2, NORM_SEG3, 1, 3, 4], [0,4,8] m_line = MEDCouplingUMesh("seg", 1) @@ -3469,14 +3469,14 @@ class MEDCouplingBasicsTest5(unittest.TestCase): c = [NORM_POLYGON, 4, 5, 6, 7, NORM_POLYGON, 0, 1, 5, 4, NORM_POLYGON, 1, 2, 3, 0, 4, 7, 6, 5] cI = [0, 5, 10, 19] m.setConnectivity(DataArrayInt(c), DataArrayInt(cI)) - m.checkCoherency() + m.checkConsistencyLight() coords2 = [-1., 0.25, 1., 0.25] connec2, cI2 = [NORM_SEG2, 0, 1], [0,3] m_line = MEDCouplingUMesh.New("seg", 1) m_line.setCoords(DataArrayDouble(coords2, len(coords2)/2, 2)) m_line.setConnectivity(DataArrayInt(connec2), DataArrayInt(cI2)) - m_line2 = m_line.deepCpy() - m2 = m.deepCpy() + m_line2 = m_line.deepCopy() + m2 = m.deepCopy() a, b, c, d = MEDCouplingUMesh.Intersect2DMeshWith1DLine(m, m_line, eps) self.assertTrue(a.getCoords().getHiddenCppPointer()==b.getCoords().getHiddenCppPointer()) self.assertTrue(a.getCoords()[:m.getNumberOfNodes()].isEqual(m.getCoords(),1e-12)) @@ -3504,7 +3504,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): c = [NORM_QPOLYG, 8, 9, 10, 11, 12, 13, 14, 15, NORM_QPOLYG, 3, 1, 10, 9, 2, 17, 13, 16, NORM_QPOLYG, 1, 7, 5, 3, 9, 8, 11, 10, 0, 6, 4, 16, 12, 15, 14, 17] cI = [0, 9, 18, 35] m.setConnectivity(DataArrayInt(c), DataArrayInt(cI)) - m.checkCoherency() + m.checkConsistencyLight() coords2 = [-2., 1., 2., 1.0] connec2, cI2 = [NORM_SEG2, 0, 1], [0,3] m_line = MEDCouplingUMesh("seg", 1) @@ -3535,7 +3535,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): c = [NORM_QPOLYG, 15, 13, 11, 9, 14, 12, 10, 8, NORM_QPOLYG, 7, 5, 13, 15, 6, 17, 14, 16, NORM_QPOLYG, 5, 3, 1, 7, 15, 9, 11, 13, 4, 2, 0, 16, 8, 10, 12, 17] cI = [0, 9, 18, 35] m.setConnectivity(DataArrayInt(c), DataArrayInt(cI)) - m.checkCoherency() + m.checkConsistencyLight() coords2 = [-2., 0., 2., 0.] connec2, cI2 = [NORM_SEG2, 0, 1], [0,3] m_line = MEDCouplingUMesh.New("seg", 1) @@ -3568,7 +3568,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): c = [NORM_QPOLYG, 8, 9, 10, 11, 12, 13, 14, 15, NORM_QPOLYG, 3, 1, 10, 9, 2, 17, 13, 16, NORM_QPOLYG, 1, 7, 5, 3, 9, 8, 11, 10, 0, 6, 4, 16, 12, 15, 14, 17] cI = [0, 9, 18, 35] m.setConnectivity(DataArrayInt(c), DataArrayInt(cI)) - m.checkCoherency() + m.checkConsistencyLight() coords2 = [(-2., 1.),(2.,1.),(0.,1)] connec2, cI2 = [NORM_SEG2, 0, 2, NORM_SEG2, 2, 1], [0,3,6] m_line = MEDCouplingUMesh("seg", 1) @@ -3601,7 +3601,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): c = [NORM_QPOLYG, 8, 9, 10, 11, 12, 13, 14, 15, NORM_QPOLYG, 3, 1, 10, 9, 2, 17, 13, 16, NORM_QPOLYG, 1, 7, 5, 3, 9, 8, 11, 10, 0, 6, 4, 16, 12, 15, 14, 17] cI = [0, 9, 18, 35] m.setConnectivity(DataArrayInt(c), DataArrayInt(cI)) - m.checkCoherency() + m.checkConsistencyLight() coords2 = [1., 2., 1., -2.] connec2, cI2 = [NORM_SEG2, 0, 1], [0,3] m_line = MEDCouplingUMesh("seg", 1) @@ -3631,7 +3631,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): coords2 = DataArrayDouble([float(i) for i in range(32)], 16,2) m2.setCoords(coords2); m2.setConnectivity(c, cI); - m2.checkCoherency1(1.0e-8); + m2.checkConsistency(1.0e-8); # Shuffle a bit :-) m2.renumberCells(DataArrayInt([0,3,6,8,1,4,7,5,2]), True); @@ -3649,7 +3649,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): m3.setCoords(coord3) m3.setConnectivity(conn3A, cI) - m3.checkCoherency1(1.0e-8) + m3.checkConsistency(1.0e-8) res2 = m3.orderConsecutiveCells1D() expRes2 = [0,1,2] self.assertEqual(m3.getNumberOfCells(),res2.getNumberOfTuples()) @@ -3770,7 +3770,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): def testSwig2PartDefinitionComposeWith1(self): f=PartDefinition.New(DataArrayInt([0,1,2,3,6,7,8,9])) g=PartDefinition.New(4,14,1) - g2=g.deepCpy() + g2=g.deepCopy() self.assertTrue(g2.isEqual(g)[0]) h=f.composeWith(g) self.assertTrue(isinstance(h,DataArrayPartDefinition)) @@ -3785,7 +3785,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertTrue(isinstance(p2,SlicePartDefinition)) self.assertEqual(p2.getSlice(),slice(2,11,4)) self.assertTrue(p2.isEqual(SlicePartDefinition(2,11,4))[0]) - self.assertTrue(p2.isEqual(p2.deepCpy())[0]) + self.assertTrue(p2.isEqual(p2.deepCopy())[0]) self.assertTrue(not p2.isEqual(SlicePartDefinition(1,11,4))[0]) self.assertTrue(not p2.isEqual(SlicePartDefinition(2,10,4))[0]) self.assertTrue(not p2.isEqual(SlicePartDefinition(2,11,3))[0]) @@ -3793,7 +3793,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): def testSwig2DAIGetIdsStrictlyNegative1(self): d=DataArrayInt([4,-5,-1,0,3,99,-7]) - self.assertTrue(d.getIdsStrictlyNegative().isEqual(DataArrayInt([1,2,6]))) + self.assertTrue(d.findIdsStricltyNegative().isEqual(DataArrayInt([1,2,6]))) pass def testSwig2DAIReplaceOneValByInThis1(self): @@ -3972,7 +3972,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): arrZ=DataArrayDouble([0.,1.3,2.1,2.4]) m=MEDCouplingCMesh() ; m.setCoords(arrX,arrY,arrZ) ; m=m.buildUnstructured() f=m.computeDiameterField() - f.checkCoherency() + f.checkConsistencyLight() exp=DataArrayDouble([1.8411952639521971,1.5937377450509227,1.5297058540778357,1.705872210923198,1.4352700094407325,1.3638181696985856,2.0273134932713295,1.8055470085267789,1.7492855684535902,1.5297058540778357,1.2206555615733703,1.1357816691600546,1.3638181696985856,1.004987562112089,0.9,1.7492855684535902,1.4866068747318506,1.4177446878757824,1.3379088160259651,0.9695359714832656,0.8602325267042626,1.1445523142259597,0.6782329983125266,0.5099019513592785,1.5842979517754858,1.2884098726725124,1.208304597359457]) self.assertTrue(exp.isEqual(f.getArray(),1e-12)) m1=m[::2] @@ -3980,7 +3980,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): m2.simplexize(PLANAR_FACE_5) m3=MEDCouplingUMesh.MergeUMeshesOnSameCoords(m1,m2) f=m3.computeDiameterField() - f.checkCoherency() + f.checkConsistencyLight() exp2=DataArrayDouble([1.8411952639521971,1.5297058540778357,1.4352700094407325,2.0273134932713295,1.7492855684535902,1.2206555615733703,1.3638181696985856,0.9,1.4866068747318506,1.3379088160259651,0.8602325267042626,0.6782329983125266,1.5842979517754858,1.208304597359457,1.47648230602334,1.47648230602334,1.47648230602334,1.47648230602334,1.47648230602334,1.7029386365926402,1.7029386365926402,1.7029386365926402,1.7029386365926402,1.7029386365926402,1.3601470508735445,1.3601470508735445,1.3601470508735445,1.3601470508735445,1.3601470508735445,1.70293863659264,1.70293863659264,1.70293863659264,1.70293863659264,1.70293863659264,1.3601470508735445,1.3601470508735445,1.3601470508735445,1.3601470508735445,1.3601470508735445,1.063014581273465,1.063014581273465,1.063014581273465,1.063014581273465,1.063014581273465,1.0,1.0,1.0,1.0,1.0,1.5556349186104046,1.5556349186104046,1.5556349186104046,1.5556349186104046,1.5556349186104046,1.3601470508735443,1.3601470508735443,1.3601470508735443,1.3601470508735443,1.3601470508735443,0.9219544457292886,0.9219544457292886,0.9219544457292886,0.9219544457292886,0.9219544457292886,1.140175425099138,1.140175425099138,1.140175425099138,1.140175425099138,1.140175425099138,0.5,0.5,0.5,0.5,0.5,1.2529964086141667,1.2529964086141667,1.2529964086141667,1.2529964086141667,1.2529964086141667]) self.assertTrue(exp2.isEqual(f.getArray(),1e-12)) # TRI3 - spacedim = 2 @@ -4187,7 +4187,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): m=MEDCouplingCurveLinearMesh() m.setCoords(arr) m.setNodeGridStructure([3,2]) - m.checkCoherency() + m.checkConsistencyLight() self.assertEqual(m.getMeshDimension(),2) self.assertEqual(m.getSpaceDimension(),2) self.assertTrue(not "mismatch" in m.__str__()) @@ -4202,15 +4202,15 @@ class MEDCouplingBasicsTest5(unittest.TestCase): pass def testSwig2BugComputeOffsets1(self): - """Non regression test. computeOffsets2 on empty array must return 0.""" + """Non regression test. computeOffsetsFull on empty array must return 0.""" d=DataArrayInt([3]) - d.computeOffsets2() + d.computeOffsetsFull() self.assertTrue(d.isEqual(DataArrayInt([0,3]))) d=DataArrayInt([]) d.computeOffsets() self.assertTrue(d.isEqual(DataArrayInt([]))) d=DataArrayInt([]) - d.computeOffsets2() + d.computeOffsetsFull() self.assertTrue(d.isEqual(DataArrayInt([0]))) # <- bug was here pass diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index 82e8d898f..c81baf3b5 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -30,7 +30,7 @@ %{ #include "MEDCouplingMemArray.hxx" #include "MEDCouplingUMesh.hxx" -#include "MEDCouplingExtrudedMesh.hxx" +#include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingCMesh.hxx" #include "MEDCouplingIMesh.hxx" #include "MEDCouplingCurveLinearMesh.hxx" @@ -39,7 +39,7 @@ #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingFieldTemplate.hxx" #include "MEDCouplingGaussLocalization.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "MEDCouplingMultiFields.hxx" #include "MEDCouplingFieldOverTime.hxx" #include "MEDCouplingDefinitionTime.hxx" @@ -207,7 +207,7 @@ using namespace INTERP_KERNEL; %newobject MEDCoupling::MEDCouplingFieldDouble::DivideFields; %newobject MEDCoupling::MEDCouplingFieldDouble::min; %newobject MEDCoupling::MEDCouplingFieldDouble::negate; -%newobject MEDCoupling::MEDCouplingFieldDouble::getIdsInRange; +%newobject MEDCoupling::MEDCouplingFieldDouble::findIdsInRange; %newobject MEDCoupling::MEDCouplingFieldDouble::buildSubPart; %newobject MEDCoupling::MEDCouplingFieldDouble::buildSubPartRange; %newobject MEDCoupling::MEDCouplingFieldDouble::__getitem__; @@ -223,13 +223,13 @@ using namespace INTERP_KERNEL; %newobject MEDCoupling::MEDCouplingFieldDouble::__rdiv__; %newobject MEDCoupling::MEDCouplingFieldDouble::clone; %newobject MEDCoupling::MEDCouplingFieldDouble::cloneWithMesh; -%newobject MEDCoupling::MEDCouplingFieldDouble::deepCpy; +%newobject MEDCoupling::MEDCouplingFieldDouble::deepCopy; %newobject MEDCoupling::MEDCouplingFieldDouble::buildNewTimeReprFromThis; %newobject MEDCoupling::MEDCouplingFieldDouble::nodeToCellDiscretization; %newobject MEDCoupling::MEDCouplingFieldDouble::cellToNodeDiscretization; %newobject MEDCoupling::MEDCouplingFieldDouble::getValueOnMulti; %newobject MEDCoupling::MEDCouplingFieldTemplate::New; -%newobject MEDCoupling::MEDCouplingMesh::deepCpy; +%newobject MEDCoupling::MEDCouplingMesh::deepCopy; %newobject MEDCoupling::MEDCouplingMesh::clone; %newobject MEDCoupling::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith; %newobject MEDCoupling::MEDCouplingMesh::checkTypeConsistencyAndContig; @@ -239,14 +239,14 @@ using namespace INTERP_KERNEL; %newobject MEDCoupling::MEDCouplingMesh::buildPartRange; %newobject MEDCoupling::MEDCouplingMesh::giveCellsWithType; %newobject MEDCoupling::MEDCouplingMesh::getCoordinatesAndOwner; -%newobject MEDCoupling::MEDCouplingMesh::getBarycenterAndOwner; +%newobject MEDCoupling::MEDCouplingMesh::computeCellCenterOfMass; %newobject MEDCoupling::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell; %newobject MEDCoupling::MEDCouplingMesh::buildOrthogonalField; %newobject MEDCoupling::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds; %newobject MEDCoupling::MEDCouplingMesh::mergeMyselfWith; %newobject MEDCoupling::MEDCouplingMesh::fillFromAnalytic; -%newobject MEDCoupling::MEDCouplingMesh::fillFromAnalytic2; -%newobject MEDCoupling::MEDCouplingMesh::fillFromAnalytic3; +%newobject MEDCoupling::MEDCouplingMesh::fillFromAnalyticCompo; +%newobject MEDCoupling::MEDCouplingMesh::fillFromAnalyticNamedCompo; %newobject MEDCoupling::MEDCouplingMesh::getMeasureField; %newobject MEDCoupling::MEDCouplingMesh::simplexize; %newobject MEDCoupling::MEDCouplingMesh::buildUnstructured; @@ -256,13 +256,13 @@ using namespace INTERP_KERNEL; %newobject MEDCoupling::MEDCouplingPointSet::findBoundaryNodes; %newobject MEDCoupling::MEDCouplingPointSet::buildBoundaryMesh; %newobject MEDCoupling::MEDCouplingPointSet::MergeNodesArray; -%newobject MEDCoupling::MEDCouplingPointSet::buildPartOfMySelf2; +%newobject MEDCoupling::MEDCouplingPointSet::buildPartOfMySelfSlice; %newobject MEDCoupling::MEDCouplingPointSet::BuildInstanceFromMeshType; %newobject MEDCoupling::MEDCouplingPointSet::zipConnectivityTraducer; %newobject MEDCoupling::MEDCouplingPointSet::mergeMyselfWithOnSameCoords; %newobject MEDCoupling::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds; %newobject MEDCoupling::MEDCouplingPointSet::getCellIdsLyingOnNodes; -%newobject MEDCoupling::MEDCouplingPointSet::deepCpyConnectivityOnly; +%newobject MEDCoupling::MEDCouplingPointSet::deepCopyConnectivityOnly; %newobject MEDCoupling::MEDCouplingPointSet::getBoundingBoxForBBTree; %newobject MEDCoupling::MEDCouplingPointSet::computeFetchedNodeIds; %newobject MEDCoupling::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells; @@ -336,8 +336,8 @@ using namespace INTERP_KERNEL; %newobject MEDCoupling::MEDCoupling1DGTUMesh::buildSetInstanceFromThis; %newobject MEDCoupling::MEDCoupling1DGTUMesh::Merge1DGTUMeshes; %newobject MEDCoupling::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords; -%newobject MEDCoupling::MEDCouplingExtrudedMesh::New; -%newobject MEDCoupling::MEDCouplingExtrudedMesh::build3DUnstructuredMesh; +%newobject MEDCoupling::MEDCouplingMappedExtrudedMesh::New; +%newobject MEDCoupling::MEDCouplingMappedExtrudedMesh::build3DUnstructuredMesh; %newobject MEDCoupling::MEDCouplingStructuredMesh::buildStructuredSubPart; %newobject MEDCoupling::MEDCouplingStructuredMesh::build1SGTUnstructured; %newobject MEDCoupling::MEDCouplingStructuredMesh::build1SGTSubLevelMesh; @@ -356,11 +356,11 @@ using namespace INTERP_KERNEL; %newobject MEDCoupling::MEDCouplingCurveLinearMesh::New; %newobject MEDCoupling::MEDCouplingCurveLinearMesh::getCoords; %newobject MEDCoupling::MEDCouplingMultiFields::New; -%newobject MEDCoupling::MEDCouplingMultiFields::deepCpy; +%newobject MEDCoupling::MEDCouplingMultiFields::deepCopy; %newobject MEDCoupling::MEDCouplingFieldOverTime::New; %newobject MEDCoupling::MEDCouplingCartesianAMRPatchGen::getMesh; %newobject MEDCoupling::MEDCouplingCartesianAMRPatchGen::__getitem__; -%newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::deepCpy; +%newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::deepCopy; %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildUnstructured; %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::extractGhostFrom; %newobject MEDCoupling::MEDCouplingCartesianAMRMeshGen::buildMeshFromPatchEnvelop; @@ -377,7 +377,7 @@ using namespace INTERP_KERNEL; %newobject MEDCoupling::MEDCouplingCartesianAMRMesh::New; %newobject MEDCoupling::MEDCouplingDataForGodFather::getMyGodFather; %newobject MEDCoupling::MEDCouplingAMRAttribute::New; -%newobject MEDCoupling::MEDCouplingAMRAttribute::deepCpy; +%newobject MEDCoupling::MEDCouplingAMRAttribute::deepCopy; %newobject MEDCoupling::MEDCouplingAMRAttribute::deepCpyWithoutGodFather; %newobject MEDCoupling::MEDCouplingAMRAttribute::getFieldOn; %newobject MEDCoupling::MEDCouplingAMRAttribute::projectTo; @@ -385,7 +385,7 @@ using namespace INTERP_KERNEL; %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnWithGhost; %newobject MEDCoupling::MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost; %newobject MEDCoupling::DenseMatrix::New; -%newobject MEDCoupling::DenseMatrix::deepCpy; +%newobject MEDCoupling::DenseMatrix::deepCopy; %newobject MEDCoupling::DenseMatrix::shallowCpy; %newobject MEDCoupling::DenseMatrix::getData; %newobject MEDCoupling::DenseMatrix::matVecMult; @@ -407,7 +407,7 @@ using namespace INTERP_KERNEL; %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();" %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();" %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();" -%feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();" +%feature("unref") MEDCouplingMappedExtrudedMesh "$this->decrRef();" %feature("unref") MEDCouplingCMesh "$this->decrRef();" %feature("unref") MEDCouplingIMesh "$this->decrRef();" %feature("unref") MEDCouplingCurveLinearMesh "$this->decrRef();" @@ -553,21 +553,21 @@ namespace MEDCoupling std::string getTimeUnit() const; virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception); bool isStructured() const throw(INTERP_KERNEL::Exception); - virtual MEDCouplingMesh *deepCpy() const throw(INTERP_KERNEL::Exception); + virtual MEDCouplingMesh *deepCopy() const throw(INTERP_KERNEL::Exception); virtual MEDCouplingMesh *clone(bool recDeepCpy) const throw(INTERP_KERNEL::Exception); virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception); virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception); virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception); virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception); virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception); - virtual void checkCoherency() const throw(INTERP_KERNEL::Exception); - virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception); + virtual void checkConsistencyLight() const throw(INTERP_KERNEL::Exception); + virtual void checkConsistency(double eps=1e-12) const throw(INTERP_KERNEL::Exception); virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception); virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception); virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception); virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception); virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception); - virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception); + virtual DataArrayDouble *computeCellCenterOfMass() const throw(INTERP_KERNEL::Exception); virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception); virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception); virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception); @@ -585,8 +585,8 @@ namespace MEDCoupling virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception); virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception); virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception); - virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception); - virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception); + virtual MEDCouplingFieldDouble *fillFromAnalyticCompo(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception); + virtual MEDCouplingFieldDouble *fillFromAnalyticNamedCompo(TypeOfField t, int nbOfComp, const std::vector& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception); virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception); virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception); virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception); @@ -641,7 +641,7 @@ namespace MEDCoupling int spaceDim=self->getSpaceDimension(); const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : "; const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true); - MEDCouplingAutoRefCountObjectPtr elts,eltsIndex; + MCAuto elts,eltsIndex; self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); @@ -651,7 +651,7 @@ namespace MEDCoupling PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception) { - MEDCouplingAutoRefCountObjectPtr elts,eltsIndex; + MCAuto elts,eltsIndex; int spaceDim=self->getSpaceDimension(); void *da=0; int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 ); @@ -706,8 +706,8 @@ namespace MEDCoupling virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception) { - MEDCouplingAutoRefCountObjectPtr d0=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr d1=DataArrayInt::New(); + MCAuto d0=DataArrayInt::New(); + MCAuto d1=DataArrayInt::New(); self->getReverseNodalConnectivity(d0,d1); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); @@ -1123,7 +1123,7 @@ namespace MEDCoupling int getDimension() const throw(INTERP_KERNEL::Exception); int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception); std::string getStringRepr() const throw(INTERP_KERNEL::Exception); - void checkCoherency() const throw(INTERP_KERNEL::Exception); + void checkConsistencyLight() const throw(INTERP_KERNEL::Exception); bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const throw(INTERP_KERNEL::Exception); // const std::vector& getRefCoords() const throw(INTERP_KERNEL::Exception); @@ -1183,7 +1183,7 @@ namespace MEDCoupling void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception); void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception); virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception); - virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception); + virtual MEDCouplingPointSet *buildPartOfMySelfSlice(int start, int end, int step) const throw(INTERP_KERNEL::Exception); virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception); static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception); static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception); @@ -1198,7 +1198,7 @@ namespace MEDCoupling virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception); virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception); virtual bool isEmptyMesh(const std::vector& tinyInfo) const throw(INTERP_KERNEL::Exception); - virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception); + virtual MEDCouplingPointSet *deepCopyConnectivityOnly() const throw(INTERP_KERNEL::Exception); virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception); virtual void renumberNodesWithOffsetInConn(int offset) throw(INTERP_KERNEL::Exception); virtual bool areAllNodesFetched() const throw(INTERP_KERNEL::Exception); @@ -1289,9 +1289,9 @@ namespace MEDCoupling return convertMesh(ret, SWIG_POINTER_OWN | 0 ); } - virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception) + virtual PyObject *buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const throw(INTERP_KERNEL::Exception) { - MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step); + MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoordsSlice(start,end,step); return convertMesh(ret, SWIG_POINTER_OWN | 0 ); } @@ -1320,12 +1320,12 @@ namespace MEDCoupling self->renumberNodes(tmp,newNbOfNodes); } - void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception) + void renumberNodesCenter(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception) { int szArr,sw,iTypppArr; std::vector stdvecTyyppArr; const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr); - self->renumberNodes2(tmp,newNbOfNodes); + self->renumberNodesCenter(tmp,newNbOfNodes); } PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception) @@ -1519,11 +1519,11 @@ namespace MEDCoupling return res; } - virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception) + virtual PyObject *mergeNodesCenter(double precision) throw(INTERP_KERNEL::Exception) { bool ret1; int ret2; - DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2); + DataArrayInt *ret0=self->mergeNodesCenter(precision,ret1,ret2); PyObject *res = PyList_New(3); PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); PyList_SetItem(res,1,SWIG_From_bool(ret1)); @@ -1593,7 +1593,7 @@ namespace MEDCoupling } case 3: { - return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true); + return self->buildPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,true); } case 4: { @@ -1757,15 +1757,15 @@ namespace MEDCoupling public: static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception); static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception); - void checkCoherency() const throw(INTERP_KERNEL::Exception); + void checkConsistencyLight() const throw(INTERP_KERNEL::Exception); void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception); void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception); void finishInsertingCells() throw(INTERP_KERNEL::Exception); MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception); void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception); INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception); - void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception); - int getMeshLength() const throw(INTERP_KERNEL::Exception); + void setPartOfMySelfSlice(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception); + int getNodalConnectivityArrayLen() const throw(INTERP_KERNEL::Exception); void computeTypes() throw(INTERP_KERNEL::Exception); std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception); @@ -1969,7 +1969,7 @@ namespace MEDCoupling } case 3: { - self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis); + self->setPartOfMySelfSlice(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis); break; } case 4: @@ -2335,30 +2335,30 @@ namespace MEDCoupling return ret; } - static PyObject *ExtractFromIndexedArrays2(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception) + static PyObject *ExtractFromIndexedArraysSlice(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception) { DataArrayInt *arrOut=0,*arrIndexOut=0; - MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut); + MEDCouplingUMesh::ExtractFromIndexedArraysSlice(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); return ret; } - static PyObject *ExtractFromIndexedArrays2(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception) + static PyObject *ExtractFromIndexedArraysSlice(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception) { if(!PySlice_Check(slic)) - throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : the first param is not a pyslice !"); + throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : the first param is not a pyslice !"); Py_ssize_t strt=2,stp=2,step=2; PySliceObject *sliC=reinterpret_cast(slic); if(!arrIndxIn) - throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : last array is null !"); + throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : last array is null !"); arrIndxIn->checkAllocated(); if(arrIndxIn->getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : number of components of last argument must be equal to one !"); - GetIndicesOfSlice(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArrays2 (wrap) : Invalid slice regarding nb of elements !"); + throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : number of components of last argument must be equal to one !"); + GetIndicesOfSlice(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArraysSlice (wrap) : Invalid slice regarding nb of elements !"); DataArrayInt *arrOut=0,*arrIndexOut=0; - MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut); + MEDCouplingUMesh::ExtractFromIndexedArraysSlice(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); @@ -2509,10 +2509,10 @@ namespace MEDCoupling return ret; } - PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception) + PyObject *areCellsIncludedInPolicy7(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception) { DataArrayInt *ret1; - bool ret0=self->areCellsIncludedIn2(other,ret1); + bool ret0=self->areCellsIncludedInPolicy7(other,ret1); PyObject *ret=PyTuple_New(2); PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py); @@ -2523,10 +2523,10 @@ namespace MEDCoupling PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception) { - MEDCouplingAutoRefCountObjectPtr d0=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr d1=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr d2=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr d3=DataArrayInt::New(); + MCAuto d0=DataArrayInt::New(); + MCAuto d1=DataArrayInt::New(); + MCAuto d2=DataArrayInt::New(); + MCAuto d3=DataArrayInt::New(); MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3); PyObject *ret=PyTuple_New(5); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); @@ -2539,10 +2539,10 @@ namespace MEDCoupling PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception) { - MEDCouplingAutoRefCountObjectPtr d0=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr d1=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr d2=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr d3=DataArrayInt::New(); + MCAuto d0=DataArrayInt::New(); + MCAuto d1=DataArrayInt::New(); + MCAuto d2=DataArrayInt::New(); + MCAuto d3=DataArrayInt::New(); MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3); PyObject *ret=PyTuple_New(5); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); @@ -2555,10 +2555,10 @@ namespace MEDCoupling PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception) { - MEDCouplingAutoRefCountObjectPtr d0=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr d1=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr d2=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr d3=DataArrayInt::New(); + MCAuto d0=DataArrayInt::New(); + MCAuto d1=DataArrayInt::New(); + MCAuto d2=DataArrayInt::New(); + MCAuto d3=DataArrayInt::New(); MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3); PyObject *ret=PyTuple_New(5); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); @@ -2601,8 +2601,8 @@ namespace MEDCoupling PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh) { - MEDCouplingAutoRefCountObjectPtr d0=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr d1=DataArrayInt::New(); + MCAuto d0=DataArrayInt::New(); + MCAuto d1=DataArrayInt::New(); DataArrayInt *d2,*d3,*d4,*dd5; MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5); PyObject *ret=PyTuple_New(7); @@ -2792,27 +2792,27 @@ namespace MEDCoupling //== MEDCouplingUMesh End - //== MEDCouplingExtrudedMesh + //== MEDCouplingMappedExtrudedMesh - class MEDCouplingExtrudedMesh : public MEDCoupling::MEDCouplingMesh + class MEDCouplingMappedExtrudedMesh : public MEDCoupling::MEDCouplingMesh { public: - static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception); + static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception); %extend { - MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception) + MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception) { - return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId); + return MEDCouplingMappedExtrudedMesh::New(mesh3D,mesh2D,cell2DId); } - MEDCouplingExtrudedMesh() + MEDCouplingMappedExtrudedMesh() { - return MEDCouplingExtrudedMesh::New(); + return MEDCouplingMappedExtrudedMesh::New(); } static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception) { - return NewMethWrapCallInitOnlyIfEmptyDictInInput(cls,args,"MEDCouplingExtrudedMesh"); + return NewMethWrapCallInitOnlyIfEmptyDictInInput(cls,args,"MEDCouplingMappedExtrudedMesh"); } std::string __str__() const throw(INTERP_KERNEL::Exception) @@ -2851,7 +2851,7 @@ namespace MEDCoupling } }; - //== MEDCouplingExtrudedMesh End + //== MEDCouplingMappedExtrudedMesh End class MEDCoupling1GTUMesh : public MEDCoupling::MEDCouplingPointSet { @@ -2861,7 +2861,7 @@ namespace MEDCoupling INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception); int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception); virtual void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception); - virtual void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception); + virtual void checkConsistencyOfConnectivity() const throw(INTERP_KERNEL::Exception); %extend { virtual void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception) @@ -3559,7 +3559,7 @@ namespace MEDCoupling class MEDCouplingField : public MEDCoupling::RefCountObject, public MEDCoupling::TimeLabel { public: - virtual void checkCoherency() const throw(INTERP_KERNEL::Exception); + virtual void checkConsistencyLight() const throw(INTERP_KERNEL::Exception); virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception); virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception); virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception); @@ -3761,8 +3761,8 @@ namespace MEDCoupling std::string writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *clone(bool recDeepCpy) const; MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const; - MEDCouplingFieldDouble *deepCpy() const; - MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception); + MEDCouplingFieldDouble *deepCopy() const; + MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *cellToNodeDiscretization() const throw(INTERP_KERNEL::Exception); TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception); @@ -3790,7 +3790,7 @@ namespace MEDCoupling void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception); void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception); bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception); - bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception); + bool mergeNodesCenter(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception); bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception); bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception); bool simplexize(int policy) throw(INTERP_KERNEL::Exception); @@ -3807,11 +3807,11 @@ namespace MEDCoupling void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception); void fillFromAnalytic(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception); - void fillFromAnalytic2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception); - void fillFromAnalytic3(int nbOfComp, const std::vector& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception); + void fillFromAnalyticCompo(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception); + void fillFromAnalyticNamedCompo(int nbOfComp, const std::vector& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception); void applyFunc(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception); - void applyFunc2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception); - void applyFunc3(int nbOfComp, const std::vector& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception); + void applyFuncCompo(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception); + void applyFuncNamedCompo(int nbOfComp, const std::vector& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception); void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception); void applyFunc(const std::string& func) throw(INTERP_KERNEL::Exception); void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception); @@ -3827,7 +3827,7 @@ namespace MEDCoupling double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception); double normL1(int compId) const throw(INTERP_KERNEL::Exception); double normL2(int compId) const throw(INTERP_KERNEL::Exception); - DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception); + DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception); static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception); static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception); @@ -3980,7 +3980,7 @@ namespace MEDCoupling MEDCoupling_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp); else { - MEDCouplingAutoRefCountObjectPtr arr=DataArrayDouble::New(); + MCAuto arr=DataArrayDouble::New(); MEDCoupling_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp); self->setArray(arr); } @@ -4164,7 +4164,7 @@ namespace MEDCoupling { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); } catch(INTERP_KERNEL::Exception& e) { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDCouplingAutoRefCountObjectPtr ret0=MEDCoupling_MEDCouplingFieldDouble_buildSubPart(self,elt0); + MCAuto ret0=MEDCoupling_MEDCouplingFieldDouble_buildSubPart(self,elt0); DataArrayDouble *ret0Arr=ret0->getArray(); if(!ret0Arr) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !"); @@ -4173,13 +4173,13 @@ namespace MEDCoupling case 1: { std::vector v2(1,singleVal); - MEDCouplingAutoRefCountObjectPtr aarr(ret0Arr->keepSelectedComponents(v2)); + MCAuto aarr(ret0Arr->keepSelectedComponents(v2)); ret0->setArray(aarr); return ret0.retn(); } case 2: { - MEDCouplingAutoRefCountObjectPtr aarr(ret0Arr->keepSelectedComponents(multiVal)); + MCAuto aarr(ret0Arr->keepSelectedComponents(multiVal)); ret0->setArray(aarr); return ret0.retn(); } @@ -4189,7 +4189,7 @@ namespace MEDCoupling std::vector v2(nbOfComp); for(int i=0;i aarr(ret0Arr->keepSelectedComponents(v2)); + MCAuto aarr(ret0Arr->keepSelectedComponents(v2)); ret0->setArray(aarr); return ret0.retn(); } @@ -4289,9 +4289,9 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr ret=self->getArray()->deepCpy(); + MCAuto ret=self->getArray()->deepCopy(); ret->applyLin(1.,-val); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -4299,8 +4299,8 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::Substract(self->getArray(),a); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto ret=DataArrayDouble::Substract(self->getArray(),a); + MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -4308,9 +4308,9 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::Substract(self->getArray(),aaa); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto ret=DataArrayDouble::Substract(self->getArray(),aaa); + MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -4318,9 +4318,9 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::Substract(self->getArray(),aaa); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto ret=DataArrayDouble::Substract(self->getArray(),aaa); + MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -4373,9 +4373,9 @@ namespace MEDCoupling throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !"); if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr ret=self->getArray()->deepCpy(); + MCAuto ret=self->getArray()->deepCopy(); ret->applyLin(1./val,0); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -4383,8 +4383,8 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::Divide(self->getArray(),a); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto ret=DataArrayDouble::Divide(self->getArray(),a); + MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -4392,9 +4392,9 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::Divide(self->getArray(),aaa); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto ret=DataArrayDouble::Divide(self->getArray(),aaa); + MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -4402,9 +4402,9 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::Divide(self->getArray(),aaa); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto ret=DataArrayDouble::Divide(self->getArray(),aaa); + MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -4445,9 +4445,9 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr ret=self->getArray()->deepCpy(); + MCAuto ret=self->getArray()->deepCopy(); ret->applyPow(val); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -4455,8 +4455,8 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::Pow(self->getArray(),a); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto ret=DataArrayDouble::Pow(self->getArray(),a); + MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -4464,9 +4464,9 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::Pow(self->getArray(),aaa); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto ret=DataArrayDouble::Pow(self->getArray(),aaa); + MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -4474,9 +4474,9 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::Pow(self->getArray(),aaa); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto ret=DataArrayDouble::Pow(self->getArray(),aaa); + MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -4527,7 +4527,7 @@ namespace MEDCoupling } case 2: { - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto ret2=self->clone(false); ret2->setArray(a); *self+=*ret2; Py_XINCREF(trueSelf); @@ -4535,8 +4535,8 @@ namespace MEDCoupling } case 3: { - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto ret2=self->clone(false); ret2->setArray(aaa); *self+=*ret2; Py_XINCREF(trueSelf); @@ -4546,7 +4546,7 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); self->getArray()->addEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -4593,7 +4593,7 @@ namespace MEDCoupling } case 2: { - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto ret2=self->clone(false); ret2->setArray(a); *self-=*ret2; Py_XINCREF(trueSelf); @@ -4601,8 +4601,8 @@ namespace MEDCoupling } case 3: { - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto ret2=self->clone(false); ret2->setArray(aaa); *self-=*ret2; Py_XINCREF(trueSelf); @@ -4612,7 +4612,7 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); self->getArray()->substractEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -4659,7 +4659,7 @@ namespace MEDCoupling } case 2: { - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto ret2=self->clone(false); ret2->setArray(a); *self*=*ret2; Py_XINCREF(trueSelf); @@ -4667,8 +4667,8 @@ namespace MEDCoupling } case 3: { - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto ret2=self->clone(false); ret2->setArray(aaa); *self*=*ret2; Py_XINCREF(trueSelf); @@ -4678,7 +4678,7 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); self->getArray()->multiplyEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -4727,7 +4727,7 @@ namespace MEDCoupling } case 2: { - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto ret2=self->clone(false); ret2->setArray(a); *self/=*ret2; Py_XINCREF(trueSelf); @@ -4735,8 +4735,8 @@ namespace MEDCoupling } case 3: { - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto ret2=self->clone(false); ret2->setArray(aaa); *self/=*ret2; Py_XINCREF(trueSelf); @@ -4746,7 +4746,7 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); self->getArray()->divideEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -4793,7 +4793,7 @@ namespace MEDCoupling } case 2: { - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto ret2=self->clone(false); ret2->setArray(a); *self^=*ret2; Py_XINCREF(trueSelf); @@ -4801,8 +4801,8 @@ namespace MEDCoupling } case 3: { - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto ret2=self->clone(false); ret2->setArray(aaa); *self^=*ret2; Py_XINCREF(trueSelf); @@ -4812,7 +4812,7 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); self->getArray()->powEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -4914,7 +4914,7 @@ namespace MEDCoupling PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception) {// put an empty dict in input to say to __new__ to call __init__... - self->checkCoherency(); + self->checkConsistencyLight(); PyObject *ret(PyTuple_New(1)); PyObject *ret0(PyDict_New()); { @@ -4929,7 +4929,7 @@ namespace MEDCoupling PyObject *__getstate__() const throw(INTERP_KERNEL::Exception) { - self->checkCoherency(); + self->checkConsistencyLight(); PyObject *ret0(MEDCoupling_MEDCouplingFieldDouble_getTinySerializationInformation(self)); PyObject *ret1(MEDCoupling_MEDCouplingFieldDouble_serialize(self)); const MEDCouplingMesh *mesh(self->getMesh()); @@ -4996,12 +4996,12 @@ namespace MEDCoupling { public: int getNumberOfFields() const; - MEDCouplingMultiFields *deepCpy() const; + MEDCouplingMultiFields *deepCopy() const; virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception); virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception); virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const; virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const; - virtual void checkCoherency() const throw(INTERP_KERNEL::Exception); + virtual void checkConsistencyLight() const throw(INTERP_KERNEL::Exception); %extend { std::string __str__() const throw(INTERP_KERNEL::Exception) @@ -5376,9 +5376,9 @@ namespace MEDCoupling } // agy : don't know why typemap fails here ??? let it in the extend section - PyObject *deepCpy(MEDCouplingCartesianAMRMeshGen *father) const throw(INTERP_KERNEL::Exception) + PyObject *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const throw(INTERP_KERNEL::Exception) { - return convertCartesianAMRMesh(self->deepCpy(father), SWIG_POINTER_OWN | 0 ); + return convertCartesianAMRMesh(self->deepCopy(father), SWIG_POINTER_OWN | 0 ); } MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector& pos) const throw(INTERP_KERNEL::Exception) @@ -5578,7 +5578,7 @@ namespace MEDCoupling { public: int getNumberOfLevels() const throw(INTERP_KERNEL::Exception); - MEDCouplingAMRAttribute *deepCpy() const throw(INTERP_KERNEL::Exception); + MEDCouplingAMRAttribute *deepCopy() const throw(INTERP_KERNEL::Exception); MEDCouplingAMRAttribute *deepCpyWithoutGodFather() const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *buildCellFieldOnWithGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const throw(INTERP_KERNEL::Exception); @@ -5656,7 +5656,7 @@ namespace MEDCoupling public: static DenseMatrix *New(int nbRows, int nbCols) throw(INTERP_KERNEL::Exception); static DenseMatrix *New(DataArrayDouble *array, int nbRows, int nbCols) throw(INTERP_KERNEL::Exception); - DenseMatrix *deepCpy() const throw(INTERP_KERNEL::Exception); + DenseMatrix *deepCopy() const throw(INTERP_KERNEL::Exception); DenseMatrix *shallowCpy() const throw(INTERP_KERNEL::Exception); // int getNumberOfRows() const throw(INTERP_KERNEL::Exception); @@ -5753,7 +5753,7 @@ namespace MEDCoupling virtual int getNumberOfElems() const throw(INTERP_KERNEL::Exception); virtual std::string getRepr() const throw(INTERP_KERNEL::Exception); virtual PartDefinition *composeWith(const PartDefinition *other) const throw(INTERP_KERNEL::Exception); - virtual void checkCoherency() const throw(INTERP_KERNEL::Exception); + virtual void checkConsistencyLight() const throw(INTERP_KERNEL::Exception); virtual PartDefinition *tryToSimplify() const throw(INTERP_KERNEL::Exception); %extend { @@ -5774,9 +5774,9 @@ namespace MEDCoupling return ret; } - virtual PyObject *deepCpy() const throw(INTERP_KERNEL::Exception) + virtual PyObject *deepCopy() const throw(INTERP_KERNEL::Exception) { - return convertPartDefinition(self->deepCpy(),SWIG_POINTER_OWN | 0); + return convertPartDefinition(self->deepCopy(),SWIG_POINTER_OWN | 0); } } protected: diff --git a/src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i b/src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i index cbd924d82..1971f90fb 100644 --- a/src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i +++ b/src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i @@ -283,7 +283,7 @@ MCData *BuildNewInstance(PyObject *elt0, int npyObjectType, PyTypeObject *pytype if(itemSize!=PyArray_STRIDE(elt0,1)) throw INTERP_KERNEL::Exception("Input numpy array has stride that mismatches the item size ! Data are not packed in the right way for DataArrays for component #1 !"); const char *data=PyArray_BYTES(elt0); - typename MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret=MCData::New(); + typename MEDCoupling::MCAuto ret=MCData::New(); if(PyArray_ISBEHAVED(elt0))//aligned and writeable and in machine byte-order { PyArrayObject *elt0C=reinterpret_cast(elt0); @@ -479,8 +479,8 @@ SWIGINTERN PyObject *MEDCoupling_DataArrayDouble_toNumPyArray(MEDCoupling::DataA PyObject *ToCSRMatrix(const std::vector >& m, int nbCols) throw(INTERP_KERNEL::Exception) { int nbRows((int)m.size()); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr indPtr(MEDCoupling::DataArrayInt::New()),indices(MEDCoupling::DataArrayInt::New()); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr data(MEDCoupling::DataArrayDouble::New()); + MEDCoupling::MCAuto indPtr(MEDCoupling::DataArrayInt::New()),indices(MEDCoupling::DataArrayInt::New()); + MEDCoupling::MCAuto data(MEDCoupling::DataArrayDouble::New()); indPtr->alloc(nbRows+1,1); int *intPtr_ptr(indPtr->getPointer()); intPtr_ptr[0]=0; intPtr_ptr++; int sz2(0); diff --git a/src/MEDCoupling_Swig/MEDCouplingDataForTest.py b/src/MEDCoupling_Swig/MEDCouplingDataForTest.py index f88aad244..3b18754df 100644 --- a/src/MEDCoupling_Swig/MEDCouplingDataForTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingDataForTest.py @@ -341,7 +341,7 @@ class MEDCouplingDataForTest: myCoords=DataArrayDouble.New(); myCoords.setValues(coords,11,2); ret.setCoords(myCoords); - ret.checkCoherency(); + ret.checkConsistencyLight(); return ret; def build2DTargetMesh_4(cls): @@ -598,7 +598,7 @@ class MEDCouplingDataForTest: for i in xrange(30,36): m.insertNextCell(NORM_QUAD8,conn[i]) pass - fff=MEDCouplingFieldDouble.New(ON_GAUSS_PT) ; fff.setName("CH1RB") ; fff.setNature(ConservativeVolumic) + fff=MEDCouplingFieldDouble.New(ON_GAUSS_PT) ; fff.setName("CH1RB") ; fff.setNature(IntensiveMaximum) fff.setMesh(m) fff.setGaussLocalizationOnCells(range(0,12),[0.,0.,1.,0.,0.,1.],[0.3333333333333333,0.3333333333333333],[0.5]) fff.setGaussLocalizationOnCells(range(12,18),[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[-0.577350269189626,-0.577350269189626,0.577350269189626,-0.577350269189626,0.577350269189626,0.577350269189626,-0.577350269189626,0.577350269189626],[1.,1.,1.,1.]) @@ -627,7 +627,7 @@ class MEDCouplingDataForTest: for i in xrange(100,120): m.insertNextCell(NORM_QUAD8,conn[i]) pass - fff=MEDCouplingFieldDouble.New(ON_GAUSS_PT) ; fff.setName("CH2RB") ; fff.setNature(ConservativeVolumic) + fff=MEDCouplingFieldDouble.New(ON_GAUSS_PT) ; fff.setName("CH2RB") ; fff.setNature(IntensiveMaximum) fff.setMesh(m) fff.setGaussLocalizationOnCells(range(0,40),[0.,0.,1.,0.,0.,1.],[0.3333333333333333,0.3333333333333333],[0.5]) fff.setGaussLocalizationOnCells(range(40,60),[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[-0.577350269189626,-0.577350269189626,0.577350269189626,-0.577350269189626,0.577350269189626,0.577350269189626,-0.577350269189626,0.577350269189626],[1.,1.,1.,1.]) @@ -651,7 +651,7 @@ class MEDCouplingDataForTest: pass m.insertNextCell(NORM_HEXA8,conn[6]) m.insertNextCell(NORM_HEXA8,conn[7]) - fff=MEDCouplingFieldDouble.New(ON_GAUSS_PT) ; fff.setName("CH13") ; fff.setNature(ConservativeVolumic) + fff=MEDCouplingFieldDouble.New(ON_GAUSS_PT) ; fff.setName("CH13") ; fff.setNature(IntensiveMaximum) fff.setMesh(m) fff.setGaussLocalizationOnCells([0],[0.,1.,0.,0.,0.,0.,0.,0.,1.,1.,0.,0.],[0.25,0.25,0.25],[0.16666666666666666]) fff.setGaussLocalizationOnCells([1],[1.,0.,0.,0.,-1.,0.,-1.,0.,0.,0.,1.,0.,0.,0.,1.],[0.5,0.,0.1531754163448146,0.,0.5,0.1531754163448146,-0.5,0.,0.1531754163448146,0.,-0.5,0.1531754163448146,0.,0.,0.6372983346207416],[0.1333333333333333,0.1333333333333333,0.1333333333333333,0.1333333333333333,0.1333333333333333]) @@ -675,7 +675,7 @@ class MEDCouplingDataForTest: pass m.insertNextCell(NORM_HEXA8,conn[6]) m.insertNextCell(NORM_HEXA8,conn[7]) - fff=MEDCouplingFieldDouble.New(ON_GAUSS_PT) ; fff.setName("CH23") ; fff.setNature(ConservativeVolumic) + fff=MEDCouplingFieldDouble.New(ON_GAUSS_PT) ; fff.setName("CH23") ; fff.setNature(IntensiveMaximum) fff.setMesh(m) fff.setGaussLocalizationOnCells([0],[0.,1.,0.,0.,0.,0.,0.,0.,1.,1.,0.,0.],[0.25,0.25,0.25],[0.16666666666666666]) fff.setGaussLocalizationOnCells([1],[1.,0.,0.,0.,-1.,0.,-1.,0.,0.,0.,1.,0.,0.,0.,1.],[0.5,0.,0.1531754163448146,0.,0.5,0.1531754163448146,-0.5,0.,0.1531754163448146,0.,-0.5,0.1531754163448146,0.,0.,0.6372983346207416],[0.1333333333333333,0.1333333333333333,0.1333333333333333,0.1333333333333333,0.1333333333333333]) diff --git a/src/MEDCoupling_Swig/MEDCouplingExamplesTest.py b/src/MEDCoupling_Swig/MEDCouplingExamplesTest.py index 86ee5d767..549fab780 100644 --- a/src/MEDCoupling_Swig/MEDCouplingExamplesTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingExamplesTest.py @@ -110,7 +110,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): mesh1.allocateCells(0) mesh1.finishInsertingCells() # mesh 2 - mesh2=mesh1.deepCpy() + mesh2=mesh1.deepCopy() mesh2.getCoords().setValues(coords2, 4, 1) #! [PySnippet_MEDCouplingFieldDouble_substractInPlaceDM_1] #! [PySnippet_MEDCouplingFieldDouble_substractInPlaceDM_2] @@ -137,7 +137,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): mesh1.allocateCells(0) mesh1.finishInsertingCells() # mesh 2 - mesh2=mesh1.deepCpy() + mesh2=mesh1.deepCopy() mesh2.getCoords().setValues(coords2, 4, 1) #! [PySnippet_MEDCouplingFieldDouble_changeUnderlyingMesh_1] #! [PySnippet_MEDCouplingFieldDouble_changeUnderlyingMesh_2] @@ -177,7 +177,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): # transform the field to a 3D vector field func = "IVec * b + JVec * a + KVec * sqrt( a*a + b*b ) + 10" varNames=["a","b"] # names used to refer to X and Y components - field.applyFunc3( 3, varNames, func ) # require 3 components + field.applyFuncNamedCompo( 3, varNames, func ) # require 3 components self.assertTrue( field.getNumberOfComponents() == 3 ) # 3 components as required #! [PySnippet_MEDCouplingFieldDouble_applyFunc3_1] #! [PySnippet_MEDCouplingFieldDouble_applyFunc3_2] @@ -200,7 +200,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): field.setArray( array ) # transform the field to a 3D vector field func = "IVec * b + JVec * a + KVec * sqrt( a*a + b*b ) + 10" - field.applyFunc2( 3, func ) # require 3 components + field.applyFuncCompo( 3, func ) # require 3 components self.assertTrue( field.getNumberOfComponents() == 3 ) # 3 components as required #! [PySnippet_MEDCouplingFieldDouble_applyFunc2_1] #! [PySnippet_MEDCouplingFieldDouble_applyFunc2_2] @@ -265,13 +265,13 @@ class MEDCouplingBasicsTest(unittest.TestCase): field.setMesh( mesh ) func = "IVec * b + JVec * a + KVec * sqrt( a*a + b*b ) + 10" varNames=["a","b"] # names used to refer to X and Y coord components - field.fillFromAnalytic3(3,varNames,func) + field.fillFromAnalyticNamedCompo(3,varNames,func) #! [PySnippet_MEDCouplingFieldDouble_fillFromAnalytic3_2] #! [PySnippet_MEDCouplingFieldDouble_fillFromAnalytic3_3] vals1 = field.getArray().getTuple(1) # values of the cell #1 assert len( vals1 ) == 3 # 3 components in the field # - bc = mesh.getBarycenterAndOwner() # func is applied to barycenters of cells + bc = mesh.computeCellCenterOfMass() # func is applied to barycenters of cells bc1 = bc.getTuple(1) # coordinates of the second point # dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ) # "sqrt( a*a + b*b )" @@ -295,13 +295,13 @@ class MEDCouplingBasicsTest(unittest.TestCase): field = MEDCouplingFieldDouble( ON_CELLS ) field.setMesh( mesh ) func = "IVec * b + JVec * a + KVec * sqrt( a*a + b*b ) + 10" - field.fillFromAnalytic2(3,func) + field.fillFromAnalyticCompo(3,func) #! [PySnippet_MEDCouplingFieldDouble_fillFromAnalytic2_2] #! [PySnippet_MEDCouplingFieldDouble_fillFromAnalytic2_3] vals1 = field.getArray().getTuple(1) # values of the cell #1 assert len( vals1 ) == 3 # 3 components in the field # - bc = mesh.getBarycenterAndOwner() # func is applied to barycenters of cells + bc = mesh.computeCellCenterOfMass() # func is applied to barycenters of cells bc1 = bc.getTuple(1) # coordinates of the second point # dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ) # "sqrt( a*a + b*b )" @@ -329,7 +329,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): vals1 = field.getArray().getTuple(1) # values of the cell #1 assert len( vals1 ) == 3 # 3 components in the field # - bc = mesh.getBarycenterAndOwner() # func is applied to barycenters of cells + bc = mesh.computeCellCenterOfMass() # func is applied to barycenters of cells bc1 = bc.getTuple(1) # coordinates of the second point # dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ) # "sqrt( a*a + b*b )" @@ -371,7 +371,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): field = mesh.fillFromAnalytic(ON_CELLS,1,"x+y") #! [PySnippet_MEDCouplingFieldDouble_getValueOnMulti_1] #! [PySnippet_MEDCouplingFieldDouble_getValueOnMulti_2] - bc = mesh.getBarycenterAndOwner() # field values are located at cell barycenters + bc = mesh.computeCellCenterOfMass() # field values are located at cell barycenters valArray = field.getValueOnMulti( bc ) self.assertTrue( valArray.isEqual( field.getArray(), 1e-13 )) #! [PySnippet_MEDCouplingFieldDouble_getValueOnMulti_2] @@ -386,7 +386,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): field = mesh.fillFromAnalytic(ON_CELLS,1,"x+y") #! [PySnippet_MEDCouplingFieldDouble_getValueOn_1] #! [PySnippet_MEDCouplingFieldDouble_getValueOn_2] - bc = mesh.getBarycenterAndOwner() # field values are located at cell barycenters + bc = mesh.computeCellCenterOfMass() # field values are located at cell barycenters vals = [] # array to collect values returned by getValueOn() for i,tupl in enumerate( bc ): vals.extend( field.getValueOn( tupl ) ) @@ -404,7 +404,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): #! [PySnippet_MEDCouplingFieldDouble_getValueOnPos_1] #! [PySnippet_MEDCouplingFieldDouble_getValueOnPos_2] val11 = field.getValueOnPos( 1,1,-1) - bc = mesh.getBarycenterAndOwner() # field values are located at cell barycenters + bc = mesh.computeCellCenterOfMass() # field values are located at cell barycenters self.assertTrue( val11[0] == bc[3,0] + bc[3,1] ) #! [PySnippet_MEDCouplingFieldDouble_getValueOnPos_2] return @@ -445,7 +445,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): #! [PySnippet_MEDCouplingFieldDouble_renumberCells_2] field = mesh.fillFromAnalytic(ON_CELLS,2,"IVec*x+JVec*y") values = field.getArray() - bc = mesh.getBarycenterAndOwner() + bc = mesh.computeCellCenterOfMass() self.assertTrue( values.isEqualWithoutConsideringStr( bc, 1e-13 )) #! [PySnippet_MEDCouplingFieldDouble_renumberCells_2] #! [PySnippet_MEDCouplingFieldDouble_renumberCells_3] @@ -453,7 +453,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): field.renumberCells(renumber,False) mesh2 = field.getMesh() # field now refers to another mesh values = field.getArray() - bc = mesh2.getBarycenterAndOwner() + bc = mesh2.computeCellCenterOfMass() self.assertTrue( values.isEqualWithoutConsideringStr( bc, 1e-13 )) #! [PySnippet_MEDCouplingFieldDouble_renumberCells_3] return @@ -484,13 +484,13 @@ class MEDCouplingBasicsTest(unittest.TestCase): #! [PySnippet_MEDCouplingMesh_fillFromAnalytic3_2] func = "IVec * b + JVec * a + KVec * sqrt( a*a + b*b ) + 10" varNames=["a","b"] # names used to refer to X and Y coord components - field=mesh.fillFromAnalytic3(ON_CELLS,3,varNames,func) + field=mesh.fillFromAnalyticNamedCompo(ON_CELLS,3,varNames,func) #! [PySnippet_MEDCouplingMesh_fillFromAnalytic3_2] #! [PySnippet_MEDCouplingMesh_fillFromAnalytic3_3] vals1 = field.getArray().getTuple(1) # values of the cell #1 assert len( vals1 ) == 3 # 3 components in the field # - bc = mesh.getBarycenterAndOwner() # func is applied to barycenters of cells + bc = mesh.computeCellCenterOfMass() # func is applied to barycenters of cells bc1 = bc.getTuple(1) # coordinates of the second point # dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ) # "sqrt( a*a + b*b )" @@ -512,13 +512,13 @@ class MEDCouplingBasicsTest(unittest.TestCase): #! [PySnippet_MEDCouplingMesh_fillFromAnalytic2_1] #! [PySnippet_MEDCouplingMesh_fillFromAnalytic2_2] func = "IVec * b + JVec * a + KVec * sqrt( a*a + b*b ) + 10" - field=mesh.fillFromAnalytic2(ON_CELLS,3,func) + field=mesh.fillFromAnalyticCompo(ON_CELLS,3,func) #! [PySnippet_MEDCouplingMesh_fillFromAnalytic2_2] #! [PySnippet_MEDCouplingMesh_fillFromAnalytic2_3] vals1 = field.getArray().getTuple(1) # values of the cell #1 assert len( vals1 ) == 3 # 3 components in the field # - bc = mesh.getBarycenterAndOwner() # func is applied to barycenters of cells + bc = mesh.computeCellCenterOfMass() # func is applied to barycenters of cells bc1 = bc.getTuple(1) # coordinates of the second point # dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ) # "sqrt( a*a + b*b )" @@ -544,7 +544,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): vals1 = field.getArray().getTuple(1) # values of the cell #1 assert len( vals1 ) == 3 # 3 components in the field # - bc = mesh.getBarycenterAndOwner() # func is applied to barycenters of cells + bc = mesh.computeCellCenterOfMass() # func is applied to barycenters of cells bc1 = bc.getTuple(1) # coordinates of the second point # dist = sqrt( bc1[0]*bc1[0] + bc1[1]*bc1[1] ) # "sqrt( a*a + b*b )" @@ -603,7 +603,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): coords=[-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2] coordsArr=DataArrayDouble(coords,5,2) # coordinates of 5 top nodes - coordsArr2 = coordsArr.deepCpy() + coordsArr2 = coordsArr.deepCopy() # 3D coordinates of base + top nodes coordsArr = coordsArr.changeNbOfComponents( 3, 0 ) coordsArr2 = coordsArr2.changeNbOfComponents( 3, 1 ) @@ -633,7 +633,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): coords=[-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2] coordsArr=DataArrayDouble(coords,5,2) # coordinates of 5 top nodes - coordsArr2 = coordsArr.deepCpy() + coordsArr2 = coordsArr.deepCopy() # 3D coordinates of base + top nodes coordsArr = coordsArr.changeNbOfComponents( 3, 0 ) coordsArr2 = coordsArr2.changeNbOfComponents( 3, 1 ) @@ -859,7 +859,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): #! [PySnippet_MEDCouplingUMesh_renumberNodes_2] #! [PySnippet_MEDCouplingUMesh_renumberNodes_3] coordsArr.setValues(coords,4,2) # restore old nodes - mesh.renumberNodes2([ 2,1,0,2 ], 3) + mesh.renumberNodesCenter([ 2,1,0,2 ], 3) coordsArr = mesh.getCoords() # get a shorten array assert coordsArr.getValues() == [0.7,-0.3, 0.2,-0.3, -0.3,0.0] #! [PySnippet_MEDCouplingUMesh_renumberNodes_3] @@ -1079,8 +1079,8 @@ class MEDCouplingBasicsTest(unittest.TestCase): # restore coordinates coordsArr = DataArrayDouble(coords,6,2) mesh.setCoords(coordsArr) - # call mergeNodes2() - mesh.mergeNodes2(0.004) + # call mergeNodesCenter() + mesh.mergeNodesCenter(0.004) coordsArr = mesh.getCoords() # retrieve a new shorten coord array self.assertAlmostEqual( baryCoords2[1], coordsArr.getIJ(0,1), 13 ) # Y of node #0 equals to that of baryCoords2 #! [PySnippet_MEDCouplingUMesh_mergeNodes_3] @@ -1318,7 +1318,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): coordsArr=DataArrayDouble(coords,4,2) mesh=MEDCouplingUMesh() mesh.setCoords(coordsArr) - initCoords = coordsArr.deepCpy() + initCoords = coordsArr.deepCopy() #! [PySnippet_MEDCouplingPointSet_scale_1] #! [PySnippet_MEDCouplingPointSet_scale_2] center = [0.,0.] @@ -1338,7 +1338,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): coordsArr=DataArrayDouble(coords,4,2) mesh=MEDCouplingUMesh() mesh.setCoords(coordsArr) - initCoords = coordsArr.deepCpy() + initCoords = coordsArr.deepCopy() #! [PySnippet_MEDCouplingPointSet_translate_1] #! [PySnippet_MEDCouplingPointSet_translate_2] vector = [1.,1.] @@ -1525,7 +1525,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): da=DataArrayDouble() da.alloc( 10, 1 ) da[ :, :] = range(10) - da2 = da.getIdsInRange( 2.5, 6 ) + da2 = da.findIdsInRange( 2.5, 6 ) #! [PySnippet_DataArrayDouble_getIdsInRange_1] return @@ -1642,7 +1642,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): da.setPartOfValues1( dv, 0,3,2, 1,4,2, True ) #! [Snippet_DataArrayDouble_setPartOfValues1_5] #! [Snippet_DataArrayDouble_setPartOfValues1_6] - da2 = da.deepCpy() + da2 = da.deepCopy() da2.fillWithZero() da2[ 0:3:2, 1:4:2 ] = dv self.assertTrue( da.isEqual( da2, 1e-20 )) @@ -1678,7 +1678,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): da.setPartOfValues1( dv, 0,3,2, 1,4,2, True ) #! [Snippet_DataArrayInt_setPartOfValues1_5] #! [Snippet_DataArrayInt_setPartOfValues1_6] - da2 = da.deepCpy() + da2 = da.deepCopy() da2.fillWithZero() da2[ 0:3:2, 1:4:2 ] = dv self.assertTrue( da.isEqual( da2 )) @@ -1708,7 +1708,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): da.setPartOfValuesSimple1( dv, 0,3,2, 1,4,2 ) #! [Snippet_DataArrayDouble_setPartOfValuesSimple1_5] #! [Snippet_DataArrayDouble_setPartOfValuesSimple1_6] - da2 = da.deepCpy() + da2 = da.deepCopy() da2.fillWithZero() da2[ 0:3:2, 1:4:2 ] = dv self.assertTrue( da.isEqual( da2, 1e-20 )) @@ -1738,7 +1738,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): da.setPartOfValuesSimple1( dv, 0,3,2, 1,4,2 ) #! [Snippet_DataArrayInt_setPartOfValuesSimple1_5] #! [Snippet_DataArrayInt_setPartOfValuesSimple1_6] - da2 = da.deepCpy() + da2 = da.deepCopy() da2.fillWithZero() da2[ 0:3:2, 1:4:2 ] = dv self.assertTrue( da.isEqual( da2 )) @@ -1852,7 +1852,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): dv.alloc( 4, 4 ) dv.fillWithZero() dv.setInfoOnComponents( ["v1","v2","v3","v4"]) - dv2 = dv.deepCpy() + dv2 = dv.deepCopy() dv.setSelectedComponents( da, [1,0] ) #! [Snippet_DataArrayDouble_setSelectedComponents2] #! [Snippet_DataArrayDouble_setSelectedComponents3] @@ -1873,7 +1873,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): dv.alloc( 4, 4 ) dv.fillWithZero() dv.setInfoOnComponents( ["v1","v2","v3","v4"]) - dv2 = dv.deepCpy() + dv2 = dv.deepCopy() dv.setSelectedComponents( da, [1,0] ) #! [Snippet_DataArrayInt_setSelectedComponents2] #! [Snippet_DataArrayInt_setSelectedComponents3] @@ -1927,7 +1927,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): da3.setInfoOnComponent(1,"c1da3") da3.setInfoOnComponent(2,"c2da3") # - da1C=da1.deepCpy() + da1C=da1.deepCopy() da1.meldWith(da3) #! [PySnippet_DataArrayDouble_Meld1_1] @@ -2017,7 +2017,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertEqual(2,f2.getMesh().getSpaceDimension()) self.assertEqual(2,f2.getMesh().getMeshDimension()) m2C=f2.getMesh() - self.assertEqual(13,m2C.getMeshLength()) + self.assertEqual(13,m2C.getNodalConnectivityArrayLen()) expected2=[0.2, -0.3, 0.7, -0.3, 0.2, 0.2, 0.7, 0.2, 0.2, 0.7, 0.7, 0.7] for i in xrange(12): self.assertAlmostEqual(expected2[i],m2C.getCoords().getIJ(0,i),12) @@ -2050,7 +2050,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertEqual(2,f2.getMesh().getSpaceDimension()) self.assertEqual(2,f2.getMesh().getMeshDimension()) m2C=f2.getMesh() - self.assertEqual(8,m2C.getMeshLength()) + self.assertEqual(8,m2C.getNodalConnectivityArrayLen()) for i in xrange(8):#8 is not an error self.assertAlmostEqual(expected2[i],m2C.getCoords().getIJ(0,i),12) pass @@ -2072,7 +2072,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertEqual(2,f2.getMesh().getSpaceDimension()) self.assertEqual(2,f2.getMesh().getMeshDimension()) m2C=f2.getMesh() - self.assertEqual(8,m2C.getMeshLength()) + self.assertEqual(8,m2C.getNodalConnectivityArrayLen()) for i in xrange(8):#8 is not an error self.assertAlmostEqual(expected2[i],m2C.getCoords().getIJ(0,i),12) pass @@ -2092,7 +2092,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertEqual(2,f2.getMesh().getSpaceDimension()) self.assertEqual(2,f2.getMesh().getMeshDimension()) m2C=f2.getMesh() - self.assertEqual(13,m2C.getMeshLength()) + self.assertEqual(13,m2C.getNodalConnectivityArrayLen()) for i in xrange(12): self.assertAlmostEqual(expected2[i],m2C.getCoords().getIJ(0,i),12) pass @@ -2128,7 +2128,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): # ! [PySnippetUMeshStdBuild1_4] # ! [PySnippetUMeshStdBuild1_5] # ! [PySnippetUMeshStdBuild1_5] - mesh.checkCoherency() + mesh.checkConsistencyLight() return def testExampleCMeshStdBuild1(self): @@ -2184,7 +2184,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): # ! [PySnippetUMeshAdvBuild1_4] # ! [PySnippetUMeshAdvBuild1_5] # ! [PySnippetUMeshAdvBuild1_5] - mesh.checkCoherency() + mesh.checkConsistencyLight() return def testExampleDataArrayBuild1(self): @@ -2331,11 +2331,11 @@ class MEDCouplingBasicsTest(unittest.TestCase): ddd.setInfoOnComponents(["Y [m]","AA [m/s]","GG [MW]"]) # ! [PySnippetDataArrayApplyFunc1_7] # ! [PySnippetDataArrayApplyFunc1_8] - ddd1=ddd.applyFunc2(1,"Y+GG") + ddd1=ddd.applyFuncCompo(1,"Y+GG") self.assertTrue(ddd1.isEqual(DataArrayDouble([4.,24.,44.,64.],4,1),1e-12)) # ! [PySnippetDataArrayApplyFunc1_8] # ! [PySnippetDataArrayApplyFunc1_9] - ddd1=ddd.applyFunc3(1,["X","Y","Z"],"X+Z") + ddd1=ddd.applyFuncNamedCompo(1,["X","Y","Z"],"X+Z") self.assertTrue(ddd1.isEqual(DataArrayDouble([4.,24.,44.,64.],4,1),1e-12)) # ! [PySnippetDataArrayApplyFunc1_9] return diff --git a/src/MEDCoupling_Swig/MEDCouplingFieldDiscretization.i b/src/MEDCoupling_Swig/MEDCouplingFieldDiscretization.i index ced6d8b49..7a1c2d69b 100644 --- a/src/MEDCoupling_Swig/MEDCouplingFieldDiscretization.i +++ b/src/MEDCoupling_Swig/MEDCouplingFieldDiscretization.i @@ -19,7 +19,7 @@ // Author : Anthony Geay (CEA/DEN) %newobject MEDCoupling::MEDCouplingFieldDiscretization::New; -%newobject MEDCoupling::MEDCouplingFieldDiscretization::deepCpy; +%newobject MEDCoupling::MEDCouplingFieldDiscretization::deepCopy; %newobject MEDCoupling::MEDCouplingFieldDiscretization::clone; %newobject MEDCoupling::MEDCouplingFieldDiscretization::clonePartRange; %newobject MEDCoupling::MEDCouplingFieldDiscretization::getOffsetArr; @@ -43,7 +43,7 @@ namespace MEDCoupling virtual bool isEqual(const MEDCouplingFieldDiscretization *other, double eps) const throw(INTERP_KERNEL::Exception); virtual bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const throw(INTERP_KERNEL::Exception); virtual bool isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double eps) const throw(INTERP_KERNEL::Exception); - virtual MEDCouplingFieldDiscretization *deepCpy() const throw(INTERP_KERNEL::Exception); + virtual MEDCouplingFieldDiscretization *deepCopy() const throw(INTERP_KERNEL::Exception); virtual MEDCouplingFieldDiscretization *clone() const throw(INTERP_KERNEL::Exception); virtual MEDCouplingFieldDiscretization *clonePartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception); virtual std::string getStringRepr() const throw(INTERP_KERNEL::Exception); diff --git a/src/MEDCoupling_Swig/MEDCouplingFinalize.i b/src/MEDCoupling_Swig/MEDCouplingFinalize.i index ed3a5490f..f9418b4d7 100644 --- a/src/MEDCoupling_Swig/MEDCouplingFinalize.i +++ b/src/MEDCoupling_Swig/MEDCouplingFinalize.i @@ -60,7 +60,7 @@ MEDCoupling1SGTUMesh.__new__=classmethod(MEDCoupling1SGTUMeshnew) MEDCouplingCurveLinearMesh.__new__=classmethod(MEDCouplingCurveLinearMeshnew) MEDCouplingCMesh.__new__=classmethod(MEDCouplingCMeshnew) MEDCouplingIMesh.__new__=classmethod(MEDCouplingIMeshnew) -MEDCouplingExtrudedMesh.__new__=classmethod(MEDCouplingExtrudedMeshnew) +MEDCouplingMappedExtrudedMesh.__new__=classmethod(MEDCouplingExtrudedMeshnew) MEDCouplingFieldDouble.__new__=classmethod(MEDCouplingFieldDoublenew) del INTERPKERNELExceptionReduce diff --git a/src/MEDCoupling_Swig/MEDCouplingMemArray.i b/src/MEDCoupling_Swig/MEDCouplingMemArray.i index 4bfeddfae..a56db7e2e 100644 --- a/src/MEDCoupling_Swig/MEDCouplingMemArray.i +++ b/src/MEDCoupling_Swig/MEDCouplingMemArray.i @@ -42,16 +42,16 @@ } //$$$$$$$$$$$$$$$$$$ -%newobject MEDCoupling::DataArray::deepCpy; +%newobject MEDCoupling::DataArray::deepCopy; %newobject MEDCoupling::DataArray::selectByTupleRanges; %newobject MEDCoupling::DataArray::selectByTupleId; %newobject MEDCoupling::DataArray::selectByTupleIdSafe; -%newobject MEDCoupling::DataArray::selectByTupleId2; +%newobject MEDCoupling::DataArray::selectByTupleIdSafeSlice; %newobject MEDCoupling::DataArray::Aggregate; %newobject MEDCoupling::DataArrayInt::New; %newobject MEDCoupling::DataArrayInt::__iter__; %newobject MEDCoupling::DataArrayInt::convertToDblArr; -%newobject MEDCoupling::DataArrayInt::performCpy; +%newobject MEDCoupling::DataArrayInt::performCopyOrIncrRef; %newobject MEDCoupling::DataArrayInt::substr; %newobject MEDCoupling::DataArrayInt::changeNbOfComponents; %newobject MEDCoupling::DataArrayInt::accumulatePerChunck; @@ -63,17 +63,17 @@ %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2O; %newobject MEDCoupling::DataArrayInt::invertArrayN2O2O2N; %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2OBis; -%newobject MEDCoupling::DataArrayInt::getIdsEqual; -%newobject MEDCoupling::DataArrayInt::getIdsNotEqual; -%newobject MEDCoupling::DataArrayInt::getIdsEqualList; -%newobject MEDCoupling::DataArrayInt::getIdsNotEqualList; -%newobject MEDCoupling::DataArrayInt::getIdsEqualTuple; +%newobject MEDCoupling::DataArrayInt::findIdsEqual; +%newobject MEDCoupling::DataArrayInt::findIdsNotEqual; +%newobject MEDCoupling::DataArrayInt::findIdsEqualList; +%newobject MEDCoupling::DataArrayInt::findIdsNotEqualList; +%newobject MEDCoupling::DataArrayInt::findIdsEqualTuple; %newobject MEDCoupling::DataArrayInt::sumPerTuple; %newobject MEDCoupling::DataArrayInt::negate; %newobject MEDCoupling::DataArrayInt::computeAbs; -%newobject MEDCoupling::DataArrayInt::getIdsInRange; -%newobject MEDCoupling::DataArrayInt::getIdsNotInRange; -%newobject MEDCoupling::DataArrayInt::getIdsStrictlyNegative; +%newobject MEDCoupling::DataArrayInt::findIdsInRange; +%newobject MEDCoupling::DataArrayInt::findIdsNotInRange; +%newobject MEDCoupling::DataArrayInt::findIdsStricltyNegative; %newobject MEDCoupling::DataArrayInt::Aggregate; %newobject MEDCoupling::DataArrayInt::AggregateIndexes; %newobject MEDCoupling::DataArrayInt::Meld; @@ -124,23 +124,23 @@ %newobject MEDCoupling::DataArrayChar::renumberR; %newobject MEDCoupling::DataArrayChar::renumberAndReduce; %newobject MEDCoupling::DataArrayChar::changeNbOfComponents; -%newobject MEDCoupling::DataArrayChar::getIdsEqual; -%newobject MEDCoupling::DataArrayChar::getIdsNotEqual; +%newobject MEDCoupling::DataArrayChar::findIdsEqual; +%newobject MEDCoupling::DataArrayChar::findIdsNotEqual; %newobject MEDCoupling::DataArrayChar::Aggregate; %newobject MEDCoupling::DataArrayChar::Meld; %newobject MEDCoupling::DataArrayByte::New; %newobject MEDCoupling::DataArrayByte::__iter__; -%newobject MEDCoupling::DataArrayByte::performCpy; +%newobject MEDCoupling::DataArrayByte::performCopyOrIncrRef; %newobject MEDCoupling::DataArrayByteTuple::buildDAByte; %newobject MEDCoupling::DataArrayChar::substr; %newobject MEDCoupling::DataArrayAsciiChar::New; %newobject MEDCoupling::DataArrayAsciiChar::__iter__; -%newobject MEDCoupling::DataArrayAsciiChar::performCpy; +%newobject MEDCoupling::DataArrayAsciiChar::performCopyOrIncrRef; %newobject MEDCoupling::DataArrayAsciiCharTuple::buildDAAsciiChar; %newobject MEDCoupling::DataArrayDouble::New; %newobject MEDCoupling::DataArrayDouble::__iter__; %newobject MEDCoupling::DataArrayDouble::convertToIntArr; -%newobject MEDCoupling::DataArrayDouble::performCpy; +%newobject MEDCoupling::DataArrayDouble::performCopyOrIncrRef; %newobject MEDCoupling::DataArrayDouble::Aggregate; %newobject MEDCoupling::DataArrayDouble::Meld; %newobject MEDCoupling::DataArrayDouble::Dot; @@ -153,13 +153,13 @@ %newobject MEDCoupling::DataArrayDouble::substr; %newobject MEDCoupling::DataArrayDouble::changeNbOfComponents; %newobject MEDCoupling::DataArrayDouble::accumulatePerChunck; -%newobject MEDCoupling::DataArrayDouble::getIdsInRange; -%newobject MEDCoupling::DataArrayDouble::getIdsNotInRange; +%newobject MEDCoupling::DataArrayDouble::findIdsInRange; +%newobject MEDCoupling::DataArrayDouble::findIdsNotInRange; %newobject MEDCoupling::DataArrayDouble::negate; %newobject MEDCoupling::DataArrayDouble::computeAbs; %newobject MEDCoupling::DataArrayDouble::applyFunc; -%newobject MEDCoupling::DataArrayDouble::applyFunc2; -%newobject MEDCoupling::DataArrayDouble::applyFunc3; +%newobject MEDCoupling::DataArrayDouble::applyFuncCompo; +%newobject MEDCoupling::DataArrayDouble::applyFuncNamedCompo; %newobject MEDCoupling::DataArrayDouble::doublyContractedProduct; %newobject MEDCoupling::DataArrayDouble::determinant; %newobject MEDCoupling::DataArrayDouble::eigenValues; @@ -239,8 +239,8 @@ namespace MEDCoupling virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception); virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception); virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception); - virtual DataArray *deepCpy() const throw(INTERP_KERNEL::Exception); - virtual DataArray *selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception); + virtual DataArray *deepCopy() const throw(INTERP_KERNEL::Exception); + virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception); virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception); void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception); void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception); @@ -253,7 +253,7 @@ namespace MEDCoupling static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception); static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception); static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit) throw(INTERP_KERNEL::Exception); - static std::string GetAxTypeRepr(MEDCouplingAxisType at) throw(INTERP_KERNEL::Exception); + static std::string GetAxisTypeRepr(MEDCouplingAxisType at) throw(INTERP_KERNEL::Exception); void updateTime() const; %extend { @@ -341,8 +341,8 @@ namespace MEDCoupling //tuplesSelec in PyObject * because DataArrayInt is not already existing ! virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception) { - static const char msg[]="DataArray::setContigPartOfSelectedValues2 : 4th parameter \"tuplesSelec\" should be of type DataArrayInt"; - DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 3rd parameter \"aBase\" should be of type DataArray"); + static const char msg[]="DataArray::setContigPartOfSelectedValuesSlice : 4th parameter \"tuplesSelec\" should be of type DataArrayInt"; + DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 3rd parameter \"aBase\" should be of type DataArray"); DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg); DataArrayInt *tuplesSelecPtr2=0; if(tuplesSelecPtr) @@ -354,10 +354,10 @@ namespace MEDCoupling self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2); } - virtual void setContigPartOfSelectedValues2(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception) + virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception) { - DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 2nd parameter \"aBase\" should be of type DataArray"); - self->setContigPartOfSelectedValues2(tupleIdStart,a,bg,end2,step); + DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 2nd parameter \"aBase\" should be of type DataArray"); + self->setContigPartOfSelectedValuesSlice(tupleIdStart,a,bg,end2,step); } virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception) @@ -532,8 +532,8 @@ namespace MEDCoupling static DataArrayDouble *New(); double doubleValue() const throw(INTERP_KERNEL::Exception); bool empty() const throw(INTERP_KERNEL::Exception); - DataArrayDouble *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception); - void cpyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception); + DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception); + void deepCopyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception); void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception); void pushBackSilent(double val) throw(INTERP_KERNEL::Exception); double popBackSilent() throw(INTERP_KERNEL::Exception); @@ -615,12 +615,12 @@ namespace MEDCoupling DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception); DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception); void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception); - DataArrayDouble *applyFunc2(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception); - DataArrayDouble *applyFunc3(int nbOfComp, const std::vector& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception); + DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception); + DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception); void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception); void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception); - DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception); - DataArrayInt *getIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception); + DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception); + DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception); static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception); static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception); static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception); @@ -668,7 +668,7 @@ namespace MEDCoupling int nbOfCompo=PyInt_AS_LONG(elt2); if(nbOfCompo<0) throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !"); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); std::vector tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo); ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); return ret.retn(); @@ -678,7 +678,7 @@ namespace MEDCoupling } else {//DataArrayDouble.New([1.,3.,4.],3) - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); int tmpp1=-1; std::vector tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1); ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); @@ -690,7 +690,7 @@ namespace MEDCoupling } else {// DataArrayDouble.New([1.,3.,4.]) - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); int tmpp1=-1,tmpp2=-1; std::vector tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2); ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); @@ -711,7 +711,7 @@ namespace MEDCoupling int nbOfCompo=PyInt_AS_LONG(nbOfTuples); if(nbOfCompo<0) throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !"); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); ret->alloc(nbOfTuples1,nbOfCompo); return ret.retn(); } @@ -723,7 +723,7 @@ namespace MEDCoupling } else {//DataArrayDouble.New(5) - MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + MCAuto ret=DataArrayDouble::New(); ret->alloc(nbOfTuples1,1); return ret.retn(); } @@ -1096,7 +1096,7 @@ namespace MEDCoupling int nbComp=self->getNumberOfComponents(),nbTuples=-1; const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : "; const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples); - MEDCouplingAutoRefCountObjectPtr inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp); + MCAuto inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp); DataArrayInt *c=0,*cI=0; self->computeTupleIdsNearTuples(inpu,eps,c,cI); PyObject *ret=PyTuple_New(2); @@ -1130,7 +1130,7 @@ namespace MEDCoupling DataArrayInt *dt1=0,*dc1=0; int sw; convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1); - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; switch(sw) { case 1: @@ -1140,7 +1140,7 @@ namespace MEDCoupling case 2: return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ); case 3: - return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ); case 4: return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ); case 5: @@ -1153,7 +1153,7 @@ namespace MEDCoupling } case 7: { - ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second); + ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second); std::vector v2(1,ic1); return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ); } @@ -1175,7 +1175,7 @@ namespace MEDCoupling } case 11: { - ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second); + ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second); return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ); } case 12: @@ -1203,7 +1203,7 @@ namespace MEDCoupling } case 15: { - ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second); + ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second); int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2); std::vector v2(nbOfComp); for(int i=0;i > pt1,pc1; DataArrayInt *dt1=0,*dc1=0; convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1); - MEDCouplingAutoRefCountObjectPtr tmp; + MCAuto tmp; switch(sw2) { case 1: @@ -1591,7 +1591,7 @@ namespace MEDCoupling if(other) { PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 ); - MEDCouplingAutoRefCountObjectPtr ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp); + MCAuto ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp); Py_XDECREF(tmp); return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ); } @@ -1605,7 +1605,7 @@ namespace MEDCoupling { case 1: { - MEDCouplingAutoRefCountObjectPtr ret=self->deepCpy(); + MCAuto ret=self->deepCopy(); ret->applyLin(1.,val); return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ); } @@ -1615,12 +1615,12 @@ namespace MEDCoupling } case 3: { - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ); } case 4: { - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ); } default: @@ -1641,18 +1641,18 @@ namespace MEDCoupling { case 1: { - MEDCouplingAutoRefCountObjectPtr ret=self->deepCpy(); + MCAuto ret=self->deepCopy(); ret->applyLin(1.,val); return ret.retn(); } case 3: { - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); return DataArrayDouble::Add(self,aaa); } case 4: { - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); return DataArrayDouble::Add(self,aaa); } default: @@ -1685,14 +1685,14 @@ namespace MEDCoupling } case 3: { - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); self->addEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; } case 4: { - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); self->addEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -1719,7 +1719,7 @@ namespace MEDCoupling if(other) { PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 ); - MEDCouplingAutoRefCountObjectPtr ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp); + MCAuto ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp); Py_XDECREF(tmp); return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ); } @@ -1733,7 +1733,7 @@ namespace MEDCoupling { case 1: { - MEDCouplingAutoRefCountObjectPtr ret=self->deepCpy(); + MCAuto ret=self->deepCopy(); ret->applyLin(1.,-val); return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ); } @@ -1743,12 +1743,12 @@ namespace MEDCoupling } case 3: { - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ); } case 4: { - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ); } default: @@ -1769,18 +1769,18 @@ namespace MEDCoupling { case 1: { - MEDCouplingAutoRefCountObjectPtr ret=self->deepCpy(); + MCAuto ret=self->deepCopy(); ret->applyLin(-1.,val); return ret.retn(); } case 3: { - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); return DataArrayDouble::Substract(aaa,self); } case 4: { - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); return DataArrayDouble::Substract(aaa,self); } default: @@ -1813,14 +1813,14 @@ namespace MEDCoupling } case 3: { - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); self->substractEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; } case 4: { - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); self->substractEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -1847,7 +1847,7 @@ namespace MEDCoupling if(other) { PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 ); - MEDCouplingAutoRefCountObjectPtr ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp); + MCAuto ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp); Py_XDECREF(tmp); return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ); } @@ -1861,7 +1861,7 @@ namespace MEDCoupling { case 1: { - MEDCouplingAutoRefCountObjectPtr ret=self->deepCpy(); + MCAuto ret=self->deepCopy(); ret->applyLin(val,0.); return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ); } @@ -1871,12 +1871,12 @@ namespace MEDCoupling } case 3: { - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ); } case 4: { - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ); } default: @@ -1897,18 +1897,18 @@ namespace MEDCoupling { case 1: { - MEDCouplingAutoRefCountObjectPtr ret=self->deepCpy(); + MCAuto ret=self->deepCopy(); ret->applyLin(val,0.); return ret.retn(); } case 3: { - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); return DataArrayDouble::Multiply(self,aaa); } case 4: { - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); return DataArrayDouble::Multiply(self,aaa); } default: @@ -1941,14 +1941,14 @@ namespace MEDCoupling } case 3: { - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); self->multiplyEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; } case 4: { - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); self->multiplyEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -1975,7 +1975,7 @@ namespace MEDCoupling if(other) { PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 ); - MEDCouplingAutoRefCountObjectPtr ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp); + MCAuto ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp); Py_XDECREF(tmp); return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ); } @@ -1991,7 +1991,7 @@ namespace MEDCoupling { if(val==0.) throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !"); - MEDCouplingAutoRefCountObjectPtr ret=self->deepCpy(); + MCAuto ret=self->deepCopy(); ret->applyLin(1/val,0.); return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ); } @@ -2001,12 +2001,12 @@ namespace MEDCoupling } case 3: { - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ); } case 4: { - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ); } default: @@ -2027,18 +2027,18 @@ namespace MEDCoupling { case 1: { - MEDCouplingAutoRefCountObjectPtr ret=self->deepCpy(); + MCAuto ret=self->deepCopy(); ret->applyInv(val); return ret.retn(); } case 3: { - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); return DataArrayDouble::Divide(aaa,self); } case 4: { - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); return DataArrayDouble::Divide(aaa,self); } default: @@ -2073,14 +2073,14 @@ namespace MEDCoupling } case 3: { - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); self->divideEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; } case 4: { - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); self->divideEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -2103,7 +2103,7 @@ namespace MEDCoupling { case 1: { - MEDCouplingAutoRefCountObjectPtr ret=self->deepCpy(); + MCAuto ret=self->deepCopy(); ret->applyPow(val); return ret.retn(); } @@ -2113,12 +2113,12 @@ namespace MEDCoupling } case 3: { - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); return DataArrayDouble::Pow(self,aaa); } case 4: { - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); return DataArrayDouble::Pow(self,aaa); } default: @@ -2139,18 +2139,18 @@ namespace MEDCoupling { case 1: { - MEDCouplingAutoRefCountObjectPtr ret=self->deepCpy(); + MCAuto ret=self->deepCopy(); ret->applyRPow(val); return ret.retn(); } case 3: { - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); return DataArrayDouble::Pow(aaa,self); } case 4: { - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); return DataArrayDouble::Pow(aaa,self); } default: @@ -2183,14 +2183,14 @@ namespace MEDCoupling } case 3: { - MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); self->powEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; } case 4: { - MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); self->powEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -2323,7 +2323,7 @@ namespace MEDCoupling PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception) { - MEDCouplingAutoRefCountObjectPtr ret=self->buildDADouble(1,self->getNumberOfCompo()); + MCAuto ret=self->buildDADouble(1,self->getNumberOfCompo()); MEDCoupling_DataArrayDouble____iadd___(ret,0,obj); Py_XINCREF(trueSelf); return trueSelf; @@ -2331,7 +2331,7 @@ namespace MEDCoupling PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception) { - MEDCouplingAutoRefCountObjectPtr ret=self->buildDADouble(1,self->getNumberOfCompo()); + MCAuto ret=self->buildDADouble(1,self->getNumberOfCompo()); MEDCoupling_DataArrayDouble____isub___(ret,0,obj); Py_XINCREF(trueSelf); return trueSelf; @@ -2339,7 +2339,7 @@ namespace MEDCoupling PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception) { - MEDCouplingAutoRefCountObjectPtr ret=self->buildDADouble(1,self->getNumberOfCompo()); + MCAuto ret=self->buildDADouble(1,self->getNumberOfCompo()); MEDCoupling_DataArrayDouble____imul___(ret,0,obj); Py_XINCREF(trueSelf); return trueSelf; @@ -2347,7 +2347,7 @@ namespace MEDCoupling PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception) { - MEDCouplingAutoRefCountObjectPtr ret=self->buildDADouble(1,self->getNumberOfCompo()); + MCAuto ret=self->buildDADouble(1,self->getNumberOfCompo()); MEDCoupling_DataArrayDouble____idiv___(ret,0,obj); Py_XINCREF(trueSelf); return trueSelf; @@ -2587,8 +2587,8 @@ namespace MEDCoupling int intValue() const throw(INTERP_KERNEL::Exception); int getHashCode() const throw(INTERP_KERNEL::Exception); bool empty() const throw(INTERP_KERNEL::Exception); - DataArrayInt *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception); - void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception); + DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception); + void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception); void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception); void pushBackSilent(int val) throw(INTERP_KERNEL::Exception); int popBackSilent() throw(INTERP_KERNEL::Exception); @@ -2617,10 +2617,10 @@ namespace MEDCoupling DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception); DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception); DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception); - DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception); + DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception); DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception); DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception); - bool isIdentity2(int sizeExpected) const throw(INTERP_KERNEL::Exception); + bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception); bool isUniform(int val) const throw(INTERP_KERNEL::Exception); DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception); void transpose() throw(INTERP_KERNEL::Exception); @@ -2641,12 +2641,12 @@ namespace MEDCoupling DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception); const int *begin() const throw(INTERP_KERNEL::Exception); const int *end() const throw(INTERP_KERNEL::Exception); - DataArrayInt *getIdsEqual(int val) const throw(INTERP_KERNEL::Exception); - DataArrayInt *getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception); + DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception); + DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception); int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception); - int locateTuple(const std::vector& tupl) const throw(INTERP_KERNEL::Exception); - int locateValue(int value) const throw(INTERP_KERNEL::Exception); - int locateValue(const std::vector& vals) const throw(INTERP_KERNEL::Exception); + int findIdFirstEqualTuple(const std::vector& tupl) const throw(INTERP_KERNEL::Exception); + int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception); + int findIdFirstEqual(const std::vector& vals) const throw(INTERP_KERNEL::Exception); int search(const std::vector& vals) const throw(INTERP_KERNEL::Exception); bool presenceOfTuple(const std::vector& tupl) const throw(INTERP_KERNEL::Exception); bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception); @@ -2668,9 +2668,9 @@ namespace MEDCoupling void applyRModulus(int val) throw(INTERP_KERNEL::Exception); void applyPow(int val) throw(INTERP_KERNEL::Exception); void applyRPow(int val) throw(INTERP_KERNEL::Exception); - DataArrayInt *getIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception); - DataArrayInt *getIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception); - DataArrayInt *getIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception); + DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception); + DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception); + DataArrayInt *findIdsStricltyNegative() const throw(INTERP_KERNEL::Exception); bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception); static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception); static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception); @@ -2687,7 +2687,7 @@ namespace MEDCoupling DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception); DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception); void computeOffsets() throw(INTERP_KERNEL::Exception); - void computeOffsets2() throw(INTERP_KERNEL::Exception); + void computeOffsetsFull() throw(INTERP_KERNEL::Exception); DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception); DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception); DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception); @@ -2739,7 +2739,7 @@ namespace MEDCoupling int nbOfCompo=PyInt_AS_LONG(nbOfComp); if(nbOfCompo<0) throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !"); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo); ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); return ret.retn(); @@ -2749,7 +2749,7 @@ namespace MEDCoupling } else {//DataArrayInt.New([1,3,4],3) - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); int tmpp1=-1; std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1); ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); @@ -2761,7 +2761,7 @@ namespace MEDCoupling } else {// DataArrayInt.New([1,3,4]) - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); int tmpp1=-1,tmpp2=-1; std::vector tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2); ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); @@ -2782,7 +2782,7 @@ namespace MEDCoupling int nbOfCompo=PyInt_AS_LONG(nbOfTuples); if(nbOfCompo<0) throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !"); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuples1,nbOfCompo); return ret.retn(); } @@ -2794,7 +2794,7 @@ namespace MEDCoupling } else {//DataArrayInt.New(5) - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuples1,1); return ret.retn(); } @@ -2858,12 +2858,12 @@ namespace MEDCoupling return self->accumulatePerChunck(bg,bg+sz); } - DataArrayInt *getIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception) + DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception) { int sw,sz,val; std::vector val2; const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2)); - return self->getIdsEqualTuple(bg,bg+sz); + return self->findIdsEqualTuple(bg,bg+sz); } PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception) @@ -2897,14 +2897,14 @@ namespace MEDCoupling return ret; } - static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception) + static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception) { int newNbOfTuples=-1; int szArr,szArrI,sw,iTypppArr,iTypppArrI; std::vector stdvecTyyppArr,stdvecTyyppArrI; const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr); const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI); - DataArrayInt *ret0=MEDCoupling::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples); + DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0)); PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples)); @@ -2913,7 +2913,7 @@ namespace MEDCoupling static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception) { - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); + MCAuto ret(DataArrayInt::New()); int szArr,sw,iTypppArr; std::vector stdvecTyyppArr; const int *arrPtr(convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr)); @@ -3034,7 +3034,7 @@ namespace MEDCoupling } } - DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception) + DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception) { int sw; int singleVal; @@ -3045,17 +3045,17 @@ namespace MEDCoupling switch(sw) { case 1: - return self->getIdsEqualList(&singleVal,&singleVal+1); + return self->findIdsEqualList(&singleVal,&singleVal+1); case 2: - return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size()); + return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size()); case 4: - return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end()); + return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end()); default: - throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !"); + throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !"); } } - DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception) + DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception) { int sw; int singleVal; @@ -3066,13 +3066,13 @@ namespace MEDCoupling switch(sw) { case 1: - return self->getIdsNotEqualList(&singleVal,&singleVal+1); + return self->findIdsNotEqualList(&singleVal,&singleVal+1); case 2: - return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size()); + return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size()); case 4: - return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end()); + return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end()); default: - throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !"); + throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !"); } } @@ -3298,7 +3298,7 @@ namespace MEDCoupling if(PyInt_Check(obj)) { int val=(int)PyInt_AS_LONG(obj); - return self->locateValue(val); + return self->findIdFirstEqual(val); } else throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !"); @@ -3307,7 +3307,7 @@ namespace MEDCoupling { std::vector arr; convertPyToNewIntArr3(obj,arr); - return self->locateTuple(arr); + return self->findIdFirstEqualTuple(arr); } } } @@ -3351,7 +3351,7 @@ namespace MEDCoupling DataArrayInt *dt1=0,*dc1=0; int sw; convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1); - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; switch(sw) { case 1: @@ -3363,7 +3363,7 @@ namespace MEDCoupling case 2: return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); case 3: - return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); case 4: return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); case 5: @@ -3376,7 +3376,7 @@ namespace MEDCoupling } case 7: { - ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second); + ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second); std::vector v2(1,ic1); return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); } @@ -3398,7 +3398,7 @@ namespace MEDCoupling } case 11: { - ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second); + ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second); return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); } case 12: @@ -3426,7 +3426,7 @@ namespace MEDCoupling } case 15: { - ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second); + ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second); int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2); std::vector v2(nbOfComp); for(int i=0;i > pt1,pc1; DataArrayInt *dt1=0,*dc1=0; convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1); - MEDCouplingAutoRefCountObjectPtr tmp; + MCAuto tmp; switch(sw2) { case 1: @@ -3875,13 +3875,13 @@ namespace MEDCoupling { case 1: { - MEDCouplingAutoRefCountObjectPtr ret=self->deepCpy(); + MCAuto ret=self->deepCopy(); ret->applyLin(1,val); return ret.retn(); } case 2: { - MEDCouplingAutoRefCountObjectPtr aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); + MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); return DataArrayInt::Add(self,aaaa); } case 3: @@ -3890,7 +3890,7 @@ namespace MEDCoupling } case 4: { - MEDCouplingAutoRefCountObjectPtr aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); return DataArrayInt::Add(self,aaaa); } default: @@ -3911,18 +3911,18 @@ namespace MEDCoupling { case 1: { - MEDCouplingAutoRefCountObjectPtr ret=self->deepCpy(); + MCAuto ret=self->deepCopy(); ret->applyLin(1,val); return ret.retn(); } case 2: { - MEDCouplingAutoRefCountObjectPtr aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); + MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); return DataArrayInt::Add(self,aaaa); } case 4: { - MEDCouplingAutoRefCountObjectPtr aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); return DataArrayInt::Add(self,aaaa); } default: @@ -3949,7 +3949,7 @@ namespace MEDCoupling } case 2: { - MEDCouplingAutoRefCountObjectPtr bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); + MCAuto bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); self->addEqual(bb); Py_XINCREF(trueSelf); return trueSelf; @@ -3962,7 +3962,7 @@ namespace MEDCoupling } case 4: { - MEDCouplingAutoRefCountObjectPtr aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); self->addEqual(aaaa); Py_XINCREF(trueSelf); return trueSelf; @@ -3985,13 +3985,13 @@ namespace MEDCoupling { case 1: { - MEDCouplingAutoRefCountObjectPtr ret=self->deepCpy(); + MCAuto ret=self->deepCopy(); ret->applyLin(1,-val); return ret.retn(); } case 2: { - MEDCouplingAutoRefCountObjectPtr aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); + MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); return DataArrayInt::Substract(self,aaaa); } case 3: @@ -4000,7 +4000,7 @@ namespace MEDCoupling } case 4: { - MEDCouplingAutoRefCountObjectPtr aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); return DataArrayInt::Substract(self,aaaa); } default: @@ -4021,18 +4021,18 @@ namespace MEDCoupling { case 1: { - MEDCouplingAutoRefCountObjectPtr ret=self->deepCpy(); + MCAuto ret=self->deepCopy(); ret->applyLin(-1,val); return ret.retn(); } case 2: { - MEDCouplingAutoRefCountObjectPtr aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); + MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); return DataArrayInt::Substract(aaaa,self); } case 4: { - MEDCouplingAutoRefCountObjectPtr aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); return DataArrayInt::Substract(aaaa,self); } default: @@ -4059,7 +4059,7 @@ namespace MEDCoupling } case 2: { - MEDCouplingAutoRefCountObjectPtr bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); + MCAuto bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); self->substractEqual(bb); Py_XINCREF(trueSelf); return trueSelf; @@ -4072,7 +4072,7 @@ namespace MEDCoupling } case 4: { - MEDCouplingAutoRefCountObjectPtr aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); self->substractEqual(aaaa); Py_XINCREF(trueSelf); return trueSelf; @@ -4095,13 +4095,13 @@ namespace MEDCoupling { case 1: { - MEDCouplingAutoRefCountObjectPtr ret=self->deepCpy(); + MCAuto ret=self->deepCopy(); ret->applyLin(val,0); return ret.retn(); } case 2: { - MEDCouplingAutoRefCountObjectPtr aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); + MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); return DataArrayInt::Multiply(self,aaaa); } case 3: @@ -4110,7 +4110,7 @@ namespace MEDCoupling } case 4: { - MEDCouplingAutoRefCountObjectPtr aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); return DataArrayInt::Multiply(self,aaaa); } default: @@ -4131,18 +4131,18 @@ namespace MEDCoupling { case 1: { - MEDCouplingAutoRefCountObjectPtr ret=self->deepCpy(); + MCAuto ret=self->deepCopy(); ret->applyLin(val,0); return ret.retn(); } case 2: { - MEDCouplingAutoRefCountObjectPtr aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); + MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); return DataArrayInt::Multiply(self,aaaa); } case 4: { - MEDCouplingAutoRefCountObjectPtr aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); return DataArrayInt::Multiply(self,aaaa); } default: @@ -4169,7 +4169,7 @@ namespace MEDCoupling } case 2: { - MEDCouplingAutoRefCountObjectPtr bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); + MCAuto bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); self->multiplyEqual(bb); Py_XINCREF(trueSelf); return trueSelf; @@ -4182,7 +4182,7 @@ namespace MEDCoupling } case 4: { - MEDCouplingAutoRefCountObjectPtr aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); self->multiplyEqual(aaaa); Py_XINCREF(trueSelf); return trueSelf; @@ -4205,13 +4205,13 @@ namespace MEDCoupling { case 1: { - MEDCouplingAutoRefCountObjectPtr ret=self->deepCpy(); + MCAuto ret=self->deepCopy(); ret->applyDivideBy(val); return ret.retn(); } case 2: { - MEDCouplingAutoRefCountObjectPtr aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); + MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); return DataArrayInt::Divide(self,aaaa); } case 3: @@ -4220,7 +4220,7 @@ namespace MEDCoupling } case 4: { - MEDCouplingAutoRefCountObjectPtr aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); return DataArrayInt::Divide(self,aaaa); } default: @@ -4241,18 +4241,18 @@ namespace MEDCoupling { case 1: { - MEDCouplingAutoRefCountObjectPtr ret=self->deepCpy(); + MCAuto ret=self->deepCopy(); ret->applyInv(val); return ret.retn(); } case 2: { - MEDCouplingAutoRefCountObjectPtr aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); + MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); return DataArrayInt::Divide(aaaa,self); } case 4: { - MEDCouplingAutoRefCountObjectPtr aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); return DataArrayInt::Divide(aaaa,self); } default: @@ -4279,7 +4279,7 @@ namespace MEDCoupling } case 2: { - MEDCouplingAutoRefCountObjectPtr bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); + MCAuto bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); self->divideEqual(bb); Py_XINCREF(trueSelf); return trueSelf; @@ -4292,7 +4292,7 @@ namespace MEDCoupling } case 4: { - MEDCouplingAutoRefCountObjectPtr aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); self->divideEqual(aaaa); Py_XINCREF(trueSelf); return trueSelf; @@ -4315,13 +4315,13 @@ namespace MEDCoupling { case 1: { - MEDCouplingAutoRefCountObjectPtr ret=self->deepCpy(); + MCAuto ret=self->deepCopy(); ret->applyModulus(val); return ret.retn(); } case 2: { - MEDCouplingAutoRefCountObjectPtr aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); + MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); return DataArrayInt::Modulus(self,aaaa); } case 3: @@ -4330,7 +4330,7 @@ namespace MEDCoupling } case 4: { - MEDCouplingAutoRefCountObjectPtr aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); return DataArrayInt::Modulus(self,aaaa); } default: @@ -4351,13 +4351,13 @@ namespace MEDCoupling { case 1: { - MEDCouplingAutoRefCountObjectPtr ret=self->deepCpy(); + MCAuto ret=self->deepCopy(); ret->applyRModulus(val); return ret.retn(); } case 2: { - MEDCouplingAutoRefCountObjectPtr aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); + MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); return DataArrayInt::Modulus(aaaa,self); } case 3: @@ -4366,7 +4366,7 @@ namespace MEDCoupling } case 4: { - MEDCouplingAutoRefCountObjectPtr aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); return DataArrayInt::Modulus(aaaa,self); } default: @@ -4399,7 +4399,7 @@ namespace MEDCoupling } case 4: { - MEDCouplingAutoRefCountObjectPtr aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); self->modulusEqual(aaaa); Py_XINCREF(trueSelf); return trueSelf; @@ -4422,13 +4422,13 @@ namespace MEDCoupling { case 1: { - MEDCouplingAutoRefCountObjectPtr ret=self->deepCpy(); + MCAuto ret=self->deepCopy(); ret->applyPow(val); return ret.retn(); } case 2: { - MEDCouplingAutoRefCountObjectPtr aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); + MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); return DataArrayInt::Pow(self,aaaa); } case 3: @@ -4437,7 +4437,7 @@ namespace MEDCoupling } case 4: { - MEDCouplingAutoRefCountObjectPtr aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); return DataArrayInt::Pow(self,aaaa); } default: @@ -4458,13 +4458,13 @@ namespace MEDCoupling { case 1: { - MEDCouplingAutoRefCountObjectPtr ret=self->deepCpy(); + MCAuto ret=self->deepCopy(); ret->applyRPow(val); return ret.retn(); } case 2: { - MEDCouplingAutoRefCountObjectPtr aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); + MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size()); return DataArrayInt::Pow(aaaa,self); } case 3: @@ -4473,7 +4473,7 @@ namespace MEDCoupling } case 4: { - MEDCouplingAutoRefCountObjectPtr aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); return DataArrayInt::Pow(aaaa,self); } default: @@ -4506,7 +4506,7 @@ namespace MEDCoupling } case 4: { - MEDCouplingAutoRefCountObjectPtr aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); self->powEqual(aaaa); Py_XINCREF(trueSelf); return trueSelf; @@ -4549,10 +4549,10 @@ namespace MEDCoupling return pyRet; } - PyObject *searchRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception) + PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception) { DataArrayInt *ret0=0,*ret1=0; - self->searchRangesInListOfIds(listOfIds,ret0,ret1); + self->findIdsRangesInListOfIds(listOfIds,ret0,ret1); PyObject *pyRet=PyTuple_New(2); PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); @@ -4680,7 +4680,7 @@ namespace MEDCoupling PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception) { - MEDCouplingAutoRefCountObjectPtr ret=self->buildDAInt(1,self->getNumberOfCompo()); + MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); MEDCoupling_DataArrayInt____iadd___(ret,0,obj); Py_XINCREF(trueSelf); return trueSelf; @@ -4688,7 +4688,7 @@ namespace MEDCoupling PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception) { - MEDCouplingAutoRefCountObjectPtr ret=self->buildDAInt(1,self->getNumberOfCompo()); + MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); MEDCoupling_DataArrayInt____isub___(ret,0,obj); Py_XINCREF(trueSelf); return trueSelf; @@ -4696,7 +4696,7 @@ namespace MEDCoupling PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception) { - MEDCouplingAutoRefCountObjectPtr ret=self->buildDAInt(1,self->getNumberOfCompo()); + MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); MEDCoupling_DataArrayInt____imul___(ret,0,obj); Py_XINCREF(trueSelf); return trueSelf; @@ -4704,7 +4704,7 @@ namespace MEDCoupling PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception) { - MEDCouplingAutoRefCountObjectPtr ret=self->buildDAInt(1,self->getNumberOfCompo()); + MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); MEDCoupling_DataArrayInt____idiv___(ret,0,obj); Py_XINCREF(trueSelf); return trueSelf; @@ -4712,7 +4712,7 @@ namespace MEDCoupling PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception) { - MEDCouplingAutoRefCountObjectPtr ret=self->buildDAInt(1,self->getNumberOfCompo()); + MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); MEDCoupling_DataArrayInt____imod___(ret,0,obj); Py_XINCREF(trueSelf); return trueSelf; @@ -4950,7 +4950,7 @@ namespace MEDCoupling virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception); int getHashCode() const throw(INTERP_KERNEL::Exception); bool empty() const throw(INTERP_KERNEL::Exception); - void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception); + void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception); void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception); void pushBackSilent(char val) throw(INTERP_KERNEL::Exception); char popBackSilent() throw(INTERP_KERNEL::Exception); @@ -4977,15 +4977,15 @@ namespace MEDCoupling void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception); void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception); char *getPointer() throw(INTERP_KERNEL::Exception); - DataArrayInt *getIdsEqual(char val) const throw(INTERP_KERNEL::Exception); - DataArrayInt *getIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception); - int locateTuple(const std::vector& tupl) const throw(INTERP_KERNEL::Exception); + DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception); + DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception); + int findIdFirstEqualTuple(const std::vector& tupl) const throw(INTERP_KERNEL::Exception); bool presenceOfTuple(const std::vector& tupl) const throw(INTERP_KERNEL::Exception); char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception); char getMaxValueInArray() const throw(INTERP_KERNEL::Exception); char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception); char getMinValueInArray() const throw(INTERP_KERNEL::Exception); - DataArrayInt *getIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception); + DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception); static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception); static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception); %extend @@ -5124,7 +5124,7 @@ namespace MEDCoupling public: static DataArrayByte *New(); DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception); - DataArrayByte *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception); + DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception); char byteValue() const throw(INTERP_KERNEL::Exception); %extend { @@ -5152,7 +5152,7 @@ namespace MEDCoupling int nbOfCompo=PyInt_AS_LONG(nbOfComp); if(nbOfCompo<0) throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !"); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayByte::New(); + MCAuto ret=DataArrayByte::New(); std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo); ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); return ret.retn(); @@ -5162,7 +5162,7 @@ namespace MEDCoupling } else {//DataArrayByte.New([1,3,4],3) - MEDCouplingAutoRefCountObjectPtr ret=DataArrayByte::New(); + MCAuto ret=DataArrayByte::New(); int tmpp1=-1; std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1); ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); @@ -5174,7 +5174,7 @@ namespace MEDCoupling } else {// DataArrayByte.New([1,3,4]) - MEDCouplingAutoRefCountObjectPtr ret=DataArrayByte::New(); + MCAuto ret=DataArrayByte::New(); int tmpp1=-1,tmpp2=-1; std::vector tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2); ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); @@ -5195,7 +5195,7 @@ namespace MEDCoupling int nbOfCompo=PyInt_AS_LONG(nbOfTuples); if(nbOfCompo<0) throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !"); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayByte::New(); + MCAuto ret=DataArrayByte::New(); ret->alloc(nbOfTuples1,nbOfCompo); return ret.retn(); } @@ -5207,7 +5207,7 @@ namespace MEDCoupling } else {//DataArrayByte.New(5) - MEDCouplingAutoRefCountObjectPtr ret=DataArrayByte::New(); + MCAuto ret=DataArrayByte::New(); ret->alloc(nbOfTuples1,1); return ret.retn(); } @@ -5281,24 +5281,24 @@ namespace MEDCoupling return self->presenceOfValue(vals2); } - int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception) + int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception) { int sz=-1,sw=-1; int ival=-1; std::vector ivval; const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval); std::vector vals2(sz); std::copy(pt,pt+sz,vals2.begin()); - return self->locateValue(vals2); + return self->findIdFirstEqual(vals2); } - int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception) + int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception) { int sz=-1,sw=-1; int ival=-1; std::vector ivval; const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval); std::vector vals(sz); std::copy(pt,pt+sz,vals.begin()); - return self->locateTuple(vals); + return self->findIdFirstEqualTuple(vals); } int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception) @@ -5351,13 +5351,13 @@ namespace MEDCoupling if(PyInt_Check(obj)) { int val=(int)PyInt_AS_LONG(obj); - return self->locateValue(val); + return self->findIdFirstEqual(val); } else throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !"); } default: - return MEDCoupling_DataArrayByte_locateTuple(self,obj); + return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj); } } @@ -5399,7 +5399,7 @@ namespace MEDCoupling std::pair > pt1,pc1; DataArrayInt *dt1=0,*dc1=0; convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1); - MEDCouplingAutoRefCountObjectPtr tmp; + MCAuto tmp; switch(sw2) { case 1: @@ -5642,7 +5642,7 @@ namespace MEDCoupling public: static DataArrayAsciiChar *New(); DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception); - DataArrayAsciiChar *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception); + DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception); char asciiCharValue() const throw(INTERP_KERNEL::Exception); %extend { @@ -5670,7 +5670,7 @@ namespace MEDCoupling int nbOfCompo=PyInt_AS_LONG(nbOfComp); if(nbOfCompo<0) throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !"); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayAsciiChar::New(); + MCAuto ret=DataArrayAsciiChar::New(); std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo); ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); return ret.retn(); @@ -5680,7 +5680,7 @@ namespace MEDCoupling } else {//DataArrayAsciiChar.New([1,3,4],3) - MEDCouplingAutoRefCountObjectPtr ret=DataArrayAsciiChar::New(); + MCAuto ret=DataArrayAsciiChar::New(); int tmpp1=-1; std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1); ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); @@ -5710,7 +5710,7 @@ namespace MEDCoupling else { // DataArrayAsciiChar.New([1,3,4]) - MEDCouplingAutoRefCountObjectPtr ret=DataArrayAsciiChar::New(); + MCAuto ret=DataArrayAsciiChar::New(); int tmpp1=-1,tmpp2=-1; std::vector tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2); ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); @@ -5732,7 +5732,7 @@ namespace MEDCoupling int nbOfCompo=PyInt_AS_LONG(nbOfTuples); if(nbOfCompo<0) throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !"); - MEDCouplingAutoRefCountObjectPtr ret=DataArrayAsciiChar::New(); + MCAuto ret=DataArrayAsciiChar::New(); ret->alloc(nbOfTuples1,nbOfCompo); return ret.retn(); } @@ -5744,7 +5744,7 @@ namespace MEDCoupling } else {//DataArrayAsciiChar.New(5) - MEDCouplingAutoRefCountObjectPtr ret=DataArrayAsciiChar::New(); + MCAuto ret=DataArrayAsciiChar::New(); ret->alloc(nbOfTuples1,1); return ret.retn(); } @@ -5823,30 +5823,30 @@ namespace MEDCoupling throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !"); } - int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception) + int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception) { if(PyString_Check(vals)) { Py_ssize_t sz=PyString_Size(vals); std::vector vals2(sz); std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin()); - return self->locateValue(vals2); + return self->findIdFirstEqual(vals2); } else - throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateValue : only strings in input supported !"); + throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !"); } - int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception) + int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception) { if(PyString_Check(tupl)) { Py_ssize_t sz=PyString_Size(tupl); std::vector vals(sz); std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin()); - return self->locateTuple(vals); + return self->findIdFirstEqualTuple(vals); } else - throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateTuple : only strings in input supported !"); + throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !"); } int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception) @@ -5904,7 +5904,7 @@ namespace MEDCoupling Py_ssize_t sz=PyString_Size(obj); char *pt=PyString_AsString(obj); if(sz==1) - return self->locateValue(pt[0]); + return self->findIdFirstEqual(pt[0]); else throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !"); } @@ -5912,7 +5912,7 @@ namespace MEDCoupling throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !"); } default: - return MEDCoupling_DataArrayAsciiChar_locateTuple(self,obj); + return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj); } } @@ -5956,7 +5956,7 @@ namespace MEDCoupling case 2: return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 ); case 3: - return convertDataArrayChar(self->selectByTupleId2(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 ); + return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 ); case 4: return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 ); default: @@ -5991,14 +5991,14 @@ namespace MEDCoupling //value string case 2: { - MEDCouplingAutoRefCountObjectPtr tmp=DataArrayAsciiChar::New(sc); + MCAuto tmp=DataArrayAsciiChar::New(sc); self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false); return self; } //value vector case 3: { - MEDCouplingAutoRefCountObjectPtr tmp=DataArrayAsciiChar::New(vsc,' '); + MCAuto tmp=DataArrayAsciiChar::New(vsc,' '); self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false); return self; } @@ -6025,14 +6025,14 @@ namespace MEDCoupling //value string case 2: { - MEDCouplingAutoRefCountObjectPtr tmp=DataArrayAsciiChar::New(sc); + MCAuto tmp=DataArrayAsciiChar::New(sc); self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false); return self; } //value vector case 3: { - MEDCouplingAutoRefCountObjectPtr tmp=DataArrayAsciiChar::New(vsc,' '); + MCAuto tmp=DataArrayAsciiChar::New(vsc,' '); self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false); return self; } @@ -6060,14 +6060,14 @@ namespace MEDCoupling //value string case 2: { - MEDCouplingAutoRefCountObjectPtr tmp=DataArrayAsciiChar::New(sc); + MCAuto tmp=DataArrayAsciiChar::New(sc); self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false); return self; } //value vector case 3: { - MEDCouplingAutoRefCountObjectPtr tmp=DataArrayAsciiChar::New(vsc,' '); + MCAuto tmp=DataArrayAsciiChar::New(vsc,' '); self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false); return self; } @@ -6095,14 +6095,14 @@ namespace MEDCoupling //value string case 2: { - MEDCouplingAutoRefCountObjectPtr tmp=DataArrayAsciiChar::New(sc); + MCAuto tmp=DataArrayAsciiChar::New(sc); self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false); return self; } //value vector case 3: { - MEDCouplingAutoRefCountObjectPtr tmp=DataArrayAsciiChar::New(vsc,' '); + MCAuto tmp=DataArrayAsciiChar::New(vsc,' '); self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false); return self; } diff --git a/src/MEDCoupling_Swig/MEDCouplingNumPyTest.py b/src/MEDCoupling_Swig/MEDCouplingNumPyTest.py index 308e33e27..3fbc1488a 100644 --- a/src/MEDCoupling_Swig/MEDCouplingNumPyTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingNumPyTest.py @@ -102,7 +102,7 @@ class MEDCouplingNumPyTest(unittest.TestCase): d=DataArrayInt(a) self.assertEqual(weakref.getweakrefcount(a),1) self.assertTrue(not a.flags["OWNDATA"]) - self.assertTrue(d.isIdentity2(20)) + self.assertTrue(d.isIota(20)) a[:]=2 # modifying a and d because a and d share the same chunk of data self.assertTrue(d.isUniform(2)) del d # d is destroyed, a retrieves its ownership of its initial chunk of data @@ -119,8 +119,8 @@ class MEDCouplingNumPyTest(unittest.TestCase): a=arange(20,dtype=int32) d=DataArrayInt(a) # d owns data of a e=DataArrayInt(a) # a not owned -> e only an access to chunk of a - self.assertTrue(d.isIdentity2(d.getNumberOfTuples())) - self.assertTrue(e.isIdentity2(e.getNumberOfTuples())) + self.assertTrue(d.isIota(d.getNumberOfTuples())) + self.assertTrue(e.isIota(e.getNumberOfTuples())) a[:]=6 self.assertTrue(d.isUniform(6)) self.assertTrue(e.isUniform(6)) @@ -154,13 +154,13 @@ class MEDCouplingNumPyTest(unittest.TestCase): del b # no impact on e and f because a is the base of a. ##@@ Ensure a pass of the garbage collector so that the de-allocator of d is called gc.collect() - self.assertTrue(f.isIdentity2(f.getNumberOfTuples())) - self.assertTrue(e.isIdentity2(e.getNumberOfTuples())) + self.assertTrue(f.isIota(f.getNumberOfTuples())) + self.assertTrue(e.isIota(e.getNumberOfTuples())) del a # a destroyed, but as c has its base set to a, a exists -> e and f not allocated ##@@ Ensure a pass of the garbage collector so that the de-allocator of d is called gc.collect() - self.assertTrue(f.isIdentity2(f.getNumberOfTuples())) - self.assertTrue(e.isIdentity2(e.getNumberOfTuples())) + self.assertTrue(f.isIota(f.getNumberOfTuples())) + self.assertTrue(e.isIota(e.getNumberOfTuples())) del c # c killed -> a killed -> e and d are put into not allocated state ##@@ Ensure a pass of the garbage collector so that the de-allocator of d is called gc.collect() @@ -562,33 +562,33 @@ class MEDCouplingNumPyTest(unittest.TestCase): b=DataArrayInt(a) c=DataArrayInt(a) d=DataArrayInt(a) - self.assertTrue(b.isIdentity2(10)) - self.assertTrue(c.isIdentity2(10)) - self.assertTrue(d.isIdentity2(10)) + self.assertTrue(b.isIota(10)) + self.assertTrue(c.isIota(10)) + self.assertTrue(d.isIota(10)) c.pushBackSilent(10) # c and a,b are dissociated - self.assertTrue(b.isIdentity2(10)) - self.assertTrue(c.isIdentity2(11)) - self.assertTrue(d.isIdentity2(10)) + self.assertTrue(b.isIota(10)) + self.assertTrue(c.isIota(11)) + self.assertTrue(d.isIota(10)) del a gc.collect() - self.assertTrue(b.isIdentity2(10)) - self.assertTrue(c.isIdentity2(11)) + self.assertTrue(b.isIota(10)) + self.assertTrue(c.isIota(11)) self.assertTrue(not d.isAllocated()) del b gc.collect() - self.assertTrue(c.isIdentity2(11)) + self.assertTrue(c.isIota(11)) # a=arange(10,dtype=int32) b=DataArrayInt(a) c=DataArrayInt(a) - self.assertTrue(b.isIdentity2(10)) - self.assertTrue(c.isIdentity2(10)) + self.assertTrue(b.isIota(10)) + self.assertTrue(c.isIota(10)) b.pushBackSilent(10) # c and a,b are dissociated - self.assertTrue(b.isIdentity2(11)) - self.assertTrue(c.isIdentity2(10)) + self.assertTrue(b.isIota(11)) + self.assertTrue(c.isIota(10)) del a gc.collect() - self.assertTrue(b.isIdentity2(11)) + self.assertTrue(b.isIota(11)) self.assertTrue(not c.isAllocated()) del b gc.collect() diff --git a/src/MEDCoupling_Swig/MEDCouplingPickleTest.py b/src/MEDCoupling_Swig/MEDCouplingPickleTest.py index 677b11082..4b954c468 100644 --- a/src/MEDCoupling_Swig/MEDCouplingPickleTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingPickleTest.py @@ -71,7 +71,7 @@ class MEDCouplingPickleTest(unittest.TestCase): m=m.buildUnstructured() m.setName("mesh") m.getCoords().setInfoOnComponents(["aa","bbb","ddddd"]) - m.checkCoherency() + m.checkConsistencyLight() st=cPickle.dumps(m,cPickle.HIGHEST_PROTOCOL) m2=cPickle.loads(st) self.assertTrue(m2.isEqual(m,1e-16)) @@ -85,7 +85,7 @@ class MEDCouplingPickleTest(unittest.TestCase): m=m.buildUnstructured() m.setName("mesh") m.getCoords().setInfoOnComponents(["aa","bbb","ddddd"]) - m.checkCoherency() + m.checkConsistencyLight() # a0,a1,a2=m.getTinySerializationInformation() b0,b1=m.serialize() @@ -103,7 +103,7 @@ class MEDCouplingPickleTest(unittest.TestCase): # m=MEDCouplingCMesh() ; m.setCoords(arrX,arrY,arrZ) m.setName("mesh") - m.checkCoherency() + m.checkConsistencyLight() st=cPickle.dumps(m,cPickle.HIGHEST_PROTOCOL) m2=cPickle.loads(st) self.assertTrue(m2.isEqual(m,1e-16)) @@ -137,7 +137,7 @@ class MEDCouplingPickleTest(unittest.TestCase): @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy") def test8(self): - """ Test of a MEDCouplingExtrudedMesh pickeling.""" + """ Test of a MEDCouplingMappedExtrudedMesh pickeling.""" arrX=DataArrayDouble(10) ; arrX.iota() ; arrX.setInfoOnComponents(["aa"]) arrY=DataArrayDouble(5) ; arrY.iota() ; arrY.setInfoOnComponents(["bbb"]) arrZ=DataArrayDouble(7) ; arrZ.iota() ; arrZ.setInfoOnComponents(["cccc"]) @@ -148,8 +148,8 @@ class MEDCouplingPickleTest(unittest.TestCase): mesh2D=m.buildUnstructured() ; del m # mesh2D.setCoords(mesh3D.getCoords()) - mesh=MEDCouplingExtrudedMesh(mesh3D,mesh2D,0) ; del mesh3D,mesh2D - self.assertTrue(isinstance(mesh,MEDCouplingExtrudedMesh)) + mesh=MEDCouplingMappedExtrudedMesh(mesh3D,mesh2D,0) ; del mesh3D,mesh2D + self.assertTrue(isinstance(mesh,MEDCouplingMappedExtrudedMesh)) st=cPickle.dumps(mesh,cPickle.HIGHEST_PROTOCOL) m2=cPickle.loads(st) self.assertTrue(m2.isEqual(mesh,1e-16)) @@ -174,7 +174,7 @@ class MEDCouplingPickleTest(unittest.TestCase): def test10(self): """ Test of a MEDCouplingIMesh pickeling.""" m=MEDCouplingIMesh("mesh",3,DataArrayInt([3,1,4]),DataArrayDouble([1.5,2.5,3.5]),DataArrayDouble((0.5,1.,0.25))) ; m.setAxisUnit("km") - m.checkCoherency() + m.checkConsistencyLight() st=cPickle.dumps(m,cPickle.HIGHEST_PROTOCOL) m2=cPickle.loads(st) self.assertTrue(m2.isEqual(m,1e-16)) @@ -193,7 +193,7 @@ class MEDCouplingPickleTest(unittest.TestCase): b=a[:] ; b.iota(7000.) f.setArray(DataArrayDouble.Meld(a,b)) f.getArray().setInfoOnComponents(["u1","vv2"]) - f.checkCoherency(); + f.checkConsistencyLight(); # st=cPickle.dumps(f,cPickle.HIGHEST_PROTOCOL) f2=cPickle.loads(st) @@ -239,13 +239,13 @@ class MEDCouplingPickleTest(unittest.TestCase): ptr=array.getPointer(); f.setArray(array); f.setName("MyFirstFieldOnGaussPoint"); - f.checkCoherency(); + f.checkConsistencyLight(); self.assertAlmostEqual(27.,f.getIJK(2,5,0),14); self.assertAlmostEqual(16.,f.getIJK(1,5,1),14); # f.clearGaussLocalizations(); self.assertEqual(0,f.getNbOfGaussLocalization()); - self.assertRaises(InterpKernelException,f.checkCoherency); + self.assertRaises(InterpKernelException,f.checkConsistencyLight); ids1=[0,1,3,4] self.assertRaises(InterpKernelException,f.setGaussLocalizationOnCells,ids1,_refCoo2,_gsCoo1,_wg1); self.assertEqual(0,f.getNbOfGaussLocalization()); @@ -260,7 +260,7 @@ class MEDCouplingPickleTest(unittest.TestCase): self.assertEqual(0,f.getGaussLocalizationIdOfOneCell(0)); self.assertEqual(1,f.getGaussLocalizationIdOfOneCell(1)); self.assertEqual(1,f.getGaussLocalizationIdOfOneCell(2)); - self.assertRaises(InterpKernelException,f.checkCoherency);#<- cell 3 has no localization + self.assertRaises(InterpKernelException,f.checkConsistencyLight);#<- cell 3 has no localization ids4=[3] _gsCoo2=_gsCoo1; _wg2=_wg1; @@ -270,10 +270,10 @@ class MEDCouplingPickleTest(unittest.TestCase): self.assertEqual(3,f.getNbOfGaussLocalization()); tmpIds=f.getCellIdsHavingGaussLocalization(0); self.assertEqual(ids2,list(tmpIds.getValues())); - self.assertRaises(InterpKernelException,f.checkCoherency);#<- it's always not ok because undelying array not with the good size. + self.assertRaises(InterpKernelException,f.checkConsistencyLight);#<- it's always not ok because undelying array not with the good size. array2=f.getArray().substr(0,10); f.setArray(array2); - f.checkCoherency(); + f.checkConsistencyLight(); #### st=cPickle.dumps(f,cPickle.HIGHEST_PROTOCOL) f2=cPickle.loads(st) diff --git a/src/MEDCoupling_Swig/MEDCouplingRemapper.i b/src/MEDCoupling_Swig/MEDCouplingRemapper.i index 696df19e7..4aea9b44a 100644 --- a/src/MEDCoupling_Swig/MEDCouplingRemapper.i +++ b/src/MEDCoupling_Swig/MEDCouplingRemapper.i @@ -216,7 +216,7 @@ def MEDCouplingIMeshnew(cls,*args): return _MEDCouplingRemapper.MEDCouplingIMesh____new___(cls,args) def MEDCouplingExtrudedMeshnew(cls,*args): import _MEDCouplingRemapper - return _MEDCouplingRemapper.MEDCouplingExtrudedMesh____new___(cls,args) + return _MEDCouplingRemapper.MEDCouplingMappedExtrudedMesh____new___(cls,args) %} %include "MEDCouplingFinalize.i" diff --git a/src/MEDCoupling_Swig/MEDCouplingRemapperTest.py b/src/MEDCoupling_Swig/MEDCouplingRemapperTest.py index 2edf0257f..fbaae1126 100644 --- a/src/MEDCoupling_Swig/MEDCouplingRemapperTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingRemapperTest.py @@ -32,7 +32,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): remapper.setIntersectionType(Triangulation); self.failUnless(remapper.prepare(sourceMesh,targetMesh,"P0P0")==1); srcField=MEDCouplingFieldDouble.New(ON_CELLS); - srcField.setNature(ConservativeVolumic); + srcField.setNature(IntensiveMaximum); srcField.setMesh(sourceMesh); array=DataArrayDouble.New(); ptr=sourceMesh.getNumberOfCells()*[None] @@ -71,7 +71,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): trgFt.setMesh(targetMesh); self.assertEqual(1,remapper.prepareEx(srcFt,trgFt)); srcField=MEDCouplingFieldDouble.New(ON_CELLS); - srcField.setNature(ConservativeVolumic); + srcField.setNature(IntensiveMaximum); srcField.setMesh(sourceMesh); array=DataArrayDouble.New(); ptr=sourceMesh.getNumberOfCells()*[None] @@ -103,7 +103,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): trgFt.setMesh(targetMesh); self.assertEqual(1,remapper.prepareEx(srcFt,trgFt)); srcField=MEDCouplingFieldDouble.New(ON_CELLS); - srcField.setNature(ConservativeVolumic); + srcField.setNature(IntensiveMaximum); srcField.setMesh(sourceMesh); array=DataArrayDouble.New(); ptr=sourceMesh.getNumberOfCells()*[None] @@ -113,7 +113,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): array.setValues(ptr,sourceMesh.getNumberOfCells(),1); srcField.setArray(array); trgfield=MEDCouplingFieldDouble.New(ON_CELLS); - trgfield.setNature(ConservativeVolumic); + trgfield.setNature(IntensiveMaximum); trgfield.setMesh(targetMesh); array=DataArrayDouble.New(); ptr=targetMesh.getNumberOfCells()*[None] @@ -140,7 +140,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): trg=MEDCouplingCMesh() ; arr=DataArrayDouble([-0.7,-0.1,0.2,0.7,2.,2.3]) trg.setCoordsAt(0,arr) fieldSrc=MEDCouplingFieldDouble(ON_CELLS,NO_TIME) ; fieldSrc.setMesh(src) ; arrSrc=DataArrayDouble([10.,30.]) - fieldSrc.setNature(Integral) ; fieldSrc.setArray(arrSrc) + fieldSrc.setNature(ExtensiveMaximum) ; fieldSrc.setArray(arrSrc) rem=MEDCouplingRemapper() rem.prepare(src,trg,"P0P0") trgField=rem.transferField(fieldSrc,-7.) @@ -157,7 +157,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): trg=MEDCouplingCMesh() ; arr=DataArrayDouble([-0.7,-0.1,0.2,0.7,2.,2.3]) trg.setCoordsAt(0,arr) ; trg.setCoordsAt(1,arr) fieldSrc=MEDCouplingFieldDouble(ON_CELLS,NO_TIME) ; fieldSrc.setMesh(src) ; arrSrc=DataArrayDouble([10.,30.]) - fieldSrc.setNature(Integral) ; fieldSrc.setArray(arrSrc) + fieldSrc.setNature(ExtensiveMaximum) ; fieldSrc.setArray(arrSrc) rem=MEDCouplingRemapper() rem.prepare(src,trg,"P0P0") trgField=rem.transferField(fieldSrc,-7.) @@ -173,10 +173,10 @@ class MEDCouplingBasicsTest(unittest.TestCase): src.allocateCells(2) ; src.insertNextCell(NORM_TETRA4,[0,1,2,5]) ; src.insertNextCell(NORM_TETRA4,[3,4,0,6]) ; src.finishInsertingCells() trg=MEDCouplingCMesh() ; arr=DataArrayDouble([-0.7,-0.1,0.2,0.7,2.,2.3]) ; arr2=DataArrayDouble([-0.7,0.2,0.6,1.2,2.]) trg.setCoordsAt(0,arr) ; trg.setCoordsAt(1,arr) ; trg.setCoordsAt(2,arr2) - src.checkCoherency1(1e-10) - trg.checkCoherency() + src.checkConsistency(1e-10) + trg.checkConsistencyLight() fieldSrc=MEDCouplingFieldDouble(ON_CELLS,NO_TIME) ; fieldSrc.setMesh(src) ; arrSrc=DataArrayDouble([10.,30.]) - fieldSrc.setNature(Integral) ; fieldSrc.setArray(arrSrc) + fieldSrc.setNature(ExtensiveMaximum) ; fieldSrc.setArray(arrSrc) rem=MEDCouplingRemapper() rem.prepare(src,trg,"P0P0") trgField=rem.transferField(fieldSrc,-7.) @@ -196,7 +196,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): src=MEDCouplingCMesh() ; arr=DataArrayDouble([-0.7,-0.1,0.2,0.7,2.,2.3]) src.setCoordsAt(0,arr) fieldSrc=MEDCouplingFieldDouble(ON_CELLS,NO_TIME) ; fieldSrc.setMesh(src) ; arrTrg=DataArrayDouble([10.,30.,40.,70.,80.]) - fieldSrc.setNature(Integral) ; fieldSrc.setArray(arrTrg) + fieldSrc.setNature(ExtensiveMaximum) ; fieldSrc.setArray(arrTrg) rem=MEDCouplingRemapper() rem.prepare(src,trg,"P0P0") trgField=rem.transferField(fieldSrc,-7.) @@ -213,7 +213,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): src=MEDCouplingCMesh() ; arr=DataArrayDouble([-0.7,-0.1,0.2,0.7,2.,2.3]) src.setCoordsAt(0,arr) ; src.setCoordsAt(1,arr) fieldSrc=MEDCouplingFieldDouble(ON_CELLS,NO_TIME) ; fieldSrc.setMesh(src) ; arrSrc=DataArrayDouble([10.,30.,40.,70.,80.,110.,130.,140.,170.,180.,210.,230.,240.,270.,280.,310.,330.,340.,370.,380.,410.,430.,440.,470.,480.]) - fieldSrc.setNature(Integral) ; fieldSrc.setArray(arrSrc) + fieldSrc.setNature(ExtensiveMaximum) ; fieldSrc.setArray(arrSrc) rem=MEDCouplingRemapper() rem.prepare(src,trg,"P0P0") trgField=rem.transferField(fieldSrc,-7.) @@ -229,10 +229,10 @@ class MEDCouplingBasicsTest(unittest.TestCase): trg.allocateCells(2) ; trg.insertNextCell(NORM_TETRA4,[0,1,2,5]) ; trg.insertNextCell(NORM_TETRA4,[3,4,0,6]) ; trg.finishInsertingCells() src=MEDCouplingCMesh() ; arr=DataArrayDouble([-0.7,-0.1,0.2,0.7,2.,2.3]) ; arr2=DataArrayDouble([-0.7,0.2,0.6,1.2,2.]) src.setCoordsAt(0,arr) ; src.setCoordsAt(1,arr) ; src.setCoordsAt(2,arr2) - trg.checkCoherency1(1e-10) - src.checkCoherency() + trg.checkConsistency(1e-10) + src.checkConsistencyLight() fieldSrc=MEDCouplingFieldDouble(ON_CELLS,NO_TIME) ; fieldSrc.setMesh(src) ; arrSrc=DataArrayDouble(100) ; arrSrc.iota(7.7) - fieldSrc.setNature(Integral) ; fieldSrc.setArray(arrSrc) + fieldSrc.setNature(ExtensiveMaximum) ; fieldSrc.setArray(arrSrc) rem=MEDCouplingRemapper() rem.prepare(src,trg,"P0P0") trgField=rem.transferField(fieldSrc,-7.) @@ -251,7 +251,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): trg=MEDCouplingCMesh() ; arr=DataArrayDouble([-0.9,-0.1,0.15]) trg.setCoordsAt(0,arr) fieldSrc=MEDCouplingFieldDouble(ON_CELLS,NO_TIME) ; fieldSrc.setMesh(src) ; arrTrg=DataArrayDouble([10.,30.,40.,70.,80.]) - fieldSrc.setNature(Integral) ; fieldSrc.setArray(arrTrg) + fieldSrc.setNature(ExtensiveMaximum) ; fieldSrc.setArray(arrTrg) rem=MEDCouplingRemapper() rem.prepare(src,trg,"P0P0") trgField=rem.transferField(fieldSrc,-7.) @@ -267,7 +267,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): trg=MEDCouplingCMesh() ; arr=DataArrayDouble([-0.9,-0.1,0.15]) trg.setCoordsAt(0,arr) ; trg.setCoordsAt(1,arr) fieldSrc=MEDCouplingFieldDouble(ON_CELLS,NO_TIME) ; fieldSrc.setMesh(src) ; arrSrc=DataArrayDouble([10.,30.,40.,70.,80.,110.,130.,140.,170.,180.,210.,230.,240.,270.,280.,310.,330.,340.,370.,380.,410.,430.,440.,470.,480.]) - fieldSrc.setNature(Integral) ; fieldSrc.setArray(arrSrc) + fieldSrc.setNature(ExtensiveMaximum) ; fieldSrc.setArray(arrSrc) rem=MEDCouplingRemapper() rem.prepare(src,trg,"P0P0") trgField=rem.transferField(fieldSrc,-7.) @@ -283,7 +283,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): trg=MEDCouplingCMesh() ; arr=DataArrayDouble([-0.9,-0.1,0.15]) trg.setCoordsAt(0,arr) ; trg.setCoordsAt(1,arr) ; trg.setCoordsAt(2,arr) fieldSrc=MEDCouplingFieldDouble(ON_CELLS,NO_TIME) ; fieldSrc.setMesh(src) ; arrSrc=DataArrayDouble(125) ; arrSrc.iota(7.7) - fieldSrc.setNature(Integral) ; fieldSrc.setArray(arrSrc) ; fieldSrc.checkCoherency() + fieldSrc.setNature(ExtensiveMaximum) ; fieldSrc.setArray(arrSrc) ; fieldSrc.checkConsistencyLight() rem=MEDCouplingRemapper() rem.prepare(src,trg,"P0P0") trgField=rem.transferField(fieldSrc,-7.) @@ -313,14 +313,14 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertAlmostEqual(1.25884086663e-06,mat1[0][1],16) ; self.assertAlmostEqual(1.25884086663e-06,mat2[0][1],16) # d=DataArrayDouble([13.45,27.67],2,1) - f1=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) ; f1.setMesh(src1) ; f1.setArray(d) ; f1.setNature(RevIntegral) - f2=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) ; f2.setMesh(src2) ; f2.setArray(d) ; f2.setNature(RevIntegral) + f1=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) ; f1.setMesh(src1) ; f1.setArray(d) ; f1.setNature(IntensiveConservation) + f2=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) ; f2.setMesh(src2) ; f2.setArray(d) ; f2.setNature(IntensiveConservation) f11=rem1.transferField(f1,1e300) ; f22=rem2.transferField(f2,1e300) expected1=DataArrayDouble([0.012480539537637884]) self.assertTrue(f11.getArray().isEqual(expected1,1e-15)) self.assertTrue(f22.getArray().isEqual(expected1,1e-15)) # - f1.setNature(Integral) ; f2.setNature(Integral) + f1.setNature(ExtensiveMaximum) ; f2.setNature(ExtensiveMaximum) f11=rem1.transferField(f1,1e300) ; f22=rem2.transferField(f2,1e300) # expected2=DataArrayDouble([41.12]) @@ -337,8 +337,8 @@ class MEDCouplingBasicsTest(unittest.TestCase): # n2o=um.simplexize(PLANAR_FACE_5) f.setArray(f.getArray()[n2o]) - f.checkCoherency() - f.setNature(ConservativeVolumic) + f.checkConsistencyLight() + f.setNature(IntensiveMaximum) f.setTime(5.6,7,8) f.setName("toto") ; f.setDescription("aDescription") p=MEDCouplingRemapper() @@ -426,7 +426,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): def testSwig2MixOfUMesh(self): arr0=DataArrayDouble([0,1,1.5]) ; arr1=DataArrayDouble([0,1]) sc=MEDCouplingCMesh() ; sc.setCoords(arr0,arr1,arr1) - tc=sc.deepCpy() ; tc.translate([0.4,0.3,0.3]) + tc=sc.deepCopy() ; tc.translate([0.4,0.3,0.3]) # umesh-umesh # 90 (umesh-1sgtumesh) rem=MEDCouplingRemapper() ; rem.setIntersectionType(Triangulation) @@ -511,7 +511,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): # (umesh-cmesh) # 167 (1sgtumesh-cmesh) rem=MEDCouplingRemapper() ; rem.setIntersectionType(Triangulation) - s=sc.build1SGTUnstructured() ; t=tc.deepCpy() + s=sc.build1SGTUnstructured() ; t=tc.deepCopy() self.assertTrue(isinstance(s,MEDCoupling1SGTUMesh)) self.assertTrue(isinstance(t,MEDCouplingCMesh)) rem.prepare(s,t,"P0P0") @@ -521,7 +521,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): del s,t # 183 (1dgtumesh-cmesh) #rem=MEDCouplingRemapper() ; rem.setIntersectionType(Triangulation) - #s=sc.buildUnstructured() ; s.convertAllToPoly() ; s=MEDCoupling1DGTUMesh(s) ; t=tc.deepCpy() + #s=sc.buildUnstructured() ; s.convertAllToPoly() ; s=MEDCoupling1DGTUMesh(s) ; t=tc.deepCopy() #self.assertTrue(isinstance(s,MEDCoupling1DGTUMesh)) #self.assertTrue(isinstance(t,MEDCouplingCMesh)) #rem.prepare(s,t,"P0P0") @@ -532,7 +532,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): # (cmesh-umesh) # 122 (cmesh-1sgtumesh) rem=MEDCouplingRemapper() ; rem.setIntersectionType(Triangulation) - s=sc.deepCpy() ; t=tc.build1SGTUnstructured() + s=sc.deepCopy() ; t=tc.build1SGTUnstructured() self.assertTrue(isinstance(s,MEDCouplingCMesh)) self.assertTrue(isinstance(t,MEDCoupling1SGTUMesh)) rem.prepare(s,t,"P0P0") @@ -542,7 +542,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): del s,t # 123 (cmesh-1dgtumesh) #rem=MEDCouplingRemapper() ; rem.setIntersectionType(Triangulation) - #s=sc.deepCpy() ; t=tc.buildUnstructured() ; t.convertAllToPoly() ; t=MEDCoupling1DGTUMesh(t) + #s=sc.deepCopy() ; t=tc.buildUnstructured() ; t.convertAllToPoly() ; t=MEDCoupling1DGTUMesh(t) #self.assertTrue(isinstance(s,MEDCouplingCMesh)) #self.assertTrue(isinstance(t,MEDCoupling1DGTUMesh)) #rem.prepare(s,t,"P0P0") @@ -597,7 +597,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): arr=DataArrayDouble(3) ; arr.iota() m=MEDCouplingCMesh() ; m.setCoords(arr,arr) src=m.buildUnstructured() - trg=src.deepCpy() ; trg=trg[[0,1,3]] + trg=src.deepCopy() ; trg=trg[[0,1,3]] trg.getCoords()[:]*=0.5 ; trg.getCoords()[:]+=[0.3,0.25] # Let's interpolate. rem=MEDCouplingRemapper() @@ -618,7 +618,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertAlmostEqual(m[2,2],0.05,12) self.assertAlmostEqual(m[2,3],0.075,12) self.assertEqual(diff.getnnz(),0) - # IntegralGlobConstraint (division by sum of cols) + # ExtensiveConservation (division by sum of cols) colSum=m.sum(axis=0) # version 0.12.0 # m_0=m*diags(array(1/colSum),[0]) m_0=m*spdiags(array(1/colSum),[0],colSum.shape[1],colSum.shape[1]) @@ -631,7 +631,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertAlmostEqual(m_0[2,2],1.,12) self.assertAlmostEqual(m_0[2,3],1.,12) self.assertEqual(m_0.getnnz(),7) - # ConservativeVolumic (division by sum of rows) + # IntensiveMaximum (division by sum of rows) rowSum=m.sum(axis=1) # version 0.12.0 # m_1=diags(array(1/rowSum.transpose()),[0])*m m_1=spdiags(array(1/rowSum.transpose()),[0],rowSum.shape[0],rowSum.shape[0])*m @@ -681,7 +681,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): pass vals*=1e-5 eps0=DataArrayDouble(m0.data)-vals ; eps0.abs() - self.assertTrue(eps0.getIdsInRange(1e-17,1e300).empty()) + self.assertTrue(eps0.findIdsInRange(1e-17,1e300).empty()) self.assertTrue(DataArrayInt(m0.indices).isEqual(DataArrayInt([0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27,0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27,0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27]))) self.assertTrue(DataArrayInt(m0.indptr).isEqual(DataArrayInt([0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,90,93,96,99,102,105,108,111,114,117,120,123,126,129,132,135,138,141,144,147,150,153,156,159,162,165,168,171,174,177,180,183,186,189,192,195,198,201,204,207,210,213,216,219,222,225,228,231,234,237,240,243,246,249,252,255,258,261,264,267,270,273,276,279,282,285,288,291,294,297,300,303,306,309,312]))) # @@ -706,7 +706,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): # m is ready m1,d,di,rd,rdi=m.buildUnstructured().buildDescendingConnectivity() rdi2=rdi.deltaShiftIndex() - cellIds=rdi2.getIdsEqual(1) + cellIds=rdi2.findIdsEqual(1) skinAndNonConformCells=m1[cellIds] skinAndNonConformCells.zipCoords() # at this point skinAndNonConformCells contains non conform cells and skin cells. Now trying to split them in two parts. # @@ -717,8 +717,8 @@ class MEDCouplingBasicsTest(unittest.TestCase): mat=rem.getCrudeCSRMatrix() indptr=DataArrayInt(mat.indptr) indptr2=indptr.deltaShiftIndex() - cellIdsOfNonConformCells=indptr2.getIdsNotEqual(1) - cellIdsOfSkin=indptr2.getIdsEqual(1) + cellIdsOfNonConformCells=indptr2.findIdsNotEqual(1) + cellIdsOfSkin=indptr2.findIdsEqual(1) self.assertTrue(cellIdsOfSkin.isEqual(DataArrayInt([1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,19,20,21,23]))) self.assertTrue(cellIdsOfNonConformCells.isEqual(DataArrayInt([0,4,18,22]))) pass @@ -744,7 +744,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): fsource.setMesh(source) arr=DataArrayDouble(len(sourceCoo)) ; arr.iota(0.7) ; arr*=arr fsource.setArray(arr) - fsource.setNature(ConservativeVolumic) + fsource.setNature(IntensiveMaximum) # rem=MEDCouplingRemapper() rem.setIntersectionType(PointLocator) @@ -773,11 +773,11 @@ class MEDCouplingBasicsTest(unittest.TestCase): srcMesh=m[0].getMesh().buildUnstructured() srcField=MEDCouplingFieldDouble(ON_CELLS) fine2=DataArrayDouble(3*2*4*4) ; fine2.iota(0) ; srcField.setArray(fine2) - srcField.setMesh(srcMesh) ; srcField.setNature(Integral) + srcField.setMesh(srcMesh) ; srcField.setNature(ExtensiveMaximum) # trgField=MEDCouplingFieldDouble(ON_CELLS) coarse2=DataArrayDouble(35) ; coarse2.iota(0) ; trgField.setArray(coarse2) - trgField.setMesh(trgMesh) ; trgField.setNature(Integral) + trgField.setMesh(trgMesh) ; trgField.setNature(ExtensiveMaximum) # rem=MEDCouplingRemapper() rem.prepare(srcMesh,trgMesh,"P0P0") diff --git a/src/MEDCoupling_Swig/MEDCouplingTimeDiscretization.i b/src/MEDCoupling_Swig/MEDCouplingTimeDiscretization.i index f4c285bc1..fc7274445 100644 --- a/src/MEDCoupling_Swig/MEDCouplingTimeDiscretization.i +++ b/src/MEDCoupling_Swig/MEDCouplingTimeDiscretization.i @@ -28,7 +28,7 @@ namespace MEDCoupling const char *getTimeUnit() const; virtual void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other) throw(INTERP_KERNEL::Exception); virtual void copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other) throw(INTERP_KERNEL::Exception); - virtual void checkCoherency() const throw(INTERP_KERNEL::Exception); + virtual void checkConsistencyLight() const throw(INTERP_KERNEL::Exception); virtual bool areCompatible(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception); virtual bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other, std::string& reason) const throw(INTERP_KERNEL::Exception); virtual bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception); @@ -37,7 +37,7 @@ namespace MEDCoupling virtual bool isEqualIfNotWhy(const MEDCouplingTimeDiscretization *other, double prec, std::string& reason) const throw(INTERP_KERNEL::Exception); virtual bool isEqual(const MEDCouplingTimeDiscretization *other, double prec) const throw(INTERP_KERNEL::Exception); virtual bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const throw(INTERP_KERNEL::Exception); - virtual MEDCouplingTimeDiscretization *buildNewTimeReprFromThis(TypeOfTimeDiscretization type, bool deepCpy) const throw(INTERP_KERNEL::Exception); + virtual MEDCouplingTimeDiscretization *buildNewTimeReprFromThis(TypeOfTimeDiscretization type, bool deepCopy) const throw(INTERP_KERNEL::Exception); virtual std::string getStringRepr() const throw(INTERP_KERNEL::Exception); virtual TypeOfTimeDiscretization getEnum() const throw(INTERP_KERNEL::Exception); virtual void synchronizeTimeWith(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception); @@ -58,7 +58,7 @@ namespace MEDCoupling virtual void divideEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception); virtual MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const throw(INTERP_KERNEL::Exception); virtual void powEqual(const MEDCouplingTimeDiscretization *other) throw(INTERP_KERNEL::Exception); - virtual MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception); + virtual MEDCouplingTimeDiscretization *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception); void setTimeTolerance(double val); double getTimeTolerance() const; virtual void checkNoTimePresence() const throw(INTERP_KERNEL::Exception); @@ -112,15 +112,15 @@ namespace MEDCoupling virtual void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception); virtual void applyFunc(int nbOfComp, FunctionToEvaluate func) throw(INTERP_KERNEL::Exception); virtual void applyFunc(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception); - virtual void applyFunc2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception); - virtual void applyFunc3(int nbOfComp, const std::vector& varsOrder, const char *func) throw(INTERP_KERNEL::Exception); + virtual void applyFuncCompo(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception); + virtual void applyFuncNamedCompo(int nbOfComp, const std::vector& varsOrder, const char *func) throw(INTERP_KERNEL::Exception); virtual void applyFunc(const char *func) throw(INTERP_KERNEL::Exception); virtual void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception); virtual void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception); virtual void fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, FunctionToEvaluate func) throw(INTERP_KERNEL::Exception); virtual void fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception); - virtual void fillFromAnalytic2(const DataArrayDouble *loc, int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception); - virtual void fillFromAnalytic3(const DataArrayDouble *loc, int nbOfComp, const std::vector& varsOrder, const char *func) throw(INTERP_KERNEL::Exception); + virtual void fillFromAnalyticCompo(const DataArrayDouble *loc, int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception); + virtual void fillFromAnalyticNamedCompo(const DataArrayDouble *loc, int nbOfComp, const std::vector& varsOrder, const char *func) throw(INTERP_KERNEL::Exception); // virtual ~MEDCouplingTimeDiscretization(); }; @@ -129,7 +129,7 @@ namespace MEDCoupling { public: MEDCouplingNoTimeLabel(); - MEDCouplingNoTimeLabel(const MEDCouplingTimeDiscretization& other, bool deepCpy); + MEDCouplingNoTimeLabel(const MEDCouplingTimeDiscretization& other, bool deepCopy); public: static const TypeOfTimeDiscretization DISCRETIZATION=NO_TIME; static const char REPR[]; @@ -148,7 +148,7 @@ namespace MEDCoupling { protected: MEDCouplingConstOnTimeInterval(); - MEDCouplingConstOnTimeInterval(const MEDCouplingConstOnTimeInterval& other, bool deepCpy); + MEDCouplingConstOnTimeInterval(const MEDCouplingConstOnTimeInterval& other, bool deepCopy); public: static const TypeOfTimeDiscretization DISCRETIZATION=CONST_ON_TIME_INTERVAL; static const char REPR[]; diff --git a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i index 12ba35c9a..4aa51443f 100644 --- a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i +++ b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i @@ -34,8 +34,8 @@ static PyObject *convertMesh(MEDCoupling::MEDCouplingMesh *mesh, int owner) thro ret=SWIG_NewPointerObj((void*)mesh,SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh,owner); if(dynamic_cast(mesh)) ret=SWIG_NewPointerObj((void*)mesh,SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh,owner); - if(dynamic_cast(mesh)) - ret=SWIG_NewPointerObj((void*)mesh,SWIGTYPE_p_MEDCoupling__MEDCouplingExtrudedMesh,owner); + if(dynamic_cast(mesh)) + ret=SWIG_NewPointerObj((void*)mesh,SWIGTYPE_p_MEDCoupling__MEDCouplingMappedExtrudedMesh,owner); if(dynamic_cast(mesh)) ret=SWIG_NewPointerObj((void*)mesh,SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh,owner); if(dynamic_cast(mesh)) @@ -177,9 +177,9 @@ static MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble__ { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret=self->getArray()->deepCpy(); + MEDCoupling::MCAuto ret=self->getArray()->deepCopy(); ret->applyLin(1.,val); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MEDCoupling::MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -187,8 +187,8 @@ static MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble__ { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret=MEDCoupling::DataArrayDouble::Add(self->getArray(),a); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MEDCoupling::MCAuto ret=MEDCoupling::DataArrayDouble::Add(self->getArray(),a); + MEDCoupling::MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -196,9 +196,9 @@ static MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble__ { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret=MEDCoupling::DataArrayDouble::Add(self->getArray(),aaa); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MEDCoupling::MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MEDCoupling::MCAuto ret=MEDCoupling::DataArrayDouble::Add(self->getArray(),aaa); + MEDCoupling::MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -206,9 +206,9 @@ static MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble__ { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr aaa=MEDCoupling::DataArrayDouble::New(); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size()); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret=MEDCoupling::DataArrayDouble::Add(self->getArray(),aaa); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MEDCoupling::MCAuto aaa=MEDCoupling::DataArrayDouble::New(); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size()); + MEDCoupling::MCAuto ret=MEDCoupling::DataArrayDouble::Add(self->getArray(),aaa); + MEDCoupling::MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -249,9 +249,9 @@ static MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble__ { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret=self->getArray()->deepCpy(); + MEDCoupling::MCAuto ret=self->getArray()->deepCopy(); ret->applyLin(-1.,val); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MEDCoupling::MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -259,8 +259,8 @@ static MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble__ { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret=MEDCoupling::DataArrayDouble::Substract(a,self->getArray()); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MEDCoupling::MCAuto ret=MEDCoupling::DataArrayDouble::Substract(a,self->getArray()); + MEDCoupling::MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -268,9 +268,9 @@ static MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble__ { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret=MEDCoupling::DataArrayDouble::Substract(aaa,self->getArray()); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MEDCoupling::MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MEDCoupling::MCAuto ret=MEDCoupling::DataArrayDouble::Substract(aaa,self->getArray()); + MEDCoupling::MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -278,9 +278,9 @@ static MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble__ { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr aaa=MEDCoupling::DataArrayDouble::New(); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size()); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret=MEDCoupling::DataArrayDouble::Substract(aaa,self->getArray()); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MEDCoupling::MCAuto aaa=MEDCoupling::DataArrayDouble::New(); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size()); + MEDCoupling::MCAuto ret=MEDCoupling::DataArrayDouble::Substract(aaa,self->getArray()); + MEDCoupling::MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -316,9 +316,9 @@ static MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble__ { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret=self->getArray()->deepCpy(); + MEDCoupling::MCAuto ret=self->getArray()->deepCopy(); ret->applyLin(val,0.); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MEDCoupling::MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -326,8 +326,8 @@ static MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble__ { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret=MEDCoupling::DataArrayDouble::Multiply(self->getArray(),a); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MEDCoupling::MCAuto ret=MEDCoupling::DataArrayDouble::Multiply(self->getArray(),a); + MEDCoupling::MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -335,9 +335,9 @@ static MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble__ { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret=MEDCoupling::DataArrayDouble::Multiply(self->getArray(),aaa); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MEDCoupling::MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MEDCoupling::MCAuto ret=MEDCoupling::DataArrayDouble::Multiply(self->getArray(),aaa); + MEDCoupling::MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -345,9 +345,9 @@ static MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble__ { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr aaa=MEDCoupling::DataArrayDouble::New(); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size()); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret=MEDCoupling::DataArrayDouble::Multiply(self->getArray(),aaa); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MEDCoupling::MCAuto aaa=MEDCoupling::DataArrayDouble::New(); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size()); + MEDCoupling::MCAuto ret=MEDCoupling::DataArrayDouble::Multiply(self->getArray(),aaa); + MEDCoupling::MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -388,9 +388,9 @@ MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble___rdiv__ { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret=self->getArray()->deepCpy(); + MEDCoupling::MCAuto ret=self->getArray()->deepCopy(); ret->applyInv(val); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MEDCoupling::MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -398,8 +398,8 @@ MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble___rdiv__ { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret=MEDCoupling::DataArrayDouble::Divide(a,self->getArray()); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MEDCoupling::MCAuto ret=MEDCoupling::DataArrayDouble::Divide(a,self->getArray()); + MEDCoupling::MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -407,9 +407,9 @@ MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble___rdiv__ { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr aaa=aa->buildDADouble(1,self->getNumberOfComponents()); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret=MEDCoupling::DataArrayDouble::Divide(aaa,self->getArray()); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MEDCoupling::MCAuto aaa=aa->buildDADouble(1,self->getNumberOfComponents()); + MEDCoupling::MCAuto ret=MEDCoupling::DataArrayDouble::Divide(aaa,self->getArray()); + MEDCoupling::MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } @@ -417,9 +417,9 @@ MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble___rdiv__ { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr aaa=MEDCoupling::DataArrayDouble::New(); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size()); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret=MEDCoupling::DataArrayDouble::Divide(aaa,self->getArray()); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); + MEDCoupling::MCAuto aaa=MEDCoupling::DataArrayDouble::New(); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size()); + MEDCoupling::MCAuto ret=MEDCoupling::DataArrayDouble::Divide(aaa,self->getArray()); + MEDCoupling::MCAuto ret2=self->clone(false); ret2->setArray(ret); return ret2.retn(); } diff --git a/src/MEDLoader/MEDFileData.cxx b/src/MEDLoader/MEDFileData.cxx index e374f05d4..283ae4c81 100644 --- a/src/MEDLoader/MEDFileData.cxx +++ b/src/MEDLoader/MEDFileData.cxx @@ -32,18 +32,18 @@ MEDFileData *MEDFileData::New() return new MEDFileData; } -MEDFileData *MEDFileData::deepCpy() const +MEDFileData *MEDFileData::deepCopy() const { - MEDCouplingAutoRefCountObjectPtr fields; + MCAuto fields; if((const MEDFileFields *)_fields) - fields=_fields->deepCpy(); - MEDCouplingAutoRefCountObjectPtr meshes; + fields=_fields->deepCopy(); + MCAuto meshes; if((const MEDFileMeshes *)_meshes) - meshes=_meshes->deepCpy(); - MEDCouplingAutoRefCountObjectPtr params; + meshes=_meshes->deepCopy(); + MCAuto params; if((const MEDFileParameters *)_params) - params=_params->deepCpy(); - MEDCouplingAutoRefCountObjectPtr ret(MEDFileData::New()); + params=_params->deepCopy(); + MCAuto ret(MEDFileData::New()); ret->_fields=fields; ret->_meshes=meshes; ret->_params=params; return ret.retn(); } @@ -192,7 +192,7 @@ bool MEDFileData::unPolyzeMeshes() std::vector< MEDFileMesh * > meshesImpacted; std::vector< DataArrayInt * > renumParamsOfMeshImpacted;//same size as meshesImpacted std::vector< std::vector > oldCodeOfMeshImpacted,newCodeOfMeshImpacted;//same size as meshesImpacted - std::vector > memSaverIfThrow;//same size as meshesImpacted + std::vector > memSaverIfThrow;//same size as meshesImpacted for(int i=0;igetNumberOfMeshes();i++) { MEDFileMesh *m=ms->getMeshAtPos(i); diff --git a/src/MEDLoader/MEDFileData.hxx b/src/MEDLoader/MEDFileData.hxx index 3671db495..9f27a3e60 100644 --- a/src/MEDLoader/MEDFileData.hxx +++ b/src/MEDLoader/MEDFileData.hxx @@ -21,7 +21,7 @@ #ifndef __MEDFILEDATA_HXX__ #define __MEDFILEDATA_HXX__ -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "MEDFileParameter.hxx" #include "MEDFileField.hxx" #include "MEDFileMesh.hxx" @@ -36,7 +36,7 @@ namespace MEDCoupling public: MEDLOADER_EXPORT static MEDFileData *New(const std::string& fileName); MEDLOADER_EXPORT static MEDFileData *New(); - MEDLOADER_EXPORT MEDFileData *deepCpy() const; + MEDLOADER_EXPORT MEDFileData *deepCopy() const; MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT MEDFileFields *getFields() const; @@ -59,9 +59,9 @@ namespace MEDCoupling MEDFileData(); MEDFileData(const std::string& fileName); private: - MEDCouplingAutoRefCountObjectPtr _fields; - MEDCouplingAutoRefCountObjectPtr _meshes; - MEDCouplingAutoRefCountObjectPtr _params; + MCAuto _fields; + MCAuto _meshes; + MCAuto _params; }; } diff --git a/src/MEDLoader/MEDFileEquivalence.cxx b/src/MEDLoader/MEDFileEquivalence.cxx index 63f1775bc..22e193291 100644 --- a/src/MEDLoader/MEDFileEquivalence.cxx +++ b/src/MEDLoader/MEDFileEquivalence.cxx @@ -36,7 +36,7 @@ MEDFileEquivalencePair *MEDFileEquivalencePair::Load(MEDFileEquivalences *father { if(!father) throw INTERP_KERNEL::Exception("MEDFileEquivalencePair::Load : father is NULL ! Should not !"); - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileEquivalencePair(father,name,desc)); + MCAuto ret(new MEDFileEquivalencePair(father,name,desc)); ret->load(fid); return ret.retn(); } @@ -69,15 +69,15 @@ MEDFileMesh *MEDFileEquivalencePair::getMesh() return getFather()->getMesh(); } -MEDFileEquivalencePair *MEDFileEquivalencePair::deepCpy(MEDFileEquivalences *father) const +MEDFileEquivalencePair *MEDFileEquivalencePair::deepCopy(MEDFileEquivalences *father) const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileEquivalencePair(father,_name,_description)); + MCAuto ret(new MEDFileEquivalencePair(father,_name,_description)); const MEDFileEquivalenceCell *cell(_cell); if(cell) - ret->_cell=cell->deepCpy(const_cast(this)); + ret->_cell=cell->deepCopy(const_cast(this)); const MEDFileEquivalenceNode *node(_node); if(node) - ret->_node=node->deepCpy(const_cast(this)); + ret->_node=node->deepCopy(const_cast(this)); return ret.retn(); } @@ -206,12 +206,12 @@ void MEDFileEquivalencePair::load(med_idt fid) MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceSize,(fid,meshName.c_str(),_name.c_str(),dt,it,MED_NODE,MED_NONE,&ncor)); if(ncor>0) { - MEDCouplingAutoRefCountObjectPtr da(DataArrayInt::New()); + MCAuto da(DataArrayInt::New()); da->alloc(ncor*2); MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceRd,(fid,meshName.c_str(),_name.c_str(),dt,it,MED_NODE,MED_NONE,da->getPointer())); da->applyLin(1,-1); da->rearrange(2); - MEDCouplingAutoRefCountObjectPtr node(new MEDFileEquivalenceNode(this,da)); + MCAuto node(new MEDFileEquivalenceNode(this,da)); _node=node; } _cell=MEDFileEquivalenceCell::Load(fid,this); @@ -243,7 +243,7 @@ std::string MEDFileEquivalences::getMeshName() const void MEDFileEquivalences::pushEquivalence(MEDFileEquivalencePair *elt) { - MEDCouplingAutoRefCountObjectPtr elta(elt); + MCAuto elta(elt); if(elt) elt->incrRef(); _equ.push_back(elta); @@ -262,7 +262,7 @@ MEDFileEquivalencePair *MEDFileEquivalences::getEquivalence(int i) MEDFileEquivalencePair *MEDFileEquivalences::getEquivalenceWithName(const std::string& name) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_equ.begin();it!=_equ.end();it++) + for(std::vector< MCAuto >::iterator it=_equ.begin();it!=_equ.end();it++) { MEDFileEquivalencePair *elt(*it); if(elt) @@ -286,7 +286,7 @@ int MEDFileEquivalences::size() const std::vector MEDFileEquivalences::getEquivalenceNames() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_equ.begin();it!=_equ.end();it++) + for(std::vector< MCAuto >::const_iterator it=_equ.begin();it!=_equ.end();it++) { const MEDFileEquivalencePair *elt(*it); if(elt) @@ -299,14 +299,14 @@ std::vector MEDFileEquivalences::getEquivalenceNames() const MEDFileEquivalencePair *MEDFileEquivalences::appendEmptyEquivalenceWithName(const std::string& name) { - MEDCouplingAutoRefCountObjectPtr elt(MEDFileEquivalencePair::New(this,name)); + MCAuto elt(MEDFileEquivalencePair::New(this,name)); _equ.push_back(elt); return elt; } -MEDFileEquivalences *MEDFileEquivalences::deepCpy(MEDFileMesh *owner) const +MEDFileEquivalences *MEDFileEquivalences::deepCopy(MEDFileMesh *owner) const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileEquivalences(owner)); + MCAuto ret(new MEDFileEquivalences(owner)); ret->deepCpyFrom(*this); return ret.retn(); } @@ -346,7 +346,7 @@ bool MEDFileEquivalences::isEqual(const MEDFileEquivalences *other, std::string& void MEDFileEquivalences::getRepr(std::ostream& oss) const { std::size_t ii(0); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_equ.begin();it!=_equ.end();it++,ii++) + for(std::vector< MCAuto >::const_iterator it=_equ.begin();it!=_equ.end();it++,ii++) { const MEDFileEquivalencePair *elt(*it); oss << "Equivalence #" << ii << " : " ; @@ -359,7 +359,7 @@ void MEDFileEquivalences::getRepr(std::ostream& oss) const void MEDFileEquivalences::killEquivalenceWithName(const std::string& name) { - std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it(_equ.begin()); + std::vector< MCAuto >::iterator it(_equ.begin()); for(;it!=_equ.end();it++) { const MEDFileEquivalencePair *elt(*it); @@ -382,7 +382,7 @@ void MEDFileEquivalences::killEquivalenceAt(int i) std::ostringstream oss; oss << "MEDFileEquivalences::killEquivalenceAt : Id must be in [0," << sz << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it(_equ.begin()); + std::vector< MCAuto >::iterator it(_equ.begin()); for(int j=0;j >::const_iterator it=_equ.begin();it!=_equ.end();it++) + for(std::vector< MCAuto >::const_iterator it=_equ.begin();it!=_equ.end();it++) { const MEDFileEquivalencePair *elt(*it); if(elt) @@ -410,7 +410,7 @@ int MEDFileEquivalences::PresenceOfEquivalences(med_idt fid, const std::string& MEDFileEquivalences *MEDFileEquivalences::Load(med_idt fid, int nbOfEq, MEDFileMesh *owner) { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileEquivalences(owner)); + MCAuto ret(new MEDFileEquivalences(owner)); if(!owner) throw INTERP_KERNEL::Exception("MEDFileEquivalences::Load : owner is NULL !"); std::string meshName(owner->getName()); @@ -421,7 +421,7 @@ MEDFileEquivalences *MEDFileEquivalences::Load(med_idt fid, int nbOfEq, MEDFileM int nstep,nocstpncor; MEDFILESAFECALLERRD0(MEDequivalenceInfo,(fid,meshName.c_str(),i+1,equ,desc,&nstep,&nocstpncor)); std::string eqName(MEDLoaderBase::buildStringFromFortran(equ,MED_NAME_SIZE)),eqDescName(MEDLoaderBase::buildStringFromFortran(desc,MED_COMMENT_SIZE)); - MEDCouplingAutoRefCountObjectPtr eqv(MEDFileEquivalencePair::Load(ret,fid,eqName,eqDescName)); + MCAuto eqv(MEDFileEquivalencePair::Load(ret,fid,eqName,eqDescName)); ret->pushEquivalence(eqv); } return ret.retn(); @@ -441,13 +441,13 @@ void MEDFileEquivalences::CheckDataArray(const DataArrayInt *data) void MEDFileEquivalences::deepCpyFrom(const MEDFileEquivalences& other) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=other._equ.begin();it!=other._equ.end();it++) + for(std::vector< MCAuto >::const_iterator it=other._equ.begin();it!=other._equ.end();it++) { const MEDFileEquivalencePair *elt(*it); - MEDCouplingAutoRefCountObjectPtr eltCpy; + MCAuto eltCpy; if(elt) { - eltCpy=elt->deepCpy(this); + eltCpy=elt->deepCopy(this); } _equ.push_back(eltCpy); } @@ -510,7 +510,7 @@ void MEDFileEquivalenceData::writeLL(med_idt fid, med_entity_type medtype, med_g INTERP_KERNEL::AutoPtr name(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); MEDLoaderBase::safeStrCpy(meshName.c_str(),MED_NAME_SIZE,meshName2,getFather()->getMesh()->getTooLongStrPolicy()); MEDLoaderBase::safeStrCpy(equName.c_str(),MED_NAME_SIZE,name,getFather()->getMesh()->getTooLongStrPolicy()); - MEDCouplingAutoRefCountObjectPtr da2(da->deepCpy()); da2->rearrange(1); da2->applyLin(1,1); da2->rearrange(2); + MCAuto da2(da->deepCopy()); da2->rearrange(1); da2->applyLin(1,1); da2->rearrange(2); MEDFILESAFECALLERWR0(MEDequivalenceCorrespondenceWr,(fid,meshName2,name,dt,it,medtype,medgt,da2->getNumberOfTuples(),da2->begin())); } @@ -519,11 +519,11 @@ std::size_t MEDFileEquivalenceCellType::getHeapMemorySizeWithoutChildren() const return sizeof(MEDFileEquivalenceCellType); } -MEDFileEquivalenceCellType *MEDFileEquivalenceCellType::deepCpy(MEDFileEquivalencePair *owner) const +MEDFileEquivalenceCellType *MEDFileEquivalenceCellType::deepCopy(MEDFileEquivalencePair *owner) const { - MEDCouplingAutoRefCountObjectPtr da; + MCAuto da; if(getArray()) - da=getArray()->deepCpy(); + da=getArray()->deepCopy(); return new MEDFileEquivalenceCellType(owner,_type,da); } @@ -570,7 +570,7 @@ std::size_t MEDFileEquivalenceCell::getHeapMemorySizeWithoutChildren() const MEDFileEquivalenceCell *MEDFileEquivalenceCell::Load(med_idt fid, MEDFileEquivalencePair *owner) { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileEquivalenceCell(owner)); + MCAuto ret(new MEDFileEquivalenceCell(owner)); ret->load(fid); if(ret->size()>0) return ret.retn(); @@ -580,7 +580,7 @@ MEDFileEquivalenceCell *MEDFileEquivalenceCell::Load(med_idt fid, MEDFileEquival void MEDFileEquivalenceCell::write(med_idt fid) const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_types.begin();it!=_types.end();it++) + for(std::vector< MCAuto >::const_iterator it=_types.begin();it!=_types.end();it++) { const MEDFileEquivalenceCellType *ct(*it); if(ct) @@ -588,15 +588,15 @@ void MEDFileEquivalenceCell::write(med_idt fid) const } } -MEDFileEquivalenceCell *MEDFileEquivalenceCell::deepCpy(MEDFileEquivalencePair *owner) const +MEDFileEquivalenceCell *MEDFileEquivalenceCell::deepCopy(MEDFileEquivalencePair *owner) const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileEquivalenceCell(owner)); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_types.begin();it!=_types.end();it++) + MCAuto ret(new MEDFileEquivalenceCell(owner)); + for(std::vector< MCAuto >::const_iterator it=_types.begin();it!=_types.end();it++) { const MEDFileEquivalenceCellType *elt(*it); - MEDCouplingAutoRefCountObjectPtr eltCpy; + MCAuto eltCpy; if(elt) - eltCpy=elt->deepCpy(owner); + eltCpy=elt->deepCopy(owner); ret->_types.push_back(eltCpy); } return ret.retn(); @@ -635,7 +635,7 @@ bool MEDFileEquivalenceCell::isEqual(const MEDFileEquivalenceCell *other, std::s void MEDFileEquivalenceCell::getRepr(std::ostream& oss) const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_types.begin();it!=_types.end();it++) + for(std::vector< MCAuto >::const_iterator it=_types.begin();it!=_types.end();it++) { const MEDFileEquivalenceCellType *elt(*it); if(elt) @@ -645,7 +645,7 @@ void MEDFileEquivalenceCell::getRepr(std::ostream& oss) const DataArrayInt *MEDFileEquivalenceCell::getArray(INTERP_KERNEL::NormalizedCellType type) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_types.begin();it!=_types.end();it++) + for(std::vector< MCAuto >::iterator it=_types.begin();it!=_types.end();it++) { MEDFileEquivalenceCellType *elt(*it); if(elt && elt->getType()==type) @@ -663,7 +663,7 @@ void MEDFileEquivalenceCell::setArray(int meshDimRelToMax, DataArrayInt *da) MEDFileMesh *mm(getMesh()); int totalNbOfCells(mm->getNumberOfCellsAtLevel(meshDimRelToMax)); // - MEDCouplingAutoRefCountObjectPtr tmp(da->deepCpy()); tmp->rearrange(1); + MCAuto tmp(da->deepCopy()); tmp->rearrange(1); int maxv,minv; tmp->getMinMaxValues(minv,maxv); if((minv<0 || minv>=totalNbOfCells) || (maxv<0 || maxv>=totalNbOfCells)) @@ -678,9 +678,9 @@ void MEDFileEquivalenceCell::setArray(int meshDimRelToMax, DataArrayInt *da) for(std::vector::const_iterator it=gts.begin();it!=gts.end();it++) { endId=startId+mm->getNumberOfCellsWithType(*it); - MEDCouplingAutoRefCountObjectPtr da0(da->keepSelectedComponents(compS)); - MEDCouplingAutoRefCountObjectPtr ids(da0->getIdsInRange(startId,endId)); - MEDCouplingAutoRefCountObjectPtr da1(da->selectByTupleIdSafe(ids->begin(),ids->end())); + MCAuto da0(da->keepSelectedComponents(compS)); + MCAuto ids(da0->findIdsInRange(startId,endId)); + MCAuto da1(da->selectByTupleIdSafe(ids->begin(),ids->end())); da1->applyLin(1,-startId); setArrayForType(*it,da1); startId=endId; @@ -689,7 +689,7 @@ void MEDFileEquivalenceCell::setArray(int meshDimRelToMax, DataArrayInt *da) void MEDFileEquivalenceCell::setArrayForType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_types.begin();it!=_types.end();it++) + for(std::vector< MCAuto >::iterator it=_types.begin();it!=_types.end();it++) { MEDFileEquivalenceCellType *elt(*it); if(elt && elt->getType()==type) @@ -698,14 +698,14 @@ void MEDFileEquivalenceCell::setArrayForType(INTERP_KERNEL::NormalizedCellType t return ; } } - MEDCouplingAutoRefCountObjectPtr newElt(new MEDFileEquivalenceCellType(getFather(),type,da)); + MCAuto newElt(new MEDFileEquivalenceCellType(getFather(),type,da)); _types.push_back(newElt); } std::vector MEDFileEquivalenceCell::getTypes() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_types.begin();it!=_types.end();it++) + for(std::vector< MCAuto >::const_iterator it=_types.begin();it!=_types.end();it++) { const MEDFileEquivalenceCellType *elt(*it); if(elt) @@ -725,12 +725,12 @@ void MEDFileEquivalenceCell::load(med_idt fid) MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceSize,(fid,meshName.c_str(),name.c_str(),dt,it,MED_CELL,typmai[i],&ncor)); if(ncor>0) { - MEDCouplingAutoRefCountObjectPtr da(DataArrayInt::New()); + MCAuto da(DataArrayInt::New()); da->alloc(ncor*2); MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceRd,(fid,meshName.c_str(),name.c_str(),dt,it,MED_CELL,typmai[i],da->getPointer())); da->applyLin(1,-1); da->rearrange(2); - MEDCouplingAutoRefCountObjectPtr ct(new MEDFileEquivalenceCellType(getFather(),typmai2[i],da)); + MCAuto ct(new MEDFileEquivalenceCellType(getFather(),typmai2[i],da)); _types.push_back(ct); } } @@ -746,12 +746,12 @@ void MEDFileEquivalenceNode::write(med_idt fid) const writeLL(fid,MED_NODE,MED_NONE); } -MEDFileEquivalenceNode *MEDFileEquivalenceNode::deepCpy(MEDFileEquivalencePair *owner) const +MEDFileEquivalenceNode *MEDFileEquivalenceNode::deepCopy(MEDFileEquivalencePair *owner) const { - MEDCouplingAutoRefCountObjectPtr da; + MCAuto da; if(getArray()) - da=getArray()->deepCpy(); - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileEquivalenceNode(owner,da)); + da=getArray()->deepCopy(); + MCAuto ret(new MEDFileEquivalenceNode(owner,da)); return ret.retn(); } diff --git a/src/MEDLoader/MEDFileEquivalence.hxx b/src/MEDLoader/MEDFileEquivalence.hxx index 6ea7f34aa..e302703c6 100644 --- a/src/MEDLoader/MEDFileEquivalence.hxx +++ b/src/MEDLoader/MEDFileEquivalence.hxx @@ -25,7 +25,7 @@ #include "MEDCouplingRefCountObject.hxx" #include "MEDCouplingMemArray.hxx" #include "MEDFileUtilities.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include @@ -45,7 +45,7 @@ namespace MEDCoupling MEDFileEquivalences *getFather() { return _father; } const MEDFileMesh *getMesh() const; MEDFileMesh *getMesh(); - MEDFileEquivalencePair *deepCpy(MEDFileEquivalences *father) const; + MEDFileEquivalencePair *deepCopy(MEDFileEquivalences *father) const; bool isEqual(const MEDFileEquivalencePair *other, std::string& what) const; void getRepr(std::ostream& oss) const; static MEDFileEquivalencePair *New(MEDFileEquivalences *father, const std::string& name); @@ -68,8 +68,8 @@ namespace MEDCoupling MEDFileEquivalences *_father; std::string _name; std::string _description; - MEDCouplingAutoRefCountObjectPtr _cell; - MEDCouplingAutoRefCountObjectPtr _node; + MCAuto _cell; + MCAuto _node; }; class MEDFileEquivalences : public RefCountObject @@ -83,7 +83,7 @@ namespace MEDCoupling std::string getMeshName() const; void pushEquivalence(MEDFileEquivalencePair *elt); static MEDFileEquivalences *New(MEDFileMesh *owner) { return new MEDFileEquivalences(owner); } - MEDFileEquivalences *deepCpy(MEDFileMesh *owner) const; + MEDFileEquivalences *deepCopy(MEDFileMesh *owner) const; bool isEqual(const MEDFileEquivalences *other, std::string& what) const; void getRepr(std::ostream& oss) const; public: @@ -105,7 +105,7 @@ namespace MEDCoupling void deepCpyFrom(const MEDFileEquivalences& other); private: MEDFileMesh *_owner; - std::vector< MEDCouplingAutoRefCountObjectPtr > _equ; + std::vector< MCAuto > _equ; }; class MEDFileEquivalenceBase : public RefCountObject @@ -136,7 +136,7 @@ namespace MEDCoupling protected: ~MEDFileEquivalenceData() { } protected: - MEDCouplingAutoRefCountObjectPtr _data; + MCAuto _data; }; class MEDFileEquivalenceCellType : public MEDFileEquivalenceData @@ -145,7 +145,7 @@ namespace MEDCoupling MEDFileEquivalenceCellType(MEDFileEquivalencePair *owner, INTERP_KERNEL::NormalizedCellType type, DataArrayInt *data):MEDFileEquivalenceData(owner,data),_type(type) { } MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; INTERP_KERNEL::NormalizedCellType getType() const { return _type; } - MEDFileEquivalenceCellType *deepCpy(MEDFileEquivalencePair *owner) const; + MEDFileEquivalenceCellType *deepCopy(MEDFileEquivalencePair *owner) const; bool isEqual(const MEDFileEquivalenceCellType *other, std::string& what) const; void getRepr(std::ostream& oss) const; public: @@ -163,7 +163,7 @@ namespace MEDCoupling MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; static MEDFileEquivalenceCell *Load(med_idt fid, MEDFileEquivalencePair *owner); void write(med_idt fid) const; - MEDFileEquivalenceCell *deepCpy(MEDFileEquivalencePair *owner) const; + MEDFileEquivalenceCell *deepCopy(MEDFileEquivalencePair *owner) const; bool isEqual(const MEDFileEquivalenceCell *other, std::string& what) const; void getRepr(std::ostream& oss) const; public: @@ -181,7 +181,7 @@ namespace MEDCoupling void load(med_idt fid); std::string getName() const { return getFather()->getName(); } private: - std::vector< MEDCouplingAutoRefCountObjectPtr > _types; + std::vector< MCAuto > _types; }; class MEDFileEquivalenceNode : public MEDFileEquivalenceData @@ -190,7 +190,7 @@ namespace MEDCoupling MEDFileEquivalenceNode(MEDFileEquivalencePair *owner, DataArrayInt *data):MEDFileEquivalenceData(owner,data) { } MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; void write(med_idt fid) const; - MEDFileEquivalenceNode *deepCpy(MEDFileEquivalencePair *owner) const; + MEDFileEquivalenceNode *deepCopy(MEDFileEquivalencePair *owner) const; bool isEqual(const MEDFileEquivalenceNode *other, std::string& what) const; void getRepr(std::ostream& oss) const; private: diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index 3cb2da239..8a0509d16 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -105,7 +105,7 @@ MEDFileFieldLoc::MEDFileFieldLoc(const std::string& locName, INTERP_KERNEL::Norm _nb_gauss_pt=_w.size(); } -MEDFileFieldLoc *MEDFileFieldLoc::deepCpy() const +MEDFileFieldLoc *MEDFileFieldLoc::deepCopy() const { return new MEDFileFieldLoc(*this); } @@ -214,16 +214,16 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(int& start, int off { case ON_CELLS: { - getOrCreateAndGetArray()->setContigPartOfSelectedValues2(_start,arrr,offset,offset+nbOfCells,1); + getOrCreateAndGetArray()->setContigPartOfSelectedValuesSlice(_start,arrr,offset,offset+nbOfCells,1); _end=_start+nbOfCells; _nval=nbOfCells; break; } case ON_GAUSS_NE: { - MEDCouplingAutoRefCountObjectPtr arr=field->getDiscretization()->getOffsetArr(field->getMesh()); + MCAuto arr=field->getDiscretization()->getOffsetArr(field->getMesh()); const int *arrPtr=arr->getConstPointer(); - getOrCreateAndGetArray()->setContigPartOfSelectedValues2(_start,arrr,arrPtr[offset],arrPtr[offset+nbOfCells],1); + getOrCreateAndGetArray()->setContigPartOfSelectedValuesSlice(_start,arrr,arrPtr[offset],arrPtr[offset+nbOfCells],1); _end=_start+(arrPtr[offset+nbOfCells]-arrPtr[offset]); _nval=nbOfCells; break; @@ -236,11 +236,11 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(int& start, int off if(!disc2) throw INTERP_KERNEL::Exception("assignFieldNoProfile : invalid call to this method ! Internal Error !"); const DataArrayInt *dai=disc2->getArrayOfDiscIds(); - MEDCouplingAutoRefCountObjectPtr dai2=disc2->getOffsetArr(field->getMesh()); + MCAuto dai2=disc2->getOffsetArr(field->getMesh()); const int *dai2Ptr=dai2->getConstPointer(); int nbi=gsLoc.getWeights().size(); - MEDCouplingAutoRefCountObjectPtr da2=dai->selectByTupleId2(offset,offset+nbOfCells,1); - MEDCouplingAutoRefCountObjectPtr da3=da2->getIdsEqual(_loc_id); + MCAuto da2=dai->selectByTupleIdSafeSlice(offset,offset+nbOfCells,1); + MCAuto da3=da2->findIdsEqual(_loc_id); const int *da3Ptr=da3->getConstPointer(); if(da3->getNumberOfTuples()!=nbOfCells) {//profile : for gauss even in NoProfile !!! @@ -249,7 +249,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(int& start, int off da3->setName(_profile.c_str()); glob.appendProfile(da3); } - MEDCouplingAutoRefCountObjectPtr da4=DataArrayInt::New(); + MCAuto da4=DataArrayInt::New(); _nval=da3->getNbOfElems(); da4->alloc(_nval*nbi,1); int *da4Ptr=da4->getPointer(); @@ -311,7 +311,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, int& case ON_NODES: { _nval=idsInPfl->getNumberOfTuples(); - getOrCreateAndGetArray()->setContigPartOfSelectedValues2(_start,arrr,0,arrr->getNumberOfTuples(),1); + getOrCreateAndGetArray()->setContigPartOfSelectedValuesSlice(_start,arrr,0,arrr->getNumberOfTuples(),1); _end=_start+_nval; break; } @@ -324,11 +324,11 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, int& } case ON_GAUSS_NE: { - MEDCouplingAutoRefCountObjectPtr arr=field->getDiscretization()->getOffsetArr(mesh); - MEDCouplingAutoRefCountObjectPtr arr2=arr->deltaShiftIndex(); - MEDCouplingAutoRefCountObjectPtr arr3=arr2->selectByTupleId(multiTypePfl->begin(),multiTypePfl->end()); - arr3->computeOffsets2(); - MEDCouplingAutoRefCountObjectPtr tmp=idsInPfl->buildExplicitArrByRanges(arr3); + MCAuto arr=field->getDiscretization()->getOffsetArr(mesh); + MCAuto arr2=arr->deltaShiftIndex(); + MCAuto arr3=arr2->selectByTupleId(multiTypePfl->begin(),multiTypePfl->end()); + arr3->computeOffsetsFull(); + MCAuto tmp=idsInPfl->buildExplicitArrByRanges(arr3); int trueNval=tmp->getNumberOfTuples(); _nval=idsInPfl->getNumberOfTuples(); getOrCreateAndGetArray()->setContigPartOfSelectedValues(_start,arrr,tmp); @@ -342,14 +342,14 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, int& throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : invalid call to this method ! Internal Error !"); const DataArrayInt *da1=disc2->getArrayOfDiscIds(); const MEDCouplingGaussLocalization& gsLoc=field->getGaussLocalization(_loc_id); - MEDCouplingAutoRefCountObjectPtr da2=da1->selectByTupleId(idsInPfl->begin(),idsInPfl->end()); - MEDCouplingAutoRefCountObjectPtr da3=da2->getIdsEqual(_loc_id); - MEDCouplingAutoRefCountObjectPtr da4=idsInPfl->selectByTupleId(da3->begin(),da3->end()); + MCAuto da2=da1->selectByTupleId(idsInPfl->begin(),idsInPfl->end()); + MCAuto da3=da2->findIdsEqual(_loc_id); + MCAuto da4=idsInPfl->selectByTupleId(da3->begin(),da3->end()); // - MEDCouplingAutoRefCountObjectPtr mesh2=mesh->buildPart(multiTypePfl->begin(),multiTypePfl->end()); - MEDCouplingAutoRefCountObjectPtr arr=disc2->getOffsetArr(mesh2); + MCAuto mesh2=mesh->buildPart(multiTypePfl->begin(),multiTypePfl->end()); + MCAuto arr=disc2->getOffsetArr(mesh2); // - MEDCouplingAutoRefCountObjectPtr tmp=DataArrayInt::New(); + MCAuto tmp=DataArrayInt::New(); int trueNval=0; for(const int *pt=da4->begin();pt!=da4->end();pt++) trueNval+=arr->getIJ(*pt+1,0)-arr->getIJ(*pt,0); @@ -365,14 +365,14 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, int& oss << "_loc_" << _loc_id; if(locIds) { - MEDCouplingAutoRefCountObjectPtr da5=locIds->selectByTupleId(da3->begin(),da3->end()); + MCAuto da5=locIds->selectByTupleId(da3->begin(),da3->end()); da5->setName(oss.str().c_str()); glob.appendProfile(da5); _profile=oss.str(); } else { - if(!da3->isIdentity2(nbOfEltsInWholeMesh)) + if(!da3->isIota(nbOfEltsInWholeMesh)) { da3->setName(oss.str().c_str()); glob.appendProfile(da3); @@ -394,7 +394,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignNodeFieldNoProfile(int& start, con { _start=start; _nval=arrr->getNumberOfTuples(); - getOrCreateAndGetArray()->setContigPartOfSelectedValues2(_start,arrr,0,_nval,1); + getOrCreateAndGetArray()->setContigPartOfSelectedValuesSlice(_start,arrr,0,_nval,1); _end=_start+_nval; start=_end; } @@ -426,9 +426,9 @@ std::vector MEDFileFieldPerMeshPerTypePerDisc::getDirec return ret; } -MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::deepCpy(MEDFileFieldPerMeshPerType *father) const +MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::deepCopy(MEDFileFieldPerMeshPerType *father) const { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileFieldPerMeshPerTypePerDisc(*this); + MCAuto ret=new MEDFileFieldPerMeshPerTypePerDisc(*this); ret->_father=father; return ret.retn(); } @@ -497,21 +497,21 @@ void MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile(med_idt fid, const const DataArrayPartDefinition *dpd(dynamic_cast(pd)); if(dpd) { - dpd->checkCoherency(); - MEDCouplingAutoRefCountObjectPtr myIds(dpd->toDAI()); + dpd->checkConsistencyLight(); + MCAuto myIds(dpd->toDAI()); int a(myIds->getMinValueInArray()),b(myIds->getMaxValueInArray()); myIds->applyLin(1,-a); int nbOfEltsToLoad(b-a+1); med_filter filter=MED_FILTER_INIT; {//TODO : manage int32 ! - MEDCouplingAutoRefCountObjectPtr tmp(DataArrayDouble::New()); + MCAuto tmp(DataArrayDouble::New()); tmp->alloc(nbOfEltsToLoad,nbOfCompo); MEDfilterBlockOfEntityCr(fid,/*nentity*/overallNval,/*nvaluesperentity*/nbi,/*nconstituentpervalue*/nbOfCompo, MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE, /*start*/a+1,/*stride*/1,/*count*/1,/*blocksize*/nbOfEltsToLoad, /*lastblocksize=useless because count=1*/0,&filter); MEDFILESAFECALLERRD0(MEDfieldValueAdvancedRd,(fid,fieldName.c_str(),iteration,order,menti,mgeoti,&filter,reinterpret_cast(tmp->getPointer()))); - MEDCouplingAutoRefCountObjectPtr feeder(DataArrayDouble::New()); + MCAuto feeder(DataArrayDouble::New()); feeder->useExternalArrayWithRWAccess(reinterpret_cast(startFeedingPtr),_nval,nbOfCompo); feeder->setContigPartOfSelectedValues(0,tmp,myIds); } @@ -906,7 +906,7 @@ bool MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(int offset, const std::ve const DataArrayInt *explicitIdsInMesh, const std::vector& newCode, MEDFileFieldGlobsReal& glob, DataArrayDouble *arr, - std::vector< MEDCouplingAutoRefCountObjectPtr >& result) + std::vector< MCAuto >& result) { if(entriesOnSameDisc.empty()) return false; @@ -917,35 +917,35 @@ bool MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(int offset, const std::ve int nbi=szTuples/szEntities; if(szTuples%szEntities!=0) throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks : internal error the splitting into same dicretization failed !"); - MEDCouplingAutoRefCountObjectPtr renumTuples=DataArrayInt::New(); renumTuples->alloc(szTuples,1); - MEDCouplingAutoRefCountObjectPtr ranges=MEDCouplingUMesh::ComputeRangesFromTypeDistribution(newCode); - std::vector< MEDCouplingAutoRefCountObjectPtr > newGeoTypesPerChunk(entriesOnSameDisc.size()); + MCAuto renumTuples=DataArrayInt::New(); renumTuples->alloc(szTuples,1); + MCAuto ranges=MEDCouplingUMesh::ComputeRangesFromTypeDistribution(newCode); + std::vector< MCAuto > newGeoTypesPerChunk(entriesOnSameDisc.size()); std::vector< const DataArrayInt * > newGeoTypesPerChunk2(entriesOnSameDisc.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr > newGeoTypesPerChunk_bis(entriesOnSameDisc.size()); + std::vector< MCAuto > newGeoTypesPerChunk_bis(entriesOnSameDisc.size()); std::vector< const DataArrayInt * > newGeoTypesPerChunk3(entriesOnSameDisc.size()); - MEDCouplingAutoRefCountObjectPtr newGeoTypesPerChunk4=DataArrayInt::New(); newGeoTypesPerChunk4->alloc(szEntities,nbi); + MCAuto newGeoTypesPerChunk4=DataArrayInt::New(); newGeoTypesPerChunk4->alloc(szEntities,nbi); int id=0; for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesOnSameDisc.begin();it!=entriesOnSameDisc.end();it++,id++) { int startOfEltIdOfChunk=(*it)->_start; - MEDCouplingAutoRefCountObjectPtr newEltIds=explicitIdsInMesh->substr(startOfEltIdOfChunk,startOfEltIdOfChunk+(*it)->_nval); - MEDCouplingAutoRefCountObjectPtr rangeIdsForChunk=newEltIds->findRangeIdForEachTuple(ranges); - MEDCouplingAutoRefCountObjectPtr idsInRrangeForChunk=newEltIds->findIdInRangeForEachTuple(ranges); + MCAuto newEltIds=explicitIdsInMesh->substr(startOfEltIdOfChunk,startOfEltIdOfChunk+(*it)->_nval); + MCAuto rangeIdsForChunk=newEltIds->findRangeIdForEachTuple(ranges); + MCAuto idsInRrangeForChunk=newEltIds->findIdInRangeForEachTuple(ranges); // - MEDCouplingAutoRefCountObjectPtr tmp=rangeIdsForChunk->duplicateEachTupleNTimes(nbi); rangeIdsForChunk->rearrange(nbi); + MCAuto tmp=rangeIdsForChunk->duplicateEachTupleNTimes(nbi); rangeIdsForChunk->rearrange(nbi); newGeoTypesPerChunk4->setPartOfValues1(tmp,(*it)->_tmp_work1-offset,(*it)->_tmp_work1+(*it)->_nval*nbi-offset,1,0,nbi,1); // newGeoTypesPerChunk[id]=rangeIdsForChunk; newGeoTypesPerChunk2[id]=rangeIdsForChunk; newGeoTypesPerChunk_bis[id]=idsInRrangeForChunk; newGeoTypesPerChunk3[id]=idsInRrangeForChunk; } - MEDCouplingAutoRefCountObjectPtr newGeoTypesEltIdsAllGather=DataArrayInt::Aggregate(newGeoTypesPerChunk2); newGeoTypesPerChunk.clear(); newGeoTypesPerChunk2.clear(); - MEDCouplingAutoRefCountObjectPtr newGeoTypesEltIdsAllGather2=DataArrayInt::Aggregate(newGeoTypesPerChunk3); newGeoTypesPerChunk_bis.clear(); newGeoTypesPerChunk3.clear(); - MEDCouplingAutoRefCountObjectPtr diffVals=newGeoTypesEltIdsAllGather->getDifferentValues(); - MEDCouplingAutoRefCountObjectPtr renumEltIds=newGeoTypesEltIdsAllGather->buildPermArrPerLevel(); + MCAuto newGeoTypesEltIdsAllGather=DataArrayInt::Aggregate(newGeoTypesPerChunk2); newGeoTypesPerChunk.clear(); newGeoTypesPerChunk2.clear(); + MCAuto newGeoTypesEltIdsAllGather2=DataArrayInt::Aggregate(newGeoTypesPerChunk3); newGeoTypesPerChunk_bis.clear(); newGeoTypesPerChunk3.clear(); + MCAuto diffVals=newGeoTypesEltIdsAllGather->getDifferentValues(); + MCAuto renumEltIds=newGeoTypesEltIdsAllGather->buildPermArrPerLevel(); // - MEDCouplingAutoRefCountObjectPtr renumTupleIds=newGeoTypesPerChunk4->buildPermArrPerLevel(); + MCAuto renumTupleIds=newGeoTypesPerChunk4->buildPermArrPerLevel(); // - MEDCouplingAutoRefCountObjectPtr arrPart=arr->substr(offset,offset+szTuples); + MCAuto arrPart=arr->substr(offset,offset+szTuples); arrPart->renumberInPlace(renumTupleIds->begin()); arr->setPartOfValues1(arrPart,offset,offset+szTuples,1,0,arrPart->getNumberOfComponents(),1); bool ret=false; @@ -954,12 +954,12 @@ bool MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(int offset, const std::ve int offset2=0; for(int i=0;igetNumberOfTuples();i++,idIt++) { - MEDCouplingAutoRefCountObjectPtr ids=newGeoTypesEltIdsAllGather->getIdsEqual(*idIt); - MEDCouplingAutoRefCountObjectPtr subIds=newGeoTypesEltIdsAllGather2->selectByTupleId(ids->begin(),ids->end()); + MCAuto ids=newGeoTypesEltIdsAllGather->findIdsEqual(*idIt); + MCAuto subIds=newGeoTypesEltIdsAllGather2->selectByTupleId(ids->begin(),ids->end()); int nbEntityElts=subIds->getNumberOfTuples(); bool ret2; - MEDCouplingAutoRefCountObjectPtr eltToAdd=MEDFileFieldPerMeshPerTypePerDisc:: - NewObjectOnSameDiscThanPool(type,(INTERP_KERNEL::NormalizedCellType)newCode[3*(*idIt)],subIds,!subIds->isIdentity2(newCode[3*(*idIt)+1]),nbi, + MCAuto eltToAdd=MEDFileFieldPerMeshPerTypePerDisc:: + NewObjectOnSameDiscThanPool(type,(INTERP_KERNEL::NormalizedCellType)newCode[3*(*idIt)],subIds,!subIds->isIota(newCode[3*(*idIt)+1]),nbi, offset+offset2, li,glob,ret2); ret=ret || ret2; @@ -1052,26 +1052,26 @@ MEDFileFieldPerMeshPerType *MEDFileFieldPerMeshPerType::New(MEDFileFieldPerMesh std::size_t MEDFileFieldPerMeshPerType::getHeapMemorySizeWithoutChildren() const { - return _field_pm_pt_pd.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr); + return _field_pm_pt_pd.capacity()*sizeof(MCAuto); } std::vector MEDFileFieldPerMeshPerType::getDirectChildrenWithNull() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) ret.push_back((const MEDFileFieldPerMeshPerTypePerDisc *)*it); return ret; } -MEDFileFieldPerMeshPerType *MEDFileFieldPerMeshPerType::deepCpy(MEDFileFieldPerMesh *father) const +MEDFileFieldPerMeshPerType *MEDFileFieldPerMeshPerType::deepCopy(MEDFileFieldPerMesh *father) const { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileFieldPerMeshPerType(*this); + MCAuto ret=new MEDFileFieldPerMeshPerType(*this); ret->_father=father; std::size_t i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++) { if((const MEDFileFieldPerMeshPerTypePerDisc *)*it) - ret->_field_pm_pt_pd[i]=(*it)->deepCpy((MEDFileFieldPerMeshPerType *)ret); + ret->_field_pm_pt_pd[i]=(*it)->deepCopy((MEDFileFieldPerMeshPerType *)ret); } return ret.retn(); } @@ -1108,7 +1108,7 @@ void MEDFileFieldPerMeshPerType::assignNodeFieldNoProfile(int& start, const MEDC void MEDFileFieldPerMeshPerType::assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) { - MEDCouplingAutoRefCountObjectPtr pfl2=pfl->deepCpy(); + MCAuto pfl2=pfl->deepCopy(); if(!arr || !arr->isAllocated()) throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerType::assignNodeFieldProfile : input array is null, or not allocated !"); _field_pm_pt_pd.resize(1); @@ -1180,8 +1180,8 @@ std::vector MEDFileFieldPerMeshPerType::addNewEntryIfNecessaryGauss(const M const DataArrayInt *da=disc2->getArrayOfDiscIds(); if(!da) throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss (no profile) : no localization ids per cell array available ! The input Gauss node field is maybe invalid !"); - MEDCouplingAutoRefCountObjectPtr da2=da->selectByTupleId2(offset,offset+nbOfCells,1); - MEDCouplingAutoRefCountObjectPtr retTmp=da2->getDifferentValues(); + MCAuto da2=da->selectByTupleIdSafeSlice(offset,offset+nbOfCells,1); + MCAuto retTmp=da2->getDifferentValues(); if(retTmp->presenceOfValue(-1)) throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : some cells have no dicretization description !"); std::vector ret(retTmp->begin(),retTmp->end()); @@ -1252,8 +1252,8 @@ std::vector MEDFileFieldPerMeshPerType::addNewEntryIfNecessaryGauss(const M const DataArrayInt *da=disc2->getArrayOfDiscIds(); if(!da) throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : no localization ids per cell array available ! The input Gauss node field is maybe invalid !"); - MEDCouplingAutoRefCountObjectPtr da2=da->selectByTupleIdSafe(subCells->getConstPointer(),subCells->getConstPointer()+subCells->getNumberOfTuples()); - MEDCouplingAutoRefCountObjectPtr retTmp=da2->getDifferentValues(); + MCAuto da2=da->selectByTupleIdSafe(subCells->getConstPointer(),subCells->getConstPointer()+subCells->getNumberOfTuples()); + MCAuto retTmp=da2->getDifferentValues(); if(retTmp->presenceOfValue(-1)) throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : some cells have no dicretization description !"); std::vector ret(retTmp->begin(),retTmp->end()); @@ -1274,7 +1274,7 @@ void MEDFileFieldPerMeshPerType::getDimension(int& dim) const void MEDFileFieldPerMeshPerType::fillTypesOfFieldAvailable(std::set& types) const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) { (*it)->fillTypesOfFieldAvailable(types); } @@ -1325,7 +1325,7 @@ void MEDFileFieldPerMeshPerType::simpleRepr(int bkOffset, std::ostream& oss, int oss << startLine3 << "Entry geometry type #" << id << " is lying on NODES." << std::endl; oss << startLine3 << "Entry is defined on " << _field_pm_pt_pd.size() << " localizations." << std::endl; int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++) { const MEDFileFieldPerMeshPerTypePerDisc *cur=(*it); if(cur) @@ -1339,7 +1339,7 @@ void MEDFileFieldPerMeshPerType::simpleRepr(int bkOffset, std::ostream& oss, int void MEDFileFieldPerMeshPerType::getSizes(int& globalSz, int& nbOfEntries) const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) { globalSz+=(*it)->getNumberOfTuples(); } @@ -1360,7 +1360,7 @@ int MEDFileFieldPerMeshPerType::getNumberOfComponents() const bool MEDFileFieldPerMeshPerType::presenceOfMultiDiscPerGeoType() const { std::size_t nb(0); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) { const MEDFileFieldPerMeshPerTypePerDisc *fmtd(*it); if(fmtd) @@ -1389,7 +1389,7 @@ std::vector MEDFileFieldPerMeshPerType::getPflsReallyUsed() const { std::vector ret; std::set ret2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) + for(std::vector< MCAuto >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) { std::string tmp=(*it1)->getProfile(); if(!tmp.empty()) @@ -1406,7 +1406,7 @@ std::vector MEDFileFieldPerMeshPerType::getLocsReallyUsed() const { std::vector ret; std::set ret2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) + for(std::vector< MCAuto >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) { std::string tmp=(*it1)->getLocalization(); if(!tmp.empty() && tmp!=MED_GAUSS_ELNO) @@ -1423,7 +1423,7 @@ std::vector MEDFileFieldPerMeshPerType::getPflsReallyUsedMulti() co { std::vector ret; std::set ret2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) + for(std::vector< MCAuto >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) { std::string tmp=(*it1)->getProfile(); if(!tmp.empty()) @@ -1435,7 +1435,7 @@ std::vector MEDFileFieldPerMeshPerType::getPflsReallyUsedMulti() co std::vector MEDFileFieldPerMeshPerType::getLocsReallyUsedMulti() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) + for(std::vector< MCAuto >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) { std::string tmp=(*it1)->getLocalization(); if(!tmp.empty() && tmp!=MED_GAUSS_ELNO) @@ -1446,13 +1446,13 @@ std::vector MEDFileFieldPerMeshPerType::getLocsReallyUsedMulti() co void MEDFileFieldPerMeshPerType::changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) + for(std::vector< MCAuto >::iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) (*it1)->changePflsRefsNamesGen(mapOfModif); } void MEDFileFieldPerMeshPerType::changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) + for(std::vector< MCAuto >::iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++) (*it1)->changeLocsRefsNamesGen(mapOfModif); } @@ -1498,23 +1498,23 @@ void MEDFileFieldPerMeshPerType::getFieldAtLevel(int meshDim, TypeOfField type, if(meshDim!=(int)cm.getDimension()) return ; } - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) (*it)->getFieldAtLevel(type,glob,dads,pfls,locs,geoTypes); } void MEDFileFieldPerMeshPerType::fillValues(int& startEntryId, std::vector< std::pair,std::pair > >& entries) const { int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++) { (*it)->fillValues(i,startEntryId,entries); } } -void MEDFileFieldPerMeshPerType::setLeaves(const std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerTypePerDisc > >& leaves) +void MEDFileFieldPerMeshPerType::setLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves) { _field_pm_pt_pd=leaves; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + for(std::vector< MCAuto >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) (*it)->setFather(this); } @@ -1526,8 +1526,8 @@ void MEDFileFieldPerMeshPerType::setLeaves(const std::vector< MEDCouplingAutoRef bool MEDFileFieldPerMeshPerType::keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair >& its) { bool ret(false); - std::vector< MEDCouplingAutoRefCountObjectPtr > newPmPtPd; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + std::vector< MCAuto > newPmPtPd; + for(std::vector< MCAuto >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) if((*it)->getType()==tof) { newPmPtPd.push_back(*it); @@ -1551,8 +1551,8 @@ bool MEDFileFieldPerMeshPerType::keepOnlyGaussDiscretization(std::size_t idOfDis { if(_field_pm_pt_pd.size()<=idOfDisc) return false; - MEDCouplingAutoRefCountObjectPtr elt(_field_pm_pt_pd[idOfDisc]); - std::vector< MEDCouplingAutoRefCountObjectPtr > newPmPtPd(1,elt); + MCAuto elt(_field_pm_pt_pd[idOfDisc]); + std::vector< MCAuto > newPmPtPd(1,elt); std::pair bgEnd; bgEnd.first=_field_pm_pt_pd[idOfDisc]->getStart(); bgEnd.second=_field_pm_pt_pd[idOfDisc]->getEnd(); elt->setNewStart(globalNum); globalNum=elt->getEnd(); @@ -1587,19 +1587,19 @@ MEDFileFieldPerMeshPerType::MEDFileFieldPerMeshPerType(med_idt fid, MEDFileField void MEDFileFieldPerMeshPerType::loadOnlyStructureOfDataRecursively(med_idt fid, int &start, const MEDFileFieldNameScope& nasc) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + for(std::vector< MCAuto >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) (*it)->loadOnlyStructureOfDataRecursively(fid,start,nasc); } void MEDFileFieldPerMeshPerType::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + for(std::vector< MCAuto >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) (*it)->loadBigArray(fid,nasc); } void MEDFileFieldPerMeshPerType::writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) { (*it)->copyOptionsFrom(*this); (*it)->writeLL(fid,nasc); @@ -1640,26 +1640,26 @@ MEDFileFieldPerMesh *MEDFileFieldPerMesh::New(MEDFileAnyTypeField1TSWithoutSDA * std::size_t MEDFileFieldPerMesh::getHeapMemorySizeWithoutChildren() const { - return _mesh_name.capacity()+_field_pm_pt.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType >); + return _mesh_name.capacity()+_field_pm_pt.capacity()*sizeof(MCAuto< MEDFileFieldPerMeshPerType >); } std::vector MEDFileFieldPerMesh::getDirectChildrenWithNull() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) ret.push_back((const MEDFileFieldPerMeshPerType *)*it); return ret; } -MEDFileFieldPerMesh *MEDFileFieldPerMesh::deepCpy(MEDFileAnyTypeField1TSWithoutSDA *father) const +MEDFileFieldPerMesh *MEDFileFieldPerMesh::deepCopy(MEDFileAnyTypeField1TSWithoutSDA *father) const { - MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > ret=new MEDFileFieldPerMesh(*this); + MCAuto< MEDFileFieldPerMesh > ret=new MEDFileFieldPerMesh(*this); ret->_father=father; std::size_t i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++) { if((const MEDFileFieldPerMeshPerType *)*it) - ret->_field_pm_pt[i]=(*it)->deepCpy((MEDFileFieldPerMesh *)(ret)); + ret->_field_pm_pt[i]=(*it)->deepCopy((MEDFileFieldPerMesh *)(ret)); } return ret.retn(); } @@ -1670,7 +1670,7 @@ void MEDFileFieldPerMesh::simpleRepr(int bkOffset, std::ostream& oss, int id) co oss << startLine << "## Field part (" << id << ") lying on mesh \"" << _mesh_name << "\", Mesh iteration=" << _mesh_iteration << ". Mesh order=" << _mesh_order << "." << std::endl; oss << startLine << "## Field is defined on " << _field_pm_pt.size() << " types." << std::endl; int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++) { const MEDFileFieldPerMeshPerType *cur=*it; if(cur) @@ -1746,13 +1746,13 @@ void MEDFileFieldPerMesh::assignNodeFieldProfile(int& start, const DataArrayInt void MEDFileFieldPerMesh::loadOnlyStructureOfDataRecursively(med_idt fid, int& start, const MEDFileFieldNameScope& nasc) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) (*it)->loadOnlyStructureOfDataRecursively(fid,start,nasc); } void MEDFileFieldPerMesh::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) (*it)->loadBigArraysRecursively(fid,nasc); } @@ -1768,13 +1768,13 @@ void MEDFileFieldPerMesh::writeLL(med_idt fid, const MEDFileFieldNameScope& nasc void MEDFileFieldPerMesh::getDimension(int& dim) const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) (*it)->getDimension(dim); } void MEDFileFieldPerMesh::fillTypesOfFieldAvailable(std::set& types) const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) (*it)->fillTypesOfFieldAvailable(types); } @@ -1814,7 +1814,7 @@ int MEDFileFieldPerMesh::getNumberOfComponents() const bool MEDFileFieldPerMesh::presenceOfMultiDiscPerGeoType() const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { const MEDFileFieldPerMeshPerType *fpmt(*it); if(!fpmt) @@ -1929,7 +1929,7 @@ std::vector MEDFileFieldPerMesh::getPflsReallyUsed() const { std::vector ret; std::set ret2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { std::vector tmp=(*it)->getPflsReallyUsed(); for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) @@ -1945,7 +1945,7 @@ std::vector MEDFileFieldPerMesh::getPflsReallyUsed() const std::vector MEDFileFieldPerMesh::getPflsReallyUsedMulti() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { std::vector tmp=(*it)->getPflsReallyUsedMulti(); ret.insert(ret.end(),tmp.begin(),tmp.end()); @@ -1957,7 +1957,7 @@ std::vector MEDFileFieldPerMesh::getLocsReallyUsed() const { std::vector ret; std::set ret2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { std::vector tmp=(*it)->getLocsReallyUsed(); for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) @@ -1973,7 +1973,7 @@ std::vector MEDFileFieldPerMesh::getLocsReallyUsed() const std::vector MEDFileFieldPerMesh::getLocsReallyUsedMulti() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { std::vector tmp=(*it)->getLocsReallyUsedMulti(); ret.insert(ret.end(),tmp.begin(),tmp.end()); @@ -2024,9 +2024,9 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam else otherEntries.push_back(getLeafGivenTypeAndLocId((*it).first.first,(*it).first.second)); } - MEDCouplingAutoRefCountObjectPtr renumDefrag=DataArrayInt::New(); renumDefrag->alloc(arr->getNumberOfTuples(),1); renumDefrag->fillWithZero(); + MCAuto renumDefrag=DataArrayInt::New(); renumDefrag->alloc(arr->getNumberOfTuples(),1); renumDefrag->fillWithZero(); //////////////////// - MEDCouplingAutoRefCountObjectPtr explicitIdsOldInMesh=DataArrayInt::New(); explicitIdsOldInMesh->alloc(sz,1);//sz is a majorant of the real size. A realloc will be done after + MCAuto explicitIdsOldInMesh=DataArrayInt::New(); explicitIdsOldInMesh->alloc(sz,1);//sz is a majorant of the real size. A realloc will be done after int *workI2=explicitIdsOldInMesh->getPointer(); int sz1=0,sz2=0,sid=1; std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > entriesKeptML=MEDFileFieldPerMeshPerTypePerDisc::SplitPerDiscretization(entriesKept); @@ -2034,7 +2034,7 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam for(std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> >::const_iterator itL1=entriesKeptML.begin();itL1!=entriesKeptML.end();itL1++,sid++) { // tupleIdOfStartOfNewChuncksV[sid-1]=sz2; - MEDCouplingAutoRefCountObjectPtr explicitIdsOldInArr=DataArrayInt::New(); explicitIdsOldInArr->alloc(sz,1); + MCAuto explicitIdsOldInArr=DataArrayInt::New(); explicitIdsOldInArr->alloc(sz,1); int *workI=explicitIdsOldInArr->getPointer(); for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator itL2=(*itL1).begin();itL2!=(*itL1).end();itL2++) { @@ -2048,20 +2048,20 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam explicitIdsOldInMesh->reAlloc(sz2); int tupleIdOfStartOfNewChuncks=arr->getNumberOfTuples()-sz2; //////////////////// - MEDCouplingAutoRefCountObjectPtr permArrDefrag=renumDefrag->buildPermArrPerLevel(); renumDefrag=0; + MCAuto permArrDefrag=renumDefrag->buildPermArrPerLevel(); renumDefrag=0; // perform redispatching of non concerned MEDFileFieldPerMeshPerTypePerDisc - std::vector< MEDCouplingAutoRefCountObjectPtr > otherEntriesNew; + std::vector< MCAuto > otherEntriesNew; for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=otherEntries.begin();it!=otherEntries.end();it++) { otherEntriesNew.push_back(MEDFileFieldPerMeshPerTypePerDisc::New(*(*it))); otherEntriesNew.back()->setNewStart(permArrDefrag->getIJ((*it)->getStart(),0)); otherEntriesNew.back()->setLocId((*it)->getGeoType()); } - std::vector< MEDCouplingAutoRefCountObjectPtr > entriesKeptNew; + std::vector< MCAuto > entriesKeptNew; std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> entriesKeptNew2; for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesKept.begin();it!=entriesKept.end();it++) { - MEDCouplingAutoRefCountObjectPtr elt=MEDFileFieldPerMeshPerTypePerDisc::New(*(*it)); + MCAuto elt=MEDFileFieldPerMeshPerTypePerDisc::New(*(*it)); int newStart=elt->getLocId(); elt->setLocId((*it)->getGeoType()); elt->setNewStart(newStart); @@ -2069,9 +2069,9 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam entriesKeptNew.push_back(elt); entriesKeptNew2.push_back(elt); } - MEDCouplingAutoRefCountObjectPtr arr2=arr->renumber(permArrDefrag->getConstPointer()); + MCAuto arr2=arr->renumber(permArrDefrag->getConstPointer()); // perform redispatching of concerned MEDFileFieldPerMeshPerTypePerDisc -> values are in arr2 - MEDCouplingAutoRefCountObjectPtr explicitIdsNewInMesh=renumO2N->selectByTupleId(explicitIdsOldInMesh->begin(),explicitIdsOldInMesh->end()); + MCAuto explicitIdsNewInMesh=renumO2N->selectByTupleId(explicitIdsOldInMesh->begin(),explicitIdsOldInMesh->end()); std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > entriesKeptPerDisc=MEDFileFieldPerMeshPerTypePerDisc::SplitPerDiscretization(entriesKeptNew2); bool ret=false; for(std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> >::const_iterator it4=entriesKeptPerDisc.begin();it4!=entriesKeptPerDisc.end();it4++) @@ -2089,7 +2089,7 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam return false; // Assign new dispatching assignNewLeaves(otherEntriesNew); - arr->cpyFrom(*arr2); + arr->deepCopyFrom(*arr2); return true; } @@ -2099,8 +2099,8 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam */ void MEDFileFieldPerMesh::keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair >& its) { - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > > ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + std::vector< MCAuto< MEDFileFieldPerMeshPerType > > ret; + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { std::vector< std::pair > its2; if((*it)->keepOnlySpatialDiscretization(tof,globalNum,its2)) @@ -2118,8 +2118,8 @@ void MEDFileFieldPerMesh::keepOnlySpatialDiscretization(TypeOfField tof, int &gl */ void MEDFileFieldPerMesh::keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair >& its) { - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > > ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + std::vector< MCAuto< MEDFileFieldPerMeshPerType > > ret; + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { std::vector< std::pair > its2; if((*it)->keepOnlyGaussDiscretization(idOfDisc,globalNum,its2)) @@ -2131,18 +2131,18 @@ void MEDFileFieldPerMesh::keepOnlyGaussDiscretization(std::size_t idOfDisc, int _field_pm_pt=ret; } -void MEDFileFieldPerMesh::assignNewLeaves(const std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerTypePerDisc > >& leaves) +void MEDFileFieldPerMesh::assignNewLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves) { - std::map > > types; - for( std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerTypePerDisc > >::const_iterator it=leaves.begin();it!=leaves.end();it++) + std::map > > types; + for( std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >::const_iterator it=leaves.begin();it!=leaves.end();it++) types[(INTERP_KERNEL::NormalizedCellType)(*it)->getLocId()].push_back(*it); // - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > > fieldPmPt(types.size()); - std::map > >::const_iterator it1=types.begin(); - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it2=fieldPmPt.begin(); + std::vector< MCAuto< MEDFileFieldPerMeshPerType > > fieldPmPt(types.size()); + std::map > >::const_iterator it1=types.begin(); + std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::iterator it2=fieldPmPt.begin(); for(;it1!=types.end();it1++,it2++) { - MEDCouplingAutoRefCountObjectPtr elt=MEDFileFieldPerMeshPerType::New(this,(INTERP_KERNEL::NormalizedCellType)((*it1).second[0]->getLocId())); + MCAuto elt=MEDFileFieldPerMeshPerType::New(this,(INTERP_KERNEL::NormalizedCellType)((*it1).second[0]->getLocId())); elt->setLeaves((*it1).second); *it2=elt; } @@ -2151,20 +2151,20 @@ void MEDFileFieldPerMesh::assignNewLeaves(const std::vector< MEDCouplingAutoRefC void MEDFileFieldPerMesh::changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) (*it)->changePflsRefsNamesGen(mapOfModif); } void MEDFileFieldPerMesh::changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) (*it)->changeLocsRefsNamesGen(mapOfModif); } /*! * \param [in] mesh is the whole mesh */ -MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl, MEDCouplingAutoRefCountObjectPtr& arrOut, const MEDFileFieldNameScope& nasc) const +MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { if(_field_pm_pt.empty()) throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : no types field set !"); @@ -2174,7 +2174,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField t std::vector notNullPflsPerGeoType; std::vector locs,code; std::vector geoTypes; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) (*it)->getFieldAtLevel(mesh->getMeshDimension(),type,glob,dads,pfls,locs,geoTypes); // Sort by types SortArraysPerType(glob,type,geoTypes,dads,pfls,locs,code,notNullPflsPerGeoType); @@ -2184,7 +2184,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField t throw INTERP_KERNEL::Exception(oss.str().c_str()); } // - std::vector< MEDCouplingAutoRefCountObjectPtr > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); + std::vector< MCAuto > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); std::vector< const DataArrayInt *> notNullPflsPerGeoType3(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); if(type!=ON_NODES) { @@ -2193,7 +2193,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField t return finishField(type,glob,dads,locs,mesh,isPfl,arrOut,nasc); else { - MEDCouplingAutoRefCountObjectPtr arr2(arr); + MCAuto arr2(arr); return finishField2(type,glob,dads,locs,geoTypes,mesh,arr,isPfl,arrOut,nasc); } } @@ -2227,7 +2227,7 @@ DataArray *MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl(TypeOfField type, c std::vector notNullPflsPerGeoType; std::vector locs,code; std::vector geoTypes; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) (*it)->getFieldAtLevel(mesh->getMeshDimension(),type,glob,dads,pfls,locs,geoTypes); // Sort by types SortArraysPerType(glob,type,geoTypes,dads,pfls,locs,code,notNullPflsPerGeoType); @@ -2236,11 +2236,11 @@ DataArray *MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl(TypeOfField type, c std::ostringstream oss; oss << "MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl : " << "The field \"" << nasc.getName() << "\" exists but not with such spatial discretization or such dimension specified !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - std::vector< MEDCouplingAutoRefCountObjectPtr > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); + std::vector< MCAuto > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); std::vector< const DataArrayInt *> notNullPflsPerGeoType3(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); if(type!=ON_NODES) { - MEDCouplingAutoRefCountObjectPtr arr=mesh->checkTypeConsistencyAndContig(code,notNullPflsPerGeoType3); + MCAuto arr=mesh->checkTypeConsistencyAndContig(code,notNullPflsPerGeoType3); return finishField4(dads,arr,mesh->getNumberOfCells(),pfl); } else @@ -2267,13 +2267,13 @@ void MEDFileFieldPerMesh::getUndergroundDataArrayExt(std::vector< std::pair >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { (*it)->getSizes(globalSz,nbOfEntries); } entries.resize(nbOfEntries); nbOfEntries=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { (*it)->fillValues(nbOfEntries,entries); } @@ -2281,7 +2281,7 @@ void MEDFileFieldPerMesh::getUndergroundDataArrayExt(std::vector< std::pair >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { if((*it)->getGeoType()==typ) return (*it)->getLeafGivenLocId(locId); @@ -2289,7 +2289,7 @@ MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(typ); std::ostringstream oss; oss << "MEDFileFieldPerMesh::getLeafGivenTypeAndLocId : no such geometric type \"" << cm.getRepr() << "\" in this !" << std::endl; oss << "Possiblities are : "; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { const INTERP_KERNEL::CellModel& cm2=INTERP_KERNEL::CellModel::GetCellModel((*it)->getGeoType()); oss << "\"" << cm2.getRepr() << "\", "; @@ -2299,7 +2299,7 @@ MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId) const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { if((*it)->getGeoType()==typ) return (*it)->getLeafGivenLocId(locId); @@ -2307,7 +2307,7 @@ const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAn const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(typ); std::ostringstream oss; oss << "MEDFileFieldPerMesh::getLeafGivenTypeAndLocId : no such geometric type \"" << cm.getRepr() << "\" in this !" << std::endl; oss << "Possiblities are : "; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { const INTERP_KERNEL::CellModel& cm2=INTERP_KERNEL::CellModel::GetCellModel((*it)->getGeoType()); oss << "\"" << cm2.getRepr() << "\", "; @@ -2319,8 +2319,8 @@ int MEDFileFieldPerMesh::addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellTyp { int i=0; int pos=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,type)); - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it2=_field_pm_pt.begin(); - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++) + std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::iterator it2=_field_pm_pt.begin(); + for(std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++) { INTERP_KERNEL::NormalizedCellType curType=(*it)->getGeoType(); if(type==curType) @@ -2343,12 +2343,12 @@ int MEDFileFieldPerMesh::addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellTyp */ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField(TypeOfField type, const MEDFileFieldGlobsReal *glob, const std::vector< std::pair >& dads, const std::vector& locs, - const MEDCouplingMesh *mesh, bool& isPfl, MEDCouplingAutoRefCountObjectPtr& arrOut, const MEDFileFieldNameScope& nasc) const + const MEDCouplingMesh *mesh, bool& isPfl, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { isPfl=false; - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingFieldDouble::New(type,ONE_TIME); + MCAuto ret=MEDCouplingFieldDouble::New(type,ONE_TIME); ret->setMesh(mesh); ret->setName(nasc.getName().c_str()); ret->setTime(getTime(),getIteration(),getOrder()); ret->setTimeUnit(nasc.getDtUnit().c_str()); - MEDCouplingAutoRefCountObjectPtr da=getOrCreateAndGetArray()->selectByTupleRanges(dads); + MCAuto da=getOrCreateAndGetArray()->selectByTupleRanges(dads); const std::vector& infos=getInfo(); da->setInfoOnComponents(infos); da->setName(""); @@ -2361,7 +2361,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField(TypeOfField type, const std::vector > dads2(1,dads[i]); const std::vector locs2(1,locs[i]); const std::vector geoTypes2(1,INTERP_KERNEL::NORM_ERROR); int nbOfElems=ComputeNbOfElems(glob,type,geoTypes2,dads2,locs2); - MEDCouplingAutoRefCountObjectPtr di=DataArrayInt::New(); + MCAuto di=DataArrayInt::New(); di->alloc(nbOfElems,1); di->iota(offset); const MEDFileFieldLoc& fl=glob->getLocalizationFromId(locs[i]); @@ -2383,13 +2383,13 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField(TypeOfField type, const MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField2(TypeOfField type, const MEDFileFieldGlobsReal *glob, const std::vector >& dads, const std::vector& locs, const std::vector& geoTypes, - const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MEDCouplingAutoRefCountObjectPtr& arrOut, const MEDFileFieldNameScope& nasc) const + const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { - if(da->isIdentity2(mesh->getNumberOfCells())) + if(da->isIota(mesh->getNumberOfCells())) return finishField(type,glob,dads,locs,mesh,isPfl,arrOut,nasc); - MEDCouplingAutoRefCountObjectPtr m2=mesh->buildPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems()); + MCAuto m2=mesh->buildPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems()); m2->setName(mesh->getName().c_str()); - MEDCouplingAutoRefCountObjectPtr ret=finishField(type,glob,dads,locs,m2,isPfl,arrOut,nasc); + MCAuto ret=finishField(type,glob,dads,locs,m2,isPfl,arrOut,nasc); isPfl=true; return ret.retn(); } @@ -2399,9 +2399,9 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField2(TypeOfField type, cons */ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileFieldGlobsReal *glob, const std::vector >& dads, const std::vector& locs, - const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MEDCouplingAutoRefCountObjectPtr& arrOut, const MEDFileFieldNameScope& nasc) const + const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { - if(da->isIdentity2(mesh->getNumberOfNodes())) + if(da->isIota(mesh->getNumberOfNodes())) return finishField(ON_NODES,glob,dads,locs,mesh,isPfl,arrOut,nasc); // Treatment of particular case where nodal field on pfl is requested with a meshDimRelToMax=1. const MEDCouplingUMesh *meshu=dynamic_cast(mesh); @@ -2409,7 +2409,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileField { if(meshu->getNodalConnectivity()==0) { - MEDCouplingAutoRefCountObjectPtr ret=finishField(ON_CELLS,glob,dads,locs,mesh,isPfl,arrOut,nasc); + MCAuto ret=finishField(ON_CELLS,glob,dads,locs,mesh,isPfl,arrOut,nasc); int nb=da->getNbOfElems(); const int *ptr=da->getConstPointer(); MEDCouplingUMesh *meshuc=const_cast(meshu); @@ -2425,16 +2425,16 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileField } } // - MEDCouplingAutoRefCountObjectPtr ret=finishField(ON_NODES,glob,dads,locs,mesh,isPfl,arrOut,nasc); + MCAuto ret=finishField(ON_NODES,glob,dads,locs,mesh,isPfl,arrOut,nasc); isPfl=true; DataArrayInt *arr2=0; - MEDCouplingAutoRefCountObjectPtr cellIds=mesh->getCellIdsFullyIncludedInNodeIds(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems()); - MEDCouplingAutoRefCountObjectPtr mesh2=mesh->buildPartAndReduceNodes(cellIds->getConstPointer(),cellIds->getConstPointer()+cellIds->getNbOfElems(),arr2); - MEDCouplingAutoRefCountObjectPtr arr3(arr2); + MCAuto cellIds=mesh->getCellIdsFullyIncludedInNodeIds(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems()); + MCAuto mesh2=mesh->buildPartAndReduceNodes(cellIds->getConstPointer(),cellIds->getConstPointer()+cellIds->getNbOfElems(),arr2); + MCAuto arr3(arr2); int nnodes=mesh2->getNumberOfNodes(); if(nnodes==(int)da->getNbOfElems()) { - MEDCouplingAutoRefCountObjectPtr da3=da->transformWithIndArrR(arr2->begin(),arr2->end()); + MCAuto da3=da->transformWithIndArrR(arr2->begin(),arr2->end()); arrOut->renumberInPlace(da3->getConstPointer()); mesh2->setName(mesh->getName().c_str()); ret->setMesh(mesh2); @@ -2469,8 +2469,8 @@ DataArray *MEDFileFieldPerMesh::finishField4(const std::vector(pflIn); pflOut->incrRef(); } - MEDCouplingAutoRefCountObjectPtr safePfl(pflOut); - MEDCouplingAutoRefCountObjectPtr da=getOrCreateAndGetArray()->selectByTupleRanges(dads); + MCAuto safePfl(pflOut); + MCAuto da=getOrCreateAndGetArray()->selectByTupleRanges(dads); const std::vector& infos=getInfo(); int nbOfComp=infos.size(); for(int i=0;i cpy=_pfls[i]->deepCpy(); + MCAuto cpy=_pfls[i]->deepCopy(); cpy->applyLin(1,1,0); INTERP_KERNEL::AutoPtr pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); MEDLoaderBase::safeStrCpy(_pfls[i]->getName().c_str(),MED_NAME_SIZE,pflName,opt.getTooLongStrPolicy()); @@ -2656,7 +2656,7 @@ void MEDFileFieldGlobs::writeGlobals(med_idt fid, const MEDFileWritable& opt) co void MEDFileFieldGlobs::appendGlobs(const MEDFileFieldGlobs& other, double eps) { std::vector pfls=getPfls(); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=other._pfls.begin();it!=other._pfls.end();it++) + for(std::vector< MCAuto >::const_iterator it=other._pfls.begin();it!=other._pfls.end();it++) { std::vector::iterator it2=std::find(pfls.begin(),pfls.end(),(*it)->getName()); if(it2==pfls.end()) @@ -2674,7 +2674,7 @@ void MEDFileFieldGlobs::appendGlobs(const MEDFileFieldGlobs& other, double eps) } } std::vector locs=getLocs(); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=other._locs.begin();it!=other._locs.end();it++) + for(std::vector< MCAuto >::const_iterator it=other._locs.begin();it!=other._locs.end();it++) { std::vector::iterator it2=std::find(locs.begin(),locs.end(),(*it)->getName()); if(it2==locs.end()) @@ -2745,33 +2745,33 @@ MEDFileFieldGlobs *MEDFileFieldGlobs::New() std::size_t MEDFileFieldGlobs::getHeapMemorySizeWithoutChildren() const { - return _file_name.capacity()+_pfls.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr)+_locs.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr); + return _file_name.capacity()+_pfls.capacity()*sizeof(MCAuto)+_locs.capacity()*sizeof(MCAuto); } std::vector MEDFileFieldGlobs::getDirectChildrenWithNull() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< DataArrayInt > >::const_iterator it=_pfls.begin();it!=_pfls.end();it++) + for(std::vector< MCAuto< DataArrayInt > >::const_iterator it=_pfls.begin();it!=_pfls.end();it++) ret.push_back((const DataArrayInt *)*it); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_locs.begin();it!=_locs.end();it++) + for(std::vector< MCAuto >::const_iterator it=_locs.begin();it!=_locs.end();it++) ret.push_back((const MEDFileFieldLoc *)*it); return ret; } -MEDFileFieldGlobs *MEDFileFieldGlobs::deepCpy() const +MEDFileFieldGlobs *MEDFileFieldGlobs::deepCopy() const { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileFieldGlobs(*this); + MCAuto ret=new MEDFileFieldGlobs(*this); std::size_t i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) { if((const DataArrayInt *)*it) - ret->_pfls[i]=(*it)->deepCpy(); + ret->_pfls[i]=(*it)->deepCopy(); } i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_locs.begin();it!=_locs.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_locs.begin();it!=_locs.end();it++,i++) { if((const MEDFileFieldLoc*)*it) - ret->_locs[i]=(*it)->deepCpy(); + ret->_locs[i]=(*it)->deepCopy(); } return ret.retn(); } @@ -2783,14 +2783,14 @@ MEDFileFieldGlobs *MEDFileFieldGlobs::deepCpy() const */ MEDFileFieldGlobs *MEDFileFieldGlobs::shallowCpyPart(const std::vector& pfls, const std::vector& locs) const { - MEDCouplingAutoRefCountObjectPtr ret=MEDFileFieldGlobs::New(); + MCAuto ret=MEDFileFieldGlobs::New(); for(std::vector::const_iterator it1=pfls.begin();it1!=pfls.end();it1++) { DataArrayInt *pfl=const_cast(getProfile((*it1).c_str())); if(!pfl) throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::shallowCpyPart : internal error ! pfl null !"); pfl->incrRef(); - MEDCouplingAutoRefCountObjectPtr pfl2(pfl); + MCAuto pfl2(pfl); ret->_pfls.push_back(pfl2); } for(std::vector::const_iterator it2=locs.begin();it2!=locs.end();it2++) @@ -2799,7 +2799,7 @@ MEDFileFieldGlobs *MEDFileFieldGlobs::shallowCpyPart(const std::vectorincrRef(); - MEDCouplingAutoRefCountObjectPtr loc2(loc); + MCAuto loc2(loc); ret->_locs.push_back(loc2); } ret->setFileName(getFileName()); @@ -2813,20 +2813,20 @@ MEDFileFieldGlobs *MEDFileFieldGlobs::shallowCpyPart(const std::vector& pfls, const std::vector& locs) const { - MEDCouplingAutoRefCountObjectPtr ret=MEDFileFieldGlobs::New(); + MCAuto ret=MEDFileFieldGlobs::New(); for(std::vector::const_iterator it1=pfls.begin();it1!=pfls.end();it1++) { DataArrayInt *pfl=const_cast(getProfile((*it1).c_str())); if(!pfl) throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::deepCpyPart : internal error ! pfl null !"); - ret->_pfls.push_back(pfl->deepCpy()); + ret->_pfls.push_back(pfl->deepCopy()); } for(std::vector::const_iterator it2=locs.begin();it2!=locs.end();it2++) { MEDFileFieldLoc *loc=const_cast(&getLocalization((*it2).c_str())); if(!loc) throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::deepCpyPart : internal error ! loc null !"); - ret->_locs.push_back(loc->deepCpy()); + ret->_locs.push_back(loc->deepCopy()); } ret->setFileName(getFileName()); return ret.retn(); @@ -2877,7 +2877,7 @@ void MEDFileFieldGlobs::setFileName(const std::string& fileName) void MEDFileFieldGlobs::changePflsNamesInStruct(const std::vector< std::pair, std::string > >& mapOfModif) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_pfls.begin();it!=_pfls.end();it++) + for(std::vector< MCAuto >::iterator it=_pfls.begin();it!=_pfls.end();it++) { DataArrayInt *elt(*it); if(elt) @@ -2897,7 +2897,7 @@ void MEDFileFieldGlobs::changePflsNamesInStruct(const std::vector< std::pair, std::string > >& mapOfModif) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_locs.begin();it!=_locs.end();it++) + for(std::vector< MCAuto >::iterator it=_locs.begin();it!=_locs.end();it++) { MEDFileFieldLoc *elt(*it); if(elt) @@ -2941,7 +2941,7 @@ namespace MEDCouplingImpl { public: LocFinder(const std::string& loc):_loc(loc) { } - bool operator() (const MEDCouplingAutoRefCountObjectPtr& loc) { return loc->isName(_loc); } + bool operator() (const MCAuto& loc) { return loc->isName(_loc); } private: const std::string &_loc; }; @@ -2950,7 +2950,7 @@ namespace MEDCouplingImpl { public: PflFinder(const std::string& pfl):_pfl(pfl) { } - bool operator() (const MEDCouplingAutoRefCountObjectPtr& pfl) { return _pfl==pfl->getName(); } + bool operator() (const MCAuto& pfl) { return _pfl==pfl->getName(); } private: const std::string& _pfl; }; @@ -2959,7 +2959,7 @@ namespace MEDCouplingImpl int MEDFileFieldGlobs::getLocalizationId(const std::string& loc) const { - std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=std::find_if(_locs.begin(),_locs.end(),MEDCouplingImpl::LocFinder(loc)); + std::vector< MCAuto >::const_iterator it=std::find_if(_locs.begin(),_locs.end(),MEDCouplingImpl::LocFinder(loc)); if(it==_locs.end()) { std::ostringstream oss; oss << "MEDFileFieldGlobs::getLocalisationId : no such localisation name : \"" << loc << "\" Possible localizations are : "; @@ -2976,7 +2976,7 @@ int MEDFileFieldGlobs::getLocalizationId(const std::string& loc) const const DataArrayInt *MEDFileFieldGlobs::getProfile(const std::string& pflName) const { std::string pflNameCpp(pflName); - std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pflNameCpp)); + std::vector< MCAuto >::const_iterator it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pflNameCpp)); if(it==_pfls.end()) { std::ostringstream oss; oss << "MEDFileFieldGlobs::getProfile: no such profile name : \"" << pflNameCpp << "\" Possible profiles are : "; @@ -3012,7 +3012,7 @@ MEDFileFieldLoc& MEDFileFieldGlobs::getLocalization(const std::string& locName) DataArrayInt *MEDFileFieldGlobs::getProfile(const std::string& pflName) { std::string pflNameCpp(pflName); - std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pflNameCpp)); + std::vector< MCAuto >::iterator it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pflNameCpp)); if(it==_pfls.end()) { std::ostringstream oss; oss << "MEDFileFieldGlobs::getProfile: no such profile name : \"" << pflNameCpp << "\" Possible profiles are : "; @@ -3032,9 +3032,9 @@ DataArrayInt *MEDFileFieldGlobs::getProfileFromId(int pflId) void MEDFileFieldGlobs::killProfileIds(const std::vector& pflIds) { - std::vector< MEDCouplingAutoRefCountObjectPtr > newPfls; + std::vector< MCAuto > newPfls; int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) { if(std::find(pflIds.begin(),pflIds.end(),i)==pflIds.end()) newPfls.push_back(*it); @@ -3044,9 +3044,9 @@ void MEDFileFieldGlobs::killProfileIds(const std::vector& pflIds) void MEDFileFieldGlobs::killLocalizationIds(const std::vector& locIds) { - std::vector< MEDCouplingAutoRefCountObjectPtr > newLocs; + std::vector< MCAuto > newLocs; int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_locs.begin();it!=_locs.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_locs.begin();it!=_locs.end();it++,i++) { if(std::find(locIds.begin(),locIds.end(),i)==locIds.end()) newLocs.push_back(*it); @@ -3090,7 +3090,7 @@ std::vector< std::vector > MEDFileFieldGlobs::whichAreEqualProfiles() const { std::map > m; int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) { const DataArrayInt *tmp=(*it); if(tmp) @@ -3136,7 +3136,7 @@ void MEDFileFieldGlobs::appendProfile(DataArrayInt *pfl) std::string name(pfl->getName()); if(name.empty()) throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::appendProfile : unsupported profiles with no name !"); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_pfls.begin();it!=_pfls.end();it++) + for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++) if(name==(*it)->getName()) { if(!pfl->isEqual(*(*it))) @@ -3154,8 +3154,8 @@ void MEDFileFieldGlobs::appendLoc(const std::string& locName, INTERP_KERNEL::Nor std::string name(locName); if(name.empty()) throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::appendLoc : unsupported localizations with no name !"); - MEDCouplingAutoRefCountObjectPtr obj=MEDFileFieldLoc::New(locName,geoType,refCoo,gsCoo,w); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_locs.begin();it!=_locs.end();it++) + MCAuto obj=MEDFileFieldLoc::New(locName,geoType,refCoo,gsCoo,w); + for(std::vector< MCAuto >::const_iterator it=_locs.begin();it!=_locs.end();it++) if((*it)->isName(locName)) { if(!(*it)->isEqual(*obj,1e-12)) @@ -3280,7 +3280,7 @@ void MEDFileFieldGlobsReal::deepCpyGlobs(const MEDFileFieldGlobsReal& other) { _globals=other._globals; if((const MEDFileFieldGlobs *)_globals) - _globals=other._globals->deepCpy(); + _globals=other._globals->deepCopy(); } /*! @@ -3809,10 +3809,10 @@ void MEDFileAnyTypeField1TSWithoutSDA::deepCpyLeavesFrom(const MEDFileAnyTypeFie { _field_per_mesh.resize(other._field_per_mesh.size()); std::size_t i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=other._field_per_mesh.begin();it!=other._field_per_mesh.end();it++,i++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=other._field_per_mesh.begin();it!=other._field_per_mesh.end();it++,i++) { if((const MEDFileFieldPerMesh *)*it) - _field_per_mesh[i]=(*it)->deepCpy(this); + _field_per_mesh[i]=(*it)->deepCopy(this); } } @@ -3860,7 +3860,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::simpleRepr(int bkOffset, std::ostream& os if(!_field_per_mesh.empty()) { int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it2=_field_per_mesh.begin();it2!=_field_per_mesh.end();it2++,i++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it2=_field_per_mesh.begin();it2!=_field_per_mesh.end();it2++,i++) { const MEDFileFieldPerMesh *cur=(*it2); if(cur) @@ -3876,18 +3876,18 @@ void MEDFileAnyTypeField1TSWithoutSDA::simpleRepr(int bkOffset, std::ostream& os oss << startOfLine << "----------------------" << std::endl; } -std::vector< MEDCouplingAutoRefCountObjectPtr > MEDFileAnyTypeField1TSWithoutSDA::splitComponents() const +std::vector< MCAuto > MEDFileAnyTypeField1TSWithoutSDA::splitComponents() const { const DataArray *arr(getUndergroundDataArray()); if(!arr) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::splitComponents : no array defined !"); int nbOfCompo=arr->getNumberOfComponents(); - std::vector< MEDCouplingAutoRefCountObjectPtr > ret(nbOfCompo); + std::vector< MCAuto > ret(nbOfCompo); for(int i=0;i v(1,i); - MEDCouplingAutoRefCountObjectPtr arr2=arr->keepSelectedComponents(v); + MCAuto arr2=arr->keepSelectedComponents(v); ret[i]->setArray(arr2); } return ret; @@ -3909,7 +3909,7 @@ MEDFileAnyTypeField1TSWithoutSDA::MEDFileAnyTypeField1TSWithoutSDA():_iteration( int MEDFileAnyTypeField1TSWithoutSDA::getDimension() const { int ret=-2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) (*it)->getDimension(ret); return ret; } @@ -3937,7 +3937,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::setMeshName(const std::string& newMeshNam bool MEDFileAnyTypeField1TSWithoutSDA::changeMeshNames(const std::vector< std::pair >& modifTab) { bool ret=false; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) { MEDFileFieldPerMesh *cur(*it); if(cur) @@ -4015,7 +4015,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::fillIteration(std::pair& p) cons void MEDFileAnyTypeField1TSWithoutSDA::fillTypesOfFieldAvailable(std::vector& types) const { std::set types2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) { (*it)->fillTypesOfFieldAvailable(types2); } @@ -4039,7 +4039,7 @@ std::vector MEDFileAnyTypeField1TSWithoutSDA::getPflsReallyUsed2() { std::vector ret; std::set ret2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) { std::vector tmp=(*it)->getPflsReallyUsed(); for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) @@ -4056,7 +4056,7 @@ std::vector MEDFileAnyTypeField1TSWithoutSDA::getLocsReallyUsed2() { std::vector ret; std::set ret2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) { std::vector tmp=(*it)->getLocsReallyUsed(); for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) @@ -4072,7 +4072,7 @@ std::vector MEDFileAnyTypeField1TSWithoutSDA::getLocsReallyUsed2() std::vector MEDFileAnyTypeField1TSWithoutSDA::getPflsReallyUsedMulti2() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) { std::vector tmp=(*it)->getPflsReallyUsedMulti(); ret.insert(ret.end(),tmp.begin(),tmp.end()); @@ -4084,7 +4084,7 @@ std::vector MEDFileAnyTypeField1TSWithoutSDA::getLocsReallyUsedMult { std::vector ret; std::set ret2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) { std::vector tmp=(*it)->getLocsReallyUsedMulti(); ret.insert(ret.end(),tmp.begin(),tmp.end()); @@ -4094,13 +4094,13 @@ std::vector MEDFileAnyTypeField1TSWithoutSDA::getLocsReallyUsedMult void MEDFileAnyTypeField1TSWithoutSDA::changePflsRefsNamesGen2(const std::vector< std::pair, std::string > >& mapOfModif) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) (*it)->changePflsRefsNamesGen(mapOfModif); } void MEDFileAnyTypeField1TSWithoutSDA::changeLocsRefsNamesGen2(const std::vector< std::pair, std::string > >& mapOfModif) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) (*it)->changeLocsRefsNamesGen(mapOfModif); } @@ -4248,7 +4248,7 @@ int MEDFileAnyTypeField1TSWithoutSDA::getMeshIdFromMeshName(const std::string& m std::string mName2(mName); int ret=0; std::vector msg; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++,ret++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++,ret++) if(mName2==(*it)->getMeshName()) return ret; else @@ -4267,7 +4267,7 @@ int MEDFileAnyTypeField1TSWithoutSDA::addNewEntryIfNecessary(const MEDCouplingMe std::string tmp(mesh->getName()); if(tmp.empty()) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::addNewEntryIfNecessary : empty mesh name ! unsupported by MED file !"); - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin(); + std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin(); int i=0; for(;it!=_field_per_mesh.end();it++,i++) { @@ -4284,7 +4284,7 @@ bool MEDFileAnyTypeField1TSWithoutSDA::renumberEntitiesLyingOnMesh(const std::st MEDFileFieldGlobsReal& glob) { bool ret=false; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) { MEDFileFieldPerMesh *fpm(*it); if(fpm) @@ -4299,7 +4299,7 @@ bool MEDFileAnyTypeField1TSWithoutSDA::renumberEntitiesLyingOnMesh(const std::st * * \sa splitMultiDiscrPerGeoTypes */ -std::vector< MEDCouplingAutoRefCountObjectPtr > MEDFileAnyTypeField1TSWithoutSDA::splitDiscretizations() const +std::vector< MCAuto > MEDFileAnyTypeField1TSWithoutSDA::splitDiscretizations() const { std::vector types; std::vector< std::vector > typesF; @@ -4309,7 +4309,7 @@ std::vector< MEDCouplingAutoRefCountObjectPtr for(std::vector< std::vector >::const_iterator it1=typesF.begin();it1!=typesF.end();it1++) for(std::vector::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) allEnt.insert(*it2); - std::vector< MEDCouplingAutoRefCountObjectPtr > ret(allEnt.size()); + std::vector< MCAuto > ret(allEnt.size()); std::set::const_iterator it3(allEnt.begin()); for(std::size_t i=0;i * * \sa splitDiscretizations */ -std::vector< MEDCouplingAutoRefCountObjectPtr > MEDFileAnyTypeField1TSWithoutSDA::splitMultiDiscrPerGeoTypes() const +std::vector< MCAuto > MEDFileAnyTypeField1TSWithoutSDA::splitMultiDiscrPerGeoTypes() const { std::vector types; std::vector< std::vector > typesF; @@ -4347,11 +4347,11 @@ std::vector< MEDCouplingAutoRefCountObjectPtr throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::splitMultiDiscrPerGeoTypes : empty field !"); if(nbOfMDPGT==1) { - std::vector< MEDCouplingAutoRefCountObjectPtr > ret0(1); + std::vector< MCAuto > ret0(1); ret0[0]=const_cast(this); this->incrRef(); return ret0; } - std::vector< MEDCouplingAutoRefCountObjectPtr > ret(nbOfMDPGT); + std::vector< MCAuto > ret(nbOfMDPGT); for(std::size_t i=0;i > its; @@ -4365,7 +4365,7 @@ std::vector< MEDCouplingAutoRefCountObjectPtr int MEDFileAnyTypeField1TSWithoutSDA::keepOnlySpatialDiscretization(TypeOfField tof, std::vector< std::pair >& its) { int globalCounter(0); - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) (*it)->keepOnlySpatialDiscretization(tof,globalCounter,its); return globalCounter; } @@ -4373,7 +4373,7 @@ int MEDFileAnyTypeField1TSWithoutSDA::keepOnlySpatialDiscretization(TypeOfField int MEDFileAnyTypeField1TSWithoutSDA::keepOnlyGaussDiscretization(std::size_t idOfDisc, std::vector< std::pair >& its) { int globalCounter(0); - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) (*it)->keepOnlyGaussDiscretization(idOfDisc,globalCounter,its); return globalCounter; } @@ -4386,7 +4386,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::updateData(int newLgth, const std::vector const DataArray *oldArr(getUndergroundDataArray()); if(oldArr) { - MEDCouplingAutoRefCountObjectPtr newArr(createNewEmptyDataArrayInstance()); + MCAuto newArr(createNewEmptyDataArrayInstance()); newArr->setInfoAndChangeNbOfCompo(oldArr->getInfoOnComponents()); setArray(newArr); _nb_of_tuples_to_be_allocated=newLgth;//force the _nb_of_tuples_to_be_allocated because setArray has been used specialy @@ -4400,7 +4400,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::updateData(int newLgth, const std::vector const DataArray *oldArr(getUndergroundDataArray()); if(!oldArr || !oldArr->isAllocated()) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::updateData : internal error 1 !"); - MEDCouplingAutoRefCountObjectPtr newArr(createNewEmptyDataArrayInstance()); + MCAuto newArr(createNewEmptyDataArrayInstance()); newArr->alloc(newLgth,getNumberOfComponents()); if(oldArr) newArr->copyStringInfoFrom(*oldArr); @@ -4409,7 +4409,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::updateData(int newLgth, const std::vector { if((*it).second<(*it).first) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::updateData : the range in the leaves was invalid !"); - newArr->setContigPartOfSelectedValues2(pos,oldArr,(*it).first,(*it).second,1); + newArr->setContigPartOfSelectedValuesSlice(pos,oldArr,(*it).first,(*it).second,1); pos+=(*it).second-(*it).first; } setArray(newArr); @@ -4480,14 +4480,14 @@ void MEDFileAnyTypeField1TSWithoutSDA::loadOnlyStructureOfDataRecursively(med_id void MEDFileAnyTypeField1TSWithoutSDA::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc) { allocIfNecessaryTheArrayToReceiveDataFromFile(); - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) (*it)->loadBigArraysRecursively(fid,nasc); } void MEDFileAnyTypeField1TSWithoutSDA::loadBigArraysRecursivelyIfNecessary(med_idt fid, const MEDFileFieldNameScope& nasc) { if(allocIfNecessaryTheArrayToReceiveDataFromFile()) - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) (*it)->loadBigArraysRecursively(fid,nasc); } @@ -4509,7 +4509,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::unloadArrays() std::size_t MEDFileAnyTypeField1TSWithoutSDA::getHeapMemorySizeWithoutChildren() const { - return _dt_unit.capacity()+_field_per_mesh.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh >); + return _dt_unit.capacity()+_field_per_mesh.capacity()*sizeof(MCAuto< MEDFileFieldPerMesh >); } std::vector MEDFileAnyTypeField1TSWithoutSDA::getDirectChildrenWithNull() const @@ -4517,7 +4517,7 @@ std::vector MEDFileAnyTypeField1TSWithoutSDA::getDirect std::vector ret; if(getUndergroundDataArray()) ret.push_back(getUndergroundDataArray()); - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) ret.push_back((const MEDFileFieldPerMesh *)*it); return ret; } @@ -4587,15 +4587,15 @@ void MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile(const MEDCouplingFieldDou std::vector idsInPflPerType; std::vector idsPerType; std::vector code,code2; - MEDCouplingAutoRefCountObjectPtr m(mesh->getMeshAtLevel(meshDimRelToMax)); + MCAuto m(mesh->getMeshAtLevel(meshDimRelToMax)); if(type!=ON_NODES) { m->splitProfilePerType(profile,code,idsInPflPerType,idsPerType); - std::vector< MEDCouplingAutoRefCountObjectPtr > idsInPflPerType2(idsInPflPerType.size()); std::copy(idsInPflPerType.begin(),idsInPflPerType.end(),idsInPflPerType2.begin()); - std::vector< MEDCouplingAutoRefCountObjectPtr > idsPerType2(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType2.begin()); + std::vector< MCAuto > idsInPflPerType2(idsInPflPerType.size()); std::copy(idsInPflPerType.begin(),idsInPflPerType.end(),idsInPflPerType2.begin()); + std::vector< MCAuto > idsPerType2(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType2.begin()); std::vector idsPerType3(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType3.begin()); // start of check - MEDCouplingAutoRefCountObjectPtr field2=field->clone(false); + MCAuto field2=field->clone(false); int nbOfTuplesExp=field2->getNumberOfTuplesExpectedRegardingCode(code,idsPerType3); if(nbOfTuplesExp!=arrOfVals->getNumberOfTuples()) { @@ -4724,7 +4724,7 @@ std::vector& MEDFileAnyTypeField1TSWithoutSDA::getInfo() bool MEDFileAnyTypeField1TSWithoutSDA::presenceOfMultiDiscPerGeoType() const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) { const MEDFileFieldPerMesh *fpm(*it); if(!fpm) @@ -4756,9 +4756,9 @@ bool MEDFileAnyTypeField1TSWithoutSDA::presenceOfMultiDiscPerGeoType() const * \throw If no field of \a this is lying on the mesh \a mName. * \throw If no field values of the given \a type or given \a meshDimRelToMax are available. */ -MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr& arrOut, const MEDFileFieldNameScope& nasc) const +MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { - MEDCouplingAutoRefCountObjectPtr mm; + MCAuto mm; if(mName.empty()) mm=MEDFileMesh::New(glob->getFileName(),getMeshName().c_str(),getMeshIteration(),getMeshOrder()); else @@ -4786,9 +4786,9 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtLevel(TypeOf * \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh. * \throw If no field values of the given \a type or given \a meshDimRelToMax are available. */ -MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MEDCouplingAutoRefCountObjectPtr& arrOut, const MEDFileFieldNameScope& nasc) const +MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { - MEDCouplingAutoRefCountObjectPtr m(mesh->getMeshAtLevel(meshDimRelToMax,false)); + MCAuto m(mesh->getMeshAtLevel(meshDimRelToMax,false)); const DataArrayInt *d=mesh->getNumberFieldAtLevel(meshDimRelToMax); const DataArrayInt *e=mesh->getNumberFieldAtLevel(1); if(meshDimRelToMax==1) @@ -4816,9 +4816,9 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel( * \throw If there are no mesh entities in the mesh. * \throw If no field values of the given \a type are available. */ -MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtTopLevel(TypeOfField type, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr& arrOut, const MEDFileFieldNameScope& nasc) const +MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtTopLevel(TypeOfField type, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { - MEDCouplingAutoRefCountObjectPtr mm; + MCAuto mm; if(mName.empty()) mm=MEDFileMesh::New(glob->getFileName(),getMeshName().c_str(),getMeshIteration(),getMeshOrder()); else @@ -4850,12 +4850,12 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtTopLevel(Typ * \throw If no field of \a this is lying on \a mesh. * \throw If no field values of the given \a type or given \a meshDimRelToMax are available. */ -MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum, MEDCouplingAutoRefCountObjectPtr& arrOut, const MEDFileFieldNameScope& nasc) const +MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { static const char msg1[]="MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : request for a renumbered field following mesh numbering whereas it is a profile field !"; int meshId=getMeshIdFromMeshName(mesh->getName()); bool isPfl=false; - MEDCouplingAutoRefCountObjectPtr ret=_field_per_mesh[meshId]->getFieldOnMeshAtLevel(type,glob,mesh,isPfl,arrOut,nasc); + MCAuto ret=_field_per_mesh[meshId]->getFieldOnMeshAtLevel(type,glob,mesh,isPfl,arrOut,nasc); switch(renumPol) { case 0: @@ -4900,7 +4900,7 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel( oss << "\"" << nasc.getName() << "\" not defined on all nodes !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDCouplingAutoRefCountObjectPtr nodeRenumSafe=nodeRenum->checkAndPreparePermutation(); + MCAuto nodeRenumSafe=nodeRenum->checkAndPreparePermutation(); if(!dynamic_cast((DataArray *)arrOut)) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : node renumbering not implemented for not double DataArrays !"); ret->renumberNodes(nodeRenumSafe->getConstPointer()); @@ -4930,9 +4930,9 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel( */ DataArray *MEDFileAnyTypeField1TSWithoutSDA::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const { - MEDCouplingAutoRefCountObjectPtr m(mesh->getMeshAtLevel(meshDimRelToMax)); + MCAuto m(mesh->getMeshAtLevel(meshDimRelToMax)); int meshId=getMeshIdFromMeshName(mesh->getName().c_str()); - MEDCouplingAutoRefCountObjectPtr ret=_field_per_mesh[meshId]->getFieldOnMeshAtLevelWithPfl(type,m,pfl,glob,nasc); + MCAuto ret=_field_per_mesh[meshId]->getFieldOnMeshAtLevelWithPfl(type,m,pfl,glob,nasc); ret->setName(nasc.getName().c_str()); return ret.retn(); } @@ -4967,13 +4967,13 @@ std::vector MEDFileField1TSWithoutSDA::CheckSBTMesh(const MEDCouplingMesh * std::set geoTypes=mesh->getAllGeoTypes(); int nbOfTypes=geoTypes.size(); std::vector code(3*nbOfTypes); - MEDCouplingAutoRefCountObjectPtr arr1=DataArrayInt::New(); + MCAuto arr1=DataArrayInt::New(); arr1->alloc(nbOfTypes,1); int *arrPtr=arr1->getPointer(); std::set::const_iterator it=geoTypes.begin(); for(int i=0;i arr2=arr1->checkAndPreparePermutation(); + MCAuto arr2=arr1->checkAndPreparePermutation(); const int *arrPtr2=arr2->getConstPointer(); int i=0; for(it=geoTypes.begin();it!=geoTypes.end();it++,i++) @@ -5051,7 +5051,7 @@ std::vector< std::vector > MEDFileField1TSWithoutSDA::getFiel ret[i].resize(nbOfRet1); for(int j=0;jselectByTupleId2(p[j].first,p[j].second,1); + DataArrayDouble *tmp=_arr->selectByTupleIdSafeSlice(p[j].first,p[j].second,1); ret[i][j]=tmp; } } @@ -5081,13 +5081,13 @@ const char *MEDFileField1TSWithoutSDA::getTypeStr() const MEDFileIntField1TSWithoutSDA *MEDFileField1TSWithoutSDA::convertToInt() const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileIntField1TSWithoutSDA); + MCAuto ret(new MEDFileIntField1TSWithoutSDA); ret->MEDFileAnyTypeField1TSWithoutSDA::operator =(*this); ret->deepCpyLeavesFrom(*this); const DataArrayDouble *arr(_arr); if(arr) { - MEDCouplingAutoRefCountObjectPtr arr2(arr->convertToIntArr()); + MCAuto arr2(arr->convertToIntArr()); ret->setArray(arr2); } return ret.retn(); @@ -5164,16 +5164,16 @@ MEDFileField1TSWithoutSDA::MEDFileField1TSWithoutSDA():MEDFileAnyTypeField1TSWit MEDFileAnyTypeField1TSWithoutSDA *MEDFileField1TSWithoutSDA::shallowCpy() const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileField1TSWithoutSDA(*this)); + MCAuto ret(new MEDFileField1TSWithoutSDA(*this)); ret->deepCpyLeavesFrom(*this); return ret.retn(); } -MEDFileAnyTypeField1TSWithoutSDA *MEDFileField1TSWithoutSDA::deepCpy() const +MEDFileAnyTypeField1TSWithoutSDA *MEDFileField1TSWithoutSDA::deepCopy() const { - MEDCouplingAutoRefCountObjectPtr ret=static_cast(shallowCpy()); + MCAuto ret=static_cast(shallowCpy()); if((const DataArrayDouble *)_arr) - ret->_arr=_arr->deepCpy(); + ret->_arr=_arr->deepCopy(); return ret.retn(); } @@ -5253,13 +5253,13 @@ const char *MEDFileIntField1TSWithoutSDA::getTypeStr() const MEDFileField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::convertToDouble() const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileField1TSWithoutSDA); + MCAuto ret(new MEDFileField1TSWithoutSDA); ret->MEDFileAnyTypeField1TSWithoutSDA::operator =(*this); ret->deepCpyLeavesFrom(*this); const DataArrayInt *arr(_arr); if(arr) { - MEDCouplingAutoRefCountObjectPtr arr2(arr->convertToDblArr()); + MCAuto arr2(arr->convertToDblArr()); ret->setArray(arr2); } return ret.retn(); @@ -5342,16 +5342,16 @@ DataArrayInt *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayIntExt(std::v MEDFileAnyTypeField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::shallowCpy() const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileIntField1TSWithoutSDA(*this)); + MCAuto ret(new MEDFileIntField1TSWithoutSDA(*this)); ret->deepCpyLeavesFrom(*this); return ret.retn(); } -MEDFileAnyTypeField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::deepCpy() const +MEDFileAnyTypeField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::deepCopy() const { - MEDCouplingAutoRefCountObjectPtr ret=static_cast(shallowCpy()); + MCAuto ret=static_cast(shallowCpy()); if((const DataArrayInt *)_arr) - ret->_arr=_arr->deepCpy(); + ret->_arr=_arr->deepCopy(); return ret.retn(); } @@ -5419,7 +5419,7 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i std::vector infos; std::string dtunit,fieldName; LocateField2(fid,fileName,0,true,fieldName,typcha,infos,dtunit); - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; switch(typcha) { case MED_FLOAT64: @@ -5473,7 +5473,7 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i std::string dtunit; int iii=-1; int nbSteps=LocateField(fid,fileName,fieldName,iii,typcha,infos,dtunit); - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; switch(typcha) { case MED_FLOAT64: @@ -5532,14 +5532,14 @@ MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::BuildNewInstanceFromContent(MEDF throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::BuildNewInstanceFromContent : empty content in input : unable to build a new instance !"); if(dynamic_cast(c)) { - MEDCouplingAutoRefCountObjectPtr ret=MEDFileField1TS::New(); + MCAuto ret=MEDFileField1TS::New(); ret->setFileName(fileName); ret->_content=c; c->incrRef(); return ret.retn(); } if(dynamic_cast(c)) { - MEDCouplingAutoRefCountObjectPtr ret=MEDFileIntField1TS::New(); + MCAuto ret=MEDFileIntField1TS::New(); ret->setFileName(fileName); ret->_content=c; c->incrRef(); return ret.retn(); @@ -5551,8 +5551,8 @@ MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const std::string& fileName, { MEDFileUtilities::CheckFileForRead(fileName); MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); - MEDCouplingAutoRefCountObjectPtr c=BuildContentFrom(fid,fileName,loadAll,0); - MEDCouplingAutoRefCountObjectPtr ret=BuildNewInstanceFromContent(c,fileName); + MCAuto c=BuildContentFrom(fid,fileName,loadAll,0); + MCAuto ret=BuildNewInstanceFromContent(c,fileName); ret->loadGlobals(fid); return ret.retn(); } @@ -5561,8 +5561,8 @@ MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const std::string& fileName, { MEDFileUtilities::CheckFileForRead(fileName); MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); - MEDCouplingAutoRefCountObjectPtr c=BuildContentFrom(fid,fileName,fieldName,loadAll,0); - MEDCouplingAutoRefCountObjectPtr ret=BuildNewInstanceFromContent(c,fileName); + MCAuto c=BuildContentFrom(fid,fileName,fieldName,loadAll,0); + MCAuto ret=BuildNewInstanceFromContent(c,fileName); ret->loadGlobals(fid); return ret.retn(); } @@ -5571,8 +5571,8 @@ MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const std::string& fileName, { MEDFileUtilities::CheckFileForRead(fileName); MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); - MEDCouplingAutoRefCountObjectPtr c=BuildContentFrom(fid,fileName,fieldName,iteration,order,loadAll,0); - MEDCouplingAutoRefCountObjectPtr ret=BuildNewInstanceFromContent(c,fileName); + MCAuto c=BuildContentFrom(fid,fileName,fieldName,iteration,order,loadAll,0); + MCAuto ret=BuildNewInstanceFromContent(c,fileName); ret->loadGlobals(fid); return ret.retn(); } @@ -5584,7 +5584,7 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i std::string dtunit; int iii=-1; int nbOfStep2=LocateField(fid,fileName,fieldName,iii,typcha,infos,dtunit); - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; switch(typcha) { case MED_FLOAT64: @@ -6134,14 +6134,14 @@ std::vector< std::vector > > MEDFileAnyTypeField1TS::getField * The returned instances are deep copy of \a this except that for globals that are share with those contained in \a this. * ** WARNING ** do no forget to rename the ouput instances to avoid to write n-times in the same MED file field ! */ -std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > MEDFileAnyTypeField1TS::splitComponents() const +std::vector< MCAuto< MEDFileAnyTypeField1TS > > MEDFileAnyTypeField1TS::splitComponents() const { const MEDFileAnyTypeField1TSWithoutSDA *content(_content); if(!content) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::splitComponents : no content in this ! Unable to split components !"); - std::vector< MEDCouplingAutoRefCountObjectPtr > contentsSplit=content->splitComponents(); + std::vector< MCAuto > contentsSplit=content->splitComponents(); std::size_t sz(contentsSplit.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret(sz); + std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret(sz); for(std::size_t i=0;i > MEDFil * This method returns as MEDFileAnyTypeField1TS new instances as number of spatial discretizations in \a this. * The returned instances are shallowed copied of \a this except that for globals that are share with those contained in \a this. */ -std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > MEDFileAnyTypeField1TS::splitDiscretizations() const +std::vector< MCAuto< MEDFileAnyTypeField1TS > > MEDFileAnyTypeField1TS::splitDiscretizations() const { const MEDFileAnyTypeField1TSWithoutSDA *content(_content); if(!content) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::splitDiscretizations : no content in this ! Unable to split discretization !"); - std::vector< MEDCouplingAutoRefCountObjectPtr > contentsSplit(content->splitDiscretizations()); + std::vector< MCAuto > contentsSplit(content->splitDiscretizations()); std::size_t sz(contentsSplit.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret(sz); + std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret(sz); for(std::size_t i=0;i > MEDFil * This method returns as MEDFileAnyTypeField1TS new instances as number of maximal number of discretization in \a this. * The returned instances are shallowed copied of \a this except that for globals that are share with those contained in \a this. */ -std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > MEDFileAnyTypeField1TS::splitMultiDiscrPerGeoTypes() const +std::vector< MCAuto< MEDFileAnyTypeField1TS > > MEDFileAnyTypeField1TS::splitMultiDiscrPerGeoTypes() const { const MEDFileAnyTypeField1TSWithoutSDA *content(_content); if(!content) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::splitMultiDiscrPerGeoTypes : no content in this ! Unable to split discretization !"); - std::vector< MEDCouplingAutoRefCountObjectPtr > contentsSplit(content->splitMultiDiscrPerGeoTypes()); + std::vector< MCAuto > contentsSplit(content->splitMultiDiscrPerGeoTypes()); std::size_t sz(contentsSplit.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret(sz); + std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret(sz); for(std::size_t i=0;i > MEDFil return ret; } -MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::deepCpy() const +MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::deepCopy() const { - MEDCouplingAutoRefCountObjectPtr ret=shallowCpy(); + MCAuto ret=shallowCpy(); if((const MEDFileAnyTypeField1TSWithoutSDA *)_content) - ret->_content=_content->deepCpy(); + ret->_content=_content->deepCopy(); ret->deepCpyGlobs(*this); return ret.retn(); } @@ -6216,7 +6216,7 @@ int MEDFileAnyTypeField1TS::copyTinyInfoFrom(const MEDCouplingFieldDouble *field */ MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, bool loadAll) { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileField1TS(fileName,loadAll,0)); + MCAuto ret(new MEDFileField1TS(fileName,loadAll,0)); ret->contentNotNull(); return ret.retn(); } @@ -6233,7 +6233,7 @@ MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, bool loadAll) */ MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, const std::string& fieldName, bool loadAll) { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileField1TS(fileName,fieldName,loadAll,0)); + MCAuto ret(new MEDFileField1TS(fileName,fieldName,loadAll,0)); ret->contentNotNull(); return ret.retn(); } @@ -6253,7 +6253,7 @@ MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, const std::st */ MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll) { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileField1TS(fileName,fieldName,iteration,order,loadAll,0)); + MCAuto ret(new MEDFileField1TS(fileName,fieldName,iteration,order,loadAll,0)); ret->contentNotNull(); return ret.retn(); } @@ -6272,7 +6272,7 @@ MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, const std::st */ MEDFileField1TS *MEDFileField1TS::New(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent) { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileField1TS(other,shallowCopyOfContent); + MCAuto ret=new MEDFileField1TS(other,shallowCopyOfContent); ret->contentNotNull(); return ret.retn(); } @@ -6284,7 +6284,7 @@ MEDFileField1TS *MEDFileField1TS::New(const MEDFileField1TSWithoutSDA& other, bo */ MEDFileField1TS *MEDFileField1TS::New() { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileField1TS; + MCAuto ret=new MEDFileField1TS; ret->contentNotNull(); return ret.retn(); } @@ -6299,14 +6299,14 @@ MEDFileField1TS *MEDFileField1TS::New() */ MEDFileIntField1TS *MEDFileField1TS::convertToInt(bool isDeepCpyGlobs) const { - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; const MEDFileAnyTypeField1TSWithoutSDA *content(_content); if(content) { const MEDFileField1TSWithoutSDA *contc=dynamic_cast(content); if(!contc) throw INTERP_KERNEL::Exception("MEDFileField1TS::convertToInt : the content inside this is not FLOAT64 ! This is incoherent !"); - MEDCouplingAutoRefCountObjectPtr newc(contc->convertToInt()); + MCAuto newc(contc->convertToInt()); ret=static_cast(MEDFileAnyTypeField1TS::BuildNewInstanceFromContent((MEDFileIntField1TSWithoutSDA *)newc,getFileName())); } else @@ -6340,7 +6340,7 @@ MEDFileField1TSWithoutSDA *MEDFileField1TS::contentNotNull() return ret; } -void MEDFileField1TS::SetDataArrayDoubleInField(MEDCouplingFieldDouble *f, MEDCouplingAutoRefCountObjectPtr& arr) +void MEDFileField1TS::SetDataArrayDoubleInField(MEDCouplingFieldDouble *f, MCAuto& arr) { if(!f) throw INTERP_KERNEL::Exception("MEDFileField1TS::SetDataArrayDoubleInField : input field is NULL !"); @@ -6352,7 +6352,7 @@ void MEDFileField1TS::SetDataArrayDoubleInField(MEDCouplingFieldDouble *f, MEDCo f->setArray(arrOutC); } -DataArrayDouble *MEDFileField1TS::ReturnSafelyDataArrayDouble(MEDCouplingAutoRefCountObjectPtr& arr) +DataArrayDouble *MEDFileField1TS::ReturnSafelyDataArrayDouble(MCAuto& arr) { if(!((DataArray*)arr)) throw INTERP_KERNEL::Exception("MEDFileField1TS::ReturnSafelyDataArrayDouble : no array !"); @@ -6429,8 +6429,8 @@ MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtLevel(TypeOfField type, int m { if(getFileName().empty()) throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !"); - MEDCouplingAutoRefCountObjectPtr arrOut; - MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut,*contentNotNull()); + MCAuto arrOut; + MCAuto ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut,*contentNotNull()); MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut); return ret.retn(); } @@ -6461,8 +6461,8 @@ MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtTopLevel(TypeOfField type, in { if(getFileName().empty()) throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtTopLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtTopLevel method instead !"); - MEDCouplingAutoRefCountObjectPtr arrOut; - MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldAtTopLevel(type,std::string(),renumPol,this,arrOut,*contentNotNull()); + MCAuto arrOut; + MCAuto ret=contentNotNull()->getFieldAtTopLevel(type,std::string(),renumPol,this,arrOut,*contentNotNull()); MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut); return ret.retn(); } @@ -6489,8 +6489,8 @@ MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtTopLevel(TypeOfField type, in */ MEDCouplingFieldDouble *MEDFileField1TS::getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol) const { - MEDCouplingAutoRefCountObjectPtr arrOut; - MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arrOut,*contentNotNull()); + MCAuto arrOut; + MCAuto ret=contentNotNull()->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arrOut,*contentNotNull()); MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut); return ret.retn(); } @@ -6518,8 +6518,8 @@ MEDCouplingFieldDouble *MEDFileField1TS::getFieldOnMeshAtLevel(TypeOfField type, */ MEDCouplingFieldDouble *MEDFileField1TS::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol) const { - MEDCouplingAutoRefCountObjectPtr arrOut; - MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arrOut,*contentNotNull()); + MCAuto arrOut; + MCAuto ret=contentNotNull()->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arrOut,*contentNotNull()); MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut); return ret.retn(); } @@ -6554,8 +6554,8 @@ MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtLevelOld(TypeOfField type, co { if(getFileName().empty()) throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtLevelOld : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !"); - MEDCouplingAutoRefCountObjectPtr arrOut; - MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arrOut,*contentNotNull()); + MCAuto arrOut; + MCAuto ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arrOut,*contentNotNull()); MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut); return ret.retn(); } @@ -6578,7 +6578,7 @@ MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtLevelOld(TypeOfField type, co */ DataArrayDouble *MEDFileField1TS::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const { - MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNull()); + MCAuto ret=contentNotNull()->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNull()); return MEDFileField1TS::ReturnSafelyDataArrayDouble(ret); } @@ -6654,35 +6654,35 @@ std::vector< std::vector > MEDFileField1TS::getFieldSplitedBy MEDFileIntField1TS *MEDFileIntField1TS::New() { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileIntField1TS; + MCAuto ret=new MEDFileIntField1TS; ret->contentNotNull(); return ret.retn(); } MEDFileIntField1TS *MEDFileIntField1TS::New(const std::string& fileName, bool loadAll) { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileIntField1TS(fileName,loadAll,0)); + MCAuto ret(new MEDFileIntField1TS(fileName,loadAll,0)); ret->contentNotNull(); return ret.retn(); } MEDFileIntField1TS *MEDFileIntField1TS::New(const std::string& fileName, const std::string& fieldName, bool loadAll) { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileIntField1TS(fileName,fieldName,loadAll,0)); + MCAuto ret(new MEDFileIntField1TS(fileName,fieldName,loadAll,0)); ret->contentNotNull(); return ret.retn(); } MEDFileIntField1TS *MEDFileIntField1TS::New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll) { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileIntField1TS(fileName,fieldName,iteration,order,loadAll,0)); + MCAuto ret(new MEDFileIntField1TS(fileName,fieldName,iteration,order,loadAll,0)); ret->contentNotNull(); return ret.retn(); } MEDFileIntField1TS *MEDFileIntField1TS::New(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent) { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileIntField1TS(other,shallowCopyOfContent); + MCAuto ret=new MEDFileIntField1TS(other,shallowCopyOfContent); ret->contentNotNull(); return ret.retn(); } @@ -6738,14 +6738,14 @@ MEDFileAnyTypeField1TS *MEDFileIntField1TS::shallowCpy() const */ MEDFileField1TS *MEDFileIntField1TS::convertToDouble(bool isDeepCpyGlobs) const { - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; const MEDFileAnyTypeField1TSWithoutSDA *content(_content); if(content) { const MEDFileIntField1TSWithoutSDA *contc=dynamic_cast(content); if(!contc) throw INTERP_KERNEL::Exception("MEDFileIntField1TS::convertToInt : the content inside this is not INT32 ! This is incoherent !"); - MEDCouplingAutoRefCountObjectPtr newc(contc->convertToDouble()); + MCAuto newc(contc->convertToDouble()); ret=static_cast(MEDFileAnyTypeField1TS::BuildNewInstanceFromContent((MEDFileField1TSWithoutSDA *)newc,getFileName())); } else @@ -6821,8 +6821,8 @@ MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldAtLevel(TypeOfField type, in { if(getFileName().empty()) throw INTERP_KERNEL::Exception("MEDFileIntField1TS::getFieldAtLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !"); - MEDCouplingAutoRefCountObjectPtr arrOut2; - MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut2,*contentNotNull()); + MCAuto arrOut2; + MCAuto ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut2,*contentNotNull()); DataArrayInt *arrOutC=dynamic_cast((DataArray *)arrOut2); if(!arrOutC) throw INTERP_KERNEL::Exception("MEDFileIntField1TS::getFieldAtLevelOld : mismatch between dataArrays type and MEDFileIntField1TS ! Expected int32 !"); @@ -6831,7 +6831,7 @@ MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldAtLevel(TypeOfField type, in return ret.retn(); } -DataArrayInt *MEDFileIntField1TS::ReturnSafelyDataArrayInt(MEDCouplingAutoRefCountObjectPtr& arr) +DataArrayInt *MEDFileIntField1TS::ReturnSafelyDataArrayInt(MCAuto& arr) { if(!((DataArray *)arr)) throw INTERP_KERNEL::Exception("MEDFileIntField1TS::ReturnSafelyDataArrayInt : input DataArray is NULL !"); @@ -6869,8 +6869,8 @@ MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldAtTopLevel(TypeOfField type, { if(getFileName().empty()) throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtTopLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtTopLevel method instead !"); - MEDCouplingAutoRefCountObjectPtr arr; - MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldAtTopLevel(type,std::string(),renumPol,this,arr,*contentNotNull()); + MCAuto arr; + MCAuto ret=contentNotNull()->getFieldAtTopLevel(type,std::string(),renumPol,this,arr,*contentNotNull()); arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); return ret.retn(); } @@ -6898,8 +6898,8 @@ MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldAtTopLevel(TypeOfField type, */ MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt* &arrOut, int renumPol) const { - MEDCouplingAutoRefCountObjectPtr arr; - MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arr,*contentNotNull()); + MCAuto arr; + MCAuto ret=contentNotNull()->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arr,*contentNotNull()); arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); return ret.retn(); } @@ -6928,8 +6928,8 @@ MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldOnMeshAtLevel(TypeOfField ty */ MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt* &arrOut, int renumPol) const { - MEDCouplingAutoRefCountObjectPtr arr; - MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arr,*contentNotNull()); + MCAuto arr; + MCAuto ret=contentNotNull()->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arr,*contentNotNull()); arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); return ret.retn(); } @@ -6965,8 +6965,8 @@ MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldAtLevelOld(TypeOfField type, { if(getFileName().empty()) throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtLevelOld : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !"); - MEDCouplingAutoRefCountObjectPtr arr; - MEDCouplingAutoRefCountObjectPtr ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arr,*contentNotNull()); + MCAuto arr; + MCAuto ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arr,*contentNotNull()); arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); return ret.retn(); } @@ -6989,7 +6989,7 @@ MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldAtLevelOld(TypeOfField type, */ DataArrayInt *MEDFileIntField1TS::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const { - MEDCouplingAutoRefCountObjectPtr arr=contentNotNull()->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNull()); + MCAuto arr=contentNotNull()->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNull()); return MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); } @@ -7044,7 +7044,7 @@ catch(INTERP_KERNEL::Exception& e) std::size_t MEDFileAnyTypeFieldMultiTSWithoutSDA::getHeapMemorySizeWithoutChildren() const { - std::size_t ret(_name.capacity()+_infos.capacity()*sizeof(std::string)+_time_steps.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr)); + std::size_t ret(_name.capacity()+_infos.capacity()*sizeof(std::string)+_time_steps.capacity()*sizeof(MCAuto)); for(std::vector::const_iterator it=_infos.begin();it!=_infos.end();it++) ret+=(*it).capacity(); return ret; @@ -7053,7 +7053,7 @@ std::size_t MEDFileAnyTypeFieldMultiTSWithoutSDA::getHeapMemorySizeWithoutChildr std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getDirectChildrenWithNull() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) ret.push_back((const MEDFileAnyTypeField1TSWithoutSDA *)*it); return ret; } @@ -7064,7 +7064,7 @@ std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getDi */ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds(const int *startIds, const int *endIds) const { - MEDCouplingAutoRefCountObjectPtr ret=createNew(); + MCAuto ret=createNew(); ret->setInfo(_infos); int sz=(int)_time_steps.size(); for(const int *id=startIds;id!=endIds;id++) @@ -7072,7 +7072,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buil if(*id>=0 && *id tse2; + MCAuto tse2; if(tse) { tse->incrRef(); @@ -7101,7 +7101,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buil { static const char msg[]="MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds2"; int nbOfEntriesToKeep=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg); - MEDCouplingAutoRefCountObjectPtr ret=createNew(); + MCAuto ret=createNew(); ret->setInfo(_infos); int sz=(int)_time_steps.size(); int j=bg; @@ -7110,7 +7110,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buil if(j>=0 && j tse2; + MCAuto tse2; if(tse) { tse->incrRef(); @@ -7134,8 +7134,8 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buil MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair >& timeSteps) const { int id=0; - MEDCouplingAutoRefCountObjectPtr ids=DataArrayInt::New(); ids->alloc(0,1); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++) + MCAuto ids=DataArrayInt::New(); ids->alloc(0,1); + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++) { const MEDFileAnyTypeField1TSWithoutSDA *cur(*it); if(!cur) @@ -7150,8 +7150,8 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::part MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair >& timeSteps) const { int id=0; - MEDCouplingAutoRefCountObjectPtr ids=DataArrayInt::New(); ids->alloc(0,1); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++) + MCAuto ids=DataArrayInt::New(); ids->alloc(0,1); + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++) { const MEDFileAnyTypeField1TSWithoutSDA *cur(*it); if(!cur) @@ -7165,7 +7165,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::part bool MEDFileAnyTypeFieldMultiTSWithoutSDA::presenceOfMultiDiscPerGeoType() const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) { const MEDFileAnyTypeField1TSWithoutSDA *cur(*it); if(!cur) @@ -7189,7 +7189,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::setInfo(const std::vector >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++) { const MEDFileAnyTypeField1TSWithoutSDA *pt(*it); if(pt->isDealingTS(iteration,order)) @@ -7230,7 +7230,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::setMeshName(const std::string& newMes bool MEDFileAnyTypeFieldMultiTSWithoutSDA::changeMeshNames(const std::vector< std::pair >& modifTab) { bool ret=false; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) { MEDFileAnyTypeField1TSWithoutSDA *cur(*it); if(cur) @@ -7259,7 +7259,7 @@ bool MEDFileAnyTypeFieldMultiTSWithoutSDA::renumberEntitiesLyingOnMesh(const std MEDFileFieldGlobsReal& glob) { bool ret=false; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) { MEDFileAnyTypeField1TSWithoutSDA *f1ts(*it); if(f1ts) @@ -7281,7 +7281,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::simpleRepr(int bkOffset, std::ostream oss << startLine << " - \"" << *it << "\"" << std::endl; } int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++) { std::string chapter(17,'0'+i); oss << startLine << chapter << std::endl; @@ -7315,7 +7315,7 @@ std::vector< std::pair > MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeS return ret; } -void MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep(MEDCouplingAutoRefCountObjectPtr& tse) +void MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep(MCAuto& tse) { MEDFileAnyTypeField1TSWithoutSDA *tse2(tse); if(!tse2) @@ -7333,7 +7333,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep(MEDCouplingAutoRefCo void MEDFileAnyTypeFieldMultiTSWithoutSDA::synchronizeNameScope() { std::size_t nbOfCompo=_infos.size(); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) { MEDFileAnyTypeField1TSWithoutSDA *cur=(*it); if(cur) @@ -7408,7 +7408,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::writeLL(med_idt fid, const MEDFileWri void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) { MEDFileAnyTypeField1TSWithoutSDA *elt(*it); if(elt) @@ -7418,7 +7418,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursively(med_idt fid, void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursivelyIfNecessary(med_idt fid, const MEDFileFieldNameScope& nasc) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) { MEDFileAnyTypeField1TSWithoutSDA *elt(*it); if(elt) @@ -7428,7 +7428,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursivelyIfNecessary(m void MEDFileAnyTypeFieldMultiTSWithoutSDA::unloadArrays() { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) { MEDFileAnyTypeField1TSWithoutSDA *elt(*it); if(elt) @@ -7443,8 +7443,8 @@ int MEDFileAnyTypeFieldMultiTSWithoutSDA::getNumberOfTS() const void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseEmptyTS() { - std::vector< MEDCouplingAutoRefCountObjectPtr > newTS; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) + std::vector< MCAuto > newTS; + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) { const MEDFileAnyTypeField1TSWithoutSDA *tmp=(*it); if(tmp) @@ -7455,7 +7455,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseEmptyTS() void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds(const int *startIds, const int *endIds) { - std::vector< MEDCouplingAutoRefCountObjectPtr > newTS; + std::vector< MCAuto > newTS; int maxId=(int)_time_steps.size(); int ii=0; std::set idsToDel; @@ -7488,7 +7488,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds2(int bg, int end, in int j=bg; for(int i=0;i > newTS; + std::vector< MCAuto > newTS; for(std::size_t i=0;i >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++) { const MEDFileAnyTypeField1TSWithoutSDA *tmp(*it); if(tmp) @@ -7520,7 +7520,7 @@ int MEDFileAnyTypeFieldMultiTSWithoutSDA::getPosGivenTime(double time, double ep int ret=0; std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getPosGivenTime : No such time step " << time << "! \nPossibilities are : "; oss.precision(15); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++) { const MEDFileAnyTypeField1TSWithoutSDA *tmp(*it); if(tmp) @@ -7619,7 +7619,7 @@ std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getPflsReallyUsed { std::vector ret; std::set ret2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) { std::vector tmp=(*it)->getPflsReallyUsed2(); for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) @@ -7636,7 +7636,7 @@ std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getLocsReallyUsed { std::vector ret; std::set ret2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) { std::vector tmp=(*it)->getLocsReallyUsed2(); for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) @@ -7652,7 +7652,7 @@ std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getLocsReallyUsed std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getPflsReallyUsedMulti2() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) { std::vector tmp=(*it)->getPflsReallyUsedMulti2(); ret.insert(ret.end(),tmp.begin(),tmp.end()); @@ -7663,7 +7663,7 @@ std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getPflsReallyUsed std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getLocsReallyUsedMulti2() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) { std::vector tmp=(*it)->getLocsReallyUsedMulti2(); ret.insert(ret.end(),tmp.begin(),tmp.end()); @@ -7673,13 +7673,13 @@ std::vector MEDFileAnyTypeFieldMultiTSWithoutSDA::getLocsReallyUsed void MEDFileAnyTypeFieldMultiTSWithoutSDA::changePflsRefsNamesGen2(const std::vector< std::pair, std::string > >& mapOfModif) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TSWithoutSDA > >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) (*it)->changePflsRefsNamesGen2(mapOfModif); } void MEDFileAnyTypeFieldMultiTSWithoutSDA::changeLocsRefsNamesGen2(const std::vector< std::pair, std::string > >& mapOfModif) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TSWithoutSDA > >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) + for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) (*it)->changeLocsRefsNamesGen2(mapOfModif); } @@ -7700,23 +7700,23 @@ std::vector< std::vector< std::pair > > MEDFileAnyTypeFieldMultiTSWitho return getTimeStepEntry(iteration,order).getFieldSplitedByType(mname,types,typesF,pfls,locs); } -MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::deepCpy() const +MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::deepCopy() const { - MEDCouplingAutoRefCountObjectPtr ret=shallowCpy(); + MCAuto ret=shallowCpy(); std::size_t i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++) { if((const MEDFileAnyTypeField1TSWithoutSDA *)*it) - ret->_time_steps[i]=(*it)->deepCpy(); + ret->_time_steps[i]=(*it)->deepCopy(); } return ret.retn(); } -std::vector< MEDCouplingAutoRefCountObjectPtr > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitComponents() const +std::vector< MCAuto > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitComponents() const { std::size_t sz(_infos.size()),sz2(_time_steps.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr > ret(sz); - std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr > > ts(sz2); + std::vector< MCAuto > ret(sz); + std::vector< std::vector< MCAuto > > ts(sz2); for(std::size_t i=0;i > ret1=_time_steps[i]->splitComponents(); + std::vector< MCAuto > ret1=_time_steps[i]->splitComponents(); if(ret1.size()!=sz) { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::splitComponents : At rank #" << i << " number of components is " << ret1.size() << " whereas it should be for all time steps " << sz << " !"; @@ -7742,10 +7742,10 @@ std::vector< MEDCouplingAutoRefCountObjectPtr > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitDiscretizations() const +std::vector< MCAuto > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitDiscretizations() const { std::size_t sz(_time_steps.size()); - std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr > > items(sz); + std::vector< std::vector< MCAuto > > items(sz); for(std::size_t i=0;isplitDiscretizations(); } // - std::vector< MEDCouplingAutoRefCountObjectPtr > ret; - std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr > > ret2; + std::vector< MCAuto > ret; + std::vector< std::vector< MCAuto > > ret2; std::vector< TypeOfField > types; - for(std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr > >::const_iterator it0=items.begin();it0!=items.end();it0++) - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++) + for(std::vector< std::vector< MCAuto > >::const_iterator it0=items.begin();it0!=items.end();it0++) + for(std::vector< MCAuto >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++) { std::vector ts=(*it1)->getTypesOfFieldAvailable(); if(ts.size()!=1) @@ -7771,8 +7771,8 @@ std::vector< MEDCouplingAutoRefCountObjectPtr > >::const_iterator it0=items.begin();it0!=items.end();it0++) - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++) + for(std::vector< std::vector< MCAuto > >::const_iterator it0=items.begin();it0!=items.end();it0++) + for(std::vector< MCAuto >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++) { TypeOfField typ=(*it1)->getTypesOfFieldAvailable()[0]; std::size_t pos=std::distance(types.begin(),std::find(types.begin(),types.end(),typ)); @@ -7780,8 +7780,8 @@ std::vector< MEDCouplingAutoRefCountObjectPtr elt(createNew()); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it1=ret2[i].begin();it1!=ret2[i].end();it1++) + MCAuto elt(createNew()); + for(std::vector< MCAuto >::iterator it1=ret2[i].begin();it1!=ret2[i].end();it1++) elt->pushBackTimeStep(*it1);//also updates infos in elt ret[i]=elt; elt->MEDFileFieldNameScope::operator=(*this); @@ -7792,10 +7792,10 @@ std::vector< MEDCouplingAutoRefCountObjectPtr > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes() const +std::vector< MCAuto > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes() const { std::size_t sz(_time_steps.size()); - std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr > > items(sz); + std::vector< std::vector< MCAuto > > items(sz); std::size_t szOut(std::numeric_limits::max()); for(std::size_t i=0;i::max()) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes : empty field !"); - std::vector< MEDCouplingAutoRefCountObjectPtr > ret(szOut); + std::vector< MCAuto > ret(szOut); for(std::size_t i=0;i elt(createNew()); + MCAuto elt(createNew()); for(std::size_t j=0;jpushBackTimeStep(items[j][i]); ret[i]=elt; @@ -7874,7 +7874,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::checkThatNbOfCompoOfTSMatchThis() con { std::size_t sz=_infos.size(); int j=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,j++) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,j++) { const MEDFileAnyTypeField1TSWithoutSDA *elt(*it); if(elt) @@ -7894,7 +7894,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldNoProfileSBT(const MEDCoup if(!_time_steps.empty()) checkCoherencyOfTinyInfo(field,arr); MEDFileAnyTypeField1TSWithoutSDA *objC=createNew1TSWithoutSDAEmptyInstance(); - MEDCouplingAutoRefCountObjectPtr obj(objC); + MCAuto obj(objC); objC->setFieldNoProfileSBT(field,arr,glob,*this); copyTinyInfoFrom(field,arr); _time_steps.push_back(obj); @@ -7907,13 +7907,13 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldProfile(const MEDCouplingF if(!_time_steps.empty()) checkCoherencyOfTinyInfo(field,arr); MEDFileField1TSWithoutSDA *objC=new MEDFileField1TSWithoutSDA; - MEDCouplingAutoRefCountObjectPtr obj(objC); + MCAuto obj(objC); objC->setFieldProfile(field,arr,mesh,meshDimRelToMax,profile,glob,*this); copyTinyInfoFrom(field,arr); _time_steps.push_back(obj); } -void MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration(int i, MEDCouplingAutoRefCountObjectPtr ts) +void MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration(int i, MCAuto ts) { int sz=(int)_time_steps.size(); if(i<0 || i>=sz) @@ -8009,10 +8009,10 @@ std::vector< std::vector > MEDFileFieldMultiTSWithoutSDA::get MEDFileIntFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::convertToInt() const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileIntFieldMultiTSWithoutSDA); + MCAuto ret(new MEDFileIntFieldMultiTSWithoutSDA); ret->MEDFileAnyTypeFieldMultiTSWithoutSDA::operator =(*this); int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++) { const MEDFileAnyTypeField1TSWithoutSDA *eltToConv(*it); if(eltToConv) @@ -8020,7 +8020,7 @@ MEDFileIntFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::convertToInt() const MEDFileField1TSWithoutSDA *eltToConvC=dynamic_cast(eltToConv); if(!eltToConvC) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::convertToInt : presence of an invalid 1TS type ! Should be of type FLOAT64 !"); - MEDCouplingAutoRefCountObjectPtr elt=eltToConvC->convertToInt(); + MCAuto elt=eltToConvC->convertToInt(); ret->setIteration(i,elt); } } @@ -8053,7 +8053,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFr std::string dtunit; int i=-1; MEDFileAnyTypeField1TS::LocateField(fid,fileName,fieldName,i,typcha,infos,dtunit); - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; switch(typcha) { case MED_FLOAT64: @@ -8083,7 +8083,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFr std::vector infos; std::string dtunit,fieldName; MEDFileAnyTypeField1TS::LocateField2(fid,fileName,0,true,fieldName,typcha,infos,dtunit); - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; switch(typcha) { case MED_FLOAT64: @@ -8112,14 +8112,14 @@ MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromCont throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent : empty content in input : unable to build a new instance !"); if(dynamic_cast(c)) { - MEDCouplingAutoRefCountObjectPtr ret=MEDFileFieldMultiTS::New(); + MCAuto ret=MEDFileFieldMultiTS::New(); ret->setFileName(fileName); ret->_content=c; c->incrRef(); return ret.retn(); } if(dynamic_cast(c)) { - MEDCouplingAutoRefCountObjectPtr ret=MEDFileIntFieldMultiTS::New(); + MCAuto ret=MEDFileIntFieldMultiTS::New(); ret->setFileName(fileName); ret->_content=c; c->incrRef(); return ret.retn(); @@ -8203,10 +8203,10 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::createNe MEDFileFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::convertToDouble() const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileFieldMultiTSWithoutSDA); + MCAuto ret(new MEDFileFieldMultiTSWithoutSDA); ret->MEDFileAnyTypeFieldMultiTSWithoutSDA::operator =(*this); int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++) { const MEDFileAnyTypeField1TSWithoutSDA *eltToConv(*it); if(eltToConv) @@ -8214,7 +8214,7 @@ MEDFileFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::convertToDouble const MEDFileIntField1TSWithoutSDA *eltToConvC=dynamic_cast(eltToConv); if(!eltToConvC) throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTSWithoutSDA::convertToInt : presence of an invalid 1TS type ! Should be of type INT32 !"); - MEDCouplingAutoRefCountObjectPtr elt=eltToConvC->convertToDouble(); + MCAuto elt=eltToConvC->convertToDouble(); ret->setIteration(i,elt); } } @@ -8235,8 +8235,8 @@ MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const std::string& f { MEDFileUtilities::CheckFileForRead(fileName); MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); - MEDCouplingAutoRefCountObjectPtr c=BuildContentFrom(fid,fileName,loadAll,0); - MEDCouplingAutoRefCountObjectPtr ret=BuildNewInstanceFromContent(c,fileName); + MCAuto c=BuildContentFrom(fid,fileName,loadAll,0); + MCAuto ret=BuildNewInstanceFromContent(c,fileName); ret->loadGlobals(fid); return ret.retn(); } @@ -8255,8 +8255,8 @@ MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const std::string& f { MEDFileUtilities::CheckFileForRead(fileName); MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); - MEDCouplingAutoRefCountObjectPtr c(BuildContentFrom(fid,fileName,fieldName,loadAll,0,0)); - MEDCouplingAutoRefCountObjectPtr ret=BuildNewInstanceFromContent(c,fileName); + MCAuto c(BuildContentFrom(fid,fileName,fieldName,loadAll,0,0)); + MCAuto ret=BuildNewInstanceFromContent(c,fileName); ret->loadGlobals(fid); return ret.retn(); } @@ -8349,16 +8349,16 @@ void MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds2(int bg, int end, int step) MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::buildSubPart(const int *startIds, const int *endIds) const { - MEDCouplingAutoRefCountObjectPtr c=contentNotNullBase()->buildFromTimeStepIds(startIds,endIds); - MEDCouplingAutoRefCountObjectPtr ret=shallowCpy(); + MCAuto c=contentNotNullBase()->buildFromTimeStepIds(startIds,endIds); + MCAuto ret=shallowCpy(); ret->_content=c; return ret.retn(); } MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::buildSubPartSlice(int bg, int end, int step) const { - MEDCouplingAutoRefCountObjectPtr c=contentNotNullBase()->buildFromTimeStepIds2(bg,end,step); - MEDCouplingAutoRefCountObjectPtr ret=shallowCpy(); + MCAuto c=contentNotNullBase()->buildFromTimeStepIds2(bg,end,step); + MCAuto ret=shallowCpy(); ret->_content=c; return ret.retn(); } @@ -8381,7 +8381,7 @@ void MEDFileAnyTypeFieldMultiTS::pushBackTimeSteps(MEDFileAnyTypeFieldMultiTS *f int nbOfTS(fmts->getNumberOfTS()); for(int i=0;i elt(fmts->getTimeStepAtPos(i)); + MCAuto elt(fmts->getTimeStepAtPos(i)); pushBackTimeStep(elt); } } @@ -8392,10 +8392,10 @@ void MEDFileAnyTypeFieldMultiTS::pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep : input pointer is NULL !"); checkCoherencyOfType(f1ts); f1ts->incrRef(); - MEDCouplingAutoRefCountObjectPtr f1tsSafe(f1ts); + MCAuto f1tsSafe(f1ts); MEDFileAnyTypeField1TSWithoutSDA *c=f1ts->contentNotNullBase(); c->incrRef(); - MEDCouplingAutoRefCountObjectPtr cSafe(c); + MCAuto cSafe(c); if(!((MEDFileAnyTypeFieldMultiTSWithoutSDA *)_content)) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep : no content in this !"); _content->pushBackTimeStep(cSafe); @@ -8603,14 +8603,14 @@ std::vector MEDFileAnyTypeFieldMultiTS::getDirectChildr * The returned instances are deep copy of \a this except that for globals that are share with those contained in \a this. * ** WARNING ** do no forget to rename the ouput instances to avoid to write n-times in the same MED file field ! */ -std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > MEDFileAnyTypeFieldMultiTS::splitComponents() const +std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > MEDFileAnyTypeFieldMultiTS::splitComponents() const { const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content); if(!content) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::splitComponents : no content in this ! Unable to split components !"); - std::vector< MEDCouplingAutoRefCountObjectPtr > contentsSplit=content->splitComponents(); + std::vector< MCAuto > contentsSplit=content->splitComponents(); std::size_t sz(contentsSplit.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret(sz); + std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret(sz); for(std::size_t i=0;i > ME * This method returns as MEDFileAnyTypeFieldMultiTS new instances as number of discretizations over time steps in \a this. * The returned instances are shallow copied of \a this included globals that are share with those contained in \a this. */ -std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > MEDFileAnyTypeFieldMultiTS::splitDiscretizations() const +std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > MEDFileAnyTypeFieldMultiTS::splitDiscretizations() const { const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content); if(!content) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::splitDiscretizations : no content in this ! Unable to split discretizations !"); - std::vector< MEDCouplingAutoRefCountObjectPtr > contentsSplit(content->splitDiscretizations()); + std::vector< MCAuto > contentsSplit(content->splitDiscretizations()); std::size_t sz(contentsSplit.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret(sz); + std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret(sz); for(std::size_t i=0;i > ME * This method returns as MEDFileAnyTypeFieldMultiTS new instances as number of sub-discretizations over time steps in \a this. * The returned instances are shallow copied of \a this included globals that are share with those contained in \a this. */ -std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > MEDFileAnyTypeFieldMultiTS::splitMultiDiscrPerGeoTypes() const +std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > MEDFileAnyTypeFieldMultiTS::splitMultiDiscrPerGeoTypes() const { const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content); if(!content) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::splitMultiDiscrPerGeoTypes : no content in this ! Unable to split discretizations !"); - std::vector< MEDCouplingAutoRefCountObjectPtr > contentsSplit(content->splitMultiDiscrPerGeoTypes()); + std::vector< MCAuto > contentsSplit(content->splitMultiDiscrPerGeoTypes()); std::size_t sz(contentsSplit.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret(sz); + std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret(sz); for(std::size_t i=0;i > ME return ret; } -MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::deepCpy() const +MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::deepCopy() const { - MEDCouplingAutoRefCountObjectPtr ret=shallowCpy(); + MCAuto ret=shallowCpy(); if((const MEDFileAnyTypeFieldMultiTSWithoutSDA *)_content) - ret->_content=_content->deepCpy(); + ret->_content=_content->deepCopy(); ret->deepCpyGlobs(*this); return ret.retn(); } -MEDCouplingAutoRefCountObjectPtr MEDFileAnyTypeFieldMultiTS::getContent() +MCAuto MEDFileAnyTypeFieldMultiTS::getContent() { return _content; } @@ -8761,7 +8761,7 @@ std::vector< std::vector > MEDFileAnyTypeFieldMult * \throw If an element in \a vectFMTS is null. * \sa MEDFileAnyTypeFieldMultiTS::AreOnSameSupportAcrossTime */ -std::vector< std::vector > MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(const std::vector& vectFMTS, const MEDFileMesh *mesh, std::vector< MEDCouplingAutoRefCountObjectPtr >& fsc) +std::vector< std::vector > MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(const std::vector& vectFMTS, const MEDFileMesh *mesh, std::vector< MCAuto >& fsc) { static const char msg[]="MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport : presence of a null instance in the input vector !"; if(!mesh) @@ -8791,7 +8791,7 @@ std::vector< std::vector > MEDFileAnyTypeFieldMult else vectFMTSNotNodes.push_back(*it); } - std::vector< MEDCouplingAutoRefCountObjectPtr > cmps; + std::vector< MCAuto > cmps; std::vector< std::vector > retCell=SplitPerCommonSupportNotNodesAlg(vectFMTSNotNodes,mesh,cmps); ret=retCell; for(std::vector::const_iterator it2=vectFMTSNodes.begin();it2!=vectFMTSNodes.end();it2++) @@ -8808,7 +8808,7 @@ std::vector< std::vector > MEDFileAnyTypeFieldMult if(!isFetched) { std::vector tmp(1,*it2); - MEDCouplingAutoRefCountObjectPtr tmp2(MEDFileMeshStruct::New(mesh)); + MCAuto tmp2(MEDFileMeshStruct::New(mesh)); ret.push_back(tmp); retCell.push_back(tmp); cmps.push_back(MEDFileFastCellSupportComparator::New(tmp2,*it2)); } } @@ -8820,7 +8820,7 @@ std::vector< std::vector > MEDFileAnyTypeFieldMult * WARNING no check here. The caller must be sure that all items in vectFMTS are coherent each other in time steps, only one same spatial discretization and not ON_NODES. * \param [out] cmps - same size than the returned vector. */ -std::vector< std::vector > MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupportNotNodesAlg(const std::vector& vectFMTS, const MEDFileMesh *mesh, std::vector< MEDCouplingAutoRefCountObjectPtr >& cmps) +std::vector< std::vector > MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupportNotNodesAlg(const std::vector& vectFMTS, const MEDFileMesh *mesh, std::vector< MCAuto >& cmps) { std::vector< std::vector > ret; std::list lstFMTS(vectFMTS.begin(),vectFMTS.end()); @@ -8830,8 +8830,8 @@ std::vector< std::vector > MEDFileAnyTypeFieldMult MEDFileAnyTypeFieldMultiTS *ref(*it); std::vector elt; elt.push_back(ref); it=lstFMTS.erase(it); - MEDCouplingAutoRefCountObjectPtr mst(MEDFileMeshStruct::New(mesh)); - MEDCouplingAutoRefCountObjectPtr cmp(MEDFileFastCellSupportComparator::New(mst,ref)); + MCAuto mst(MEDFileMeshStruct::New(mesh)); + MCAuto cmp(MEDFileFastCellSupportComparator::New(mst,ref)); while(it!=lstFMTS.end()) { MEDFileAnyTypeFieldMultiTS *curIt(*it); @@ -8880,8 +8880,8 @@ int MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime(MEDFileAnyTypeFieldMultiT return nts; for(int i=0;i f0cur=f0->getTimeStepAtPos(i); - MEDCouplingAutoRefCountObjectPtr f1cur=f1->getTimeStepAtPos(i); + MCAuto f0cur=f0->getTimeStepAtPos(i); + MCAuto f1cur=f1->getTimeStepAtPos(i); std::vector tofs0(f0cur->getTypesOfFieldAvailable()),tofs1(f1cur->getTypesOfFieldAvailable()); if(tofs0.size()!=1 || tofs1.size()!=1) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : All time steps must be defined on only one spatial discretization !"); @@ -8938,7 +8938,7 @@ MEDFileFieldMultiTS *MEDFileFieldMultiTS::New() */ MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const std::string& fileName, bool loadAll) { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileFieldMultiTS(fileName,loadAll,0); + MCAuto ret=new MEDFileFieldMultiTS(fileName,loadAll,0); ret->contentNotNull();//to check that content type matches with \a this type. return ret.retn(); } @@ -8955,7 +8955,7 @@ MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const std::string& fileName, bool */ MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const std::string& fileName, const std::string& fieldName, bool loadAll) { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileFieldMultiTS(fileName,fieldName,loadAll,0); + MCAuto ret=new MEDFileFieldMultiTS(fileName,fieldName,loadAll,0); ret->contentNotNull();//to check that content type matches with \a this type. return ret.retn(); } @@ -8979,7 +8979,7 @@ MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const MEDFileFieldMultiTSWithoutSD MEDFileFieldMultiTS *MEDFileFieldMultiTS::LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, const std::vector< std::pair >& entities, bool loadAll) { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileFieldMultiTS(fileName,fieldName,loadAll,0,&entities)); + MCAuto ret(new MEDFileFieldMultiTS(fileName,fieldName,loadAll,0,&entities)); ret->contentNotNull();//to check that content type matches with \a this type. return ret.retn(); } @@ -9008,14 +9008,14 @@ void MEDFileFieldMultiTS::checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1t */ MEDFileIntFieldMultiTS *MEDFileFieldMultiTS::convertToInt(bool isDeepCpyGlobs) const { - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content); if(content) { const MEDFileFieldMultiTSWithoutSDA *contc=dynamic_cast(content); if(!contc) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::convertToInt : the content inside this is not FLOAT64 ! This is incoherent !"); - MEDCouplingAutoRefCountObjectPtr newc(contc->convertToInt()); + MCAuto newc(contc->convertToInt()); ret=static_cast(MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent((MEDFileIntFieldMultiTSWithoutSDA *)newc,getFileName())); } else @@ -9045,7 +9045,7 @@ MEDFileAnyTypeField1TS *MEDFileFieldMultiTS::getTimeStepAtPos(int pos) const const MEDFileField1TSWithoutSDA *itemC=dynamic_cast(item); if(itemC) { - MEDCouplingAutoRefCountObjectPtr ret=MEDFileField1TS::New(*itemC,false); + MCAuto ret=MEDFileField1TS::New(*itemC,false); ret->shallowCpyGlobs(*this); return ret.retn(); } @@ -9081,8 +9081,8 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtLevel(TypeOfField type, i const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldAtLevel : mismatch of type of field expecting FLOAT64 !"); - MEDCouplingAutoRefCountObjectPtr arrOut; - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut,*contentNotNullBase()); + MCAuto arrOut; + MCAuto ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut,*contentNotNullBase()); MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut); return ret.retn(); } @@ -9113,8 +9113,8 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtTopLevel(TypeOfField type const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldAtTopLevel : mismatch of type of field !"); - MEDCouplingAutoRefCountObjectPtr arrOut; - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldAtTopLevel(type,std::string(),renumPol,this,arrOut,*contentNotNullBase()); + MCAuto arrOut; + MCAuto ret=myF1TSC->getFieldAtTopLevel(type,std::string(),renumPol,this,arrOut,*contentNotNullBase()); MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut); return ret.retn(); } @@ -9147,8 +9147,8 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldOnMeshAtLevel(TypeOfField t const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldOnMeshAtLevel : mismatch of type of field !"); - MEDCouplingAutoRefCountObjectPtr arrOut; - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arrOut,*contentNotNullBase()); + MCAuto arrOut; + MCAuto ret=myF1TSC->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arrOut,*contentNotNullBase()); MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut); return ret.retn(); } @@ -9179,8 +9179,8 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldOnMeshAtLevel(TypeOfField t const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldOnMeshAtLevel : mismatch of type of field !"); - MEDCouplingAutoRefCountObjectPtr arrOut; - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arrOut,*contentNotNullBase()); + MCAuto arrOut; + MCAuto ret=myF1TSC->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arrOut,*contentNotNullBase()); MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut); return ret.retn(); } @@ -9196,8 +9196,8 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtLevelOld(TypeOfField type const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldAtLevelOld : mismatch of type of field !"); - MEDCouplingAutoRefCountObjectPtr arrOut; - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arrOut,*contentNotNullBase()); + MCAuto arrOut; + MCAuto ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arrOut,*contentNotNullBase()); MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut); return ret.retn(); } @@ -9228,7 +9228,7 @@ DataArrayDouble *MEDFileFieldMultiTS::getFieldWithProfile(TypeOfField type, int const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldWithProfile : mismatch of type of field !"); - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNullBase()); + MCAuto ret=myF1TSC->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNullBase()); return MEDFileField1TS::ReturnSafelyDataArrayDouble(ret); } @@ -9392,7 +9392,7 @@ MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New() */ MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const std::string& fileName, bool loadAll) { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileIntFieldMultiTS(fileName,loadAll,0); + MCAuto ret=new MEDFileIntFieldMultiTS(fileName,loadAll,0); ret->contentNotNull();//to check that content type matches with \a this type. return ret.retn(); } @@ -9409,7 +9409,7 @@ MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const std::string& fileName, */ MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const std::string& fileName, const std::string& fieldName, bool loadAll) { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileIntFieldMultiTS(fileName,fieldName,loadAll,0); + MCAuto ret=new MEDFileIntFieldMultiTS(fileName,fieldName,loadAll,0); ret->contentNotNull();//to check that content type matches with \a this type. return ret.retn(); } @@ -9433,7 +9433,7 @@ MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const MEDFileIntFieldMultiTS MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, const std::vector< std::pair >& entities, bool loadAll) { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileIntFieldMultiTS(fileName,fieldName,loadAll,0,&entities); + MCAuto ret=new MEDFileIntFieldMultiTS(fileName,fieldName,loadAll,0,&entities); ret->contentNotNull();//to check that content type matches with \a this type. return ret.retn(); } @@ -9448,14 +9448,14 @@ MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::LoadSpecificEntities(const std:: */ MEDFileFieldMultiTS *MEDFileIntFieldMultiTS::convertToDouble(bool isDeepCpyGlobs) const { - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content); if(content) { const MEDFileIntFieldMultiTSWithoutSDA *contc=dynamic_cast(content); if(!contc) throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::convertToInt : the content inside this is not INT32 ! This is incoherent !"); - MEDCouplingAutoRefCountObjectPtr newc(contc->convertToDouble()); + MCAuto newc(contc->convertToDouble()); ret=static_cast(MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent((MEDFileFieldMultiTSWithoutSDA *)newc,getFileName())); } else @@ -9510,8 +9510,8 @@ MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldAtLevel(TypeOfField type const MEDFileIntField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::getFieldAtLevel : mismatch of type of field expecting INT32 !"); - MEDCouplingAutoRefCountObjectPtr arr; - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arr,*contentNotNullBase()); + MCAuto arr; + MCAuto ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arr,*contentNotNullBase()); arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); return ret.retn(); } @@ -9543,8 +9543,8 @@ MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldAtTopLevel(TypeOfField t const MEDFileIntField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::getFieldAtTopLevel : mismatch of type of field ! INT32 expected !"); - MEDCouplingAutoRefCountObjectPtr arr; - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldAtTopLevel(type,std::string(),renumPol,this,arr,*contentNotNullBase()); + MCAuto arr; + MCAuto ret=myF1TSC->getFieldAtTopLevel(type,std::string(),renumPol,this,arr,*contentNotNullBase()); arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); return ret.retn(); } @@ -9578,8 +9578,8 @@ MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldOnMeshAtLevel(TypeOfFiel const MEDFileIntField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldOnMeshAtLevel : mismatch of type of field ! INT32 expected !"); - MEDCouplingAutoRefCountObjectPtr arr; - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arr,*contentNotNullBase()); + MCAuto arr; + MCAuto ret=myF1TSC->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arr,*contentNotNullBase()); arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); return ret.retn(); } @@ -9611,8 +9611,8 @@ MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldOnMeshAtLevel(TypeOfFiel const MEDFileIntField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileFieldIntMultiTS::getFieldOnMeshAtLevel : mismatch of type of field ! INT32 expected !"); - MEDCouplingAutoRefCountObjectPtr arr; - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arr,*contentNotNullBase()); + MCAuto arr; + MCAuto ret=myF1TSC->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arr,*contentNotNullBase()); arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); return ret.retn(); } @@ -9628,8 +9628,8 @@ MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldAtLevelOld(TypeOfField t const MEDFileIntField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldOnMeshAtLevel : mismatch of type of field ! INT32 expected !"); - MEDCouplingAutoRefCountObjectPtr arr; - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arr,*contentNotNullBase()); + MCAuto arr; + MCAuto ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arr,*contentNotNullBase()); arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); return ret.retn(); } @@ -9660,7 +9660,7 @@ DataArrayInt *MEDFileIntFieldMultiTS::getFieldWithProfile(TypeOfField type, int const MEDFileIntField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::getFieldWithProfile : mismatch of type of field ! INT32 expected !"); - MEDCouplingAutoRefCountObjectPtr ret=myF1TSC->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNullBase()); + MCAuto ret=myF1TSC->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNullBase()); return MEDFileIntField1TS::ReturnSafelyDataArrayInt(ret); } @@ -9682,7 +9682,7 @@ MEDFileAnyTypeField1TS *MEDFileIntFieldMultiTS::getTimeStepAtPos(int pos) const const MEDFileIntField1TSWithoutSDA *itemC=dynamic_cast(item); if(itemC) { - MEDCouplingAutoRefCountObjectPtr ret=MEDFileIntField1TS::New(*itemC,false); + MCAuto ret=MEDFileIntField1TS::New(*itemC,false); ret->shallowCpyGlobs(*this); return ret.retn(); } @@ -9809,26 +9809,26 @@ MEDFileFields *MEDFileFields::LoadSpecificEntities(const std::string& fileName, std::size_t MEDFileFields::getHeapMemorySizeWithoutChildren() const { std::size_t ret(MEDFileFieldGlobsReal::getHeapMemorySizeWithoutChildren()); - ret+=_fields.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr); + ret+=_fields.capacity()*sizeof(MCAuto); return ret; } std::vector MEDFileFields::getDirectChildrenWithNull() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++) ret.push_back((const MEDFileAnyTypeFieldMultiTSWithoutSDA *)*it); return ret; } -MEDFileFields *MEDFileFields::deepCpy() const +MEDFileFields *MEDFileFields::deepCopy() const { - MEDCouplingAutoRefCountObjectPtr ret=shallowCpy(); + MCAuto ret=shallowCpy(); std::size_t i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++) { if((const MEDFileAnyTypeFieldMultiTSWithoutSDA*)*it) - ret->_fields[i]=(*it)->deepCpy(); + ret->_fields[i]=(*it)->deepCopy(); } ret->deepCpyGlobs(*this); return ret.retn(); @@ -9854,7 +9854,7 @@ std::vector< std::pair > MEDFileFields::getCommonIterations(bool& areTh std::set< std::pair > s; bool firstShot=true; areThereSomeForgottenTS=false; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++) { if(!(const MEDFileAnyTypeFieldMultiTSWithoutSDA*)*it) continue; @@ -9884,7 +9884,7 @@ std::vector MEDFileFields::getFieldsNames() const { std::vector ret(_fields.size()); int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++) { const MEDFileAnyTypeFieldMultiTSWithoutSDA *f=(*it); if(f) @@ -9903,7 +9903,7 @@ std::vector MEDFileFields::getFieldsNames() const std::vector MEDFileFields::getMeshesNames() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++) { const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(*it); if(cur) @@ -9926,7 +9926,7 @@ void MEDFileFields::simpleRepr(int bkOffset, std::ostream& oss) const std::string startLine(bkOffset,' '); oss << startLine << "There are " << nbOfFields << " fields in this :" << std::endl; int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++) { const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur=(*it); if(cur) @@ -9939,7 +9939,7 @@ void MEDFileFields::simpleRepr(int bkOffset, std::ostream& oss) const } } i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++) { const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur=(*it); std::string chapter(17,'0'+i); @@ -10004,7 +10004,7 @@ void MEDFileFields::writeLL(med_idt fid) const { int i=0; writeGlobals(fid,*this); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++) { const MEDFileAnyTypeFieldMultiTSWithoutSDA *elt=*it; if(!elt) @@ -10035,7 +10035,7 @@ void MEDFileFields::loadArrays() if(getFileName().empty()) throw INTERP_KERNEL::Exception("MEDFileFields::loadArrays : the structure does not come from a file !"); MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName().c_str(),MED_ACC_RDONLY); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto >::iterator it=_fields.begin();it!=_fields.end();it++) { MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it); if(elt) @@ -10055,7 +10055,7 @@ void MEDFileFields::loadArraysIfNecessary() if(!getFileName().empty()) { MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName().c_str(),MED_ACC_RDONLY); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto >::iterator it=_fields.begin();it!=_fields.end();it++) { MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it); if(elt) @@ -10073,7 +10073,7 @@ void MEDFileFields::loadArraysIfNecessary() */ void MEDFileFields::unloadArrays() { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto >::iterator it=_fields.begin();it!=_fields.end();it++) { MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it); if(elt) @@ -10098,7 +10098,7 @@ std::vector MEDFileFields::getPflsReallyUsed() const { std::vector ret; std::set ret2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++) { std::vector tmp=(*it)->getPflsReallyUsed2(); for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) @@ -10115,7 +10115,7 @@ std::vector MEDFileFields::getLocsReallyUsed() const { std::vector ret; std::set ret2; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++) { std::vector tmp=(*it)->getLocsReallyUsed2(); for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) @@ -10131,7 +10131,7 @@ std::vector MEDFileFields::getLocsReallyUsed() const std::vector MEDFileFields::getPflsReallyUsedMulti() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++) { std::vector tmp=(*it)->getPflsReallyUsedMulti2(); ret.insert(ret.end(),tmp.begin(),tmp.end()); @@ -10142,7 +10142,7 @@ std::vector MEDFileFields::getPflsReallyUsedMulti() const std::vector MEDFileFields::getLocsReallyUsedMulti() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++) { std::vector tmp=(*it)->getLocsReallyUsed2(); ret.insert(ret.end(),tmp.begin(),tmp.end()); @@ -10152,13 +10152,13 @@ std::vector MEDFileFields::getLocsReallyUsedMulti() const void MEDFileFields::changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::iterator it=_fields.begin();it!=_fields.end();it++) (*it)->changePflsRefsNamesGen2(mapOfModif); } void MEDFileFields::changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::iterator it=_fields.begin();it!=_fields.end();it++) (*it)->changeLocsRefsNamesGen2(mapOfModif); } @@ -10208,7 +10208,7 @@ void MEDFileFields::destroyFieldsAtPos(const int *startIds, const int *endIds) } b[*i]=false; } - std::vector< MEDCouplingAutoRefCountObjectPtr > fields(std::count(b.begin(),b.end(),true)); + std::vector< MCAuto > fields(std::count(b.begin(),b.end(),true)); std::size_t j=0; for(std::size_t i=0;i<_fields.size();i++) if(b[i]) @@ -10231,7 +10231,7 @@ void MEDFileFields::destroyFieldsAtPos2(int bg, int end, int step) } b[k]=false; } - std::vector< MEDCouplingAutoRefCountObjectPtr > fields(std::count(b.begin(),b.end(),true)); + std::vector< MCAuto > fields(std::count(b.begin(),b.end(),true)); std::size_t j=0; for(std::size_t i=0;i<_fields.size();i++) if(b[i]) @@ -10242,7 +10242,7 @@ void MEDFileFields::destroyFieldsAtPos2(int bg, int end, int step) bool MEDFileFields::changeMeshNames(const std::vector< std::pair >& modifTab) { bool ret=false; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto >::iterator it=_fields.begin();it!=_fields.end();it++) { MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(*it); if(cur) @@ -10263,7 +10263,7 @@ bool MEDFileFields::changeMeshNames(const std::vector< std::pair& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N) { bool ret=false; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_fields.begin();it!=_fields.end();it++) + for(std::vector< MCAuto >::iterator it=_fields.begin();it!=_fields.end();it++) { MEDFileAnyTypeFieldMultiTSWithoutSDA *fmts(*it); if(fmts) @@ -10284,7 +10284,7 @@ MEDFileAnyTypeFieldMultiTS *MEDFileFields::getFieldAtPos(int i) const const MEDFileAnyTypeFieldMultiTSWithoutSDA *fmts=_fields[i]; if(!fmts) return 0; - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; const MEDFileFieldMultiTSWithoutSDA *fmtsC=dynamic_cast(fmts); const MEDFileIntFieldMultiTSWithoutSDA *fmtsC2=dynamic_cast(fmts); if(fmtsC) @@ -10307,9 +10307,9 @@ MEDFileAnyTypeFieldMultiTS *MEDFileFields::getFieldAtPos(int i) const */ MEDFileFields *MEDFileFields::buildSubPart(const int *startIds, const int *endIds) const { - MEDCouplingAutoRefCountObjectPtr ret=shallowCpy(); + MCAuto ret=shallowCpy(); std::size_t sz=std::distance(startIds,endIds); - std::vector< MEDCouplingAutoRefCountObjectPtr > fields(sz); + std::vector< MCAuto > fields(sz); int j=0; for(const int *i=startIds;i!=endIds;i++,j++) { @@ -10337,8 +10337,8 @@ MEDFileAnyTypeFieldMultiTS *MEDFileFields::getFieldWithName(const std::string& f */ bool MEDFileFields::removeFieldsWithoutAnyTimeStep() { - std::vector > newFields; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fields.begin();it!=_fields.end();it++) + std::vector > newFields; + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++) { const MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it); if(elt) @@ -10364,8 +10364,8 @@ bool MEDFileFields::removeFieldsWithoutAnyTimeStep() */ MEDFileFields *MEDFileFields::partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const { - MEDCouplingAutoRefCountObjectPtr ret=MEDFileFields::New(); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fields.begin();it!=_fields.end();it++) + MCAuto ret=MEDFileFields::New(); + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++) { const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur=(*it); if(!cur) @@ -10373,7 +10373,7 @@ MEDFileFields *MEDFileFields::partOfThisLyingOnSpecifiedMeshName(const std::stri if(cur->getMeshName()==meshName) { cur->incrRef(); - MEDCouplingAutoRefCountObjectPtr cur2(const_cast(cur)); + MCAuto cur2(const_cast(cur)); ret->_fields.push_back(cur2); } } @@ -10396,13 +10396,13 @@ MEDFileFields *MEDFileFields::partOfThisLyingOnSpecifiedMeshName(const std::stri */ MEDFileFields *MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair >& timeSteps) const { - MEDCouplingAutoRefCountObjectPtr ret=MEDFileFields::New(); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fields.begin();it!=_fields.end();it++) + MCAuto ret=MEDFileFields::New(); + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++) { const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur=(*it); if(!cur) continue; - MEDCouplingAutoRefCountObjectPtr elt=cur->partOfThisLyingOnSpecifiedTimeSteps(timeSteps); + MCAuto elt=cur->partOfThisLyingOnSpecifiedTimeSteps(timeSteps); ret->_fields.push_back(elt); } ret->shallowCpyOnlyUsedGlobs(*this); @@ -10414,13 +10414,13 @@ MEDFileFields *MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps(const std::vec */ MEDFileFields *MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair >& timeSteps) const { - MEDCouplingAutoRefCountObjectPtr ret=MEDFileFields::New(); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_fields.begin();it!=_fields.end();it++) + MCAuto ret=MEDFileFields::New(); + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++) { const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur=(*it); if(!cur) continue; - MEDCouplingAutoRefCountObjectPtr elt=cur->partOfThisNotLyingOnSpecifiedTimeSteps(timeSteps); + MCAuto elt=cur->partOfThisNotLyingOnSpecifiedTimeSteps(timeSteps); if(elt->getNumberOfTS()!=0) ret->_fields.push_back(elt); } diff --git a/src/MEDLoader/MEDFileField.hxx b/src/MEDLoader/MEDFileField.hxx index 87c045650..47c9ebbcd 100644 --- a/src/MEDLoader/MEDFileField.hxx +++ b/src/MEDLoader/MEDFileField.hxx @@ -26,7 +26,7 @@ #include "MEDFileFieldOverView.hxx" #include "MEDFileUtilities.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "MEDCouplingRefCountObject.hxx" #include "MEDCouplingMemArray.hxx" @@ -58,7 +58,7 @@ namespace MEDCoupling static MEDFileFieldLoc *New(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w); std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; - MEDFileFieldLoc *deepCpy() const; + MEDFileFieldLoc *deepCopy() const; MEDLOADER_EXPORT int getNbOfGaussPtPerCell() const { return _nb_gauss_pt; } MEDLOADER_EXPORT void writeLL(med_idt fid) const; MEDLOADER_EXPORT std::string repr() const; @@ -103,7 +103,7 @@ namespace MEDCoupling static MEDFileFieldPerMeshPerTypePerDisc *New(const MEDFileFieldPerMeshPerTypePerDisc& other); std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; - MEDFileFieldPerMeshPerTypePerDisc *deepCpy(MEDFileFieldPerMeshPerType *father) const; + MEDFileFieldPerMeshPerTypePerDisc *deepCopy(MEDFileFieldPerMeshPerType *father) const; void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldDouble *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); void assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldDouble *field, const DataArray *arrr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob); @@ -147,7 +147,7 @@ namespace MEDCoupling static std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > SplitPerDiscretization(const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entries); static bool RenumberChunks(int offset, const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc, const DataArrayInt *explicitIdsInMesh, const std::vector& newCode, - MEDFileFieldGlobsReal& glob, DataArrayDouble *arr, std::vector< MEDCouplingAutoRefCountObjectPtr >& result); + MEDFileFieldGlobsReal& glob, DataArrayDouble *arr, std::vector< MCAuto >& result); static MEDFileFieldPerMeshPerTypePerDisc *NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayInt *idsOfMeshElt, bool isPfl, int nbi, int offset, std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc, MEDFileFieldGlobsReal& glob, bool ¬InExisting); @@ -170,7 +170,7 @@ namespace MEDCoupling //! only on assignement -3 : ON_NODES, -2 : ON_CELLS, -1 : ON_GAUSS_NE, 0..* : ON_GAUSS_PT mutable int _loc_id; mutable int _profile_it; - MEDCouplingAutoRefCountObjectPtr _pd; + MCAuto _pd; public: mutable int _tmp_work1; }; @@ -182,7 +182,7 @@ namespace MEDCoupling static MEDFileFieldPerMeshPerType *NewOnRead(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc, const PartDefinition *pd); std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; - MEDFileFieldPerMeshPerType *deepCpy(MEDFileFieldPerMesh *father) const; + MEDFileFieldPerMeshPerType *deepCopy(MEDFileFieldPerMesh *father) const; void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); void assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob); @@ -216,7 +216,7 @@ namespace MEDCoupling const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(int locId) const; void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const; void fillValues(int& startEntryId, std::vector< std::pair,std::pair > >& entries) const; - void setLeaves(const std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerTypePerDisc > >& leaves); + void setLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves); bool keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair >& its); bool keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair >& its); static med_entity_type ConvertIntoMEDFileType(TypeOfField ikType, INTERP_KERNEL::NormalizedCellType ikGeoType, med_geometry_type& medfGeoType); @@ -229,7 +229,7 @@ namespace MEDCoupling MEDFileFieldPerMeshPerType(MEDFileFieldPerMesh *fath, INTERP_KERNEL::NormalizedCellType geoType); private: MEDFileFieldPerMesh *_father; - std::vector< MEDCouplingAutoRefCountObjectPtr > _field_pm_pt_pd; + std::vector< MCAuto > _field_pm_pt_pd; INTERP_KERNEL::NormalizedCellType _geo_type; }; @@ -242,7 +242,7 @@ namespace MEDCoupling static MEDFileFieldPerMesh *NewOnRead(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc, const MEDFileMesh *mm, const std::vector< std::pair > *entities); std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; - MEDFileFieldPerMesh *deepCpy(MEDFileAnyTypeField1TSWithoutSDA *father) const; + MEDFileFieldPerMesh *deepCopy(MEDFileAnyTypeField1TSWithoutSDA *father) const; void simpleRepr(int bkOffset,std::ostream& oss, int id) const; void copyTinyInfoFrom(const MEDCouplingMesh *mesh); void assignFieldProfile(int& start, const DataArrayInt *multiTypePfl, const std::vector& code, const std::vector& code2, const std::vector& idsInPflPerType, const std::vector& idsPerType, const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); @@ -276,7 +276,7 @@ namespace MEDCoupling void keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair >& its); void changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); void changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); - MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl, MEDCouplingAutoRefCountObjectPtr &arrOut, const MEDFileFieldNameScope& nasc) const; + MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; DataArray *getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const; void getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId); @@ -284,16 +284,16 @@ namespace MEDCoupling private: int addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type); MEDCouplingFieldDouble *finishField(TypeOfField type, const MEDFileFieldGlobsReal *glob, - const std::vector< std::pair >& dads, const std::vector& locs, const MEDCouplingMesh *mesh, bool& isPfl, MEDCouplingAutoRefCountObjectPtr &arrOut, const MEDFileFieldNameScope& nasc) const; + const std::vector< std::pair >& dads, const std::vector& locs, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; MEDCouplingFieldDouble *finishField2(TypeOfField type, const MEDFileFieldGlobsReal *glob, const std::vector< std::pair >& dads, const std::vector& locs, const std::vector& geoTypes, - const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MEDCouplingAutoRefCountObjectPtr &arrOut, const MEDFileFieldNameScope& nasc) const; + const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; MEDCouplingFieldDouble *finishFieldNode2(const MEDFileFieldGlobsReal *glob, const std::vector< std::pair >& dads, const std::vector& locs, - const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MEDCouplingAutoRefCountObjectPtr &arrOut, const MEDFileFieldNameScope& nasc) const; + const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; DataArray *finishField4(const std::vector< std::pair >& dads, const DataArrayInt *pflIn, int nbOfElems, DataArrayInt *&pflOut) const; - void assignNewLeaves(const std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerTypePerDisc > >& leaves); + void assignNewLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves); static void SortArraysPerType(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector& geoTypes, const std::vector< std::pair >& dads, const std::vector& pfls, const std::vector& locs, std::vector& code, std::vector& notNullPfls); @@ -305,7 +305,7 @@ namespace MEDCoupling int _mesh_iteration; int _mesh_order; MEDFileAnyTypeField1TSWithoutSDA *_father; - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > > _field_pm_pt; + std::vector< MCAuto< MEDFileFieldPerMeshPerType > > _field_pm_pt; }; class MEDFileFieldGlobsReal; @@ -317,7 +317,7 @@ namespace MEDCoupling static MEDFileFieldGlobs *New(); std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; - MEDFileFieldGlobs *deepCpy() const; + MEDFileFieldGlobs *deepCopy() const; MEDFileFieldGlobs *shallowCpyPart(const std::vector& pfls, const std::vector& locs) const; MEDFileFieldGlobs *deepCpyPart(const std::vector& pfls, const std::vector& locs) const; void simpleRepr(std::ostream& oss) const; @@ -363,8 +363,8 @@ namespace MEDCoupling MEDFileFieldGlobs(); ~MEDFileFieldGlobs(); protected: - std::vector< MEDCouplingAutoRefCountObjectPtr > _pfls; - std::vector< MEDCouplingAutoRefCountObjectPtr > _locs; + std::vector< MCAuto > _pfls; + std::vector< MCAuto > _locs; std::string _file_name; }; @@ -437,7 +437,7 @@ namespace MEDCoupling MEDFileFieldGlobs *contentNotNull(); const MEDFileFieldGlobs *contentNotNull() const; protected: - MEDCouplingAutoRefCountObjectPtr< MEDFileFieldGlobs > _globals; + MCAuto< MEDFileFieldGlobs > _globals; }; class MEDFileFieldNameScope @@ -506,9 +506,9 @@ namespace MEDCoupling MEDLOADER_EXPORT void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); MEDLOADER_EXPORT void setFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); MEDLOADER_EXPORT virtual void simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const; - MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TSWithoutSDA *deepCpy() const = 0; + MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TSWithoutSDA *deepCopy() const = 0; MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TSWithoutSDA *shallowCpy() const = 0; - MEDLOADER_EXPORT virtual std::vector< MEDCouplingAutoRefCountObjectPtr > splitComponents() const; + MEDLOADER_EXPORT virtual std::vector< MCAuto > splitComponents() const; MEDLOADER_EXPORT virtual const char *getTypeStr() const = 0; MEDLOADER_EXPORT virtual DataArray *getUndergroundDataArray() const = 0; MEDLOADER_EXPORT virtual DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const = 0; @@ -517,15 +517,15 @@ namespace MEDCoupling MEDLOADER_EXPORT virtual DataArray *getOrCreateAndGetArray() = 0; MEDLOADER_EXPORT virtual const DataArray *getOrCreateAndGetArray() const = 0; public: - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr &arrOut, const MEDFileFieldNameScope& nasc) const; - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MEDCouplingAutoRefCountObjectPtr &arrOut, const MEDFileFieldNameScope& nasc) const; - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr &arrOut, const MEDFileFieldNameScope& nasc) const; - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum, MEDCouplingAutoRefCountObjectPtr &arrOut, const MEDFileFieldNameScope& nasc) const; + MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; + MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; + MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; + MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; DataArray *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const; public: MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob); - MEDLOADER_EXPORT std::vector< MEDCouplingAutoRefCountObjectPtr > splitDiscretizations() const; - MEDLOADER_EXPORT std::vector< MEDCouplingAutoRefCountObjectPtr > splitMultiDiscrPerGeoTypes() const; + MEDLOADER_EXPORT std::vector< MCAuto > splitDiscretizations() const; + MEDLOADER_EXPORT std::vector< MCAuto > splitMultiDiscrPerGeoTypes() const; MEDLOADER_EXPORT int keepOnlySpatialDiscretization(TypeOfField tof, std::vector< std::pair >& its); MEDLOADER_EXPORT int keepOnlyGaussDiscretization(std::size_t idOfDisc, std::vector< std::pair >& its); public: @@ -542,7 +542,7 @@ namespace MEDCoupling int addNewEntryIfNecessary(const MEDCouplingMesh *mesh); void updateData(int newLgth, const std::vector< std::pair >& oldStartStops); protected: - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > > _field_per_mesh; + std::vector< MCAuto< MEDFileFieldPerMesh > > _field_per_mesh; int _iteration; int _order; double _dt; @@ -577,7 +577,7 @@ namespace MEDCoupling MEDLOADER_EXPORT MEDFileField1TSWithoutSDA(); MEDLOADER_EXPORT MEDFileField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order, const std::vector& infos); MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *shallowCpy() const; - MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *deepCpy() const; + MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *deepCopy() const; MEDLOADER_EXPORT void setArray(DataArray *arr); MEDLOADER_EXPORT DataArray *createNewEmptyDataArrayInstance() const; MEDLOADER_EXPORT DataArray *getOrCreateAndGetArray(); @@ -586,7 +586,7 @@ namespace MEDCoupling MEDLOADER_EXPORT const DataArrayDouble *getOrCreateAndGetArrayDouble() const; MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA *convertToInt() const; protected: - MEDCouplingAutoRefCountObjectPtr< DataArrayDouble > _arr; + MCAuto< DataArrayDouble > _arr; public: static const char TYPE_STR[]; }; @@ -599,7 +599,7 @@ namespace MEDCoupling public: MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA(); MEDLOADER_EXPORT static MEDFileIntField1TSWithoutSDA *New(const std::string& fieldName, int csit, int iteration, int order, const std::vector& infos); - MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *deepCpy() const; + MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *deepCopy() const; MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *shallowCpy() const; MEDLOADER_EXPORT const char *getTypeStr() const; MEDLOADER_EXPORT DataArray *getUndergroundDataArray() const; @@ -616,7 +616,7 @@ namespace MEDCoupling protected: MEDFileIntField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order, const std::vector& infos); protected: - MEDCouplingAutoRefCountObjectPtr< DataArrayInt > _arr; + MCAuto< DataArrayInt > _arr; public: MEDLOADER_EXPORT static const char TYPE_STR[]; }; @@ -679,10 +679,10 @@ namespace MEDCoupling MEDLOADER_EXPORT void loadArraysIfNecessary(); MEDLOADER_EXPORT void unloadArrays(); MEDLOADER_EXPORT void unloadArraysWithoutDataLoss(); - MEDLOADER_EXPORT std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > splitComponents() const; - MEDLOADER_EXPORT std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > splitDiscretizations() const; - MEDLOADER_EXPORT std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > splitMultiDiscrPerGeoTypes() const; - MEDLOADER_EXPORT MEDFileAnyTypeField1TS *deepCpy() const; + MEDLOADER_EXPORT std::vector< MCAuto< MEDFileAnyTypeField1TS > > splitComponents() const; + MEDLOADER_EXPORT std::vector< MCAuto< MEDFileAnyTypeField1TS > > splitDiscretizations() const; + MEDLOADER_EXPORT std::vector< MCAuto< MEDFileAnyTypeField1TS > > splitMultiDiscrPerGeoTypes() const; + MEDLOADER_EXPORT MEDFileAnyTypeField1TS *deepCopy() const; MEDLOADER_EXPORT int copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr); MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TS *shallowCpy() const = 0; public: @@ -706,7 +706,7 @@ namespace MEDCoupling MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *contentNotNullBase(); MEDLOADER_EXPORT const MEDFileAnyTypeField1TSWithoutSDA *contentNotNullBase() const; protected: - MEDCouplingAutoRefCountObjectPtr _content; + MCAuto _content; }; class MEDFileIntField1TS; @@ -742,8 +742,8 @@ namespace MEDCoupling MEDLOADER_EXPORT std::vector< std::vector > getFieldSplitedByType2(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; public: - MEDLOADER_EXPORT static void SetDataArrayDoubleInField(MEDCouplingFieldDouble *f, MEDCouplingAutoRefCountObjectPtr& arr); - MEDLOADER_EXPORT static DataArrayDouble *ReturnSafelyDataArrayDouble(MEDCouplingAutoRefCountObjectPtr& arr); + MEDLOADER_EXPORT static void SetDataArrayDoubleInField(MEDCouplingFieldDouble *f, MCAuto& arr); + MEDLOADER_EXPORT static DataArrayDouble *ReturnSafelyDataArrayDouble(MCAuto& arr); private: med_field_type getMEDFileFieldType() const { return MED_FLOAT64; } const MEDFileField1TSWithoutSDA *contentNotNull() const; @@ -779,7 +779,7 @@ namespace MEDCoupling MEDLOADER_EXPORT void setFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArray() const; public: - MEDLOADER_EXPORT static DataArrayInt *ReturnSafelyDataArrayInt(MEDCouplingAutoRefCountObjectPtr& arr); + MEDLOADER_EXPORT static DataArrayInt *ReturnSafelyDataArrayInt(MCAuto& arr); private: med_field_type getMEDFileFieldType() const { return MED_INT32; } const MEDFileIntField1TSWithoutSDA *contentNotNull() const; @@ -803,10 +803,10 @@ namespace MEDCoupling public: MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; - MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTSWithoutSDA *deepCpy() const; - MEDLOADER_EXPORT virtual std::vector< MEDCouplingAutoRefCountObjectPtr > splitComponents() const; - MEDLOADER_EXPORT virtual std::vector< MEDCouplingAutoRefCountObjectPtr > splitDiscretizations() const; - MEDLOADER_EXPORT virtual std::vector< MEDCouplingAutoRefCountObjectPtr > splitMultiDiscrPerGeoTypes() const; + MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTSWithoutSDA *deepCopy() const; + MEDLOADER_EXPORT virtual std::vector< MCAuto > splitComponents() const; + MEDLOADER_EXPORT virtual std::vector< MCAuto > splitDiscretizations() const; + MEDLOADER_EXPORT virtual std::vector< MCAuto > splitMultiDiscrPerGeoTypes() const; MEDLOADER_EXPORT virtual const char *getTypeStr() const = 0; MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const = 0; MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTSWithoutSDA *createNew() const = 0; @@ -833,7 +833,7 @@ namespace MEDCoupling MEDLOADER_EXPORT int getPosGivenTime(double time, double eps=1e-8) const; MEDLOADER_EXPORT std::vector< std::pair > getIterations() const; MEDLOADER_EXPORT std::vector< std::pair > getTimeSteps(std::vector& ret1) const; - MEDLOADER_EXPORT void pushBackTimeStep(MEDCouplingAutoRefCountObjectPtr& tse); + MEDLOADER_EXPORT void pushBackTimeStep(MCAuto& tse); MEDLOADER_EXPORT void synchronizeNameScope(); MEDLOADER_EXPORT void simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const; MEDLOADER_EXPORT int getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector& levs) const; @@ -858,7 +858,7 @@ namespace MEDCoupling MEDLOADER_EXPORT std::vector getLocsReallyUsedMulti2() const; MEDLOADER_EXPORT void changePflsRefsNamesGen2(const std::vector< std::pair, std::string > >& mapOfModif); MEDLOADER_EXPORT void changeLocsRefsNamesGen2(const std::vector< std::pair, std::string > >& mapOfModif); - MEDLOADER_EXPORT void setIteration(int i, MEDCouplingAutoRefCountObjectPtr ts); + MEDLOADER_EXPORT void setIteration(int i, MCAuto ts); protected: virtual med_field_type getMEDFileFieldType() const = 0; void copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr); @@ -867,7 +867,7 @@ namespace MEDCoupling void checkThatNbOfCompoOfTSMatchThis() const; protected: std::vector _infos; - std::vector< MEDCouplingAutoRefCountObjectPtr > _time_steps; + std::vector< MCAuto > _time_steps; }; class MEDFileIntFieldMultiTSWithoutSDA; @@ -937,10 +937,10 @@ namespace MEDCoupling MEDLOADER_EXPORT void writeLL(med_idt fid) const; MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; - MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTS *deepCpy() const; - MEDLOADER_EXPORT std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > splitComponents() const; - MEDLOADER_EXPORT std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > splitDiscretizations() const; - MEDLOADER_EXPORT std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > splitMultiDiscrPerGeoTypes() const; + MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTS *deepCopy() const; + MEDLOADER_EXPORT std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > splitComponents() const; + MEDLOADER_EXPORT std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > splitDiscretizations() const; + MEDLOADER_EXPORT std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > splitMultiDiscrPerGeoTypes() const; MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const = 0; MEDLOADER_EXPORT virtual void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const = 0; // @@ -948,7 +948,7 @@ namespace MEDCoupling MEDLOADER_EXPORT MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const; MEDLOADER_EXPORT MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const; MEDLOADER_EXPORT static std::vector< std::vector > SplitIntoCommonTimeSeries(const std::vector& vectFMTS); - MEDLOADER_EXPORT static std::vector< std::vector > SplitPerCommonSupport(const std::vector& vectFMTS, const MEDFileMesh *mesh, std::vector< MEDCouplingAutoRefCountObjectPtr >& fsc); + MEDLOADER_EXPORT static std::vector< std::vector > SplitPerCommonSupport(const std::vector& vectFMTS, const MEDFileMesh *mesh, std::vector< MCAuto >& fsc); MEDLOADER_EXPORT static int CheckSupportAcrossTime(MEDFileAnyTypeFieldMultiTS *f0, MEDFileAnyTypeFieldMultiTS *f1, const MEDFileMesh *mesh, TypeOfField& tof0, TypeOfField& tof1); public:// direct forwarding to MEDFileField1TSWithoutSDA instance _content MEDLOADER_EXPORT std::string getName() const; @@ -982,7 +982,7 @@ namespace MEDCoupling MEDLOADER_EXPORT int getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector& levs) const; MEDLOADER_EXPORT std::vector< std::vector > getTypesOfFieldAvailable() const; MEDLOADER_EXPORT std::vector< std::vector< std::pair > > getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; - MEDLOADER_EXPORT MEDCouplingAutoRefCountObjectPtr getContent(); + MEDLOADER_EXPORT MCAuto getContent(); public: MEDLOADER_EXPORT std::vector getPflsReallyUsed() const; MEDLOADER_EXPORT std::vector getLocsReallyUsed() const; @@ -994,9 +994,9 @@ namespace MEDCoupling MEDFileAnyTypeFieldMultiTSWithoutSDA *contentNotNullBase(); const MEDFileAnyTypeFieldMultiTSWithoutSDA *contentNotNullBase() const; private: - static std::vector< std::vector > SplitPerCommonSupportNotNodesAlg(const std::vector& vectFMTS, const MEDFileMesh *mesh, std::vector< MEDCouplingAutoRefCountObjectPtr >& cmps); + static std::vector< std::vector > SplitPerCommonSupportNotNodesAlg(const std::vector& vectFMTS, const MEDFileMesh *mesh, std::vector< MCAuto >& cmps); protected: - MEDCouplingAutoRefCountObjectPtr _content; + MCAuto _content; }; class MEDFileIntFieldMultiTS; @@ -1088,7 +1088,7 @@ namespace MEDCoupling MEDLOADER_EXPORT ~MEDFileAnyTypeFieldMultiTSIterator(); MEDLOADER_EXPORT MEDFileAnyTypeField1TS *nextt(); private: - MEDCouplingAutoRefCountObjectPtr _fmts; + MCAuto _fmts; int _iter_id; int _nb_iter; }; @@ -1107,7 +1107,7 @@ namespace MEDCoupling MEDLOADER_EXPORT static MEDFileFields *LoadSpecificEntities(const std::string& fileName, const std::vector< std::pair >& entities, bool loadAll=true); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; - MEDLOADER_EXPORT MEDFileFields *deepCpy() const; + MEDLOADER_EXPORT MEDFileFields *deepCopy() const; MEDLOADER_EXPORT MEDFileFields *shallowCpy() const; MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const; MEDLOADER_EXPORT void writeLL(med_idt fid) const; @@ -1152,7 +1152,7 @@ namespace MEDCoupling MEDFileFields(); MEDFileFields(const std::string& fileName, bool loadAll, const MEDFileMeshes *ms, const std::vector< std::pair > *entities); private: - std::vector< MEDCouplingAutoRefCountObjectPtr > _fields; + std::vector< MCAuto > _fields; }; class MEDFileFieldsIterator @@ -1162,7 +1162,7 @@ namespace MEDCoupling MEDLOADER_EXPORT ~MEDFileFieldsIterator(); MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *nextt(); private: - MEDCouplingAutoRefCountObjectPtr _fs; + MCAuto _fs; int _iter_id; int _nb_iter; }; diff --git a/src/MEDLoader/MEDFileFieldOverView.cxx b/src/MEDLoader/MEDFileFieldOverView.cxx index 392eab45a..8a52bf254 100644 --- a/src/MEDLoader/MEDFileFieldOverView.cxx +++ b/src/MEDLoader/MEDFileFieldOverView.cxx @@ -198,7 +198,7 @@ MEDMeshMultiLev *MEDMeshMultiLev::New(const MEDFileMesh *m, const std::vector ret(MEDMeshMultiLev::New(m,m->getNonEmptyLevels())); + MCAuto ret(MEDMeshMultiLev::New(m,m->getNonEmptyLevels())); ret->selectPartOfNodes(pflOnNode); return ret.retn(); } @@ -254,7 +254,7 @@ bool MEDMeshMultiLev::isFastlyTheSameStruct(const MEDFileField1TSStructItem& fst DataArray *MEDMeshMultiLev::buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const { - MEDCouplingAutoRefCountObjectPtr ret(const_cast(vals)); ret->incrRef(); + MCAuto ret(const_cast(vals)); ret->incrRef(); if(isFastlyTheSameStruct(fst,globs)) return ret.retn(); else @@ -282,7 +282,7 @@ void MEDMeshMultiLev::retrieveFamilyIdsOnCells(DataArrayInt *& famIds, bool& isW { famIds=const_cast(fids); famIds->incrRef(); isWithoutCopy=_mesh->isObjectInTheProgeny(famIds); return ; } //bad luck the slowest part isWithoutCopy=false; - std::vector< MEDCouplingAutoRefCountObjectPtr > retSafe(sz); + std::vector< MCAuto > retSafe(sz); std::vector< const DataArrayInt *> ret(sz); int start(0); for(std::size_t i=0;i tmp(fids->selectByTupleId2(start,start+lgth,1)); + MCAuto tmp(fids->selectByTupleIdSafeSlice(start,start+lgth,1)); retSafe[i]=tmp->selectByTupleIdSafe(pfl->begin(),pfl->end()); } else { - retSafe[i]=fids->selectByTupleId2(start,start+lgth,1); + retSafe[i]=fids->selectByTupleIdSafeSlice(start,start+lgth,1); } ret[i]=retSafe[i]; start+=lgth; @@ -325,7 +325,7 @@ void MEDMeshMultiLev::retrieveNumberIdsOnCells(DataArrayInt *& numIds, bool& isW { numIds=const_cast(nids); numIds->incrRef(); isWithoutCopy=_mesh->isObjectInTheProgeny(numIds); return ; } //bad luck the slowest part isWithoutCopy=false; - std::vector< MEDCouplingAutoRefCountObjectPtr > retSafe(sz); + std::vector< MCAuto > retSafe(sz); std::vector< const DataArrayInt *> ret(sz); int start(0); for(std::size_t i=0;i tmp(nids->selectByTupleId2(start,start+lgth,1)); + MCAuto tmp(nids->selectByTupleIdSafeSlice(start,start+lgth,1)); retSafe[i]=tmp->selectByTupleIdSafe(pfl->begin(),pfl->end()); } else { - retSafe[i]=nids->selectByTupleId2(start,start+lgth,1); + retSafe[i]=nids->selectByTupleIdSafeSlice(start,start+lgth,1); } ret[i]=retSafe[i]; start+=lgth; @@ -463,28 +463,28 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem& std::string pflName(p.getPflName()); const DataArrayInt *nr(_node_reduction); if(pflName.empty() && !nr) - return vals->deepCpy(); + return vals->deepCopy(); if(pflName.empty() && nr) throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for nodes 2 !"); if(!pflName.empty() && nr) { - MEDCouplingAutoRefCountObjectPtr p1(globs->getProfile(pflName.c_str())->deepCpy()); - MEDCouplingAutoRefCountObjectPtr p2(nr->deepCpy()); + MCAuto p1(globs->getProfile(pflName.c_str())->deepCopy()); + MCAuto p2(nr->deepCopy()); p1->sort(true); p2->sort(true); if(!p1->isEqualWithoutConsideringStr(*p2)) throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : it appears that a profile on nodes does not cover the cells correctly !"); p1=DataArrayInt::FindPermutationFromFirstToSecond(globs->getProfile(pflName.c_str()),nr); - MEDCouplingAutoRefCountObjectPtr ret(vals->deepCpy()); + MCAuto ret(vals->deepCopy()); ret->renumberInPlace(p1->begin()); return ret.retn(); } if(!pflName.empty() && !nr) { - MEDCouplingAutoRefCountObjectPtr p1(globs->getProfile(pflName.c_str())->deepCpy()); + MCAuto p1(globs->getProfile(pflName.c_str())->deepCopy()); p1->sort(true); - if(!p1->isIdentity2(getNumberOfNodes())) + if(!p1->isIota(getNumberOfNodes())) throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for nodes 4 !"); - MEDCouplingAutoRefCountObjectPtr ret(vals->deepCpy()); + MCAuto ret(vals->deepCopy()); ret->renumberInPlace(globs->getProfile(pflName.c_str())->begin()); return ret.retn(); } @@ -497,7 +497,7 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem& if(s.size()!=_geo_types.size()) throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for cells 2 !"); std::vector< const DataArray *> arr(s.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr > arrSafe(s.size()); + std::vector< MCAuto > arrSafe(s.size()); int iii(0); int nc(vals->getNumberOfComponents()); std::vector compInfo(vals->getInfoOnComponents()); @@ -518,7 +518,7 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem& int nbi(ps[0]->getNbOfIntegrationPts(globs)); const DataArrayInt *otherP(ps[0]->getPfl(globs)); const std::pair& strtStop(ps[0]->getStartStop()); - MEDCouplingAutoRefCountObjectPtr ret(vals->selectByTupleId2(strtStop.first,strtStop.second,1)); + MCAuto ret(vals->selectByTupleIdSafeSlice(strtStop.first,strtStop.second,1)); if(!thisP && !otherP) { arrSafe[iii]=ret; arr[iii]=ret; @@ -526,10 +526,10 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem& } if(thisP && otherP) { - MEDCouplingAutoRefCountObjectPtr p1(otherP->invertArrayN2O2O2N(getNumberOfCells(ps[0]->getGeo()))); - MEDCouplingAutoRefCountObjectPtr p2(thisP->deepCpy()); + MCAuto p1(otherP->invertArrayN2O2O2N(getNumberOfCells(ps[0]->getGeo()))); + MCAuto p2(thisP->deepCopy()); p2->transformWithIndArr(p1->begin(),p1->end()); - //p1=p2->getIdsNotEqual(-1); + //p1=p2->findIdsNotEqual(-1); //p1=p2->selectByTupleIdSafe(p1->begin(),p1->end()); ret->rearrange(nbi*nc); ret=ret->selectByTupleIdSafe(p2->begin(),p2->end()); ret->rearrange(nc); ret->setInfoOnComponents(compInfo); arrSafe[iii]=ret; arr[iii]=ret; @@ -537,7 +537,7 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem& } if(!thisP && otherP) { - MEDCouplingAutoRefCountObjectPtr p1(otherP->deepCpy()); + MCAuto p1(otherP->deepCopy()); p1->sort(true); p1->checkAllIdsInRange(0,getNumberOfCells(ps[0]->getGeo())); p1=DataArrayInt::FindPermutationFromFirstToSecond(otherP,p1); @@ -551,45 +551,45 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem& { std::vector< const DataArrayInt * >otherPS(ps.size()); std::vector< const DataArray * > arr2(ps.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr > arr2Safe(ps.size()); + std::vector< MCAuto > arr2Safe(ps.size()); std::vector< const DataArrayInt * > nbis(ps.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr > nbisSafe(ps.size()); + std::vector< MCAuto > nbisSafe(ps.size()); int jj(0); for(std::vector::const_iterator it2=ps.begin();it2!=ps.end();it2++,jj++) { int nbi((*it2)->getNbOfIntegrationPts(globs)); const DataArrayInt *otherPfl((*it2)->getPfl(globs)); const std::pair& strtStop((*it2)->getStartStop()); - MEDCouplingAutoRefCountObjectPtr ret2(vals->selectByTupleId2(strtStop.first,strtStop.second,1)); + MCAuto ret2(vals->selectByTupleIdSafeSlice(strtStop.first,strtStop.second,1)); if(!otherPfl) throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for cells 4 !"); arr2[jj]=ret2; arr2Safe[jj]=ret2; otherPS[jj]=otherPfl; nbisSafe[jj]=DataArrayInt::New(); nbisSafe[jj]->alloc(otherPfl->getNumberOfTuples(),1); nbisSafe[jj]->fillWithValue(nbi); nbis[jj]=nbisSafe[jj]; } - MEDCouplingAutoRefCountObjectPtr arr3(DataArray::Aggregate(arr2)); - MEDCouplingAutoRefCountObjectPtr otherP(DataArrayInt::Aggregate(otherPS)); - MEDCouplingAutoRefCountObjectPtr zenbis(DataArrayInt::Aggregate(nbis)); - MEDCouplingAutoRefCountObjectPtr otherPN(otherP->invertArrayN2O2O2N(getNumberOfCells(*it))); - MEDCouplingAutoRefCountObjectPtr p1; + MCAuto arr3(DataArray::Aggregate(arr2)); + MCAuto otherP(DataArrayInt::Aggregate(otherPS)); + MCAuto zenbis(DataArrayInt::Aggregate(nbis)); + MCAuto otherPN(otherP->invertArrayN2O2O2N(getNumberOfCells(*it))); + MCAuto p1; if(thisP) p1=DataArrayInt::FindPermutationFromFirstToSecond(otherP,thisP); else - p1=otherP->deepCpy(); - MEDCouplingAutoRefCountObjectPtr zenbisN(zenbis->renumber(p1->begin())); - zenbisN->computeOffsets2(); + p1=otherP->deepCopy(); + MCAuto zenbisN(zenbis->renumber(p1->begin())); + zenbisN->computeOffsetsFull(); jj=0; for(std::vector::const_iterator it2=ps.begin();it2!=ps.end();it2++,jj++) { //int nbi((*it2)->getNbOfIntegrationPts(globs)); const DataArrayInt *otherPfl((*it2)->getPfl(globs)); const std::pair& strtStop((*it2)->getStartStop()); - MEDCouplingAutoRefCountObjectPtr ret2(vals->selectByTupleId2(strtStop.first,strtStop.second,1)); + MCAuto ret2(vals->selectByTupleIdSafeSlice(strtStop.first,strtStop.second,1)); // - MEDCouplingAutoRefCountObjectPtr p2(otherPfl->deepCpy()); + MCAuto p2(otherPfl->deepCopy()); p2->transformWithIndArr(otherPN->begin(),otherPN->end()); p2->transformWithIndArr(p1->begin(),p1->end()); - MEDCouplingAutoRefCountObjectPtr idsN(p2->buildExplicitArrByRanges(zenbisN)); + MCAuto idsN(p2->buildExplicitArrByRanges(zenbisN)); arr3->setPartOfValuesBase3(ret2,idsN->begin(),idsN->end(),0,nc,1); } arrSafe[iii]=arr3; arr[iii]=arr3; @@ -615,7 +615,7 @@ void MEDMeshMultiLev::appendVertices(const DataArrayInt *verticesToAdd, DataArra const DataArrayInt *cf(_cell_fam_ids),*cn(_cell_num_ids),*nf(_node_fam_ids),*nn(_node_num_ids); if(cf) { - MEDCouplingAutoRefCountObjectPtr tmp; + MCAuto tmp; std::vector a(2); a[0]=cf; if(nf) @@ -629,7 +629,7 @@ void MEDMeshMultiLev::appendVertices(const DataArrayInt *verticesToAdd, DataArra } if(cn) { - MEDCouplingAutoRefCountObjectPtr tmp; + MCAuto tmp; std::vector a(2); a[0]=cn; if(nn) @@ -811,7 +811,7 @@ MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector > famIdsSafe(sz); + std::vector< MCAuto > famIdsSafe(sz); std::vector famIds(sz); bool f(true); for(std::size_t i=0;i > numIdsSafe(sz); + std::vector< MCAuto > numIdsSafe(sz); std::vector numIds(sz); bool n(true); for(std::size_t i=0;iisAllocated()) return ; std::size_t sz(_parts.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr > a(sz); + std::vector< MCAuto > a(sz); std::vector< const DataArrayInt *> aa(sz); for(std::size_t i=0;i m(_parts[i]); + MCAuto m(_parts[i]); if(pfl) m=dynamic_cast(_parts[i]->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end())); DataArrayInt *cellIds=0; m->fillCellIdsToKeepFromNodeIds(pflNodes->begin(),pflNodes->end(),true,cellIds); - MEDCouplingAutoRefCountObjectPtr cellIdsSafe(cellIds); - MEDCouplingAutoRefCountObjectPtr m2(m->buildPartOfMySelfKeepCoords(cellIds->begin(),cellIds->end())); + MCAuto cellIdsSafe(cellIds); + MCAuto m2(m->buildPartOfMySelfKeepCoords(cellIds->begin(),cellIds->end())); int tmp=-1; - MEDCouplingAutoRefCountObjectPtr o2n(m2->getNodeIdsInUse(tmp)); + MCAuto o2n(m2->getNodeIdsInUse(tmp)); a[i]=o2n->invertArrayO2N2N2O(tmp); aa[i]=a[i]; if(pfl) _pfls[i]=pfl->selectByTupleIdSafe(cellIds->begin(),cellIds->end()); @@ -872,7 +872,7 @@ void MEDUMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes) if(!aa.empty()) _node_reduction=DataArrayInt::Aggregate(aa);//general case else - _node_reduction=pflNodes->deepCpy();//case where no cells in read mesh. + _node_reduction=pflNodes->deepCopy();//case where no cells in read mesh. _node_reduction->sort(true); _node_reduction=_node_reduction->buildUnique(); if(_node_reduction->getNumberOfTuples()==pflNodes->getNumberOfTuples()) @@ -880,9 +880,9 @@ void MEDUMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes) if(_node_reduction->getNumberOfTuples()>pflNodes->getNumberOfTuples()) throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::selectPartOfNodes : internal error in MEDCoupling during cell select from a list of nodes !"); // Here the cells available in _parts is not enough to cover all the nodes in pflNodes. So adding vertices cells in _parts... - MEDCouplingAutoRefCountObjectPtr pflNodes2(pflNodes->deepCpy()); + MCAuto pflNodes2(pflNodes->deepCopy()); pflNodes2->sort(true); - MEDCouplingAutoRefCountObjectPtr diff(pflNodes2->buildSubstractionOptimized(_node_reduction)); + MCAuto diff(pflNodes2->buildSubstractionOptimized(_node_reduction)); appendVertices(diff,pflNodes2); } @@ -895,7 +895,7 @@ MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDUMeshMultiLev& other):MEDMeshMultiLe { } -MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const MEDCouplingAutoRefCountObjectPtr& part):MEDMeshMultiLev(other) +MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const MCAuto& part):MEDMeshMultiLev(other) { _parts.resize(1); _parts[0]=part; @@ -918,18 +918,18 @@ bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * tmp=_parts[0]->getCoords(); if(!tmp) throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : the coordinates are null !"); - MEDCouplingAutoRefCountObjectPtr a(const_cast(tmp)); tmp->incrRef(); + MCAuto a(const_cast(tmp)); tmp->incrRef(); int szBCE(0),szD(0),szF(0); bool isPolyh(false); int iii(0); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_parts.begin();it!=_parts.end();it++,iii++) + for(std::vector< MCAuto >::const_iterator it=_parts.begin();it!=_parts.end();it++,iii++) { const MEDCoupling1GTUMesh *cur(*it); if(!cur) throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : a part is null !"); // const DataArrayInt *pfl(_pfls[iii]); - MEDCouplingAutoRefCountObjectPtr cur2; + MCAuto cur2; if(!pfl) { cur2=const_cast(cur); cur2->incrRef(); } else @@ -942,25 +942,25 @@ bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * else { isPolyh=true; - MEDCouplingAutoRefCountObjectPtr tmp2(cur->computeEffectiveNbOfNodesPerCell()); + MCAuto tmp2(cur->computeEffectiveNbOfNodesPerCell()); szD+=tmp2->accumulate(0)+curNbCells; szF+=2*curNbCells+cur->getNodalConnectivity()->getNumberOfTuples(); } } - MEDCouplingAutoRefCountObjectPtr b(DataArrayByte::New()); b->alloc(szBCE,1); char *bPtr(b->getPointer()); - MEDCouplingAutoRefCountObjectPtr c(DataArrayInt::New()); c->alloc(szBCE,1); int *cPtr(c->getPointer()); - MEDCouplingAutoRefCountObjectPtr d(DataArrayInt::New()); d->alloc(szD,1); int *dPtr(d->getPointer()); - MEDCouplingAutoRefCountObjectPtr e(DataArrayInt::New()),f(DataArrayInt::New()); int *ePtr(0),*fPtr(0); + MCAuto b(DataArrayByte::New()); b->alloc(szBCE,1); char *bPtr(b->getPointer()); + MCAuto c(DataArrayInt::New()); c->alloc(szBCE,1); int *cPtr(c->getPointer()); + MCAuto d(DataArrayInt::New()); d->alloc(szD,1); int *dPtr(d->getPointer()); + MCAuto e(DataArrayInt::New()),f(DataArrayInt::New()); int *ePtr(0),*fPtr(0); if(isPolyh) { e->alloc(szBCE,1); ePtr=e->getPointer(); f->alloc(szF,1); fPtr=f->getPointer(); } int k(0); iii=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_parts.begin();it!=_parts.end();it++,iii++) + for(std::vector< MCAuto >::const_iterator it=_parts.begin();it!=_parts.end();it++,iii++) { const MEDCoupling1GTUMesh *cur(*it); // const DataArrayInt *pfl(_pfls[iii]); - MEDCouplingAutoRefCountObjectPtr cur2; + MCAuto cur2; if(!pfl) { cur2=const_cast(cur); cur2->incrRef(); } else @@ -1066,7 +1066,7 @@ bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * return _mesh->isObjectInTheProgeny(coords); } -void MEDUMeshMultiLev::reorderNodesIfNecessary(MEDCouplingAutoRefCountObjectPtr& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const +void MEDUMeshMultiLev::reorderNodesIfNecessary(MCAuto& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const { const DataArrayInt *nr(_node_reduction); if(!nr) @@ -1113,14 +1113,14 @@ void MEDUMeshMultiLev::reorderNodesIfNecessary(MEDCouplingAutoRefCountObjectPtr< if(szExp!=nr->getNumberOfTuples()) throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::reorderNodesIfNecessary : internal error #3 !"); // Go renumbering ! - MEDCouplingAutoRefCountObjectPtr o2n(DataArrayInt::New()); o2n->alloc(sz,1); + MCAuto o2n(DataArrayInt::New()); o2n->alloc(sz,1); int *o2nPtr(o2n->getPointer()); int newId(0); for(int i=0;ibegin()); - MEDCouplingAutoRefCountObjectPtr n2o(o2n->invertArrayO2N2N2O(nr->getNumberOfTuples())); - MEDCouplingAutoRefCountObjectPtr perm(DataArrayInt::FindPermutationFromFirstToSecond(n2o,nr)); + MCAuto n2o(o2n->invertArrayO2N2N2O(nr->getNumberOfTuples())); + MCAuto perm(DataArrayInt::FindPermutationFromFirstToSecond(n2o,nr)); const int *permPtr(perm->begin()); int *work2(nodalConnVTK->getPointer()),*endW2(nodalConnVTK->getPointer()+nodalConnVTK->getNumberOfTuples()); while(work2!=endW2) @@ -1151,7 +1151,7 @@ void MEDUMeshMultiLev::appendVertices(const DataArrayInt *verticesToAdd, DataArr { int nbOfCells(verticesToAdd->getNumberOfTuples());//it is not a bug cells are NORM_POINT1 MEDMeshMultiLev::appendVertices(verticesToAdd,nr); - MEDCouplingAutoRefCountObjectPtr elt(MEDCoupling1SGTUMesh::New("",INTERP_KERNEL::NORM_POINT1)); + MCAuto elt(MEDCoupling1SGTUMesh::New("",INTERP_KERNEL::NORM_POINT1)); elt->allocateCells(nbOfCells); for(int i=0;isetCoords(_parts[0]->getCoords()); - MEDCouplingAutoRefCountObjectPtr elt2((MEDCoupling1SGTUMesh *)elt); elt2->incrRef(); + MCAuto elt2((MEDCoupling1SGTUMesh *)elt); elt2->incrRef(); _parts.push_back(elt2); } @@ -1248,9 +1248,9 @@ bool MEDStructuredMeshMultiLev::prepareForImplicitUnstructuredMeshCase(MEDMeshMu const DataArrayInt *pfl(0),*nr(_node_reduction); if(!_pfls.empty()) pfl=_pfls[0]; - MEDCouplingAutoRefCountObjectPtr facesIfPresent2(facesIfPresent); facesIfPresent->incrRef(); + MCAuto facesIfPresent2(facesIfPresent); facesIfPresent->incrRef(); moveFaceToCell(); - MEDCouplingAutoRefCountObjectPtr ret2(new MEDUMeshMultiLev(*this,facesIfPresent2)); + MCAuto ret2(new MEDUMeshMultiLev(*this,facesIfPresent2)); if(pfl) ret2->setCellReduction(pfl); if(nr) @@ -1281,8 +1281,8 @@ void MEDStructuredMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes) if(!pflNodes || !pflNodes->isAllocated()) return ; std::vector ngs(getNodeGridStructure()); - MEDCouplingAutoRefCountObjectPtr conn(MEDCouplingStructuredMesh::Build1GTNodalConnectivity(&ngs[0],&ngs[0]+ngs.size())); - MEDCouplingAutoRefCountObjectPtr m(MEDCoupling1SGTUMesh::New("",MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(ngs.size()))); + MCAuto conn(MEDCouplingStructuredMesh::Build1GTNodalConnectivity(&ngs[0],&ngs[0]+ngs.size())); + MCAuto m(MEDCoupling1SGTUMesh::New("",MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(ngs.size()))); m->setNodalConnectivity(conn); const DataArrayInt *pfl(_pfls[0]); if(pfl) @@ -1291,8 +1291,8 @@ void MEDStructuredMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes) } DataArrayInt *cellIds=0; m->fillCellIdsToKeepFromNodeIds(pflNodes->begin(),pflNodes->end(),true,cellIds); - MEDCouplingAutoRefCountObjectPtr cellIdsSafe(cellIds); - MEDCouplingAutoRefCountObjectPtr m2(m->buildPartOfMySelfKeepCoords(cellIds->begin(),cellIds->end())); + MCAuto cellIdsSafe(cellIds); + MCAuto m2(m->buildPartOfMySelfKeepCoords(cellIds->begin(),cellIds->end())); int tmp=-1; _node_reduction=m2->getNodeIdsInUse(tmp); if(pfl) @@ -1374,49 +1374,49 @@ MEDMeshMultiLev *MEDCMeshMultiLev::prepare() const const DataArrayInt *pfl(0),*nr(_node_reduction); if(!_pfls.empty()) pfl=_pfls[0]; - MEDCouplingAutoRefCountObjectPtr nnr; + MCAuto nnr; std::vector cgs,ngs(getNodeGridStructure()); cgs.resize(ngs.size()); std::transform(ngs.begin(),ngs.end(),cgs.begin(),std::bind2nd(std::plus(),-1)); if(pfl) { std::vector< std::pair > cellParts; - MEDCouplingAutoRefCountObjectPtr ret2; + MCAuto ret2; if(MEDCouplingStructuredMesh::IsPartStructured(pfl->begin(),pfl->end(),cgs,cellParts)) { - MEDCouplingAutoRefCountObjectPtr ret(new MEDCMeshMultiLev(*this)); + MCAuto ret(new MEDCMeshMultiLev(*this)); ret->_is_internal=false; if(nr) - { nnr=nr->deepCpy(); nnr->sort(true); ret->setNodeReduction(nnr); } + { nnr=nr->deepCopy(); nnr->sort(true); ret->setNodeReduction(nnr); } ret->_nb_entities[0]=pfl->getNumberOfTuples(); ret->_pfls[0]=0; - std::vector< MEDCouplingAutoRefCountObjectPtr > coords(_coords.size()); + std::vector< MCAuto > coords(_coords.size()); for(std::size_t i=0;i<_coords.size();i++) - coords[i]=_coords[i]->selectByTupleId2(cellParts[i].first,cellParts[i].second+1,1); + coords[i]=_coords[i]->selectByTupleIdSafeSlice(cellParts[i].first,cellParts[i].second+1,1); ret->_coords=coords; ret2=(MEDCMeshMultiLev *)ret; ret2->incrRef(); } else { - MEDCouplingAutoRefCountObjectPtr m(MEDCouplingCMesh::New()); + MCAuto m(MEDCouplingCMesh::New()); for(std::size_t i=0;isetCoordsAt(i,_coords[i]); - MEDCouplingAutoRefCountObjectPtr m2(m->build1SGTUnstructured()); - MEDCouplingAutoRefCountObjectPtr m3=dynamic_cast(m2->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end())); - MEDCouplingAutoRefCountObjectPtr ret(new MEDUMeshMultiLev(*this,m3)); + MCAuto m2(m->build1SGTUnstructured()); + MCAuto m3=dynamic_cast(m2->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end())); + MCAuto ret(new MEDUMeshMultiLev(*this,m3)); if(nr) - { m3->zipCoords(); nnr=nr->deepCpy(); nnr->sort(true); ret->setNodeReduction(nnr); } + { m3->zipCoords(); nnr=nr->deepCopy(); nnr->sort(true); ret->setNodeReduction(nnr); } ret2=(MEDUMeshMultiLev *)ret; ret2->incrRef(); } const DataArrayInt *famIds(_cell_fam_ids),*numIds(_cell_num_ids); if(famIds) { - MEDCouplingAutoRefCountObjectPtr tmp(famIds->selectByTupleIdSafe(pfl->begin(),pfl->end())); + MCAuto tmp(famIds->selectByTupleIdSafe(pfl->begin(),pfl->end())); ret2->setFamilyIdsOnCells(tmp); } if(numIds) { - MEDCouplingAutoRefCountObjectPtr tmp(numIds->selectByTupleIdSafe(pfl->begin(),pfl->end())); + MCAuto tmp(numIds->selectByTupleIdSafe(pfl->begin(),pfl->end())); ret2->setNumberIdsOnCells(tmp); } return ret2.retn(); @@ -1424,9 +1424,9 @@ MEDMeshMultiLev *MEDCMeshMultiLev::prepare() const } else { - MEDCouplingAutoRefCountObjectPtr ret(new MEDCMeshMultiLev(*this)); + MCAuto ret(new MEDCMeshMultiLev(*this)); if(nr) - { nnr=nr->deepCpy(); nnr->sort(true); ret->setNodeReduction(nnr); } + { nnr=nr->deepCopy(); nnr->sort(true); ret->setNodeReduction(nnr); } return ret.retn(); } } @@ -1510,14 +1510,14 @@ MEDMeshMultiLev *MEDCurveLinearMeshMultiLev::prepare() const const DataArrayInt *pfl(0),*nr(_node_reduction); if(!_pfls.empty()) pfl=_pfls[0]; - MEDCouplingAutoRefCountObjectPtr nnr; + MCAuto nnr; std::vector cgs,ngs(getNodeGridStructure()); cgs.resize(ngs.size()); std::transform(ngs.begin(),ngs.end(),cgs.begin(),std::bind2nd(std::plus(),-1)); if(pfl) { std::vector< std::pair > cellParts,nodeParts; - MEDCouplingAutoRefCountObjectPtr ret2; + MCAuto ret2; if(MEDCouplingStructuredMesh::IsPartStructured(pfl->begin(),pfl->end(),cgs,cellParts)) { nodeParts=cellParts; @@ -1527,11 +1527,11 @@ MEDMeshMultiLev *MEDCurveLinearMeshMultiLev::prepare() const nodeParts[i].second++; st[i]=nodeParts[i].second-nodeParts[i].first; } - MEDCouplingAutoRefCountObjectPtr p(MEDCouplingStructuredMesh::BuildExplicitIdsFrom(ngs,nodeParts)); - MEDCouplingAutoRefCountObjectPtr ret(new MEDCurveLinearMeshMultiLev(*this)); + MCAuto p(MEDCouplingStructuredMesh::BuildExplicitIdsFrom(ngs,nodeParts)); + MCAuto ret(new MEDCurveLinearMeshMultiLev(*this)); ret->_is_internal=false; if(nr) - { nnr=nr->deepCpy(); nnr->sort(true); ret->setNodeReduction(nnr); } + { nnr=nr->deepCopy(); nnr->sort(true); ret->setNodeReduction(nnr); } ret->_nb_entities[0]=pfl->getNumberOfTuples(); ret->_pfls[0]=0; ret->_coords=_coords->selectByTupleIdSafe(p->begin(),p->end()); @@ -1540,33 +1540,33 @@ MEDMeshMultiLev *MEDCurveLinearMeshMultiLev::prepare() const } else { - MEDCouplingAutoRefCountObjectPtr m(MEDCouplingCurveLinearMesh::New()); + MCAuto m(MEDCouplingCurveLinearMesh::New()); m->setCoords(_coords); m->setNodeGridStructure(&_structure[0],&_structure[0]+_structure.size()); - MEDCouplingAutoRefCountObjectPtr m2(m->build1SGTUnstructured()); - MEDCouplingAutoRefCountObjectPtr m3=dynamic_cast(m2->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end())); - MEDCouplingAutoRefCountObjectPtr ret(new MEDUMeshMultiLev(*this,m3)); + MCAuto m2(m->build1SGTUnstructured()); + MCAuto m3=dynamic_cast(m2->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end())); + MCAuto ret(new MEDUMeshMultiLev(*this,m3)); if(nr) - { m3->zipCoords(); nnr=nr->deepCpy(); nnr->sort(true); ret->setNodeReduction(nnr); } + { m3->zipCoords(); nnr=nr->deepCopy(); nnr->sort(true); ret->setNodeReduction(nnr); } ret2=(MEDUMeshMultiLev *)ret; ret2->incrRef(); } const DataArrayInt *famIds(_cell_fam_ids),*numIds(_cell_num_ids); if(famIds) { - MEDCouplingAutoRefCountObjectPtr tmp(famIds->selectByTupleIdSafe(pfl->begin(),pfl->end())); + MCAuto tmp(famIds->selectByTupleIdSafe(pfl->begin(),pfl->end())); ret2->setFamilyIdsOnCells(tmp); } if(numIds) { - MEDCouplingAutoRefCountObjectPtr tmp(numIds->selectByTupleIdSafe(pfl->begin(),pfl->end())); + MCAuto tmp(numIds->selectByTupleIdSafe(pfl->begin(),pfl->end())); ret2->setNumberIdsOnCells(tmp); } return ret2.retn(); } else { - MEDCouplingAutoRefCountObjectPtr ret(new MEDCurveLinearMeshMultiLev(*this)); + MCAuto ret(new MEDCurveLinearMeshMultiLev(*this)); if(nr) - { nnr=nr->deepCpy(); nnr->sort(true); ret->setNodeReduction(nnr); } + { nnr=nr->deepCopy(); nnr->sort(true); ret->setNodeReduction(nnr); } return ret.retn(); } } @@ -1741,13 +1741,13 @@ MEDFileField1TSStructItem2 MEDFileField1TSStructItem2::BuildAggregationOf(const throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::BuildAggregationOf : invalid situation ! Several same geo type chunk must all lie on profiles !"); arrs[i]=globs->getProfile(obj->_pfl->getName().c_str()); } - MEDCouplingAutoRefCountObjectPtr arr(DataArrayInt::Aggregate(arrs)); + MCAuto arr(DataArrayInt::Aggregate(arrs)); arr->sort(); int oldNbTuples(arr->getNumberOfTuples()); arr=arr->buildUnique(); if(oldNbTuples!=arr->getNumberOfTuples()) throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::BuildAggregationOf : some entities are present several times !"); - if(arr->isIdentity2(nbEntityRef)) + if(arr->isIota(nbEntityRef)) { std::pair p(0,nbEntityRef); std::string a,b; @@ -1936,9 +1936,9 @@ bool MEDFileField1TSStructItem::isCompatibleWithNodesDiscr(const MEDFileField1TS else { const DataArrayInt *pfl=globs->getProfile(otherNodeIt.getPflName().c_str()); - MEDCouplingAutoRefCountObjectPtr cpyPfl(pfl->deepCpy()); + MCAuto cpyPfl(pfl->deepCopy()); cpyPfl->sort(); - if(cpyPfl->isIdentity2(nbOfNodes)) + if(cpyPfl->isIota(nbOfNodes)) {//on all nodes also ! if(!ret0) return false; @@ -2195,7 +2195,7 @@ MEDMeshMultiLev *MEDFileField1TSStruct::buildFromScratchDataSetSupport(const MED int pos0(-1),pos1(-1); if(presenceOfCellDiscr(pos0)) { - MEDCouplingAutoRefCountObjectPtr ret(_already_checked[pos0].buildFromScratchDataSetSupportOnCells(mst,globs)); + MCAuto ret(_already_checked[pos0].buildFromScratchDataSetSupportOnCells(mst,globs)); if(presenceOfPartialNodeDiscr(pos1)) ret->setNodeReduction(_already_checked[pos1][0].getPfl(globs)); return ret.retn(); @@ -2310,7 +2310,7 @@ MEDFileFastCellSupportComparator::MEDFileFastCellSupportComparator(const MEDFile _f1ts_cmps.resize(nbPts); for(int i=0;i elt=ref->getTimeStepAtPos(i); + MCAuto elt=ref->getTimeStepAtPos(i); try { _f1ts_cmps[i]=MEDFileField1TSStruct::New(elt,_mesh_comp); @@ -2327,7 +2327,7 @@ MEDFileFastCellSupportComparator::MEDFileFastCellSupportComparator(const MEDFile std::size_t MEDFileFastCellSupportComparator::getHeapMemorySizeWithoutChildren() const { - std::size_t ret(_f1ts_cmps.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr)); + std::size_t ret(_f1ts_cmps.capacity()*sizeof(MCAuto)); return ret; } @@ -2337,7 +2337,7 @@ std::vector MEDFileFastCellSupportComparator::getDirect const MEDFileMeshStruct *mst(_mesh_comp); if(mst) ret.push_back(mst); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_f1ts_cmps.begin();it!=_f1ts_cmps.end();it++) + for(std::vector< MCAuto >::const_iterator it=_f1ts_cmps.begin();it!=_f1ts_cmps.end();it++) ret.push_back((const MEDFileField1TSStruct *)*it); return ret; } @@ -2352,7 +2352,7 @@ bool MEDFileFastCellSupportComparator::isEqual(const MEDFileAnyTypeFieldMultiTS } for(int i=0;i elt=other->getTimeStepAtPos(i); + MCAuto elt=other->getTimeStepAtPos(i); if(!_f1ts_cmps[i]->isEqualConsideringThePast(elt,_mesh_comp)) if(!_f1ts_cmps[i]->isSupportSameAs(elt,_mesh_comp)) return false; @@ -2370,7 +2370,7 @@ bool MEDFileFastCellSupportComparator::isCompatibleWithNodesDiscr(const MEDFileA } for(int i=0;i elt=other->getTimeStepAtPos(i); + MCAuto elt=other->getTimeStepAtPos(i); if(!_f1ts_cmps[i]->isCompatibleWithNodesDiscr(elt,_mesh_comp)) return false; } diff --git a/src/MEDLoader/MEDFileFieldOverView.hxx b/src/MEDLoader/MEDFileFieldOverView.hxx index 003a19b0e..02f316c9d 100644 --- a/src/MEDLoader/MEDFileFieldOverView.hxx +++ b/src/MEDLoader/MEDFileFieldOverView.hxx @@ -23,7 +23,7 @@ #include "MEDLoaderDefines.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "MEDCouplingRefCountObject.hxx" #include "MEDCoupling1GTUMesh.hxx" @@ -108,16 +108,16 @@ namespace MEDCoupling MEDMeshMultiLev(const MEDFileMesh *mesh, int nbNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); protected: const MEDFileMesh *_mesh; - std::vector< MEDCouplingAutoRefCountObjectPtr > _pfls; + std::vector< MCAuto > _pfls; std::vector< INTERP_KERNEL::NormalizedCellType > _geo_types; std::vector _nb_entities; - MEDCouplingAutoRefCountObjectPtr _node_reduction; + MCAuto _node_reduction; int _nb_nodes; // - MEDCouplingAutoRefCountObjectPtr _cell_fam_ids; - MEDCouplingAutoRefCountObjectPtr _cell_num_ids; - MEDCouplingAutoRefCountObjectPtr _node_fam_ids; - MEDCouplingAutoRefCountObjectPtr _node_num_ids; + MCAuto _cell_fam_ids; + MCAuto _cell_num_ids; + MCAuto _node_fam_ids; + MCAuto _node_num_ids; public: MEDLOADER_EXPORT static const int PARAMEDMEM_2_VTKTYPE_LGTH=34; MEDLOADER_EXPORT static const unsigned char PARAMEDMEM_2_VTKTYPE[PARAMEDMEM_2_VTKTYPE_LGTH]; @@ -133,20 +133,20 @@ namespace MEDCoupling static MEDUMeshMultiLev *New(const MEDFileUMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); void selectPartOfNodes(const DataArrayInt *pflNodes); MEDMeshMultiLev *prepare() const; - MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const MEDCouplingAutoRefCountObjectPtr& part); + MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const MCAuto& part); MEDLOADER_EXPORT bool buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayInt *&cellLocations, DataArrayInt *& cells, DataArrayInt *&faceLocations, DataArrayInt *&faces) const; protected: void appendVertices(const DataArrayInt *verticesToAdd, DataArrayInt *nr); private: - void reorderNodesIfNecessary(MEDCouplingAutoRefCountObjectPtr& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const; + void reorderNodesIfNecessary(MCAuto& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const; private: MEDUMeshMultiLev(const MEDUMeshMultiLev& other); MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector& levs); MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); private: - std::vector< MEDCouplingAutoRefCountObjectPtr > _parts; + std::vector< MCAuto > _parts; //! this attribute is used only for mesh with no cells but having coordinates. For classical umeshes those pointer is equal to pointer of coordinates of instances in this->_parts. - MEDCouplingAutoRefCountObjectPtr _coords; + MCAuto _coords; }; class MEDStructuredMeshMultiLev : public MEDMeshMultiLev @@ -166,8 +166,8 @@ namespace MEDCoupling void initStdFieldOfIntegers(const MEDFileStructuredMesh *m); protected: bool _is_internal; - MEDCouplingAutoRefCountObjectPtr _face_fam_ids; - MEDCouplingAutoRefCountObjectPtr _face_num_ids; + MCAuto _face_fam_ids; + MCAuto _face_num_ids; }; class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev @@ -183,7 +183,7 @@ namespace MEDCoupling MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector& levs); MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); private: - std::vector< MEDCouplingAutoRefCountObjectPtr > _coords; + std::vector< MCAuto > _coords; }; class MEDCurveLinearMeshMultiLev : public MEDStructuredMeshMultiLev @@ -199,7 +199,7 @@ namespace MEDCoupling MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector& levs); MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); private: - MEDCouplingAutoRefCountObjectPtr _coords; + MCAuto _coords; std::vector _structure; }; @@ -233,7 +233,7 @@ namespace MEDCoupling private: INTERP_KERNEL::NormalizedCellType _geo_type; std::pair _start_end; - MEDCouplingAutoRefCountObjectPtr _pfl; + MCAuto _pfl; std::string _loc; int _nb_of_entity; }; @@ -303,8 +303,8 @@ namespace MEDCoupling private: MEDFileFastCellSupportComparator(const MEDFileMeshStruct *m, const MEDFileAnyTypeFieldMultiTS *ref); private: - MEDCouplingAutoRefCountObjectPtr _mesh_comp; - std::vector< MEDCouplingAutoRefCountObjectPtr > _f1ts_cmps; + MCAuto _mesh_comp; + std::vector< MCAuto > _f1ts_cmps; }; } diff --git a/src/MEDLoader/MEDFileJoint.cxx b/src/MEDLoader/MEDFileJoint.cxx index f14f20134..5763ca2f7 100644 --- a/src/MEDLoader/MEDFileJoint.cxx +++ b/src/MEDLoader/MEDFileJoint.cxx @@ -34,7 +34,7 @@ using namespace MEDCoupling; std::size_t MEDFileJointCorrespondence::getHeapMemorySizeWithoutChildren() const { - return sizeof(MEDCouplingAutoRefCountObjectPtr); + return sizeof(MCAuto); } std::vector MEDFileJointCorrespondence::getDirectChildrenWithNull() const @@ -175,15 +175,15 @@ bool MEDFileJointCorrespondence::isEqual(const MEDFileJointCorrespondence *other return true; } -MEDFileJointCorrespondence *MEDFileJointCorrespondence::deepCpy() const +MEDFileJointCorrespondence *MEDFileJointCorrespondence::deepCopy() const { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileJointCorrespondence(*this); + MCAuto ret=new MEDFileJointCorrespondence(*this); return ret.retn(); } MEDFileJointCorrespondence *MEDFileJointCorrespondence::shallowCpy() const { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileJointCorrespondence(*this); + MCAuto ret=new MEDFileJointCorrespondence(*this); return ret.retn(); } @@ -223,7 +223,7 @@ MEDFileJointOneStep::MEDFileJointOneStep():_order(-1),_iteration(-1) std::size_t MEDFileJointOneStep::getHeapMemorySizeWithoutChildren() const { - return _correspondences.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr); + return _correspondences.capacity()*sizeof(MCAuto); } std::vector MEDFileJointOneStep::getDirectChildrenWithNull() const @@ -276,7 +276,7 @@ MEDFileJointOneStep::MEDFileJointOneStep(med_idt fid, const std::string& mName, &loc_ent_type, &loc_geo_type, &rem_ent_type, &rem_geo_type, &num_entity)); if ( num_entity > 0 ) { - MEDCouplingAutoRefCountObjectPtr correspondence=DataArrayInt::New(); + MCAuto correspondence=DataArrayInt::New(); correspondence->alloc(num_entity*2, 1); MEDFILESAFECALLERRD0(MEDsubdomainCorrespondenceRd,(fid, mName.c_str(), jointName.c_str(), order, iteration, loc_ent_type, loc_geo_type, rem_ent_type, rem_geo_type, correspondence->getPointer())); @@ -313,7 +313,7 @@ void MEDFileJointOneStep::write(const std::string& fileName, int mode, const std void MEDFileJointOneStep::writeLL(med_idt fid, const std::string& localMeshName, const std::string& jointName) const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_correspondences.begin();it!=_correspondences.end();it++) + for(std::vector< MCAuto >::const_iterator it=_correspondences.begin();it!=_correspondences.end();it++) { (*it)->writeLL(fid, localMeshName, jointName, getOrder(), getIteration()); } @@ -377,21 +377,21 @@ bool MEDFileJointOneStep::isEqual(const MEDFileJointOneStep *other) const return true; } -MEDFileJointOneStep *MEDFileJointOneStep::deepCpy() const +MEDFileJointOneStep *MEDFileJointOneStep::deepCopy() const { - std::vector< MEDCouplingAutoRefCountObjectPtr > correspondences(_correspondences.size()); + std::vector< MCAuto > correspondences(_correspondences.size()); std::size_t i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_correspondences.begin();it!=_correspondences.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_correspondences.begin();it!=_correspondences.end();it++,i++) if((const MEDFileJointCorrespondence *)*it) - correspondences[i]=(*it)->deepCpy(); - MEDCouplingAutoRefCountObjectPtr ret= new MEDFileJointOneStep; + correspondences[i]=(*it)->deepCopy(); + MCAuto ret= new MEDFileJointOneStep; ret->_correspondences=correspondences; return ret.retn(); } MEDFileJointOneStep *MEDFileJointOneStep::shallowCpy() const { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileJointOneStep(*this); + MCAuto ret=new MEDFileJointOneStep(*this); return ret.retn(); } @@ -405,7 +405,7 @@ std::string MEDFileJointOneStep::simpleRepr() const std::ostringstream oss; oss << "(*************************************)\n(* JOINT_ONE_STEP INFORMATION: *)\n(*************************************)\n"; oss << "- Number of the correspondences : <<" << _correspondences.size() << ">>\n"; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_correspondences.begin();it!=_correspondences.end();it++) + for(std::vector< MCAuto >::const_iterator it=_correspondences.begin();it!=_correspondences.end();it++) { oss << (*it)->simpleRepr(); } @@ -426,7 +426,7 @@ INTERP_KERNEL::NormalizedCellType MEDFileJointOneStep::convertGeometryType(med_g } std::size_t MEDFileJoint::getHeapMemorySizeWithoutChildren() const { - return _joint.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr); + return _joint.capacity()*sizeof(MCAuto); } std::vector MEDFileJoint::getDirectChildrenWithNull() const @@ -519,7 +519,7 @@ void MEDFileJoint::write(med_idt fid) const // if ( _loc_mesh_name.empty() ) // throw INTERP_KERNEL::Exception("MEDFileJoint::write : name of a local mesh not defined!"); MEDFILESAFECALLERWR0(MEDsubdomainJointCr,(fid,getLocalMeshName().c_str(),getJointName().c_str(),getDescription().c_str(),getDomainNumber(),getRemoteMeshName().c_str())); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_joint.begin();it!=_joint.end();it++) { + for(std::vector< MCAuto >::const_iterator it=_joint.begin();it!=_joint.end();it++) { (*it)->writeLL(fid, getLocalMeshName(),getJointName()); } } @@ -585,21 +585,21 @@ bool MEDFileJoint::isEqual(const MEDFileJoint *other) const return true; } -MEDFileJoint *MEDFileJoint::deepCpy() const +MEDFileJoint *MEDFileJoint::deepCopy() const { - std::vector< MEDCouplingAutoRefCountObjectPtr > joint(_joint.size()); + std::vector< MCAuto > joint(_joint.size()); std::size_t i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_joint.begin();it!=_joint.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_joint.begin();it!=_joint.end();it++,i++) if((const MEDFileJointOneStep *)*it) - joint[i]=(*it)->deepCpy(); - MEDCouplingAutoRefCountObjectPtr ret=MEDFileJoint::New(); + joint[i]=(*it)->deepCopy(); + MCAuto ret=MEDFileJoint::New(); ret->_joint=joint; return ret.retn(); } MEDFileJoint *MEDFileJoint::shallowCpy() const { - MEDCouplingAutoRefCountObjectPtr ret=new MEDFileJoint(*this); + MCAuto ret=new MEDFileJoint(*this); return ret.retn(); } @@ -630,7 +630,7 @@ std::string MEDFileJoint::simpleRepr() const oss << "- Description : <<" << getDescription() << ">>\n"; oss << "- Joint name : <<" << getJointName() << ">>\n"; oss << "- Domain number : " << getDomainNumber() << "\n"; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_joint.begin();it!=_joint.end();it++) + for(std::vector< MCAuto >::const_iterator it=_joint.begin();it!=_joint.end();it++) { oss << (*it)->simpleRepr(); } @@ -656,7 +656,7 @@ MEDFileJoints *MEDFileJoints::New(med_idt fid, const std::string& meshName) void MEDFileJoints::write(med_idt fid) const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_joints.begin();it!=_joints.end();it++) + for(std::vector< MCAuto >::const_iterator it=_joints.begin();it!=_joints.end();it++) { (*it)->write(fid); } @@ -716,7 +716,7 @@ std::vector MEDFileJoints::getJointsNames() const { std::vector ret(_joints.size()); int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_joints.begin();it!=_joints.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_joints.begin();it!=_joints.end();it++,i++) { const MEDFileJoint *f=(*it); if(f) @@ -735,7 +735,7 @@ std::vector MEDFileJoints::getJointsNames() const bool MEDFileJoints::changeJointNames(const std::vector< std::pair >& modifTab) { bool ret=false; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_joints.begin();it!=_joints.end();it++) + for(std::vector< MCAuto >::iterator it=_joints.begin();it!=_joints.end();it++) { MEDFileJoint *cur(*it); if(cur) @@ -792,27 +792,27 @@ MEDFileJoints::MEDFileJoints(med_idt fid, const std::string& meshName) _joints.push_back(MEDFileJoint::New(fid,meshName,i)); } -MEDFileJoints *MEDFileJoints::deepCpy() const +MEDFileJoints *MEDFileJoints::deepCopy() const { - std::vector< MEDCouplingAutoRefCountObjectPtr > joints(_joints.size()); + std::vector< MCAuto > joints(_joints.size()); std::size_t i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_joints.begin();it!=_joints.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_joints.begin();it!=_joints.end();it++,i++) if((const MEDFileJoint *)*it) - joints[i]=(*it)->deepCpy(); - MEDCouplingAutoRefCountObjectPtr ret=MEDFileJoints::New(); + joints[i]=(*it)->deepCopy(); + MCAuto ret=MEDFileJoints::New(); ret->_joints=joints; return ret.retn(); } std::size_t MEDFileJoints::getHeapMemorySizeWithoutChildren() const { - return _joints.capacity()*(sizeof(MEDCouplingAutoRefCountObjectPtr)); + return _joints.capacity()*(sizeof(MCAuto)); } std::vector MEDFileJoints::getDirectChildrenWithNull() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_joints.begin();it!=_joints.end();it++) + for(std::vector< MCAuto >::const_iterator it=_joints.begin();it!=_joints.end();it++) ret.push_back((const MEDFileJoint *)*it); return ret; } @@ -832,7 +832,7 @@ void MEDFileJoints::simpleReprWithoutHeader(std::ostream& oss) const std::vector jns=getJointsNames(); for(int i=0;i >::const_iterator it=_joints.begin();it!=_joints.end();it++) + for(std::vector< MCAuto >::const_iterator it=_joints.begin();it!=_joints.end();it++) { oss << (*it)->simpleRepr(); } diff --git a/src/MEDLoader/MEDFileJoint.hxx b/src/MEDLoader/MEDFileJoint.hxx index ed2f70bee..5fd7d8540 100644 --- a/src/MEDLoader/MEDFileJoint.hxx +++ b/src/MEDLoader/MEDFileJoint.hxx @@ -23,7 +23,7 @@ #include "MEDLoaderDefines.hxx" #include "MEDFileUtilities.hxx" #include "MEDCouplingMemArray.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" namespace MEDCoupling { @@ -43,7 +43,7 @@ public: INTERP_KERNEL::NormalizedCellType rem_geo_type); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; - MEDLOADER_EXPORT MEDFileJointCorrespondence *deepCpy() const; + MEDLOADER_EXPORT MEDFileJointCorrespondence *deepCopy() const; MEDLOADER_EXPORT MEDFileJointCorrespondence *shallowCpy() const; MEDLOADER_EXPORT bool isEqual(const MEDFileJointCorrespondence *other) const; MEDLOADER_EXPORT void setIsNodal(bool isNodal) { _is_nodal = isNodal; } @@ -68,7 +68,7 @@ private: bool _is_nodal; INTERP_KERNEL::NormalizedCellType _loc_geo_type; INTERP_KERNEL::NormalizedCellType _rem_geo_type; - MEDCouplingAutoRefCountObjectPtr _correspondence; + MCAuto _correspondence; }; /*! @@ -82,7 +82,7 @@ public: MEDLOADER_EXPORT static MEDFileJointOneStep *New(med_idt fid, const std::string& mName, const std::string& jointName, int number=1); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; - MEDLOADER_EXPORT MEDFileJointOneStep *deepCpy() const; + MEDLOADER_EXPORT MEDFileJointOneStep *deepCopy() const; MEDLOADER_EXPORT MEDFileJointOneStep *shallowCpy() const; MEDLOADER_EXPORT bool isEqual(const MEDFileJointOneStep *other) const; MEDLOADER_EXPORT void setOrder(int order) { _order=order; } @@ -105,7 +105,7 @@ protected: int _order; int _iteration; private: - std::vector > _correspondences; + std::vector > _correspondences; }; /*! @@ -121,7 +121,7 @@ public: MEDLOADER_EXPORT static MEDFileJoint *New(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum ); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; - MEDLOADER_EXPORT MEDFileJoint *deepCpy() const; + MEDLOADER_EXPORT MEDFileJoint *deepCopy() const; MEDLOADER_EXPORT MEDFileJoint *shallowCpy() const; MEDLOADER_EXPORT bool isEqual(const MEDFileJoint *other) const; MEDLOADER_EXPORT void setLocalMeshName(const std::string& name) { _loc_mesh_name=name; } @@ -152,7 +152,7 @@ public: std::string _desc_name; int _domain_number; std::string _rem_mesh_name; - std::vector< MEDCouplingAutoRefCountObjectPtr > _joint; + std::vector< MCAuto > _joint; }; /*! @@ -164,7 +164,7 @@ public: MEDLOADER_EXPORT static MEDFileJoints *New(); MEDLOADER_EXPORT static MEDFileJoints *New(const std::string& fileName, const std::string& meshName); MEDLOADER_EXPORT static MEDFileJoints *New(med_idt fid, const std::string& meshName); - MEDLOADER_EXPORT MEDFileJoints *deepCpy() const; + MEDLOADER_EXPORT MEDFileJoints *deepCopy() const; MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT std::string simpleRepr() const; @@ -187,7 +187,7 @@ public: MEDFileJoints(); MEDFileJoints(med_idt fid, const std::string& meshName); private: - std::vector< MEDCouplingAutoRefCountObjectPtr > _joints; + std::vector< MCAuto > _joints; }; } diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index 6dd99c99f..23e752040 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -89,7 +89,7 @@ MEDFileMesh *MEDFileMesh::New(const std::string& fileName, MEDFileMeshReadSelect std::string dummy2; MEDCoupling::MEDCouplingAxisType dummy3; MEDFileMeshL2::GetMeshIdFromName(fid,ms.front(),meshType,dummy3,dt,it,dummy2); - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; switch(meshType) { case UNSTRUCTURED: @@ -143,7 +143,7 @@ MEDFileMesh *MEDFileMesh::New(const std::string& fileName, const std::string& mN std::string dummy2; MEDCoupling::MEDCouplingAxisType dummy3; MEDFileMeshL2::GetMeshIdFromName(fid,mName,meshType,dummy3,dummy0,dummy1,dummy2); - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; switch(meshType) { case UNSTRUCTURED: @@ -748,7 +748,7 @@ std::vector MEDFileMesh::removeOrphanGroups() */ std::vector MEDFileMesh::removeOrphanFamilies() { - MEDCouplingAutoRefCountObjectPtr allFamIdsInUse=computeAllFamilyIdsInUse(); + MCAuto allFamIdsInUse=computeAllFamilyIdsInUse(); std::vector ret; if(!((DataArrayInt*)allFamIdsInUse)) { @@ -829,10 +829,10 @@ void MEDFileMesh::rearrangeFamilies() std::vector v(fams->getNumberOfTuples(),false); for(std::set::const_iterator pt=idsRefed.begin();pt!=idsRefed.end();pt++) fams->switchOnTupleEqualTo(*pt,v); - MEDCouplingAutoRefCountObjectPtr unfetchedIds(DataArrayInt::BuildListOfSwitchedOff(v)); + MCAuto unfetchedIds(DataArrayInt::BuildListOfSwitchedOff(v)); if(!unfetchedIds->empty()) { - MEDCouplingAutoRefCountObjectPtr newFams(fams->deepCpy()); + MCAuto newFams(fams->deepCopy()); newFams->setPartOfValuesSimple3(0,unfetchedIds->begin(),unfetchedIds->end(),0,1,1); setFamilyFieldArr(*it,newFams); } @@ -1152,7 +1152,7 @@ void MEDFileMesh::createGroupOnAll(int meshDimRelToMaxExt, const std::string& gr const DataArrayInt *fieldFamIds=getFamilyFieldAtLevel(meshDimRelToMaxExt); if(fieldFamIds==0) throw INTERP_KERNEL::Exception("MEDFileMesh::createGroupOnAll : Family field arr ids is not defined for this level !"); - MEDCouplingAutoRefCountObjectPtr famIds=fieldFamIds->getDifferentValues(); + MCAuto famIds=fieldFamIds->getDifferentValues(); std::vector familiesOnWholeGroup; for(const int *it=famIds->begin();it!=famIds->end();it++) { @@ -1189,7 +1189,7 @@ bool MEDFileMesh::keepFamIdsOnlyOnLevs(const std::vector& famIds, const std const DataArrayInt *fieldFamIds=getFamilyFieldAtLevel(*it); if(fieldFamIds) { - MEDCouplingAutoRefCountObjectPtr famIds3=fieldFamIds->getDifferentValues(); + MCAuto famIds3=fieldFamIds->getDifferentValues(); std::vector tmp; std::set_intersection(famIds3->begin(),famIds3->end(),famIds2.begin(),famIds2.end(),std::back_insert_iterator< std::vector >(tmp)); for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) @@ -1274,19 +1274,19 @@ void MEDFileMesh::addGroupUnderground(bool isNodeGroup, const DataArrayInt *ids, if(grpName.empty()) throw INTERP_KERNEL::Exception("MEDFileUMesh::addGroup : empty group name ! MED file format do not accept empty group name !"); ids->checkStrictlyMonotonic(true); - famArr->incrRef(); MEDCouplingAutoRefCountObjectPtr famArrTmp(famArr); + famArr->incrRef(); MCAuto famArrTmp(famArr); std::vector grpsNames=getGroupsNames(); if(std::find(grpsNames.begin(),grpsNames.end(),grpName)!=grpsNames.end()) { std::ostringstream oss; oss << "MEDFileUMesh::addGroup : Group with name \"" << grpName << "\" already exists ! Destroy it before calling this method !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - std::list< MEDCouplingAutoRefCountObjectPtr > allFamIds(getAllNonNullFamilyIds()); + std::list< MCAuto > allFamIds(getAllNonNullFamilyIds()); allFamIds.erase(std::find(allFamIds.begin(),allFamIds.end(),famArrTmp)); - MEDCouplingAutoRefCountObjectPtr famIds=famArr->selectByTupleIdSafe(ids->begin(),ids->end()); - MEDCouplingAutoRefCountObjectPtr diffFamIds=famIds->getDifferentValues(); + MCAuto famIds=famArr->selectByTupleIdSafe(ids->begin(),ids->end()); + MCAuto diffFamIds=famIds->getDifferentValues(); std::vector familyIds; - std::vector< MEDCouplingAutoRefCountObjectPtr > idsPerfamiliyIds; + std::vector< MCAuto > idsPerfamiliyIds; int maxVal=getTheMaxAbsFamilyId()+1; std::map families(_families); std::map > groups(_groups); @@ -1294,14 +1294,14 @@ void MEDFileMesh::addGroupUnderground(bool isNodeGroup, const DataArrayInt *ids, bool created(false); for(const int *famId=diffFamIds->begin();famId!=diffFamIds->end();famId++) { - MEDCouplingAutoRefCountObjectPtr ids2Tmp=famIds->getIdsEqual(*famId); - MEDCouplingAutoRefCountObjectPtr ids2=ids->selectByTupleId(ids2Tmp->begin(),ids2Tmp->end()); - MEDCouplingAutoRefCountObjectPtr ids1=famArr->getIdsEqual(*famId); - MEDCouplingAutoRefCountObjectPtr ret0(ids1->buildSubstractionOptimized(ids2)); + MCAuto ids2Tmp=famIds->findIdsEqual(*famId); + MCAuto ids2=ids->selectByTupleId(ids2Tmp->begin(),ids2Tmp->end()); + MCAuto ids1=famArr->findIdsEqual(*famId); + MCAuto ret0(ids1->buildSubstractionOptimized(ids2)); if(ret0->empty()) { bool isFamPresent=false; - for(std::list< MEDCouplingAutoRefCountObjectPtr >::const_iterator itl=allFamIds.begin();itl!=allFamIds.end() && !isFamPresent;itl++) + for(std::list< MCAuto >::const_iterator itl=allFamIds.begin();itl!=allFamIds.end() && !isFamPresent;itl++) isFamPresent=(*itl)->presenceOfValue(*famId); if(!isFamPresent) { familyIds.push_back(*famId); idsPerfamiliyIds.push_back(ret0); fams.push_back(FindOrCreateAndGiveFamilyWithId(families,*famId,created)); } // adding *famId in grp @@ -1569,7 +1569,7 @@ int MEDFileMesh::getTheMinFamilyId() const */ DataArrayInt *MEDFileMesh::getAllFamiliesIdsReferenced() const { - MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); + MCAuto ret=DataArrayInt::New(); std::set v; for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) v.insert((*it).second); @@ -1586,11 +1586,11 @@ DataArrayInt *MEDFileMesh::getAllFamiliesIdsReferenced() const DataArrayInt *MEDFileMesh::computeAllFamilyIdsInUse() const { std::vector famLevs=getFamArrNonEmptyLevelsExt(); - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; for(std::vector::const_iterator it=famLevs.begin();it!=famLevs.end();it++) { const DataArrayInt *arr=getFamilyFieldAtLevel(*it);//arr not null due to spec of getFamArrNonEmptyLevelsExt - MEDCouplingAutoRefCountObjectPtr dv=arr->getDifferentValues(); + MCAuto dv=arr->getDifferentValues(); if((DataArrayInt *) ret) ret=dv->buildUnion(ret); else @@ -1614,7 +1614,7 @@ bool MEDFileMesh::ensureDifferentFamIdsPerLevel() const DataArrayInt *fam=getFamilyFieldAtLevel(*it); if(fam) { - MEDCouplingAutoRefCountObjectPtr tmp=fam->getDifferentValues(); + MCAuto tmp=fam->getDifferentValues(); std::set r2; std::set_intersection(tmp->begin(),tmp->end(),allFamIds.begin(),allFamIds.end(),std::inserter(r2,r2.end())); if(!r2.empty()) @@ -1625,7 +1625,7 @@ bool MEDFileMesh::ensureDifferentFamIdsPerLevel() } if(famIdsToRenum.empty()) return true; - MEDCouplingAutoRefCountObjectPtr allIds=getAllFamiliesIdsReferenced(); + MCAuto allIds=getAllFamiliesIdsReferenced(); for(std::map >::const_iterator it2=famIdsToRenum.begin();it2!=famIdsToRenum.end();it2++) { DataArrayInt *fam=const_cast(getFamilyFieldAtLevel((*it2).first)); @@ -1644,7 +1644,7 @@ bool MEDFileMesh::ensureDifferentFamIdsPerLevel() addFamilyOnGrp((*it4),newFam); } } - MEDCouplingAutoRefCountObjectPtr ids=fam->getIdsEqualList(&(*it2).second[0],&(*it2).second[0]+(*it2).second.size()); + MCAuto ids=fam->findIdsEqualList(&(*it2).second[0],&(*it2).second[0]+(*it2).second.size()); for(const int *id=ids->begin();id!=ids->end();id++) famIdsToChange[*id]=ren[famIdsToChange[*id]]; } @@ -1661,7 +1661,7 @@ bool MEDFileMesh::ensureDifferentFamIdsPerLevel() void MEDFileMesh::normalizeFamIdsTrio() { ensureDifferentFamIdsPerLevel(); - MEDCouplingAutoRefCountObjectPtr allIds=getAllFamiliesIdsReferenced(); + MCAuto allIds=getAllFamiliesIdsReferenced(); std::vector levs=getNonEmptyLevelsExt(); std::set levsS(levs.begin(),levs.end()); std::set famsFetched; @@ -1673,7 +1673,7 @@ void MEDFileMesh::normalizeFamIdsTrio() if(fam) { int refId=1; - MEDCouplingAutoRefCountObjectPtr tmp=fam->getDifferentValues(); + MCAuto tmp=fam->getDifferentValues(); std::map ren; for(const int *it=tmp->begin();it!=tmp->end();it++,refId++) ren[*it]=refId; @@ -1699,7 +1699,7 @@ void MEDFileMesh::normalizeFamIdsTrio() if(fam) { int refId=-1; - MEDCouplingAutoRefCountObjectPtr tmp=fam->getDifferentValues(); + MCAuto tmp=fam->getDifferentValues(); std::map ren; for(const int *it=tmp->begin();it!=tmp->end();it++,refId--) ren[*it]=refId; @@ -1723,7 +1723,7 @@ void MEDFileMesh::normalizeFamIdsTrio() DataArrayInt *fam=const_cast(getFamilyFieldAtLevel(*it2)); if(fam) { - MEDCouplingAutoRefCountObjectPtr tmp=fam->getDifferentValues(); + MCAuto tmp=fam->getDifferentValues(); fam->fillWithZero(); for(const int *it3=tmp->begin();it3!=tmp->end();it3++) if(allIds->presenceOfValue(*it3)) @@ -1753,7 +1753,7 @@ void MEDFileMesh::normalizeFamIdsTrio() void MEDFileMesh::normalizeFamIdsMEDFile() { ensureDifferentFamIdsPerLevel(); - MEDCouplingAutoRefCountObjectPtr allIds=getAllFamiliesIdsReferenced(); + MCAuto allIds=getAllFamiliesIdsReferenced(); std::vector levs=getNonEmptyLevelsExt(); std::set levsS(levs.begin(),levs.end()); std::set famsFetched; @@ -1765,7 +1765,7 @@ void MEDFileMesh::normalizeFamIdsMEDFile() const DataArrayInt *fam=getFamilyFieldAtLevel(1); if(fam) { - MEDCouplingAutoRefCountObjectPtr tmp=fam->getDifferentValues(); + MCAuto tmp=fam->getDifferentValues(); std::map ren; for(const int *it=tmp->begin();it!=tmp->end();it++,refId++) ren[*it]=refId; @@ -1790,7 +1790,7 @@ void MEDFileMesh::normalizeFamIdsMEDFile() const DataArrayInt *fam=getFamilyFieldAtLevel(*it2); if(fam) { - MEDCouplingAutoRefCountObjectPtr tmp=fam->getDifferentValues(); + MCAuto tmp=fam->getDifferentValues(); std::map ren; for(const int *it=tmp->begin();it!=tmp->end();it++,refId--) ren[*it]=refId; @@ -1858,7 +1858,7 @@ DataArrayInt *MEDFileMesh::getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToM DataArrayInt *ret(getFamilyFieldAtLevel(meshDimRelToMaxExt)); if(ret) return ret; - MEDCouplingAutoRefCountObjectPtr arr(DataArrayInt::New()); + MCAuto arr(DataArrayInt::New()); arr->alloc(getSizeAtLevel(meshDimRelToMaxExt),1); arr->fillWithZero(); setFamilyFieldArr(meshDimRelToMaxExt,arr); @@ -2028,7 +2028,7 @@ void MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector fam; + MCAuto fam; std::vector< std::vector > fidsOfGroups; if(!renum) { @@ -2036,7 +2036,7 @@ void MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector > grps2(grps.size()); + std::vector< MCAuto > grps2(grps.size()); for(unsigned int ii=0;ii ids=fam->getDifferentValues(); + MCAuto ids=fam->getDifferentValues(); appendFamilyEntries(ids,fidsOfGroups,grpsName2); setFamilyFieldArr(meshDimRelToMaxExt,fam); } @@ -2093,7 +2093,7 @@ std::vector MEDFileMesh::getAllGeoTypes() con std::vector MEDFileMesh::getDistributionOfTypes(int meshDimRelToMax) const { - MEDCouplingAutoRefCountObjectPtr mLev(getMeshAtLevel(meshDimRelToMax)); + MCAuto mLev(getMeshAtLevel(meshDimRelToMax)); return mLev->getDistributionOfTypes(); } @@ -2310,7 +2310,7 @@ MEDFileUMesh *MEDFileUMesh::LoadPartOf(const std::string& fileName, const std::s */ MEDFileUMesh *MEDFileUMesh::LoadPartOf(med_idt fid, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs) { - MEDCouplingAutoRefCountObjectPtr ret(MEDFileUMesh::New()); + MCAuto ret(MEDFileUMesh::New()); ret->loadPartUMeshFromFile(fid,mName,types,slicPerTyp,dt,it,mrs); return ret.retn(); } @@ -2318,7 +2318,7 @@ MEDFileUMesh *MEDFileUMesh::LoadPartOf(med_idt fid, const std::string& mName, co std::size_t MEDFileUMesh::getHeapMemorySizeWithoutChildren() const { std::size_t ret(MEDFileMesh::getHeapMemorySizeWithoutChildren()); - ret+=_ms.capacity()*(sizeof(MEDCouplingAutoRefCountObjectPtr)); + ret+=_ms.capacity()*(sizeof(MCAuto)); return ret; } @@ -2331,14 +2331,14 @@ std::vector MEDFileUMesh::getDirectChildrenWithNull() c ret.push_back((const DataArrayInt *)_rev_num_coords); ret.push_back((const DataArrayAsciiChar *)_name_coords); ret.push_back((const PartDefinition *)_part_coords); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_ms.begin();it!=_ms.end();it++) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) ret.push_back((const MEDFileUMeshSplitL1*) *it); return ret; } MEDFileMesh *MEDFileUMesh::shallowCpy() const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileUMesh(*this)); + MCAuto ret(new MEDFileUMesh(*this)); return ret.retn(); } @@ -2347,28 +2347,28 @@ MEDFileMesh *MEDFileUMesh::createNewEmpty() const return new MEDFileUMesh; } -MEDFileMesh *MEDFileUMesh::deepCpy() const +MEDFileMesh *MEDFileUMesh::deepCopy() const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileUMesh(*this)); + MCAuto ret(new MEDFileUMesh(*this)); ret->deepCpyEquivalences(*this); if((const DataArrayDouble*)_coords) - ret->_coords=_coords->deepCpy(); + ret->_coords=_coords->deepCopy(); if((const DataArrayInt*)_fam_coords) - ret->_fam_coords=_fam_coords->deepCpy(); + ret->_fam_coords=_fam_coords->deepCopy(); if((const DataArrayInt*)_num_coords) - ret->_num_coords=_num_coords->deepCpy(); + ret->_num_coords=_num_coords->deepCopy(); if((const DataArrayInt*)_rev_num_coords) - ret->_rev_num_coords=_rev_num_coords->deepCpy(); + ret->_rev_num_coords=_rev_num_coords->deepCopy(); if((const DataArrayAsciiChar*)_name_coords) - ret->_name_coords=_name_coords->deepCpy(); + ret->_name_coords=_name_coords->deepCopy(); std::size_t i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_ms.begin();it!=_ms.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++,i++) { if((const MEDFileUMeshSplitL1 *)(*it)) - ret->_ms[i]=(*it)->deepCpy(ret->_coords); + ret->_ms[i]=(*it)->deepCopy(ret->_coords); } if((const PartDefinition*)_part_coords) - ret->_part_coords=_part_coords->deepCpy(); + ret->_part_coords=_part_coords->deepCopy(); return ret.retn(); } @@ -2506,7 +2506,7 @@ void MEDFileUMesh::clearNonDiscrAttributes() const const DataArrayAsciiChar *namc1=_name_coords; if(namc1) (const_cast(namc1))->setName("");//This parameter is not discriminant for comparison - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_ms.begin();it!=_ms.end();it++) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) { const MEDFileUMeshSplitL1 *tmp=(*it); if(tmp) @@ -2516,7 +2516,7 @@ void MEDFileUMesh::clearNonDiscrAttributes() const void MEDFileUMesh::setName(const std::string& name) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_ms.begin();it!=_ms.end();it++) + for(std::vector< MCAuto >::iterator it=_ms.begin();it!=_ms.end();it++) if((MEDFileUMeshSplitL1 *)(*it)!=0) (*it)->setName(name); MEDFileMesh::setName(name); @@ -2600,7 +2600,7 @@ void MEDFileMesh::deepCpyEquivalences(const MEDFileMesh& other) { const MEDFileEquivalences *equiv(other._equiv); if(equiv) - _equiv=equiv->deepCpy(this); + _equiv=equiv->deepCopy(this); } bool MEDFileMesh::areEquivalencesEqual(const MEDFileMesh *other, std::string& what) const @@ -2628,11 +2628,11 @@ void MEDFileMesh::getEquivalencesRepr(std::ostream& oss) const void MEDFileMesh::checkCartesian() const { - if(getAxType()!=AX_CART) + if(getAxisType()!=AX_CART) { - std::ostringstream oss; oss << "MEDFileMesh::checkCartesian : request for method that is dedicated to a cartesian convention ! But you are not in cartesian convention (" << DataArray::GetAxTypeRepr(getAxType()) << ")."; + std::ostringstream oss; oss << "MEDFileMesh::checkCartesian : request for method that is dedicated to a cartesian convention ! But you are not in cartesian convention (" << DataArray::GetAxisTypeRepr(getAxisType()) << ")."; oss << std::endl << "To perform operation you have two possiblities :" << std::endl; - oss << " - call setAxType(AX_CART)" << std::endl; + oss << " - call setAxisType(AX_CART)" << std::endl; oss << " - call cartesianize()"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } @@ -2677,7 +2677,7 @@ void MEDFileUMesh::loadLL(med_idt fid, const std::string& mName, int dt, int it, std::string dummy2; MEDCoupling::MEDCouplingAxisType axType; int mid(MEDFileUMeshL2::GetMeshIdFromName(fid,mName,meshType,axType,dummy0,dummy1,dummy2)); - setAxType(axType); + setAxisType(axType); if(meshType!=UNSTRUCTURED) { std::ostringstream oss; oss << "Trying to load as unstructured an existing mesh with name '" << mName << "' !"; @@ -2743,12 +2743,12 @@ void MEDFileUMesh::writeLL(med_idt fid) const MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE-1,comp+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo MEDLoaderBase::safeStrCpy2(u.c_str(),MED_SNAME_SIZE-1,unit+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo } - MEDFILESAFECALLERWR0(MEDmeshCr,(fid,maa,spaceDim,mdim,MED_UNSTRUCTURED_MESH,desc,"",MED_SORT_DTIT,MEDFileMeshL2::TraduceAxisTypeRev(getAxType()),comp,unit)); + MEDFILESAFECALLERWR0(MEDmeshCr,(fid,maa,spaceDim,mdim,MED_UNSTRUCTURED_MESH,desc,"",MED_SORT_DTIT,MEDFileMeshL2::TraduceAxisTypeRev(getAxisType()),comp,unit)); if(_univ_wr_status) MEDFILESAFECALLERWR0(MEDmeshUniversalNameWr,(fid,maa)); std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE)); MEDFileUMeshL2::WriteCoords(fid,meshName,_iteration,_order,_time,_coords,_fam_coords,_num_coords,_name_coords); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_ms.begin();it!=_ms.end();it++) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) if((const MEDFileUMeshSplitL1 *)(*it)!=0) (*it)->write(fid,meshName,mdim); MEDFileUMeshL2::WriteFamiliesAndGrps(fid,meshName,_families,_groups,_too_long_str); @@ -2762,7 +2762,7 @@ std::vector MEDFileUMesh::getNonEmptyLevels() const { std::vector ret; int lev=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--) if((const MEDFileUMeshSplitL1 *)(*it)!=0) if(!(*it)->empty()) ret.push_back(lev); @@ -2793,7 +2793,7 @@ std::vector MEDFileUMesh::getFamArrNonEmptyLevelsExt() const if(famCoo) ret.push_back(1); int lev=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--) { const MEDFileUMeshSplitL1 *cur(*it); if(cur) @@ -2810,7 +2810,7 @@ std::vector MEDFileUMesh::getNumArrNonEmptyLevelsExt() const if(numCoo) ret.push_back(1); int lev=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--) { const MEDFileUMeshSplitL1 *cur(*it); if(cur) @@ -2827,7 +2827,7 @@ std::vector MEDFileUMesh::getNameArrNonEmptyLevelsExt() const if(nameCoo) ret.push_back(1); int lev=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--) { const MEDFileUMeshSplitL1 *cur(*it); if(cur) @@ -2885,7 +2885,7 @@ int MEDFileUMesh::getMaxAbsFamilyIdInArrays() const int val=_fam_coords->getMaxValue(tmp); ret=std::max(ret,std::abs(val)); } - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_ms.begin();it!=_ms.end();it++) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) { if((const MEDFileUMeshSplitL1 *)(*it)) { @@ -2908,7 +2908,7 @@ int MEDFileUMesh::getMaxFamilyIdInArrays() const int val=_fam_coords->getMaxValue(tmp); ret=std::max(ret,val); } - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_ms.begin();it!=_ms.end();it++) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) { if((const MEDFileUMeshSplitL1 *)(*it)) { @@ -2931,7 +2931,7 @@ int MEDFileUMesh::getMinFamilyIdInArrays() const int val=_fam_coords->getMinValue(tmp); ret=std::min(ret,val); } - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_ms.begin();it!=_ms.end();it++) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) { if((const MEDFileUMeshSplitL1 *)(*it)) { @@ -2954,7 +2954,7 @@ int MEDFileUMesh::getMinFamilyIdInArrays() const int MEDFileUMesh::getMeshDimension() const { int lev=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev++) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev++) if((const MEDFileUMeshSplitL1 *)(*it)!=0) return (*it)->getMeshDimension()+lev; throw INTERP_KERNEL::Exception("MEDFileUMesh::getMeshDimension : impossible to find a mesh dimension !"); @@ -3152,7 +3152,7 @@ void MEDFileUMesh::whichAreNodesFetched(const MEDFileField1TSStructItem& st, con else { const DataArrayInt *arr(globs->getProfile(st[i].getPflName())); - MEDCouplingAutoRefCountObjectPtr m2(dynamic_cast(m->buildPartOfMySelf(arr->begin(),arr->end(),true))); + MCAuto m2(dynamic_cast(m->buildPartOfMySelf(arr->begin(),arr->end(),true))); m2->computeNodeIdsAlg(nodesFetched); } } @@ -3160,23 +3160,23 @@ void MEDFileUMesh::whichAreNodesFetched(const MEDFileField1TSStructItem& st, con MEDFileMesh *MEDFileUMesh::cartesianize() const { - if(getAxType()==AX_CART) + if(getAxisType()==AX_CART) { incrRef(); return const_cast(this); } else { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileUMesh(*this)); + MCAuto ret(new MEDFileUMesh(*this)); const DataArrayDouble *coords(_coords); if(!coords) throw INTERP_KERNEL::Exception("MEDFileUMesh::cartesianize : coordinates are null !"); - MEDCouplingAutoRefCountObjectPtr coordsCart(_coords->cartesianize(getAxType())); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=ret->_ms.begin();it!=ret->_ms.end();it++) + MCAuto coordsCart(_coords->cartesianize(getAxisType())); + for(std::vector< MCAuto >::iterator it=ret->_ms.begin();it!=ret->_ms.end();it++) if((const MEDFileUMeshSplitL1 *)(*it)) *it=(*it)->shallowCpyUsingCoords(coordsCart); ret->_coords=coordsCart; - ret->setAxType(AX_CART); + ret->setAxisType(AX_CART); return ret.retn(); } } @@ -3208,7 +3208,7 @@ const DataArrayInt *MEDFileUMesh::getRevNumberFieldAtLevel(int meshDimRelToMaxEx DataArrayDouble *MEDFileUMesh::getCoords() const { checkCartesian(); - MEDCouplingAutoRefCountObjectPtr tmp(_coords); + MCAuto tmp(_coords); if((DataArrayDouble *)tmp) { return tmp; @@ -3258,7 +3258,7 @@ MEDCouplingUMesh *MEDFileUMesh::getGroups(int meshDimRelToMaxExt, const std::vec checkCartesian(); synchronizeTinyInfoOnLeaves(); std::vector fams2=getFamiliesOnGroups(grps); - MEDCouplingAutoRefCountObjectPtr zeRet=getFamilies(meshDimRelToMaxExt,fams2,renum); + MCAuto zeRet=getFamilies(meshDimRelToMaxExt,fams2,renum); if(grps.size()==1 && ((MEDCouplingUMesh *)zeRet)) zeRet->setName(grps[0]); return zeRet.retn(); @@ -3307,15 +3307,15 @@ MEDCouplingUMesh *MEDFileUMesh::getFamilies(int meshDimRelToMaxExt, const std::v synchronizeTinyInfoOnLeaves(); if(meshDimRelToMaxExt==1) { - MEDCouplingAutoRefCountObjectPtr arr=getFamiliesArr(1,fams,renum); - MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingUMesh::New(); - MEDCouplingAutoRefCountObjectPtr c=_coords->selectByTupleId(arr->getConstPointer(),arr->getConstPointer()+arr->getNbOfElems()); + MCAuto arr=getFamiliesArr(1,fams,renum); + MCAuto ret=MEDCouplingUMesh::New(); + MCAuto c=_coords->selectByTupleId(arr->getConstPointer(),arr->getConstPointer()+arr->getNbOfElems()); ret->setCoords(c); return ret.retn(); } std::vector famIds=getFamiliesIds(fams); const MEDFileUMeshSplitL1 *l1=getMeshAtLevSafe(meshDimRelToMaxExt); - MEDCouplingAutoRefCountObjectPtr zeRet; + MCAuto zeRet; if(!famIds.empty()) zeRet=l1->getFamilyPart(&famIds[0],&famIds[0]+famIds.size(),renum); else @@ -3344,11 +3344,11 @@ DataArrayInt *MEDFileUMesh::getFamiliesArr(int meshDimRelToMaxExt, const std::ve { if((const DataArrayInt *)_fam_coords) { - MEDCouplingAutoRefCountObjectPtr da; + MCAuto da; if(!famIds.empty()) - da=_fam_coords->getIdsEqualList(&famIds[0],&famIds[0]+famIds.size()); + da=_fam_coords->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size()); else - da=_fam_coords->getIdsEqualList(0,0); + da=_fam_coords->findIdsEqualList(0,0); if(renum) return MEDFileUMeshSplitL1::Renumber(_num_coords,da); else @@ -3386,7 +3386,7 @@ MEDCouplingUMesh *MEDFileUMesh::getMeshAtLevel(int meshDimRelToMaxExt, bool renu if(!renum) { MEDCouplingUMesh *umesh=MEDCouplingUMesh::New(); - MEDCouplingAutoRefCountObjectPtr cc=_coords->deepCpy(); + MCAuto cc=_coords->deepCopy(); umesh->setCoords(cc); MEDFileUMeshSplitL1::ClearNonDiscrAttributes(umesh); umesh->setName(getName()); @@ -3463,7 +3463,7 @@ MEDCouplingUMesh *MEDFileUMesh::getLevelM3Mesh(bool renum) const */ void MEDFileUMesh::forceComputationOfParts() const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_ms.begin();it!=_ms.end();it++) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) { const MEDFileUMeshSplitL1 *elt(*it); if(elt) @@ -3590,7 +3590,7 @@ void MEDFileUMesh::checkMeshDimCoherency(int meshDim, int meshDimRelToMax) const if(-meshDimRelToMax>=(int)_ms.size()) throw INTERP_KERNEL::Exception("MEDFileUMesh::checkMeshDimCoherency : The meshdim of mesh is not managed by 'this' !"); int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_ms.begin();it!=_ms.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++,i++) { if(((const MEDFileUMeshSplitL1*) (*it))!=0) { @@ -3619,7 +3619,7 @@ void MEDFileUMesh::setCoords(DataArrayDouble *coords) _fam_coords=DataArrayInt::New(); _fam_coords->alloc(nbOfTuples,1); _fam_coords->fillWithZero(); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_ms.begin();it!=_ms.end();it++) + for(std::vector< MCAuto >::iterator it=_ms.begin();it!=_ms.end();it++) if((MEDFileUMeshSplitL1 *)(*it)) (*it)->setCoords(coords); } @@ -3652,7 +3652,7 @@ void MEDFileUMesh::optimizeFamilies() for(std::vector::const_iterator it=levs.begin();it!=levs.end();it++) { const DataArrayInt *ffield=getFamilyFieldAtLevel(*it); - MEDCouplingAutoRefCountObjectPtr ids=ffield->getDifferentValues(); + MCAuto ids=ffield->getDifferentValues(); std::set res; std::set_union(ids->begin(),ids->end(),allFamsIds.begin(),allFamsIds.end(),std::inserter(res,res.begin())); allFamsIds=res; @@ -3707,30 +3707,30 @@ void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, std::vector levs=getNonEmptyLevels(); if(std::find(levs.begin(),levs.end(),0)==levs.end() || std::find(levs.begin(),levs.end(),-1)==levs.end()) throw INTERP_KERNEL::Exception("MEDFileUMesh::buildInnerBoundaryAlongM1Group : This method works only for mesh definied on level 0 and -1 !"); - MEDCouplingAutoRefCountObjectPtr m0=getMeshAtLevel(0); - MEDCouplingAutoRefCountObjectPtr m1=getMeshAtLevel(-1); + MCAuto m0=getMeshAtLevel(0); + MCAuto m1=getMeshAtLevel(-1); int nbNodes=m0->getNumberOfNodes(); - MEDCouplingAutoRefCountObjectPtr m11=getGroup(-1,grpNameM1); + MCAuto m11=getGroup(-1,grpNameM1); DataArrayInt *tmp00=0,*tmp11=0,*tmp22=0; m0->findNodesToDuplicate(*m11,tmp00,tmp11,tmp22); - MEDCouplingAutoRefCountObjectPtr nodeIdsToDuplicate(tmp00); - MEDCouplingAutoRefCountObjectPtr cellsToModifyConn0(tmp11); - MEDCouplingAutoRefCountObjectPtr cellsToModifyConn1(tmp22); - MEDCouplingAutoRefCountObjectPtr tmp0=static_cast(m0->buildPartOfMySelf(cellsToModifyConn0->begin(),cellsToModifyConn0->end(),true)); + MCAuto nodeIdsToDuplicate(tmp00); + MCAuto cellsToModifyConn0(tmp11); + MCAuto cellsToModifyConn1(tmp22); + MCAuto tmp0=static_cast(m0->buildPartOfMySelf(cellsToModifyConn0->begin(),cellsToModifyConn0->end(),true)); // node renumbering of cells in m1 impacted by duplication of node but not in group 'grpNameM1' on level -1 - MEDCouplingAutoRefCountObjectPtr descTmp0=DataArrayInt::New(),descITmp0=DataArrayInt::New(),revDescTmp0=DataArrayInt::New(),revDescITmp0=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr tmp0Desc=tmp0->buildDescendingConnectivity(descTmp0,descITmp0,revDescTmp0,revDescITmp0); + MCAuto descTmp0=DataArrayInt::New(),descITmp0=DataArrayInt::New(),revDescTmp0=DataArrayInt::New(),revDescITmp0=DataArrayInt::New(); + MCAuto tmp0Desc=tmp0->buildDescendingConnectivity(descTmp0,descITmp0,revDescTmp0,revDescITmp0); descTmp0=0; descITmp0=0; revDescTmp0=0; revDescITmp0=0; - MEDCouplingAutoRefCountObjectPtr cellsInM1ToRenumW2=tmp0Desc->getCellIdsLyingOnNodes(nodeIdsToDuplicate->begin(),nodeIdsToDuplicate->end(),false); - MEDCouplingAutoRefCountObjectPtr cellsInM1ToRenumW3=static_cast(tmp0Desc->buildPartOfMySelf(cellsInM1ToRenumW2->begin(),cellsInM1ToRenumW2->end(),true)); + MCAuto cellsInM1ToRenumW2=tmp0Desc->getCellIdsLyingOnNodes(nodeIdsToDuplicate->begin(),nodeIdsToDuplicate->end(),false); + MCAuto cellsInM1ToRenumW3=static_cast(tmp0Desc->buildPartOfMySelf(cellsInM1ToRenumW2->begin(),cellsInM1ToRenumW2->end(),true)); DataArrayInt *cellsInM1ToRenumW4Tmp=0; m1->areCellsIncludedIn(cellsInM1ToRenumW3,2,cellsInM1ToRenumW4Tmp); - MEDCouplingAutoRefCountObjectPtr cellsInM1ToRenumW4(cellsInM1ToRenumW4Tmp); - MEDCouplingAutoRefCountObjectPtr cellsInM1ToRenumW5=cellsInM1ToRenumW4->getIdsInRange(0,m1->getNumberOfCells()); + MCAuto cellsInM1ToRenumW4(cellsInM1ToRenumW4Tmp); + MCAuto cellsInM1ToRenumW5=cellsInM1ToRenumW4->findIdsInRange(0,m1->getNumberOfCells()); cellsInM1ToRenumW5->transformWithIndArr(cellsInM1ToRenumW4->begin(),cellsInM1ToRenumW4->end()); - MEDCouplingAutoRefCountObjectPtr grpIds=getGroupArr(-1,grpNameM1); - MEDCouplingAutoRefCountObjectPtr cellsInM1ToRenum=cellsInM1ToRenumW5->buildSubstraction(grpIds); - MEDCouplingAutoRefCountObjectPtr m1Part=static_cast(m1->buildPartOfMySelf(cellsInM1ToRenum->begin(),cellsInM1ToRenum->end(),true)); + MCAuto grpIds=getGroupArr(-1,grpNameM1); + MCAuto cellsInM1ToRenum=cellsInM1ToRenumW5->buildSubstraction(grpIds); + MCAuto m1Part=static_cast(m1->buildPartOfMySelf(cellsInM1ToRenum->begin(),cellsInM1ToRenum->end(),true)); m1Part->duplicateNodesInConn(nodeIdsToDuplicate->begin(),nodeIdsToDuplicate->end(),nbNodes); m1->setPartOfMySelf(cellsInM1ToRenum->begin(),cellsInM1ToRenum->end(),*m1Part); // end of node renumbering of cells in m1 impacted by duplication of node but not in group of level -1 'grpNameM1' @@ -3742,15 +3742,15 @@ void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, // duplication of cells in group 'grpNameM1' on level -1 m11->duplicateNodesInConn(nodeIdsToDuplicate->begin(),nodeIdsToDuplicate->end(),nbNodes); m11->setCoords(m0->getCoords()); std::vector v(2); v[0]=m1; v[1]=m11; - MEDCouplingAutoRefCountObjectPtr newm1=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(v,tmp00,tmp11); - MEDCouplingAutoRefCountObjectPtr szOfCellGrpOfSameType(tmp00); - MEDCouplingAutoRefCountObjectPtr idInMsOfCellGrpOfSameType(tmp11); + MCAuto newm1=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(v,tmp00,tmp11); + MCAuto szOfCellGrpOfSameType(tmp00); + MCAuto idInMsOfCellGrpOfSameType(tmp11); // newm1->setName(getName()); const DataArrayInt *fam=getFamilyFieldAtLevel(-1); if(!fam) throw INTERP_KERNEL::Exception("MEDFileUMesh::buildInnerBoundaryAlongM1Group : internal problem !"); - MEDCouplingAutoRefCountObjectPtr newFam=DataArrayInt::New(); + MCAuto newFam=DataArrayInt::New(); newFam->alloc(newm1->getNumberOfCells(),1); // Get a new family ID: care must be taken if we need a positive ID or a negative one: // Positive ID for family of nodes, negative for all the rest. @@ -3767,7 +3767,7 @@ void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, if(idInMsOfCellGrpOfSameType->getIJ(i,0)==0) { end=start+szOfCellGrpOfSameType->getIJ(i,0); - MEDCouplingAutoRefCountObjectPtr part=fam->selectByTupleId2(start,end,1); + MCAuto part=fam->selectByTupleIdSafeSlice(start,end,1); newFam->setPartOfValues1(part,globStart,globEnd,1,0,1,1,true); start=end; } @@ -3812,27 +3812,27 @@ bool MEDFileUMesh::unPolyze(std::vector& oldCode, std::vector& newCode std::vector levs=getNonEmptyLevels(); bool ret=false; std::vector< const DataArrayInt* > renumCellsSplited;//same than memorySaverIfThrow - std::vector< MEDCouplingAutoRefCountObjectPtr > memorySaverIfThrow;//same than renumCellsSplited only in case of throw + std::vector< MCAuto > memorySaverIfThrow;//same than renumCellsSplited only in case of throw int start=0; int end=0; for(std::vector::reverse_iterator it=levs.rbegin();it!=levs.rend();it++) { - MEDCouplingAutoRefCountObjectPtr m=getMeshAtLevel(*it); + MCAuto m=getMeshAtLevel(*it); std::vector code1=m->getDistributionOfTypes(); end=PutInThirdComponentOfCodeOffset(code1,start); oldCode.insert(oldCode.end(),code1.begin(),code1.end()); bool hasChanged=m->unPolyze(); DataArrayInt *fake=0; - MEDCouplingAutoRefCountObjectPtr o2nCellsPart=m->getLevArrPerCellTypes(MEDCouplingUMesh::MEDMEM_ORDER, + MCAuto o2nCellsPart=m->getLevArrPerCellTypes(MEDCouplingUMesh::MEDMEM_ORDER, MEDCouplingUMesh::MEDMEM_ORDER+MEDCouplingUMesh::N_MEDMEM_ORDER,fake); fake->decrRef(); renumCellsSplited.push_back(o2nCellsPart); memorySaverIfThrow.push_back(o2nCellsPart); if(hasChanged) { - MEDCouplingAutoRefCountObjectPtr o2nCellsPart2=o2nCellsPart->buildPermArrPerLevel(); + MCAuto o2nCellsPart2=o2nCellsPart->buildPermArrPerLevel(); m->renumberCells(o2nCellsPart2->getConstPointer(),false); ret=true; - MEDCouplingAutoRefCountObjectPtr famField2,numField2; + MCAuto famField2,numField2; const DataArrayInt *famField=getFamilyFieldAtLevel(*it); if(famField) { famField->incrRef(); famField2=const_cast(famField); } const DataArrayInt *numField=getNumberFieldAtLevel(*it); if(numField) { numField->incrRef(); numField2=const_cast(numField); } setMeshAtLevel(*it,m); @@ -3840,16 +3840,16 @@ bool MEDFileUMesh::unPolyze(std::vector& oldCode, std::vector& newCode end=PutInThirdComponentOfCodeOffset(code2,start); newCode.insert(newCode.end(),code2.begin(),code2.end()); // - if(o2nCellsPart2->isIdentity2(o2nCellsPart2->getNumberOfTuples())) + if(o2nCellsPart2->isIota(o2nCellsPart2->getNumberOfTuples())) continue; if(famField) { - MEDCouplingAutoRefCountObjectPtr newFamField=famField->renumber(o2nCellsPart2->getConstPointer()); + MCAuto newFamField=famField->renumber(o2nCellsPart2->getConstPointer()); setFamilyFieldArr(*it,newFamField); } if(numField) { - MEDCouplingAutoRefCountObjectPtr newNumField=numField->renumber(o2nCellsPart2->getConstPointer()); + MCAuto newNumField=numField->renumber(o2nCellsPart2->getConstPointer()); setRenumFieldArr(*it,newNumField); } } @@ -3861,8 +3861,8 @@ bool MEDFileUMesh::unPolyze(std::vector& oldCode, std::vector& newCode } if(ret) { - MEDCouplingAutoRefCountObjectPtr renumCells=DataArrayInt::Aggregate(renumCellsSplited); - MEDCouplingAutoRefCountObjectPtr o2nRenumCellRet=renumCells->buildPermArrPerLevel(); + MCAuto renumCells=DataArrayInt::Aggregate(renumCellsSplited); + MCAuto o2nRenumCellRet=renumCells->buildPermArrPerLevel(); o2nRenumCell=o2nRenumCellRet.retn(); } return ret; @@ -3908,28 +3908,28 @@ DataArrayInt *MEDFileUMesh::zipCoords() } else { - MEDCouplingAutoRefCountObjectPtr mesh(zeLev->getWholeMesh(false)); + MCAuto mesh(zeLev->getWholeMesh(false)); mesh->computeNodeIdsAlg(nodeIdsInUse); } } int nbrOfNodesInUse((int)std::count(nodeIdsInUse.begin(),nodeIdsInUse.end(),true)); if(nbrOfNodesInUse==nbOfNodes) return 0;//no need to update _part_coords - MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); ret->alloc(nbOfNodes,1); + MCAuto ret(DataArrayInt::New()); ret->alloc(nbOfNodes,1); std::transform(nodeIdsInUse.begin(),nodeIdsInUse.end(),ret->getPointer(),MEDLoaderAccVisit1()); - MEDCouplingAutoRefCountObjectPtr ret2(ret->invertArrayO2N2N2OBis(nbrOfNodesInUse)); - MEDCouplingAutoRefCountObjectPtr newCoords(coo->selectByTupleIdSafe(ret2->begin(),ret2->end())); - MEDCouplingAutoRefCountObjectPtr newFamCoords; - MEDCouplingAutoRefCountObjectPtr newNameCoords; + MCAuto ret2(ret->invertArrayO2N2N2OBis(nbrOfNodesInUse)); + MCAuto newCoords(coo->selectByTupleIdSafe(ret2->begin(),ret2->end())); + MCAuto newFamCoords; + MCAuto newNameCoords; if((const DataArrayInt *)_fam_coords) newFamCoords=_fam_coords->selectByTupleIdSafe(ret2->begin(),ret2->end()); - MEDCouplingAutoRefCountObjectPtr newNumCoords; + MCAuto newNumCoords; if((const DataArrayInt *)_num_coords) newNumCoords=_num_coords->selectByTupleIdSafe(ret2->begin(),ret2->end()); if((const DataArrayAsciiChar *)_name_coords) newNameCoords=static_cast(_name_coords->selectByTupleIdSafe(ret2->begin(),ret2->end())); _coords=newCoords; _fam_coords=newFamCoords; _num_coords=newNumCoords; _name_coords=newNameCoords; _rev_num_coords=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_ms.begin();it!=_ms.end();it++) + for(std::vector< MCAuto >::iterator it=_ms.begin();it!=_ms.end();it++) { if((MEDFileUMeshSplitL1*)*it) { @@ -3941,7 +3941,7 @@ DataArrayInt *MEDFileUMesh::zipCoords() const PartDefinition *pc(_part_coords); if(pc) { - MEDCouplingAutoRefCountObjectPtr tmpPD(DataArrayPartDefinition::New(ret2)); + MCAuto tmpPD(DataArrayPartDefinition::New(ret2)); _part_coords=tmpPD->composeWith(pc); } return ret.retn(); @@ -3966,32 +3966,32 @@ MEDFileUMesh *MEDFileUMesh::buildExtrudedMesh(const MEDCouplingUMesh *m1D, int p checkCartesian(); if(getMeshDimension()!=2) throw INTERP_KERNEL::Exception("MEDFileUMesh::buildExtrudedMesh : this is expected to be with mesh dimension equal to 2 !"); - MEDCouplingAutoRefCountObjectPtr ret(MEDFileUMesh::New()); - m1D->checkCoherency(); + MCAuto ret(MEDFileUMesh::New()); + m1D->checkConsistencyLight(); if(m1D->getMeshDimension()!=1) throw INTERP_KERNEL::Exception("MEDFileUMesh::buildExtrudedMesh : input mesh must have a mesh dimension equal to one !"); int nbRep(m1D->getNumberOfCells()); std::vector levs(getNonEmptyLevels()); std::vector grps(getGroupsNames()); - std::vector< MEDCouplingAutoRefCountObjectPtr > zeList; + std::vector< MCAuto > zeList; DataArrayDouble *coords(0); std::size_t nbOfLevsOut(levs.size()+1); - std::vector< MEDCouplingAutoRefCountObjectPtr > o2ns(nbOfLevsOut); + std::vector< MCAuto > o2ns(nbOfLevsOut); for(std::vector::const_iterator lev=levs.begin();lev!=levs.end();lev++) { - MEDCouplingAutoRefCountObjectPtr item(getMeshAtLevel(*lev)); + MCAuto item(getMeshAtLevel(*lev)); item=item->clone(false); item->changeSpaceDimension(3+(*lev),0.);//no problem non const but change DataArrayDouble for coordinates do not alter data - MEDCouplingAutoRefCountObjectPtr tmp(static_cast(m1D->deepCpy())); + MCAuto tmp(static_cast(m1D->deepCopy())); tmp->changeSpaceDimension(3+(*lev),0.); - MEDCouplingAutoRefCountObjectPtr elt(item->buildExtrudedMesh(tmp,policy)); + MCAuto elt(item->buildExtrudedMesh(tmp,policy)); zeList.push_back(elt); if(*lev==0) coords=elt->getCoords(); } if(!coords) throw INTERP_KERNEL::Exception("MEDFileUMesh::buildExtrudedMesh : internal error !"); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=zeList.begin();it!=zeList.end();it++) + for(std::vector< MCAuto >::iterator it=zeList.begin();it!=zeList.end();it++) { (*it)->setName(getName()); (*it)->setCoords(coords); @@ -3999,12 +3999,12 @@ MEDFileUMesh *MEDFileUMesh::buildExtrudedMesh(const MEDCouplingUMesh *m1D, int p for(std::size_t ii=0;ii!=zeList.size();ii++) { int lev(levs[ii]); - MEDCouplingAutoRefCountObjectPtr elt(zeList[ii]); + MCAuto elt(zeList[ii]); if(lev<=-1) { - MEDCouplingAutoRefCountObjectPtr elt1(getMeshAtLevel(lev+1)); - MEDCouplingAutoRefCountObjectPtr elt2(elt1->clone(false)); - MEDCouplingAutoRefCountObjectPtr tmp(elt2->getNodalConnectivity()->deepCpy()); + MCAuto elt1(getMeshAtLevel(lev+1)); + MCAuto elt2(elt1->clone(false)); + MCAuto tmp(elt2->getNodalConnectivity()->deepCopy()); elt2->setConnectivity(tmp,elt2->getNodalConnectivityIndex()); elt2->shiftNodeNumbersInConn(nbRep*elt1->getNumberOfNodes()); elt1->setCoords(elt->getCoords()); elt2->setCoords(elt->getCoords()); @@ -4017,9 +4017,9 @@ MEDFileUMesh *MEDFileUMesh::buildExtrudedMesh(const MEDCouplingUMesh *m1D, int p o2ns[ii]=elt->sortCellsInMEDFileFrmt(); ret->setMeshAtLevel(lev,elt); } - MEDCouplingAutoRefCountObjectPtr endLev(getMeshAtLevel(levs.back())),endLev2; + MCAuto endLev(getMeshAtLevel(levs.back())),endLev2; endLev=endLev->clone(false); endLev->setCoords(coords); - MEDCouplingAutoRefCountObjectPtr tmp(endLev->getNodalConnectivity()->deepCpy()); + MCAuto tmp(endLev->getNodalConnectivity()->deepCopy()); endLev2=endLev->clone(false); endLev2->setConnectivity(tmp,endLev->getNodalConnectivityIndex()); endLev2->shiftNodeNumbersInConn(nbRep*getNumberOfNodes()); endLev=MEDCouplingUMesh::MergeUMeshesOnSameCoords(endLev,endLev2); @@ -4030,16 +4030,16 @@ MEDFileUMesh *MEDFileUMesh::buildExtrudedMesh(const MEDCouplingUMesh *m1D, int p for(std::size_t ii=0;ii!=zeList.size();ii++) { int lev(levs[ii]); - std::vector< MEDCouplingAutoRefCountObjectPtr > outGrps; + std::vector< MCAuto > outGrps; std::vector< const DataArrayInt * > outGrps2; if(lev<=-1) { for(std::vector::const_iterator grp=grps.begin();grp!=grps.end();grp++) { - MEDCouplingAutoRefCountObjectPtr grpArr(getGroupArr(lev+1,*grp)); + MCAuto grpArr(getGroupArr(lev+1,*grp)); if(!grpArr->empty()) { - MEDCouplingAutoRefCountObjectPtr grpArr1(grpArr->deepCpy()),grpArr2(grpArr->deepCpy()); + MCAuto grpArr1(grpArr->deepCopy()),grpArr2(grpArr->deepCopy()); int offset0(zeList[ii]->getNumberOfCells()); int offset1(offset0+getNumberOfCellsAtLevel(lev+1)); grpArr1->applyLin(1,offset0); grpArr2->applyLin(1,offset1); @@ -4055,18 +4055,18 @@ MEDFileUMesh *MEDFileUMesh::buildExtrudedMesh(const MEDCouplingUMesh *m1D, int p // for(std::vector::const_iterator grp=grps.begin();grp!=grps.end();grp++) { - MEDCouplingAutoRefCountObjectPtr grpArr(getGroupArr(lev,*grp)); + MCAuto grpArr(getGroupArr(lev,*grp)); if(!grpArr->empty()) { int nbCellsB4Extrusion(getNumberOfCellsAtLevel(lev)); - std::vector< MEDCouplingAutoRefCountObjectPtr > grpArrs(nbRep); + std::vector< MCAuto > grpArrs(nbRep); std::vector< const DataArrayInt *> grpArrs2(nbRep); for(int iii=0;iiideepCpy(); grpArrs[iii]->applyLin(1,iii*nbCellsB4Extrusion); + grpArrs[iii]=grpArr->deepCopy(); grpArrs[iii]->applyLin(1,iii*nbCellsB4Extrusion); grpArrs2[iii]=grpArrs[iii]; } - MEDCouplingAutoRefCountObjectPtr grpArrExt(DataArrayInt::Aggregate(grpArrs2)); + MCAuto grpArrExt(DataArrayInt::Aggregate(grpArrs2)); grpArrExt->transformWithIndArr(o2ns[ii]->begin(),o2ns[ii]->end()); std::ostringstream grpName; grpName << *grp << "_extruded"; grpArrExt->setName(grpName.str()); @@ -4076,14 +4076,14 @@ MEDFileUMesh *MEDFileUMesh::buildExtrudedMesh(const MEDCouplingUMesh *m1D, int p } ret->setGroupsAtLevel(lev,outGrps2); } - std::vector< MEDCouplingAutoRefCountObjectPtr > outGrps; + std::vector< MCAuto > outGrps; std::vector< const DataArrayInt * > outGrps2; for(std::vector::const_iterator grp=grps.begin();grp!=grps.end();grp++) { - MEDCouplingAutoRefCountObjectPtr grpArr1(getGroupArr(levs.back(),*grp)); + MCAuto grpArr1(getGroupArr(levs.back(),*grp)); if(grpArr1->empty()) continue; - MEDCouplingAutoRefCountObjectPtr grpArr2(grpArr1->deepCpy()); + MCAuto grpArr2(grpArr1->deepCopy()); std::ostringstream grpName; grpName << *grp << "_top"; grpArr2->setName(grpName.str()); grpArr2->applyLin(1,getNumberOfCellsAtLevel(levs.back())); @@ -4109,12 +4109,12 @@ MEDFileUMesh *MEDFileUMesh::buildExtrudedMesh(const MEDCouplingUMesh *m1D, int p MEDFileUMesh *MEDFileUMesh::linearToQuadratic(int conversionType, double eps) const { checkCartesian(); - MEDCouplingAutoRefCountObjectPtr ret(MEDFileUMesh::New()); + MCAuto ret(MEDFileUMesh::New()); int initialNbNodes(getNumberOfNodes()); - MEDCouplingAutoRefCountObjectPtr m0Tmp(getMeshAtLevel(0)); - MEDCouplingAutoRefCountObjectPtr m0(dynamic_cast(m0Tmp->deepCpy())); + MCAuto m0Tmp(getMeshAtLevel(0)); + MCAuto m0(dynamic_cast(m0Tmp->deepCopy())); { - MEDCouplingAutoRefCountObjectPtr notUsed(m0->convertLinearCellsToQuadratic(conversionType)); + MCAuto notUsed(m0->convertLinearCellsToQuadratic(conversionType)); } DataArrayDouble *zeCoords(m0->getCoords()); ret->setMeshAtLevel(0,m0); @@ -4122,43 +4122,43 @@ MEDFileUMesh *MEDFileUMesh::linearToQuadratic(int conversionType, double eps) co const DataArrayInt *famField(getFamilyFieldAtLevel(0)); if(famField) { - MEDCouplingAutoRefCountObjectPtr famFieldCpy(famField->deepCpy()); + MCAuto famFieldCpy(famField->deepCopy()); ret->setFamilyFieldArr(0,famFieldCpy); } famField=getFamilyFieldAtLevel(1); if(famField) { - MEDCouplingAutoRefCountObjectPtr fam(DataArrayInt::New()); fam->alloc(zeCoords->getNumberOfTuples(),1); + MCAuto fam(DataArrayInt::New()); fam->alloc(zeCoords->getNumberOfTuples(),1); fam->fillWithZero(); fam->setPartOfValues1(famField,0,initialNbNodes,1,0,1,1); ret->setFamilyFieldArr(1,fam); } ret->copyFamGrpMapsFrom(*this); - MEDCouplingAutoRefCountObjectPtr partZeCoords(zeCoords->selectByTupleId2(initialNbNodes,zeCoords->getNumberOfTuples(),1)); + MCAuto partZeCoords(zeCoords->selectByTupleIdSafeSlice(initialNbNodes,zeCoords->getNumberOfTuples(),1)); for(std::vector::const_iterator lev=levs.begin();lev!=levs.end();lev++) { if(*lev==0) continue; - MEDCouplingAutoRefCountObjectPtr m1Tmp(getMeshAtLevel(*lev)); - MEDCouplingAutoRefCountObjectPtr m1(dynamic_cast(m1Tmp->deepCpy())); + MCAuto m1Tmp(getMeshAtLevel(*lev)); + MCAuto m1(dynamic_cast(m1Tmp->deepCopy())); if(m1->getMeshDimension()!=0) { { - MEDCouplingAutoRefCountObjectPtr notUsed(m1->convertLinearCellsToQuadratic(conversionType)); + MCAuto notUsed(m1->convertLinearCellsToQuadratic(conversionType)); }//kill unused notUsed var - MEDCouplingAutoRefCountObjectPtr m1Coords(m1->getCoords()->selectByTupleId2(initialNbNodes,m1->getNumberOfNodes(),1)); + MCAuto m1Coords(m1->getCoords()->selectByTupleIdSafeSlice(initialNbNodes,m1->getNumberOfNodes(),1)); DataArrayInt *b(0); bool a(partZeCoords->areIncludedInMe(m1Coords,eps,b)); - MEDCouplingAutoRefCountObjectPtr bSafe(b); + MCAuto bSafe(b); if(!a) { std::ostringstream oss; oss << "MEDFileUMesh::linearCellsToQuadratic : for level " << *lev << " problem to identify nodes generated !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } b->applyLin(1,initialNbNodes); - MEDCouplingAutoRefCountObjectPtr l0(DataArrayInt::New()); l0->alloc(initialNbNodes,1); l0->iota(); + MCAuto l0(DataArrayInt::New()); l0->alloc(initialNbNodes,1); l0->iota(); std::vector v(2); v[0]=l0; v[1]=b; - MEDCouplingAutoRefCountObjectPtr renum(DataArrayInt::Aggregate(v)); + MCAuto renum(DataArrayInt::Aggregate(v)); m1->renumberNodesInConn(renum->begin()); } m1->setCoords(zeCoords); @@ -4166,7 +4166,7 @@ MEDFileUMesh *MEDFileUMesh::linearToQuadratic(int conversionType, double eps) co famField=getFamilyFieldAtLevel(*lev); if(famField) { - MEDCouplingAutoRefCountObjectPtr famFieldCpy(famField->deepCpy()); + MCAuto famFieldCpy(famField->deepCopy()); ret->setFamilyFieldArr(*lev,famFieldCpy); } } @@ -4186,9 +4186,9 @@ MEDFileUMesh *MEDFileUMesh::linearToQuadratic(int conversionType, double eps) co MEDFileUMesh *MEDFileUMesh::quadraticToLinear(double eps) const { checkCartesian(); - MEDCouplingAutoRefCountObjectPtr ret(MEDFileUMesh::New()); - MEDCouplingAutoRefCountObjectPtr m0Tmp(getMeshAtLevel(0)); - MEDCouplingAutoRefCountObjectPtr m0(dynamic_cast(m0Tmp->deepCpy())); + MCAuto ret(MEDFileUMesh::New()); + MCAuto m0Tmp(getMeshAtLevel(0)); + MCAuto m0(dynamic_cast(m0Tmp->deepCopy())); m0->convertQuadraticCellsToLinear(); m0->zipCoords(); DataArrayDouble *zeCoords(m0->getCoords()); @@ -4197,13 +4197,13 @@ MEDFileUMesh *MEDFileUMesh::quadraticToLinear(double eps) const const DataArrayInt *famField(getFamilyFieldAtLevel(0)); if(famField) { - MEDCouplingAutoRefCountObjectPtr famFieldCpy(famField->deepCpy()); + MCAuto famFieldCpy(famField->deepCopy()); ret->setFamilyFieldArr(0,famFieldCpy); } famField=getFamilyFieldAtLevel(1); if(famField) { - MEDCouplingAutoRefCountObjectPtr fam(famField->selectByTupleId2(0,zeCoords->getNumberOfTuples(),1)); + MCAuto fam(famField->selectByTupleIdSafeSlice(0,zeCoords->getNumberOfTuples(),1)); ret->setFamilyFieldArr(1,fam); } ret->copyFamGrpMapsFrom(*this); @@ -4211,13 +4211,13 @@ MEDFileUMesh *MEDFileUMesh::quadraticToLinear(double eps) const { if(*lev==0) continue; - MEDCouplingAutoRefCountObjectPtr m1Tmp(getMeshAtLevel(*lev)); - MEDCouplingAutoRefCountObjectPtr m1(dynamic_cast(m1Tmp->deepCpy())); + MCAuto m1Tmp(getMeshAtLevel(*lev)); + MCAuto m1(dynamic_cast(m1Tmp->deepCopy())); m1->convertQuadraticCellsToLinear(); m1->zipCoords(); DataArrayInt *b(0); bool a(zeCoords->areIncludedInMe(m1->getCoords(),eps,b)); - MEDCouplingAutoRefCountObjectPtr bSafe(b); + MCAuto bSafe(b); if(!a) { std::ostringstream oss; oss << "MEDFileUMesh::quadraticToLinear : for level " << *lev << " problem to identify nodes generated !"; @@ -4229,20 +4229,20 @@ MEDFileUMesh *MEDFileUMesh::quadraticToLinear(double eps) const famField=getFamilyFieldAtLevel(*lev); if(famField) { - MEDCouplingAutoRefCountObjectPtr famFieldCpy(famField->deepCpy()); + MCAuto famFieldCpy(famField->deepCopy()); ret->setFamilyFieldArr(*lev,famFieldCpy); } } return ret.retn(); } -void MEDFileUMesh::serialize(std::vector& tinyDouble, std::vector& tinyInt, std::vector& tinyStr, std::vector< MEDCouplingAutoRefCountObjectPtr >& bigArraysI, MEDCouplingAutoRefCountObjectPtr& bigArrayD) +void MEDFileUMesh::serialize(std::vector& tinyDouble, std::vector& tinyInt, std::vector& tinyStr, std::vector< MCAuto >& bigArraysI, MCAuto& bigArrayD) { clearNonDiscrAttributes(); forceComputationOfParts(); tinyDouble.clear(); tinyInt.clear(); tinyStr.clear(); bigArraysI.clear(); bigArrayD=0; std::vector layer0; - layer0.push_back(getAxType());//0 i + layer0.push_back(getAxisType());//0 i layer0.push_back(_order); //1 i layer0.push_back(_iteration);//2 i layer0.push_back(getSpaceDimension());//3 i @@ -4297,7 +4297,7 @@ void MEDFileUMesh::serialize(std::vector& tinyDouble, std::vector& } void MEDFileUMesh::unserialize(std::vector& tinyDouble, std::vector& tinyInt, std::vector& tinyStr, - std::vector< MEDCouplingAutoRefCountObjectPtr >& bigArraysI, MEDCouplingAutoRefCountObjectPtr& bigArrayD) + std::vector< MCAuto >& bigArraysI, MCAuto& bigArrayD) { int sz0(tinyInt[0]); std::vector layer0(tinyInt.begin()+1,tinyInt.begin()+1+sz0); @@ -4310,7 +4310,7 @@ void MEDFileUMesh::unserialize(std::vector& tinyDouble, std::vector std::reverse(tinyStr.begin(),tinyStr.end()); std::reverse(bigArraysI.begin(),bigArraysI.end()); // - setAxType((MEDCouplingAxisType)layer0.back()); layer0.pop_back(); + setAxisType((MEDCouplingAxisType)layer0.back()); layer0.pop_back(); _order=layer0.back(); layer0.pop_back(); _iteration=layer0.back(); layer0.pop_back(); int spaceDim(layer0.back()); layer0.pop_back(); @@ -4466,7 +4466,7 @@ void MEDFileUMesh::removeMeshAtLevel(int meshDimRelToMax) */ void MEDFileUMesh::setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m) { - MEDCouplingAutoRefCountObjectPtr elt(new MEDFileUMeshSplitL1(m)); + MCAuto elt(new MEDFileUMeshSplitL1(m)); checkAndGiveEntryInSplitL1(meshDimRelToMax,m)=elt; } @@ -4485,11 +4485,11 @@ void MEDFileUMesh::setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m) */ void MEDFileUMesh::setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld) { - MEDCouplingAutoRefCountObjectPtr elt(new MEDFileUMeshSplitL1(m,newOrOld)); + MCAuto elt(new MEDFileUMeshSplitL1(m,newOrOld)); checkAndGiveEntryInSplitL1(meshDimRelToMax,m)=elt; } -MEDCouplingAutoRefCountObjectPtr& MEDFileUMesh::checkAndGiveEntryInSplitL1(int meshDimRelToMax, MEDCouplingPointSet *m) +MCAuto& MEDFileUMesh::checkAndGiveEntryInSplitL1(int meshDimRelToMax, MEDCouplingPointSet *m) { dealWithTinyInfo(m); std::vector levSet=getNonEmptyLevels(); @@ -4570,7 +4570,7 @@ void MEDFileUMesh::setMeshes(const std::vector& ms, bo * \throw If the meshes in \a ms do not share the same node coordinates array. * \throw If the node coordinates array of \a this mesh (if any) is not the same as that * of the given meshes. - * \throw If \a ms[ i ] is not well defined (MEDCouplingUMesh::checkCoherency()). + * \throw If \a ms[ i ] is not well defined (MEDCouplingUMesh::checkConsistencyLight()). * \throw If names of some meshes in \a ms are equal. * \throw If \a ms includes a mesh with an empty name. */ @@ -4592,8 +4592,8 @@ void MEDFileUMesh::setGroupsFromScratch(int meshDimRelToMax, const std::vector corr; - MEDCouplingAutoRefCountObjectPtr m=MEDCouplingUMesh::FuseUMeshesOnSameCoords(ms,_zipconn_pol,corr); - std::vector< MEDCouplingAutoRefCountObjectPtr > corr3(corr.begin(),corr.end()); + MCAuto m=MEDCouplingUMesh::FuseUMeshesOnSameCoords(ms,_zipconn_pol,corr); + std::vector< MCAuto > corr3(corr.begin(),corr.end()); setMeshAtLevel(meshDimRelToMax,m,renum); std::vector corr2(corr.begin(),corr.end()); setGroupsAtLevel(meshDimRelToMax,corr2,true); @@ -4614,7 +4614,7 @@ void MEDFileUMesh::setGroupsFromScratch(int meshDimRelToMax, const std::vector > corr(ms.size()); + std::vector< MCAuto > corr(ms.size()); int i=0; for(std::vector::const_iterator it=ms.begin();it!=ms.end();it++,i++) { @@ -4659,7 +4659,7 @@ DataArrayDouble *MEDFileUMesh::checkMultiMesh(const std::vectorgetMeshDimension(); for(unsigned int i=1;icheckCoherency(); + ms[i]->checkConsistencyLight(); if(ms[i]->getCoords()!=ret) throw INTERP_KERNEL::Exception("MEDFileUMesh::checkMultiMesh : meshes must share the same coords !"); if(ms[i]->getMeshDimension()!=mdim) @@ -4775,7 +4775,7 @@ void MEDFileUMesh::setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiCha void MEDFileUMesh::synchronizeTinyInfoOnLeaves() const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_ms.begin();it!=_ms.end();it++) + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) if((const MEDFileUMeshSplitL1 *)(*it)) (*it)->synchronizeTinyInfo(*this); } @@ -4788,7 +4788,7 @@ void MEDFileUMesh::changeFamilyIdArr(int oldId, int newId) DataArrayInt *arr=_fam_coords; if(arr) arr->changeValue(oldId,newId); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_ms.begin();it!=_ms.end();it++) + for(std::vector< MCAuto >::iterator it=_ms.begin();it!=_ms.end();it++) { MEDFileUMeshSplitL1 *sp=(*it); if(sp) @@ -4798,20 +4798,20 @@ void MEDFileUMesh::changeFamilyIdArr(int oldId, int newId) } } -std::list< MEDCouplingAutoRefCountObjectPtr > MEDFileUMesh::getAllNonNullFamilyIds() const +std::list< MCAuto > MEDFileUMesh::getAllNonNullFamilyIds() const { - std::list< MEDCouplingAutoRefCountObjectPtr > ret; + std::list< MCAuto > ret; const DataArrayInt *da(_fam_coords); if(da) - { da->incrRef(); ret.push_back(MEDCouplingAutoRefCountObjectPtr(const_cast(da))); } - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_ms.begin();it!=_ms.end();it++) + { da->incrRef(); ret.push_back(MCAuto(const_cast(da))); } + for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) { const MEDFileUMeshSplitL1 *elt(*it); if(elt) { da=elt->getFamilyField(); if(da) - { da->incrRef(); ret.push_back(MEDCouplingAutoRefCountObjectPtr(const_cast(da))); } + { da->incrRef(); ret.push_back(MCAuto(const_cast(da))); } } } return ret; @@ -5114,11 +5114,11 @@ DataArrayInt *MEDFileStructuredMesh::getFamiliesArr(int meshDimRelToMaxExt, cons { if((const DataArrayInt *)_fam_nodes) { - MEDCouplingAutoRefCountObjectPtr da; + MCAuto da; if(!famIds.empty()) - da=_fam_nodes->getIdsEqualList(&famIds[0],&famIds[0]+famIds.size()); + da=_fam_nodes->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size()); else - da=_fam_nodes->getIdsEqualList(0,0); + da=_fam_nodes->findIdsEqualList(0,0); if(renum) return MEDFileUMeshSplitL1::Renumber(_num_nodes,da); else @@ -5132,11 +5132,11 @@ DataArrayInt *MEDFileStructuredMesh::getFamiliesArr(int meshDimRelToMaxExt, cons { if((const DataArrayInt *)_fam_cells) { - MEDCouplingAutoRefCountObjectPtr da; + MCAuto da; if(!famIds.empty()) - da=_fam_cells->getIdsEqualList(&famIds[0],&famIds[0]+famIds.size()); + da=_fam_cells->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size()); else - da=_fam_cells->getIdsEqualList(0,0); + da=_fam_cells->findIdsEqualList(0,0); if(renum) return MEDFileUMeshSplitL1::Renumber(_num_cells,da); else @@ -5150,11 +5150,11 @@ DataArrayInt *MEDFileStructuredMesh::getFamiliesArr(int meshDimRelToMaxExt, cons { if((const DataArrayInt *)_fam_faces) { - MEDCouplingAutoRefCountObjectPtr da; + MCAuto da; if(!famIds.empty()) - da=_fam_faces->getIdsEqualList(&famIds[0],&famIds[0]+famIds.size()); + da=_fam_faces->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size()); else - da=_fam_faces->getIdsEqualList(0,0); + da=_fam_faces->findIdsEqualList(0,0); if(renum) return MEDFileUMeshSplitL1::Renumber(_num_faces,da); else @@ -5550,45 +5550,45 @@ void MEDFileStructuredMesh::changeFamilyIdArr(int oldId, int newId) arr->changeValue(oldId,newId); } -std::list< MEDCouplingAutoRefCountObjectPtr > MEDFileStructuredMesh::getAllNonNullFamilyIds() const +std::list< MCAuto > MEDFileStructuredMesh::getAllNonNullFamilyIds() const { - std::list< MEDCouplingAutoRefCountObjectPtr > ret; + std::list< MCAuto > ret; const DataArrayInt *da(_fam_nodes); if(da) - { da->incrRef(); ret.push_back(MEDCouplingAutoRefCountObjectPtr(const_cast(da))); } + { da->incrRef(); ret.push_back(MCAuto(const_cast(da))); } da=_fam_cells; if(da) - { da->incrRef(); ret.push_back(MEDCouplingAutoRefCountObjectPtr(const_cast(da))); } + { da->incrRef(); ret.push_back(MCAuto(const_cast(da))); } da=_fam_faces; if(da) - { da->incrRef(); ret.push_back(MEDCouplingAutoRefCountObjectPtr(const_cast(da))); } + { da->incrRef(); ret.push_back(MCAuto(const_cast(da))); } return ret; } void MEDFileStructuredMesh::deepCpyAttributes() { if((const DataArrayInt*)_fam_nodes) - _fam_nodes=_fam_nodes->deepCpy(); + _fam_nodes=_fam_nodes->deepCopy(); if((const DataArrayInt*)_num_nodes) - _num_nodes=_num_nodes->deepCpy(); + _num_nodes=_num_nodes->deepCopy(); if((const DataArrayAsciiChar*)_names_nodes) - _names_nodes=_names_nodes->deepCpy(); + _names_nodes=_names_nodes->deepCopy(); if((const DataArrayInt*)_fam_cells) - _fam_cells=_fam_cells->deepCpy(); + _fam_cells=_fam_cells->deepCopy(); if((const DataArrayInt*)_num_cells) - _num_cells=_num_cells->deepCpy(); + _num_cells=_num_cells->deepCopy(); if((const DataArrayAsciiChar*)_names_cells) - _names_cells=_names_cells->deepCpy(); + _names_cells=_names_cells->deepCopy(); if((const DataArrayInt*)_fam_faces) - _fam_faces=_fam_faces->deepCpy(); + _fam_faces=_fam_faces->deepCopy(); if((const DataArrayInt*)_num_faces) - _num_faces=_num_faces->deepCpy(); + _num_faces=_num_faces->deepCopy(); if((const DataArrayAsciiChar*)_names_faces) - _names_faces=_names_faces->deepCpy(); + _names_faces=_names_faces->deepCopy(); if((const DataArrayInt*)_rev_num_nodes) - _rev_num_nodes=_rev_num_nodes->deepCpy(); + _rev_num_nodes=_rev_num_nodes->deepCopy(); if((const DataArrayInt*)_rev_num_cells) - _rev_num_cells=_rev_num_cells->deepCpy(); + _rev_num_cells=_rev_num_cells->deepCopy(); } /*! @@ -5830,7 +5830,7 @@ med_geometry_type MEDFileStructuredMesh::GetGeoTypeFromMeshDim(int meshDim) } void MEDFileStructuredMesh::LoadStrMeshDAFromFile(med_idt fid, int meshDim, int dt, int it, const std::string& mName, MEDFileMeshReadSelector *mrs, - MEDCouplingAutoRefCountObjectPtr& famCells, MEDCouplingAutoRefCountObjectPtr& numCells, MEDCouplingAutoRefCountObjectPtr& namesCells) + MCAuto& famCells, MCAuto& numCells, MCAuto& namesCells) { med_bool chgt=MED_FALSE,trsf=MED_FALSE; med_geometry_type geoTypeReq=MEDFileStructuredMesh::GetGeoTypeFromMeshDim(meshDim); @@ -6087,7 +6087,7 @@ std::string MEDFileCMesh::advancedRepr() const MEDFileMesh *MEDFileCMesh::shallowCpy() const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileCMesh(*this)); + MCAuto ret(new MEDFileCMesh(*this)); return ret.retn(); } @@ -6096,12 +6096,12 @@ MEDFileMesh *MEDFileCMesh::createNewEmpty() const return new MEDFileCMesh; } -MEDFileMesh *MEDFileCMesh::deepCpy() const +MEDFileMesh *MEDFileCMesh::deepCopy() const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileCMesh(*this)); + MCAuto ret(new MEDFileCMesh(*this)); ret->deepCpyEquivalences(*this); if((const MEDCouplingCMesh*)_cmesh) - ret->_cmesh=static_cast(_cmesh->deepCpy()); + ret->_cmesh=static_cast(_cmesh->deepCopy()); ret->deepCpyAttributes(); return ret.retn(); } @@ -6181,7 +6181,7 @@ void MEDFileCMesh::loadLL(med_idt fid, const std::string& mName, int dt, int it, } MEDFileCMeshL2 loaderl2; loaderl2.loadAll(fid,mid,mName,dt,it); - setAxType(axType); + setAxisType(axType); MEDCouplingCMesh *mesh=loaderl2.getMesh(); mesh->incrRef(); _cmesh=mesh; @@ -6220,7 +6220,7 @@ void MEDFileCMesh::setMesh(MEDCouplingCMesh *m) MEDFileMesh *MEDFileCMesh::cartesianize() const { - if(getAxType()==AX_CART) + if(getAxisType()==AX_CART) { incrRef(); return const_cast(this); @@ -6230,13 +6230,13 @@ MEDFileMesh *MEDFileCMesh::cartesianize() const const MEDCouplingCMesh *cmesh(getMesh()); if(!cmesh) throw INTERP_KERNEL::Exception("MEDFileCMesh::cartesianize : impossible to turn into cartesian because the mesh is null !"); - MEDCouplingAutoRefCountObjectPtr clmesh(cmesh->buildCurveLinear()); - MEDCouplingAutoRefCountObjectPtr coords(clmesh->getCoords()->cartesianize(getAxType())); + MCAuto clmesh(cmesh->buildCurveLinear()); + MCAuto coords(clmesh->getCoords()->cartesianize(getAxisType())); clmesh->setCoords(coords); - MEDCouplingAutoRefCountObjectPtr ret(MEDFileCurveLinearMesh::New()); + MCAuto ret(MEDFileCurveLinearMesh::New()); ret->MEDFileStructuredMesh::operator=(*this); ret->setMesh(clmesh); - ret->setAxType(AX_CART); + ret->setAxisType(AX_CART); return ret.retn(); } } @@ -6260,10 +6260,10 @@ void MEDFileCMesh::writeLL(med_idt fid) const MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE-1,comp+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo MEDLoaderBase::safeStrCpy2(u.c_str(),MED_SNAME_SIZE-1,unit+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo } - MEDFILESAFECALLERWR0(MEDmeshCr,(fid,maa,spaceDim,spaceDim,MED_STRUCTURED_MESH,desc,dtunit,MED_SORT_DTIT,MEDFileMeshL2::TraduceAxisTypeRev(getAxType()),comp,unit)); + MEDFILESAFECALLERWR0(MEDmeshCr,(fid,maa,spaceDim,spaceDim,MED_STRUCTURED_MESH,desc,dtunit,MED_SORT_DTIT,MEDFileMeshL2::TraduceAxisTypeRev(getAxisType()),comp,unit)); if(_univ_wr_status) MEDFILESAFECALLERWR0(MEDmeshUniversalNameWr,(fid,maa)); - MEDFILESAFECALLERWR0(MEDmeshGridTypeWr,(fid,maa,MEDFileMeshL2::TraduceAxisTypeRevStruct(getAxType()))); + MEDFILESAFECALLERWR0(MEDmeshGridTypeWr,(fid,maa,MEDFileMeshL2::TraduceAxisTypeRevStruct(getAxisType()))); for(int i=0;igetCoordsAt(i); @@ -6329,7 +6329,7 @@ std::vector MEDFileCurveLinearMesh::getDirectChildrenWi MEDFileMesh *MEDFileCurveLinearMesh::shallowCpy() const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileCurveLinearMesh(*this)); + MCAuto ret(new MEDFileCurveLinearMesh(*this)); return ret.retn(); } @@ -6338,12 +6338,12 @@ MEDFileMesh *MEDFileCurveLinearMesh::createNewEmpty() const return new MEDFileCurveLinearMesh; } -MEDFileMesh *MEDFileCurveLinearMesh::deepCpy() const +MEDFileMesh *MEDFileCurveLinearMesh::deepCopy() const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileCurveLinearMesh(*this)); + MCAuto ret(new MEDFileCurveLinearMesh(*this)); ret->deepCpyEquivalences(*this); if((const MEDCouplingCurveLinearMesh*)_clmesh) - ret->_clmesh=static_cast(_clmesh->deepCpy()); + ret->_clmesh=static_cast(_clmesh->deepCopy()); ret->deepCpyAttributes(); return ret.retn(); } @@ -6429,7 +6429,7 @@ void MEDFileCurveLinearMesh::setMesh(MEDCouplingCurveLinearMesh *m) MEDFileMesh *MEDFileCurveLinearMesh::cartesianize() const { - if(getAxType()==AX_CART) + if(getAxisType()==AX_CART) { incrRef(); return const_cast(this); @@ -6442,12 +6442,12 @@ MEDFileMesh *MEDFileCurveLinearMesh::cartesianize() const const DataArrayDouble *coords(mesh->getCoords()); if(!coords) throw INTERP_KERNEL::Exception("MEDFileCurveLinearMesh::cartesianize : coordinate pointer in mesh is null !"); - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileCurveLinearMesh(*this)); - MEDCouplingAutoRefCountObjectPtr mesh2(mesh->clone(false)); - MEDCouplingAutoRefCountObjectPtr coordsCart(coords->cartesianize(getAxType())); + MCAuto ret(new MEDFileCurveLinearMesh(*this)); + MCAuto mesh2(mesh->clone(false)); + MCAuto coordsCart(coords->cartesianize(getAxisType())); mesh2->setCoords(coordsCart); ret->setMesh(mesh2); - ret->setAxType(AX_CART); + ret->setAxisType(AX_CART); return ret.retn(); } } @@ -6495,7 +6495,7 @@ void MEDFileCurveLinearMesh::writeLL(med_idt fid) const MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE-1,comp+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo MEDLoaderBase::safeStrCpy2(u.c_str(),MED_SNAME_SIZE-1,unit+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo } - MEDFILESAFECALLERWR0(MEDmeshCr,(fid,maa,spaceDim,meshDim,MED_STRUCTURED_MESH,desc,dtunit,MED_SORT_DTIT,MEDFileMeshL2::TraduceAxisTypeRev(getAxType()),comp,unit)); + MEDFILESAFECALLERWR0(MEDmeshCr,(fid,maa,spaceDim,meshDim,MED_STRUCTURED_MESH,desc,dtunit,MED_SORT_DTIT,MEDFileMeshL2::TraduceAxisTypeRev(getAxisType()),comp,unit)); if(_univ_wr_status) MEDFILESAFECALLERWR0(MEDmeshUniversalNameWr,(fid,maa)); MEDFILESAFECALLERWR0(MEDmeshGridTypeWr,(fid,maa,MED_CURVILINEAR_GRID)); @@ -6515,7 +6515,7 @@ void MEDFileCurveLinearMesh::loadLL(med_idt fid, const std::string& mName, int d std::string dtunit; MEDCoupling::MEDCouplingAxisType axType; int mid=MEDFileMeshL2::GetMeshIdFromName(fid,mName,meshType,axType,dummy0,dummy1,dtunit); - setAxType(axType); + setAxisType(axType); if(meshType!=CURVE_LINEAR) { std::ostringstream oss; oss << "Trying to load as curve linear an existing mesh with name '" << mName << "' that is NOT curve linear !"; @@ -6544,27 +6544,27 @@ MEDFileMeshMultiTS *MEDFileMeshMultiTS::New(const std::string& fileName, const s return new MEDFileMeshMultiTS(fileName,mName); } -MEDFileMeshMultiTS *MEDFileMeshMultiTS::deepCpy() const +MEDFileMeshMultiTS *MEDFileMeshMultiTS::deepCopy() const { - MEDCouplingAutoRefCountObjectPtr ret=MEDFileMeshMultiTS::New(); - std::vector< MEDCouplingAutoRefCountObjectPtr > meshOneTs(_mesh_one_ts.size()); + MCAuto ret=MEDFileMeshMultiTS::New(); + std::vector< MCAuto > meshOneTs(_mesh_one_ts.size()); std::size_t i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++,i++) if((const MEDFileMesh *)*it) - meshOneTs[i]=(*it)->deepCpy(); + meshOneTs[i]=(*it)->deepCopy(); ret->_mesh_one_ts=meshOneTs; return ret.retn(); } std::size_t MEDFileMeshMultiTS::getHeapMemorySizeWithoutChildren() const { - return _mesh_one_ts.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr); + return _mesh_one_ts.capacity()*sizeof(MCAuto); } std::vector MEDFileMeshMultiTS::getDirectChildrenWithNull() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++) + for(std::vector< MCAuto >::const_iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++) ret.push_back((const MEDFileMesh *)*it); return ret; } @@ -6587,7 +6587,7 @@ void MEDFileMeshMultiTS::setName(const std::string& newMeshName) bool MEDFileMeshMultiTS::changeNames(const std::vector< std::pair >& modifTab) { bool ret=false; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++) + for(std::vector< MCAuto >::iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++) { MEDFileMesh *cur(*it); if(cur) @@ -6598,12 +6598,12 @@ bool MEDFileMeshMultiTS::changeNames(const std::vector< std::pair >::iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++) + for(std::vector< MCAuto >::iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++) { MEDFileMesh *cur(*it); if(cur) { - MEDCouplingAutoRefCountObjectPtr ccur(cur->cartesianize());// Attention ! Do not wrap these two lines because memory leak ! + MCAuto ccur(cur->cartesianize());// Attention ! Do not wrap these two lines because memory leak ! *it=ccur; } } @@ -6622,7 +6622,7 @@ void MEDFileMeshMultiTS::setOneTimeStep(MEDFileMesh *mesh1TimeStep) throw INTERP_KERNEL::Exception("MEDFileMeshMultiTS::setOneTimeStep : input pointer should be different from 0 !"); _mesh_one_ts.resize(1); mesh1TimeStep->incrRef(); - //MEDCouplingAutoRefCountObjectPtr toto=mesh1TimeStep; + //MCAuto toto=mesh1TimeStep; _mesh_one_ts[0]=mesh1TimeStep; } @@ -6638,7 +6638,7 @@ MEDFileJoints * MEDFileMeshMultiTS::getJoints() const */ void MEDFileMeshMultiTS::setJoints( MEDFileJoints* joints ) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++) + for(std::vector< MCAuto >::iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++) { (*it)->setJoints( joints ); } @@ -6649,7 +6649,7 @@ void MEDFileMeshMultiTS::write(med_idt fid) const MEDFileJoints *joints(getJoints()); bool jointsWritten(false); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++) + for(std::vector< MCAuto >::const_iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++) { if ( jointsWritten ) const_cast(**it).setJoints( 0 ); @@ -6734,8 +6734,8 @@ MEDFileMeshes *MEDFileMeshes::New(const std::string& fileName) void MEDFileMeshes::write(med_idt fid) const { - checkCoherency(); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_meshes.begin();it!=_meshes.end();it++) + checkConsistencyLight(); + for(std::vector< MCAuto >::const_iterator it=_meshes.begin();it!=_meshes.end();it++) { (*it)->copyOptionsFrom(*this); (*it)->write(fid); @@ -6748,7 +6748,7 @@ void MEDFileMeshes::write(const std::string& fileName, int mode) const MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod); std::ostringstream oss; oss << "MEDFileMesh : error on attempt to write in file : \"" << fileName << "\""; MEDFileUtilities::CheckMEDCode(fid,fid,oss.str()); - checkCoherency(); + checkConsistencyLight(); write(fid); } @@ -6791,7 +6791,7 @@ std::vector MEDFileMeshes::getMeshesNames() const { std::vector ret(_meshes.size()); int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_meshes.begin();it!=_meshes.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_meshes.begin();it!=_meshes.end();it++,i++) { const MEDFileMeshMultiTS *f=(*it); if(f) @@ -6810,7 +6810,7 @@ std::vector MEDFileMeshes::getMeshesNames() const bool MEDFileMeshes::changeNames(const std::vector< std::pair >& modifTab) { bool ret=false; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_meshes.begin();it!=_meshes.end();it++) + for(std::vector< MCAuto >::iterator it=_meshes.begin();it!=_meshes.end();it++) { MEDFileMeshMultiTS *cur(*it); if(cur) @@ -6821,7 +6821,7 @@ bool MEDFileMeshes::changeNames(const std::vector< std::pair >::iterator it=_meshes.begin();it!=_meshes.end();it++) + for(std::vector< MCAuto >::iterator it=_meshes.begin();it!=_meshes.end();it++) { MEDFileMeshMultiTS *cur(*it); if(cur) @@ -6886,27 +6886,27 @@ catch(INTERP_KERNEL::Exception& /*e*/) { } -MEDFileMeshes *MEDFileMeshes::deepCpy() const +MEDFileMeshes *MEDFileMeshes::deepCopy() const { - std::vector< MEDCouplingAutoRefCountObjectPtr > meshes(_meshes.size()); + std::vector< MCAuto > meshes(_meshes.size()); std::size_t i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_meshes.begin();it!=_meshes.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_meshes.begin();it!=_meshes.end();it++,i++) if((const MEDFileMeshMultiTS *)*it) - meshes[i]=(*it)->deepCpy(); - MEDCouplingAutoRefCountObjectPtr ret=MEDFileMeshes::New(); + meshes[i]=(*it)->deepCopy(); + MCAuto ret=MEDFileMeshes::New(); ret->_meshes=meshes; return ret.retn(); } std::size_t MEDFileMeshes::getHeapMemorySizeWithoutChildren() const { - return _meshes.capacity()*(sizeof(MEDCouplingAutoRefCountObjectPtr)); + return _meshes.capacity()*(sizeof(MCAuto)); } std::vector MEDFileMeshes::getDirectChildrenWithNull() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_meshes.begin();it!=_meshes.end();it++) + for(std::vector< MCAuto >::const_iterator it=_meshes.begin();it!=_meshes.end();it++) ret.push_back((const MEDFileMeshMultiTS *)*it); return ret; } @@ -6928,12 +6928,12 @@ void MEDFileMeshes::simpleReprWithoutHeader(std::ostream& oss) const oss << " - #" << i << " \"" << mns[i] << "\"\n"; } -void MEDFileMeshes::checkCoherency() const +void MEDFileMeshes::checkConsistencyLight() const { - static const char MSG[]="MEDFileMeshes::checkCoherency : mesh at rank "; + static const char MSG[]="MEDFileMeshes::checkConsistencyLight : mesh at rank "; int i=0; std::set s; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_meshes.begin();it!=_meshes.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_meshes.begin();it!=_meshes.end();it++,i++) { const MEDFileMeshMultiTS *elt=(*it); if(!elt) diff --git a/src/MEDLoader/MEDFileMesh.hxx b/src/MEDLoader/MEDFileMesh.hxx index 77115cb49..f4676c218 100644 --- a/src/MEDLoader/MEDFileMesh.hxx +++ b/src/MEDLoader/MEDFileMesh.hxx @@ -45,7 +45,7 @@ namespace MEDCoupling MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT virtual MEDFileMesh *createNewEmpty() const = 0; - MEDLOADER_EXPORT virtual MEDFileMesh *deepCpy() const = 0; + MEDLOADER_EXPORT virtual MEDFileMesh *deepCopy() const = 0; MEDLOADER_EXPORT virtual MEDFileMesh *shallowCpy() const = 0; MEDLOADER_EXPORT virtual bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const; MEDLOADER_EXPORT virtual void clearNonDiscrAttributes() const; @@ -67,8 +67,8 @@ namespace MEDCoupling MEDLOADER_EXPORT double getTimeValue() const { return _time; } MEDLOADER_EXPORT void setTimeUnit(const std::string& unit) { _dt_unit=unit; } MEDLOADER_EXPORT std::string getTimeUnit() const { return _dt_unit; } - MEDLOADER_EXPORT void setAxType(MEDCouplingAxisType at) { _axis_type=at; } - MEDLOADER_EXPORT MEDCouplingAxisType getAxType() const { return _axis_type; } + MEDLOADER_EXPORT void setAxisType(MEDCouplingAxisType at) { _axis_type=at; } + MEDLOADER_EXPORT MEDCouplingAxisType getAxisType() const { return _axis_type; } MEDLOADER_EXPORT std::vector getAllGeoTypes() const; MEDLOADER_EXPORT virtual int getNumberOfNodes() const = 0; MEDLOADER_EXPORT virtual int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const = 0; @@ -204,7 +204,7 @@ namespace MEDCoupling void getFamilyRepr(std::ostream& oss) const; virtual void appendFamilyEntries(const DataArrayInt *famIds, const std::vector< std::vector >& fidsOfGrps, const std::vector& grpNames); virtual void changeFamilyIdArr(int oldId, int newId) = 0; - virtual std::list< MEDCouplingAutoRefCountObjectPtr > getAllNonNullFamilyIds() const = 0; + virtual std::list< MCAuto > getAllNonNullFamilyIds() const = 0; virtual void loadLL(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) = 0; void loadLLWithAdditionalItems(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); void addGroupUnderground(bool isNodeGroup, const DataArrayInt *ids, DataArrayInt *famArr); @@ -231,8 +231,8 @@ namespace MEDCoupling bool _univ_wr_status; std::string _desc_name; MEDCouplingAxisType _axis_type; - MEDCouplingAutoRefCountObjectPtr _joints; - MEDCouplingAutoRefCountObjectPtr _equiv; + MCAuto _joints; + MCAuto _equiv; protected: std::map > _groups; std::map _families; @@ -252,7 +252,7 @@ namespace MEDCoupling MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT MEDFileMesh *createNewEmpty() const; - MEDLOADER_EXPORT MEDFileMesh *deepCpy() const; + MEDLOADER_EXPORT MEDFileMesh *deepCopy() const; MEDLOADER_EXPORT MEDFileMesh *shallowCpy() const; MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const; MEDLOADER_EXPORT void clearNonDiscrAttributes() const; @@ -331,9 +331,9 @@ namespace MEDCoupling MEDLOADER_EXPORT MEDFileUMesh *quadraticToLinear(double eps=1e-12) const; // serialization MEDLOADER_EXPORT void serialize(std::vector& tinyDouble, std::vector& tinyInt, std::vector& tinyStr, - std::vector< MEDCouplingAutoRefCountObjectPtr >& bigArraysI, MEDCouplingAutoRefCountObjectPtr& bigArrayD); + std::vector< MCAuto >& bigArraysI, MCAuto& bigArrayD); MEDLOADER_EXPORT void unserialize(std::vector& tinyDouble, std::vector& tinyInt, std::vector& tinyStr, - std::vector< MEDCouplingAutoRefCountObjectPtr >& bigArraysI, MEDCouplingAutoRefCountObjectPtr& bigArrayD); + std::vector< MCAuto >& bigArraysI, MCAuto& bigArrayD); private: MEDLOADER_EXPORT ~MEDFileUMesh(); void writeLL(med_idt fid) const; @@ -349,16 +349,16 @@ namespace MEDCoupling void computeRevNum() const; void synchronizeTinyInfoOnLeaves() const; void changeFamilyIdArr(int oldId, int newId); - std::list< MEDCouplingAutoRefCountObjectPtr > getAllNonNullFamilyIds() const; - MEDCouplingAutoRefCountObjectPtr& checkAndGiveEntryInSplitL1(int meshDimRelToMax, MEDCouplingPointSet *m); + std::list< MCAuto > getAllNonNullFamilyIds() const; + MCAuto& checkAndGiveEntryInSplitL1(int meshDimRelToMax, MEDCouplingPointSet *m); private: - std::vector< MEDCouplingAutoRefCountObjectPtr > _ms; - MEDCouplingAutoRefCountObjectPtr _coords; - MEDCouplingAutoRefCountObjectPtr _fam_coords; - MEDCouplingAutoRefCountObjectPtr _num_coords; - MEDCouplingAutoRefCountObjectPtr _name_coords; - mutable MEDCouplingAutoRefCountObjectPtr _rev_num_coords; - MEDCouplingAutoRefCountObjectPtr _part_coords; + std::vector< MCAuto > _ms; + MCAuto _coords; + MCAuto _fam_coords; + MCAuto _num_coords; + MCAuto _name_coords; + mutable MCAuto _rev_num_coords; + MCAuto _part_coords; }; class MEDFileStructuredMesh : public MEDFileMesh @@ -407,7 +407,7 @@ namespace MEDCoupling protected: ~MEDFileStructuredMesh() { } void changeFamilyIdArr(int oldId, int newId); - std::list< MEDCouplingAutoRefCountObjectPtr > getAllNonNullFamilyIds() const; + std::list< MCAuto > getAllNonNullFamilyIds() const; void deepCpyAttributes(); void loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); void writeStructuredLL(med_idt fid, const std::string& maa) const; @@ -416,20 +416,20 @@ namespace MEDCoupling static med_geometry_type GetGeoTypeFromMeshDim(int meshDim); private: static void LoadStrMeshDAFromFile(med_idt fid, int meshDim, int dt, int it, const std::string& mName, MEDFileMeshReadSelector *mrs, - MEDCouplingAutoRefCountObjectPtr& famCells, MEDCouplingAutoRefCountObjectPtr& numCells, MEDCouplingAutoRefCountObjectPtr& namesCells); + MCAuto& famCells, MCAuto& numCells, MCAuto& namesCells); private: - MEDCouplingAutoRefCountObjectPtr _fam_nodes; - MEDCouplingAutoRefCountObjectPtr _num_nodes; - MEDCouplingAutoRefCountObjectPtr _names_nodes; - MEDCouplingAutoRefCountObjectPtr _fam_cells; - MEDCouplingAutoRefCountObjectPtr _num_cells; - MEDCouplingAutoRefCountObjectPtr _names_cells; - MEDCouplingAutoRefCountObjectPtr _fam_faces; - MEDCouplingAutoRefCountObjectPtr _num_faces; - MEDCouplingAutoRefCountObjectPtr _names_faces; - mutable MEDCouplingAutoRefCountObjectPtr _rev_num_nodes; - mutable MEDCouplingAutoRefCountObjectPtr _rev_num_cells; - mutable MEDCouplingAutoRefCountObjectPtr _faces_if_necessary; + MCAuto _fam_nodes; + MCAuto _num_nodes; + MCAuto _names_nodes; + MCAuto _fam_cells; + MCAuto _num_cells; + MCAuto _names_cells; + MCAuto _fam_faces; + MCAuto _num_faces; + MCAuto _names_faces; + mutable MCAuto _rev_num_nodes; + mutable MCAuto _rev_num_cells; + mutable MCAuto _faces_if_necessary; }; class MEDFileCMesh : public MEDFileStructuredMesh @@ -442,7 +442,7 @@ namespace MEDCoupling MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT MEDFileMesh *createNewEmpty() const; - MEDLOADER_EXPORT MEDFileMesh *deepCpy() const; + MEDLOADER_EXPORT MEDFileMesh *deepCopy() const; MEDLOADER_EXPORT MEDFileMesh *shallowCpy() const; MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const; MEDLOADER_EXPORT int getMeshDimension() const; @@ -462,7 +462,7 @@ namespace MEDCoupling MEDFileCMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); void loadLL(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); private: - MEDCouplingAutoRefCountObjectPtr _cmesh; + MCAuto _cmesh; }; class MEDFileCurveLinearMesh : public MEDFileStructuredMesh @@ -475,7 +475,7 @@ namespace MEDCoupling MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT MEDFileMesh *createNewEmpty() const; - MEDLOADER_EXPORT MEDFileMesh *deepCpy() const; + MEDLOADER_EXPORT MEDFileMesh *deepCopy() const; MEDLOADER_EXPORT MEDFileMesh *shallowCpy() const; MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const; MEDLOADER_EXPORT int getMeshDimension() const; @@ -494,7 +494,7 @@ namespace MEDCoupling void writeLL(med_idt fid) const; void loadLL(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);//to imp private: - MEDCouplingAutoRefCountObjectPtr _clmesh; + MCAuto _clmesh; }; class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritable @@ -503,7 +503,7 @@ namespace MEDCoupling MEDLOADER_EXPORT static MEDFileMeshMultiTS *New(); MEDLOADER_EXPORT static MEDFileMeshMultiTS *New(const std::string& fileName); MEDLOADER_EXPORT static MEDFileMeshMultiTS *New(const std::string& fileName, const std::string& mName); - MEDLOADER_EXPORT MEDFileMeshMultiTS *deepCpy() const; + MEDLOADER_EXPORT MEDFileMeshMultiTS *deepCopy() const; MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT std::string getName() const; @@ -523,7 +523,7 @@ namespace MEDCoupling MEDFileMeshMultiTS(const std::string& fileName); MEDFileMeshMultiTS(const std::string& fileName, const std::string& mName); private: - std::vector< MEDCouplingAutoRefCountObjectPtr > _mesh_one_ts; + std::vector< MCAuto > _mesh_one_ts; }; class MEDFileMeshesIterator; @@ -533,7 +533,7 @@ namespace MEDCoupling public: MEDLOADER_EXPORT static MEDFileMeshes *New(); MEDLOADER_EXPORT static MEDFileMeshes *New(const std::string& fileName); - MEDLOADER_EXPORT MEDFileMeshes *deepCpy() const; + MEDLOADER_EXPORT MEDFileMeshes *deepCopy() const; MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT std::string simpleRepr() const; @@ -554,12 +554,12 @@ namespace MEDCoupling MEDLOADER_EXPORT void destroyMeshAtPos(int i); private: ~MEDFileMeshes() { } - void checkCoherency() const; + void checkConsistencyLight() const; void loadFromFile(const std::string& fileName); MEDFileMeshes(); MEDFileMeshes(const std::string& fileName); private: - std::vector< MEDCouplingAutoRefCountObjectPtr > _meshes; + std::vector< MCAuto > _meshes; }; class MEDFileMeshesIterator @@ -569,7 +569,7 @@ namespace MEDCoupling MEDLOADER_EXPORT ~MEDFileMeshesIterator(); MEDLOADER_EXPORT MEDFileMesh *nextt(); private: - MEDCouplingAutoRefCountObjectPtr _ms; + MCAuto _ms; int _iter_id; int _nb_iter; }; diff --git a/src/MEDLoader/MEDFileMeshElt.cxx b/src/MEDLoader/MEDFileMeshElt.cxx index db3c66495..92e49111f 100644 --- a/src/MEDLoader/MEDFileMeshElt.cxx +++ b/src/MEDLoader/MEDFileMeshElt.cxx @@ -51,7 +51,7 @@ MEDFileUMeshPerType *MEDFileUMeshPerType::NewPart(med_idt fid, const char *mName med_entity_type whichEntity; if(!isExisting(fid,mName,dt,it,geoElt,whichEntity)) throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::NewPart : The specified geo type is not present in the specified mesh !"); - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileUMeshPerType); + MCAuto ret(new MEDFileUMeshPerType); ret->loadPart(fid,mName,dt,it,mdim,geoElt,geoElt2,whichEntity,strt,stp,step,mrs); return ret.retn(); } @@ -139,7 +139,7 @@ void MEDFileUMeshPerType::loadFromStaticType(med_idt fid, const char *mName, int { _m=MEDCoupling1SGTUMesh::New(mName,type); MEDCoupling1SGTUMesh *mc(dynamic_cast((MEDCoupling1GTUMesh *)_m)); - MEDCouplingAutoRefCountObjectPtr conn(DataArrayInt::New()); + MCAuto conn(DataArrayInt::New()); int nbOfNodesPerCell(mc->getNumberOfNodesPerCell()); conn->alloc(nbOfNodesPerCell*curNbOfElem,1); MEDFILESAFECALLERRD0(MEDmeshElementConnectivityRd,(fid,mName,dt,it,entity,geoElt,MED_NODAL,MED_FULL_INTERLACE,conn->getPointer())); @@ -158,7 +158,7 @@ void MEDFileUMeshPerType::loadPartStaticType(med_idt fid, const char *mName, int int nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(strt,end,step,"MEDFileUMeshPerType::loadPartStaticType")); _m=MEDCoupling1SGTUMesh::New(mName,type); MEDCoupling1SGTUMesh *mc(dynamic_cast((MEDCoupling1GTUMesh *)_m)); - MEDCouplingAutoRefCountObjectPtr conn(DataArrayInt::New()); + MCAuto conn(DataArrayInt::New()); int nbOfNodesPerCell(mc->getNumberOfNodesPerCell()); conn->alloc(nbOfNodesPerCell*nbOfEltsToLoad,1); med_filter filter=MED_FILTER_INIT; @@ -279,8 +279,8 @@ void MEDFileUMeshPerType::loadPolyg(med_idt fid, const char *mName, int dt, int med_bool changement,transformation; med_int curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_INDEX_NODE,MED_NODAL,&changement,&transformation)-1); _m=MEDCoupling1DGTUMesh::New(mName,geoElt==MED_POLYGON?INTERP_KERNEL::NORM_POLYGON:INTERP_KERNEL::NORM_QPOLYG); - MEDCouplingAutoRefCountObjectPtr mc(DynamicCast(_m)); - MEDCouplingAutoRefCountObjectPtr conn(DataArrayInt::New()),connI(DataArrayInt::New()); + MCAuto mc(DynamicCast(_m)); + MCAuto conn(DataArrayInt::New()),connI(DataArrayInt::New()); conn->alloc(arraySize,1); connI->alloc(curNbOfElem+1,1); MEDFILESAFECALLERRD0(MEDmeshPolygon2Rd,(fid,mName,dt,it,MED_CELL,geoElt,MED_NODAL,connI->getPointer(),conn->getPointer())); std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus(),-1)); @@ -296,12 +296,12 @@ void MEDFileUMeshPerType::loadPolyh(med_idt fid, const char *mName, int dt, int med_int indexFaceLgth(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_INDEX_NODE,MED_NODAL,&changement,&transformation)); int curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_INDEX_FACE,MED_NODAL,&changement,&transformation)-1); _m=MEDCoupling1DGTUMesh::New(mName,INTERP_KERNEL::NORM_POLYHED); - MEDCouplingAutoRefCountObjectPtr mc(DynamicCastSafe(_m)); + MCAuto mc(DynamicCastSafe(_m)); INTERP_KERNEL::AutoPtr index=new int[curNbOfElem+1]; INTERP_KERNEL::AutoPtr indexFace=new int[indexFaceLgth]; INTERP_KERNEL::AutoPtr locConn=new int[connFaceLgth]; MEDFILESAFECALLERRD0(MEDmeshPolyhedronRd,(fid,mName,dt,it,MED_CELL,MED_NODAL,index,indexFace,locConn)); - MEDCouplingAutoRefCountObjectPtr conn(DataArrayInt::New()),connI(DataArrayInt::New()); + MCAuto conn(DataArrayInt::New()),connI(DataArrayInt::New()); int arraySize=connFaceLgth; for(int i=0;i(m)); if(!m0) throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::Write : internal error #1 !"); - MEDCouplingAutoRefCountObjectPtr arr(m0->getNodalConnectivity()->deepCpy()); + MCAuto arr(m0->getNodalConnectivity()->deepCopy()); std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus(),1)); MEDFILESAFECALLERWR0(MEDmeshElementConnectivityWr,(fid,mname.c_str(),dt,it,timm,MED_CELL,curMedType,MED_NODAL,MED_FULL_INTERLACE,nbOfCells,arr->begin())); } @@ -351,7 +351,7 @@ void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int mdim, throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::Write : internal error #2 !"); if(ikt==INTERP_KERNEL::NORM_POLYGON || ikt==INTERP_KERNEL::NORM_QPOLYG) { - MEDCouplingAutoRefCountObjectPtr arr(m0->getNodalConnectivity()->deepCpy()),arrI(m0->getNodalConnectivityIndex()->deepCpy()); + MCAuto arr(m0->getNodalConnectivity()->deepCopy()),arrI(m0->getNodalConnectivityIndex()->deepCopy()); std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus(),1)); std::transform(arrI->begin(),arrI->end(),arrI->getPointer(),std::bind2nd(std::plus(),1)); MEDFILESAFECALLERWR0(MEDmeshPolygon2Wr,(fid,mname.c_str(),dt,it,timm,MED_CELL,ikt==INTERP_KERNEL::NORM_POLYGON?MED_POLYGON:MED_POLYGON2,MED_NODAL,nbOfCells+1,arrI->begin(),arr->begin())); diff --git a/src/MEDLoader/MEDFileMeshElt.hxx b/src/MEDLoader/MEDFileMeshElt.hxx index 5771cc51a..7b256c620 100644 --- a/src/MEDLoader/MEDFileMeshElt.hxx +++ b/src/MEDLoader/MEDFileMeshElt.hxx @@ -24,7 +24,7 @@ #include "MEDCouplingMemArray.hxx" #include "MEDCoupling1GTUMesh.hxx" #include "MEDCouplingPartDefinition.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "NormalizedUnstructuredMesh.hxx" @@ -67,11 +67,11 @@ namespace MEDCoupling void loadCommonPart(med_idt fid, const char *mName, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs); void loadPartOfCellCommonPart(med_idt fid, const char *mName, int strt, int stp, int step, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs); private: - MEDCouplingAutoRefCountObjectPtr _m; - MEDCouplingAutoRefCountObjectPtr _num; - MEDCouplingAutoRefCountObjectPtr _fam; - MEDCouplingAutoRefCountObjectPtr _names; - MEDCouplingAutoRefCountObjectPtr _pd; + MCAuto _m; + MCAuto _num; + MCAuto _fam; + MCAuto _names; + MCAuto _pd; med_entity_type _entity; }; } diff --git a/src/MEDLoader/MEDFileMeshLL.cxx b/src/MEDLoader/MEDFileMeshLL.cxx index 83bdb7d9c..a9a458b0f 100644 --- a/src/MEDLoader/MEDFileMeshLL.cxx +++ b/src/MEDLoader/MEDFileMeshLL.cxx @@ -484,14 +484,14 @@ void MEDFileUMeshL2::loadPart(med_idt fid, int mId, const std::string& mName, co med_bool changement,transformation; int nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation)); std::vector fetchedNodeIds(nCoords,false); - for(std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++) - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++) + for(std::vector< std::vector< MCAuto > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++) + for(std::vector< MCAuto >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++) (*it1)->getMesh()->computeNodeIdsAlg(fetchedNodeIds); int nMin(std::distance(fetchedNodeIds.begin(),std::find(fetchedNodeIds.begin(),fetchedNodeIds.end(),true))); int nMax(std::distance(fetchedNodeIds.rbegin(),std::find(fetchedNodeIds.rbegin(),fetchedNodeIds.rend(),true))); nMax=nCoords-nMax; - for(std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++) - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++) + for(std::vector< std::vector< MCAuto > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++) + for(std::vector< MCAuto >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++) (*it1)->getMesh()->renumberNodesWithOffsetInConn(-nMin); loadPartCoords(fid,mId,infosOnComp,mName,dt,it,nMin,nMax); } @@ -522,7 +522,7 @@ void MEDFileUMeshL2::loadPartOfConnectivity(med_idt fid, int mdim, const std::st for(std::size_t ii=0;ii tmp(MEDFileUMeshPerType::NewPart(fid,mName.c_str(),dt,it,mdim,types[ii],strt,stp,step,mrs)); + MCAuto tmp(MEDFileUMeshPerType::NewPart(fid,mName.c_str(),dt,it,mdim,types[ii],strt,stp,step,mrs)); _per_type_mesh[0].push_back(tmp); } sortTypes(); @@ -616,9 +616,9 @@ void MEDFileUMeshL2::loadPartCoords(med_idt fid, int mId, const std::vector mdims; - std::vector< MEDCouplingAutoRefCountObjectPtr > tmp(_per_type_mesh[0]); + std::vector< MCAuto > tmp(_per_type_mesh[0]); _per_type_mesh.clear(); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=tmp.begin();it!=tmp.end();it++) + for(std::vector< MCAuto >::const_iterator it=tmp.begin();it!=tmp.end();it++) mdims.insert((*it)->getDim()); if(mdims.empty()) return; @@ -626,15 +626,15 @@ void MEDFileUMeshL2::sortTypes() _per_type_mesh.resize(mdim+1); for(int dim=mdim+1;dim!=0;dim--) { - std::vector< MEDCouplingAutoRefCountObjectPtr >& elt=_per_type_mesh[mdim+1-dim]; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=tmp.begin();it!=tmp.end();it++) + std::vector< MCAuto >& elt=_per_type_mesh[mdim+1-dim]; + for(std::vector< MCAuto >::const_iterator it=tmp.begin();it!=tmp.end();it++) if((*it)->getDim()==dim-1) elt.push_back(*it); } // suppression of contiguous empty levels at the end of _per_type_mesh. int nbOfUselessLev=0; bool isFirst=true; - for(std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr > >::reverse_iterator it2=_per_type_mesh.rbegin();it2!=_per_type_mesh.rend();it2++) + for(std::vector< std::vector< MCAuto > >::reverse_iterator it2=_per_type_mesh.rbegin();it2!=_per_type_mesh.rend();it2++) { if((*it2).empty() && isFirst) { @@ -669,7 +669,7 @@ void MEDFileUMeshL2::WriteCoords(med_idt fid, const std::string& mname, int dt, bool MEDFileUMeshL2::isFamDefinedOnLev(int levId) const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_per_type_mesh[levId].begin();it!=_per_type_mesh[levId].end();it++) + for(std::vector< MCAuto >::const_iterator it=_per_type_mesh[levId].begin();it!=_per_type_mesh[levId].end();it++) if((*it)->getFam()==0) return false; return true; @@ -677,7 +677,7 @@ bool MEDFileUMeshL2::isFamDefinedOnLev(int levId) const bool MEDFileUMeshL2::isNumDefinedOnLev(int levId) const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_per_type_mesh[levId].begin();it!=_per_type_mesh[levId].end();it++) + for(std::vector< MCAuto >::const_iterator it=_per_type_mesh[levId].begin();it!=_per_type_mesh[levId].end();it++) if((*it)->getNum()==0) return false; return true; @@ -685,7 +685,7 @@ bool MEDFileUMeshL2::isNumDefinedOnLev(int levId) const bool MEDFileUMeshL2::isNamesDefinedOnLev(int levId) const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_per_type_mesh[levId].begin();it!=_per_type_mesh[levId].end();it++) + for(std::vector< MCAuto >::const_iterator it=_per_type_mesh[levId].begin();it!=_per_type_mesh[levId].end();it++) if((*it)->getNames()==0) return false; return true; @@ -720,7 +720,7 @@ void MEDFileCMeshL2::loadAll(med_idt fid, int mId, const std::string& mName, int med_data_type dataTypeReq=GetDataTypeCorrespondingToSpaceId(i); med_bool chgt=MED_FALSE,trsf=MED_FALSE; int nbOfElt(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,dataTypeReq,MED_NO_CMODE,&chgt,&trsf)); - MEDCouplingAutoRefCountObjectPtr da=DataArrayDouble::New(); + MCAuto da=DataArrayDouble::New(); da->alloc(nbOfElt,1); da->setInfoOnComponent(0,infosOnComp[i]); MEDFILESAFECALLERRD0(MEDmeshGridIndexCoordinateRd,(fid,mName.c_str(),dt,it,i+1,da->getPointer())); @@ -767,7 +767,7 @@ void MEDFileCLMeshL2::loadAll(med_idt fid, int mId, const std::string& mName, in _clmesh->setNodeGridStructure(stGrid,((int *)stGrid)+Mdim); med_bool chgt=MED_FALSE,trsf=MED_FALSE; int nbNodes(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&chgt,&trsf)); - MEDCouplingAutoRefCountObjectPtr da=DataArrayDouble::New(); + MCAuto da=DataArrayDouble::New(); da->alloc(nbNodes,infosOnComp.size()); da->setInfoOnComponents(infosOnComp); MEDFILESAFECALLERRD0(MEDmeshNodeCoordinateRd,(fid,mName.c_str(),dt,it,MED_FULL_INTERLACE,da->getPointer())); @@ -787,7 +787,7 @@ MEDFileUMeshPermCompute::operator MEDCouplingUMesh *() const if((MEDCouplingUMesh *)_m==0) { updateTime(); - _m=static_cast(_st->_m_by_types.getUmesh()->deepCpy()); + _m=static_cast(_st->_m_by_types.getUmesh()->deepCopy()); _m->renumberCells(_st->_num->getConstPointer(),true); return _m.retn(); } @@ -798,7 +798,7 @@ MEDFileUMeshPermCompute::operator MEDCouplingUMesh *() const else { updateTime(); - _m=static_cast(_st->_m_by_types.getUmesh()->deepCpy()); + _m=static_cast(_st->_m_by_types.getUmesh()->deepCopy()); _m->renumberCells(_st->_num->getConstPointer(),true); return _m.retn(); } @@ -834,7 +834,7 @@ MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshSplitL1& other):RefCo MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const std::string& mName, int id):_m(this) { - const std::vector< MEDCouplingAutoRefCountObjectPtr >& v=l2.getLev(id); + const std::vector< MCAuto >& v=l2.getLev(id); if(v.empty()) return; int sz=v.size(); @@ -845,7 +845,7 @@ MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const std::st for(int i=0;igetMesh()); - MEDCouplingAutoRefCountObjectPtr tmp2=l2.getCoords(); + MCAuto tmp2=l2.getCoords(); elt->setCoords(tmp2); ms[i]=elt; pds[i]=v[i]->getPartDef(); @@ -926,24 +926,24 @@ std::vector MEDFileUMeshSplitL1::getDirectChildrenWithN MEDFileUMeshSplitL1 *MEDFileUMeshSplitL1::shallowCpyUsingCoords(DataArrayDouble *coords) const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileUMeshSplitL1(*this)); + MCAuto ret(new MEDFileUMeshSplitL1(*this)); ret->_m_by_types.shallowCpyMeshes(); ret->_m_by_types.setCoords(coords); return ret.retn(); } -MEDFileUMeshSplitL1 *MEDFileUMeshSplitL1::deepCpy(DataArrayDouble *coords) const +MEDFileUMeshSplitL1 *MEDFileUMeshSplitL1::deepCopy(DataArrayDouble *coords) const { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileUMeshSplitL1(*this)); - ret->_m_by_types=_m_by_types.deepCpy(coords); + MCAuto ret(new MEDFileUMeshSplitL1(*this)); + ret->_m_by_types=_m_by_types.deepCopy(coords); if((const DataArrayInt *)_fam) - ret->_fam=_fam->deepCpy(); + ret->_fam=_fam->deepCopy(); if((const DataArrayInt *)_num) - ret->_num=_num->deepCpy(); + ret->_num=_num->deepCopy(); if((const DataArrayInt *)_rev_num) - ret->_rev_num=_rev_num->deepCpy(); + ret->_rev_num=_rev_num->deepCopy(); if((const DataArrayAsciiChar *)_names) - ret->_names=_names->deepCpy(); + ret->_names=_names->deepCopy(); return ret.retn(); } @@ -1024,9 +1024,9 @@ void MEDFileUMeshSplitL1::assignMesh(MEDCouplingUMesh *m, bool newOrOld) { m->incrRef(); _m=m; - _m_by_types.assignUMesh(dynamic_cast(m->deepCpy())); - MEDCouplingAutoRefCountObjectPtr da=_m_by_types.getUmesh()->getRenumArrForConsecutiveCellTypesSpec(typmai2,typmai2+MED_N_CELL_FIXED_GEO); - if(!da->isIdentity2(m->getNumberOfCells())) + _m_by_types.assignUMesh(dynamic_cast(m->deepCopy())); + MCAuto da=_m_by_types.getUmesh()->getRenumArrForConsecutiveCellTypesSpec(typmai2,typmai2+MED_N_CELL_FIXED_GEO); + if(!da->isIota(m->getNumberOfCells())) { _num=da->invertArrayO2N2N2O(m->getNumberOfCells()); _m.updateTime(); @@ -1102,7 +1102,7 @@ int MEDFileUMeshSplitL1::getSize() const MEDCouplingUMesh *MEDFileUMeshSplitL1::getFamilyPart(const int *idsBg, const int *idsEnd, bool renum) const { - MEDCouplingAutoRefCountObjectPtr eltsToKeep=_fam->getIdsEqualList(idsBg,idsEnd); + MCAuto eltsToKeep=_fam->findIdsEqualList(idsBg,idsEnd); MEDCouplingUMesh *m=(MEDCouplingUMesh *)_m_by_types.getUmesh()->buildPartOfMySelf(eltsToKeep->getConstPointer(),eltsToKeep->getConstPointer()+eltsToKeep->getNumberOfTuples(),true); if(renum) return renumIfNeeded(m,eltsToKeep->getConstPointer()); @@ -1111,7 +1111,7 @@ MEDCouplingUMesh *MEDFileUMeshSplitL1::getFamilyPart(const int *idsBg, const int DataArrayInt *MEDFileUMeshSplitL1::getFamilyPartArr(const int *idsBg, const int *idsEnd, bool renum) const { - MEDCouplingAutoRefCountObjectPtr da=_fam->getIdsEqualList(idsBg,idsEnd); + MCAuto da=_fam->findIdsEqualList(idsBg,idsEnd); if(renum) return renumIfNeededArr(da); return da.retn(); @@ -1129,7 +1129,7 @@ int MEDFileUMeshSplitL1::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellT MEDCouplingUMesh *MEDFileUMeshSplitL1::getWholeMesh(bool renum) const { - MEDCouplingAutoRefCountObjectPtr tmp; + MCAuto tmp; if(renum && ((const DataArrayInt *)_num)) tmp=_m; else @@ -1149,7 +1149,7 @@ DataArrayInt *MEDFileUMeshSplitL1::extractFamilyFieldOnGeoType(INTERP_KERNEL::No return 0; int start(0),stop(0); _m_by_types.getStartStopOfGeoTypeWithoutComputation(gt,start,stop); - return fam->selectByTupleId2(start,stop,1); + return fam->selectByTupleIdSafeSlice(start,stop,1); } DataArrayInt *MEDFileUMeshSplitL1::extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const @@ -1159,7 +1159,7 @@ DataArrayInt *MEDFileUMeshSplitL1::extractNumberFieldOnGeoType(INTERP_KERNEL::No return 0; int start(0),stop(0); _m_by_types.getStartStopOfGeoTypeWithoutComputation(gt,start,stop); - return num->selectByTupleId2(start,stop,1); + return num->selectByTupleIdSafeSlice(start,stop,1); } DataArrayInt *MEDFileUMeshSplitL1::getOrCreateAndGetFamilyField() @@ -1209,7 +1209,7 @@ void MEDFileUMeshSplitL1::setGroupsFromScratch(const std::vector corr; _m=MEDCouplingUMesh::FuseUMeshesOnSameCoords(ms,0,corr); - std::vector< MEDCouplingAutoRefCountObjectPtr > corrMSafe(corr.begin(),corr.end()); + std::vector< MCAuto > corrMSafe(corr.begin(),corr.end()); std::vector< std::vector > fidsOfGroups; std::vector< const DataArrayInt * > corr2(corr.begin(),corr.end()); _fam=DataArrayInt::MakePartition(corr2,((MEDCouplingUMesh *)_m)->getNumberOfCells(),fidsOfGroups); @@ -1230,8 +1230,8 @@ void MEDFileUMeshSplitL1::write(med_idt fid, const std::string& mName, int mdim) { int nbCells=(*it)->getNumberOfCells(); int end=start+nbCells; - MEDCouplingAutoRefCountObjectPtr fam,num; - MEDCouplingAutoRefCountObjectPtr names; + MCAuto fam,num; + MCAuto names; if((const DataArrayInt *)_fam) fam=_fam->substr(start,end); if((const DataArrayInt *)_num) @@ -1248,14 +1248,14 @@ void MEDFileUMeshSplitL1::renumberNodesInConn(const int *newNodeNumbersO2N) _m_by_types.renumberNodesInConnWithoutComputation(newNodeNumbersO2N); } -void MEDFileUMeshSplitL1::serialize(std::vector& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr >& bigArraysI) const +void MEDFileUMeshSplitL1::serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const { bigArraysI.push_back(_fam); bigArraysI.push_back(_num); _m_by_types.serialize(tinyInt,bigArraysI); } -void MEDFileUMeshSplitL1::unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr >& bigArraysI) +void MEDFileUMeshSplitL1::unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) { _fam=bigArraysI.back(); bigArraysI.pop_back(); _num=bigArraysI.back(); bigArraysI.pop_back(); @@ -1323,15 +1323,15 @@ MEDCouplingUMesh *MEDFileUMeshSplitL1::Renumber2(const DataArrayInt *renum, MEDC m->renumberCells(renum->getConstPointer(),true); else { - MEDCouplingAutoRefCountObjectPtr locnum=renum->selectByTupleId(cellIds,cellIds+m->getNumberOfCells()); + MCAuto locnum=renum->selectByTupleId(cellIds,cellIds+m->getNumberOfCells()); m->renumberCells(locnum->getConstPointer(),true); } return m; } -MEDFileUMeshSplitL1 *MEDFileUMeshSplitL1::Unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr >& bigArraysI) +MEDFileUMeshSplitL1 *MEDFileUMeshSplitL1::Unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) { - MEDCouplingAutoRefCountObjectPtr ret(new MEDFileUMeshSplitL1); + MCAuto ret(new MEDFileUMeshSplitL1); ret->unserialize(name,coo,tinyInt,bigArraysI); return ret.retn(); } @@ -1399,7 +1399,7 @@ void MEDFileUMeshAggregateCompute::setName(const std::string& name) } if(_mp_time>=_m_time) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_m_parts.begin();it!=_m_parts.end();it++) + for(std::vector< MCAuto >::iterator it=_m_parts.begin();it!=_m_parts.end();it++) { MEDCoupling1GTUMesh *tmp(*it); if(tmp) @@ -1411,7 +1411,7 @@ void MEDFileUMeshAggregateCompute::setName(const std::string& name) void MEDFileUMeshAggregateCompute::assignParts(const std::vector< const MEDCoupling1GTUMesh * >& mParts) { std::size_t sz(mParts.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr > ret(sz); + std::vector< MCAuto > ret(sz); for(std::size_t i=0;igetNumberOfCells(); int ret(0); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) + for(std::vector< MCAuto >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) ret+=(*it)->getNumberOfCells(); return ret; } @@ -1488,7 +1488,7 @@ int MEDFileUMeshAggregateCompute::getNumberOfCellsWithType(INTERP_KERNEL::Normal { if(_mp_time>=_m_time) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) + for(std::vector< MCAuto >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) { const MEDCoupling1GTUMesh *elt(*it); if(elt && elt->getCellModelEnum()==ct) @@ -1507,7 +1507,7 @@ std::vector MEDFileUMeshAggregateCompute::retrievePartsWi // std::vector ret(_m_parts.size()); std::size_t i(0); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++,i++) { const MEDCoupling1GTUMesh *elt(*it); ret[i]=const_cast(elt); @@ -1560,7 +1560,7 @@ void MEDFileUMeshAggregateCompute::renumberNodesInConnWithoutComputation(const i { if(_mp_time>_m_time) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_m_parts.begin();it!=_m_parts.end();it++) + for(std::vector< MCAuto >::iterator it=_m_parts.begin();it!=_m_parts.end();it++) { MEDCoupling1GTUMesh *m(*it); if(m) @@ -1587,7 +1587,7 @@ void MEDFileUMeshAggregateCompute::forceComputationOfPartsFromUMesh() const return ;// no needs to compte parts they are already here ! } std::vector ms(m->splitByType()); - std::vector< MEDCouplingAutoRefCountObjectPtr > msMSafe(ms.begin(),ms.end()); + std::vector< MCAuto > msMSafe(ms.begin(),ms.end()); std::size_t sz(msMSafe.size()); _m_parts.resize(sz); for(std::size_t i=0;i& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr >& bigArraysI) const +void MEDFileUMeshAggregateCompute::serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const { if(_mp_time<_m_time) throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::serialize : the parts require a computation !"); @@ -1633,7 +1633,7 @@ void MEDFileUMeshAggregateCompute::serialize(std::vector& tinyInt, std::vec DataArrayInt *elt(mesh1->getNodalConnectivity()); if(elt) elt->incrRef(); - MEDCouplingAutoRefCountObjectPtr elt1(elt); + MCAuto elt1(elt); bigArraysI.push_back(elt1); } else if(mesh2) @@ -1643,7 +1643,7 @@ void MEDFileUMeshAggregateCompute::serialize(std::vector& tinyInt, std::vec elt1->incrRef(); if(elt2) elt2->incrRef(); - MEDCouplingAutoRefCountObjectPtr elt11(elt1),elt22(elt2); + MCAuto elt11(elt1),elt22(elt2); bigArraysI.push_back(elt11); bigArraysI.push_back(elt22); } else @@ -1661,7 +1661,7 @@ void MEDFileUMeshAggregateCompute::serialize(std::vector& tinyInt, std::vec } } -void MEDFileUMeshAggregateCompute::unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr >& bigArraysI) +void MEDFileUMeshAggregateCompute::unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) { int nbParts(tinyInt.back()); tinyInt.pop_back(); _part_def.clear(); _part_def.resize(nbParts); @@ -1669,7 +1669,7 @@ void MEDFileUMeshAggregateCompute::unserialize(const std::string& name, DataArra for(int i=0;i mesh(MEDCoupling1GTUMesh::New(name,tp)); + MCAuto mesh(MEDCoupling1GTUMesh::New(name,tp)); mesh->setCoords(coo); MEDCoupling1SGTUMesh *mesh1(dynamic_cast((MEDCoupling1GTUMesh *) mesh)); MEDCoupling1DGTUMesh *mesh2(dynamic_cast((MEDCoupling1GTUMesh *) mesh)); @@ -1679,7 +1679,7 @@ void MEDFileUMeshAggregateCompute::unserialize(const std::string& name, DataArra } else if(mesh2) { - MEDCouplingAutoRefCountObjectPtr elt0,elt1; + MCAuto elt0,elt1; elt0=bigArraysI.back(); bigArraysI.pop_back(); elt1=bigArraysI.back(); bigArraysI.pop_back(); mesh2->setNodalConnectivity(elt0,elt1); @@ -1714,7 +1714,7 @@ std::size_t MEDFileUMeshAggregateCompute::getTimeOfThis() const std::size_t MEDFileUMeshAggregateCompute::getTimeOfParts() const { std::size_t ret(0); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) + for(std::vector< MCAuto >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) { const MEDCoupling1GTUMesh *elt(*it); if(!elt) @@ -1736,20 +1736,20 @@ std::size_t MEDFileUMeshAggregateCompute::getTimeOfUMesh() const std::size_t MEDFileUMeshAggregateCompute::getHeapMemorySizeWithoutChildren() const { - std::size_t ret(_m_parts.size()*sizeof(MEDCouplingAutoRefCountObjectPtr)); + std::size_t ret(_m_parts.size()*sizeof(MCAuto)); return ret; } std::vector MEDFileUMeshAggregateCompute::getDirectChildrenWithNull() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) + for(std::vector< MCAuto >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) ret.push_back((const MEDCoupling1GTUMesh *)*it); ret.push_back((const MEDCouplingUMesh *)_m); return ret; } -MEDFileUMeshAggregateCompute MEDFileUMeshAggregateCompute::deepCpy(DataArrayDouble *coords) const +MEDFileUMeshAggregateCompute MEDFileUMeshAggregateCompute::deepCopy(DataArrayDouble *coords) const { MEDFileUMeshAggregateCompute ret; ret._m_parts.resize(_m_parts.size()); @@ -1758,14 +1758,14 @@ MEDFileUMeshAggregateCompute MEDFileUMeshAggregateCompute::deepCpy(DataArrayDoub const MEDCoupling1GTUMesh *elt(_m_parts[i]); if(elt) { - ret._m_parts[i]=static_cast(elt->deepCpy()); + ret._m_parts[i]=static_cast(elt->deepCopy()); ret._m_parts[i]->setCoords(coords); } } ret._mp_time=_mp_time; ret._m_time=_m_time; if((const MEDCouplingUMesh *)_m) { - ret._m=static_cast(_m->deepCpy()); + ret._m=static_cast(_m->deepCopy()); ret._m->setCoords(coords); } std::size_t sz(_part_def.size()); @@ -1774,19 +1774,19 @@ MEDFileUMeshAggregateCompute MEDFileUMeshAggregateCompute::deepCpy(DataArrayDoub { const PartDefinition *elt(_part_def[i]); if(elt) - ret._part_def[i]=elt->deepCpy(); + ret._part_def[i]=elt->deepCopy(); } return ret; } void MEDFileUMeshAggregateCompute::shallowCpyMeshes() { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_m_parts.begin();it!=_m_parts.end();it++) + for(std::vector< MCAuto >::iterator it=_m_parts.begin();it!=_m_parts.end();it++) { const MEDCoupling1GTUMesh *elt(*it); if(elt) { - MEDCouplingAutoRefCountObjectPtr elt2(elt->clone(false)); + MCAuto elt2(elt->clone(false)); *it=DynamicCastSafe(elt2); } } @@ -1838,14 +1838,14 @@ bool MEDFileUMeshAggregateCompute::isEqual(const MEDFileUMeshAggregateCompute& o void MEDFileUMeshAggregateCompute::clearNonDiscrAttributes() const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) + for(std::vector< MCAuto >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) MEDFileUMeshSplitL1::ClearNonDiscrAttributes(*it); MEDFileUMeshSplitL1::ClearNonDiscrAttributes(_m); } void MEDFileUMeshAggregateCompute::synchronizeTinyInfo(const MEDFileMesh& master) const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) + for(std::vector< MCAuto >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) { const MEDCoupling1GTUMesh *tmp(*it); if(tmp) @@ -1906,7 +1906,7 @@ std::vector MEDFileUMeshAggregateCompute::getDistributionOfTypes() const else { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) + for(std::vector< MCAuto >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) { const MEDCoupling1GTUMesh *tmp(*it); if(!tmp) @@ -1930,7 +1930,7 @@ int MEDFileUMeshAggregateCompute::getSize() const else { int ret=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) + for(std::vector< MCAuto >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) { const MEDCoupling1GTUMesh *m(*it); if(!m) @@ -1943,7 +1943,7 @@ int MEDFileUMeshAggregateCompute::getSize() const void MEDFileUMeshAggregateCompute::setCoords(DataArrayDouble *coords) { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_m_parts.begin();it!=_m_parts.end();it++) + for(std::vector< MCAuto >::iterator it=_m_parts.begin();it!=_m_parts.end();it++) { MEDCoupling1GTUMesh *tmp(*it); if(tmp) diff --git a/src/MEDLoader/MEDFileMeshLL.hxx b/src/MEDLoader/MEDFileMeshLL.hxx index 5fc8fed00..e5e29cf68 100644 --- a/src/MEDLoader/MEDFileMeshLL.hxx +++ b/src/MEDLoader/MEDFileMeshLL.hxx @@ -29,7 +29,7 @@ #include "MEDCoupling1GTUMesh.hxx" #include "MEDCouplingPartDefinition.hxx" #include "MEDCouplingCurveLinearMesh.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "med.h" @@ -52,7 +52,7 @@ namespace MEDCoupling int getIteration() const { return _iteration; } int getOrder() const { return _order; } double getTime() const { return _time; } - MEDCouplingAutoRefCountObjectPtr getPartDefOfCoo() const { return _part_coords; } + MCAuto getPartDefOfCoo() const { return _part_coords; } std::vector getAxisInfoOnMesh(med_idt fid, int mId, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& nstep, int& Mdim); static int GetMeshIdFromName(med_idt fid, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& dt, int& it, std::string& dtunit1); static double CheckMeshTimeStep(med_idt fid, const std::string& mname, int nstep, int dt, int it); @@ -80,7 +80,7 @@ namespace MEDCoupling int _iteration; int _order; double _time; - MEDCouplingAutoRefCountObjectPtr _part_coords; + MCAuto _part_coords; }; class MEDFileUMeshL2 : public MEDFileMeshL2 @@ -96,23 +96,23 @@ namespace MEDCoupling void loadPartCoords(med_idt fid, int mId, const std::vector& infosOnComp, const std::string& mName, int dt, int it, int nMin, int nMax); int getNumberOfLevels() const { return _per_type_mesh.size(); } bool emptyLev(int levId) const { return _per_type_mesh[levId].empty(); } - const std::vector< MEDCouplingAutoRefCountObjectPtr >& getLev(int levId) const { return _per_type_mesh[levId]; } + const std::vector< MCAuto >& getLev(int levId) const { return _per_type_mesh[levId]; } bool isFamDefinedOnLev(int levId) const; bool isNumDefinedOnLev(int levId) const; bool isNamesDefinedOnLev(int levId) const; - MEDCouplingAutoRefCountObjectPtr getCoords() const { return _coords; } - MEDCouplingAutoRefCountObjectPtr getCoordsFamily() const { return _fam_coords; } - MEDCouplingAutoRefCountObjectPtr getCoordsNum() const { return _num_coords; } - MEDCouplingAutoRefCountObjectPtr getCoordsName() const { return _name_coords; } + MCAuto getCoords() const { return _coords; } + MCAuto getCoordsFamily() const { return _fam_coords; } + MCAuto getCoordsNum() const { return _num_coords; } + MCAuto getCoordsName() const { return _name_coords; } static void WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords); private: void sortTypes(); private: - std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr > > _per_type_mesh; - MEDCouplingAutoRefCountObjectPtr _coords; - MEDCouplingAutoRefCountObjectPtr _fam_coords; - MEDCouplingAutoRefCountObjectPtr _num_coords; - MEDCouplingAutoRefCountObjectPtr _name_coords; + std::vector< std::vector< MCAuto > > _per_type_mesh; + MCAuto _coords; + MCAuto _fam_coords; + MCAuto _num_coords; + MCAuto _name_coords; }; class MEDFileStrMeshL2 : public MEDFileMeshL2 @@ -125,11 +125,11 @@ namespace MEDCoupling MEDFileCMeshL2(); void loadAll(med_idt fid, int mId, const std::string& mName, int dt, int it); MEDCouplingCMesh *getMesh() { return _cmesh; } - MEDCoupling::MEDCouplingAxisType getAxType() const { return _ax_type; } + MEDCoupling::MEDCouplingAxisType getAxisType() const { return _ax_type; } private: static med_data_type GetDataTypeCorrespondingToSpaceId(int id); private: - MEDCouplingAutoRefCountObjectPtr _cmesh; + MCAuto _cmesh; MEDCoupling::MEDCouplingAxisType _ax_type; }; @@ -140,7 +140,7 @@ namespace MEDCoupling void loadAll(med_idt fid, int mId, const std::string& mName, int dt, int it); MEDCouplingCurveLinearMesh *getMesh() { return _clmesh; } private: - MEDCouplingAutoRefCountObjectPtr _clmesh; + MCAuto _clmesh; }; class MEDFileMesh; @@ -159,7 +159,7 @@ namespace MEDCoupling const MEDFileUMeshSplitL1 *_st; mutable std::size_t _mpt_time; mutable std::size_t _num_time; - mutable MEDCouplingAutoRefCountObjectPtr _m; + mutable MCAuto _m; }; class MEDFileUMeshAggregateCompute : public BigMemoryObject @@ -183,7 +183,7 @@ namespace MEDCoupling std::size_t getTimeOfThis() const; std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; - MEDFileUMeshAggregateCompute deepCpy(DataArrayDouble *coords) const; + MEDFileUMeshAggregateCompute deepCopy(DataArrayDouble *coords) const; void shallowCpyMeshes(); bool isEqual(const MEDFileUMeshAggregateCompute& other, double eps, std::string& what) const; void clearNonDiscrAttributes() const; @@ -195,17 +195,17 @@ namespace MEDCoupling void setCoords(DataArrayDouble *coords); void forceComputationOfPartsFromUMesh() const; const PartDefinition *getPartDefOfWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const; - void serialize(std::vector& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr >& bigArraysI) const; - void unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr >& bigArraysI); + void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const; + void unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI); private: std::size_t getTimeOfParts() const; std::size_t getTimeOfUMesh() const; private: - mutable std::vector< MEDCouplingAutoRefCountObjectPtr > _m_parts; + mutable std::vector< MCAuto > _m_parts; mutable std::size_t _mp_time; mutable std::size_t _m_time; - mutable MEDCouplingAutoRefCountObjectPtr _m; - mutable std::vector< MEDCouplingAutoRefCountObjectPtr > _part_def; + mutable MCAuto _m; + mutable std::vector< MCAuto > _part_def; }; class MEDFileUMeshSplitL1 : public RefCountObject @@ -221,7 +221,7 @@ namespace MEDCoupling std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; MEDFileUMeshSplitL1 *shallowCpyUsingCoords(DataArrayDouble *coords) const; - MEDFileUMeshSplitL1 *deepCpy(DataArrayDouble *coords) const; + MEDFileUMeshSplitL1 *deepCopy(DataArrayDouble *coords) const; void setCoords(DataArrayDouble *coords); bool isEqual(const MEDFileUMeshSplitL1 *other, double eps, std::string& what) const; void clearNonDiscrAttributes() const; @@ -265,8 +265,8 @@ namespace MEDCoupling // void renumberNodesInConn(const int *newNodeNumbersO2N); // - void serialize(std::vector& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr >& bigArraysI) const; - void unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr >& bigArraysI); + void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const; + void unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI); // static void ClearNonDiscrAttributes(const MEDCouplingMesh *tmp); static std::vector GetNewFamiliesNumber(int nb, const std::map& families); @@ -274,7 +274,7 @@ namespace MEDCoupling std::map& famIdTrad, std::map& newfams); static DataArrayInt *Renumber(const DataArrayInt *renum, const DataArrayInt *da); static MEDCouplingUMesh *Renumber2(const DataArrayInt *renum, MEDCouplingUMesh *m, const int *cellIds); - static MEDFileUMeshSplitL1 *Unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr >& bigArraysI); + static MEDFileUMeshSplitL1 *Unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI); private: MEDFileUMeshSplitL1(); void assignCommonPart(); @@ -283,10 +283,10 @@ namespace MEDCoupling void computeRevNum() const; private: MEDFileUMeshAggregateCompute _m_by_types; - MEDCouplingAutoRefCountObjectPtr _fam; - MEDCouplingAutoRefCountObjectPtr _num; - MEDCouplingAutoRefCountObjectPtr _names; - mutable MEDCouplingAutoRefCountObjectPtr _rev_num; + MCAuto _fam; + MCAuto _num; + MCAuto _names; + mutable MCAuto _rev_num; MEDFileUMeshPermCompute _m; }; } diff --git a/src/MEDLoader/MEDFileParameter.cxx b/src/MEDLoader/MEDFileParameter.cxx index 9f281464a..de3214243 100644 --- a/src/MEDLoader/MEDFileParameter.cxx +++ b/src/MEDLoader/MEDFileParameter.cxx @@ -51,7 +51,7 @@ bool MEDFileParameter1TS::isEqual(const MEDFileParameter1TS *other, double eps, return true; } -MEDFileParameter1TS *MEDFileParameterDouble1TSWTI::deepCpy() const +MEDFileParameter1TS *MEDFileParameterDouble1TSWTI::deepCopy() const { return new MEDFileParameterDouble1TSWTI(*this); } @@ -333,7 +333,7 @@ bool MEDFileParameterDouble1TS::isEqual(const MEDFileParameter1TS *other, double return true; } -MEDFileParameter1TS *MEDFileParameterDouble1TS::deepCpy() const +MEDFileParameter1TS *MEDFileParameterDouble1TS::deepCopy() const { return new MEDFileParameterDouble1TS(*this); } @@ -390,7 +390,7 @@ MEDFileParameterMultiTS::MEDFileParameterMultiTS(const MEDFileParameterMultiTS& { const MEDFileParameter1TS *elt=_param_per_ts[i]; if(elt) - _param_per_ts[i]=elt->deepCpy(); + _param_per_ts[i]=elt->deepCopy(); } } @@ -483,19 +483,19 @@ void MEDFileParameterMultiTS::finishLoading(med_idt fid, med_parameter_type typ, std::size_t MEDFileParameterMultiTS::getHeapMemorySizeWithoutChildren() const { std::size_t ret(sizeof(MEDFileParameterMultiTS)); - ret+=sizeof(MEDCouplingAutoRefCountObjectPtr)*_param_per_ts.capacity(); + ret+=sizeof(MCAuto)*_param_per_ts.capacity(); return ret; } std::vector MEDFileParameterMultiTS::getDirectChildrenWithNull() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++) + for(std::vector< MCAuto >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++) ret.push_back((const MEDFileParameter1TS *)*it); return ret; } -MEDFileParameterMultiTS *MEDFileParameterMultiTS::deepCpy() const +MEDFileParameterMultiTS *MEDFileParameterMultiTS::deepCopy() const { return new MEDFileParameterMultiTS(*this,true); } @@ -529,7 +529,7 @@ void MEDFileParameterMultiTS::write(const std::string& fileName, int mode) const void MEDFileParameterMultiTS::writeLL(med_idt fid, const MEDFileWritable& mw) const { std::set diffType; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++) + for(std::vector< MCAuto >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++) { const MEDFileParameter1TS *elt(*it); if(dynamic_cast(elt)) @@ -541,7 +541,7 @@ void MEDFileParameterMultiTS::writeLL(med_idt fid, const MEDFileWritable& mw) co return; med_parameter_type typ=*diffType.begin(); MEDFileParameterTinyInfo::writeLLHeader(fid,typ); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++) + for(std::vector< MCAuto >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++) { const MEDFileParameter1TS *elt(*it); if(elt) @@ -559,7 +559,7 @@ std::string MEDFileParameterMultiTS::simpleRepr() const void MEDFileParameterMultiTS::simpleRepr2(int bkOffset, std::ostream& oss) const { MEDFileParameterTinyInfo::mainRepr(bkOffset,oss); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++) + for(std::vector< MCAuto >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++) { const MEDFileParameter1TS *elt(*it); if(elt) @@ -569,9 +569,9 @@ void MEDFileParameterMultiTS::simpleRepr2(int bkOffset, std::ostream& oss) const void MEDFileParameterMultiTS::appendValue(int dt, int it, double time, double val) { - MEDCouplingAutoRefCountObjectPtr elt=MEDFileParameterDouble1TSWTI::New(dt,it,time); + MCAuto elt=MEDFileParameterDouble1TSWTI::New(dt,it,time); elt->setValue(val); - MEDCouplingAutoRefCountObjectPtr elt2((MEDFileParameterDouble1TSWTI*)elt); elt2->incrRef(); + MCAuto elt2((MEDFileParameterDouble1TSWTI*)elt); elt2->incrRef(); _param_per_ts.push_back(elt2); } @@ -598,7 +598,7 @@ int MEDFileParameterMultiTS::getPosOfTimeStep(int iteration, int order) const { int ret=0; std::ostringstream oss; oss << "MEDFileParameterMultiTS::getPosOfTimeStep : no such iteration=" << iteration << " order=" << order << " ! Possibilities are :"; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++,ret++) + for(std::vector< MCAuto >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++,ret++) { const MEDFileParameter1TS *elt(*it); if(elt) @@ -616,7 +616,7 @@ int MEDFileParameterMultiTS::getPosGivenTime(double time, double eps) const { int ret=0; std::ostringstream oss; oss << "MEDFileParameterMultiTS::getPosGivenTime : no such time=" << time << " ! Possibilities are :"; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++,ret++) + for(std::vector< MCAuto >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++,ret++) { const MEDFileParameter1TS *elt(*it); if(elt) @@ -655,7 +655,7 @@ void MEDFileParameterMultiTS::eraseTimeStepIds(const int *startIds, const int *e std::ostringstream oss; oss << "MEDFileParameterMultiTS::eraseTimeStepIds : At pos #" << std::distance(startIds,w) << " value is " << *w << " should be in [0," << len << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } std::size_t newNb=std::count(b.begin(),b.end(),true); - std::vector< MEDCouplingAutoRefCountObjectPtr > paramPerTs(newNb); + std::vector< MCAuto > paramPerTs(newNb); std::size_t j=0; for(std::size_t i=0;i<_param_per_ts.size();i++) if(b[i]) @@ -671,7 +671,7 @@ int MEDFileParameterMultiTS::getNumberOfTS() const std::vector< std::pair > MEDFileParameterMultiTS::getIterations() const { std::vector< std::pair > ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++) + for(std::vector< MCAuto >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++) { const MEDFileParameter1TS *elt(*it); if(elt) @@ -687,7 +687,7 @@ std::vector< std::pair > MEDFileParameterMultiTS::getTimeSteps(std::vec { std::vector< std::pair > ret0; ret1.clear(); - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++) + for(std::vector< MCAuto >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++) { const MEDFileParameter1TS *elt(*it); if(elt) @@ -735,19 +735,19 @@ MEDFileParameters::MEDFileParameters() std::size_t MEDFileParameters::getHeapMemorySizeWithoutChildren() const { std::size_t ret(sizeof(MEDFileParameters)); - ret+=sizeof(MEDCouplingAutoRefCountObjectPtr)*_params.capacity(); + ret+=sizeof(MCAuto)*_params.capacity(); return ret; } std::vector MEDFileParameters::getDirectChildrenWithNull() const { std::vector ret; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_params.begin();it!=_params.end();it++) + for(std::vector< MCAuto >::const_iterator it=_params.begin();it!=_params.end();it++) ret.push_back((const MEDFileParameterMultiTS *)*it); return ret; } -MEDFileParameters *MEDFileParameters::deepCpy() const +MEDFileParameters *MEDFileParameters::deepCopy() const { return new MEDFileParameters(*this,true); } @@ -778,7 +778,7 @@ MEDFileParameters::MEDFileParameters(const MEDFileParameters& other, bool deepCo { const MEDFileParameterMultiTS *elt=_params[i]; if(elt) - _params[i]=elt->deepCpy(); + _params[i]=elt->deepCopy(); } } @@ -791,7 +791,7 @@ void MEDFileParameters::write(const std::string& fileName, int mode) const void MEDFileParameters::writeLL(med_idt fid) const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_params.begin();it!=_params.end();it++) + for(std::vector< MCAuto >::const_iterator it=_params.begin();it!=_params.end();it++) { const MEDFileParameterMultiTS *elt(*it); if(elt) @@ -803,7 +803,7 @@ std::vector MEDFileParameters::getParamsNames() const { std::vector ret(_params.size()); int i=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_params.begin();it!=_params.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_params.begin();it!=_params.end();it++,i++) { const MEDFileParameterMultiTS *p=(*it); if(p) @@ -828,7 +828,7 @@ std::string MEDFileParameters::simpleRepr() const void MEDFileParameters::simpleReprWithoutHeader(std::ostream& oss) const { - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_params.begin();it!=_params.end();it++) + for(std::vector< MCAuto >::const_iterator it=_params.begin();it!=_params.end();it++) { const MEDFileParameterMultiTS *elt(*it); if(elt) @@ -847,7 +847,7 @@ void MEDFileParameters::pushParam(MEDFileParameterMultiTS *param) { if(param) param->incrRef(); - MEDCouplingAutoRefCountObjectPtr elt(param); + MCAuto elt(param); _params.push_back(elt); } @@ -859,7 +859,7 @@ void MEDFileParameters::setParamAtPos(int i, MEDFileParameterMultiTS *param) _params.resize(i+1); if(param) param->incrRef(); - MEDCouplingAutoRefCountObjectPtr elt(param); + MCAuto elt(param); _params[i]=elt; } @@ -893,14 +893,14 @@ void MEDFileParameters::destroyParamAtPos(int i) std::ostringstream oss; oss << "MEDFileParameters::destroyParamAtPos : should be in [0," << _params.size() << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - _params[i]=MEDCouplingAutoRefCountObjectPtr(0); + _params[i]=MCAuto(0); } int MEDFileParameters::getPosFromParamName(const std::string& paramName) const { std::ostringstream oss; oss << "MEDFileParameters::getPosFromParamName : no such name=" << paramName << " ! Possibilities are :"; int ret=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_params.begin();it!=_params.end();it++,ret++) + for(std::vector< MCAuto >::const_iterator it=_params.begin();it!=_params.end();it++,ret++) { const MEDFileParameterMultiTS *elt(*it); if(elt) diff --git a/src/MEDLoader/MEDFileParameter.hxx b/src/MEDLoader/MEDFileParameter.hxx index 0a87f5f35..a2dee534d 100644 --- a/src/MEDLoader/MEDFileParameter.hxx +++ b/src/MEDLoader/MEDFileParameter.hxx @@ -24,14 +24,14 @@ #include "MEDLoaderDefines.hxx" #include "MEDFileUtilities.hxx" #include "MEDCouplingMemArray.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" namespace MEDCoupling { class MEDFileParameter1TS : public RefCountObject { public: - MEDLOADER_EXPORT virtual MEDFileParameter1TS *deepCpy() const = 0; + MEDLOADER_EXPORT virtual MEDFileParameter1TS *deepCopy() const = 0; MEDLOADER_EXPORT virtual bool isEqual(const MEDFileParameter1TS *other, double eps, std::string& what) const; MEDLOADER_EXPORT virtual void simpleRepr2(int bkOffset, std::ostream& oss) const = 0; MEDLOADER_EXPORT virtual void readValue(med_idt fid, const std::string& name) = 0; @@ -58,7 +58,7 @@ namespace MEDCoupling { public: MEDLOADER_EXPORT static MEDFileParameterDouble1TSWTI *New(int iteration, int order, double time); - MEDLOADER_EXPORT MEDFileParameter1TS *deepCpy() const; + MEDLOADER_EXPORT MEDFileParameter1TS *deepCopy() const; MEDLOADER_EXPORT void setValue(double val) { _arr=val; } MEDLOADER_EXPORT double getValue() const { return _arr; } MEDLOADER_EXPORT bool isEqual(const MEDFileParameter1TS *other, double eps, std::string& what) const; @@ -102,7 +102,7 @@ namespace MEDCoupling MEDLOADER_EXPORT static MEDFileParameterDouble1TS *New(const std::string& fileName); MEDLOADER_EXPORT static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName); MEDLOADER_EXPORT static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName, int dt, int it); - MEDLOADER_EXPORT virtual MEDFileParameter1TS *deepCpy() const; + MEDLOADER_EXPORT virtual MEDFileParameter1TS *deepCopy() const; MEDLOADER_EXPORT virtual bool isEqual(const MEDFileParameter1TS *other, double eps, std::string& what) const; MEDLOADER_EXPORT virtual std::string simpleRepr() const; MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; @@ -127,7 +127,7 @@ namespace MEDCoupling MEDLOADER_EXPORT void setName(const std::string& name) { _name=name; } MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; - MEDLOADER_EXPORT MEDFileParameterMultiTS *deepCpy() const; + MEDLOADER_EXPORT MEDFileParameterMultiTS *deepCopy() const; MEDLOADER_EXPORT bool isEqual(const MEDFileParameterMultiTS *other, double eps, std::string& what) const; MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const; MEDLOADER_EXPORT void writeLL(med_idt fid, const MEDFileWritable& mw) const; @@ -149,7 +149,7 @@ namespace MEDCoupling MEDFileParameterMultiTS(const std::string& fileName, const std::string& paramName); void finishLoading(med_idt fid, med_parameter_type typ, int nbOfSteps); protected: - std::vector< MEDCouplingAutoRefCountObjectPtr > _param_per_ts; + std::vector< MCAuto > _param_per_ts; }; class MEDFileParameters : public RefCountObject, public MEDFileWritable @@ -159,7 +159,7 @@ namespace MEDCoupling MEDLOADER_EXPORT static MEDFileParameters *New(const std::string& fileName); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; - MEDLOADER_EXPORT MEDFileParameters *deepCpy() const; + MEDLOADER_EXPORT MEDFileParameters *deepCopy() const; MEDLOADER_EXPORT bool isEqual(const MEDFileParameters *other, double eps, std::string& what) const; MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const; MEDLOADER_EXPORT void writeLL(med_idt fid) const; @@ -180,7 +180,7 @@ namespace MEDCoupling MEDFileParameters(const MEDFileParameters& other, bool deepCopy); MEDFileParameters(); protected: - std::vector< MEDCouplingAutoRefCountObjectPtr > _params; + std::vector< MCAuto > _params; }; } diff --git a/src/MEDLoader/MEDLoader.cxx b/src/MEDLoader/MEDLoader.cxx index f8211f58b..3580cc46c 100644 --- a/src/MEDLoader/MEDLoader.cxx +++ b/src/MEDLoader/MEDLoader.cxx @@ -29,7 +29,7 @@ #include "MEDCouplingMemArray.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingGaussLocalization.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "InterpKernelAutoPtr.hxx" @@ -608,7 +608,7 @@ std::vector MEDCoupling::GetMeshGroupsNames(const std::string& file std::vector MEDCoupling::GetTypesOfField(const std::string& fileName, const std::string& meshName, const std::string& fieldName) { std::vector ret; - MEDCouplingAutoRefCountObjectPtr fs(MEDFileAnyTypeFieldMultiTS::New(fileName,fieldName,false)); + MCAuto fs(MEDFileAnyTypeFieldMultiTS::New(fileName,fieldName,false)); if(fs->getMeshName()!=meshName) { std::ostringstream oss; oss << "GetTypesOfField : The field \"" << fieldName << "\" in file \"" << fileName << "\" is not lying on mesh \"" << meshName << "\""; @@ -620,7 +620,7 @@ std::vector MEDCoupling::GetTypesOfField(const std::st return ret; for(int i=0;i f1ts(fs->getTimeStepAtPos(i)); + MCAuto f1ts(fs->getTimeStepAtPos(i)); std::vector tof(f1ts->getTypesOfFieldAvailable()); for(std::vector::const_iterator it=tof.begin();it!=tof.end();it++) if(std::find(ret.begin(),ret.end(),*it)==ret.end()) @@ -1042,7 +1042,7 @@ std::vector< std::pair > MEDCoupling::GetNodeFieldIterations(const std: MEDCoupling::MEDCouplingMesh *MEDCoupling::ReadMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax) { MEDCoupling::CheckFileForRead(fileName); - MEDCouplingAutoRefCountObjectPtr mm(MEDFileMesh::New(fileName,meshName)); + MCAuto mm(MEDFileMesh::New(fileName,meshName)); MEDFileMesh *mmPtr(mm); MEDFileUMesh *mmuPtr=dynamic_cast(mmPtr); if(mmuPtr) @@ -1066,7 +1066,7 @@ MEDCoupling::MEDCouplingMesh *MEDCoupling::ReadMeshFromFile(const std::string& f MEDCoupling::MEDCouplingMesh *MEDCoupling::ReadMeshFromFile(const std::string& fileName, int meshDimRelToMax) { MEDCoupling::CheckFileForRead(fileName); - MEDCouplingAutoRefCountObjectPtr mm(MEDFileMesh::New(fileName)); + MCAuto mm(MEDFileMesh::New(fileName)); MEDFileMesh *mmPtr(mm); MEDFileUMesh *mmuPtr=dynamic_cast(mmPtr); if(mmuPtr) @@ -1090,7 +1090,7 @@ MEDCoupling::MEDCouplingMesh *MEDCoupling::ReadMeshFromFile(const std::string& f MEDCoupling::MEDCouplingUMesh *MEDCoupling::ReadUMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax) { MEDCoupling::CheckFileForRead(fileName); - MEDCouplingAutoRefCountObjectPtr mm(MEDFileMesh::New(fileName,meshName)); + MCAuto mm(MEDFileMesh::New(fileName,meshName)); MEDFileMesh *mmPtr(mm); MEDFileUMesh *mmuPtr=dynamic_cast(mmPtr); if(!mmuPtr) @@ -1104,7 +1104,7 @@ MEDCoupling::MEDCouplingUMesh *MEDCoupling::ReadUMeshFromFile(const std::string& MEDCoupling::MEDCouplingUMesh *MEDCoupling::ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax) { MEDCoupling::CheckFileForRead(fileName); - MEDCouplingAutoRefCountObjectPtr mm(MEDFileMesh::New(fileName)); + MCAuto mm(MEDFileMesh::New(fileName)); MEDFileMesh *mmPtr(mm); MEDFileUMesh *mmuPtr=dynamic_cast(mmPtr); if(!mmuPtr) @@ -1125,7 +1125,7 @@ int MEDCoupling::ReadUMeshDimFromFile(const std::string& fileName, const std::st MEDCoupling::MEDCouplingUMesh *MEDCoupling::ReadUMeshFromFamilies(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector& fams) { MEDCoupling::CheckFileForRead(fileName); - MEDCouplingAutoRefCountObjectPtr mm(MEDFileMesh::New(fileName,meshName)); + MCAuto mm(MEDFileMesh::New(fileName,meshName)); MEDFileMesh *mmPtr(mm); MEDFileUMesh *mmuPtr=dynamic_cast(mmPtr); if(!mmuPtr) @@ -1139,7 +1139,7 @@ MEDCoupling::MEDCouplingUMesh *MEDCoupling::ReadUMeshFromFamilies(const std::str MEDCoupling::MEDCouplingUMesh *MEDCoupling::ReadUMeshFromGroups(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector& grps) { MEDCoupling::CheckFileForRead(fileName); - MEDCouplingAutoRefCountObjectPtr mm=MEDFileMesh::New(fileName,meshName); + MCAuto mm=MEDFileMesh::New(fileName,meshName); MEDFileMesh *mmPtr(mm); MEDFileUMesh *mmuPtr=dynamic_cast(mmPtr); if(!mmuPtr) @@ -1175,25 +1175,25 @@ std::vector MEDCoupling::ReadFieldsOnSame return std::vector(); MEDCoupling::CheckFileForRead(fileName); std::vector ret(its.size()); - std::vector< MEDCouplingAutoRefCountObjectPtr > retSafe(its.size()); + std::vector< MCAuto > retSafe(its.size()); if(its.empty()) return ret; //Retrieving mesh of rank 0 and field on rank 0 too. - MEDCouplingAutoRefCountObjectPtr mm=MEDFileMesh::New(fileName,meshName); + MCAuto mm=MEDFileMesh::New(fileName,meshName); MEDFileMesh *mmPtr(mm); MEDFileUMesh *mmuPtr=dynamic_cast(mmPtr); if(!mmuPtr) throw INTERP_KERNEL::Exception("ReadFieldsOnSameMesh : only unstructured mesh is managed !"); - MEDCouplingAutoRefCountObjectPtr m=mmuPtr->getMeshAtLevel(meshDimRelToMax); + MCAuto m=mmuPtr->getMeshAtLevel(meshDimRelToMax); const DataArrayInt *o2n=mmuPtr->getNumberFieldAtLevel(meshDimRelToMax); - MEDCouplingAutoRefCountObjectPtr m2(m->clone(true)); + MCAuto m2(m->clone(true)); if(o2n) m2->renumberCells(o2n->begin(),true); int i=0; for(std::vector >::const_iterator it=its.begin();it!=its.end();it++,i++) { - MEDCouplingAutoRefCountObjectPtr ff=MEDFileField1TS::New(fileName,fieldName,(*it).first,(*it).second); - MEDCouplingAutoRefCountObjectPtr retElt=ff->getFieldOnMeshAtLevel(type,m); + MCAuto ff=MEDFileField1TS::New(fileName,fieldName,(*it).first,(*it).second); + MCAuto retElt=ff->getFieldOnMeshAtLevel(type,m); if(o2n) retElt->renumberCells(o2n->begin(),true); retElt->setMesh(m2); @@ -1231,12 +1231,12 @@ std::vector MEDCoupling::ReadFieldsGaussN MEDCoupling::MEDCouplingFieldDouble *MEDCoupling::ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) { - MEDCouplingAutoRefCountObjectPtr ff(MEDFileField1TS::New(fileName,fieldName,iteration,order)); - MEDCouplingAutoRefCountObjectPtr mm(MEDFileMesh::New(fileName,meshName)); - MEDCouplingAutoRefCountObjectPtr m(mm->getMeshAtLevel(meshDimRelToMax,false)); + MCAuto ff(MEDFileField1TS::New(fileName,fieldName,iteration,order)); + MCAuto mm(MEDFileMesh::New(fileName,meshName)); + MCAuto m(mm->getMeshAtLevel(meshDimRelToMax,false)); MEDFileMesh *mPtr(mm); MEDFileUMesh *muPtr=dynamic_cast(mPtr); - MEDCouplingAutoRefCountObjectPtr ret(ff->getFieldOnMeshAtLevel(ON_CELLS,m)); + MCAuto ret(ff->getFieldOnMeshAtLevel(ON_CELLS,m)); if(muPtr) { const DataArrayInt *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax)); @@ -1248,11 +1248,11 @@ MEDCoupling::MEDCouplingFieldDouble *MEDCoupling::ReadFieldCell(const std::strin MEDCoupling::MEDCouplingFieldDouble *MEDCoupling::ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) { - MEDCouplingAutoRefCountObjectPtr ff(MEDFileField1TS::New(fileName,fieldName,iteration,order)); - MEDCouplingAutoRefCountObjectPtr mm(MEDFileMesh::New(fileName,meshName)); - MEDCouplingAutoRefCountObjectPtr m(mm->getMeshAtLevel(meshDimRelToMax,false)); + MCAuto ff(MEDFileField1TS::New(fileName,fieldName,iteration,order)); + MCAuto mm(MEDFileMesh::New(fileName,meshName)); + MCAuto m(mm->getMeshAtLevel(meshDimRelToMax,false)); MEDFileMesh *mPtr(mm); - MEDCouplingAutoRefCountObjectPtr ret(ff->getFieldOnMeshAtLevel(ON_NODES,m)); + MCAuto ret(ff->getFieldOnMeshAtLevel(ON_NODES,m)); MEDFileUMesh *muPtr=dynamic_cast(mPtr); if(ff->getPflsReallyUsed().empty()) { @@ -1266,19 +1266,19 @@ MEDCoupling::MEDCouplingFieldDouble *MEDCoupling::ReadFieldNode(const std::strin else { DataArrayInt *pfl=0,*arr2=0; - MEDCouplingAutoRefCountObjectPtr arr(ff->getFieldWithProfile(ON_NODES,meshDimRelToMax,mm,pfl)); - MEDCouplingAutoRefCountObjectPtr pflSafe(pfl); - MEDCouplingAutoRefCountObjectPtr mp(m->getCellIdsFullyIncludedInNodeIds(pfl->begin(),pfl->end())); - MEDCouplingAutoRefCountObjectPtr mzip(static_cast(m->buildPartAndReduceNodes(mp->begin(),mp->end(),arr2))); - MEDCouplingAutoRefCountObjectPtr arr2Safe(arr2); - MEDCouplingAutoRefCountObjectPtr arr3(arr2->invertArrayO2N2N2O(mzip->getNumberOfNodes())); - MEDCouplingAutoRefCountObjectPtr pflSorted(pflSafe->deepCpy()); pflSorted->sort(true); + MCAuto arr(ff->getFieldWithProfile(ON_NODES,meshDimRelToMax,mm,pfl)); + MCAuto pflSafe(pfl); + MCAuto mp(m->getCellIdsFullyIncludedInNodeIds(pfl->begin(),pfl->end())); + MCAuto mzip(static_cast(m->buildPartAndReduceNodes(mp->begin(),mp->end(),arr2))); + MCAuto arr2Safe(arr2); + MCAuto arr3(arr2->invertArrayO2N2N2O(mzip->getNumberOfNodes())); + MCAuto pflSorted(pflSafe->deepCopy()); pflSorted->sort(true); if(!arr3->isEqualWithoutConsideringStr(*pflSorted)) throw INTERP_KERNEL::Exception("ReadFieldNode : not implemented yet !"); if(!arr3->isEqualWithoutConsideringStr(*pflSafe)) { - MEDCouplingAutoRefCountObjectPtr o2n2(pflSafe->checkAndPreparePermutation()); - MEDCouplingAutoRefCountObjectPtr n2o2(o2n2->invertArrayO2N2N2O(o2n2->getNumberOfTuples())); + MCAuto o2n2(pflSafe->checkAndPreparePermutation()); + MCAuto n2o2(o2n2->invertArrayO2N2N2O(o2n2->getNumberOfTuples())); mzip->renumberNodes(n2o2->begin(),n2o2->getNumberOfTuples()); arr->setName(""); ret->setArray(arr); @@ -1290,12 +1290,12 @@ MEDCoupling::MEDCouplingFieldDouble *MEDCoupling::ReadFieldNode(const std::strin MEDCoupling::MEDCouplingFieldDouble *MEDCoupling::ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) { - MEDCouplingAutoRefCountObjectPtr ff(MEDFileField1TS::New(fileName,fieldName,iteration,order)); - MEDCouplingAutoRefCountObjectPtr mm(MEDFileMesh::New(fileName,meshName)); - MEDCouplingAutoRefCountObjectPtr m(mm->getMeshAtLevel(meshDimRelToMax,false)); + MCAuto ff(MEDFileField1TS::New(fileName,fieldName,iteration,order)); + MCAuto mm(MEDFileMesh::New(fileName,meshName)); + MCAuto m(mm->getMeshAtLevel(meshDimRelToMax,false)); MEDFileMesh *mPtr(mm); MEDFileUMesh *muPtr=dynamic_cast(mPtr); - MEDCouplingAutoRefCountObjectPtr ret(ff->getFieldOnMeshAtLevel(ON_GAUSS_PT,m)); + MCAuto ret(ff->getFieldOnMeshAtLevel(ON_GAUSS_PT,m)); if(muPtr) { const DataArrayInt *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax)); @@ -1307,12 +1307,12 @@ MEDCoupling::MEDCouplingFieldDouble *MEDCoupling::ReadFieldGauss(const std::stri MEDCoupling::MEDCouplingFieldDouble *MEDCoupling::ReadFieldGaussNE(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) { - MEDCouplingAutoRefCountObjectPtr ff(MEDFileField1TS::New(fileName,fieldName,iteration,order)); - MEDCouplingAutoRefCountObjectPtr mm(MEDFileMesh::New(fileName,meshName)); - MEDCouplingAutoRefCountObjectPtr m(mm->getMeshAtLevel(meshDimRelToMax,false)); + MCAuto ff(MEDFileField1TS::New(fileName,fieldName,iteration,order)); + MCAuto mm(MEDFileMesh::New(fileName,meshName)); + MCAuto m(mm->getMeshAtLevel(meshDimRelToMax,false)); MEDFileMesh *mPtr(mm); MEDFileUMesh *muPtr=dynamic_cast(mPtr); - MEDCouplingAutoRefCountObjectPtr ret(ff->getFieldOnMeshAtLevel(ON_GAUSS_NE,m)); + MCAuto ret(ff->getFieldOnMeshAtLevel(ON_GAUSS_NE,m)); if(muPtr) { const DataArrayInt *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax)); @@ -1336,7 +1336,7 @@ void MEDCoupling::WriteMesh(const std::string& fileName, const MEDCoupling::MEDC const MEDCoupling1GTUMesh *um2(dynamic_cast(mesh)); if(um2) { - MEDCouplingAutoRefCountObjectPtr mmu(MEDFileUMesh::New()); + MCAuto mmu(MEDFileUMesh::New()); AssignStaticWritePropertiesTo(*mmu); mmu->setMeshAtLevel(0,const_cast(um2)); mmu->write(fileName,mod); @@ -1345,7 +1345,7 @@ void MEDCoupling::WriteMesh(const std::string& fileName, const MEDCoupling::MEDC const MEDCouplingCMesh *um3(dynamic_cast(mesh)); if(um3) { - MEDCouplingAutoRefCountObjectPtr mmc(MEDFileCMesh::New()); + MCAuto mmc(MEDFileCMesh::New()); AssignStaticWritePropertiesTo(*mmc); mmc->setMesh(const_cast(um3)); mmc->write(fileName,mod); @@ -1354,7 +1354,7 @@ void MEDCoupling::WriteMesh(const std::string& fileName, const MEDCoupling::MEDC const MEDCouplingCurveLinearMesh *um4(dynamic_cast(mesh)); if(um4) { - MEDCouplingAutoRefCountObjectPtr mmc(MEDFileCurveLinearMesh::New()); + MCAuto mmc(MEDFileCurveLinearMesh::New()); AssignStaticWritePropertiesTo(*mmc); mmc->setMesh(const_cast(um4)); mmc->write(fileName,mod); @@ -1368,9 +1368,9 @@ void MEDCoupling::WriteUMesh(const std::string& fileName, const MEDCoupling::MED if(!mesh) throw INTERP_KERNEL::Exception("WriteUMesh : input mesh is null !"); int mod=writeFromScratch?2:0; - MEDCouplingAutoRefCountObjectPtr m(MEDFileUMesh::New()); + MCAuto m(MEDFileUMesh::New()); AssignStaticWritePropertiesTo(*m); - MEDCouplingAutoRefCountObjectPtr mcpy(static_cast(mesh->deepCpy())); + MCAuto mcpy(static_cast(mesh->deepCopy())); m->setMeshAtLevel(0,mcpy,true); m->write(fileName,mod); } @@ -1391,7 +1391,7 @@ void MEDCoupling::WriteUMeshesPartition(const std::string& fileName, const std:: std::ostringstream oss; oss << "File with name \'" << fileName << "\' has not valid permissions !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDCouplingAutoRefCountObjectPtr m(MEDFileUMesh::New()); + MCAuto m(MEDFileUMesh::New()); AssignStaticWritePropertiesTo(*m); m->setGroupsFromScratch(0,meshes,true); m->setName(meshNameC); @@ -1407,7 +1407,7 @@ void MEDCoupling::WriteUMeshesPartitionDep(const std::string& fileName, const st void MEDCoupling::WriteUMeshes(const std::string& fileName, const std::vector& meshes, bool writeFromScratch) { int mod=writeFromScratch?2:0; - MEDCouplingAutoRefCountObjectPtr m(MEDFileUMesh::New()); + MCAuto m(MEDFileUMesh::New()); AssignStaticWritePropertiesTo(*m); m->setMeshes(meshes,true); m->write(fileName,mod); @@ -1415,22 +1415,22 @@ void MEDCoupling::WriteUMeshes(const std::string& fileName, const std::vector ff(MEDFileField1TS::New()); + MCAuto ff(MEDFileField1TS::New()); AssignStaticWritePropertiesTo(*ff); - MEDCouplingAutoRefCountObjectPtr f2(f->deepCpy()); + MCAuto f2(f->deepCopy()); const MEDCouplingMesh *m(f2->getMesh()); const MEDCouplingUMesh *um(dynamic_cast(m)); const MEDCoupling1GTUMesh *um2(dynamic_cast(m)); const MEDCouplingCMesh *um3(dynamic_cast(m)); const MEDCouplingCurveLinearMesh *um4(dynamic_cast(m)); - MEDCouplingAutoRefCountObjectPtr mm; + MCAuto mm; int mod=writeFromScratch?2:0; if(um) { - MEDCouplingAutoRefCountObjectPtr mmu(MEDFileUMesh::New()); + MCAuto mmu(MEDFileUMesh::New()); AssignStaticWritePropertiesTo(*mmu); - MEDCouplingAutoRefCountObjectPtr o2n(um->getRenumArrForMEDFileFrmt()); - MEDCouplingAutoRefCountObjectPtr n2o(o2n->invertArrayO2N2N2O(o2n->getNumberOfTuples())); + MCAuto o2n(um->getRenumArrForMEDFileFrmt()); + MCAuto n2o(o2n->invertArrayO2N2N2O(o2n->getNumberOfTuples())); f2->renumberCells(o2n->begin(),false); mmu->setMeshAtLevel(0,const_cast(static_cast(f2->getMesh()))); mmu->setRenumFieldArr(0,n2o); @@ -1439,7 +1439,7 @@ void MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(const std::stri } else if(um2) { - MEDCouplingAutoRefCountObjectPtr mmu(MEDFileUMesh::New()); + MCAuto mmu(MEDFileUMesh::New()); AssignStaticWritePropertiesTo(*mmu); mmu->setMeshAtLevel(0,const_cast(um2)); ff->setFieldNoProfileSBT(f2); @@ -1447,7 +1447,7 @@ void MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(const std::stri } else if(um3) { - MEDCouplingAutoRefCountObjectPtr mmc(MEDFileCMesh::New()); + MCAuto mmc(MEDFileCMesh::New()); AssignStaticWritePropertiesTo(*mmc); mmc->setMesh(const_cast(um3)); ff->setFieldNoProfileSBT(f2); @@ -1455,7 +1455,7 @@ void MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(const std::stri } else if(um4) { - MEDCouplingAutoRefCountObjectPtr mmc(MEDFileCurveLinearMesh::New()); + MCAuto mmc(MEDFileCurveLinearMesh::New()); AssignStaticWritePropertiesTo(*mmc); mmc->setMesh(const_cast(um4)); ff->setFieldNoProfileSBT(f2); @@ -1470,7 +1470,7 @@ void MEDCoupling::WriteField(const std::string& fileName, const MEDCoupling::MED { if(!f) throw INTERP_KERNEL::Exception("WriteField : input field is NULL !"); - f->checkCoherency(); + f->checkConsistencyLight(); int status=MEDLoaderBase::getStatusOfFile(fileName); if(status!=MEDLoaderBase::EXIST_RW && status!=MEDLoaderBase::NOT_EXIST) { @@ -1491,34 +1491,34 @@ void MEDCoupling::WriteField(const std::string& fileName, const MEDCoupling::MED MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(fileName,f,false); else { - MEDCouplingAutoRefCountObjectPtr mm(MEDFileMesh::New(fileName,f->getMesh()->getName().c_str())); + MCAuto mm(MEDFileMesh::New(fileName,f->getMesh()->getName().c_str())); AssignStaticWritePropertiesTo(*mm); const MEDFileMesh *mmPtr(mm); const MEDFileUMesh *mmuPtr=dynamic_cast(mmPtr); if(!mmuPtr) throw INTERP_KERNEL::Exception("WriteField : only umeshes are supported now !"); - MEDCouplingAutoRefCountObjectPtr f2(f->deepCpy()); + MCAuto f2(f->deepCopy()); MEDCouplingUMesh *m=dynamic_cast(const_cast(f2->getMesh())); if(!m) throw INTERP_KERNEL::Exception("WriteField : only umesh in input field supported !"); - MEDCouplingAutoRefCountObjectPtr o2n=m->getRenumArrForMEDFileFrmt(); + MCAuto o2n=m->getRenumArrForMEDFileFrmt(); f2->renumberCells(o2n->begin(),false); m=static_cast(const_cast(f2->getMesh())); - MEDCouplingAutoRefCountObjectPtr mread=mmuPtr->getMeshAtLevel(m->getMeshDimension()-mm->getMeshDimension()); + MCAuto mread=mmuPtr->getMeshAtLevel(m->getMeshDimension()-mm->getMeshDimension()); if(f2->getTypeOfField()!=ON_NODES) { m->tryToShareSameCoordsPermute(*mread,_EPS_FOR_NODE_COMP); DataArrayInt *part=0; bool b=mread->areCellsIncludedIn(m,_COMP_FOR_CELL,part); - MEDCouplingAutoRefCountObjectPtr partSafe(part); + MCAuto partSafe(part); if(!b) { std::ostringstream oss; oss << "WriteField : The file \""<< fileName << "\" already contains a mesh named \""<< f->getMesh()->getName() << "\" and this mesh in the file is not compatible (a subpart) with the mesh you intend to write ! This is maybe due to a too strict policy ! Try with to lease it by calling SetCompPolicyForCell !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDCouplingAutoRefCountObjectPtr f1ts(MEDFileField1TS::New()); + MCAuto f1ts(MEDFileField1TS::New()); AssignStaticWritePropertiesTo(*f1ts); - if(part->isIdentity2(mread->getNumberOfCells())) + if(part->isIota(mread->getNumberOfCells())) f1ts->setFieldNoProfileSBT(f2); else { @@ -1532,15 +1532,15 @@ void MEDCoupling::WriteField(const std::string& fileName, const MEDCoupling::MED { DataArrayInt *part=0; bool b=mread->getCoords()->areIncludedInMe(m->getCoords(),_EPS_FOR_NODE_COMP,part); - MEDCouplingAutoRefCountObjectPtr partSafe(part); + MCAuto partSafe(part); if(!b) { std::ostringstream oss; oss << "WriteField : The file \""<< fileName << "\" already contains a mesh named \""<< f->getMesh()->getName() << "\" and this mesh in the file is not compatible (a subpart regarding nodes) with the mesh you intend to write ! This is maybe due to a too strict epsilon ! Try with to lease it by calling SetEpsilonForNodeComp !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDCouplingAutoRefCountObjectPtr f1ts(MEDFileField1TS::New()); + MCAuto f1ts(MEDFileField1TS::New()); AssignStaticWritePropertiesTo(*f1ts); - if(part->isIdentity2(mread->getNumberOfNodes())) + if(part->isIota(mread->getNumberOfNodes())) f1ts->setFieldNoProfileSBT(f2); else { @@ -1562,20 +1562,20 @@ void MEDCoupling::WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, { if(!f) throw INTERP_KERNEL::Exception("WriteFieldUsingAlreadyWrittenMesh : input field is null !"); - f->checkCoherency(); + f->checkConsistencyLight(); int status=MEDLoaderBase::getStatusOfFile(fileName); if(status!=MEDLoaderBase::EXIST_RW) { std::ostringstream oss; oss << "File with name \'" << fileName << "\' has not valid permissions or not exists !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDCouplingAutoRefCountObjectPtr f1ts(MEDFileField1TS::New()); + MCAuto f1ts(MEDFileField1TS::New()); AssignStaticWritePropertiesTo(*f1ts); MEDCouplingUMesh *m(dynamic_cast(const_cast(f->getMesh()))); if(m) { - MEDCouplingAutoRefCountObjectPtr o2n(m->getRenumArrForMEDFileFrmt()); - MEDCouplingAutoRefCountObjectPtr f2(f->deepCpy()); + MCAuto o2n(m->getRenumArrForMEDFileFrmt()); + MCAuto f2(f->deepCopy()); f2->renumberCells(o2n->begin(),false); f1ts->setFieldNoProfileSBT(f2); } diff --git a/src/MEDLoader/SauvMedConvertor.cxx b/src/MEDLoader/SauvMedConvertor.cxx index 82e998aed..f1542f90c 100644 --- a/src/MEDLoader/SauvMedConvertor.cxx +++ b/src/MEDLoader/SauvMedConvertor.cxx @@ -2379,11 +2379,11 @@ Group* IntermediateMED::addNewGroup(std::vector* groupsTo MEDCoupling::MEDFileData* IntermediateMED::convertInMEDFileDS() { - MEDCouplingAutoRefCountObjectPtr< MEDFileUMesh > mesh = makeMEDFileMesh(); - MEDCouplingAutoRefCountObjectPtr< MEDFileFields > fields = makeMEDFileFields(mesh); + MCAuto< MEDFileUMesh > mesh = makeMEDFileMesh(); + MCAuto< MEDFileFields > fields = makeMEDFileFields(mesh); - MEDCouplingAutoRefCountObjectPtr< MEDFileMeshes > meshes = MEDFileMeshes::New(); - MEDCouplingAutoRefCountObjectPtr< MEDFileData > medData = MEDFileData::New(); + MCAuto< MEDFileMeshes > meshes = MEDFileMeshes::New(); + MCAuto< MEDFileData > medData = MEDFileData::New(); meshes->pushMesh( mesh ); medData->setMeshes( meshes ); if ( fields ) medData->setFields( fields ); @@ -3193,7 +3193,7 @@ void IntermediateMED::setGroups( MEDCoupling::MEDFileUMesh* mesh ) const int meshDimRelToMaxExt = ( dim == 0 ? 1 : dim - meshDim ); std::vector medGroups; - std::vector > refGroups; + std::vector > refGroups; for ( size_t i = 0; i < _groups.size(); ++i ) { Group& grp = _groups[i]; @@ -3272,7 +3272,7 @@ void IntermediateMED::setGroups( MEDCoupling::MEDFileUMesh* mesh ) if ( !grp._refNames[ iRef ].empty() && uniqueNames.insert( grp._refNames[ iRef ]).second ) // for name uniqueness (23155) { - refGroups.push_back( grp._medGroup->deepCpy() ); + refGroups.push_back( grp._medGroup->deepCopy() ); refGroups.back()->setName( grp._refNames[ iRef ].c_str() ); medGroups.push_back( refGroups.back() ); } @@ -3433,25 +3433,25 @@ void IntermediateMED::setTS( SauvUtilities::DoubleField* fld, // set the mesh if ( onAll ) { - MEDCouplingAutoRefCountObjectPtr + MCAuto < MEDCouplingUMesh > dimMesh = mesh->getMeshAtLevel( dimRel ); timeStamp->setMesh( dimMesh ); } else if ( timeStamp->getTypeOfField() == MEDCoupling::ON_NODES ) { DataArrayDouble * coo = mesh->getCoords(); - MEDCouplingAutoRefCountObjectPtr + MCAuto subCoo = coo->selectByTupleId(support->_medGroup->begin(), support->_medGroup->end()); - MEDCouplingAutoRefCountObjectPtr< MEDCouplingUMesh > nodeSubMesh = + MCAuto< MEDCouplingUMesh > nodeSubMesh = MEDCouplingUMesh::Build0DMeshFromCoords( subCoo ); timeStamp->setMesh( nodeSubMesh ); } else { - MEDCouplingAutoRefCountObjectPtr + MCAuto < MEDCouplingUMesh > dimMesh = mesh->getMeshAtLevel( dimRel ); - MEDCouplingAutoRefCountObjectPtr + MCAuto subMesh = dimMesh->buildPart(support->_medGroup->begin(), support->_medGroup->end()); timeStamp->setMesh( subMesh); @@ -3485,7 +3485,7 @@ void IntermediateMED::setTS( SauvUtilities::DoubleField* fld, timeStamp->setOrder( nbTS ); // add the time-stamp - timeStamp->checkCoherency(); + timeStamp->checkConsistencyLight(); if ( onAll ) fld->_curMedField->appendFieldNoProfileSBT( timeStamp ); else diff --git a/src/MEDLoader/SauvReader.cxx b/src/MEDLoader/SauvReader.cxx index 150c22982..6c4f69ce9 100644 --- a/src/MEDLoader/SauvReader.cxx +++ b/src/MEDLoader/SauvReader.cxx @@ -24,7 +24,7 @@ #include "SauvReader.hxx" #include "SauvMedConvertor.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "NormalizedUnstructuredMesh.hxx" #include "MEDCouplingRefCountObject.hxx" @@ -48,7 +48,7 @@ SauvReader* SauvReader::New(const std::string& fileName) { if ( fileName.empty() ) THROW_IK_EXCEPTION("Invalid file name"); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr< SauvUtilities::FileReader> parser; + MEDCoupling::MCAuto< SauvUtilities::FileReader> parser; // try to open as XRD parser = new XDRReader( fileName.c_str() ); diff --git a/src/MEDLoader/SauvWriter.cxx b/src/MEDLoader/SauvWriter.cxx index 60cce9b53..7d6440aa2 100644 --- a/src/MEDLoader/SauvWriter.cxx +++ b/src/MEDLoader/SauvWriter.cxx @@ -374,7 +374,7 @@ void SauvWriter::fillFamilySubMeshes() for ( size_t iDim = 0; iDim < dims.size(); ++iDim ) { int dimRelExt = dims[ iDim ]; - MEDCouplingAutoRefCountObjectPtr< MEDCouplingMesh > mesh = _fileMesh->getMeshAtLevel(dimRelExt); + MCAuto< MEDCouplingMesh > mesh = _fileMesh->getMeshAtLevel(dimRelExt); const DataArrayInt * famIds = _fileMesh->getFamilyFieldAtLevel(dimRelExt); if ( !famIds ) continue; @@ -488,7 +488,7 @@ void SauvWriter::fillProfileSubMeshes() SubMesh* nilSm = (SubMesh*) 0; for ( int isOnNodes = 0; isOnNodes < 2; ++isOnNodes ) { - vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldMultiTS > > + vector< MCAuto< MEDFileFieldMultiTS > > fields = isOnNodes ? _nodeFields : _cellFields; for ( size_t i = 0; i < fields.size(); ++i ) { @@ -563,7 +563,7 @@ void SauvWriter::makeProfileIDs( SubMesh* sm, INTERP_KERNEL::NormalizedCellType type, const DataArrayInt* profile ) { - MEDCouplingAutoRefCountObjectPtr< MEDCouplingMesh > + MCAuto< MEDCouplingMesh > mesh = _fileMesh->getMeshAtLevel(sm->_dimRelExt); const MEDCouplingUMesh* uMesh = dynamic_cast< const MEDCouplingUMesh* > ((const MEDCouplingMesh*) mesh ); @@ -600,7 +600,7 @@ void SauvWriter::makeProfileIDs( SubMesh* sm, code[2] = -1; } vector idsPerType( 1, profile ); - MEDCouplingAutoRefCountObjectPtr + MCAuto resIDs = uMesh->checkTypeConsistencyAndContig( code, idsPerType ); if (( const DataArrayInt *) resIDs ) { @@ -661,7 +661,7 @@ void SauvWriter::write(const std::string& fileName) void SauvWriter::writeFileHead() { - MEDCouplingAutoRefCountObjectPtr< MEDCouplingMesh > mesh = _fileMesh->getMeshAtLevel(0); + MCAuto< MEDCouplingMesh > mesh = _fileMesh->getMeshAtLevel(0); *_sauvFile << " ENREGISTREMENT DE TYPE 4" << endl @@ -742,9 +742,9 @@ void SauvWriter::writeSubMeshes() else { // write each sub-type as a SAUV sub-mesh - MEDCouplingAutoRefCountObjectPtr< MEDCouplingMesh > + MCAuto< MEDCouplingMesh > mesh = _fileMesh->getMeshAtLevel( sm._dimRelExt ); - MEDCouplingAutoRefCountObjectPtr< MEDCouplingUMesh> + MCAuto< MEDCouplingUMesh> umesh = mesh->buildUnstructured(); for ( int iType=0; iType < sm.cellIDsByTypeSize(); ++iType ) @@ -841,8 +841,8 @@ void SauvWriter::writeCompoundSubMesh(int iSub) void SauvWriter::writeNodes() { - MEDCouplingAutoRefCountObjectPtr< MEDCouplingMesh > mesh = _fileMesh->getMeshAtLevel( 1 ); - MEDCouplingAutoRefCountObjectPtr< MEDCouplingUMesh > umesh = mesh->buildUnstructured(); + MCAuto< MEDCouplingMesh > mesh = _fileMesh->getMeshAtLevel( 1 ); + MCAuto< MEDCouplingUMesh > umesh = mesh->buildUnstructured(); // write the index connecting nodes with their coodrinates @@ -871,7 +871,7 @@ void SauvWriter::writeNodes() _sauvFile->precision(14); _sauvFile->setf( ios_base::scientific, ios_base::floatfield ); _sauvFile->setf( ios_base::uppercase ); - MEDCouplingAutoRefCountObjectPtr< DataArrayDouble> coordArray = umesh->getCoordinatesAndOwner(); + MCAuto< DataArrayDouble> coordArray = umesh->getCoordinatesAndOwner(); const double precision = 1.e-99; // PAL12077 for ( int i = 0; i < nbNodes; ++i) { @@ -996,7 +996,7 @@ void SauvWriter::writeLongNames() void SauvWriter::writeFieldNames( const bool isNodal, std::map& fldNamePrefixMap) { - vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldMultiTS > >& + vector< MCAuto< MEDFileFieldMultiTS > >& flds = isNodal ? _nodeFields : _cellFields; map nameNbMap; diff --git a/src/MEDLoader/SauvWriter.hxx b/src/MEDLoader/SauvWriter.hxx index 1ae9ee2c2..e076683c5 100644 --- a/src/MEDLoader/SauvWriter.hxx +++ b/src/MEDLoader/SauvWriter.hxx @@ -27,7 +27,7 @@ #include "MEDCouplingRefCountObject.hxx" #include "NormalizedUnstructuredMesh.hxx" #include "SauvUtilities.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include #include @@ -97,9 +97,9 @@ namespace MEDCoupling private: - MEDCouplingAutoRefCountObjectPtr< MEDFileMesh > _fileMesh; - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldMultiTS > > _nodeFields; - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldMultiTS > > _cellFields; + MCAuto< MEDFileMesh > _fileMesh; + std::vector< MCAuto< MEDFileFieldMultiTS > > _nodeFields; + std::vector< MCAuto< MEDFileFieldMultiTS > > _cellFields; std::vector _subs; std::map< int, SubMesh* > _famIDs2Sub; diff --git a/src/MEDLoader/Swig/CaseReader.py b/src/MEDLoader/Swig/CaseReader.py index 663e54ac4..69791c65e 100644 --- a/src/MEDLoader/Swig/CaseReader.py +++ b/src/MEDLoader/Swig/CaseReader.py @@ -61,7 +61,7 @@ class CaseReader(CaseIO): pass c=DataArrayInt(len(cells),nbNodesPerCell+1) ; c[:,0]=ct ; c[:,1:]=c2-1 ; c.rearrange(1) m.setConnectivity(c,cI,True) - m.checkCoherency1() + m.checkConsistency() return m def __traduceMeshForPolyhed(self,name,coords,arr0,arr1,arr2): @@ -72,13 +72,13 @@ class CaseReader(CaseIO): m.setCoords(coo) # arr2=arr2[:]-1 - arr0mc0=DataArrayInt(arr0) ; arr0mc0.computeOffsets2() - arr0mc1=DataArrayInt(arr0).deepCpy() - arr0mc2=DataArrayInt(len(arr0),2) ; arr0mc2[:,0]=DataArrayInt(arr0)-1 ; arr0mc2[:,1]=1 ; arr0mc2.rearrange(1) ; arr0mc2.computeOffsets2() + arr0mc0=DataArrayInt(arr0) ; arr0mc0.computeOffsetsFull() + arr0mc1=DataArrayInt(arr0).deepCopy() + arr0mc2=DataArrayInt(len(arr0),2) ; arr0mc2[:,0]=DataArrayInt(arr0)-1 ; arr0mc2[:,1]=1 ; arr0mc2.rearrange(1) ; arr0mc2.computeOffsetsFull() arr0mc3=DataArrayInt.Range(0,2*len(arr0),2).buildExplicitArrByRanges(arr0mc2) - arr1mc0=DataArrayInt(arr1) ; arr1mc0.computeOffsets2() + arr1mc0=DataArrayInt(arr1) ; arr1mc0.computeOffsetsFull() arr1mc1=arr1mc0[arr0mc0] ; arr1mc1[1:]+=arr0mc0[1:] - arr1mc2=DataArrayInt(arr1).deepCpy() ; arr1mc2+=1 ; arr1mc2.computeOffsets2() + arr1mc2=DataArrayInt(arr1).deepCopy() ; arr1mc2+=1 ; arr1mc2.computeOffsetsFull() arr2mc0=(arr1mc2[1:])[arr0mc3] # c=DataArrayInt(arr1.size+arr2.size) @@ -88,7 +88,7 @@ class CaseReader(CaseIO): c[a]=DataArrayInt(arr2) # m.setConnectivity(c,arr1mc1,True) - m.checkCoherency1() + m.checkConsistency() return m def __traduceMeshForPolygon(self,name,coords,arr0,arr1): @@ -98,14 +98,14 @@ class CaseReader(CaseIO): m=MEDCouplingUMesh(name,2) m.setCoords(coo) # - arr0_0=DataArrayInt(arr0+1) ; arr0_0.computeOffsets2() - arr0_1=DataArrayInt(len(arr0),2) ; arr0_1[:,1]=DataArrayInt(arr0) ; arr0_1[:,0]=1 ; arr0_1.rearrange(1) ; arr0_1.computeOffsets2() + arr0_0=DataArrayInt(arr0+1) ; arr0_0.computeOffsetsFull() + arr0_1=DataArrayInt(len(arr0),2) ; arr0_1[:,1]=DataArrayInt(arr0) ; arr0_1[:,0]=1 ; arr0_1.rearrange(1) ; arr0_1.computeOffsetsFull() arr0_2=DataArrayInt.Range(1,2*len(arr0),2).buildExplicitArrByRanges(arr0_1) c=DataArrayInt(len(arr0)+len(arr1)) ; c[:]=0 ; c[arr0_0[:-1]]=NORM_POLYGON c[arr0_2]=DataArrayInt(arr1-1) # m.setConnectivity(c,arr0_0,True) - m.checkCoherency1() + m.checkConsistency() return m def __convertGeo2MED(self,geoFileName): @@ -289,7 +289,7 @@ class CaseReader(CaseIO): pass f=MEDCouplingFieldDouble(self.discSpatial2[discr],ONE_TIME) ; f.setName("%s_%s"%(fieldName,mcmeshes[meshId].getName())) f.setMesh(mcmeshes[meshId]) ; f.setArray(vals2) ; f.setTime(float(it),it,-1) - f.checkCoherency() + f.checkConsistencyLight() mlfields[locId+meshId].appendFieldNoProfileSBT(f) pass @@ -342,7 +342,7 @@ class CaseReader(CaseIO): pass f=MEDCouplingFieldDouble(self.discSpatial2[discr],ONE_TIME) ; f.setName("%s_%s"%(fieldName,mcmeshes[nbTurn].getName())) f.setMesh(mcmeshes[nbTurn]) ; f.setArray(vals2) ; f.setTime(float(it),it,-1) - f.checkCoherency() + f.checkConsistencyLight() mlfields[locId+nbTurn].appendFieldNoProfileSBT(f) nbTurn+=1 pass diff --git a/src/MEDLoader/Swig/CaseWriter.py b/src/MEDLoader/Swig/CaseWriter.py index cb80579b5..a62133fd8 100644 --- a/src/MEDLoader/Swig/CaseWriter.py +++ b/src/MEDLoader/Swig/CaseWriter.py @@ -172,7 +172,7 @@ time values: c=mp.computeNbOfFacesPerCell() a=np.memmap(f,dtype='int32',mode='w+',offset=mm.tell(),shape=(nbelem,)) a[:]=c.toNumPyArray(); a.flush() ; mm.seek(mm.tell()+nbelem*4) - c=mp.getNodalConnectivity()[:] ; c.pushBackSilent(-1) ; c[mp.getNodalConnectivityIndex()[:-1]]=-1 ; ids=c.getIdsEqual(-1) ; nbOfNodesPerFace=ids.deltaShiftIndex()-1 + c=mp.getNodalConnectivity()[:] ; c.pushBackSilent(-1) ; c[mp.getNodalConnectivityIndex()[:-1]]=-1 ; ids=c.findIdsEqual(-1) ; nbOfNodesPerFace=ids.deltaShiftIndex()-1 a=np.memmap(f,dtype='int32',mode='w+',offset=mm.tell(),shape=(len(nbOfNodesPerFace),)) a[:]=nbOfNodesPerFace.toNumPyArray() ; a.flush() ; mm.seek(mm.tell()+len(nbOfNodesPerFace)*4) ids2=ids.buildComplement(ids.back()+1) diff --git a/src/MEDLoader/Swig/MEDLoader.i b/src/MEDLoader/Swig/MEDLoader.i index 4160f18e1..bf10fe1c0 100644 --- a/src/MEDLoader/Swig/MEDLoader.i +++ b/src/MEDLoader/Swig/MEDLoader.i @@ -131,7 +131,7 @@ def MEDCouplingIMeshnew(cls,*args): return _MEDLoader.MEDCouplingIMesh____new___(cls,args) def MEDCouplingExtrudedMeshnew(cls,*args): import _MEDLoader - return _MEDLoader.MEDCouplingExtrudedMesh____new___(cls,args) + return _MEDLoader.MEDCouplingMappedExtrudedMesh____new___(cls,args) %} %pythoncode %{ diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index e8c429754..1a4544caf 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -86,7 +86,7 @@ using namespace MEDCoupling; %newobject MEDCoupling::ReadFieldGaussNE; %newobject MEDCoupling::MEDFileMesh::New; %newobject MEDCoupling::MEDFileMesh::createNewEmpty; -%newobject MEDCoupling::MEDFileMesh::deepCpy; +%newobject MEDCoupling::MEDFileMesh::deepCopy; %newobject MEDCoupling::MEDFileMesh::shallowCpy; %newobject MEDCoupling::MEDFileMesh::getMeshAtLevel; %newobject MEDCoupling::MEDFileMesh::__getitem__; @@ -126,10 +126,10 @@ using namespace MEDCoupling; %newobject MEDCoupling::MEDFileCMesh::New; %newobject MEDCoupling::MEDFileCurveLinearMesh::New; %newobject MEDCoupling::MEDFileMeshMultiTS::New; -%newobject MEDCoupling::MEDFileMeshMultiTS::deepCpy; +%newobject MEDCoupling::MEDFileMeshMultiTS::deepCopy; %newobject MEDCoupling::MEDFileMeshMultiTS::getOneTimeStep; %newobject MEDCoupling::MEDFileMeshes::New; -%newobject MEDCoupling::MEDFileMeshes::deepCpy; +%newobject MEDCoupling::MEDFileMeshes::deepCopy; %newobject MEDCoupling::MEDFileMeshes::getMeshAtPos; %newobject MEDCoupling::MEDFileMeshes::getMeshWithName; %newobject MEDCoupling::MEDFileMeshes::__getitem__; @@ -138,7 +138,7 @@ using namespace MEDCoupling; %newobject MEDCoupling::MEDFileFields::New; %newobject MEDCoupling::MEDFileFields::LoadPartOf; %newobject MEDCoupling::MEDFileFields::LoadSpecificEntities; -%newobject MEDCoupling::MEDFileFields::deepCpy; +%newobject MEDCoupling::MEDFileFields::deepCopy; %newobject MEDCoupling::MEDFileFields::shallowCpy; %newobject MEDCoupling::MEDFileFields::getFieldWithName; %newobject MEDCoupling::MEDFileFields::getFieldAtPos; @@ -148,7 +148,7 @@ using namespace MEDCoupling; %newobject MEDCoupling::MEDFileFields::__iter__; %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::New; -%newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::deepCpy; +%newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::deepCopy; %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::shallowCpy; %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::getTimeStepAtPos; %newobject MEDCoupling::MEDFileAnyTypeFieldMultiTS::getTimeStep; @@ -169,7 +169,7 @@ using namespace MEDCoupling; %newobject MEDCoupling::MEDFileAnyTypeField1TS::New; %newobject MEDCoupling::MEDFileAnyTypeField1TS::shallowCpy; -%newobject MEDCoupling::MEDFileAnyTypeField1TS::deepCpy; +%newobject MEDCoupling::MEDFileAnyTypeField1TS::deepCopy; %newobject MEDCoupling::MEDFileField1TS::New; %newobject MEDCoupling::MEDFileField1TS::getFieldAtLevel; %newobject MEDCoupling::MEDFileField1TS::getFieldAtTopLevel; @@ -182,34 +182,34 @@ using namespace MEDCoupling; %newobject MEDCoupling::MEDFileIntField1TS::convertToDouble; %newobject MEDCoupling::MEDFileData::New; -%newobject MEDCoupling::MEDFileData::deepCpy; +%newobject MEDCoupling::MEDFileData::deepCopy; %newobject MEDCoupling::MEDFileData::getMeshes; %newobject MEDCoupling::MEDFileData::getFields; %newobject MEDCoupling::MEDFileData::getParams; %newobject MEDCoupling::MEDFileParameterDouble1TS::New; -%newobject MEDCoupling::MEDFileParameterDouble1TS::deepCpy; +%newobject MEDCoupling::MEDFileParameterDouble1TS::deepCopy; %newobject MEDCoupling::MEDFileParameterMultiTS::New; -%newobject MEDCoupling::MEDFileParameterMultiTS::deepCpy; +%newobject MEDCoupling::MEDFileParameterMultiTS::deepCopy; %newobject MEDCoupling::MEDFileParameterMultiTS::getTimeStepAtPos; %newobject MEDCoupling::MEDFileParameterMultiTS::__getitem__; %newobject MEDCoupling::MEDFileParameters::New; -%newobject MEDCoupling::MEDFileParameters::deepCpy; +%newobject MEDCoupling::MEDFileParameters::deepCopy; %newobject MEDCoupling::MEDFileParameters::getParamAtPos; %newobject MEDCoupling::MEDFileParameters::getParamWithName; %newobject MEDCoupling::MEDFileParameters::__getitem__; %newobject MEDCoupling::MEDFileJointCorrespondence::New; -%newobject MEDCoupling::MEDFileJointCorrespondence::deepCpy; +%newobject MEDCoupling::MEDFileJointCorrespondence::deepCopy; %newobject MEDCoupling::MEDFileJointCorrespondence::shallowCpy; %newobject MEDCoupling::MEDFileJointOneStep::New; -%newobject MEDCoupling::MEDFileJointOneStep::deepCpy; +%newobject MEDCoupling::MEDFileJointOneStep::deepCopy; %newobject MEDCoupling::MEDFileJointOneStep::shallowCpy; %newobject MEDCoupling::MEDFileJoint::New; -%newobject MEDCoupling::MEDFileJoint::deepCpy; +%newobject MEDCoupling::MEDFileJoint::deepCopy; %newobject MEDCoupling::MEDFileJoint::shallowCpy; %newobject MEDCoupling::MEDFileJoints::New; -%newobject MEDCoupling::MEDFileJoints::deepCpy; +%newobject MEDCoupling::MEDFileJoints::deepCopy; %newobject MEDCoupling::MEDFileJoints::getJointAtPos; %newobject MEDCoupling::MEDFileJoints::getJointWithName; %newobject MEDCoupling::MEDFileJoints::__getitem__; @@ -555,7 +555,7 @@ namespace MEDCoupling INTERP_KERNEL::NormalizedCellType rem_geo_type) throw(INTERP_KERNEL::Exception); std::vector getDirectChildrenWithNull() const; - MEDFileJointCorrespondence *deepCpy() const; + MEDFileJointCorrespondence *deepCopy() const; MEDFileJointCorrespondence *shallowCpy() const; void setIsNodal(bool isNodal); bool getIsNodal() const; @@ -597,7 +597,7 @@ namespace MEDCoupling public: static MEDFileJointOneStep *New(int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception); static MEDFileJointOneStep *New(const std::string& fileName, const std::string& mName, const std::string& jointName, int number=1) throw(INTERP_KERNEL::Exception); - MEDFileJointOneStep *deepCpy() const; + MEDFileJointOneStep *deepCopy() const; MEDFileJointOneStep *shallowCpy() const; bool isEqual(const MEDFileJointOneStep *other) const; void setOrder(int order); @@ -634,7 +634,7 @@ namespace MEDCoupling static MEDFileJoint *New() throw(INTERP_KERNEL::Exception); static MEDFileJoint *New(const std::string& fileName, const std::string& mName, int num) throw(INTERP_KERNEL::Exception); static MEDFileJoint *New(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum ) throw(INTERP_KERNEL::Exception); - MEDFileJoint *deepCpy() const; + MEDFileJoint *deepCopy() const; MEDFileJoint *shallowCpy() const; bool isEqual(const MEDFileJoint *other) const; void setLocalMeshName(const std::string& name); @@ -677,7 +677,7 @@ namespace MEDCoupling public: static MEDFileJoints *New() throw(INTERP_KERNEL::Exception); static MEDFileJoints *New(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception); - MEDFileJoints *deepCpy() const; + MEDFileJoints *deepCopy() const; std::string simpleRepr() const; void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception); std::string getMeshName() const; @@ -889,7 +889,7 @@ namespace MEDCoupling static MEDFileMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception); static MEDFileMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception); virtual MEDFileMesh *createNewEmpty() const throw(INTERP_KERNEL::Exception); - virtual MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception); + virtual MEDFileMesh *deepCopy() const throw(INTERP_KERNEL::Exception); virtual MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception); virtual void clearNonDiscrAttributes() const throw(INTERP_KERNEL::Exception); void setName(const std::string& name); @@ -908,8 +908,8 @@ namespace MEDCoupling double getTimeValue() const; void setTimeUnit(const std::string& unit); std::string getTimeUnit() const; - void setAxType(MEDCouplingAxisType at); - MEDCouplingAxisType getAxType() const; + void setAxisType(MEDCouplingAxisType at); + MEDCouplingAxisType getAxisType() const; virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception); virtual int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception); virtual bool hasImplicitPart() const throw(INTERP_KERNEL::Exception); @@ -1276,8 +1276,8 @@ namespace MEDCoupling std::vector a0; std::vector a1; std::vector a2; - std::vector< MEDCouplingAutoRefCountObjectPtr > a3; - MEDCouplingAutoRefCountObjectPtr a4; + std::vector< MCAuto > a3; + MCAuto a4; self->serialize(a0,a1,a2,a3,a4); PyObject *ret(PyTuple_New(5)); PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0)); @@ -1315,8 +1315,8 @@ namespace MEDCoupling std::vector a0; std::vector a1; std::vector a2; - std::vector< MEDCouplingAutoRefCountObjectPtr > a3; - MEDCouplingAutoRefCountObjectPtr a4; + std::vector< MCAuto > a3; + MCAuto a4; // PyObject *a0py(PyTuple_GetItem(inp,0)),*a1py(PyTuple_GetItem(inp,1)),*a2py(PyTuple_GetItem(inp,2)); int tmp(-1); @@ -1533,7 +1533,7 @@ namespace MEDCoupling static MEDFileMeshMultiTS *New(); static MEDFileMeshMultiTS *New(const std::string& fileName) throw(INTERP_KERNEL::Exception); static MEDFileMeshMultiTS *New(const std::string& fileName, const std::string& mName) throw(INTERP_KERNEL::Exception); - MEDFileMeshMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception); + MEDFileMeshMultiTS *deepCopy() const throw(INTERP_KERNEL::Exception); std::string getName() const throw(INTERP_KERNEL::Exception); void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception); void setOneTimeStep(MEDFileMesh *mesh1TimeStep) throw(INTERP_KERNEL::Exception); @@ -1592,7 +1592,7 @@ namespace MEDCoupling public: static MEDFileMeshes *New(); static MEDFileMeshes *New(const std::string& fileName) throw(INTERP_KERNEL::Exception); - MEDFileMeshes *deepCpy() const throw(INTERP_KERNEL::Exception); + MEDFileMeshes *deepCopy() const throw(INTERP_KERNEL::Exception); void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception); int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception); std::vector getMeshesNames() const throw(INTERP_KERNEL::Exception); @@ -1840,7 +1840,7 @@ namespace MEDCoupling bool presenceOfMultiDiscPerGeoType() const throw(INTERP_KERNEL::Exception); void setTime(int iteration, int order, double val) throw(INTERP_KERNEL::Exception); virtual MEDFileAnyTypeField1TS *shallowCpy() const throw(INTERP_KERNEL::Exception); - MEDFileAnyTypeField1TS *deepCpy() const throw(INTERP_KERNEL::Exception); + MEDFileAnyTypeField1TS *deepCopy() const throw(INTERP_KERNEL::Exception); std::string getDtUnit() const throw(INTERP_KERNEL::Exception); void setDtUnit(const std::string& dtUnit) throw(INTERP_KERNEL::Exception); %extend @@ -1937,7 +1937,7 @@ namespace MEDCoupling PyObject *splitComponents() const throw(INTERP_KERNEL::Exception) { - std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret=self->splitComponents(); + std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitComponents(); std::size_t sz=ret.size(); PyObject *retPy=PyList_New(sz); for(std::size_t i=0;i > ret=self->splitDiscretizations(); + std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitDiscretizations(); std::size_t sz=ret.size(); PyObject *retPy=PyList_New(sz); for(std::size_t i=0;i > ret=self->splitMultiDiscrPerGeoTypes(); + std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret=self->splitMultiDiscrPerGeoTypes(); std::size_t sz=ret.size(); PyObject *retPy=PyList_New(sz); for(std::size_t i=0;i da=DataArrayInt::New(); da->alloc(sz,1); + MCAuto da=DataArrayInt::New(); da->alloc(sz,1); int *pt=da->getPointer(); for(int i=0;i > ret=self->splitComponents(); + std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitComponents(); std::size_t sz=ret.size(); PyObject *retPy=PyList_New(sz); for(std::size_t i=0;i > ret=self->splitDiscretizations(); + std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitDiscretizations(); std::size_t sz=ret.size(); PyObject *retPy=PyList_New(sz); for(std::size_t i=0;i > ret=self->splitMultiDiscrPerGeoTypes(); + std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret=self->splitMultiDiscrPerGeoTypes(); std::size_t sz=ret.size(); PyObject *retPy=PyList_New(sz); for(std::size_t i=0;i vectFMTS; convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS); - std::vector< MEDCouplingAutoRefCountObjectPtr > ret2; + std::vector< MCAuto > ret2; std::vector< std::vector > ret=MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(vectFMTS,mesh,ret2); if(ret2.size()!=ret.size()) { @@ -2872,7 +2872,7 @@ namespace MEDCoupling static MEDFileFields *New() throw(INTERP_KERNEL::Exception); static MEDFileFields *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception); static MEDFileFields *LoadPartOf(const std::string& fileName, bool loadAll=true, const MEDFileMeshes *ms=0) throw(INTERP_KERNEL::Exception); - MEDFileFields *deepCpy() const throw(INTERP_KERNEL::Exception); + MEDFileFields *deepCopy() const throw(INTERP_KERNEL::Exception); MEDFileFields *shallowCpy() const throw(INTERP_KERNEL::Exception); void loadArrays() throw(INTERP_KERNEL::Exception); void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception); @@ -2959,7 +2959,7 @@ namespace MEDCoupling if(obj && PyList_Check(obj)) { int sz=PyList_Size(obj); - MEDCouplingAutoRefCountObjectPtr da=DataArrayInt::New(); da->alloc(sz,1); + MCAuto da=DataArrayInt::New(); da->alloc(sz,1); int *pt=da->getPointer(); for(int i=0;i getParamsNames() const throw(INTERP_KERNEL::Exception); std::string simpleRepr() const throw(INTERP_KERNEL::Exception); @@ -3429,7 +3429,7 @@ namespace MEDCoupling public: static MEDFileData *New(const std::string& fileName) throw(INTERP_KERNEL::Exception); static MEDFileData *New(); - MEDFileData *deepCpy() const throw(INTERP_KERNEL::Exception); + MEDFileData *deepCopy() const throw(INTERP_KERNEL::Exception); void setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception); void setMeshes(MEDFileMeshes *meshes) throw(INTERP_KERNEL::Exception); void setParams(MEDFileParameters *params) throw(INTERP_KERNEL::Exception); diff --git a/src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py b/src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py index db6549772..418515e71 100644 --- a/src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py +++ b/src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py @@ -49,7 +49,7 @@ print tmp a=cI.deltaShiftIndex() b=a-1 myNewNbOfTuples=oldNbOfTuples-sum(b.getValues()) -o2n,newNbOfTuples=DataArrayInt.BuildOld2NewArrayFromSurjectiveFormat2(oldNbOfTuples,c,cI) +o2n,newNbOfTuples=DataArrayInt.ConvertIndexArrayToO2N(oldNbOfTuples,c,cI) print "Ai je trouve le bon resultat ? %s"%(str(myNewNbOfTuples==newNbOfTuples)) ; assert myNewNbOfTuples==newNbOfTuples # d3=d2.renumberAndReduce(o2n,newNbOfTuples) @@ -66,7 +66,7 @@ for i in xrange(7): m.insertNextCell(NORM_POLYGON,o2n[6*i:6*(i+1)].getValues()) pass m.finishInsertingCells() -m.checkCoherency() +m.checkConsistencyLight() # m.writeVTK("My7hexagons.vtu") @@ -98,7 +98,7 @@ myCoords.setInfoOnComponents(["X [m]","Y [m]","Z [m]"]) mesh3D.setCoords(myCoords); mesh3D.orientCorrectlyPolyhedrons() mesh3D.sortCellsInMEDFileFrmt() -mesh3D.checkCoherency() +mesh3D.checkConsistencyLight() renum=DataArrayInt.New(60) ; renum[:15]=range(15,30) ; renum[15:30]=range(15) ; renum[30:45]=range(45,60) ; renum[45:]=range(30,45) mesh3D.renumberNodes(renum,60) # @@ -110,12 +110,12 @@ zLev=zLev.getDifferentValues(1e-12) zLev.sort() # tmp,cellIdsSol1=mesh3D.buildSlice3D([0.,0.,(zLev[1]+zLev[2])/2],[0.,0.,1.],1e-12) -bary=mesh3D.getBarycenterAndOwner() +bary=mesh3D.computeCellCenterOfMass() baryZ=bary[:,2] -cellIdsSol2=baryZ.getIdsInRange(zLev[1],zLev[2]) +cellIdsSol2=baryZ.findIdsInRange(zLev[1],zLev[2]) nodeIds=mesh3D.findNodesOnPlane([0.,0.,zLev[0]],[0.,0.,1.],1e-10) mesh2D=mesh3D.buildFacePartOfMySelfNode(nodeIds,True) -extMesh=MEDCouplingExtrudedMesh.New(mesh3D,mesh2D,0) +extMesh=MEDCouplingMappedExtrudedMesh.New(mesh3D,mesh2D,0) cellIdsSol3=extMesh.getMesh3DIds()[mesh2D.getNumberOfCells():2*mesh2D.getNumberOfCells()] for i in xrange(3): exec("print cellIdsSol%s.getValues()"%(i+1)) @@ -129,26 +129,26 @@ print mesh3DPart.checkConsecutiveCellTypes() ; assert mesh3DPart.checkConsecutiv baryXY=bary[:,[0,1]] baryXY-=[250.,150.] magn=baryXY.magnitude() -cellIds2Sol1=magn.getIdsInRange(0.,1e-12) +cellIds2Sol1=magn.findIdsInRange(0.,1e-12) # -bary2=mesh2D.getBarycenterAndOwner()[:,[0,1]] +bary2=mesh2D.computeCellCenterOfMass()[:,[0,1]] bary2-=[250.,150.] magn=bary2.magnitude() -ids=magn.getIdsInRange(0.,1e-12) +ids=magn.findIdsInRange(0.,1e-12) idStart=int(ids) # ids is assumed to contain only one value, if not an exception is thrown cellIds2Sol2=extMesh.getMesh3DIds()[range(idStart,mesh3D.getNumberOfCells(),mesh2D.getNumberOfCells())] # mesh3DSlice2=mesh3D[cellIds2Sol1] mesh3DSlice2.zipCoords() # -mesh3DSlice2bis=mesh3DSlice2.deepCpy() +mesh3DSlice2bis=mesh3DSlice2.deepCopy() mesh3DSlice2bis.translate([0.,1000.,0.]) mesh3DSlice2All=MEDCouplingUMesh.MergeUMeshes([mesh3DSlice2,mesh3DSlice2bis]) mesh3DSlice2All.writeVTK("mesh3DSlice2All.vtu") # mesh3DSurf,desc,descIndx,revDesc,revDescIndx=mesh3D.buildDescendingConnectivity() numberOf3DCellSharing=revDescIndx.deltaShiftIndex() -cellIds=numberOf3DCellSharing.getIdsNotEqual(1) +cellIds=numberOf3DCellSharing.findIdsNotEqual(1) mesh3DSurfInside=mesh3DSurf[cellIds] mesh3DSurfInside.writeVTK("mesh3DSurfInside.vtu") @@ -171,12 +171,12 @@ f2.setName("MyField2") f2.fillFromAnalytic(1,"(x-5.)*(x-5.)+(y-5.)*(y-5.)+(z-5.)*(z-5.)") print "f and f2 are equal : %s"%(f.isEqualWithoutConsideringStr(f2,1e-13,1e-12)) ; assert f.isEqualWithoutConsideringStr(f2,1e-13,1e-12) # -ids1=f.getArray().getIdsInRange(0.,5.) +ids1=f.getArray().findIdsInRange(0.,5.) fPart1=f.buildSubPart(ids1) -ids2=f.getArray().getIdsInRange(50.,1.e300) +ids2=f.getArray().findIdsInRange(50.,1.e300) fPart2=f.buildSubPart(ids2) #Renumbering cells to follow MED file -fPart1Cpy=fPart1.deepCpy() +fPart1Cpy=fPart1.deepCopy() o2n=fPart1Cpy.getMesh().sortCellsInMEDFileFrmt() fPart1Cpy.getArray().renumberInPlace(o2n) #Check that fPart1Cpy and fPart1 are the same @@ -186,7 +186,7 @@ print "Fields are the same ? %s"%(fPart1Cpy.getArray().accumulate()[0]<1e-12) ; # fPart12=MEDCouplingFieldDouble.MergeFields([fPart1,fPart2]) # evaluation on points -bary=fPart12.getMesh().getBarycenterAndOwner() +bary=fPart12.getMesh().computeCellCenterOfMass() arr1=fPart12.getValueOnMulti(bary) arr2=f.getValueOnMulti(bary) delta=arr1-arr2 @@ -233,7 +233,7 @@ print "Is the mesh read in file equals targetMesh ? %s"%(meshRead.isEqual(target # f=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME) f.setTime(5.6,7,8) -f.setArray(targetMesh.getBarycenterAndOwner()) +f.setArray(targetMesh.computeCellCenterOfMass()) f.setMesh(targetMesh) f.setName("AFieldName") WriteField("MyFirstField.med",f,True) @@ -303,7 +303,7 @@ print "Is group \"grp0_Lev0\" are the same ? %s"%(grp0_0_read.isEqual(grp0_0)) ; # f=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME) f.setTime(5.6,7,8) -f.setArray(targetMesh.getBarycenterAndOwner()) +f.setArray(targetMesh.computeCellCenterOfMass()) f.setMesh(targetMesh) f.setName("AFieldName") # @@ -367,7 +367,7 @@ WriteFieldUsingAlreadyWrittenMesh(proc1_fname,CellField1) CellField0_read=ReadFieldCell("proc0.med","mesh",0,"CellField",5,6) CellField1_read=ReadFieldCell("proc1.med","mesh",0,"CellField",5,6) CellField_read=MEDCouplingFieldDouble.MergeFields([CellField0_read,CellField1_read]) -CellFieldCpy=CellField.deepCpy() +CellFieldCpy=CellField.deepCopy() CellFieldCpy.substractInPlaceDM(CellField_read,10,1e-12) CellFieldCpy.getArray().abs() print CellFieldCpy.getArray().isUniform(0.,1e-12) @@ -376,7 +376,7 @@ NodeField0_read=ReadFieldNode("proc0.med","mesh",0,"NodeField",5,6) NodeField1_read=ReadFieldNode("proc1.med","mesh",0,"NodeField",5,6) NodeField_read=MEDCouplingFieldDouble.MergeFields([NodeField0_read,NodeField1_read]) NodeField_read.mergeNodes(1e-10) -NodeFieldCpy=NodeField.deepCpy() +NodeFieldCpy=NodeField.deepCopy() NodeFieldCpy.mergeNodes(1e-10) NodeFieldCpy.substractInPlaceDM(NodeField_read,10,1e-12) print NodeFieldCpy.getArray().isUniform(0.,1e-12) ; assert NodeFieldCpy.getArray().isUniform(0.,1e-12) @@ -426,7 +426,7 @@ for fieldName in fsML[0].getFieldsNames(): if typp==ON_CELLS: arr.renumberInPlace(o2nML[lev]) mcf=MEDCouplingFieldDouble(typp,ONE_TIME) ; mcf.setName(fieldName) ; mcf.setTime(tim,dt,it) ; mcf.setArray(arr) - mcf.setMesh(mergeMLMesh.getMeshAtLevel(lev)) ; mcf.checkCoherency() + mcf.setMesh(mergeMLMesh.getMeshAtLevel(lev)) ; mcf.checkConsistencyLight() mergeField.appendFieldNoProfileSBT(mcf) pass pass @@ -463,17 +463,17 @@ srcField=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) ; srcField.setMesh(srcMesh) srcField.fillFromAnalytic(1,"7-sqrt((x-5.)*(x-5.)+(y-5.)*(y-5.))") ; CellField.getArray().setInfoOnComponent(0,"powercell [W]") # #remap.transferField(srcField,1e300) -srcField.setNature(ConservativeVolumic) +srcField.setNature(IntensiveMaximum) trgFieldCV=remap.transferField(srcField,1e300) # -print "ConservativeVolumic %lf == %lf"%(srcField.integral(True)[0],trgFieldCV.integral(True)[0]) ; assert abs(srcField.integral(True)[0]-trgFieldCV.integral(True)[0])<1e-6 -print "ConservativeVolumic %lf != %lf"%(srcField.getArray().accumulate()[0],trgFieldCV.getArray().accumulate()[0]) ; assert abs(srcField.getArray().accumulate()[0]-trgFieldCV.getArray().accumulate()[0])>1e-6 +print "IntensiveMaximum %lf == %lf"%(srcField.integral(True)[0],trgFieldCV.integral(True)[0]) ; assert abs(srcField.integral(True)[0]-trgFieldCV.integral(True)[0])<1e-6 +print "IntensiveMaximum %lf != %lf"%(srcField.getArray().accumulate()[0],trgFieldCV.getArray().accumulate()[0]) ; assert abs(srcField.getArray().accumulate()[0]-trgFieldCV.getArray().accumulate()[0])>1e-6 # -srcField.setNature(Integral) +srcField.setNature(ExtensiveMaximum) trgFieldI=remap.transferField(srcField,1e300) # -print "IntegralGlobConstraint %lf != %lf"%(srcField.integral(True)[0],trgFieldI.integral(True)[0]) ; assert abs(srcField.integral(True)[0]-trgFieldI.integral(True)[0])>1e-6 -print "IntegralGlobConstraint %lf == %lf"%(srcField.getArray().accumulate()[0],trgFieldI.getArray().accumulate()[0]) ; assert abs(srcField.getArray().accumulate()[0]-trgFieldI.getArray().accumulate()[0])<1e-6 +print "ExtensiveConservation %lf != %lf"%(srcField.integral(True)[0],trgFieldI.integral(True)[0]) ; assert abs(srcField.integral(True)[0]-trgFieldI.integral(True)[0])>1e-6 +print "ExtensiveConservation %lf == %lf"%(srcField.getArray().accumulate()[0],trgFieldI.getArray().accumulate()[0]) ; assert abs(srcField.getArray().accumulate()[0]-trgFieldI.getArray().accumulate()[0])<1e-6 ###### @@ -496,7 +496,7 @@ f1ts=fMts[(2,-1)] fMc=f1ts.getFieldAtLevel(ON_CELLS,0) arr=fMc.getArray() arr.getMinMaxPerComponent() # juste pour voir la plage de variation du champ par compo -ids=arr.getIdsInRange(0.,1.) +ids=arr.findIdsInRange(0.,1.) f2Mc=fMc[ids] # pressMts=data.getFields()["PRESSION_ELEM_DOM"] @@ -509,7 +509,7 @@ pressOnAgitateurMc.getMesh().zipCoords() agitateurMesh3DMc=pressOnAgitateurMc.getMesh() m3DSurf,desc,descI,revDesc,revDescI=agitateurMesh3DMc.buildDescendingConnectivity() nbOf3DCellSharing=revDescI.deltaShiftIndex() -ids2=nbOf3DCellSharing.getIdsEqual(1) +ids2=nbOf3DCellSharing.findIdsEqual(1) agitateurSkinMc=m3DSurf[ids2] OffsetsOfTupleIdsInField=revDescI[ids2] tupleIdsInField=revDesc[OffsetsOfTupleIdsInField] @@ -525,9 +525,9 @@ forceVectSkin=forceSkin*normalSkin # singlePolyhedron=agitateurMesh3DMc.buildSpreadZonesWithPoly() singlePolyhedron.orientCorrectlyPolyhedrons() -centerOfMass=singlePolyhedron.getBarycenterAndOwner() +centerOfMass=singlePolyhedron.computeCellCenterOfMass() -barySkin=agitateurSkinMc.getBarycenterAndOwner() +barySkin=agitateurSkinMc.computeCellCenterOfMass() posSkin=barySkin-centerOfMass torquePerCellOnSkin=DataArrayDouble.CrossProduct(posSkin,forceVectSkin) @@ -555,17 +555,17 @@ print vect0 def computeAngle(locAgitateur1ts): fMc=locAgitateur1ts.getFieldAtLevel(ON_CELLS,0) arr=fMc.getArray() - ids=arr.getIdsInRange(0.,1.) + ids=arr.findIdsInRange(0.,1.) f2Mc=fMc[ids] m3DSurf,desc,descI,revDesc,revDescI=f2Mc.getMesh().buildDescendingConnectivity() nbOf3DCellSharing=revDescI.deltaShiftIndex() - ids2=nbOf3DCellSharing.getIdsEqual(1) + ids2=nbOf3DCellSharing.findIdsEqual(1) agitateurSkinMc=m3DSurf[ids2] # singlePolyhedron=agitateurMesh3DMc.buildSpreadZonesWithPoly() singlePolyhedron.orientCorrectlyPolyhedrons() - centerOfMass=singlePolyhedron.getBarycenterAndOwner() - bary=agitateurSkinMc.getBarycenterAndOwner() + centerOfMass=singlePolyhedron.computeCellCenterOfMass() + bary=agitateurSkinMc.computeCellCenterOfMass() posSkin=bary-centerOfMass x2=posSkin[:,0]*posSkin[:,0] ; x2=x2.accumulate()[0] y2=posSkin[:,1]*posSkin[:,1] ; y2=y2.accumulate()[0] diff --git a/src/MEDLoader/Swig/MEDLoaderDataForTest.py b/src/MEDLoader/Swig/MEDLoaderDataForTest.py index e8f0f5332..ae67db4ba 100644 --- a/src/MEDLoader/Swig/MEDLoaderDataForTest.py +++ b/src/MEDLoader/Swig/MEDLoaderDataForTest.py @@ -384,7 +384,7 @@ class MEDLoaderDataForTest: f1.setArray(array); tmp=array.getPointer(); f1.setTime(2.,0,1); - f1.checkCoherency(); + f1.checkConsistencyLight(); return f1; def buildVecFieldOnNodes_1(cls): @@ -402,7 +402,7 @@ class MEDLoaderDataForTest: array.setInfoOnComponent(1,"density [g/cm^3]"); array.setInfoOnComponent(2,"temperature [K]"); f1.setTime(2.12,2,3); - f1.checkCoherency(); + f1.checkConsistencyLight(); return f1; def buildVecFieldOnGauss_1(cls): @@ -444,7 +444,7 @@ class MEDLoaderDataForTest: f.setName("MyFirstFieldOnGaussPoint"); array.setInfoOnComponent(0,"power [MW/m^3]"); array.setInfoOnComponent(1,"density"); - f.checkCoherency(); + f.checkConsistencyLight(); return f; def buildVecFieldOnGauss_2(cls): @@ -493,7 +493,7 @@ class MEDLoaderDataForTest: f.setName("MyFirstFieldOnGaussPoint"); array.setInfoOnComponent(0,"power [MW/m^3]"); array.setInfoOnComponent(1,"density"); - f.checkCoherency(); + f.checkConsistencyLight(); return f; # idem buildVecFieldOnGauss_2 except that different discretizations are sorted inside one type @@ -543,7 +543,7 @@ class MEDLoaderDataForTest: f.setName("MyFirstFieldOnGaussPoint"); array.setInfoOnComponent(0,"power [MW/m^3]"); array.setInfoOnComponent(1,"density"); - f.checkCoherency(); + f.checkConsistencyLight(); return f; def buildVecFieldOnGaussNE_1(cls): @@ -559,7 +559,7 @@ class MEDLoaderDataForTest: array.setInfoOnComponent(0,"power [W]"); array.setInfoOnComponent(1,"temperature"); f.setName("MyFieldOnGaussNE"); - f.checkCoherency(); + f.checkConsistencyLight(); return f; def buildACompleteMEDDataStructureWithFieldsOnCells_1(cls): @@ -599,7 +599,7 @@ class MEDLoaderDataForTest: f11Tmp.setMesh(m0) arr=DataArrayDouble(m0.getNumberOfCells(),1) ; arr.iota() ; arr+=1+i ; arr*=0.1 f11Tmp.setArray(arr) - f11Tmp.checkCoherency() + f11Tmp.checkConsistencyLight() f11Tmp.setName(f1Name) f1.appendFieldNoProfileSBT(f11Tmp) pass @@ -614,7 +614,7 @@ class MEDLoaderDataForTest: f21Tmp.setMesh(m0) arr=DataArrayDouble(m0.getNumberOfCells(),1) ; arr.iota() ; arr+=1+i f21Tmp.setArray(arr) - f21Tmp.checkCoherency() + f21Tmp.checkConsistencyLight() f21Tmp.setName(f2Name) f2.appendFieldNoProfileSBT(f21Tmp) f22Tmp=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) @@ -622,7 +622,7 @@ class MEDLoaderDataForTest: f22Tmp.setMesh(m1) arr=DataArrayDouble(m1.getNumberOfCells(),1) ; arr.iota() ; arr+=100+1+i f22Tmp.setArray(arr) - f22Tmp.checkCoherency() + f22Tmp.checkConsistencyLight() f22Tmp.setName(f2Name) f2[it,order].setFieldNoProfileSBT(f22Tmp) pass @@ -639,7 +639,7 @@ class MEDLoaderDataForTest: f31Tmp.setMesh(m0Part) arr=DataArrayDouble(m0Part.getNumberOfCells(),1) ; arr.iota() ; arr+=1000+i+1 f31Tmp.setArray(arr) - f31Tmp.checkCoherency() + f31Tmp.checkConsistencyLight() f31Tmp.setName(f3Name) f3.appendFieldProfile(f31Tmp,mm,0,pfl1) pfl2=DataArrayInt([0,3]) ; pfl2.setName("pfl2Bottom") @@ -649,7 +649,7 @@ class MEDLoaderDataForTest: f32Tmp.setMesh(m1Part) arr=DataArrayDouble(m1Part.getNumberOfCells(),1) ; arr.iota() ; arr+=2000+1+i f32Tmp.setArray(arr) - f32Tmp.checkCoherency() + f32Tmp.checkConsistencyLight() f32Tmp.setName(f3Name) f3[it,order].setFieldProfile(f32Tmp,mm,-1,pfl2) pass diff --git a/src/MEDLoader/Swig/MEDLoaderExamplesTest.py b/src/MEDLoader/Swig/MEDLoaderExamplesTest.py index ddabb286a..fc1517c4d 100644 --- a/src/MEDLoader/Swig/MEDLoaderExamplesTest.py +++ b/src/MEDLoader/Swig/MEDLoaderExamplesTest.py @@ -206,9 +206,9 @@ class MEDLoaderBasicsTest(unittest.TestCase): F1Cell.setTime(1000.,2,3) F1Cell.setName("F1Cell") WriteFieldUsingAlreadyWrittenMesh("file2.med",F1Cell) - F1Cell1=F1Cell.deepCpy() + F1Cell1=F1Cell.deepCopy() F1Cell1.setMesh(myMesh1) - F1Cell1.setArray(myMesh1.getBarycenterAndOwner()) + F1Cell1.setArray(myMesh1.computeCellCenterOfMass()) WriteFieldUsingAlreadyWrittenMesh("file2.med",F1Cell1) #! [PySnippetMeshAdvAPI1_12] f1Cell_3D=ReadFieldCell("file2.med","Example2",0,"F1Cell",2,3) diff --git a/src/MEDLoader/Swig/MEDLoaderTest1.py b/src/MEDLoader/Swig/MEDLoaderTest1.py index 3d2e8927a..0baf085dd 100644 --- a/src/MEDLoader/Swig/MEDLoaderTest1.py +++ b/src/MEDLoader/Swig/MEDLoaderTest1.py @@ -27,7 +27,7 @@ from MEDLoaderDataForTest import MEDLoaderDataForTest class MEDLoaderTest(unittest.TestCase): def testMesh1DRW(self): mesh=MEDLoaderDataForTest.build1DMesh_1(); - mesh.checkCoherency(); + mesh.checkConsistencyLight(); MEDLoader.WriteUMesh("Pyfile1.med",mesh,True); mesh_rw=MEDLoader.ReadUMeshFromFile("Pyfile1.med",mesh.getName(),0); self.assertTrue(mesh.isEqual(mesh_rw,1e-12)); @@ -35,7 +35,7 @@ class MEDLoaderTest(unittest.TestCase): def testMesh2DCurveRW(self): mesh=MEDLoaderDataForTest.build2DCurveMesh_1(); - mesh.checkCoherency(); + mesh.checkConsistencyLight(); MEDLoader.WriteUMesh("Pyfile2.med",mesh,True); mesh_rw=MEDLoader.ReadUMeshFromFile("Pyfile2.med",mesh.getName(),0); self.assertTrue(mesh.isEqual(mesh_rw,1e-12)); @@ -43,7 +43,7 @@ class MEDLoaderTest(unittest.TestCase): def testMesh2DRW(self): mesh=MEDLoaderDataForTest.build2DMesh_1(); - mesh.checkCoherency(); + mesh.checkConsistencyLight(); MEDLoader.WriteUMesh("Pyfile3.med",mesh,True); mesh_rw=MEDLoader.ReadUMeshFromFile("Pyfile3.med",mesh.getName(),0); self.assertTrue(mesh.isEqual(mesh_rw,1e-12)); @@ -51,7 +51,7 @@ class MEDLoaderTest(unittest.TestCase): def testMesh3DSurfRW(self): mesh=MEDLoaderDataForTest.build3DSurfMesh_1(); - mesh.checkCoherency(); + mesh.checkConsistencyLight(); MEDLoader.WriteUMesh("Pyfile4.med",mesh,True); mesh_rw=MEDLoader.ReadUMeshFromFile("Pyfile4.med",mesh.getName(),0); self.assertTrue(mesh.isEqual(mesh_rw,1e-12)); @@ -59,7 +59,7 @@ class MEDLoaderTest(unittest.TestCase): def testMesh3DRW(self): mesh=MEDLoaderDataForTest.build3DMesh_1(); - mesh.checkCoherency(); + mesh.checkConsistencyLight(); MEDLoader.WriteUMesh("Pyfile5.med",mesh,True); mesh_rw=MEDLoader.ReadUMeshFromFile("Pyfile5.med",mesh.getName(),0); self.assertTrue(mesh.isEqual(mesh_rw,1e-12)); @@ -292,14 +292,14 @@ class MEDLoaderTest(unittest.TestCase): arr1=[71.,171.,10.,110.,20.,120.,30.,130.,40.,140.] array.setValues(arr1,nbOfCells,2); f1.setTime(3.14,2,7); - f1.checkCoherency(); + f1.checkConsistencyLight(); # MEDLoader.WriteField(fileName,f1,False);#<- False important for the test # f2=MEDLoader.ReadFieldCell(fileName,f1.getMesh().getName(),0,f1.getName(),2,7); tt=MEDLoader.GetTypesOfField(fileName,f1.getMesh().getName(),f1.getName()); self.assertEqual(tt,[MEDLoader.ON_CELLS]); - f2.checkCoherency(); + f2.checkConsistencyLight(); self.assertTrue(f1.isEqual(f2,1e-12,1e-12)); # pass @@ -326,7 +326,7 @@ class MEDLoaderTest(unittest.TestCase): mesh=MEDLoaderDataForTest.build3DSurfMesh_1(); renumber1=[2,5,1,0,3,4] mesh.renumberCells(renumber1,False); - mesh.checkCoherency(); + mesh.checkConsistencyLight(); MEDLoader.WriteUMesh(fileName,mesh,True); mesh_rw=MEDLoader.ReadUMeshFromFile(fileName,mesh.getName(),0); self.assertTrue(mesh.isEqual(mesh_rw,1e-12)); @@ -396,7 +396,7 @@ class MEDLoaderTest(unittest.TestCase): f1.setArray(array); tmp=array.setValues(arr1,m2d.getNumberOfCells(),2); f1.setTime(3.14,2,7); - f1.checkCoherency(); + f1.checkConsistencyLight(); MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f2=MEDLoader.ReadFieldCell(fileName,f1.getMesh().getName(),-1,f1.getName(),2,7); self.assertTrue(f2.isEqual(f1,1e-12,1e-12)); @@ -418,14 +418,14 @@ class MEDLoaderTest(unittest.TestCase): array.setInfoOnComponent(0,"tyty [mm]"); array.setInfoOnComponent(1,"uiop [MW]"); f1.setTime(3.14,2,7); - f1.checkCoherency(); + f1.checkConsistencyLight(); arr2=[1,4] f2=f1.buildSubPart(arr2); f2.getMesh().setName(f1.getMesh().getName()); MEDLoader.WriteField(fileName,f2,False);#<- False important for the test # f3=MEDLoader.ReadFieldNode(fileName,f2.getMesh().getName(),0,f2.getName(),2,7); - f3.checkCoherency(); + f3.checkConsistencyLight(); self.assertTrue(f3.isEqual(f2,1e-12,1e-12)); # arr3=[1,3,0,5,2,4] @@ -433,7 +433,7 @@ class MEDLoaderTest(unittest.TestCase): MEDLoader.WriteUMesh(fileName2,m,True); MEDLoader.WriteField(fileName2,f2,False);#<- False important for the test f3=MEDLoader.ReadFieldNode(fileName2,f2.getMesh().getName(),0,f2.getName(),2,7); - f3.checkCoherency(); + f3.checkConsistencyLight(); self.assertTrue(f3.isEqual(f2,1e-12,1e-12)); # pass @@ -458,7 +458,7 @@ class MEDLoaderTest(unittest.TestCase): # renumArr=[3,7,2,1,5,11,10,0,9,6,8,4] f1.renumberNodes(renumArr); - f1.checkCoherency(); + f1.checkConsistencyLight(); MEDLoader.WriteField(fileName,f1,False);#<- False important for the test f2=MEDLoader.ReadFieldNode(fileName,f1.getMesh().getName(),0,f1.getName(),2,7); self.assertTrue(f2.isEqual(f1,1e-12,1e-12)); @@ -478,7 +478,7 @@ class MEDLoaderTest(unittest.TestCase): array.setInfoOnComponent(0,"plkj [mm]"); array.setInfoOnComponent(1,"pqqqss [mm]"); f1.setTime(3.14,2,7); - f1.checkCoherency(); + f1.checkConsistencyLight(); # f2=MEDLoader.MEDCouplingFieldDouble.New(MEDLoader.ON_NODES,MEDLoader.ONE_TIME); f2.setName("FieldMix"); @@ -491,7 +491,7 @@ class MEDLoaderTest(unittest.TestCase): array.setInfoOnComponent(0,"plkj [mm]"); array.setInfoOnComponent(1,"pqqqss [mm]"); f2.setTime(3.14,2,7); - f2.checkCoherency(); + f2.checkConsistencyLight(); # MEDLoader.WriteField(fileName,f1,True); ts=MEDLoader.GetTypesOfField(fileName,f1.getMesh().getName(),f1.getName()); @@ -570,7 +570,7 @@ class MEDLoaderTest(unittest.TestCase): m.insertNextCell([0,2,1,3]) m.setCoords(MEDLoader.DataArrayDouble([0.,0.,1.,1.,1.,0.,0.,1.],4,2)) # - ms=[m.deepCpy() for i in xrange(4)] + ms=[m.deepCopy() for i in xrange(4)] for i,elt in enumerate(ms): elt.translate([float(i)*1.5,0.]) pass @@ -619,7 +619,7 @@ class MEDLoaderTest(unittest.TestCase): m.insertNextCell([0,2,1,3]) m.setCoords(MEDLoader.DataArrayDouble([0.,0.,1.,1.,1.,0.,0.,1.],4,2)) # - ms=[m.deepCpy() for i in xrange(4)] + ms=[m.deepCopy() for i in xrange(4)] for i,elt in enumerate(ms): elt.translate([float(i)*1.5,0.]) pass @@ -726,15 +726,15 @@ class MEDLoaderTest(unittest.TestCase): f1.setMesh(mesh) arr=MEDLoader.DataArrayDouble(20) ; arr.iota() f1.setArray(arr) - f1.checkCoherency() + f1.checkConsistencyLight() # f2=MEDLoader.MEDCouplingFieldDouble(MEDLoader.ON_NODES) ; f2.setName("f2") f2.setMesh(mesh) arr=MEDLoader.DataArrayDouble(20) ; arr.iota() ; arr*=3 f2.setArray(arr) - f2.checkCoherency() + f2.checkConsistencyLight() # - f11=f1.deepCpy() ; (f11.getArray())[:]*=4 ; f11.setTime(1.1,5,6) + f11=f1.deepCopy() ; (f11.getArray())[:]*=4 ; f11.setTime(1.1,5,6) # MEDLoader.WriteMesh(fname,f1.getMesh(),True) MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f1) diff --git a/src/MEDLoader/Swig/MEDLoaderTest2.py b/src/MEDLoader/Swig/MEDLoaderTest2.py index cce9f07e0..17553ad73 100644 --- a/src/MEDLoader/Swig/MEDLoaderTest2.py +++ b/src/MEDLoader/Swig/MEDLoaderTest2.py @@ -27,7 +27,7 @@ from MEDLoaderDataForTest import MEDLoaderDataForTest class MEDLoaderTest(unittest.TestCase): def testMesh1DRW(self): mesh=MEDLoaderDataForTest.build1DMesh_1(); - mesh.checkCoherency(); + mesh.checkConsistencyLight(); WriteUMeshDep("Pyfile1.med",mesh,False); mesh_rw=ReadUMeshFromFile("Pyfile1.med",mesh.getName(),0); self.assertTrue(mesh.isEqual(mesh_rw,1e-12)); @@ -35,7 +35,7 @@ class MEDLoaderTest(unittest.TestCase): def testMesh2DCurveRW(self): mesh=MEDLoaderDataForTest.build2DCurveMesh_1(); - mesh.checkCoherency(); + mesh.checkConsistencyLight(); WriteUMeshDep("Pyfile2.med",mesh,False); mesh_rw=ReadUMeshFromFile("Pyfile2.med",mesh.getName(),0); self.assertTrue(mesh.isEqual(mesh_rw,1e-12)); @@ -43,7 +43,7 @@ class MEDLoaderTest(unittest.TestCase): def testMesh2DRW(self): mesh=MEDLoaderDataForTest.build2DMesh_1(); - mesh.checkCoherency(); + mesh.checkConsistencyLight(); WriteUMeshDep("Pyfile3.med",mesh,False); mesh_rw=ReadUMeshFromFile("Pyfile3.med",mesh.getName(),0); self.assertTrue(mesh.isEqual(mesh_rw,1e-12)); @@ -51,7 +51,7 @@ class MEDLoaderTest(unittest.TestCase): def testMesh3DSurfRW(self): mesh=MEDLoaderDataForTest.build3DSurfMesh_1(); - mesh.checkCoherency(); + mesh.checkConsistencyLight(); WriteUMeshDep("Pyfile4.med",mesh,False); mesh_rw=ReadUMeshFromFile("Pyfile4.med",mesh.getName(),0); self.assertTrue(mesh.isEqual(mesh_rw,1e-12)); @@ -59,7 +59,7 @@ class MEDLoaderTest(unittest.TestCase): def testMesh3DRW(self): mesh=MEDLoaderDataForTest.build3DMesh_1(); - mesh.checkCoherency(); + mesh.checkConsistencyLight(); WriteUMeshDep("Pyfile5.med",mesh,False); mesh_rw=ReadUMeshFromFile("Pyfile5.med",mesh.getName(),0); self.assertTrue(mesh.isEqual(mesh_rw,1e-12)); @@ -260,7 +260,7 @@ class MEDLoaderTest(unittest.TestCase): mesh=MEDLoaderDataForTest.build3DSurfMesh_1(); renumber1=[2,5,1,0,3,4] mesh.renumberCells(renumber1,False); - mesh.checkCoherency(); + mesh.checkConsistencyLight(); WriteUMeshDep(fileName,mesh,False); mesh_rw=ReadUMeshFromFile(fileName,mesh.getName(),0); self.assertTrue(mesh.isEqual(mesh_rw,1e-12)); @@ -330,7 +330,7 @@ class MEDLoaderTest(unittest.TestCase): f1.setArray(array); tmp=array.setValues(arr1,m2d.getNumberOfCells(),2); f1.setTime(3.14,2,7); - f1.checkCoherency(); + f1.checkConsistencyLight(); WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f2=ReadFieldCell(fileName,f1.getMesh().getName(),-1,f1.getName(),2,7); self.assertTrue(f2.isEqual(f1,1e-12,1e-12)); diff --git a/src/MEDLoader/Swig/MEDLoaderTest3.py b/src/MEDLoader/Swig/MEDLoaderTest3.py index fd3522c33..29aa66cb7 100644 --- a/src/MEDLoader/Swig/MEDLoaderTest3.py +++ b/src/MEDLoader/Swig/MEDLoaderTest3.py @@ -99,7 +99,7 @@ class MEDLoaderTest(unittest.TestCase): m.insertNextCell(NORM_POLYGON,4,targetConn[14:18]) m.finishInsertingCells(); m.setCoords(c) - m.checkCoherency() + m.checkConsistencyLight() m1=MEDCouplingUMesh.New(); m1.setMeshDimension(1); m1.allocateCells(3); @@ -108,7 +108,7 @@ class MEDLoaderTest(unittest.TestCase): m1.insertNextCell(NORM_SEG3,3,[2,8,5]) m1.finishInsertingCells(); m1.setCoords(c) - m1.checkCoherency() + m1.checkConsistencyLight() m2=MEDCouplingUMesh.New(); m2.setMeshDimension(0); m2.allocateCells(4); @@ -118,7 +118,7 @@ class MEDLoaderTest(unittest.TestCase): m2.insertNextCell(NORM_POINT1,1,[6]) m2.finishInsertingCells(); m2.setCoords(c) - m2.checkCoherency() + m2.checkConsistencyLight() # mm=MEDFileUMesh.New() self.assertTrue(mm.getUnivNameWrStatus()) @@ -168,7 +168,7 @@ class MEDLoaderTest(unittest.TestCase): t=mm.getGroupArr(0,"GrpOnAllCell") self.assertTrue(t.getValues()==range(5)) # - mmCpy=mm.deepCpy() + mmCpy=mm.deepCopy() self.assertTrue(mm.isEqual(mmCpy,1e-12)[0]) ; del mm mmCpy.write(outFileName,2); # @@ -216,7 +216,7 @@ class MEDLoaderTest(unittest.TestCase): m.insertNextCell(NORM_QUAD4,4,targetConn[14:18]) m.finishInsertingCells(); m.setCoords(c) - m.checkCoherency() + m.checkConsistencyLight() m1=MEDCouplingUMesh.New(); m1.setMeshDimension(1); m1.allocateCells(3); @@ -225,7 +225,7 @@ class MEDLoaderTest(unittest.TestCase): m1.insertNextCell(NORM_SEG2,2,[3,6]) m1.finishInsertingCells(); m1.setCoords(c) - m1.checkCoherency() + m1.checkConsistencyLight() m2=MEDCouplingUMesh.New(); m2.setMeshDimension(0); m2.allocateCells(4); @@ -235,7 +235,7 @@ class MEDLoaderTest(unittest.TestCase): m2.insertNextCell(NORM_POINT1,1,[6]) m2.finishInsertingCells(); m2.setCoords(c) - m2.checkCoherency() + m2.checkConsistencyLight() # mm=MEDFileUMesh.New() mm.setName("My2ndMEDCouplingMEDmesh") @@ -582,9 +582,9 @@ class MEDLoaderTest(unittest.TestCase): # fname="Pyfile28.med" f1=MEDLoaderDataForTest.buildVecFieldOnGauss_2_Simpler(); - f1InvalidCpy=f1.deepCpy() + f1InvalidCpy=f1.deepCopy() f1InvalidCpy.setDiscretization(MEDCouplingFieldDiscretizationGauss()) - f1InvalidCpy2=f1.deepCpy() + f1InvalidCpy2=f1.deepCopy() f1InvalidCpy2.setDiscretization(MEDCouplingFieldDiscretizationGauss()) m1=f1.getMesh() mm1=MEDFileUMesh.New() @@ -644,7 +644,7 @@ class MEDLoaderTest(unittest.TestCase): f21=m2.getMeasureField(True) ; f21.setName("f21") ; f21=f21.buildNewTimeReprFromThis(ONE_TIME,False) f21.getArray().setInfoOnComponent(0,"sta [mm]") ; ff21.appendFieldNoProfileSBT(f21) - f22=f21.deepCpy() ; f22.setName("f22") ; f22=f22.buildNewTimeReprFromThis(ONE_TIME,False) ; + f22=f21.deepCopy() ; f22.setName("f22") ; f22=f22.buildNewTimeReprFromThis(ONE_TIME,False) ; f22.applyFunc(2,"3*x*IVec+2*x*JVec") f22.getArray().setInfoOnComponent(0,"distance [km]") ; f22.getArray().setInfoOnComponent(1,"displacement [cm]") ff22.appendFieldNoProfileSBT(f22) @@ -687,7 +687,7 @@ class MEDLoaderTest(unittest.TestCase): # ff1.setFieldProfile(f1,mm1,0,da) ff1.changePflsNames([(["sup1_NORM_QUAD4"],"ForV650")]) - ff1=ff1.deepCpy() + ff1=ff1.deepCopy() ff1.write(fname,0) # vals,pfl=ff1.getFieldWithProfile(ON_CELLS,0,mm1) ; vals.setName("") @@ -727,7 +727,7 @@ class MEDLoaderTest(unittest.TestCase): ff1.appendFieldProfile(f1,mm1,0,da) f1.setTime(1.2,1,2) ; e=d.applyFunc("2*x") ; e.copyStringInfoFrom(d) ; f1.setArray(e) ; ff1.appendFieldProfile(f1,mm1,0,da) - ff1=ff1.deepCpy() + ff1=ff1.deepCopy() ff1.write(fname,0) # vals,pfl=ff1.getFieldWithProfile(ON_CELLS,1,2,0,mm1) ; vals.setName("") @@ -891,7 +891,7 @@ class MEDLoaderTest(unittest.TestCase): ff1.write(fname,0) f1=ff1.getFieldOnMeshAtLevel(ON_GAUSS_NE,m1,0) f2,p1=ff1.getFieldWithProfile(ON_GAUSS_NE,0,mm1) ; f2.setName("") - self.assertTrue(p1.isIdentity2(5)) + self.assertTrue(p1.isIota(5)) self.assertTrue(f1.getArray().isEqual(f2,1e-12)) pass # Test for getFieldAtTopLevel method @@ -960,7 +960,7 @@ class MEDLoaderTest(unittest.TestCase): ff1.appendFieldProfile(f1,mm1,0,da) ffs.resize(1) ffs.setFieldAtPos(0,ff1) - ffs=ffs.deepCpy() + ffs=ffs.deepCopy() ffs.write(fname,0) # ffsr=MEDFileFields.New(fname) @@ -1056,7 +1056,7 @@ class MEDLoaderTest(unittest.TestCase): ff1.setFieldNoProfileSBT(f1) ff1.write(fname,0) # writing mesh1 and field1, now creation of mesh2 and field2 - f2=f1.deepCpy() + f2=f1.deepCopy() m2=f2.getMesh() m2.translate([0.5,0.6,0.7]) m2.setName("3DSurfMesh_2") @@ -1094,7 +1094,7 @@ class MEDLoaderTest(unittest.TestCase): da2.iota(7.) da2.rearrange(len(compNames1)) da2.setInfoOnComponents(compNames1) - f2=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME) ; f2.setName(FieldName1) ; f2.setArray(da2) ; f2.setMesh(m2) ; f2.checkCoherency() + f2=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME) ; f2.setName(FieldName1) ; f2.setArray(da2) ; f2.setMesh(m2) ; f2.checkConsistencyLight() ff1.setFieldNoProfileSBT(f2) self.assertEqual(ff1.getNonEmptyLevels(),(2, [0])) da0=DataArrayDouble.New() @@ -1102,7 +1102,7 @@ class MEDLoaderTest(unittest.TestCase): da0.iota(190.) da0.rearrange(len(compNames1)) da0.setInfoOnComponents(compNames1) - f0=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME) ; f0.setName(FieldName1) ; f0.setArray(da0) ; f0.setMesh(m0) ; f0.checkCoherency() + f0=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME) ; f0.setName(FieldName1) ; f0.setArray(da0) ; f0.setMesh(m0) ; f0.checkConsistencyLight() ff1.setFieldNoProfileSBT(f0) self.assertEqual(ff1.getNonEmptyLevels(),(2, [0,-2])) da1=DataArrayDouble.New() @@ -1110,7 +1110,7 @@ class MEDLoaderTest(unittest.TestCase): da1.iota(90.) da1.rearrange(len(compNames1)) da1.setInfoOnComponents(compNames1) - f1=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME) ; f1.setName(FieldName1) ; f1.setArray(da1) ; f1.setMesh(m1) ; f1.checkCoherency() + f1=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME) ; f1.setName(FieldName1) ; f1.setArray(da1) ; f1.setMesh(m1) ; f1.checkConsistencyLight() ff1.setFieldNoProfileSBT(f1) self.assertEqual(ff1.getNonEmptyLevels(),(2, [0,-1,-2])) # @@ -1124,7 +1124,7 @@ class MEDLoaderTest(unittest.TestCase): da0.iota(-190.) da0.rearrange(2) da0.setInfoOnComponents(compNames2) - f0=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME) ; f0.setName(FieldName2) ; f0.setArray(da0) ; f0.setMesh(m0) ; f0.checkCoherency() + f0=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME) ; f0.setName(FieldName2) ; f0.setArray(da0) ; f0.setMesh(m0) ; f0.checkConsistencyLight() ff2.setFieldNoProfileSBT(f0) self.assertEqual(ff2.getNonEmptyLevels(),(0, [0])) da1=DataArrayDouble.New() @@ -1132,7 +1132,7 @@ class MEDLoaderTest(unittest.TestCase): da1.iota(-90.) da1.rearrange(len(compNames2)) da1.setInfoOnComponents(compNames2) - f1=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME) ; f1.setName(FieldName2) ; f1.setArray(da1) ; f1.setMesh(m1) ; f1.checkCoherency() + f1=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME) ; f1.setName(FieldName2) ; f1.setArray(da1) ; f1.setMesh(m1) ; f1.checkConsistencyLight() ff2.setFieldNoProfileSBT(f1) self.assertEqual(ff2.getNonEmptyLevels(),(1, [0,-1])) # @@ -1433,8 +1433,8 @@ class MEDLoaderTest(unittest.TestCase): fread=ff2.getFieldOnMeshAtLevel(ON_CELLS,0,mm) fread2=ff2.getFieldAtLevel(ON_CELLS,0) # - fread.checkCoherency() - fread2.checkCoherency() + fread.checkConsistencyLight() + fread2.checkConsistencyLight() self.assertTrue(fread.isEqual(f1,1e-12,1e-12)) self.assertTrue(fread2.isEqual(f1,1e-12,1e-12)) pass @@ -1543,7 +1543,7 @@ class MEDLoaderTest(unittest.TestCase): tr=[[0.,4.],[2.,4.],[4.,4.],[6.,4.],[8.,4.],[10.,4.],[12.,4.],[14.,4.],[16.,4.],[18.,4.],[20.,4.],[0.,0.],[2.,0.], [0.,2.],[2.,2.],[4.,2.],[6.,2.],[8.,2.],[10.,2.],[12.,2.]] ms=11*[mT3]+2*[mQ4]+7*[mQ8] - ms[:]=(elt.deepCpy() for elt in ms) + ms[:]=(elt.deepCopy() for elt in ms) for m,t in zip(ms,tr): d=m.getCoords() ; d+= t pass @@ -1558,12 +1558,12 @@ class MEDLoaderTest(unittest.TestCase): da=DataArrayDouble(34) ; da.iota(3.) f.setArray(da) f.setName("fieldCellOnPflWithoutPfl") - fInvalid=f.deepCpy() + fInvalid=f.deepCopy() f.setGaussLocalizationOnCells([0,1,2,3,4,5,6,7,8],[0.,0.,1.,0.,1.,1.],[0.3,0.3,0.7,0.7],[0.8,0.2]) f.setGaussLocalizationOnCells([9,10],[0.,0.,1.,0.,1.,1.],[0.3,0.3,0.7,0.7,0.8,0.8],[0.8,0.07,0.13]) f.setGaussLocalizationOnCells([11,12],[0.,0.,1.,0.,1.,1.,0.,1.],[0.3,0.3,0.7,0.7,0.8,0.8,0.8,0.8,0.8,0.8],[0.8,0.07,0.1,0.01,0.02]) - f.checkCoherency() - fInvalid2=fInvalid.deepCpy() + f.checkConsistencyLight() + fInvalid2=fInvalid.deepCopy() fInvalid2.getDiscretization().setArrayOfDiscIds(f.getDiscretization().getArrayOfDiscIds()) # mm=MEDFileUMesh() @@ -1593,7 +1593,7 @@ class MEDLoaderTest(unittest.TestCase): f2=f1tsRead.getFieldOnMeshAtLevel(ON_GAUSS_PT,0,mRead) self.assertTrue(f.isEqual(f2,1e-12,1e-12)) f2_bis=ReadFieldGauss(fname,m.getName(),0,f.getName(),f.getTime()[1],f.getTime()[2]) - f2_bis.checkCoherency() + f2_bis.checkConsistencyLight() self.assertTrue(f.isEqual(f2_bis,1e-12,1e-12)) # WriteField(fname2,f,True) @@ -1611,7 +1611,7 @@ class MEDLoaderTest(unittest.TestCase): f.setGaussLocalizationOnCells([0,1,3],[0.,0.,1.,0.,1.,1.],[0.3,0.3,0.7,0.7],[0.8,0.2]) f.setGaussLocalizationOnCells([2,4,5],[0.,0.,1.,0.,1.,1.],[0.3,0.3,0.7,0.7,0.8,0.8],[0.8,0.07,0.13]) f.setGaussLocalizationOnCells([6,7,8,9],[0.,0.,1.,0.,1.,1.,0.,1.,0.5,0.,1.,0.5,0.5,1.,0.,0.5],[0.3,0.3,0.7,0.7,0.8,0.8,0.8,0.8,0.8,0.8],[0.8,0.07,0.1,0.01,0.02]) - f.checkCoherency() + f.checkConsistencyLight() # mm=MEDFileUMesh() mm.setMeshAtLevel(0,m) @@ -1650,7 +1650,7 @@ class MEDLoaderTest(unittest.TestCase): f.setGaussLocalizationOnCells([11,12],[0.,0.,1.,0.,1.,1.,0.,1.],[0.3,0.3,0.7,0.7,0.8,0.8,0.8,0.8,0.8,0.8],[0.8,0.07,0.1,0.01,0.02]) f.setGaussLocalizationOnCells([13,14,15,17,18],[0.,0.,1.,0.,1.,1.,0.,1.,0.5,0.,1.,0.5,0.5,1.,0.,0.5],[0.3,0.3,0.7,0.7,0.8,0.8,0.8,0.8],[0.8,0.1,0.03,0.07]) f.setGaussLocalizationOnCells([16,19],[0.,0.,1.,0.,1.,1.,0.,1.,0.5,0.,1.,0.5,0.5,1.,0.,0.5],[0.3,0.3,0.7,0.7,0.8,0.8],[0.8,0.1,0.1]) - f.checkCoherency() + f.checkConsistencyLight() mm=MEDFileUMesh() mm.setMeshAtLevel(0,m) f1ts=MEDFileField1TS.New() @@ -1728,36 +1728,36 @@ class MEDLoaderTest(unittest.TestCase): ## Reading from file m=MEDFileMesh.New(fname) m0=m.getMeshAtLevel(0) - m00=m0.deepCpy() ; m00=m00[[0,2]] ; m00.setName(m.getName()) ; m00.zipCoords() + m00=m0.deepCopy() ; m00=m00[[0,2]] ; m00.setName(m.getName()) ; m00.zipCoords() fieldNode0.setMesh(m00) f0=MEDFileField1TS.New(fname,fieldNode0.getName(),dt,it) ff0_1=f0.getFieldOnMeshAtLevel(ON_NODES,m0) - ff0_1.checkCoherency() + ff0_1.checkConsistencyLight() self.assertTrue(ff0_1.isEqual(fieldNode0,1e-12,1e-12)) ff0_2=f0.getFieldAtLevel(ON_NODES,0) - ff0_2.checkCoherency() + ff0_2.checkConsistencyLight() self.assertTrue(ff0_2.isEqual(fieldNode0,1e-12,1e-12)) ff0_3=f0.getFieldOnMeshAtLevel(ON_NODES,0,m) - ff0_3.checkCoherency() + ff0_3.checkConsistencyLight() self.assertTrue(ff0_3.isEqual(fieldNode0,1e-12,1e-12)) ff0_4=ReadFieldNode(fname,m.getName(),0,fieldNode0.getName(),dt,it) - ff0_4.checkCoherency() + ff0_4.checkConsistencyLight() self.assertTrue(ff0_4.isEqual(fieldNode0,1e-12,1e-12)) f1=MEDFileField1TS.New(fname,fieldNode1.getName(),dt,it) m1=m.getMeshAtLevel(-1) - m10=m1.deepCpy() ; m10=m10[[0,1,2,3,4,5,6,7]] ; m10.setName(m.getName()) ; m10.zipCoords() + m10=m1.deepCopy() ; m10=m10[[0,1,2,3,4,5,6,7]] ; m10.setName(m.getName()) ; m10.zipCoords() fieldNode1.setMesh(m10) ff1_1=f1.getFieldOnMeshAtLevel(ON_NODES,m1) - ff1_1.checkCoherency() + ff1_1.checkConsistencyLight() self.assertTrue(ff1_1.isEqual(fieldNode1,1e-12,1e-12)) ff1_2=f1.getFieldAtLevel(ON_NODES,-1) - ff1_2.checkCoherency() + ff1_2.checkConsistencyLight() self.assertTrue(ff1_2.isEqual(fieldNode1,1e-12,1e-12)) ff1_3=f1.getFieldOnMeshAtLevel(ON_NODES,-1,m) - ff1_3.checkCoherency() + ff1_3.checkConsistencyLight() self.assertTrue(ff1_3.isEqual(fieldNode1,1e-12,1e-12)) ff1_4=ReadFieldNode(fname,m.getName(),-1,fieldNode1.getName(),dt,it) - ff1_4.checkCoherency() + ff1_4.checkConsistencyLight() self.assertTrue(ff1_4.getMesh().isEqual(m10,1e-12)) self.assertRaises(InterpKernelException,f1.getFieldOnMeshAtLevel,ON_NODES,m0) # error because impossible to build a sub mesh at level 0 lying on nodes [0,1,2,3,4,5,6] self.assertRaises(InterpKernelException,f1.getFieldAtLevel,ON_NODES,0) # error because impossible to build a sub mesh at level 0 lying on nodes [0,1,2,3,4,5,6] @@ -1818,36 +1818,36 @@ class MEDLoaderTest(unittest.TestCase): ## Reading from file m=MEDFileMesh.New(fname) m0=m.getMeshAtLevel(0) - m00=m0.deepCpy() ; m00=m00[pfl0] ; m00.setName(m.getName()) + m00=m0.deepCopy() ; m00=m00[pfl0] ; m00.setName(m.getName()) fieldCell0.setMesh(m00) f0=MEDFileField1TS.New(fname,fieldCell0.getName(),dt,it) ff0_1=f0.getFieldOnMeshAtLevel(ON_CELLS,m0) - ff0_1.checkCoherency() + ff0_1.checkConsistencyLight() self.assertTrue(ff0_1.isEqual(fieldCell0,1e-12,1e-12)) ff0_2=f0.getFieldAtLevel(ON_CELLS,0) - ff0_2.checkCoherency() + ff0_2.checkConsistencyLight() self.assertTrue(ff0_2.isEqual(fieldCell0,1e-12,1e-12)) ff0_3=f0.getFieldOnMeshAtLevel(ON_CELLS,0,m) - ff0_3.checkCoherency() + ff0_3.checkConsistencyLight() self.assertTrue(ff0_3.isEqual(fieldCell0,1e-12,1e-12)) ff0_4=ReadFieldCell(fname,m.getName(),0,fieldCell0.getName(),dt,it) - ff0_4.checkCoherency() + ff0_4.checkConsistencyLight() self.assertTrue(ff0_4.isEqual(fieldCell0,1e-12,1e-12)) f1=MEDFileField1TS.New(fname,fieldCell1.getName(),dt,it) m1=m.getMeshAtLevel(-1) - m10=m1.deepCpy() ; m10=m10[pfl1] ; m10.setName(m.getName()) + m10=m1.deepCopy() ; m10=m10[pfl1] ; m10.setName(m.getName()) fieldCell1.setMesh(m10) ff1_1=f1.getFieldOnMeshAtLevel(ON_CELLS,m1) - ff1_1.checkCoherency() + ff1_1.checkConsistencyLight() self.assertTrue(ff1_1.isEqual(fieldCell1,1e-12,1e-12)) ff1_2=f1.getFieldAtLevel(ON_CELLS,-1) - ff1_2.checkCoherency() + ff1_2.checkConsistencyLight() self.assertTrue(ff1_2.isEqual(fieldCell1,1e-12,1e-12)) ff1_3=f1.getFieldOnMeshAtLevel(ON_CELLS,-1,m) - ff1_3.checkCoherency() + ff1_3.checkConsistencyLight() self.assertTrue(ff1_3.isEqual(fieldCell1,1e-12,1e-12)) ff1_4=ReadFieldCell(fname,m.getName(),-1,fieldCell1.getName(),dt,it) - ff1_4.checkCoherency() + ff1_4.checkConsistencyLight() self.assertTrue(ff1_4.getMesh().isEqual(m10,1e-12)) self.assertRaises(InterpKernelException,f1.getFieldOnMeshAtLevel,ON_CELLS,m0) # error because impossible to build a sub mesh at level 0 lying on cells [0,1,2,3,4,5,6] self.assertRaises(InterpKernelException,f1.getFieldAtLevel,ON_CELLS,0) # error because impossible to build a sub mesh at level 0 lying on cells [0,1,2,3,4,5,6] @@ -1896,7 +1896,7 @@ class MEDLoaderTest(unittest.TestCase): m1.setCoords(coo) ; m.setMeshAtLevel(-1,m1) m2.setCoords(coo) ; m.setMeshAtLevel(-2,m2) # - mm=m.deepCpy() + mm=m.deepCopy() famCoo=DataArrayInt([0,2,0,3,2,0,-1,0,0,0,0,-1,3]) ; mm.setFamilyFieldArr(1,famCoo) da0=DataArrayInt([0,0,0]) ; mm.setFamilyFieldArr(0,da0) da1=DataArrayInt([0,3]) ; mm.setFamilyFieldArr(-1,da1) @@ -1967,7 +1967,7 @@ class MEDLoaderTest(unittest.TestCase): m1.setCoords(coo) ; m.setMeshAtLevel(-1,m1) m2.setCoords(coo) ; m.setMeshAtLevel(-2,m2) # - mm=m.deepCpy() + mm=m.deepCopy() famCoo=DataArrayInt([0,2,0,3,2,0,-1,0,0,0,0,-1,3]) ; mm.setFamilyFieldArr(0,famCoo) da0=DataArrayInt([0,0,0]) ; mm.setFamilyFieldArr(1,da0) da1=DataArrayInt([0,3]) ; mm.setFamilyFieldArr(-1,da1) @@ -2066,7 +2066,7 @@ class MEDLoaderTest(unittest.TestCase): a1.iota(7.) ; a1.rearrange(3); mesh.setCoords(a1); mesh.setNodeGridStructure([4,5]); - mesh.checkCoherency(); + mesh.checkConsistencyLight(); # m=MEDFileCurveLinearMesh() m.setMesh(mesh) @@ -2107,15 +2107,15 @@ class MEDLoaderTest(unittest.TestCase): pts.setName("A") ; pts.setDescription("An example of parameter") ; pts.setTimeUnit("ms") pts.appendValue(1,2,3.4,567.89) pts.appendValue(2,3,5.6,999.123) - pts2=pts.deepCpy() ; pts2.setName("B") ; pts2.setDescription("A second example") + pts2=pts.deepCopy() ; pts2.setName("B") ; pts2.setDescription("A second example") p.pushParam(pts) ; p.pushParam(pts2) data.write(fname,2) p2=MEDFileParameters(fname) self.assertTrue(p.isEqual(p2,1e-14)[0]) self.assertAlmostEqual(p[1][1,2].getValue(),567.89,13) - p3=p.deepCpy() - pts4=pts2.deepCpy() - pts3=pts2.deepCpy() + p3=p.deepCopy() + pts4=pts2.deepCopy() + pts3=pts2.deepCopy() self.assertTrue(pts3.isEqual(pts2,1e-14)[0]) pts2.eraseTimeStepIds([0]) self.assertTrue(not pts3.isEqual(pts2,1e-14)[0]) @@ -2179,7 +2179,7 @@ class MEDLoaderTest(unittest.TestCase): self.assertTrue(not mm.isEqual(mmr,1e-12)[0]) mmr.getNameFieldAtLevel(1).setIJ(0,0,'N') self.assertTrue(mm.isEqual(mmr,1e-12)[0]) - mmCpy=mm.deepCpy() + mmCpy=mm.deepCopy() self.assertTrue(mm.isEqual(mmCpy,1e-12)[0]) # remove names on nodes mmCpy.setNameFieldAtLevel(1,None) @@ -2210,7 +2210,7 @@ class MEDLoaderTest(unittest.TestCase): self.assertTrue(not cc.isEqual(ccr,1e-12)[0]) ccr.getNameFieldAtLevel(1).setIJ(0,0,'N') self.assertTrue(cc.isEqual(ccr,1e-12)[0]) - ccCpy=cc.deepCpy() + ccCpy=cc.deepCopy() self.assertTrue(cc.isEqual(ccCpy,1e-12)[0]) pass @@ -2246,7 +2246,7 @@ class MEDLoaderTest(unittest.TestCase): c2.transformWithIndArr(whichGrp) splitOfM1=len(grps)*[None] for grpId,grp in enumerate(grps): - tmp=c2.getIdsEqual(grpId) + tmp=c2.findIdsEqual(grpId) splitOfM1[grpId]=tmp pass splitOfM1[0].isEqual(DataArrayInt([0,1,2,3,6,8,10,11,12,13])) @@ -2619,13 +2619,13 @@ class MEDLoaderTest(unittest.TestCase): tri=MEDCouplingUMesh("tri",2) tri.allocateCells() ; tri.insertNextCell(NORM_TRI3,[0,1,2]) tri.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,0.)])) - tris=[tri.deepCpy() for i in xrange(4)] + tris=[tri.deepCopy() for i in xrange(4)] for i,elt in enumerate(tris): elt.translate([i,0]) tris=MEDCouplingUMesh.MergeUMeshes(tris) quad=MEDCouplingUMesh("quad",2) quad.allocateCells() ; quad.insertNextCell(NORM_QUAD4,[0,1,2,3]) quad.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,1.),(1.,0.)])) - quads=[quad.deepCpy() for i in xrange(5)] + quads=[quad.deepCopy() for i in xrange(5)] for i,elt in enumerate(quads): elt.translate([5+i,0]) quads=MEDCouplingUMesh.MergeUMeshes(quads) m=MEDCouplingUMesh.MergeUMeshes(tris,quads) @@ -2654,9 +2654,9 @@ class MEDLoaderTest(unittest.TestCase): pass # add a mismatch of nb of compos pass - fmts0_2=fmts0_0.deepCpy() - fmts0_3=fmts0_0.deepCpy() - fmts0_4=fmts0_0.deepCpy() + fmts0_2=fmts0_0.deepCopy() + fmts0_3=fmts0_0.deepCopy() + fmts0_4=fmts0_0.deepCopy() fmts0_5=fmts0_0.shallowCpy() self.assertTrue(len(fmts0_0)==10 and len(fmts0_1)==10 and len(fmts0_2)==10 and len(fmts0_3)==10 and len(fmts0_4)==10 and len(fmts0_5)==10) del fmts0_2[::2] @@ -2697,13 +2697,13 @@ class MEDLoaderTest(unittest.TestCase): tri=MEDCouplingUMesh("tri",2) tri.allocateCells() ; tri.insertNextCell(NORM_TRI3,[0,1,2]) tri.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,0.)])) - tris=[tri.deepCpy() for i in xrange(4)] + tris=[tri.deepCopy() for i in xrange(4)] for i,elt in enumerate(tris): elt.translate([i,0]) tris=MEDCouplingUMesh.MergeUMeshes(tris) quad=MEDCouplingUMesh("quad",2) quad.allocateCells() ; quad.insertNextCell(NORM_QUAD4,[0,1,2,3]) quad.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,1.),(1.,0.)])) - quads=[quad.deepCpy() for i in xrange(5)] + quads=[quad.deepCopy() for i in xrange(5)] for i,elt in enumerate(quads): elt.translate([5+i,0]) quads=MEDCouplingUMesh.MergeUMeshes(quads) m=MEDCouplingUMesh.MergeUMeshes(tris,quads) @@ -2732,9 +2732,9 @@ class MEDLoaderTest(unittest.TestCase): fmts0_0.zipPflsNames() self.assertEqual(fmts0_0.getPfls(),('pfl_NORM_QUAD4',)) self.assertTrue(fmts0_1.getProfile("pfl_NORM_QUAD4").isEqual(fmts0_0.getProfile("pfl_NORM_QUAD4"))) - fmts0_2=fmts0_0.deepCpy() - fmts0_3=fmts0_0.deepCpy() - fmts0_4=fmts0_0.deepCpy() + fmts0_2=fmts0_0.deepCopy() + fmts0_3=fmts0_0.deepCopy() + fmts0_4=fmts0_0.deepCopy() fs0=MEDFileFields() fs0.pushField(fmts0_0) fmts0_2.setName("2ndField") ; fs0.pushField(fmts0_2) @@ -2762,13 +2762,13 @@ class MEDLoaderTest(unittest.TestCase): tri=MEDCouplingUMesh("tri",2) tri.allocateCells() ; tri.insertNextCell(NORM_TRI3,[0,1,2]) tri.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,0.)])) - tris=[tri.deepCpy() for i in xrange(4)] + tris=[tri.deepCopy() for i in xrange(4)] for i,elt in enumerate(tris): elt.translate([i,0]) tris=MEDCouplingUMesh.MergeUMeshes(tris) quad=MEDCouplingUMesh("quad",2) quad.allocateCells() ; quad.insertNextCell(NORM_QUAD4,[0,1,2,3]) quad.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,1.),(1.,0.)])) - quads=[quad.deepCpy() for i in xrange(5)] + quads=[quad.deepCopy() for i in xrange(5)] for i,elt in enumerate(quads): elt.translate([5+i,0]) quads=MEDCouplingUMesh.MergeUMeshes(quads) m=MEDCouplingUMesh.MergeUMeshes(tris,quads) @@ -2831,13 +2831,13 @@ class MEDLoaderTest(unittest.TestCase): tri=MEDCouplingUMesh("tri",2) tri.allocateCells() ; tri.insertNextCell(NORM_TRI3,[0,1,2]) tri.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,0.)])) - tris=[tri.deepCpy() for i in xrange(4)] + tris=[tri.deepCopy() for i in xrange(4)] for i,elt in enumerate(tris): elt.translate([i,0]) tris=MEDCouplingUMesh.MergeUMeshes(tris) quad=MEDCouplingUMesh("quad",2) quad.allocateCells() ; quad.insertNextCell(NORM_QUAD4,[0,1,2,3]) quad.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,1.),(1.,0.)])) - quads=[quad.deepCpy() for i in xrange(5)] + quads=[quad.deepCopy() for i in xrange(5)] for i,elt in enumerate(quads): elt.translate([5+i,0]) quads=MEDCouplingUMesh.MergeUMeshes(quads) m=MEDCouplingUMesh.MergeUMeshes(tris,quads) @@ -2846,7 +2846,7 @@ class MEDLoaderTest(unittest.TestCase): # ff0=MEDFileField1TS() f0=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) ; f0.setMesh(m) ; arr=DataArrayDouble(m.getNumberOfCells()*2) ; arr.iota() ; arr.rearrange(2) ; arr.setInfoOnComponents(["X [km]","YY [mm]"]) ; f0.setArray(arr) ; f0.setName("FieldCell") - f0.checkCoherency() + f0.checkConsistencyLight() ff0.setFieldNoProfileSBT(f0) # fspExp=[(3,[(0,(0,4),'','')]),(4,[(0,(4,9),'','')])] @@ -2863,7 +2863,7 @@ class MEDLoaderTest(unittest.TestCase): del arr,f0,ff0,ff1,ff0i,fspExp ff0=MEDFileField1TS() f0=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) ; f0.setMesh(m[:7]) ; arr=DataArrayDouble(7*2) ; arr.iota() ; arr.rearrange(2) ; arr.setInfoOnComponents(["XX [pm]","YYY [hm]"]) ; f0.setArray(arr) ; f0.setName("FieldCellPfl") - f0.checkCoherency() + f0.checkConsistencyLight() pfl=DataArrayInt.Range(0,7,1) ; pfl.setName("pfl") ff0.setFieldProfile(f0,mm,0,pfl) fspExp=[(3,[(0,(0,4),'','')]),(4,[(0,(4,7),'pfl_NORM_QUAD4','')])] @@ -2881,13 +2881,13 @@ class MEDLoaderTest(unittest.TestCase): ## MultiTimeSteps ff0=MEDFileFieldMultiTS() f0=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) ; f0.setMesh(m[:7]) ; arr=DataArrayDouble(7*2) ; arr.iota() ; arr.rearrange(2) ; arr.setInfoOnComponents(["X [km]","YY [mm]"]) ; f0.setArray(arr) ; f0.setName("FieldCellMTime") ; f0.setTime(0.1,0,10) - f0.checkCoherency() + f0.checkConsistencyLight() ff0.appendFieldProfile(f0,mm,0,pfl) f0=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) ; f0.setMesh(m[:7]) ; arr=DataArrayDouble(7*2) ; arr.iota(100) ; arr.rearrange(2) ; arr.setInfoOnComponents(["X [km]","YY [mm]"]) ; f0.setArray(arr) ; f0.setName("FieldCellMTime") ; f0.setTime(1.1,1,11) - f0.checkCoherency() + f0.checkConsistencyLight() ff0.appendFieldProfile(f0,mm,0,pfl) f0=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) ; f0.setMesh(m[:7]) ; arr=DataArrayDouble(7*2) ; arr.iota(200) ; arr.rearrange(2) ; arr.setInfoOnComponents(["X [km]","YY [mm]"]) ; f0.setArray(arr) ; f0.setName("FieldCellMTime") ; f0.setTime(2.1,2,12) - f0.checkCoherency() + f0.checkConsistencyLight() ff0.appendFieldProfile(f0,mm,0,pfl) ff1=ff0.convertToInt() self.assertTrue(isinstance(ff1,MEDFileIntFieldMultiTS)) @@ -2933,13 +2933,13 @@ class MEDLoaderTest(unittest.TestCase): tri=MEDCouplingUMesh("tri",2) tri.allocateCells() ; tri.insertNextCell(NORM_TRI3,[0,1,2]) tri.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,0.)])) - tris=[tri.deepCpy() for i in xrange(30)] + tris=[tri.deepCopy() for i in xrange(30)] for i,elt in enumerate(tris): elt.translate([i,0]) tris=MEDCouplingUMesh.MergeUMeshes(tris) quad=MEDCouplingUMesh("quad",2) quad.allocateCells() ; quad.insertNextCell(NORM_QUAD4,[0,1,2,3]) quad.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,1.),(1.,0.)])) - quads=[quad.deepCpy() for i in xrange(40)] + quads=[quad.deepCopy() for i in xrange(40)] for i,elt in enumerate(quads): elt.translate([40+i,0]) quads=MEDCouplingUMesh.MergeUMeshes(quads) m=MEDCouplingUMesh.MergeUMeshes(tris,quads) @@ -2948,7 +2948,7 @@ class MEDLoaderTest(unittest.TestCase): # ff0=MEDFileField1TS() f0=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) ; f0.setMesh(m) ; arr=DataArrayDouble(m.getNumberOfCells()*2) ; arr.iota() ; arr.rearrange(2) ; arr.setInfoOnComponents(["X [km]","YY [mm]"]) ; f0.setArray(arr) ; f0.setName("FieldCell") - f0.checkCoherency() + f0.checkConsistencyLight() ff0.setFieldNoProfileSBT(f0) ff0.write(fname,0) # @@ -2957,7 +2957,7 @@ class MEDLoaderTest(unittest.TestCase): # With profiles ff0=MEDFileField1TS() f0=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) ; f0.setMesh(m[:50]) ; arr=DataArrayDouble(50*2) ; arr.iota() ; arr.rearrange(2) ; arr.setInfoOnComponents(["XX [pm]","YYY [hm]"]) ; f0.setArray(arr) ; f0.setName("FieldCellPfl") - f0.checkCoherency() + f0.checkConsistencyLight() pfl=DataArrayInt.Range(0,50,1) ; pfl.setName("pfl") ff0.setFieldProfile(f0,mm,0,pfl) fspExp=[(3,[(0,(0,30),'','')]),(4,[(0,(30,50),'pfl_NORM_QUAD4','')])] @@ -3015,7 +3015,7 @@ class MEDLoaderTest(unittest.TestCase): for t in xrange(20): f0=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) ; f0.setMesh(m) ; arr=DataArrayDouble(m.getNumberOfCells()*2) ; arr.iota(float(t+1000)) ; arr.rearrange(2) ; arr.setInfoOnComponents(["X [km]","YY [mm]"]) ; f0.setArray(arr) ; f0.setName(fieldName) f0.setTime(float(t)+0.1,t,100+t) - f0.checkCoherency() + f0.checkConsistencyLight() ff0.appendFieldNoProfileSBT(f0) pass ff0.write(fname,0) @@ -3201,13 +3201,13 @@ class MEDLoaderTest(unittest.TestCase): tri=MEDCouplingUMesh("tri",2) tri.allocateCells() ; tri.insertNextCell(NORM_TRI3,[0,1,2]) tri.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,0.)])) - tris=[tri.deepCpy() for i in xrange(4)] + tris=[tri.deepCopy() for i in xrange(4)] for i,elt in enumerate(tris): elt.translate([i,0]) tris=MEDCouplingUMesh.MergeUMeshes(tris) quad=MEDCouplingUMesh("quad",2) quad.allocateCells() ; quad.insertNextCell(NORM_QUAD4,[0,1,2,3]) quad.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,1.),(1.,0.)])) - quads=[quad.deepCpy() for i in xrange(5)] + quads=[quad.deepCopy() for i in xrange(5)] for i,elt in enumerate(quads): elt.translate([5+i,0]) quads=MEDCouplingUMesh.MergeUMeshes(quads) m=MEDCouplingUMesh.MergeUMeshes(tris,quads) @@ -3316,13 +3316,13 @@ class MEDLoaderTest(unittest.TestCase): tri=MEDCouplingUMesh("tri",2) tri.allocateCells() ; tri.insertNextCell(NORM_TRI3,[0,1,2]) tri.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,0.)])) - tris=[tri.deepCpy() for i in xrange(4)] + tris=[tri.deepCopy() for i in xrange(4)] for i,elt in enumerate(tris): elt.translate([i,0]) tris=MEDCouplingUMesh.MergeUMeshes(tris) quad=MEDCouplingUMesh("quad",2) quad.allocateCells() ; quad.insertNextCell(NORM_QUAD4,[0,1,2,3]) quad.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,1.),(1.,0.)])) - quads=[quad.deepCpy() for i in xrange(5)] + quads=[quad.deepCopy() for i in xrange(5)] for i,elt in enumerate(quads): elt.translate([5+i,0]) quads=MEDCouplingUMesh.MergeUMeshes(quads) m=MEDCouplingUMesh.MergeUMeshes(tris,quads) @@ -3418,14 +3418,14 @@ class MEDLoaderTest(unittest.TestCase): m.insertNextCell([0,2,1,3]) m.setCoords(DataArrayDouble([0.,0.,1.,1.,1.,0.,0.,1.],4,2)) # - ms=[m.deepCpy() for i in xrange(4)] + ms=[m.deepCopy() for i in xrange(4)] for i,elt in enumerate(ms): elt.translate([float(i)*1.5,0.]) pass m0=MEDCoupling1SGTUMesh.Merge1SGTUMeshes(ms).buildUnstructured() m0.convertAllToPoly() # - ms=[m.deepCpy() for i in xrange(5)] + ms=[m.deepCopy() for i in xrange(5)] for i,elt in enumerate(ms): elt.translate([float(i)*1.5,1.5]) pass @@ -3456,7 +3456,7 @@ class MEDLoaderTest(unittest.TestCase): arr0=DataArrayDouble(9) ; arr0.iota() arr1=DataArrayDouble(9) ; arr1.iota(100) arr=DataArrayDouble.Meld(arr0,arr1) ; arr.setInfoOnComponents(["mm [kg]","sds [m]"]) - f.setArray(arr) ; f.checkCoherency() + f.setArray(arr) ; f.checkConsistencyLight() f.setTime(5.6,1,2) ff=MEDFileField1TS() ff.setFieldNoProfileSBT(f) @@ -3539,7 +3539,7 @@ class MEDLoaderTest(unittest.TestCase): for elt in [[0,1,2,3,4,5],[1,2,3,4,5,6],[2,3,4,5,6,7],[3,4,5,6,7,8]]:#4 m0.insertNextCell(NORM_PENTA6,elt) pass - m0.checkCoherency1() + m0.checkConsistency() m1=MEDCouplingUMesh(); m1.setName("mesh") m1.setMeshDimension(2); m1.allocateCells(5); @@ -3703,7 +3703,7 @@ class MEDLoaderTest(unittest.TestCase): m.changeSpaceDimension(3,0.) infos=["aa [b]","cc [de]","gg [klm]"] m.getCoords().setInfoOnComponents(infos) - m.checkCoherency1() + m.checkConsistency() mm=MEDFileUMesh() mm.setMeshAtLevel(0,m) m1=MEDCouplingCMesh() ; m1.setCoords(arr) ; m1.setName("Mesh") @@ -3787,7 +3787,7 @@ class MEDLoaderTest(unittest.TestCase): m.changeSpaceDimension(3,0.) infos=["aa [b]","cc [de]","gg [klm]"] m.getCoords().setInfoOnComponents(infos) - m.checkCoherency1() + m.checkConsistency() f=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) ; f.setMesh(m) f.setName("Field") arr=DataArrayDouble(25,2) ; arr.setInfoOnComponents(compos) @@ -3801,7 +3801,7 @@ class MEDLoaderTest(unittest.TestCase): arr[:,0]=range(200,236) arr[:,1]=range(300,336) f.setArray(arr) - f.checkCoherency() + f.checkConsistencyLight() WriteFieldUsingAlreadyWrittenMesh(fileName,f) # ms=MEDFileMeshes() @@ -3814,7 +3814,7 @@ class MEDLoaderTest(unittest.TestCase): mm=MEDFileUMesh.LoadPartOf(fileName,meshName,[NORM_QUAD4],[3,15,1]) ms.pushMesh(mm) fs=MEDFileFields.LoadPartOf(fileName,False,ms) - fs=fs.deepCpy() + fs=fs.deepCopy() fs[0][0].loadArrays() arr=DataArrayDouble(12,2) ; arr[:,0]=range(3,15) ; arr[:,1]=range(103,115) arr.setInfoOnComponents(compos) @@ -3852,7 +3852,7 @@ class MEDLoaderTest(unittest.TestCase): m.changeSpaceDimension(3,0.) infos=["aa [b]","cc [de]","gg [klm]"] m.getCoords().setInfoOnComponents(infos) - m.checkCoherency1() + m.checkConsistency() f=MEDCouplingFieldDouble(ON_CELLS,ONE_TIME) ; f.setMesh(m) f.setName("Field") arr=DataArrayDouble(25,2) ; arr.setInfoOnComponents(compos) @@ -3866,7 +3866,7 @@ class MEDLoaderTest(unittest.TestCase): arr[:,0]=range(200,236) arr[:,1]=range(300,336) f.setArray(arr) - f.checkCoherency() + f.checkConsistencyLight() WriteFieldUsingAlreadyWrittenMesh(fileName,f) # ms=MEDFileMeshes() @@ -3925,7 +3925,7 @@ class MEDLoaderTest(unittest.TestCase): m=MEDCouplingUMesh.MergeUMeshesOnSameCoords([m0,m1]) m.setName(meshName2D) mMinus1,a,b,c,d=m.buildDescendingConnectivity() - e=d.deltaShiftIndex().getIdsEqual(1) + e=d.deltaShiftIndex().findIdsEqual(1) # mm=MEDFileUMesh() mm.setMeshAtLevel(0,m) ; mm.setMeshAtLevel(-1,mMinus1) @@ -4003,7 +4003,7 @@ class MEDLoaderTest(unittest.TestCase): m.insertNextCell(NORM_POLYGON,4,targetConn[14:18]) m.finishInsertingCells(); m.setCoords(c) - m.checkCoherency() + m.checkConsistencyLight() m1=MEDCouplingUMesh.New(); m1.setMeshDimension(1); m1.allocateCells(3); @@ -4012,7 +4012,7 @@ class MEDLoaderTest(unittest.TestCase): m1.insertNextCell(NORM_SEG3,3,[2,8,5]) m1.finishInsertingCells(); m1.setCoords(c) - m1.checkCoherency() + m1.checkConsistencyLight() m2=MEDCouplingUMesh.New(); m2.setMeshDimension(0); m2.allocateCells(4); @@ -4022,7 +4022,7 @@ class MEDLoaderTest(unittest.TestCase): m2.insertNextCell(NORM_POINT1,1,[6]) m2.finishInsertingCells(); m2.setCoords(c) - m2.checkCoherency() + m2.checkConsistencyLight() # mm=MEDFileUMesh.New() self.assertTrue(mm.getUnivNameWrStatus()) @@ -4076,13 +4076,13 @@ class MEDLoaderTest(unittest.TestCase): st=cPickle.dumps(mm,cPickle.HIGHEST_PROTOCOL) mm2=cPickle.loads(st) self.assertTrue(mm.isEqual(mm2,1e-12)[0]) - self.assertEqual(mm.getAxType(),AX_CART) + self.assertEqual(mm.getAxisType(),AX_CART) # - mm.setAxType(AX_CYL) + mm.setAxisType(AX_CYL) st=cPickle.dumps(mm,cPickle.HIGHEST_PROTOCOL) mm2=cPickle.loads(st) self.assertTrue(mm.isEqual(mm2,1e-12)[0]) - self.assertEqual(mm2.getAxType(),AX_CYL) + self.assertEqual(mm2.getAxisType(),AX_CYL) pass def testMEDFileFieldsLoadSpecificEntities1(self): @@ -4302,7 +4302,7 @@ class MEDLoaderTest(unittest.TestCase): field.setMesh(m) field.setArray(DataArrayDouble([1.2,2.3,3.4,4.5])) field.setName("Field") - field.checkCoherency() + field.checkConsistencyLight() pfl=DataArrayInt([0,1,2,3]) ; pfl.setName("TUTU") #<- false profile because defined on all cells ! ff.setFieldProfile(field,mm,0,pfl) # <- bug was revealed here ! self.assertEqual(ff.getPfls(),()) @@ -4322,7 +4322,7 @@ class MEDLoaderTest(unittest.TestCase): field.setMesh(m) field.setArray(DataArrayDouble([1.2,2.3,3.4,4.5])) field.setName("Field") - field.checkCoherency() + field.checkConsistencyLight() pfl=DataArrayInt([0,1,2,3]) ; pfl.setName("TUTU") ff.setFieldProfile(field,mm,0,pfl) self.assertEqual(ff.getPfls(),()) @@ -4350,7 +4350,7 @@ class MEDLoaderTest(unittest.TestCase): m3D=m.buildExtrudedMesh(m1D,0) m3D.sortCellsInMEDFileFrmt() m3D.setName(meshName) - m2D=m ; m2D.setCoords(m3D.getCoords()) ; m2D.shiftNodeNumbersInConn(delta) ; m2D.setName(meshName) ; m2D.checkCoherency1() + m2D=m ; m2D.setCoords(m3D.getCoords()) ; m2D.shiftNodeNumbersInConn(delta) ; m2D.setName(meshName) ; m2D.checkConsistency() m1D=m2D.computeSkin() ; m1D.setName(meshName) m0D=MEDCouplingUMesh.Build0DMeshFromCoords(m3D.getCoords()) ; m0D.setName(meshName) ; m0D=m0D[[2,4,10]] # @@ -4394,7 +4394,7 @@ class MEDLoaderTest(unittest.TestCase): self.assertEqual(mm.getGroupsNames(),('grp0','grp1','grp2','grp3')) delta=12 for grp in [grp0,grp1,grp2,grp3]: - grpNode=grp.deepCpy() ; grpNode+=delta ; grpNode.setName("%s_node"%grp.getName()) + grpNode=grp.deepCopy() ; grpNode+=delta ; grpNode.setName("%s_node"%grp.getName()) mm.addGroup(1,grpNode) self.assertEqual(mm.getGroupsNames(),('grp0','grp0_node','grp1','grp1_node','grp2','grp2_node','grp3','grp3_node')) for grp in [grp0,grp1,grp2,grp3]: @@ -4589,7 +4589,7 @@ class MEDLoaderTest(unittest.TestCase): f.setMesh(m) f.setArray(DataArrayDouble(100)) f.getArray()[:]=100. - f.checkCoherency() + f.checkConsistencyLight() f1ts=MEDFileField1TS() f1ts.setFieldNoProfileSBT(f) # redirect stderr @@ -4646,9 +4646,9 @@ class MEDLoaderTest(unittest.TestCase): mesh=MEDFileUMesh() ; mesh[0]=m m1=m.computeSkin() ; mesh[-1]=m1 # - bary1=m1.getBarycenterAndOwner()[:,2] - grp1=bary1.getIdsInRange(hauteur-1e-12,hauteur+1e-12) ; grp1.setName(grpName1) - grp2=bary1.getIdsInRange(0.-1e-12,0.+1e-12) ; grp2.setName(grpName2) + bary1=m1.computeCellCenterOfMass()[:,2] + grp1=bary1.findIdsInRange(hauteur-1e-12,hauteur+1e-12) ; grp1.setName(grpName1) + grp2=bary1.findIdsInRange(0.-1e-12,0.+1e-12) ; grp2.setName(grpName2) mesh.setGroupsAtLevel(-1,[grp1,grp2]) import cPickle @@ -4701,7 +4701,7 @@ class MEDLoaderTest(unittest.TestCase): c.setArrayForType(NORM_QUAD4,corr) self.assertEqual(eq0.getCell().size(),1) self.assertTrue(eq0.getCell().getArray(NORM_QUAD4).isEqual(corr)) - mm2=mm.deepCpy() + mm2=mm.deepCopy() self.assertTrue(mm.isEqual(mm2,1e-12)[0]) self.assertEqual(mm2.getEquivalences().size(),1) self.assertTrue(mm2.getEquivalences().getEquivalence(0).getCell().getArray(NORM_QUAD4).isEqual(corr)) @@ -4761,10 +4761,10 @@ class MEDLoaderTest(unittest.TestCase): ref2=mm[0].getNodalConnectivityIndex().getHiddenCppPointer() ref3=mm.getDirectUndergroundSingleGeoTypeMesh(NORM_QUAD4).getNodalConnectivity().getHiddenCppPointer() self.assertEqual(ref0,mm.getDirectUndergroundSingleGeoTypeMesh(NORM_QUAD4).getCoords().getHiddenCppPointer()) - mm.setAxType(AX_CYL) #<- important + mm.setAxisType(AX_CYL) #<- important mm2=mm.cartesianize() # the trigger - self.assertEqual(mm2.getAxType(),AX_CART) - mm.setAxType(AX_CART) # this is here only to avoid complaints + self.assertEqual(mm2.getAxisType(),AX_CART) + mm.setAxisType(AX_CART) # this is here only to avoid complaints self.assertTrue(isinstance(mm2,MEDFileUMesh)) self.assertTrue(mm.getHiddenCppPointer()!=mm2.getHiddenCppPointer()) self.assertTrue(ref0==mm.getCoords().getHiddenCppPointer()) # <- here important @@ -4787,19 +4787,19 @@ class MEDLoaderTest(unittest.TestCase): self.assertEqual(mm.getFamilyFieldAtLevel(1).getHiddenCppPointer(),d0.getHiddenCppPointer()) self.assertEqual(mm2.getFamilyFieldAtLevel(1).getHiddenCppPointer(),d0.getHiddenCppPointer()) # <- here very important # UMesh cart - mm.setAxType(AX_CART) + mm.setAxisType(AX_CART) mm2=mm.cartesianize() # the trigger - self.assertEqual(mm2.getAxType(),AX_CART) + self.assertEqual(mm2.getAxisType(),AX_CART) self.assertTrue(isinstance(mm2,MEDFileUMesh)) self.assertTrue(mm.getHiddenCppPointer()==mm2.getHiddenCppPointer()) # optimization # CurveLinearMesh non cart arr=DataArrayDouble(4) ; arr.iota() ; m=MEDCouplingCMesh() ; m.setCoords(arr,arr) ; m=m.buildCurveLinear() - mm=MEDFileCurveLinearMesh() ; mm.setMesh(m) ; mm.setAxType(AX_CYL) #<- important + mm=MEDFileCurveLinearMesh() ; mm.setMesh(m) ; mm.setAxisType(AX_CYL) #<- important mm.setFamilyFieldArr(0,d1) ; mm.setFamilyFieldArr(1,d0) mm.setName("a") ; mm.setDescription("b") ; mm.setTime(3,4,5.) ; mm.addFamily("c",-4) ; mm.setFamiliesOnGroup("d",["c"]) ; mm.setTimeUnit("ms") ref0=mm.getMesh().getCoords().getHiddenCppPointer() mm2=mm.cartesianize() # the trigger - self.assertEqual(mm2.getAxType(),AX_CART) + self.assertEqual(mm2.getAxisType(),AX_CART) self.assertTrue(isinstance(mm2,MEDFileCurveLinearMesh)) self.assertTrue(mm.getHiddenCppPointer()!=mm2.getHiddenCppPointer()) self.assertTrue(ref0==mm.getMesh().getCoords().getHiddenCppPointer()) # <- here important @@ -4818,18 +4818,18 @@ class MEDLoaderTest(unittest.TestCase): self.assertEqual(mm.getFamilyFieldAtLevel(1).getHiddenCppPointer(),d0.getHiddenCppPointer()) self.assertEqual(mm2.getFamilyFieldAtLevel(1).getHiddenCppPointer(),d0.getHiddenCppPointer()) # <- here very important # CurveLinearMesh cart - mm.setAxType(AX_CART) + mm.setAxisType(AX_CART) mm2=mm.cartesianize() # the trigger - self.assertEqual(mm2.getAxType(),AX_CART) + self.assertEqual(mm2.getAxisType(),AX_CART) self.assertTrue(isinstance(mm2,MEDFileCurveLinearMesh)) self.assertTrue(mm.getHiddenCppPointer()==mm2.getHiddenCppPointer()) # optimization # CMesh non cart arr=DataArrayDouble(4) ; arr.iota() ; m=MEDCouplingCMesh() ; m.setCoords(arr,arr) - mm=MEDFileCMesh() ; mm.setMesh(m) ; mm.setAxType(AX_CYL) #<- important + mm=MEDFileCMesh() ; mm.setMesh(m) ; mm.setAxisType(AX_CYL) #<- important mm.setFamilyFieldArr(0,d1) ; mm.setFamilyFieldArr(1,d0) mm.setName("a") ; mm.setDescription("b") ; mm.setTime(3,4,5.) ; mm.addFamily("c",-4) ; mm.setFamiliesOnGroup("d",["c"]) ; mm.setTimeUnit("ms") mm2=mm.cartesianize() # the trigger - self.assertEqual(mm2.getAxType(),AX_CART) + self.assertEqual(mm2.getAxisType(),AX_CART) self.assertTrue(isinstance(mm2,MEDFileCurveLinearMesh)) self.assertEqual(mm2.getMesh().getNodeGridStructure(),mm.getMesh().getNodeGridStructure()) self.assertEqual(mm2.getName(),mm.getName()) @@ -4845,9 +4845,9 @@ class MEDLoaderTest(unittest.TestCase): self.assertEqual(mm.getFamilyFieldAtLevel(1).getHiddenCppPointer(),d0.getHiddenCppPointer()) self.assertEqual(mm2.getFamilyFieldAtLevel(1).getHiddenCppPointer(),d0.getHiddenCppPointer()) # <- here very important # CMesh cart - mm.setAxType(AX_CART) + mm.setAxisType(AX_CART) mm2=mm.cartesianize() # the trigger - self.assertEqual(mm2.getAxType(),AX_CART) + self.assertEqual(mm2.getAxisType(),AX_CART) self.assertTrue(isinstance(mm2,MEDFileCMesh)) self.assertTrue(mm.getHiddenCppPointer()==mm2.getHiddenCppPointer()) # optimization pass diff --git a/src/MEDLoader/Swig/MEDLoaderTest4.py b/src/MEDLoader/Swig/MEDLoaderTest4.py index b3f28e316..f660928a5 100644 --- a/src/MEDLoader/Swig/MEDLoaderTest4.py +++ b/src/MEDLoader/Swig/MEDLoaderTest4.py @@ -37,13 +37,13 @@ class MEDLoaderTest4(unittest.TestCase): tri=MEDCouplingUMesh("tri",2) tri.allocateCells() ; tri.insertNextCell(NORM_TRI3,[0,1,2]) tri.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,0.)])) - tris=[tri.deepCpy() for i in xrange(4)] + tris=[tri.deepCopy() for i in xrange(4)] for i,elt in enumerate(tris): elt.translate([i,0]) tris=MEDCouplingUMesh.MergeUMeshes(tris) quad=MEDCouplingUMesh("quad",2) quad.allocateCells() ; quad.insertNextCell(NORM_QUAD4,[0,1,2,3]) quad.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,1.),(1.,0.)])) - quads=[quad.deepCpy() for i in xrange(5)] + quads=[quad.deepCopy() for i in xrange(5)] for i,elt in enumerate(quads): elt.translate([5+i,0]) quads=MEDCouplingUMesh.MergeUMeshes(quads) m=MEDCouplingUMesh.MergeUMeshes(tris,quads) @@ -64,13 +64,13 @@ class MEDLoaderTest4(unittest.TestCase): fCell0.setName(fieldName) ; fCell0.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfCells()) ; arr.iota(100) ; arr.rearrange(2) fCell0.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fCell0.checkCoherency() + fCell0.checkConsistencyLight() f.setFieldNoProfileSBT(fCell0) fCell1=MEDCouplingFieldDouble(ON_CELLS) ; fCell1.setTime(float(i),i,0) fCell1.setName(fieldName) ; fCell1.setMesh(m1) arr=DataArrayDouble(2*m1.getNumberOfCells()) ; arr.iota(200) ; arr.rearrange(2) fCell1.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fCell1.checkCoherency() + fCell1.checkConsistencyLight() f.setFieldNoProfileSBT(fCell1) fs.pushBackTimeStep(f) ##### Time step 1 @@ -80,14 +80,14 @@ class MEDLoaderTest4(unittest.TestCase): fCell0.setName(fieldName) ; fCell0.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfCells()) ; arr.iota(1100) ; arr.rearrange(2) fCell0.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fCell0.checkCoherency() + fCell0.checkConsistencyLight() f.setFieldNoProfileSBT(fCell0) # fCell1=MEDCouplingFieldDouble(ON_CELLS) ; fCell1.setTime(float(i),i,0) fCell1.setName(fieldName) ; fCell1.setMesh(m1) arr=DataArrayDouble(2*m1.getNumberOfCells()) ; arr.iota(1200) ; arr.rearrange(2) fCell1.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fCell1.checkCoherency() + fCell1.checkConsistencyLight() f.setFieldNoProfileSBT(fCell1) fs.pushBackTimeStep(f) ##### Time step 2 @@ -97,14 +97,14 @@ class MEDLoaderTest4(unittest.TestCase): fCell0.setName(fieldName) ; fCell0.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfCells()) ; arr.iota(2100) ; arr.rearrange(2) fCell0.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fCell0.checkCoherency() + fCell0.checkConsistencyLight() f.setFieldNoProfileSBT(fCell0) # fCell1=MEDCouplingFieldDouble(ON_CELLS) ; fCell1.setTime(float(i),i,0) fCell1.setName(fieldName) ; fCell1.setMesh(m1) arr=DataArrayDouble(2*m1.getNumberOfCells()) ; arr.iota(2200) ; arr.rearrange(2) fCell1.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fCell1.checkCoherency() + fCell1.checkConsistencyLight() f.setFieldNoProfileSBT(fCell1) fs.pushBackTimeStep(f) ##### Time step 3 @@ -115,14 +115,14 @@ class MEDLoaderTest4(unittest.TestCase): fCell0.setName(fieldName) ; fCell0.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfCells()) ; arr.iota(3100) ; arr.rearrange(2) fCell0.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fCell0.checkCoherency() + fCell0.checkConsistencyLight() f.setFieldNoProfileSBT(fCell0) # fCell1=MEDCouplingFieldDouble(ON_CELLS) ; fCell1.setTime(float(i),i,0) fCell1.setName(fieldName) ; fCell1.setMesh(m1) arr=DataArrayDouble(2*m1.getNumberOfCells()) ; arr.iota(3200) ; arr.rearrange(2) fCell1.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fCell1.checkCoherency() + fCell1.checkConsistencyLight() f.setFieldNoProfileSBT(fCell1) # fs.pushBackTimeStep(f) @@ -134,19 +134,19 @@ class MEDLoaderTest4(unittest.TestCase): fCell0.setName(fieldName) ; fCell0.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfCells()) ; arr.iota(4100) ; arr.rearrange(2) fCell0.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fCell0.checkCoherency() + fCell0.checkConsistencyLight() f.setFieldNoProfileSBT(fCell0) # fCell1=MEDCouplingFieldDouble(ON_CELLS) ; fCell1.setTime(float(i),i,0) fCell1.setName(fieldName) ; fCell1.setMesh(m1) arr=DataArrayDouble(2*m1.getNumberOfCells()) ; arr.iota(4200) ; arr.rearrange(2) fCell1.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fCell1.checkCoherency() + fCell1.checkConsistencyLight() f.setFieldNoProfileSBT(fCell1) fs.pushBackTimeStep(f) mm.write(fname,2) fs.write(fname,0) - a0Exp=mm.getCoords().deepCpy() + a0Exp=mm.getCoords().deepCopy() del m,m1,mm,fs,f,fCell0,fCell1 ########## GO for reading in MEDReader, by not loading all. Mesh is fully loaded but not fields values ms=MEDFileMeshes(fname) ; ms.cartesianizeMe() @@ -221,13 +221,13 @@ class MEDLoaderTest4(unittest.TestCase): tri=MEDCouplingUMesh("tri",2) tri.allocateCells() ; tri.insertNextCell(NORM_TRI3,[0,1,2]) tri.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,0.)])) - tris=[tri.deepCpy() for i in xrange(4)] + tris=[tri.deepCopy() for i in xrange(4)] for i,elt in enumerate(tris): elt.translate([i,0]) tris=MEDCouplingUMesh.MergeUMeshes(tris) quad=MEDCouplingUMesh("quad",2) quad.allocateCells() ; quad.insertNextCell(NORM_QUAD4,[0,1,2,3]) quad.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,1.),(1.,0.)])) - quads=[quad.deepCpy() for i in xrange(5)] + quads=[quad.deepCopy() for i in xrange(5)] for i,elt in enumerate(quads): elt.translate([5+i,0]) quads=MEDCouplingUMesh.MergeUMeshes(quads) m=MEDCouplingUMesh.MergeUMeshes(tris,quads) @@ -244,20 +244,20 @@ class MEDLoaderTest4(unittest.TestCase): fCell0.setName(fieldName) ; fCell0.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfCells()) ; arr.iota(100) ; arr.rearrange(2) fCell0.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fCell0.checkCoherency() + fCell0.checkConsistencyLight() f.setFieldNoProfileSBT(fCell0) fCell1=MEDCouplingFieldDouble(ON_CELLS) ; fCell1.setTime(float(i),i,0) fCell1.setName(fieldName) ; fCell1.setMesh(m1) arr=DataArrayDouble(2*m1.getNumberOfCells()) ; arr.iota(200) ; arr.rearrange(2) fCell1.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fCell1.checkCoherency() + fCell1.checkConsistencyLight() f.setFieldNoProfileSBT(fCell1) # fNode=MEDCouplingFieldDouble(ON_NODES) ; fNode.setTime(float(i),i,0) fNode.setName(fieldName) ; fNode.setMesh(m1) arr=DataArrayDouble(2*m.getNumberOfNodes()) ; arr.iota(300) ; arr.rearrange(2) fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fNode.checkCoherency() + fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs.pushBackTimeStep(f) ##### Time step 1 @@ -267,21 +267,21 @@ class MEDLoaderTest4(unittest.TestCase): fCell0.setName(fieldName) ; fCell0.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfCells()) ; arr.iota(1100) ; arr.rearrange(2) fCell0.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fCell0.checkCoherency() + fCell0.checkConsistencyLight() f.setFieldNoProfileSBT(fCell0) # fCell1=MEDCouplingFieldDouble(ON_CELLS) ; fCell1.setTime(float(i),i,0) fCell1.setName(fieldName) ; fCell1.setMesh(m1) arr=DataArrayDouble(2*m1.getNumberOfCells()) ; arr.iota(1200) ; arr.rearrange(2) fCell1.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fCell1.checkCoherency() + fCell1.checkConsistencyLight() f.setFieldNoProfileSBT(fCell1) # fNode=MEDCouplingFieldDouble(ON_NODES) ; fNode.setTime(float(i),i,0) fNode.setName(fieldName) ; fNode.setMesh(m1) arr=DataArrayDouble(2*m.getNumberOfNodes()) ; arr.iota(1300) ; arr.rearrange(2) fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fNode.checkCoherency() + fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs.pushBackTimeStep(f) ##### Time step 2 @@ -291,21 +291,21 @@ class MEDLoaderTest4(unittest.TestCase): fNode.setName(fieldName) ; fNode.setMesh(m1) arr=DataArrayDouble(2*m.getNumberOfNodes()) ; arr.iota(2300) ; arr.rearrange(2) fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fNode.checkCoherency() + fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) # fCell0=MEDCouplingFieldDouble(ON_CELLS) ; fCell0.setTime(float(i),i,0) fCell0.setName(fieldName) ; fCell0.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfCells()) ; arr.iota(2100) ; arr.rearrange(2) fCell0.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fCell0.checkCoherency() + fCell0.checkConsistencyLight() f.setFieldNoProfileSBT(fCell0) # fCell1=MEDCouplingFieldDouble(ON_CELLS) ; fCell1.setTime(float(i),i,0) fCell1.setName(fieldName) ; fCell1.setMesh(m1) arr=DataArrayDouble(2*m1.getNumberOfCells()) ; arr.iota(2200) ; arr.rearrange(2) fCell1.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fCell1.checkCoherency() + fCell1.checkConsistencyLight() f.setFieldNoProfileSBT(fCell1) fs.pushBackTimeStep(f) ##### Time step 3 @@ -316,21 +316,21 @@ class MEDLoaderTest4(unittest.TestCase): fCell0.setName(fieldName) ; fCell0.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfCells()) ; arr.iota(3100) ; arr.rearrange(2) fCell0.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fCell0.checkCoherency() + fCell0.checkConsistencyLight() f.setFieldNoProfileSBT(fCell0) # fCell1=MEDCouplingFieldDouble(ON_CELLS) ; fCell1.setTime(float(i),i,0) fCell1.setName(fieldName) ; fCell1.setMesh(m1) arr=DataArrayDouble(2*m1.getNumberOfCells()) ; arr.iota(3200) ; arr.rearrange(2) fCell1.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fCell1.checkCoherency() + fCell1.checkConsistencyLight() f.setFieldNoProfileSBT(fCell1) # fNode=MEDCouplingFieldDouble(ON_NODES) ; fNode.setTime(float(i),i,0) fNode.setName(fieldName) ; fNode.setMesh(m1) arr=DataArrayDouble(2*m.getNumberOfNodes()) ; arr.iota(3300) ; arr.rearrange(2) fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fNode.checkCoherency() + fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) # fs.pushBackTimeStep(f) @@ -342,27 +342,27 @@ class MEDLoaderTest4(unittest.TestCase): fCell0.setName(fieldName) ; fCell0.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfCells()) ; arr.iota(4100) ; arr.rearrange(2) fCell0.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fCell0.checkCoherency() + fCell0.checkConsistencyLight() f.setFieldNoProfileSBT(fCell0) # fCell1=MEDCouplingFieldDouble(ON_CELLS) ; fCell1.setTime(float(i),i,0) fCell1.setName(fieldName) ; fCell1.setMesh(m1) arr=DataArrayDouble(2*m1.getNumberOfCells()) ; arr.iota(4200) ; arr.rearrange(2) fCell1.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fCell1.checkCoherency() + fCell1.checkConsistencyLight() f.setFieldNoProfileSBT(fCell1) # fNode=MEDCouplingFieldDouble(ON_NODES) ; fNode.setTime(float(i),i,0) fNode.setName(fieldName) ; fNode.setMesh(m1) arr=DataArrayDouble(2*m.getNumberOfNodes()) ; arr.iota(4300) ; arr.rearrange(2) fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fNode.checkCoherency() + fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) # fs.pushBackTimeStep(f) mm.write(fname,2) fs.write(fname,0) - a0Exp=mm.getCoords().deepCpy() + a0Exp=mm.getCoords().deepCopy() del m,m1,mm,fs,f,fCell0,fCell1 ########## GO for reading in MEDReader, by not loading all. Mesh is fully loaded but not fields values ms=MEDFileMeshes(fname) ; ms.cartesianizeMe() @@ -439,13 +439,13 @@ class MEDLoaderTest4(unittest.TestCase): tri=MEDCouplingUMesh("tri",2) tri.allocateCells() ; tri.insertNextCell(NORM_TRI3,[0,1,2]) tri.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,0.)])) - tris=[tri.deepCpy() for i in xrange(4)] + tris=[tri.deepCopy() for i in xrange(4)] for i,elt in enumerate(tris): elt.translate([i,0]) tris=MEDCouplingUMesh.MergeUMeshes(tris) quad=MEDCouplingUMesh("quad",2) quad.allocateCells() ; quad.insertNextCell(NORM_QUAD4,[0,1,2,3]) quad.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,1.),(1.,0.)])) - quads=[quad.deepCpy() for i in xrange(5)] + quads=[quad.deepCopy() for i in xrange(5)] for i,elt in enumerate(quads): elt.translate([5+i,0]) quads=MEDCouplingUMesh.MergeUMeshes(quads) m=MEDCouplingUMesh.MergeUMeshes(tris,quads) @@ -462,13 +462,13 @@ class MEDLoaderTest4(unittest.TestCase): fCell0.setName(fieldName) ; fCell0.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfCells()) ; arr.iota(100) ; arr.rearrange(2) fCell0.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fCell0.checkCoherency() + fCell0.checkConsistencyLight() f.setFieldNoProfileSBT(fCell0) fCell1=MEDCouplingFieldDouble(ON_CELLS) ; fCell1.setTime(float(i),i,0) fCell1.setName(fieldName) ; fCell1.setMesh(m1) arr=DataArrayDouble(2*m1.getNumberOfCells()) ; arr.iota(200) ; arr.rearrange(2) fCell1.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fCell1.checkCoherency() + fCell1.checkConsistencyLight() f.setFieldNoProfileSBT(fCell1) fs.pushBackTimeStep(f) ##### Time step 1 on nodes @@ -478,7 +478,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode.setName(fieldName) ; fNode.setMesh(m1) arr=DataArrayDouble(2*m.getNumberOfNodes()) ; arr.iota(1300) ; arr.rearrange(2) fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fNode.checkCoherency() + fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs.pushBackTimeStep(f) ##### Time step 2 on cells @@ -488,14 +488,14 @@ class MEDLoaderTest4(unittest.TestCase): fCell0.setName(fieldName) ; fCell0.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfCells()) ; arr.iota(2100) ; arr.rearrange(2) fCell0.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fCell0.checkCoherency() + fCell0.checkConsistencyLight() f.setFieldNoProfileSBT(fCell0) # fCell1=MEDCouplingFieldDouble(ON_CELLS) ; fCell1.setTime(float(i),i,0) fCell1.setName(fieldName) ; fCell1.setMesh(m1) arr=DataArrayDouble(2*m1.getNumberOfCells()) ; arr.iota(2200) ; arr.rearrange(2) fCell1.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fCell1.checkCoherency() + fCell1.checkConsistencyLight() f.setFieldNoProfileSBT(fCell1) fs.pushBackTimeStep(f) ##### Time step 3 on nodes @@ -505,7 +505,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode.setName(fieldName) ; fNode.setMesh(m1) arr=DataArrayDouble(2*m.getNumberOfNodes()) ; arr.iota(3300) ; arr.rearrange(2) fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fNode.checkCoherency() + fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs.pushBackTimeStep(f) ##### Time step 4 @@ -515,20 +515,20 @@ class MEDLoaderTest4(unittest.TestCase): fCell0.setName(fieldName) ; fCell0.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfCells()) ; arr.iota(4100) ; arr.rearrange(2) fCell0.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fCell0.checkCoherency() + fCell0.checkConsistencyLight() f.setFieldNoProfileSBT(fCell0) # fCell1=MEDCouplingFieldDouble(ON_CELLS) ; fCell1.setTime(float(i),i,0) fCell1.setName(fieldName) ; fCell1.setMesh(m1) arr=DataArrayDouble(2*m1.getNumberOfCells()) ; arr.iota(4200) ; arr.rearrange(2) fCell1.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]","Com2 [s^2]"]) - fCell1.checkCoherency() + fCell1.checkConsistencyLight() f.setFieldNoProfileSBT(fCell1) # fs.pushBackTimeStep(f) mm.write(fname,2) fs.write(fname,0) - a0Exp=mm.getCoords().deepCpy() + a0Exp=mm.getCoords().deepCopy() del m,m1,mm,fs,f,fCell0,fCell1 ########## GO for reading in MEDReader, by not loading all. Mesh is fully loaded but not fields values ms=MEDFileMeshes(fname) ; ms.cartesianizeMe() @@ -623,13 +623,13 @@ class MEDLoaderTest4(unittest.TestCase): tri=MEDCouplingUMesh("tri",2) tri.allocateCells() ; tri.insertNextCell(NORM_TRI3,[0,1,2]) tri.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,0.)])) - tris=[tri.deepCpy() for i in xrange(4)] + tris=[tri.deepCopy() for i in xrange(4)] for i,elt in enumerate(tris): elt.translate([i,0]) tris=MEDCouplingUMesh.MergeUMeshes(tris) quad=MEDCouplingUMesh("quad",2) quad.allocateCells() ; quad.insertNextCell(NORM_QUAD4,[0,1,2,3]) quad.setCoords(DataArrayDouble([(0.,0.),(0.,1.),(1.,1.),(1.,0.)])) - quads=[quad.deepCpy() for i in xrange(5)] + quads=[quad.deepCopy() for i in xrange(5)] for i,elt in enumerate(quads): elt.translate([5+i,0]) quads=MEDCouplingUMesh.MergeUMeshes(quads) m=MEDCouplingUMesh.MergeUMeshes(tris,quads) @@ -647,7 +647,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode.setName(fieldName1) ; fNode.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfNodes()) ; arr.iota(0+1000*i) ; arr.rearrange(2) fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_0 [m]","Com2_0 [s^2]"]) - fNode.checkCoherency() + fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs1.pushBackTimeStep(f) # @@ -656,7 +656,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode.setName(fieldName2) ; fNode.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfNodes()) ; arr.iota(100+1000*i) ; arr.rearrange(2) fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_1 [m]","Com2_1 [s^2]"]) - fNode.checkCoherency() + fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs2.pushBackTimeStep(f) # @@ -665,7 +665,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode.setName(fieldName3) ; fNode.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfNodes()) ; arr.iota(200+1000*i) ; arr.rearrange(2) fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_2 [m]","Com2_2 [s^2]"]) - fNode.checkCoherency() + fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs3.pushBackTimeStep(f) ##### Time step 1 @@ -675,7 +675,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode.setName(fieldName1) ; fNode.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfNodes()) ; arr.iota(0+1000*i) ; arr.rearrange(2) fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_0 [m]","Com2_0 [s^2]"]) - fNode.checkCoherency() + fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs1.pushBackTimeStep(f) # @@ -684,7 +684,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode.setName(fieldName2) ; fNode.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfNodes()) ; arr.iota(100+1000*i) ; arr.rearrange(2) fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_1 [m]","Com2_1 [s^2]"]) - fNode.checkCoherency() + fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs2.pushBackTimeStep(f) # @@ -693,7 +693,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode.setName(fieldName3) ; fNode.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfNodes()) ; arr.iota(200+1000*i) ; arr.rearrange(2) fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_2 [m]","Com2_2 [s^2]"]) - fNode.checkCoherency() + fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs3.pushBackTimeStep(f) ##### Time step 2 @@ -703,7 +703,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode.setName(fieldName1) ; fNode.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfNodes()) ; arr.iota(0+1000*i) ; arr.rearrange(2) fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_0 [m]","Com2_0 [s^2]"]) - fNode.checkCoherency() + fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs1.pushBackTimeStep(f) # @@ -712,7 +712,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode.setName(fieldName2) ; fNode.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfNodes()) ; arr.iota(100+1000*i) ; arr.rearrange(2) fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_1 [m]","Com2_1 [s^2]"]) - fNode.checkCoherency() + fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs2.pushBackTimeStep(f) # @@ -721,7 +721,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode.setName(fieldName3) ; fNode.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfNodes()) ; arr.iota(200+1000*i) ; arr.rearrange(2) fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_2 [m]","Com2_2 [s^2]"]) - fNode.checkCoherency() + fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs3.pushBackTimeStep(f) ##### Time step 3 @@ -731,7 +731,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode.setName(fieldName1) ; fNode.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfNodes()) ; arr.iota(0+1000*i) ; arr.rearrange(2) fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_0 [m]","Com2_0 [s^2]"]) - fNode.checkCoherency() + fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs1.pushBackTimeStep(f) # @@ -740,7 +740,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode.setName(fieldName2) ; fNode.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfNodes()) ; arr.iota(100+1000*i) ; arr.rearrange(2) fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_1 [m]","Com2_1 [s^2]"]) - fNode.checkCoherency() + fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs2.pushBackTimeStep(f) # @@ -749,7 +749,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode.setName(fieldName3) ; fNode.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfNodes()) ; arr.iota(200+1000*i) ; arr.rearrange(2) fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_2 [m]","Com2_2 [s^2]"]) - fNode.checkCoherency() + fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs3.pushBackTimeStep(f) ##### Time step 4 @@ -759,7 +759,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode.setName(fieldName1) ; fNode.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfNodes()) ; arr.iota(0+1000*i) ; arr.rearrange(2) fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_0 [m]","Com2_0 [s^2]"]) - fNode.checkCoherency() + fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs1.pushBackTimeStep(f) # @@ -768,7 +768,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode.setName(fieldName2) ; fNode.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfNodes()) ; arr.iota(100+1000*i) ; arr.rearrange(2) fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_1 [m]","Com2_1 [s^2]"]) - fNode.checkCoherency() + fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs2.pushBackTimeStep(f) # @@ -777,13 +777,13 @@ class MEDLoaderTest4(unittest.TestCase): fNode.setName(fieldName3) ; fNode.setMesh(m) arr=DataArrayDouble(2*m.getNumberOfNodes()) ; arr.iota(200+1000*i) ; arr.rearrange(2) fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_2 [m]","Com2_2 [s^2]"]) - fNode.checkCoherency() + fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs3.pushBackTimeStep(f) # mm.write(fname,2) fs1.write(fname,0) ; fs2.write(fname,0) ; fs3.write(fname,0) - a0Exp=mm.getCoords().deepCpy() + a0Exp=mm.getCoords().deepCopy() del m,mm,fs1,fs2,fs3,f,fNode ########## GO for reading in MEDReader, by not loading all. Mesh is fully loaded but not fields values ms=MEDFileMeshes(fname) ; ms.cartesianizeMe() @@ -915,7 +915,7 @@ class MEDLoaderTest4(unittest.TestCase): pass mm.write(fname,2) fs1.write(fname,0) ; fs2.write(fname,0) ; fs3.write(fname,0) - a0Exp=mm.getCoords().deepCpy() + a0Exp=mm.getCoords().deepCopy() del m,mm,fs1,fs2,fs3,f,fNode ########## GO for reading in MEDReader,by not loading all. Mesh is fully loaded but not fields values ms=MEDFileMeshes(fname) ; ms.cartesianizeMe() @@ -1041,7 +1041,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode=MEDCouplingFieldDouble(ON_CELLS) ; fNode.setTime(float(i),i,0) fNode.setName(fieldName0) ; fNode.setMesh(m) arr=DataArrayDouble(2*8) ; arr.iota(0+1000*i) ; arr.rearrange(2) - fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_0 [m]","Com2_0 [s^2]"]) ; fNode.checkCoherency() + fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_0 [m]","Com2_0 [s^2]"]) ; fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs0.pushBackTimeStep(f) # @@ -1076,7 +1076,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode=MEDCouplingFieldDouble(ON_NODES) ; fNode.setTime(float(i),i,0) fNode.setName(fieldName4) ; fNode.setMesh(m) arr=DataArrayDouble(2*15) ; arr.iota(400+1000*i) ; arr.rearrange(2) - fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_4 [m]","Com2_4 [s^2]"]) ; fNode.checkCoherency() + fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_4 [m]","Com2_4 [s^2]"]) ; fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs4.pushBackTimeStep(f) pass @@ -1250,7 +1250,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode=MEDCouplingFieldDouble(ON_CELLS) ; fNode.setTime(float(i),i,0) fNode.setName(fieldName0) ; fNode.setMesh(m) arr=DataArrayDouble(2*8) ; arr.iota(0+1000*i) ; arr.rearrange(2) - fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_0 [m]","Com2_0 [s^2]"]) ; fNode.checkCoherency() + fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_0 [m]","Com2_0 [s^2]"]) ; fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs0.pushBackTimeStep(f) # @@ -1285,7 +1285,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode=MEDCouplingFieldDouble(ON_NODES) ; fNode.setTime(float(i),i,0) fNode.setName(fieldName4) ; fNode.setMesh(m) arr=DataArrayDouble(2*15) ; arr.iota(400+1000*i) ; arr.rearrange(2) - fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_4 [m]","Com2_4 [s^2]"]) ; fNode.checkCoherency() + fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_4 [m]","Com2_4 [s^2]"]) ; fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs4.pushBackTimeStep(f) pass @@ -1453,7 +1453,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode=MEDCouplingFieldDouble(ON_GAUSS_NE) ; fNode.setTime(float(i),i,0) fNode.setName(fieldName0) ; fNode.setMesh(m) arr=DataArrayDouble(2*38) ; arr.iota(0+1000*i) ; arr.rearrange(2) - fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_0 [m]","Com2_0 [s^2]"]) ; fNode.checkCoherency() + fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_0 [m]","Com2_0 [s^2]"]) ; fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs0.pushBackTimeStep(f) # @@ -1461,7 +1461,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode=MEDCouplingFieldDouble(ON_CELLS) ; fNode.setTime(float(i),i,0) fNode.setName(fieldName1) ; fNode.setMesh(m) arr=DataArrayDouble(2*11) ; arr.iota(100+1000*i) ; arr.rearrange(2) - fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_1 [m]","Com2_1 [s^2]"]) ; fNode.checkCoherency() + fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_1 [m]","Com2_1 [s^2]"]) ; fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs1.pushBackTimeStep(f) # @@ -1473,7 +1473,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode.setGaussLocalizationOnCells([6,7,8],[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2],[0.8,0.05,0.1,0.04]) fNode.setGaussLocalizationOnCells([9,10],[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2,0.3,0.3,0.4,0.4,0.8,0.8],[0.8,0.05,0.1,0.01,0.02,0.005,0.005]) arr=DataArrayDouble(2*(4*2+2*5+3*4+2*7)) ; arr.iota(300+1000*i) ; arr.rearrange(2) - fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_2 [m]","Com2_2 [s^2]"]) ; fNode.checkCoherency() + fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_2 [m]","Com2_2 [s^2]"]) ; fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs2.pushBackTimeStep(f) # @@ -1481,7 +1481,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode=MEDCouplingFieldDouble(ON_NODES) ; fNode.setTime(float(i),i,0) fNode.setName(fieldName3) ; fNode.setMesh(m) arr=DataArrayDouble(2*15) ; arr.iota(400+1000*i) ; arr.rearrange(2) - fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_3 [m]","Com2_3 [s^2]"]) ; fNode.checkCoherency() + fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_3 [m]","Com2_3 [s^2]"]) ; fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs3.pushBackTimeStep(f) # @@ -1489,7 +1489,7 @@ class MEDLoaderTest4(unittest.TestCase): # mm.write(fname,2) fs0.write(fname,0) ; fs1.write(fname,0) ; fs2.write(fname,0) ; fs3.write(fname,0) - a0Exp=mm.getCoords().deepCpy() + a0Exp=mm.getCoords().deepCopy() del m,mm,fs1,fs2,fs3,f,fNode ########## GO for reading in MEDReader,by not loading all. Mesh is fully loaded but not fields values ms=MEDFileMeshes(fname) ; ms.cartesianizeMe() @@ -1621,7 +1621,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode.setGaussLocalizationOnCells([2,3],[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2],[0.8,0.05,0.1,0.04]) fNode.setGaussLocalizationOnCells([4],[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2,0.3,0.3,0.4,0.4,0.8,0.8],[0.8,0.05,0.1,0.01,0.02,0.005,0.005]) arr=DataArrayDouble(2*(2*1+5*1+4*2+7*1)) ; arr.iota(300+1000*i) ; arr.rearrange(2) - fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_2 [m]","Com2_2 [s^2]"]) ; fNode.checkCoherency() + fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_2 [m]","Com2_2 [s^2]"]) ; fNode.checkConsistencyLight() f.setFieldProfile(fNode,mm,0,pfl1) fs2.pushBackTimeStep(f) # @@ -1637,7 +1637,7 @@ class MEDLoaderTest4(unittest.TestCase): # mm.write(fname,2) fs0.write(fname,0) ; fs1.write(fname,0) ; fs2.write(fname,0) ; fs3.write(fname,0) - a0Exp=mm.getCoords().deepCpy() + a0Exp=mm.getCoords().deepCopy() del m,mm,fs1,fs2,fs3,f,fNode ########## GO for reading in MEDReader,by not loading all. Mesh is fully loaded but not fields values ms=MEDFileMeshes(fname) ; ms.cartesianizeMe() @@ -1770,7 +1770,7 @@ class MEDLoaderTest4(unittest.TestCase): # mm.write(fname,2) fs0.write(fname,0) ; fs1.write(fname,0) ; fs2.write(fname,0) - a0Exp=mm.getCoords().deepCpy() + a0Exp=mm.getCoords().deepCopy() del m,mm,fs1,fs2,f,fNode ########## GO for reading in MEDReader,by not loading all. Mesh is fully loaded but not fields values ms=MEDFileMeshes(fname) ; ms.cartesianizeMe() @@ -1867,13 +1867,13 @@ class MEDLoaderTest4(unittest.TestCase): fNode.setGaussLocalizationOnCells([6,10,13],[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2],[0.8,0.05,0.1,0.04]) fNode.setGaussLocalizationOnCells([11,12,14],[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2,0.3,0.3,0.4,0.4,0.8,0.8],[0.8,0.05,0.1,0.01,0.02,0.005,0.005]) arr=DataArrayDouble(2*(2*6+5*4+4*3+7*3)) ; arr.iota(0+1000*i) ; arr.rearrange(2) - fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_0 [m]","Com2_0 [s^2]"]) ; fNode.checkCoherency() + fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_0 [m]","Com2_0 [s^2]"]) ; fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs0.pushBackTimeStep(f) pass mm.write(fname,2) fs0.write(fname,0) - a0Exp=mm.getCoords().deepCpy() + a0Exp=mm.getCoords().deepCopy() del m,mm,fs0,f,fNode ########## GO for reading in MEDReader,by not loading all. Mesh is fully loaded but not fields values ms=MEDFileMeshes(fname) ; ms.cartesianizeMe() @@ -1954,7 +1954,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode.setGaussLocalizationOnCells([6,10,13],[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2],[0.8,0.05,0.1,0.04]) fNode.setGaussLocalizationOnCells([11,12,14],[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2,0.3,0.3,0.4,0.4,0.8,0.8],[0.8,0.05,0.1,0.01,0.02,0.005,0.005]) arr=DataArrayDouble(2*(2*6+5*4+4*3+7*3)) ; arr.iota(0+1000*i) ; arr.rearrange(2) - fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_0 [m]","Com2_0 [s^2]"]) ; fNode.checkCoherency() + fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_0 [m]","Com2_0 [s^2]"]) ; fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs0.pushBackTimeStep(f) # @@ -1962,13 +1962,13 @@ class MEDLoaderTest4(unittest.TestCase): fNode=MEDCouplingFieldDouble(ON_CELLS) ; fNode.setTime(float(i),i,0) fNode.setName(fieldName1) ; fNode.setMesh(m) arr=DataArrayDouble(2*16) ; arr.iota(300+1000*i) ; arr.rearrange(2) - fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_1 [m]","Com2_1 [s^2]"]) ; fNode.checkCoherency() + fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_1 [m]","Com2_1 [s^2]"]) ; fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs1.pushBackTimeStep(f) pass mm.write(fname,2) fs0.write(fname,0) ; fs1.write(fname,0) - a0Exp=mm.getCoords().deepCpy() + a0Exp=mm.getCoords().deepCopy() del m,mm,fs0,fs1,f,fNode ########## GO for reading in MEDReader,by not loading all. Mesh is fully loaded but not fields values ms=MEDFileMeshes(fname) ; ms.cartesianizeMe() @@ -2055,7 +2055,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode=MEDCouplingFieldDouble(ON_CELLS) ; fNode.setTime(float(i),i,0) fNode.setName(fieldName0) ; fNode.setMesh(m) arr=DataArrayDouble(2*5) ; arr.iota(0+1000*i) ; arr.rearrange(2) - fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_0 [m]","Com2_0 [s^2]"]) ; fNode.checkCoherency() + fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_0 [m]","Com2_0 [s^2]"]) ; fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs0.pushBackTimeStep(f) # @@ -2063,7 +2063,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode=MEDCouplingFieldDouble(ON_CELLS) ; fNode.setTime(float(i),i,0) fNode.setName(fieldName1) ; fNode.setMesh(m) arr=DataArrayDouble(2*5) ; arr.iota(100+1000*i) ; arr.rearrange(2) - fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_1 [m]","Com2_1 [s^2]"]) ; fNode.checkCoherency() + fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_1 [m]","Com2_1 [s^2]"]) ; fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs1.pushBackTimeStep(f) # @@ -2071,7 +2071,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode=MEDCouplingFieldDouble(ON_CELLS) ; fNode.setTime(float(i),i,0) fNode.setName(fieldName2) ; fNode.setMesh(m[pfl1]) arr=DataArrayDouble(2*2) ; arr.iota(200+1000*i) ; arr.rearrange(2) - fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_2 [m]","Com2_2 [s^2]"]) ; fNode.checkCoherency() + fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_2 [m]","Com2_2 [s^2]"]) ; fNode.checkConsistencyLight() f.setFieldProfile(fNode,mm,0,pfl1) fs2.pushBackTimeStep(f) # @@ -2079,13 +2079,13 @@ class MEDLoaderTest4(unittest.TestCase): fNode=MEDCouplingFieldDouble(ON_CELLS) ; fNode.setTime(float(i),i,0) fNode.setName(fieldName3) ; fNode.setMesh(m[pfl2]) arr=DataArrayDouble(2*3) ; arr.iota(300+1000*i) ; arr.rearrange(2) - fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_3 [m]","Com2_3 [s^2]"]) ; fNode.checkCoherency() + fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_3 [m]","Com2_3 [s^2]"]) ; fNode.checkConsistencyLight() f.setFieldProfile(fNode,mm,0,pfl2) fs3.pushBackTimeStep(f) pass mm.write(fname,2) fs0.write(fname,0) ; fs1.write(fname,0) ; fs2.write(fname,0) ; fs3.write(fname,0) - a0Exp=mm.getCoords().deepCpy() + a0Exp=mm.getCoords().deepCopy() del m,mm,fs0 ########## GO for reading in MEDReader,by not loading all. Mesh is fully loaded but not fields values ms=MEDFileMeshes(fname) ; ms.cartesianizeMe() @@ -2227,7 +2227,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode=MEDCouplingFieldDouble(ON_CELLS) ; fNode.setTime(float(i),i,0) fNode.setName(fieldName0) ; fNode.setMesh(m) arr=DataArrayDouble(2*3) ; arr.iota(0+1000*i) ; arr.rearrange(2) - fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_0 [m]","Com2_0 [s^2]"]) ; fNode.checkCoherency() + fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_0 [m]","Com2_0 [s^2]"]) ; fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs0.pushBackTimeStep(f) # @@ -2235,13 +2235,13 @@ class MEDLoaderTest4(unittest.TestCase): fNode=MEDCouplingFieldDouble(ON_CELLS) ; fNode.setTime(float(i),i,0) fNode.setName(fieldName1) ; fNode.setMesh(m) arr=DataArrayDouble(2*3) ; arr.iota(100+1000*i) ; arr.rearrange(2) - fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_1 [m]","Com2_1 [s^2]"]) ; fNode.checkCoherency() + fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_1 [m]","Com2_1 [s^2]"]) ; fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs1.pushBackTimeStep(f) pass mm.write(fname,2) fs0.write(fname,0) ; fs1.write(fname,0) - a0Exp=mm.getCoords().deepCpy() + a0Exp=mm.getCoords().deepCopy() del m,mm,fs0 ########## GO for reading in MEDReader,by not loading all. Mesh is fully loaded but not fields values ms=MEDFileMeshes(fname) ; ms.cartesianizeMe() @@ -2348,12 +2348,12 @@ class MEDLoaderTest4(unittest.TestCase): a=DataArrayDouble(m0.getNumberOfCells()) ; a.iota(off) ; a.setInfoOnComponents(["xx [m]"]) fCell.setArray(a) fCell.setTime(*t) - fCell.checkCoherency() + fCell.checkConsistencyLight() a=DataArrayDouble(m0.getNumberOfNodes()) ; a.iota(off) ; a.setInfoOnComponents(["xx [m]"]) a=a.negate() fNode.setArray(a) fNode.setTime(*t) - fNode.checkCoherency() + fNode.checkConsistencyLight() f1ts.setFieldNoProfileSBT(fCell) f1ts.setFieldNoProfileSBT(fNode) ffs.pushBackTimeStep(f1ts) @@ -2363,12 +2363,12 @@ class MEDLoaderTest4(unittest.TestCase): a=DataArrayDouble(m0.getNumberOfCells()) ; a.iota(off) ; a.setInfoOnComponents(["xx [m]"]) fCell.setArray(a) fCell.setTime(*t) - fCell.checkCoherency() + fCell.checkConsistencyLight() a=DataArrayDouble(m0.getNumberOfNodes()) ; a.iota(off) ; a.setInfoOnComponents(["xx [m]"]) a=a.negate() fNode.setArray(a) fNode.setTime(*t) - fNode.checkCoherency() + fNode.checkConsistencyLight() f1ts.setFieldNoProfileSBT(fCell) f1ts.setFieldNoProfileSBT(fNode) ffs.pushBackTimeStep(f1ts) @@ -2378,12 +2378,12 @@ class MEDLoaderTest4(unittest.TestCase): a=DataArrayDouble(m0.getNumberOfCells()) ; a.iota(off) ; a.setInfoOnComponents(["xx [m]"]) fCell.setArray(a) fCell.setTime(*t) - fCell.checkCoherency() + fCell.checkConsistencyLight() a=DataArrayDouble(m0.getNumberOfNodes()) ; a.iota(off) ; a.setInfoOnComponents(["xx [m]"]) a=a.negate() fNode.setArray(a) fNode.setTime(*t) - fNode.checkCoherency() + fNode.checkConsistencyLight() f1ts.setFieldNoProfileSBT(fCell) f1ts.setFieldNoProfileSBT(fNode) ffs.pushBackTimeStep(f1ts) @@ -2393,12 +2393,12 @@ class MEDLoaderTest4(unittest.TestCase): a=DataArrayDouble(m0.getNumberOfCells()) ; a.iota(off) ; a.setInfoOnComponents(["xx [m]"]) fCell.setArray(a) fCell.setTime(*t) - fCell.checkCoherency() + fCell.checkConsistencyLight() a=DataArrayDouble(m0.getNumberOfNodes()) ; a.iota(off) ; a.setInfoOnComponents(["xx [m]"]) a=a.negate() fNode.setArray(a) fNode.setTime(*t) - fNode.checkCoherency() + fNode.checkConsistencyLight() f1ts.setFieldNoProfileSBT(fCell) f1ts.setFieldNoProfileSBT(fNode) ffs.pushBackTimeStep(f1ts) @@ -2483,7 +2483,7 @@ class MEDLoaderTest4(unittest.TestCase): mm1.setFamiliesIdsOnGroup("Grp1_1",[0,1]) ; mm1.setFamiliesIdsOnGroup("Grp1_2",[2,3]) mms.pushMesh(mm1) ; del mm1 # - m1=m0.deepCpy() ; m1.translate([2.5,0.,0.]) ; m1.setName("mesh2") + m1=m0.deepCopy() ; m1.translate([2.5,0.,0.]) ; m1.setName("mesh2") # fCell2=MEDCouplingFieldDouble(ON_CELLS) fCell2.setName("zeField3_1") @@ -2515,12 +2515,12 @@ class MEDLoaderTest4(unittest.TestCase): a=DataArrayDouble(m0.getNumberOfCells()) ; a.iota(off) ; a.setInfoOnComponents(["xx [m]"]) fCell1.setArray(a) fCell1.setTime(*t) - fCell1.checkCoherency() + fCell1.checkConsistencyLight() a=DataArrayDouble(m0.getNumberOfNodes()) ; a.iota(off) ; a.setInfoOnComponents(["xx [m]"]) a=a.negate() fNode1.setArray(a) fNode1.setTime(*t) - fNode1.checkCoherency() + fNode1.checkConsistencyLight() f1ts1.setFieldNoProfileSBT(fCell1) ; ffs1_1.pushBackTimeStep(f1ts1) f1ts2.setFieldNoProfileSBT(fNode1) ; ffs1_2.pushBackTimeStep(f1ts2) # @@ -2529,12 +2529,12 @@ class MEDLoaderTest4(unittest.TestCase): a=DataArrayDouble(m1.getNumberOfCells()) ; a.iota(1000.+off) ; a.setInfoOnComponents(["xx [m]"]) fCell2.setArray(a) fCell2.setTime(*t) - fCell2.checkCoherency() + fCell2.checkConsistencyLight() a=DataArrayDouble(m1.getNumberOfNodes()) ; a.iota(1000+off) ; a.setInfoOnComponents(["xx [m]"]) a=a.negate() fNode2.setArray(a) fNode2.setTime(*t) - fNode2.checkCoherency() + fNode2.checkConsistencyLight() f1ts1.setFieldNoProfileSBT(fCell2) ; ffs2_1.pushBackTimeStep(f1ts1) f1ts2.setFieldNoProfileSBT(fNode2) ; ffs2_2.pushBackTimeStep(f1ts2) # TimeStep 1 @@ -2544,12 +2544,12 @@ class MEDLoaderTest4(unittest.TestCase): a=DataArrayDouble(m0.getNumberOfCells()) ; a.iota(off) ; a.setInfoOnComponents(["xx [m]"]) fCell1.setArray(a) fCell1.setTime(*t) - fCell1.checkCoherency() + fCell1.checkConsistencyLight() a=DataArrayDouble(m0.getNumberOfNodes()) ; a.iota(off) ; a.setInfoOnComponents(["xx [m]"]) a=a.negate() fNode1.setArray(a) fNode1.setTime(*t) - fNode1.checkCoherency() + fNode1.checkConsistencyLight() f1ts1.setFieldNoProfileSBT(fCell1) ; ffs1_1.pushBackTimeStep(f1ts1) f1ts2.setFieldNoProfileSBT(fNode1) ; ffs1_2.pushBackTimeStep(f1ts2) # @@ -2558,12 +2558,12 @@ class MEDLoaderTest4(unittest.TestCase): a=DataArrayDouble(m1.getNumberOfCells()) ; a.iota(1000.+off) ; a.setInfoOnComponents(["xx [m]"]) fCell2.setArray(a) fCell2.setTime(*t) - fCell2.checkCoherency() + fCell2.checkConsistencyLight() a=DataArrayDouble(m1.getNumberOfNodes()) ; a.iota(1000+off) ; a.setInfoOnComponents(["xx [m]"]) a=a.negate() fNode2.setArray(a) fNode2.setTime(*t) - fNode2.checkCoherency() + fNode2.checkConsistencyLight() f1ts1.setFieldNoProfileSBT(fCell2) ; ffs2_1.pushBackTimeStep(f1ts1) f1ts2.setFieldNoProfileSBT(fNode2) ; ffs2_2.pushBackTimeStep(f1ts2) # TimeStep 2 @@ -2573,12 +2573,12 @@ class MEDLoaderTest4(unittest.TestCase): a=DataArrayDouble(m0.getNumberOfCells()) ; a.iota(off) ; a.setInfoOnComponents(["xx [m]"]) fCell1.setArray(a) fCell1.setTime(*t) - fCell1.checkCoherency() + fCell1.checkConsistencyLight() a=DataArrayDouble(m0.getNumberOfNodes()) ; a.iota(off) ; a.setInfoOnComponents(["xx [m]"]) a=a.negate() fNode1.setArray(a) fNode1.setTime(*t) - fNode1.checkCoherency() + fNode1.checkConsistencyLight() f1ts1.setFieldNoProfileSBT(fCell1) ; ffs1_1.pushBackTimeStep(f1ts1) f1ts2.setFieldNoProfileSBT(fNode1) ; ffs1_2.pushBackTimeStep(f1ts2) # @@ -2587,12 +2587,12 @@ class MEDLoaderTest4(unittest.TestCase): a=DataArrayDouble(m1.getNumberOfCells()) ; a.iota(1000.+off) ; a.setInfoOnComponents(["xx [m]"]) fCell2.setArray(a) fCell2.setTime(*t) - fCell2.checkCoherency() + fCell2.checkConsistencyLight() a=DataArrayDouble(m1.getNumberOfNodes()) ; a.iota(1000+off) ; a.setInfoOnComponents(["xx [m]"]) a=a.negate() fNode2.setArray(a) fNode2.setTime(*t) - fNode2.checkCoherency() + fNode2.checkConsistencyLight() f1ts1.setFieldNoProfileSBT(fCell2) ; ffs2_1.pushBackTimeStep(f1ts1) f1ts2.setFieldNoProfileSBT(fNode2) ; ffs2_2.pushBackTimeStep(f1ts2) # @@ -2642,13 +2642,13 @@ class MEDLoaderTest4(unittest.TestCase): m.allocateCells() m.insertNextCell(NORM_QUAD4,[0,3,4,1]) m.insertNextCell(NORM_QUAD4,[1,4,5,2]) - m.checkCoherency1() + m.checkConsistency() # t=(1.1,0,-1) f=MEDCouplingFieldDouble(ON_GAUSS_NE) ; f.setTime(*t) ; f.setMesh(m) f.setArray(DataArrayDouble([3.,5.,7.,6.,2.,3.,11.,8.])) f.setName(fieldName1) - f.checkCoherency() + f.checkConsistencyLight() WriteField(fname,f,True) f2=MEDCouplingFieldDouble(ON_CELLS) ; f2.setTime(*t) ; f2.setMesh(m) f2.setArray(DataArrayDouble([7.,11.],2,1)) @@ -2663,7 +2663,7 @@ class MEDLoaderTest4(unittest.TestCase): f=MEDCouplingFieldDouble(ON_GAUSS_NE) ; f.setTime(*t) ; f.setMesh(m) f.setArray(DataArrayDouble([7.,6.,3.,5.,11.,8.,2.,3.])) f.setName(fieldName1) - f.checkCoherency() + f.checkConsistencyLight() WriteFieldUsingAlreadyWrittenMesh(fname,f) f2=MEDCouplingFieldDouble(ON_CELLS) ; f2.setTime(*t) ; f2.setMesh(m) f2.setArray(DataArrayDouble([11.,7.],2,1)) @@ -2756,14 +2756,14 @@ class MEDLoaderTest4(unittest.TestCase): m.allocateCells() m.insertNextCell(NORM_QUAD4,[0,3,4,1]) m.insertNextCell(NORM_QUAD4,[1,4,5,2]) - m.checkCoherency1() + m.checkConsistency() # t=(1.1,0,-1) f=MEDCouplingFieldDouble(ON_GAUSS_PT) ; f.setTime(*t) ; f.setMesh(m) f.setGaussLocalizationOnType(NORM_QUAD4,[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[0.2,0.2,0.8,0.8],[0.7,0.3]) f.setArray(DataArrayDouble([3.,5.,4.,6.])) ; f.getArray().setInfoOnComponents(["Smth"]) f.setName(fieldName1) - f.checkCoherency() + f.checkConsistencyLight() WriteField(fname,f,True) f2=MEDCouplingFieldDouble(ON_CELLS) ; f2.setTime(*t) ; f2.setMesh(m) f2.setArray(DataArrayDouble([7.,11.],2,1)) @@ -2779,7 +2779,7 @@ class MEDLoaderTest4(unittest.TestCase): f.setGaussLocalizationOnType(NORM_QUAD4,[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[0.2,0.2,0.8,0.8],[0.7,0.3]) f.setArray(DataArrayDouble([5.,3.,6.,4.])) ; f.getArray().setInfoOnComponents(["Smth"]) f.setName(fieldName1) - f.checkCoherency() + f.checkConsistencyLight() WriteFieldUsingAlreadyWrittenMesh(fname,f) f2=MEDCouplingFieldDouble(ON_CELLS) ; f2.setTime(*t) ; f2.setMesh(m) f2.setArray(DataArrayDouble([11.,7.],2,1)) @@ -2948,7 +2948,7 @@ class MEDLoaderTest4(unittest.TestCase): f.setName(fieldName) arr=DataArrayDouble(24) ; arr.iota() ; arr.setInfoOnComponents(["AStr"]) f.setArray(arr) - f.checkCoherency() + f.checkConsistencyLight() f1ts=MEDFileField1TS() ; f1ts.setFieldNoProfileSBT(f) ff.pushBackTimeStep(f1ts) # time 1 @@ -2957,7 +2957,7 @@ class MEDLoaderTest4(unittest.TestCase): f.setName(fieldName) arr=DataArrayDouble(24) ; arr.iota() ; arr.reverse() ; arr.setInfoOnComponents(["AStr"]) f.setArray(arr) - f.checkCoherency() + f.checkConsistencyLight() f1ts=MEDFileField1TS() ; f1ts.setFieldNoProfileSBT(f) ff.pushBackTimeStep(f1ts) # @@ -3066,16 +3066,16 @@ class MEDLoaderTest4(unittest.TestCase): f0.setName(fieldName0) ; f0.setTime(*t) da=m.getCoords().magnitude() ; da.setInfoOnComponents(["zeInfo"]) f0.setArray(da) - f0.checkCoherency() + f0.checkConsistencyLight() f1ts=MEDFileField1TS() f1ts.setFieldNoProfileSBT(f0) fmts0.pushBackTimeStep(f1ts) # f1=MEDCouplingFieldDouble(ON_CELLS) ; f1.setMesh(m) f1.setName(fieldName1) ; f1.setTime(*t) - da=m.getBarycenterAndOwner().magnitude() ; da.setInfoOnComponents(["zeInfoCell"]) + da=m.computeCellCenterOfMass().magnitude() ; da.setInfoOnComponents(["zeInfoCell"]) f1.setArray(da) - f1.checkCoherency() + f1.checkConsistencyLight() f1ts=MEDFileField1TS() f1ts.setFieldNoProfileSBT(f1) fmts1.pushBackTimeStep(f1ts) @@ -3084,16 +3084,16 @@ class MEDLoaderTest4(unittest.TestCase): f2.setName(fieldName2) ; f2.setTime(*t) da=m.getCoords().magnitude()[pfl2] ; da.setInfoOnComponents(["zzzz"]) f2.setArray(da) - f2.checkCoherency() + f2.checkConsistencyLight() f1ts=MEDFileField1TS() f1ts.setFieldProfile(f2,mm,0,pfl2) fmts2.pushBackTimeStep(f1ts) # f3=MEDCouplingFieldDouble(ON_CELLS) ; mTmp=m[pfl3] ; mTmp.setName(m.getName()) ; f3.setMesh(mTmp) f3.setName(fieldName3) ; f3.setTime(*t) - da=mTmp.getBarycenterAndOwner().magnitude() ; da.setInfoOnComponents(["abcdefg"]) + da=mTmp.computeCellCenterOfMass().magnitude() ; da.setInfoOnComponents(["abcdefg"]) f3.setArray(da) - f3.checkCoherency() + f3.checkConsistencyLight() f1ts=MEDFileField1TS() f1ts.setFieldProfile(f3,mm,0,pfl3) fmts3.pushBackTimeStep(f1ts) @@ -3103,16 +3103,16 @@ class MEDLoaderTest4(unittest.TestCase): f0.setName(fieldName0) ; f0.setTime(*t) da=m.getCoords().magnitude() ; da.reverse() ; da.setInfoOnComponents(["zeInfo"]) f0.setArray(da) - f0.checkCoherency() + f0.checkConsistencyLight() f1ts=MEDFileField1TS() f1ts.setFieldNoProfileSBT(f0) fmts0.pushBackTimeStep(f1ts) # f1=MEDCouplingFieldDouble(ON_CELLS) ; f1.setMesh(m) f1.setName(fieldName1) ; f1.setTime(*t) - da=m.getBarycenterAndOwner().magnitude() ; da.reverse() ; da.setInfoOnComponents(["zeInfoCell"]) + da=m.computeCellCenterOfMass().magnitude() ; da.reverse() ; da.setInfoOnComponents(["zeInfoCell"]) f1.setArray(da) - f1.checkCoherency() + f1.checkConsistencyLight() f1ts=MEDFileField1TS() f1ts.setFieldNoProfileSBT(f1) fmts1.pushBackTimeStep(f1ts) @@ -3121,16 +3121,16 @@ class MEDLoaderTest4(unittest.TestCase): f2.setName(fieldName2) ; f2.setTime(*t) da=m.getCoords().magnitude()[pfl2] ; da.reverse() ; da.setInfoOnComponents(["zzzz"]) f2.setArray(da) - f2.checkCoherency() + f2.checkConsistencyLight() f1ts=MEDFileField1TS() f1ts.setFieldProfile(f2,mm,0,pfl2) fmts2.pushBackTimeStep(f1ts) # f3=MEDCouplingFieldDouble(ON_CELLS) ; mTmp=m[pfl3] ; mTmp.setName(m.getName()) ; f3.setMesh(mTmp) f3.setName(fieldName3) ; f3.setTime(*t) - da=mTmp.getBarycenterAndOwner().magnitude() ; da.reverse() ; da.setInfoOnComponents(["abcdefg"]) + da=mTmp.computeCellCenterOfMass().magnitude() ; da.reverse() ; da.setInfoOnComponents(["abcdefg"]) f3.setArray(da) - f3.checkCoherency() + f3.checkConsistencyLight() f1ts=MEDFileField1TS() f1ts.setFieldProfile(f3,mm,0,pfl3) fmts3.pushBackTimeStep(f1ts) @@ -3331,7 +3331,7 @@ class MEDLoaderTest4(unittest.TestCase): f0.setName(fieldName0) ; f0.setTime(*t) da=DataArrayDouble(9) ; da.iota() ; da.setInfoOnComponents(["zeInfo"]) f0.setArray(da) - f0.checkCoherency() + f0.checkConsistencyLight() f1ts=MEDFileField1TS() f1ts.setFieldNoProfileSBT(f0) fmts0.pushBackTimeStep(f1ts) @@ -3341,7 +3341,7 @@ class MEDLoaderTest4(unittest.TestCase): f0.setName(fieldName0) ; f0.setTime(*t) da=DataArrayDouble(9) ; da.iota() ; da.reverse() ; da.setInfoOnComponents(["zeInfo"]) f0.setArray(da) - f0.checkCoherency() + f0.checkConsistencyLight() f1ts=MEDFileField1TS() f1ts.setFieldNoProfileSBT(f0) fmts0.pushBackTimeStep(f1ts) @@ -3444,7 +3444,7 @@ class MEDLoaderTest4(unittest.TestCase): f0.setName(fieldName0) ; f0.setTime(*t) da=DataArrayDouble(4) ; da.iota() ; da.setInfoOnComponents(["zeInfo"]) f0.setArray(da) - f0.checkCoherency() + f0.checkConsistencyLight() f1ts=MEDFileField1TS() f1ts.setFieldProfile(f0,mm,-1,pfl) fmts0.pushBackTimeStep(f1ts) @@ -3454,7 +3454,7 @@ class MEDLoaderTest4(unittest.TestCase): f0.setName(fieldName0) ; f0.setTime(*t) da=DataArrayDouble(4) ; da.iota() ; da.reverse() ; da.setInfoOnComponents(["zeInfo"]) f0.setArray(da) - f0.checkCoherency() + f0.checkConsistencyLight() f1ts=MEDFileField1TS() f1ts.setFieldProfile(f0,mm,-1,pfl) fmts0.pushBackTimeStep(f1ts) @@ -3667,7 +3667,7 @@ class MEDLoaderTest4(unittest.TestCase): pfl1=DataArrayInt([1,3,5]) ; pfl1.setName(pflName1) tmp=m0[pfl1] ; f2.setMesh(tmp) f2.setGaussLocalizationOnType(NORM_QUAD4,[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[-0.5,-0.5,0.5,-0.5,0.5,0.5,-0.5,0.5,0.,0.],[0.1,0.1,0.1,0.1,0.6]) - f2.checkCoherency() + f2.checkConsistencyLight() f1ts.setFieldProfile(f2,m,0,pfl1) fmts.pushBackTimeStep(f1ts) # @@ -3981,7 +3981,7 @@ class MEDLoaderTest4(unittest.TestCase): f0=MEDCouplingFieldDouble(ON_NODES) ; f0.setMesh(m0) ; f0.setName("f0NoPfl") arr0=DataArrayDouble([0.,1.,2.,3.,1.,1.5,2.2,3.1,2.,2.2,3.,3.1,3.,3.1,3.5,4.]) f0.setArray(arr0) - f0.checkCoherency() + f0.checkConsistencyLight() f1ts0.setFieldNoProfileSBT(f0) self.assertEqual(f1ts0.getMeshName(),"mesh") # @@ -4705,7 +4705,7 @@ class MEDLoaderTest4(unittest.TestCase): fCell0.setName(fieldName) ; fCell0.setMesh(m) arr=DataArrayDouble(m.getNumberOfCells()) ; arr.iota(0) ; arr[i%10]=100. fCell0.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]"]) - fCell0.checkCoherency() + fCell0.checkConsistencyLight() WriteFieldUsingAlreadyWrittenMesh(fname,fCell0) pass ########## GO for reading in MEDReader,by not loading all. Mesh is fully loaded but not fields values @@ -4784,7 +4784,7 @@ class MEDLoaderTest4(unittest.TestCase): fNode.setGaussLocalizationOnCells([6,10,13],[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2],[0.8,0.05,0.1,0.04]) fNode.setGaussLocalizationOnCells([11,12,14],[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2,0.3,0.3,0.4,0.4,0.8,0.8],[0.8,0.05,0.1,0.01,0.02,0.005,0.005]) arr=DataArrayDouble(2*(2*6+5*4+4*3+7*3)) ; arr.iota(0+1000*i) ; arr.rearrange(2) - fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_0 [m]","Com2_0 [s^2]"]) ; fNode.checkCoherency() + fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_0 [m]","Com2_0 [s^2]"]) ; fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs0.pushBackTimeStep(f) # @@ -4792,13 +4792,13 @@ class MEDLoaderTest4(unittest.TestCase): fNode=MEDCouplingFieldDouble(ON_CELLS) ; fNode.setTime(float(i),i,0) fNode.setName(fieldName1) ; fNode.setMesh(m) arr=DataArrayDouble(2*16) ; arr.iota(300+1000*i) ; arr.rearrange(2) - fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_1 [m]","Com2_1 [s^2]"]) ; fNode.checkCoherency() + fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_1 [m]","Com2_1 [s^2]"]) ; fNode.checkConsistencyLight() f.setFieldNoProfileSBT(fNode) fs1.pushBackTimeStep(f) pass mm.write(fname,2) fs0.write(fname,0) ; fs1.write(fname,0) - a0Exp=mm.getCoords().deepCpy() + a0Exp=mm.getCoords().deepCopy() del m,mm,fs0,fs1,f,fNode ########## GO for reading in MEDReader,by not loading all. Mesh is fully loaded but not fields values ms=MEDFileMeshes(fname) ; ms.cartesianizeMe() @@ -5000,7 +5000,7 @@ class MEDLoaderTest4(unittest.TestCase): arr=DataArrayDouble(7) ; arr.iota(2000) f1.setArray(arr) f1.setName("bbb") - f1.checkCoherency() + f1.checkConsistencyLight() f1.setTime(*zeTime) ff1.setFieldNoProfileSBT(f1) # @@ -5009,7 +5009,7 @@ class MEDLoaderTest4(unittest.TestCase): arr=DataArrayDouble(9) ; arr.iota(4000) f2.setArray(arr) f2.setName("ddd") - f2.checkCoherency() + f2.checkConsistencyLight() f2.setTime(*zeTime) ff2.setFieldNoProfileSBT(f2) # @@ -5018,18 +5018,18 @@ class MEDLoaderTest4(unittest.TestCase): f3.setGaussLocalizationOnType(NORM_TRI3,[0,0,1,0,0,1],[0.333333,0.333333],[0.5]) arr=DataArrayDouble(3) ; arr.iota(1000) f3.setArray(arr) - f3.checkCoherency() + f3.checkConsistencyLight() f3.setTime(*zeTime) f3.setName("aaa") ff3.setFieldNoProfileSBT(f3) # ff4=MEDFileField1TS() - m0d=m0.deepCpy() ; m0d.zipCoords() + m0d=m0.deepCopy() ; m0d.zipCoords() f4=MEDCouplingFieldDouble(ON_NODES) ; f4.setMesh(m0d) arr=DataArrayDouble(5) ; arr.iota(3000) f4.setArray(arr) f4.setName("ccc") - f4.checkCoherency() + f4.checkConsistencyLight() f4.setTime(*zeTime) pfl=DataArrayInt([0,1,2,3,4]) ; pfl.setName("PFL") ff4.setFieldProfile(f4,mm,0,pfl) @@ -5126,9 +5126,9 @@ class MEDLoaderTest4(unittest.TestCase): arrZ=DataArrayDouble(5) ; arrZ.iota() ; arrZ*=1.6 ; arrZ-=8. ; arrZ.setInfoOnComponent(0,comps[2]) m=MEDCouplingCMesh() ; m.setCoords(arrX,arrY,arrZ) ; m.setName(meshName) mm=MEDFileCMesh() ; mm.setMesh(m) ; mm.setDescription(description) - mm.setAxType(AX_CYL) # the test is here ! + mm.setAxisType(AX_CYL) # the test is here ! f=MEDCouplingFieldDouble(ON_CELLS) ; f.setMesh(m) ; f.setName("Field") - arr=DataArrayDouble(m.getNumberOfCells()) ; arr.iota() ; arr*=0.1 ; f.setArray(arr) ; f.checkCoherency() + arr=DataArrayDouble(m.getNumberOfCells()) ; arr.iota() ; arr*=0.1 ; f.setArray(arr) ; f.checkConsistencyLight() ff=MEDFileField1TS() ; ff.setFieldNoProfileSBT(f) fmts=MEDFileFieldMultiTS() ; fmts.pushBackTimeStep(ff) # @@ -5195,9 +5195,9 @@ class MEDLoaderTest4(unittest.TestCase): arrZ=DataArrayDouble(5) ; arrZ.iota() ; arrZ*=2*pi/(len(arrZ)-1) ; arrZ.setInfoOnComponent(0,comps[2]) m=MEDCouplingCMesh() ; m.setCoords(arrX,arrY,arrZ) ; m.setName(meshName) mm=MEDFileCMesh() ; mm.setMesh(m) ; mm.setDescription(description) - mm.setAxType(AX_SPHER) # the test is here ! + mm.setAxisType(AX_SPHER) # the test is here ! f=MEDCouplingFieldDouble(ON_CELLS) ; f.setMesh(m) ; f.setName("Field") - arr=DataArrayDouble(m.getNumberOfCells()) ; arr.iota() ; arr*=0.1 ; f.setArray(arr) ; f.checkCoherency() + arr=DataArrayDouble(m.getNumberOfCells()) ; arr.iota() ; arr*=0.1 ; f.setArray(arr) ; f.checkConsistencyLight() ff=MEDFileField1TS() ; ff.setFieldNoProfileSBT(f) fmts=MEDFileFieldMultiTS() ; fmts.pushBackTimeStep(ff) # @@ -5264,9 +5264,9 @@ class MEDLoaderTest4(unittest.TestCase): arrZ=DataArrayDouble(5) ; arrZ.iota() ; arrZ*=2*pi/(len(arrZ)-1) ; arrZ.setInfoOnComponent(0,comps[2]) m=MEDCouplingCMesh() ; m.setCoords(arrX,arrY,arrZ) ; m.setName(meshName) ; m=m.buildUnstructured() mm=MEDFileUMesh() ; mm[0]=m ; mm.setDescription(description) # the test is here : UMesh ! - mm.setAxType(AX_SPHER) # the test is here ! + mm.setAxisType(AX_SPHER) # the test is here ! f=MEDCouplingFieldDouble(ON_CELLS) ; f.setMesh(m) ; f.setName("Field") - arr=DataArrayDouble(m.getNumberOfCells()) ; arr.iota() ; arr*=0.1 ; f.setArray(arr) ; f.checkCoherency() + arr=DataArrayDouble(m.getNumberOfCells()) ; arr.iota() ; arr*=0.1 ; f.setArray(arr) ; f.checkConsistencyLight() ff=MEDFileField1TS() ; ff.setFieldNoProfileSBT(f) fmts=MEDFileFieldMultiTS() ; fmts.pushBackTimeStep(ff) # @@ -5332,9 +5332,9 @@ class MEDLoaderTest4(unittest.TestCase): arrZ=DataArrayDouble(5) ; arrZ.iota() ; arrZ*=2*pi/(len(arrZ)-1) ; arrZ.setInfoOnComponent(0,comps[2]) m=MEDCouplingCMesh() ; m.setCoords(arrX,arrY,arrZ) ; m.setName(meshName) ; m=m.buildCurveLinear() mm=MEDFileCurveLinearMesh() ; mm.setMesh(m) ; mm.setDescription(description) # the test is here CLMesh! - mm.setAxType(AX_SPHER) # the test is here ! + mm.setAxisType(AX_SPHER) # the test is here ! f=MEDCouplingFieldDouble(ON_CELLS) ; f.setMesh(m) ; f.setName("Field") - arr=DataArrayDouble(m.getNumberOfCells()) ; arr.iota() ; arr*=0.1 ; f.setArray(arr) ; f.checkCoherency() + arr=DataArrayDouble(m.getNumberOfCells()) ; arr.iota() ; arr*=0.1 ; f.setArray(arr) ; f.checkConsistencyLight() ff=MEDFileField1TS() ; ff.setFieldNoProfileSBT(f) fmts=MEDFileFieldMultiTS() ; fmts.pushBackTimeStep(ff) # diff --git a/src/MEDLoader/Swig/SauvLoaderTest.py b/src/MEDLoader/Swig/SauvLoaderTest.py index 259af09a1..928996345 100644 --- a/src/MEDLoader/Swig/SauvLoaderTest.py +++ b/src/MEDLoader/Swig/SauvLoaderTest.py @@ -290,7 +290,7 @@ class SauvLoaderTest(unittest.TestCase): wgt=[0.3,0.3,0.3,0.3,0.4,0.4,0.4,0.4,0.7] f.setGaussLocalizationOnType(NORM_QUAD8,refCoo,gpCoo,wgt) f.setName("SIGT") - f.checkCoherency() + f.checkConsistencyLight() # mm=MEDFileUMesh() mm.setMeshAtLevel(0,m) diff --git a/src/MEDLoader/Swig/VTKReader.py b/src/MEDLoader/Swig/VTKReader.py index b54174459..23933de82 100644 --- a/src/MEDLoader/Swig/VTKReader.py +++ b/src/MEDLoader/Swig/VTKReader.py @@ -162,9 +162,9 @@ class VTURawReader: offsets=np.memmap(fd,dtype=rd._type_off,mode='r',offset=ref+rd._off_off,shape=(rd._nb_cells,)) offsets=self.__swapIfNecessary(rd._bo,offsets) ; connLgth=offsets[-1] ; offsets2=DataArrayInt(rd._nb_cells+1) ; offsets2.setIJ(0,0,0) offsets2[1:]=DataArrayInt(offsets) - offsets3=offsets2.deltaShiftIndex() ; offsets2=offsets3.deepCpy() ; offsets3+=1 ; offsets3.computeOffsets2() + offsets3=offsets2.deltaShiftIndex() ; offsets2=offsets3.deepCopy() ; offsets3+=1 ; offsets3.computeOffsetsFull() offsets=offsets3 - tmp1=DataArrayInt(len(offsets2),2) ; tmp1[:,0]=1 ; tmp1[:,1]=offsets2 ; tmp1.rearrange(1) ; tmp1.computeOffsets2() + tmp1=DataArrayInt(len(offsets2),2) ; tmp1[:,0]=1 ; tmp1[:,1]=offsets2 ; tmp1.rearrange(1) ; tmp1.computeOffsetsFull() tmp1=DataArrayInt.Range(1,2*len(offsets2),2).buildExplicitArrByRanges(tmp1) conn=np.memmap(fd,dtype=rd._type_conn,mode='r',offset=ref+rd._off_conn,shape=(connLgth,)) conn=self.__swapIfNecessary(rd._bo,conn) @@ -173,7 +173,7 @@ class VTURawReader: conn2[offsets[0:-1]]=types conn2[tmp1]=DataArrayInt(conn) m.setConnectivity(conn2,offsets,True) - m.checkCoherency() ; mm=MEDFileUMesh() ; mm.setMeshAtLevel(0,m) ; ms.pushMesh(mm) + m.checkConsistencyLight() ; mm=MEDFileUMesh() ; mm.setMeshAtLevel(0,m) ; ms.pushMesh(mm) # Fields on nodes and on cells for spatialDisc,nbEnt,fields in [(ON_NODES,rd._nb_nodes,rd._node_fields),(ON_CELLS,rd._nb_cells,rd._cell_fields)]: for name,typ,nbCompo,off in fields: @@ -183,7 +183,7 @@ class VTURawReader: vals=np.memmap(fd,dtype=typ,mode='r',offset=ref+off,shape=(nbEnt*nbCompo)) vals=self.__swapIfNecessary(rd._bo,vals) arr=DataArrayDouble(np.array(vals,dtype='float64')) ; arr.rearrange(nbCompo) - f.setArray(arr) ; f.checkCoherency() + f.setArray(arr) ; f.checkConsistencyLight() f.setTime(self._time[0],self._time[1],0) ff.appendFieldNoProfileSBT(f) fs.pushField(ff) diff --git a/src/MEDLoader/Test/MEDLoaderTest.cxx b/src/MEDLoader/Test/MEDLoaderTest.cxx index 849fc2977..6128f95c4 100644 --- a/src/MEDLoader/Test/MEDLoaderTest.cxx +++ b/src/MEDLoader/Test/MEDLoaderTest.cxx @@ -34,7 +34,7 @@ using namespace MEDCoupling; void MEDLoaderTest::testMesh1DRW() { MEDCouplingUMesh *mesh=build1DMesh_1(); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); WriteUMesh("file1.med",mesh,true); MEDCouplingUMesh *mesh_rw=ReadUMeshFromFile("file1.med",mesh->getName().c_str(),0); CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12)); @@ -45,7 +45,7 @@ void MEDLoaderTest::testMesh1DRW() void MEDLoaderTest::testMesh2DCurveRW() { MEDCouplingUMesh *mesh=build2DCurveMesh_1(); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); WriteUMesh("file2.med",mesh,true); MEDCouplingUMesh *mesh_rw=ReadUMeshFromFile("file2.med",mesh->getName().c_str(),0); CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12)); @@ -56,7 +56,7 @@ void MEDLoaderTest::testMesh2DCurveRW() void MEDLoaderTest::testMesh2DRW() { MEDCouplingUMesh *mesh=build2DMesh_1(); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); WriteUMesh("file3.med",mesh,true); MEDCouplingUMesh *mesh_rw=ReadUMeshFromFile("file3.med",mesh->getName().c_str(),0); CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12)); @@ -67,7 +67,7 @@ void MEDLoaderTest::testMesh2DRW() void MEDLoaderTest::testMesh3DSurfRW() { MEDCouplingUMesh *mesh=build3DSurfMesh_1(); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); WriteUMesh("file4.med",mesh,true); MEDCouplingUMesh *mesh_rw=ReadUMeshFromFile("file4.med",mesh->getName().c_str(),0); CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12)); @@ -78,7 +78,7 @@ void MEDLoaderTest::testMesh3DSurfRW() void MEDLoaderTest::testMesh3DRW() { MEDCouplingUMesh *mesh=build3DMesh_1(); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); WriteUMesh("file5.med",mesh,true); MEDCouplingUMesh *mesh_rw=ReadUMeshFromFile("file5.med",mesh->getName().c_str(),0); CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12)); @@ -373,7 +373,7 @@ void MEDLoaderTest::testFieldProfilRW1() const double arr1[10]={71.,171.,10.,110.,20.,120.,30.,130.,40.,140.}; std::copy(arr1,arr1+10,tmp); f1->setTime(3.14,2,7); - f1->checkCoherency(); + f1->checkConsistencyLight(); // WriteField(fileName,f1,false);//<- false important for the test // @@ -381,7 +381,7 @@ void MEDLoaderTest::testFieldProfilRW1() std::vector types=GetTypesOfField(fileName,f1->getMesh()->getName().c_str(),f1->getName().c_str()); CPPUNIT_ASSERT_EQUAL(1,(int)types.size()); CPPUNIT_ASSERT(types[0]==ON_CELLS); - f2->checkCoherency(); + f2->checkConsistencyLight(); CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12)); // f2->decrRef(); @@ -412,14 +412,14 @@ void MEDLoaderTest::testFieldNodeProfilRW1() array->setInfoOnComponent(1,"uiop [MW]"); array->decrRef(); f1->setTime(3.14,2,7); - f1->checkCoherency(); + f1->checkConsistencyLight(); const int arr2[2]={1,4};//node ids are 2,4,5,3,6,7 MEDCouplingFieldDouble *f2=f1->buildSubPart(arr2,arr2+2); (const_cast(f2->getMesh()))->setName(f1->getMesh()->getName().c_str()); WriteField(fileName,f2,false);//<- false important for the test // MEDCouplingFieldDouble *f3=ReadFieldNode(fileName,f2->getMesh()->getName().c_str(),0,f2->getName().c_str(),2,7); - f3->checkCoherency(); + f3->checkConsistencyLight(); CPPUNIT_ASSERT(f3->isEqual(f2,1e-12,1e-12)); f3->decrRef(); // @@ -428,7 +428,7 @@ void MEDLoaderTest::testFieldNodeProfilRW1() WriteUMesh(fileName2,m,true); WriteField(fileName2,f2,false);//<- false important for the test f3=ReadFieldNode(fileName2,f2->getMesh()->getName().c_str(),0,f2->getName().c_str(),2,7); - f3->checkCoherency(); + f3->checkConsistencyLight(); CPPUNIT_ASSERT(f3->isEqual(f2,1e-12,1e-12)); f3->decrRef(); f2->decrRef(); @@ -462,7 +462,7 @@ void MEDLoaderTest::testFieldNodeProfilRW2() // const int renumArr[12]={3,7,2,1,5,11,10,0,9,6,8,4}; f1->renumberNodes(renumArr); - f1->checkCoherency(); + f1->checkConsistencyLight(); WriteField(fileName,f1,false);//<- false important for the test MEDCouplingFieldDouble *f2=ReadFieldNode(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7); CPPUNIT_ASSERT(f2->isEqual(f1,1e-12,1e-12)); @@ -534,7 +534,7 @@ void MEDLoaderTest::testMesh3DSurfShuffleRW() MEDCouplingUMesh *mesh=build3DSurfMesh_1(); const int renumber1[6]={2,5,1,0,3,4}; mesh->renumberCells(renumber1,false); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); WriteUMesh(fileName,mesh,true); MEDCouplingUMesh *mesh_rw=ReadUMeshFromFile(fileName,mesh->getName().c_str(),0); CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12)); @@ -557,7 +557,7 @@ void MEDLoaderTest::testFieldShuffleRW1() const double arr1[12]={71.,171.,10.,110.,20.,120.,30.,130.,40.,140.,50.,150.}; std::copy(arr1,arr1+12,tmp); f1->setTime(3.14,2,7); - f1->checkCoherency(); + f1->checkConsistencyLight(); // const int renumber1[6]={2,1,5,0,3,4}; f1->renumberCells(renumber1,false); @@ -661,7 +661,7 @@ void MEDLoaderTest::testWriteUMeshesRW1() const double arr1[10]={71.,171.,10.,110.,20.,120.,30.,130.,40.,140.}; std::copy(arr1,arr1+10,tmp); f1->setTime(3.14,2,7); - f1->checkCoherency(); + f1->checkConsistencyLight(); WriteFieldUsingAlreadyWrittenMesh(fileName,f1); MEDCouplingFieldDouble *f2=ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),-1,f1->getName().c_str(),2,7); CPPUNIT_ASSERT(f2->isEqual(f1,1e-12,1e-12)); @@ -691,7 +691,7 @@ void MEDLoaderTest::testMixCellAndNodesFieldRW1() const double arr1[12]={71.,171.,10.,110.,20.,120.,30.,130.,40.,140.,50.,150.}; std::copy(arr1,arr1+12,tmp); f1->setTime(3.14,2,7); - f1->checkCoherency(); + f1->checkConsistencyLight(); // MEDCouplingFieldDouble *f2=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME); f2->setName("FieldMix"); @@ -709,7 +709,7 @@ void MEDLoaderTest::testMixCellAndNodesFieldRW1() }; std::copy(arr2,arr2+24,tmp); f2->setTime(3.14,2,7); - f2->checkCoherency(); + f2->checkConsistencyLight(); // WriteField(fileName,f1,true); std::vector ts=GetTypesOfField(fileName,f1->getMesh()->getName().c_str(),f1->getName().c_str()); @@ -860,7 +860,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(-1,its1[0].second); // MEDCouplingFieldDouble *field0=ReadFieldCell(fileName.c_str(),meshNames[0].c_str(),0,fieldsName[0].c_str(),its0[0].first,its0[0].second); - field0->checkCoherency(); + field0->checkConsistencyLight(); CPPUNIT_ASSERT(field0->getName()==fieldsName[0]); CPPUNIT_ASSERT_EQUAL(1,field0->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(16,field0->getNumberOfTuples()); @@ -889,7 +889,7 @@ void MEDLoaderTest::testMEDLoaderRead1() field0->decrRef(); // MEDCouplingFieldDouble *field1=ReadFieldCell(fileName.c_str(),meshNames[0].c_str(),0,fieldsName[1].c_str(),its1[0].first,its1[0].second); - field1->checkCoherency(); + field1->checkConsistencyLight(); CPPUNIT_ASSERT(field1->getName()==fieldsName[1]); CPPUNIT_ASSERT_EQUAL(3,field1->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(16,field1->getNumberOfTuples()); @@ -930,7 +930,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(2,its0Node[2].first); CPPUNIT_ASSERT_EQUAL(-1,its0Node[2].second); MEDCouplingFieldDouble *field0Nodes=ReadFieldNode(fileName.c_str(),meshNames[0].c_str(),0,fieldsNameNode[0].c_str(),its0Node[0].first,its0Node[0].second); - field0Nodes->checkCoherency(); + field0Nodes->checkConsistencyLight(); CPPUNIT_ASSERT(field0Nodes->getName()==fieldsNameNode[0]); CPPUNIT_ASSERT_EQUAL(1,field0Nodes->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(19,field0Nodes->getNumberOfTuples()); @@ -944,7 +944,7 @@ void MEDLoaderTest::testMEDLoaderRead1() field0Nodes->decrRef(); // field0Nodes=ReadFieldNode(fileName.c_str(),meshNames[0].c_str(),0,fieldsNameNode[0].c_str(),its0Node[2].first,its0Node[2].second); - field0Nodes->checkCoherency(); + field0Nodes->checkConsistencyLight(); CPPUNIT_ASSERT(field0Nodes->getName()==fieldsNameNode[0]); CPPUNIT_ASSERT_EQUAL(1,field0Nodes->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(19,field0Nodes->getNumberOfTuples()); @@ -972,7 +972,7 @@ void MEDLoaderTest::testMEDLoaderRead1() field0Nodes->decrRef(); // field0Nodes=ReadFieldNode(fileName.c_str(),meshNames[0].c_str(),0,fieldsNameNode[0].c_str(),its0Node[0].first,its0Node[0].second); - field0Nodes->checkCoherency(); + field0Nodes->checkConsistencyLight(); CPPUNIT_ASSERT(field0Nodes->getName()==fieldsNameNode[0]); CPPUNIT_ASSERT_EQUAL(1,field0Nodes->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(19,field0Nodes->getNumberOfTuples()); @@ -1010,7 +1010,7 @@ void MEDLoaderTest::testMEDLoaderPolygonRead() CPPUNIT_ASSERT_EQUAL(1,(int)meshNames.size()); CPPUNIT_ASSERT(meshNames[0]=="Bord"); MEDCouplingUMesh *mesh=ReadUMeshFromFile(fileName.c_str(),meshNames[0].c_str(),0); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(538,mesh->getNumberOfCells()); @@ -1039,7 +1039,7 @@ void MEDLoaderTest::testMEDLoaderPolygonRead() std::vector > its0=GetCellFieldIterations(fileName.c_str(),meshNames[0].c_str(),fieldsName[0].c_str()); CPPUNIT_ASSERT_EQUAL(1,(int)its0.size()); MEDCouplingFieldDouble *field=ReadFieldCell(fileName.c_str(),meshNames[0].c_str(),0,fieldsName[0].c_str(),its0[0].first,its0[0].second); - field->checkCoherency(); + field->checkConsistencyLight(); CPPUNIT_ASSERT(field->getName()==fieldsName[0]); CPPUNIT_ASSERT_EQUAL(1,field->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(538,field->getNumberOfTuples()); @@ -1076,7 +1076,7 @@ void MEDLoaderTest::testMEDLoaderPolyhedronRead() CPPUNIT_ASSERT_EQUAL(1,(int)meshNames.size()); CPPUNIT_ASSERT(meshNames[0]=="poly3D"); MEDCouplingUMesh *mesh=ReadUMeshFromFile(fileName.c_str(),meshNames[0].c_str(),0); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(3,mesh->getNumberOfCells()); @@ -1092,7 +1092,7 @@ void MEDLoaderTest::testMEDLoaderPolyhedronRead() mesh->decrRef(); // mesh=ReadUMeshFromFile(fileName.c_str(),meshNames[0].c_str(),-1); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(17,mesh->getNumberOfCells()); @@ -1129,7 +1129,7 @@ void MEDLoaderTest::testMEDLoaderPolyhedronRead() vector families2; families2.push_back(families[0]); mesh=ReadUMeshFromFamilies(fileName.c_str(),meshNames[0].c_str(),-1,families2); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(3,mesh->getNumberOfCells()); @@ -1380,7 +1380,7 @@ MEDCouplingFieldDouble *MEDLoaderTest::buildVecFieldOnCells_1() const double arr1[18]={0.,10.,20.,1.,11.,21.,2.,12.,22.,3.,13.,23.,4.,14.,24.,5.,15.,25.}; std::copy(arr1,arr1+18,tmp); f1->setTime(2.,0,1); - f1->checkCoherency(); + f1->checkConsistencyLight(); mesh->decrRef(); return f1; } @@ -1406,7 +1406,7 @@ MEDCouplingFieldDouble *MEDLoaderTest::buildVecFieldOnNodes_1() }; std::copy(arr1,arr1+36,tmp); f1->setTime(2.12,2,3); - f1->checkCoherency(); + f1->checkConsistencyLight(); mesh->decrRef(); return f1; } @@ -1449,7 +1449,7 @@ MEDCouplingFieldDouble *MEDLoaderTest::buildVecFieldOnGauss_1() array->setInfoOnComponent(0,"power [MW/m^3]"); array->setInfoOnComponent(1,"density"); array->decrRef(); - f->checkCoherency(); + f->checkConsistencyLight(); m->decrRef(); return f; } @@ -1470,7 +1470,7 @@ MEDCouplingFieldDouble *MEDLoaderTest::buildVecFieldOnGaussNE_1() array->setInfoOnComponent(1,"temperature"); f->setName("MyFieldOnGaussNE"); array->decrRef(); - f->checkCoherency(); + f->checkConsistencyLight(); m->decrRef(); return f; } diff --git a/src/MEDLoader/Test/SauvLoaderTest.cxx b/src/MEDLoader/Test/SauvLoaderTest.cxx index 14097d81b..296e8ad20 100644 --- a/src/MEDLoader/Test/SauvLoaderTest.cxx +++ b/src/MEDLoader/Test/SauvLoaderTest.cxx @@ -41,8 +41,8 @@ void SauvLoaderTest::testSauv2Med() { // read a file containing all types of readable piles std::string file = INTERP_TEST::getResourceFile("allPillesTest.sauv", 3); - MEDCouplingAutoRefCountObjectPtr sr=SauvReader::New(file.c_str()); - MEDCouplingAutoRefCountObjectPtr d2=sr->loadInMEDFileDS(); + MCAuto sr=SauvReader::New(file.c_str()); + MCAuto d2=sr->loadInMEDFileDS(); // write MED d2->write("allPillesTest.med",0); // check @@ -59,23 +59,23 @@ void SauvLoaderTest::testMed2SauvOnAMeshWithVoidFamily() const int nbOfNodes = 6; double coords[nbOfNodes*spaceDim] = {0,0, 1,0, 1,1, 0,1, 2,0, 2,1}; int conn[8]={0,1,2,3, 1,4,5,2}; - MEDCouplingAutoRefCountObjectPtr mesh2d=MEDCouplingUMesh::New("Mesh",spaceDim); + MCAuto mesh2d=MEDCouplingUMesh::New("Mesh",spaceDim); mesh2d->allocateCells(2); mesh2d->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); mesh2d->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+4); mesh2d->finishInsertingCells(); - MEDCouplingAutoRefCountObjectPtr myCoords=DataArrayDouble::New(); + MCAuto myCoords=DataArrayDouble::New(); myCoords->alloc(nbOfNodes,spaceDim); std::copy(coords,coords+nbOfNodes*spaceDim,myCoords->getPointer()); mesh2d->setCoords(myCoords); // create a MedFileUMesh - MEDCouplingAutoRefCountObjectPtr m= MEDFileUMesh::New(); + MCAuto m= MEDFileUMesh::New(); m->setMeshAtLevel(0,mesh2d); // Create families and groups - MEDCouplingAutoRefCountObjectPtr fam = DataArrayInt::New(); + MCAuto fam = DataArrayInt::New(); fam->alloc(2,1); int elemsFams[2] = {-2,-3}; std::copy(elemsFams,elemsFams+2,fam->getPointer()); @@ -102,23 +102,23 @@ void SauvLoaderTest::testMed2SauvOnAMeshWithVoidFamily() // write to SAUV const char* sauvFile = "mesh_with_void_family.sauv"; - MEDCouplingAutoRefCountObjectPtr medData = MEDFileData::New(); - MEDCouplingAutoRefCountObjectPtr medMeshes = MEDFileMeshes::New(); - MEDCouplingAutoRefCountObjectPtr sw=SauvWriter::New(); + MCAuto medData = MEDFileData::New(); + MCAuto medMeshes = MEDFileMeshes::New(); + MCAuto sw=SauvWriter::New(); medMeshes->setMeshAtPos(0, m); medData->setMeshes(medMeshes); sw->setMEDFileDS(medData); sw->write(sauvFile); // read SAUV and check groups - MEDCouplingAutoRefCountObjectPtr sr=SauvReader::New(sauvFile); - MEDCouplingAutoRefCountObjectPtr d2=sr->loadInMEDFileDS(); + MCAuto sr=SauvReader::New(sauvFile); + MCAuto d2=sr->loadInMEDFileDS(); MEDFileUMesh* m2 = static_cast( d2->getMeshes()->getMeshAtPos(0) ); - MEDCouplingAutoRefCountObjectPtr group1 = m2->getGroup(0, "Group1"); + MCAuto group1 = m2->getGroup(0, "Group1"); CPPUNIT_ASSERT_EQUAL(1,(int)group1->getNumberOfCells()); - MEDCouplingAutoRefCountObjectPtr group2 = m2->getGroup(0, "Group2"); + MCAuto group2 = m2->getGroup(0, "Group2"); CPPUNIT_ASSERT_EQUAL(1,(int)group2->getNumberOfCells()); - MEDCouplingAutoRefCountObjectPtr grptot = m2->getGroup(0, "Grouptot"); + MCAuto grptot = m2->getGroup(0, "Grouptot"); CPPUNIT_ASSERT_EQUAL(2,(int)grptot->getNumberOfCells()); } @@ -126,22 +126,22 @@ void SauvLoaderTest::testSauv2MedOnA3SubsField() { // read SAUV std::string sauvFile = INTERP_TEST::getResourceFile("portico_3subs.sauv", 3); - MEDCouplingAutoRefCountObjectPtr sr=SauvReader::New(sauvFile.c_str()); - MEDCouplingAutoRefCountObjectPtr d2=sr->loadInMEDFileDS(); + MCAuto sr=SauvReader::New(sauvFile.c_str()); + MCAuto d2=sr->loadInMEDFileDS(); // check mesh MEDFileUMesh* m2 = static_cast(d2->getMeshes()->getMeshAtPos(0)); - MEDCouplingAutoRefCountObjectPtr mesh1d = m2->getMeshAtLevel(0); - MEDCouplingAutoRefCountObjectPtr length1dField = mesh1d->getMeasureField(0); + MCAuto mesh1d = m2->getMeshAtLevel(0); + MCAuto length1dField = mesh1d->getMeasureField(0); std::cout << "Length of 1d elements: " << length1dField->accumulate(0) << std::endl; CPPUNIT_ASSERT_DOUBLES_EQUAL(3, length1dField->accumulate(0), 1e-12); // check field - MEDCouplingAutoRefCountObjectPtr field = + MCAuto field = dynamic_cast(d2->getFields()->getFieldWithName("CHAM1D")); std::cout << "Number of components in field: " << field->getInfo().size() << std::endl; CPPUNIT_ASSERT_EQUAL(6,(int)field->getInfo().size()); std::vector< std::pair > timesteps = field->getIterations(); - MEDCouplingAutoRefCountObjectPtr field1d = + MCAuto field1d = field->getFieldOnMeshAtLevel(ON_GAUSS_NE, timesteps[0].first, timesteps[0].second, 0, m2); // Check first component of the field @@ -170,11 +170,11 @@ void SauvLoaderTest::testMed2Sauv() { // read pointe.med std::string file = INTERP_TEST::getResourceFile("pointe.med", 3); - MEDCouplingAutoRefCountObjectPtr pointeMed=MEDFileData::New(file.c_str()); + MCAuto pointeMed=MEDFileData::New(file.c_str()); // add 3 faces to pointeMed MEDFileUMesh* pointeMedMesh = static_cast(pointeMed->getMeshes()->getMeshAtPos(0)); - MEDCouplingAutoRefCountObjectPtr pointeM1D = MEDCouplingUMesh::New(); + MCAuto pointeM1D = MEDCouplingUMesh::New(); DataArrayDouble *coords = pointeMedMesh->getCoords(); pointeM1D->setCoords( coords ); pointeM1D->setMeshDimension( 2 ); @@ -191,11 +191,11 @@ void SauvLoaderTest::testMed2Sauv() pointeMed->getMeshes()->setMeshAtPos( 0, pointeMedMesh ); // add a field on 2 faces to pointeMed - MEDCouplingAutoRefCountObjectPtr ff1=MEDFileFieldMultiTS::New(); - MEDCouplingAutoRefCountObjectPtr f1=MEDCouplingFieldDouble::New(ON_GAUSS_NE,ONE_TIME); + MCAuto ff1=MEDFileFieldMultiTS::New(); + MCAuto f1=MEDCouplingFieldDouble::New(ON_GAUSS_NE,ONE_TIME); f1->setMesh( pointeM1D ); f1->setName("Field on 2 faces"); - MEDCouplingAutoRefCountObjectPtr d=DataArrayDouble::New(); + MCAuto d=DataArrayDouble::New(); d->alloc(3+4,2); d->setInfoOnComponent(0,"sigX [MPa]"); d->setInfoOnComponent(1,"sigY [GPa]"); @@ -205,7 +205,7 @@ void SauvLoaderTest::testMed2Sauv() }; std::copy(vals,vals+d->getNbOfElems(),d->getPointer()); f1->setArray(d); - MEDCouplingAutoRefCountObjectPtr da=DataArrayInt::New(); + MCAuto da=DataArrayInt::New(); int ids[] = { 0,2 @@ -220,7 +220,7 @@ void SauvLoaderTest::testMed2Sauv() MEDFileFields* pointeFields = pointeMed->getFields(); for ( int i = 0; i < pointeFields->getNumberOfFields(); ++i ) { - MEDCouplingAutoRefCountObjectPtr ts = pointeFields->getFieldAtPos(i); + MCAuto ts = pointeFields->getFieldAtPos(i); if ( std::string("fieldnodeint") == ts->getName()) { pointeFields->destroyFieldAtPos( i ); @@ -229,13 +229,13 @@ void SauvLoaderTest::testMed2Sauv() } // write pointeMed to SAUV const char* sauvFile = "pointe.sauv"; - MEDCouplingAutoRefCountObjectPtr sw=SauvWriter::New(); + MCAuto sw=SauvWriter::New(); sw->setMEDFileDS(pointeMed); sw->write(sauvFile); // read SAUV and check - MEDCouplingAutoRefCountObjectPtr sr=SauvReader::New(sauvFile); - MEDCouplingAutoRefCountObjectPtr d2=sr->loadInMEDFileDS(); + MCAuto sr=SauvReader::New(sauvFile); + MCAuto d2=sr->loadInMEDFileDS(); CPPUNIT_ASSERT_EQUAL(1,d2->getNumberOfMeshes()); CPPUNIT_ASSERT_EQUAL(4,d2->getNumberOfFields()); MEDFileUMesh * m = static_cast( d2->getMeshes()->getMeshAtPos(0) ); @@ -250,25 +250,25 @@ void SauvLoaderTest::testMed2Sauv() CPPUNIT_ASSERT( std::find(groups.begin(),groups.end(),"groupe5") != groups.end() ); CPPUNIT_ASSERT( std::find(groups.begin(),groups.end(),"maa1") != groups.end() ); CPPUNIT_ASSERT_EQUAL(16,m->getSizeAtLevel(0)); - MEDCouplingAutoRefCountObjectPtr um0 = m->getMeshAtLevel(0); + MCAuto um0 = m->getMeshAtLevel(0); CPPUNIT_ASSERT_EQUAL(12, um0->getNumberOfCellsWithType( INTERP_KERNEL::NORM_TETRA4 )); CPPUNIT_ASSERT_EQUAL(2, um0->getNumberOfCellsWithType( INTERP_KERNEL::NORM_PYRA5 )); CPPUNIT_ASSERT_EQUAL(2, um0->getNumberOfCellsWithType( INTERP_KERNEL::NORM_HEXA8 )); - MEDCouplingAutoRefCountObjectPtr um1 = m->getMeshAtLevel(-1); + MCAuto um1 = m->getMeshAtLevel(-1); CPPUNIT_ASSERT_EQUAL(2, um1->getNumberOfCellsWithType( INTERP_KERNEL::NORM_TRI3 )); - MEDCouplingAutoRefCountObjectPtr pointeUM0 = + MCAuto pointeUM0 = static_cast( pointeMedMesh->getMeshAtLevel(0)); DataArrayDouble *coo = m->getCoords(); DataArrayDouble *pointeCoo = pointeMedMesh->getCoords(); CPPUNIT_ASSERT(coo->isEqualWithoutConsideringStr(*pointeCoo,1e-12)); - MEDCouplingAutoRefCountObjectPtr vol = um0->getMeasureField(0); - MEDCouplingAutoRefCountObjectPtr pointeVol = pointeUM0->getMeasureField(0); + MCAuto vol = um0->getMeasureField(0); + MCAuto pointeVol = pointeUM0->getMeasureField(0); CPPUNIT_ASSERT_DOUBLES_EQUAL( vol->accumulate(0), pointeVol->accumulate(0),1e-12); // check fields // fieldnodedouble - MEDCouplingAutoRefCountObjectPtr fieldnodedoubleTS1 = + MCAuto fieldnodedoubleTS1 = dynamic_cast(pointeMed->getFields()->getFieldWithName("fieldnodedouble")); - MEDCouplingAutoRefCountObjectPtr fieldnodedoubleTS2 = + MCAuto fieldnodedoubleTS2 = dynamic_cast(d2->getFields()->getFieldWithName("fieldnodedouble")); CPPUNIT_ASSERT_EQUAL( fieldnodedoubleTS1->getInfo().size(), fieldnodedoubleTS2->getInfo().size()); for ( size_t i = 0; i < fieldnodedoubleTS1->getInfo().size(); ++i ) @@ -278,16 +278,16 @@ void SauvLoaderTest::testMed2Sauv() std::vector< std::pair > io2 = fieldnodedoubleTS2->getIterations(); for ( int i =0; i < fieldnodedoubleTS1->getNumberOfTS(); ++i ) { - MEDCouplingAutoRefCountObjectPtr fnd1 = + MCAuto fnd1 = fieldnodedoubleTS1->getFieldOnMeshAtLevel(ON_NODES, io1[i].first,io1[i].second,pointeUM0); - MEDCouplingAutoRefCountObjectPtr fnd2 = + MCAuto fnd2 = fieldnodedoubleTS2->getFieldOnMeshAtLevel(ON_NODES, io2[i].first,io2[i].second,um0); CPPUNIT_ASSERT( fnd1->getArray()->isEqual( *fnd2->getArray(), 1e-12 )); } // fieldcelldoublevector - MEDCouplingAutoRefCountObjectPtr fieldcelldoublevectorTS1 = + MCAuto fieldcelldoublevectorTS1 = dynamic_cast(pointeMed->getFields()->getFieldWithName("fieldcelldoublevector")); - MEDCouplingAutoRefCountObjectPtr fieldcelldoublevectorTS2 = + MCAuto fieldcelldoublevectorTS2 = dynamic_cast(d2->getFields()->getFieldWithName("fieldcelldoublevector")); CPPUNIT_ASSERT_EQUAL( fieldcelldoublevectorTS1->getInfo().size(), fieldcelldoublevectorTS2->getInfo().size()); for ( size_t i = 0; i < fieldcelldoublevectorTS1->getInfo().size(); ++i ) @@ -297,19 +297,19 @@ void SauvLoaderTest::testMed2Sauv() io2 = fieldcelldoublevectorTS2->getIterations(); for ( int i =0; i < fieldcelldoublevectorTS1->getNumberOfTS(); ++i ) { - MEDCouplingAutoRefCountObjectPtr fnd1 = + MCAuto fnd1 = fieldcelldoublevectorTS1->getFieldOnMeshAtLevel(ON_CELLS, io1[i].first,io1[i].second,pointeUM0); - MEDCouplingAutoRefCountObjectPtr fnd2 = + MCAuto fnd2 = fieldcelldoublevectorTS2->getFieldOnMeshAtLevel(ON_CELLS, io2[i].first,io2[i].second,um0); CPPUNIT_ASSERT_DOUBLES_EQUAL( fnd1->accumulate(0), fnd2->accumulate(0), 1e-12 ); CPPUNIT_ASSERT_DOUBLES_EQUAL( fnd1->accumulate(1), fnd2->accumulate(1), 1e-12 ); CPPUNIT_ASSERT_DOUBLES_EQUAL( fnd1->accumulate(2), fnd2->accumulate(2), 1e-12 ); } // "Field on 2 faces" - MEDCouplingAutoRefCountObjectPtr fieldOnFaces = + MCAuto fieldOnFaces = dynamic_cast(d2->getFields()->getFieldWithName(f1->getName().c_str())); io1 = fieldOnFaces->getIterations(); - MEDCouplingAutoRefCountObjectPtr fof = + MCAuto fof = fieldOnFaces->getFieldOnMeshAtLevel(f1->getTypeOfField(),io1[0].first,io1[0].second,um1); CPPUNIT_ASSERT( d->isEqual( *fof->getArray(), 1e-12 )); } diff --git a/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx b/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx index 8f99e885d..31dfdca16 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx @@ -252,8 +252,8 @@ void MEDPARTITIONER::ConnectZone::setDistantMesh(MEDCoupling::MEDCouplingUMesh * */ void MEDPARTITIONER::ConnectZone::setNodeCorresp(const int * nodeCorresp, int nbnode) { - MEDCouplingAutoRefCountObjectPtr indexArr( DataArrayInt::New() ); - MEDCouplingAutoRefCountObjectPtr valueArr( DataArrayInt::New() ); + MCAuto indexArr( DataArrayInt::New() ); + MCAuto valueArr( DataArrayInt::New() ); indexArr->alloc( nbnode+1 ); valueArr->alloc( 2*nbnode ); int * index = indexArr->getPointer(); @@ -280,8 +280,8 @@ void MEDPARTITIONER::ConnectZone::setNodeCorresp(MEDCouplingSkyLineArray* array) */ void MEDPARTITIONER::ConnectZone::setFaceCorresp(const int * faceCorresp, int nbface) { - MEDCouplingAutoRefCountObjectPtr indexArr( DataArrayInt::New() ); - MEDCouplingAutoRefCountObjectPtr valueArr( DataArrayInt::New() ); + MCAuto indexArr( DataArrayInt::New() ); + MCAuto valueArr( DataArrayInt::New() ); indexArr->alloc( nbface+1 ); valueArr->alloc( 2*nbface ); int * index = indexArr->getPointer(); @@ -311,8 +311,8 @@ void MEDPARTITIONER::ConnectZone::setFaceCorresp(MEDCouplingSkyLineArray* array) void MEDPARTITIONER::ConnectZone::setEntityCorresp(int localEntity, int distantEntity, const int *entityCorresp, int nbentity) { - MEDCouplingAutoRefCountObjectPtr indexArr( DataArrayInt::New() ); - MEDCouplingAutoRefCountObjectPtr valueArr( DataArrayInt::New() ); + MCAuto indexArr( DataArrayInt::New() ); + MCAuto valueArr( DataArrayInt::New() ); indexArr->alloc( nbentity+1 ); valueArr->alloc( 2*nbentity ); int * index = indexArr->getPointer(); diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx index e2f4487bf..e957d84a7 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx @@ -34,7 +34,7 @@ #include "MEDPARTITIONER_JointFinder.hxx" #endif -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingMemArray.hxx" #include "MEDCouplingNormalizedUnstructuredMesh.hxx" @@ -652,7 +652,7 @@ void MEDPARTITIONER::MeshCollection::castIntField(std::vectorisMyDomain(iold)) { - MEDCoupling::DataArrayDouble* sourceCoords=meshesCastFrom[iold]->getBarycenterAndOwner(); + MEDCoupling::DataArrayDouble* sourceCoords=meshesCastFrom[iold]->computeCellCenterOfMass(); bbox[iold]=sourceCoords->computeBBoxPerTuple(1.e-6); acceleratingStructures[iold]=new BBTreeOfDim( sourceCoords->getNumberOfComponents(), bbox[iold]->getConstPointer(),0,0,bbox[iold]->getNumberOfTuples()); sourceCoords->decrRef(); @@ -727,7 +727,7 @@ void MEDPARTITIONER::MeshCollection::remapIntField(int inew, int iold, { if (sourceMesh.getNumberOfCells()<=0) return; //empty mesh could exist - MEDCoupling::DataArrayDouble* targetCoords=targetMesh.getBarycenterAndOwner(); + MEDCoupling::DataArrayDouble* targetCoords=targetMesh.computeCellCenterOfMass(); const double* tc=targetCoords->getConstPointer(); int targetSize=targetMesh.getNumberOfCells(); int sourceSize=sourceMesh.getNumberOfCells(); @@ -745,7 +745,7 @@ void MEDPARTITIONER::MeshCollection::remapIntField(int inew, int iold, int dim = targetCoords->getNumberOfComponents(); if (myTree==0) { - sourceBBox=sourceMesh.getBarycenterAndOwner()->computeBBoxPerTuple(1e-8); + sourceBBox=sourceMesh.computeCellCenterOfMass()->computeBBoxPerTuple(1e-8); tree=new BBTreeOfDim( dim, sourceBBox->getConstPointer(),0,0, sourceBBox->getNumberOfTuples(),1e-10); cleantree=true; } @@ -971,7 +971,7 @@ namespace bool removeEqual = false) { // sort - MEDCouplingAutoRefCountObjectPtr< DataArrayInt > renumN2O = ids1->buildPermArrPerLevel(); + MCAuto< DataArrayInt > renumN2O = ids1->buildPermArrPerLevel(); ids1->renumberInPlaceR( renumN2O->begin() ); ids2->renumberInPlaceR( renumN2O->begin() ); @@ -1143,9 +1143,9 @@ void MEDPARTITIONER::MeshCollection::buildConnectZones( const NodeMapping& nodeM // separate ids of two domains const MEDCoupling::MEDCouplingSkyLineArray *corrArray = cz->getEntityCorresp( 0, 0 ); const DataArrayInt* ids12 = corrArray->getValueArray(); - MEDCouplingAutoRefCountObjectPtr ids1, ids2, ids12Sorted; - ids1 = ids12->selectByTupleId2( 0, corrArray->getLength(), 2 ); - ids2 = ids12->selectByTupleId2( 1, corrArray->getLength(), 2 ); + MCAuto ids1, ids2, ids12Sorted; + ids1 = ids12->selectByTupleIdSafeSlice( 0, corrArray->getLength(), 2 ); + ids2 = ids12->selectByTupleIdSafeSlice( 1, corrArray->getLength(), 2 ); // renumber cells according to mesh->sortCellsInMEDFileFrmt() renumber( ids1, o2nRenumber[ cz->getLocalDomainNumber() ]); @@ -1253,9 +1253,9 @@ void MEDPARTITIONER::MeshCollection::buildConnectZones( const NodeMapping& nodeM // separate ids of two domains const MEDCoupling::MEDCouplingSkyLineArray *corrArray = cz->getNodeCorresp(); const DataArrayInt *ids12 = corrArray->getValueArray(); - MEDCouplingAutoRefCountObjectPtr ids1, ids2, ids12Sorted; - ids1 = ids12->selectByTupleId2( 0, corrArray->getLength(), 2 ); - ids2 = ids12->selectByTupleId2( 1, corrArray->getLength(), 2 ); + MCAuto ids1, ids2, ids12Sorted; + ids1 = ids12->selectByTupleIdSafeSlice( 0, corrArray->getLength(), 2 ); + ids2 = ids12->selectByTupleIdSafeSlice( 1, corrArray->getLength(), 2 ); ids12Sorted = sortCorrespondences( ids1, ids2, /*delta=*/0, removeEqual ); cz->setNodeCorresp( ids12Sorted->begin(), ids12Sorted->getNbOfElems() / 2 ); @@ -1296,7 +1296,7 @@ void MEDPARTITIONER::MeshCollection::buildBoundaryFaces() for (int inew = 0; inew < nbMeshes-1; inew++) if ( !isParallelMode() || _domain_selector->isMyDomain(inew) ) { - DataArrayDouble* bcCoords = faceMeshes[inew]->getBarycenterAndOwner(); + DataArrayDouble* bcCoords = faceMeshes[inew]->computeCellCenterOfMass(); bbox [inew] = bcCoords->computeBBoxPerTuple(1.e-6); bbTrees[inew] = new BBTreeOfDim( bcCoords->getNumberOfComponents(), bbox[inew]->getConstPointer(),0,0, @@ -1341,7 +1341,7 @@ void MEDPARTITIONER::MeshCollection::buildBoundaryFaces() std::vector< int > faces1, faces2; if ( mesh1 && mesh2 ) { - const DataArrayDouble* coords2 = mesh2->getBarycenterAndOwner(); + const DataArrayDouble* coords2 = mesh2->computeCellCenterOfMass(); const double* c2 = coords2->getConstPointer(); const int dim = coords2->getNumberOfComponents(); const int nbFaces2 = mesh2->getNumberOfCells(); diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx index 516deff4e..f284facac 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx @@ -72,8 +72,8 @@ int MeshCollectionDriver::readSeq(const char* filename, const char* meshname) (_collection->getFaceMesh()).push_back(mfm->getLevelM1Mesh(false)); //reading family ids - MEDCoupling::DataArrayInt* cellIds(mfm->getFamilyFieldAtLevel(0)->deepCpy()); - MEDCoupling::DataArrayInt* faceIds(mfm->getFamilyFieldAtLevel(-1)->deepCpy()); + MEDCoupling::DataArrayInt* cellIds(mfm->getFamilyFieldAtLevel(0)->deepCopy()); + MEDCoupling::DataArrayInt* faceIds(mfm->getFamilyFieldAtLevel(-1)->deepCopy()); (_collection->getCellFamilyIds()).push_back(cellIds); (_collection->getFaceFamilyIds()).push_back(faceIds); @@ -136,7 +136,7 @@ void MeshCollectionDriver::readData(MEDCoupling::MEDFileUMesh* mfm, int idomain) { (_collection->getMesh())[idomain]=mfm->getLevel0Mesh(false); //reading families groups - MEDCoupling::DataArrayInt* cellIds(mfm->getFamilyFieldAtLevel(0)->deepCpy()); + MEDCoupling::DataArrayInt* cellIds(mfm->getFamilyFieldAtLevel(0)->deepCopy()); (_collection->getCellFamilyIds())[idomain]=cellIds; } catch(...) @@ -153,7 +153,7 @@ void MeshCollectionDriver::readData(MEDCoupling::MEDFileUMesh* mfm, int idomain) { (_collection->getFaceMesh())[idomain]=mfm->getLevelM1Mesh(false); //reading families groups - MEDCoupling::DataArrayInt* faceIds(mfm->getFamilyFieldAtLevel(-1)->deepCpy()); + MEDCoupling::DataArrayInt* faceIds(mfm->getFamilyFieldAtLevel(-1)->deepCopy()); (_collection->getFaceFamilyIds())[idomain]=faceIds; if (MyGlobals::_Verbose>10) std::cout << "proc " << MyGlobals::_Rank << " : WITH Faces\n"; @@ -225,7 +225,7 @@ MEDCoupling::MEDFileMesh* MeshCollectionDriver::getMesh(int idomain) const cellMesh->setName(finalMeshName); mfm->setMeshAtLevel( 0, cellMesh ); - faceMesh->checkCoherency(); + faceMesh->checkConsistencyLight(); if (faceMesh->getNumberOfCells()>0) { faceMesh->tryToShareSameCoordsPermute(*cellMesh, 1e-10); @@ -258,7 +258,7 @@ MEDCoupling::MEDFileMesh* MeshCollectionDriver::getMesh(int idomain) const // add joints - using MEDCoupling::MEDCouplingAutoRefCountObjectPtr; + using MEDCoupling::MCAuto; using MEDCoupling::MEDCouplingSkyLineArray; using MEDCoupling::MEDFileJoint; using MEDCoupling::MEDFileJointCorrespondence; @@ -268,7 +268,7 @@ MEDCoupling::MEDFileMesh* MeshCollectionDriver::getMesh(int idomain) const if ( _collection->getCZ().size() > 0 ) { - MEDCouplingAutoRefCountObjectPtr< MEDFileJoints > joints = MEDFileJoints::New(); + MCAuto< MEDFileJoints > joints = MEDFileJoints::New(); for ( size_t i = 0; i < _collection->getCZ().size(); ++i ) { @@ -287,19 +287,19 @@ MEDCoupling::MEDFileMesh* MeshCollectionDriver::getMesh(int idomain) const cz->setDescription( oss.str() ); } - MEDCouplingAutoRefCountObjectPtr< MEDFileJoint> + MCAuto< MEDFileJoint> joint = MEDFileJoint::New( cz->getName(), finalMeshName, finalMeshName, cz->getDistantDomainNumber() ); joint->setDescription( cz->getDescription() ); joints->pushJoint( joint ); - MEDCouplingAutoRefCountObjectPtr< MEDFileJointOneStep> j1st = MEDFileJointOneStep::New(); + MCAuto< MEDFileJointOneStep> j1st = MEDFileJointOneStep::New(); joint->pushStep( j1st ); const MEDCouplingSkyLineArray * nodeCorr = cz->getNodeCorresp(); if ( nodeCorr ) { - MEDCouplingAutoRefCountObjectPtr< MEDFileJointCorrespondence > + MCAuto< MEDFileJointCorrespondence > corr = MEDFileJointCorrespondence::New( nodeCorr->getValueArray() ); j1st->pushCorrespondence( corr ); } @@ -314,7 +314,7 @@ MEDCoupling::MEDFileMesh* MeshCollectionDriver::getMesh(int idomain) const { t1 = INTERP_KERNEL::NormalizedCellType( types[it].first ); t2 = INTERP_KERNEL::NormalizedCellType( types[it].second ); - MEDCouplingAutoRefCountObjectPtr< MEDFileJointCorrespondence> + MCAuto< MEDFileJointCorrespondence> corr = MEDFileJointCorrespondence::New( cellCorr->getValueArray(), t1, t2 ); j1st->pushCorrespondence( corr ); } @@ -380,7 +380,7 @@ MEDCoupling::MEDCouplingFieldDouble* MeshCollectionDriver::getField(std::string } field->setArray(da); field->setTime(time,DT,IT); - field->checkCoherency(); + field->checkConsistencyLight(); } return field; } @@ -424,8 +424,8 @@ MEDCoupling::MEDFileData* MeshCollectionDriver::getMEDFileData() { MEDCoupling::MEDFileData* newdata = MEDCoupling::MEDFileData::New(); - MEDCoupling::MEDCouplingAutoRefCountObjectPtr meshes; - MEDCoupling::MEDCouplingAutoRefCountObjectPtr fields; + MEDCoupling::MCAuto meshes; + MEDCoupling::MCAuto fields; meshes = MEDCoupling::MEDFileMeshes::New(); fields = MEDCoupling::MEDFileFields::New(); diff --git a/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx b/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx index 51543f52f..a9ab2c3f3 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx @@ -26,7 +26,7 @@ #include "MEDCouplingUMesh.hxx" #include "MEDCouplingFieldDouble.hxx" #include "InterpKernelException.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "InterpKernelAutoPtr.hxx" #include @@ -824,7 +824,7 @@ MEDCoupling::MEDCouplingUMesh* MEDPARTITIONER::CreateEmptyMEDCouplingUMesh() umesh->setCoords(myCoords); umesh->setName("EMPTY"); myCoords->decrRef(); - umesh->checkCoherency(); + umesh->checkConsistencyLight(); return umesh; } diff --git a/src/MEDPartitioner/MEDPARTITIONER_UtilsPara.cxx b/src/MEDPartitioner/MEDPARTITIONER_UtilsPara.cxx index 489fb8fb4..942397376 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_UtilsPara.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_UtilsPara.cxx @@ -26,7 +26,7 @@ #include "MEDCouplingUMesh.hxx" #include "MEDCouplingFieldDouble.hxx" #include "InterpKernelException.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "InterpKernelAutoPtr.hxx" #include diff --git a/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx b/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx index c6d95a674..a3a9bb910 100644 --- a/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx +++ b/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx @@ -29,7 +29,7 @@ #include "MEDLoader.hxx" #include "MEDLoaderBase.hxx" #include "MEDCouplingUMesh.hxx" -#include "MEDCouplingExtrudedMesh.hxx" +#include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingMemArray.hxx" #include "MEDCouplingMultiFields.hxx" @@ -234,7 +234,7 @@ MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildCUBE3DMesh() mesh->setCoords(myCoords); mesh->setName(_mesh_name.c_str()); myCoords->decrRef(); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); return mesh; } @@ -302,7 +302,7 @@ MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildCARRE3DMesh() mesh->setCoords(myCoords); mesh->setName(_mesh_name.c_str()); myCoords->decrRef(); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); return mesh; } @@ -371,7 +371,7 @@ MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildFACE3DMesh() mesh->setCoords(myCoords); mesh->setName(_mesh_name.c_str()); myCoords->decrRef(); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); return mesh; } @@ -403,7 +403,7 @@ MEDCouplingFieldDouble * MEDPARTITIONERTest::buildVecFieldOnCells(string myfileN myField->setInfoOnComponent(2,"vz"); myField->decrRef(); f1->setTime(2.,0,1); - f1->checkCoherency(); + f1->checkConsistencyLight(); mesh->decrRef(); return f1; } @@ -436,7 +436,7 @@ MEDCouplingFieldDouble * MEDPARTITIONERTest::buildVecFieldOnNodes() myField->setInfoOnComponent(2,"vz"); myField->decrRef(); f1->setTime(2.,0,1); - f1->checkCoherency(); + f1->checkConsistencyLight(); mesh->decrRef(); return f1; } @@ -465,8 +465,8 @@ void MEDPARTITIONERTest::createTestMeshWithoutField() mesh1->setName("testMesh"); mesh2->setName("theFaces"); mesh2->tryToShareSameCoordsPermute(*mesh1, 1e-9); - mesh2->checkCoherency(); - mesh1->checkCoherency(); + mesh2->checkConsistencyLight(); + mesh1->checkConsistencyLight(); meshes.push_back(mesh1); meshes.push_back(mesh2); WriteUMeshes(_file_name_with_faces.c_str(), meshes, true); @@ -573,7 +573,7 @@ void MEDPARTITIONERTest::createHugeTestMesh(int ni, int nj, int nk, int nbx, int int xyz=1; string sxyz; - DataArrayDouble* coordsInit=mesh->getCoords()->deepCpy(); + DataArrayDouble* coordsInit=mesh->getCoords()->deepCopy(); double* ptrInit=coordsInit->getPointer(); double deltax=cooFin[0]-cooDep[0]; double deltay=cooFin[1]-cooDep[1]; @@ -703,7 +703,7 @@ void MEDPARTITIONERTest::createTestMeshWithVecFieldOnCells() array->decrRef(); WriteField(name.c_str(),f3,true); if (_verbose) cout<checkCoherency(); + f3->checkConsistencyLight(); f1->decrRef(); if (_ntot<1000000) //too long { @@ -1374,7 +1374,7 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D() mesh->setCoords(myCoords); mesh->setName("FacesIn2D"); myCoords->decrRef(); - mesh->checkCoherency(); + mesh->checkConsistencyLight(); // groups of cells DataArrayInt* cellsFam=DataArrayInt::New(); diff --git a/src/MEDPartitioner/Test/MEDPARTITIONERTest.hxx b/src/MEDPartitioner/Test/MEDPARTITIONERTest.hxx index 2f6421597..96f807c01 100644 --- a/src/MEDPartitioner/Test/MEDPARTITIONERTest.hxx +++ b/src/MEDPartitioner/Test/MEDPARTITIONERTest.hxx @@ -38,7 +38,7 @@ #include #include "MEDCouplingUMesh.hxx" -#include "MEDCouplingExtrudedMesh.hxx" +#include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" class MEDPARTITIONERTEST_EXPORT MEDPARTITIONERTest : public CppUnit::TestFixture diff --git a/src/MEDPartitioner/Test/MEDPARTITIONERTestPara.cxx b/src/MEDPartitioner/Test/MEDPARTITIONERTestPara.cxx index 6fe8f1d37..b5b50af88 100644 --- a/src/MEDPartitioner/Test/MEDPARTITIONERTestPara.cxx +++ b/src/MEDPartitioner/Test/MEDPARTITIONERTestPara.cxx @@ -29,7 +29,7 @@ #include "MEDLoader.hxx" #include "MEDLoaderBase.hxx" #include "MEDCouplingUMesh.hxx" -#include "MEDCouplingExtrudedMesh.hxx" +#include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingMemArray.hxx" #include "MEDCouplingMultiFields.hxx" diff --git a/src/ParaMEDLoader/ParaMEDFileMesh.cxx b/src/ParaMEDLoader/ParaMEDFileMesh.cxx index 6851b764b..4ed619071 100644 --- a/src/ParaMEDLoader/ParaMEDFileMesh.cxx +++ b/src/ParaMEDLoader/ParaMEDFileMesh.cxx @@ -19,7 +19,7 @@ // Author : Anthony Geay (EDF R&D) #include "ParaMEDFileMesh.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "MEDFileMesh.hxx" #include "MEDFileMeshLL.hxx" #include "MEDLoader.hxx" @@ -87,7 +87,7 @@ MEDFileUMesh *ParaMEDFileUMesh::ParaNew(int iPart, int nbOfParts, const MPI_Comm MEDFileUMesh *ParaMEDFileUMesh::NewPrivate(med_idt fid, int iPart, int nbOfParts, const std::string& fileName, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) { - MEDCouplingAutoRefCountObjectPtr ret; + MCAuto ret; int meshDim, spaceDim, numberOfNodes; std::vector< std::vector< std::pair > > typesDistrib(GetUMeshGlobalInfo(fileName,mName,meshDim,spaceDim,numberOfNodes)); std::vector types; @@ -108,10 +108,10 @@ MEDFileUMesh *ParaMEDFileUMesh::NewPrivate(med_idt fid, int iPart, int nbOfParts MEDFileMeshes *ParaMEDFileMeshes::New(int iPart, int nbOfParts, const std::string& fileName) { std::vector ms(GetMeshNames(fileName)); - MEDCouplingAutoRefCountObjectPtr ret(MEDFileMeshes::New()); + MCAuto ret(MEDFileMeshes::New()); for(std::vector::const_iterator it=ms.begin();it!=ms.end();it++) { - MEDCouplingAutoRefCountObjectPtr mesh(ParaMEDFileMesh::New(iPart,nbOfParts,fileName,(*it))); + MCAuto mesh(ParaMEDFileMesh::New(iPart,nbOfParts,fileName,(*it))); ret->pushMesh(mesh); } return ret.retn(); @@ -120,10 +120,10 @@ MEDFileMeshes *ParaMEDFileMeshes::New(int iPart, int nbOfParts, const std::strin MEDFileMeshes *ParaMEDFileMeshes::ParaNew(int iPart, int nbOfParts, const MPI_Comm& com, const MPI_Info& nfo, const std::string& fileName) { std::vector ms(GetMeshNames(fileName)); - MEDCouplingAutoRefCountObjectPtr ret(MEDFileMeshes::New()); + MCAuto ret(MEDFileMeshes::New()); for(std::vector::const_iterator it=ms.begin();it!=ms.end();it++) { - MEDCouplingAutoRefCountObjectPtr mesh(ParaMEDFileMesh::ParaNew(iPart,nbOfParts,com,nfo,fileName,(*it))); + MCAuto mesh(ParaMEDFileMesh::ParaNew(iPart,nbOfParts,com,nfo,fileName,(*it))); ret->pushMesh(mesh); } return ret.retn(); diff --git a/src/ParaMEDMEM/DisjointDEC.cxx b/src/ParaMEDMEM/DisjointDEC.cxx index 365e8d6aa..cb14746d4 100644 --- a/src/ParaMEDMEM/DisjointDEC.cxx +++ b/src/ParaMEDMEM/DisjointDEC.cxx @@ -103,12 +103,12 @@ namespace MEDCoupling DEC::copyFrom(other); if(other._target_group) { - _target_group=other._target_group->deepCpy(); + _target_group=other._target_group->deepCopy(); _owns_groups=true; } if(other._source_group) { - _source_group=other._source_group->deepCpy(); + _source_group=other._source_group->deepCopy(); _owns_groups=true; } if (_source_group && _target_group) diff --git a/src/ParaMEDMEM/ElementLocator.cxx b/src/ParaMEDMEM/ElementLocator.cxx index df7828060..8a6aaa042 100644 --- a/src/ParaMEDMEM/ElementLocator.cxx +++ b/src/ParaMEDMEM/ElementLocator.cxx @@ -27,7 +27,7 @@ #include "ProcessorGroup.hxx" #include "MPIProcessorGroup.hxx" #include "MEDCouplingFieldDouble.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "DirectedBoundingBox.hxx" #include @@ -88,7 +88,7 @@ namespace MEDCoupling if (find(_distant_proc_ids.begin(), _distant_proc_ids.end(),rank)==_distant_proc_ids.end()) return; - MEDCouplingAutoRefCountObjectPtr elems; + MCAuto elems; #ifdef USE_DIRECTED_BB INTERP_KERNEL::DirectedBoundingBox dbb; double* distant_bb = _domain_bounding_boxes+rank*dbb.dataSize(_local_cell_mesh_space_dim); @@ -696,7 +696,7 @@ namespace MEDCoupling CommInterface comm; DataArrayInt *globalIds=_local_para_field.returnGlobalNumbering(); const int *globalIdsC=globalIds->getConstPointer(); - MEDCouplingAutoRefCountObjectPtr candidates=_local_para_field.getSupport()->getCellMesh()->findBoundaryNodes(); + MCAuto candidates=_local_para_field.getSupport()->getCellMesh()->findBoundaryNodes(); for(int *iter1=candidates->getPointer();iter1!=candidates->getPointer()+candidates->getNumberOfTuples();iter1++) (*iter1)=globalIdsC[*iter1]; std::set candidatesS(candidates->begin(),candidates->end()); diff --git a/src/ParaMEDMEM/InterpolationMatrix.cxx b/src/ParaMEDMEM/InterpolationMatrix.cxx index 06a51e42d..cfc7fc2c3 100644 --- a/src/ParaMEDMEM/InterpolationMatrix.cxx +++ b/src/ParaMEDMEM/InterpolationMatrix.cxx @@ -347,10 +347,10 @@ namespace MEDCoupling NatureOfField nature=elementLocator.getLocalNature(); switch(nature) { - case ConservativeVolumic: + case IntensiveMaximum: computeConservVolDenoW(elementLocator); break; - case Integral: + case ExtensiveMaximum: { if(!elementLocator.isM1DCorr()) computeIntegralDenoW(elementLocator); @@ -358,10 +358,10 @@ namespace MEDCoupling computeGlobConstraintDenoW(elementLocator); break; } - case IntegralGlobConstraint: + case ExtensiveConservation: computeGlobConstraintDenoW(elementLocator); break; - case RevIntegral: + case IntensiveConservation: { if(!elementLocator.isM1DCorr()) computeRevIntegralDenoW(elementLocator); @@ -380,10 +380,10 @@ namespace MEDCoupling NatureOfField nature=elementLocator.getLocalNature(); switch(nature) { - case ConservativeVolumic: + case IntensiveMaximum: computeConservVolDenoL(elementLocator); break; - case Integral: + case ExtensiveMaximum: { if(!elementLocator.isM1DCorr()) computeIntegralDenoL(elementLocator); @@ -391,11 +391,11 @@ namespace MEDCoupling computeConservVolDenoL(elementLocator); break; } - case IntegralGlobConstraint: - //this is not a bug doing like ConservativeVolumic + case ExtensiveConservation: + //this is not a bug doing like IntensiveMaximum computeConservVolDenoL(elementLocator); break; - case RevIntegral: + case IntensiveConservation: { if(!elementLocator.isM1DCorr()) computeRevIntegralDenoL(elementLocator); diff --git a/src/ParaMEDMEM/MPIProcessorGroup.cxx b/src/ParaMEDMEM/MPIProcessorGroup.cxx index 80dffe0f3..ee5b68ac9 100644 --- a/src/ParaMEDMEM/MPIProcessorGroup.cxx +++ b/src/ParaMEDMEM/MPIProcessorGroup.cxx @@ -218,7 +218,7 @@ namespace MEDCoupling } - MPIProcessorGroup *MPIProcessorGroup::deepCpy() const + MPIProcessorGroup *MPIProcessorGroup::deepCopy() const { return new MPIProcessorGroup(*this); } diff --git a/src/ParaMEDMEM/MPIProcessorGroup.hxx b/src/ParaMEDMEM/MPIProcessorGroup.hxx index db46a2b85..9b0845578 100644 --- a/src/ParaMEDMEM/MPIProcessorGroup.hxx +++ b/src/ParaMEDMEM/MPIProcessorGroup.hxx @@ -38,7 +38,7 @@ namespace MEDCoupling MPIProcessorGroup(const CommInterface& interface,int pstart, int pend, const MPI_Comm& world_comm=MPI_COMM_WORLD); MPIProcessorGroup(const MPIProcessorGroup& other); virtual ~MPIProcessorGroup(); - virtual MPIProcessorGroup *deepCpy() const; + virtual MPIProcessorGroup *deepCopy() const; virtual ProcessorGroup* fuse (const ProcessorGroup&) const; void intersect (ProcessorGroup&) { } int myRank() const; diff --git a/src/ParaMEDMEM/OverlapElementLocator.hxx b/src/ParaMEDMEM/OverlapElementLocator.hxx index 9cc75a4c1..c3d9a4260 100644 --- a/src/ParaMEDMEM/OverlapElementLocator.hxx +++ b/src/ParaMEDMEM/OverlapElementLocator.hxx @@ -25,7 +25,7 @@ #include "MEDCouplingNatureOfField.hxx" #include "MEDCouplingPointSet.hxx" #include "MEDCouplingMemArray.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include #include @@ -71,8 +71,8 @@ namespace MEDCoupling void sendMesh(int procId, const MEDCouplingPointSet *mesh, const DataArrayInt *idsToSend) const; void receiveMesh(int procId, MEDCouplingPointSet* &mesh, DataArrayInt *&ids) const; private: - typedef MEDCouplingAutoRefCountObjectPtr< MEDCouplingPointSet > AutoMCPointSet; - typedef MEDCouplingAutoRefCountObjectPtr< DataArrayInt > AutoDAInt; + typedef MCAuto< MEDCouplingPointSet > AutoMCPointSet; + typedef MCAuto< DataArrayInt > AutoDAInt; typedef std::pair Proc_SrcOrTgt; // a key indicating a proc ID and whether the data is for source mesh/field or target mesh/field static const int START_TAG_MESH_XCH; diff --git a/src/ParaMEDMEM/OverlapInterpolationMatrix.cxx b/src/ParaMEDMEM/OverlapInterpolationMatrix.cxx index 842ba5f96..c51c2bf6e 100644 --- a/src/ParaMEDMEM/OverlapInterpolationMatrix.cxx +++ b/src/ParaMEDMEM/OverlapInterpolationMatrix.cxx @@ -257,14 +257,14 @@ namespace MEDCoupling void OverlapInterpolationMatrix::computeSurfacesAndDeno() { - if(_target_field->getField()->getNature()==ConservativeVolumic) + if(_target_field->getField()->getNature()==IntensiveMaximum) _mapping.computeDenoConservativeVolumic(_target_field->getField()->getNumberOfTuplesExpected()); else - throw INTERP_KERNEL::Exception("OverlapDEC: Policy not implemented yet: only ConservativeVolumic!"); + throw INTERP_KERNEL::Exception("OverlapDEC: Policy not implemented yet: only IntensiveMaximum!"); // { -// if(_target_field->getField()->getNature()==RevIntegral) +// if(_target_field->getField()->getNature()==IntensiveConservation) // { -// MEDCouplingAutoRefCountObjectPtr f; +// MCAuto f; // int orient = getOrientation(); // From InterpolationOptions inheritance // if(orient == 2) // absolute areas // f = _target_support->getMeasureField(true); @@ -276,7 +276,7 @@ namespace MEDCoupling // _mapping.computeDenoRevIntegral(*f->getArray()); // } // else -// throw INTERP_KERNEL::Exception("OverlapDEC: Policy not implemented yet: only ConservativeVolumic and RevIntegral defined!"); +// throw INTERP_KERNEL::Exception("OverlapDEC: Policy not implemented yet: only IntensiveMaximum and IntensiveConservation defined!"); // } } diff --git a/src/ParaMEDMEM/OverlapMapping.cxx b/src/ParaMEDMEM/OverlapMapping.cxx index c0c966399..398a67b20 100644 --- a/src/ParaMEDMEM/OverlapMapping.cxx +++ b/src/ParaMEDMEM/OverlapMapping.cxx @@ -22,7 +22,7 @@ #include "MPIProcessorGroup.hxx" #include "MEDCouplingFieldDouble.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "InterpKernelAutoPtr.hxx" @@ -163,7 +163,7 @@ void OverlapMapping::prepare(const std::vector< int >& procsToSendField, int nbO } ///*! -// * Compute denominators for IntegralGlobConstraint interp. +// * Compute denominators for ExtensiveConservation interp. // * TO BE REVISED: needs another communication since some bits are held non locally // */ //void OverlapMapping::computeDenoGlobConstraint() @@ -251,7 +251,7 @@ void OverlapMapping::computeDenoConservativeVolumic(int nbOfTuplesTrg) { const std::vector< SparseDoubleVec >& mat=_the_matrix_st[i]; int curSrcId=_the_matrix_st_source_proc_id[i]; - map < int, MEDCouplingAutoRefCountObjectPtr >::const_iterator isItem1 = _sent_trg_ids.find(curSrcId); + map < int, MCAuto >::const_iterator isItem1 = _sent_trg_ids.find(curSrcId); int rowId=0; if(isItem1==_sent_trg_ids.end() || curSrcId==myProcId) // Local computation: simple, because rowId of mat are directly target cell ids. { @@ -274,7 +274,7 @@ void OverlapMapping::computeDenoConservativeVolumic(int nbOfTuplesTrg) int rowId=0; const std::vector< SparseDoubleVec >& mat=_the_matrix_st[i]; int curSrcId=_the_matrix_st_source_proc_id[i]; - map < int, MEDCouplingAutoRefCountObjectPtr >::const_iterator isItem1 = _sent_trg_ids.find(curSrcId); + map < int, MCAuto >::const_iterator isItem1 = _sent_trg_ids.find(curSrcId); std::vector< SparseDoubleVec >& denoM=_the_deno_st[i]; denoM.resize(mat.size()); if(isItem1==_sent_trg_ids.end() || curSrcId==myProcId)//item1 of step2 main algo. Simple, because rowId of mat are directly target ids. @@ -527,7 +527,7 @@ void OverlapMapping::multiply(const MEDCouplingFieldDouble *fieldInput, MEDCoupl else if(find(_proc_ids_to_send_vector_st.begin(),_proc_ids_to_send_vector_st.end(),procID)!=_proc_ids_to_send_vector_st.end()) { - MEDCouplingAutoRefCountObjectPtr vals; + MCAuto vals; if(_locator.isInMyTodoList(myProcID, procID)) { map >::const_iterator isItem11 = _src_ids_zip_comp.find(procID); @@ -539,7 +539,7 @@ void OverlapMapping::multiply(const MEDCouplingFieldDouble *fieldInput, MEDCoupl } else { - map < int, MEDCouplingAutoRefCountObjectPtr >::const_iterator isItem11 = _sent_src_ids.find( procID ); + map < int, MCAuto >::const_iterator isItem11 = _sent_src_ids.find( procID ); if (isItem11 == _sent_src_ids.end()) throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: SEND: unexpected end iterator in _sent_src_ids!"); vals=fieldInput->getArray()->selectByTupleId(*(*isItem11).second); @@ -685,7 +685,7 @@ void OverlapMapping::multiply(const MEDCouplingFieldDouble *fieldInput, MEDCoupl int newId=0; for(vector::const_iterator it=vec.begin();it!=vec.end();it++,newId++) revert_zip[*it]=newId; - map < int, MEDCouplingAutoRefCountObjectPtr >::const_iterator isItem24 = _sent_trg_ids.find(srcProcID); + map < int, MCAuto >::const_iterator isItem24 = _sent_trg_ids.find(srcProcID); if (isItem24 == _sent_trg_ids.end()) throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: MULTIPLY: unexpected end iterator in _sent_trg_ids!"); const DataArrayInt *tgrIdsDA = (*isItem24).second; diff --git a/src/ParaMEDMEM/OverlapMapping.hxx b/src/ParaMEDMEM/OverlapMapping.hxx index 70826f843..53f6f8730 100644 --- a/src/ParaMEDMEM/OverlapMapping.hxx +++ b/src/ParaMEDMEM/OverlapMapping.hxx @@ -21,7 +21,7 @@ #ifndef __OVERLAPMAPPING_HXX__ #define __OVERLAPMAPPING_HXX__ -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "OverlapElementLocator.hxx" #include @@ -83,10 +83,10 @@ namespace MEDCoupling * gives an old2new map for the local part of the source mesh that has been sent to proc#i, just based on the * bounding box computation (this is potentially a larger set than what is finally in the interp matrix). * Second member gives proc ID. */ - map < int, MEDCouplingAutoRefCountObjectPtr > _sent_src_ids; + map < int, MCAuto > _sent_src_ids; //! See _sent_src_ids. Same for target mesh. - map < int, MEDCouplingAutoRefCountObjectPtr > _sent_trg_ids; + map < int, MCAuto > _sent_trg_ids; /**! Vector of matrixes (partial interpolation ratios), result of the LOCAL interpolator run. * Indexing shared with _source_proc_id_st, and _target_proc_id_st. */ diff --git a/src/ParaMEDMEM/ProcessorGroup.hxx b/src/ParaMEDMEM/ProcessorGroup.hxx index 74767634b..327bdf7e8 100644 --- a/src/ParaMEDMEM/ProcessorGroup.hxx +++ b/src/ParaMEDMEM/ProcessorGroup.hxx @@ -44,7 +44,7 @@ namespace MEDCoupling _comm_interface(other.getCommInterface()),_proc_ids(other._proc_ids) { } ProcessorGroup (const CommInterface& interface, int start, int end); virtual ~ProcessorGroup() { } - virtual ProcessorGroup *deepCpy() const = 0; + virtual ProcessorGroup *deepCopy() const = 0; virtual ProcessorGroup* fuse (const ProcessorGroup&) const = 0; virtual void intersect (ProcessorGroup&) = 0; bool contains(int rank) const { return _proc_ids.find(rank)!=_proc_ids.end(); } diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_1.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_1.cxx index 50cbc3eb2..43d66789e 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_1.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_1.cxx @@ -100,7 +100,7 @@ void MPI2ParaMEDMEMTest::testBasicMPI2_1() value[0]=34+13*((double)grank); MEDCoupling::InterpKernelDEC dec(*source,*target); - parafield->getField()->setNature(ConservativeVolumic); + parafield->getField()->setNature(IntensiveMaximum); dec.setMethod("P0"); diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_2.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_2.cxx index 21f7ff932..387e38b0c 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_2.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_2.cxx @@ -102,7 +102,7 @@ void MPI2ParaMEDMEMTest::testBasicMPI2_1() parafield = new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo); MEDCoupling::InterpKernelDEC dec(*source,*target); - parafield->getField()->setNature(ConservativeVolumic); + parafield->getField()->setNature(IntensiveMaximum); dec.setMethod("P0"); dec.attachLocalField(parafield); diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_FabienAPI.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_FabienAPI.cxx index 5b5bbaebb..e619548c3 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_FabienAPI.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_FabienAPI.cxx @@ -72,7 +72,7 @@ void ParaMEDMEMTest::testFabienAPI1() MEDCoupling::ComponentTopology comptopo; paramesh=new ParaMESH(mesh,*dec->getSourceGrp(),"source mesh"); parafield=new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo); - parafield->getField()->setNature(ConservativeVolumic); + parafield->getField()->setNature(IntensiveMaximum); double *vals=parafield->getField()->getArray()->getPointer(); vals[0]=7.; } @@ -93,7 +93,7 @@ void ParaMEDMEMTest::testFabienAPI1() MEDCoupling::ComponentTopology comptopo; paramesh=new ParaMESH(mesh,*dec->getTargetGrp(),"target mesh"); parafield=new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo); - parafield->getField()->setNature(ConservativeVolumic); + parafield->getField()->setNature(IntensiveMaximum); } dec->attachLocalField(parafield); dec->synchronize(); @@ -157,7 +157,7 @@ void ParaMEDMEMTest::testFabienAPI2() MEDCoupling::ComponentTopology comptopo; paramesh=new ParaMESH(mesh,*dec->getSourceGrp(),"source mesh"); parafield=new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo); - parafield->getField()->setNature(ConservativeVolumic); + parafield->getField()->setNature(IntensiveMaximum); double *vals=parafield->getField()->getArray()->getPointer(); vals[0]=7.; } @@ -178,7 +178,7 @@ void ParaMEDMEMTest::testFabienAPI2() MEDCoupling::ComponentTopology comptopo; paramesh=new ParaMESH(mesh,*dec->getTargetGrp(),"target mesh"); parafield=new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo); - parafield->getField()->setNature(ConservativeVolumic); + parafield->getField()->setNature(IntensiveMaximum); } dec->attachLocalField(parafield); dec->synchronize(); diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_Gauthier1.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_Gauthier1.cxx index 52e05b95c..a77512fc5 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_Gauthier1.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_Gauthier1.cxx @@ -53,8 +53,8 @@ void afficheGauthier1(const ParaFIELD& field, const double *vals, int lgth) MEDCouplingUMesh *init_quadGauthier1(int is_master) { - MEDCouplingAutoRefCountObjectPtr m(MEDCouplingUMesh::New("champ_quad",2)); - MEDCouplingAutoRefCountObjectPtr coo(DataArrayDouble::New()); + MCAuto m(MEDCouplingUMesh::New("champ_quad",2)); + MCAuto coo(DataArrayDouble::New()); if(is_master) { const double dataCoo[24]={0,0,0,1,0,0,0,0,1,1,0,1,0,1,0,1,1,0,0,1,1,1,1,1}; @@ -76,8 +76,8 @@ MEDCouplingUMesh *init_quadGauthier1(int is_master) MEDCouplingUMesh *init_triangleGauthier1(int is_master) { - MEDCouplingAutoRefCountObjectPtr m(MEDCouplingUMesh::New("champ_triangle",2)); - MEDCouplingAutoRefCountObjectPtr coo(DataArrayDouble::New()); + MCAuto m(MEDCouplingUMesh::New("champ_triangle",2)); + MCAuto coo(DataArrayDouble::New()); if(is_master) { const double dataCoo[24]={0,0,0,1,0,0,0,0,1,1,0,1,0,1,0,1,1,0,0,1,1,1,1,1}; @@ -155,7 +155,7 @@ void ParaMEDMEMTest::testGauthier1() InterpKernelDEC dec_emetteur(emetteur_group, recepteur_group); MEDCoupling::ParaFIELD *champ_emetteur(0),*champ_recepteur(0); MEDCoupling::ParaMESH *paramesh(0); - MEDCouplingAutoRefCountObjectPtr mesh; + MCAuto mesh; dec_emetteur.setOrientation(2); if (send==0) { @@ -168,7 +168,7 @@ void ParaMEDMEMTest::testGauthier1() paramesh=new MEDCoupling::ParaMESH(mesh,recepteur_group.containsMyRank()?recepteur_group:emetteur_group,"emetteur mesh"); MEDCoupling::ComponentTopology comptopo; champ_emetteur=new MEDCoupling::ParaFIELD(ON_CELLS,ONE_TIME,paramesh,comptopo); - champ_emetteur->getField()->setNature(ConservativeVolumic); + champ_emetteur->getField()->setNature(IntensiveMaximum); champ_emetteur->setOwnSupport(true); if (rec==0) { @@ -180,7 +180,7 @@ void ParaMEDMEMTest::testGauthier1() } paramesh=new MEDCoupling::ParaMESH(mesh,recepteur_group.containsMyRank()?recepteur_group:emetteur_group,"recepteur mesh"); champ_recepteur=new MEDCoupling::ParaFIELD(ON_CELLS,ONE_TIME,paramesh,comptopo); - champ_recepteur->getField()->setNature(ConservativeVolumic); + champ_recepteur->getField()->setNature(IntensiveMaximum); champ_recepteur->setOwnSupport(true); if (cas=="emetteur") { @@ -279,8 +279,8 @@ void ParaMEDMEMTest::testGauthier2() if ( entree_chaude_group.containsMyRank()) { - MEDCouplingAutoRefCountObjectPtr mesh(MEDCouplingUMesh::New("mesh",2)); - MEDCouplingAutoRefCountObjectPtr arr(DataArrayDouble::New()); arr->alloc(63,3); + MCAuto mesh(MEDCouplingUMesh::New("mesh",2)); + MCAuto arr(DataArrayDouble::New()); arr->alloc(63,3); const double cooData[189]={0.,0.,0.,0.5,0.,0.,0.5,0.05,0.,0.,0.1,0.,0.5,0.1,0.,0.5,0.15,0.,0.,0.2,0.,0.5,0.2,0.,0.5,0.25,0.,0.,0.3,0.,0.5,0.3,0.,0.5,0.35,0.,0.,0.4,0.,0.5,0.4,0.,0.5,0.45,0.,0.,0.5,0.,0.5,0.5,0.,0.5,0.55,0.,0.,0.6,0.,0.5,0.6,0.,0.5,0.65,0.,0.,0.7,0.,0.5,0.7,0.,0.5,0.75,0.,0.,0.8,0.,0.5,0.8,0.,0.5,0.85,0.,0.,0.9,0.,0.5,0.9,0.,0.5,0.95,0.,1.,0.,0.,1.,0.1,0.,1.,0.2,0.,1.,0.3,0.,1.,0.4,0.,1.,0.5,0.,1.,0.6,0.,1.,0.7,0.,1.,0.8,0.,1.,0.9,0.,1.,0.05,0.,1.,0.15,0.,1.,0.25,0.,1.,0.35,0.,1.,0.45,0.,1.,0.55,0.,1.,0.65,0.,1.,0.75,0.,1.,0.85,0.,1.,0.95,0.,1.,1.,0.,0.,1.,0.,0.5,1.,0.,0.,0.05,0.,0.,0.15,0.,0.,0.25,0.,0.,0.35,0.,0.,0.45,0.,0.,0.55,0.,0.,0.65,0.,0.,0.75,0.,0.,0.85,0.,0.,0.95,0.}; std::copy(cooData,cooData+189,arr->getPointer()); mesh->setCoords(arr); @@ -288,12 +288,12 @@ void ParaMEDMEMTest::testGauthier2() const int conn[240]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,2,1,31,5,4,32,8,7,33,11,10,34,14,13,35,17,16,36,20,19,37,23,22,38,26,25,39,29,28,30,40,2,31,41,5,32,42,8,33,43,11,34,44,14,35,45,17,36,46,20,37,47,23,38,48,26,39,49,29,31,2,40,32,5,41,33,8,42,34,11,43,35,14,44,36,17,45,37,20,46,38,23,47,39,26,48,50,29,49,3,2,4,6,5,7,9,8,10,12,11,13,15,14,16,18,17,19,21,20,22,24,23,25,27,26,28,51,29,52,31,4,2,32,7,5,33,10,8,34,13,11,35,16,14,36,19,17,37,22,20,38,25,23,39,28,26,50,52,29,0,2,53,3,5,54,6,8,55,9,11,56,12,14,57,15,17,58,18,20,59,21,23,60,24,26,61,27,29,62,3,53,2,6,54,5,9,55,8,12,56,11,15,57,14,18,58,17,21,59,20,24,60,23,27,61,26,51,62,29}; for(int i=0;i<80;i++) mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn+3*i); - MEDCouplingAutoRefCountObjectPtr f(MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME)); + MCAuto f(MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME)); const double valsOfField[189]={0.,0.,0.,0.,0.,0.,0.,0.,0.05,0.,0.,0.1,0.,0.,0.1,0.,0.,0.15,0.,0.,0.2,0.,0.,0.2,0.,0.,0.25,0.,0.,0.3,0.,0.,0.3,0.,0.,0.35,0.,0.,0.4,0.,0.,0.4,0.,0.,0.45,0.,0.,0.5,0.,0.,0.5,0.,0.,0.55,0.,0.,0.6,0.,0.,0.6,0.,0.,0.65,0.,0.,0.7,0.,0.,0.7,0.,0.,0.75,0.,0.,0.8,0.,0.,0.8,0.,0.,0.85,0.,0.,0.9,0.,0.,0.9,0.,0.,0.95,0.,0.,0.,0.,0.,0.1,0.,0.,0.2,0.,0.,0.3,0.,0.,0.4,0.,0.,0.5,0.,0.,0.6,0.,0.,0.7,0.,0.,0.8,0.,0.,0.9,0.,0.,0.05,0.,0.,0.15,0.,0.,0.25,0.,0.,0.35,0.,0.,0.45,0.,0.,0.55,0.,0.,0.65,0.,0.,0.75,0.,0.,0.85,0.,0.,0.95,0.,0.,1.,0.,0.,1.,0.,0.,1.,0.,0.,0.05,0.,0.,0.15,0.,0.,0.25,0.,0.,0.35,0.,0.,0.45,0.,0.,0.55,0.,0.,0.65,0.,0.,0.75,0.,0.,0.85,0.,0.,0.95}; f->setMesh(mesh); f->setName("VITESSE_P1_OUT"); arr=DataArrayDouble::New(); arr->alloc(63,3); std::copy(valsOfField,valsOfField+189,arr->getPointer()); - f->setArray(arr); f->setNature(ConservativeVolumic); + f->setArray(arr); f->setNature(IntensiveMaximum); MEDCoupling::ParaMESH *paramesh(new MEDCoupling::ParaMESH(mesh,entree_chaude_group,"emetteur mesh")); vitesse=new MEDCoupling::ParaFIELD(f,paramesh,entree_chaude_group); vitesse->setOwnSupport(true); @@ -301,8 +301,8 @@ void ParaMEDMEMTest::testGauthier2() } else { - MEDCouplingAutoRefCountObjectPtr mesh(MEDCouplingUMesh::New("mesh",2)); - MEDCouplingAutoRefCountObjectPtr arr(DataArrayDouble::New()); arr->alloc(22,3); + MCAuto mesh(MEDCouplingUMesh::New("mesh",2)); + MCAuto arr(DataArrayDouble::New()); arr->alloc(22,3); const double cooData[66]={0,0,0,1,0,0,0,0.1,0,1,0.1,0,0,0.2,0,1,0.2,0,0,0.3,0,1,0.3,0,0,0.4,0,1,0.4,0,0,0.5,0,1,0.5,0,0,0.6,0,1,0.6,0,0,0.7,0,1,0.7,0,0,0.8,0,1,0.8,0,0,0.9,0,1,0.9,0,0,1,0,1,1,0}; std::copy(cooData,cooData+66,arr->getPointer()); mesh->setCoords(arr); @@ -310,10 +310,10 @@ void ParaMEDMEMTest::testGauthier2() const int conn[40]={0,1,3,2,2,3,5,4,4,5,7,6,6,7,9,8,8,9,11,10,10,11,13,12,12,13,15,14,14,15,17,16,16,17,19,18,18,19,21,20}; for(int i=0;i<10;i++) mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+4*i); - MEDCouplingAutoRefCountObjectPtr f(MEDCouplingFieldDouble::New(type==0?ON_CELLS:ON_NODES,ONE_TIME)); + MCAuto f(MEDCouplingFieldDouble::New(type==0?ON_CELLS:ON_NODES,ONE_TIME)); f->setMesh(mesh); f->setName("vitesse_in_chaude"); arr=DataArrayDouble::New(); arr->alloc(f->getNumberOfTuplesExpected()*3); arr->fillWithZero(); arr->rearrange(3); - f->setArray(arr); f->setNature(ConservativeVolumic); + f->setArray(arr); f->setNature(IntensiveMaximum); MEDCoupling::ParaMESH *paramesh(new MEDCoupling::ParaMESH(mesh,Genepi_group,"recepteur mesh")); vitesse=new MEDCoupling::ParaFIELD(f,paramesh,Genepi_group); vitesse->setOwnSupport(true); @@ -418,7 +418,7 @@ void ParaMEDMEMTest::testGauthier3() InterpKernelDEC& dec_emetteur=decu[0]; MEDCoupling::ParaFIELD *champ_emetteur(0),*champ_recepteur(0); MEDCoupling::ParaMESH *paramesh(0); - MEDCouplingAutoRefCountObjectPtr mesh; + MCAuto mesh; dec_emetteur.setOrientation(2); if (send==0) { @@ -431,7 +431,7 @@ void ParaMEDMEMTest::testGauthier3() paramesh=new MEDCoupling::ParaMESH(mesh,recepteur_group.containsMyRank()?recepteur_group:emetteur_group,"emetteur mesh"); MEDCoupling::ComponentTopology comptopo; champ_emetteur=new MEDCoupling::ParaFIELD(ON_CELLS,ONE_TIME,paramesh,comptopo); - champ_emetteur->getField()->setNature(ConservativeVolumic); + champ_emetteur->getField()->setNature(IntensiveMaximum); champ_emetteur->setOwnSupport(true); if (rec==0) { @@ -443,7 +443,7 @@ void ParaMEDMEMTest::testGauthier3() } paramesh=new MEDCoupling::ParaMESH(mesh,recepteur_group.containsMyRank()?recepteur_group:emetteur_group,"recepteur mesh"); champ_recepteur=new MEDCoupling::ParaFIELD(ON_CELLS,ONE_TIME,paramesh,comptopo); - champ_recepteur->getField()->setNature(ConservativeVolumic); + champ_recepteur->getField()->setNature(IntensiveMaximum); champ_recepteur->setOwnSupport(true); if (cas=="emetteur") { @@ -612,7 +612,7 @@ void ParaMEDMEMTest::testGauthier4() //test 1 - primaire -> secondaire MEDCoupling::InterpKernelDEC dec(*source_group,*target_group); dec.setIntersectionType(INTERP_KERNEL::PointLocator); - parafield->getField()->setNature(ConservativeVolumic);//very important + parafield->getField()->setNature(IntensiveMaximum);//very important if (source_group->containsMyRank()) { dec.setMethod("P1"); diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_ICoco.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_ICoco.cxx index 0a15f5589..5dd26f4f1 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_ICoco.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_ICoco.cxx @@ -67,8 +67,8 @@ void affiche(const ParaFIELD& field) MEDCouplingUMesh *init_quad() { - MEDCouplingAutoRefCountObjectPtr m(MEDCouplingUMesh::New("champ_quad",2)); - MEDCouplingAutoRefCountObjectPtr coo(DataArrayDouble::New()); + MCAuto m(MEDCouplingUMesh::New("champ_quad",2)); + MCAuto coo(DataArrayDouble::New()); const double dataCoo[24]={0.,0.,0.,1.,0.,0.,0.,0.,1.,1.,0.,1.,0.,1e-05,0.,1.,1e-05,0.,0.,1e-05,1.,1.,1e-05,1.}; coo->alloc(8,3); std::copy(dataCoo,dataCoo+24,coo->getPointer()); @@ -82,8 +82,8 @@ MEDCouplingUMesh *init_quad() MEDCouplingUMesh *init_triangle() { - MEDCouplingAutoRefCountObjectPtr m(MEDCouplingUMesh::New("champ_triangle",2)); - MEDCouplingAutoRefCountObjectPtr coo(DataArrayDouble::New()); + MCAuto m(MEDCouplingUMesh::New("champ_triangle",2)); + MCAuto coo(DataArrayDouble::New()); const double dataCoo[24]={0.,0.,0.,1.,0.,0.,0.,0.,1.,1.,0.,1.,0.,1e-05,0.,1.,1e-05,0.,0.,1e-05,1.,1.,1e-05,1.}; coo->alloc(8,3); std::copy(dataCoo,dataCoo+24,coo->getPointer()); @@ -126,21 +126,21 @@ void ParaMEDMEMTest::testICoco1() MEDCoupling::ParaMESH *paramesh(0); if (cas=="emetteur") { - MEDCouplingAutoRefCountObjectPtr mesh_emetteur(init_triangle()); + MCAuto mesh_emetteur(init_triangle()); paramesh=new MEDCoupling::ParaMESH(mesh_emetteur,emetteur_group,"emetteur mesh"); MEDCoupling::ComponentTopology comptopo; champ_emetteur=new MEDCoupling::ParaFIELD(ON_CELLS,ONE_TIME,paramesh,comptopo); - champ_emetteur->getField()->setNature(ConservativeVolumic); + champ_emetteur->getField()->setNature(IntensiveMaximum); champ_emetteur->setOwnSupport(true); champ_emetteur->getField()->getArray()->fillWithValue(1.); } else { - MEDCouplingAutoRefCountObjectPtr mesh_recepteur(init_quad()); + MCAuto mesh_recepteur(init_quad()); paramesh=new MEDCoupling::ParaMESH(mesh_recepteur,recepteur_group,"recepteur mesh"); MEDCoupling::ComponentTopology comptopo; champ_recepteur=new MEDCoupling::ParaFIELD(ON_CELLS,ONE_TIME,paramesh,comptopo); - champ_recepteur->getField()->setNature(ConservativeVolumic); + champ_recepteur->getField()->setNature(IntensiveMaximum); champ_recepteur->setOwnSupport(true); } diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx index e7668b546..f826e7674 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx @@ -149,7 +149,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_1D() MEDCoupling::ComponentTopology comptopo; parafieldP0 = new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo); double *valueP0=parafieldP0->getField()->getArray()->getPointer(); - parafieldP0->getField()->setNature(ConservativeVolumic); + parafieldP0->getField()->setNature(IntensiveMaximum); if(rank==0) { valueP0[0]=7.; valueP0[1]=8.; @@ -198,7 +198,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_1D() } MEDCoupling::ComponentTopology comptopo; parafieldP0 = new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo); - parafieldP0->getField()->setNature(ConservativeVolumic); + parafieldP0->getField()->setNature(IntensiveMaximum); } // test 1 MEDCoupling::InterpKernelDEC dec(*source_group,*target_group); @@ -338,7 +338,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_2DCurve() MEDCoupling::ComponentTopology comptopo; parafieldP0 = new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo); double *valueP0=parafieldP0->getField()->getArray()->getPointer(); - parafieldP0->getField()->setNature(ConservativeVolumic); + parafieldP0->getField()->setNature(IntensiveMaximum); if(rank==0) { valueP0[0]=7.; valueP0[1]=8.; @@ -387,7 +387,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_2DCurve() } MEDCoupling::ComponentTopology comptopo; parafieldP0 = new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo); - parafieldP0->getField()->setNature(ConservativeVolumic); + parafieldP0->getField()->setNature(IntensiveMaximum); } // test 1 MEDCoupling::InterpKernelDEC dec(*source_group,*target_group); @@ -526,7 +526,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_2D_(const char *srcMeth, const char *ta if(srcM=="P0") { parafield = new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo); - parafield->getField()->setNature(ConservativeVolumic); + parafield->getField()->setNature(IntensiveMaximum); } else parafield = new ParaFIELD(ON_NODES,NO_TIME,paramesh, comptopo); @@ -563,7 +563,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_2D_(const char *srcMeth, const char *ta if(targetM=="P0") { parafield = new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo); - parafield->getField()->setNature(ConservativeVolumic); + parafield->getField()->setNature(IntensiveMaximum); } else parafield = new ParaFIELD(ON_NODES,NO_TIME,paramesh, comptopo); @@ -730,7 +730,7 @@ void ParaMEDMEMTest::testInterpKernelDEC2_2D_(const char *srcMeth, const char *t array->alloc(mcfield->getNumberOfTuples(),1); mcfield->setArray(array); array->decrRef(); - mcfield->setNature(ConservativeVolumic); + mcfield->setNature(IntensiveMaximum); } else { @@ -773,7 +773,7 @@ void ParaMEDMEMTest::testInterpKernelDEC2_2D_(const char *srcMeth, const char *t array->alloc(mcfield->getNumberOfTuples(),1); mcfield->setArray(array); array->decrRef(); - mcfield->setNature(ConservativeVolumic); + mcfield->setNature(IntensiveMaximum); } else { @@ -899,7 +899,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_3D_(const char *srcMeth, const char *ta if(srcM=="P0") { parafield = new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo); - parafield->getField()->setNature(ConservativeVolumic); + parafield->getField()->setNature(IntensiveMaximum); } else parafield = new ParaFIELD(ON_NODES,NO_TIME,paramesh, comptopo); @@ -936,7 +936,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_3D_(const char *srcMeth, const char *ta if(targetM=="P0") { parafield = new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo); - parafield->getField()->setNature(ConservativeVolumic); + parafield->getField()->setNature(IntensiveMaximum); } else parafield = new ParaFIELD(ON_NODES,NO_TIME,paramesh, comptopo); @@ -1165,7 +1165,7 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P0() } //test 1 - Conservative volumic MEDCoupling::InterpKernelDEC dec(*source_group,*target_group); - parafield->getField()->setNature(ConservativeVolumic); + parafield->getField()->setNature(IntensiveMaximum); if (source_group->containsMyRank()) { dec.setMethod("P0"); @@ -1186,9 +1186,9 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P0() CPPUNIT_ASSERT_DOUBLES_EQUAL(expected[0],res[0],1e-13); CPPUNIT_ASSERT_DOUBLES_EQUAL(expected[1],res[1],1e-13); } - //test 2 - Integral + //test 2 - ExtensiveMaximum MEDCoupling::InterpKernelDEC dec2(*source_group,*target_group); - parafield->getField()->setNature(Integral); + parafield->getField()->setNature(ExtensiveMaximum); if (source_group->containsMyRank()) { dec2.setMethod("P0"); @@ -1209,9 +1209,9 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P0() CPPUNIT_ASSERT_DOUBLES_EQUAL(expected[0],res[0],1e-13); CPPUNIT_ASSERT_DOUBLES_EQUAL(expected[1],res[1],1e-13); } - //test 3 - Integral with global constraint + //test 3 - ExtensiveMaximum with global constraint MEDCoupling::InterpKernelDEC dec3(*source_group,*target_group); - parafield->getField()->setNature(IntegralGlobConstraint); + parafield->getField()->setNature(ExtensiveConservation); if (source_group->containsMyRank()) { dec3.setMethod("P0"); @@ -1232,9 +1232,9 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P0() CPPUNIT_ASSERT_DOUBLES_EQUAL(expected[0],res[0],1e-13); CPPUNIT_ASSERT_DOUBLES_EQUAL(expected[1],res[1],1e-13); } - //test 4 - RevIntegral + //test 4 - IntensiveConservation MEDCoupling::InterpKernelDEC dec4(*source_group,*target_group); - parafield->getField()->setNature(RevIntegral); + parafield->getField()->setNature(IntensiveConservation); if (source_group->containsMyRank()) { dec4.setMethod("P0"); @@ -1257,7 +1257,7 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P0() } //test 5 - Conservative volumic reversed MEDCoupling::InterpKernelDEC dec5(*source_group,*target_group); - parafield->getField()->setNature(ConservativeVolumic); + parafield->getField()->setNature(IntensiveMaximum); if (source_group->containsMyRank()) { dec5.setMethod("P0"); @@ -1282,9 +1282,9 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P0() res[1]=toSet[1]; dec5.sendData(); } - //test 6 - Integral reversed + //test 6 - ExtensiveMaximum reversed MEDCoupling::InterpKernelDEC dec6(*source_group,*target_group); - parafield->getField()->setNature(Integral); + parafield->getField()->setNature(ExtensiveMaximum); if (source_group->containsMyRank()) { dec6.setMethod("P0"); @@ -1309,9 +1309,9 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P0() res[1]=toSet[1]; dec6.sendData(); } - //test 7 - Integral with global constraint reversed + //test 7 - ExtensiveMaximum with global constraint reversed MEDCoupling::InterpKernelDEC dec7(*source_group,*target_group); - parafield->getField()->setNature(IntegralGlobConstraint); + parafield->getField()->setNature(ExtensiveConservation); if (source_group->containsMyRank()) { dec7.setMethod("P0"); @@ -1336,9 +1336,9 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P0() res[1]=toSet[1]; dec7.sendData(); } - //test 8 - Integral with RevIntegral reversed + //test 8 - ExtensiveMaximum with IntensiveConservation reversed MEDCoupling::InterpKernelDEC dec8(*source_group,*target_group); - parafield->getField()->setNature(RevIntegral); + parafield->getField()->setNature(IntensiveConservation); if (source_group->containsMyRank()) { dec8.setMethod("P0"); @@ -1443,8 +1443,8 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P1P1P0() parafieldP1 = new ParaFIELD(ON_NODES,NO_TIME,paramesh, comptopo); double *valueP0=parafieldP0->getField()->getArray()->getPointer(); double *valueP1=parafieldP1->getField()->getArray()->getPointer(); - parafieldP0->getField()->setNature(ConservativeVolumic); - parafieldP1->getField()->setNature(ConservativeVolumic); + parafieldP0->getField()->setNature(IntensiveMaximum); + parafieldP1->getField()->setNature(IntensiveMaximum); if(rank==0) { valueP0[0]=31.; @@ -1527,8 +1527,8 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P1P1P0() MEDCoupling::ComponentTopology comptopo; parafieldP0 = new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo); parafieldP1 = new ParaFIELD(ON_NODES,NO_TIME,paramesh, comptopo); - parafieldP0->getField()->setNature(ConservativeVolumic); - parafieldP1->getField()->setNature(ConservativeVolumic); + parafieldP0->getField()->setNature(IntensiveMaximum); + parafieldP1->getField()->setNature(IntensiveMaximum); } // test 1 - P0 P1 MEDCoupling::InterpKernelDEC dec(*source_group,*target_group); @@ -1654,7 +1654,7 @@ void ParaMEDMEMTest::testInterpKernelDEC2DM1D_P0P0() MEDCoupling::ComponentTopology comptopo; paramesh=new ParaMESH(mesh,*source_group,"source mesh"); parafield=new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo); - parafield->getField()->setNature(ConservativeVolumic); + parafield->getField()->setNature(IntensiveMaximum); double *vals=parafield->getField()->getArray()->getPointer(); if(rank==0) { vals[0]=7.; vals[1]=8.; } @@ -1667,7 +1667,7 @@ void ParaMEDMEMTest::testInterpKernelDEC2DM1D_P0P0() MEDCoupling::ComponentTopology comptopo; paramesh=new ParaMESH(mesh,*target_group,"target mesh"); parafield=new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo); - parafield->getField()->setNature(ConservativeVolumic); + parafield->getField()->setNature(IntensiveMaximum); } MEDCoupling::InterpKernelDEC dec(*source_group,*target_group); if(source_group->containsMyRank()) @@ -1704,7 +1704,7 @@ void ParaMEDMEMTest::testInterpKernelDEC2DM1D_P0P0() } MEDCoupling::InterpKernelDEC dec2(*source_group,*target_group); dec2.setMethod("P0"); - parafield->getField()->setNature(IntegralGlobConstraint); + parafield->getField()->setNature(ExtensiveConservation); if(source_group->containsMyRank()) { double *vals=parafield->getField()->getArray()->getPointer(); @@ -1741,7 +1741,7 @@ void ParaMEDMEMTest::testInterpKernelDEC2DM1D_P0P0() // MEDCoupling::InterpKernelDEC dec3(*source_group,*target_group); dec3.setMethod("P0"); - parafield->getField()->setNature(Integral); + parafield->getField()->setNature(ExtensiveMaximum); if(source_group->containsMyRank()) { double *vals=parafield->getField()->getArray()->getPointer(); @@ -1778,7 +1778,7 @@ void ParaMEDMEMTest::testInterpKernelDEC2DM1D_P0P0() // MEDCoupling::InterpKernelDEC dec4(*source_group,*target_group); dec4.setMethod("P0"); - parafield->getField()->setNature(RevIntegral); + parafield->getField()->setNature(IntensiveConservation); if(source_group->containsMyRank()) { double *vals=parafield->getField()->getArray()->getPointer(); @@ -1876,7 +1876,7 @@ void ParaMEDMEMTest::testInterpKernelDECPartialProcs() MEDCoupling::ComponentTopology comptopo; paramesh=new ParaMESH(mesh,*source_group,"source mesh"); parafield=new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo); - parafield->getField()->setNature(ConservativeVolumic); + parafield->getField()->setNature(IntensiveMaximum); double *vals=parafield->getField()->getArray()->getPointer(); vals[0]=7.; dec=new MEDCoupling::InterpKernelDEC(*source_group,*target_group); @@ -1902,7 +1902,7 @@ void ParaMEDMEMTest::testInterpKernelDECPartialProcs() MEDCoupling::ComponentTopology comptopo; paramesh=new ParaMESH(mesh,*target_group,"target mesh"); parafield=new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo); - parafield->getField()->setNature(ConservativeVolumic); + parafield->getField()->setNature(IntensiveMaximum); dec=new MEDCoupling::InterpKernelDEC(*source_group,*target_group); dec->attachLocalField(parafield); dec->synchronize(); @@ -1978,7 +1978,7 @@ void ParaMEDMEMTest::testInterpKernelDEC3DSurfEmptyBBox() MEDCoupling::ComponentTopology comptopo; parafieldP0 = new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo); double *valueP0=parafieldP0->getField()->getArray()->getPointer(); - parafieldP0->getField()->setNature(ConservativeVolumic); + parafieldP0->getField()->setNature(IntensiveMaximum); valueP0[0]=7.; valueP0[1]=8.; } else @@ -2016,7 +2016,7 @@ void ParaMEDMEMTest::testInterpKernelDEC3DSurfEmptyBBox() } MEDCoupling::ComponentTopology comptopo; parafieldP0 = new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo); - parafieldP0->getField()->setNature(ConservativeVolumic); + parafieldP0->getField()->setNature(IntensiveMaximum); } // test 1 MEDCoupling::InterpKernelDEC dec(*source_group,*target_group); @@ -2157,7 +2157,7 @@ void ParaMEDMEMTest::testAsynchronousInterpKernelDEC_2D(double dtA, double tmaxA if(srcM=="P0") { parafield = new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo); - parafield->getField()->setNature(ConservativeVolumic);//InvertIntegral);//ConservativeVolumic); + parafield->getField()->setNature(IntensiveMaximum);//InvertIntegral);//IntensiveMaximum); } else parafield = new ParaFIELD(ON_NODES,NO_TIME,paramesh, comptopo); @@ -2198,7 +2198,7 @@ void ParaMEDMEMTest::testAsynchronousInterpKernelDEC_2D(double dtA, double tmaxA if(targetM=="P0") { parafield = new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo); - parafield->getField()->setNature(ConservativeVolumic);//InvertIntegral);//ConservativeVolumic); + parafield->getField()->setNature(IntensiveMaximum);//InvertIntegral);//IntensiveMaximum); } else parafield = new ParaFIELD(ON_NODES,NO_TIME,paramesh, comptopo); diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_OverlapDEC.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_OverlapDEC.cxx index cb2e69f67..5dc19d8db 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_OverlapDEC.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_OverlapDEC.cxx @@ -35,7 +35,7 @@ using namespace std; -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "MEDLoader.hxx" #include "MEDLoaderBase.hxx" #include "MEDCouplingFieldDouble.hxx" @@ -44,9 +44,9 @@ using namespace std; using namespace MEDCoupling; -typedef MEDCouplingAutoRefCountObjectPtr MUMesh; -typedef MEDCouplingAutoRefCountObjectPtr MFDouble; -typedef MEDCouplingAutoRefCountObjectPtr DADouble; +typedef MCAuto MUMesh; +typedef MCAuto MFDouble; +typedef MCAuto DADouble; //void ParaMEDMEMTest::testOverlapDEC_LMEC_seq() //{ @@ -68,7 +68,7 @@ typedef MEDCouplingAutoRefCountObjectPtr DADouble; // DataArrayDouble * dad = DataArrayDouble::New(); dad->alloc(src_mesh->getNumberOfCells(),1); // dad->fillWithValue(1.0); // srcField->setArray(dad); -// srcField->setNature(ConservativeVolumic); +// srcField->setNature(IntensiveMaximum); // // MEDCouplingRemapper remap; // remap.setOrientation(2); // always consider surface intersections as absolute areas. @@ -138,18 +138,18 @@ typedef MEDCouplingAutoRefCountObjectPtr DADouble; // DataArrayDouble * dad = DataArrayDouble::New(); dad->alloc(src_mesh->getNumberOfCells(),1); // dad->fillWithValue(1.0); // srcField->setArray(dad); -// srcField->setNature(ConservativeVolumic); +// srcField->setNature(IntensiveMaximum); // // ComponentTopology comptopo; // parameshS = new ParaMESH(src_mesh,*dec.getGroup(),"source mesh"); // parafieldS = new ParaFIELD(ON_CELLS,ONE_TIME,parameshS,comptopo); -// parafieldS->getField()->setNature(ConservativeVolumic);//IntegralGlobConstraint +// parafieldS->getField()->setNature(IntensiveMaximum);//ExtensiveConservation // parafieldS->getField()->setArray(dad); // // // **** TARGET // parameshT=new ParaMESH(tgt_mesh,*dec.getGroup(),"target mesh"); // parafieldT=new ParaFIELD(ON_CELLS,ONE_TIME,parameshT,comptopo); -// parafieldT->getField()->setNature(ConservativeVolumic);//IntegralGlobConstraint +// parafieldT->getField()->setNature(IntensiveMaximum);//ExtensiveConservation // parafieldT->getField()->getArray()->fillWithValue(1.0e300); //// valsT[0]=7.; // } @@ -360,10 +360,10 @@ void prepareData2(int rank, ProcessorGroup * grp, NatureOfField nature, if(rank==0) { const double tr1[] = {1.5, 0.0}; - MEDCouplingUMesh *meshS_1 = static_cast(meshS_0->deepCpy()); + MEDCouplingUMesh *meshS_1 = static_cast(meshS_0->deepCopy()); meshS_1->translate(tr1); const double tr2[] = {3.0, 0.0}; - MEDCouplingUMesh *meshS_2 = static_cast(meshS_0->deepCpy()); + MEDCouplingUMesh *meshS_2 = static_cast(meshS_0->deepCopy()); meshS_2->translate(tr2); std::vector vec; @@ -390,7 +390,7 @@ void prepareData2(int rank, ProcessorGroup * grp, NatureOfField nature, // const double tr3[] = {0.0, -1.5}; - MEDCouplingUMesh *meshT_3 = static_cast(meshT_0->deepCpy()); + MEDCouplingUMesh *meshT_3 = static_cast(meshT_0->deepCopy()); meshT_3->translate(tr3); vec.clear(); vec.push_back(meshT_0);vec.push_back(meshT_3); @@ -405,10 +405,10 @@ void prepareData2(int rank, ProcessorGroup * grp, NatureOfField nature, if(rank==1) { const double tr3[] = {0.0, -1.5}; - MEDCouplingUMesh *meshS_3 = static_cast(meshS_0->deepCpy()); + MEDCouplingUMesh *meshS_3 = static_cast(meshS_0->deepCopy()); meshS_3->translate(tr3); const double tr4[] = {1.5, -1.5}; - MEDCouplingUMesh *meshS_4 = static_cast(meshS_0->deepCpy()); + MEDCouplingUMesh *meshS_4 = static_cast(meshS_0->deepCopy()); meshS_4->translate(tr4); std::vector vec; @@ -429,13 +429,13 @@ void prepareData2(int rank, ProcessorGroup * grp, NatureOfField nature, // const double tr5[] = {1.5, 0.0}; - MEDCouplingUMesh *meshT_1 = static_cast(meshT_0->deepCpy()); + MEDCouplingUMesh *meshT_1 = static_cast(meshT_0->deepCopy()); meshT_1->translate(tr5); const double tr6[] = {3.0, 0.0}; - MEDCouplingUMesh *meshT_2 = static_cast(meshT_0->deepCpy()); + MEDCouplingUMesh *meshT_2 = static_cast(meshT_0->deepCopy()); meshT_2->translate(tr6); const double tr7[] = {1.5, -1.5}; - MEDCouplingUMesh *meshT_4 = static_cast(meshT_0->deepCpy()); + MEDCouplingUMesh *meshT_4 = static_cast(meshT_0->deepCopy()); meshT_4->translate(tr7); vec.clear(); @@ -481,7 +481,7 @@ void testOverlapDEC_generic(int workSharingAlgo, double bbAdj) OverlapDEC dec(procs); MEDCouplingFieldDouble * mcfieldS=0, *mcfieldT=0; - prepareData1(rank, ConservativeVolumic, mcfieldS, mcfieldT); + prepareData1(rank, IntensiveMaximum, mcfieldS, mcfieldT); // See comment in the caller: dec.setBoundingBoxAdjustmentAbs(bbAdj); @@ -580,7 +580,7 @@ void ParaMEDMEMTest::testOverlapDEC3() ParaMESH* parameshS=0, *parameshT=0; ParaFIELD* parafieldS=0, *parafieldT=0; - prepareData2(rank, grp, ConservativeVolumic, meshS, meshT, parameshS, parameshT, parafieldS, parafieldT); + prepareData2(rank, grp, IntensiveMaximum, meshS, meshT, parameshS, parameshT, parafieldS, parafieldT); dec.attachSourceLocalField(parafieldS); dec.attachTargetLocalField(parafieldT); @@ -641,7 +641,7 @@ void ParaMEDMEMTest::testOverlapDEC4() ParaFIELD* parafieldS=0, *parafieldT=0; // As before, except than one of the source cell is removed, and that the field now has 2 components - prepareData2(rank, grp, ConservativeVolumic, meshS, meshT, parameshS, parameshT, parafieldS, parafieldT, + prepareData2(rank, grp, IntensiveMaximum, meshS, meshT, parameshS, parameshT, parafieldS, parafieldT, true, 2); // if (rank == 1) // { diff --git a/src/ParaMEDMEM_Swig/test_InterpKernelDEC.py b/src/ParaMEDMEM_Swig/test_InterpKernelDEC.py index a15b6f662..b98437e9d 100755 --- a/src/ParaMEDMEM_Swig/test_InterpKernelDEC.py +++ b/src/ParaMEDMEM_Swig/test_InterpKernelDEC.py @@ -64,7 +64,7 @@ class ParaMEDMEMBasicsTest(unittest.TestCase): paramesh=ParaMESH(mesh,source_group,"source mesh") comptopo = ComponentTopology() parafield = ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo) - parafield.getField().setNature(ConservativeVolumic) + parafield.getField().setNature(IntensiveMaximum) nb_local=mesh.getNumberOfCells() value = [1.0]*nb_local parafield.getField().setValues(value) @@ -79,7 +79,7 @@ class ParaMEDMEMBasicsTest(unittest.TestCase): paramesh=ParaMESH(mesh,target_group,"target mesh") comptopo = ComponentTopology() parafield = ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo) - parafield.getField().setNature(ConservativeVolumic) + parafield.getField().setNature(IntensiveMaximum) nb_local=mesh.getNumberOfCells() value = [0.0]*nb_local parafield.getField().setValues(value) diff --git a/src/ParaMEDMEM_Swig/test_StructuredCoincidentDEC.py b/src/ParaMEDMEM_Swig/test_StructuredCoincidentDEC.py index 171c25fed..e467bc6a2 100755 --- a/src/ParaMEDMEM_Swig/test_StructuredCoincidentDEC.py +++ b/src/ParaMEDMEM_Swig/test_StructuredCoincidentDEC.py @@ -67,7 +67,7 @@ class ParaMEDMEMBasicsTest2(unittest.TestCase): paramesh=ParaMESH(mesh,source_group,"source mesh") comptopo=ComponentTopology(6) parafield=ParaFIELD(ON_CELLS,NO_TIME,paramesh,comptopo) - parafield.getField().setNature(ConservativeVolumic) + parafield.getField().setNature(IntensiveMaximum) nb_local=mesh.getNumberOfCells() global_numbering=paramesh.getGlobalNumberingCell2() value = [] @@ -90,7 +90,7 @@ class ParaMEDMEMBasicsTest2(unittest.TestCase): paramesh=ParaMESH(mesh, self_group, "target mesh") comptopo=ComponentTopology(6,target_group) parafield=ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo) - parafield.getField().setNature(ConservativeVolumic) + parafield.getField().setNature(IntensiveMaximum) nb_local=mesh.getNumberOfCells() value = [0.0]*(nb_local*comptopo.nbLocalComponents()) parafield.getField().setValues(value) diff --git a/src/RENUMBER/RENUMBER_BOOSTRenumbering.cxx b/src/RENUMBER/RENUMBER_BOOSTRenumbering.cxx index 99c225ec5..9dbc517a1 100644 --- a/src/RENUMBER/RENUMBER_BOOSTRenumbering.cxx +++ b/src/RENUMBER/RENUMBER_BOOSTRenumbering.cxx @@ -20,7 +20,7 @@ #include "RENUMBER_BOOSTRenumbering.hxx" #include "MEDCouplingMemArray.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include #include @@ -30,7 +30,7 @@ void BOOSTRenumbering::renumber(const int *graph, const int *index_graph, int nbCell, MEDCoupling::DataArrayInt *&iperm, MEDCoupling::DataArrayInt *&perm) { - MEDCoupling::MEDCouplingAutoRefCountObjectPtr out0(MEDCoupling::DataArrayInt::New()),out1(MEDCoupling::DataArrayInt::New()); + MEDCoupling::MCAuto out0(MEDCoupling::DataArrayInt::New()),out1(MEDCoupling::DataArrayInt::New()); out0->alloc(nbCell,1); out1->alloc(nbCell,1); out0->fillWithZero(); out1->fillWithZero(); // diff --git a/src/RENUMBER/RENUMBER_METISRenumbering.cxx b/src/RENUMBER/RENUMBER_METISRenumbering.cxx index 065df9235..0de52dc04 100644 --- a/src/RENUMBER/RENUMBER_METISRenumbering.cxx +++ b/src/RENUMBER/RENUMBER_METISRenumbering.cxx @@ -29,13 +29,13 @@ extern "C" } #include "MEDCouplingMemArray.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "RENUMBER_METISRenumbering.hxx" void METISRenumbering::renumber(const int *graph, const int *index_graph, int nbCell, MEDCoupling::DataArrayInt *&iperm, MEDCoupling::DataArrayInt *&perm) { - MEDCoupling::MEDCouplingAutoRefCountObjectPtr out0(MEDCoupling::DataArrayInt::New()),out1(MEDCoupling::DataArrayInt::New()); + MEDCoupling::MCAuto out0(MEDCoupling::DataArrayInt::New()),out1(MEDCoupling::DataArrayInt::New()); out0->alloc(nbCell,1); out1->alloc(nbCell,1); out0->fillWithZero(); out1->fillWithZero(); int num_flag=1; diff --git a/src/RENUMBER/renumbering.cxx b/src/RENUMBER/renumbering.cxx index 4afad1524..0f8abe888 100644 --- a/src/RENUMBER/renumbering.cxx +++ b/src/RENUMBER/renumbering.cxx @@ -57,7 +57,7 @@ int main(int argc, char** argv) } // Reading file structure cout << "Reading : " << flush; - MEDCouplingAutoRefCountObjectPtr fd(MEDFileData::New(filename_in)); + MCAuto fd(MEDFileData::New(filename_in)); MEDFileMesh *m=fd->getMeshes()->getMeshWithName(meshname); MEDFileUMesh *mc=dynamic_cast(m); if(!mc) @@ -68,12 +68,12 @@ int main(int argc, char** argv) t_read_st=clock(); cout << (t_read_st-t_begin)/(double) CLOCKS_PER_SEC << "s" << endl << flush; // Reading mesh - MEDCouplingAutoRefCountObjectPtr workMesh=mc->getMeshAtLevel(0); + MCAuto workMesh=mc->getMeshAtLevel(0); std::vector code=workMesh->getDistributionOfTypes(); cout << "Building the graph : " << flush; DataArrayInt *neighb=0,*neighbI=0; workMesh->computeNeighborsOfCells(neighb,neighbI); - MEDCouplingAutoRefCountObjectPtr neighbSafe(neighb),neighbISafe(neighbI),ipermSafe,permSafe; + MCAuto neighbSafe(neighb),neighbISafe(neighbI),ipermSafe,permSafe; const int *graph=neighbSafe->begin(); const int *graph_index=neighbISafe->begin(); // Compute permutation iperm->new2old perm->old2new @@ -93,7 +93,7 @@ int main(int argc, char** argv) const DataArrayInt *famField=mc->getFamilyFieldAtLevel(0); if(famField) { - MEDCouplingAutoRefCountObjectPtr famField2=famField->renumber(perm->begin()); + MCAuto famField2=famField->renumber(perm->begin()); mc->setFamilyFieldArr(0,famField2); } mc->write(filename_out,2); diff --git a/src/RENUMBER_Swig/MEDRenumberCommon.i b/src/RENUMBER_Swig/MEDRenumberCommon.i index 8a5de767d..876e76e65 100644 --- a/src/RENUMBER_Swig/MEDRenumberCommon.i +++ b/src/RENUMBER_Swig/MEDRenumberCommon.i @@ -25,7 +25,7 @@ %{ #include "MEDCouplingMemArray.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "MEDCouplingDataArrayTypemaps.i" #include "RenumberingFactory.hxx" diff --git a/v8_work/medcoup7to8.py b/v8_work/medcoup7to8.py index 9e8557d07..91e734114 100755 --- a/v8_work/medcoup7to8.py +++ b/v8_work/medcoup7to8.py @@ -86,12 +86,12 @@ REPLACEMENTS = [("RevIntegral", "IntensiveConservation"), ("setAxType", "setAxisType"), ("getAxType", "getAxisType"), ("isIdentity2", "isIota"), - ("SWIGTYPE_p_ParaMEDMEM__MEDCouplingExtrudedMesh", "SWIGTYPE_p_ParaMEDMEM__MEDCouplingMappedExtrudedMesh"), + ("SWIGTYPE_p_MEDCoupling__MEDCouplingExtrudedMesh", "SWIGTYPE_p_MEDCoupling__MEDCouplingMappedExtrudedMesh"), ("MEDCouplingExtrudedMesh____new___", "MEDCouplingMappedExtrudedMesh____new___"), ("locateValue", "findIdFirstEqual"), ("locateTuple", "findIdFirstEqualTuple"), - ("ParaMEDMEM_DataArrayByte_locateTuple", "ParaMEDMEM_DataArrayByte_findIdFirstEqualTuple"), - ("ParaMEDMEM_DataArrayAsciiChar_locateTuple", "ParaMEDMEM_DataArrayAsciiChar_findIdFirstEqualTuple"), + ("MEDCoupling_DataArrayByte_locateTuple", "MEDCoupling_DataArrayByte_findIdFirstEqualTuple"), + ("MEDCoupling_DataArrayAsciiChar_locateTuple", "MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple"), #("substr", "subArray"), # conflicts with regular C++ substr, to be handled manually #("search", "findIdSequence"), # idem ]