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
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
+
myCoords = DataArrayDouble.New()
myCoords.setValues(coordinates,nbOfNodes,3)
mesh.setCoords(myCoords)
- mesh.checkCoherency()
+ mesh.checkConsistencyLight()
print "6 ********************"
# Extraction of surfacic meshing
mesh2D = mesh.buildFacePartOfMySelfNode(nodes,True)
#print mesh2D
mesh2D.setName("3Dcube")
- mesh2D.checkCoherency()
+ mesh2D.checkConsistencyLight()
print "7 ********************"
# Creation of field : with following definition
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)
fBF = MEDCouplingFieldDouble.New(ON_CELLS)
fBF.setMesh(mesh2D)
fBF.setName("fieldBottomFace")
- fBF.setNature(Integral)
+ fBF.setNature(ExtensiveMaximum)
Cval = 10.
myCoords2D=DataArrayDouble.New()
sampleTab=[]
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)
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")
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
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 )
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"]
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]
# 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)
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]
import MEDLoader as ml
def displayVTK(m,fname):
- tmp = m.deepCpy()
+ tmp = m.deepCopy()
tmp.tessellate2D(0.1)
tmp.writeVTK(fname)
return
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
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
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:
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
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])
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")
pass
print "5 ********************"
- mesh.checkCoherency()
+ mesh.checkConsistencyLight()
medFileName = "MEDCoupling_Fleur.med"
MEDLoader.WriteUMesh(medFileName,mesh,True)
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)
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)
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
# 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
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]
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")
#
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
# 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)
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)
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)
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
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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pass
# Check mesh consistency:
- mesh.checkCoherency()
+ mesh.checkConsistencyLight()
Method by extrusion
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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(...)
mesh2D = mesh.buildFacePartOfMySelfNode(nodes,True)
#print mesh2D
mesh2D.setName("3Dcube")
- mesh2D.checkCoherency()
+ mesh2D.checkConsistencyLight()
medFileName = "MEDCoupling_cube3D.med"
meshes=[mesh2D,mesh]
res=f.getValueOn(pos)
# Verify if value is OK
- bar = mesh3D.getBarycenterAndOwner()
+ bar = mesh3D.computeCellCenterOfMass()
x=bar.getIJ(...)
y=bar.getIJ(...)
z=bar.getIJ(...)
An alternative (and more compact) way to do it : ::
- ds=[d.deepCpy() for i in xrange(len(translationToPerform))]
+ ds=[d.deepCopy() for i in xrange(len(translationToPerform))]
for (elt,t) in zip(ds,translationToPerform) : elt+=t
Aggregating DataArrayDouble
The format 'old-2-new' is systematically used for all renumbering operations (one-to-one correspondence).
-The static method DataArrayInt.BuildOld2NewArrayFromSurjectiveFormat2() performs the conversion from one storage mode to the other (c, cI to o2n).
+The static method DataArrayInt.ConvertIndexArrayToO2N() performs the conversion from one storage mode to the other (c, cI to o2n).
We get for free the number of elements in Y, i.e. the variable newNbOfTuples. ::
- o2n,newNbOfTuples=DataArrayInt.BuildOld2NewArrayFromSurjectiveFormat2(oldNbOfTuples,c,cI)
+ o2n,newNbOfTuples=DataArrayInt.ConvertIndexArrayToO2N(oldNbOfTuples,c,cI)
print "Have I got the right result? %s"%(str(myNewNbOfTuples==newNbOfTuples))
Using o2n and newNbOfTuples invoke DataArrayDouble.renumberAndReduce() on d2. ::
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. ::
.. 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)
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 ...
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
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)
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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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")
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.
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)
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
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)
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()). ::
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. ::
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())]
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])
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")
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)
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
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]
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]
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")
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")
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.
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]
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
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"
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
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]
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 !
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
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
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")
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))
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:
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])
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])
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
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")
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))
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:
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])
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])
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. ::
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. ::
.. 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.
.. 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.
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)
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.
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
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)
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,
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
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")
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")
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)
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)
MEDCouplingIMesh.* \
MEDCouplingStructuredMesh.* \
MEDCouplingCurveLinearMesh.* \
- MEDCouplingExtrudedMesh.* \
+ MEDCouplingMappedExtrudedMesh.* \
MEDCouplingFieldDouble.* \
MEDCouplingField.* \
MEDCouplingNatureOfFieldEnum \
MEDCouplingCartesianAMRMesh.* \
MEDCouplingTimeLabel.* \
MEDCouplingRefCountObject.* \
- MEDCouplingAutoRefCountObjectPtr.* \
+ MCAuto.* \
MEDCouplingMemArray.* \
MEDCouplingGaussLocalization.* \
MEDCouplingRemapper.* \
- \subpage interpkernel
- \ref MPIAccess-det
-*/
\ No newline at end of file
+*/
-# 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
+*/
- \subpage medcouplingpyexamples
- \subpage medcouplingcppexamples
-*/
\ No newline at end of file
+*/
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.
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
\n
-*/
\ No newline at end of file
+*/
\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."<br>
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".
\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 :
- \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
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
+*/
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".
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
- \ref NatureOfField
-*/
\ No newline at end of file
+*/
- "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
const char targetFileName[]="target.med";
MEDCouplingUMesh *med_target_mesh=MEDLoader::ReadUMeshFromFile(targetFileName,"Target_Mesh",0);
//
-sourceField->setNature(ConservativeVolumic);
+sourceField->setNature(IntensiveMaximum);
...
\endcode
* <TABLE BORDER=1 >
* <TR><TD> </TD><TD>Intensive</TD><TD> extensive </TD></TR>
- * <TR><TD> Conservation</TD><TD> \f[\frac{Vol(T_i\cap S_j)}{ Vol(T_i)}\f] <br /> \ref TableNatureOfFieldExampleRevIntegral "RevIntegral" </TD><TD> \f[ \frac{Vol(T_i\cap S_j)}{ \sum_{T_i} Vol(S_j\cap T_i) }\f] <br /> \ref TableNatureOfFieldExampleIntegralGlobConstraint "IntegralGlobConstraint" </TD></TR>
- * <TR><TD> Maximum principle </TD><TD> \f[\frac{Vol(T_i\cap S_j)}{ \sum_{S_j} Vol(T_i\cap S_j)}\f] <br /> \ref TableNatureOfFieldExampleConservVol "ConservativeVolumic" </TD><TD> \f[\frac{Vol(T_i\cap S_j)}{ Vol(S_j) }\f] <br /> \ref TableNatureOfFieldExampleIntegral "Integral"</TD></TR>
+ * <TR><TD> Conservation</TD><TD> \f[\frac{Vol(T_i\cap S_j)}{ Vol(T_i)}\f] <br /> \ref TableNatureOfFieldExampleRevIntegral "IntensiveConservation" </TD><TD> \f[ \frac{Vol(T_i\cap S_j)}{ \sum_{T_i} Vol(S_j\cap T_i) }\f] <br /> \ref TableNatureOfFieldExampleIntegralGlobConstraint "ExtensiveConservation" </TD></TR>
+ * <TR><TD> Maximum principle </TD><TD> \f[\frac{Vol(T_i\cap S_j)}{ \sum_{S_j} Vol(T_i\cap S_j)}\f] <br /> \ref TableNatureOfFieldExampleConservVol "IntensiveMaximum" </TD><TD> \f[\frac{Vol(T_i\cap S_j)}{ Vol(S_j) }\f] <br /> \ref TableNatureOfFieldExampleIntegral "ExtensiveMaximum"</TD></TR>
*</TABLE>
\section TableNatureOfFieldExample Illustration of a non overlapping P0P0 interpolation
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 \\
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 \\
\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 \\
\endverbatim
-*/
\ No newline at end of file
+*/
-*/
\ No newline at end of file
+*/
More information on the MED file format itself can be found at:
- \ref med-file
-*/
\ No newline at end of file
+*/
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.
*/
- \subpage MEDCouplingFieldTemplatesPage
-*/
\ No newline at end of file
+*/
\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
\endcode
-*/
\ No newline at end of file
+*/
The %MEDCoupling/%MEDLoader Python tutorial is accessible here:
- <a class="el" href="tutorial/index.html">MEDCoupling tutorial</a>
-*/
\ No newline at end of file
+*/
_value=valuesInExpr[pos];
}
-LeafExprVal *LeafExprVal::deepCpy() const
+LeafExprVal *LeafExprVal::deepCopy() const
{
return new LeafExprVal(*this);
}
return true;
}
-LeafExprVar *LeafExprVar::deepCpy() const
+LeafExprVar *LeafExprVar::deepCopy() const
{
return new LeafExprVar(*this);
}
for(std::vector<ExprParserOfEval>::iterator it=_sub_parts.begin();it!=_sub_parts.end();it++)
(*it).sortMemory();
if(_leaf)
- _leaf=_leaf->deepCpy();
+ _leaf=_leaf->deepCopy();
for(std::vector<Function *>::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)
INTERPKERNEL_EXPORT virtual void compileX86(std::vector<std::string>& ass) const = 0;
INTERPKERNEL_EXPORT virtual void compileX86_64(std::vector<std::string>& ass) const = 0;
INTERPKERNEL_EXPORT virtual void replaceValues(const std::vector<double>& 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);
};
INTERPKERNEL_EXPORT void compileX86_64(std::vector<std::string>& ass) const;
INTERPKERNEL_EXPORT void fillValue(Value *val) const;
INTERPKERNEL_EXPORT void replaceValues(const std::vector<double>& valuesInExpr);
- INTERPKERNEL_EXPORT LeafExprVal *deepCpy() const;
+ INTERPKERNEL_EXPORT LeafExprVal *deepCopy() const;
private:
double _value;
};
INTERPKERNEL_EXPORT void prepareExprEvaluationVec() const;
INTERPKERNEL_EXPORT void replaceValues(const std::vector<double>& 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:
virtual void operateStackOfDoubleSafe(std::vector<double>& 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
void operateStackOfDouble(std::vector<double>& 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[];
};
void operateStackOfDouble(std::vector<double>& 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[];
};
void operateStackOfDouble(std::vector<double>& 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[];
};
void operateStackOfDouble(std::vector<double>& 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[];
};
void operateStackOfDouble(std::vector<double>& 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[];
};
void operateStackOfDouble(std::vector<double>& 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[];
};
void operateStackOfDoubleSafe(std::vector<double>& 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[];
};
void operateStackOfDoubleSafe(std::vector<double>& 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[];
};
void operateStackOfDouble(std::vector<double>& 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[];
};
void operateStackOfDouble(std::vector<double>& 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[];
};
void operateStackOfDouble(std::vector<double>& 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[];
};
void operateStackOfDouble(std::vector<double>& 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[];
};
void operateStackOfDoubleSafe(std::vector<double>& 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[];
};
void operateStackOfDouble(std::vector<double>& 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[];
};
void operateStackOfDouble(std::vector<double>& 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[];
};
void operateStackOfDoubleSafe(std::vector<double>& 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[];
};
void operateStackOfDoubleSafe(std::vector<double>& 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[];
};
void operateStackOfDoubleSafe(std::vector<double>& 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[];
};
void operateStackOfDouble(std::vector<double>& 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[];
};
void operateStackOfDouble(std::vector<double>& 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[];
};
void operateStackOfDouble(std::vector<double>& 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[];
};
void operateStackOfDoubleSafe(std::vector<double>& 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[];
};
void operateStackOfDoubleSafe(std::vector<double>& 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[];
};
void operateStackOfDouble(std::vector<double>& 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[];
};
void operateStackOfDouble(std::vector<double>& 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[];
};
void operateStackOfDouble(std::vector<double>& 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[];
};
void operateStackOfDouble(std::vector<double>& 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[];
};
void operateStackOfDoubleSafe(std::vector<double>& 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[];
};
void Interpolation3DTest::getVolumes(MEDCoupling::MEDCouplingUMesh& mesh, double *tab) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> vol=mesh->getMeasureField(true);
+ MCAuto<MEDCouplingFieldDouble> vol=mesh->getMeasureField(true);
std::copy(vol->getArray()->begin(),vol->getArray()->end(),tab);
}
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "MEDCouplingCMesh.hxx"
#include "MEDMeshMaker.hxx"
MEDCoupling::MEDCouplingUMesh *MEDMeshMaker(int dim, int nbedge)
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> c=MEDCouplingCMesh::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
+ MCAuto<MEDCouplingCMesh> c=MEDCouplingCMesh::New();
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
arr->alloc(nbedge+1,1); arr->iota(0.); arr->applyLin(1./double(nbedge),0.);
switch(dim)
{
template <int SPACEDIM, int MESHDIM>
void MeshTestToolkit<SPACEDIM,MESHDIM>::getVolumes(MEDCoupling::MEDCouplingUMesh& mesh, double *tab) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> vol=mesh.getMeasureField(true);
+ MCAuto<MEDCouplingFieldDouble> vol=mesh.getMeasureField(true);
std::copy(vol->getArray()->begin(),vol->getArray()->end(),tab);
}
LOG(1, std::endl << "=== -> intersecting src = " << mesh1path << ", target = " << mesh2path );
LOG(5, "Loading " << mesh1 << " from " << mesh1path);
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> sMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh1path).c_str(),mesh1);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> sMesh=sMeshML->getMeshAtLevel(0);
+ MCAuto<MEDFileUMesh> sMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh1path).c_str(),mesh1);
+ MCAuto<MEDCouplingUMesh> sMesh=sMeshML->getMeshAtLevel(0);
LOG(5, "Loading " << mesh2 << " from " << mesh2path);
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> tMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh2path).c_str(),mesh2);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> tMesh=tMeshML->getMeshAtLevel(0);
+ MCAuto<MEDFileUMesh> tMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh2path).c_str(),mesh2);
+ MCAuto<MEDCouplingUMesh> tMesh=tMeshML->getMeshAtLevel(0);
MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM> sMesh_wrapper(sMesh);
MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM> tMesh_wrapper(tMesh);
LOG(1, std::endl << "=== -> intersecting src = " << mesh1 << ", target = " << mesh2 );
LOG(5, "Loading " << mesh1 << " from " << mesh1path);
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> sMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh1path).c_str(),mesh1);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> sMesh=sMeshML->getMeshAtLevel(0);
+ MCAuto<MEDFileUMesh> sMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh1path).c_str(),mesh1);
+ MCAuto<MEDCouplingUMesh> sMesh=sMeshML->getMeshAtLevel(0);
LOG(5, "Loading " << mesh2 << " from " << mesh2path);
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> tMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh2path).c_str(),mesh2);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> tMesh=tMeshML->getMeshAtLevel(0);
+ MCAuto<MEDFileUMesh> tMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh2path).c_str(),mesh2);
+ MCAuto<MEDCouplingUMesh> tMesh=tMeshML->getMeshAtLevel(0);
MEDCouplingNormalizedUnstructuredMesh<3,3> sMesh_wrapper(sMesh);
MEDCouplingNormalizedUnstructuredMesh<3,3> tMesh_wrapper(tMesh);
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.]
//
MEDCouplingRefCountObject.cxx
MEDCouplingPointSet.cxx
MEDCouplingFieldTemplate.cxx
- MEDCouplingExtrudedMesh.cxx
+ MEDCouplingMappedExtrudedMesh.cxx
MEDCouplingMesh.cxx
MEDCouplingGaussLocalization.cxx
MEDCouplingNatureOfField.cxx
--- /dev/null
+// 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 T>
+ 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<class T, class U>
+ typename MEDCoupling::MCAuto<U> DynamicCast(typename MEDCoupling::MCAuto<T>& autoSubPtr) throw()
+ {
+ T *subPtr(autoSubPtr);
+ U *ptr(dynamic_cast<U *>(subPtr));
+ typename MEDCoupling::MCAuto<U> ret(ptr);
+ if(ptr)
+ ptr->incrRef();
+ return ret;
+ }
+
+ template<class T, class U>
+ typename MEDCoupling::MCAuto<U> DynamicCastSafe(typename MEDCoupling::MCAuto<T>& autoSubPtr)
+ {
+ T *subPtr(autoSubPtr);
+ U *ptr(dynamic_cast<U *>(subPtr));
+ if(subPtr && !ptr)
+ throw INTERP_KERNEL::Exception("DynamicCastSafe : U is not a subtype of T !");
+ typename MEDCoupling::MCAuto<U> ret(ptr);
+ if(ptr)
+ ptr->incrRef();
+ return ret;
+ }
+}
+
+#endif
*/
DataArrayInt *MEDCoupling1GTUMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
if(type==getCellModelEnum())
ret->alloc(getNumberOfCells(),1);
else
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<DataArrayInt *>(profile); idsInPflPerType[0]->incrRef();
void MEDCoupling1GTUMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m=buildUnstructured();
+ MCAuto<MEDCouplingUMesh> m=buildUnstructured();
m->writeVTKLL(ofs,cellData,pointData,byteData);
}
return true;
}
-void MEDCoupling1GTUMesh::checkCoherency() const
+void MEDCoupling1GTUMesh::checkConsistencyLight() const
{
- MEDCouplingPointSet::checkCoherency();
+ MEDCouplingPointSet::checkConsistencyLight();
}
-DataArrayDouble *MEDCoupling1GTUMesh::getBarycenterAndOwner() const
+DataArrayDouble *MEDCoupling1GTUMesh::computeCellCenterOfMass() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m=buildUnstructured();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=m->getBarycenterAndOwner();
+ MCAuto<MEDCouplingUMesh> m=buildUnstructured();
+ MCAuto<DataArrayDouble> ret=m->computeCellCenterOfMass();
return ret.retn();
}
MEDCouplingFieldDouble *MEDCoupling1GTUMesh::getMeasureField(bool isAbs) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m=buildUnstructured();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=m->getMeasureField(isAbs);
+ MCAuto<MEDCouplingUMesh> m=buildUnstructured();
+ MCAuto<MEDCouplingFieldDouble> ret=m->getMeasureField(isAbs);
ret->setMesh(this);
return ret.retn();
}
MEDCouplingFieldDouble *MEDCoupling1GTUMesh::getMeasureFieldOnNode(bool isAbs) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m=buildUnstructured();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=m->getMeasureFieldOnNode(isAbs);
+ MCAuto<MEDCouplingUMesh> m=buildUnstructured();
+ MCAuto<MEDCouplingFieldDouble> ret=m->getMeasureFieldOnNode(isAbs);
ret->setMesh(this);
return ret.retn();
}
*/
int MEDCoupling1GTUMesh::getCellContainingPoint(const double *pos, double eps) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m=buildUnstructured();
+ MCAuto<MEDCouplingUMesh> m=buildUnstructured();
return m->getCellContainingPoint(pos,eps);
}
MEDCouplingFieldDouble *MEDCoupling1GTUMesh::buildOrthogonalField() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m=buildUnstructured();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=m->buildOrthogonalField();
+ MCAuto<MEDCouplingUMesh> m=buildUnstructured();
+ MCAuto<MEDCouplingFieldDouble> ret=m->buildOrthogonalField();
ret->setMesh(this);
return ret.retn();
}
DataArrayInt *MEDCoupling1GTUMesh::getCellsInBoundingBox(const double *bbox, double eps) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m=buildUnstructured();
+ MCAuto<MEDCouplingUMesh> m=buildUnstructured();
return m->getCellsInBoundingBox(bbox,eps);
}
DataArrayInt *MEDCoupling1GTUMesh::getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps)
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m=buildUnstructured();
+ MCAuto<MEDCouplingUMesh> m=buildUnstructured();
return m->getCellsInBoundingBox(bbox,eps);
}
MEDCouplingPointSet *MEDCoupling1GTUMesh::buildFacePartOfMySelfNode(const int *start, const int *end, bool fullyIn) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m=buildUnstructured();
+ MCAuto<MEDCouplingUMesh> m=buildUnstructured();
return m->buildFacePartOfMySelfNode(start,end,fullyIn);
}
DataArrayInt *MEDCoupling1GTUMesh::findBoundaryNodes() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m=buildUnstructured();
+ MCAuto<MEDCouplingUMesh> m=buildUnstructured();
return m->findBoundaryNodes();
}
MEDCouplingPointSet *MEDCoupling1GTUMesh::buildBoundaryMesh(bool keepCoords) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m=buildUnstructured();
+ MCAuto<MEDCouplingUMesh> m=buildUnstructured();
return m->buildBoundaryMesh(keepCoords);
}
void MEDCoupling1GTUMesh::findCommonCells(int compType, int startCellId, DataArrayInt *& commonCellsArr, DataArrayInt *& commonCellsIArr) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m=buildUnstructured();
+ MCAuto<MEDCouplingUMesh> m=buildUnstructured();
m->findCommonCells(compType,startCellId,commonCellsArr,commonCellsIArr);
}
throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh : the first instance in input parts is null !");
const DataArrayDouble *coords(firstPart->getCoords());
int meshDim(firstPart->getMeshDimension());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret(MEDCouplingUMesh::New(firstPart->getName(),meshDim)); ret->setDescription(firstPart->getDescription());
+ MCAuto<MEDCouplingUMesh> 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++)
nbOfCells+=(*it)->getNumberOfCells();
connSize+=(*it)->getNodalConnectivityLength();
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(DataArrayInt::New()),connI(DataArrayInt::New());
+ MCAuto<DataArrayInt> 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++)
{
const DataArrayInt *c(other._conn);
if(c)
- _conn=c->deepCpy();
+ _conn=c->deepCopy();
}
}
if(gts.size()!=1)
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::New : input mesh must have exactly one geometric type !");
int geoType((int)*gts.begin());
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New(m->getName(),*gts.begin()));
+ MCAuto<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New(m->getName(),*gts.begin()));
ret->setCoords(m->getCoords()); ret->setDescription(m->getDescription());
int nbCells(m->getNumberOfCells());
int nbOfNodesPerCell(ret->getNumberOfNodesPerCell());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(DataArrayInt::New()); conn->alloc(nbCells*nbOfNodesPerCell,1);
+ MCAuto<DataArrayInt> 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<nbCells;i++,ciin++)
}
/*!
- * This method behaves mostly like MEDCoupling1SGTUMesh::deepCpy method, except that only nodal connectivity arrays are deeply copied.
+ * This method behaves mostly like MEDCoupling1SGTUMesh::deepCopy method, except that only nodal connectivity arrays are deeply copied.
* The coordinates are shared between \a this and the returned instance.
*
* \return MEDCoupling1SGTUMesh * - A new object instance holding the copy of \a this (deep for connectivity, shallow for coordiantes)
- * \sa MEDCoupling1SGTUMesh::deepCpy
+ * \sa MEDCoupling1SGTUMesh::deepCopy
*/
-MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::deepCpyConnectivityOnly() const
+MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::deepCopyConnectivityOnly() const
{
- checkCoherency();
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret(clone(false));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> c(_conn->deepCpy());
+ checkConsistencyLight();
+ MCAuto<MEDCoupling1SGTUMesh> ret(clone(false));
+ MCAuto<DataArrayInt> c(_conn->deepCopy());
ret->setNodalConnectivity(c);
return ret.retn();
}
return ret;
}
-MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::deepCpy() const
+MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::deepCopy() const
{
return clone(true);
}
return true;
}
-void MEDCoupling1SGTUMesh::checkCoherencyOfConnectivity() const
+void MEDCoupling1SGTUMesh::checkConsistencyOfConnectivity() const
{
const DataArrayInt *c1(_conn);
if(c1)
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();
DataArrayInt *MEDCoupling1SGTUMesh::computeNbOfNodesPerCell() const
{
checkNonDynamicGeoType();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(getNumberOfCells(),1);
ret->fillWithValue((int)_cm->getNumberOfNodes());
return ret.retn();
DataArrayInt *MEDCoupling1SGTUMesh::computeNbOfFacesPerCell() const
{
checkNonDynamicGeoType();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(getNumberOfCells(),1);
ret->fillWithValue((int)_cm->getNumberOfSons());
return ret.retn();
DataArrayInt *MEDCoupling1SGTUMesh::computeEffectiveNbOfNodesPerCell() const
{
checkNonDynamicGeoType();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
int nbCells(getNumberOfCells());
ret->alloc(nbCells,1);
int *retPtr(ret->getPointer());
DataArrayDouble *MEDCoupling1SGTUMesh::computeIsoBarycenterOfNodesPerCell() const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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();
void MEDCoupling1SGTUMesh::renumberCells(const int *old2NewBg, bool check)
{
int nbCells=getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n=DataArrayInt::New();
+ MCAuto<DataArrayInt> o2n=DataArrayInt::New();
o2n->useArray(old2NewBg,false,C_DEALLOC,nbCells,1);
if(check)
o2n=o2n->checkAndPreparePermutation();
//
const int *conn=_conn->begin();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> n2o=o2n->invertArrayO2N2N2O(nbCells);
+ MCAuto<DataArrayInt> n2o=o2n->invertArrayO2N2N2O(nbCells);
const int *n2oPtr=n2o->begin();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConn=DataArrayInt::New();
+ MCAuto<DataArrayInt> newConn=DataArrayInt::New();
newConn->alloc(_conn->getNumberOfTuples(),1);
newConn->copyStringInfoFrom(*_conn);
int sz=getNumberOfNodesPerCell();
void MEDCoupling1SGTUMesh::fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, DataArrayInt *&cellIdsKeptArr) const
{
int nbOfCells=getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellIdsKept=DataArrayInt::New(); cellIdsKept->alloc(0,1);
+ MCAuto<DataArrayInt> cellIdsKept=DataArrayInt::New(); cellIdsKept->alloc(0,1);
int tmp=-1;
int sz=_conn->getMaxValue(tmp); sz=std::max(sz,0)+1;
std::vector<bool> fastFinder(sz,false);
MEDCouplingUMesh *MEDCoupling1SGTUMesh::buildUnstructured() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(getName(),getMeshDimension());
+ MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(getName(),getMeshDimension());
ret->setCoords(getCoords());
const int *nodalConn=_conn->begin();
int nbCells=getNumberOfCells();
int nbNodesPerCell=getNumberOfNodesPerCell();
int geoType=(int)getCellModelEnum();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> c=DataArrayInt::New(); c->alloc(nbCells*(nbNodesPerCell+1),1);
+ MCAuto<DataArrayInt> c=DataArrayInt::New(); c->alloc(nbCells*(nbNodesPerCell+1),1);
int *cPtr=c->getPointer();
for(int i=0;i<nbCells;i++,nodalConn+=nbNodesPerCell)
{
*cPtr++=geoType;
cPtr=std::copy(nodalConn,nodalConn+nbNodesPerCell,cPtr);
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cI=DataArrayInt::Range(0,(nbCells+1)*(nbNodesPerCell+1),nbNodesPerCell+1);
+ MCAuto<DataArrayInt> cI=DataArrayInt::Range(0,(nbCells+1)*(nbNodesPerCell+1),nbNodesPerCell+1);
ret->setConnectivity(c,cI,true);
try
{ ret->copyTinyInfoFrom(this); }
*/
DataArrayInt *MEDCoupling1SGTUMesh::computeFetchedNodeIds() const
{
- checkCoherencyOfConnectivity();
+ checkConsistencyOfConnectivity();
int nbNodes(getNumberOfNodes());
std::vector<bool> fetchedNodes(nbNodes,false);
computeNodeIdsAlg(fetchedNodes);
int sz((int)std::count(fetchedNodes.begin(),fetchedNodes.end(),true));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(sz,1);
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(sz,1);
int *retPtr(ret->getPointer());
for(int i=0;i<nbNodes;i++)
if(fetchedNodes[i])
nbrOfNodesInUse=-1;
int nbOfNodes=getNumberOfNodes();
int nbOfCells=getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New());
+ MCAuto<DataArrayInt> ret(DataArrayInt::New());
ret->alloc(nbOfNodes,1);
int *traducer=ret->getPointer();
std::fill(traducer,traducer+nbOfNodes,-1);
for(std::size_t ii=0;ii<sz;ii++)
if(&(a[ii]->getCellModel())!=cm)
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::Merge1SGTUMeshes : all items must have the same geo type !");
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> > bb(sz);
+ std::vector< MCAuto<MEDCoupling1SGTUMesh> > bb(sz);
std::vector< const MEDCoupling1SGTUMesh * > aa(sz);
int spaceDim=-3;
for(std::size_t i=0;i<sz && spaceDim==-3;i++)
if(coords!=(*it)->getCoords())
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords : not lying on same coords !");
}
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret(new MEDCoupling1SGTUMesh("merge",*cm));
+ MCAuto<MEDCoupling1SGTUMesh> ret(new MEDCoupling1SGTUMesh("merge",*cm));
ret->setCoords(coords);
ret->_conn=DataArrayInt::Aggregate(ncs);
return ret.retn();
}
std::vector<const MEDCouplingPointSet *> aps(a.size());
std::copy(a.begin(),a.end(),aps.begin());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> pts=MergeNodesArray(aps);
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret(new MEDCoupling1SGTUMesh("merge",*cm));
+ MCAuto<DataArrayDouble> pts=MergeNodesArray(aps);
+ MCAuto<MEDCoupling1SGTUMesh> ret(new MEDCoupling1SGTUMesh("merge",*cm));
ret->setCoords(pts);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> c=DataArrayInt::New();
+ MCAuto<DataArrayInt> c=DataArrayInt::New();
c->alloc(nbOfCells*nbNodesPerCell,1);
int *cPtr=c->getPointer();
int offset=0;
MEDCouplingPointSet *MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoords(const int *begin, const int *end) const
{
int ncell=getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret(new MEDCoupling1SGTUMesh(getName(),*_cm));
+ MCAuto<MEDCoupling1SGTUMesh> 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<DataArrayInt> connRet=DataArrayInt::New(); connRet->alloc((int)nbOfElemsRet*sz,1);
+ MCAuto<DataArrayInt> connRet=DataArrayInt::New(); connRet->alloc((int)nbOfElemsRet*sz,1);
int *connPtr=connRet->getPointer();
for(const int *work=begin;work!=end;work++,connPtr+=sz)
{
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<MEDCoupling1SGTUMesh> ret(new MEDCoupling1SGTUMesh(getName(),*_cm));
+ int nbOfElemsRet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoordsSlice : ");
+ MCAuto<MEDCoupling1SGTUMesh> ret(new MEDCoupling1SGTUMesh(getName(),*_cm));
ret->setCoords(_coords);
const int *inConn=_conn->getConstPointer();
int sz=getNumberOfNodesPerCell();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> connRet=DataArrayInt::New(); connRet->alloc((int)nbOfElemsRet*sz,1);
+ MCAuto<DataArrayInt> connRet=DataArrayInt::New(); connRet->alloc((int)nbOfElemsRet*sz,1);
int *connPtr=connRet->getPointer();
int curId=start;
for(int i=0;i<nbOfElemsRet;i++,connPtr+=sz,curId+=step)
std::copy(inConn+curId*sz,inConn+(curId+1)*sz,connPtr);
else
{
- std::ostringstream oss; oss << "MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoords2 : On pos #" << i << " input cell id =" << curId << " should be in [0," << ncell << ") !";
+ std::ostringstream oss; oss << "MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoordsSlice : On pos #" << i << " input cell id =" << curId << " should be in [0," << ncell << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::buildSetInstanceFromThis(int spaceDim) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret(new MEDCoupling1SGTUMesh(getName(),*_cm));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp1;
+ MCAuto<MEDCoupling1SGTUMesh> ret(new MEDCoupling1SGTUMesh(getName(),*_cm));
+ MCAuto<DataArrayInt> tmp1;
const DataArrayInt *nodalConn(_conn);
if(!nodalConn)
{
ret->_conn=tmp1;
if(!_coords)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coords=DataArrayDouble::New(); coords->alloc(0,spaceDim);
+ MCAuto<DataArrayDouble> coords=DataArrayDouble::New(); coords->alloc(0,spaceDim);
ret->setCoords(coords);
}
else
int nbOfCells=getNumberOfCells();
if(getCellModelEnum()!=INTERP_KERNEL::NORM_QUAD4)
return DataArrayInt::Range(0,nbOfCells,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(2*3*nbOfCells,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(2*nbOfCells,1);
+ MCAuto<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(2*3*nbOfCells,1);
+ MCAuto<DataArrayInt> 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<nbOfCells;i++,c+=4,newConnPtr+=6,retPtr+=2)
int nbOfCells=getNumberOfCells();
if(getCellModelEnum()!=INTERP_KERNEL::NORM_QUAD4)
return DataArrayInt::Range(0,nbOfCells,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(2*3*nbOfCells,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(2*nbOfCells,1);
+ MCAuto<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(2*3*nbOfCells,1);
+ MCAuto<DataArrayInt> 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<nbOfCells;i++,c+=4,newConnPtr+=6,retPtr+=2)
int nbOfCells=getNumberOfCells();
if(getCellModelEnum()!=INTERP_KERNEL::NORM_HEXA8)
return DataArrayInt::Range(0,nbOfCells,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(5*4*nbOfCells,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(5*nbOfCells,1);
+ MCAuto<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(5*4*nbOfCells,1);
+ MCAuto<DataArrayInt> 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<nbOfCells;i++,c+=8,newConnPtr+=20,retPtr+=5)
int nbOfCells=getNumberOfCells();
if(getCellModelEnum()!=INTERP_KERNEL::NORM_HEXA8)
return DataArrayInt::Range(0,nbOfCells,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(6*4*nbOfCells,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(6*nbOfCells,1);
+ MCAuto<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(6*4*nbOfCells,1);
+ MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(6*nbOfCells,1);
const int *c(_conn->begin());
int *retPtr(ret->getPointer()),*newConnPtr(newConn->getPointer());
for(int i=0;i<nbOfCells;i++,c+=8,newConnPtr+=24,retPtr+=6)
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4 : this method can be applied only on HEXA8 mesh !");
int nbHexa8(getNumberOfCells());
const int *inConnPtr(getNodalConnectivity()->begin());
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New(getName(),INTERP_KERNEL::NORM_QUAD4));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> c(DataArrayInt::New()); c->alloc(nbHexa8*6*4,1);
+ MCAuto<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New(getName(),INTERP_KERNEL::NORM_QUAD4));
+ MCAuto<DataArrayInt> c(DataArrayInt::New()); c->alloc(nbHexa8*6*4,1);
int *cPtr(c->getPointer());
for(int i=0;i<nbHexa8;i++,inConnPtr+=8)
{
*/
MEDCouplingCMesh *MEDCoupling1SGTUMesh::structurizeMe(DataArrayInt *& cellPerm, DataArrayInt *& nodePerm, double eps) const
{
- checkCoherency();
+ checkConsistencyLight();
int spaceDim(getSpaceDimension()),meshDim(getMeshDimension()),nbNodes(getNumberOfNodes());
if(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(meshDim)!=getCellModelEnum())
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::structurizeMe : the unique geo type in this is not compatible with the geometric type regarding mesh dimension !");
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> cm(MEDCouplingCMesh::New());
+ MCAuto<MEDCouplingCMesh> cm(MEDCouplingCMesh::New());
for(int i=0;i<spaceDim;i++)
{
std::vector<int> tmp(1,i);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> elt(static_cast<DataArrayDouble*>(getCoords()->keepSelectedComponents(tmp)));
+ MCAuto<DataArrayDouble> elt(static_cast<DataArrayDouble*>(getCoords()->keepSelectedComponents(tmp)));
elt=elt->getDifferentValues(eps);
elt->sort(true);
cm->setCoordsAt(i,elt);
try
{ cm->copyTinyInfoFrom(this); }
catch(INTERP_KERNEL::Exception&) { }
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> um(cm->buildUnstructured()),self(buildUnstructured());
+ MCAuto<MEDCouplingUMesh> um(cm->buildUnstructured()),self(buildUnstructured());
self->checkGeoEquivalWith(um,12,eps,cellPerm,nodePerm);
return cm.retn();
}
*/
DataArrayInt *MEDCoupling1SGTUMesh::sortHexa8EachOther()
{
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> quads(explodeEachHexa8To6Quad4());//checks that only hexa8
+ MCAuto<MEDCoupling1SGTUMesh> quads(explodeEachHexa8To6Quad4());//checks that only hexa8
int nbHexa8(getNumberOfCells()),*cQuads(quads->getNodalConnectivity()->getPointer());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> neighOfQuads(DataArrayInt::New()); neighOfQuads->alloc(nbHexa8*6,1); neighOfQuads->fillWithValue(-1);
+ MCAuto<DataArrayInt> 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<MEDCouplingUMesh> quadsTmp(quads->buildUnstructured());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ccSafe,cciSafe;
+ MCAuto<MEDCouplingUMesh> quadsTmp(quads->buildUnstructured());
+ MCAuto<DataArrayInt> ccSafe,cciSafe;
DataArrayInt *cc(0),*cci(0);
quadsTmp->findCommonCells(3,0,cc,cci);
ccSafe=cc; cciSafe=cci;
for(int i=0;i<nbOfPair;i++)
{ ptNeigh[ccPtr[2*i+0]]=ccPtr[2*i+1]/6; ptNeigh[ccPtr[2*i+1]]=ccPtr[2*i+0]/6; }
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
std::vector<bool> fetched(nbHexa8,false);
std::vector<bool>::iterator it(std::find(fetched.begin(),fetched.end(),false));
while(it!=fetched.end())//it will turns as time as number of connected zones
if(getCellModelEnum()!=INTERP_KERNEL::NORM_TETRA4)
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::computeDualMesh3D : only TETRA4 supported !");
checkFullyDefined();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> thisu(buildUnstructured());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> revNodArr(DataArrayInt::New()),revNodIArr(DataArrayInt::New());
+ MCAuto<MEDCouplingUMesh> thisu(buildUnstructured());
+ MCAuto<DataArrayInt> revNodArr(DataArrayInt::New()),revNodIArr(DataArrayInt::New());
thisu->getReverseNodalConnectivity(revNodArr,revNodIArr);
const int *revNod(revNodArr->begin()),*revNodI(revNodIArr->begin()),*nodal(_conn->begin());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1Arr(DataArrayInt::New()),di1Arr(DataArrayInt::New()),rd1Arr(DataArrayInt::New()),rdi1Arr(DataArrayInt::New());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> edges(thisu->explode3DMeshTo1D(d1Arr,di1Arr,rd1Arr,rdi1Arr));
+ MCAuto<DataArrayInt> d1Arr(DataArrayInt::New()),di1Arr(DataArrayInt::New()),rd1Arr(DataArrayInt::New()),rdi1Arr(DataArrayInt::New());
+ MCAuto<MEDCouplingUMesh> edges(thisu->explode3DMeshTo1D(d1Arr,di1Arr,rd1Arr,rdi1Arr));
const int *d1(d1Arr->begin());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2Arr(DataArrayInt::New()),di2Arr(DataArrayInt::New()),rd2Arr(DataArrayInt::New()),rdi2Arr(DataArrayInt::New());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> faces(thisu->buildDescendingConnectivity(d2Arr,di2Arr,rd2Arr,rdi2Arr)); thisu=0;
+ MCAuto<DataArrayInt> d2Arr(DataArrayInt::New()),di2Arr(DataArrayInt::New()),rd2Arr(DataArrayInt::New()),rdi2Arr(DataArrayInt::New());
+ MCAuto<MEDCouplingUMesh> faces(thisu->buildDescendingConnectivity(d2Arr,di2Arr,rd2Arr,rdi2Arr)); thisu=0;
const int *d2(d2Arr->begin()),*rdi2(rdi2Arr->begin());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> edgesBaryArr(edges->getBarycenterAndOwner()),facesBaryArr(faces->getBarycenterAndOwner()),baryArr(getBarycenterAndOwner());
+ MCAuto<DataArrayDouble> 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<const DataArrayDouble *> v(4); v[0]=getCoords(); v[1]=facesBaryArr; v[2]=edgesBaryArr; v[3]=baryArr;
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> zeArr(DataArrayDouble::Aggregate(v)); baryArr=0; edgesBaryArr=0; facesBaryArr=0;
+ MCAuto<DataArrayDouble> zeArr(DataArrayDouble::Aggregate(v)); baryArr=0; edgesBaryArr=0; facesBaryArr=0;
std::string name("DualOf_"); name+=getName();
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1DGTUMesh> ret(MEDCoupling1DGTUMesh::New(name,INTERP_KERNEL::NORM_POLYHED)); ret->setCoords(zeArr);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cArr(DataArrayInt::New()),ciArr(DataArrayInt::New()); ciArr->alloc(nbOfNodes+1,1); ciArr->setIJ(0,0,0); cArr->alloc(0,1);
+ MCAuto<MEDCoupling1DGTUMesh> ret(MEDCoupling1DGTUMesh::New(name,INTERP_KERNEL::NORM_POLYHED)); ret->setCoords(zeArr);
+ MCAuto<DataArrayInt> 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<nbOfNodes;i++,revNodI++)
{
int nbOfCellsSharingNode(revNodI[1]-revNodI[0]);
if(getCellModelEnum()!=INTERP_KERNEL::NORM_TRI3)
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::computeDualMesh2D : only TRI3 supported !");
checkFullyDefined();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> thisu(buildUnstructured());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> revNodArr(DataArrayInt::New()),revNodIArr(DataArrayInt::New());
+ MCAuto<MEDCouplingUMesh> thisu(buildUnstructured());
+ MCAuto<DataArrayInt> revNodArr(DataArrayInt::New()),revNodIArr(DataArrayInt::New());
thisu->getReverseNodalConnectivity(revNodArr,revNodIArr);
const int *revNod(revNodArr->begin()),*revNodI(revNodIArr->begin()),*nodal(_conn->begin());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2Arr(DataArrayInt::New()),di2Arr(DataArrayInt::New()),rd2Arr(DataArrayInt::New()),rdi2Arr(DataArrayInt::New());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> edges(thisu->buildDescendingConnectivity(d2Arr,di2Arr,rd2Arr,rdi2Arr)); thisu=0;
+ MCAuto<DataArrayInt> d2Arr(DataArrayInt::New()),di2Arr(DataArrayInt::New()),rd2Arr(DataArrayInt::New()),rdi2Arr(DataArrayInt::New());
+ MCAuto<MEDCouplingUMesh> edges(thisu->buildDescendingConnectivity(d2Arr,di2Arr,rd2Arr,rdi2Arr)); thisu=0;
const int *d2(d2Arr->begin()),*rdi2(rdi2Arr->begin());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> edgesBaryArr(edges->getBarycenterAndOwner()),baryArr(getBarycenterAndOwner());
+ MCAuto<DataArrayDouble> edgesBaryArr(edges->computeCellCenterOfMass()),baryArr(computeCellCenterOfMass());
const int nbOfNodes(getNumberOfNodes()),offset0(nbOfNodes+edges->getNumberOfCells());
edges=0;
std::vector<const DataArrayDouble *> v(3); v[0]=getCoords(); v[1]=edgesBaryArr; v[2]=baryArr;
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> zeArr(DataArrayDouble::Aggregate(v)); baryArr=0; edgesBaryArr=0;
+ MCAuto<DataArrayDouble> zeArr(DataArrayDouble::Aggregate(v)); baryArr=0; edgesBaryArr=0;
std::string name("DualOf_"); name+=getName();
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1DGTUMesh> ret(MEDCoupling1DGTUMesh::New(name,INTERP_KERNEL::NORM_POLYGON)); ret->setCoords(zeArr);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cArr(DataArrayInt::New()),ciArr(DataArrayInt::New()); ciArr->alloc(nbOfNodes+1,1); ciArr->setIJ(0,0,0); cArr->alloc(0,1);
+ MCAuto<MEDCoupling1DGTUMesh> ret(MEDCoupling1DGTUMesh::New(name,INTERP_KERNEL::NORM_POLYGON)); ret->setCoords(zeArr);
+ MCAuto<DataArrayInt> 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<nbOfNodes;i++,revNodI++)
{
int nbOfCellsSharingNode(revNodI[1]-revNodI[0]);
DataArrayDouble *MEDCoupling1SGTUMesh::getBoundingBoxForBBTree(double arcDetEps) const
{
int spaceDim(getSpaceDimension()),nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes()),nbOfNodesPerCell(getNumberOfNodesPerCell());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim);
+ MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim);
double *bbox(ret->getPointer());
for(int i=0;i<nbOfCells*spaceDim;i++)
{
MEDCouplingFieldDouble *MEDCoupling1SGTUMesh::computeDiameterField() const
{
checkFullyDefined();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME));
+ MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME));
int nbCells(getNumberOfCells());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr(DataArrayDouble::New());
+ MCAuto<DataArrayDouble> arr(DataArrayDouble::New());
arr->alloc(nbCells,1);
INTERP_KERNEL::AutoCppPtr<INTERP_KERNEL::DiameterCalculator> dc(_cm->buildInstanceOfDiameterCalulator(getSpaceDimension()));
dc->computeFor1SGTUMeshFrmt(nbCells,_conn->begin(),getCoords()->begin(),arr->getPointer());
{
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();
}
}
}
/*!
- * 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<MEDCoupling1DGTUMesh> ret(clone(false));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> c(_conn->deepCpy()),ci(_conn_indx->deepCpy());
+ checkConsistencyLight();
+ MCAuto<MEDCoupling1DGTUMesh> ret(clone(false));
+ MCAuto<DataArrayInt> c(_conn->deepCopy()),ci(_conn_indx->deepCopy());
ret->setNodalConnectivity(c,ci);
return ret.retn();
}
return ret;
}
-MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::deepCpy() const
+MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::deepCopy() const
{
return clone(true);
}
}
}
-void MEDCoupling1DGTUMesh::checkCoherencyOfConnectivity() const
+void MEDCoupling1DGTUMesh::checkConsistencyOfConnectivity() const
{
const DataArrayInt *c1(_conn);
if(c1)
int szOfC1Exp=_conn_indx->back();
if(sz2<szOfC1Exp)
{
- std::ostringstream oss; oss << "MEDCoupling1DGTUMesh::checkCoherencyOfConnectivity : The expected length of nodal connectivity array regarding index is " << szOfC1Exp << " but the actual size of it is " << c1->getNumberOfTuples() << " !";
+ 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());
}
}
* 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();
int MEDCoupling1DGTUMesh::getNumberOfCells() const
{
- checkCoherencyOfConnectivity();//do not remove
+ checkConsistencyOfConnectivity();//do not remove
return _conn_indx->getNumberOfTuples()-1;
}
*/
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<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfCells,1);
int *retPtr=ret->getPointer();
const int *ci=_conn_indx->begin(),*c=_conn->begin();
*/
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<DataArrayInt> ret=_conn_indx->deltaShiftIndex();
+ MCAuto<DataArrayInt> ret=_conn_indx->deltaShiftIndex();
ret->applyDivideBy(2);
return ret.retn();
}
// for polyhedrons
int nbOfCells=_conn_indx->getNumberOfTuples()-1;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfCells,1);
int *retPtr=ret->getPointer();
const int *ci=_conn_indx->begin(),*c=_conn->begin();
*/
DataArrayInt *MEDCoupling1DGTUMesh::computeEffectiveNbOfNodesPerCell() const
{
- checkCoherency();
+ checkConsistencyLight();
_conn_indx->checkMonotonic(true);
int nbOfCells(_conn_indx->getNumberOfTuples()-1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfCells,1);
int *retPtr(ret->getPointer());
const int *ci(_conn_indx->begin()),*c(_conn->begin());
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;
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;
DataArrayDouble *MEDCoupling1DGTUMesh::computeIsoBarycenterOfNodesPerCell() const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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();
void MEDCoupling1DGTUMesh::renumberCells(const int *old2NewBg, bool check)
{
int nbCells=getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n=DataArrayInt::New();
+ MCAuto<DataArrayInt> 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<DataArrayInt> newConn=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConnI=DataArrayInt::New();
+ MCAuto<DataArrayInt> newConn=DataArrayInt::New();
+ MCAuto<DataArrayInt> newConnI=DataArrayInt::New();
newConn->alloc(_conn->getNumberOfTuples(),1); newConnI->alloc(nbCells,1);
newConn->copyStringInfoFrom(*_conn); newConnI->copyStringInfoFrom(*_conn_indx);
//
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
- newConnI->computeOffsets2(); newCI=newConnI->getPointer();
+ newConnI->computeOffsetsFull(); newCI=newConnI->getPointer();
//
for(int i=0;i<nbCells;i++,conni++)
{
MEDCouplingUMesh *MEDCoupling1DGTUMesh::buildUnstructured() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(getName(),getMeshDimension());
+ MCAuto<MEDCouplingUMesh> 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<DataArrayInt> c=DataArrayInt::New(); c->alloc(nbCells+_conn->getNumberOfTuples(),1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cI=DataArrayInt::New(); cI->alloc(nbCells+1);
+ MCAuto<DataArrayInt> c=DataArrayInt::New(); c->alloc(nbCells+_conn->getNumberOfTuples(),1);
+ MCAuto<DataArrayInt> cI=DataArrayInt::New(); cI->alloc(nbCells+1);
int *cPtr=c->getPointer(),*ciPtr=cI->getPointer();
ciPtr[0]=0;
for(int i=0;i<nbCells;i++,ciPtr++)
DataArrayInt *MEDCoupling1DGTUMesh::simplexize(int policy)
{
int nbOfCells=getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfCells,1);
ret->iota(0);
return ret.retn();
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;
MEDCouplingPointSet *MEDCoupling1DGTUMesh::buildPartOfMySelfKeepCoords(const int *begin, const int *end) const
{
- checkCoherency();
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh(getName(),*_cm));
+ checkConsistencyLight();
+ MCAuto<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh(getName(),*_cm));
ret->setCoords(_coords);
DataArrayInt *c=0,*ci=0;
MEDCouplingUMesh::ExtractFromIndexedArrays(begin,end,_conn,_conn_indx,c,ci);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cSafe(c),ciSafe(ci);
+ MCAuto<DataArrayInt> 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<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh(getName(),*_cm));
+ checkConsistencyLight();
+ MCAuto<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh(getName(),*_cm));
ret->setCoords(_coords);
DataArrayInt *c=0,*ci=0;
- MEDCouplingUMesh::ExtractFromIndexedArrays2(start,end,step,_conn,_conn_indx,c,ci);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cSafe(c),ciSafe(ci);
+ MEDCouplingUMesh::ExtractFromIndexedArraysSlice(start,end,step,_conn,_conn_indx,c,ci);
+ MCAuto<DataArrayInt> cSafe(c),ciSafe(ci);
ret->setNodalConnectivity(c,ci);
return ret.retn();
}
void MEDCoupling1DGTUMesh::computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const
{
- checkCoherency1();
+ checkConsistency();
int sz((int)nodeIdsInUse.size());
for(const int *conn=_conn->begin();conn!=_conn->end();conn++)
{
std::vector<int> tinyInfo2(tinyInfo.begin()+9,tinyInfo.begin()+9+tinyInfo[6]);
std::vector<int> tinyInfo1(tinyInfo.begin()+9+tinyInfo[6],tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7]);
std::vector<int> tinyInfo12(tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7],tinyInfo.begin()+9+tinyInfo[6]+tinyInfo[7]+tinyInfo[8]);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> p1(DataArrayInt::New()); p1->resizeForUnserialization(tinyInfo1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> p2(DataArrayInt::New()); p2->resizeForUnserialization(tinyInfo12);
+ MCAuto<DataArrayInt> p1(DataArrayInt::New()); p1->resizeForUnserialization(tinyInfo1);
+ MCAuto<DataArrayInt> p2(DataArrayInt::New()); p2->resizeForUnserialization(tinyInfo12);
std::vector<const DataArrayInt *> v(2); v[0]=p1; v[1]=p2;
p2=DataArrayInt::Aggregate(v);
a2->resizeForUnserialization(tinyInfo2);
*/
DataArrayInt *MEDCoupling1DGTUMesh::computeFetchedNodeIds() const
{
- checkCoherency1();
+ checkConsistency();
int nbNodes(getNumberOfNodes());
std::vector<bool> fetchedNodes(nbNodes,false);
computeNodeIdsAlg(fetchedNodes);
int sz((int)std::count(fetchedNodes.begin(),fetchedNodes.end(),true));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(sz,1);
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(sz,1);
int *retPtr(ret->getPointer());
for(int i=0;i<nbNodes;i++)
if(fetchedNodes[i])
{
nbrOfNodesInUse=-1;
int nbOfNodes=getNumberOfNodes();
- int nbOfCells=getNumberOfCells();//checkCoherency
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ int nbOfCells=getNumberOfCells();//checkConsistencyLight
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfNodes,1);
int *traducer=ret->getPointer();
std::fill(traducer,traducer+nbOfNodes,-1);
void MEDCoupling1DGTUMesh::fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, DataArrayInt *&cellIdsKeptArr) const
{
int nbOfCells=getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellIdsKept=DataArrayInt::New(); cellIdsKept->alloc(0,1);
+ MCAuto<DataArrayInt> cellIdsKept=DataArrayInt::New(); cellIdsKept->alloc(0,1);
int tmp=-1;
int sz=_conn->getMaxValue(tmp); sz=std::max(sz,0)+1;
std::vector<bool> fastFinder(sz,false);
*/
MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::copyWithNodalConnectivityPacked(bool& isShallowCpyOfNodalConnn) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh(getName(),*_cm));
+ MCAuto<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh(getName(),*_cm));
DataArrayInt *nc=0,*nci=0;
isShallowCpyOfNodalConnn=retrievePackedNodalConnectivity(nc,nci);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ncs(nc),ncis(nci);
+ MCAuto<DataArrayInt> ncs(nc),ncis(nci);
ret->_conn=ncs; ret->_conn_indx=ncis;
ret->setCoords(getCoords());
return ret.retn();
* \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<DataArrayInt *>(c0); nodalConnIndx=const_cast<DataArrayInt *>(c1);
return true;
}
int bg=_conn_indx->front(),end=_conn_indx->back();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nc(_conn->selectByTupleId2(bg,end,1));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nci(_conn_indx->deepCpy());
+ MCAuto<DataArrayInt> nc(_conn->selectByTupleIdSafeSlice(bg,end,1));
+ MCAuto<DataArrayInt> nci(_conn_indx->deepCopy());
nci->applyLin(1,-bg);
nodalConn=nc.retn(); nodalConnIndx=nci.retn();
return false;
* 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();
}
for(std::size_t ii=0;ii<sz;ii++)
if(&(a[ii]->getCellModel())!=cm)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::Merge1DGTUMeshes : all items must have the same geo type !");
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1DGTUMesh> > bb(sz);
+ std::vector< MCAuto<MEDCoupling1DGTUMesh> > bb(sz);
std::vector< const MEDCoupling1DGTUMesh * > aa(sz);
int spaceDim=-3;
for(std::size_t i=0;i<sz && spaceDim==-3;i++)
std::vector<const MEDCoupling1DGTUMesh *>::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<MEDCoupling1DGTUMesh> > objs(a.size());
+ std::vector< MCAuto<MEDCoupling1DGTUMesh> > objs(a.size());
std::vector<const DataArrayInt *> ncs(a.size()),ncis(a.size());
(*it)->getNumberOfCells();//to check that all is OK
const DataArrayDouble *coords=(*it)->getCoords();
if(coords!=(*it)->getCoords())
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords : not lying on same coords !");
}
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh("merge",*cm));
+ MCAuto<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh("merge",*cm));
ret->setCoords(coords);
ret->_conn=DataArrayInt::Aggregate(ncs);
ret->_conn_indx=DataArrayInt::AggregateIndexes(ncis);
{
if(a.empty())
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::Merge1DGTUMeshes : input array must be NON EMPTY !");
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1DGTUMesh> > objs(a.size());
+ std::vector< MCAuto<MEDCoupling1DGTUMesh> > objs(a.size());
std::vector<const DataArrayInt *> ncs(a.size()),ncis(a.size());
std::vector<const MEDCoupling1DGTUMesh *>::const_iterator it=a.begin();
std::vector<int> nbNodesPerElt(a.size());
}
std::vector<const MEDCouplingPointSet *> aps(a.size());
std::copy(a.begin(),a.end(),aps.begin());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> pts=MergeNodesArray(aps);
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh("merge",*cm));
+ MCAuto<DataArrayDouble> pts=MergeNodesArray(aps);
+ MCAuto<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh("merge",*cm));
ret->setCoords(pts);
ret->_conn=AggregateNodalConnAndShiftNodeIds(ncs,nbNodesPerElt);
ret->_conn_indx=DataArrayInt::AggregateIndexes(ncis);
MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::buildSetInstanceFromThis(int spaceDim) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh(getName(),*_cm));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp1,tmp2;
+ MCAuto<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh(getName(),*_cm));
+ MCAuto<DataArrayInt> tmp1,tmp2;
const DataArrayInt *nodalConn(_conn),*nodalConnI(_conn_indx);
if(!nodalConn)
{
//
if(!_coords)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coords=DataArrayDouble::New(); coords->alloc(0,spaceDim);
+ MCAuto<DataArrayDouble> coords=DataArrayDouble::New(); coords->alloc(0,spaceDim);
ret->setCoords(coords);
}
else
{
checkFullyDefined();
int spaceDim(getSpaceDimension()),nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim);
+ MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim);
double *bbox(ret->getPointer());
for(int i=0;i<nbOfCells*spaceDim;i++)
{
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds : presence of array with not exactly one component !");
nbOfTuples+=(*it)->getNumberOfTuples();
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbOfTuples,1);
+ MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbOfTuples,1);
int *pt=ret->getPointer();
int i=0;
for(std::vector<const DataArrayInt *>::const_iterator it=nodalConns.begin();it!=nodalConns.end();it++,i++)
if(gts.size()!=1)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::New : input mesh must have exactly one geometric type !");
int geoType((int)*gts.begin());
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1DGTUMesh> ret(MEDCoupling1DGTUMesh::New(m->getName(),*gts.begin()));
+ MCAuto<MEDCoupling1DGTUMesh> ret(MEDCoupling1DGTUMesh::New(m->getName(),*gts.begin()));
ret->setCoords(m->getCoords()); ret->setDescription(m->getDescription());
int nbCells(m->getNumberOfCells());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(DataArrayInt::New()),connI(DataArrayInt::New());
- conn->alloc(m->getMeshLength()-nbCells,1); connI->alloc(nbCells+1,1);
+ MCAuto<DataArrayInt> 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<nbCells;i++,ciin++,ci++)
#include "MEDCoupling.hxx"
#include "MEDCouplingPointSet.hxx"
#include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "CellModel.hxx"
MEDCOUPLING_EXPORT int getNodalConnectivityLength() 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 checkCoherency() const;
- MEDCOUPLING_EXPORT DataArrayDouble *getBarycenterAndOwner() const;
+ MEDCOUPLING_EXPORT void checkConsistencyLight() const;
+ MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
MEDCOUPLING_EXPORT int getCellContainingPoint(const double *pos, double eps) const;
MEDCOUPLING_EXPORT virtual void allocateCells(int nbOfCells=0) = 0;
MEDCOUPLING_EXPORT virtual void insertNextCell(const int *nodalConnOfCellBg, const int *nodalConnOfCellEnd) = 0;
MEDCOUPLING_EXPORT virtual DataArrayInt *getNodalConnectivity() const = 0;
- MEDCOUPLING_EXPORT virtual void checkCoherencyOfConnectivity() const = 0;
+ MEDCOUPLING_EXPORT virtual void checkConsistencyOfConnectivity() const = 0;
protected:
MEDCoupling1GTUMesh(const std::string& name, const INTERP_KERNEL::CellModel& cm);
MEDCoupling1GTUMesh(const MEDCoupling1GTUMesh& other, bool recDeepCpy);
MEDCOUPLING_EXPORT static MEDCoupling1SGTUMesh *New();
// Copy methods
MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *clone(bool recDeepCpy) const;
- MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *deepCpy() const;
- MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *deepCpyConnectivityOnly() const;
+ MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *deepCopy() const;
+ MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *deepCopyConnectivityOnly() const;
// overload of TimeLabel and RefCountObject
MEDCOUPLING_EXPORT void updateTime() const;
MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() 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 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;
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<bool>& nodeIdsInUse) const;
MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const;
MEDCOUPLING_EXPORT void checkFullyDefined() const;
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
MEDCoupling1DGTUMesh *computeDualMesh3D() const;
MEDCoupling1DGTUMesh *computeDualMesh2D() const;
private:
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _conn;
+ MCAuto<DataArrayInt> _conn;
public:
static const int HEXA8_FACE_PAIRS[6];
};
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;
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;
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<bool>& nodeIdsInUse) const;
MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const;
MEDCOUPLING_EXPORT void checkFullyDefined() const;
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
void checkDynamicGeoT2ype() const;
static MEDCoupling1DGTUMesh *Merge1DGTUMeshesLL(std::vector<const MEDCoupling1DGTUMesh *>& a);
private:
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _conn_indx;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _conn;
+ MCAuto<DataArrayInt> _conn_indx;
+ MCAuto<DataArrayInt> _conn;
};
}
return new DataArrayDoubleCollection(fieldNames);
}
-DataArrayDoubleCollection *DataArrayDoubleCollection::deepCpy() const
+DataArrayDoubleCollection *DataArrayDoubleCollection::deepCopy() const
{
return new DataArrayDoubleCollection(*this);
}
const DataArrayDouble *otherArr(other._arrs[i].first);
if(!thisArr || !otherArr)
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::copyFrom : empty DataArray !");
- thisArr->cpyFrom(*otherArr);
+ thisArr->deepCopyFrom(*otherArr);
}
}
const DataArrayDouble *DataArrayDoubleCollection::getFieldWithName(const std::string& name) const
{
std::vector<std::string> vec;
- for(std::vector< std::pair< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble>, NatureOfField > >::const_iterator it=_arrs.begin();it!=_arrs.end();it++)
+ for(std::vector< std::pair< MCAuto<DataArrayDouble>, NatureOfField > >::const_iterator it=_arrs.begin();it!=_arrs.end();it++)
{
const DataArrayDouble *obj((*it).first);
if(obj)
DataArrayDouble *DataArrayDoubleCollection::getFieldWithName(const std::string& name)
{
std::vector<std::string> vec;
- for(std::vector< std::pair< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble>, NatureOfField > >::iterator it=_arrs.begin();it!=_arrs.end();it++)
+ for(std::vector< std::pair< MCAuto<DataArrayDouble>, NatureOfField > >::iterator it=_arrs.begin();it!=_arrs.end();it++)
{
DataArrayDouble *obj((*it).first);
if(obj)
_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);
}
_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<DataArrayDouble>);
+ ret+=_arrs.capacity()*sizeof(MCAuto<DataArrayDouble>);
return ret;
}
std::vector<const BigMemoryObject *> DataArrayDoubleCollection::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(std::vector< std::pair< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble>, NatureOfField > >::const_iterator it=_arrs.begin();it!=_arrs.end();it++)
+ for(std::vector< std::pair< MCAuto<DataArrayDouble>, 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<DataArrayDouble>, NatureOfField > >::const_iterator it=_arrs.begin();it!=_arrs.end();it++)
+ for(std::vector< std::pair< MCAuto<DataArrayDouble>, NatureOfField > >::const_iterator it=_arrs.begin();it!=_arrs.end();it++)
{
const DataArrayDouble *pt((*it).first);
if(pt)
bool DataArrayDoubleCollection::IsConservativeNature(NatureOfField n)
{
CheckValidNature(n);
- return n==RevIntegral || n==IntegralGlobConstraint;
+ return n==IntensiveConservation || n==ExtensiveConservation;
}
void DataArrayDoubleCollection::CheckSameNatures(NatureOfField n1, NatureOfField n2)
void DataArrayDoubleCollection::CheckValidNature(NatureOfField n)
{
- if(n!=ConservativeVolumic && n!=Integral && n!=IntegralGlobConstraint && n!=RevIntegral)
+ if(n!=IntensiveMaximum && n!=ExtensiveMaximum && n!=ExtensiveConservation && n!=IntensiveConservation)
throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::CheckValidNature : unrecognized nature !");
}
return new MEDCouplingGridCollection(ms,fieldNames);
}
-MEDCouplingGridCollection *MEDCouplingGridCollection::deepCpy(const MEDCouplingCartesianAMRMeshGen *newGf, const MEDCouplingCartesianAMRMeshGen *oldGf) const
+MEDCouplingGridCollection *MEDCouplingGridCollection::deepCopy(const MEDCouplingCartesianAMRMeshGen *newGf, const MEDCouplingCartesianAMRMeshGen *oldGf) const
{
return new MEDCouplingGridCollection(*this,newGf,oldGf);
}
void MEDCouplingGridCollection::alloc(int ghostLev)
{
- for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
{
int nbTuples((*it).first->getNumberOfCellsAtCurrentLevelGhost(ghostLev));
DataArrayDoubleCollection *dadc((*it).second);
void MEDCouplingGridCollection::dealloc()
{
- for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
{
DataArrayDoubleCollection *dadc((*it).second);
if(dadc)
void MEDCouplingGridCollection::spillInfoOnComponents(const std::vector< std::vector<std::string> >& compNames)
{
- for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
(*it).second->spillInfoOnComponents(compNames);
}
void MEDCouplingGridCollection::spillNatures(const std::vector<NatureOfField>& nfs)
{
- for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
(*it).second->spillNatures(nfs);
}
bool MEDCouplingGridCollection::presenceOf(const MEDCouplingCartesianAMRMeshGen *m, int& pos) const
{
int ret(0);
- for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++,ret++)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++,ret++)
{
if((*it).first==m)
{
*/
void MEDCouplingGridCollection::copyOverlappedZoneFrom(int ghostLev, const MEDCouplingGridCollection& other)
{
- for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
{
std::vector<int> deltaThis,deltaOther;
std::vector< std::pair<int,int> > rgThis((*it).first->positionRelativeToGodFather(deltaThis));
std::vector<int> thisSt((*it).first->getImageMesh()->getCellGridStructure());
std::transform(thisSt.begin(),thisSt.end(),thisSt.begin(),std::bind2nd(std::plus<int>(),2*ghostLev));
- for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::const_iterator it2=other._map_of_dadc.begin();it2!=other._map_of_dadc.end();it2++)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::const_iterator it2=other._map_of_dadc.begin();it2!=other._map_of_dadc.end();it2++)
{
std::vector< std::pair<int,int> > rgOther((*it2).first->positionRelativeToGodFather(deltaOther));
if(MEDCouplingStructuredMesh::AreRangesIntersect(rgThis,rgOther))
{
const DataArrayDouble *otherArr((*it2).second->at(i));
DataArrayDouble *thisArr((*it).second->at(i));
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> partOfOther(MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(otherSt,otherArr,pOther));
+ MCAuto<DataArrayDouble> partOfOther(MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(otherSt,otherArr,pOther));
MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(thisSt,thisArr,pThis,partOfOther);
}
}
{
if(!fine || !coarse)
throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::SynchronizeFineToCoarse : one or more input pointer is NULL !");
- const std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >& mf(fine->_map_of_dadc);
- const std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >& mc(coarse->_map_of_dadc);
- for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::const_iterator it=mf.begin();it!=mf.end();it++)
+ const std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >& mf(fine->_map_of_dadc);
+ const std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >& mc(coarse->_map_of_dadc);
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::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 MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::const_iterator it0=mc.begin();it0!=mc.end() && !found;it0++)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::const_iterator it0=mc.begin();it0!=mc.end() && !found;it0++)
{
if((*it0).first==fatherOfFineMesh)
{
{
if(!fine || !coarse)
throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::SynchronizeCoarseToFine : one or more input pointer is NULL !");
- const std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >& mf(fine->_map_of_dadc);
- const std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >& mc(coarse->_map_of_dadc);
- for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::const_iterator it=mf.begin();it!=mf.end();it++)
+ const std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >& mf(fine->_map_of_dadc);
+ const std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >& mc(coarse->_map_of_dadc);
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::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 MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::const_iterator it0=mc.begin();it0!=mc.end() && !found;it0++)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::const_iterator it0=mc.begin();it0!=mc.end() && !found;it0++)
{
if((*it0).first==fatherOfFineMesh)
{
{
std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> > ret;
std::map<const MEDCouplingCartesianAMRMeshGen *,std::vector< const MEDCouplingCartesianAMRMeshGen * > > m;
- for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
{
const MEDCouplingCartesianAMRMeshGen *fineMesh((*it).first);
const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh(fineMesh->getFather());
{
if(!fine || !coarse)
throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::SynchronizeCoarseToFineOnlyInGhostZone : one or more input pointer is NULL !");
- const std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >& mf(fine->_map_of_dadc);
- const std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >& mc(coarse->_map_of_dadc);
- for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::const_iterator it=mf.begin();it!=mf.end();it++)
+ const std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >& mf(fine->_map_of_dadc);
+ const std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >& mc(coarse->_map_of_dadc);
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::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 MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::const_iterator it0=mc.begin();it0!=mc.end() && !found;it0++)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::const_iterator it0=mc.begin();it0!=mc.end() && !found;it0++)
{
if((*it0).first==fatherOfFineMesh)
{
void MEDCouplingGridCollection::fillIfInTheProgenyOf(const std::string& fieldName, const MEDCouplingCartesianAMRMeshGen *head, std::vector<const DataArrayDouble *>& recurseArrs) const
{
- for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
{
const MEDCouplingCartesianAMRMeshGen *a((*it).first);
if(head==a || head->isObjectInTheProgeny(a))
_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<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> >);
+ ret+=_map_of_dadc.capacity()*sizeof(std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> >);
return ret;
}
std::vector<const BigMemoryObject *> MEDCouplingGridCollection::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::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 MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
{
const MEDCouplingCartesianAMRMeshGen *a((*it).first);
if(a)
{
const MEDCouplingCartesianAMRMesh *gf(other._gf);
if(gf)
- _gf=gf->deepCpy(0);
+ _gf=gf->deepCopy(0);
_tlc.keepTrackOfNewTL(_gf);
}
}
fieldNames2[i].second=(int)fieldNames[i].second.size();
compNames[i]=fieldNames[i].second;
}
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingAMRAttribute> ret(New(gf,fieldNames2,ghostLev));
+ MCAuto<MEDCouplingAMRAttribute> ret(New(gf,fieldNames2,ghostLev));
ret->spillInfoOnComponents(compNames);
return ret.retn();
}
void MEDCouplingAMRAttribute::spillInfoOnComponents(const std::vector< std::vector<std::string> >& compNames)
{
_tlc.checkConst();
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection> >::iterator it=_levs.begin();it!=_levs.end();it++)
+ for(std::vector< MCAuto<MEDCouplingGridCollection> >::iterator it=_levs.begin();it!=_levs.end();it++)
(*it)->spillInfoOnComponents(compNames);
}
void MEDCouplingAMRAttribute::spillNatures(const std::vector<NatureOfField>& nfs)
{
_tlc.checkConst();
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection> >::iterator it=_levs.begin();it!=_levs.end();it++)
+ for(std::vector< MCAuto<MEDCouplingGridCollection> >::iterator it=_levs.begin();it!=_levs.end();it++)
(*it)->spillNatures(nfs);
}
-MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::deepCpy() const
+MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::deepCopy() const
{
return new MEDCouplingAMRAttribute(*this,true);
}
*/
std::vector<DataArrayDouble *> MEDCouplingAMRAttribute::retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
+ for(std::vector< MCAuto<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
{
int tmp(-1);
if((*it)->presenceOf(mesh,tmp))
*/
const DataArrayDouble *MEDCouplingAMRAttribute::getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
+ for(std::vector< MCAuto<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
{
int tmp(-1);
if((*it)->presenceOf(mesh,tmp))
DataArrayDouble *MEDCouplingAMRAttribute::getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName)
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection> >::iterator it=_levs.begin();it!=_levs.end();it++)
+ for(std::vector< MCAuto<MEDCouplingGridCollection> >::iterator it=_levs.begin();it!=_levs.end();it++)
{
int tmp(-1);
if((*it)->presenceOf(mesh,tmp))
{
std::vector<const DataArrayDouble *> recurseArrs;
std::size_t lev(0);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++,lev++)
+ for(std::vector< MCAuto<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++,lev++)
{
int tmp(-1);
if((*it)->presenceOf(mesh,tmp))
MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnWithGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const
{
const DataArrayDouble *arr(0);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
+ for(std::vector< MCAuto<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
{
int tmp(-1);
if((*it)->presenceOf(mesh,tmp))
}
if(!arr)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::buildCellFieldOnWithGhost : the mesh specified is not in the progeny of this !");
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingIMesh> im(mesh->getImageMesh()->buildWithGhost(_ghost_lev));
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(ON_CELLS));
+ MCAuto<MEDCouplingIMesh> im(mesh->getImageMesh()->buildWithGhost(_ghost_lev));
+ MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(ON_CELLS));
ret->setMesh(im);
ret->setArray(const_cast<DataArrayDouble *>(arr));
ret->setName(arr->getName());
MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const
{
const DataArrayDouble *arr(0);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
+ for(std::vector< MCAuto<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
{
int tmp(-1);
if((*it)->presenceOf(mesh,tmp))
if(!arr)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost : the mesh specified is not in the progeny of this !");
//
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingIMesh> im(mesh->getImageMesh()->buildWithGhost(_ghost_lev));
+ MCAuto<MEDCouplingIMesh> im(mesh->getImageMesh()->buildWithGhost(_ghost_lev));
std::vector<int> cgs(mesh->getImageMesh()->getCellGridStructure()),cgsWG(im->getCellGridStructure());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2(DataArrayDouble::New());
+ MCAuto<DataArrayDouble> arr2(DataArrayDouble::New());
arr2->alloc(mesh->getImageMesh()->getNumberOfCells(),arr->getNumberOfComponents());
std::vector< std::pair<int,int> > cgs2(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(cgs));
MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(cgs2,_ghost_lev);
MEDCouplingIMesh::SpreadCoarseToFine(arr,cgsWG,arr2,cgs2,fakeFactors);
arr2->copyStringInfoFrom(*arr);
//
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(ON_CELLS));
+ MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(ON_CELLS));
ret->setMesh(mesh->getImageMesh());
ret->setArray(arr2);
ret->setName(arr->getName());
{
std::vector<MEDCouplingCartesianAMRPatchGen *> patches(gf->retrieveGridsAt(i));
std::size_t sz(patches.size());
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRPatchGen> > patchesSafe(sz);
+ std::vector< MCAuto<MEDCouplingCartesianAMRPatchGen> > patchesSafe(sz);
for(std::size_t j=0;j<sz;j++)
patchesSafe[j]=patches[j];
if(sz==0)
const DataArrayDoubleCollection& ddc(_levs[i]->getFieldsAt(tmp));
std::vector<DataArrayDouble *> arrs(ddc.retrieveFields());
std::size_t nbFields(arrs.size());
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrsSafe(nbFields),arrs2Safe(nbFields);
+ std::vector< MCAuto<DataArrayDouble> > arrsSafe(nbFields),arrs2Safe(nbFields);
std::vector< const MEDCouplingFieldDouble *> fields(nbFields);
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> > fieldsSafe(nbFields);
+ std::vector< MCAuto<MEDCouplingFieldDouble> > fieldsSafe(nbFields);
for(std::size_t pp=0;pp<nbFields;pp++)
arrsSafe[pp]=arrs[pp];
for(std::size_t pp=0;pp<nbFields;pp++)
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingIMesh> im(mesh->getImageMesh()->buildWithGhost(_ghost_lev));
+ MCAuto<MEDCouplingIMesh> im(mesh->getImageMesh()->buildWithGhost(_ghost_lev));
std::vector<int> cgs(mesh->getImageMesh()->getCellGridStructure()),cgsWG(im->getCellGridStructure());
arrs2Safe[pp]=DataArrayDouble::New();
arrs2Safe[pp]->alloc(mesh->getImageMesh()->getNumberOfCells(),arrs[pp]->getNumberOfComponents());
if(!lev0)
throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::projectTo : lev0 is NULL !");
std::vector< std::pair < std::string, std::vector<std::string> > > fieldNames(lev0->getInfoOnComponents());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingAMRAttribute> ret(MEDCouplingAMRAttribute::New(targetGF,fieldNames,_ghost_lev));
+ MCAuto<MEDCouplingAMRAttribute> ret(MEDCouplingAMRAttribute::New(targetGF,fieldNames,_ghost_lev));
ret->spillNatures(lev0->getNatures());
ret->alloc();
int nbLevs(getNumberOfLevels());
void MEDCouplingAMRAttribute::alloc()
{
_tlc.resetState();
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection> >::iterator it=_levs.begin();it!=_levs.end();it++)
+ for(std::vector< MCAuto<MEDCouplingGridCollection> >::iterator it=_levs.begin();it!=_levs.end();it++)
{
MEDCouplingGridCollection *elt(*it);
if(elt)
void MEDCouplingAMRAttribute::dealloc()
{
_tlc.checkConst();
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection> >::iterator it=_levs.begin();it!=_levs.end();it++)
+ for(std::vector< MCAuto<MEDCouplingGridCollection> >::iterator it=_levs.begin();it!=_levs.end();it++)
{
MEDCouplingGridCollection *elt(*it);
if(elt)
std::size_t MEDCouplingAMRAttribute::getHeapMemorySizeWithoutChildren() const
{
std::size_t ret(sizeof(MEDCouplingAMRAttribute));
- ret+=_levs.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection>);
+ ret+=_levs.capacity()*sizeof(MCAuto<MEDCouplingGridCollection>);
return ret;
}
std::vector<const BigMemoryObject *> MEDCouplingAMRAttribute::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
+ for(std::vector< MCAuto<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
ret.push_back((const MEDCouplingGridCollection *)*it);
return ret;
}
{
std::vector<MEDCouplingCartesianAMRPatchGen *> patches(gf->retrieveGridsAt(i));
std::size_t sz(patches.size());
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRPatchGen> > patchesSafe(patches.size());
+ std::vector< MCAuto<MEDCouplingCartesianAMRPatchGen> > patchesSafe(patches.size());
for(std::size_t j=0;j<sz;j++)
patchesSafe[j]=patches[j];
std::vector<const MEDCouplingCartesianAMRMeshGen *> ms(sz);
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)
const DataArrayDoubleCollection& MEDCouplingAMRAttribute::findCollectionAttachedTo(const MEDCouplingCartesianAMRMeshGen *m) const
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
+ for(std::vector< MCAuto<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
{
const MEDCouplingGridCollection *elt(*it);
if(elt)
{
public:
static DataArrayDoubleCollection *New(const std::vector< std::pair<std::string,int> >& fieldNames);
- DataArrayDoubleCollection *deepCpy() const;
+ DataArrayDoubleCollection *deepCopy() const;
void allocTuples(int nbOfTuples);
void dellocTuples();
void copyFrom(const DataArrayDoubleCollection& other);
static void CheckSameNatures(NatureOfField n1, NatureOfField n2);
static void CheckValidNature(NatureOfField n);
private:
- std::vector< std::pair< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble>, NatureOfField > > _arrs;
+ std::vector< std::pair< MCAuto<DataArrayDouble>, NatureOfField > > _arrs;
};
class MEDCouplingGridCollection : public RefCountObject, public TimeLabel
{
public:
static MEDCouplingGridCollection *New(const std::vector<const MEDCouplingCartesianAMRMeshGen *>& ms, const std::vector< std::pair<std::string,int> >& 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<std::string> >& compNames);
std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
void updateTime() const;
private:
- std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > > _map_of_dadc;
+ std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MCAuto<DataArrayDoubleCollection> > > _map_of_dadc;
};
/// @endcond
virtual bool changeGodFather(MEDCouplingCartesianAMRMesh *gf);
MEDCouplingDataForGodFather(const MEDCouplingDataForGodFather& other, bool deepCpyGF);
protected:
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRMesh> _gf;
+ MCAuto<MEDCouplingCartesianAMRMesh> _gf;
TimeLabelConstOverseer _tlc;
};
MEDCOUPLING_EXPORT static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair<std::string, std::vector<std::string> > >& fieldNames, int ghostLev);
MEDCOUPLING_EXPORT void spillInfoOnComponents(const std::vector< std::vector<std::string> >& compNames);
MEDCOUPLING_EXPORT void spillNatures(const std::vector<NatureOfField>& 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<DataArrayDouble *> retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const;
void synchronizeCoarseToFineByOneLevel(int level);
private:
int _ghost_lev;
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection> > _levs;
+ std::vector< MCAuto<MEDCouplingGridCollection> > _levs;
std::vector< std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> > > _neighbors;
std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> > _mixed_lev_neighbors;
std::vector< std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> > > _cross_lev_neighbors;
+++ /dev/null
-// 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 T>
- 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<class T, class U>
- typename MEDCoupling::MEDCouplingAutoRefCountObjectPtr<U> DynamicCast(typename MEDCoupling::MEDCouplingAutoRefCountObjectPtr<T>& autoSubPtr) throw()
- {
- T *subPtr(autoSubPtr);
- U *ptr(dynamic_cast<U *>(subPtr));
- typename MEDCoupling::MEDCouplingAutoRefCountObjectPtr<U> ret(ptr);
- if(ptr)
- ptr->incrRef();
- return ret;
- }
-
- template<class T, class U>
- typename MEDCoupling::MEDCouplingAutoRefCountObjectPtr<U> DynamicCastSafe(typename MEDCoupling::MEDCouplingAutoRefCountObjectPtr<T>& autoSubPtr)
- {
- T *subPtr(autoSubPtr);
- U *ptr(dynamic_cast<U *>(subPtr));
- if(subPtr && !ptr)
- throw INTERP_KERNEL::Exception("DynamicCastSafe : U is not a subtype of T !");
- typename MEDCoupling::MEDCouplingAutoRefCountObjectPtr<U> ret(ptr);
- if(ptr)
- ptr->incrRef();
- return ret;
- }
-}
-
-#endif
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;
}
return ret;
}
-MEDCouplingCMesh *MEDCouplingCMesh::deepCpy() const
+MEDCouplingCMesh *MEDCouplingCMesh::deepCopy() const
{
return clone(true);
}
MEDCouplingCurveLinearMesh *MEDCouplingCMesh::buildCurveLinear() const
{
- checkCoherency();
+ checkConsistencyLight();
int dim(getSpaceDimension());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCurveLinearMesh> ret(MEDCouplingCurveLinearMesh::New());
+ MCAuto<MEDCouplingCurveLinearMesh> ret(MEDCouplingCurveLinearMesh::New());
ret->MEDCouplingStructuredMesh::operator=(*this);
INTERP_KERNEL::AutoPtr<int> ngs(new int[dim]);
getNodeGridStructure(ngs);
ret->setNodeGridStructure(ngs,ngs+dim);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coo(getCoordinatesAndOwner());
+ MCAuto<DataArrayDouble> coo(getCoordinatesAndOwner());
ret->setCoords(coo);
return ret.retn();
}
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.";
}
}
-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)
MEDCouplingStructuredMesh *MEDCouplingCMesh::buildStructuredSubPart(const std::vector< std::pair<int,int> >& 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<MEDCouplingCMesh> ret(dynamic_cast<MEDCouplingCMesh *>(deepCpy()));
+ MCAuto<MEDCouplingCMesh> ret(dynamic_cast<MEDCouplingCMesh *>(deepCopy()));
for(int i=0;i<dim;i++)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp(ret->getCoordsAt(i)->selectByTupleId2(cellPart[i].first,cellPart[i].second+1,1));
+ MCAuto<DataArrayDouble> tmp(ret->getCoordsAt(i)->selectByTupleIdSafeSlice(cellPart[i].first,cellPart[i].second+1,1));
ret->setCoordsAt(i,tmp);
}
return ret.retn();
*/
DataArrayDouble *MEDCouplingCMesh::getCoordinatesAndOwner() const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret(DataArrayDouble::New());
+ MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
int spaceDim(getSpaceDimension()),nbNodes(getNumberOfNodes());
ret->alloc(nbNodes,spaceDim);
double *pt(ret->getPointer());
* 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();
DataArrayDouble *MEDCouplingCMesh::computeIsoBarycenterOfNodesPerCell() const
{
- return MEDCouplingCMesh::getBarycenterAndOwner();
+ return MEDCouplingCMesh::computeCellCenterOfMass();
}
void MEDCouplingCMesh::renumberCells(const int *old2NewBg, bool check)
thisArr[i]->writeVTK(ofs,8,"Array",byteData);
else
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coo=DataArrayDouble::New(); coo->alloc(1,1);
+ MCAuto<DataArrayDouble> coo=DataArrayDouble::New(); coo->alloc(1,1);
coo->setIJ(0,0,0.);
coo->writeVTK(ofs,8,"Array",byteData);
}
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;
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<double>& coo) const;
MEDCOUPLING_EXPORT std::string simpleRepr() const;
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
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;
{
const MEDCouplingCartesianAMRMeshGen *mesh(other._mesh);
if(mesh)
- _mesh=mesh->deepCpy(father);
+ _mesh=mesh->deepCopy(father);
}
const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRPatchGen::getMeshSafe() const
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);
}
std::vector< std::pair<int,int> > p2RefinedAbs(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dimsP2NotRefined));
std::vector<int> dimsP2RefinedGhost(dimsP2Refined.size());
std::transform(dimsP2Refined.begin(),dimsP2Refined.end(),dimsP2RefinedGhost.begin(),std::bind2nd(std::plus<int>(),2*ghostLev));
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> fineP2(DataArrayDouble::New()); fineP2->alloc(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(dimsP2RefinedGhost),dataOnP2->getNumberOfComponents());
+ MCAuto<DataArrayDouble> fineP2(DataArrayDouble::New()); fineP2->alloc(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(dimsP2RefinedGhost),dataOnP2->getNumberOfComponents());
MEDCouplingIMesh::SpreadCoarseToFineGhost(dataOnP2,dimsP2NotRefined,fineP2,p2RefinedAbs,factors,ghostLev);
if(isConservative)
{
ApplyFactorsOnCompactFrmt(dimsFine,factors);
ApplyAllGhostOnCompactFrmt(dimsFine,ghostLev);
//
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ghostVals(MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(dimsFine),dataOnP2,tmp2));
+ MCAuto<DataArrayDouble> ghostVals(MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(dimsFine),dataOnP2,tmp2));
MEDCouplingIMesh::CondenseFineToCoarse(dimsCoarse,ghostVals,interstRange,fakeFactors,dataOnP1);
}
{
}
-MEDCouplingCartesianAMRPatchGF *MEDCouplingCartesianAMRPatchGF::deepCpy(MEDCouplingCartesianAMRMeshGen *father) const
+MEDCouplingCartesianAMRPatchGF *MEDCouplingCartesianAMRPatchGF::deepCopy(MEDCouplingCartesianAMRMeshGen *father) const
{
return new MEDCouplingCartesianAMRPatchGF(*this,father);
}
int MEDCouplingCartesianAMRMeshGen::getMaxNumberOfLevelsRelativeToThis() const
{
int ret(1);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
+ for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
ret=std::max(ret,(*it)->getMaxNumberOfLevelsRelativeToThis()+1);
return ret;
}
*/
int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsAtCurrentLevelGhost(int ghostLev) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingIMesh> tmp(_mesh->buildWithGhost(ghostLev));
+ MCAuto<MEDCouplingIMesh> tmp(_mesh->buildWithGhost(ghostLev));
return tmp->getNumberOfCells();
}
int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithOverlap() const
{
int ret(_mesh->getNumberOfCells());
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
+ for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
{
ret+=(*it)->getNumberOfCellsRecursiveWithOverlap();
}
int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithoutOverlap() const
{
int ret(_mesh->getNumberOfCells());
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
+ for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
{
ret-=(*it)->getNumberOfOverlapedCellsForFather();
ret+=(*it)->getNumberOfCellsRecursiveWithoutOverlap();
void MEDCouplingCartesianAMRMeshGen::addPatch(const std::vector< std::pair<int,int> >& bottomLeftTopRight, const std::vector<int>& factors)
{
checkFactorsAndIfNotSetAssign(factors);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingIMesh> mesh(static_cast<MEDCouplingIMesh *>(_mesh->buildStructuredSubPart(bottomLeftTopRight)));
+ MCAuto<MEDCouplingIMesh> mesh(static_cast<MEDCouplingIMesh *>(_mesh->buildStructuredSubPart(bottomLeftTopRight)));
mesh->refineWithFactor(factors);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRMeshSub> zeMesh(new MEDCouplingCartesianAMRMeshSub(this,mesh));
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRPatch> elt(new MEDCouplingCartesianAMRPatch(zeMesh,bottomLeftTopRight));
+ MCAuto<MEDCouplingCartesianAMRMeshSub> zeMesh(new MEDCouplingCartesianAMRMeshSub(this,mesh));
+ MCAuto<MEDCouplingCartesianAMRPatch> elt(new MEDCouplingCartesianAMRPatch(zeMesh,bottomLeftTopRight));
_patches.push_back(elt);
declareAsNew();
}
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<InternalPatch> extractPart(const std::vector< std::pair<int,int> >&partInGlobal) const;
- MEDCouplingAutoRefCountObjectPtr<InternalPatch> deepCpy() const;
+ MCAuto<InternalPatch> extractPart(const std::vector< std::pair<int,int> >&partInGlobal) const;
+ MCAuto<InternalPatch> deepCopy() const;
protected:
~InternalPatch() { }
private:
_nb_of_true=(int)std::count(_crit.begin(),_crit.end(),true);
}
-MEDCouplingAutoRefCountObjectPtr<InternalPatch> InternalPatch::extractPart(const std::vector< std::pair<int,int> >&partInGlobal) const
+MCAuto<InternalPatch> InternalPatch::extractPart(const std::vector< std::pair<int,int> >&partInGlobal) const
{
- MEDCouplingAutoRefCountObjectPtr<InternalPatch> ret(new InternalPatch);
+ MCAuto<InternalPatch> ret(new InternalPatch);
std::vector<int> cgs(computeCGS());
std::vector< std::pair<int,int> > newPart;
MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(_part,partInGlobal,newPart);
return ret;
}
-MEDCouplingAutoRefCountObjectPtr<InternalPatch> InternalPatch::deepCpy() const
+MCAuto<InternalPatch> InternalPatch::deepCopy() const
{
- MEDCouplingAutoRefCountObjectPtr<InternalPatch> ret(new InternalPatch);
+ MCAuto<InternalPatch> ret(new InternalPatch);
(*ret)=*this;
return ret;
}
rectH[axisId].second=patchToBeSplit->getConstPart()[axisId].first+i;
else
rectH[axisId].first=patchToBeSplit->getConstPart()[axisId].first+i;
- MEDCouplingAutoRefCountObjectPtr<InternalPatch> p(patchToBeSplit->deepCpy());
+ MCAuto<InternalPatch> p(patchToBeSplit->deepCopy());
p->zipToFitOnCriterion(bso.getMinimumPatchLength());
efficiencyPerAxis[h]=p->getEfficiencyPerAxis(axisId);
}
return true;
}
-MEDCouplingAutoRefCountObjectPtr<InternalPatch> DealWithNoCut(const InternalPatch *patch)
+MCAuto<InternalPatch> DealWithNoCut(const InternalPatch *patch)
{
- MEDCouplingAutoRefCountObjectPtr<InternalPatch> ret(const_cast<InternalPatch *>(patch));
+ MCAuto<InternalPatch> ret(const_cast<InternalPatch *>(patch));
ret->incrRef();
return ret;
}
-void DealWithCut(double minPatchLgth, const InternalPatch *patchToBeSplit, int axisId, int cutPlace, std::vector<MEDCouplingAutoRefCountObjectPtr<InternalPatch> >& listOfPatches)
+void DealWithCut(double minPatchLgth, const InternalPatch *patchToBeSplit, int axisId, int cutPlace, std::vector<MCAuto<InternalPatch> >& listOfPatches)
{
- MEDCouplingAutoRefCountObjectPtr<InternalPatch> leftPart,rightPart;
+ MCAuto<InternalPatch> leftPart,rightPart;
std::vector< std::pair<int,int> > rect(patchToBeSplit->getConstPart());
std::vector< std::pair<int,int> > leftRect(rect),rightRect(rect);
leftRect[axisId].second=cutPlace+1;
{
checkPatchId(patchId);
int sz((int)_patches.size()),j(0);
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRPatch> > patches(sz-1);
+ std::vector< MCAuto<MEDCouplingCartesianAMRPatch> > patches(sz-1);
for(int i=0;i<sz;i++)
if(i!=patchId)
patches[j++]=_patches[i];
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion : the number of tuples of criterion array must be equal to the number of cells at the current level !");
_patches.clear();
std::vector<int> cgs(_mesh->getCellGridStructure());
- std::vector< MEDCouplingAutoRefCountObjectPtr<InternalPatch> > listOfPatches,listOfPatchesOK;
+ std::vector< MCAuto<InternalPatch> > listOfPatches,listOfPatchesOK;
//
- MEDCouplingAutoRefCountObjectPtr<InternalPatch> p(new InternalPatch);
+ MCAuto<InternalPatch> 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<InternalPatch> > listOfPatchesTmp;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<InternalPatch> >::iterator it=listOfPatches.begin();it!=listOfPatches.end();it++)
+ std::vector< MCAuto<InternalPatch> > listOfPatchesTmp;
+ for(std::vector< MCAuto<InternalPatch> >::iterator it=listOfPatches.begin();it!=listOfPatches.end();it++)
{
//
int axisId,largestLength,cutPlace;
}
listOfPatches=listOfPatchesTmp;
}
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<InternalPatch> >::const_iterator it=listOfPatchesOK.begin();it!=listOfPatchesOK.end();it++)
+ for(std::vector< MCAuto<InternalPatch> >::const_iterator it=listOfPatchesOK.begin();it!=listOfPatchesOK.end();it++)
addPatch((*it)->getConstPart(),factors);
declareAsNew();
}
int MEDCouplingCartesianAMRMeshGen::getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const
{
int ret(0);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++,ret++)
+ for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++,ret++)
{
if((*it)->getMesh()==mesh)
return ret;
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<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(fine->getNumberOfCells(),cellFieldOnThis->getNumberOfComponents());
+ MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(fine->getNumberOfCells(),cellFieldOnThis->getNumberOfComponents());
ret->copyStringInfoFrom(*cellFieldOnThis);
MEDCouplingIMesh::SpreadCoarseToFine(cellFieldOnThis,_mesh->getCellGridStructure(),ret,patch->getBLTRRange(),getFactors());
return ret.retn();
DataArrayInt *MEDCouplingCartesianAMRMeshGen::findPatchesInTheNeighborhoodOf(int patchId, int ghostLev) const
{
int nbp(getNumberOfPatches());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
for(int i=0;i<nbp;i++)
{
if(i!=patchId)
MEDCouplingUMesh *MEDCouplingCartesianAMRMeshGen::buildUnstructured() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> part(_mesh->buildUnstructured());
+ MCAuto<MEDCouplingUMesh> part(_mesh->buildUnstructured());
std::vector<bool> bs(_mesh->getNumberOfCells(),false);
std::vector<int> cgs(_mesh->getCellGridStructure());
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> > msSafe(_patches.size()+1);
+ std::vector< MCAuto<MEDCouplingUMesh> > msSafe(_patches.size()+1);
std::size_t ii(0);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++,ii++)
+ for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++,ii++)
{
MEDCouplingStructuredMesh::SwitchOnIdsFrom(cgs,(*it)->getBLTRRange(),bs);
msSafe[ii+1]=(*it)->getMesh()->buildUnstructured();
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> eltsOff(DataArrayInt::BuildListOfSwitchedOff(bs));
+ MCAuto<DataArrayInt> eltsOff(DataArrayInt::BuildListOfSwitchedOff(bs));
msSafe[0]=static_cast<MEDCouplingUMesh *>(part->buildPartOfMySelf(eltsOff->begin(),eltsOff->end(),false));
std::vector< const MEDCouplingUMesh * > ms(msSafe.size());
for(std::size_t i=0;i<msSafe.size();i++)
MEDCoupling1SGTUMesh *MEDCouplingCartesianAMRMeshGen::buildMeshFromPatchEnvelop() const
{
std::vector<const MEDCoupling1SGTUMesh *> cells;
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> > cellsSafe;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
+ std::vector< MCAuto<MEDCoupling1SGTUMesh> > cellsSafe;
+ for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
{
const MEDCouplingCartesianAMRPatch *patch(*it);
if(patch)
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingIMesh> cell(patch->getMesh()->getImageMesh()->asSingleCell());
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> cell1SGT(cell->build1SGTUnstructured());
+ MCAuto<MEDCouplingIMesh> cell(patch->getMesh()->getImageMesh()->asSingleCell());
+ MCAuto<MEDCoupling1SGTUMesh> cell1SGT(cell->build1SGTUnstructured());
cellsSafe.push_back(cell1SGT); cells.push_back(cell1SGT);
}
}
MEDCoupling1SGTUMesh *MEDCouplingCartesianAMRMeshGen::buildMeshOfDirectChildrenOnly() const
{
std::vector<const MEDCoupling1SGTUMesh *> patches;
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> > patchesSafe;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
+ std::vector< MCAuto<MEDCoupling1SGTUMesh> > patchesSafe;
+ for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
{
const MEDCouplingCartesianAMRPatch *patch(*it);
if(patch)
{
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> patchMesh(patch->getMesh()->getImageMesh()->build1SGTUnstructured());
+ MCAuto<MEDCoupling1SGTUMesh> patchMesh(patch->getMesh()->getImageMesh()->build1SGTUnstructured());
patchesSafe.push_back(patchMesh); patches.push_back(patchMesh);
}
}
//
std::vector<bool> bs(_mesh->getNumberOfCells(),false);
std::vector<int> cgs(_mesh->getCellGridStructure());
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> > msSafe(_patches.size()+1);
+ std::vector< MCAuto<MEDCouplingFieldDouble> > msSafe(_patches.size()+1);
std::size_t ii(0);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++,ii++)
+ for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++,ii++)
{
MEDCouplingStructuredMesh::SwitchOnIdsFrom(cgs,(*it)->getBLTRRange(),bs);
std::vector<const DataArrayDouble *> tmpArrs(extractSubTreeFromGlobalFlatten((*it)->getMesh(),recurseArrs));
msSafe[ii+1]=(*it)->getMesh()->buildCellFieldOnRecurseWithoutOverlapWithoutGhost(ghostSz,tmpArrs);
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> eltsOff(DataArrayInt::BuildListOfSwitchedOff(bs));
+ MCAuto<DataArrayInt> eltsOff(DataArrayInt::BuildListOfSwitchedOff(bs));
//
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(ON_CELLS));
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2(extractGhostFrom(ghostSz,recurseArrs[0]));
+ MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(ON_CELLS));
+ MCAuto<DataArrayDouble> arr2(extractGhostFrom(ghostSz,recurseArrs[0]));
arr2=arr2->selectByTupleIdSafe(eltsOff->begin(),eltsOff->end());
ret->setArray(arr2);
ret->setName(arr2->getName());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> part(_mesh->buildUnstructured());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> mesh(part->buildPartOfMySelf(eltsOff->begin(),eltsOff->end(),false));
+ MCAuto<MEDCouplingUMesh> part(_mesh->buildUnstructured());
+ MCAuto<MEDCouplingMesh> mesh(part->buildPartOfMySelf(eltsOff->begin(),eltsOff->end(),false));
ret->setMesh(mesh);
msSafe[0]=ret;
//
std::vector< std::pair<int,int> > p(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(st));
std::transform(st.begin(),st.end(),st.begin(),std::bind2nd(std::plus<int>(),2*ghostSz));
MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(p,ghostSz);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret(MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,arr,p));
+ MCAuto<DataArrayDouble> ret(MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,arr,p));
return ret.retn();
}
{
const MEDCouplingIMesh *mesh(other._mesh);
if(mesh)
- _mesh=static_cast<MEDCouplingIMesh *>(mesh->deepCpy());
+ _mesh=static_cast<MEDCouplingIMesh *>(mesh->deepCopy());
std::size_t sz(other._patches.size());
for(std::size_t i=0;i<sz;i++)
{
const MEDCouplingCartesianAMRPatch *patch(other._patches[i]);
if(patch)
- _patches[i]=patch->deepCpy(this);
+ _patches[i]=patch->deepCopy(this);
}
}
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen(MEDCouplingIMesh *mesh) constructor : The input mesh is null !");
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
_mesh=mesh; _mesh->incrRef();
}
}
}
-void MEDCouplingCartesianAMRMeshGen::retrieveGridsAtInternal(int lev, std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRPatchGen> >& grids) const
+void MEDCouplingCartesianAMRMeshGen::retrieveGridsAtInternal(int lev, std::vector< MCAuto<MEDCouplingCartesianAMRPatchGen> >& grids) const
{
if(lev==0)
{
const MEDCouplingCartesianAMRMesh *thisc(dynamic_cast<const MEDCouplingCartesianAMRMesh *>(this));//tony
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRPatchGF> elt(new MEDCouplingCartesianAMRPatchGF(const_cast<MEDCouplingCartesianAMRMesh *>(thisc)));
+ MCAuto<MEDCouplingCartesianAMRPatchGF> elt(new MEDCouplingCartesianAMRPatchGF(const_cast<MEDCouplingCartesianAMRMesh *>(thisc)));
grids.push_back(DynamicCastSafe<MEDCouplingCartesianAMRPatchGF,MEDCouplingCartesianAMRPatchGen>(elt));
}
else if(lev==1)
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
+ for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
{
const MEDCouplingCartesianAMRPatch *pt(*it);
if(pt)
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRPatch> tmp1(*it);
+ MCAuto<MEDCouplingCartesianAMRPatch> tmp1(*it);
grids.push_back(DynamicCastSafe<MEDCouplingCartesianAMRPatch,MEDCouplingCartesianAMRPatchGen>(tmp1));
}
}
}
else
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
+ for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
{
const MEDCouplingCartesianAMRPatch *pt(*it);
if(pt)
void MEDCouplingCartesianAMRMeshGen::dumpPatchesOf(const std::string& varName, std::ostream& oss) const
{
std::size_t j(0);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
+ for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
{
const MEDCouplingCartesianAMRPatch *patch(*it);
if(patch)
{
std::vector<const BigMemoryObject *> ret;
ret.push_back((const MEDCouplingIMesh *)_mesh);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
+ for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
ret.push_back((const MEDCouplingCartesianAMRPatch*)*it);
return ret;
}
{
if((const MEDCouplingIMesh *)_mesh)
updateTimeWith(*_mesh);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
+ for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
{
const MEDCouplingCartesianAMRPatch *elt(*it);
if(!elt)
{
}
-MEDCouplingCartesianAMRMeshSub *MEDCouplingCartesianAMRMeshSub::deepCpy(MEDCouplingCartesianAMRMeshGen *fath) const
+MEDCouplingCartesianAMRMeshSub *MEDCouplingCartesianAMRMeshSub::deepCopy(MEDCouplingCartesianAMRMeshGen *fath) const
{
return new MEDCouplingCartesianAMRMeshSub(*this,fath);
}
std::vector<MEDCouplingCartesianAMRPatchGen *> MEDCouplingCartesianAMRMesh::retrieveGridsAt(int absoluteLev) const
{
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRPatchGen> > rets;
+ std::vector< MCAuto<MEDCouplingCartesianAMRPatchGen> > rets;
retrieveGridsAtInternal(absoluteLev,rets);
std::vector< MEDCouplingCartesianAMRPatchGen * > ret(rets.size());
for(std::size_t i=0;i<rets.size();i++)
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);
}
//
std::vector<MEDCouplingCartesianAMRPatchGen *> elts(retrieveGridsAt((int)(i)));
std::size_t sz(elts.size());
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRPatchGen> > elts2(sz);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > elts3(sz);
+ std::vector< MCAuto<MEDCouplingCartesianAMRPatchGen> > elts2(sz);
+ std::vector< MCAuto<DataArrayDouble> > elts3(sz);
for(std::size_t ii=0;ii<sz;ii++)
elts2[ii]=elts[ii];
//
static const char TMP_STR[]="TMP";
std::vector< std::pair<std::string,int> > fieldNames(1); fieldNames[0].first=TMP_STR; fieldNames[0].second=1;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingAMRAttribute> att(MEDCouplingAMRAttribute::New(this,fieldNames,0));
+ MCAuto<MEDCouplingAMRAttribute> att(MEDCouplingAMRAttribute::New(this,fieldNames,0));
att->alloc();
DataArrayDouble *tmpDa(const_cast<DataArrayDouble *>(att->getFieldOn(this,TMP_STR)));
- tmpDa->cpyFrom(*criterion);
+ tmpDa->deepCopyFrom(*criterion);
att->synchronizeCoarseToFine();
for(std::size_t ii=0;ii<sz;ii++)
{
#include "MEDCoupling.hxx"
#include "MEDCouplingTimeLabel.hxx"
#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "BoxSplittingOptions.hxx"
#include "InterpKernelException.hxx"
class MEDCouplingCartesianAMRPatchGen : public RefCountObject
{
public:
- MEDCOUPLING_EXPORT virtual MEDCouplingCartesianAMRPatchGen *deepCpy(MEDCouplingCartesianAMRMeshGen *father) const = 0;
+ MEDCOUPLING_EXPORT virtual MEDCouplingCartesianAMRPatchGen *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const = 0;
MEDCOUPLING_EXPORT int getNumberOfCellsRecursiveWithOverlap() const;
MEDCOUPLING_EXPORT int getNumberOfCellsRecursiveWithoutOverlap() const;
MEDCOUPLING_EXPORT int getMaxNumberOfLevelsRelativeToThis() const;
private:
std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
protected:
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRMeshGen> _mesh;
+ MCAuto<MEDCouplingCartesianAMRMeshGen> _mesh;
};
/*!
{
public:
MEDCouplingCartesianAMRPatch(MEDCouplingCartesianAMRMeshGen *mesh, const std::vector< std::pair<int,int> >& bottomLeftTopRight);
- MEDCouplingCartesianAMRPatch *deepCpy(MEDCouplingCartesianAMRMeshGen *father) const;
+ MEDCouplingCartesianAMRPatch *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const;
// direct forward to _mesh
MEDCOUPLING_EXPORT void addPatch(const std::vector< std::pair<int,int> >& bottomLeftTopRight, const std::vector<int>& factors);
// end of direct forward to _mesh
{
public:
MEDCouplingCartesianAMRPatchGF(MEDCouplingCartesianAMRMesh *mesh);
- MEDCouplingCartesianAMRPatchGF *deepCpy(MEDCouplingCartesianAMRMeshGen *father) const;
+ MEDCouplingCartesianAMRPatchGF *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const;
private:
std::size_t getHeapMemorySizeWithoutChildren() const;
private:
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<int>& getFactors() const { return _factors; }
MEDCOUPLING_EXPORT void setFactors(const std::vector<int>& newFactors);
MEDCouplingCartesianAMRMeshGen(MEDCouplingIMesh *mesh);
void checkPatchId(int patchId) const;
void checkFactorsAndIfNotSetAssign(const std::vector<int>& factors);
- void retrieveGridsAtInternal(int lev, std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRPatchGen> >& grids) const;
+ void retrieveGridsAtInternal(int lev, std::vector< MCAuto<MEDCouplingCartesianAMRPatchGen> >& grids) const;
static int GetGhostLevelInFineRef(int ghostLev, const std::vector<int>& factors);
std::vector<const DataArrayDouble *> extractSubTreeFromGlobalFlatten(const MEDCouplingCartesianAMRMeshGen *head, const std::vector<const DataArrayDouble *>& all) const;
void dumpPatchesOf(const std::string& varName, std::ostream& oss) const;
MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDCOUPLING_EXPORT void updateTime() const;
protected:
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingIMesh> _mesh;
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRPatch> > _patches;
+ MCAuto<MEDCouplingIMesh> _mesh;
+ std::vector< MCAuto<MEDCouplingCartesianAMRPatch> > _patches;
std::vector<int> _factors;
};
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<int>& ret) const;
protected:
MEDCouplingCartesianAMRMeshGen *_father;
MEDCOUPLING_EXPORT std::vector< std::pair<int,int> > positionRelativeToGodFather(std::vector<int>& st) const;
MEDCOUPLING_EXPORT int getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const;
MEDCOUPLING_EXPORT std::vector<MEDCouplingCartesianAMRPatchGen *> retrieveGridsAt(int absoluteLev) const;
- MEDCouplingCartesianAMRMesh *deepCpy(MEDCouplingCartesianAMRMeshGen *father) const;
+ MEDCouplingCartesianAMRMesh *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const;
MEDCOUPLING_EXPORT void createPatchesFromCriterionML(const std::vector<const INTERP_KERNEL::BoxSplittingOptions *>& bso, const DataArrayDouble *criterion, const std::vector< std::vector<int> >& factors, double eps);
private:
void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector<int>& ret) const;
if(deepCopy)
{
if((const DataArrayDouble *)other._coords)
- _coords=other._coords->deepCpy();
+ _coords=other._coords->deepCopy();
}
else
_coords=other._coords;
return ret;
}
-MEDCouplingCurveLinearMesh *MEDCouplingCurveLinearMesh::deepCpy() const
+MEDCouplingCurveLinearMesh *MEDCouplingCurveLinearMesh::deepCopy() const
{
return clone(true);
}
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<int>::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();
}
MEDCouplingStructuredMesh *MEDCouplingCurveLinearMesh::buildStructuredSubPart(const std::vector< std::pair<int,int> >& cellPart) const
{
- checkCoherency();
+ checkConsistencyLight();
int dim(getSpaceDimension());
std::vector<int> dims(getMeshDimension());
if(dim!=(int)cellPart.size())
std::vector< std::pair<int,int> > nodePartFormat(cellPart);
for(std::vector< std::pair<int,int> >::iterator it=nodePartFormat.begin();it!=nodePartFormat.end();it++)
(*it).second++;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat));
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCurveLinearMesh> ret(dynamic_cast<MEDCouplingCurveLinearMesh *>(deepCpy()));
+ MCAuto<DataArrayInt> tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat));
+ MCAuto<MEDCouplingCurveLinearMesh> ret(dynamic_cast<MEDCouplingCurveLinearMesh *>(deepCopy()));
const DataArrayDouble *coo(ret->getCoords());
if(coo)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coo2(coo->selectByTupleIdSafe(tmp1->begin(),tmp1->end()));
+ MCAuto<DataArrayDouble> coo2(coo->selectByTupleIdSafe(tmp1->begin(),tmp1->end()));
ret->setCoords(coo2);
}
for(int i=0;i<dim;i++)
MEDCouplingFieldDouble *MEDCouplingCurveLinearMesh::getMeasureField(bool isAbs) const
{
- checkCoherency();
+ checkConsistencyLight();
int meshDim=getMeshDimension();
std::string name="MeasureOfMesh_"; name+=getName();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+ MCAuto<MEDCouplingFieldDouble> field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
field->setName(name); field->setMesh(const_cast<MEDCouplingCurveLinearMesh *>(this)); field->synchronizeTimeWithMesh();
switch(meshDim)
{
{
int nbnodes=getNumberOfNodes();
int spaceDim=getSpaceDimension();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New(); field->setArray(arr);
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::New(); field->setArray(arr);
if(nbnodes==0)
{ arr->alloc(0,1); return; }
if(spaceDim==1)
}
else
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp=DataArrayDouble::New(); tmp->alloc(nbnodes-1,spaceDim);
+ MCAuto<DataArrayDouble> tmp=DataArrayDouble::New(); tmp->alloc(nbnodes-1,spaceDim);
std::transform(_coords->begin()+spaceDim,_coords->end(),_coords->begin(),tmp->getPointer(),std::minus<double>());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp2=tmp->magnitude(); field->setArray(tmp2);
+ MCAuto<DataArrayDouble> tmp2=tmp->magnitude(); field->setArray(tmp2);
}
}
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<DataArrayDouble> arr=DataArrayDouble::New(); field->setArray(arr);
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::New(); field->setArray(arr);
arr->alloc(nbcells,1);
double *pt=arr->getPointer();
const double *coords=_coords->begin();
int spaceDim=getSpaceDimension();
if(spaceDim!=3)
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim3 : with meshDim 3 only space dimension 3 is possible !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New(); field->setArray(arr);
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::New(); field->setArray(arr);
arr->alloc(nbcells,1);
double *pt=arr->getPointer();
const double *coords=_coords->begin();
int MEDCouplingCurveLinearMesh::getCellContainingPoint(const double *pos, double eps) const
{
- checkCoherency();
+ checkConsistencyLight();
int spaceDim=getSpaceDimension();
const double *coords=_coords->getConstPointer();
int nodeId=-1;
return ret;
}
-DataArrayDouble *MEDCouplingCurveLinearMesh::getBarycenterAndOwner() const
+DataArrayDouble *MEDCouplingCurveLinearMesh::computeCellCenterOfMass() const
{
- checkCoherency();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ checkConsistencyLight();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
int spaceDim=getSpaceDimension();
int meshDim=getMeshDimension();
int nbOfCells=getNumberOfCells();
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
{
/*!
* \param [in,out] bary Barycenter array feeded with good values.
- * \sa MEDCouplingCurveLinearMesh::getBarycenterAndOwner
+ * \sa MEDCouplingCurveLinearMesh::computeCellCenterOfMass
*/
void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim2(DataArrayDouble *bary) const
{
/*!
* \param [in,out] bary Barycenter array feeded with good values.
- * \sa MEDCouplingCurveLinearMesh::getBarycenterAndOwner
+ * \sa MEDCouplingCurveLinearMesh::computeCellCenterOfMass
*/
void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim1(DataArrayDouble *bary) const
{
_coords->writeVTK(ofs,8,"Points",byteData);
else
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coo=_coords->changeNbOfComponents(3,0.);
+ MCAuto<DataArrayDouble> coo=_coords->changeNbOfComponents(3,0.);
coo->writeVTK(ofs,8,"Points",byteData);
}
ofs << " </Points>\n";
#include "MEDCoupling.hxx"
#include "MEDCouplingStructuredMesh.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
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;
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;
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
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<DataArrayDouble> _coords;
+ MCAuto<DataArrayDouble> _coords;
std::vector<int> _structure;
};
}
{
std::vector<int> ids;
int id=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingDefinitionTimeSlice> >::const_iterator it=_slices.begin();it!=_slices.end();it++,id++)
+ for(std::vector< MCAuto<MEDCouplingDefinitionTimeSlice> >::const_iterator it=_slices.begin();it!=_slices.end();it++,id++)
if((*it)->isContaining(tm,_eps))
ids.push_back(id);
if(ids.empty())
std::vector<double> MEDCouplingDefinitionTime::getHotSpotsTime() const
{
std::vector<double> ret;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingDefinitionTimeSlice> >::const_iterator it=_slices.begin();it!=_slices.end();it++)
+ for(std::vector< MCAuto<MEDCouplingDefinitionTimeSlice> >::const_iterator it=_slices.begin();it!=_slices.end();it++)
{
std::vector<double> tmp;
(*it)->getHotSpotsTime(tmp);
void MEDCouplingDefinitionTime::appendRepr(std::ostream& stream) const
{
stream << "Time definition :\n";
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingDefinitionTimeSlice> >::const_iterator it=_slices.begin();it!=_slices.end();it++)
+ for(std::vector< MCAuto<MEDCouplingDefinitionTimeSlice> >::const_iterator it=_slices.begin();it!=_slices.end();it++)
{
stream << " - ";
(*it)->appendRepr(stream);
#define __PARAMEDMEM_MEDCOUPLINGDEFINITIONTIME_HXX__
#include "MEDCouplingRefCountObject.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "InterpKernelException.hxx"
MEDCOUPLING_EXPORT void unserialize(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
private:
double _eps;
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingDefinitionTimeSlice> > _slices;
+ std::vector< MCAuto<MEDCouplingDefinitionTimeSlice> > _slices;
static const double EPS_DFT;
};
}
+++ /dev/null
-// 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 <limits>
-#include <algorithm>
-#include <functional>
-#include <iterator>
-#include <sstream>
-#include <cmath>
-#include <list>
-#include <set>
-
-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<const BigMemoryObject *> MEDCouplingExtrudedMesh::getDirectChildrenWithNull() const
-{
- std::vector<const BigMemoryObject *> 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<const MEDCouplingExtrudedMesh *>(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<MEDCouplingUMesh *>(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<const MEDCouplingExtrudedMesh *>(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<const MEDCouplingExtrudedMesh *>(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<INTERP_KERNEL::NormalizedCellType> MEDCouplingExtrudedMesh::getAllGeoTypes() const
-{
- std::set<INTERP_KERNEL::NormalizedCellType> ret2D(_mesh2D->getAllGeoTypes());
- std::set<INTERP_KERNEL::NormalizedCellType> ret;
- for(std::set<INTERP_KERNEL::NormalizedCellType>::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<DataArrayInt> ret=DataArrayInt::New();
- if(revExtTyp==INTERP_KERNEL::NORM_ERROR)
- {
- ret->alloc(0,1);
- return ret.retn();
- }
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> 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;i<nbOfLevs;i++,pt+=nbOfTuples)
- std::transform(tmp->begin(),tmp->end(),pt,std::bind2nd(std::plus<int>(),i*nbOfCells2D));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret2=ret->renumberR(_mesh3D_ids->begin());
- ret2->sort();
- return ret2.retn();
-}
-
-DataArrayInt *MEDCouplingExtrudedMesh::computeNbOfNodesPerCell() const
-{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret2D=_mesh2D->computeNbOfNodesPerCell();
- int nbOfLevs=_mesh1D->getNumberOfCells();
- int nbOfCells2D=_mesh2D->getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret3D=DataArrayInt::New(); ret3D->alloc(nbOfLevs*nbOfCells2D,1);
- int *pt=ret3D->getPointer();
- for(int i=0;i<nbOfLevs;i++,pt+=nbOfCells2D)
- std::copy(ret2D->begin(),ret2D->end(),pt);
- ret3D->applyLin(2,0,0);
- return ret3D->renumberR(_mesh3D_ids->begin());
-}
-
-DataArrayInt *MEDCouplingExtrudedMesh::computeNbOfFacesPerCell() const
-{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret2D=_mesh2D->computeNbOfNodesPerCell();
- int nbOfLevs=_mesh1D->getNumberOfCells();
- int nbOfCells2D=_mesh2D->getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret3D=DataArrayInt::New(); ret3D->alloc(nbOfLevs*nbOfCells2D,1);
- int *pt=ret3D->getPointer();
- for(int i=0;i<nbOfLevs;i++,pt+=nbOfCells2D)
- std::copy(ret2D->begin(),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;i<nbOfCells2D;i++)
- {
- INTERP_KERNEL::NormalizedCellType t=_mesh2D->getTypeOfCell(i);
- if(INTERP_KERNEL::CellModel::GetCellModel(t).getExtrudedType()==type)
- ret++;
- }
- return ret*_mesh1D->getNumberOfCells();
-}
-
-void MEDCouplingExtrudedMesh::getNodeIdsOfCell(int cellId, std::vector<int>& conn) const
-{
- int nbOfCells2D=_mesh2D->getNumberOfCells();
- int nbOfNodes2D=_mesh2D->getNumberOfNodes();
- int locId=cellId%nbOfCells2D;
- int lev=cellId/nbOfCells2D;
- std::vector<int> tmp,tmp2;
- _mesh2D->getNodeIdsOfCell(locId,tmp);
- tmp2=tmp;
- std::transform(tmp.begin(),tmp.end(),tmp.begin(),std::bind2nd(std::plus<int>(),nbOfNodes2D*lev));
- std::transform(tmp2.begin(),tmp2.end(),tmp2.begin(),std::bind2nd(std::plus<int>(),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<double>& coo) const
-{
- int nbOfNodes2D=_mesh2D->getNumberOfNodes();
- int locId=nodeId%nbOfNodes2D;
- int lev=nodeId/nbOfNodes2D;
- std::vector<double> 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<double>());
- std::transform(tmp2.begin(),tmp2.end(),z+(lev+1)*spaceDim,tmp2.begin(),std::plus<double>());
- 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<double>::max());
- std::fill(bbox1DMax,bbox1DMax+3,-(std::numeric_limits<double>::max()));
- for(int i=0;i<nbOfNodes1D;i++)
- {
- std::transform(nodes1D+3*i,nodes1D+3*(i+1),bbox1DMin,bbox1DMin,static_cast<const double& (*)(const double&, const double&)>(std::min<double>));
- std::transform(nodes1D+3*i,nodes1D+3*(i+1),bbox1DMax,bbox1DMax,static_cast<const double& (*)(const double&, const double&)>(std::max<double>));
- }
- std::transform(bbox1DMax,bbox1DMax+3,bbox1DMin,tmp,std::minus<double>());
- 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;i<nbOf1DCells;i++)
- for(int j=0;j<nbOf2DCells;j++)
- retPtr[renum[i*nbOf2DCells+j]]=ret2DPtr[j]*ret1DPtr[i];
- ret->setArray(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<nbOf1DLev;i++)
- {
- std::vector<int> 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<int> 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<int>& 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<int> conn2(conn2D+conn2DIndx[*candidate2D]+1,conn2D+conn2DIndx[*candidate2D+1]);
- std::sort(conn2.begin(),conn2.end());
- std::list<int> intersect;
- std::set_intersection(connSorted.begin(),connSorted.end(),conn2.begin(),conn2.end(),
- std::insert_iterator< std::list<int> >(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<int>& 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<int>::const_iterator iter=nodalConnec.begin();iter!=nodalConnec.end();iter++)
- std::transform(zoneToUpdate,zoneToUpdate+3,coords+3*(*iter),zoneToUpdate,std::plus<double>());
- std::transform(zoneToUpdate,zoneToUpdate+3,zoneToUpdate,std::bind2nd(std::multiplies<double>(),(double)(1./(int)nodalConnec.size())));
-}
-
-int MEDCouplingExtrudedMesh::FindCorrespCellByNodalConn(const std::vector<int>& nodalConnec, const int *revNodalPtr, const int *revNodalIndxPtr)
-{
- std::vector<int>::const_iterator iter=nodalConnec.begin();
- std::set<int> s1(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1]);
- iter++;
- for(;iter!=nodalConnec.end();iter++)
- {
- std::set<int> s2(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1]);
- std::set<int> s3;
- std::set_intersection(s1.begin(),s1.end(),s2.begin(),s2.end(),std::insert_iterator< std::set<int> >(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<int>(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<int> c;
- std::vector<double> 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>());
- double n=INTERP_KERNEL::norm<3>(v);
- std::transform(v,v+3,v,std::bind2nd(std::multiplies<double>(),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<int> MEDCouplingExtrudedMesh::getDistributionOfTypes() const
-{
- throw INTERP_KERNEL::Exception("Not implemented yet !");
-}
-
-DataArrayInt *MEDCouplingExtrudedMesh::checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const
-{
- throw INTERP_KERNEL::Exception("Not implemented yet !");
-}
-
-void MEDCouplingExtrudedMesh::splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& idsInPflPerType, std::vector<DataArrayInt *>& 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;i<nbOf1DLev;i++)
- {
- std::copy(ptSrc,ptSrc+3*nbOf2DNodes,pt+3*i*nbOf2DNodes);
- double vec[3];
- std::copy(arr1D->getConstPointer()+3*i,arr1D->getConstPointer()+3*(i+1),vec);
- std::transform(arr1D->getConstPointer()+3*(i-1),arr1D->getConstPointer()+3*i,vec,vec,std::minus<double>());
- for(int j=0;j<nbOf2DNodes;j++)
- std::transform(vec,vec+3,pt+3*(i*nbOf2DNodes+j),pt+3*(i*nbOf2DNodes+j),std::plus<double>());
- }
- 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<MEDCouplingUMesh> 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;i<nbOf1DLev;i++)
- {
- tmpConn[0]=i;
- tmpConn[1]=i+1;
- _mesh1D->insertNextCell(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<nbOf2DCells;i++)
- {
- int idInSubMesh;
- std::vector<int> 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<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const
-{
- std::vector<int> tinyInfo1;
- std::vector<std::string> ls1;
- std::vector<double> ls3;
- _mesh2D->getTinySerializationInformation(ls3,tinyInfo1,ls1);
- std::vector<int> tinyInfo2;
- std::vector<std::string> ls2;
- std::vector<double> 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<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
-{
- std::size_t sz=tinyInfo.size();
- int sz1=tinyInfo[sz-2];
- std::vector<int> ti1(tinyInfo.begin(),tinyInfo.begin()+sz1);
- std::vector<int> 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<std::string> 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<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector<std::string>& 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<int> ti1(tinyInfo.begin(),tinyInfo.begin()+sz1);
- std::vector<int> 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<std::string> 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<double> 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<MEDCouplingUMesh> 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();
-}
+++ /dev/null
-// 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 <vector>
-
-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<const BigMemoryObject *> 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<INTERP_KERNEL::NormalizedCellType> 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<int>& conn) const;
- MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector<double>& 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<int>& 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<int> getDistributionOfTypes() const;
- MEDCOUPLING_EXPORT DataArrayInt *checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const;
- MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& idsInPflPerType, std::vector<DataArrayInt *>& 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<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
- MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
- MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const;
- MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
- const std::vector<std::string>& 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<int>& connSorted,
- const int *desc3D, const int *descIndx3D,
- const int *conn2D, const int *conn2DIndx);
- void computeBaryCenterOfFace(const std::vector<int>& 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
#include "MEDCouplingNatureOfField.hxx"
#include "MEDCouplingRefCountObject.hxx"
#include "NormalizedUnstructuredMesh.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "MEDCouplingFieldDiscretization.hxx"
#include "InterpKernelException.hxx"
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;
std::string _desc;
NatureOfField _nature;
const MEDCouplingMesh *_mesh;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDiscretization> _type;
+ MCAuto<MEDCouplingFieldDiscretization> _type;
};
}
#include "MEDCouplingCMesh.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "CellModel.hxx"
#include "InterpolationUtils.hxx"
* 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();
}
*/
void MEDCouplingFieldDiscretization::normL1(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> vol=getMeasureField(mesh,true);
+ MCAuto<MEDCouplingFieldDouble> vol=getMeasureField(mesh,true);
int nbOfCompo=arr->getNumberOfComponents();
int nbOfElems=getNumberOfTuples(mesh);
std::fill(res,res+nbOfCompo,0.);
*/
void MEDCouplingFieldDiscretization::normL2(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> vol=getMeasureField(mesh,true);
+ MCAuto<MEDCouplingFieldDouble> vol=getMeasureField(mesh,true);
int nbOfCompo=arr->getNumberOfComponents();
int nbOfElems=getNumberOfTuples(mesh);
std::fill(res,res+nbOfCompo,0.);
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::integral : mesh is NULL !");
if(!arr)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::integral : input array is NULL !");
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> vol=getMeasureField(mesh,isWAbs);
+ MCAuto<MEDCouplingFieldDouble> vol=getMeasureField(mesh,isWAbs);
int nbOfCompo=arr->getNumberOfComponents();
int nbOfElems=getNumberOfTuples(mesh);
if(nbOfElems!=arr->getNumberOfTuples())
*/
MEDCouplingMesh *MEDCouplingFieldDiscretization::buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::Range(beginCellIds,endCellIds,stepCellIds);
+ MCAuto<DataArrayInt> da=DataArrayInt::Range(beginCellIds,endCellIds,stepCellIds);
return buildSubMeshData(mesh,da->begin(),da->end(),di);
}
int oldNbOfElems=arr->getNumberOfTuples();
int nbOfComp=arr->getNumberOfComponents();
int newNbOfTuples=newNbOfEntity;
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arrCpy=arr->deepCpy();
+ MCAuto<DataArrayDouble> arrCpy=arr->deepCopy();
const double *ptSrc=arrCpy->getConstPointer();
arr->reAlloc(newNbOfTuples);
double *ptToFill=arr->getPointer();
void MEDCouplingFieldDiscretization::RenumberEntitiesFromN2OArr(const int *new2OldPtr, int new2OldSz, DataArrayDouble *arr, const std::string& msg)
{
int nbOfComp=arr->getNumberOfComponents();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arrCpy=arr->deepCpy();
+ MCAuto<DataArrayDouble> arrCpy=arr->deepCopy();
const double *ptSrc=arrCpy->getConstPointer();
arr->reAlloc(new2OldSz);
double *ptToFill=arr->getPointer();
}
/*!
- * 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
{
{
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,
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::computeMeshRestrictionFromTupleIds : NULL input mesh !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp=DataArrayInt::New();
+ MCAuto<DataArrayInt> tmp=DataArrayInt::New();
tmp->alloc((int)std::distance(tupleIdsBg,tupleIdsEnd),1);
std::copy(tupleIdsBg,tupleIdsEnd,tmp->getPointer());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp2(tmp->deepCpy());
+ MCAuto<DataArrayInt> tmp2(tmp->deepCopy());
cellRestriction=tmp.retn();
trueTupleRestriction=tmp2.retn();
}
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getValueOnMulti : NULL input mesh !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> eltsArr,eltsIndexArr;
+ MCAuto<DataArrayInt> 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<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbOfPoints,nbOfComponents);
double *ptToFill=ret->getPointer();
for(int i=0;i<nbOfPoints;i++,ptToFill+=nbOfComponents)
*/
DataArrayInt *MEDCouplingFieldDiscretizationP0::computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const int *startCellIds, const int *endCellIds) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc((int)std::distance(startCellIds,endCellIds),1);
std::copy(startCellIds,endCellIds,ret->getPointer());
return ret.retn();
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::buildSubMeshData : NULL input mesh !");
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> ret=mesh->buildPart(start,end);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> diSafe=DataArrayInt::New();
+ MCAuto<MEDCouplingMesh> ret=mesh->buildPart(start,end);
+ MCAuto<DataArrayInt> diSafe=DataArrayInt::New();
diSafe->alloc((int)std::distance(start,end),1);
std::copy(start,end,diSafe->getPointer());
di=diSafe.retn();
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::buildSubMeshDataRange : NULL input mesh !");
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> ret=mesh->buildPartRange(beginCellIds,endCellIds,stepCellIds);
+ MCAuto<MEDCouplingMesh> ret=mesh->buildPartRange(beginCellIds,endCellIds,stepCellIds);
di=0; beginOut=beginCellIds; endOut=endCellIds; stepOut=stepCellIds;
return ret.retn();
}
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationOnNodes::computeMeshRestrictionFromTupleIds : NULL input mesh !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret1=mesh->getCellIdsFullyIncludedInNodeIds(tupleIdsBg,tupleIdsEnd);
+ MCAuto<DataArrayInt> ret1=mesh->getCellIdsFullyIncludedInNodeIds(tupleIdsBg,tupleIdsEnd);
const MEDCouplingUMesh *meshc=dynamic_cast<const MEDCouplingUMesh *>(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<MEDCouplingUMesh> meshPart=static_cast<MEDCouplingUMesh *>(meshc->buildPartOfMySelf(ret1->begin(),ret1->end(),true));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret2=meshPart->computeFetchedNodeIds();
+ MCAuto<MEDCouplingUMesh> meshPart=static_cast<MEDCouplingUMesh *>(meshc->buildPartOfMySelf(ret1->begin(),ret1->end(),true));
+ MCAuto<DataArrayInt> ret2=meshPart->computeFetchedNodeIds();
cellRestriction=ret1.retn();
trueTupleRestriction=ret2.retn();
}
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationNodes::buildSubMeshData : NULL input mesh !");
DataArrayInt *diTmp=0;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> ret=mesh->buildPartAndReduceNodes(start,end,diTmp);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> diTmpSafe(diTmp);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> di2=diTmpSafe->invertArrayO2N2N2O(ret->getNumberOfNodes());
+ MCAuto<MEDCouplingMesh> ret=mesh->buildPartAndReduceNodes(start,end,diTmp);
+ MCAuto<DataArrayInt> diTmpSafe(diTmp);
+ MCAuto<DataArrayInt> di2=diTmpSafe->invertArrayO2N2N2O(ret->getNumberOfNodes());
di=di2.retn();
return ret.retn();
}
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationOnNodes::buildSubMeshDataRange : NULL input mesh !");
DataArrayInt *diTmp=0;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> ret=mesh->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,beginOut,endOut,stepOut,diTmp);
+ MCAuto<MEDCouplingMesh> ret=mesh->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,beginOut,endOut,stepOut,diTmp);
if(diTmp)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> diTmpSafe(diTmp);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> di2=diTmpSafe->invertArrayO2N2N2O(ret->getNumberOfNodes());
+ MCAuto<DataArrayInt> diTmpSafe(diTmp);
+ MCAuto<DataArrayInt> di2=diTmpSafe->invertArrayO2N2N2O(ret->getNumberOfNodes());
di=di2.retn();
}
return ret.retn();
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP1::computeTupleIdsToSelectFromCellIds : NULL input mesh !");
- const MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> umesh=mesh->buildUnstructured();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> umesh2=static_cast<MEDCouplingUMesh *>(umesh->buildPartOfMySelf(startCellIds,endCellIds,true));
+ const MCAuto<MEDCouplingUMesh> umesh=mesh->buildUnstructured();
+ MCAuto<MEDCouplingUMesh> umesh2=static_cast<MEDCouplingUMesh *>(umesh->buildPartOfMySelf(startCellIds,endCellIds,true));
return umesh2->computeFetchedNodeIds();
}
}
/*!
- * 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
{
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
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP1::getValueOnMulti : NULL input mesh !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> eltsArr,eltsIndexArr;
+ MCAuto<DataArrayInt> 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<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbOfPoints,nbOfComponents);
double *ptToFill=ret->getPointer();
for(int i=0;i<nbOfPoints;i++)
if(arr)
{
if(startCellIds==0 && endCellIds==0)
- _discr_per_cell=arr->deepCpy();
+ _discr_per_cell=arr->deepCopy();
else
_discr_per_cell=arr->selectByTupleIdSafe(startCellIds,endCellIds);
}
DataArrayInt *arr=other._discr_per_cell;
if(arr)
{
- _discr_per_cell=arr->selectByTupleId2(beginCellIds,endCellIds,stepCellIds);
+ _discr_per_cell=arr->selectByTupleIdSafeSlice(beginCellIds,endCellIds,stepCellIds);
}
}
{
if(!_discr_per_cell)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell::checkNoOrphanCells : no discretization defined !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> test=_discr_per_cell->getIdsEqual(DFT_INVALID_LOCID_VALUE);
+ MCAuto<DataArrayInt> test=_discr_per_cell->findIdsEqual(DFT_INVALID_LOCID_VALUE);
if(test->getNumberOfTuples()!=0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell::checkNoOrphanCells : presence of orphan cells !");
}
}
/*!
- * 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
{
/*!
* 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<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfTuples+1,1);
int *retPtr=ret->getPointer();
const int *start=_discr_per_cell->getConstPointer();
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getLocalizationOfDiscValues : NULL input mesh !");
checkNoOrphanCells();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> umesh=mesh->buildUnstructured();//in general do nothing
+ MCAuto<MEDCouplingUMesh> umesh=mesh->buildUnstructured();//in general do nothing
int nbOfTuples=getNumberOfTuples(mesh);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
int spaceDim=mesh->getSpaceDimension();
ret->alloc(nbOfTuples,spaceDim);
std::vector< int > locIds;
std::vector<DataArrayInt *> parts=splitIntoSingleGaussDicrPerCellType(locIds);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > parts2(parts.size());
+ std::vector< MCAuto<DataArrayInt> > parts2(parts.size());
std::copy(parts.begin(),parts.end(),parts2.begin());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> offsets=buildNbOfGaussPointPerCellField();
+ MCAuto<DataArrayInt> offsets=buildNbOfGaussPointPerCellField();
offsets->computeOffsets();
const int *ptrOffsets=offsets->getConstPointer();
const double *coords=umesh->getCoords()->getConstPointer();
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::computeMeshRestrictionFromTupleIds : NULL input mesh !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp=DataArrayInt::New(); tmp->alloc((int)std::distance(tupleIdsBg,tupleIdsEnd),1);
+ MCAuto<DataArrayInt> tmp=DataArrayInt::New(); tmp->alloc((int)std::distance(tupleIdsBg,tupleIdsEnd),1);
std::copy(tupleIdsBg,tupleIdsEnd,tmp->getPointer());
tmp->sort(true);
tmp=tmp->buildUnique();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nbOfNodesPerCell=buildNbOfGaussPointPerCellField();
- nbOfNodesPerCell->computeOffsets2();
- nbOfNodesPerCell->searchRangesInListOfIds(tmp,cellRestriction,trueTupleRestriction);
+ MCAuto<DataArrayInt> nbOfNodesPerCell=buildNbOfGaussPointPerCellField();
+ nbOfNodesPerCell->computeOffsetsFull();
+ nbOfNodesPerCell->findIdsRangesInListOfIds(tmp,cellRestriction,trueTupleRestriction);
}
/*!
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::checkCoherencyBetween : NULL input mesh or DataArray !");
MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween(mesh,da);
for(std::vector<MEDCouplingGaussLocalization>::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();
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getMeasureField : mesh instance specified is NULL !");
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> vol=mesh->getMeasureField(isAbs);
+ MCAuto<MEDCouplingFieldDouble> vol=mesh->getMeasureField(isAbs);
const double *volPtr=vol->getArray()->begin();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_GAUSS_PT);
+ MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_GAUSS_PT);
ret->setMesh(mesh);
ret->setDiscretization(const_cast<MEDCouplingFieldDiscretizationGauss *>(this));
if(!_discr_per_cell)
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<DataArrayInt> offset=getOffsetArr(mesh);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New(); arr->alloc(getNumberOfTuples(mesh),1);
+ MCAuto<DataArrayInt> offset=getOffsetArr(mesh);
+ MCAuto<DataArrayDouble> 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<int> locIds;
std::vector<DataArrayInt *> ids=splitIntoSingleGaussDicrPerCellType(locIds);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > ids2(ids.size()); std::copy(ids.begin(),ids.end(),ids2.begin());
+ std::vector< MCAuto<DataArrayInt> > ids2(ids.size()); std::copy(ids.begin(),ids.end(),ids2.begin());
for(std::size_t i=0;i<locIds.size();i++)
{
const DataArrayInt *curIds=ids[i];
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::buildSubMeshData : NULL input mesh !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> diSafe=computeTupleIdsToSelectFromCellIds(mesh,start,end);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> ret=mesh->buildPart(start,end);
+ MCAuto<DataArrayInt> diSafe=computeTupleIdsToSelectFromCellIds(mesh,start,end);
+ MCAuto<MEDCouplingMesh> ret=mesh->buildPart(start,end);
di=diSafe.retn();
return ret.retn();
}
else
{ std::ostringstream oss; oss << msg << i << " is detected as orphan !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); }
}
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> ret=mesh->buildPartRange(beginCellIds,endCellIds,stepCellIds);
+ MCAuto<MEDCouplingMesh> ret=mesh->buildPartRange(beginCellIds,endCellIds,stepCellIds);
return ret.retn();
}
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::computeTupleIdsToSelectFromCellIds : null mesh !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nbOfNodesPerCell=buildNbOfGaussPointPerCellField();//check of _discr_per_cell not NULL pointer
+ MCAuto<DataArrayInt> 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<DataArrayInt> sel=DataArrayInt::New(); sel->useArray(startCellIds,false,CPP_DEALLOC,(int)std::distance(startCellIds,endCellIds),1);
+ nbOfNodesPerCell->computeOffsetsFull();
+ MCAuto<DataArrayInt> sel=DataArrayInt::New(); sel->useArray(startCellIds,false,CPP_DEALLOC,(int)std::distance(startCellIds,endCellIds),1);
return sel->buildExplicitArrByRanges(nbOfNodesPerCell);
}
if(!_discr_per_cell)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::buildNbOfGaussPointPerCellField : no discretization array set !");
int nbOfTuples=_discr_per_cell->getNumberOfTuples();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
const int *w=_discr_per_cell->begin();
ret->alloc(nbOfTuples,1);
int *valsToFill=ret->getPointer();
}
/*!
- * 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
{
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getLocalizationOfDiscValues : NULL input mesh !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> umesh=mesh->buildUnstructured();//in general do nothing
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<MEDCouplingUMesh> umesh=mesh->buildUnstructured();//in general do nothing
int nbOfTuples=getNumberOfTuples(umesh);
int spaceDim=mesh->getSpaceDimension();
ret->alloc(nbOfTuples,spaceDim);
int nbOfCompo=arr->getNumberOfComponents();
std::fill(res,res+nbOfCompo,0.);
//
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> vol=mesh->getMeasureField(isWAbs);
+ MCAuto<MEDCouplingFieldDouble> vol=mesh->getMeasureField(isWAbs);
std::set<INTERP_KERNEL::NormalizedCellType> types=mesh->getAllGeoTypes();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nbOfNodesPerCell=mesh->computeNbOfNodesPerCell();
- nbOfNodesPerCell->computeOffsets2();
+ MCAuto<DataArrayInt> nbOfNodesPerCell=mesh->computeNbOfNodesPerCell();
+ nbOfNodesPerCell->computeOffsetsFull();
const double *arrPtr=arr->begin(),*volPtr=vol->getArray()->begin();
for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=types.begin();it!=types.end();it++)
{
INTERP_KERNEL::AutoPtr<double> wArr2=new double[wArrSz];
double sum=std::accumulate(wArr,wArr+wArrSz,0.);
std::transform(wArr,wArr+wArrSz,(double *)wArr2,std::bind2nd(std::multiplies<double>(),1./sum));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids=mesh->giveCellsWithType(*it);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell);
+ MCAuto<DataArrayInt> ids=mesh->giveCellsWithType(*it);
+ MCAuto<DataArrayInt> ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell);
const int *ptIds2=ids2->begin(),*ptIds=ids->begin();
int nbOfCellsWithCurGeoType=ids->getNumberOfTuples();
for(int i=0;i<nbOfCellsWithCurGeoType;i++,ptIds++,ptIds2+=wArrSz)
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::computeMeshRestrictionFromTupleIds : NULL input mesh !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp=DataArrayInt::New(); tmp->alloc((int)std::distance(tupleIdsBg,tupleIdsEnd),1);
+ MCAuto<DataArrayInt> tmp=DataArrayInt::New(); tmp->alloc((int)std::distance(tupleIdsBg,tupleIdsEnd),1);
std::copy(tupleIdsBg,tupleIdsEnd,tmp->getPointer());
tmp->sort(true);
tmp=tmp->buildUnique();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nbOfNodesPerCell=mesh->computeNbOfNodesPerCell();
- nbOfNodesPerCell->computeOffsets2();
- nbOfNodesPerCell->searchRangesInListOfIds(tmp,cellRestriction,trueTupleRestriction);
+ MCAuto<DataArrayInt> nbOfNodesPerCell=mesh->computeNbOfNodesPerCell();
+ nbOfNodesPerCell->computeOffsetsFull();
+ nbOfNodesPerCell->findIdsRangesInListOfIds(tmp,cellRestriction,trueTupleRestriction);
}
void MEDCouplingFieldDiscretizationGaussNE::checkCompatibilityWithNature(NatureOfField nat) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getMeasureField : mesh instance specified is NULL !");
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> vol=mesh->getMeasureField(isAbs);
+ MCAuto<MEDCouplingFieldDouble> vol=mesh->getMeasureField(isAbs);
const double *volPtr=vol->getArray()->begin();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_GAUSS_NE);
+ MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_GAUSS_NE);
ret->setMesh(mesh);
//
std::set<INTERP_KERNEL::NormalizedCellType> types=mesh->getAllGeoTypes();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nbOfNodesPerCell=mesh->computeNbOfNodesPerCell();
+ MCAuto<DataArrayInt> nbOfNodesPerCell=mesh->computeNbOfNodesPerCell();
int nbTuples=nbOfNodesPerCell->accumulate(0);
- nbOfNodesPerCell->computeOffsets2();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New(); arr->alloc(nbTuples,1);
+ nbOfNodesPerCell->computeOffsetsFull();
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::New(); arr->alloc(nbTuples,1);
ret->setArray(arr);
double *arrPtr=arr->getPointer();
for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=types.begin();it!=types.end();it++)
INTERP_KERNEL::AutoPtr<double> wArr2=new double[wArrSz];
double sum=std::accumulate(wArr,wArr+wArrSz,0.);
std::transform(wArr,wArr+wArrSz,(double *)wArr2,std::bind2nd(std::multiplies<double>(),1./sum));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids=mesh->giveCellsWithType(*it);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell);
+ MCAuto<DataArrayInt> ids=mesh->giveCellsWithType(*it);
+ MCAuto<DataArrayInt> ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell);
const int *ptIds2=ids2->begin(),*ptIds=ids->begin();
int nbOfCellsWithCurGeoType=ids->getNumberOfTuples();
for(int i=0;i<nbOfCellsWithCurGeoType;i++,ptIds++)
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::buildSubMeshData : NULL input mesh !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> diSafe=computeTupleIdsToSelectFromCellIds(mesh,start,end);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> ret=mesh->buildPart(start,end);
+ MCAuto<DataArrayInt> diSafe=computeTupleIdsToSelectFromCellIds(mesh,start,end);
+ MCAuto<MEDCouplingMesh> ret=mesh->buildPart(start,end);
di=diSafe.retn();
return ret.retn();
}
if(i>=endCellIds)
break;
}
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> ret=mesh->buildPartRange(beginCellIds,endCellIds,stepCellIds);
+ MCAuto<MEDCouplingMesh> ret=mesh->buildPartRange(beginCellIds,endCellIds,stepCellIds);
return ret.retn();
}
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::computeTupleIdsToSelectFromCellIds : null mesh !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nbOfNodesPerCell=mesh->computeNbOfNodesPerCell();
- nbOfNodesPerCell->computeOffsets2();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> sel=DataArrayInt::New(); sel->useArray(startCellIds,false,CPP_DEALLOC,(int)std::distance(startCellIds,endCellIds),1);
+ MCAuto<DataArrayInt> nbOfNodesPerCell=mesh->computeNbOfNodesPerCell();
+ nbOfNodesPerCell->computeOffsetsFull();
+ MCAuto<DataArrayInt> sel=DataArrayInt::New(); sel->useArray(startCellIds,false,CPP_DEALLOC,(int)std::distance(startCellIds,endCellIds),1);
return sel->buildExplicitArrByRanges(nbOfNodesPerCell);
}
}
/*!
- * 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
{
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
void MEDCouplingFieldDiscretizationKriging::getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> res2=MEDCouplingFieldDiscretizationKriging::getValueOnMulti(arr,mesh,loc,1);
+ MCAuto<DataArrayDouble> res2=MEDCouplingFieldDiscretizationKriging::getValueOnMulti(arr,mesh,loc,1);
std::copy(res2->begin(),res2->end(),res);
}
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
int nbCols(-1),nbCompo(arr->getNumberOfComponents());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> m(computeEvaluationMatrixOnGivenPts(mesh,loc,nbOfTargetPoints,nbCols));
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret(DataArrayDouble::New());
+ MCAuto<DataArrayDouble> m(computeEvaluationMatrixOnGivenPts(mesh,loc,nbOfTargetPoints,nbCols));
+ MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
ret->alloc(nbOfTargetPoints,nbCompo);
INTERP_KERNEL::matrixProduct(m->begin(),nbOfTargetPoints,nbCols,arr->begin(),nbOfRows,nbCompo,ret->getPointer());
return ret.retn();
DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeEvaluationMatrixOnGivenPts(const MEDCouplingMesh *mesh, const double *loc, int nbOfTargetPoints, int& nbCols) const
{
int isDrift(-1),nbRows(-1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> matrixInv(computeInverseMatrix(mesh,isDrift,nbRows));
+ MCAuto<DataArrayDouble> matrixInv(computeInverseMatrix(mesh,isDrift,nbRows));
//
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coords=getLocalizationOfDiscValues(mesh);
+ MCAuto<DataArrayDouble> coords=getLocalizationOfDiscValues(mesh);
int nbOfPts(coords->getNumberOfTuples()),dimension(coords->getNumberOfComponents());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> locArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> locArr=DataArrayDouble::New();
locArr->useArray(loc,false,CPP_DEALLOC,nbOfTargetPoints,dimension);
nbCols=nbOfPts;
//
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> matrix2=coords->buildEuclidianDistanceDenseMatrixWith(locArr);
+ MCAuto<DataArrayDouble> matrix2=coords->buildEuclidianDistanceDenseMatrixWith(locArr);
operateOnDenseMatrix(mesh->getSpaceDimension(),nbOfTargetPoints*nbOfPts,matrix2->getPointer());
//
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> matrix3=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> matrix3=DataArrayDouble::New();
matrix3->alloc(nbOfTargetPoints*nbRows,1);
double *work=matrix3->getPointer();
const double *workCst(matrix2->begin()),*workCst2(loc);
for(int j=0;j<isDrift-1;j++)
work[i*nbRows+(nbOfPts+1+j)]=workCst2[j];
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret(DataArrayDouble::New());
+ MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
ret->alloc(nbOfTargetPoints,nbRows);
INTERP_KERNEL::matrixProduct(matrix3->begin(),nbOfTargetPoints,nbRows,matrixInv->begin(),nbRows,nbRows,ret->getPointer());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret2(DataArrayDouble::New());
+ MCAuto<DataArrayDouble> ret2(DataArrayDouble::New());
ret2->alloc(nbOfTargetPoints*nbOfPts,1);
workCst=ret->begin(); work=ret2->getPointer();
for(int i=0;i<nbOfTargetPoints;i++,workCst+=nbRows)
*/
DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeInverseMatrix(const MEDCouplingMesh *mesh, int& isDrift, int& matSz) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> matrixWithDrift(computeMatrix(mesh,isDrift,matSz));
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> matrixInv(DataArrayDouble::New());
+ MCAuto<DataArrayDouble> matrixWithDrift(computeMatrix(mesh,isDrift,matSz));
+ MCAuto<DataArrayDouble> matrixInv(DataArrayDouble::New());
matrixInv->alloc(matSz*matSz,1);
INTERP_KERNEL::inverseMatrix(matrixWithDrift->getConstPointer(),matSz,matrixInv->getPointer());
return matrixInv.retn();
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::computeMatrix : NULL input mesh !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coords(getLocalizationOfDiscValues(mesh));
+ MCAuto<DataArrayDouble> coords(getLocalizationOfDiscValues(mesh));
int nbOfPts(coords->getNumberOfTuples());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> matrix(coords->buildEuclidianDistanceDenseMatrix());
+ MCAuto<DataArrayDouble> matrix(coords->buildEuclidianDistanceDenseMatrix());
operateOnDenseMatrix(mesh->getSpaceDimension(),nbOfPts*nbOfPts,matrix->getPointer());
// Drift
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> matrixWithDrift(performDrift(matrix,coords,isDrift));
+ MCAuto<DataArrayDouble> matrixWithDrift(performDrift(matrix,coords,isDrift));
matSz=nbOfPts+isDrift;
return matrixWithDrift.retn();
}
DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeVectorOfCoefficients(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, int& isDrift) const
{
int nbRows(-1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> matrixInv(computeInverseMatrix(mesh,isDrift,nbRows));
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> KnewiK(DataArrayDouble::New());
+ MCAuto<DataArrayDouble> matrixInv(computeInverseMatrix(mesh,isDrift,nbRows));
+ MCAuto<DataArrayDouble> KnewiK(DataArrayDouble::New());
KnewiK->alloc(nbRows*1,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2(PerformDriftOfVec(arr,isDrift));
+ MCAuto<DataArrayDouble> arr2(PerformDriftOfVec(arr,isDrift));
INTERP_KERNEL::matrixProduct(matrixInv->getConstPointer(),nbRows,nbRows,arr2->getConstPointer(),arr2->getNumberOfTuples(),1,KnewiK->getPointer());
return KnewiK.retn();
}
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<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfPts*(nbOfCols+delta));
+ MCAuto<DataArrayDouble> 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<nbOfPts;i++,aPtr+=spaceDimension,mPtr+=nbOfCols)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::PerformDriftOfVec : input array must be not NULL allocated and with one component !");
if(isDrift<0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::PerformDriftOfVec : isDrift parameter must be >=0 !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2(DataArrayDouble::New());
+ MCAuto<DataArrayDouble> 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.);
int szOfMatrix=arr->getNumberOfTuples();
if(szOfMatrix*szOfMatrix!=matr->getNumberOfTuples())
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::performDrift : invalid size");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc((szOfMatrix+delta)*(szOfMatrix+delta),1);
const double *srcWork=matr->getConstPointer();
const double *srcWork2=arr->getConstPointer();
}
std::fill(destWork,destWork+szOfMatrix,1.); destWork+=szOfMatrix;
std::fill(destWork,destWork+spaceDimension+1,0.); destWork+=spaceDimension+1;
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arrNoI=arr->toNoInterlace();
+ MCAuto<DataArrayDouble> arrNoI=arr->toNoInterlace();
srcWork2=arrNoI->getConstPointer();
for(int i=0;i<spaceDimension;i++)
{
#include "MEDCouplingTimeLabel.hxx"
#include "MEDCouplingNatureOfField.hxx"
#include "MEDCouplingGaussLocalization.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include <set>
#include <vector>
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;
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingTimeDiscretization.hxx"
#include "MEDCouplingFieldDiscretization.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "MEDCouplingNatureOfField.hxx"
#include "InterpKernelAutoPtr.hxx"
* \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
*
* 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().
*/
MEDCouplingFieldDouble *MEDCouplingFieldDouble::cloneWithMesh(bool recDeepCpy) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=clone(recDeepCpy);
+ MCAuto<MEDCouplingFieldDouble> ret=clone(recDeepCpy);
if(_mesh)
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> mCpy=_mesh->deepCpy();
+ MCAuto<MEDCouplingMesh> mCpy=_mesh->deepCopy();
ret->setMesh(mCpy);
}
return ret.retn();
* 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);
}
MEDCouplingFieldDouble *MEDCouplingFieldDouble::buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const
{
MEDCouplingTimeDiscretization *tdo=_time_discr->buildNewTimeReprFromThis(td,deepCopy);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDiscretization> disc;
+ MCAuto<MEDCouplingFieldDiscretization> disc;
if(_type)
disc=_type->clone();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),tdo,disc.retn());
+ MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),tdo,disc.retn());
ret->setMesh(getMesh());
ret->setName(getName());
ret->setDescription(getDescription());
* \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<MEDCouplingFieldDouble> ret(clone(false));
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDiscretizationP0> nsp(new MEDCouplingFieldDiscretizationP0);
+ MCAuto<MEDCouplingFieldDouble> ret(clone(false));
+ MCAuto<MEDCouplingFieldDiscretizationP0> 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<DataArrayDouble *> arrs(getArrays());
std::size_t sz(arrs.size());
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > outArrsSafe(sz); std::vector<DataArrayDouble *> outArrs(sz);
+ std::vector< MCAuto<DataArrayDouble> > outArrsSafe(sz); std::vector<DataArrayDouble *> outArrs(sz);
for(std::size_t j=0;j<sz;j++)
{
int nbCompo(arrs[j]->getNumberOfComponents());
* \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<MEDCouplingFieldDouble> ret(clone(false));
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDiscretizationP1> nsp(new MEDCouplingFieldDiscretizationP1);
+ MCAuto<MEDCouplingFieldDouble> ret(clone(false));
+ MCAuto<MEDCouplingFieldDiscretizationP1> nsp(new MEDCouplingFieldDiscretizationP1);
ret->setDiscretization(nsp);
- const MEDCouplingMesh *m(getMesh());//m is non empty thanks to checkCoherency call
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> rn(DataArrayInt::New()),rni(DataArrayInt::New());
+ const MEDCouplingMesh *m(getMesh());//m is non empty thanks to checkConsistencyLight call
+ MCAuto<DataArrayInt> rn(DataArrayInt::New()),rni(DataArrayInt::New());
m->getReverseNodalConnectivity(rn,rni);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> rni2(rni->deltaShiftIndex());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> rni3(rni2->convertToDblArr()); rni2=0;
+ MCAuto<DataArrayInt> rni2(rni->deltaShiftIndex());
+ MCAuto<DataArrayDouble> rni3(rni2->convertToDblArr()); rni2=0;
std::vector<DataArrayDouble *> arrs(getArrays());
std::size_t sz(arrs.size());
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > outArrsSafe(sz); std::vector<DataArrayDouble *> outArrs(sz);
+ std::vector< MCAuto<DataArrayDouble> > outArrsSafe(sz); std::vector<DataArrayDouble *> outArrs(sz);
for(std::size_t j=0;j<sz;j++)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp(arrs[j]->selectByTupleIdSafe(rn->begin(),rn->end()));
+ MCAuto<DataArrayDouble> 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]);
void MEDCouplingFieldDouble::renumberCells(const int *old2NewBg, bool check)
{
renumberCellsWithoutMesh(old2NewBg,check);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> m=_mesh->deepCpy();
+ MCAuto<MEDCouplingMesh> m=_mesh->deepCopy();
m->renumberCells(old2NewBg,check);
setMesh(m);
updateTime();
if(!meshC)
throw INTERP_KERNEL::Exception("Invalid mesh to apply renumberNodes on it !");
int nbOfNodes=meshC->getNumberOfNodes();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingPointSet> meshC2((MEDCouplingPointSet *)meshC->deepCpy());
+ MCAuto<MEDCouplingPointSet> meshC2((MEDCouplingPointSet *)meshC->deepCopy());
int newNbOfNodes=*std::max_element(old2NewBg,old2NewBg+nbOfNodes)+1;
renumberNodesWithoutMesh(old2NewBg,newNbOfNodes,eps);
meshC2->renumberNodes(old2NewBg,newNbOfNodes);
/*!
* 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
* \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);
}
/*!
/*!
* 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",
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : Expecting a not NULL spatial discretization !");
DataArrayInt *arrSelect;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> m=_type->buildSubMeshData(_mesh,partBg,partEnd,arrSelect);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arrSelect2(arrSelect);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=clone(false);//quick shallow copy.
+ MCAuto<MEDCouplingMesh> m=_type->buildSubMeshData(_mesh,partBg,partEnd,arrSelect);
+ MCAuto<DataArrayInt> arrSelect2(arrSelect);
+ MCAuto<MEDCouplingFieldDouble> ret=clone(false);//quick shallow copy.
const MEDCouplingFieldDiscretization *disc=getDiscretization();
if(disc)
- ret->setDiscretization(MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDiscretization>(disc->clonePart(partBg,partEnd)));
+ ret->setDiscretization(MCAuto<MEDCouplingFieldDiscretization>(disc->clonePart(partBg,partEnd)));
ret->setMesh(m);
std::vector<DataArrayDouble *> arrays;
_time_discr->getArrays(arrays);
std::vector<DataArrayDouble *> arrs;
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrsSafe;
+ std::vector< MCAuto<DataArrayDouble> > arrsSafe;
const int *arrSelBg=arrSelect->begin();
const int *arrSelEnd=arrSelect->end();
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : Expecting a not NULL spatial discretization !");
DataArrayInt *arrSelect;
int beginOut,endOut,stepOut;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> m=_type->buildSubMeshDataRange(_mesh,begin,end,step,beginOut,endOut,stepOut,arrSelect);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arrSelect2(arrSelect);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=clone(false);//quick shallow copy.
+ MCAuto<MEDCouplingMesh> m=_type->buildSubMeshDataRange(_mesh,begin,end,step,beginOut,endOut,stepOut,arrSelect);
+ MCAuto<DataArrayInt> arrSelect2(arrSelect);
+ MCAuto<MEDCouplingFieldDouble> ret=clone(false);//quick shallow copy.
const MEDCouplingFieldDiscretization *disc=getDiscretization();
if(disc)
- ret->setDiscretization(MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDiscretization>(disc->clonePartRange(begin,end,step)));
+ ret->setDiscretization(MCAuto<MEDCouplingFieldDiscretization>(disc->clonePartRange(begin,end,step)));
ret->setMesh(m);
std::vector<DataArrayDouble *> arrays;
_time_discr->getArrays(arrays);
std::vector<DataArrayDouble *> arrs;
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrsSafe;
+ std::vector< MCAuto<DataArrayDouble> > arrsSafe;
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
{
DataArrayDouble *arr=0;
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);
}
}
MEDCouplingFieldDouble::MEDCouplingFieldDouble(const MEDCouplingFieldDouble& other, bool deepCopy):MEDCouplingField(other,deepCopy),
- _time_discr(other._time_discr->performCpy(deepCopy))
+ _time_discr(other._time_discr->performCopyOrIncrRef(deepCopy))
{
}
* \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());
}
double ret=-std::numeric_limits<double>::max();
bool isExistingArr=false;
tupleIds=0;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret1;
+ MCAuto<DataArrayInt> ret1;
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
{
if(*iter)
isExistingArr=true;
DataArrayInt *tmp;
ret=std::max(ret,(*iter)->getMaxValue2(tmp));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmpSafe(tmp);
+ MCAuto<DataArrayInt> tmpSafe(tmp);
if(!((const DataArrayInt *)ret1))
ret1=tmpSafe;
}
double ret=-std::numeric_limits<double>::max();
bool isExistingArr=false;
tupleIds=0;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret1;
+ MCAuto<DataArrayInt> ret1;
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
{
if(*iter)
isExistingArr=true;
DataArrayInt *tmp;
ret=std::max(ret,(*iter)->getMinValue2(tmp));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmpSafe(tmp);
+ MCAuto<DataArrayInt> tmpSafe(tmp);
if(!((const DataArrayInt *)ret1))
ret1=tmpSafe;
}
{
if(getArray()==0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::getWeightedAverageValue : no default array defined !");
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> w=buildMeasureField(isWAbs);
+ MCAuto<MEDCouplingFieldDouble> w=buildMeasureField(isWAbs);
double deno=w->getArray()->accumulate(0);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=getArray()->deepCpy();
+ MCAuto<DataArrayDouble> arr=getArray()->deepCopy();
arr->multiplyEqual(w->getArray());
arr->accumulate(res);
int nCompo = getArray()->getNumberOfComponents();
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<DataArrayDouble> loc=_type->getLocalizationOfDiscValues(_mesh);
+ MCAuto<DataArrayDouble> loc=_type->getLocalizationOfDiscValues(_mesh);
_time_discr->fillFromAnalytic(loc,nbOfComp,func);
}
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<DataArrayDouble> loc=_type->getLocalizationOfDiscValues(_mesh);
+ MCAuto<DataArrayDouble> loc=_type->getLocalizationOfDiscValues(_mesh);
_time_discr->fillFromAnalytic(loc,nbOfComp,func);
}
* \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<DataArrayDouble> loc=_type->getLocalizationOfDiscValues(_mesh);
- _time_discr->fillFromAnalytic2(loc,nbOfComp,func);
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform fillFromAnalyticCompo !");
+ MCAuto<DataArrayDouble> loc=_type->getLocalizationOfDiscValues(_mesh);
+ _time_discr->fillFromAnalyticCompo(loc,nbOfComp,func);
}
/*!
* \ref py_mcfielddouble_fillFromAnalytic3 "Here is a Python example".
* \endif
*/
-void MEDCouplingFieldDouble::fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func)
+void MEDCouplingFieldDouble::fillFromAnalyticNamedCompo(int nbOfComp, const std::vector<std::string>& 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<DataArrayDouble> 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<DataArrayDouble> loc=_type->getLocalizationOfDiscValues(_mesh);
+ _time_discr->fillFromAnalyticNamedCompo(loc,nbOfComp,varsOrder,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);
}
/*!
* \ref py_mcfielddouble_applyFunc3 "Here is a Python example".
* \endif
*/
-void MEDCouplingFieldDouble::applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func)
+void MEDCouplingFieldDouble::applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func)
{
- _time_discr->applyFunc3(nbOfComp,varsOrder,func);
+ _time_discr->applyFuncNamedCompo(nbOfComp,varsOrder,func);
}
/*!
* 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.
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<DataArrayInt> cellCor2(cellCor),nodeCor2(nodeCor);
+ MCAuto<DataArrayInt> cellCor2(cellCor),nodeCor2(nodeCor);
if(cellCor)
renumberCellsWithoutMesh(cellCor->getConstPointer(),false);
if(nodeCor)
* 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.<br>
- * 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.<br>
* "DM" in the method name stands for "different meshes".
* \param [in] f - the field to subtract from this.
*/
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);
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<MEDCouplingPointSet> meshC2((MEDCouplingPointSet *)meshC->deepCpy());
+ MCAuto<MEDCouplingPointSet> meshC2((MEDCouplingPointSet *)meshC->deepCopy());
bool ret;
int ret2;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr=meshC2->mergeNodes(eps,ret,ret2);
+ MCAuto<DataArrayInt> arr=meshC2->mergeNodes(eps,ret,ret2);
if(!ret)//no nodes have been merged.
return ret;
std::vector<DataArrayDouble *> arrays;
* \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<const MEDCouplingPointSet *>(_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<MEDCouplingPointSet> meshC2((MEDCouplingPointSet *)meshC->deepCpy());
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform mergeNodesCenter !");
+ MCAuto<MEDCouplingPointSet> meshC2((MEDCouplingPointSet *)meshC->deepCopy());
bool ret;
int ret2;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr=meshC2->mergeNodes2(eps,ret,ret2);
+ MCAuto<DataArrayInt> arr=meshC2->mergeNodesCenter(eps,ret,ret2);
if(!ret)//no nodes have been merged.
return ret;
std::vector<DataArrayDouble *> arrays;
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<MEDCouplingPointSet> meshC2((MEDCouplingPointSet *)meshC->deepCpy());
+ MCAuto<MEDCouplingPointSet> meshC2((MEDCouplingPointSet *)meshC->deepCopy());
int oldNbOfNodes=meshC2->getNumberOfNodes();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr=meshC2->zipCoordsTraducer();
+ MCAuto<DataArrayInt> arr=meshC2->zipCoordsTraducer();
if(meshC2->getNumberOfNodes()!=oldNbOfNodes)
{
std::vector<DataArrayDouble *> arrays;
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<MEDCouplingUMesh> meshC2((MEDCouplingUMesh *)meshC->deepCpy());
+ MCAuto<MEDCouplingUMesh> meshC2((MEDCouplingUMesh *)meshC->deepCopy());
int oldNbOfCells=meshC2->getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr=meshC2->zipConnectivityTraducer(compType);
+ MCAuto<DataArrayInt> arr=meshC2->zipConnectivityTraducer(compType);
if(meshC2->getNumberOfCells()!=oldNbOfCells)
{
std::vector<DataArrayDouble *> arrays;
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<MEDCouplingUMesh> umesh(mesh->buildUnstructured());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=clone(false);
+ const MCAuto<MEDCouplingUMesh> umesh(mesh->buildUnstructured());
+ MCAuto<MEDCouplingFieldDouble> ret=clone(false);
ret->setMesh(umesh);
DataArrayInt *cellIds=0;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh2=umesh->buildSlice3D(origin,vec,eps,cellIds);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellIds2=cellIds;
+ MCAuto<MEDCouplingUMesh> mesh2=umesh->buildSlice3D(origin,vec,eps,cellIds);
+ MCAuto<DataArrayInt> cellIds2=cellIds;
ret->setMesh(mesh2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tupleIds=computeTupleIdsToSelectFromCellIds(cellIds->begin(),cellIds->end());
+ MCAuto<DataArrayInt> tupleIds=computeTupleIdsToSelectFromCellIds(cellIds->begin(),cellIds->end());
std::vector<DataArrayDouble *> arrays;
_time_discr->getArrays(arrays);
int i=0;
std::vector<DataArrayDouble *> newArr(arrays.size());
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > newArr2(arrays.size());
+ std::vector< MCAuto<DataArrayDouble> > newArr2(arrays.size());
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++,i++)
{
if(*iter)
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform simplexize !");
int oldNbOfCells=_mesh->getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> meshC2(_mesh->deepCpy());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr=meshC2->simplexize(policy);
+ MCAuto<MEDCouplingMesh> meshC2(_mesh->deepCopy());
+ MCAuto<DataArrayInt> arr=meshC2->simplexize(policy);
int newNbOfCells=meshC2->getNumberOfCells();
if(oldNbOfCells==newNbOfCells)
return false;
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform doublyContractedProduct !");
MEDCouplingTimeDiscretization *td=_time_discr->doublyContractedProduct();
td->copyTinyAttrFrom(*_time_discr);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
+ MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setName("DoublyContractedProduct");
ret->setMesh(getMesh());
return ret.retn();
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform determinant !");
MEDCouplingTimeDiscretization *td=_time_discr->determinant();
td->copyTinyAttrFrom(*_time_discr);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
+ MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setName("Determinant");
ret->setMesh(getMesh());
return ret.retn();
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform eigenValues !");
MEDCouplingTimeDiscretization *td=_time_discr->eigenValues();
td->copyTinyAttrFrom(*_time_discr);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
+ MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setName("EigenValues");
ret->setMesh(getMesh());
return ret.retn();
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform eigenVectors !");
MEDCouplingTimeDiscretization *td=_time_discr->eigenVectors();
td->copyTinyAttrFrom(*_time_discr);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
+ MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setName("EigenVectors");
ret->setMesh(getMesh());
return ret.retn();
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform inverse !");
MEDCouplingTimeDiscretization *td=_time_discr->inverse();
td->copyTinyAttrFrom(*_time_discr);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
+ MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setName("Inversion");
ret->setMesh(getMesh());
return ret.retn();
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform trace !");
MEDCouplingTimeDiscretization *td=_time_discr->trace();
td->copyTinyAttrFrom(*_time_discr);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
+ MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setName("Trace");
ret->setMesh(getMesh());
return ret.retn();
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform deviator !");
MEDCouplingTimeDiscretization *td=_time_discr->deviator();
td->copyTinyAttrFrom(*_time_discr);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
+ MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setName("Deviator");
ret->setMesh(getMesh());
return ret.retn();
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform magnitude !");
MEDCouplingTimeDiscretization *td=_time_discr->magnitude();
td->copyTinyAttrFrom(*_time_discr);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
+ MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setName("Magnitude");
ret->setMesh(getMesh());
return ret.retn();
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform maxPerTuple !");
MEDCouplingTimeDiscretization *td=_time_discr->maxPerTuple();
td->copyTinyAttrFrom(*_time_discr);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
+ MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
std::ostringstream oss;
oss << "Max_" << getName();
ret->setName(oss.str());
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform keepSelectedComponents !");
MEDCouplingTimeDiscretization *td=_time_discr->keepSelectedComponents(compoIds);
td->copyTinyAttrFrom(*_time_discr);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
+ MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setName(getName());
ret->setMesh(getMesh());
return ret.retn();
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<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
+ MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
ret->setName(f1->getName());
ret->setDescription(f1->getDescription());
if(m1)
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> m=m1->mergeMyselfWith(m2);
+ MCAuto<MEDCouplingMesh> m=m1->mergeMyselfWith(m2);
ret->setMesh(m);
}
return ret.retn();
{
if(a.size()<1)
throw INTERP_KERNEL::Exception("FieldDouble::MergeFields : size of array must be >= 1 !");
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> > ms(a.size());
+ std::vector< MCAuto<MEDCouplingUMesh> > ms(a.size());
std::vector< const MEDCouplingUMesh *> ms2(a.size());
std::vector< const MEDCouplingTimeDiscretization *> tds(a.size());
std::vector<const MEDCouplingFieldDouble *>::const_iterator it=a.begin();
}
MEDCouplingTimeDiscretization *td=tds[0]->aggregate(tds);
td->copyTinyAttrFrom(*(a[0]->_time_discr));
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(a[0]->getNature(),td,a[0]->_type->clone());
+ MCAuto<MEDCouplingFieldDouble> 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<MEDCouplingUMesh> m=MEDCouplingUMesh::MergeUMeshes(ms2);
+ MCAuto<MEDCouplingUMesh> m=MEDCouplingUMesh::MergeUMeshes(ms2);
m->copyTinyInfoFrom(ms2[0]);
ret->setMesh(m);
}
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<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
+ MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
ret->setMesh(f1->getMesh());
return ret.retn();
}
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<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(NoNature,td,f1->_type->clone());
+ MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(NoNature,td,f1->_type->clone());
ret->setMesh(f1->getMesh());
return ret.retn();
}
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<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
+ MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
ret->setMesh(f1->getMesh());
return ret.retn();
}
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<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
+ MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
ret->setMesh(f1->getMesh());
return ret.retn();
}
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform negate !");
MEDCouplingTimeDiscretization *td=_time_discr->negate();
td->copyTinyAttrFrom(*_time_discr);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
+ MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setMesh(getMesh());
return ret.retn();
}
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<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
+ MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
ret->setMesh(f1->getMesh());
return ret.retn();
}
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<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
+ MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
ret->setMesh(f1->getMesh());
return ret.retn();
}
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<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(NoNature,td,f1->_type->clone());
+ MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(NoNature,td,f1->_type->clone());
ret->setMesh(f1->getMesh());
return ret.retn();
}
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<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(NoNature,td,f1->_type->clone());
+ MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(NoNature,td,f1->_type->clone());
ret->setMesh(f1->getMesh());
return ret.retn();
}
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<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(NoNature,td,f1->_type->clone());
+ MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(NoNature,td,f1->_type->clone());
ret->setMesh(f1->getMesh());
return ret.retn();
}
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<DataArrayByte> byteArr;
+ MCAuto<DataArrayByte> byteArr;
if(isBinary)
{ byteArr=DataArrayByte::New(); byteArr->alloc(0,1); }
std::ostringstream coss,noss;
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(); }
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<std::string>& varsOrder, const std::string& func);
+ MEDCOUPLING_EXPORT void fillFromAnalyticCompo(int nbOfComp, const std::string& func);
+ MEDCOUPLING_EXPORT void fillFromAnalyticNamedCompo(int nbOfComp, const std::vector<std::string>& 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<std::string>& varsOrder, const std::string& func);
+ MEDCOUPLING_EXPORT void applyFuncCompo(int nbOfComp, const std::string& func);
+ MEDCOUPLING_EXPORT void applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& 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);
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;
double MEDCouplingFieldOverTime::getTimeTolerance() const
{
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
+ std::vector< MCAuto<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
if(_fs.empty())
throw INTERP_KERNEL::Exception("MEDCouplingFieldOverTime::getTimeTolerance : empty set !");
for(;it!=_fs.end();it++)
throw INTERP_KERNEL::Exception("MEDCouplingFieldOverTime::getTimeTolerance : only empty fields in this !");
}
-void MEDCouplingFieldOverTime::checkCoherency() const
+void MEDCouplingFieldOverTime::checkConsistencyLight() const
{
- MEDCouplingMultiFields::checkCoherency();
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
+ MEDCouplingMultiFields::checkConsistencyLight();
+ std::vector< MCAuto<MEDCouplingFieldDouble> >::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())
}
double curt=(*it)->getStartTime(tt1,tt2);
if(curt<reft-eps)
- throw INTERP_KERNEL::Exception("MEDCouplingFieldOverTime::checkCoherency : fields are NOT sorted properly in ascending time !");
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldOverTime::checkConsistencyLight : fields are NOT sorted properly in ascending time !");
reft=(*it)->getEndTime(tt1,tt2);
}
}
std::vector<MEDCouplingMesh *> MEDCouplingFieldOverTime::getMeshes() const
{
- checkCoherency();
+ checkConsistencyLight();
return MEDCouplingMultiFields::getMeshes();
}
std::vector<MEDCouplingMesh *> MEDCouplingFieldOverTime::getDifferentMeshes(std::vector<int>& refs) const
{
- checkCoherency();
+ checkConsistencyLight();
return MEDCouplingMultiFields::getDifferentMeshes(refs);
}
std::vector<DataArrayDouble *> MEDCouplingFieldOverTime::getArrays() const
{
- checkCoherency();
+ checkConsistencyLight();
return MEDCouplingMultiFields::getArrays();
}
std::vector<DataArrayDouble *> MEDCouplingFieldOverTime::getDifferentArrays(std::vector< std::vector<int> >& refs) const
{
- checkCoherency();
+ checkConsistencyLight();
return MEDCouplingMultiFields::getDifferentArrays(refs);
}
MEDCouplingFieldOverTime::MEDCouplingFieldOverTime(const std::vector<MEDCouplingFieldDouble *>& fs):MEDCouplingMultiFields(fs)
{
- checkCoherency();
+ checkConsistencyLight();
}
MEDCouplingFieldOverTime::MEDCouplingFieldOverTime()
{
public:
MEDCOUPLING_EXPORT static MEDCouplingFieldOverTime *New(const std::vector<MEDCouplingFieldDouble *>& 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;
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
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<int>& tinyInfo) const;
MEDCOUPLING_EXPORT void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
const std::vector<double>& gsCoo, const std::vector<double>& w)
try:_type(type),_ref_coord(refCoo),_gauss_coord(gsCoo),_weight(w)
{
- checkCoherency();
+ checkConsistencyLight();
}
catch(INTERP_KERNEL::Exception& e)
{
_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();
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<int>& tinyInfo) const;
MEDCOUPLING_EXPORT void pushTinySerializationDblInfo(std::vector<double>& tinyInfo) const;
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<MEDCouplingIMesh> ret(new MEDCouplingIMesh);
+ MCAuto<MEDCouplingIMesh> ret(new MEDCouplingIMesh);
ret->setName(meshName);
ret->setSpaceDimension(spaceDim);
ret->setNodeStruct(nodeStrctStart,nodeStrctStop);
return ret.retn();
}
-MEDCouplingIMesh *MEDCouplingIMesh::deepCpy() const
+MEDCouplingIMesh *MEDCouplingIMesh::deepCopy() const
{
return clone(true);
}
{
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];
dxyz[i]=_dxyz[i];
structure[i]=_structure[i]+2*ghostLev;
}
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingIMesh> ret(MEDCouplingIMesh::New(getName(),spaceDim,structure,structure+spaceDim,origin,origin+spaceDim,dxyz,dxyz+spaceDim));
+ MCAuto<MEDCouplingIMesh> ret(MEDCouplingIMesh::New(getName(),spaceDim,structure,structure+spaceDim,origin,origin+spaceDim,dxyz,dxyz+spaceDim));
ret->copyTinyInfoFrom(this);
return ret.retn();
}
*/
double MEDCouplingIMesh::getMeasureOfAnyCell() const
{
- checkCoherency();
+ checkConsistencyLight();
int dim(getSpaceDimension());
double ret(1.);
for(int i=0;i<dim;i++)
*/
MEDCouplingCMesh *MEDCouplingIMesh::convertToCartesian() const
{
- checkCoherency();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> ret(MEDCouplingCMesh::New());
+ checkConsistencyLight();
+ MCAuto<MEDCouplingCMesh> ret(MEDCouplingCMesh::New());
try
{ ret->copyTinyInfoFrom(this); }
catch(INTERP_KERNEL::Exception& ) { }
std::vector<std::string> infos(buildInfoOnComponents());
for(int i=0;i<spaceDim;i++)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr(DataArrayDouble::New()); arr->alloc(_structure[i],1); arr->setInfoOnComponent(0,infos[i]);
+ MCAuto<DataArrayDouble> 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);
}
{
if((int)factors.size()!=_space_dim)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::refineWithFactor : refinement factors must have size equal to spaceDim !");
- checkCoherency();
+ checkConsistencyLight();
std::vector<int> structure(_structure,_structure+3);
std::vector<double> dxyz(_dxyz,_dxyz+3);
for(int i=0;i<_space_dim;i++)
*
* \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<spaceDim;i++)
dxyz[i]=_dxyz[i];
}
}
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingIMesh> ret(MEDCouplingIMesh::New(getName(),getSpaceDimension(),nodeSt,nodeSt+spaceDim,_origin,_origin+spaceDim,dxyz,dxyz+spaceDim));
+ MCAuto<MEDCouplingIMesh> ret(MEDCouplingIMesh::New(getName(),getSpaceDimension(),nodeSt,nodeSt+spaceDim,_origin,_origin+spaceDim,dxyz,dxyz+spaceDim));
ret->copyTinyInfoFrom(this);
return ret.retn();
}
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
MEDCouplingStructuredMesh *MEDCouplingIMesh::buildStructuredSubPart(const std::vector< std::pair<int,int> >& cellPart) const
{
- checkCoherency();
+ checkConsistencyLight();
int dim(getSpaceDimension());
if(dim!=(int)cellPart.size())
{
}
double retOrigin[3]={0.,0.,0.};
int retStruct[3]={0,0,0};
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingIMesh> ret(dynamic_cast<MEDCouplingIMesh *>(deepCpy()));
+ MCAuto<MEDCouplingIMesh> ret(dynamic_cast<MEDCouplingIMesh *>(deepCopy()));
for(int i=0;i<dim;i++)
{
int startNode(cellPart[i].first),endNode(cellPart[i].second+1);
}
ret->setNodeStruct(retStruct,retStruct+dim);
ret->setOrigin(retOrigin,retOrigin+dim);
- ret->checkCoherency();
+ ret->checkConsistencyLight();
return ret.retn();
}
void MEDCouplingIMesh::getBoundingBox(double *bbox) const
{
- checkCoherency();
+ checkConsistencyLight();
int dim(getSpaceDimension());
for(int idim=0; idim<dim; idim++)
{
*/
MEDCouplingFieldDouble *MEDCouplingIMesh::getMeasureField(bool isAbs) const
{
- checkCoherency();
+ checkConsistencyLight();
std::string name="MeasureOfMesh_";
name+=getName();
int nbelem(getNumberOfCells());
*/
DataArrayDouble *MEDCouplingIMesh::getCoordinatesAndOwner() const
{
- checkCoherency();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret(DataArrayDouble::New());
+ checkConsistencyLight();
+ MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
int spaceDim(getSpaceDimension()),nbNodes(getNumberOfNodes());
ret->alloc(nbNodes,spaceDim);
double *pt(ret->getPointer());
* 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<DataArrayDouble> ret(DataArrayDouble::New());
+ checkConsistencyLight();
+ MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
int spaceDim(getSpaceDimension()),nbCells(getNumberOfCells()),tmp[3],tmp2[3];
ret->alloc(nbCells,spaceDim);
double *pt(ret->getPointer()),shiftOrigin[3];
DataArrayDouble *MEDCouplingIMesh::computeIsoBarycenterOfNodesPerCell() const
{
- return MEDCouplingIMesh::getBarycenterAndOwner();
+ return MEDCouplingIMesh::computeCellCenterOfMass();
}
void MEDCouplingIMesh::renumberCells(const int *old2NewBg, bool check)
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++)
{
MEDCOUPLING_EXPORT static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair<int,int> >& fineLocInCoarse, const std::vector<int>& facts, int ghostSize);
MEDCOUPLING_EXPORT static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector<int>& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair<int,int> >& fineLocInCoarse, const std::vector<int>& 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;
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<double>& coo) const;
MEDCOUPLING_EXPORT std::string simpleRepr() const;
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
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;
--- /dev/null
+// 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 <limits>
+#include <algorithm>
+#include <functional>
+#include <iterator>
+#include <sstream>
+#include <cmath>
+#include <list>
+#include <set>
+
+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<const BigMemoryObject *> MEDCouplingMappedExtrudedMesh::getDirectChildrenWithNull() const
+{
+ std::vector<const BigMemoryObject *> 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<const MEDCouplingMappedExtrudedMesh *>(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<MEDCouplingUMesh *>(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<const MEDCouplingMappedExtrudedMesh *>(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<const MEDCouplingMappedExtrudedMesh *>(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<INTERP_KERNEL::NormalizedCellType> MEDCouplingMappedExtrudedMesh::getAllGeoTypes() const
+{
+ std::set<INTERP_KERNEL::NormalizedCellType> ret2D(_mesh2D->getAllGeoTypes());
+ std::set<INTERP_KERNEL::NormalizedCellType> ret;
+ for(std::set<INTERP_KERNEL::NormalizedCellType>::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<DataArrayInt> ret=DataArrayInt::New();
+ if(revExtTyp==INTERP_KERNEL::NORM_ERROR)
+ {
+ ret->alloc(0,1);
+ return ret.retn();
+ }
+ MCAuto<DataArrayInt> 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;i<nbOfLevs;i++,pt+=nbOfTuples)
+ std::transform(tmp->begin(),tmp->end(),pt,std::bind2nd(std::plus<int>(),i*nbOfCells2D));
+ MCAuto<DataArrayInt> ret2=ret->renumberR(_mesh3D_ids->begin());
+ ret2->sort();
+ return ret2.retn();
+}
+
+DataArrayInt *MEDCouplingMappedExtrudedMesh::computeNbOfNodesPerCell() const
+{
+ MCAuto<DataArrayInt> ret2D=_mesh2D->computeNbOfNodesPerCell();
+ int nbOfLevs=_mesh1D->getNumberOfCells();
+ int nbOfCells2D=_mesh2D->getNumberOfCells();
+ MCAuto<DataArrayInt> ret3D=DataArrayInt::New(); ret3D->alloc(nbOfLevs*nbOfCells2D,1);
+ int *pt=ret3D->getPointer();
+ for(int i=0;i<nbOfLevs;i++,pt+=nbOfCells2D)
+ std::copy(ret2D->begin(),ret2D->end(),pt);
+ ret3D->applyLin(2,0,0);
+ return ret3D->renumberR(_mesh3D_ids->begin());
+}
+
+DataArrayInt *MEDCouplingMappedExtrudedMesh::computeNbOfFacesPerCell() const
+{
+ MCAuto<DataArrayInt> ret2D=_mesh2D->computeNbOfNodesPerCell();
+ int nbOfLevs=_mesh1D->getNumberOfCells();
+ int nbOfCells2D=_mesh2D->getNumberOfCells();
+ MCAuto<DataArrayInt> ret3D=DataArrayInt::New(); ret3D->alloc(nbOfLevs*nbOfCells2D,1);
+ int *pt=ret3D->getPointer();
+ for(int i=0;i<nbOfLevs;i++,pt+=nbOfCells2D)
+ std::copy(ret2D->begin(),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;i<nbOfCells2D;i++)
+ {
+ INTERP_KERNEL::NormalizedCellType t=_mesh2D->getTypeOfCell(i);
+ if(INTERP_KERNEL::CellModel::GetCellModel(t).getExtrudedType()==type)
+ ret++;
+ }
+ return ret*_mesh1D->getNumberOfCells();
+}
+
+void MEDCouplingMappedExtrudedMesh::getNodeIdsOfCell(int cellId, std::vector<int>& conn) const
+{
+ int nbOfCells2D=_mesh2D->getNumberOfCells();
+ int nbOfNodes2D=_mesh2D->getNumberOfNodes();
+ int locId=cellId%nbOfCells2D;
+ int lev=cellId/nbOfCells2D;
+ std::vector<int> tmp,tmp2;
+ _mesh2D->getNodeIdsOfCell(locId,tmp);
+ tmp2=tmp;
+ std::transform(tmp.begin(),tmp.end(),tmp.begin(),std::bind2nd(std::plus<int>(),nbOfNodes2D*lev));
+ std::transform(tmp2.begin(),tmp2.end(),tmp2.begin(),std::bind2nd(std::plus<int>(),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<double>& coo) const
+{
+ int nbOfNodes2D=_mesh2D->getNumberOfNodes();
+ int locId=nodeId%nbOfNodes2D;
+ int lev=nodeId/nbOfNodes2D;
+ std::vector<double> 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<double>());
+ std::transform(tmp2.begin(),tmp2.end(),z+(lev+1)*spaceDim,tmp2.begin(),std::plus<double>());
+ 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<double>::max());
+ std::fill(bbox1DMax,bbox1DMax+3,-(std::numeric_limits<double>::max()));
+ for(int i=0;i<nbOfNodes1D;i++)
+ {
+ std::transform(nodes1D+3*i,nodes1D+3*(i+1),bbox1DMin,bbox1DMin,static_cast<const double& (*)(const double&, const double&)>(std::min<double>));
+ std::transform(nodes1D+3*i,nodes1D+3*(i+1),bbox1DMax,bbox1DMax,static_cast<const double& (*)(const double&, const double&)>(std::max<double>));
+ }
+ std::transform(bbox1DMax,bbox1DMax+3,bbox1DMin,tmp,std::minus<double>());
+ 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;i<nbOf1DCells;i++)
+ for(int j=0;j<nbOf2DCells;j++)
+ retPtr[renum[i*nbOf2DCells+j]]=ret2DPtr[j]*ret1DPtr[i];
+ ret->setArray(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<nbOf1DLev;i++)
+ {
+ std::vector<int> 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<int> 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<int>& 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<int> conn2(conn2D+conn2DIndx[*candidate2D]+1,conn2D+conn2DIndx[*candidate2D+1]);
+ std::sort(conn2.begin(),conn2.end());
+ std::list<int> intersect;
+ std::set_intersection(connSorted.begin(),connSorted.end(),conn2.begin(),conn2.end(),
+ std::insert_iterator< std::list<int> >(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<int>& 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<int>::const_iterator iter=nodalConnec.begin();iter!=nodalConnec.end();iter++)
+ std::transform(zoneToUpdate,zoneToUpdate+3,coords+3*(*iter),zoneToUpdate,std::plus<double>());
+ std::transform(zoneToUpdate,zoneToUpdate+3,zoneToUpdate,std::bind2nd(std::multiplies<double>(),(double)(1./(int)nodalConnec.size())));
+}
+
+int MEDCouplingMappedExtrudedMesh::FindCorrespCellByNodalConn(const std::vector<int>& nodalConnec, const int *revNodalPtr, const int *revNodalIndxPtr)
+{
+ std::vector<int>::const_iterator iter=nodalConnec.begin();
+ std::set<int> s1(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1]);
+ iter++;
+ for(;iter!=nodalConnec.end();iter++)
+ {
+ std::set<int> s2(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1]);
+ std::set<int> s3;
+ std::set_intersection(s1.begin(),s1.end(),s2.begin(),s2.end(),std::insert_iterator< std::set<int> >(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<int>(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<int> c;
+ std::vector<double> 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>());
+ double n=INTERP_KERNEL::norm<3>(v);
+ std::transform(v,v+3,v,std::bind2nd(std::multiplies<double>(),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<int> MEDCouplingMappedExtrudedMesh::getDistributionOfTypes() const
+{
+ throw INTERP_KERNEL::Exception("Not implemented yet !");
+}
+
+DataArrayInt *MEDCouplingMappedExtrudedMesh::checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const
+{
+ throw INTERP_KERNEL::Exception("Not implemented yet !");
+}
+
+void MEDCouplingMappedExtrudedMesh::splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& idsInPflPerType, std::vector<DataArrayInt *>& 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;i<nbOf1DLev;i++)
+ {
+ std::copy(ptSrc,ptSrc+3*nbOf2DNodes,pt+3*i*nbOf2DNodes);
+ double vec[3];
+ std::copy(arr1D->getConstPointer()+3*i,arr1D->getConstPointer()+3*(i+1),vec);
+ std::transform(arr1D->getConstPointer()+3*(i-1),arr1D->getConstPointer()+3*i,vec,vec,std::minus<double>());
+ for(int j=0;j<nbOf2DNodes;j++)
+ std::transform(vec,vec+3,pt+3*(i*nbOf2DNodes+j),pt+3*(i*nbOf2DNodes+j),std::plus<double>());
+ }
+ 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<MEDCouplingUMesh> 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;i<nbOf1DLev;i++)
+ {
+ tmpConn[0]=i;
+ tmpConn[1]=i+1;
+ _mesh1D->insertNextCell(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<nbOf2DCells;i++)
+ {
+ int idInSubMesh;
+ std::vector<int> 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<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const
+{
+ std::vector<int> tinyInfo1;
+ std::vector<std::string> ls1;
+ std::vector<double> ls3;
+ _mesh2D->getTinySerializationInformation(ls3,tinyInfo1,ls1);
+ std::vector<int> tinyInfo2;
+ std::vector<std::string> ls2;
+ std::vector<double> 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<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
+{
+ std::size_t sz=tinyInfo.size();
+ int sz1=tinyInfo[sz-2];
+ std::vector<int> ti1(tinyInfo.begin(),tinyInfo.begin()+sz1);
+ std::vector<int> 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<std::string> 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<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector<std::string>& 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<int> ti1(tinyInfo.begin(),tinyInfo.begin()+sz1);
+ std::vector<int> 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<std::string> 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<double> 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<MEDCouplingUMesh> 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();
+}
--- /dev/null
+// 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 <vector>
+
+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<const BigMemoryObject *> 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<INTERP_KERNEL::NormalizedCellType> 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<int>& conn) const;
+ MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector<double>& 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<int>& 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<int> getDistributionOfTypes() const;
+ MEDCOUPLING_EXPORT DataArrayInt *checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const;
+ MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& idsInPflPerType, std::vector<DataArrayInt *>& 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<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const;
+ MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
+ const std::vector<std::string>& 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<int>& connSorted,
+ const int *desc3D, const int *descIndx3D,
+ const int *conn2D, const int *conn2DIndx);
+ void computeBaryCenterOfFace(const std::vector<int>& 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
return new DenseMatrix(array,nbRows,nbCols);
}
-DenseMatrix *DenseMatrix::deepCpy() const
+DenseMatrix *DenseMatrix::deepCopy() const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr(getData()->deepCpy());
- MEDCouplingAutoRefCountObjectPtr<DenseMatrix> ret(DenseMatrix::New(arr,getNumberOfRows(),getNumberOfCols()));
+ MCAuto<DataArrayDouble> arr(getData()->deepCopy());
+ MCAuto<DenseMatrix> ret(DenseMatrix::New(arr,getNumberOfRows(),getNumberOfCols()));
return ret.retn();
}
DenseMatrix *DenseMatrix::shallowCpy() const
{
- MEDCouplingAutoRefCountObjectPtr<DenseMatrix> ret(DenseMatrix::New(const_cast<DataArrayDouble *>(getData()),getNumberOfRows(),getNumberOfCols()));
+ MCAuto<DenseMatrix> ret(DenseMatrix::New(const_cast<DataArrayDouble *>(getData()),getNumberOfRows(),getNumberOfCols()));
return ret.retn();
}
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<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(mat->getNumberOfRows(),1);
+ MCAuto<DataArrayDouble> 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();
}
if(!a1 || !a2)
throw INTERP_KERNEL::Exception("DenseMatrix::Add : input matrices must be not NULL !");
CheckSameSize(a1,a2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> data(DataArrayDouble::Add(a1->getData(),a2->getData()));
- MEDCouplingAutoRefCountObjectPtr<DenseMatrix> ret(DenseMatrix::New(data,a1->getNumberOfRows(),a1->getNumberOfCols()));
+ MCAuto<DataArrayDouble> data(DataArrayDouble::Add(a1->getData(),a2->getData()));
+ MCAuto<DenseMatrix> ret(DenseMatrix::New(data,a1->getNumberOfRows(),a1->getNumberOfCols()));
return ret.retn();
}
if(!a1 || !a2)
throw INTERP_KERNEL::Exception("DenseMatrix::Substract : input matrices must be not NULL !");
CheckSameSize(a1,a2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> data(DataArrayDouble::Substract(a1->getData(),a2->getData()));
- MEDCouplingAutoRefCountObjectPtr<DenseMatrix> ret(DenseMatrix::New(data,a1->getNumberOfRows(),a1->getNumberOfCols()));
+ MCAuto<DataArrayDouble> data(DataArrayDouble::Substract(a1->getData(),a2->getData()));
+ MCAuto<DenseMatrix> ret(DenseMatrix::New(data,a1->getNumberOfRows(),a1->getNumberOfCols()));
return ret.retn();
}
throw INTERP_KERNEL::Exception("DenseMatrix::Multiply : input matrices must be not NULL !");
CheckCompatibleSizeForMul(a1,a2);
int nbr(a1->getNumberOfRows()),nbc(a2->getNumberOfCols());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> data(DataArrayDouble::New()); data->alloc(nbr*nbc,1);
- MEDCouplingAutoRefCountObjectPtr<DenseMatrix> ret(DenseMatrix::New(data,a1->getNumberOfRows(),a2->getNumberOfCols()));
+ MCAuto<DataArrayDouble> data(DataArrayDouble::New()); data->alloc(nbr*nbc,1);
+ MCAuto<DenseMatrix> 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();
}
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<DenseMatrix> a2Bis(DenseMatrix::New(const_cast<DataArrayDouble *>(a2),a2->getNumberOfTuples(),1));
+ MCAuto<DenseMatrix> a2Bis(DenseMatrix::New(const_cast<DataArrayDouble *>(a2),a2->getNumberOfTuples(),1));
return DenseMatrix::Multiply(a1,a2Bis);
}
#include "MEDCouplingTimeLabel.hxx"
#include "MEDCouplingRefCountObject.hxx"
#include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "InterpKernelException.hxx"
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<const BigMemoryObject *> getDirectChildrenWithNull() const;
private:
int _nb_rows;
int _nb_cols;
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> _data;
+ MCAuto<DataArrayDouble> _data;
};
}
// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingMemArray.txx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "BBTree.txx"
#include "GenMathFormulae.hxx"
return oss.str();
}
-std::string DataArray::GetAxTypeRepr(MEDCouplingAxisType at)
+std::string DataArray::GetAxisTypeRepr(MEDCouplingAxisType at)
{
switch(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 !");
}
}
* \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);
}
* \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();
* \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();
checkAllocated();
int nbTuples=getNumberOfTuples();
int nbOfCompo=getNumberOfComponents();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbTuples,nbOfCompo);
ret->copyStringInfoFrom(*this);
const double *iptr=getConstPointer();
checkAllocated();
int nbTuples=getNumberOfTuples();
int nbOfCompo=getNumberOfComponents();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbTuples,nbOfCompo);
ret->copyStringInfoFrom(*this);
const double *iptr=getConstPointer();
checkAllocated();
int nbTuples=getNumberOfTuples();
int nbOfCompo=getNumberOfComponents();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(newNbOfTuple,nbOfCompo);
const double *iptr=getConstPointer();
double *optr=ret->getPointer();
DataArrayDouble *DataArrayDouble::selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const
{
checkAllocated();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
int nbComp=getNumberOfComponents();
ret->alloc((int)std::distance(new2OldBg,new2OldEnd),nbComp);
ret->copyStringInfoFrom(*this);
DataArrayDouble *DataArrayDouble::selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const
{
checkAllocated();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
int nbComp=getNumberOfComponents();
int oldNbOfTuples=getNumberOfTuples();
ret->alloc((int)std::distance(new2OldBg,new2OldEnd),nbComp);
* 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<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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;
}
}
if(isIncreasing && nbOfTuplesThis==nbOfTuples)
- return deepCpy();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ return deepCopy();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbOfTuples,nbOfComp);
ret->copyStringInfoFrom(*this);
const double *src=getConstPointer();
* Returns a shorten copy of \a this array. The new DataArrayDouble 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.
* \throw If \a tupleIdBg < 0.
* \throw If \a tupleIdBg > \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
{
else
trueEnd=nbt;
int nbComp=getNumberOfComponents();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(trueEnd-tupleIdBg,nbComp);
ret->copyStringInfoFrom(*this);
std::copy(getConstPointer()+tupleIdBg*nbComp,getConstPointer()+trueEnd*nbComp,ret->getPointer());
DataArrayDouble *DataArrayDouble::changeNbOfComponents(int newNbOfComp, double dftValue) const
{
checkAllocated();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(getNumberOfTuples(),newNbOfComp);
const double *oldc=getConstPointer();
double *nc=ret->getPointer();
DataArrayDouble *DataArrayDouble::keepSelectedComponents(const std::vector<int>& compoIds) const
{
checkAllocated();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret(DataArrayDouble::New());
+ MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
std::size_t newNbOfCompo=compoIds.size();
int oldNbOfCompo=getNumberOfComponents();
for(std::vector<int>::const_iterator it=compoIds.begin();it!=compoIds.end();it++)
checkAllocated(); other->checkAllocated();
if(getNumberOfComponents()!=other->getNumberOfComponents())
throw INTERP_KERNEL::Exception("DataArrayDouble::areIncludedInMe : the number of components does not match !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> a=DataArrayDouble::Aggregate(this,other);
+ MCAuto<DataArrayDouble> a=DataArrayDouble::Aggregate(this,other);
DataArrayInt *c=0,*ci=0;
a->findCommonTuples(prec,getNumberOfTuples(),c,ci);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cSafe(c),ciSafe(ci);
+ MCAuto<DataArrayInt> cSafe(c),ciSafe(ci);
int newNbOfTuples=-1;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids=DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(a->getNumberOfTuples(),c->begin(),ci->begin(),ci->end(),newNbOfTuples);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret1=ids->selectByTupleId2(getNumberOfTuples(),a->getNumberOfTuples(),1);
+ MCAuto<DataArrayInt> ids=DataArrayInt::ConvertIndexArrayToO2N(a->getNumberOfTuples(),c->begin(),ci->begin(),ci->end(),newNbOfTuples);
+ MCAuto<DataArrayInt> ret1=ids->selectByTupleIdSafeSlice(getNumberOfTuples(),a->getNumberOfTuples(),1);
tupleIds=ret1.retn();
return newNbOfTuples==getNumberOfTuples();
}
*
* \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
{
int nbOfTuples=getNumberOfTuples();
//
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> c(DataArrayInt::New()),cI(DataArrayInt::New()); c->alloc(0,1); cI->pushBackSilent(0);
+ MCAuto<DataArrayInt> c(DataArrayInt::New()),cI(DataArrayInt::New()); c->alloc(0,1); cI->pushBackSilent(0);
switch(nbOfCompo)
{
case 4:
throw INTERP_KERNEL::Exception("DataArrayDouble::duplicateEachTupleNTimes : nb times should be >= 1 !");
int nbTuples=getNumberOfTuples();
const double *inPtr=getConstPointer();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New(); ret->alloc(nbTimes*nbTuples,1);
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New(); ret->alloc(nbTimes*nbTuples,1);
double *retPtr=ret->getPointer();
for(int i=0;i<nbTuples;i++,inPtr++)
{
*/
double DataArrayDouble::minimalDistanceTo(const DataArrayDouble *other, int& thisTupleId, int& otherTupleId) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> part1=findClosestTupleId(other);
+ MCAuto<DataArrayInt> part1=findClosestTupleId(other);
int nbOfCompo(getNumberOfComponents());
int otherNbTuples(other->getNumberOfTuples());
const double *thisPt(begin()),*otherPt(other->begin());
}
int nbOfTuples=other->getNumberOfTuples();
int thisNbOfTuples=getNumberOfTuples();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbOfTuples,1);
+ MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbOfTuples,1);
double bounds[6];
getMinMaxPerComponent(bounds);
switch(nbOfCompo)
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<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(nbOfTuples,1);
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(nbOfTuples,1);
const double *thisBBPtr(begin());
int *retPtr(ret->getPointer());
switch(nbOfComp/2)
checkAllocated();
DataArrayInt *c0=0,*cI0=0;
findCommonTuples(prec,limitTupleId,c0,cI0);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> c(c0),cI(cI0);
+ MCAuto<DataArrayInt> c(c0),cI(cI0);
int newNbOfTuples=-1;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n=DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(getNumberOfTuples(),c0->begin(),cI0->begin(),cI0->end(),newNbOfTuples);
+ MCAuto<DataArrayInt> o2n=DataArrayInt::ConvertIndexArrayToO2N(getNumberOfTuples(),c0->begin(),cI0->begin(),cI0->end(),newNbOfTuples);
return renumberAndReduce(o2n->getConstPointer(),newNbOfTuples);
}
* 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<const DataArrayDouble *>(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<nbOfTupleToWrite;i++,valsToSet+=nbOfComp,valsSrc+=step*nbOfComp)
{
const double *dataPtr=getConstPointer();
int nbOfCompo=getNumberOfComponents();
int nbTuples=getNumberOfTuples();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> bbox=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> bbox=DataArrayDouble::New();
bbox->alloc(nbTuples,2*nbOfCompo);
double *bboxPtr=bbox->getPointer();
for(int i=0;i<nbTuples;i++)
if(nbOfCompo!=otherNbOfCompo)
throw INTERP_KERNEL::Exception("DataArrayDouble::computeTupleIdsNearTuples : number of components should be equal between this and other !");
int nbOfTuplesOther=other->getNumberOfTuples();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cArr(DataArrayInt::New()),cIArr(DataArrayInt::New()); cArr->alloc(0,1); cIArr->pushBackSilent(0);
+ MCAuto<DataArrayInt> cArr(DataArrayInt::New()),cIArr(DataArrayInt::New()); cArr->alloc(0,1); cIArr->pushBackSilent(0);
switch(nbOfCompo)
{
case 3:
int tmp;
tupleIds=0;
double ret=getMaxValue(tmp);
- tupleIds=getIdsInRange(ret,ret);
+ tupleIds=findIdsInRange(ret,ret);
return ret;
}
int tmp;
tupleIds=0;
double ret=getMinValue(tmp);
- tupleIds=getIdsInRange(ret,ret);
+ tupleIds=findIdsInRange(ret,ret);
return ret;
}
if(sz<1)
throw INTERP_KERNEL::Exception("DataArrayDouble::accumulatePerChunck : invalid size of input index array !");
sz--;
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New(); ret->alloc(sz,nbCompo);
+ MCAuto<DataArrayDouble> 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) !");
{
checkAllocated();
int nbOfComp(getNumberOfComponents());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret;
+ MCAuto<DataArrayDouble> ret;
switch(atOfThis)
{
case AX_CART:
- ret=deepCpy();
+ ret=deepCopy();
case AX_CYL:
if(nbOfComp==3)
{
{
checkAllocated();
int nbOfComp(getNumberOfComponents()),nbOfTuple(getNumberOfTuples());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret(DataArrayDouble::New());
+ MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
ret->alloc(nbOfTuple,1);
const double *src(getConstPointer());
double *dest(ret->getPointer());
{
checkAllocated();
int nbOfComp=getNumberOfComponents();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
int nbOfTuple=getNumberOfTuples();
ret->alloc(nbOfTuple,1);
const double *src=getConstPointer();
{
checkAllocated();
int nbOfComp=getNumberOfComponents();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret0=DataArrayDouble::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret1=DataArrayInt::New();
+ MCAuto<DataArrayDouble> ret0=DataArrayDouble::New();
+ MCAuto<DataArrayInt> ret1=DataArrayInt::New();
int nbOfTuple=getNumberOfTuples();
ret0->alloc(nbOfTuple,1); ret1->alloc(nbOfTuple,1);
const double *src=getConstPointer();
int nbOfComp=getNumberOfComponents();
int nbOfTuples=getNumberOfTuples();
const double *inData=getConstPointer();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbOfTuples*nbOfTuples,1);
double *outData=ret->getPointer();
for(int i=0;i<nbOfTuples;i++)
int otherNbOfTuples=other->getNumberOfTuples();
const double *inData=getConstPointer();
const double *inDataOther=other->getConstPointer();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(otherNbOfTuples*nbOfTuples,1);
double *outData=ret->getPointer();
for(int i=0;i<otherNbOfTuples;i++,inDataOther+=nbOfComp)
std::set<std::string> vars;
expr.getTrueSetOfVars(vars);
std::vector<std::string> varsV(vars.begin(),vars.end());
- return applyFunc3(nbOfComp,varsV,func,isSafe);
+ return applyFuncNamedCompo(nbOfComp,varsV,func,isSafe);
}
/*!
throw INTERP_KERNEL::Exception("DataArrayDouble::applyFunc : output number of component must be > 0 !");
checkAllocated();
int nbOfTuples(getNumberOfTuples());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> newArr(DataArrayDouble::New());
+ MCAuto<DataArrayDouble> newArr(DataArrayDouble::New());
newArr->alloc(nbOfTuples,nbOfComp);
INTERP_KERNEL::ExprParser expr(func);
expr.parse();
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<std::string>(oss," "));
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
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<std::string>(oss," "));
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
* \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);
}
/*!
* \throw If \a func contains vars not in \a varsOrder.
* \throw If computing \a func fails.
*/
-DataArrayDouble *DataArrayDouble::applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe) const
+DataArrayDouble *DataArrayDouble::applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& 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<std::string> varsOrder2(varsOrder);
int oldNbOfComp(getNumberOfComponents());
for(int i=(int)varsOrder.size();i<oldNbOfComp;i++)
std::copy(vars.begin(),vars.end(),std::ostream_iterator<std::string>(oss," "));
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> newArr(DataArrayDouble::New());
+ MCAuto<DataArrayDouble> newArr(DataArrayDouble::New());
newArr->alloc(nbOfTuples,nbOfComp);
INTERP_KERNEL::AutoPtr<double> buff(new double[oldNbOfComp]);
double *buffPtr(buff),*ptrToFill;
* 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".<br>
* \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<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
int nbOfTuples(getNumberOfTuples());
for(int i=0;i<nbOfTuples;i++,cptr++)
if(*cptr>=vmin && *cptr<=vmax)
* 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<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
int nbOfTuples(getNumberOfTuples());
for(int i=0;i<nbOfTuples;i++,cptr++)
if(*cptr<vmin || *cptr>vmax)
throw INTERP_KERNEL::Exception("DataArrayDouble::Aggregate : Nb of components mismatch for array aggregation !");
nbt+=(*it)->getNumberOfTuples();
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbt,nbOfComp);
double *pt=ret->getPointer();
for(it=a.begin();it!=a.end();it++)
int nbOfTuple2=a2->getNumberOfTuples();
int nbOfComp=a1->getNumberOfComponents();
int nbOfComp2=a2->getNumberOfComponents();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=0;
+ MCAuto<DataArrayDouble> ret=0;
if(nbOfTuple==nbOfTuple2)
{
if(nbOfComp==nbOfComp2)
{
if(nbOfComp1==nbOfComp2)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbOfTuple2,nbOfComp1);
std::transform(a1->begin(),a1->end(),a2->begin(),ret->getPointer(),std::minus<double>());
ret->copyStringInfoFrom(*a1);
}
else if(nbOfComp2==1)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbOfTuple1,nbOfComp1);
const double *a2Ptr=a2->getConstPointer();
const double *a1Ptr=a1->getConstPointer();
else if(nbOfTuple2==1)
{
a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Substract !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbOfTuple1,nbOfComp1);
const double *a1ptr=a1->getConstPointer(),*a2ptr=a2->getConstPointer();
double *pt=ret->getPointer();
int nbOfTuple2=a2->getNumberOfTuples();
int nbOfComp=a1->getNumberOfComponents();
int nbOfComp2=a2->getNumberOfComponents();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=0;
+ MCAuto<DataArrayDouble> ret=0;
if(nbOfTuple==nbOfTuple2)
{
if(nbOfComp==nbOfComp2)
{
if(nbOfComp1==nbOfComp2)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbOfTuple2,nbOfComp1);
std::transform(a1->begin(),a1->end(),a2->begin(),ret->getPointer(),std::divides<double>());
ret->copyStringInfoFrom(*a1);
}
else if(nbOfComp2==1)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbOfTuple1,nbOfComp1);
const double *a2Ptr=a2->getConstPointer();
const double *a1Ptr=a1->getConstPointer();
else if(nbOfTuple2==1)
{
a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Divide !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbOfTuple1,nbOfComp1);
const double *a1ptr=a1->getConstPointer(),*a2ptr=a2->getConstPointer();
double *pt=ret->getPointer();
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<DataArrayDouble> ret=DataArrayDouble::New(); ret->alloc(nbOfTuple,1);
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New(); ret->alloc(nbOfTuple,1);
const double *ptr1(a1->begin()),*ptr2(a2->begin());
double *ptr=ret->getPointer();
for(int i=0;i<nbOfTuple;i++,ptr1++,ptr2++,ptr++)
* \ref MEDCouplingArrayBasicsCopyDeep.
* \return DataArrayInt * - a new instance of DataArrayInt.
*/
-DataArrayInt *DataArrayInt::deepCpy() const
+DataArrayInt *DataArrayInt::deepCopy() const
{
return new DataArrayInt(*this);
}
* \return DataArrayInt * - either a new instance of DataArrayInt (if \a dCpy
* == \a true) or \a this instance (if \a dCpy == \a false).
*/
-DataArrayInt *DataArrayInt::performCpy(bool dCpy) const
+DataArrayInt *DataArrayInt::performCopyOrIncrRef(bool dCpy) const
{
if(dCpy)
- return deepCpy();
+ return deepCopy();
else
{
incrRef();
* \param [in] other - another instance of DataArrayInt to copy data from.
* \throw If the \a other is not allocated.
*/
-void DataArrayInt::cpyFrom(const DataArrayInt& other)
+void DataArrayInt::deepCopyFrom(const DataArrayInt& other)
{
other.checkAllocated();
int nbOfTuples=other.getNumberOfTuples();
typedef std::reverse_iterator<const int *> rintstart;
rintstart bg(arrEnd);//OK no problem because size of 'arr' is greater or equal 2
rintstart end2(arrBg);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret1=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret2=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret3=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret1=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret2=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret3=DataArrayInt::New();
ret1->alloc(nbOfTuples,1);
ret2->alloc(nbOfTuples,1);
int *ret1Ptr=ret1->getPointer();
int nbElemsIn=(int)std::distance(indArrBg,indArrEnd);
int nbOfTuples=getNumberOfTuples();
const int *pt=getConstPointer();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfTuples,1);
ret->fillWithValue(-1);
int *tmp=ret->getPointer();
*/
DataArrayInt *DataArrayInt::invertArrayO2N2N2O(int newNbOfElem) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(newNbOfElem,1);
int nbOfOldNodes=getNumberOfTuples();
const int *old2New=getConstPointer();
*/
DataArrayInt *DataArrayInt::invertArrayO2N2N2OBis(int newNbOfElem) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(newNbOfElem,1);
int nbOfOldNodes=getNumberOfTuples();
const int *old2New=getConstPointer();
DataArrayInt *DataArrayInt::invertArrayN2O2O2N(int oldNbOfElem) const
{
checkAllocated();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(oldNbOfElem,1);
const int *new2Old=getConstPointer();
int *pt=ret->getPointer();
*/
bool DataArrayInt::isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> a=deepCpy();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> b=other.deepCpy();
+ MCAuto<DataArrayInt> a=deepCopy();
+ MCAuto<DataArrayInt> b=other.deepCopy();
a->sort();
b->sort();
return a->isEqualWithoutConsideringStr(*b);
{
checkAllocated();
int nbOfComp(getNumberOfComponents()),nbOfTuple(getNumberOfTuples());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New());
+ MCAuto<DataArrayInt> ret(DataArrayInt::New());
ret->alloc(nbOfTuple,1);
const int *src(getConstPointer());
int *dest(ret->getPointer());
other.checkAllocated();
if(nbTuple!=other.getNumberOfTuples())
throw INTERP_KERNEL::Exception("DataArrayInt::buildPermutationArr : 'this' and 'other' must have the same number of tuple !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbTuple,1);
ret->fillWithValue(-1);
const int *pt=getConstPointer();
checkAllocated();
int nbTuples=getNumberOfTuples();
int nbOfCompo=getNumberOfComponents();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbTuples,nbOfCompo);
ret->copyStringInfoFrom(*this);
const int *iptr=getConstPointer();
checkAllocated();
int nbTuples=getNumberOfTuples();
int nbOfCompo=getNumberOfComponents();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbTuples,nbOfCompo);
ret->copyStringInfoFrom(*this);
const int *iptr=getConstPointer();
checkAllocated();
int nbTuples=getNumberOfTuples();
int nbOfCompo=getNumberOfComponents();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(newNbOfTuple,nbOfCompo);
const int *iptr=getConstPointer();
int *optr=ret->getPointer();
DataArrayInt *DataArrayInt::selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const
{
checkAllocated();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
int nbComp=getNumberOfComponents();
ret->alloc((int)std::distance(new2OldBg,new2OldEnd),nbComp);
ret->copyStringInfoFrom(*this);
DataArrayInt *DataArrayInt::selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const
{
checkAllocated();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
int nbComp=getNumberOfComponents();
int oldNbOfTuples=getNumberOfTuples();
ret->alloc((int)std::distance(new2OldBg,new2OldEnd),nbComp);
* 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<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> 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;
int nbOfTuplesThis=getNumberOfTuples();
if(ranges.empty())
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(0,nbOfComp);
ret->copyStringInfoFrom(*this);
return ret.retn();
}
}
if(isIncreasing && nbOfTuplesThis==nbOfTuples)
- return deepCpy();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ return deepCopy();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfTuples,nbOfComp);
ret->copyStringInfoFrom(*this);
const int *src=getConstPointer();
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<DataArrayInt> p1(ids1->deepCpy());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> p2(ids2->deepCpy());
+ MCAuto<DataArrayInt> p1(ids1->deepCopy());
+ MCAuto<DataArrayInt> 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 !");
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::changeSurjectiveFormat : number of components must == 1 !");
int nbOfTuples=getNumberOfTuples();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> retI(DataArrayInt::New());
+ MCAuto<DataArrayInt> ret(DataArrayInt::New());
+ MCAuto<DataArrayInt> retI(DataArrayInt::New());
retI->alloc(targetNb+1,1);
const int *input=getConstPointer();
std::vector< std::vector<int> > tmp(targetNb);
* 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<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfOldTuples,1);
int *pt=ret->getPointer();
std::fill(pt,pt+nbOfOldTuples,-1);
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());
}
}
int nbOfTuples=getNumberOfTuples();
const int *pt=getConstPointer();
std::map<int,int> m;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfTuples,1);
int *opt=ret->getPointer();
for(int i=0;i<nbOfTuples;i++,pt++,opt++)
* \throw If \a this is not allocated.
* \throw If \a this->getNumberOfComponents() != 1.
*/
-bool DataArrayInt::isIdentity2(int sizeExpected) const
+bool DataArrayInt::isIota(int sizeExpected) const
{
checkAllocated();
if(getNumberOfComponents()!=1)
* 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.
* \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
{
else
trueEnd=nbt;
int nbComp=getNumberOfComponents();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(trueEnd-tupleIdBg,nbComp);
ret->copyStringInfoFrom(*this);
std::copy(getConstPointer()+tupleIdBg*nbComp,getConstPointer()+trueEnd*nbComp,ret->getPointer());
DataArrayInt *DataArrayInt::changeNbOfComponents(int newNbOfComp, int dftValue) const
{
checkAllocated();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(getNumberOfTuples(),newNbOfComp);
const int *oldc=getConstPointer();
int *nc=ret->getPointer();
DataArrayInt *DataArrayInt::keepSelectedComponents(const std::vector<int>& compoIds) const
{
checkAllocated();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New());
+ MCAuto<DataArrayInt> ret(DataArrayInt::New());
int newNbOfCompo=(int)compoIds.size();
int oldNbOfCompo=getNumberOfComponents();
for(std::vector<int>::const_iterator it=compoIds.begin();it!=compoIds.end();it++)
* 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<const DataArrayInt *>(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;i<nbOfTupleToWrite;i++,valsToSet+=nbOfComp,valsSrc+=step*nbOfComp)
{
* array using decrRef() as it is no more needed.
* \throw If \a this is not allocated.
* \throw If \a this->getNumberOfComponents() != 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<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
int nbOfTuples=getNumberOfTuples();
for(int i=0;i<nbOfTuples;i++,cptr++)
if(*cptr==val)
* \throw If \a this is not allocated.
* \throw If \a this->getNumberOfComponents() != 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<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
int nbOfTuples=getNumberOfTuples();
for(int i=0;i<nbOfTuples;i++,cptr++)
if(*cptr!=val)
/*!
* Creates a new DataArrayInt containing IDs (indices) of tuples holding tuple equal to those defined by [ \a tupleBg , \a tupleEnd )
- * This method is an extension of DataArrayInt::getIdsEqual method.
+ * This method is an extension of DataArrayInt::findIdsEqual method.
*
* \param [in] tupleBg - the begin (included) of the input tuple to find within \a this.
* \param [in] tupleEnd - the end (excluded) of the input tuple to find within \a this.
* \throw If \a this is not allocated.
* \throw If \a this->getNumberOfComponents() != 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<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
+ throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualTuple : number of components should be > 0 !");
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
const int *bg(begin()),*end2(end()),*work(begin());
while(work!=end2)
{
* 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<int> vals2(valsBg,valsEnd);
const int *cptr(getConstPointer());
std::vector<int> res;
int nbOfTuples(getNumberOfTuples());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
for(int i=0;i<nbOfTuples;i++,cptr++)
if(vals2.find(*cptr)!=vals2.end())
ret->pushBackSilent(i);
* 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<int> vals2(valsBg,valsEnd);
const int *cptr=getConstPointer();
std::vector<int> res;
int nbOfTuples=getNumberOfTuples();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
for(int i=0;i<nbOfTuples;i++,cptr++)
if(vals2.find(*cptr)==vals2.end())
ret->pushBackSilent(i);
}
/*!
- * 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.
* \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<int>& tupl) const
+int DataArrayInt::findIdFirstEqualTuple(const std::vector<int>& 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();
/*!
* 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<int>& 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)
* If not any tuple contains one of the values contained in 'vals' -1 is returned.
* \sa DataArrayInt::presenceOfValue
*/
-int DataArrayInt::locateValue(const std::vector<int>& vals) const
+int DataArrayInt::findIdFirstEqual(const std::vector<int>& vals) const
{
checkAllocated();
if(getNumberOfComponents()!=1)
* 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<int>& tupl) const
{
- return locateTuple(tupl)!=-1;
+ return findIdFirstEqualTuple(tupl)!=-1;
}
* \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<int>& vals) const
{
- return locateValue(vals)!=-1;
+ return findIdFirstEqual(vals)!=-1;
}
/*!
if(sz<1)
throw INTERP_KERNEL::Exception("DataArrayInt::accumulatePerChunck : invalid size of input index array !");
sz--;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(sz,nbCompo);
+ MCAuto<DataArrayInt> 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) !");
throw INTERP_KERNEL::Exception("DataArrayInt::Aggregate : Nb of components mismatch for array aggregation !");
nbt+=(*it)->getNumberOfTuples();
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbt,nbOfComp);
int *pt=ret->getPointer();
for(it=a.begin();it!=a.end();it++)
}
if(arrs.empty())
throw INTERP_KERNEL::Exception("DataArrayInt::AggregateIndexes : input list must be NON EMPTY !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(retSz,1);
int *pt=ret->getPointer(); *pt++=0;
for(std::vector<const DataArrayInt *>::const_iterator it=arrs.begin();it!=arrs.end();it++)
* \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<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
int nbOfTuples(getNumberOfTuples());
for(int i=0;i<nbOfTuples;i++,cptr++)
if(*cptr>=vmin && *cptr<vmax)
* \param [in] vmax end of range. This value is included in range (included).
* \return a newly allocated data array that the caller should deal with.
*
- * \sa DataArrayInt::getIdsInRange , DataArrayInt::getIdsStrictlyNegative
+ * \sa DataArrayInt::findIdsInRange , DataArrayInt::findIdsStricltyNegative
*/
-DataArrayInt *DataArrayInt::getIdsNotInRange(int vmin, int vmax) const
+DataArrayInt *DataArrayInt::findIdsNotInRange(int vmin, int vmax) const
{
checkAllocated();
if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotInRange : this must have exactly one component !");
+ throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotInRange : this must have exactly one component !");
const int *cptr(getConstPointer());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
int nbOfTuples(getNumberOfTuples());
for(int i=0;i<nbOfTuples;i++,cptr++)
if(*cptr<vmin || *cptr>=vmax)
* 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<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
int nbOfTuples(getNumberOfTuples());
for(int i=0;i<nbOfTuples;i++,cptr++)
if(*cptr<0)
for(std::vector<const DataArrayInt *>::const_iterator it4=groups.begin();it4!=groups.end();it4++)
if(*it4)
groups2.push_back(*it4);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(newNb,1);
int *retPtr=ret->getPointer();
std::fill(retPtr,retPtr+newNb,0);
DataArrayInt *DataArrayInt::BuildListOfSwitchedOn(const std::vector<bool>& v)
{
int sz((int)std::count(v.begin(),v.end(),true));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(sz,1);
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(sz,1);
std::for_each(v.begin(),v.end(),MEDCouplingImpl::OpSwitchedOn(ret->getPointer()));
return ret.retn();
}
DataArrayInt *DataArrayInt::BuildListOfSwitchedOff(const std::vector<bool>& v)
{
int sz((int)std::count(v.begin(),v.end(),false));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(sz,1);
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(sz,1);
std::for_each(v.begin(),v.end(),MEDCouplingImpl::OpSwitchedOff(ret->getPointer()));
return ret.retn();
}
void DataArrayInt::PutIntoToSkylineFrmt(const std::vector< std::vector<int> >& v, DataArrayInt *& data, DataArrayInt *& dataIndex)
{
int sz((int)v.size());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret0(DataArrayInt::New()),ret1(DataArrayInt::New());
+ MCAuto<DataArrayInt> ret0(DataArrayInt::New()),ret1(DataArrayInt::New());
ret1->alloc(sz+1,1);
int *pt(ret1->getPointer()); *pt=0;
for(int i=0;i<sz;i++,pt++)
if(other->getNumberOfComponents()!=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<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
for(;work1!=pt1End;work1++)
{
if(work2!=pt2End && *work1==*work2)
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::buildUnique : only single component allowed !");
int nbOfTuples=getNumberOfTuples();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp=deepCpy();
+ MCAuto<DataArrayInt> tmp=deepCopy();
int *data=tmp->getPointer();
int *last=std::unique(data,data+nbOfTuples);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(std::distance(data,last),1);
std::copy(data,last,ret->getPointer());
return ret.retn();
getMinMaxValues(minVal,maxVal);
std::vector<bool> b(maxVal-minVal+1,false);
const int *ptBg(begin()),*endBg(end());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
for(const int *pt=ptBg;pt!=endBg;pt++)
{
if(!b[*pt-minVal])
* "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.
* - 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
{
* 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.<br>
* 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.
* - After \a this contains [0,3,8,9,11,11,19]<br>
* \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();
/*!
* 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.
* \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: <br>
* - \a this : [0,3,7,9,15,18]
* In this example id 3 in input \a listOfIds is alone so it do not appear in output \a idsInInputListThatFetch.
* <br>
*/
-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<DataArrayInt> ret0=DataArrayInt::New(); ret0->alloc(0,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret1=DataArrayInt::New(); ret1->alloc(0,1);
+ throw INTERP_KERNEL::Exception("DataArrayInt::findIdsRangesInListOfIds : this must have exactly one component !");
+ MCAuto<DataArrayInt> ret0=DataArrayInt::New(); ret0->alloc(0,1);
+ MCAuto<DataArrayInt> 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)
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(retNbOftuples,1);
int *retPtr=ret->getPointer();
for(int i=0;i<nbOfTuples;i++)
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(sz,1);
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(sz,1);
int *retPtr(ret->getPointer());
pos=bg;
for(int i=0;i<nbOfEltsInSlc;i++,pos+=step)
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::findRangeIdForEachTuple : this should have only one component !");
int nbTuples=getNumberOfTuples();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbTuples,1);
+ MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbTuples,1);
int nbOfRanges=ranges->getNumberOfTuples();
const int *rangesPtr=ranges->getConstPointer();
int *retPtr=ret->getPointer();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::findIdInRangeForEachTuple : this should have only one component !");
int nbTuples=getNumberOfTuples();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbTuples,1);
+ MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbTuples,1);
int nbOfRanges=ranges->getNumberOfTuples();
const int *rangesPtr=ranges->getConstPointer();
int *retPtr=ret->getPointer();
throw INTERP_KERNEL::Exception("DataArrayInt::duplicateEachTupleNTimes : nb times should be >= 1 !");
int nbTuples=getNumberOfTuples();
const int *inPtr=getConstPointer();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbTimes*nbTuples,1);
+ MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbTimes*nbTuples,1);
int *retPtr=ret->getPointer();
for(int i=0;i<nbTuples;i++,inPtr++)
{
checkAllocated();
std::set<int> ret;
ret.insert(begin(),end());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret2=DataArrayInt::New(); ret2->alloc((int)ret.size(),1);
+ MCAuto<DataArrayInt> ret2=DataArrayInt::New(); ret2->alloc((int)ret.size(),1);
std::copy(ret.begin(),ret.end(),ret2->getPointer());
return ret2.retn();
}
int nbOfTuple2=a2->getNumberOfTuples();
int nbOfComp=a1->getNumberOfComponents();
int nbOfComp2=a2->getNumberOfComponents();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=0;
+ MCAuto<DataArrayInt> ret=0;
if(nbOfTuple==nbOfTuple2)
{
if(nbOfComp==nbOfComp2)
{
if(nbOfComp1==nbOfComp2)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfTuple2,nbOfComp1);
std::transform(a1->begin(),a1->end(),a2->begin(),ret->getPointer(),std::minus<int>());
ret->copyStringInfoFrom(*a1);
}
else if(nbOfComp2==1)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfTuple1,nbOfComp1);
const int *a2Ptr=a2->getConstPointer();
const int *a1Ptr=a1->getConstPointer();
else if(nbOfTuple2==1)
{
a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Substract !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfTuple1,nbOfComp1);
const int *a1ptr=a1->getConstPointer(),*a2ptr=a2->getConstPointer();
int *pt=ret->getPointer();
int nbOfTuple2=a2->getNumberOfTuples();
int nbOfComp=a1->getNumberOfComponents();
int nbOfComp2=a2->getNumberOfComponents();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=0;
+ MCAuto<DataArrayInt> ret=0;
if(nbOfTuple==nbOfTuple2)
{
if(nbOfComp==nbOfComp2)
{
if(nbOfComp1==nbOfComp2)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfTuple2,nbOfComp1);
std::transform(a1->begin(),a1->end(),a2->begin(),ret->getPointer(),std::divides<int>());
ret->copyStringInfoFrom(*a1);
}
else if(nbOfComp2==1)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfTuple1,nbOfComp1);
const int *a2Ptr=a2->getConstPointer();
const int *a1Ptr=a1->getConstPointer();
else if(nbOfTuple2==1)
{
a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Divide !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfTuple1,nbOfComp1);
const int *a1ptr=a1->getConstPointer(),*a2ptr=a2->getConstPointer();
int *pt=ret->getPointer();
{
if(nbOfComp1==nbOfComp2)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfTuple2,nbOfComp1);
std::transform(a1->begin(),a1->end(),a2->begin(),ret->getPointer(),std::modulus<int>());
ret->copyStringInfoFrom(*a1);
}
else if(nbOfComp2==1)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfTuple1,nbOfComp1);
const int *a2Ptr=a2->getConstPointer();
const int *a1Ptr=a1->getConstPointer();
else if(nbOfTuple2==1)
{
a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Modulus !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfTuple1,nbOfComp1);
const int *a1ptr=a1->getConstPointer(),*a2ptr=a2->getConstPointer();
int *pt=ret->getPointer();
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<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbOfTuple,1);
+ MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbOfTuple,1);
const int *ptr1(a1->begin()),*ptr2(a2->begin());
int *ptr=ret->getPointer();
for(int i=0;i<nbOfTuple;i++,ptr1++,ptr2++,ptr++)
DataArrayInt *DataArrayInt::Range(int begin, int end, int step)
{
int nbOfTuples=GetNumberOfItemGivenBESRelative(begin,end,step,"DataArrayInt::Range");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfTuples,1);
int *ptr=ret->getPointer();
if(step>0)
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;
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<std::pair<int,int> >& ranges) const = 0;
MEDCOUPLING_EXPORT virtual DataArray *keepSelectedComponents(const std::vector<int>& 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;
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<const DataArray *>& arrs);
MEDCOUPLING_EXPORT virtual void reprStream(std::ostream& stream) const = 0;
MEDCOUPLING_EXPORT virtual void reprZipStream(std::ostream& stream) const = 0;
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);
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<std::pair<int,int> >& ranges) const;
MEDCOUPLING_EXPORT DataArrayDouble *substr(int tupleIdBg, int tupleIdEnd=-1) const;
MEDCOUPLING_EXPORT void rearrange(int newNbOfCompo);
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;
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<std::string>& 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<std::string>& 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<const DataArrayDouble *>& arr);
MEDCOUPLING_EXPORT static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2);
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);
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<std::pair<int,int> >& 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);
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;
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<int>& tupl) const;
- MEDCOUPLING_EXPORT int locateValue(int value) const;
- MEDCOUPLING_EXPORT int locateValue(const std::vector<int>& vals) const;
+ MEDCOUPLING_EXPORT int findIdFirstEqualTuple(const std::vector<int>& tupl) const;
+ MEDCOUPLING_EXPORT int findIdFirstEqual(int value) const;
+ MEDCOUPLING_EXPORT int findIdFirstEqual(const std::vector<int>& vals) const;
MEDCOUPLING_EXPORT int search(const std::vector<int>& vals) const;
MEDCOUPLING_EXPORT bool presenceOfTuple(const std::vector<int>& tupl) const;
MEDCOUPLING_EXPORT bool presenceOfValue(int value) const;
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<const DataArrayInt *>& arr);
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;
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);
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;
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<std::pair<int,int> >& 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]; }
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<char>& vals) const;
- MEDCOUPLING_EXPORT int locateTuple(const std::vector<char>& tupl) const;
- MEDCOUPLING_EXPORT int locateValue(char value) const;
- MEDCOUPLING_EXPORT int locateValue(const std::vector<char>& vals) const;
+ MEDCOUPLING_EXPORT int findIdFirstEqualTuple(const std::vector<char>& tupl) const;
+ MEDCOUPLING_EXPORT int findIdFirstEqual(char value) const;
+ MEDCOUPLING_EXPORT int findIdFirstEqual(const std::vector<char>& vals) const;
MEDCOUPLING_EXPORT bool presenceOfTuple(const std::vector<char>& tupl) const;
MEDCOUPLING_EXPORT bool presenceOfValue(char value) const;
MEDCOUPLING_EXPORT bool presenceOfValue(const std::vector<char>& vals) const;
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<const DataArrayChar *>& arr);
MEDCOUPLING_EXPORT static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2);
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;
MEDCOUPLING_EXPORT static DataArrayAsciiChar *New(const std::vector<std::string>& 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;
// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingMemArray.txx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include <set>
#include <cmath>
* \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();
checkAllocated();
int nbTuples=getNumberOfTuples();
int nbOfCompo=getNumberOfComponents();
- MEDCouplingAutoRefCountObjectPtr<DataArrayChar> ret=buildEmptySpecializedDAChar();
+ MCAuto<DataArrayChar> ret=buildEmptySpecializedDAChar();
ret->alloc(nbTuples,nbOfCompo);
ret->copyStringInfoFrom(*this);
const char *iptr=getConstPointer();
checkAllocated();
int nbTuples=getNumberOfTuples();
int nbOfCompo=getNumberOfComponents();
- MEDCouplingAutoRefCountObjectPtr<DataArrayChar> ret=buildEmptySpecializedDAChar();
+ MCAuto<DataArrayChar> ret=buildEmptySpecializedDAChar();
ret->alloc(nbTuples,nbOfCompo);
ret->copyStringInfoFrom(*this);
const char *iptr=getConstPointer();
checkAllocated();
int nbTuples=getNumberOfTuples();
int nbOfCompo=getNumberOfComponents();
- MEDCouplingAutoRefCountObjectPtr<DataArrayChar> ret=buildEmptySpecializedDAChar();
+ MCAuto<DataArrayChar> ret=buildEmptySpecializedDAChar();
ret->alloc(newNbOfTuple,nbOfCompo);
const char *iptr=getConstPointer();
char *optr=ret->getPointer();
DataArrayChar *DataArrayChar::selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const
{
checkAllocated();
- MEDCouplingAutoRefCountObjectPtr<DataArrayChar> ret=buildEmptySpecializedDAChar();
+ MCAuto<DataArrayChar> ret=buildEmptySpecializedDAChar();
int nbComp=getNumberOfComponents();
int oldNbOfTuples=getNumberOfTuples();
ret->alloc((int)std::distance(new2OldBg,new2OldEnd),nbComp);
* \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<DataArrayChar> ret=buildEmptySpecializedDAChar();
+ MCAuto<DataArrayChar> 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;
* 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.
* \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
{
else
trueEnd=nbt;
int nbComp=getNumberOfComponents();
- MEDCouplingAutoRefCountObjectPtr<DataArrayChar> ret=buildEmptySpecializedDAChar();
+ MCAuto<DataArrayChar> ret=buildEmptySpecializedDAChar();
ret->alloc(trueEnd-tupleIdBg,nbComp);
ret->copyStringInfoFrom(*this);
std::copy(getConstPointer()+tupleIdBg*nbComp,getConstPointer()+trueEnd*nbComp,ret->getPointer());
DataArrayChar *DataArrayChar::changeNbOfComponents(int newNbOfComp, char dftValue) const
{
checkAllocated();
- MEDCouplingAutoRefCountObjectPtr<DataArrayChar> ret=buildEmptySpecializedDAChar();
+ MCAuto<DataArrayChar> ret=buildEmptySpecializedDAChar();
ret->alloc(getNumberOfTuples(),newNbOfComp);
const char *oldc=getConstPointer();
char *nc=ret->getPointer();
DataArrayChar *DataArrayChar::keepSelectedComponents(const std::vector<int>& compoIds) const
{
checkAllocated();
- MEDCouplingAutoRefCountObjectPtr<DataArrayChar> ret(buildEmptySpecializedDAChar());
+ MCAuto<DataArrayChar> ret(buildEmptySpecializedDAChar());
int newNbOfCompo=(int)compoIds.size();
int oldNbOfCompo=getNumberOfComponents();
for(std::vector<int>::const_iterator it=compoIds.begin();it!=compoIds.end();it++)
* 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<const DataArrayChar *>(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<nbOfTupleToWrite;i++,valsToSet+=nbOfComp,valsSrc+=step*nbOfComp)
{
int nbOfTuplesThis=getNumberOfTuples();
if(ranges.empty())
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayChar> ret=buildEmptySpecializedDAChar();
+ MCAuto<DataArrayChar> ret=buildEmptySpecializedDAChar();
ret->alloc(0,nbOfComp);
ret->copyStringInfoFrom(*this);
return ret.retn();
}
}
if(isIncreasing && nbOfTuplesThis==nbOfTuples)
- return deepCpy();
- MEDCouplingAutoRefCountObjectPtr<DataArrayChar> ret=buildEmptySpecializedDAChar();
+ return deepCopy();
+ MCAuto<DataArrayChar> ret=buildEmptySpecializedDAChar();
ret->alloc(nbOfTuples,nbOfComp);
ret->copyStringInfoFrom(*this);
const char *src=getConstPointer();
* \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<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
int nbOfTuples=getNumberOfTuples();
for(int i=0;i<nbOfTuples;i++,cptr++)
if(*cptr==val)
* \throw If \a this is not allocated.
* \throw If \a this->getNumberOfComponents() != 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<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
int nbOfTuples=getNumberOfTuples();
for(int i=0;i<nbOfTuples;i++,cptr++)
if(*cptr!=val)
/*!
* This method searches the sequence specified in input parameter \b vals in \b this.
* This works only for DataArrayChar having number of components equal to one (if not an INTERP_KERNEL::Exception will be thrown).
- * This method differs from DataArrayChar::locateTuple in that the position is internal raw data is not considered here contrary to DataArrayChar::locateTuple.
- * \sa DataArrayChar::locateTuple
+ * This method differs from DataArrayChar::findIdFirstEqualTuple in that the position is internal raw data is not considered here contrary to DataArrayChar::findIdFirstEqualTuple.
+ * \sa DataArrayChar::findIdFirstEqualTuple
*/
int DataArrayChar::search(const std::vector<char>& 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.
* \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<char>& tupl) const
+int DataArrayChar::findIdFirstEqualTuple(const std::vector<char>& 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();
* 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<char>& tupl) const
{
- return locateTuple(tupl)!=-1;
+ return findIdFirstEqualTuple(tupl)!=-1;
}
/*!
* \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<char>& vals) const
{
- return locateValue(vals)!=-1;
+ return findIdFirstEqual(vals)!=-1;
}
/*!
* 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)
* If not any tuple contains one of the values contained in 'vals' false is returned.
* \sa DataArrayChar::presenceOfValue
*/
-int DataArrayChar::locateValue(const std::vector<char>& vals) const
+int DataArrayChar::findIdFirstEqual(const std::vector<char>& vals) const
{
checkAllocated();
if(getNumberOfComponents()!=1)
* \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<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(0,1);
+ MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(0,1);
int nbOfTuples=getNumberOfTuples();
for(int i=0;i<nbOfTuples;i++,cptr++)
if(*cptr>=vmin && *cptr<vmax)
throw INTERP_KERNEL::Exception("DataArrayChar::Aggregate : Nb of components mismatch for array aggregation !");
nbt+=(*it)->getNumberOfTuples();
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayChar> ret=a[0]->buildEmptySpecializedDAChar();
+ MCAuto<DataArrayChar> ret=a[0]->buildEmptySpecializedDAChar();
ret->alloc(nbt,nbOfComp);
char *pt=ret->getPointer();
for(it=a.begin();it!=a.end();it++)
* \ref MEDCouplingArrayBasicsCopyDeep.
* \return DataArrayByte * - a new instance of DataArrayByte.
*/
-DataArrayByte *DataArrayByte::deepCpy() const
+DataArrayByte *DataArrayByte::deepCopy() const
{
return new DataArrayByte(*this);
}
* \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();
* \ref MEDCouplingArrayBasicsCopyDeep.
* \return DataArrayAsciiChar * - a new instance of DataArrayAsciiChar.
*/
-DataArrayAsciiChar *DataArrayAsciiChar::deepCpy() const
+DataArrayAsciiChar *DataArrayAsciiChar::deepCopy() const
{
return new DataArrayAsciiChar(*this);
}
* \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();
#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingFieldDiscretization.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include <set>
#include <cmath>
}
else
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellIds=DataArrayInt::Range(beginCellIds,endCellIds,stepCellIds);
+ MCAuto<DataArrayInt> cellIds=DataArrayInt::Range(beginCellIds,endCellIds,stepCellIds);
return buildPart(cellIds->begin(),cellIds->end());
}
}
*/
MEDCouplingMesh *MEDCouplingMesh::buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt*& arr) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellIds=DataArrayInt::Range(beginCellIds,endCellIds,stepCellIds);
+ MCAuto<DataArrayInt> cellIds=DataArrayInt::Range(beginCellIds,endCellIds,stepCellIds);
return buildPartAndReduceNodes(cellIds->begin(),cellIds->end(),arr);
}
*/
MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic(TypeOfField t, int nbOfComp, FunctionToEvaluate func) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(t,ONE_TIME);
+ MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(t,ONE_TIME);
ret->setMesh(this);
ret->fillFromAnalytic(nbOfComp,func);
ret->synchronizeTimeWithSupport();
*/
MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(t,ONE_TIME);
+ MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(t,ONE_TIME);
ret->setMesh(this);
ret->fillFromAnalytic(nbOfComp,func);
ret->synchronizeTimeWithSupport();
* \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<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(t,ONE_TIME);
+ MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(t,ONE_TIME);
ret->setMesh(this);
- ret->fillFromAnalytic2(nbOfComp,func);
+ ret->fillFromAnalyticCompo(nbOfComp,func);
ret->synchronizeTimeWithSupport();
return ret.retn();
}
* \ref py_mcmesh_fillFromAnalytic3 "Here is a Python example".
* \endif
*/
-MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const
+MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalyticNamedCompo(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(t,ONE_TIME);
+ MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(t,ONE_TIME);
ret->setMesh(this);
- ret->fillFromAnalytic3(nbOfComp,varsOrder,func);
+ ret->fillFromAnalyticNamedCompo(nbOfComp,varsOrder,func);
ret->synchronizeTimeWithSupport();
return ret.retn();
}
*/
MEDCouplingMesh *MEDCouplingMesh::MergeMeshes(std::vector<const MEDCouplingMesh *>& meshes)
{
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> > ms1(meshes.size());
+ std::vector< MCAuto<MEDCouplingUMesh> > ms1(meshes.size());
std::vector< const MEDCouplingUMesh * > ms2(meshes.size());
for(std::size_t i=0;i<meshes.size();i++)
{
* \ref py_mcumesh_getCellsContainingPoints "Here is a Python example".
* \endif
*/
-void MEDCouplingMesh::getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& elts, MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& eltsIndex) const
+void MEDCouplingMesh::getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, MCAuto<DataArrayInt>& elts, MCAuto<DataArrayInt>& 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());
std::string ret(getVTKFileNameOf(fileName));
//
std::string cda,pda;
- MEDCouplingAutoRefCountObjectPtr<DataArrayByte> byteArr;
+ MCAuto<DataArrayByte> byteArr;
if(isBinary)
{ byteArr=DataArrayByte::New(); byteArr->alloc(0,1); }
writeVTKAdvanced(ret,cda,pda,byteArr);
#include "MEDCouplingTimeLabel.hxx"
#include "MEDCouplingRefCountObject.hxx"
#include "NormalizedUnstructuredMesh.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "InterpKernelException.hxx"
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);
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;
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<int>& elts) const;
- MEDCOUPLING_EXPORT virtual void getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& elts, MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& eltsIndex) const;
+ MEDCOUPLING_EXPORT virtual void getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, MCAuto<DataArrayInt>& elts, MCAuto<DataArrayInt>& 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<std::string>& 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<std::string>& 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;
#include "MEDCouplingFieldTemplate.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMesh.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include <sstream>
#include <algorithm>
return new MEDCouplingMultiFields;
}
-MEDCouplingMultiFields *MEDCouplingMultiFields::deepCpy() const
+MEDCouplingMultiFields *MEDCouplingMultiFields::deepCopy() const
{
return new MEDCouplingMultiFields(*this);
}
std::string MEDCouplingMultiFields::getName() const
{
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
+ std::vector< MCAuto<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
for(;it!=_fs.end();it++)
if((const MEDCouplingFieldDouble *)(*it))
return (*it)->getName();
std::string MEDCouplingMultiFields::getDescription() const
{
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
+ std::vector< MCAuto<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
for(;it!=_fs.end();it++)
if((const MEDCouplingFieldDouble *)(*it))
return (*it)->getDescription();
std::string MEDCouplingMultiFields::getTimeUnit() const
{
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
+ std::vector< MCAuto<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
for(;it!=_fs.end();it++)
if((const MEDCouplingFieldDouble *)(*it))
return (*it)->getTimeUnit();
double MEDCouplingMultiFields::getTimeResolution() const
{
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
+ std::vector< MCAuto<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
for(;it!=_fs.end();it++)
if((const MEDCouplingFieldDouble *)(*it))
return (*it)->getTimeTolerance();
void MEDCouplingMultiFields::updateTime() const
{
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
+ std::vector< MCAuto<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
for(;it!=_fs.end();it++)
if((const MEDCouplingFieldDouble *)(*it))
(*it)->updateTime();
std::vector<const BigMemoryObject *> MEDCouplingMultiFields::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();it!=_fs.end();it++)
+ for(std::vector< MCAuto<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();it!=_fs.end();it++)
ret.push_back((const MEDCouplingFieldDouble *)*it);
return ret;
}
std::vector<MEDCouplingMesh *> MEDCouplingMultiFields::getMeshes() const
{
std::vector<MEDCouplingMesh *> ms;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();it!=_fs.end();it++)
+ for(std::vector< MCAuto<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();it!=_fs.end();it++)
{
const MEDCouplingMesh *m=0;
if((const MEDCouplingFieldDouble *)(*it))
refs.resize(_fs.size());
std::vector<MEDCouplingMesh *> ms;
int id=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();it!=_fs.end();it++,id++)
+ for(std::vector< MCAuto<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();it!=_fs.end();it++,id++)
{
const MEDCouplingMesh *m=0;
if((const MEDCouplingFieldDouble *)(*it))
std::vector<DataArrayDouble *> MEDCouplingMultiFields::getArrays() const
{
std::vector<DataArrayDouble *> tmp;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();it!=_fs.end();it++)
+ for(std::vector< MCAuto<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();it!=_fs.end();it++)
{
std::vector<DataArrayDouble *> tmp2=(*it)->getArrays();
tmp.insert(tmp.end(),tmp2.begin(),tmp2.end());
refs.resize(_fs.size());
int id=0;
std::vector<DataArrayDouble *> ret;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();it!=_fs.end();it++,id++)
+ for(std::vector< MCAuto<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();it!=_fs.end();it++,id++)
{
std::vector<DataArrayDouble *> tmp2;
if((const MEDCouplingFieldDouble *)(*it))
return ret;
}
-void MEDCouplingMultiFields::checkCoherency() const
+void MEDCouplingMultiFields::checkConsistencyLight() const
{
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
+ std::vector< MCAuto<MEDCouplingFieldDouble> >::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();
}
}
(*it)->incrRef();
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)
{
std::vector< std::vector<int> > refs2;
std::vector<MEDCouplingMesh *> ms=other.getDifferentMeshes(refs);
std::size_t msLgh=ms.size();
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> > ms2(msLgh);
+ std::vector< MCAuto<MEDCouplingMesh> > ms2(msLgh);
for(std::size_t i=0;i<msLgh;i++)
- ms2[i]=ms[i]->deepCpy();
+ ms2[i]=ms[i]->deepCopy();
std::vector<DataArrayDouble *> das=other.getDifferentArrays(refs2);
std::size_t dasLgth=das.size();
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > das2(dasLgth);
+ std::vector< MCAuto<DataArrayDouble> > das2(dasLgth);
for(std::size_t i=0;i<dasLgth;i++)
- das2[i]=das[i]->deepCpy();
+ das2[i]=das[i]->deepCopy();
for(std::size_t i=0;i<sz;i++)
{
if((const MEDCouplingFieldDouble *)other._fs[i])
#include "MEDCouplingRefCountObject.hxx"
#include "MEDCouplingTimeLabel.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "InterpKernelException.hxx"
public:
MEDCOUPLING_EXPORT static MEDCouplingMultiFields *New(const std::vector<MEDCouplingFieldDouble *>& 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;
MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD,
const std::vector<MEDCouplingFieldTemplate *>& ft, const std::vector<MEDCouplingMesh *>& ms,
const std::vector<DataArrayDouble *>& das);
- MEDCOUPLING_EXPORT virtual void checkCoherency() const;
+ MEDCOUPLING_EXPORT virtual void checkConsistencyLight() const;
protected:
MEDCOUPLING_EXPORT MEDCouplingMultiFields(const std::vector<MEDCouplingFieldDouble *>& fs);
MEDCOUPLING_EXPORT MEDCouplingMultiFields(const MEDCouplingMultiFields& other);
MEDCOUPLING_EXPORT MEDCouplingMultiFields();
protected:
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> > _fs;
+ std::vector< MCAuto<MEDCouplingFieldDouble> > _fs;
};
}
{
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};
typedef enum
{
NoNature = 17,
- ConservativeVolumic = 26,
- Integral = 32,
- IntegralGlobConstraint = 35,
- RevIntegral = 37
+ IntensiveMaximum = 26,
+ ExtensiveMaximum = 32,
+ ExtensiveConservation = 35,
+ IntensiveConservation = 37
} NatureOfField;
}
return DataArrayPartDefinition::New(listOfIds);
}
-PartDefinition *PartDefinition::Unserialize(std::vector<int>& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >& bigArraysI)
+PartDefinition *PartDefinition::Unserialize(std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI)
{
if(tinyInt.empty())
{
- MEDCouplingAutoRefCountObjectPtr<PartDefinition> ret(DataArrayPartDefinition::New(bigArraysI.back()));
+ MCAuto<PartDefinition> ret(DataArrayPartDefinition::New(bigArraysI.back()));
bigArraysI.pop_back();
return ret.retn();
}
else if(tinyInt.size()==3)
{
- MEDCouplingAutoRefCountObjectPtr<PartDefinition> ret(SlicePartDefinition::New(tinyInt[0],tinyInt[1],tinyInt[2]));
+ MCAuto<PartDefinition> ret(SlicePartDefinition::New(tinyInt[0],tinyInt[1],tinyInt[2]));
tinyInt.erase(tinyInt.begin(),tinyInt.begin()+3);
return ret.retn();
}
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<DataArrayInt *>(arr));
}
{
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<const SlicePartDefinition *>(other));
if(spd)
{//special case for optim
spd->getSlice(a,b,c);
if(c==1)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr(DataArrayInt::New());
+ MCAuto<DataArrayInt> arr(DataArrayInt::New());
arr->alloc(_arr->getNumberOfTuples(),1);
std::transform(_arr->begin(),_arr->end(),arr->getPointer(),std::bind2nd(std::plus<int>(),a));
return DataArrayPartDefinition::New(arr);
}
}
//
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr1(other->toDAI());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr2(arr1->selectByTupleIdSafe(_arr->begin(),_arr->end()));
+ MCAuto<DataArrayInt> arr1(other->toDAI());
+ MCAuto<DataArrayInt> arr2(arr1->selectByTupleIdSafe(_arr->begin(),_arr->end()));
return DataArrayPartDefinition::New(arr2);
}
-void DataArrayPartDefinition::checkCoherency() const
+void DataArrayPartDefinition::checkConsistencyLight() const
{
CheckInternalArrayOK(_arr);
}
*/
PartDefinition *DataArrayPartDefinition::tryToSimplify() const
{
- checkCoherency();
+ checkConsistencyLight();
int a(0),b(0),c(0);
if(_arr->isRange(a,b,c))
{
}
}
-void DataArrayPartDefinition::serialize(std::vector<int>& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >& bigArraysI) const
+void DataArrayPartDefinition::serialize(std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI) const
{
bigArraysI.push_back(_arr);
}
DataArrayPartDefinition *DataArrayPartDefinition::add1(const DataArrayPartDefinition *other) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> a1(toDAI()),a2(other->toDAI());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> a3(DataArrayInt::Aggregate(a1,a2,0));
+ MCAuto<DataArrayInt> a1(toDAI()),a2(other->toDAI());
+ MCAuto<DataArrayInt> a3(DataArrayInt::Aggregate(a1,a2,0));
a3->sort();
return DataArrayPartDefinition::New(a3);
}
DataArrayPartDefinition *DataArrayPartDefinition::add2(const SlicePartDefinition *other) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> a1(toDAI()),a2(other->toDAI());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> a3(DataArrayInt::Aggregate(a1,a2,0));
+ MCAuto<DataArrayInt> a1(toDAI()),a2(other->toDAI());
+ MCAuto<DataArrayInt> a3(DataArrayInt::Aggregate(a1,a2,0));
a3->sort();
return DataArrayPartDefinition::New(a3);
}
return true;
}
-SlicePartDefinition *SlicePartDefinition::deepCpy() const
+SlicePartDefinition *SlicePartDefinition::deepCopy() const
{
return SlicePartDefinition::New(_start,_stop,_step);
}
{
if(!other)
throw INTERP_KERNEL::Exception("SlicePartDefinition::composeWith : input PartDef must be not NULL !");
- checkCoherency();
- other->checkCoherency();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr(other->toDAI());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr1(arr->selectByTupleId2(_start,_stop,_step));
+ checkConsistencyLight();
+ other->checkConsistencyLight();
+ MCAuto<DataArrayInt> arr(other->toDAI());
+ MCAuto<DataArrayInt> 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
{
}
return ret;
}
-void SlicePartDefinition::serialize(std::vector<int>& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >& bigArraysI) const
+void SlicePartDefinition::serialize(std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI) const
{
tinyInt.push_back(_start);
tinyInt.push_back(_stop);
DataArrayPartDefinition *SlicePartDefinition::add1(const DataArrayPartDefinition *other) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> a1(toDAI()),a2(other->toDAI());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> a3(DataArrayInt::Aggregate(a1,a2,0));
+ MCAuto<DataArrayInt> a1(toDAI()),a2(other->toDAI());
+ MCAuto<DataArrayInt> a3(DataArrayInt::Aggregate(a1,a2,0));
a3->sort();
return DataArrayPartDefinition::New(a3);
}
}
else
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> a1(toDAI()),a2(other->toDAI());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> a3(DataArrayInt::Aggregate(a1,a2,0));
+ MCAuto<DataArrayInt> a1(toDAI()),a2(other->toDAI());
+ MCAuto<DataArrayInt> a3(DataArrayInt::Aggregate(a1,a2,0));
a3->sort();
return DataArrayPartDefinition::New(a3);
}
#include "MEDCoupling.hxx"
#include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
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<int>& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >& bigArraysI);
+ MEDCOUPLING_EXPORT static PartDefinition *Unserialize(std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& 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<int>& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >& bigArraysI) const = 0;
+ MEDCOUPLING_EXPORT virtual void serialize(std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI) const = 0;
protected:
virtual ~PartDefinition();
};
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<int>& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >& bigArraysI) const;
+ MEDCOUPLING_EXPORT void serialize(std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI) const;
private:
DataArrayPartDefinition(DataArrayInt *listOfIds);
void checkInternalArrayOK() const;
DataArrayPartDefinition *add2(const SlicePartDefinition *other) const;
virtual ~DataArrayPartDefinition();
private:
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _arr;
+ MCAuto<DataArrayInt> _arr;
};
class SlicePartDefinition : public PartDefinition
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<int>& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >& bigArraysI) const;
+ MEDCOUPLING_EXPORT void serialize(std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI) const;
//specific method
MEDCOUPLING_EXPORT int getEffectiveStop() const;
MEDCOUPLING_EXPORT void getSlice(int& start, int& stop, int& step) const;
// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingPointSet.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "MEDCoupling1GTUMesh.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingMemArray.hxx"
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()
DataArrayInt *comm,*commI;
findCommonNodes(precision,limitNodeId,comm,commI);
int oldNbOfNodes=getNumberOfNodes();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=buildNewNumberingFromCommonNodesFormat(comm,commI,newNbOfNodes);
+ MCAuto<DataArrayInt> ret=buildNewNumberingFromCommonNodesFormat(comm,commI,newNbOfNodes);
areNodesMerged=(oldNbOfNodes!=newNbOfNodes);
comm->decrRef();
commI->decrRef();
{
DataArrayInt *c=0,*cI=0;
getNodeIdsNearPoints(pos,1,eps,c,cI);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cITmp(cI);
+ MCAuto<DataArrayInt> cITmp(cI);
return c;
}
if(!_coords)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getNodeIdsNearPoint : no coordiantes set !");
int spaceDim=getSpaceDimension();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> points=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> points=DataArrayDouble::New();
points->useArray(pos,false,CPP_DEALLOC,nbOfPoints,spaceDim);
_coords->computeTupleIdsNearTuples(points,eps,c,cI);
}
{
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);
}
/*!
{
if(!_coords)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::renumberNodes : no coords specified !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> newCoords=_coords->renumberAndReduce(newNodeNumbers,newNbOfNodes);
+ MCAuto<DataArrayDouble> newCoords=_coords->renumberAndReduce(newNodeNumbers,newNbOfNodes);
renumberNodesInConn(newNodeNumbers);
setCoords(newCoords);//let it here not before renumberNodesInConn because old number of nodes is sometimes used...
}
* \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<int> div(newNbOfNodes);
{
if(!_coords)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : no coords set !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> newCoords=_coords->selectByTupleIdSafe(nodeIdsToDuplicateBg,nodeIdsToDuplicateEnd);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> newCoords2=DataArrayDouble::Aggregate(_coords,newCoords);
+ MCAuto<DataArrayDouble> newCoords=_coords->selectByTupleIdSafe(nodeIdsToDuplicateBg,nodeIdsToDuplicateEnd);
+ MCAuto<DataArrayDouble> newCoords2=DataArrayDouble::Aggregate(_coords,newCoords);
setCoords(newCoords2);
}
}
}
-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 !");
}
/*!
{
if(!srcMesh || !trgMesh)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells : the input meshes must be not NULL !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> sbbox(srcMesh->getBoundingBoxForBBTree()),tbbox(trgMesh->getBoundingBoxForBBTree());
+ MCAuto<DataArrayDouble> sbbox(srcMesh->getBoundingBoxForBBTree()),tbbox(trgMesh->getBoundingBoxForBBTree());
return tbbox->computeNbOfInteractionsWith(sbbox,eps);
}
*/
MEDCouplingMesh *MEDCouplingPointSet::buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingPointSet> ret=buildPartOfMySelf(start,end,true);
+ MCAuto<MEDCouplingPointSet> ret=buildPartOfMySelf(start,end,true);
arr=ret->zipCoordsTraducer();
return ret.retn();
}
*
* \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
{
}
else
{
- return buildPartOfMySelf2(beginCellIds,endCellIds,stepCellIds,true);
+ return buildPartOfMySelfSlice(beginCellIds,endCellIds,stepCellIds,true);
}
}
* \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<MEDCouplingPointSet> ret=buildPartOfMySelf2(beginCellIds,endCellIds,stepCellIds,true);
+ MCAuto<MEDCouplingPointSet> ret=buildPartOfMySelfSlice(beginCellIds,endCellIds,stepCellIds,true);
arr=ret->zipCoordsTraducer();
return ret.retn();
}
if(!_coords)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::tryToShareSameCoordsPermute : No coords specified in this whereas there is any in other !");
int otherNbOfNodes=other.getNumberOfNodes();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> newCoords=MergeNodesArray(&other,this);
+ MCAuto<DataArrayDouble> newCoords=MergeNodesArray(&other,this);
_coords->incrRef();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> oldCoords=_coords;
+ MCAuto<DataArrayDouble> oldCoords=_coords;
setCoords(newCoords);
bool areNodesMerged;
int newNbOfNodes;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=buildPermArrayForMergeNode(epsilon,otherNbOfNodes,areNodesMerged,newNbOfNodes);
+ MCAuto<DataArrayInt> da=buildPermArrayForMergeNode(epsilon,otherNbOfNodes,areNodesMerged,newNbOfNodes);
if(!areNodesMerged)
{
setCoords(oldCoords);
MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelf(const int *begin, const int *end, bool keepCoords) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingPointSet> ret=buildPartOfMySelfKeepCoords(begin,end);
+ MCAuto<MEDCouplingPointSet> 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<MEDCouplingPointSet> ret=buildPartOfMySelfKeepCoords2(start,end,step);
+ MCAuto<MEDCouplingPointSet> ret=buildPartOfMySelfKeepCoordsSlice(start,end,step);
if(!keepCoords)
ret->zipCoords();
return ret.retn();
{
DataArrayInt *cellIdsKept=0;
fillCellIdsToKeepFromNodeIds(begin,end,fullyIn,cellIdsKept);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellIdsKept2(cellIdsKept);
+ MCAuto<DataArrayInt> cellIdsKept2(cellIdsKept);
return buildPartOfMySelf(cellIdsKept->begin(),cellIdsKept->end(),true);
}
{
DataArrayInt *commonCells=0,*commonCellsI=0;
findCommonCells(compType,startCellId,commonCells,commonCellsI);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> commonCellsTmp(commonCells),commonCellsITmp(commonCellsI);
+ MCAuto<DataArrayInt> commonCellsTmp(commonCells),commonCellsITmp(commonCellsI);
int newNbOfCells=-1;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(getNumberOfCells(),commonCells->begin(),commonCellsI->begin(),
+ MCAuto<DataArrayInt> ret=DataArrayInt::ConvertIndexArrayToO2N(getNumberOfCells(),commonCells->begin(),commonCellsI->begin(),
commonCellsI->end(),newNbOfCells);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret2=ret->invertArrayO2N2N2O(newNbOfCells);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingPointSet> self=buildPartOfMySelf(ret2->begin(),ret2->end(),true);
+ MCAuto<DataArrayInt> ret2=ret->invertArrayO2N2N2O(newNbOfCells);
+ MCAuto<MEDCouplingPointSet> self=buildPartOfMySelf(ret2->begin(),ret2->end(),true);
shallowCopyConnectivityFrom(self);
return ret.retn();
}
const MEDCouplingPointSet *otherC=dynamic_cast<const MEDCouplingPointSet *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkDeepEquivalWith : other is not a PointSet mesh !");
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingPointSet> m=dynamic_cast<MEDCouplingPointSet *>(mergeMyselfWith(otherC));
+ MCAuto<MEDCouplingPointSet> m=dynamic_cast<MEDCouplingPointSet *>(mergeMyselfWith(otherC));
bool areNodesMerged;
int newNbOfNodes;
int oldNbOfNodes=getNumberOfNodes();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=m->buildPermArrayForMergeNode(prec,oldNbOfNodes,areNodesMerged,newNbOfNodes);
+ MCAuto<DataArrayInt> da=m->buildPermArrayForMergeNode(prec,oldNbOfNodes,areNodesMerged,newNbOfNodes);
//mergeNodes
if(!areNodesMerged && oldNbOfNodes != 0)
throw INTERP_KERNEL::Exception("checkDeepEquivalWith : Nodes are incompatible ! ");
throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some nodes in other are not in this !");
m->renumberNodes(da->getConstPointer(),newNbOfNodes);
//
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nodeCor2=da->substr(oldNbOfNodes);
+ MCAuto<DataArrayInt> nodeCor2=da->substr(oldNbOfNodes);
da=m->mergeNodes(prec,areNodesMerged,newNbOfNodes);
//
da=m->zipConnectivityTraducer(cellCompPol);
int dan(da->getNumberOfTuples());
if (dan)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da1(DataArrayInt::New()),da2(DataArrayInt::New());
+ MCAuto<DataArrayInt> 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());
if (!da1->isEqualWithoutConsideringStr(*da2))
throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some cells in other are not in this !");
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellCor2=da->selectByTupleId2(nbCells,da->getNbOfElems(),1);
- nodeCor=nodeCor2->isIdentity2(nodeCor2->getNumberOfTuples())?0:nodeCor2.retn();
- cellCor=cellCor2->isIdentity2(cellCor2->getNumberOfTuples())?0:cellCor2.retn();
+ MCAuto<DataArrayInt> cellCor2=da->selectByTupleIdSafeSlice(nbCells,da->getNbOfElems(),1);
+ nodeCor=nodeCor2->isIota(nodeCor2->getNumberOfTuples())?0:nodeCor2.retn();
+ cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?0:cellCor2.retn();
}
/*!
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<MEDCouplingPointSet> m=mergeMyselfWithOnSameCoords(otherC);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=m->zipConnectivityTraducer(cellCompPol);
+ MCAuto<MEDCouplingPointSet> m=mergeMyselfWithOnSameCoords(otherC);
+ MCAuto<DataArrayInt> da=m->zipConnectivityTraducer(cellCompPol);
int maxId=*std::max_element(da->getConstPointer(),da->getConstPointer()+getNumberOfCells());
const int *pt=std::find_if(da->getConstPointer()+getNumberOfCells(),da->getConstPointer()+da->getNbOfElems(),std::bind2nd(std::greater<int>(),maxId));
if(pt!=da->getConstPointer()+da->getNbOfElems())
{
throw INTERP_KERNEL::Exception("checkDeepEquivalOnSameNodesWith : some cells in other are not in this !");
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellCor2=da->selectByTupleId2(getNumberOfCells(),da->getNbOfElems(),1);
- cellCor=cellCor2->isIdentity2(cellCor2->getNumberOfTuples())?0:cellCor2.retn();
+ MCAuto<DataArrayInt> cellCor2=da->selectByTupleIdSafeSlice(getNumberOfCells(),da->getNbOfElems(),1);
+ cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?0:cellCor2.retn();
}
void MEDCouplingPointSet::checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const
DataArrayInt *MEDCouplingPointSet::zipCoordsTraducer()
{
int newNbOfNodes=-1;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> traducer=getNodeIdsInUse(newNbOfNodes);
+ MCAuto<DataArrayInt> traducer=getNodeIdsInUse(newNbOfNodes);
renumberNodes(traducer->getConstPointer(),newNbOfNodes);
return traducer.retn();
}
*/
DataArrayInt *MEDCouplingPointSet::mergeNodes(double precision, bool& areNodesMerged, int& newNbOfNodes)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=buildPermArrayForMergeNode(precision,-1,areNodesMerged,newNbOfNodes);
+ MCAuto<DataArrayInt> ret=buildPermArrayForMergeNode(precision,-1,areNodesMerged,newNbOfNodes);
if(areNodesMerged)
renumberNodes(ret->begin(),newNbOfNodes);
return ret.retn();
* \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;
}
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<bool>& nodeIdsInUse) const = 0;
MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const;
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;
MEDCOUPLING_EXPORT virtual void renumberNodesInConn(const INTERP_KERNEL::HashMap<int,int>& 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<int>& tinyInfo) const = 0;
MEDCOUPLING_EXPORT virtual void checkFullyDefined() const = 0;
MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
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);
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingFieldTemplate.hxx"
#include "MEDCouplingFieldDiscretization.hxx"
-#include "MEDCouplingExtrudedMesh.hxx"
+#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingCMesh.hxx"
#include "MEDCouplingNormalizedUnstructuredMesh.txx"
#include "MEDCouplingNormalizedCartesianMesh.txx"
throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepare : presence of NULL input pointer !");
std::string srcMethod,targetMethod;
INTERP_KERNEL::Interpolation<INTERP_KERNEL::Interpolation3D>::CheckAndSplitInterpolationMethod(method,srcMethod,targetMethod);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldTemplate> src=MEDCouplingFieldTemplate::New(MEDCouplingFieldDiscretization::GetTypeOfFieldFromStringRepr(srcMethod));
+ MCAuto<MEDCouplingFieldTemplate> src=MEDCouplingFieldTemplate::New(MEDCouplingFieldDiscretization::GetTypeOfFieldFromStringRepr(srcMethod));
src->setMesh(srcMesh);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldTemplate> target=MEDCouplingFieldTemplate::New(MEDCouplingFieldDiscretization::GetTypeOfFieldFromStringRepr(targetMethod));
+ MCAuto<MEDCouplingFieldTemplate> target=MEDCouplingFieldTemplate::New(MEDCouplingFieldDiscretization::GetTypeOfFieldFromStringRepr(targetMethod));
target->setMesh(targetMesh);
return prepareEx(src,target);
}
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())
int trgNbOfCompo=targetField->getNumberOfComponents();
if(array)
{
- srcField->checkCoherency();
+ srcField->checkConsistencyLight();
if(trgNbOfCompo!=srcField->getNumberOfTuplesExpected())
throw INTERP_KERNEL::Exception("Number of components mismatch !");
}
else
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble > tmp(DataArrayDouble::New());
+ MCAuto<DataArrayDouble > tmp(DataArrayDouble::New());
tmp->alloc(srcField->getNumberOfTuplesExpected(),trgNbOfCompo);
srcField->setArray(tmp);
}
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());
{
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");
{
std::string srcMeth,trgMeth;
std::string methC=checkAndGiveInterpolationMethodStr(srcMeth,trgMeth);
- const MEDCouplingExtrudedMesh *src_mesh=static_cast<const MEDCouplingExtrudedMesh *>(_src_ft->getMesh());
- const MEDCouplingExtrudedMesh *target_mesh=static_cast<const MEDCouplingExtrudedMesh *>(_target_ft->getMesh());
+ const MEDCouplingMappedExtrudedMesh *src_mesh=static_cast<const MEDCouplingMappedExtrudedMesh *>(_src_ft->getMesh());
+ const MEDCouplingMappedExtrudedMesh *target_mesh=static_cast<const MEDCouplingMappedExtrudedMesh *>(_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());
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<std::map<int,double> > matrix1D;
{
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<DataArrayDouble> trgLoc=_target_ft->getLocalizationOfDiscr();
+ MCAuto<DataArrayDouble> trgLoc=_target_ft->getLocalizationOfDiscr();
const double *trgLocPtr=trgLoc->begin();
int trgSpaceDim=trgLoc->getNumberOfComponents();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> srcOffsetArr=_src_ft->getDiscretization()->getOffsetArr(_src_ft->getMesh());
+ MCAuto<DataArrayInt> 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 !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
const int *srcOffsetArrPtr=srcOffsetArr->begin();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> srcLoc=_src_ft->getLocalizationOfDiscr();
+ MCAuto<DataArrayDouble> srcLoc=_src_ft->getLocalizationOfDiscr();
const double *srcLocPtr=srcLoc->begin();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> eltsArr,eltsIndexArr;
+ MCAuto<DataArrayInt> 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<DataArrayInt> nbOfSrcCellsShTrgPts(eltsIndexArr->deltaShiftIndex());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids0=nbOfSrcCellsShTrgPts->getIdsNotEqual(0);
+ MCAuto<DataArrayInt> nbOfSrcCellsShTrgPts(eltsIndexArr->deltaShiftIndex());
+ MCAuto<DataArrayInt> ids0=nbOfSrcCellsShTrgPts->findIdsNotEqual(0);
for(const int *trgId=ids0->begin();trgId!=ids0->end();trgId++)
{
const double *ptTrg=trgLocPtr+trgSpaceDim*(*trgId);
}
if(ids0->getNumberOfTuples()!=trgNbOfGaussPts)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> orphanTrgIds=nbOfSrcCellsShTrgPts->getIdsEqual(0);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> orphanTrg=trgLoc->selectByTupleId(orphanTrgIds->begin(),orphanTrgIds->end());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> srcIdPerTrg=srcLoc->findClosestTupleId(orphanTrg);
+ MCAuto<DataArrayInt> orphanTrgIds=nbOfSrcCellsShTrgPts->findIdsEqual(0);
+ MCAuto<DataArrayDouble> orphanTrg=trgLoc->selectByTupleId(orphanTrgIds->begin(),orphanTrgIds->end());
+ MCAuto<DataArrayInt> srcIdPerTrg=srcLoc->findClosestTupleId(orphanTrg);
const int *srcIdPerTrgPtr=srcIdPerTrg->begin();
for(const int *orphanTrgId=orphanTrgIds->begin();orphanTrgId!=orphanTrgIds->end();orphanTrgId++,srcIdPerTrgPtr++)
_matrix[*orphanTrgId][*srcIdPerTrgPtr]=2.;
{
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");
int srcNbOfCompo(srcField->getNumberOfComponents());
if(array)
{
- targetField->checkCoherency();
+ targetField->checkConsistencyLight();
if(srcNbOfCompo!=targetField->getNumberOfComponents())
throw INTERP_KERNEL::Exception("Number of components mismatch !");
}
{
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<DataArrayDouble> tmp(DataArrayDouble::New());
+ MCAuto<DataArrayDouble> tmp(DataArrayDouble::New());
tmp->alloc(targetField->getNumberOfTuples(),srcNbOfCompo);
targetField->setArray(tmp);
}
_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());
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());
#include "MEDCouplingTimeLabel.hxx"
#include "InterpolationOptions.hxx"
#include "MEDCouplingNatureOfField.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "InterpKernelException.hxx"
static void ComputeColSumAndRowSum(const std::vector<std::map<int,double> >& matrixDeno,
std::vector<std::map<int,double> >& deno, std::vector<std::map<int,double> >& denoReverse);
private:
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldTemplate> _src_ft;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldTemplate> _target_ft;
+ MCAuto<MEDCouplingFieldTemplate> _src_ft;
+ MCAuto<MEDCouplingFieldTemplate> _target_ft;
InterpolationMatrixPolicy _interp_matrix_pol;
NatureOfField _nature_of_deno;
unsigned int _time_deno_update;
#include "MEDCoupling.hxx"
#include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include <vector>
class MEDCOUPLING_EXPORT MEDCouplingSkyLineArray
{
private:
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _index;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _value;
+ MCAuto<DataArrayInt> _index;
+ MCAuto<DataArrayInt> _value;
public:
MEDCouplingSkyLineArray();
MEDCouplingSkyLineArray( const MEDCouplingSkyLineArray &myArray );
DataArrayInt *MEDCouplingStructuredMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
if(getTypeOfCell(0)==type)
{
ret->alloc(getNumberOfCells(),1);
DataArrayInt *MEDCouplingStructuredMesh::computeNbOfNodesPerCell() const
{
int nbCells=getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbCells,1);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(getTypeOfCell(0));
ret->fillWithValue((int)cm.getNumberOfNodes());
DataArrayInt *MEDCouplingStructuredMesh::computeNbOfFacesPerCell() const
{
int nbCells=getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbCells,1);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(getTypeOfCell(0));
ret->fillWithValue((int)cm.getNumberOfSons());
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 ;
}
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);
}
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<DataArrayDouble> coords(getCoordinatesAndOwner());
+ MCAuto<DataArrayDouble> coords(getCoordinatesAndOwner());
int ns[3];
getNodeGridStructure(ns);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(Build1GTNodalConnectivity(ns,ns+spaceDim));
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New(getName(),GetGeoTypeGivenMeshDimension(meshDim)));
+ MCAuto<DataArrayInt> conn(Build1GTNodalConnectivity(ns,ns+spaceDim));
+ MCAuto<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New(getName(),GetGeoTypeGivenMeshDimension(meshDim)));
ret->setNodalConnectivity(conn); ret->setCoords(coords);
try
{ ret->copyTinyInfoFrom(this); }
int meshDim(getMeshDimension());
if(meshDim<1 || meshDim>3)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::build1SGTSubLevelMesh : meshdim must be in [2,3] !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coords(getCoordinatesAndOwner());
+ MCAuto<DataArrayDouble> coords(getCoordinatesAndOwner());
int ns[3];
getNodeGridStructure(ns);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(Build1GTNodalConnectivityOfSubLevelMesh(ns,ns+meshDim));
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New(getName(),GetGeoTypeGivenMeshDimension(meshDim-1)));
+ MCAuto<DataArrayInt> conn(Build1GTNodalConnectivityOfSubLevelMesh(ns,ns+meshDim));
+ MCAuto<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New(getName(),GetGeoTypeGivenMeshDimension(meshDim-1)));
ret->setNodalConnectivity(conn); ret->setCoords(coords);
return ret.retn();
}
*/
MEDCouplingUMesh *MEDCouplingStructuredMesh::buildUnstructured() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret0(build1SGTUnstructured());
+ MCAuto<MEDCoupling1SGTUMesh> ret0(build1SGTUnstructured());
return ret0->buildUnstructured();
}
std::vector< std::pair<int,int> > cellPartFormat,nodePartFormat;
if(IsPartStructured(start,end,cgs,cellPartFormat))
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingStructuredMesh> ret(buildStructuredSubPart(cellPartFormat));
+ MCAuto<MEDCouplingStructuredMesh> ret(buildStructuredSubPart(cellPartFormat));
nodePartFormat=cellPartFormat;
for(std::vector< std::pair<int,int> >::iterator it=nodePartFormat.begin();it!=nodePartFormat.end();it++)
(*it).second++;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp2(DataArrayInt::New()); tmp2->alloc(getNumberOfNodes(),1);
+ MCAuto<DataArrayInt> tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat));
+ MCAuto<DataArrayInt> tmp2(DataArrayInt::New()); tmp2->alloc(getNumberOfNodes(),1);
tmp2->fillWithValue(-1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp3(DataArrayInt::New()); tmp3->alloc(tmp1->getNumberOfTuples(),1); tmp3->iota(0);
+ MCAuto<DataArrayInt> 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();
{
case 0:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(DataArrayInt::New());
+ MCAuto<DataArrayInt> conn(DataArrayInt::New());
conn->alloc(1,1); conn->setIJ(0,0,0);
return conn.retn();
}
if(ghostLev<0)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ComputeCornersGhost : ghost lev must be >= 0 !");
std::size_t dim(st.size());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New());
+ MCAuto<DataArrayInt> ret(DataArrayInt::New());
switch(dim)
{
case 1:
DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity1D(const int *nodeStBg)
{
int nbOfCells(*nodeStBg-1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(DataArrayInt::New());
+ MCAuto<DataArrayInt> conn(DataArrayInt::New());
conn->alloc(2*nbOfCells,1);
int *cp=conn->getPointer();
for(int i=0;i<nbOfCells;i++)
{
int n1=nodeStBg[0]-1;
int n2=nodeStBg[1]-1;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(DataArrayInt::New());
+ MCAuto<DataArrayInt> conn(DataArrayInt::New());
conn->alloc(4*n1*n2,1);
int *cp=conn->getPointer();
int pos=0;
int n1=nodeStBg[0]-1;
int n2=nodeStBg[1]-1;
int n3=nodeStBg[2]-1;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(DataArrayInt::New());
+ MCAuto<DataArrayInt> conn(DataArrayInt::New());
conn->alloc(8*n1*n2*n3,1);
int *cp=conn->getPointer();
int pos=0;
std::vector<int> 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<DataArrayInt> conn(DataArrayInt::New());
+ MCAuto<DataArrayInt> conn(DataArrayInt::New());
conn->alloc(4*GetNumberOfCellsOfSubLevelMesh(ngs,3));
int *cp(conn->getPointer());
//X
std::vector<int> ngs(2);
int n0(nodeStBg[0]-1),n1(nodeStBg[1]-1); ngs[0]=n0; ngs[1]=n1;
int off0(nodeStBg[0]);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(DataArrayInt::New());
+ MCAuto<DataArrayInt> conn(DataArrayInt::New());
conn->alloc(2*GetNumberOfCellsOfSubLevelMesh(ngs,2));
int *cp(conn->getPointer());
//X
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom : invalid size of input array of double regarding the structure !");
std::vector<int> dims(GetDimensionsFromCompactFrmt(partCompactFormat));
int nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims)),nbComp(fieldOfDbl->getNumberOfComponents());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfTuplesOfOutField,nbComp);
+ MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfTuplesOfOutField,nbComp);
ret->copyStringInfoFrom(*fieldOfDbl);
double *ptRet(ret->getPointer());
const double *fieldOfDblPtr(fieldOfDbl->begin());
dims[i]=partCompactFormat[i].second-partCompactFormat[i].first;
nbOfItems*=dims[i];
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New());
+ MCAuto<DataArrayInt> ret(DataArrayInt::New());
ret->alloc(nbOfItems,1);
int *pt(ret->getPointer());
switch(st.size())
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();
};
}
// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingTimeDiscretization.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingMesh.hxx"
_array->copyStringInfoFrom(*other._array);
}
-void MEDCouplingTimeDiscretization::checkCoherency() const
+void MEDCouplingTimeDiscretization::checkConsistencyLight() const
{
if(!_array)
throw INTERP_KERNEL::Exception("Field invalid because no values set !");
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<DataArrayDouble> arr;
+ MCAuto<DataArrayDouble> arr;
if(arrSrc)
- arr=arrSrc->performCpy(deepCpy);
+ arr=arrSrc->performCopyOrIncrRef(deepCopy);
ret->setArray(arr,0);
return ret;
}
{
}
-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;
}
ret->setTimeUnit(getTimeUnit());
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
{
if(arrays[j])
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
{
if(arrays[j])
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
{
if(arrays[j])
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
{
if(arrays[j])
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
{
if(arrays[j])
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
{
if(arrays[j])
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
{
if(arrays[j])
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
{
if(arrays[j])
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
{
if(arrays[j])
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
{
if(arrays[j])
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
{
if(arrays[j])
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
{
if(arrays[j])
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
{
if(arrays[j])
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
bool newArr=false;
for(std::size_t j=0;j<arrays.size();j++)
{
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
{
if(arrays[j])
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
{
if(arrays[j])
setArrays(arrays3,0);
}
-void MEDCouplingTimeDiscretization::applyFunc2(int nbOfComp, const std::string& func)
+void MEDCouplingTimeDiscretization::applyFuncCompo(int nbOfComp, const std::string& func)
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
{
if(arrays[j])
- arrays2[j]=arrays[j]->applyFunc2(nbOfComp,func);
+ arrays2[j]=arrays[j]->applyFuncCompo(nbOfComp,func);
else
arrays2[j]=0;
}
setArrays(arrays3,0);
}
-void MEDCouplingTimeDiscretization::applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func)
+void MEDCouplingTimeDiscretization::applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func)
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
{
if(arrays[j])
- arrays2[j]=arrays[j]->applyFunc3(nbOfComp,varsOrder,func);
+ arrays2[j]=arrays[j]->applyFuncNamedCompo(nbOfComp,varsOrder,func);
else
arrays2[j]=0;
}
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
{
if(arrays[j])
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
arrays2[j]=loc->applyFunc(nbOfComp,func);
std::vector<DataArrayDouble *> arrays3(arrays.size());
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
arrays2[j]=loc->applyFunc(nbOfComp,func);
std::vector<DataArrayDouble *> arrays3(arrays.size());
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<DataArrayDouble *> arrays;
getArrays(arrays);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
- arrays2[j]=loc->applyFunc2(nbOfComp,func);
+ arrays2[j]=loc->applyFuncCompo(nbOfComp,func);
std::vector<DataArrayDouble *> arrays3(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
arrays3[j]=arrays2[j];
setArrays(arrays3,0);
}
-void MEDCouplingTimeDiscretization::fillFromAnalytic3(const DataArrayDouble *loc, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func)
+void MEDCouplingTimeDiscretization::fillFromAnalyticNamedCompo(const DataArrayDouble *loc, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func)
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ std::vector< MCAuto<DataArrayDouble> > arrays2(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
- arrays2[j]=loc->applyFunc3(nbOfComp,varsOrder,func);
+ arrays2[j]=loc->applyFuncNamedCompo(nbOfComp,varsOrder,func);
std::vector<DataArrayDouble *> arrays3(arrays.size());
for(std::size_t j=0;j<arrays.size();j++)
arrays3[j]=arrays2[j];
{
}
-MEDCouplingNoTimeLabel::MEDCouplingNoTimeLabel(const MEDCouplingTimeDiscretization& other, bool deepCpy):MEDCouplingTimeDiscretization(other,deepCpy)
+MEDCouplingNoTimeLabel::MEDCouplingNoTimeLabel(const MEDCouplingTimeDiscretization& other, bool deepCopy):MEDCouplingTimeDiscretization(other,deepCopy)
{
}
const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("NoTimeLabel::aggregation on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Aggregate(getArray(),other->getArray());
MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
ret->setArray(arr,0);
return ret;
throw INTERP_KERNEL::Exception("NoTimeLabel::aggregate on mismatched time discretization !");
a[i]=itC->getArray();
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(a);
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Aggregate(a);
MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
ret->setArray(arr,0);
return ret;
const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("NoTimeLabel::meld on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Meld(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Meld(getArray(),other->getArray());
MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
ret->setTimeTolerance(getTimeTolerance());
ret->setArray(arr,0);
const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("NoTimeLabel::dot on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Dot(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Dot(getArray(),other->getArray());
MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
ret->setArray(arr,0);
return ret;
const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("NoTimeLabel::crossProduct on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::CrossProduct(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::CrossProduct(getArray(),other->getArray());
MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
ret->setArray(arr,0);
return ret;
const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("NoTimeLabel::max on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Max(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Max(getArray(),other->getArray());
MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
ret->setArray(arr,0);
return ret;
const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("NoTimeLabel::max on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Min(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Min(getArray(),other->getArray());
MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
ret->setArray(arr,0);
return ret;
const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("NoTimeLabel::add on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Add(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Add(getArray(),other->getArray());
MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
ret->setArray(arr,0);
return ret;
throw INTERP_KERNEL::Exception("NoTimeLabel::substract on mismatched time discretization !");
if(!getArray())
throw INTERP_KERNEL::Exception("MEDCouplingNoTimeLabel::substract : Data Array is NULL !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Substract(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Substract(getArray(),other->getArray());
MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
ret->setArray(arr,0);
return ret;
const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("NoTimeLabel::multiply on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Multiply(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Multiply(getArray(),other->getArray());
MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
ret->setArray(arr,0);
return ret;
const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("divide on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Divide(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Divide(getArray(),other->getArray());
MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
ret->setArray(arr,0);
return ret;
const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("pow on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Pow(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Pow(getArray(),other->getArray());
MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
ret->setArray(arr,0);
return ret;
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
_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)
{
}
const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::aggregation on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Aggregate(getArray(),other->getArray());
MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
ret->setArray(arr,0);
return ret;
throw INTERP_KERNEL::Exception("WithTimeStep::aggregate on mismatched time discretization !");
a[i]=itC->getArray();
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(a);
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Aggregate(a);
MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
ret->setArray(arr,0);
return ret;
const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::meld on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Meld(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Meld(getArray(),other->getArray());
MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
ret->setArray(arr,0);
return ret;
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::dot on mismatched time discretization !");
MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Dot(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Dot(getArray(),other->getArray());
ret->setArray(arr,0);
return ret;
}
const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::crossProduct on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::CrossProduct(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::CrossProduct(getArray(),other->getArray());
MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
ret->setArray(arr,0);
return ret;
const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::max on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Max(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Max(getArray(),other->getArray());
MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
ret->setArray(arr,0);
return ret;
const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::min on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Min(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Min(getArray(),other->getArray());
MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
ret->setArray(arr,0);
return ret;
const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::add on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Add(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Add(getArray(),other->getArray());
MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
ret->setArray(arr,0);
int tmp1,tmp2;
const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::substract on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Substract(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Substract(getArray(),other->getArray());
MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
ret->setArray(arr,0);
int tmp1,tmp2;
const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::multiply on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Multiply(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Multiply(getArray(),other->getArray());
MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
ret->setArray(arr,0);
int tmp1,tmp2;
const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::divide on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Divide(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Divide(getArray(),other->getArray());
MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
ret->setArray(arr,0);
int tmp1,tmp2;
const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("WithTimeStep::pow on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Pow(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Pow(getArray(),other->getArray());
MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
ret->setArray(arr,0);
int tmp1,tmp2;
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
_end_time=tinyInfoD[2];
}
-MEDCouplingConstOnTimeInterval::MEDCouplingConstOnTimeInterval(const MEDCouplingConstOnTimeInterval& other, bool deepCpy):
- MEDCouplingTimeDiscretization(other,deepCpy),_start_time(other._start_time),_end_time(other._end_time),_start_iteration(other._start_iteration),
+MEDCouplingConstOnTimeInterval::MEDCouplingConstOnTimeInterval(const MEDCouplingConstOnTimeInterval& 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)
{
}
_time_unit=tUnit;
}
-MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::performCpy(bool deepCpy) const
+MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::performCopyOrIncrRef(bool deepCopy) const
{
- return new MEDCouplingConstOnTimeInterval(*this,deepCpy);
+ return new MEDCouplingConstOnTimeInterval(*this,deepCopy);
}
std::vector< const DataArrayDouble *> MEDCouplingConstOnTimeInterval::getArraysForTime(double time) const
const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("ConstOnTimeInterval::aggregation on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Aggregate(getArray(),other->getArray());
MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
ret->setArray(arr,0);
return ret;
throw INTERP_KERNEL::Exception("ConstOnTimeInterval::aggregate on mismatched time discretization !");
a[i]=itC->getArray();
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(a);
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Aggregate(a);
MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
ret->setArray(arr,0);
return ret;
const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("ConstOnTimeInterval::meld on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Meld(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Meld(getArray(),other->getArray());
MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
ret->setTimeTolerance(getTimeTolerance());
ret->setArray(arr,0);
const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("ConstOnTimeInterval::dot on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Dot(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Dot(getArray(),other->getArray());
MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
ret->setArray(arr,0);
return ret;
const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("ConstOnTimeInterval::crossProduct on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::CrossProduct(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::CrossProduct(getArray(),other->getArray());
MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
ret->setArray(arr,0);
return ret;
const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("ConstOnTimeInterval::max on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Max(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Max(getArray(),other->getArray());
MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
ret->setArray(arr,0);
return ret;
const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("ConstOnTimeInterval::min on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Min(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Min(getArray(),other->getArray());
MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
ret->setArray(arr,0);
return ret;
const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("ConstOnTimeInterval::add on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Add(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Add(getArray(),other->getArray());
MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
ret->setArray(arr,0);
int tmp1,tmp2;
const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("ConstOnTimeInterval::substract on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Substract(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Substract(getArray(),other->getArray());
MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
ret->setArray(arr,0);
int tmp1,tmp2;
const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("multiply on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Multiply(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Multiply(getArray(),other->getArray());
MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
ret->setArray(arr,0);
int tmp1,tmp2;
const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("divide on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Divide(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Divide(getArray(),other->getArray());
MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
ret->setArray(arr,0);
int tmp1,tmp2;
const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("pow on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Pow(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Pow(getArray(),other->getArray());
MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
ret->setArray(arr,0);
int tmp1,tmp2;
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;
}
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())
setEndArray(arrays.back(),owner);
}
-MEDCouplingLinearTime::MEDCouplingLinearTime(const MEDCouplingLinearTime& other, bool deepCpy):MEDCouplingTwoTimeSteps(other,deepCpy)
+MEDCouplingLinearTime::MEDCouplingLinearTime(const MEDCouplingLinearTime& other, bool deepCopy):MEDCouplingTwoTimeSteps(other,deepCopy)
{
}
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
const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::aggregation on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Aggregate(getArray(),other->getArray());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Aggregate(getEndArray(),other->getEndArray());
+ MCAuto<DataArrayDouble> arr1=DataArrayDouble::Aggregate(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr2=DataArrayDouble::Aggregate(getEndArray(),other->getEndArray());
MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
ret->setArray(arr1,0);
ret->setEndArray(arr2,0);
a[i]=itC->getArray();
b[i]=itC->getEndArray();
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::Aggregate(a);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Aggregate(b);
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::Aggregate(a);
+ MCAuto<DataArrayDouble> arr2=DataArrayDouble::Aggregate(b);
MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
ret->setArray(arr,0);
ret->setEndArray(arr2,0);
const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::meld on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Meld(getArray(),other->getArray());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Meld(getEndArray(),other->getEndArray());
+ MCAuto<DataArrayDouble> arr1=DataArrayDouble::Meld(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr2=DataArrayDouble::Meld(getEndArray(),other->getEndArray());
MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
ret->setTimeTolerance(getTimeTolerance());
ret->setArray(arr1,0);
const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::dot on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Dot(getArray(),other->getArray());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Dot(getEndArray(),other->getEndArray());
+ MCAuto<DataArrayDouble> arr1=DataArrayDouble::Dot(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr2=DataArrayDouble::Dot(getEndArray(),other->getEndArray());
MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
ret->setArray(arr1,0);
ret->setEndArray(arr2,0);
const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::crossProduct on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::CrossProduct(getArray(),other->getArray());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::CrossProduct(getEndArray(),other->getEndArray());
+ MCAuto<DataArrayDouble> arr1=DataArrayDouble::CrossProduct(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr2=DataArrayDouble::CrossProduct(getEndArray(),other->getEndArray());
MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
ret->setArray(arr1,0);
ret->setEndArray(arr2,0);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::max on mismatched time discretization !");
MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Max(getArray(),other->getArray());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Max(getEndArray(),other->getEndArray());
+ MCAuto<DataArrayDouble> arr1=DataArrayDouble::Max(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr2=DataArrayDouble::Max(getEndArray(),other->getEndArray());
ret->setArray(arr1,0);
ret->setEndArray(arr2,0);
return ret;
const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::min on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Min(getArray(),other->getArray());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Min(getEndArray(),other->getEndArray());
+ MCAuto<DataArrayDouble> arr1=DataArrayDouble::Min(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr2=DataArrayDouble::Min(getEndArray(),other->getEndArray());
MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
ret->setArray(arr1,0);
ret->setEndArray(arr2,0);
const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::add on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Add(getArray(),other->getArray());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Add(getEndArray(),other->getEndArray());
+ MCAuto<DataArrayDouble> arr1=DataArrayDouble::Add(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr2=DataArrayDouble::Add(getEndArray(),other->getEndArray());
MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
ret->setArray(arr1,0);
ret->setEndArray(arr2,0);
const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::substract on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Substract(getArray(),other->getArray());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Substract(getEndArray(),other->getEndArray());
+ MCAuto<DataArrayDouble> arr1=DataArrayDouble::Substract(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr2=DataArrayDouble::Substract(getEndArray(),other->getEndArray());
MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
ret->setArray(arr1,0);
ret->setEndArray(arr2,0);
const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::multiply on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Multiply(getArray(),other->getArray());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Multiply(getEndArray(),other->getEndArray());
+ MCAuto<DataArrayDouble> arr1=DataArrayDouble::Multiply(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr2=DataArrayDouble::Multiply(getEndArray(),other->getEndArray());
MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
ret->setArray(arr1,0);
ret->setEndArray(arr2,0);
const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::divide on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Divide(getArray(),other->getArray());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Divide(getEndArray(),other->getEndArray());
+ MCAuto<DataArrayDouble> arr1=DataArrayDouble::Divide(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr2=DataArrayDouble::Divide(getEndArray(),other->getEndArray());
MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
ret->setArray(arr1,0);
ret->setEndArray(arr2,0);
const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("LinearTime::pow on mismatched time discretization !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr1=DataArrayDouble::Pow(getArray(),other->getArray());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=DataArrayDouble::Pow(getEndArray(),other->getEndArray());
+ MCAuto<DataArrayDouble> arr1=DataArrayDouble::Pow(getArray(),other->getArray());
+ MCAuto<DataArrayDouble> arr2=DataArrayDouble::Pow(getEndArray(),other->getEndArray());
MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
ret->setArray(arr1,0);
ret->setEndArray(arr2,0);
{
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;
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;
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;
MEDCOUPLING_EXPORT virtual void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const = 0;
MEDCOUPLING_EXPORT virtual void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const = 0;
MEDCOUPLING_EXPORT virtual void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& 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;
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<std::string>& 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<std::string>& 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<std::string>& 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<std::string>& varsOrder, const std::string& func);
//
MEDCOUPLING_EXPORT virtual ~MEDCouplingTimeDiscretization();
protected:
{
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);
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;
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;
MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& 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; }
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);
MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
MEDCOUPLING_EXPORT void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
MEDCOUPLING_EXPORT void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& 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;
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:
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;
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;
* \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);
}
}
/*!
- * 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<MEDCouplingUMesh> ret=clone(false);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> c(getNodalConnectivity()->deepCpy()),ci(getNodalConnectivityIndex()->deepCpy());
+ MCAuto<MEDCouplingUMesh> ret=clone(false);
+ MCAuto<DataArrayInt> c(getNodalConnectivity()->deepCopy()),ci(getNodalConnectivityIndex()->deepCopy());
ret->setConnectivity(c,ci);
return ret.retn();
}
* \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<INTERP_KERNEL::NormalizedCellType>::const_iterator iter=_types.begin();iter!=_types.end();iter++)
{
if((int)INTERP_KERNEL::CellModel::GetCellModel(*iter).getDimension()!=_mesh_dim)
/*!
* 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. <br> In addition to the checks performed by checkCoherency(), this
+ * algorithms. <br> 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.
* \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();
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;
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());
}
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());
}
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++]);
*/
void MEDCouplingUMesh::computeNeighborsOfCells(DataArrayInt *&neighbors, DataArrayInt *&neighborsIndx) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> desc=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> descIndx=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> revDesc=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> revDescIndx=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
+ MCAuto<DataArrayInt> desc=DataArrayInt::New();
+ MCAuto<DataArrayInt> descIndx=DataArrayInt::New();
+ MCAuto<DataArrayInt> revDesc=DataArrayInt::New();
+ MCAuto<DataArrayInt> revDescIndx=DataArrayInt::New();
+ MCAuto<MEDCouplingUMesh> meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
meshDM1=0;
ComputeNeighborsOfCellsAdv(desc,descIndx,revDesc,revDescIndx,neighbors,neighborsIndx);
}
const int *revDescIPtr=revDescIndx->getConstPointer();
//
int nbCells=descIndx->getNumberOfTuples()-1;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> out0=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> out1=DataArrayInt::New(); out1->alloc(nbCells+1,1);
+ MCAuto<DataArrayInt> out0=DataArrayInt::New();
+ MCAuto<DataArrayInt> out1=DataArrayInt::New(); out1->alloc(nbCells+1,1);
int *out1Ptr=out1->getPointer();
*out1Ptr++=0;
out0->reserve(desc->getNumberOfTuples());
{
checkFullyDefined();
int mdim(getMeshDimension()),nbNodes(getNumberOfNodes());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> desc(DataArrayInt::New()),descIndx(DataArrayInt::New()),revDesc(DataArrayInt::New()),revDescIndx(DataArrayInt::New());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh1D;
+ MCAuto<DataArrayInt> desc(DataArrayInt::New()),descIndx(DataArrayInt::New()),revDesc(DataArrayInt::New()),revDescIndx(DataArrayInt::New());
+ MCAuto<MEDCouplingUMesh> mesh1D;
switch(mdim)
{
case 3:
}
desc=DataArrayInt::New(); descIndx=DataArrayInt::New(); revDesc=0; revDescIndx=0;
mesh1D->getReverseNodalConnectivity(desc,descIndx);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret0(DataArrayInt::New());
+ MCAuto<DataArrayInt> ret0(DataArrayInt::New());
ret0->alloc(desc->getNumberOfTuples(),1);
int *r0Pt(ret0->getPointer());
const int *c1DPtr(mesh1D->getNodalConnectivity()->begin()),*rn(desc->begin()),*rni(descIndx->begin());
checkConnectivityFullyDefined();
int nbOfCells=getNumberOfCells();
int nbOfNodes=getNumberOfNodes();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> revNodalIndx=DataArrayInt::New(); revNodalIndx->alloc(nbOfNodes+1,1); revNodalIndx->fillWithZero();
+ MCAuto<DataArrayInt> 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<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(name,getMeshDimension()-SonsGenerator::DELTA);
+ MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(name,getMeshDimension()-SonsGenerator::DELTA);
ret->setCoords(getCoords());
ret->allocateCells(2*nbOfCells);
descIndx->alloc(nbOfCells+1,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> revDesc2(DataArrayInt::New()); revDesc2->reserve(2*nbOfCells);
+ MCAuto<DataArrayInt> revDesc2(DataArrayInt::New()); revDesc2->reserve(2*nbOfCells);
int *descIndxPtr=descIndx->getPointer(); *descIndxPtr++=0;
for(int eltId=0;eltId<nbOfCells;eltId++,descIndxPtr++)
{
}
int nbOfCellsM1=ret->getNumberOfCells();
std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus<int>());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> revNodal=DataArrayInt::New(); revNodal->alloc(revNodalIndx->back(),1);
+ MCAuto<DataArrayInt> 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();
//
DataArrayInt *commonCells=0,*commonCellsI=0;
FindCommonCellsAlg(3,0,ret->getNodalConnectivity(),ret->getNodalConnectivityIndex(),revNodal,revNodalIndx,commonCells,commonCellsI);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> commonCellsTmp(commonCells),commonCellsITmp(commonCellsI);
+ MCAuto<DataArrayInt> commonCellsTmp(commonCells),commonCellsITmp(commonCellsI);
const int *commonCellsPtr(commonCells->getConstPointer()),*commonCellsIPtr(commonCellsI->getConstPointer());
int newNbOfCellsM1=-1;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2nM1=DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfCellsM1,commonCells->begin(),
+ MCAuto<DataArrayInt> o2nM1=DataArrayInt::ConvertIndexArrayToO2N(nbOfCellsM1,commonCells->begin(),
commonCellsI->begin(),commonCellsI->end(),newNbOfCellsM1);
std::vector<bool> 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<DataArrayInt> n2oM1=o2nM1->invertArrayO2N2N2OBis(newNbOfCellsM1);
+ MCAuto<DataArrayInt> n2oM1=o2nM1->invertArrayO2N2N2OBis(newNbOfCellsM1);
const int *n2oM1Ptr=n2oM1->getConstPointer();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret2=static_cast<MEDCouplingUMesh *>(ret->buildPartOfMySelf(n2oM1->begin(),n2oM1->end(),true));
+ MCAuto<MEDCouplingUMesh> ret2=static_cast<MEDCouplingUMesh *>(ret->buildPartOfMySelf(n2oM1->begin(),n2oM1->end(),true));
ret2->copyTinyInfoFrom(this);
desc->alloc(descIndx->back(),1);
int *descPtr=desc->getPointer();
{
int *connIndex(_nodal_connec_index->getPointer());
const int *connOld(_nodal_connec->getConstPointer());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> connNew(DataArrayInt::New()),connNewI(DataArrayInt::New()); connNew->alloc(0,1); connNewI->alloc(1,1); connNewI->setIJ(0,0,0);
+ MCAuto<DataArrayInt> connNew(DataArrayInt::New()),connNewI(DataArrayInt::New()); connNew->alloc(0,1); connNewI->alloc(1,1); connNewI->setIJ(0,0,0);
std::vector<bool> toBeDone(nbOfCells,false);
for(const int *iter=cellIdsToConvertBg;iter!=cellIdsToConvertEnd;iter++)
{
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<DataArrayInt> newCi=DataArrayInt::New();
+ MCAuto<DataArrayInt> newCi=DataArrayInt::New();
newCi->alloc(nbOfCells+1,1);
int *newci=newCi->getPointer();
const int *ci=_nodal_connec_index->getConstPointer();
else
newci[i+1]=(ci[i+1]-ci[i])+newci[i];
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newC=DataArrayInt::New();
+ MCAuto<DataArrayInt> newC=DataArrayInt::New();
newC->alloc(newci[nbOfCells],1);
int *newc=newC->getPointer();
for(int i=0;i<nbOfCells;i++)
int nbOfCells=getNumberOfCells();
if(nbOfCells<1)
return false;
- int initMeshLgth=getMeshLength();
+ int initMeshLgth=getNodalConnectivityArrayLen();
int *conn=_nodal_connec->getPointer();
int *index=_nodal_connec_index->getPointer();
int posOfCurCell=0;
checkFullyDefined();
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplifyPolyhedra : works on meshdimension 3 and spaceDimension 3 !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coords=getCoords()->deepCpy();
+ MCAuto<DataArrayDouble> coords=getCoords()->deepCopy();
coords->recenterForMaxPrecision(eps);
//
int nbOfCells=getNumberOfCells();
const int *conn=_nodal_connec->getConstPointer();
const int *index=_nodal_connec_index->getConstPointer();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> connINew=DataArrayInt::New();
+ MCAuto<DataArrayInt> connINew=DataArrayInt::New();
connINew->alloc(nbOfCells+1,1);
int *connINewPtr=connINew->getPointer(); *connINewPtr++=0;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> connNew=DataArrayInt::New(); connNew->alloc(0,1);
+ MCAuto<DataArrayInt> connNew=DataArrayInt::New(); connNew->alloc(0,1);
bool changed=false;
for(int i=0;i<nbOfCells;i++,connINewPtr++)
{
{
nbrOfNodesInUse=-1;
int nbOfNodes(getNumberOfNodes());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfNodes,1);
int *traducer=ret->getPointer();
std::fill(traducer,traducer+nbOfNodes,-1);
{
checkConnectivityFullyDefined();
int nbOfCells=getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfCells,1);
int *retPtr=ret->getPointer();
const int *conn=getNodalConnectivity()->getConstPointer();
{
checkConnectivityFullyDefined();
int nbOfCells=getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfCells,1);
int *retPtr=ret->getPointer();
const int *conn=getNodalConnectivity()->getConstPointer();
{
checkConnectivityFullyDefined();
int nbOfCells=getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfCells,1);
int *retPtr=ret->getPointer();
const int *conn=getNodalConnectivity()->getConstPointer();
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.");
}
/*!
* 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;
/*!
* 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])
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;
/*!
* 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])
{
}
/*!
- * 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])
{
/*!
* 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])
}
}
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;
*/
void MEDCouplingUMesh::findCommonCells(int compType, int startCellId, DataArrayInt *& commonCellsArr, DataArrayInt *& commonCellsIArr) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> revNodal=DataArrayInt::New(),revNodalI=DataArrayInt::New();
+ MCAuto<DataArrayInt> revNodal=DataArrayInt::New(),revNodalI=DataArrayInt::New();
getReverseNodalConnectivity(revNodal,revNodalI);
FindCommonCellsAlg(compType,startCellId,_nodal_connec,_nodal_connec_index,revNodal,revNodalI,commonCellsArr,commonCellsIArr);
}
void MEDCouplingUMesh::FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI,
DataArrayInt *& commonCellsArr, DataArrayInt *& commonCellsIArr)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> commonCells=DataArrayInt::New(),commonCellsI=DataArrayInt::New(); commonCells->alloc(0,1);
+ MCAuto<DataArrayInt> 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();
*/
bool MEDCouplingUMesh::areCellsIncludedIn(const MEDCouplingUMesh *other, int compType, DataArrayInt *& arr) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MergeUMeshesOnSameCoords(this,other);
+ MCAuto<MEDCouplingUMesh> 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))
oss << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n=mesh->zipConnectivityTraducer(compType,nbOfCells);
+ MCAuto<DataArrayInt> o2n=mesh->zipConnectivityTraducer(compType,nbOfCells);
arr=o2n->substr(nbOfCells);
arr->setName(other->getName());
int tmp;
* \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<MEDCouplingUMesh> mesh=MergeUMeshesOnSameCoords(this,other);
+ MCAuto<MEDCouplingUMesh> mesh=MergeUMeshesOnSameCoords(this,other);
DataArrayInt *commonCells=0,*commonCellsI=0;
int thisNbCells=getNumberOfCells();
mesh->findCommonCells(7,thisNbCells,commonCells,commonCellsI);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> commonCellsTmp(commonCells),commonCellsITmp(commonCellsI);
+ MCAuto<DataArrayInt> commonCellsTmp(commonCells),commonCellsITmp(commonCellsI);
const int *commonCellsPtr=commonCells->getConstPointer(),*commonCellsIPtr=commonCellsI->getConstPointer();
int otherNbCells=other->getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr2=DataArrayInt::New();
+ MCAuto<DataArrayInt> arr2=DataArrayInt::New();
arr2->alloc(otherNbCells,1);
arr2->fillWithZero();
int *arr2Ptr=arr2->getPointer();
* \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<MEDCouplingUMesh *>(MEDCouplingPointSet::buildPartOfMySelf2(start,end,step,keepCoords));
+ return static_cast<MEDCouplingUMesh *>(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)
DataArrayInt *arrOut=0,*arrIOut=0;
MEDCouplingUMesh::SetPartOfIndexedArrays(cellIdsBg,cellIdsEnd,_nodal_connec,_nodal_connec_index,otherOnSameCoordsThanThis._nodal_connec,otherOnSameCoordsThanThis._nodal_connec_index,
arrOut,arrIOut);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arrOutAuto(arrOut),arrIOutAuto(arrIOut);
+ MCAuto<DataArrayInt> 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();
}
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<DataArrayInt> arrOutAuto(arrOut),arrIOutAuto(arrIOut);
+ MCAuto<DataArrayInt> arrOutAuto(arrOut),arrIOutAuto(arrIOut);
setConnectivity(arrOut,arrIOut,true);
}
}
*/
void MEDCouplingUMesh::fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, DataArrayInt *&cellIdsKeptArr) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellIdsKept=DataArrayInt::New(); cellIdsKept->alloc(0,1);
+ MCAuto<DataArrayInt> cellIdsKept=DataArrayInt::New(); cellIdsKept->alloc(0,1);
checkConnectivityFullyDefined();
int tmp=-1;
int sz=getNodalConnectivity()->getMaxValue(tmp); sz=std::max(sz,0)+1;
*/
MEDCouplingUMesh *MEDCouplingUMesh::buildFacePartOfMySelfNode(const int *begin, const int *end, bool fullyIn) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> desc,descIndx,revDesc,revDescIndx;
+ MCAuto<DataArrayInt> desc,descIndx,revDesc,revDescIndx;
desc=DataArrayInt::New(); descIndx=DataArrayInt::New(); revDesc=DataArrayInt::New(); revDescIndx=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> subMesh=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
+ MCAuto<MEDCouplingUMesh> subMesh=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
desc=0; descIndx=0; revDesc=0; revDescIndx=0;
return static_cast<MEDCouplingUMesh*>(subMesh->buildPartOfMySelfNode(begin,end,fullyIn));
}
DataArrayInt *revDesc=DataArrayInt::New();
DataArrayInt *revDescIndx=DataArrayInt::New();
//
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
+ MCAuto<MEDCouplingUMesh> meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
revDesc->decrRef();
desc->decrRef();
descIndx->decrRef();
DataArrayInt *MEDCouplingUMesh::findCellIdsOnBoundary() const
{
checkFullyDefined();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> desc=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> descIndx=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> revDesc=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> revDescIndx=DataArrayInt::New();
+ MCAuto<DataArrayInt> desc=DataArrayInt::New();
+ MCAuto<DataArrayInt> descIndx=DataArrayInt::New();
+ MCAuto<DataArrayInt> revDesc=DataArrayInt::New();
+ MCAuto<DataArrayInt> revDescIndx=DataArrayInt::New();
//
buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx)->decrRef();
desc=(DataArrayInt*)0; descIndx=(DataArrayInt*)0;
//
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp=revDescIndx->deltaShiftIndex();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> faceIds=tmp->getIdsEqual(1); tmp=(DataArrayInt*)0;
+ MCAuto<DataArrayInt> tmp=revDescIndx->deltaShiftIndex();
+ MCAuto<DataArrayInt> faceIds=tmp->findIdsEqual(1); tmp=(DataArrayInt*)0;
const int *revDescPtr=revDesc->getConstPointer();
const int *revDescIndxPtr=revDescIndx->getConstPointer();
int nbOfCells=getNumberOfCells();
otherDimM1OnSameCoords.checkConnectivityFullyDefined();
if(getMeshDimension()-1!=otherDimM1OnSameCoords.getMeshDimension())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::findCellIdsLyingOn : invalid mesh dimension of input mesh regarding meshdimesion of this !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> fetchedNodeIds1=otherDimM1OnSameCoords.computeFetchedNodeIds();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> s0arr=getCellIdsLyingOnNodes(fetchedNodeIds1->begin(),fetchedNodeIds1->end(),false);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> thisPart=static_cast<MEDCouplingUMesh *>(buildPartOfMySelf(s0arr->begin(),s0arr->end(),true));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> descThisPart=DataArrayInt::New(),descIThisPart=DataArrayInt::New(),revDescThisPart=DataArrayInt::New(),revDescIThisPart=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> thisPartConsti=thisPart->buildDescendingConnectivity(descThisPart,descIThisPart,revDescThisPart,revDescIThisPart);
+ MCAuto<DataArrayInt> fetchedNodeIds1=otherDimM1OnSameCoords.computeFetchedNodeIds();
+ MCAuto<DataArrayInt> s0arr=getCellIdsLyingOnNodes(fetchedNodeIds1->begin(),fetchedNodeIds1->end(),false);
+ MCAuto<MEDCouplingUMesh> thisPart=static_cast<MEDCouplingUMesh *>(buildPartOfMySelf(s0arr->begin(),s0arr->end(),true));
+ MCAuto<DataArrayInt> descThisPart=DataArrayInt::New(),descIThisPart=DataArrayInt::New(),revDescThisPart=DataArrayInt::New(),revDescIThisPart=DataArrayInt::New();
+ MCAuto<MEDCouplingUMesh> 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<DataArrayInt> idsOtherInConstiAuto(idsOtherInConsti);
+ MCAuto<DataArrayInt> 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<int> s1;
for(const int *idOther=idsOtherInConsti->begin();idOther!=idsOtherInConsti->end();idOther++)
s1.insert(revDescThisPartPtr+revDescIThisPartPtr[*idOther],revDescThisPartPtr+revDescIThisPartPtr[*idOther+1]);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> s1arr_renum1=DataArrayInt::New(); s1arr_renum1->alloc((int)s1.size(),1); std::copy(s1.begin(),s1.end(),s1arr_renum1->getPointer());
+ MCAuto<DataArrayInt> 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();
*/
MEDCouplingUMesh *MEDCouplingUMesh::computeSkin() const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> desc=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> descIndx=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> revDesc=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> revDescIndx=DataArrayInt::New();
+ MCAuto<DataArrayInt> desc=DataArrayInt::New();
+ MCAuto<DataArrayInt> descIndx=DataArrayInt::New();
+ MCAuto<DataArrayInt> revDesc=DataArrayInt::New();
+ MCAuto<DataArrayInt> revDescIndx=DataArrayInt::New();
//
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
+ MCAuto<MEDCouplingUMesh> meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
revDesc=0; desc=0; descIndx=0;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> revDescIndx2=revDescIndx->deltaShiftIndex();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> part=revDescIndx2->getIdsEqual(1);
+ MCAuto<DataArrayInt> revDescIndx2=revDescIndx->deltaShiftIndex();
+ MCAuto<DataArrayInt> part=revDescIndx2->findIdsEqual(1);
return static_cast<MEDCouplingUMesh *>(meshDM1->buildPartOfMySelf(part->begin(),part->end(),true));
}
*/
DataArrayInt *MEDCouplingUMesh::findBoundaryNodes() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> skin=computeSkin();
+ MCAuto<MEDCouplingUMesh> skin=computeSkin();
return skin->computeFetchedNodeIds();
}
void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayInt *& nodeIdsToDuplicate,
DataArrayInt *& cellIdsNeededToBeRenum, DataArrayInt *& cellIdsNotModified) const
{
- typedef MEDCouplingAutoRefCountObjectPtr<DataArrayInt> DAInt;
+ typedef MCAuto<DataArrayInt> DAInt;
checkFullyDefined();
otherDimM1OnSameCoords.checkFullyDefined();
DAInt cellIdsRk0Auto(cellIdsRk0),cellIdsRk1Auto(cellIdsRk1);
DAInt s0=cellIdsRk1->buildComplement(cellIdsRk0->getNumberOfTuples());
s0->transformWithIndArr(cellIdsRk0Auto->begin(),cellIdsRk0Auto->end());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m0Part=static_cast<MEDCouplingUMesh *>(buildPartOfMySelf(s0->begin(),s0->end(),true));
+ MCAuto<MEDCouplingUMesh> m0Part=static_cast<MEDCouplingUMesh *>(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<MEDCouplingUMesh> m0Part2=static_cast<MEDCouplingUMesh *>(buildPartOfMySelf(cellIdsRk1->begin(),cellIdsRk1->end(),true));
+ MCAuto<MEDCouplingUMesh> m0Part2=static_cast<MEDCouplingUMesh *>(buildPartOfMySelf(cellIdsRk1->begin(),cellIdsRk1->end(),true));
int nCells2 = m0Part2->getNumberOfCells();
DAInt desc00=DataArrayInt::New(),descI00=DataArrayInt::New(),revDesc00=DataArrayInt::New(),revDescI00=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m01=m0Part2->buildDescendingConnectivity(desc00,descI00,revDesc00,revDescI00);
+ MCAuto<MEDCouplingUMesh> 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);
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)
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); }
//
const int *conn=_nodal_connec->getConstPointer();
const int *connI=_nodal_connec_index->getConstPointer();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n=DataArrayInt::New(); o2n->useArray(array,false,C_DEALLOC,nbCells,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> n2o=o2n->invertArrayO2N2N2O(nbCells);
+ MCAuto<DataArrayInt> o2n=DataArrayInt::New(); o2n->useArray(array,false,C_DEALLOC,nbCells,1);
+ MCAuto<DataArrayInt> n2o=o2n->invertArrayO2N2N2O(nbCells);
const int *n2oPtr=n2o->begin();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConn=DataArrayInt::New();
+ MCAuto<DataArrayInt> newConn=DataArrayInt::New();
newConn->alloc(_nodal_connec->getNumberOfTuples(),_nodal_connec->getNumberOfComponents());
newConn->copyStringInfoFrom(*_nodal_connec);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConnI=DataArrayInt::New();
+ MCAuto<DataArrayInt> newConnI=DataArrayInt::New();
newConnI->alloc(_nodal_connec_index->getNumberOfTuples(),_nodal_connec_index->getNumberOfComponents());
newConnI->copyStringInfoFrom(*_nodal_connec_index);
//
*/
DataArrayInt *MEDCouplingUMesh::getCellsInBoundingBox(const double *bbox, double eps) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elems=DataArrayInt::New(); elems->alloc(0,1);
+ MCAuto<DataArrayInt> elems=DataArrayInt::New(); elems->alloc(0,1);
if(getMeshDimension()==-1)
{
elems->pushBackSilent(0);
*/
DataArrayInt *MEDCouplingUMesh::getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elems=DataArrayInt::New(); elems->alloc(0,1);
+ MCAuto<DataArrayInt> elems=DataArrayInt::New(); elems->alloc(0,1);
if(getMeshDimension()==-1)
{
elems->pushBackSilent(0);
DataArrayInt *MEDCouplingUMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(0,1);
checkConnectivityFullyDefined();
int nbCells=getNumberOfCells();
int mdim=getMeshDimension();
if(mdim<0)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSetInstanceFromThis : invalid mesh dimension ! Should be >= 0 !");
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(getName(),mdim);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp1,tmp2;
+ MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(getName(),mdim);
+ MCAuto<DataArrayInt> tmp1,tmp2;
bool needToCpyCT=true;
if(!_nodal_connec)
{
ret->_types=_types;
if(!_coords)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coords=DataArrayDouble::New(); coords->alloc(0,spaceDim);
+ MCAuto<DataArrayDouble> coords=DataArrayDouble::New(); coords->alloc(0,spaceDim);
ret->setCoords(coords);
}
else
}
/*!
- * 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),
_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()
* 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();
}
tinyInfo.push_back(getMeshDimension());
tinyInfo.push_back(getNumberOfCells());
if(_nodal_connec)
- tinyInfo.push_back(getMeshLength());
+ tinyInfo.push_back(getNodalConnectivityArrayLen());
else
tinyInfo.push_back(-1);
}
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;
{
// Connectivity
const int *recvBuffer=a1->getConstPointer();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> myConnecIndex=DataArrayInt::New();
+ MCAuto<DataArrayInt> myConnecIndex=DataArrayInt::New();
myConnecIndex->alloc(tinyInfo[6]+1,1);
std::copy(recvBuffer,recvBuffer+tinyInfo[6]+1,myConnecIndex->getPointer());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> myConnec=DataArrayInt::New();
+ MCAuto<DataArrayInt> 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);
}
/*!
- * 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<MEDCouplingUMesh> ret=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New();
ret->_mesh_dim=_mesh_dim;
ret->setCoords(_coords);
- int newNbOfCells=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::buildPartOfMySelfKeepCoords2 : ");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConnI=DataArrayInt::New(); newConnI->alloc(newNbOfCells+1,1);
+ int newNbOfCells=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::buildPartOfMySelfKeepCoordsSlice : ");
+ MCAuto<DataArrayInt> newConnI=DataArrayInt::New(); newConnI->alloc(newNbOfCells+1,1);
int *newConnIPtr=newConnI->getPointer(); *newConnIPtr=0;
int work=start;
const int *conn=_nodal_connec->getConstPointer();
}
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<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(newConnIPtr[0],1);
+ MCAuto<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(newConnIPtr[0],1);
int *newConnPtr=newConn->getPointer();
std::set<INTERP_KERNEL::NormalizedCellType> types;
work=start;
{
checkConnectivityFullyDefined();
int ncell=getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New();
ret->_mesh_dim=_mesh_dim;
ret->setCoords(_coords);
std::size_t nbOfElemsRet=std::distance(begin,end);
types.insert((INTERP_KERNEL::NormalizedCellType)conn[connIndex[*work]]);
connRetWork=std::copy(conn+connIndex[*work],conn+connIndex[*work+1],connRetWork);
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> connRetArr=DataArrayInt::New();
+ MCAuto<DataArrayInt> connRetArr=DataArrayInt::New();
connRetArr->useArray(connRet,true,C_DEALLOC,connIndexRet[nbOfElemsRet],1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> connIndexRetArr=DataArrayInt::New();
+ MCAuto<DataArrayInt> connIndexRetArr=DataArrayInt::New();
connIndexRetArr->useArray(connIndexRet,true,C_DEALLOC,(int)nbOfElemsRet+1,1);
ret->setConnectivity(connRetArr,connIndexRetArr,false);
ret->_types=types;
std::string name="MeasureOfMesh_";
name+=getName();
int nbelem=getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+ MCAuto<MEDCouplingFieldDouble> field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
field->setName(name);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> array=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> array=DataArrayDouble::New();
array->alloc(nbelem,1);
double *area_vol=array->getPointer();
field->setArray(array) ; array=0;
std::string name="PartMeasureOfMesh_";
name+=getName();
int nbelem=(int)std::distance(begin,end);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> array=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> array=DataArrayDouble::New();
array->setName(name);
array->alloc(nbelem,1);
double *area_vol=array->getPointer();
*/
MEDCouplingFieldDouble *MEDCouplingUMesh::getMeasureFieldOnNode(bool isAbs) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> tmp=getMeasureField(isAbs);
+ MCAuto<MEDCouplingFieldDouble> tmp=getMeasureField(isAbs);
std::string name="MeasureOnNodeOfMesh_";
name+=getName();
int nbNodes=getNumberOfNodes();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_NODES);
+ MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_NODES);
double cst=1./((double)getMeshDimension()+1.);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> array=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> array=DataArrayDouble::New();
array->alloc(nbNodes,1);
double *valsToFill=array->getPointer();
std::fill(valsToFill,valsToFill+nbNodes,0.);
const double *values=tmp->getArray()->getConstPointer();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> daInd=DataArrayInt::New();
+ MCAuto<DataArrayInt> da=DataArrayInt::New();
+ MCAuto<DataArrayInt> daInd=DataArrayInt::New();
getReverseNodalConnectivity(da,daInd);
const int *daPtr=da->getConstPointer();
const int *daIPtr=daInd->getConstPointer();
{
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<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> array=DataArrayDouble::New();
+ MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+ MCAuto<DataArrayDouble> array=DataArrayDouble::New();
int nbOfCells=getNumberOfCells();
int nbComp=getMeshDimension()+1;
array->alloc(nbOfCells,nbComp);
{
if(getSpaceDimension()==3)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> loc=getBarycenterAndOwner();
+ MCAuto<DataArrayDouble> loc=computeCellCenterOfMass();
const double *locPtr=loc->getConstPointer();
for(int i=0;i<nbOfCells;i++,vals+=3)
{
}
else
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> isAbs=getMeasureField(false);
+ MCAuto<MEDCouplingFieldDouble> isAbs=getMeasureField(false);
const double *isAbsPtr=isAbs->getArray()->begin();
for(int i=0;i<nbOfCells;i++,isAbsPtr++)
{ vals[3*i]=0.; vals[3*i+1]=0.; vals[3*i+2]=*isAbsPtr>0.?1.:-1.; }
{
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<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> array=DataArrayDouble::New();
+ MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+ MCAuto<DataArrayDouble> array=DataArrayDouble::New();
std::size_t nbelems=std::distance(begin,end);
int nbComp=getMeshDimension()+1;
array->alloc((int)nbelems,nbComp);
{
if(getSpaceDimension()==3)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> loc=getPartBarycenterAndOwner(begin,end);
+ MCAuto<DataArrayDouble> loc=getPartBarycenterAndOwner(begin,end);
const double *locPtr=loc->getConstPointer();
for(const int *i=begin;i!=end;i++,vals+=3,locPtr+=3)
{
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<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> array=DataArrayDouble::New();
+ MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+ MCAuto<DataArrayDouble> array=DataArrayDouble::New();
int nbOfCells=getNumberOfCells();
int spaceDim=getSpaceDimension();
array->alloc(nbOfCells,spaceDim);
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<DataArrayInt> candidates=getCellIdsCrossingPlane(origin,vec,eps);
+ MCAuto<DataArrayInt> 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<int> nodes;
DataArrayInt *cellIds1D=0;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> subMesh=static_cast<MEDCouplingUMesh*>(buildPartOfMySelf(candidates->begin(),candidates->end(),false));
+ MCAuto<MEDCouplingUMesh> subMesh=static_cast<MEDCouplingUMesh*>(buildPartOfMySelf(candidates->begin(),candidates->end(),false));
subMesh->findNodesOnPlane(origin,vec,eps,nodes);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> desc1=DataArrayInt::New(),desc2=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> descIndx1=DataArrayInt::New(),descIndx2=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> revDesc1=DataArrayInt::New(),revDesc2=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> revDescIndx1=DataArrayInt::New(),revDescIndx2=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mDesc2=subMesh->buildDescendingConnectivity(desc2,descIndx2,revDesc2,revDescIndx2);//meshDim==2 spaceDim==3
+ MCAuto<DataArrayInt> desc1=DataArrayInt::New(),desc2=DataArrayInt::New();
+ MCAuto<DataArrayInt> descIndx1=DataArrayInt::New(),descIndx2=DataArrayInt::New();
+ MCAuto<DataArrayInt> revDesc1=DataArrayInt::New(),revDesc2=DataArrayInt::New();
+ MCAuto<DataArrayInt> revDescIndx1=DataArrayInt::New(),revDescIndx2=DataArrayInt::New();
+ MCAuto<MEDCouplingUMesh> mDesc2=subMesh->buildDescendingConnectivity(desc2,descIndx2,revDesc2,revDescIndx2);//meshDim==2 spaceDim==3
revDesc2=0; revDescIndx2=0;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mDesc1=mDesc2->buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1);//meshDim==1 spaceDim==3
+ MCAuto<MEDCouplingUMesh> 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<DataArrayInt> cellIds1DTmp(cellIds1D);
+ MCAuto<DataArrayInt> cellIds1DTmp(cellIds1D);
//
std::vector<int> cut3DCurve(mDesc1->getNumberOfCells(),-2);
for(const int *it=cellIds1D->begin();it!=cellIds1D->end();it++)
AssemblyForSplitFrom3DCurve(cut3DCurve,nodes,mDesc2->getNodalConnectivity()->getConstPointer(),mDesc2->getNodalConnectivityIndex()->getConstPointer(),
mDesc1->getNodalConnectivity()->getConstPointer(),mDesc1->getNodalConnectivityIndex()->getConstPointer(),
desc1->getConstPointer(),descIndx1->getConstPointer(),cut3DSurf);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(DataArrayInt::New()),connI(DataArrayInt::New()),cellIds2(DataArrayInt::New());
+ MCAuto<DataArrayInt> 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<MEDCouplingUMesh> ret=MEDCouplingUMesh::New("Slice3D",2);
+ MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New("Slice3D",2);
ret->setCoords(mDesc1->getCoords());
ret->setConnectivity(conn,connI,true);
cellIds=candidates->selectByTupleId(cellIds2->begin(),cellIds2->end());
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<DataArrayInt> candidates=getCellIdsCrossingPlane(origin,vec,eps);
+ MCAuto<DataArrayInt> 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<int> nodes;
DataArrayInt *cellIds1D=0;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> subMesh=static_cast<MEDCouplingUMesh*>(buildPartOfMySelf(candidates->begin(),candidates->end(),false));
+ MCAuto<MEDCouplingUMesh> subMesh=static_cast<MEDCouplingUMesh*>(buildPartOfMySelf(candidates->begin(),candidates->end(),false));
subMesh->findNodesOnPlane(origin,vec,eps,nodes);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> desc1=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> descIndx1=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> revDesc1=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> revDescIndx1=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mDesc1=subMesh->buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1);//meshDim==1 spaceDim==3
+ MCAuto<DataArrayInt> desc1=DataArrayInt::New();
+ MCAuto<DataArrayInt> descIndx1=DataArrayInt::New();
+ MCAuto<DataArrayInt> revDesc1=DataArrayInt::New();
+ MCAuto<DataArrayInt> revDescIndx1=DataArrayInt::New();
+ MCAuto<MEDCouplingUMesh> mDesc1=subMesh->buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1);//meshDim==1 spaceDim==3
mDesc1->fillCellIdsToKeepFromNodeIds(&nodes[0],&nodes[0]+nodes.size(),true,cellIds1D);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellIds1DTmp(cellIds1D);
+ MCAuto<DataArrayInt> cellIds1DTmp(cellIds1D);
//
std::vector<int> cut3DCurve(mDesc1->getNumberOfCells(),-2);
for(const int *it=cellIds1D->begin();it!=cellIds1D->end();it++)
AssemblyForSplitFrom3DCurve(cut3DCurve,nodes,subMesh->getNodalConnectivity()->getConstPointer(),subMesh->getNodalConnectivityIndex()->getConstPointer(),
mDesc1->getNodalConnectivity()->getConstPointer(),mDesc1->getNodalConnectivityIndex()->getConstPointer(),
desc1->getConstPointer(),descIndx1->getConstPointer(),cut3DSurf);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(DataArrayInt::New()),connI(DataArrayInt::New()),cellIds2(DataArrayInt::New()); connI->pushBackSilent(0);
+ MCAuto<DataArrayInt> 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();
}
if(cellIds2->empty())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3DSurf : No 3DSurf cells in this intercepts the specified plane !");
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MEDCouplingUMesh::New("Slice3DSurf",1);
+ MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New("Slice3DSurf",1);
ret->setCoords(mDesc1->getCoords());
ret->setConnectivity(conn,connI,true);
cellIds=candidates->selectByTupleId(cellIds2->begin(),cellIds2->end());
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<DataArrayInt> cellIds;
+ MCAuto<DataArrayInt> cellIds;
double bbox[6];
if(angle>eps)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coo=_coords->deepCpy();
+ MCAuto<DataArrayDouble> 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<MEDCouplingUMesh> mw=clone(false);//false -> shallow copy
+ MCAuto<MEDCouplingUMesh> mw=clone(false);//false -> shallow copy
mw->setCoords(coo);
mw->getBoundingBox(bbox);
bbox[4]=origin[2]-eps; bbox[5]=origin[2]+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<MEDCouplingFieldDouble> f=buildDirectionVectorField();
+ MCAuto<MEDCouplingFieldDouble> f=buildDirectionVectorField();
const double *fPtr=f->getArray()->getConstPointer();
double tmp[3];
for(int i=0;i<getNumberOfCells();i++)
if((int)std::distance(ptBg,ptEnd)!=spaceDim)
{ std::ostringstream oss; oss << "MEDCouplingUMesh::distanceToPoint : input point has to have dimension equal to the space dimension of this (" << spaceDim << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); }
DataArrayInt *ret1=0;
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> pts=DataArrayDouble::New(); pts->useArray(ptBg,false,C_DEALLOC,1,spaceDim);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret0=distanceToPoints(pts,ret1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret1Safe(ret1);
+ MCAuto<DataArrayDouble> pts=DataArrayDouble::New(); pts->useArray(ptBg,false,C_DEALLOC,1,spaceDim);
+ MCAuto<DataArrayDouble> ret0=distanceToPoints(pts,ret1);
+ MCAuto<DataArrayInt> ret1Safe(ret1);
cellId=*ret1Safe->begin();
return *ret0->begin();
}
if(nbCells==0)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoints : no cells in this !");
int nbOfPts=pts->getNumberOfTuples();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret0=DataArrayDouble::New(); ret0->alloc(nbOfPts,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret1=DataArrayInt::New(); ret1->alloc(nbOfPts,1);
+ MCAuto<DataArrayDouble> ret0=DataArrayDouble::New(); ret0->alloc(nbOfPts,1);
+ MCAuto<DataArrayInt> 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<DataArrayDouble> bboxArr(getBoundingBoxForBBTree());
+ MCAuto<DataArrayDouble> bboxArr(getBoundingBoxForBBTree());
const double *bbox(bboxArr->begin());
switch(spaceDim)
{
*/
void MEDCouplingUMesh::getCellsContainingPoint(const double *pos, double eps, std::vector<int>& elts) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> eltsUg,eltsIndexUg;
+ MCAuto<DataArrayInt> eltsUg,eltsIndexUg;
getCellsContainingPoints(pos,1,eps,eltsUg,eltsIndexUg);
elts.clear(); elts.insert(elts.end(),eltsUg->begin(),eltsUg->end());
}
// end
};
- INTERP_KERNEL::Edge *MEDCouplingUMeshBuildQPFromEdge2(INTERP_KERNEL::NormalizedCellType typ, const int *bg, const double *coords2D, std::map< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Node>,int>& m)
+ INTERP_KERNEL::Edge *MEDCouplingUMeshBuildQPFromEdge2(INTERP_KERNEL::NormalizedCellType typ, const int *bg, const double *coords2D, std::map< MCAuto<INTERP_KERNEL::Node>,int>& m)
{
INTERP_KERNEL::Edge *ret(0);
- MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Node> 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<INTERP_KERNEL::Node> 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)
{
template<int SPACEDIM>
void MEDCouplingUMesh::getCellsContainingPointsAlg(const double *coords, const double *pos, int nbOfPoints,
- double eps, MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& elts, MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& eltsIndex) const
+ double eps, MCAuto<DataArrayInt>& elts, MCAuto<DataArrayInt>& 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<DataArrayDouble> bboxArr(getBoundingBoxForBBTree(eps));
+ MCAuto<DataArrayDouble> bboxArr(getBoundingBoxForBBTree(eps));
const double *bbox(bboxArr->begin());
int nbOfCells=getNumberOfCells();
const int *conn=_nodal_connec->getConstPointer();
* \endif
*/
void MEDCouplingUMesh::getCellsContainingPoints(const double *pos, int nbOfPoints, double eps,
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& elts, MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& eltsIndex) const
+ MCAuto<DataArrayInt>& elts, MCAuto<DataArrayInt>& eltsIndex) const
{
int spaceDim=getSpaceDimension();
int mDim=getMeshDimension();
checkFullyDefined();
const double *coords=getCoords()->getConstPointer();
int nbOfCells=getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nodalConnecIndexOut=DataArrayInt::New();
+ MCAuto<DataArrayInt> nodalConnecIndexOut=DataArrayInt::New();
nodalConnecIndexOut->alloc(nbOfCells+1,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nodalConnecOut(DataArrayInt::New());
+ MCAuto<DataArrayInt> nodalConnecOut(DataArrayInt::New());
int *workIndexOut=nodalConnecIndexOut->getPointer();
*workIndexOut=0;
const int *nodalConnecIn=_nodal_connec->getConstPointer();
const int *nodalConnecIndexIn=_nodal_connec_index->getConstPointer();
std::set<INTERP_KERNEL::NormalizedCellType> types;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> isChanged(DataArrayInt::New());
+ MCAuto<DataArrayInt> isChanged(DataArrayInt::New());
isChanged->alloc(0,1);
for(int i=0;i<nbOfCells;i++,workIndexOut++)
{
throw INTERP_KERNEL::Exception("Invalid 2D mesh and 1D mesh because 2D mesh has quadratic cells and 1D is not fully quadratic !");
}
int oldNbOfNodes(getNumberOfNodes());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> newCoords;
+ MCAuto<DataArrayDouble> newCoords;
switch(policy)
{
case 0:
throw INTERP_KERNEL::Exception("Not implemented extrusion policy : must be in (0) !");
}
setCoords(newCoords);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret(buildExtrudedMeshFromThisLowLev(oldNbOfNodes,isQuad));
+ MCAuto<MEDCouplingUMesh> ret(buildExtrudedMeshFromThisLowLev(oldNbOfNodes,isQuad));
updateTime();
return ret.retn();
}
if(!addCoo.empty())
{
int newNbOfNodes=nnodes+((int)addCoo.size())/3;
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coo2=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coo2=DataArrayDouble::New();
coo2->alloc(newNbOfNodes,3);
double *tmp=coo2->getPointer();
tmp=std::copy(_coords->begin(),_coords->end(),tmp);
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<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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<MEDCouplingUMesh> tmp=MEDCouplingUMesh::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp2=getCoords()->deepCpy();
+ MCAuto<MEDCouplingUMesh> tmp=MEDCouplingUMesh::New();
+ MCAuto<DataArrayDouble> tmp2=getCoords()->deepCopy();
tmp->setCoords(tmp2);
const double *coo1D=mesh1D->getCoords()->getConstPointer();
const int *conn1D=mesh1D->getNodalConnectivity()->getConstPointer();
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<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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<MEDCouplingUMesh> tmp=MEDCouplingUMesh::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp2=getCoords()->deepCpy();
+ MCAuto<MEDCouplingUMesh> tmp=MEDCouplingUMesh::New();
+ MCAuto<DataArrayDouble> tmp2=getCoords()->deepCopy();
tmp->setCoords(tmp2);
const double *coo1D=mesh1D->getCoords()->getConstPointer();
const int *conn1D=mesh1D->getNodalConnectivity()->getConstPointer();
int nbOf3DCells(nbOf2DCells*nbOf1DCells);
MEDCouplingUMesh *ret(MEDCouplingUMesh::New("Extruded",getMeshDimension()+1));
const int *conn(_nodal_connec->begin()),*connI(_nodal_connec_index->begin());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConn(DataArrayInt::New()),newConnI(DataArrayInt::New());
+ MCAuto<DataArrayInt> newConn(DataArrayInt::New()),newConnI(DataArrayInt::New());
newConnI->alloc(nbOf3DCells+1,1);
int *newConnIPtr(newConnI->getPointer());
*newConnIPtr++=0;
}
if(delta==0)
return ;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConn=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConnI=DataArrayInt::New();
+ MCAuto<DataArrayInt> newConn=DataArrayInt::New();
+ MCAuto<DataArrayInt> 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();
DataArrayDouble *coords=0;
std::set<INTERP_KERNEL::NormalizedCellType> types;
checkFullyDefined();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret,connSafe,connISafe;
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsSafe;
+ MCAuto<DataArrayInt> ret,connSafe,connISafe;
+ MCAuto<DataArrayDouble> coordsSafe;
int meshDim=getMeshDimension();
switch(conversionType)
{
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<DataArrayInt> out0s(out0),outi0s(outi0);
+ //MCAuto<DataArrayInt> out0s(out0),outi0s(outi0);
//out0s=out0s->buildUnique(); out0s->sort(true);
}
#endif
*/
DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic1D0(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> bary=getBarycenterAndOwner();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(0,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(0,1);
+ MCAuto<DataArrayDouble> bary=computeCellCenterOfMass();
+ MCAuto<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(0,1);
+ MCAuto<DataArrayInt> newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0);
+ MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(0,1);
int nbOfCells=getNumberOfCells();
int nbOfNodes=getNumberOfNodes();
const int *cPtr=_nodal_connec->getConstPointer();
newConn->pushBackValsSilent(cPtr+icPtr[0],cPtr+icPtr[1]);
}
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp=bary->selectByTupleIdSafe(ret->begin(),ret->end());
+ MCAuto<DataArrayDouble> 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<INTERP_KERNEL::NormalizedCellType>& types) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(0,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(0,1);
+ MCAuto<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(0,1);
+ MCAuto<DataArrayInt> newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0);
+ MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(0,1);
//
const int *descPtr(desc->begin()),*descIPtr(descI->begin());
DataArrayInt *conn1D=0,*conn1DI=0;
std::set<INTERP_KERNEL::NormalizedCellType> types1D;
DataArrayDouble *coordsTmp=0;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=0;
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsTmpSafe(coordsTmp);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn1DSafe(conn1D),conn1DISafe(conn1DI);
+ MCAuto<DataArrayInt> ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=0;
+ MCAuto<DataArrayDouble> coordsTmpSafe(coordsTmp);
+ MCAuto<DataArrayInt> conn1DSafe(conn1D),conn1DISafe(conn1DI);
const int *c1DPtr=conn1D->begin();
const int *c1DIPtr=conn1DI->begin();
int nbOfCells=getNumberOfCells();
*/
DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic2D0(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> desc(DataArrayInt::New()),descI(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m1D=buildDescendingConnectivity(desc,descI,tmp2,tmp3); tmp2=0; tmp3=0;
+ MCAuto<DataArrayInt> desc(DataArrayInt::New()),descI(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New());
+ MCAuto<MEDCouplingUMesh> 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<INTERP_KERNEL::NormalizedCellType>& types) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> desc(DataArrayInt::New()),descI(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m1D=buildDescendingConnectivity(desc,descI,tmp2,tmp3); tmp2=0; tmp3=0;
+ MCAuto<DataArrayInt> desc(DataArrayInt::New()),descI(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New());
+ MCAuto<MEDCouplingUMesh> m1D=buildDescendingConnectivity(desc,descI,tmp2,tmp3); tmp2=0; tmp3=0;
//
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(0,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(0,1);
+ MCAuto<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(0,1);
+ MCAuto<DataArrayInt> newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0);
+ MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(0,1);
//
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> bary=getBarycenterAndOwner();
+ MCAuto<DataArrayDouble> bary=computeCellCenterOfMass();
const int *descPtr(desc->begin()),*descIPtr(descI->begin());
DataArrayInt *conn1D=0,*conn1DI=0;
std::set<INTERP_KERNEL::NormalizedCellType> types1D;
DataArrayDouble *coordsTmp=0;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=0;
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsTmpSafe(coordsTmp);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn1DSafe(conn1D),conn1DISafe(conn1DI);
+ MCAuto<DataArrayInt> ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=0;
+ MCAuto<DataArrayDouble> coordsTmpSafe(coordsTmp);
+ MCAuto<DataArrayInt> conn1DSafe(conn1D),conn1DISafe(conn1DI);
const int *c1DPtr=conn1D->begin();
const int *c1DIPtr=conn1DI->begin();
int nbOfCells=getNumberOfCells();
newConn->pushBackValsSilent(cPtr+icPtr[0],cPtr+icPtr[1]);
}
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp=bary->selectByTupleIdSafe(ret->begin(),ret->end());
+ MCAuto<DataArrayDouble> tmp=bary->selectByTupleIdSafe(ret->begin(),ret->end());
coords=DataArrayDouble::Aggregate(coordsTmpSafe,tmp); conn=newConn.retn(); connI=newConnI.retn();
return ret.retn();
}
*/
DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic3D0(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> desc(DataArrayInt::New()),descI(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m1D=explode3DMeshTo1D(desc,descI,tmp2,tmp3); tmp2=0; tmp3=0;
+ MCAuto<DataArrayInt> desc(DataArrayInt::New()),descI(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New());
+ MCAuto<MEDCouplingUMesh> 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<INTERP_KERNEL::NormalizedCellType>& types) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> desc2(DataArrayInt::New()),desc2I(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m2D=buildDescendingConnectivityGen<MinusOneSonsGeneratorBiQuadratic>(desc2,desc2I,tmp2,tmp3,MEDCouplingFastNbrer); tmp2=0; tmp3=0;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> desc1(DataArrayInt::New()),desc1I(DataArrayInt::New()),tmp4(DataArrayInt::New()),tmp5(DataArrayInt::New());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m1D=explode3DMeshTo1D(desc1,desc1I,tmp4,tmp5); tmp4=0; tmp5=0;
+ MCAuto<DataArrayInt> desc2(DataArrayInt::New()),desc2I(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New());
+ MCAuto<MEDCouplingUMesh> m2D=buildDescendingConnectivityGen<MinusOneSonsGeneratorBiQuadratic>(desc2,desc2I,tmp2,tmp3,MEDCouplingFastNbrer); tmp2=0; tmp3=0;
+ MCAuto<DataArrayInt> desc1(DataArrayInt::New()),desc1I(DataArrayInt::New()),tmp4(DataArrayInt::New()),tmp5(DataArrayInt::New());
+ MCAuto<MEDCouplingUMesh> m1D=explode3DMeshTo1D(desc1,desc1I,tmp4,tmp5); tmp4=0; tmp5=0;
//
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(0,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New(),ret2=DataArrayInt::New(); ret->alloc(0,1); ret2->alloc(0,1);
+ MCAuto<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(0,1);
+ MCAuto<DataArrayInt> newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0);
+ MCAuto<DataArrayInt> ret=DataArrayInt::New(),ret2=DataArrayInt::New(); ret->alloc(0,1); ret2->alloc(0,1);
//
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> bary=getBarycenterAndOwner();
+ MCAuto<DataArrayDouble> 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<INTERP_KERNEL::NormalizedCellType> types1D,types2D;
DataArrayDouble *coordsTmp=0,*coordsTmp2=0;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=DataArrayInt::New(); ret1D->alloc(0,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn1DSafe(conn1D),conn1DISafe(conn1DI);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsTmpSafe(coordsTmp);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret2D=m2D->convertLinearCellsToQuadratic2D1(conn2D,conn2DI,coordsTmp2,types2D); ret2D=DataArrayInt::New(); ret2D->alloc(0,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsTmp2Safe(coordsTmp2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn2DSafe(conn2D),conn2DISafe(conn2DI);
+ MCAuto<DataArrayInt> ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=DataArrayInt::New(); ret1D->alloc(0,1);
+ MCAuto<DataArrayInt> conn1DSafe(conn1D),conn1DISafe(conn1DI);
+ MCAuto<DataArrayDouble> coordsTmpSafe(coordsTmp);
+ MCAuto<DataArrayInt> ret2D=m2D->convertLinearCellsToQuadratic2D1(conn2D,conn2DI,coordsTmp2,types2D); ret2D=DataArrayInt::New(); ret2D->alloc(0,1);
+ MCAuto<DataArrayDouble> coordsTmp2Safe(coordsTmp2);
+ MCAuto<DataArrayInt> 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();
newConn->pushBackValsSilent(cPtr+icPtr[0],cPtr+icPtr[1]);
}
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> diffRet2D=ret2D->getDifferentValues();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2nRet2D=diffRet2D->invertArrayN2O2O2N(coordsTmp2Safe->getNumberOfTuples());
+ MCAuto<DataArrayInt> diffRet2D=ret2D->getDifferentValues();
+ MCAuto<DataArrayInt> o2nRet2D=diffRet2D->invertArrayN2O2O2N(coordsTmp2Safe->getNumberOfTuples());
coordsTmp2Safe=coordsTmp2Safe->selectByTupleId(diffRet2D->begin(),diffRet2D->end());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp=bary->selectByTupleIdSafe(ret->begin(),ret->end());
+ MCAuto<DataArrayDouble> tmp=bary->selectByTupleIdSafe(ret->begin(),ret->end());
std::vector<const DataArrayDouble *> v(3); v[0]=coordsTmpSafe; v[1]=coordsTmp2Safe; v[2]=tmp;
int *c=newConn->getPointer();
const int *cI(newConnI->begin());
if(getMeshDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexizePol0 : this policy is only available for mesh with meshdim == 2 !");
int nbOfCells=getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> 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<DataArrayInt> newConn=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConnI=DataArrayInt::New();
+ MCAuto<DataArrayInt> newConn=DataArrayInt::New();
+ MCAuto<DataArrayInt> 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;
if(getMeshDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexizePol0 : this policy is only available for mesh with meshdim == 2 !");
int nbOfCells=getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> 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<DataArrayInt> newConn=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConnI=DataArrayInt::New();
+ MCAuto<DataArrayInt> newConn=DataArrayInt::New();
+ MCAuto<DataArrayInt> 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;
if(getMeshDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexizePlanarFace5 : this policy is only available for mesh with meshdim == 3 !");
int nbOfCells=getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> 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<DataArrayInt> newConn=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConnI=DataArrayInt::New();
+ MCAuto<DataArrayInt> newConn=DataArrayInt::New();
+ MCAuto<DataArrayInt> 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;
if(getMeshDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexizePlanarFace6 : this policy is only available for mesh with meshdim == 3 !");
int nbOfCells=getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> 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<DataArrayInt> newConn=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConnI=DataArrayInt::New();
+ MCAuto<DataArrayInt> newConn=DataArrayInt::New();
+ MCAuto<DataArrayInt> 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;
double epsa=fabs(eps);
if(epsa<std::numeric_limits<double>::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<DataArrayInt> desc1(DataArrayInt::New()),descIndx1(DataArrayInt::New()),revDesc1(DataArrayInt::New()),revDescIndx1(DataArrayInt::New());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mDesc(buildDescendingConnectivity2(desc1,descIndx1,revDesc1,revDescIndx1));
+ MCAuto<DataArrayInt> desc1(DataArrayInt::New()),descIndx1(DataArrayInt::New()),revDesc1(DataArrayInt::New()),revDescIndx1(DataArrayInt::New());
+ MCAuto<MEDCouplingUMesh> 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());
const double *coords=_coords->getConstPointer();
std::vector<double> addCoo;
std::vector<int> newConn;//no direct DataArrayInt because interface with Geometric2D
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConnI(DataArrayInt::New());
+ MCAuto<DataArrayInt> newConnI(DataArrayInt::New());
newConnI->alloc(nbCells+1,1);
int *newConnIPtr=newConnI->getPointer();
*newConnIPtr=0;
return ;
_types=types;
DataArrayInt::SetArrayIn(newConnI,_nodal_connec_index);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConnArr=DataArrayInt::New();
+ MCAuto<DataArrayInt> newConnArr=DataArrayInt::New();
newConnArr->alloc((int)newConn.size(),1);
std::copy(newConn.begin(),newConn.end(),newConnArr->getPointer());
DataArrayInt::SetArrayIn(newConnArr,_nodal_connec);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> newCoords=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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);
connI[1]=newConnLgth;
}
//
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConn=DataArrayInt::New();
+ MCAuto<DataArrayInt> newConn=DataArrayInt::New();
newConn->alloc(newConnLgth,1);
int *work=newConn->getPointer();
for(int i=0;i<nbOfCells;i++)
int nbOfCells=getNumberOfCells();
if(nbOfCells<1)
return ;
- int initMeshLgth=getMeshLength();
+ int initMeshLgth=getNodalConnectivityArrayLen();
int *conn=_nodal_connec->getPointer();
int *index=_nodal_connec_index->getPointer();
int posOfCurCell=0;
int *conn=_nodal_connec->getPointer();
const int *connI=_nodal_connec_index->getConstPointer();
const double *coo=getCoords()->getConstPointer();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cells(DataArrayInt::New()); cells->alloc(0,1);
+ MCAuto<DataArrayInt> cells(DataArrayInt::New()); cells->alloc(0,1);
for(int i=0;i<nbOfCells;i++)
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[connI[i]]);
/*!
* This method is a faster method to correct orientation of all 3D cells in \a this.
* This method works only if \a this is a 3D mesh, that is to say a mesh with mesh dimension 3 and a space dimension 3.
- * This method makes the hypothesis that \a this a coherent that is to say MEDCouplingUMesh::checkCoherency1 should throw no exception.
+ * This method makes the hypothesis that \a this a coherent that is to say MEDCouplingUMesh::checkConsistency should throw no exception.
*
* \return a newly allocated int array with one components containing cell ids renumbered to fit the convention of MED (MED file and MEDCoupling)
* \sa MEDCouplingUMesh::orientCorrectlyPolyhedrons,
int *conn=_nodal_connec->getPointer();
const int *connI=_nodal_connec_index->getConstPointer();
const double *coordsPtr=_coords->getConstPointer();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(0,1);
+ MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(0,1);
for(int i=0;i<nbOfCells;i++)
{
INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)conn[connI[i]];
*/
MEDCouplingFieldDouble *MEDCouplingUMesh::getEdgeRatioField() const
{
- checkCoherency();
+ checkConsistencyLight();
int spaceDim=getSpaceDimension();
int meshDim=getMeshDimension();
if(spaceDim!=2 && spaceDim!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getEdgeRatioField : SpaceDimension must be equal to 2 or 3 !");
if(meshDim!=2 && meshDim!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getEdgeRatioField : MeshDimension must be equal to 2 or 3 !");
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+ MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
ret->setMesh(this);
int nbOfCells=getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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.
*/
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<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+ MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
ret->setMesh(this);
int nbOfCells=getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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.
*/
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<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+ MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
ret->setMesh(this);
int nbOfCells=getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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.
*/
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<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+ MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
ret->setMesh(this);
int nbOfCells=getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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.
*/
MEDCouplingFieldDouble *MEDCouplingUMesh::computeDiameterField() const
{
- checkCoherency();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME));
+ checkConsistencyLight();
+ MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME));
ret->setMesh(this);
std::set<INTERP_KERNEL::NormalizedCellType> types;
ComputeAllTypesInternal(types,_nodal_connec,_nodal_connec_index);
int spaceDim(getSpaceDimension()),nbCells(getNumberOfCells());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr(DataArrayDouble::New());
+ MCAuto<DataArrayDouble> arr(DataArrayDouble::New());
arr->alloc(nbCells,1);
for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=types.begin();it!=types.end();it++)
{
INTERP_KERNEL::AutoCppPtr<INTERP_KERNEL::DiameterCalculator> dc(INTERP_KERNEL::CellModel::GetCellModel(*it).buildInstanceOfDiameterCalulator(spaceDim));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellIds(giveCellsWithType(*it));
+ MCAuto<DataArrayInt> cellIds(giveCellsWithType(*it));
dc->computeForListOfCellIdsUMeshFrmt(cellIds->begin(),cellIds->end(),_nodal_connec_index->begin(),_nodal_connec->begin(),getCoords()->begin(),arr->getPointer());
}
ret->setArray(arr);
{
checkFullyDefined();
int spaceDim(getSpaceDimension()),nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim);
+ MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim);
double *bbox(ret->getPointer());
for(int i=0;i<nbOfCells*spaceDim;i++)
{
int spaceDim(getSpaceDimension()),mDim(getMeshDimension()),nbOfCells(getNumberOfCells());
if(spaceDim!=2 || mDim!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic : This method should be applied on mesh with mesh dimension equal to 2 and space dimension also equal to 2!");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim);
+ MCAuto<DataArrayDouble> 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());
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<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim);
+ MCAuto<DataArrayDouble> 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());
if(types.size()==_types.size())
return 0;
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nb,1);
int *retPtr=ret->getPointer();
const int *connI=_nodal_connec_index->getConstPointer();
//
DataArrayInt *castArr=0,*rankInsideCast=0,*castsPresent=0;
profile->splitByValueRange(&typeRangeVals[0],&typeRangeVals[0]+typeRangeVals.size(),castArr,rankInsideCast,castsPresent);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp0=castArr;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp1=rankInsideCast;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp2=castsPresent;
+ MCAuto<DataArrayInt> tmp0=castArr;
+ MCAuto<DataArrayInt> tmp1=rankInsideCast;
+ MCAuto<DataArrayInt> tmp2=castsPresent;
//
int nbOfCastsFinal=castsPresent->getNumberOfTuples();
code.resize(3*nbOfCastsFinal);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > idsInPflPerType2;
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > idsPerType2;
+ std::vector< MCAuto<DataArrayInt> > idsInPflPerType2;
+ std::vector< MCAuto<DataArrayInt> > idsPerType2;
for(int i=0;i<nbOfCastsFinal;i++)
{
int castId=castsPresent->getIJ(i,0);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp3=castArr->getIdsEqual(castId);
+ MCAuto<DataArrayInt> tmp3=castArr->findIdsEqual(castId);
idsInPflPerType2.push_back(tmp3);
code[3*i]=(int)types[castId];
code[3*i+1]=tmp3->getNumberOfTuples();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp4=rankInsideCast->selectByTupleId(tmp3->getConstPointer(),tmp3->getConstPointer()+tmp3->getNumberOfTuples());
- if(!tmp4->isIdentity2(typeRangeVals[castId+1]-typeRangeVals[castId]))
+ MCAuto<DataArrayInt> tmp4=rankInsideCast->selectByTupleId(tmp3->getConstPointer(),tmp3->getConstPointer()+tmp3->getNumberOfTuples());
+ if(!tmp4->isIota(typeRangeVals[castId+1]-typeRangeVals[castId]))
{
tmp4->copyStringInfoFrom(*profile);
idsPerType2.push_back(tmp4);
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<DataArrayInt> tmp0=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp1=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret1=buildDescendingConnectivity(desc,descIndx,tmp0,tmp1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret0=ret1->sortCellsInMEDFileFrmt();
+ MCAuto<DataArrayInt> tmp0=DataArrayInt::New();
+ MCAuto<DataArrayInt> tmp1=DataArrayInt::New();
+ MCAuto<MEDCouplingUMesh> ret1=buildDescendingConnectivity(desc,descIndx,tmp0,tmp1);
+ MCAuto<DataArrayInt> ret0=ret1->sortCellsInMEDFileFrmt();
desc->transformWithIndArr(ret0->getConstPointer(),ret0->getConstPointer()+ret0->getNbOfElems());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> tmp=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> tmp=MEDCouplingUMesh::New();
tmp->setConnectivity(tmp0,tmp1);
tmp->renumberCells(ret0->getConstPointer(),false);
revDesc=tmp->getNodalConnectivity();
DataArrayInt *MEDCouplingUMesh::sortCellsInMEDFileFrmt()
{
checkConnectivityFullyDefined();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=getRenumArrForMEDFileFrmt();
+ MCAuto<DataArrayInt> ret=getRenumArrForMEDFileFrmt();
renumberCells(ret->getConstPointer(),false);
return ret.retn();
}
int nbOfCells=getNumberOfCells();
const int *conn=_nodal_connec->getConstPointer();
const int *connI=_nodal_connec_index->getConstPointer();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmpa=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmpb=DataArrayInt::New();
+ MCAuto<DataArrayInt> tmpa=DataArrayInt::New();
+ MCAuto<DataArrayInt> tmpb=DataArrayInt::New();
tmpa->alloc(nbOfCells,1);
tmpb->alloc((int)std::distance(orderBg,orderEnd),1);
tmpb->fillWithZero();
DataArrayInt *MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const
{
DataArrayInt *nbPerType=0;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmpa=getLevArrPerCellTypes(orderBg,orderEnd,nbPerType);
+ MCAuto<DataArrayInt> tmpa=getLevArrPerCellTypes(orderBg,orderEnd,nbPerType);
nbPerType->decrRef();
return tmpa->buildPermArrPerLevel();
}
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<MEDCoupling1GTUMesh> ret=MEDCoupling1GTUMesh::New(getName(),typ);
+ MCAuto<MEDCoupling1GTUMesh> ret=MEDCoupling1GTUMesh::New(getName(),typ);
ret->setCoords(getCoords());
MEDCoupling1SGTUMesh *retC=dynamic_cast<MEDCoupling1SGTUMesh *>((MEDCoupling1GTUMesh*)ret);
if(retC)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> c=convertNodalConnectivityToStaticGeoTypeMesh();
+ MCAuto<DataArrayInt> c=convertNodalConnectivityToStaticGeoTypeMesh();
retC->setNodalConnectivity(c);
}
else
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertIntoSingleGeoTypeMesh : Internal error !");
DataArrayInt *c=0,*ci=0;
convertNodalConnectivityToDynamicGeoTypeMesh(c,ci);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cs(c),cis(ci);
+ MCAuto<DataArrayInt> cs(c),cis(ci);
retD->setNodalConnectivity(cs,cis);
}
return ret.retn();
int nbCells=getNumberOfCells();
int typi=(int)typ;
int nbNodesPerCell=(int)cm.getNumberOfNodes();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> connOut=DataArrayInt::New(); connOut->alloc(nbCells*nbNodesPerCell,1);
+ MCAuto<DataArrayInt> 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();
*/
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<nbCells)
throw INTERP_KERNEL::Exception(msg0);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> c(DataArrayInt::New()),ci(DataArrayInt::New());
+ MCAuto<DataArrayInt> 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());
const DataArrayDouble *refCoo=ms2[0]->getCoords();
int meshDim=ms2[0]->getMeshDimension();
std::vector<const MEDCouplingUMesh *> m1ssm;
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> > m1ssmAuto;
+ std::vector< MCAuto<MEDCouplingUMesh> > m1ssmAuto;
//
std::vector<const MEDCouplingUMesh *> m1ssmSingle;
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> > m1ssmSingleAuto;
+ std::vector< MCAuto<MEDCouplingUMesh> > m1ssmSingleAuto;
int fake=0,rk=0;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret1(DataArrayInt::New()),ret2(DataArrayInt::New());
+ MCAuto<DataArrayInt> ret1(DataArrayInt::New()),ret2(DataArrayInt::New());
ret1->alloc(0,1); ret2->alloc(0,1);
for(std::vector<const MEDCouplingUMesh *>::const_iterator it=ms2.begin();it!=ms2.end();it++,rk++)
{
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords : meshes are not shared by a single coordinates coords !");
std::vector<MEDCouplingUMesh *> sp=(*it)->splitByType();
std::copy(sp.begin(),sp.end(),std::back_insert_iterator< std::vector<const MEDCouplingUMesh *> >(m1ssm));
- std::copy(sp.begin(),sp.end(),std::back_insert_iterator< std::vector<MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> > >(m1ssmAuto));
+ std::copy(sp.begin(),sp.end(),std::back_insert_iterator< std::vector<MCAuto<MEDCouplingUMesh> > >(m1ssmAuto));
for(std::vector<MEDCouplingUMesh *>::const_iterator it2=sp.begin();it2!=sp.end();it2++)
{
MEDCouplingUMesh *singleCell=static_cast<MEDCouplingUMesh *>((*it2)->buildPartOfMySelf(&fake,&fake+1,true));
ret1->pushBackSilent((*it2)->getNumberOfCells()); ret2->pushBackSilent(rk);
}
}
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m1ssmSingle2=MEDCouplingUMesh::MergeUMeshesOnSameCoords(m1ssmSingle);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> renum=m1ssmSingle2->sortCellsInMEDFileFrmt();
+ MCAuto<MEDCouplingUMesh> m1ssmSingle2=MEDCouplingUMesh::MergeUMeshesOnSameCoords(m1ssmSingle);
+ MCAuto<DataArrayInt> renum=m1ssmSingle2->sortCellsInMEDFileFrmt();
std::vector<const MEDCouplingUMesh *> m1ssmfinal(m1ssm.size());
for(std::size_t i=0;i<m1ssm.size();i++)
m1ssmfinal[renum->getIJ(i,0)]=m1ssm[i];
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret0=MEDCouplingUMesh::MergeUMeshesOnSameCoords(m1ssmfinal);
+ MCAuto<MEDCouplingUMesh> ret0=MEDCouplingUMesh::MergeUMeshesOnSameCoords(m1ssmfinal);
szOfCellGrpOfSameType=ret1->renumber(renum->getConstPointer());
idInMsOfCellGrpOfSameType=ret2->renumber(renum->getConstPointer());
return ret0.retn();
checkFullyDefined();
const int *conn=_nodal_connec->getConstPointer();
const int *connIndex=_nodal_connec_index->getConstPointer();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
+ MCAuto<DataArrayInt> 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);
oss << ". It should be in [0," << szOfType << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> idsTokeep=DataArrayInt::New(); idsTokeep->alloc(sz+(int)std::distance(idsPerGeoTypeBg,idsPerGeoTypeEnd),1);
+ MCAuto<DataArrayInt> 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<nOfTypesInThis;i++)
idsPtr=std::transform(idsPerGeoTypeBg,idsPerGeoTypeEnd,idsPtr,std::bind2nd(std::plus<int>(),offset));
offset+=code[3*i+1];
}
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=static_cast<MEDCouplingUMesh *>(buildPartOfMySelf(idsTokeep->begin(),idsTokeep->end(),true));
+ MCAuto<MEDCouplingUMesh> ret=static_cast<MEDCouplingUMesh *>(buildPartOfMySelf(idsTokeep->begin(),idsTokeep->end(),true));
ret->copyTinyInfoFrom(this);
return ret.retn();
}
* \throw If the nodal connectivity of cells is not defined.
* \sa MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell
*/
-DataArrayDouble *MEDCouplingUMesh::getBarycenterAndOwner() const
+DataArrayDouble *MEDCouplingUMesh::computeCellCenterOfMass() const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
int spaceDim=getSpaceDimension();
int nbOfCells=getNumberOfCells();
ret->alloc(nbOfCells,spaceDim);
/*!
* 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<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
int spaceDim=getSpaceDimension();
int nbOfCells=getNumberOfCells();
int nbOfNodes=getNumberOfNodes();
*/
DataArrayDouble *MEDCouplingUMesh::computePlaneEquationOf3DFaces() const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret(DataArrayDouble::New());
+ MCAuto<DataArrayDouble> 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 !");
if(!da)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Build0DMeshFromCoords : instance of DataArrayDouble must be not null !");
da->checkAllocated();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(da->getName(),0);
+ MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(da->getName(),0);
ret->setCoords(da);
int nbOfTuples=da->getNumberOfTuples();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> c=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cI=DataArrayInt::New();
+ MCAuto<DataArrayInt> c=DataArrayInt::New();
+ MCAuto<DataArrayInt> cI=DataArrayInt::New();
c->alloc(2*nbOfTuples,1);
cI->alloc(nbOfTuples+1,1);
int *cp=c->getPointer();
std::ostringstream oss; oss << "MEDCouplingUMesh::MergeUMeshes : item #" << ii << " in input array of size "<< sz << " is empty !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> > bb(sz);
+ std::vector< MCAuto<MEDCouplingUMesh> > bb(sz);
std::vector< const MEDCouplingUMesh * > aa(sz);
int spaceDim=-3;
for(std::size_t i=0;i<sz && spaceDim==-3;i++)
std::vector<const MEDCouplingUMesh *>::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<const MEDCouplingPointSet *> aps(a.size());
std::copy(a.begin(),a.end(),aps.begin());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> pts=MergeNodesArray(aps);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MEDCouplingUMesh::New("merge",meshDim);
+ MCAuto<DataArrayDouble> pts=MergeNodesArray(aps);
+ MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New("merge",meshDim);
ret->setCoords(pts);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> c=DataArrayInt::New();
+ MCAuto<DataArrayInt> c=DataArrayInt::New();
c->alloc(meshLgth,1);
int *cPtr=c->getPointer();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cI=DataArrayInt::New();
+ MCAuto<DataArrayInt> cI=DataArrayInt::New();
cI->alloc(nbOfCells+1,1);
int *cIPtr=cI->getPointer();
*cIPtr++=0;
throw INTERP_KERNEL::Exception("meshes does not share the same coords ! Try using tryToShareSameCoords method !");
if(meshDim!=(*iter)->getMeshDimension())
throw INTERP_KERNEL::Exception("Mesh dimensions mismatches, FuseUMeshesOnSameCoords impossible !");
- meshLgth+=(*iter)->getMeshLength();
+ meshLgth+=(*iter)->getNodalConnectivityArrayLen();
meshIndexLgth+=(*iter)->getNumberOfCells();
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nodal=DataArrayInt::New();
+ MCAuto<DataArrayInt> nodal=DataArrayInt::New();
nodal->alloc(meshLgth,1);
int *nodalPtr=nodal->getPointer();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nodalIndex=DataArrayInt::New();
+ MCAuto<DataArrayInt> nodalIndex=DataArrayInt::New();
nodalIndex->alloc(meshIndexLgth+1,1);
int *nodalIndexPtr=nodalIndex->getPointer();
int offset=0;
const int *nod=(*iter)->getNodalConnectivity()->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<int>(),offset));
MEDCouplingUMesh *MEDCouplingUMesh::FuseUMeshesOnSameCoords(const std::vector<const MEDCouplingUMesh *>& meshes, int compType, std::vector<DataArrayInt *>& corr)
{
//All checks are delegated to MergeUMeshesOnSameCoords
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MergeUMeshesOnSameCoords(meshes);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n=ret->zipConnectivityTraducer(compType);
+ MCAuto<MEDCouplingUMesh> ret=MergeUMeshesOnSameCoords(meshes);
+ MCAuto<DataArrayInt> o2n=ret->zipConnectivityTraducer(compType);
corr.resize(meshes.size());
std::size_t nbOfMeshes=meshes.size();
int offset=0;
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> res=DataArrayDouble::Aggregate(coords);
+ MCAuto<DataArrayDouble> res=DataArrayDouble::Aggregate(coords);
std::vector<MEDCouplingUMesh *>::const_iterator it=meshes.begin();
int offset=(*it)->getNumberOfNodes();
(*it++)->setCoords(res);
//
DataArrayInt *comm,*commI;
coo->findCommonTuples(eps,-1,comm,commI);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp1(comm),tmp2(commI);
+ MCAuto<DataArrayInt> tmp1(comm),tmp2(commI);
int oldNbOfNodes=coo->getNumberOfTuples();
int newNbOfNodes;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n=DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(oldNbOfNodes,comm->begin(),commI->begin(),commI->end(),newNbOfNodes);
+ MCAuto<DataArrayInt> o2n=DataArrayInt::ConvertIndexArrayToO2N(oldNbOfNodes,comm->begin(),commI->begin(),commI->end(),newNbOfNodes);
if(oldNbOfNodes==newNbOfNodes)
return ;
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> newCoords=coo->renumberAndReduce(o2n->getConstPointer(),newNbOfNodes);
+ MCAuto<DataArrayDouble> newCoords=coo->renumberAndReduce(o2n->getConstPointer(),newNbOfNodes);
for(std::vector<MEDCouplingUMesh *>::const_iterator it=meshes.begin();it!=meshes.end();it++)
{
(*it)->renumberNodesInConn(o2n->getConstPointer());
{
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];
{
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<int,INTERP_KERNEL::ALL_C_MODE>(begin,4,coords,vec0);
const double *pt0=coords+3*begin[0],*pt1=coords+3*begin[4];
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<DataArrayDouble> v=DataArrayDouble::New(); v->alloc(nbFaces,3);
+ MCAuto<DataArrayDouble> v=DataArrayDouble::New(); v->alloc(nbFaces,3);
double *vPtr=v->getPointer();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> p=DataArrayDouble::New(); p->alloc(nbFaces,1);
+ MCAuto<DataArrayDouble> p=DataArrayDouble::New(); p->alloc(nbFaces,1);
double *pPtr=p->getPointer();
const int *stFaceConn=begin+1;
for(int i=0;i<nbFaces;i++,vPtr+=3,pPtr++)
pPtr=p->getPointer(); vPtr=v->getPointer();
DataArrayInt *comm1=0,*commI1=0;
v->findCommonTuples(eps,-1,comm1,commI1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> comm1Auto(comm1),commI1Auto(commI1);
+ MCAuto<DataArrayInt> 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<MEDCouplingUMesh> mm=MEDCouplingUMesh::New("",3);
+ MCAuto<MEDCouplingUMesh> mm=MEDCouplingUMesh::New("",3);
mm->setCoords(const_cast<DataArrayDouble *>(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<nbOfGrps1;i++)
{
int vecId=comm1Ptr[commI1Ptr[i]];
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmpgrp2=p->selectByTupleId(comm1Ptr+commI1Ptr[i],comm1Ptr+commI1Ptr[i+1]);
+ MCAuto<DataArrayDouble> tmpgrp2=p->selectByTupleId(comm1Ptr+commI1Ptr[i],comm1Ptr+commI1Ptr[i+1]);
DataArrayInt *comm2=0,*commI2=0;
tmpgrp2->findCommonTuples(eps,-1,comm2,commI2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> comm2Auto(comm2),commI2Auto(commI2);
+ MCAuto<DataArrayInt> comm2Auto(comm2),commI2Auto(commI2);
const int *comm2Ptr=comm2->getConstPointer();
const int *commI2Ptr=commI2->getConstPointer();
int nbOfGrps2=commI2Auto->getNumberOfTuples()-1;
else
{
int pointId=comm1Ptr[commI1Ptr[i]+comm2Ptr[commI2Ptr[j]]];
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids2=comm2->selectByTupleId2(commI2Ptr[j],commI2Ptr[j+1],1);
+ MCAuto<DataArrayInt> 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<MEDCouplingUMesh> mm2=mm->buildDescendingConnectivity(tmp0,tmp1,tmp2,tmp3); tmp0->decrRef(); tmp1->decrRef(); tmp2->decrRef(); tmp3->decrRef();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mm3=static_cast<MEDCouplingUMesh *>(mm2->buildPartOfMySelf(ids2->begin(),ids2->end(),true));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> idsNodeTmp=mm3->zipCoordsTraducer();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> idsNode=idsNodeTmp->invertArrayO2N2N2O(mm3->getNumberOfNodes());
+ MCAuto<MEDCouplingUMesh> mm2=mm->buildDescendingConnectivity(tmp0,tmp1,tmp2,tmp3); tmp0->decrRef(); tmp1->decrRef(); tmp2->decrRef(); tmp3->decrRef();
+ MCAuto<MEDCouplingUMesh> mm3=static_cast<MEDCouplingUMesh *>(mm2->buildPartOfMySelf(ids2->begin(),ids2->end(),true));
+ MCAuto<DataArrayInt> idsNodeTmp=mm3->zipCoordsTraducer();
+ MCAuto<DataArrayInt> 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.;
mm3->rotate(center,vec,angle);
}
mm3->changeSpaceDimension(2);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mm4=mm3->buildSpreadZonesWithPoly();
+ MCAuto<MEDCouplingUMesh> mm4=mm3->buildSpreadZonesWithPoly();
const int *conn4=mm4->getNodalConnectivity()->getConstPointer();
const int *connI4=mm4->getNodalConnectivityIndex()->getConstPointer();
int nbOfCells=mm4->getNumberOfCells();
{
int nbOfNodesExpected(skin->getNumberOfNodes());
const int *n2oPtr(n2o->getConstPointer());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> revNodal(DataArrayInt::New()),revNodalI(DataArrayInt::New());
+ MCAuto<DataArrayInt> 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<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(nbOfNodesExpected+1,1);
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(nbOfNodesExpected+1,1);
int *work(ret->getPointer()); *work++=INTERP_KERNEL::NORM_POLYGON;
if(nbOfNodesExpected<1)
return ret.retn();
int nbOfNodesExpected(skin->getNumberOfNodes());
int nbOfTurn(nbOfNodesExpected/2);
const int *n2oPtr(n2o->getConstPointer());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> revNodal(DataArrayInt::New()),revNodalI(DataArrayInt::New());
+ MCAuto<DataArrayInt> 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<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(nbOfNodesExpected+1,1);
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(nbOfNodesExpected+1,1);
int *work(ret->getPointer()); *work++=INTERP_KERNEL::NORM_QPOLYG;
if(nbOfNodesExpected<1)
return ret.retn();
{
if(getMeshDimension()!=2 || getSpaceDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildUnionOf2DMesh : meshdimension, spacedimension must be equal to 2 !");
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> skin(computeSkin());
+ MCAuto<MEDCouplingUMesh> skin(computeSkin());
int oldNbOfNodes(skin->getNumberOfNodes());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n(skin->zipCoordsTraducer());
+ MCAuto<DataArrayInt> o2n(skin->zipCoordsTraducer());
int nbOfNodesExpected(skin->getNumberOfNodes());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> n2o(o2n->invertArrayO2N2N2O(oldNbOfNodes));
+ MCAuto<DataArrayInt> n2o(o2n->invertArrayO2N2N2O(oldNbOfNodes));
int nbCells(skin->getNumberOfCells());
if(nbCells==nbOfNodesExpected)
return buildUnionOf2DMeshLinear(skin,n2o);
{
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildUnionOf3DMesh : meshdimension, spacedimension must be equal to 2 !");
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m=computeSkin();
+ MCAuto<MEDCouplingUMesh> m=computeSkin();
const int *conn=m->getNodalConnectivity()->getConstPointer();
const int *connI=m->getNodalConnectivityIndex()->getConstPointer();
int nbOfCells=m->getNumberOfCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(m->getNodalConnectivity()->getNumberOfTuples(),1);
+ MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(m->getNodalConnectivity()->getNumberOfTuples(),1);
int *work=ret->getPointer(); *work++=INTERP_KERNEL::NORM_POLYHED;
if(nbOfCells<1)
return ret.retn();
_coords->writeVTK(ofs,8,"Points",byteData);
else
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coo=_coords->changeNbOfComponents(3,0.);
+ MCAuto<DataArrayDouble> coo=_coords->changeNbOfComponents(3,0.);
coo->writeVTK(ofs,8,"Points",byteData);
}
ofs << " </Points>\n";
ofs << " <Cells>\n";
const int *cPtr=_nodal_connec->getConstPointer();
const int *cIPtr=_nodal_connec_index->getConstPointer();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> faceoffsets=DataArrayInt::New(); faceoffsets->alloc(nbOfCells,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> types=DataArrayInt::New(); types->alloc(nbOfCells,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> offsets=DataArrayInt::New(); offsets->alloc(nbOfCells,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> connectivity=DataArrayInt::New(); connectivity->alloc(_nodal_connec->getNumberOfTuples()-nbOfCells,1);
+ MCAuto<DataArrayInt> faceoffsets=DataArrayInt::New(); faceoffsets->alloc(nbOfCells,1);
+ MCAuto<DataArrayInt> types=DataArrayInt::New(); types->alloc(nbOfCells,1);
+ MCAuto<DataArrayInt> offsets=DataArrayInt::New(); offsets->alloc(nbOfCells,1);
+ MCAuto<DataArrayInt> 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;i<nbOfCells;i++,w1++,w2++,w3++)
{//presence of Polyhedra
connectivity->reAlloc(szConn);
faceoffsets->writeVTK(ofs,8,"Int32","faceoffsets",byteData);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> faces=DataArrayInt::New(); faces->alloc(szFaceOffsets,1);
+ MCAuto<DataArrayInt> faces=DataArrayInt::New(); faces->alloc(szFaceOffsets,1);
w1=faces->getPointer();
for(int i=0;i<nbOfCells;i++)
if((INTERP_KERNEL::NormalizedCellType)cPtr[cIPtr[i]]==INTERP_KERNEL::NORM_POLYHED)
m1Desc,desc1,descIndx1,revDesc1,revDescIndx1,
addCoo, m2Desc,desc2,descIndx2,revDesc2,revDescIndx2);
revDesc1->decrRef(); revDescIndx1->decrRef(); revDesc2->decrRef(); revDescIndx2->decrRef();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> dd1(desc1),dd2(descIndx1),dd3(desc2),dd4(descIndx2);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> dd5(m1Desc),dd6(m2Desc);
+ MCAuto<DataArrayInt> dd1(desc1),dd2(descIndx1),dd3(desc2),dd4(descIndx2);
+ MCAuto<MEDCouplingUMesh> dd5(m1Desc),dd6(m2Desc);
// Step 2: re-order newly created nodes according to the ordering found in m2
std::vector< std::vector<int> > intersectEdge2;
/* outputs -> */addCoordsQuadratic,cr,crI,cNb1,cNb2);
// Step 4: Prepare final result:
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> addCooDa(DataArrayDouble::New());
+ MCAuto<DataArrayDouble> addCooDa(DataArrayDouble::New());
addCooDa->alloc((int)(addCoo.size())/2,2);
std::copy(addCoo.begin(),addCoo.end(),addCooDa->getPointer());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> addCoordsQuadraticDa(DataArrayDouble::New());
+ MCAuto<DataArrayDouble> addCoordsQuadraticDa(DataArrayDouble::New());
addCoordsQuadraticDa->alloc((int)(addCoordsQuadratic.size())/2,2);
std::copy(addCoordsQuadratic.begin(),addCoordsQuadratic.end(),addCoordsQuadraticDa->getPointer());
std::vector<const DataArrayDouble *> coordss(4);
coordss[0]=m1->getCoords(); coordss[1]=m2->getCoords(); coordss[2]=addCooDa; coordss[3]=addCoordsQuadraticDa;
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coo(DataArrayDouble::Aggregate(coordss));
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret(MEDCouplingUMesh::New("Intersect2D",2));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(DataArrayInt::New()); conn->alloc((int)cr.size(),1); std::copy(cr.begin(),cr.end(),conn->getPointer());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> connI(DataArrayInt::New()); connI->alloc((int)crI.size(),1); std::copy(crI.begin(),crI.end(),connI->getPointer());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> c1(DataArrayInt::New()); c1->alloc((int)cNb1.size(),1); std::copy(cNb1.begin(),cNb1.end(),c1->getPointer());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> c2(DataArrayInt::New()); c2->alloc((int)cNb2.size(),1); std::copy(cNb2.begin(),cNb2.end(),c2->getPointer());
+ MCAuto<DataArrayDouble> coo(DataArrayDouble::Aggregate(coordss));
+ MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::New("Intersect2D",2));
+ MCAuto<DataArrayInt> conn(DataArrayInt::New()); conn->alloc((int)cr.size(),1); std::copy(cr.begin(),cr.end(),conn->getPointer());
+ MCAuto<DataArrayInt> connI(DataArrayInt::New()); connI->alloc((int)crI.size(),1); std::copy(crI.begin(),crI.end(),connI->getPointer());
+ MCAuto<DataArrayInt> c1(DataArrayInt::New()); c1->alloc((int)cNb1.size(),1); std::copy(cNb1.begin(),cNb1.end(),c1->getPointer());
+ MCAuto<DataArrayInt> 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();
}
MEDCouplingUMesh *BuildMesh1DCutFrom(const MEDCouplingUMesh *mesh1D, const std::vector< std::vector<int> >& intersectEdge2, const DataArrayDouble *coords1, const std::vector<double>& addCoo, const std::map<int,int>& mergedNodes, const std::vector< std::vector<int> >& colinear2, const std::vector< std::vector<int> >& intersectEdge1,
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& idsInRetColinear, MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& idsInMesh1DForIdsInRetColinear)
+ MCAuto<DataArrayInt>& idsInRetColinear, MCAuto<DataArrayInt>& idsInMesh1DForIdsInRetColinear)
{
idsInRetColinear=DataArrayInt::New(); idsInRetColinear->alloc(0,1);
idsInMesh1DForIdsInRetColinear=DataArrayInt::New(); idsInMesh1DForIdsInRetColinear->alloc(0,1);
int offset2(offset1+coo2->getNumberOfTuples());
int offset3(offset2+addCoo.size()/2);
std::vector<double> addCooQuad;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cOut(DataArrayInt::New()),ciOut(DataArrayInt::New()); cOut->alloc(0,1); ciOut->alloc(1,1); ciOut->setIJ(0,0,0);
+ MCAuto<DataArrayInt> 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<nCells;i++)
{
- std::map<MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Node>,int> m;
+ std::map<MCAuto<INTERP_KERNEL::Node>,int> m;
INTERP_KERNEL::Edge *e(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)c[ci[i]],c+ci[i]+1,coo2Ptr,m));
const std::vector<int>& subEdges(intersectEdge2[i]);
int nbSubEdge(subEdges.size()/2);
for(int j=0;j<nbSubEdge;j++,kk++)
{
- MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Node> n1(MEDCouplingUMeshBuildQPNode(subEdges[2*j],coords1->begin(),offset1,coo2Ptr,offset2,addCoo)),n2(MEDCouplingUMeshBuildQPNode(subEdges[2*j+1],coords1->begin(),offset1,coo2Ptr,offset2,addCoo));
- MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> e2(e->buildEdgeLyingOnMe(n1,n2));
+ MCAuto<INTERP_KERNEL::Node> n1(MEDCouplingUMeshBuildQPNode(subEdges[2*j],coords1->begin(),offset1,coo2Ptr,offset2,addCoo)),n2(MEDCouplingUMeshBuildQPNode(subEdges[2*j+1],coords1->begin(),offset1,coo2Ptr,offset2,addCoo));
+ MCAuto<INTERP_KERNEL::Edge> e2(e->buildEdgeLyingOnMe(n1,n2));
INTERP_KERNEL::Edge *e2Ptr(e2);
std::map<int,int>::const_iterator itm;
if(dynamic_cast<INTERP_KERNEL::EdgeArcCircle *>(e2Ptr))
}
e->decrRef();
}
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret(MEDCouplingUMesh::New(mesh1D->getName(),1));
+ MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::New(mesh1D->getName(),1));
ret->setConnectivity(cOut,ciOut,true);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr3(DataArrayDouble::New());
+ MCAuto<DataArrayDouble> arr3(DataArrayDouble::New());
arr3->useArray(&addCoo[0],false,C_DEALLOC,(int)addCoo.size()/2,2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr4(DataArrayDouble::New()); arr4->useArray(&addCooQuad[0],false,C_DEALLOC,(int)addCooQuad.size()/2,2);
+ MCAuto<DataArrayDouble> arr4(DataArrayDouble::New()); arr4->useArray(&addCooQuad[0],false,C_DEALLOC,(int)addCooQuad.size()/2,2);
std::vector<const DataArrayDouble *> coordss(4);
coordss[0]=coords1; coordss[1]=mesh1D->getCoords(); coordss[2]=arr3; coordss[3]=arr4;
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr(DataArrayDouble::Aggregate(coordss));
+ MCAuto<DataArrayDouble> arr(DataArrayDouble::Aggregate(coordss));
ret->setCoords(arr);
return ret.retn();
}
if(nb%2!=0)
throw INTERP_KERNEL::Exception("BuildRefined2DCellLinear : internal error 1 !");
std::size_t nbOfEdgesOf2DCellSplit(nb/2);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret(MEDCouplingUMesh::New("",2));
+ MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::New("",2));
ret->setCoords(coords);
ret->allocateCells(1);
std::vector<int> connOut(nbOfEdgesOf2DCellSplit);
INTERP_KERNEL::AutoPtr<int> tmpPtr(new int[ci[cellIdInMesh2D+1]-ci[cellIdInMesh2D]]);
std::vector<int> allEdges,centers;
const double *coordsPtr(coords->begin());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> addCoo(DataArrayDouble::New()); addCoo->alloc(0,1);
+ MCAuto<DataArrayDouble> addCoo(DataArrayDouble::New()); addCoo->alloc(0,1);
int offset(coords->getNumberOfTuples());
for(const int *it2(descBg);it2!=descEnd;it2++,ii++)
{
else
{//the current edge has been subsplit -> create corresponding centers.
std::size_t nbOfCentersToAppend(edge1.size()/2);
- std::map< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Node>,int> m;
- MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> ee(MEDCouplingUMeshBuildQPFromEdge2(typeOfSon,tmpPtr,coordsPtr,m));
+ std::map< MCAuto<INTERP_KERNEL::Node>,int> m;
+ MCAuto<INTERP_KERNEL::Edge> ee(MEDCouplingUMeshBuildQPFromEdge2(typeOfSon,tmpPtr,coordsPtr,m));
std::vector<int>::const_iterator it3(allEdges.end()-edge1.size());
for(std::size_t k=0;k<nbOfCentersToAppend;k++)
{
if(nb%2!=0)
throw INTERP_KERNEL::Exception("BuildRefined2DCellQuadratic : internal error 2 !");
std::size_t nbOfEdgesOf2DCellSplit(nb/2);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret(MEDCouplingUMesh::New("",2));
+ MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::New("",2));
if(addCoo->empty())
ret->setCoords(coords);
else
return BuildRefined2DCellQuadratic(coords,mesh2D,cellIdInMesh2D,descBg,descEnd,intersectEdge1);
}
-void AddCellInMesh2D(MEDCouplingUMesh *mesh2D, const std::vector<int>& conn, const std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> >& edges)
+void AddCellInMesh2D(MEDCouplingUMesh *mesh2D, const std::vector<int>& conn, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& edges)
{
bool isQuad(false);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> >::const_iterator it=edges.begin();it!=edges.end();it++)
+ for(std::vector< MCAuto<INTERP_KERNEL::Edge> >::const_iterator it=edges.begin();it!=edges.end();it++)
{
const INTERP_KERNEL::Edge *ee(*it);
if(dynamic_cast<const INTERP_KERNEL::EdgeArcCircle *>(ee))
* 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<int>& edge1Bis, const std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> >& edge1BisPtr,
- std::vector< std::vector<int> >& out0, std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> > >& out1)
+void BuildMesh2DCutInternal2(const MEDCouplingUMesh *splitMesh1D, const std::vector<int>& edge1Bis, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& edge1BisPtr,
+ std::vector< std::vector<int> >& out0, std::vector< std::vector< MCAuto<INTERP_KERNEL::Edge> > >& out1)
{
std::size_t nb(edge1Bis.size()/2);
std::size_t nbOfEdgesOf2DCellSplit(nb/2);
out0.resize(1); out1.resize(1);
std::vector<int>& connOut(out0[0]);
connOut.resize(nbOfEdgesOf2DCellSplit);
- std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> >& edgesPtr(out1[0]);
+ std::vector< MCAuto<INTERP_KERNEL::Edge> >& edgesPtr(out1[0]);
edgesPtr.resize(nbOfEdgesOf2DCellSplit);
for(std::size_t kk=0;kk<nbOfEdgesOf2DCellSplit;kk++)
{
out0.resize(2); out1.resize(2);
std::vector<int>& connOutLeft(out0[0]);
std::vector<int>& connOutRight(out0[1]);//connOutLeft should end with edge1Bis[2*ii] and connOutRight should end with edge1Bis[2*jj+1]
- std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> >& eleft(out1[0]);
- std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> >& eright(out1[1]);
+ std::vector< MCAuto<INTERP_KERNEL::Edge> >& eleft(out1[0]);
+ std::vector< MCAuto<INTERP_KERNEL::Edge> >& eright(out1[1]);
for(std::size_t k=ii;k<jj+1;k++)
{ connOutLeft.push_back(edge1Bis[2*k+1]); eleft.push_back(edge1BisPtr[2*k+1]); }
- std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> > ees(iEnd);
+ std::vector< MCAuto<INTERP_KERNEL::Edge> > ees(iEnd);
for(int ik=0;ik<iEnd;ik++)
{
- std::map< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Node>,int> m;
- MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> ee(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)cSplitPtr[ciSplitPtr[ik]],cSplitPtr+ciSplitPtr[ik]+1,splitMesh1D->getCoords()->begin(),m));
+ std::map< MCAuto<INTERP_KERNEL::Node>,int> m;
+ MCAuto<INTERP_KERNEL::Edge> 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--)
{
public:
CellInfo() { }
- CellInfo(const std::vector<int>& edges, const std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> >& edgesPtr);
+ CellInfo(const std::vector<int>& edges, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& edgesPtr);
public:
std::vector<int> _edges;
- std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> > _edges_ptr;
+ std::vector< MCAuto<INTERP_KERNEL::Edge> > _edges_ptr;
};
-CellInfo::CellInfo(const std::vector<int>& edges, const std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> >& edgesPtr)
+CellInfo::CellInfo(const std::vector<int>& edges, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& edgesPtr)
{
std::size_t nbe(edges.size());
- std::vector<int> edges2(2*nbe); std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> > edgesPtr2(2*nbe);
+ std::vector<int> edges2(2*nbe); std::vector< MCAuto<INTERP_KERNEL::Edge> > edgesPtr2(2*nbe);
for(std::size_t i=0;i<nbe;i++)
{
edges2[2*i]=edges[i]; edges2[2*i+1]=edges[(i+1)%nbe];
class EdgeInfo
{
public:
- EdgeInfo(int istart, int iend, const MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh>& mesh):_istart(istart),_iend(iend),_mesh(mesh),_left(-7),_right(-7) { }
- EdgeInfo(int istart, int iend, int pos, const MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge>& edge):_istart(istart),_iend(iend),_edge(edge),_left(pos),_right(pos+1) { }
+ EdgeInfo(int istart, int iend, const MCAuto<MEDCouplingUMesh>& mesh):_istart(istart),_iend(iend),_mesh(mesh),_left(-7),_right(-7) { }
+ EdgeInfo(int istart, int iend, int pos, const MCAuto<INTERP_KERNEL::Edge>& 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<INTERP_KERNEL::Edge> >& newLeft, const std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> >& newRight);
+ void somethingHappendAt(int pos, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& newLeft, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& newRight);
void feedEdgeInfoAt(double eps, const MEDCouplingUMesh *mesh2D, int offset, int neighbors[2]) const;
private:
int _istart;
int _iend;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> _mesh;
- MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> _edge;
+ MCAuto<MEDCouplingUMesh> _mesh;
+ MCAuto<INTERP_KERNEL::Edge> _edge;
int _left;
int _right;
};
-void EdgeInfo::somethingHappendAt(int pos, const std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> >& newLeft, const std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> >& newRight)
+void EdgeInfo::somethingHappendAt(int pos, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& newLeft, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& newRight)
{
const MEDCouplingUMesh *mesh(_mesh);
if(mesh)
}
else
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> barys(mesh->getBarycenterAndOwner());
+ MCAuto<DataArrayDouble> barys(mesh->computeCellCenterOfMass());
int cellId(mesh2D->getCellContainingPoint(barys->begin(),eps));
if(cellId==-1)
throw INTERP_KERNEL::Exception("EdgeInfo::feedEdgeInfoAt : internal error !");
class VectorOfCellInfo
{
public:
- VectorOfCellInfo(const std::vector<int>& edges, const std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> >& edgesPtr);
+ VectorOfCellInfo(const std::vector<int>& edges, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& edgesPtr);
std::size_t size() const { return _pool.size(); }
int getPositionOf(double eps, const MEDCouplingUMesh *mesh) const;
- void setMeshAt(int pos, const MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh>& mesh, int istart, int iend, const MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh>& mesh1DInCase, const std::vector< std::vector<int> >& edges, const std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> > >& edgePtrs);
+ void setMeshAt(int pos, const MCAuto<MEDCouplingUMesh>& mesh, int istart, int iend, const MCAuto<MEDCouplingUMesh>& mesh1DInCase, const std::vector< std::vector<int> >& edges, const std::vector< std::vector< MCAuto<INTERP_KERNEL::Edge> > >& edgePtrs);
const std::vector<int>& getConnOf(int pos) const { return get(pos)._edges; }
- const std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> >& getEdgePtrOf(int pos) const { return get(pos)._edges_ptr; }
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> getZeMesh() const { return _ze_mesh; }
+ const std::vector< MCAuto<INTERP_KERNEL::Edge> >& getEdgePtrOf(int pos) const { return get(pos)._edges_ptr; }
+ MCAuto<MEDCouplingUMesh> 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<INTERP_KERNEL::Edge> >& newLeft, const std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> >& newRight);
+ void updateEdgeInfo(int pos, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& newLeft, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& newRight);
const CellInfo& get(int pos) const;
CellInfo& get(int pos);
private:
std::vector<CellInfo> _pool;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> _ze_mesh;
+ MCAuto<MEDCouplingUMesh> _ze_mesh;
std::vector<EdgeInfo> _edge_info;
};
-VectorOfCellInfo::VectorOfCellInfo(const std::vector<int>& edges, const std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> >& edgesPtr):_pool(1)
+VectorOfCellInfo::VectorOfCellInfo(const std::vector<int>& edges, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& edgesPtr):_pool(1)
{
_pool[0]._edges=edges;
_pool[0]._edges_ptr=edgesPtr;
const MEDCouplingUMesh *zeMesh(_ze_mesh);
if(!zeMesh)
throw INTERP_KERNEL::Exception("VectorOfCellSplitter::getPositionOf : null aggregated mesh !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> barys(mesh->getBarycenterAndOwner());
+ MCAuto<DataArrayDouble> barys(mesh->computeCellCenterOfMass());
return zeMesh->getCellContainingPoint(barys->begin(),eps);
}
-void VectorOfCellInfo::setMeshAt(int pos, const MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh>& mesh, int istart, int iend, const MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh>& mesh1DInCase, const std::vector< std::vector<int> >& edges, const std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> > >& edgePtrs)
+void VectorOfCellInfo::setMeshAt(int pos, const MCAuto<MEDCouplingUMesh>& mesh, int istart, int iend, const MCAuto<MEDCouplingUMesh>& mesh1DInCase, const std::vector< std::vector<int> >& edges, const std::vector< std::vector< MCAuto<INTERP_KERNEL::Edge> > >& edgePtrs)
{
get(pos);//to check pos
bool isFast(pos==0 && _pool.size()==1);
return ;
}
//
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> > ms;
+ std::vector< MCAuto<MEDCouplingUMesh> > ms;
if(pos>0)
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> elt(static_cast<MEDCouplingUMesh *>(_ze_mesh->buildPartOfMySelf2(0,pos,true)));
+ MCAuto<MEDCouplingUMesh> elt(static_cast<MEDCouplingUMesh *>(_ze_mesh->buildPartOfMySelfSlice(0,pos,true)));
ms.push_back(elt);
}
ms.push_back(mesh);
if(pos<_ze_mesh->getNumberOfCells()-1)
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> elt(static_cast<MEDCouplingUMesh *>(_ze_mesh->buildPartOfMySelf2(pos+1,_ze_mesh->getNumberOfCells(),true)));
+ MCAuto<MEDCouplingUMesh> elt(static_cast<MEDCouplingUMesh *>(_ze_mesh->buildPartOfMySelfSlice(pos+1,_ze_mesh->getNumberOfCells(),true)));
ms.push_back(elt);
}
std::vector< const MEDCouplingUMesh *> ms2(ms.size());
throw INTERP_KERNEL::Exception("VectorOfCellInfo::getZePosOfEdgeGivenItsGlobalId : invalid id !");
}
-void VectorOfCellInfo::updateEdgeInfo(int pos, const std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> >& newLeft, const std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> >& newRight)
+void VectorOfCellInfo::updateEdgeInfo(int pos, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& newLeft, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& newRight)
{
get(pos);//to check;
if(_edge_info.empty())
*
* \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<int>& allEdges, const std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> >& allEdgesPtr, int offset,
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& idsLeftRight)
+MEDCouplingUMesh *BuildMesh2DCutInternal(double eps, const MEDCouplingUMesh *splitMesh1D, const std::vector<int>& allEdges, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& allEdgesPtr, int offset,
+ MCAuto<DataArrayInt>& idsLeftRight)
{
int nbCellsInSplitMesh1D(splitMesh1D->getNumberOfCells());
if(nbCellsInSplitMesh1D==0)
if(nb%2!=0)
throw INTERP_KERNEL::Exception("BuildMesh2DCutFrom : internal error 2 !");
std::vector<int> edge1Bis(nb*2);
- std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> > edge1BisPtr(nb*2);
+ std::vector< MCAuto<INTERP_KERNEL::Edge> > 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());
if(iEnd<nbCellsInSplitMesh1D)
iEnd++;
//
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> partOfSplitMesh1D(static_cast<MEDCouplingUMesh *>(splitMesh1D->buildPartOfMySelf2(iStart,iEnd,1,true)));
+ MCAuto<MEDCouplingUMesh> partOfSplitMesh1D(static_cast<MEDCouplingUMesh *>(splitMesh1D->buildPartOfMySelfSlice(iStart,iEnd,1,true)));
int pos(pool.getPositionOf(eps,partOfSplitMesh1D));
//
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh>retTmp(MEDCouplingUMesh::New("",2));
+ MCAuto<MEDCouplingUMesh>retTmp(MEDCouplingUMesh::New("",2));
retTmp->setCoords(splitMesh1D->getCoords());
retTmp->allocateCells();
std::vector< std::vector<int> > out0;
- std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> > > out1;
+ std::vector< std::vector< MCAuto<INTERP_KERNEL::Edge> > > out1;
BuildMesh2DCutInternal2(partOfSplitMesh1D,pool.getConnOf(pos),pool.getEdgePtrOf(pos),out0,out1);
for(std::size_t cnt=0;cnt<out0.size();cnt++)
MEDCouplingUMesh *BuildMesh2DCutFrom(double eps, int cellIdInMesh2D, const MEDCouplingUMesh *mesh2DDesc, const MEDCouplingUMesh *splitMesh1D,
const int *descBg, const int *descEnd, const std::vector< std::vector<int> >& intersectEdge1, int offset,
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& idsLeftRight)
+ MCAuto<DataArrayInt>& idsLeftRight)
{
const int *cdescPtr(mesh2DDesc->getNodalConnectivity()->begin()),*cidescPtr(mesh2DDesc->getNodalConnectivityIndex()->begin());
//
std::vector<int> allEdges;
- std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> > allEdgesPtr; // for each sub edge in splitMesh2D the uncut Edge object of the original mesh2D
+ std::vector< MCAuto<INTERP_KERNEL::Edge> > 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<INTERP_KERNEL::Node>,int> m;
- MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Edge> ee(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)cdescPtr[cidescPtr[edgeId]],cdescPtr+cidescPtr[edgeId]+1,mesh2DDesc->getCoords()->begin(),m));
+ std::map< MCAuto<INTERP_KERNEL::Node>,int> m;
+ MCAuto<INTERP_KERNEL::Edge> ee(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)cdescPtr[cidescPtr[edgeId]],cdescPtr+cidescPtr[edgeId]+1,mesh2DDesc->getCoords()->begin(),m));
const std::vector<int>& edge1(intersectEdge1[edgeId]);
if(*it>0)
allEdges.insert(allEdges.end(),edge1.begin(),edge1.end());
if(std::distance(candidatesIn2DBg,candidatesIn2DEnd)==1)
return *candidatesIn2DBg;
int edgeId(std::abs(cellIdInMesh1DSplitRelative)-1);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> cur1D(static_cast<MEDCouplingUMesh *>(mesh1DSplit->buildPartOfMySelf(&edgeId,&edgeId+1,true)));
+ MCAuto<MEDCouplingUMesh> cur1D(static_cast<MEDCouplingUMesh *>(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<MEDCouplingUMesh> cur2D(static_cast<MEDCouplingUMesh *>(mesh2DSplit->buildPartOfMySelf(it,it+1,true)));
+ MCAuto<MEDCouplingUMesh> cur2D(static_cast<MEDCouplingUMesh *>(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));
//
// Build desc connectivity
DataArrayInt *desc1(DataArrayInt::New()),*descIndx1(DataArrayInt::New()),*revDesc1(DataArrayInt::New()),*revDescIndx1(DataArrayInt::New());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> dd1(desc1),dd2(descIndx1),dd3(revDesc1),dd4(revDescIndx1);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m1Desc(mesh2D->buildDescendingConnectivity2(desc1,descIndx1,revDesc1,revDescIndx1));
+ MCAuto<DataArrayInt> dd1(desc1),dd2(descIndx1),dd3(revDesc1),dd4(revDescIndx1);
+ MCAuto<MEDCouplingUMesh> m1Desc(mesh2D->buildDescendingConnectivity2(desc1,descIndx1,revDesc1,revDescIndx1));
std::map<int,int> mergedNodes;
Intersect1DMeshes(m1Desc,mesh1D,eps,intersectEdge1,colinear2,subDiv2,addCoo,mergedNodes);
// use mergeNodes to fix intersectEdge1
(*it0)[2*n-1]=(*it1).second;
}
//
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> addCooDa(DataArrayDouble::New());
+ MCAuto<DataArrayDouble> 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<int> > intersectEdge2;
BuildIntersectEdges(m1Desc,mesh1D,addCoo,subDiv2,intersectEdge2);
subDiv2.clear();
// Step 3: compute splitMesh1D
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> idsInRet1Colinear,idsInDescMesh2DForIdsInRetColinear;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret2(DataArrayInt::New()); ret2->alloc(0,1);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret1(BuildMesh1DCutFrom(mesh1D,intersectEdge2,mesh2D->getCoords(),addCoo,mergedNodes,colinear2,intersectEdge1,
+ MCAuto<DataArrayInt> idsInRet1Colinear,idsInDescMesh2DForIdsInRetColinear;
+ MCAuto<DataArrayInt> ret2(DataArrayInt::New()); ret2->alloc(0,1);
+ MCAuto<MEDCouplingUMesh> ret1(BuildMesh1DCutFrom(mesh1D,intersectEdge2,mesh2D->getCoords(),addCoo,mergedNodes,colinear2,intersectEdge1,
idsInRet1Colinear,idsInDescMesh2DForIdsInRetColinear));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret3(DataArrayInt::New()); ret3->alloc(ret1->getNumberOfCells()*2,1); ret3->fillWithValue(std::numeric_limits<int>::max()); ret3->rearrange(2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> idsInRet1NotColinear(idsInRet1Colinear->buildComplement(ret1->getNumberOfCells()));
+ MCAuto<DataArrayInt> ret3(DataArrayInt::New()); ret3->alloc(ret1->getNumberOfCells()*2,1); ret3->fillWithValue(std::numeric_limits<int>::max()); ret3->rearrange(2);
+ MCAuto<DataArrayInt> idsInRet1NotColinear(idsInRet1Colinear->buildComplement(ret1->getNumberOfCells()));
// deal with cells in mesh2D that are not cut but only some of their edges are
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> idsInDesc2DToBeRefined(idsInDescMesh2DForIdsInRetColinear->deepCpy());
+ MCAuto<DataArrayInt> idsInDesc2DToBeRefined(idsInDescMesh2DForIdsInRetColinear->deepCopy());
idsInDesc2DToBeRefined->abs(); idsInDesc2DToBeRefined->applyLin(1,-1);
idsInDesc2DToBeRefined=idsInDesc2DToBeRefined->buildUnique();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> 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<DataArrayInt> 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<DataArrayInt> outi0s(outi0);
+ MCAuto<DataArrayInt> outi0s(outi0);
out0s=out0;
out0s=out0s->buildUnique();
out0s->sort(true);
}
//
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret1NonCol(static_cast<MEDCouplingUMesh *>(ret1->buildPartOfMySelf(idsInRet1NotColinear->begin(),idsInRet1NotColinear->end())));
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> baryRet1(ret1NonCol->getBarycenterAndOwner());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
+ MCAuto<MEDCouplingUMesh> ret1NonCol(static_cast<MEDCouplingUMesh *>(ret1->buildPartOfMySelf(idsInRet1NotColinear->begin(),idsInRet1NotColinear->end())));
+ MCAuto<DataArrayDouble> baryRet1(ret1NonCol->computeCellCenterOfMass());
+ MCAuto<DataArrayInt> elts,eltsIndex;
mesh2D->getCellsContainingPoints(baryRet1->begin(),baryRet1->getNumberOfTuples(),eps,elts,eltsIndex);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> eltsIndex2(eltsIndex->deltaShiftIndex());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> eltsIndex3(eltsIndex2->getIdsEqual(1));
+ MCAuto<DataArrayInt> eltsIndex2(eltsIndex->deltaShiftIndex());
+ MCAuto<DataArrayInt> eltsIndex3(eltsIndex2->findIdsEqual(1));
if(eltsIndex2->count(0)+eltsIndex3->getNumberOfTuples()!=ret1NonCol->getNumberOfCells())
throw INTERP_KERNEL::Exception("Intersect2DMeshWith1DLine : internal error 1 !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellsToBeModified(elts->buildUnique());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> untouchedCells(cellsToBeModified->buildComplement(mesh2D->getNumberOfCells()));
+ MCAuto<DataArrayInt> cellsToBeModified(elts->buildUnique());
+ MCAuto<DataArrayInt> 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<MEDCouplingUMesh> > outMesh2DSplit;
+ std::vector< MCAuto<MEDCouplingUMesh> > outMesh2DSplit;
// OK all is ready to insert in ret2 mesh
if(!untouchedCells->empty())
{// the most easy part, cells in mesh2D not impacted at all
}
if((DataArrayInt *)out0s)
{// here dealing with cells in out0s but not in cellsToBeModified
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> fewModifiedCells(out0s->buildSubstraction(cellsToBeModified));
+ MCAuto<DataArrayInt> 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++)
{
}
int offset(ret2->getNumberOfTuples());
ret2->pushBackValsSilent(fewModifiedCells->begin(),fewModifiedCells->end());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> partOfRet3(DataArrayInt::New()); partOfRet3->alloc(2*idsInRet1Colinear->getNumberOfTuples(),1);
+ MCAuto<DataArrayInt> partOfRet3(DataArrayInt::New()); partOfRet3->alloc(2*idsInRet1Colinear->getNumberOfTuples(),1);
partOfRet3->fillWithValue(std::numeric_limits<int>::max()); partOfRet3->rearrange(2);
int kk(0),*ret3ptr(partOfRet3->getPointer());
for(const int *it=idsInDescMesh2DForIdsInRetColinear->begin();it!=idsInDescMesh2DForIdsInRetColinear->end();it++,kk++)
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])
if(!outMesh2DSplit.empty())
{
DataArrayDouble *da(outMesh2DSplit.back()->getCoords());
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> >::iterator itt=outMesh2DSplit.begin();itt!=outMesh2DSplit.end();itt++)
+ for(std::vector< MCAuto<MEDCouplingUMesh> >::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<DataArrayInt> idsNonColPerCell(elts->getIdsEqual(*it));
+ MCAuto<DataArrayInt> idsNonColPerCell(elts->findIdsEqual(*it));
idsNonColPerCell->transformWithIndArr(eltsIndex3->begin(),eltsIndex3->end());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> idsNonColPerCell2(idsInRet1NotColinear->selectByTupleId(idsNonColPerCell->begin(),idsNonColPerCell->end()));
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> partOfMesh1CuttingCur2DCell(static_cast<MEDCouplingUMesh *>(ret1NonCol->buildPartOfMySelf(idsNonColPerCell->begin(),idsNonColPerCell->end())));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> partOfRet3;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> splitOfOneCell(BuildMesh2DCutFrom(eps,*it,m1Desc,partOfMesh1CuttingCur2DCell,dd1->begin()+dd2->getIJ(*it,0),dd1->begin()+dd2->getIJ((*it)+1,0),intersectEdge1,ret2->getNumberOfTuples(),partOfRet3));
+ MCAuto<DataArrayInt> idsNonColPerCell2(idsInRet1NotColinear->selectByTupleId(idsNonColPerCell->begin(),idsNonColPerCell->end()));
+ MCAuto<MEDCouplingUMesh> partOfMesh1CuttingCur2DCell(static_cast<MEDCouplingUMesh *>(ret1NonCol->buildPartOfMySelf(idsNonColPerCell->begin(),idsNonColPerCell->end())));
+ MCAuto<DataArrayInt> partOfRet3;
+ MCAuto<MEDCouplingUMesh> 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;i<splitOfOneCell->getNumberOfCells();i++)
tmp[i]=outMesh2DSplit[i];
//
ret1->getCoords()->setInfoOnComponents(compNames);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret2D(MEDCouplingUMesh::MergeUMeshesOnSameCoords(tmp));
+ MCAuto<MEDCouplingUMesh> ret2D(MEDCouplingUMesh::MergeUMeshesOnSameCoords(tmp));
// To finish - filter ret3 - std::numeric_limits<int>::max() -> -1 - negate values must be resolved.
ret3->rearrange(1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> edgesToDealWith(ret3->getIdsStrictlyNegative());
+ MCAuto<DataArrayInt> edgesToDealWith(ret3->findIdsStricltyNegative());
for(const int *it=edgesToDealWith->begin();it!=edgesToDealWith->end();it++)
{
int old2DCellId(-ret3->getIJ(*it,0)-1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> candidates(ret2->getIdsEqual(old2DCellId));
+ MCAuto<DataArrayInt> 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<int>::max(),-1);
const int *conn2(m2->getNodalConnectivity()->getConstPointer()),*connI2(m2->getNodalConnectivityIndex()->getConstPointer());
int offset2(offset1+m2->getNumberOfNodes());
int offset3(offset2+((int)addCoords.size())/2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> bbox1Arr(m1->getBoundingBoxForBBTree()),bbox2Arr(m2->getBoundingBoxForBBTree());
+ MCAuto<DataArrayDouble> bbox1Arr(m1->getBoundingBoxForBBTree()),bbox2Arr(m2->getBoundingBoxForBBTree());
const double *bbox1(bbox1Arr->begin()),*bbox2(bbox2Arr->begin());
// Here a BBTree on 2D-cells, not on segments:
BBTree<SPACEDIM,int> myTree(bbox2,0,0,m2->getNumberOfCells(),eps);
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<DataArrayInt> _d(DataArrayInt::New()),_dI(DataArrayInt::New());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _rD(DataArrayInt::New()),_rDI(DataArrayInt::New());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m_points(buildDescendingConnectivity(_d, _dI, _rD, _rDI));
+ MCAuto<DataArrayInt> _d(DataArrayInt::New()),_dI(DataArrayInt::New());
+ MCAuto<DataArrayInt> _rD(DataArrayInt::New()),_rDI(DataArrayInt::New());
+ MCAuto<MEDCouplingUMesh> m_points(buildDescendingConnectivity(_d, _dI, _rD, _rDI));
const int *d(_d->getConstPointer()), *dI(_dI->getConstPointer());
const int *rD(_rD->getConstPointer()), *rDI(_rDI->getConstPointer());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _dsi(_rDI->deltaShiftIndex());
+ MCAuto<DataArrayInt> _dsi(_rDI->deltaShiftIndex());
const int * dsi(_dsi->getConstPointer());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> dsii = _dsi->getIdsNotInRange(0,3);
+ MCAuto<DataArrayInt> 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<DataArrayInt> result(DataArrayInt::New());
+ MCAuto<DataArrayInt> result(DataArrayInt::New());
result->alloc(nc,1);
// set of edges not used so far
/// @cond INTERNAL
-void IKGeo2DInternalMapper2(INTERP_KERNEL::Node *n, const std::map<MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Node>,int>& m, int forbVal0, int forbVal1, std::vector<int>& isect)
+void IKGeo2DInternalMapper2(INTERP_KERNEL::Node *n, const std::map<MCAuto<INTERP_KERNEL::Node>,int>& m, int forbVal0, int forbVal1, std::vector<int>& isect)
{
- MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Node> nTmp(n); nTmp->incrRef();
- std::map<MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Node>,int>::const_iterator it(m.find(nTmp));
+ MCAuto<INTERP_KERNEL::Node> nTmp(n); nTmp->incrRef();
+ std::map<MCAuto<INTERP_KERNEL::Node>,int>::const_iterator it(m.find(nTmp));
if(it==m.end())
throw INTERP_KERNEL::Exception("Internal error in remapping !");
int v((*it).second);
isect.push_back(v);
}
-bool IKGeo2DInternalMapper(const INTERP_KERNEL::ComposedEdge& c, const std::map<MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Node>,int>& m, int forbVal0, int forbVal1, std::vector<int>& isect)
+bool IKGeo2DInternalMapper(const INTERP_KERNEL::ComposedEdge& c, const std::map<MCAuto<INTERP_KERNEL::Node>,int>& m, int forbVal0, int forbVal1, std::vector<int>& isect)
{
int sz(c.size());
if(sz<=1)
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<DataArrayInt> desc1(DataArrayInt::New()),descIndx1(DataArrayInt::New()),revDesc1(DataArrayInt::New()),revDescIndx1(DataArrayInt::New());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mDesc(buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1));
+ MCAuto<DataArrayInt> desc1(DataArrayInt::New()),descIndx1(DataArrayInt::New()),revDesc1(DataArrayInt::New()),revDescIndx1(DataArrayInt::New());
+ MCAuto<MEDCouplingUMesh> mDesc(buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1));
const int *c(mDesc->getNodalConnectivity()->getConstPointer()),*ci(mDesc->getNodalConnectivityIndex()->getConstPointer()),*rd(revDesc1->getConstPointer()),*rdi(revDescIndx1->getConstPointer());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> bboxArr(mDesc->getBoundingBoxForBBTree());
+ MCAuto<DataArrayDouble> bboxArr(mDesc->getBoundingBoxForBBTree());
const double *bbox(bboxArr->begin()),*coords(getCoords()->begin());
int nCell(getNumberOfCells()),nDescCell(mDesc->getNumberOfCells());
std::vector< std::vector<int> > intersectEdge(nDescCell),overlapEdge(nDescCell);
for(std::vector<int>::const_iterator it=candidates.begin();it!=candidates.end();it++)
if(*it>i)
{
- std::map<MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Node>,int> m;
+ std::map<MCAuto<INTERP_KERNEL::Node>,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;
int sz((int)isect.size());
if(sz>1)
{
- std::map<MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Node>,int> m;
+ std::map<MCAuto<INTERP_KERNEL::Node>,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();
}
}
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New()),notRet(DataArrayInt::New()); ret->alloc(nbOf2DCellsToBeSplit,1);
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()),notRet(DataArrayInt::New()); ret->alloc(nbOf2DCellsToBeSplit,1);
if(nbOf2DCellsToBeSplit==0)
return ret.retn();
//
if(cells2DToTreat[i])
*retPtr++=i;
//
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> mSafe,nSafe,oSafe,pSafe,qSafe,rSafe;
+ MCAuto<DataArrayInt> 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<MEDCouplingUMesh> modif(static_cast<MEDCouplingUMesh *>(buildPartOfMySelf(ret->begin(),ret->end(),true)));
+ MCAuto<MEDCouplingUMesh> modif(static_cast<MEDCouplingUMesh *>(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<DataArrayInt> tmp(mergeNodes(eps,areNodesMerged,newNbOfNodes));
+ MCAuto<DataArrayInt> tmp(mergeNodes(eps,areNodesMerged,newNbOfNodes));
}
return ret.retn();
}
*/
DataArrayInt *MEDCouplingUMesh::colinearize2D(double eps)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
- checkCoherency();
+ MCAuto<DataArrayInt> 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<DataArrayInt> newc(DataArrayInt::New()),newci(DataArrayInt::New()); newci->alloc(nbOfCells+1,1); newc->alloc(0,1); newci->setIJ(0,0,0);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> appendedCoords(DataArrayDouble::New()); appendedCoords->alloc(0,1);//1 not 2 it is not a bug.
+ MCAuto<DataArrayInt> newc(DataArrayInt::New()),newci(DataArrayInt::New()); newci->alloc(nbOfCells+1,1); newc->alloc(0,1); newci->setIJ(0,0,0);
+ MCAuto<DataArrayDouble> 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;i<nbOfCells;i++,newciptr++,ciptr++)
if(!appendedCoords->empty())
{
appendedCoords->rearrange(2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> newCoords(DataArrayDouble::Aggregate(getCoords(),appendedCoords));//treat info on components
+ MCAuto<DataArrayDouble> newCoords(DataArrayDouble::Aggregate(getCoords(),appendedCoords));//treat info on components
//non const part
setCoords(newCoords);
}
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<DataArrayDouble> bbox1Arr(m1Desc->getBoundingBoxForBBTree()),bbox2Arr(m2Desc->getBoundingBoxForBBTree());
+ MCAuto<DataArrayDouble> bbox1Arr(m1Desc->getBoundingBoxForBBTree()),bbox2Arr(m2Desc->getBoundingBoxForBBTree());
const double *bbox1(bbox1Arr->begin()),*bbox2(bbox2Arr->begin());
int nDescCell1(m1Desc->getNumberOfCells()),nDescCell2(m2Desc->getNumberOfCells());
intersectEdge1.resize(nDescCell1);
std::set<INTERP_KERNEL::Node *> nodes;
pol1->getAllNodes(nodes); pol2->getAllNodes(nodes);
std::size_t szz(nodes.size());
- std::vector< MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Node> > nodesSafe(szz);
+ std::vector< MCAuto<INTERP_KERNEL::Node> > nodesSafe(szz);
std::set<INTERP_KERNEL::Node *>::const_iterator itt(nodes.begin());
for(std::size_t iii=0;iii<szz;iii++,itt++)
{ (*itt)->incrRef(); nodesSafe[iii]=*itt; }
descIndx2=DataArrayInt::New();
revDesc2=DataArrayInt::New();
revDescIndx2=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> dd1(desc1),dd2(descIndx1),dd3(revDesc1),dd4(revDescIndx1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> dd5(desc2),dd6(descIndx2),dd7(revDesc2),dd8(revDescIndx2);
+ MCAuto<DataArrayInt> dd1(desc1),dd2(descIndx1),dd3(revDesc1),dd4(revDescIndx1);
+ MCAuto<DataArrayInt> dd5(desc2),dd6(descIndx2),dd7(revDesc2),dd8(revDescIndx2);
m1Desc=m1->buildDescendingConnectivity2(desc1,descIndx1,revDesc1,revDescIndx1);
m2Desc=m2->buildDescendingConnectivity2(desc2,descIndx2,revDesc2,revDescIndx2);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> dd9(m1Desc),dd10(m2Desc);
+ MCAuto<MEDCouplingUMesh> dd9(m1Desc),dd10(m2Desc);
std::map<int,int> notUsedMap;
Intersect1DMeshes(m1Desc,m2Desc,eps,intersectEdge1,colinear2,subDiv2,addCoo,notUsedMap);
m1Desc->incrRef(); desc1->incrRef(); descIndx1->incrRef(); revDesc1->incrRef(); revDescIndx1->incrRef();
* \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)
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<DataArrayInt> arro=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arrIo=DataArrayInt::New();
+ MCAuto<DataArrayInt> arro=DataArrayInt::New();
+ MCAuto<DataArrayInt> arrIo=DataArrayInt::New();
arrIo->alloc((int)(sz+1),1);
const int *idsIt=idsOfSelectBg;
int *work=arrIo->getPointer();
* \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<DataArrayInt> arro=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arrIo=DataArrayInt::New();
+ MCAuto<DataArrayInt> arro=DataArrayInt::New();
+ MCAuto<DataArrayInt> arrIo=DataArrayInt::New();
arrIo->alloc((int)(sz+1),1);
int idsIt=idsOfSelectStart;
int *work=arrIo->getPointer();
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());
}
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());
}
{
if(arrIn==0 || arrIndxIn==0 || srcArr==0 || srcArrIndex==0)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : presence of null pointer in input parameter !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arro=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arrIo=DataArrayInt::New();
+ MCAuto<DataArrayInt> arro=DataArrayInt::New();
+ MCAuto<DataArrayInt> arrIo=DataArrayInt::New();
int nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
std::vector<bool> v(nbOfTuples,true);
int offset=0;
}
int lgth=(int)std::count(fetched2.begin(),fetched2.end(),true);
i=0;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(lgth,1);
+ MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(lgth,1);
int *retPtr=ret->getPointer();
for(std::vector<bool>::const_iterator it=fetched2.begin();it!=fetched2.end();it++,i++)
if(*it)
*
* \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<DataArrayInt> arro=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arrIo=DataArrayInt::New();
+ throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSlice : presence of null pointer in input parameter !");
+ MCAuto<DataArrayInt> arro=DataArrayInt::New();
+ MCAuto<DataArrayInt> 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;i<nbOfElemsToSet;i++,srcArrIndexPtr++,it+=step)
{
offset+=(srcArrIndexPtr[1]-srcArrIndexPtr[0])-(arrIndxInPtr[it+1]-arrIndxInPtr[it]);
else
{
- std::ostringstream oss; oss << "MEDCouplingUMesh::SetPartOfIndexedArrays2 : On pos #" << i << " value is " << it << " not in [0," << nbOfTuples << ") !";
+ std::ostringstream oss; oss << "MEDCouplingUMesh::SetPartOfIndexedArraysSlice : On pos #" << i << " value is " << it << " not in [0," << nbOfTuples << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
* \param [in] srcArr input array that will be used as source of copy for ids in [\b idsOfSelectBg, \b idsOfSelectEnd)
* \param [in] srcArrIndex index array of \b srcArr
*
- * \sa MEDCouplingUMesh::SetPartOfIndexedArrays2 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx
+ * \sa MEDCouplingUMesh::SetPartOfIndexedArraysSlice MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx
*/
-void MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx2(int start, int end, int step, DataArrayInt *arrInOut, const DataArrayInt *arrIndxIn,
+void MEDCouplingUMesh::SetPartOfIndexedArraysSameIdxSlice(int start, int end, int step, DataArrayInt *arrInOut, const DataArrayInt *arrIndxIn,
const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex)
{
if(arrInOut==0 || arrIndxIn==0 || srcArr==0 || srcArrIndex==0)
- throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx2 : presence of null pointer in input parameter !");
+ throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdxSlice : presence of null pointer in input parameter !");
int nbOfTuples=arrIndxIn->getNumberOfTuples()-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<nbOfElemsToSet;i++,srcArrIndexPtr++,it+=step)
{
std::copy(srcArrPtr+srcArrIndexPtr[0],srcArrPtr+srcArrIndexPtr[1],arrInOutPtr+arrIndxInPtr[it]);
else
{
- std::ostringstream oss; oss << "MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx2 : On pos #" << i << " id (idsOfSelectBg[" << i << "]) is " << it << " arrIndxIn[id+1]-arrIndxIn[id]!=srcArrIndex[pos+1]-srcArrIndex[pos] !";
+ std::ostringstream oss; oss << "MEDCouplingUMesh::SetPartOfIndexedArraysSameIdxSlice : On pos #" << i << " id (idsOfSelectBg[" << i << "]) is " << it << " arrIndxIn[id+1]-arrIndxIn[id]!=srcArrIndex[pos+1]-srcArrIndex[pos] !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
else
{
- std::ostringstream oss; oss << "MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx2 : On pos #" << i << " value is " << it << " not in [0," << nbOfTuples << ") !";
+ std::ostringstream oss; oss << "MEDCouplingUMesh::SetPartOfIndexedArraysSameIdxSlice : On pos #" << i << " value is " << it << " not in [0," << nbOfTuples << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
if(mdim!=spaceDim)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSpreadZonesWithPoly : meshdimension and spacedimension do not match !");
std::vector<DataArrayInt *> partition=partitionBySpreadZone();
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > partitionAuto; partitionAuto.reserve(partition.size());
- std::copy(partition.begin(),partition.end(),std::back_insert_iterator<std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > >(partitionAuto));
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(getName(),mdim);
+ std::vector< MCAuto<DataArrayInt> > partitionAuto; partitionAuto.reserve(partition.size());
+ std::copy(partition.begin(),partition.end(),std::back_insert_iterator<std::vector< MCAuto<DataArrayInt> > >(partitionAuto));
+ MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(getName(),mdim);
ret->setCoords(getCoords());
ret->allocateCells((int)partition.size());
//
for(std::vector<DataArrayInt *>::const_iterator it=partition.begin();it!=partition.end();it++)
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> tmp=static_cast<MEDCouplingUMesh *>(buildPartOfMySelf((*it)->begin(),(*it)->end(),true));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cell;
+ MCAuto<MEDCouplingUMesh> tmp=static_cast<MEDCouplingUMesh *>(buildPartOfMySelf((*it)->begin(),(*it)->end(),true));
+ MCAuto<DataArrayInt> cell;
switch(mdim)
{
case 2:
return ret;
DataArrayInt *neigh=0,*neighI=0;
computeNeighborsOfCells(neigh,neighI);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> neighAuto(neigh),neighIAuto(neighI);
+ MCAuto<DataArrayInt> neighAuto(neigh),neighIAuto(neighI);
std::vector<bool> fetchedCells(nbOfCellsCur,false);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > ret2;
+ std::vector< MCAuto<DataArrayInt> > ret2;
int seed=0;
while(seed<nbOfCellsCur)
{
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<DataArrayInt> >::iterator it=ret2.begin();it!=ret2.end();it++)
+ for(std::vector< MCAuto<DataArrayInt> >::iterator it=ret2.begin();it!=ret2.end();it++)
ret.push_back((*it).retn());
return ret;
}
*/
DataArrayInt *MEDCouplingUMesh::ComputeRangesFromTypeDistribution(const std::vector<int>& code)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
std::size_t nb=code.size()/3;
if(code.size()%3!=0)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ComputeRangesFromTypeDistribution : invalid input code !");
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<MEDCoupling1SGTUMesh> ret0(MEDCoupling1SGTUMesh::New(getName(),INTERP_KERNEL::NORM_TETRA4));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(nbOfCells,1);
+ MCAuto<MEDCoupling1SGTUMesh> ret0(MEDCoupling1SGTUMesh::New(getName(),INTERP_KERNEL::NORM_TETRA4));
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(nbOfCells,1);
int *retPt(ret->getPointer());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConn(DataArrayInt::New()); newConn->alloc(0,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> addPts(DataArrayDouble::New()); addPts->alloc(0,1);
+ MCAuto<DataArrayInt> newConn(DataArrayInt::New()); newConn->alloc(0,1);
+ MCAuto<DataArrayDouble> 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());
}
ret0->setNodalConnectivity(newConn);
//
- ret->computeOffsets2();
+ ret->computeOffsetsFull();
n2oCells=ret->buildExplicitArrOfSliceOnScaledArr(0,nbOfCells,1);
return ret0.retn();
}
void MEDCouplingUMesh::split2DCellsLinear(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI)
{
checkConnectivityFullyDefined();
- int ncells(getNumberOfCells()),lgthToReach(getMeshLength()+subNodesInSeg->getNumberOfTuples());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> c(DataArrayInt::New()); c->alloc((std::size_t)lgthToReach);
+ int ncells(getNumberOfCells()),lgthToReach(getNodalConnectivityArrayLen()+subNodesInSeg->getNumberOfTuples());
+ MCAuto<DataArrayInt> 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]);
for(;(nbOfTurn+nbOfHit)<nbs;nbOfTurn++)
{
cm.fillSonCellNodalConnectivity2(posBaseElt,connBg+1,sz,tmpConn,typeOfSon);
- std::map<MEDCouplingAutoRefCountObjectPtr<INTERP_KERNEL::Node>,int> m;
+ std::map<MCAuto<INTERP_KERNEL::Node>,int> m;
INTERP_KERNEL::Edge *e(MEDCouplingUMeshBuildQPFromEdge2(typeOfSon,tmpConn,coords,m));
posEndElt = posBaseElt+1;
*/
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<DataArrayInt> c(DataArrayInt::New()); c->alloc((std::size_t)lgthToReach);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> addCoo(DataArrayDouble::New()); addCoo->alloc(0,1);
+ checkConsistencyLight();
+ int ncells(getNumberOfCells()),lgthToReach(getNodalConnectivityArrayLen()+2*subNodesInSeg->getNumberOfTuples()),nodesCnt(getNumberOfNodes());
+ MCAuto<DataArrayInt> c(DataArrayInt::New()); c->alloc((std::size_t)lgthToReach);
+ MCAuto<DataArrayDouble> 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());
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<INTERP_KERNEL::Edge> e(INTERP_KERNEL::QuadraticPolygon::BuildArcCircleEdge(ns));
+ MCAuto<INTERP_KERNEL::Edge> e(INTERP_KERNEL::QuadraticPolygon::BuildArcCircleEdge(ns));
for(int k=0;k<sz2;k++)//loop over subsplit of current subedge
{
cPtr[1]=subPtr[offset2+k];
_nodal_connec->decrRef();
_nodal_connec=c.retn(); _types.clear(); _types.insert(INTERP_KERNEL::NORM_QPOLYG);
addCoo->rearrange(2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coo(DataArrayDouble::Aggregate(getCoords(),addCoo));//info are copied from getCoords() by using Aggregate
+ MCAuto<DataArrayDouble> coo(DataArrayDouble::Aggregate(getCoords(),addCoo));//info are copied from getCoords() by using Aggregate
setCoords(coo);
return addCoo->getNumberOfTuples();
}
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;
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);
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<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
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();
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;
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;
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<int>& elts) const;
- MEDCOUPLING_EXPORT void getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& elts, MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& eltsIndex) const;
+ MEDCOUPLING_EXPORT void getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, MCAuto<DataArrayInt>& elts, MCAuto<DataArrayInt>& eltsIndex) const;
MEDCOUPLING_EXPORT void checkButterflyCells(std::vector<int>& cells, double eps=1e-12) const;
MEDCOUPLING_EXPORT DataArrayInt *convexEnvelop2D();
MEDCOUPLING_EXPORT DataArrayInt *findAndCorrectBadOriented3DExtrudedCells();
MEDCOUPLING_EXPORT std::vector<bool> 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;
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);
DataArrayDouble *fillExtCoordsUsingTranslAndAutoRotation3D(const MEDCouplingUMesh *mesh1D, bool isQuad) const;
static bool AreCellsEqualInPool(const std::vector<int>& 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<INTERP_KERNEL::NormalizedCellType>& types) const;
DataArrayInt *convertLinearCellsToQuadratic2DAnd3D0(const MEDCouplingUMesh *m1D, const DataArrayInt *desc, const DataArrayInt *descI, DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const;
DataArrayInt *convertLinearCellsToQuadratic2D0(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const;
DataArrayInt *buildUnionOf2DMeshQuadratic(const MEDCouplingUMesh *skin, const DataArrayInt *n2o) const;
template<int SPACEDIM>
void getCellsContainingPointsAlg(const double *coords, const double *pos, int nbOfPoints,
- double eps, MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& elts, MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& eltsIndex) const;
+ double eps, MCAuto<DataArrayInt>& elts, MCAuto<DataArrayInt>& eltsIndex) const;
/// @cond INTERNAL
static MEDCouplingUMesh *MergeUMeshesLL(std::vector<const MEDCouplingUMesh *>& a);
typedef int (*DimM1DescNbrer)(int id, unsigned nb, const INTERP_KERNEL::CellModel& cm, bool compute, const int *conn1, const int *conn2);
#include "MEDCouplingBasicsTest.hxx"
#include "MEDCouplingUMesh.hxx"
-#include "MEDCouplingExtrudedMesh.hxx"
+#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingMultiFields.hxx"
std::copy(coords,coords+22,myCoords->getPointer());
ret->setCoords(myCoords);
myCoords->decrRef();
- ret->checkCoherency();
+ ret->checkConsistencyLight();
return ret;
}
#include "MEDCouplingBasicsTest1.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingCMesh.hxx"
-#include "MEDCouplingExtrudedMesh.hxx"
+#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
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];
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));
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);
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());
// 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());
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());
// 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());
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());
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);
double *tmp=array->getPointer();
array->decrRef();
std::fill(tmp,tmp+6,7.);
- fieldOnCells->checkCoherency();
+ fieldOnCells->checkConsistencyLight();
//
fieldOnCells->decrRef();
meshM1D->decrRef();
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();
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();
const int elts[2]={1,3};
std::vector<int> 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();
////// 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());
//
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());
const int elts[2]={1,3};
std::vector<int> eltsV(elts,elts+2);
mesh->convertToPolyTypes(&eltsV[0],&eltsV[0]+eltsV.size());
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
//
desc=DataArrayInt::New();
descIndx=DataArrayInt::New();
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());
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());
const int elts[2]={1,3};
std::vector<int> 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());
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));
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();
}
{
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();
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());
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());
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());
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());
//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());
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());
}
/*!
- * 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()
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));
MEDCouplingMesh *m3=m1->mergeMyselfWith(m2);
MEDCouplingUMesh *m3C=dynamic_cast<MEDCouplingUMesh *>(m3);
CPPUNIT_ASSERT(m3C);
- m3->checkCoherency();
+ m3->checkConsistencyLight();
MEDCouplingUMesh *m4=build2DTargetMeshMerged_1();
CPPUNIT_ASSERT(m3->isEqual(m4,1.e-12));
m4->decrRef();
std::vector<const MEDCouplingUMesh *> 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};
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();
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());
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());
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());
{
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());
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());
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());
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());
{
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());
{
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());
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};
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};
//
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};
//
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();
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);
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);
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,
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,
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);
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);
{
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<DataArrayInt> t1,t2;
+ MCAuto<DataArrayInt> t1,t2;
//2D basic
targetMesh->getCellsContainingPoints(pos,6,1e-12,t1,t2);
CPPUNIT_ASSERT_EQUAL(6,(int)t1->getNbOfElems());
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);
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()));
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};
#include "MEDCouplingBasicsTest2.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingCMesh.hxx"
-#include "MEDCouplingExtrudedMesh.hxx"
+#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingGaussLocalization.hxx"
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());
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<double> _gsCoo2(_gsCoo1);
std::vector<double> _wg2(_wg1);
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);
gl1.setGaussCoord(1,1,tmp);
CPPUNIT_ASSERT(f->isEqual(f2,1e-14,1e-14));
f->decrRef();
- f2->checkCoherency();
+ f2->checkConsistencyLight();
//
f2->decrRef();
m->decrRef();
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);
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<int> cellIds2(cellIds,cellIds+3);
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();
std::copy(coords,coords+27,myCoords->getPointer());
meshN->setCoords(myCoords);
myCoords->decrRef();
- meshN->checkCoherency();
+ meshN->checkConsistencyLight();
//
std::vector<int> 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();
//
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++)
//
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++)
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++)
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};
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};
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]={
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();
std::copy(coords,coords+207,myCoords->getPointer());
meshN->setCoords(myCoords);
myCoords->decrRef();
- meshN->checkCoherency();
+ meshN->checkConsistencyLight();
std::vector<int> res1;
meshN->arePolyhedronsNotCorrectlyOriented(res1);
meshN->orientCorrectlyPolyhedrons();
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();
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);
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);
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};
void MEDCouplingBasicsTest2::testConvertQuadraticCellsToLinear()
{
MEDCouplingUMesh *mesh=build2DTargetMesh_3();
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
std::set<INTERP_KERNEL::NormalizedCellType> 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<INTERP_KERNEL::NormalizedCellType> 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<INTERP_KERNEL::NormalizedCellType> 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};
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);
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");
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);
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);
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()));
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension());
MEDCouplingUMesh *m2C=dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(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);
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension());
m2C=dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(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));
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension());
m2C=dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(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));
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension());
m2C=dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(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));
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++)
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());
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());
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());
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());
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};
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]={
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};
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};
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};
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++)
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++)
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++)
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};
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++)
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++)
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};
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++)
}
//
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++)
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);
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());
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());
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());
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++)
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++)
std::transform(tmpConn,tmpConn+8,tmpConn,std::bind2nd(std::plus<int>(),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);
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);
#include "MEDCouplingBasicsTest3.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingCMesh.hxx"
-#include "MEDCouplingExtrudedMesh.hxx"
+#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingGaussLocalization.hxx"
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());
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.};
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());
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};
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());
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]={
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");
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};
a->decrRef();
f->setMesh(m2);
//
- f->checkCoherency();
+ f->checkConsistencyLight();
double m=f->getMaxValue();
CPPUNIT_ASSERT_DOUBLES_EQUAL(8.71,m,1e-12);
DataArrayInt *ws;
//
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);
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;
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);
f2->decrRef();
//
m2=m->buildUnstructured();
- m2->checkCoherency();
+ m2->checkConsistencyLight();
f1=m->getMeasureField(false);
f2=m2->getMeasureField(false);
CPPUNIT_ASSERT_EQUAL(f1->getNumberOfTuples(),6);
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);
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<int> arr2V(arr2,arr2+6);
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");
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<int> 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);
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);
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<const DataArrayDouble *> 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);
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};
std::copy(tab1,tab1+7,da->getPointer());
const int tab2[3]={3,-2,0};
std::vector<int> 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};
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));
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));
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));
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));
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);
//
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);
//
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));
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()));
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);
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());
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");
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");
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++)
std::copy(targetCoords,targetCoords+18,myCoords->getPointer());
targetMesh->setCoords(myCoords);
myCoords->decrRef();
- targetMesh->checkCoherency();
+ targetMesh->checkConsistencyLight();
targetMesh->decrRef();
}
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);
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));
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());
#include "MEDCouplingBasicsTest4.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingCMesh.hxx"
-#include "MEDCouplingExtrudedMesh.hxx"
+#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingGaussLocalization.hxx"
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");
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();
//
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();
//
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();
//
{
MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
DataArrayInt *da5=m->findCellIdsOnBoundary();
- CPPUNIT_ASSERT(da5->isIdentity2(5));
+ CPPUNIT_ASSERT(da5->isIota(5));
//
da5->decrRef();
m->decrRef();
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);
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);
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.};
//
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++)
//
std::vector<std::string> 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<std::string> 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++)
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"));
int a,b;
std::vector<std::string> 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"));
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());
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());
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<int> 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};
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.};
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();
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<int> 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();
}
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<int> 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();
//
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();
{
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();
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++)
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);
//
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);
//
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();
}
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);
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++)
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();
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());
MEDCouplingUMesh *m1=m1c->buildUnstructured();
const int subPart1[3]={3,4,5};
MEDCouplingUMesh *m1bis=static_cast<MEDCouplingUMesh *>(m1->buildPartOfMySelf(subPart1,subPart1+3,false));
- MEDCouplingUMesh *m2tmp=static_cast<MEDCouplingUMesh *>(m1->deepCpy());
+ MEDCouplingUMesh *m2tmp=static_cast<MEDCouplingUMesh *>(m1->deepCopy());
const int subPart2[3]={0,1,2};
MEDCouplingUMesh *m2=static_cast<MEDCouplingUMesh *>(m2tmp->buildPartOfMySelf(subPart2,subPart2+3,false));
const double vec[2]={0.5,0.5};
#include "MEDCouplingBasicsTest5.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingCMesh.hxx"
-#include "MEDCouplingExtrudedMesh.hxx"
+#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingGaussLocalization.hxx"
m1->setCoords(myCoords1);
myCoords1->decrRef();
//
- MEDCouplingUMesh *m11=static_cast<MEDCouplingUMesh *>(m1->deepCpy());
+ MEDCouplingUMesh *m11=static_cast<MEDCouplingUMesh *>(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};
CPPUNIT_ASSERT(std::equal(expected2,expected2+9,m11->getNodalConnectivityIndex()->getConstPointer()));
m11->decrRef();
//
- MEDCouplingUMesh *m12=static_cast<MEDCouplingUMesh *>(m1->deepCpy());
+ MEDCouplingUMesh *m12=static_cast<MEDCouplingUMesh *>(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};
m1->setCoords(myCoords);
myCoords->decrRef();
- MEDCouplingUMesh *m2 = static_cast<MEDCouplingUMesh *>(m1->deepCpy());
+ MEDCouplingUMesh *m2 = static_cast<MEDCouplingUMesh *>(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();
}
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);
//
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.};
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);
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++)
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));
//
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};
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);
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++)
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());
{
vec2[0]=3.*cos(M_PI/9.*i);
vec2[1]=3.*sin(M_PI/9.*i);
- MEDCouplingUMesh *m1Cpy=static_cast<MEDCouplingUMesh *>(m1->deepCpy());
+ MEDCouplingUMesh *m1Cpy=static_cast<MEDCouplingUMesh *>(m1->deepCopy());
m1Cpy->translate(vec2);
std::vector<int> res;
CPPUNIT_ASSERT_THROW(m1Cpy->are2DCellsNotCorrectlyOriented(vec1,false,res),INTERP_KERNEL::Exception);
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};
std::copy(mesh3DCoords,mesh3DCoords+24,myCoords3D->getPointer());
mesh3D->setCoords(myCoords3D);
myCoords3D->decrRef();
- mesh3D->checkCoherency();
+ mesh3D->checkConsistencyLight();
//
- MEDCouplingUMesh *mesh3D_2=dynamic_cast<MEDCouplingUMesh *>(mesh3D->deepCpy());
- MEDCouplingUMesh *mesh2D_2=dynamic_cast<MEDCouplingUMesh *>(mesh2D->deepCpy());
- MEDCouplingUMesh *mesh3D_4=dynamic_cast<MEDCouplingUMesh *>(mesh3D->deepCpy());
- MEDCouplingUMesh *mesh2D_4=dynamic_cast<MEDCouplingUMesh *>(mesh2D->deepCpy());
+ MEDCouplingUMesh *mesh3D_2=dynamic_cast<MEDCouplingUMesh *>(mesh3D->deepCopy());
+ MEDCouplingUMesh *mesh2D_2=dynamic_cast<MEDCouplingUMesh *>(mesh2D->deepCopy());
+ MEDCouplingUMesh *mesh3D_4=dynamic_cast<MEDCouplingUMesh *>(mesh3D->deepCopy());
+ MEDCouplingUMesh *mesh2D_4=dynamic_cast<MEDCouplingUMesh *>(mesh2D->deepCopy());
DataArrayInt *renumNodes=DataArrayInt::New();
int oldNbOf3DNodes=mesh3D->getNumberOfNodes();
renumNodes->alloc(mesh2D->getNumberOfNodes(),1);
mesh3D->setCoords(coo);
mesh2D->setCoords(coo);
coo->decrRef();
- MEDCouplingUMesh *mesh2D_3=dynamic_cast<MEDCouplingUMesh *>(mesh2D->deepCpy());
+ MEDCouplingUMesh *mesh2D_3=dynamic_cast<MEDCouplingUMesh *>(mesh2D->deepCopy());
mesh2D_3->shiftNodeNumbersInConn(oldNbOf3DNodes);
mesh2D->renumberNodesInConn(renumNodes->getConstPointer());
renumNodes->decrRef();
da2->decrRef();
//
const double vect[3]={1.,0.,0.};
- MEDCouplingUMesh *mesh2D_5=dynamic_cast<MEDCouplingUMesh *>(mesh2D_4->deepCpy());
+ MEDCouplingUMesh *mesh2D_5=dynamic_cast<MEDCouplingUMesh *>(mesh2D_4->deepCopy());
mesh2D_5->translate(vect);
std::vector<MEDCouplingUMesh *> 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());
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());
std::copy(mesh2DCoords,mesh2DCoords+10,myCoords->getPointer());
mesh2D->setCoords(myCoords);
myCoords->decrRef();
- mesh2D->checkCoherency();
+ mesh2D->checkConsistencyLight();
//
std::vector<int> v;
mesh2D->checkButterflyCells(v);
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();
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();
//
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());
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());
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));
//
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);
MEDCouplingUMesh *part=dynamic_cast<MEDCouplingUMesh *>(umesh->buildFacePartOfMySelfNode(ids->begin(),ids->end(),true));
part->setName(skin->getName().c_str());
CPPUNIT_ASSERT(part->isEqual(skin,1e-12));
- MEDCouplingUMesh *part2=dynamic_cast<MEDCouplingUMesh *>(part->buildPartOfMySelf2(1,18,2,true));
+ MEDCouplingUMesh *part2=dynamic_cast<MEDCouplingUMesh *>(part->buildPartOfMySelfSlice(1,18,2,true));
DataArrayInt *ids2=DataArrayInt::Range(0,18,2);
part->setPartOfMySelf(ids2->begin(),ids2->end(),*part2);
ids2->decrRef();
m->decrRef(); part->decrRef();
// resize with range ids
m=build2DTargetMesh_1();
- part=static_cast<MEDCouplingUMesh *>(m->buildPartOfMySelf2(3,5,1,true));
- m->setPartOfMySelf2(1,3,1,*part);
+ part=static_cast<MEDCouplingUMesh *>(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());
m->decrRef(); part->decrRef();
// no resize with range ids
m=build2DTargetMesh_1();
- part=static_cast<MEDCouplingUMesh *>(m->buildPartOfMySelf2(0,5,3,true));
+ part=static_cast<MEDCouplingUMesh *>(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());
m->decrRef(); part->decrRef();
// no resize with range ids negative direction
m=build2DTargetMesh_1();
- part=static_cast<MEDCouplingUMesh *>(m->buildPartOfMySelf2(3,-1,-3,true));
+ part=static_cast<MEDCouplingUMesh *>(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());
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());
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);
c->useArray(coords,false,CPP_DEALLOC,24,3);
m->setCoords(c);
c->decrRef();
- m->checkCoherency1();
+ m->checkConsistency();
//
- MEDCouplingUMesh *m1=static_cast<MEDCouplingUMesh *>(m->deepCpy());
+ MEDCouplingUMesh *m1=static_cast<MEDCouplingUMesh *>(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());
m1->decrRef();
d1->decrRef();
//
- MEDCouplingUMesh *m2=static_cast<MEDCouplingUMesh *>(m->deepCpy());
+ MEDCouplingUMesh *m2=static_cast<MEDCouplingUMesh *>(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());
#include "MEDCouplingBasicsTestInterp.hxx"
#include "MEDCouplingUMesh.hxx"
-#include "MEDCouplingExtrudedMesh.hxx"
+#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
#include "Interpolation2D.txx"
#include "MEDCouplingBasicsTest.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingCMesh.hxx"
-#include "MEDCouplingExtrudedMesh.hxx"
+#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingMultiFields.hxx"
//! [CppSnippet_MEDCouplingFieldDouble_WriteVTK_1]
// mesh1
const double coords[3] = {0.,2.,4.};
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsArr = DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess( coords, 3, 1 );
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> mesh1 = MEDCouplingCMesh::New();
+ MCAuto<MEDCouplingCMesh> mesh1 = MEDCouplingCMesh::New();
mesh1->setCoords(coordsArr,coordsArr); // mesh becomes a 2D one
// 3 fields (lying on the same mesh!)
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field1 =
+ MCAuto<MEDCouplingFieldDouble> field1 =
mesh1->getMeasureField( true );
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field2 =
+ MCAuto<MEDCouplingFieldDouble> field2 =
mesh1->buildOrthogonalField();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field3 =
+ MCAuto<MEDCouplingFieldDouble> field3 =
mesh1->fillFromAnalytic( ON_CELLS, 1, "x");
field2->setName( "Normal" ); // name is necessary!
field3->setName( "Barycenter" ); // name is necessary!
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<DataArrayDouble> valsArr1 = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> valsArr1 = DataArrayDouble::New();
valsArr1->useExternalArrayWithRWAccess( vals1, 2,2 ); // 2 tuples per 2 components
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field1 = MEDCouplingFieldDouble::New( ON_NODES );
+ MCAuto<MEDCouplingFieldDouble> field1 = MEDCouplingFieldDouble::New( ON_NODES );
field1->setArray( valsArr1 );
// field 2
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> valsArr2 = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> valsArr2 = DataArrayDouble::New();
valsArr2->useExternalArrayWithRWAccess( vals2, 2,2 ); // 2 tuples per 2 components
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field2 = MEDCouplingFieldDouble::New( ON_NODES );
+ MCAuto<MEDCouplingFieldDouble> field2 = MEDCouplingFieldDouble::New( ON_NODES );
field2->setArray( valsArr2 );
// max field
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> fieldMax = MEDCouplingFieldDouble::MaxFields( field1, field2 );
+ MCAuto<MEDCouplingFieldDouble> fieldMax = MEDCouplingFieldDouble::MaxFields( field1, field2 );
CPPUNIT_ASSERT( std::equal( valsMax, valsMax+4, fieldMax->getArray()->getConstPointer() )); // fieldMax == valsMax
// min field
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> fieldMin = MEDCouplingFieldDouble::MinFields( field1, field2 );
+ MCAuto<MEDCouplingFieldDouble> fieldMin = MEDCouplingFieldDouble::MinFields( field1, field2 );
CPPUNIT_ASSERT( std::equal( valsMin, valsMin+4, fieldMin->getArray()->getConstPointer() )); // fieldMin == valsMin
//! [CppSnippet_MEDCouplingFieldDouble_MaxFields_1]
}
//! [CppSnippet_MEDCouplingFieldDouble_MergeFields_1]
// mesh1
const double coords[3] = {0.,2.,4.};
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsArr = DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess( coords, 3, 1 );
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> mesh1 = MEDCouplingCMesh::New();
+ MCAuto<MEDCouplingCMesh> mesh1 = MEDCouplingCMesh::New();
mesh1->setCoords(coordsArr); // mesh becomes a 1D
// field1
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field1 =
+ MCAuto<MEDCouplingFieldDouble> field1 =
mesh1->fillFromAnalytic( ON_CELLS, 1, "x");
// mesh2 and field2
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field2 =
+ MCAuto<MEDCouplingFieldDouble> field2 =
field1->cloneWithMesh( true );
double vec[1] = { 5. };
(const_cast<MEDCoupling::MEDCouplingMesh *>(field2->getMesh()))->translate(vec); // translate mesh2
field2->applyFunc("x + 5"); // "translate" field2
// concatenate field1 and field2
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field3 =
+ MCAuto<MEDCouplingFieldDouble> field3 =
MEDCouplingFieldDouble::MergeFields( field1, field2 );
std::vector<const MEDCouplingFieldDouble *> fields( 2 );
fields[0] = field1;
fields[1] = field2;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field4 =
+ MCAuto<MEDCouplingFieldDouble> field4 =
MEDCouplingFieldDouble::MergeFields( fields );
//! [CppSnippet_MEDCouplingFieldDouble_MergeFields_1]
}
const double coords1[4] = {0.,1.,2.,3.};
const double coords2[4] = {2.,1.,0.,3.}; // #0 <==> #2
// mesh 1
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh1 = MEDCouplingUMesh::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr = DataArrayDouble::New();
+ MCAuto<MEDCouplingUMesh> mesh1 = MEDCouplingUMesh::New();
+ MCAuto<DataArrayDouble> coordsArr = DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess( coords1, 4, 1 );
mesh1->setCoords(coordsArr);
mesh1->setMeshDimension(0);
mesh1->allocateCells(0);
mesh1->finishInsertingCells();
// mesh 2
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh2 =
- (MEDCouplingUMesh*) mesh1->deepCpy();
+ MCAuto<MEDCouplingUMesh> mesh2 =
+ (MEDCouplingUMesh*) mesh1->deepCopy();
mesh2->getCoords()->useExternalArrayWithRWAccess( coords2, 4, 1 );
//! [CppSnippet_MEDCouplingFieldDouble_substractInPlaceDM_1]
//! [CppSnippet_MEDCouplingFieldDouble_substractInPlaceDM_2]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field1 =
+ MCAuto<MEDCouplingFieldDouble> field1 =
mesh1->fillFromAnalytic( MEDCoupling::ON_NODES,1,"x"); // field1 values == coords1
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field2 =
+ MCAuto<MEDCouplingFieldDouble> 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
const double coords1[4] = {0.,1.,2.,3.};
const double coords2[4] = {2.,1.,0.,3.}; // #0 <==> #2
// mesh 1
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh1 = MEDCouplingUMesh::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr = DataArrayDouble::New();
+ MCAuto<MEDCouplingUMesh> mesh1 = MEDCouplingUMesh::New();
+ MCAuto<DataArrayDouble> coordsArr = DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess( coords1, 4, 1 );
mesh1->setCoords(coordsArr);
mesh1->setMeshDimension(0);
mesh1->allocateCells(0);
mesh1->finishInsertingCells();
// mesh 2
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh2 =
- (MEDCouplingUMesh*) mesh1->deepCpy();
+ MCAuto<MEDCouplingUMesh> mesh2 =
+ (MEDCouplingUMesh*) mesh1->deepCopy();
mesh2->getCoords()->useExternalArrayWithRWAccess( coords2, 4, 1 );
//! [CppSnippet_MEDCouplingFieldDouble_changeUnderlyingMesh_1]
//! [CppSnippet_MEDCouplingFieldDouble_changeUnderlyingMesh_2]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field =
+ MCAuto<MEDCouplingFieldDouble> 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
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingFieldDouble_applyFunc_same_nb_comp_1]
const double v[4] = {1.,2., 3.,4.};
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> array = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> array = DataArrayDouble::New();
array->useExternalArrayWithRWAccess( v, 2, 2 ); // 2 tuples per 2 components
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field =
+ MCAuto<MEDCouplingFieldDouble> field =
MEDCouplingFieldDouble::New( MEDCoupling::ON_CELLS );
field->setArray( array );
const char func[] = "IVec * v + JVec * w*w + 10";
//! [CppSnippet_MEDCouplingFieldDouble_applyFunc3_1]
// create a 2D vector field
const double values[4] = {1.,1., 2.,1.};
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> array = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> array = DataArrayDouble::New();
array->useExternalArrayWithRWAccess( values, 2, 2 ); // 2 tuples per 2 components
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field =
+ MCAuto<MEDCouplingFieldDouble> 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<std::string> 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]
//! [CppSnippet_MEDCouplingFieldDouble_applyFunc2_1]
// create a 2D vector field
const double values[4] = {1.,1., 2.,1.};
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> array = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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<MEDCouplingFieldDouble> field =
+ MCAuto<MEDCouplingFieldDouble> 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]
//! [CppSnippet_MEDCouplingFieldDouble_applyFunc_1]
// create a 2D vector field
const double values[4] = {1.,1., 2.,1.};
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> array = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> array = DataArrayDouble::New();
array->useExternalArrayWithRWAccess( values, 2, 2 ); // 2 tuples per 2 components
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field =
+ MCAuto<MEDCouplingFieldDouble> field =
MEDCouplingFieldDouble::New( MEDCoupling::ON_CELLS );
field->setArray( array );
// transform the field to a 3D vector field
//! [Snippet_MEDCouplingFieldDouble_applyFunc_val_1]
// mesh
const double coords[4] = {0.,2.,4.};
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsArr = DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess( coords, 3, 1 );
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> mesh = MEDCouplingCMesh::New();
+ MCAuto<MEDCouplingCMesh> mesh = MEDCouplingCMesh::New();
mesh->setCoords(coordsArr,coordsArr); // mesh becomes a 2D structured mesh
// field
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field =
+ MCAuto<MEDCouplingFieldDouble> field =
MEDCouplingFieldDouble::New( MEDCoupling::ON_CELLS );
field->setMesh( mesh );
field->fillFromAnalytic(2,"IVec * x + JVec * y"); // 2 components
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingFieldDouble_fillFromAnalytic3_1]
const double coords[4] = {0.,2.,4.,6.}; // 6. is not used
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> x = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> x = DataArrayDouble::New();
x->useExternalArrayWithRWAccess( coords, 3, 1 );
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> y = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> y = DataArrayDouble::New();
y->useExternalArrayWithRWAccess( coords, 2, 1 );
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> mesh=MEDCouplingCMesh::New();
+ MCAuto<MEDCouplingCMesh> mesh=MEDCouplingCMesh::New();
mesh->setCoords(x,y);
//! [CppSnippet_MEDCouplingFieldDouble_fillFromAnalytic3_1]
//! [CppSnippet_MEDCouplingFieldDouble_fillFromAnalytic3_2]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field =
+ MCAuto<MEDCouplingFieldDouble> 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<std::string> 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<DataArrayDouble> bc =
- mesh->getBarycenterAndOwner(); // func is applied to barycenters of cells
+ MCAuto<DataArrayDouble> bc =
+ mesh->computeCellCenterOfMass(); // func is applied to barycenters of cells
double bc1[2]; // coordinates of the second point
bc->getTuple( 1, bc1 );
//
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingFieldDouble_fillFromAnalytic2_1]
const double coords[4] = {0.,2.,4.};
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> x = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> x = DataArrayDouble::New();
x->useExternalArrayWithRWAccess( coords, 3, 1 );
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> y = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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<MEDCouplingCMesh> mesh=MEDCouplingCMesh::New();
+ MCAuto<MEDCouplingCMesh> mesh=MEDCouplingCMesh::New();
mesh->setCoords(x,y);
//! [CppSnippet_MEDCouplingFieldDouble_fillFromAnalytic2_1]
//! [CppSnippet_MEDCouplingFieldDouble_fillFromAnalytic2_2]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field =
+ MCAuto<MEDCouplingFieldDouble> field =
MEDCouplingFieldDouble::New( MEDCoupling::ON_CELLS );
field->setMesh( mesh );
const char func[] = "IVec * b + JVec * a + KVec * sqrt( a*a + b*b ) + 10";
CPPUNIT_ASSERT( field->getNumberOfComponents() == 3 ); // 3 components in the field
field->getArray()->getTuple( 1, val1 );
//
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> bc =
- mesh->getBarycenterAndOwner(); // func is applied to barycenters of cells
+ MCAuto<DataArrayDouble> bc =
+ mesh->computeCellCenterOfMass(); // func is applied to barycenters of cells
double bc1[2]; // coordinates of the second point
bc->getTuple( 1, bc1 );
//
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingFieldDouble_fillFromAnalytic_1]
const double coords[3] = {0.,2.,4};
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> x = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> x = DataArrayDouble::New();
x->useExternalArrayWithRWAccess( coords, 3, 1 );
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> y = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> y = DataArrayDouble::New();
y->useExternalArrayWithRWAccess( coords, 2, 1 );
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> mesh=MEDCouplingCMesh::New();
+ MCAuto<MEDCouplingCMesh> 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<MEDCouplingFieldDouble> field =
+ MCAuto<MEDCouplingFieldDouble> field =
MEDCouplingFieldDouble::New( MEDCoupling::ON_CELLS );
field->setMesh( mesh );
field->fillFromAnalytic( 3, func );
CPPUNIT_ASSERT( field->getNumberOfComponents() == 3 ); // 3 components in the field
field->getArray()->getTuple( 1, val1 );
//
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> bc =
- mesh->getBarycenterAndOwner(); // func is applied to barycenters of cells
+ MCAuto<DataArrayDouble> bc =
+ mesh->computeCellCenterOfMass(); // func is applied to barycenters of cells
double bc1[2]; // coordinates of the second point
bc->getTuple( 1, bc1 );
//
//! [Snippet_MEDCouplingFieldDouble_fillFromAnalytic_c_func_1]
// mesh
const double coords[4] = {0.,2.,4.};
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsArr = DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess( coords, 3, 1 );
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> mesh = MEDCouplingCMesh::New();
+ MCAuto<MEDCouplingCMesh> mesh = MEDCouplingCMesh::New();
mesh->setCoords(coordsArr,coordsArr); // mesh becomes a 2D structured mesh
// field
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field =
+ MCAuto<MEDCouplingFieldDouble> field =
MEDCouplingFieldDouble::New( MEDCoupling::ON_CELLS );
field->setMesh( mesh );
field->fillFromAnalytic( 3, &getNewValue ); // 3 components are required
//! [Snippet_MEDCouplingFieldDouble_applyFunc_c_func_1]
// mesh
const double coords[4] = {0.,2.,4.};
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsArr = DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess( coords, 3, 1 );
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> mesh = MEDCouplingCMesh::New();
+ MCAuto<MEDCouplingCMesh> mesh = MEDCouplingCMesh::New();
mesh->setCoords(coordsArr,coordsArr); // mesh becomes a 2D structured mesh
// field
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field =
+ MCAuto<MEDCouplingFieldDouble> field =
MEDCouplingFieldDouble::New( MEDCoupling::ON_CELLS );
field->setMesh( mesh );
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> bc = mesh->getBarycenterAndOwner();
+ MCAuto<DataArrayDouble> 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]
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingFieldDouble_getValueOn_time_1]
const double coords[4] = {0.,2.,4.};
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsArr = DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess( coords, 3, 1 );
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> mesh = MEDCouplingCMesh::New();
+ MCAuto<MEDCouplingCMesh> mesh = MEDCouplingCMesh::New();
mesh->setCoords(coordsArr,coordsArr);
//! [CppSnippet_MEDCouplingFieldDouble_getValueOn_time_1]
//! [CppSnippet_MEDCouplingFieldDouble_getValueOn_time_2]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field =
+ MCAuto<MEDCouplingFieldDouble> field =
MEDCouplingFieldDouble::New( MEDCoupling::ON_CELLS, MEDCoupling::LINEAR_TIME );
field->setMesh( mesh );
field->fillFromAnalytic( 1,"10"); // all values == 10.
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> array2 =
+ MCAuto<DataArrayDouble> array2 =
DataArrayDouble::Add( field->getArray(), field->getArray() ); // == 2 * field->getArray()
field->setEndArray( array2 ); // all values == 20.
const double time1 = 1.1, time2 = 22.;
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingFieldDouble_getValueOnMulti_1]
const double coords[4] = {0.,2.,4.};
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsArr = DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess( coords, 3, 1 );
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> mesh = MEDCouplingCMesh::New();
+ MCAuto<MEDCouplingCMesh> mesh = MEDCouplingCMesh::New();
mesh->setCoords(coordsArr,coordsArr);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field =
+ MCAuto<MEDCouplingFieldDouble> 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<DataArrayDouble> bc = mesh->getBarycenterAndOwner();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> valArray =
+ MCAuto<DataArrayDouble> bc = mesh->computeCellCenterOfMass();
+ MCAuto<DataArrayDouble> valArray =
field->getValueOnMulti( bc->getConstPointer(), bc->getNumberOfTuples() );
CPPUNIT_ASSERT( valArray->isEqual( * field->getArray(), 1e-13 ));
//! [CppSnippet_MEDCouplingFieldDouble_getValueOnMulti_2]
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingFieldDouble_getValueOn_1]
const double coords[4] = {0.,2.,4.};
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsArr = DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess( coords, 3, 1 );
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> mesh = MEDCouplingCMesh::New();
+ MCAuto<MEDCouplingCMesh> mesh = MEDCouplingCMesh::New();
mesh->setCoords(coordsArr,coordsArr);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field =
+ MCAuto<MEDCouplingFieldDouble> 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<DataArrayDouble> bc = mesh->getBarycenterAndOwner();
+ MCAuto<DataArrayDouble> bc = mesh->computeCellCenterOfMass();
std::vector<double> 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 )
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingFieldDouble_getValueOnPos_1]
const double coords[4] = {0.,2.,4.};
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsArr = DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess( coords, 3, 1 );
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> mesh = MEDCouplingCMesh::New();
+ MCAuto<MEDCouplingCMesh> mesh = MEDCouplingCMesh::New();
mesh->setCoords(coordsArr,coordsArr);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field =
+ MCAuto<MEDCouplingFieldDouble> 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<DataArrayDouble> bc = mesh->getBarycenterAndOwner();
+ MCAuto<DataArrayDouble> bc = mesh->computeCellCenterOfMass();
CPPUNIT_ASSERT( val11[0] == bc->getIJ(3,0) + bc->getIJ(3,1) );
//! [CppSnippet_MEDCouplingFieldDouble_getValueOnPos_2]
}
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingFieldDouble_renumberNodes_1]
const double coords[4] = {0.,2.,4.};
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsArr = DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess( coords, 3, 1 );
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> cmesh = MEDCouplingCMesh::New();
+ MCAuto<MEDCouplingCMesh> cmesh = MEDCouplingCMesh::New();
cmesh->setCoords(coordsArr,coordsArr);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh = cmesh->buildUnstructured();
+ MCAuto<MEDCouplingUMesh> mesh = cmesh->buildUnstructured();
//! [CppSnippet_MEDCouplingFieldDouble_renumberNodes_1]
//! [CppSnippet_MEDCouplingFieldDouble_renumberNodes_2]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field =
+ MCAuto<MEDCouplingFieldDouble> field =
mesh->fillFromAnalytic( MEDCoupling::ON_NODES,2,"IVec*x+JVec*y");
const DataArrayDouble* values = field->getArray();
const DataArrayDouble* nodeCoords = mesh->getCoords();
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingFieldDouble_renumberCells_1]
const double coords[4] = {0.,2.,4.};
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsArr = DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess( coords, 3, 1 );
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> cmesh = MEDCouplingCMesh::New();
+ MCAuto<MEDCouplingCMesh> cmesh = MEDCouplingCMesh::New();
cmesh->setCoords(coordsArr,coordsArr);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh = cmesh->buildUnstructured();
+ MCAuto<MEDCouplingUMesh> mesh = cmesh->buildUnstructured();
//! [CppSnippet_MEDCouplingFieldDouble_renumberCells_1]
//! [CppSnippet_MEDCouplingFieldDouble_renumberCells_2]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field =
+ MCAuto<MEDCouplingFieldDouble> field =
mesh->fillFromAnalytic( MEDCoupling::ON_CELLS,2,"IVec*x+JVec*y");
const DataArrayDouble* values = field->getArray();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> bc = mesh->getBarycenterAndOwner();
+ MCAuto<DataArrayDouble> bc = mesh->computeCellCenterOfMass();
CPPUNIT_ASSERT( values->isEqualWithoutConsideringStr( *bc, 1e-13 ));
//! [CppSnippet_MEDCouplingFieldDouble_renumberCells_2]
//! [CppSnippet_MEDCouplingFieldDouble_renumberCells_3]
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]
}
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingFieldDouble_buildNewTimeReprFromThis_1]
const double coords[4] = {0.,2.,4.};
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsArr = DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess( coords, 3, 1 );
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> mesh = MEDCouplingCMesh::New();
+ MCAuto<MEDCouplingCMesh> mesh = MEDCouplingCMesh::New();
mesh->setCoords(coordsArr,coordsArr);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field1 =
+ MCAuto<MEDCouplingFieldDouble> 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<MEDCouplingFieldDouble> field2 =
+ MCAuto<MEDCouplingFieldDouble> field2 =
field1->buildNewTimeReprFromThis( MEDCoupling::NO_TIME, false );
CPPUNIT_ASSERT( field2->getTimeDiscretization() == MEDCoupling::NO_TIME );
//! [CppSnippet_MEDCouplingFieldDouble_buildNewTimeReprFromThis_2]
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingMesh_fillFromAnalytic3_1]
const double coords[4] = {0.,2.,4.,6.}; // 6. is not used
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> x = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> x = DataArrayDouble::New();
x->useExternalArrayWithRWAccess( coords, 3, 1 );
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> y = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> y = DataArrayDouble::New();
y->useExternalArrayWithRWAccess( coords, 2, 1 );
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> mesh=MEDCouplingCMesh::New();
+ MCAuto<MEDCouplingCMesh> 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<std::string> varNamesVec( varNames, varNames+2 );
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field =
- mesh->fillFromAnalytic3( MEDCoupling::ON_CELLS, 3, varNamesVec, func );
+ MCAuto<MEDCouplingFieldDouble> 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<DataArrayDouble> bc =
- mesh->getBarycenterAndOwner(); // func is applied to barycenters of cells
+ MCAuto<DataArrayDouble> bc =
+ mesh->computeCellCenterOfMass(); // func is applied to barycenters of cells
double bc1[2]; // coordinates of the second point
bc->getTuple( 1, bc1 );
//
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingMesh_fillFromAnalytic2_1]
const double coords[4] = {0.,2.,4.,6.}; // 6. is not used
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> x = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> x = DataArrayDouble::New();
x->useExternalArrayWithRWAccess( coords, 3, 1 );
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> y = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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<MEDCouplingCMesh> mesh=MEDCouplingCMesh::New();
+ MCAuto<MEDCouplingCMesh> 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<MEDCouplingFieldDouble> field =
- mesh->fillFromAnalytic2( MEDCoupling::ON_CELLS, 3, func );
+ MCAuto<MEDCouplingFieldDouble> 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<DataArrayDouble> bc =
- mesh->getBarycenterAndOwner(); // func is applied to barycenters of cells
+ MCAuto<DataArrayDouble> bc =
+ mesh->computeCellCenterOfMass(); // func is applied to barycenters of cells
double bc1[2]; // coordinates of the second point
bc->getTuple( 1, bc1 );
//
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingMesh_fillFromAnalytic_1]
const double coords[4] = {0.,2.,4.,6.}; // 6. is not used
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> x = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> x = DataArrayDouble::New();
x->useExternalArrayWithRWAccess( coords, 3, 1 );
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> y = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> y = DataArrayDouble::New();
y->useExternalArrayWithRWAccess( coords, 2, 1 );
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> mesh=MEDCouplingCMesh::New();
+ MCAuto<MEDCouplingCMesh> 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<MEDCouplingFieldDouble> field =
+ MCAuto<MEDCouplingFieldDouble> field =
mesh->fillFromAnalytic( MEDCoupling::ON_CELLS, 3, func );
//! [CppSnippet_MEDCouplingMesh_fillFromAnalytic_2]
//! [CppSnippet_MEDCouplingMesh_fillFromAnalytic_3]
CPPUNIT_ASSERT( field->getNumberOfComponents() == 3 ); // 3 components in the field
field->getArray()->getTuple( 1, val1 );
//
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> bc =
- mesh->getBarycenterAndOwner(); // func is applied to barycenters of cells
+ MCAuto<DataArrayDouble> bc =
+ mesh->computeCellCenterOfMass(); // func is applied to barycenters of cells
double bc1[2]; // coordinates of the second point
bc->getTuple( 1, bc1 );
//
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingCMesh_getCoordsAt_1]
const double coords[3] = {1.,2.,4.};
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> x = DataArrayDouble::New();
+ MCAuto<DataArrayDouble> x = DataArrayDouble::New();
x->useExternalArrayWithRWAccess( coords, 3, 1 );
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> mesh=MEDCouplingCMesh::New();
+ MCAuto<MEDCouplingCMesh> mesh=MEDCouplingCMesh::New();
mesh->setCoordsAt(0,x);
const DataArrayDouble* x2=mesh->getCoordsAt(0);
CPPUNIT_ASSERT( x2->isEqual( *x, 1e-13 ));
{
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_1]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh1=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> 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};
mesh1->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // #3
mesh1->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // #4
mesh1->finishInsertingCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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());
//! [CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_1]
//! [CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_2]
const int cells2[3] = { 4,2,0 }; // even cells selected
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh2 =
+ MCAuto<MEDCouplingUMesh> mesh2 =
(MEDCouplingUMesh*) mesh1->buildPartOfMySelf( cells2, cells2+3, true );
//! [CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_2]
//! [CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_3]
//! [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<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsArr=DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess( coords, 5, 2 );
// coordinates of 5 top nodes
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr2 = coordsArr->deepCpy();
+ MCAuto<DataArrayDouble> 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<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setCoords(coordsArr);
mesh->setMeshDimension(3);
mesh->allocateCells(2);
mesh->finishInsertingCells();
//! [CppSnippet_MEDCouplingUMesh_findAndCorrectBadOriented3DExtrudedCells_1]
//! [CppSnippet_MEDCouplingUMesh_findAndCorrectBadOriented3DExtrudedCells_2]
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> fixedCells =
+ MCAuto<DataArrayInt> fixedCells =
mesh->findAndCorrectBadOriented3DExtrudedCells();
CPPUNIT_ASSERT( fixedCells->getNumberOfTuples() == 2 ); // 2 cells fixed
fixedCells = mesh->findAndCorrectBadOriented3DExtrudedCells();
//! [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<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsArr=DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess( coords, 5, 2 );
// coordinates of 5 top nodes
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr2 = coordsArr->deepCpy();
+ MCAuto<DataArrayDouble> 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<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setCoords(coordsArr);
mesh->setMeshDimension(3);
mesh->allocateCells(2);
{
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingUMesh_are2DCellsNotCorrectlyOriented_1]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> 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};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4
mesh->finishInsertingCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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());
{
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingUMesh_getCellsContainingPoints_1]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> 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};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10);
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14);
mesh->finishInsertingCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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());
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<DataArrayInt> cells, cellsIndex;
+ MCAuto<DataArrayInt> cells, cellsIndex;
mesh->getCellsContainingPoints( pos, 3, eps, cells, cellsIndex );
const int cellsExpected[3]={4, 0, 1};
const int cellsIndexExpected[4]={0, 0, 1, 3};
{
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingUMesh_getCellsContainingPoint_1]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> 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};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4
mesh->finishInsertingCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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());
{
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingUMesh_buildPartOrthogonalField_1]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> 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};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4
mesh->finishInsertingCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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());
//! [CppSnippet_MEDCouplingUMesh_buildPartOrthogonalField_1]
//! [CppSnippet_MEDCouplingUMesh_buildPartOrthogonalField_2]
const int part[4] = {1,2,3,4}; // cell #0 is omitted
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> vecField=
+ MCAuto<MEDCouplingFieldDouble> vecField=
mesh->buildPartOrthogonalField( part, part+4 );
CPPUNIT_ASSERT ( vecField->getArray()->getNumberOfTuples() == 4 );
CPPUNIT_ASSERT ( vecField->getArray()->getNumberOfComponents() == 3 );
{
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingUMesh_getPartMeasureField_1]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> 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};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4
mesh->finishInsertingCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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());
//! [CppSnippet_MEDCouplingUMesh_getPartMeasureField_2]
const bool isAbs = true;
const int part[4] = {1,2,3,4}; // cell #0 is omitted
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> areaArr=
+ MCAuto<DataArrayDouble> areaArr=
mesh->getPartMeasureField( isAbs, part, part+4 );
CPPUNIT_ASSERT( areaArr->getIJ(0,0) > 0 ); // orientation ignored
areaArr=mesh->getPartMeasureField( !isAbs, part, part+4 );
//! [CppSnippet_MEDCouplingUMesh_getPartMeasureField_2]
//! [CppSnippet_MEDCouplingUMesh_getPartMeasureField_3]
const int cellIds[4] = {1,2,3,4}; // cell #0 is omitted
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> baryCenters=
+ MCAuto<DataArrayDouble> baryCenters=
mesh->getPartBarycenterAndOwner( cellIds, cellIds+4 );
CPPUNIT_ASSERT( baryCenters->getNumberOfTuples() == 4 );
CPPUNIT_ASSERT( baryCenters->getNumberOfComponents() == mesh->getSpaceDimension() );
{
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingUMesh_getCellsInBoundingBox_1]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(1);
const double coords[3*2]={0.,0., 0.,1., 1.,1};
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsArr=DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess(coords, 3,2);
mesh->setCoords(coordsArr);
mesh->allocateCells(1);
//! [CppSnippet_MEDCouplingUMesh_getCellsInBoundingBox_1]
//! [CppSnippet_MEDCouplingUMesh_getCellsInBoundingBox_2]
const double bbox[] = {1., 1., 1.001,1.001}; // xMin, xMax, yMin, yMax
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellIdsArr =
+ MCAuto<DataArrayInt> cellIdsArr =
mesh->getCellsInBoundingBox( bbox, 0.0 );
CPPUNIT_ASSERT( cellIdsArr->getNumberOfTuples() == 0 );
cellIdsArr = mesh->getCellsInBoundingBox( bbox, 0.1 );
{
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingUMesh_renumberNodesInConn_1]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(1);
const int conn[4]={4,3,2,1};
{
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingUMesh_renumberNodes_1]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> 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<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsArr=DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess(coords, 4,2);
mesh->setCoords(coordsArr);
mesh->allocateCells(0);
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<DataArrayDouble> coordsExpectedArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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<DataArrayDouble> coordsExpectedArr2=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsExpectedArr2=DataArrayDouble::New();
coordsExpectedArr2->useExternalArrayWithRWAccess(coordsExpected2, 3,2);
CPPUNIT_ASSERT( coordsExpectedArr2->isEqual( *coordsArr, 1e-13 ));
//! [CppSnippet_MEDCouplingUMesh_renumberNodes_3]
{
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingUMesh_findBoundaryNodes_1]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> 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};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10);
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14);
mesh->finishInsertingCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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<DataArrayInt> nodeIdsArr=mesh->findBoundaryNodes();
+ MCAuto<DataArrayInt> nodeIdsArr=mesh->findBoundaryNodes();
CPPUNIT_ASSERT( nodeIdsArr->getNumberOfTuples() == mesh->getNumberOfNodes() - 1 );
//! [CppSnippet_MEDCouplingUMesh_findBoundaryNodes_2]
}
{
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingUMesh_buildBoundaryMesh_1]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> 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};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10);
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14);
mesh->finishInsertingCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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<MEDCouplingPointSet> mesh1=mesh->buildBoundaryMesh(true);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingPointSet> mesh2=mesh->buildBoundaryMesh(false);
+ MCAuto<MEDCouplingPointSet> mesh1=mesh->buildBoundaryMesh(true);
+ MCAuto<MEDCouplingPointSet> 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]
{
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingUMesh_buildFacePartOfMySelfNode_1]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> 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};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4
mesh->finishInsertingCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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());
std::vector<int> nodes;
mesh->getNodeIdsOfCell( 0, nodes );
const bool allNodes = true;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh1 =
+ MCAuto<MEDCouplingUMesh> mesh1 =
(MEDCouplingUMesh*)mesh->buildFacePartOfMySelfNode( &nodes[0],&nodes[0]+nodes.size(),allNodes);
CPPUNIT_ASSERT( mesh1->getNumberOfCells() == 4 ); // 4 segments bounding QUAD4 #0 only
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh2 =
+ MCAuto<MEDCouplingUMesh> mesh2 =
(MEDCouplingUMesh*)mesh->buildFacePartOfMySelfNode( &nodes[0],&nodes[0]+nodes.size(),!allNodes);
CPPUNIT_ASSERT( mesh2->getNumberOfCells() == 9 ); // more segments added
//! [CppSnippet_MEDCouplingUMesh_buildFacePartOfMySelfNode_2]
{
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingUMesh_buildPartOfMySelfNode_1]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> 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};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4
mesh->finishInsertingCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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());
std::vector<int> nodes;
mesh->getNodeIdsOfCell( 0, nodes );
const bool allNodes = true;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh1 =
+ MCAuto<MEDCouplingUMesh> mesh1 =
(MEDCouplingUMesh*)mesh->buildPartOfMySelfNode( &nodes[0], &nodes[0]+nodes.size(), allNodes);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh2 =
+ MCAuto<MEDCouplingUMesh> mesh2 =
(MEDCouplingUMesh*)mesh->buildPartOfMySelfNode( &nodes[0], &nodes[0]+nodes.size(),!allNodes);
CPPUNIT_ASSERT_EQUAL( mesh1->getNumberOfCells(), 1 );
CPPUNIT_ASSERT_EQUAL( mesh2->getNumberOfCells(), mesh->getNumberOfCells() );
{
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingUMesh_getCellIdsLyingOnNodes_1]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> 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};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4
mesh->finishInsertingCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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());
{
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingUMesh_getCellIdsFullyIncludedInNodeIds_1]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> 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};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10);
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14);
mesh->finishInsertingCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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());
{
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingUMesh_buildPartOfMySelf_1]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> 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};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4
mesh->finishInsertingCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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());
{
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingUMesh_mergeNodes_1]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(5);
const int conn[18]={0,3,4,1, 1,4,2, 4,5,2};
1.1,0.0, // #3
1.1,0.0, // #4 == #3
0.3,-0.303}; // #5 ~~ #0
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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<DataArrayInt> arr=
+ MCAuto<DataArrayInt> 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()));
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]
{
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingUMesh_zipConnectivityTraducer_1]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(2);
mesh->allocateCells(5);
const int conn[11]={0,3,4,1, 1,4,2, 4,1,0,3};
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<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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());
{
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingUMesh_zipCoordsTraducer_1]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> 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};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10);
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14);
mesh->finishInsertingCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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());
{
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingUMesh_getNodeIdsInUse_1]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> 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};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10);
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14);
mesh->finishInsertingCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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());
{
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingUMesh_convertToPolyTypes_1]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> 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};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4
mesh->finishInsertingCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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());
{
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingUMesh_buildDescendingConnectivity2_1]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> 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};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4
mesh->finishInsertingCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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());
{
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingUMesh_buildDescendingConnectivity_1]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> 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};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4
mesh->finishInsertingCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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());
{
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingUMesh_getReverseNodalConnectivity_1]
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> 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};
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); // 3
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+14); // 4
mesh->finishInsertingCells();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> 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());
0.0,1.0}; // #3
{
mesh1->setMeshDimension(2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsArr=DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess( coords, 4, 2 );
mesh1->setCoords(coordsArr);
mesh1->allocateCells(2);
1.0,1.001}; // #3 ~ #2
{
mesh2->setMeshDimension(2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsArr=DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess( coords2, 4, 2 );
mesh2->setCoords(coordsArr);
mesh2->allocateCells(2);
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<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsArr=DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess(coords, 4,2);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> 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.};
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<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsArr=DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess(coords, 4,2);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> 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.};
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<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsArr=DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess(coords, 4,2);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setCoords(coordsArr);
//! [CppSnippet_MEDCouplingPointSet_rotate_1]
//! [CppSnippet_MEDCouplingPointSet_rotate_2]
//! [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<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsArr=DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess(cc, 2,3);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setCoords(coordsArr);
//! [CppSnippet_MEDCouplingPointSet_getBoundingBox_1]
//! [CppSnippet_MEDCouplingPointSet_getBoundingBox_2]
0.3,-0.30002, // #2
1.1,0.0, // #3
0.3,-0.30003};// #4
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsArr=DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess(coords, 5,2);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setCoords(coordsArr);
//! [CppSnippet_MEDCouplingPointSet_getNodeIdsNearPoint_1]
//! [CppSnippet_MEDCouplingPointSet_getNodeIdsNearPoint_2]
// 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
1.1,0.0, // #4
1.1,0.002, // #5
0.3,-0.303};// #6
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsArr=DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess(coords, 7,2);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setCoords(coordsArr);
//! [CppSnippet_MEDCouplingPointSet_getNodeIdsNearPoints_1]
//! [CppSnippet_MEDCouplingPointSet_getNodeIdsNearPoints_2]
// 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
1.1,0.0, // 3
1.1,0.0, // 4
0.3,-0.303};// 5
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsArr=DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess(coords, 6,2);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setCoords(coordsArr);
//! [CppSnippet_MEDCouplingPointSet_findCommonNodes_1]
//! [CppSnippet_MEDCouplingPointSet_findCommonNodes_2]
using namespace MEDCoupling;
//! [CppSnippet_MEDCouplingPointSet_getCoordinatesOfNode_1]
double coords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3};
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsArr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> coordsArr=DataArrayDouble::New();
coordsArr->useExternalArrayWithRWAccess(coords, 3,2);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> mesh=MEDCouplingUMesh::New();
mesh->setCoords(coordsArr);
//! [CppSnippet_MEDCouplingPointSet_getCoordinatesOfNode_1]
//! [CppSnippet_MEDCouplingPointSet_getCoordinatesOfNode_2]
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();
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension());
MEDCoupling::MEDCouplingUMesh *m2C=dynamic_cast<MEDCoupling::MEDCouplingUMesh *>(const_cast<MEDCoupling::MEDCouplingMesh *>(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);
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]
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]
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));
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));
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));
#include "MEDCouplingRemapperTest.hxx"
#include "MEDCouplingUMesh.hxx"
-#include "MEDCouplingExtrudedMesh.hxx"
+#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingFieldTemplate.hxx"
#include "MEDCouplingMemArray.hxx"
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);
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};
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());
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());
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());
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());
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);
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.};
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);
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());
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());
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());
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);
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());
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());
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());
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);
//
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);
//
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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());
// ------------- -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);
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++)
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.);
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.);
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.);
//------------- 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.);
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);
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};
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};
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};
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);
//
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);
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};
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};
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};
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);
{
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();
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);
};
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);
};
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);
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);
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);
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);
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"
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)
#
field=MEDCouplingFieldDouble.New(ON_CELLS)
field.setMesh(mesh)
- field.setNature(Integral)
+ field.setNature(ExtensiveMaximum)
myCoords=DataArrayDouble.New()
sampleTab=[]
for i in range(nbOfCells*9):
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
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);
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);
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
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]
#
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
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());
#
eltsV=[1,3];
mesh.convertToPolyTypes(eltsV);
- mesh.checkCoherency();
+ mesh.checkConsistencyLight();
#
desc=DataArrayInt.New();
descIndx=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());
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());
#
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());
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));
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):
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)
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())
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)
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();
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());
#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());
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());
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));
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):
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);
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);
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();
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());
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());
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());
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());
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());
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());
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());
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());
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());
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]
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]
#
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]
#
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();
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);
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);
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,
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,
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);
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);
#res=fieldOnCells.getValueOnPos(1,2,1);
#self.assertAlmostEqual(6.,res,12);
#
- meshDeepCopy=mesh.deepCpy();
+ meshDeepCopy=mesh.deepCopy();
meshClone=mesh.clone(False);
meshEmpty.copyTinyStringsFrom(mesh);
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]);
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]
#
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]
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());
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;
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);
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):
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);
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);
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();
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();
#
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):
#
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):
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):
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]
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]
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]
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();
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();
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);
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);
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]
def testConvertQuadraticCellsToLinear(self):
mesh=MEDCouplingDataForTest.build2DTargetMesh_3();
- mesh.checkCoherency();
+ mesh.checkConsistencyLight();
types=mesh.getAllGeoTypes();
types.sort()
self.assertEqual(5,len(types));
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));
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
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);
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");
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);
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);
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()));
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);
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
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
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
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):
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());
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());
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());
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());
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]
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
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]
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]
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]
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):
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):
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):
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]
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):
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):
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]
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]
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):
pass
#
f1.sortPerTuple(False);
- f1.checkCoherency();
+ f1.checkConsistencyLight();
self.assertEqual(5,f1.getNumberOfComponents());
self.assertEqual(5,f1.getNumberOfTuples());
for i in xrange(5):
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);
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());
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());
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());
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):
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):
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);
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);
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());
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.]
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());
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]
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());
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=[
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]
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
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];
f.setArray(a);
f.setMesh(m2);
#
- f.checkCoherency();
+ f.checkConsistencyLight();
m=f.getMaxValue();
self.assertAlmostEqual(8.71,m,12);
m,ws=f.getMaxValue2();
#
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();
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));
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))
m.setCoordsAt(1,da);
#
m2=m.buildUnstructured();
- m2.checkCoherency();
+ m2.checkConsistencyLight();
f1=m.getMeasureField(False);
f2=m2.getMeasureField(False);
self.assertEqual(f1.getNumberOfTuples(),6);
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);
f1.setMesh(m1);
f1.setName("f1");
f1.setArray(a1);
- f1.checkCoherency();
+ f1.checkConsistencyLight();
#
arr2V=[1,2,1,2,0,0]
f2=f1.keepSelectedComponents(arr2V);
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");
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);
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);
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);
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];
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];
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));
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));
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));
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));
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
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
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));
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());
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);
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());
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");
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");
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):
myCoords=DataArrayDouble.New();
myCoords.setValues(targetCoords,9,2);
targetMesh.setCoords(myCoords);
- targetMesh.checkCoherency();
+ targetMesh.checkConsistencyLight();
pass
def testFieldOperatorDivDiffComp1(self):
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));
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)
pass
self.assertTrue(da.isEqual(da2))
da=da3
- da3=da.deepCpy()
+ da3=da.deepCopy()
#
for it in da:
it[:]=5
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]
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)
pass
self.assertTrue(da.isEqual(da2,1e-12))
da=da3
- da3=da.deepCpy()
+ da3=da.deepCopy()
#
for it in da:
it[:]=5
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]
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
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());
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");
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
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
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);
def testUMeshFindCellIdsOnBoundary1(self):
m=MEDCouplingDataForTest.build3DSurfTargetMesh_1();
da5=m.findCellIdsOnBoundary();
- self.assertTrue(da5.isIdentity2(5));
+ self.assertTrue(da5.isIota(5));
pass
def testMeshSetTime1(self):
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);
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);
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.]
#
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):
#
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):
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());
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());
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());
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);
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]
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]
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.]
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
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):
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
#
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
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)
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):
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);
#
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);
#
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)
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);
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):
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());
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])
#
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]
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]
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];
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);
#
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.]
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);
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):
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));
#
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]
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);
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):
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());
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);
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]
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);
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());
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());
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());
mesh2D.finishInsertingCells();
myCoords=DataArrayDouble.New(mesh2DCoords,5,2);
mesh2D.setCoords(myCoords);
- mesh2D.checkCoherency();
+ mesh2D.checkConsistencyLight();
#
v=mesh2D.checkButterflyCells();
self.assertTrue(v.empty());
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]]
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):
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]);
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):
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());
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());
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
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):
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]
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]
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());
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)
if 1 in cells:
baseMesh.insertNextCell(NORM_QPOLYG, connec3)
baseMesh.finishInsertingCells()
- baseMesh.checkCoherency()
+ baseMesh.checkConsistencyLight()
return baseMesh
eps = 1.0e-7
m3.mergeNodes(eps)
m3.convertDegeneratedCells()
m3.zipCoords()
- m4 = m3.deepCpy()
+ m4 = m3.deepCopy()
m5, _, _ = MEDCouplingUMesh.Intersect2DMeshes(m3, m4, eps)
m5.mergeNodes(eps)
# Check coordinates:
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
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))
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))
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])))
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))
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
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))
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))
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
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)
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)
#
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):
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
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])
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()
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())
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):
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):
# 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))
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)]
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()))
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])))
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])))
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
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]]
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
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))
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])
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)
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"))
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)
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))
#
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
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])))
#
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))
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))
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)
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):
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))
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)
#
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))
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))
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))
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))
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))
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()
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()
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()
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()
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()
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()
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
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__
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]
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
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())
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())
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())
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())
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())
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())
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())
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())
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):
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 )
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)
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
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
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
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))
#
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
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]
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):
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)
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):
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()
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))
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))
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([])))
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)
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())
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()
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()
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])))
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]))
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()))
##
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])
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])))
#
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()))
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))
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())
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))
#
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)
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())
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))
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))
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])))
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())
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())
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())
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())
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())
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())
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])))
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])))
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)
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
#
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))
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)
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)
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])))
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)
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)
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
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])))
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):
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())
#
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())
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])))
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])))
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])))
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())
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())
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())
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())
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())
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
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())
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]"])
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))
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))
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
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]))
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))
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])
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])
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")
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)
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)
###
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)
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))
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)
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)
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)
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)
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);
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())
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))
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])
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):
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]
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
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__())
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
%{
#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingUMesh.hxx"
-#include "MEDCouplingExtrudedMesh.hxx"
+#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingCMesh.hxx"
#include "MEDCouplingIMesh.hxx"
#include "MEDCouplingCurveLinearMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingFieldTemplate.hxx"
#include "MEDCouplingGaussLocalization.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "MEDCouplingMultiFields.hxx"
#include "MEDCouplingFieldOverTime.hxx"
#include "MEDCouplingDefinitionTime.hxx"
%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__;
%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;
%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;
%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;
%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;
%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;
%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;
%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;
%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();"
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);
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<std::string>& 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<std::string>& 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);
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<DataArrayInt> elts,eltsIndex;
+ MCAuto<DataArrayInt> 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 ));
PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
+ MCAuto<DataArrayInt> elts,eltsIndex;
int spaceDim=self->getSpaceDimension();
void *da=0;
int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
+ MCAuto<DataArrayInt> d0=DataArrayInt::New();
+ MCAuto<DataArrayInt> 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 ));
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<double>& getRefCoords() const throw(INTERP_KERNEL::Exception);
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);
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<int>& 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);
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 );
}
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<int> 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)
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));
}
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:
{
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);
}
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:
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<PySliceObject *>(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 ));
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);
PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
+ MCAuto<DataArrayInt> d0=DataArrayInt::New();
+ MCAuto<DataArrayInt> d1=DataArrayInt::New();
+ MCAuto<DataArrayInt> d2=DataArrayInt::New();
+ MCAuto<DataArrayInt> 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 ));
PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
+ MCAuto<DataArrayInt> d0=DataArrayInt::New();
+ MCAuto<DataArrayInt> d1=DataArrayInt::New();
+ MCAuto<DataArrayInt> d2=DataArrayInt::New();
+ MCAuto<DataArrayInt> 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 ));
PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
+ MCAuto<DataArrayInt> d0=DataArrayInt::New();
+ MCAuto<DataArrayInt> d1=DataArrayInt::New();
+ MCAuto<DataArrayInt> d2=DataArrayInt::New();
+ MCAuto<DataArrayInt> 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 ));
PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
+ MCAuto<DataArrayInt> d0=DataArrayInt::New();
+ MCAuto<DataArrayInt> d1=DataArrayInt::New();
DataArrayInt *d2,*d3,*d4,*dd5;
MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
PyObject *ret=PyTuple_New(7);
//== 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)
}
};
- //== MEDCouplingExtrudedMesh End
+ //== MEDCouplingMappedExtrudedMesh End
class MEDCoupling1GTUMesh : public MEDCoupling::MEDCouplingPointSet
{
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)
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);
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);
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);
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<std::string>& 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<std::string>& 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<std::string>& 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<std::string>& 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);
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);
MEDCoupling_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
else
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
MEDCoupling_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
self->setArray(arr);
}
{ 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<MEDCouplingFieldDouble> ret0=MEDCoupling_MEDCouplingFieldDouble_buildSubPart(self,elt0);
+ MCAuto<MEDCouplingFieldDouble> 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 !");
case 1:
{
std::vector<int> v2(1,singleVal);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr(ret0Arr->keepSelectedComponents(v2));
+ MCAuto<DataArrayDouble> aarr(ret0Arr->keepSelectedComponents(v2));
ret0->setArray(aarr);
return ret0.retn();
}
case 2:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr(ret0Arr->keepSelectedComponents(multiVal));
+ MCAuto<DataArrayDouble> aarr(ret0Arr->keepSelectedComponents(multiVal));
ret0->setArray(aarr);
return ret0.retn();
}
std::vector<int> v2(nbOfComp);
for(int i=0;i<nbOfComp;i++)
v2[i]=slic.first+i*slic.second.second;
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr(ret0Arr->keepSelectedComponents(v2));
+ MCAuto<DataArrayDouble> aarr(ret0Arr->keepSelectedComponents(v2));
ret0->setArray(aarr);
return ret0.retn();
}
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
+ MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
ret->applyLin(1.,-val);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
+ MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
ret->applyLin(1./val,0);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
+ MCAuto<DataArrayDouble> ret=self->getArray()->deepCopy();
ret->applyPow(val);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
}
case 2:
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(a);
*self+=*ret2;
Py_XINCREF(trueSelf);
}
case 3:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(aaa);
*self+=*ret2;
Py_XINCREF(trueSelf);
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
self->getArray()->addEqual(aaa);
Py_XINCREF(trueSelf);
return trueSelf;
}
case 2:
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(a);
*self-=*ret2;
Py_XINCREF(trueSelf);
}
case 3:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(aaa);
*self-=*ret2;
Py_XINCREF(trueSelf);
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
self->getArray()->substractEqual(aaa);
Py_XINCREF(trueSelf);
return trueSelf;
}
case 2:
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(a);
*self*=*ret2;
Py_XINCREF(trueSelf);
}
case 3:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(aaa);
*self*=*ret2;
Py_XINCREF(trueSelf);
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
self->getArray()->multiplyEqual(aaa);
Py_XINCREF(trueSelf);
return trueSelf;
}
case 2:
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(a);
*self/=*ret2;
Py_XINCREF(trueSelf);
}
case 3:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(aaa);
*self/=*ret2;
Py_XINCREF(trueSelf);
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
self->getArray()->divideEqual(aaa);
Py_XINCREF(trueSelf);
return trueSelf;
}
case 2:
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(a);
*self^=*ret2;
Py_XINCREF(trueSelf);
}
case 3:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(aaa);
*self^=*ret2;
Py_XINCREF(trueSelf);
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
self->getArray()->powEqual(aaa);
Py_XINCREF(trueSelf);
return trueSelf;
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());
{
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());
{
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)
}
// 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<int>& pos) const throw(INTERP_KERNEL::Exception)
{
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);
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);
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
{
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:
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<MCData> ret=MCData::New();
+ typename MEDCoupling::MCAuto<MCData> ret=MCData::New();
if(PyArray_ISBEHAVED(elt0))//aligned and writeable and in machine byte-order
{
PyArrayObject *elt0C=reinterpret_cast<PyArrayObject *>(elt0);
PyObject *ToCSRMatrix(const std::vector<std::map<int,double> >& m, int nbCols) throw(INTERP_KERNEL::Exception)
{
int nbRows((int)m.size());
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayInt> indPtr(MEDCoupling::DataArrayInt::New()),indices(MEDCoupling::DataArrayInt::New());
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayDouble> data(MEDCoupling::DataArrayDouble::New());
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayInt> indPtr(MEDCoupling::DataArrayInt::New()),indices(MEDCoupling::DataArrayInt::New());
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> data(MEDCoupling::DataArrayDouble::New());
indPtr->alloc(nbRows+1,1);
int *intPtr_ptr(indPtr->getPointer()); intPtr_ptr[0]=0; intPtr_ptr++;
int sz2(0);
myCoords=DataArrayDouble.New();
myCoords.setValues(coords,11,2);
ret.setCoords(myCoords);
- ret.checkCoherency();
+ ret.checkConsistencyLight();
return ret;
def build2DTargetMesh_4(cls):
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.])
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.])
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])
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])
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]
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]
# 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]
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]
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 )"
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 )"
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 )"
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]
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 ) )
#! [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
#! [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]
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
#! [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 )"
#! [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 )"
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 )"
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 )
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 )
#! [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]
# 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]
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.]
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.]
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
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 ))
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 ))
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 ))
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 ))
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]
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]
da3.setInfoOnComponent(1,"c1da3")
da3.setInfoOnComponent(2,"c2da3")
#
- da1C=da1.deepCpy()
+ da1C=da1.deepCopy()
da1.meldWith(da3)
#! [PySnippet_DataArrayDouble_Meld1_1]
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)
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
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
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
# ! [PySnippetUMeshStdBuild1_4]
# ! [PySnippetUMeshStdBuild1_5]
# ! [PySnippetUMeshStdBuild1_5]
- mesh.checkCoherency()
+ mesh.checkConsistencyLight()
return
def testExampleCMeshStdBuild1(self):
# ! [PySnippetUMeshAdvBuild1_4]
# ! [PySnippetUMeshAdvBuild1_5]
# ! [PySnippetUMeshAdvBuild1_5]
- mesh.checkCoherency()
+ mesh.checkConsistencyLight()
return
def testExampleDataArrayBuild1(self):
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
// 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;
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);
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
}
//$$$$$$$$$$$$$$$$$$
-%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;
%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;
%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;
%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;
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);
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
{
//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)
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)
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);
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<std::string>& 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<std::string>& 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);
int nbOfCompo=PyInt_AS_LONG(elt2);
if(nbOfCompo<0)
throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
return ret.retn();
}
else
{//DataArrayDouble.New([1.,3.,4.],3)
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
int tmpp1=-1;
std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
}
else
{// DataArrayDouble.New([1.,3.,4.])
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
int tmpp1=-1,tmpp2=-1;
std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
if(nbOfCompo<0)
throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbOfTuples1,nbOfCompo);
return ret.retn();
}
}
else
{//DataArrayDouble.New(5)
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbOfTuples1,1);
return ret.retn();
}
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<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
+ MCAuto<DataArrayDouble> 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);
DataArrayInt *dt1=0,*dc1=0;
int sw;
convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret;
+ MCAuto<DataArrayDouble> ret;
switch(sw)
{
case 1:
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:
}
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<int> v2(1,ic1);
return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
}
}
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:
}
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<int> v2(nbOfComp);
for(int i=0;i<nbOfComp;i++)
std::pair<int, std::pair<int,int> > pt1,pc1;
DataArrayInt *dt1=0,*dc1=0;
convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp;
+ MCAuto<DataArrayDouble> tmp;
switch(sw2)
{
case 1:
if(other)
{
PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
+ MCAuto<MEDCouplingFieldDouble> 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 );
}
{
case 1:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
+ MCAuto<DataArrayDouble> ret=self->deepCopy();
ret->applyLin(1.,val);
return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
}
}
case 3:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<DataArrayDouble> 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<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> 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:
{
case 1:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
+ MCAuto<DataArrayDouble> ret=self->deepCopy();
ret->applyLin(1.,val);
return ret.retn();
}
case 3:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
return DataArrayDouble::Add(self,aaa);
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
return DataArrayDouble::Add(self,aaa);
}
default:
}
case 3:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
self->addEqual(aaa);
Py_XINCREF(trueSelf);
return trueSelf;
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
self->addEqual(aaa);
Py_XINCREF(trueSelf);
return trueSelf;
if(other)
{
PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
+ MCAuto<MEDCouplingFieldDouble> 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 );
}
{
case 1:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
+ MCAuto<DataArrayDouble> ret=self->deepCopy();
ret->applyLin(1.,-val);
return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
}
}
case 3:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<DataArrayDouble> 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<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> 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:
{
case 1:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
+ MCAuto<DataArrayDouble> ret=self->deepCopy();
ret->applyLin(-1.,val);
return ret.retn();
}
case 3:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
return DataArrayDouble::Substract(aaa,self);
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
return DataArrayDouble::Substract(aaa,self);
}
default:
}
case 3:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
self->substractEqual(aaa);
Py_XINCREF(trueSelf);
return trueSelf;
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
self->substractEqual(aaa);
Py_XINCREF(trueSelf);
return trueSelf;
if(other)
{
PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
+ MCAuto<MEDCouplingFieldDouble> 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 );
}
{
case 1:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
+ MCAuto<DataArrayDouble> ret=self->deepCopy();
ret->applyLin(val,0.);
return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
}
}
case 3:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<DataArrayDouble> 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<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> 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:
{
case 1:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
+ MCAuto<DataArrayDouble> ret=self->deepCopy();
ret->applyLin(val,0.);
return ret.retn();
}
case 3:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
return DataArrayDouble::Multiply(self,aaa);
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
return DataArrayDouble::Multiply(self,aaa);
}
default:
}
case 3:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
self->multiplyEqual(aaa);
Py_XINCREF(trueSelf);
return trueSelf;
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
self->multiplyEqual(aaa);
Py_XINCREF(trueSelf);
return trueSelf;
if(other)
{
PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
+ MCAuto<MEDCouplingFieldDouble> 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 );
}
{
if(val==0.)
throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
+ MCAuto<DataArrayDouble> ret=self->deepCopy();
ret->applyLin(1/val,0.);
return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
}
}
case 3:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<DataArrayDouble> 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<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> 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:
{
case 1:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
+ MCAuto<DataArrayDouble> ret=self->deepCopy();
ret->applyInv(val);
return ret.retn();
}
case 3:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
return DataArrayDouble::Divide(aaa,self);
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
return DataArrayDouble::Divide(aaa,self);
}
default:
}
case 3:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
self->divideEqual(aaa);
Py_XINCREF(trueSelf);
return trueSelf;
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
self->divideEqual(aaa);
Py_XINCREF(trueSelf);
return trueSelf;
{
case 1:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
+ MCAuto<DataArrayDouble> ret=self->deepCopy();
ret->applyPow(val);
return ret.retn();
}
}
case 3:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
return DataArrayDouble::Pow(self,aaa);
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
return DataArrayDouble::Pow(self,aaa);
}
default:
{
case 1:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
+ MCAuto<DataArrayDouble> ret=self->deepCopy();
ret->applyRPow(val);
return ret.retn();
}
case 3:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
return DataArrayDouble::Pow(aaa,self);
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
return DataArrayDouble::Pow(aaa,self);
}
default:
}
case 3:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
self->powEqual(aaa);
Py_XINCREF(trueSelf);
return trueSelf;
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
self->powEqual(aaa);
Py_XINCREF(trueSelf);
return trueSelf;
PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
+ MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
Py_XINCREF(trueSelf);
return trueSelf;
PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
+ MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
Py_XINCREF(trueSelf);
return trueSelf;
PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
+ MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
Py_XINCREF(trueSelf);
return trueSelf;
PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
+ MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
Py_XINCREF(trueSelf);
return trueSelf;
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);
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);
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<int>& tupl) const throw(INTERP_KERNEL::Exception);
- int locateValue(int value) const throw(INTERP_KERNEL::Exception);
- int locateValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
+ int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
+ int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
+ int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
int search(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
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);
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);
int nbOfCompo=PyInt_AS_LONG(nbOfComp);
if(nbOfCompo<0)
throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
return ret.retn();
}
else
{//DataArrayInt.New([1,3,4],3)
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
int tmpp1=-1;
std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
}
else
{// DataArrayInt.New([1,3,4])
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
int tmpp1=-1,tmpp2=-1;
std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
if(nbOfCompo<0)
throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfTuples1,nbOfCompo);
return ret.retn();
}
}
else
{//DataArrayInt.New(5)
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfTuples1,1);
return ret.retn();
}
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<int> 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)
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<int> 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));
static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New());
+ MCAuto<DataArrayInt> ret(DataArrayInt::New());
int szArr,sw,iTypppArr;
std::vector<int> stdvecTyyppArr;
const int *arrPtr(convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
}
}
- DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
+ DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
{
int sw;
int singleVal;
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;
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 !");
}
}
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 !");
{
std::vector<int> arr;
convertPyToNewIntArr3(obj,arr);
- return self->locateTuple(arr);
+ return self->findIdFirstEqualTuple(arr);
}
}
}
DataArrayInt *dt1=0,*dc1=0;
int sw;
convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
+ MCAuto<DataArrayInt> ret;
switch(sw)
{
case 1:
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:
}
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<int> v2(1,ic1);
return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
}
}
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:
}
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<int> v2(nbOfComp);
for(int i=0;i<nbOfComp;i++)
std::pair<int, std::pair<int,int> > pt1,pc1;
DataArrayInt *dt1=0,*dc1=0;
convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
+ MCAuto<DataArrayInt> tmp;
switch(sw2)
{
case 1:
{
case 1:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
+ MCAuto<DataArrayInt> ret=self->deepCopy();
ret->applyLin(1,val);
return ret.retn();
}
case 2:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
+ MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
return DataArrayInt::Add(self,aaaa);
}
case 3:
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
return DataArrayInt::Add(self,aaaa);
}
default:
{
case 1:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
+ MCAuto<DataArrayInt> ret=self->deepCopy();
ret->applyLin(1,val);
return ret.retn();
}
case 2:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
+ MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
return DataArrayInt::Add(self,aaaa);
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
return DataArrayInt::Add(self,aaaa);
}
default:
}
case 2:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
+ MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
self->addEqual(bb);
Py_XINCREF(trueSelf);
return trueSelf;
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
self->addEqual(aaaa);
Py_XINCREF(trueSelf);
return trueSelf;
{
case 1:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
+ MCAuto<DataArrayInt> ret=self->deepCopy();
ret->applyLin(1,-val);
return ret.retn();
}
case 2:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
+ MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
return DataArrayInt::Substract(self,aaaa);
}
case 3:
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
return DataArrayInt::Substract(self,aaaa);
}
default:
{
case 1:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
+ MCAuto<DataArrayInt> ret=self->deepCopy();
ret->applyLin(-1,val);
return ret.retn();
}
case 2:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
+ MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
return DataArrayInt::Substract(aaaa,self);
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
return DataArrayInt::Substract(aaaa,self);
}
default:
}
case 2:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
+ MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
self->substractEqual(bb);
Py_XINCREF(trueSelf);
return trueSelf;
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
self->substractEqual(aaaa);
Py_XINCREF(trueSelf);
return trueSelf;
{
case 1:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
+ MCAuto<DataArrayInt> ret=self->deepCopy();
ret->applyLin(val,0);
return ret.retn();
}
case 2:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
+ MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
return DataArrayInt::Multiply(self,aaaa);
}
case 3:
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
return DataArrayInt::Multiply(self,aaaa);
}
default:
{
case 1:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
+ MCAuto<DataArrayInt> ret=self->deepCopy();
ret->applyLin(val,0);
return ret.retn();
}
case 2:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
+ MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
return DataArrayInt::Multiply(self,aaaa);
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
return DataArrayInt::Multiply(self,aaaa);
}
default:
}
case 2:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
+ MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
self->multiplyEqual(bb);
Py_XINCREF(trueSelf);
return trueSelf;
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
self->multiplyEqual(aaaa);
Py_XINCREF(trueSelf);
return trueSelf;
{
case 1:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
+ MCAuto<DataArrayInt> ret=self->deepCopy();
ret->applyDivideBy(val);
return ret.retn();
}
case 2:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
+ MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
return DataArrayInt::Divide(self,aaaa);
}
case 3:
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
return DataArrayInt::Divide(self,aaaa);
}
default:
{
case 1:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
+ MCAuto<DataArrayInt> ret=self->deepCopy();
ret->applyInv(val);
return ret.retn();
}
case 2:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
+ MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
return DataArrayInt::Divide(aaaa,self);
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
return DataArrayInt::Divide(aaaa,self);
}
default:
}
case 2:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
+ MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
self->divideEqual(bb);
Py_XINCREF(trueSelf);
return trueSelf;
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
self->divideEqual(aaaa);
Py_XINCREF(trueSelf);
return trueSelf;
{
case 1:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
+ MCAuto<DataArrayInt> ret=self->deepCopy();
ret->applyModulus(val);
return ret.retn();
}
case 2:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
+ MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
return DataArrayInt::Modulus(self,aaaa);
}
case 3:
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
return DataArrayInt::Modulus(self,aaaa);
}
default:
{
case 1:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
+ MCAuto<DataArrayInt> ret=self->deepCopy();
ret->applyRModulus(val);
return ret.retn();
}
case 2:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
+ MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
return DataArrayInt::Modulus(aaaa,self);
}
case 3:
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
return DataArrayInt::Modulus(aaaa,self);
}
default:
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
self->modulusEqual(aaaa);
Py_XINCREF(trueSelf);
return trueSelf;
{
case 1:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
+ MCAuto<DataArrayInt> ret=self->deepCopy();
ret->applyPow(val);
return ret.retn();
}
case 2:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
+ MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
return DataArrayInt::Pow(self,aaaa);
}
case 3:
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
return DataArrayInt::Pow(self,aaaa);
}
default:
{
case 1:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
+ MCAuto<DataArrayInt> ret=self->deepCopy();
ret->applyRPow(val);
return ret.retn();
}
case 2:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
+ MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
return DataArrayInt::Pow(aaaa,self);
}
case 3:
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
return DataArrayInt::Pow(aaaa,self);
}
default:
}
case 4:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
self->powEqual(aaaa);
Py_XINCREF(trueSelf);
return trueSelf;
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 ));
PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
+ MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
Py_XINCREF(trueSelf);
return trueSelf;
PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
+ MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
MEDCoupling_DataArrayInt____isub___(ret,0,obj);
Py_XINCREF(trueSelf);
return trueSelf;
PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
+ MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
MEDCoupling_DataArrayInt____imul___(ret,0,obj);
Py_XINCREF(trueSelf);
return trueSelf;
PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
+ MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
Py_XINCREF(trueSelf);
return trueSelf;
PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
+ MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
MEDCoupling_DataArrayInt____imod___(ret,0,obj);
Py_XINCREF(trueSelf);
return trueSelf;
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);
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<char>& 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<char>& tupl) const throw(INTERP_KERNEL::Exception);
bool presenceOfTuple(const std::vector<char>& 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
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
{
int nbOfCompo=PyInt_AS_LONG(nbOfComp);
if(nbOfCompo<0)
throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
+ MCAuto<DataArrayByte> ret=DataArrayByte::New();
std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
return ret.retn();
}
else
{//DataArrayByte.New([1,3,4],3)
- MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
+ MCAuto<DataArrayByte> ret=DataArrayByte::New();
int tmpp1=-1;
std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
}
else
{// DataArrayByte.New([1,3,4])
- MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
+ MCAuto<DataArrayByte> ret=DataArrayByte::New();
int tmpp1=-1,tmpp2=-1;
std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
if(nbOfCompo<0)
throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
+ MCAuto<DataArrayByte> ret=DataArrayByte::New();
ret->alloc(nbOfTuples1,nbOfCompo);
return ret.retn();
}
}
else
{//DataArrayByte.New(5)
- MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
+ MCAuto<DataArrayByte> ret=DataArrayByte::New();
ret->alloc(nbOfTuples1,1);
return ret.retn();
}
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<int> ivval;
const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
std::vector<char> 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<int> ivval;
const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
std::vector<char> 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)
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);
}
}
std::pair<int, std::pair<int,int> > pt1,pc1;
DataArrayInt *dt1=0,*dc1=0;
convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
+ MCAuto<DataArrayInt> tmp;
switch(sw2)
{
case 1:
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
{
int nbOfCompo=PyInt_AS_LONG(nbOfComp);
if(nbOfCompo<0)
throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
+ MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
return ret.retn();
}
else
{//DataArrayAsciiChar.New([1,3,4],3)
- MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
+ MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
int tmpp1=-1;
std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
else
{
// DataArrayAsciiChar.New([1,3,4])
- MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
+ MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
int tmpp1=-1,tmpp2=-1;
std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
if(nbOfCompo<0)
throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
+ MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
ret->alloc(nbOfTuples1,nbOfCompo);
return ret.retn();
}
}
else
{//DataArrayAsciiChar.New(5)
- MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
+ MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
ret->alloc(nbOfTuples1,1);
return ret.retn();
}
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<char> 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<char> 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)
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 !");
}
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);
}
}
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:
//value string
case 2:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
+ MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
return self;
}
//value vector<string>
case 3:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
+ MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
return self;
}
//value string
case 2:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
+ MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
return self;
}
//value vector<string>
case 3:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
+ MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
return self;
}
//value string
case 2:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
+ MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
return self;
}
//value vector<string>
case 3:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
+ MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
return self;
}
//value string
case 2:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
+ MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
return self;
}
//value vector<string>
case 3:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
+ MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
return self;
}
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
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))
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()
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()
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))
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()
#
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))
@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"])
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))
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))
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)
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());
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;
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)
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"
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]
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]
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]
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]
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.)
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.)
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.)
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.)
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.)
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.)
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.)
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.)
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.)
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])
#
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()
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)
# (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")
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")
# (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")
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")
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()
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])
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
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])))
#
# 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.
#
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
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)
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")
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);
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);
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);
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<std::string>& 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<std::string>& 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<std::string>& 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<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
//
virtual ~MEDCouplingTimeDiscretization();
};
{
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[];
{
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[];
ret=SWIG_NewPointerObj((void*)mesh,SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh,owner);
if(dynamic_cast<MEDCoupling::MEDCoupling1DGTUMesh *>(mesh))
ret=SWIG_NewPointerObj((void*)mesh,SWIGTYPE_p_MEDCoupling__MEDCoupling1DGTUMesh,owner);
- if(dynamic_cast<MEDCoupling::MEDCouplingExtrudedMesh *>(mesh))
- ret=SWIG_NewPointerObj((void*)mesh,SWIGTYPE_p_MEDCoupling__MEDCouplingExtrudedMesh,owner);
+ if(dynamic_cast<MEDCoupling::MEDCouplingMappedExtrudedMesh *>(mesh))
+ ret=SWIG_NewPointerObj((void*)mesh,SWIGTYPE_p_MEDCoupling__MEDCouplingMappedExtrudedMesh,owner);
if(dynamic_cast<MEDCoupling::MEDCouplingCMesh *>(mesh))
ret=SWIG_NewPointerObj((void*)mesh,SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh,owner);
if(dynamic_cast<MEDCoupling::MEDCouplingCurveLinearMesh *>(mesh))
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayDouble> ret=self->getArray()->deepCpy();
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> ret=self->getArray()->deepCopy();
ret->applyLin(1.,val);
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
+ MEDCoupling::MCAuto<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayDouble> ret=MEDCoupling::DataArrayDouble::Add(self->getArray(),a);
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> ret=MEDCoupling::DataArrayDouble::Add(self->getArray(),a);
+ MEDCoupling::MCAuto<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayDouble> ret=MEDCoupling::DataArrayDouble::Add(self->getArray(),aaa);
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> ret=MEDCoupling::DataArrayDouble::Add(self->getArray(),aaa);
+ MEDCoupling::MCAuto<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayDouble> aaa=MEDCoupling::DataArrayDouble::New(); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size());
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayDouble> ret=MEDCoupling::DataArrayDouble::Add(self->getArray(),aaa);
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> aaa=MEDCoupling::DataArrayDouble::New(); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size());
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> ret=MEDCoupling::DataArrayDouble::Add(self->getArray(),aaa);
+ MEDCoupling::MCAuto<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayDouble> ret=self->getArray()->deepCpy();
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> ret=self->getArray()->deepCopy();
ret->applyLin(-1.,val);
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
+ MEDCoupling::MCAuto<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayDouble> ret=MEDCoupling::DataArrayDouble::Substract(a,self->getArray());
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> ret=MEDCoupling::DataArrayDouble::Substract(a,self->getArray());
+ MEDCoupling::MCAuto<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayDouble> ret=MEDCoupling::DataArrayDouble::Substract(aaa,self->getArray());
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> ret=MEDCoupling::DataArrayDouble::Substract(aaa,self->getArray());
+ MEDCoupling::MCAuto<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayDouble> aaa=MEDCoupling::DataArrayDouble::New(); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size());
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayDouble> ret=MEDCoupling::DataArrayDouble::Substract(aaa,self->getArray());
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> aaa=MEDCoupling::DataArrayDouble::New(); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size());
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> ret=MEDCoupling::DataArrayDouble::Substract(aaa,self->getArray());
+ MEDCoupling::MCAuto<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayDouble> ret=self->getArray()->deepCpy();
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> ret=self->getArray()->deepCopy();
ret->applyLin(val,0.);
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
+ MEDCoupling::MCAuto<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayDouble> ret=MEDCoupling::DataArrayDouble::Multiply(self->getArray(),a);
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> ret=MEDCoupling::DataArrayDouble::Multiply(self->getArray(),a);
+ MEDCoupling::MCAuto<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayDouble> ret=MEDCoupling::DataArrayDouble::Multiply(self->getArray(),aaa);
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> ret=MEDCoupling::DataArrayDouble::Multiply(self->getArray(),aaa);
+ MEDCoupling::MCAuto<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayDouble> aaa=MEDCoupling::DataArrayDouble::New(); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size());
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayDouble> ret=MEDCoupling::DataArrayDouble::Multiply(self->getArray(),aaa);
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> aaa=MEDCoupling::DataArrayDouble::New(); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size());
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> ret=MEDCoupling::DataArrayDouble::Multiply(self->getArray(),aaa);
+ MEDCoupling::MCAuto<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayDouble> ret=self->getArray()->deepCpy();
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> ret=self->getArray()->deepCopy();
ret->applyInv(val);
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
+ MEDCoupling::MCAuto<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayDouble> ret=MEDCoupling::DataArrayDouble::Divide(a,self->getArray());
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> ret=MEDCoupling::DataArrayDouble::Divide(a,self->getArray());
+ MEDCoupling::MCAuto<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayDouble> ret=MEDCoupling::DataArrayDouble::Divide(aaa,self->getArray());
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> ret=MEDCoupling::DataArrayDouble::Divide(aaa,self->getArray());
+ MEDCoupling::MCAuto<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
{
if(!self->getArray())
throw INTERP_KERNEL::Exception(msg2);
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayDouble> aaa=MEDCoupling::DataArrayDouble::New(); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size());
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayDouble> ret=MEDCoupling::DataArrayDouble::Divide(aaa,self->getArray());
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> aaa=MEDCoupling::DataArrayDouble::New(); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size());
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> ret=MEDCoupling::DataArrayDouble::Divide(aaa,self->getArray());
+ MEDCoupling::MCAuto<MEDCoupling::MEDCouplingFieldDouble> ret2=self->clone(false);
ret2->setArray(ret);
return ret2.retn();
}
return new MEDFileData;
}
-MEDFileData *MEDFileData::deepCpy() const
+MEDFileData *MEDFileData::deepCopy() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileFields> fields;
+ MCAuto<MEDFileFields> fields;
if((const MEDFileFields *)_fields)
- fields=_fields->deepCpy();
- MEDCouplingAutoRefCountObjectPtr<MEDFileMeshes> meshes;
+ fields=_fields->deepCopy();
+ MCAuto<MEDFileMeshes> meshes;
if((const MEDFileMeshes *)_meshes)
- meshes=_meshes->deepCpy();
- MEDCouplingAutoRefCountObjectPtr<MEDFileParameters> params;
+ meshes=_meshes->deepCopy();
+ MCAuto<MEDFileParameters> params;
if((const MEDFileParameters *)_params)
- params=_params->deepCpy();
- MEDCouplingAutoRefCountObjectPtr<MEDFileData> ret(MEDFileData::New());
+ params=_params->deepCopy();
+ MCAuto<MEDFileData> ret(MEDFileData::New());
ret->_fields=fields; ret->_meshes=meshes; ret->_params=params;
return ret.retn();
}
std::vector< MEDFileMesh * > meshesImpacted;
std::vector< DataArrayInt * > renumParamsOfMeshImpacted;//same size as meshesImpacted
std::vector< std::vector<int> > oldCodeOfMeshImpacted,newCodeOfMeshImpacted;//same size as meshesImpacted
- std::vector<MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > memSaverIfThrow;//same size as meshesImpacted
+ std::vector<MCAuto<DataArrayInt> > memSaverIfThrow;//same size as meshesImpacted
for(int i=0;i<ms->getNumberOfMeshes();i++)
{
MEDFileMesh *m=ms->getMeshAtPos(i);
#ifndef __MEDFILEDATA_HXX__
#define __MEDFILEDATA_HXX__
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "MEDFileParameter.hxx"
#include "MEDFileField.hxx"
#include "MEDFileMesh.hxx"
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<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDLOADER_EXPORT MEDFileFields *getFields() const;
MEDFileData();
MEDFileData(const std::string& fileName);
private:
- MEDCouplingAutoRefCountObjectPtr<MEDFileFields> _fields;
- MEDCouplingAutoRefCountObjectPtr<MEDFileMeshes> _meshes;
- MEDCouplingAutoRefCountObjectPtr<MEDFileParameters> _params;
+ MCAuto<MEDFileFields> _fields;
+ MCAuto<MEDFileMeshes> _meshes;
+ MCAuto<MEDFileParameters> _params;
};
}
{
if(!father)
throw INTERP_KERNEL::Exception("MEDFileEquivalencePair::Load : father is NULL ! Should not !");
- MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalencePair> ret(new MEDFileEquivalencePair(father,name,desc));
+ MCAuto<MEDFileEquivalencePair> ret(new MEDFileEquivalencePair(father,name,desc));
ret->load(fid);
return ret.retn();
}
return getFather()->getMesh();
}
-MEDFileEquivalencePair *MEDFileEquivalencePair::deepCpy(MEDFileEquivalences *father) const
+MEDFileEquivalencePair *MEDFileEquivalencePair::deepCopy(MEDFileEquivalences *father) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalencePair> ret(new MEDFileEquivalencePair(father,_name,_description));
+ MCAuto<MEDFileEquivalencePair> ret(new MEDFileEquivalencePair(father,_name,_description));
const MEDFileEquivalenceCell *cell(_cell);
if(cell)
- ret->_cell=cell->deepCpy(const_cast<MEDFileEquivalencePair *>(this));
+ ret->_cell=cell->deepCopy(const_cast<MEDFileEquivalencePair *>(this));
const MEDFileEquivalenceNode *node(_node);
if(node)
- ret->_node=node->deepCpy(const_cast<MEDFileEquivalencePair *>(this));
+ ret->_node=node->deepCopy(const_cast<MEDFileEquivalencePair *>(this));
return ret.retn();
}
MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceSize,(fid,meshName.c_str(),_name.c_str(),dt,it,MED_NODE,MED_NONE,&ncor));
if(ncor>0)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da(DataArrayInt::New());
+ MCAuto<DataArrayInt> 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<MEDFileEquivalenceNode> node(new MEDFileEquivalenceNode(this,da));
+ MCAuto<MEDFileEquivalenceNode> node(new MEDFileEquivalenceNode(this,da));
_node=node;
}
_cell=MEDFileEquivalenceCell::Load(fid,this);
void MEDFileEquivalences::pushEquivalence(MEDFileEquivalencePair *elt)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalencePair> elta(elt);
+ MCAuto<MEDFileEquivalencePair> elta(elt);
if(elt)
elt->incrRef();
_equ.push_back(elta);
MEDFileEquivalencePair *MEDFileEquivalences::getEquivalenceWithName(const std::string& name)
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalencePair> >::iterator it=_equ.begin();it!=_equ.end();it++)
+ for(std::vector< MCAuto<MEDFileEquivalencePair> >::iterator it=_equ.begin();it!=_equ.end();it++)
{
MEDFileEquivalencePair *elt(*it);
if(elt)
std::vector<std::string> MEDFileEquivalences::getEquivalenceNames() const
{
std::vector<std::string> ret;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalencePair> >::const_iterator it=_equ.begin();it!=_equ.end();it++)
+ for(std::vector< MCAuto<MEDFileEquivalencePair> >::const_iterator it=_equ.begin();it!=_equ.end();it++)
{
const MEDFileEquivalencePair *elt(*it);
if(elt)
MEDFileEquivalencePair *MEDFileEquivalences::appendEmptyEquivalenceWithName(const std::string& name)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalencePair> elt(MEDFileEquivalencePair::New(this,name));
+ MCAuto<MEDFileEquivalencePair> elt(MEDFileEquivalencePair::New(this,name));
_equ.push_back(elt);
return elt;
}
-MEDFileEquivalences *MEDFileEquivalences::deepCpy(MEDFileMesh *owner) const
+MEDFileEquivalences *MEDFileEquivalences::deepCopy(MEDFileMesh *owner) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalences> ret(new MEDFileEquivalences(owner));
+ MCAuto<MEDFileEquivalences> ret(new MEDFileEquivalences(owner));
ret->deepCpyFrom(*this);
return ret.retn();
}
void MEDFileEquivalences::getRepr(std::ostream& oss) const
{
std::size_t ii(0);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalencePair> >::const_iterator it=_equ.begin();it!=_equ.end();it++,ii++)
+ for(std::vector< MCAuto<MEDFileEquivalencePair> >::const_iterator it=_equ.begin();it!=_equ.end();it++,ii++)
{
const MEDFileEquivalencePair *elt(*it);
oss << "Equivalence #" << ii << " : " ;
void MEDFileEquivalences::killEquivalenceWithName(const std::string& name)
{
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalencePair> >::iterator it(_equ.begin());
+ std::vector< MCAuto<MEDFileEquivalencePair> >::iterator it(_equ.begin());
for(;it!=_equ.end();it++)
{
const MEDFileEquivalencePair *elt(*it);
std::ostringstream oss; oss << "MEDFileEquivalences::killEquivalenceAt : Id must be in [0," << sz << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalencePair> >::iterator it(_equ.begin());
+ std::vector< MCAuto<MEDFileEquivalencePair> >::iterator it(_equ.begin());
for(int j=0;j<i;it++,j++);
_equ.erase(it);
}
void MEDFileEquivalences::write(med_idt fid) const
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalencePair> >::const_iterator it=_equ.begin();it!=_equ.end();it++)
+ for(std::vector< MCAuto<MEDFileEquivalencePair> >::const_iterator it=_equ.begin();it!=_equ.end();it++)
{
const MEDFileEquivalencePair *elt(*it);
if(elt)
MEDFileEquivalences *MEDFileEquivalences::Load(med_idt fid, int nbOfEq, MEDFileMesh *owner)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalences> ret(new MEDFileEquivalences(owner));
+ MCAuto<MEDFileEquivalences> ret(new MEDFileEquivalences(owner));
if(!owner)
throw INTERP_KERNEL::Exception("MEDFileEquivalences::Load : owner is NULL !");
std::string meshName(owner->getName());
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<MEDFileEquivalencePair> eqv(MEDFileEquivalencePair::Load(ret,fid,eqName,eqDescName));
+ MCAuto<MEDFileEquivalencePair> eqv(MEDFileEquivalencePair::Load(ret,fid,eqName,eqDescName));
ret->pushEquivalence(eqv);
}
return ret.retn();
void MEDFileEquivalences::deepCpyFrom(const MEDFileEquivalences& other)
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalencePair> >::const_iterator it=other._equ.begin();it!=other._equ.end();it++)
+ for(std::vector< MCAuto<MEDFileEquivalencePair> >::const_iterator it=other._equ.begin();it!=other._equ.end();it++)
{
const MEDFileEquivalencePair *elt(*it);
- MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalencePair> eltCpy;
+ MCAuto<MEDFileEquivalencePair> eltCpy;
if(elt)
{
- eltCpy=elt->deepCpy(this);
+ eltCpy=elt->deepCopy(this);
}
_equ.push_back(eltCpy);
}
INTERP_KERNEL::AutoPtr<char> 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<DataArrayInt> da2(da->deepCpy()); da2->rearrange(1); da2->applyLin(1,1); da2->rearrange(2);
+ MCAuto<DataArrayInt> 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()));
}
return sizeof(MEDFileEquivalenceCellType);
}
-MEDFileEquivalenceCellType *MEDFileEquivalenceCellType::deepCpy(MEDFileEquivalencePair *owner) const
+MEDFileEquivalenceCellType *MEDFileEquivalenceCellType::deepCopy(MEDFileEquivalencePair *owner) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da;
+ MCAuto<DataArrayInt> da;
if(getArray())
- da=getArray()->deepCpy();
+ da=getArray()->deepCopy();
return new MEDFileEquivalenceCellType(owner,_type,da);
}
MEDFileEquivalenceCell *MEDFileEquivalenceCell::Load(med_idt fid, MEDFileEquivalencePair *owner)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalenceCell> ret(new MEDFileEquivalenceCell(owner));
+ MCAuto<MEDFileEquivalenceCell> ret(new MEDFileEquivalenceCell(owner));
ret->load(fid);
if(ret->size()>0)
return ret.retn();
void MEDFileEquivalenceCell::write(med_idt fid) const
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalenceCellType> >::const_iterator it=_types.begin();it!=_types.end();it++)
+ for(std::vector< MCAuto<MEDFileEquivalenceCellType> >::const_iterator it=_types.begin();it!=_types.end();it++)
{
const MEDFileEquivalenceCellType *ct(*it);
if(ct)
}
}
-MEDFileEquivalenceCell *MEDFileEquivalenceCell::deepCpy(MEDFileEquivalencePair *owner) const
+MEDFileEquivalenceCell *MEDFileEquivalenceCell::deepCopy(MEDFileEquivalencePair *owner) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalenceCell> ret(new MEDFileEquivalenceCell(owner));
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalenceCellType> >::const_iterator it=_types.begin();it!=_types.end();it++)
+ MCAuto<MEDFileEquivalenceCell> ret(new MEDFileEquivalenceCell(owner));
+ for(std::vector< MCAuto<MEDFileEquivalenceCellType> >::const_iterator it=_types.begin();it!=_types.end();it++)
{
const MEDFileEquivalenceCellType *elt(*it);
- MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalenceCellType> eltCpy;
+ MCAuto<MEDFileEquivalenceCellType> eltCpy;
if(elt)
- eltCpy=elt->deepCpy(owner);
+ eltCpy=elt->deepCopy(owner);
ret->_types.push_back(eltCpy);
}
return ret.retn();
void MEDFileEquivalenceCell::getRepr(std::ostream& oss) const
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalenceCellType> >::const_iterator it=_types.begin();it!=_types.end();it++)
+ for(std::vector< MCAuto<MEDFileEquivalenceCellType> >::const_iterator it=_types.begin();it!=_types.end();it++)
{
const MEDFileEquivalenceCellType *elt(*it);
if(elt)
DataArrayInt *MEDFileEquivalenceCell::getArray(INTERP_KERNEL::NormalizedCellType type)
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalenceCellType> >::iterator it=_types.begin();it!=_types.end();it++)
+ for(std::vector< MCAuto<MEDFileEquivalenceCellType> >::iterator it=_types.begin();it!=_types.end();it++)
{
MEDFileEquivalenceCellType *elt(*it);
if(elt && elt->getType()==type)
MEDFileMesh *mm(getMesh());
int totalNbOfCells(mm->getNumberOfCellsAtLevel(meshDimRelToMax));
//
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp(da->deepCpy()); tmp->rearrange(1);
+ MCAuto<DataArrayInt> tmp(da->deepCopy()); tmp->rearrange(1);
int maxv,minv;
tmp->getMinMaxValues(minv,maxv);
if((minv<0 || minv>=totalNbOfCells) || (maxv<0 || maxv>=totalNbOfCells))
for(std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator it=gts.begin();it!=gts.end();it++)
{
endId=startId+mm->getNumberOfCellsWithType(*it);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da0(da->keepSelectedComponents(compS));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids(da0->getIdsInRange(startId,endId));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da1(da->selectByTupleIdSafe(ids->begin(),ids->end()));
+ MCAuto<DataArrayInt> da0(da->keepSelectedComponents(compS));
+ MCAuto<DataArrayInt> ids(da0->findIdsInRange(startId,endId));
+ MCAuto<DataArrayInt> da1(da->selectByTupleIdSafe(ids->begin(),ids->end()));
da1->applyLin(1,-startId);
setArrayForType(*it,da1);
startId=endId;
void MEDFileEquivalenceCell::setArrayForType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da)
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalenceCellType> >::iterator it=_types.begin();it!=_types.end();it++)
+ for(std::vector< MCAuto<MEDFileEquivalenceCellType> >::iterator it=_types.begin();it!=_types.end();it++)
{
MEDFileEquivalenceCellType *elt(*it);
if(elt && elt->getType()==type)
return ;
}
}
- MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalenceCellType> newElt(new MEDFileEquivalenceCellType(getFather(),type,da));
+ MCAuto<MEDFileEquivalenceCellType> newElt(new MEDFileEquivalenceCellType(getFather(),type,da));
_types.push_back(newElt);
}
std::vector<INTERP_KERNEL::NormalizedCellType> MEDFileEquivalenceCell::getTypes() const
{
std::vector<INTERP_KERNEL::NormalizedCellType> ret;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalenceCellType> >::const_iterator it=_types.begin();it!=_types.end();it++)
+ for(std::vector< MCAuto<MEDFileEquivalenceCellType> >::const_iterator it=_types.begin();it!=_types.end();it++)
{
const MEDFileEquivalenceCellType *elt(*it);
if(elt)
MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceSize,(fid,meshName.c_str(),name.c_str(),dt,it,MED_CELL,typmai[i],&ncor));
if(ncor>0)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da(DataArrayInt::New());
+ MCAuto<DataArrayInt> 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<MEDFileEquivalenceCellType> ct(new MEDFileEquivalenceCellType(getFather(),typmai2[i],da));
+ MCAuto<MEDFileEquivalenceCellType> ct(new MEDFileEquivalenceCellType(getFather(),typmai2[i],da));
_types.push_back(ct);
}
}
writeLL(fid,MED_NODE,MED_NONE);
}
-MEDFileEquivalenceNode *MEDFileEquivalenceNode::deepCpy(MEDFileEquivalencePair *owner) const
+MEDFileEquivalenceNode *MEDFileEquivalenceNode::deepCopy(MEDFileEquivalencePair *owner) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da;
+ MCAuto<DataArrayInt> da;
if(getArray())
- da=getArray()->deepCpy();
- MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalenceNode> ret(new MEDFileEquivalenceNode(owner,da));
+ da=getArray()->deepCopy();
+ MCAuto<MEDFileEquivalenceNode> ret(new MEDFileEquivalenceNode(owner,da));
return ret.retn();
}
#include "MEDCouplingRefCountObject.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MEDFileUtilities.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include <vector>
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);
MEDFileEquivalences *_father;
std::string _name;
std::string _description;
- MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalenceCell> _cell;
- MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalenceNode> _node;
+ MCAuto<MEDFileEquivalenceCell> _cell;
+ MCAuto<MEDFileEquivalenceNode> _node;
};
class MEDFileEquivalences : public RefCountObject
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:
void deepCpyFrom(const MEDFileEquivalences& other);
private:
MEDFileMesh *_owner;
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalencePair> > _equ;
+ std::vector< MCAuto<MEDFileEquivalencePair> > _equ;
};
class MEDFileEquivalenceBase : public RefCountObject
protected:
~MEDFileEquivalenceData() { }
protected:
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _data;
+ MCAuto<DataArrayInt> _data;
};
class MEDFileEquivalenceCellType : public MEDFileEquivalenceData
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:
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:
void load(med_idt fid);
std::string getName() const { return getFather()->getName(); }
private:
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalenceCellType> > _types;
+ std::vector< MCAuto<MEDFileEquivalenceCellType> > _types;
};
class MEDFileEquivalenceNode : public MEDFileEquivalenceData
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:
_nb_gauss_pt=_w.size();
}
-MEDFileFieldLoc *MEDFileFieldLoc::deepCpy() const
+MEDFileFieldLoc *MEDFileFieldLoc::deepCopy() const
{
return new MEDFileFieldLoc(*this);
}
{
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<DataArrayInt> arr=field->getDiscretization()->getOffsetArr(field->getMesh());
+ MCAuto<DataArrayInt> 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;
if(!disc2)
throw INTERP_KERNEL::Exception("assignFieldNoProfile : invalid call to this method ! Internal Error !");
const DataArrayInt *dai=disc2->getArrayOfDiscIds();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> dai2=disc2->getOffsetArr(field->getMesh());
+ MCAuto<DataArrayInt> dai2=disc2->getOffsetArr(field->getMesh());
const int *dai2Ptr=dai2->getConstPointer();
int nbi=gsLoc.getWeights().size();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da2=dai->selectByTupleId2(offset,offset+nbOfCells,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da3=da2->getIdsEqual(_loc_id);
+ MCAuto<DataArrayInt> da2=dai->selectByTupleIdSafeSlice(offset,offset+nbOfCells,1);
+ MCAuto<DataArrayInt> da3=da2->findIdsEqual(_loc_id);
const int *da3Ptr=da3->getConstPointer();
if(da3->getNumberOfTuples()!=nbOfCells)
{//profile : for gauss even in NoProfile !!!
da3->setName(_profile.c_str());
glob.appendProfile(da3);
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da4=DataArrayInt::New();
+ MCAuto<DataArrayInt> da4=DataArrayInt::New();
_nval=da3->getNbOfElems();
da4->alloc(_nval*nbi,1);
int *da4Ptr=da4->getPointer();
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;
}
}
case ON_GAUSS_NE:
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr=field->getDiscretization()->getOffsetArr(mesh);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr2=arr->deltaShiftIndex();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr3=arr2->selectByTupleId(multiTypePfl->begin(),multiTypePfl->end());
- arr3->computeOffsets2();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp=idsInPfl->buildExplicitArrByRanges(arr3);
+ MCAuto<DataArrayInt> arr=field->getDiscretization()->getOffsetArr(mesh);
+ MCAuto<DataArrayInt> arr2=arr->deltaShiftIndex();
+ MCAuto<DataArrayInt> arr3=arr2->selectByTupleId(multiTypePfl->begin(),multiTypePfl->end());
+ arr3->computeOffsetsFull();
+ MCAuto<DataArrayInt> tmp=idsInPfl->buildExplicitArrByRanges(arr3);
int trueNval=tmp->getNumberOfTuples();
_nval=idsInPfl->getNumberOfTuples();
getOrCreateAndGetArray()->setContigPartOfSelectedValues(_start,arrr,tmp);
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<DataArrayInt> da2=da1->selectByTupleId(idsInPfl->begin(),idsInPfl->end());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da3=da2->getIdsEqual(_loc_id);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da4=idsInPfl->selectByTupleId(da3->begin(),da3->end());
+ MCAuto<DataArrayInt> da2=da1->selectByTupleId(idsInPfl->begin(),idsInPfl->end());
+ MCAuto<DataArrayInt> da3=da2->findIdsEqual(_loc_id);
+ MCAuto<DataArrayInt> da4=idsInPfl->selectByTupleId(da3->begin(),da3->end());
//
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> mesh2=mesh->buildPart(multiTypePfl->begin(),multiTypePfl->end());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr=disc2->getOffsetArr(mesh2);
+ MCAuto<MEDCouplingMesh> mesh2=mesh->buildPart(multiTypePfl->begin(),multiTypePfl->end());
+ MCAuto<DataArrayInt> arr=disc2->getOffsetArr(mesh2);
//
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp=DataArrayInt::New();
+ MCAuto<DataArrayInt> 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);
oss << "_loc_" << _loc_id;
if(locIds)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da5=locIds->selectByTupleId(da3->begin(),da3->end());
+ MCAuto<DataArrayInt> 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);
{
_start=start;
_nval=arrr->getNumberOfTuples();
- getOrCreateAndGetArray()->setContigPartOfSelectedValues2(_start,arrr,0,_nval,1);
+ getOrCreateAndGetArray()->setContigPartOfSelectedValuesSlice(_start,arrr,0,_nval,1);
_end=_start+_nval;
start=_end;
}
return ret;
}
-MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::deepCpy(MEDFileFieldPerMeshPerType *father) const
+MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::deepCopy(MEDFileFieldPerMeshPerType *father) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> ret=new MEDFileFieldPerMeshPerTypePerDisc(*this);
+ MCAuto<MEDFileFieldPerMeshPerTypePerDisc> ret=new MEDFileFieldPerMeshPerTypePerDisc(*this);
ret->_father=father;
return ret.retn();
}
const DataArrayPartDefinition *dpd(dynamic_cast<const DataArrayPartDefinition *>(pd));
if(dpd)
{
- dpd->checkCoherency();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> myIds(dpd->toDAI());
+ dpd->checkConsistencyLight();
+ MCAuto<DataArrayInt> 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<DataArrayDouble> tmp(DataArrayDouble::New());
+ MCAuto<DataArrayDouble> 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<unsigned char *>(tmp->getPointer())));
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> feeder(DataArrayDouble::New());
+ MCAuto<DataArrayDouble> feeder(DataArrayDouble::New());
feeder->useExternalArrayWithRWAccess(reinterpret_cast<double *>(startFeedingPtr),_nval,nbOfCompo);
feeder->setContigPartOfSelectedValues(0,tmp,myIds);
}
const DataArrayInt *explicitIdsInMesh,
const std::vector<int>& newCode,
MEDFileFieldGlobsReal& glob, DataArrayDouble *arr,
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >& result)
+ std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >& result)
{
if(entriesOnSameDisc.empty())
return false;
int nbi=szTuples/szEntities;
if(szTuples%szEntities!=0)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks : internal error the splitting into same dicretization failed !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> renumTuples=DataArrayInt::New(); renumTuples->alloc(szTuples,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ranges=MEDCouplingUMesh::ComputeRangesFromTypeDistribution(newCode);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > newGeoTypesPerChunk(entriesOnSameDisc.size());
+ MCAuto<DataArrayInt> renumTuples=DataArrayInt::New(); renumTuples->alloc(szTuples,1);
+ MCAuto<DataArrayInt> ranges=MEDCouplingUMesh::ComputeRangesFromTypeDistribution(newCode);
+ std::vector< MCAuto<DataArrayInt> > newGeoTypesPerChunk(entriesOnSameDisc.size());
std::vector< const DataArrayInt * > newGeoTypesPerChunk2(entriesOnSameDisc.size());
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > newGeoTypesPerChunk_bis(entriesOnSameDisc.size());
+ std::vector< MCAuto<DataArrayInt> > newGeoTypesPerChunk_bis(entriesOnSameDisc.size());
std::vector< const DataArrayInt * > newGeoTypesPerChunk3(entriesOnSameDisc.size());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newGeoTypesPerChunk4=DataArrayInt::New(); newGeoTypesPerChunk4->alloc(szEntities,nbi);
+ MCAuto<DataArrayInt> 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<DataArrayInt> newEltIds=explicitIdsInMesh->substr(startOfEltIdOfChunk,startOfEltIdOfChunk+(*it)->_nval);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> rangeIdsForChunk=newEltIds->findRangeIdForEachTuple(ranges);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> idsInRrangeForChunk=newEltIds->findIdInRangeForEachTuple(ranges);
+ MCAuto<DataArrayInt> newEltIds=explicitIdsInMesh->substr(startOfEltIdOfChunk,startOfEltIdOfChunk+(*it)->_nval);
+ MCAuto<DataArrayInt> rangeIdsForChunk=newEltIds->findRangeIdForEachTuple(ranges);
+ MCAuto<DataArrayInt> idsInRrangeForChunk=newEltIds->findIdInRangeForEachTuple(ranges);
//
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp=rangeIdsForChunk->duplicateEachTupleNTimes(nbi); rangeIdsForChunk->rearrange(nbi);
+ MCAuto<DataArrayInt> 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<DataArrayInt> newGeoTypesEltIdsAllGather=DataArrayInt::Aggregate(newGeoTypesPerChunk2); newGeoTypesPerChunk.clear(); newGeoTypesPerChunk2.clear();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newGeoTypesEltIdsAllGather2=DataArrayInt::Aggregate(newGeoTypesPerChunk3); newGeoTypesPerChunk_bis.clear(); newGeoTypesPerChunk3.clear();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> diffVals=newGeoTypesEltIdsAllGather->getDifferentValues();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> renumEltIds=newGeoTypesEltIdsAllGather->buildPermArrPerLevel();
+ MCAuto<DataArrayInt> newGeoTypesEltIdsAllGather=DataArrayInt::Aggregate(newGeoTypesPerChunk2); newGeoTypesPerChunk.clear(); newGeoTypesPerChunk2.clear();
+ MCAuto<DataArrayInt> newGeoTypesEltIdsAllGather2=DataArrayInt::Aggregate(newGeoTypesPerChunk3); newGeoTypesPerChunk_bis.clear(); newGeoTypesPerChunk3.clear();
+ MCAuto<DataArrayInt> diffVals=newGeoTypesEltIdsAllGather->getDifferentValues();
+ MCAuto<DataArrayInt> renumEltIds=newGeoTypesEltIdsAllGather->buildPermArrPerLevel();
//
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> renumTupleIds=newGeoTypesPerChunk4->buildPermArrPerLevel();
+ MCAuto<DataArrayInt> renumTupleIds=newGeoTypesPerChunk4->buildPermArrPerLevel();
//
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arrPart=arr->substr(offset,offset+szTuples);
+ MCAuto<DataArrayDouble> arrPart=arr->substr(offset,offset+szTuples);
arrPart->renumberInPlace(renumTupleIds->begin());
arr->setPartOfValues1(arrPart,offset,offset+szTuples,1,0,arrPart->getNumberOfComponents(),1);
bool ret=false;
int offset2=0;
for(int i=0;i<diffVals->getNumberOfTuples();i++,idIt++)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids=newGeoTypesEltIdsAllGather->getIdsEqual(*idIt);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> subIds=newGeoTypesEltIdsAllGather2->selectByTupleId(ids->begin(),ids->end());
+ MCAuto<DataArrayInt> ids=newGeoTypesEltIdsAllGather->findIdsEqual(*idIt);
+ MCAuto<DataArrayInt> subIds=newGeoTypesEltIdsAllGather2->selectByTupleId(ids->begin(),ids->end());
int nbEntityElts=subIds->getNumberOfTuples();
bool ret2;
- MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> eltToAdd=MEDFileFieldPerMeshPerTypePerDisc::
- NewObjectOnSameDiscThanPool(type,(INTERP_KERNEL::NormalizedCellType)newCode[3*(*idIt)],subIds,!subIds->isIdentity2(newCode[3*(*idIt)+1]),nbi,
+ MCAuto<MEDFileFieldPerMeshPerTypePerDisc> 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;
std::size_t MEDFileFieldPerMeshPerType::getHeapMemorySizeWithoutChildren() const
{
- return _field_pm_pt_pd.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc>);
+ return _field_pm_pt_pd.capacity()*sizeof(MCAuto<MEDFileFieldPerMeshPerTypePerDisc>);
}
std::vector<const BigMemoryObject *> MEDFileFieldPerMeshPerType::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::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<MEDFileFieldPerMeshPerType> ret=new MEDFileFieldPerMeshPerType(*this);
+ MCAuto<MEDFileFieldPerMeshPerType> ret=new MEDFileFieldPerMeshPerType(*this);
ret->_father=father;
std::size_t i=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::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();
}
void MEDFileFieldPerMeshPerType::assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> pfl2=pfl->deepCpy();
+ MCAuto<DataArrayInt> 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);
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<DataArrayInt> da2=da->selectByTupleId2(offset,offset+nbOfCells,1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> retTmp=da2->getDifferentValues();
+ MCAuto<DataArrayInt> da2=da->selectByTupleIdSafeSlice(offset,offset+nbOfCells,1);
+ MCAuto<DataArrayInt> retTmp=da2->getDifferentValues();
if(retTmp->presenceOfValue(-1))
throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : some cells have no dicretization description !");
std::vector<int> ret(retTmp->begin(),retTmp->end());
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<DataArrayInt> da2=da->selectByTupleIdSafe(subCells->getConstPointer(),subCells->getConstPointer()+subCells->getNumberOfTuples());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> retTmp=da2->getDifferentValues();
+ MCAuto<DataArrayInt> da2=da->selectByTupleIdSafe(subCells->getConstPointer(),subCells->getConstPointer()+subCells->getNumberOfTuples());
+ MCAuto<DataArrayInt> retTmp=da2->getDifferentValues();
if(retTmp->presenceOfValue(-1))
throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : some cells have no dicretization description !");
std::vector<int> ret(retTmp->begin(),retTmp->end());
void MEDFileFieldPerMeshPerType::fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
{
(*it)->fillTypesOfFieldAvailable(types);
}
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<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++)
{
const MEDFileFieldPerMeshPerTypePerDisc *cur=(*it);
if(cur)
void MEDFileFieldPerMeshPerType::getSizes(int& globalSz, int& nbOfEntries) const
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
{
globalSz+=(*it)->getNumberOfTuples();
}
bool MEDFileFieldPerMeshPerType::presenceOfMultiDiscPerGeoType() const
{
std::size_t nb(0);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
{
const MEDFileFieldPerMeshPerTypePerDisc *fmtd(*it);
if(fmtd)
{
std::vector<std::string> ret;
std::set<std::string> ret2;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++)
{
std::string tmp=(*it1)->getProfile();
if(!tmp.empty())
{
std::vector<std::string> ret;
std::set<std::string> ret2;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::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)
{
std::vector<std::string> ret;
std::set<std::string> ret2;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++)
{
std::string tmp=(*it1)->getProfile();
if(!tmp.empty())
std::vector<std::string> MEDFileFieldPerMeshPerType::getLocsReallyUsedMulti() const
{
std::vector<std::string> ret;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::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)
void MEDFileFieldPerMeshPerType::changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::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::vector<std::string>, std::string > >& mapOfModif)
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++)
(*it1)->changeLocsRefsNamesGen(mapOfModif);
}
if(meshDim!=(int)cm.getDimension())
return ;
}
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::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<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
{
int i=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::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<MEDFileFieldPerMeshPerTypePerDisc> >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
(*it)->setFather(this);
}
bool MEDFileFieldPerMeshPerType::keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair<int,int> >& its)
{
bool ret(false);
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> > newPmPtPd;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
+ std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> > newPmPtPd;
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
if((*it)->getType()==tof)
{
newPmPtPd.push_back(*it);
{
if(_field_pm_pt_pd.size()<=idOfDisc)
return false;
- MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> elt(_field_pm_pt_pd[idOfDisc]);
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> > newPmPtPd(1,elt);
+ MCAuto<MEDFileFieldPerMeshPerTypePerDisc> elt(_field_pm_pt_pd[idOfDisc]);
+ std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> > newPmPtPd(1,elt);
std::pair<int,int> bgEnd; bgEnd.first=_field_pm_pt_pd[idOfDisc]->getStart(); bgEnd.second=_field_pm_pt_pd[idOfDisc]->getEnd();
elt->setNewStart(globalNum);
globalNum=elt->getEnd();
void MEDFileFieldPerMeshPerType::loadOnlyStructureOfDataRecursively(med_idt fid, int &start, const MEDFileFieldNameScope& nasc)
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::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<MEDFileFieldPerMeshPerTypePerDisc> >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::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<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
+ for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
{
(*it)->copyOptionsFrom(*this);
(*it)->writeLL(fid,nasc);
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<const BigMemoryObject *> MEDFileFieldPerMesh::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> 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();
}
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)
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);
}
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<TypeOfField>& 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);
}
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)
{
std::vector<std::string> ret;
std::set<std::string> 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<std::string> tmp=(*it)->getPflsReallyUsed();
for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
std::vector<std::string> MEDFileFieldPerMesh::getPflsReallyUsedMulti() const
{
std::vector<std::string> 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<std::string> tmp=(*it)->getPflsReallyUsedMulti();
ret.insert(ret.end(),tmp.begin(),tmp.end());
{
std::vector<std::string> ret;
std::set<std::string> 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<std::string> tmp=(*it)->getLocsReallyUsed();
for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
std::vector<std::string> MEDFileFieldPerMesh::getLocsReallyUsedMulti() const
{
std::vector<std::string> 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<std::string> tmp=(*it)->getLocsReallyUsedMulti();
ret.insert(ret.end(),tmp.begin(),tmp.end());
else
otherEntries.push_back(getLeafGivenTypeAndLocId((*it).first.first,(*it).first.second));
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> renumDefrag=DataArrayInt::New(); renumDefrag->alloc(arr->getNumberOfTuples(),1); renumDefrag->fillWithZero();
+ MCAuto<DataArrayInt> renumDefrag=DataArrayInt::New(); renumDefrag->alloc(arr->getNumberOfTuples(),1); renumDefrag->fillWithZero();
////////////////////
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> explicitIdsOldInMesh=DataArrayInt::New(); explicitIdsOldInMesh->alloc(sz,1);//sz is a majorant of the real size. A realloc will be done after
+ MCAuto<DataArrayInt> 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);
for(std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> >::const_iterator itL1=entriesKeptML.begin();itL1!=entriesKeptML.end();itL1++,sid++)
{
// tupleIdOfStartOfNewChuncksV[sid-1]=sz2;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> explicitIdsOldInArr=DataArrayInt::New(); explicitIdsOldInArr->alloc(sz,1);
+ MCAuto<DataArrayInt> 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++)
{
explicitIdsOldInMesh->reAlloc(sz2);
int tupleIdOfStartOfNewChuncks=arr->getNumberOfTuples()-sz2;
////////////////////
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> permArrDefrag=renumDefrag->buildPermArrPerLevel(); renumDefrag=0;
+ MCAuto<DataArrayInt> permArrDefrag=renumDefrag->buildPermArrPerLevel(); renumDefrag=0;
// perform redispatching of non concerned MEDFileFieldPerMeshPerTypePerDisc
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> > otherEntriesNew;
+ std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> > 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<MEDFileFieldPerMeshPerTypePerDisc> > entriesKeptNew;
+ std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> > entriesKeptNew;
std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> entriesKeptNew2;
for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesKept.begin();it!=entriesKept.end();it++)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> elt=MEDFileFieldPerMeshPerTypePerDisc::New(*(*it));
+ MCAuto<MEDFileFieldPerMeshPerTypePerDisc> elt=MEDFileFieldPerMeshPerTypePerDisc::New(*(*it));
int newStart=elt->getLocId();
elt->setLocId((*it)->getGeoType());
elt->setNewStart(newStart);
entriesKeptNew.push_back(elt);
entriesKeptNew2.push_back(elt);
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2=arr->renumber(permArrDefrag->getConstPointer());
+ MCAuto<DataArrayDouble> arr2=arr->renumber(permArrDefrag->getConstPointer());
// perform redispatching of concerned MEDFileFieldPerMeshPerTypePerDisc -> values are in arr2
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> explicitIdsNewInMesh=renumO2N->selectByTupleId(explicitIdsOldInMesh->begin(),explicitIdsOldInMesh->end());
+ MCAuto<DataArrayInt> 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++)
return false;
// Assign new dispatching
assignNewLeaves(otherEntriesNew);
- arr->cpyFrom(*arr2);
+ arr->deepCopyFrom(*arr2);
return true;
}
*/
void MEDFileFieldPerMesh::keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair<int,int> >& 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<int,int> > its2;
if((*it)->keepOnlySpatialDiscretization(tof,globalNum,its2))
*/
void MEDFileFieldPerMesh::keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair<int,int> >& 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<int,int> > its2;
if((*it)->keepOnlyGaussDiscretization(idOfDisc,globalNum,its2))
_field_pm_pt=ret;
}
-void MEDFileFieldPerMesh::assignNewLeaves(const std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerTypePerDisc > >& leaves)
+void MEDFileFieldPerMesh::assignNewLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves)
{
- std::map<INTERP_KERNEL::NormalizedCellType,std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerTypePerDisc> > > types;
- for( std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerTypePerDisc > >::const_iterator it=leaves.begin();it!=leaves.end();it++)
+ std::map<INTERP_KERNEL::NormalizedCellType,std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc> > > 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<INTERP_KERNEL::NormalizedCellType,std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerTypePerDisc> > >::const_iterator it1=types.begin();
- std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it2=fieldPmPt.begin();
+ std::vector< MCAuto< MEDFileFieldPerMeshPerType > > fieldPmPt(types.size());
+ std::map<INTERP_KERNEL::NormalizedCellType,std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc> > >::const_iterator it1=types.begin();
+ std::vector< MCAuto< MEDFileFieldPerMeshPerType > >::iterator it2=fieldPmPt.begin();
for(;it1!=types.end();it1++,it2++)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerType> elt=MEDFileFieldPerMeshPerType::New(this,(INTERP_KERNEL::NormalizedCellType)((*it1).second[0]->getLocId()));
+ MCAuto<MEDFileFieldPerMeshPerType> elt=MEDFileFieldPerMeshPerType::New(this,(INTERP_KERNEL::NormalizedCellType)((*it1).second[0]->getLocId()));
elt->setLeaves((*it1).second);
*it2=elt;
}
void MEDFileFieldPerMesh::changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, 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::vector<std::string>, 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<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
+MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
{
if(_field_pm_pt.empty())
throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : no types field set !");
std::vector<DataArrayInt *> notNullPflsPerGeoType;
std::vector<int> locs,code;
std::vector<INTERP_KERNEL::NormalizedCellType> 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);
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
//
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
+ std::vector< MCAuto<DataArrayInt> > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
std::vector< const DataArrayInt *> notNullPflsPerGeoType3(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
if(type!=ON_NODES)
{
return finishField(type,glob,dads,locs,mesh,isPfl,arrOut,nasc);
else
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr2(arr);
+ MCAuto<DataArrayInt> arr2(arr);
return finishField2(type,glob,dads,locs,geoTypes,mesh,arr,isPfl,arrOut,nasc);
}
}
std::vector<DataArrayInt *> notNullPflsPerGeoType;
std::vector<int> locs,code;
std::vector<INTERP_KERNEL::NormalizedCellType> 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);
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<DataArrayInt> > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
+ std::vector< MCAuto<DataArrayInt> > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
std::vector< const DataArrayInt *> notNullPflsPerGeoType3(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
if(type!=ON_NODES)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr=mesh->checkTypeConsistencyAndContig(code,notNullPflsPerGeoType3);
+ MCAuto<DataArrayInt> arr=mesh->checkTypeConsistencyAndContig(code,notNullPflsPerGeoType3);
return finishField4(dads,arr,mesh->getNumberOfCells(),pfl);
}
else
{
int globalSz=0;
int 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)->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);
}
MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId)
{
- 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++)
{
if((*it)->getGeoType()==typ)
return (*it)->getLeafGivenLocId(locId);
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() << "\", ";
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);
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() << "\", ";
{
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)
*/
MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField(TypeOfField type, const MEDFileFieldGlobsReal *glob,
const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs,
- const MEDCouplingMesh *mesh, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
+ const MEDCouplingMesh *mesh, bool& isPfl, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
{
isPfl=false;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(type,ONE_TIME);
+ MCAuto<MEDCouplingFieldDouble> 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<DataArray> da=getOrCreateAndGetArray()->selectByTupleRanges(dads);
+ MCAuto<DataArray> da=getOrCreateAndGetArray()->selectByTupleRanges(dads);
const std::vector<std::string>& infos=getInfo();
da->setInfoOnComponents(infos);
da->setName("");
std::vector<std::pair<int,int> > dads2(1,dads[i]); const std::vector<int> locs2(1,locs[i]);
const std::vector<INTERP_KERNEL::NormalizedCellType> geoTypes2(1,INTERP_KERNEL::NORM_ERROR);
int nbOfElems=ComputeNbOfElems(glob,type,geoTypes2,dads2,locs2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> di=DataArrayInt::New();
+ MCAuto<DataArrayInt> di=DataArrayInt::New();
di->alloc(nbOfElems,1);
di->iota(offset);
const MEDFileFieldLoc& fl=glob->getLocalizationFromId(locs[i]);
MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField2(TypeOfField type, const MEDFileFieldGlobsReal *glob,
const std::vector<std::pair<int,int> >& dads, const std::vector<int>& locs,
const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes,
- const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
+ const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto<DataArray>& 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<MEDCouplingMesh> m2=mesh->buildPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
+ MCAuto<MEDCouplingMesh> m2=mesh->buildPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
m2->setName(mesh->getName().c_str());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=finishField(type,glob,dads,locs,m2,isPfl,arrOut,nasc);
+ MCAuto<MEDCouplingFieldDouble> ret=finishField(type,glob,dads,locs,m2,isPfl,arrOut,nasc);
isPfl=true;
return ret.retn();
}
*/
MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileFieldGlobsReal *glob,
const std::vector<std::pair<int,int> >& dads, const std::vector<int>& locs,
- const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
+ const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto<DataArray>& 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<const MEDCouplingUMesh *>(mesh);
{
if(meshu->getNodalConnectivity()==0)
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=finishField(ON_CELLS,glob,dads,locs,mesh,isPfl,arrOut,nasc);
+ MCAuto<MEDCouplingFieldDouble> ret=finishField(ON_CELLS,glob,dads,locs,mesh,isPfl,arrOut,nasc);
int nb=da->getNbOfElems();
const int *ptr=da->getConstPointer();
MEDCouplingUMesh *meshuc=const_cast<MEDCouplingUMesh *>(meshu);
}
}
//
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=finishField(ON_NODES,glob,dads,locs,mesh,isPfl,arrOut,nasc);
+ MCAuto<MEDCouplingFieldDouble> ret=finishField(ON_NODES,glob,dads,locs,mesh,isPfl,arrOut,nasc);
isPfl=true;
DataArrayInt *arr2=0;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellIds=mesh->getCellIdsFullyIncludedInNodeIds(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> mesh2=mesh->buildPartAndReduceNodes(cellIds->getConstPointer(),cellIds->getConstPointer()+cellIds->getNbOfElems(),arr2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr3(arr2);
+ MCAuto<DataArrayInt> cellIds=mesh->getCellIdsFullyIncludedInNodeIds(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
+ MCAuto<MEDCouplingMesh> mesh2=mesh->buildPartAndReduceNodes(cellIds->getConstPointer(),cellIds->getConstPointer()+cellIds->getNbOfElems(),arr2);
+ MCAuto<DataArrayInt> arr3(arr2);
int nnodes=mesh2->getNumberOfNodes();
if(nnodes==(int)da->getNbOfElems())
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da3=da->transformWithIndArrR(arr2->begin(),arr2->end());
+ MCAuto<DataArrayInt> da3=da->transformWithIndArrR(arr2->begin(),arr2->end());
arrOut->renumberInPlace(da3->getConstPointer());
mesh2->setName(mesh->getName().c_str());
ret->setMesh(mesh2);
pflOut=const_cast<DataArrayInt*>(pflIn);
pflOut->incrRef();
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> safePfl(pflOut);
- MEDCouplingAutoRefCountObjectPtr<DataArray> da=getOrCreateAndGetArray()->selectByTupleRanges(dads);
+ MCAuto<DataArrayInt> safePfl(pflOut);
+ MCAuto<DataArray> da=getOrCreateAndGetArray()->selectByTupleRanges(dads);
const std::vector<std::string>& infos=getInfo();
int nbOfComp=infos.size();
for(int i=0;i<nbOfComp;i++)
int nbOfPfls=_pfls.size();
for(int i=0;i<nbOfPfls;i++)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cpy=_pfls[i]->deepCpy();
+ MCAuto<DataArrayInt> cpy=_pfls[i]->deepCopy();
cpy->applyLin(1,1,0);
INTERP_KERNEL::AutoPtr<char> pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
MEDLoaderBase::safeStrCpy(_pfls[i]->getName().c_str(),MED_NAME_SIZE,pflName,opt.getTooLongStrPolicy());
void MEDFileFieldGlobs::appendGlobs(const MEDFileFieldGlobs& other, double eps)
{
std::vector<std::string> pfls=getPfls();
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >::const_iterator it=other._pfls.begin();it!=other._pfls.end();it++)
+ for(std::vector< MCAuto<DataArrayInt> >::const_iterator it=other._pfls.begin();it!=other._pfls.end();it++)
{
std::vector<std::string>::iterator it2=std::find(pfls.begin(),pfls.end(),(*it)->getName());
if(it2==pfls.end())
}
}
std::vector<std::string> locs=getLocs();
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldLoc> >::const_iterator it=other._locs.begin();it!=other._locs.end();it++)
+ for(std::vector< MCAuto<MEDFileFieldLoc> >::const_iterator it=other._locs.begin();it!=other._locs.end();it++)
{
std::vector<std::string>::iterator it2=std::find(locs.begin(),locs.end(),(*it)->getName());
if(it2==locs.end())
std::size_t MEDFileFieldGlobs::getHeapMemorySizeWithoutChildren() const
{
- return _file_name.capacity()+_pfls.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr<DataArrayInt>)+_locs.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr<MEDFileFieldLoc>);
+ return _file_name.capacity()+_pfls.capacity()*sizeof(MCAuto<DataArrayInt>)+_locs.capacity()*sizeof(MCAuto<MEDFileFieldLoc>);
}
std::vector<const BigMemoryObject *> MEDFileFieldGlobs::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> 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<MEDFileFieldLoc> >::const_iterator it=_locs.begin();it!=_locs.end();it++)
+ for(std::vector< MCAuto<MEDFileFieldLoc> >::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<MEDFileFieldGlobs> ret=new MEDFileFieldGlobs(*this);
+ MCAuto<MEDFileFieldGlobs> ret=new MEDFileFieldGlobs(*this);
std::size_t i=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++)
+ for(std::vector< MCAuto<DataArrayInt> >::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<MEDFileFieldLoc> >::const_iterator it=_locs.begin();it!=_locs.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileFieldLoc> >::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();
}
*/
MEDFileFieldGlobs *MEDFileFieldGlobs::shallowCpyPart(const std::vector<std::string>& pfls, const std::vector<std::string>& locs) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileFieldGlobs> ret=MEDFileFieldGlobs::New();
+ MCAuto<MEDFileFieldGlobs> ret=MEDFileFieldGlobs::New();
for(std::vector<std::string>::const_iterator it1=pfls.begin();it1!=pfls.end();it1++)
{
DataArrayInt *pfl=const_cast<DataArrayInt *>(getProfile((*it1).c_str()));
if(!pfl)
throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::shallowCpyPart : internal error ! pfl null !");
pfl->incrRef();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> pfl2(pfl);
+ MCAuto<DataArrayInt> pfl2(pfl);
ret->_pfls.push_back(pfl2);
}
for(std::vector<std::string>::const_iterator it2=locs.begin();it2!=locs.end();it2++)
if(!loc)
throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::shallowCpyPart : internal error ! loc null !");
loc->incrRef();
- MEDCouplingAutoRefCountObjectPtr<MEDFileFieldLoc> loc2(loc);
+ MCAuto<MEDFileFieldLoc> loc2(loc);
ret->_locs.push_back(loc2);
}
ret->setFileName(getFileName());
*/
MEDFileFieldGlobs *MEDFileFieldGlobs::deepCpyPart(const std::vector<std::string>& pfls, const std::vector<std::string>& locs) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileFieldGlobs> ret=MEDFileFieldGlobs::New();
+ MCAuto<MEDFileFieldGlobs> ret=MEDFileFieldGlobs::New();
for(std::vector<std::string>::const_iterator it1=pfls.begin();it1!=pfls.end();it1++)
{
DataArrayInt *pfl=const_cast<DataArrayInt *>(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<std::string>::const_iterator it2=locs.begin();it2!=locs.end();it2++)
{
MEDFileFieldLoc *loc=const_cast<MEDFileFieldLoc *>(&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();
void MEDFileFieldGlobs::changePflsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >::iterator it=_pfls.begin();it!=_pfls.end();it++)
+ for(std::vector< MCAuto<DataArrayInt> >::iterator it=_pfls.begin();it!=_pfls.end();it++)
{
DataArrayInt *elt(*it);
if(elt)
void MEDFileFieldGlobs::changeLocsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldLoc> >::iterator it=_locs.begin();it!=_locs.end();it++)
+ for(std::vector< MCAuto<MEDFileFieldLoc> >::iterator it=_locs.begin();it!=_locs.end();it++)
{
MEDFileFieldLoc *elt(*it);
if(elt)
{
public:
LocFinder(const std::string& loc):_loc(loc) { }
- bool operator() (const MEDCouplingAutoRefCountObjectPtr<MEDFileFieldLoc>& loc) { return loc->isName(_loc); }
+ bool operator() (const MCAuto<MEDFileFieldLoc>& loc) { return loc->isName(_loc); }
private:
const std::string &_loc;
};
{
public:
PflFinder(const std::string& pfl):_pfl(pfl) { }
- bool operator() (const MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& pfl) { return _pfl==pfl->getName(); }
+ bool operator() (const MCAuto<DataArrayInt>& pfl) { return _pfl==pfl->getName(); }
private:
const std::string& _pfl;
};
int MEDFileFieldGlobs::getLocalizationId(const std::string& loc) const
{
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldLoc> >::const_iterator it=std::find_if(_locs.begin(),_locs.end(),MEDCouplingImpl::LocFinder(loc));
+ std::vector< MCAuto<MEDFileFieldLoc> >::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 : ";
const DataArrayInt *MEDFileFieldGlobs::getProfile(const std::string& pflName) const
{
std::string pflNameCpp(pflName);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >::const_iterator it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pflNameCpp));
+ std::vector< MCAuto<DataArrayInt> >::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 : ";
DataArrayInt *MEDFileFieldGlobs::getProfile(const std::string& pflName)
{
std::string pflNameCpp(pflName);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >::iterator it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pflNameCpp));
+ std::vector< MCAuto<DataArrayInt> >::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 : ";
void MEDFileFieldGlobs::killProfileIds(const std::vector<int>& pflIds)
{
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > newPfls;
+ std::vector< MCAuto<DataArrayInt> > newPfls;
int i=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++)
+ for(std::vector< MCAuto<DataArrayInt> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++)
{
if(std::find(pflIds.begin(),pflIds.end(),i)==pflIds.end())
newPfls.push_back(*it);
void MEDFileFieldGlobs::killLocalizationIds(const std::vector<int>& locIds)
{
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldLoc> > newLocs;
+ std::vector< MCAuto<MEDFileFieldLoc> > newLocs;
int i=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldLoc> >::const_iterator it=_locs.begin();it!=_locs.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileFieldLoc> >::const_iterator it=_locs.begin();it!=_locs.end();it++,i++)
{
if(std::find(locIds.begin(),locIds.end(),i)==locIds.end())
newLocs.push_back(*it);
{
std::map<int,std::vector<int> > m;
int i=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++)
+ for(std::vector< MCAuto<DataArrayInt> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++)
{
const DataArrayInt *tmp=(*it);
if(tmp)
std::string name(pfl->getName());
if(name.empty())
throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::appendProfile : unsupported profiles with no name !");
- 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++)
if(name==(*it)->getName())
{
if(!pfl->isEqual(*(*it)))
std::string name(locName);
if(name.empty())
throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::appendLoc : unsupported localizations with no name !");
- MEDCouplingAutoRefCountObjectPtr<MEDFileFieldLoc> obj=MEDFileFieldLoc::New(locName,geoType,refCoo,gsCoo,w);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldLoc> >::const_iterator it=_locs.begin();it!=_locs.end();it++)
+ MCAuto<MEDFileFieldLoc> obj=MEDFileFieldLoc::New(locName,geoType,refCoo,gsCoo,w);
+ for(std::vector< MCAuto<MEDFileFieldLoc> >::const_iterator it=_locs.begin();it!=_locs.end();it++)
if((*it)->isName(locName))
{
if(!(*it)->isEqual(*obj,1e-12))
{
_globals=other._globals;
if((const MEDFileFieldGlobs *)_globals)
- _globals=other._globals->deepCpy();
+ _globals=other._globals->deepCopy();
}
/*!
{
_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);
}
}
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)
oss << startOfLine << "----------------------" << std::endl;
}
-std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > MEDFileAnyTypeField1TSWithoutSDA::splitComponents() const
+std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > 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<MEDFileAnyTypeField1TSWithoutSDA> > ret(nbOfCompo);
+ std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > ret(nbOfCompo);
for(int i=0;i<nbOfCompo;i++)
{
- ret[i]=deepCpy();
+ ret[i]=deepCopy();
std::vector<int> v(1,i);
- MEDCouplingAutoRefCountObjectPtr<DataArray> arr2=arr->keepSelectedComponents(v);
+ MCAuto<DataArray> arr2=arr->keepSelectedComponents(v);
ret[i]->setArray(arr2);
}
return ret;
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;
}
bool MEDFileAnyTypeField1TSWithoutSDA::changeMeshNames(const std::vector< std::pair<std::string,std::string> >& 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)
void MEDFileAnyTypeField1TSWithoutSDA::fillTypesOfFieldAvailable(std::vector<TypeOfField>& types) const
{
std::set<TypeOfField> 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);
}
{
std::vector<std::string> ret;
std::set<std::string> 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<std::string> tmp=(*it)->getPflsReallyUsed();
for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
{
std::vector<std::string> ret;
std::set<std::string> 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<std::string> tmp=(*it)->getLocsReallyUsed();
for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
std::vector<std::string> MEDFileAnyTypeField1TSWithoutSDA::getPflsReallyUsedMulti2() const
{
std::vector<std::string> 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<std::string> tmp=(*it)->getPflsReallyUsedMulti();
ret.insert(ret.end(),tmp.begin(),tmp.end());
{
std::vector<std::string> ret;
std::set<std::string> 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<std::string> tmp=(*it)->getLocsReallyUsedMulti();
ret.insert(ret.end(),tmp.begin(),tmp.end());
void MEDFileAnyTypeField1TSWithoutSDA::changePflsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, 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::vector<std::string>, 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);
}
std::string mName2(mName);
int ret=0;
std::vector<std::string> 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
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++)
{
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)
*
* \sa splitMultiDiscrPerGeoTypes
*/
-std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > MEDFileAnyTypeField1TSWithoutSDA::splitDiscretizations() const
+std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > MEDFileAnyTypeField1TSWithoutSDA::splitDiscretizations() const
{
std::vector<INTERP_KERNEL::NormalizedCellType> types;
std::vector< std::vector<TypeOfField> > typesF;
for(std::vector< std::vector<TypeOfField> >::const_iterator it1=typesF.begin();it1!=typesF.end();it1++)
for(std::vector<TypeOfField>::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++)
allEnt.insert(*it2);
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > ret(allEnt.size());
+ std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > ret(allEnt.size());
std::set<TypeOfField>::const_iterator it3(allEnt.begin());
for(std::size_t i=0;i<allEnt.size();i++,it3++)
{
*
* \sa splitDiscretizations
*/
-std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > MEDFileAnyTypeField1TSWithoutSDA::splitMultiDiscrPerGeoTypes() const
+std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > MEDFileAnyTypeField1TSWithoutSDA::splitMultiDiscrPerGeoTypes() const
{
std::vector<INTERP_KERNEL::NormalizedCellType> types;
std::vector< std::vector<TypeOfField> > typesF;
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::splitMultiDiscrPerGeoTypes : empty field !");
if(nbOfMDPGT==1)
{
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > ret0(1);
+ std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > ret0(1);
ret0[0]=const_cast<MEDFileAnyTypeField1TSWithoutSDA *>(this); this->incrRef();
return ret0;
}
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > ret(nbOfMDPGT);
+ std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > ret(nbOfMDPGT);
for(std::size_t i=0;i<nbOfMDPGT;i++)
{
std::vector< std::pair<int,int> > its;
int MEDFileAnyTypeField1TSWithoutSDA::keepOnlySpatialDiscretization(TypeOfField tof, std::vector< std::pair<int,int> >& 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;
}
int MEDFileAnyTypeField1TSWithoutSDA::keepOnlyGaussDiscretization(std::size_t idOfDisc, std::vector< std::pair<int,int> >& 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;
}
const DataArray *oldArr(getUndergroundDataArray());
if(oldArr)
{
- MEDCouplingAutoRefCountObjectPtr<DataArray> newArr(createNewEmptyDataArrayInstance());
+ MCAuto<DataArray> 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
const DataArray *oldArr(getUndergroundDataArray());
if(!oldArr || !oldArr->isAllocated())
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::updateData : internal error 1 !");
- MEDCouplingAutoRefCountObjectPtr<DataArray> newArr(createNewEmptyDataArrayInstance());
+ MCAuto<DataArray> newArr(createNewEmptyDataArrayInstance());
newArr->alloc(newLgth,getNumberOfComponents());
if(oldArr)
newArr->copyStringInfoFrom(*oldArr);
{
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);
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);
}
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<const BigMemoryObject *> MEDFileAnyTypeField1TSWithoutSDA::getDirectChildrenWithNull() const
std::vector<const BigMemoryObject *> 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;
}
std::vector<DataArrayInt *> idsInPflPerType;
std::vector<DataArrayInt *> idsPerType;
std::vector<int> code,code2;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> m(mesh->getMeshAtLevel(meshDimRelToMax));
+ MCAuto<MEDCouplingMesh> m(mesh->getMeshAtLevel(meshDimRelToMax));
if(type!=ON_NODES)
{
m->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > idsInPflPerType2(idsInPflPerType.size()); std::copy(idsInPflPerType.begin(),idsInPflPerType.end(),idsInPflPerType2.begin());
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > idsPerType2(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType2.begin());
+ std::vector< MCAuto<DataArrayInt> > idsInPflPerType2(idsInPflPerType.size()); std::copy(idsInPflPerType.begin(),idsInPflPerType.end(),idsInPflPerType2.begin());
+ std::vector< MCAuto<DataArrayInt> > idsPerType2(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType2.begin());
std::vector<const DataArrayInt *> idsPerType3(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType3.begin());
// start of check
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field2=field->clone(false);
+ MCAuto<MEDCouplingFieldDouble> field2=field->clone(false);
int nbOfTuplesExp=field2->getNumberOfTuplesExpectedRegardingCode(code,idsPerType3);
if(nbOfTuplesExp!=arrOfVals->getNumberOfTuples())
{
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)
* \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<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
+MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm;
+ MCAuto<MEDFileMesh> mm;
if(mName.empty())
mm=MEDFileMesh::New(glob->getFileName(),getMeshName().c_str(),getMeshIteration(),getMeshOrder());
else
* \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<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
+MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> m(mesh->getMeshAtLevel(meshDimRelToMax,false));
+ MCAuto<MEDCouplingMesh> m(mesh->getMeshAtLevel(meshDimRelToMax,false));
const DataArrayInt *d=mesh->getNumberFieldAtLevel(meshDimRelToMax);
const DataArrayInt *e=mesh->getNumberFieldAtLevel(1);
if(meshDimRelToMax==1)
* \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<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
+MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtTopLevel(TypeOfField type, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm;
+ MCAuto<MEDFileMesh> mm;
if(mName.empty())
mm=MEDFileMesh::New(glob->getFileName(),getMeshName().c_str(),getMeshIteration(),getMeshOrder());
else
* \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<DataArray>& 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<DataArray>& 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<MEDCouplingFieldDouble> ret=_field_per_mesh[meshId]->getFieldOnMeshAtLevel(type,glob,mesh,isPfl,arrOut,nasc);
+ MCAuto<MEDCouplingFieldDouble> ret=_field_per_mesh[meshId]->getFieldOnMeshAtLevel(type,glob,mesh,isPfl,arrOut,nasc);
switch(renumPol)
{
case 0:
oss << "\"" << nasc.getName() << "\" not defined on all nodes !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nodeRenumSafe=nodeRenum->checkAndPreparePermutation();
+ MCAuto<DataArrayInt> nodeRenumSafe=nodeRenum->checkAndPreparePermutation();
if(!dynamic_cast<DataArrayDouble *>((DataArray *)arrOut))
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : node renumbering not implemented for not double DataArrays !");
ret->renumberNodes(nodeRenumSafe->getConstPointer());
*/
DataArray *MEDFileAnyTypeField1TSWithoutSDA::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> m(mesh->getMeshAtLevel(meshDimRelToMax));
+ MCAuto<MEDCouplingMesh> m(mesh->getMeshAtLevel(meshDimRelToMax));
int meshId=getMeshIdFromMeshName(mesh->getName().c_str());
- MEDCouplingAutoRefCountObjectPtr<DataArray> ret=_field_per_mesh[meshId]->getFieldOnMeshAtLevelWithPfl(type,m,pfl,glob,nasc);
+ MCAuto<DataArray> ret=_field_per_mesh[meshId]->getFieldOnMeshAtLevelWithPfl(type,m,pfl,glob,nasc);
ret->setName(nasc.getName().c_str());
return ret.retn();
}
std::set<INTERP_KERNEL::NormalizedCellType> geoTypes=mesh->getAllGeoTypes();
int nbOfTypes=geoTypes.size();
std::vector<int> code(3*nbOfTypes);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr1=DataArrayInt::New();
+ MCAuto<DataArrayInt> arr1=DataArrayInt::New();
arr1->alloc(nbOfTypes,1);
int *arrPtr=arr1->getPointer();
std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=geoTypes.begin();
for(int i=0;i<nbOfTypes;i++,it++)
arrPtr[i]=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,*it));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr2=arr1->checkAndPreparePermutation();
+ MCAuto<DataArrayInt> arr2=arr1->checkAndPreparePermutation();
const int *arrPtr2=arr2->getConstPointer();
int i=0;
for(it=geoTypes.begin();it!=geoTypes.end();it++,i++)
ret[i].resize(nbOfRet1);
for(int j=0;j<nbOfRet1;j++)
{
- DataArrayDouble *tmp=_arr->selectByTupleId2(p[j].first,p[j].second,1);
+ DataArrayDouble *tmp=_arr->selectByTupleIdSafeSlice(p[j].first,p[j].second,1);
ret[i][j]=tmp;
}
}
MEDFileIntField1TSWithoutSDA *MEDFileField1TSWithoutSDA::convertToInt() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TSWithoutSDA> ret(new MEDFileIntField1TSWithoutSDA);
+ MCAuto<MEDFileIntField1TSWithoutSDA> ret(new MEDFileIntField1TSWithoutSDA);
ret->MEDFileAnyTypeField1TSWithoutSDA::operator =(*this);
ret->deepCpyLeavesFrom(*this);
const DataArrayDouble *arr(_arr);
if(arr)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr2(arr->convertToIntArr());
+ MCAuto<DataArrayInt> arr2(arr->convertToIntArr());
ret->setArray(arr2);
}
return ret.retn();
MEDFileAnyTypeField1TSWithoutSDA *MEDFileField1TSWithoutSDA::shallowCpy() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA> ret(new MEDFileField1TSWithoutSDA(*this));
+ MCAuto<MEDFileField1TSWithoutSDA> ret(new MEDFileField1TSWithoutSDA(*this));
ret->deepCpyLeavesFrom(*this);
return ret.retn();
}
-MEDFileAnyTypeField1TSWithoutSDA *MEDFileField1TSWithoutSDA::deepCpy() const
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileField1TSWithoutSDA::deepCopy() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA> ret=static_cast<MEDFileField1TSWithoutSDA *>(shallowCpy());
+ MCAuto<MEDFileField1TSWithoutSDA> ret=static_cast<MEDFileField1TSWithoutSDA *>(shallowCpy());
if((const DataArrayDouble *)_arr)
- ret->_arr=_arr->deepCpy();
+ ret->_arr=_arr->deepCopy();
return ret.retn();
}
MEDFileField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::convertToDouble() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA> ret(new MEDFileField1TSWithoutSDA);
+ MCAuto<MEDFileField1TSWithoutSDA> ret(new MEDFileField1TSWithoutSDA);
ret->MEDFileAnyTypeField1TSWithoutSDA::operator =(*this);
ret->deepCpyLeavesFrom(*this);
const DataArrayInt *arr(_arr);
if(arr)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2(arr->convertToDblArr());
+ MCAuto<DataArrayDouble> arr2(arr->convertToDblArr());
ret->setArray(arr2);
}
return ret.retn();
MEDFileAnyTypeField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::shallowCpy() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TSWithoutSDA> ret(new MEDFileIntField1TSWithoutSDA(*this));
+ MCAuto<MEDFileIntField1TSWithoutSDA> ret(new MEDFileIntField1TSWithoutSDA(*this));
ret->deepCpyLeavesFrom(*this);
return ret.retn();
}
-MEDFileAnyTypeField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::deepCpy() const
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::deepCopy() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TSWithoutSDA> ret=static_cast<MEDFileIntField1TSWithoutSDA *>(shallowCpy());
+ MCAuto<MEDFileIntField1TSWithoutSDA> ret=static_cast<MEDFileIntField1TSWithoutSDA *>(shallowCpy());
if((const DataArrayInt *)_arr)
- ret->_arr=_arr->deepCpy();
+ ret->_arr=_arr->deepCopy();
return ret.retn();
}
std::vector<std::string> infos;
std::string dtunit,fieldName;
LocateField2(fid,fileName,0,true,fieldName,typcha,infos,dtunit);
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> ret;
+ MCAuto<MEDFileAnyTypeField1TSWithoutSDA> ret;
switch(typcha)
{
case MED_FLOAT64:
std::string dtunit;
int iii=-1;
int nbSteps=LocateField(fid,fileName,fieldName,iii,typcha,infos,dtunit);
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> ret;
+ MCAuto<MEDFileAnyTypeField1TSWithoutSDA> ret;
switch(typcha)
{
case MED_FLOAT64:
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::BuildNewInstanceFromContent : empty content in input : unable to build a new instance !");
if(dynamic_cast<const MEDFileField1TSWithoutSDA *>(c))
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret=MEDFileField1TS::New();
+ MCAuto<MEDFileField1TS> ret=MEDFileField1TS::New();
ret->setFileName(fileName);
ret->_content=c; c->incrRef();
return ret.retn();
}
if(dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(c))
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret=MEDFileIntField1TS::New();
+ MCAuto<MEDFileIntField1TS> ret=MEDFileIntField1TS::New();
ret->setFileName(fileName);
ret->_content=c; c->incrRef();
return ret.retn();
{
MEDFileUtilities::CheckFileForRead(fileName);
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> c=BuildContentFrom(fid,fileName,loadAll,0);
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> ret=BuildNewInstanceFromContent(c,fileName);
+ MCAuto<MEDFileAnyTypeField1TSWithoutSDA> c=BuildContentFrom(fid,fileName,loadAll,0);
+ MCAuto<MEDFileAnyTypeField1TS> ret=BuildNewInstanceFromContent(c,fileName);
ret->loadGlobals(fid);
return ret.retn();
}
{
MEDFileUtilities::CheckFileForRead(fileName);
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> c=BuildContentFrom(fid,fileName,fieldName,loadAll,0);
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> ret=BuildNewInstanceFromContent(c,fileName);
+ MCAuto<MEDFileAnyTypeField1TSWithoutSDA> c=BuildContentFrom(fid,fileName,fieldName,loadAll,0);
+ MCAuto<MEDFileAnyTypeField1TS> ret=BuildNewInstanceFromContent(c,fileName);
ret->loadGlobals(fid);
return ret.retn();
}
{
MEDFileUtilities::CheckFileForRead(fileName);
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> c=BuildContentFrom(fid,fileName,fieldName,iteration,order,loadAll,0);
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> ret=BuildNewInstanceFromContent(c,fileName);
+ MCAuto<MEDFileAnyTypeField1TSWithoutSDA> c=BuildContentFrom(fid,fileName,fieldName,iteration,order,loadAll,0);
+ MCAuto<MEDFileAnyTypeField1TS> ret=BuildNewInstanceFromContent(c,fileName);
ret->loadGlobals(fid);
return ret.retn();
}
std::string dtunit;
int iii=-1;
int nbOfStep2=LocateField(fid,fileName,fieldName,iii,typcha,infos,dtunit);
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> ret;
+ MCAuto<MEDFileAnyTypeField1TSWithoutSDA> ret;
switch(typcha)
{
case MED_FLOAT64:
* 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<MEDFileAnyTypeField1TSWithoutSDA> > contentsSplit=content->splitComponents();
+ std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > 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<sz;i++)
{
ret[i]=shallowCpy();
* 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<MEDFileAnyTypeField1TSWithoutSDA> > contentsSplit(content->splitDiscretizations());
+ std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > 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<sz;i++)
{
ret[i]=shallowCpy();
* 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<MEDFileAnyTypeField1TSWithoutSDA> > contentsSplit(content->splitMultiDiscrPerGeoTypes());
+ std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > 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<sz;i++)
{
ret[i]=shallowCpy();
return ret;
}
-MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::deepCpy() const
+MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::deepCopy() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> ret=shallowCpy();
+ MCAuto<MEDFileAnyTypeField1TS> ret=shallowCpy();
if((const MEDFileAnyTypeField1TSWithoutSDA *)_content)
- ret->_content=_content->deepCpy();
+ ret->_content=_content->deepCopy();
ret->deepCpyGlobs(*this);
return ret.retn();
}
*/
MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, bool loadAll)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret(new MEDFileField1TS(fileName,loadAll,0));
+ MCAuto<MEDFileField1TS> ret(new MEDFileField1TS(fileName,loadAll,0));
ret->contentNotNull();
return ret.retn();
}
*/
MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, const std::string& fieldName, bool loadAll)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret(new MEDFileField1TS(fileName,fieldName,loadAll,0));
+ MCAuto<MEDFileField1TS> ret(new MEDFileField1TS(fileName,fieldName,loadAll,0));
ret->contentNotNull();
return ret.retn();
}
*/
MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret(new MEDFileField1TS(fileName,fieldName,iteration,order,loadAll,0));
+ MCAuto<MEDFileField1TS> ret(new MEDFileField1TS(fileName,fieldName,iteration,order,loadAll,0));
ret->contentNotNull();
return ret.retn();
}
*/
MEDFileField1TS *MEDFileField1TS::New(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret=new MEDFileField1TS(other,shallowCopyOfContent);
+ MCAuto<MEDFileField1TS> ret=new MEDFileField1TS(other,shallowCopyOfContent);
ret->contentNotNull();
return ret.retn();
}
*/
MEDFileField1TS *MEDFileField1TS::New()
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret=new MEDFileField1TS;
+ MCAuto<MEDFileField1TS> ret=new MEDFileField1TS;
ret->contentNotNull();
return ret.retn();
}
*/
MEDFileIntField1TS *MEDFileField1TS::convertToInt(bool isDeepCpyGlobs) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret;
+ MCAuto<MEDFileIntField1TS> ret;
const MEDFileAnyTypeField1TSWithoutSDA *content(_content);
if(content)
{
const MEDFileField1TSWithoutSDA *contc=dynamic_cast<const MEDFileField1TSWithoutSDA *>(content);
if(!contc)
throw INTERP_KERNEL::Exception("MEDFileField1TS::convertToInt : the content inside this is not FLOAT64 ! This is incoherent !");
- MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TSWithoutSDA> newc(contc->convertToInt());
+ MCAuto<MEDFileIntField1TSWithoutSDA> newc(contc->convertToInt());
ret=static_cast<MEDFileIntField1TS *>(MEDFileAnyTypeField1TS::BuildNewInstanceFromContent((MEDFileIntField1TSWithoutSDA *)newc,getFileName()));
}
else
return ret;
}
-void MEDFileField1TS::SetDataArrayDoubleInField(MEDCouplingFieldDouble *f, MEDCouplingAutoRefCountObjectPtr<DataArray>& arr)
+void MEDFileField1TS::SetDataArrayDoubleInField(MEDCouplingFieldDouble *f, MCAuto<DataArray>& arr)
{
if(!f)
throw INTERP_KERNEL::Exception("MEDFileField1TS::SetDataArrayDoubleInField : input field is NULL !");
f->setArray(arrOutC);
}
-DataArrayDouble *MEDFileField1TS::ReturnSafelyDataArrayDouble(MEDCouplingAutoRefCountObjectPtr<DataArray>& arr)
+DataArrayDouble *MEDFileField1TS::ReturnSafelyDataArrayDouble(MCAuto<DataArray>& arr)
{
if(!((DataArray*)arr))
throw INTERP_KERNEL::Exception("MEDFileField1TS::ReturnSafelyDataArrayDouble : no array !");
{
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<DataArray> arrOut;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut,*contentNotNull());
+ MCAuto<DataArray> arrOut;
+ MCAuto<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut,*contentNotNull());
MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
return ret.retn();
}
{
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<DataArray> arrOut;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtTopLevel(type,std::string(),renumPol,this,arrOut,*contentNotNull());
+ MCAuto<DataArray> arrOut;
+ MCAuto<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtTopLevel(type,std::string(),renumPol,this,arrOut,*contentNotNull());
MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
return ret.retn();
}
*/
MEDCouplingFieldDouble *MEDFileField1TS::getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arrOut,*contentNotNull());
+ MCAuto<DataArray> arrOut;
+ MCAuto<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arrOut,*contentNotNull());
MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
return ret.retn();
}
*/
MEDCouplingFieldDouble *MEDFileField1TS::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arrOut,*contentNotNull());
+ MCAuto<DataArray> arrOut;
+ MCAuto<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arrOut,*contentNotNull());
MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
return ret.retn();
}
{
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<DataArray> arrOut;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arrOut,*contentNotNull());
+ MCAuto<DataArray> arrOut;
+ MCAuto<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arrOut,*contentNotNull());
MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
return ret.retn();
}
*/
DataArrayDouble *MEDFileField1TS::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArray> ret=contentNotNull()->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNull());
+ MCAuto<DataArray> ret=contentNotNull()->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNull());
return MEDFileField1TS::ReturnSafelyDataArrayDouble(ret);
}
MEDFileIntField1TS *MEDFileIntField1TS::New()
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret=new MEDFileIntField1TS;
+ MCAuto<MEDFileIntField1TS> ret=new MEDFileIntField1TS;
ret->contentNotNull();
return ret.retn();
}
MEDFileIntField1TS *MEDFileIntField1TS::New(const std::string& fileName, bool loadAll)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret(new MEDFileIntField1TS(fileName,loadAll,0));
+ MCAuto<MEDFileIntField1TS> 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<MEDFileIntField1TS> ret(new MEDFileIntField1TS(fileName,fieldName,loadAll,0));
+ MCAuto<MEDFileIntField1TS> 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<MEDFileIntField1TS> ret(new MEDFileIntField1TS(fileName,fieldName,iteration,order,loadAll,0));
+ MCAuto<MEDFileIntField1TS> ret(new MEDFileIntField1TS(fileName,fieldName,iteration,order,loadAll,0));
ret->contentNotNull();
return ret.retn();
}
MEDFileIntField1TS *MEDFileIntField1TS::New(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret=new MEDFileIntField1TS(other,shallowCopyOfContent);
+ MCAuto<MEDFileIntField1TS> ret=new MEDFileIntField1TS(other,shallowCopyOfContent);
ret->contentNotNull();
return ret.retn();
}
*/
MEDFileField1TS *MEDFileIntField1TS::convertToDouble(bool isDeepCpyGlobs) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret;
+ MCAuto<MEDFileField1TS> ret;
const MEDFileAnyTypeField1TSWithoutSDA *content(_content);
if(content)
{
const MEDFileIntField1TSWithoutSDA *contc=dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(content);
if(!contc)
throw INTERP_KERNEL::Exception("MEDFileIntField1TS::convertToInt : the content inside this is not INT32 ! This is incoherent !");
- MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA> newc(contc->convertToDouble());
+ MCAuto<MEDFileField1TSWithoutSDA> newc(contc->convertToDouble());
ret=static_cast<MEDFileField1TS *>(MEDFileAnyTypeField1TS::BuildNewInstanceFromContent((MEDFileField1TSWithoutSDA *)newc,getFileName()));
}
else
{
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<DataArray> arrOut2;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut2,*contentNotNull());
+ MCAuto<DataArray> arrOut2;
+ MCAuto<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut2,*contentNotNull());
DataArrayInt *arrOutC=dynamic_cast<DataArrayInt *>((DataArray *)arrOut2);
if(!arrOutC)
throw INTERP_KERNEL::Exception("MEDFileIntField1TS::getFieldAtLevelOld : mismatch between dataArrays type and MEDFileIntField1TS ! Expected int32 !");
return ret.retn();
}
-DataArrayInt *MEDFileIntField1TS::ReturnSafelyDataArrayInt(MEDCouplingAutoRefCountObjectPtr<DataArray>& arr)
+DataArrayInt *MEDFileIntField1TS::ReturnSafelyDataArrayInt(MCAuto<DataArray>& arr)
{
if(!((DataArray *)arr))
throw INTERP_KERNEL::Exception("MEDFileIntField1TS::ReturnSafelyDataArrayInt : input DataArray is NULL !");
{
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<DataArray> arr;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtTopLevel(type,std::string(),renumPol,this,arr,*contentNotNull());
+ MCAuto<DataArray> arr;
+ MCAuto<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtTopLevel(type,std::string(),renumPol,this,arr,*contentNotNull());
arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
return ret.retn();
}
*/
MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt* &arrOut, int renumPol) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArray> arr;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arr,*contentNotNull());
+ MCAuto<DataArray> arr;
+ MCAuto<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arr,*contentNotNull());
arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
return ret.retn();
}
*/
MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt* &arrOut, int renumPol) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArray> arr;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arr,*contentNotNull());
+ MCAuto<DataArray> arr;
+ MCAuto<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arr,*contentNotNull());
arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
return ret.retn();
}
{
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<DataArray> arr;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arr,*contentNotNull());
+ MCAuto<DataArray> arr;
+ MCAuto<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arr,*contentNotNull());
arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
return ret.retn();
}
*/
DataArrayInt *MEDFileIntField1TS::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArray> arr=contentNotNull()->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNull());
+ MCAuto<DataArray> arr=contentNotNull()->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNull());
return MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
}
std::size_t MEDFileAnyTypeFieldMultiTSWithoutSDA::getHeapMemorySizeWithoutChildren() const
{
- std::size_t ret(_name.capacity()+_infos.capacity()*sizeof(std::string)+_time_steps.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA>));
+ std::size_t ret(_name.capacity()+_infos.capacity()*sizeof(std::string)+_time_steps.capacity()*sizeof(MCAuto<MEDFileField1TSWithoutSDA>));
for(std::vector<std::string>::const_iterator it=_infos.begin();it!=_infos.end();it++)
ret+=(*it).capacity();
return ret;
std::vector<const BigMemoryObject *> MEDFileAnyTypeFieldMultiTSWithoutSDA::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> 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++)
ret.push_back((const MEDFileAnyTypeField1TSWithoutSDA *)*it);
return ret;
}
*/
MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds(const int *startIds, const int *endIds) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret=createNew();
+ MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret=createNew();
ret->setInfo(_infos);
int sz=(int)_time_steps.size();
for(const int *id=startIds;id!=endIds;id++)
if(*id>=0 && *id<sz)
{
const MEDFileAnyTypeField1TSWithoutSDA *tse=_time_steps[*id];
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> tse2;
+ MCAuto<MEDFileAnyTypeField1TSWithoutSDA> tse2;
if(tse)
{
tse->incrRef();
{
static const char msg[]="MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds2";
int nbOfEntriesToKeep=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg);
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret=createNew();
+ MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret=createNew();
ret->setInfo(_infos);
int sz=(int)_time_steps.size();
int j=bg;
if(j>=0 && j<sz)
{
const MEDFileAnyTypeField1TSWithoutSDA *tse=_time_steps[j];
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> tse2;
+ MCAuto<MEDFileAnyTypeField1TSWithoutSDA> tse2;
if(tse)
{
tse->incrRef();
MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const
{
int id=0;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids=DataArrayInt::New(); ids->alloc(0,1);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++)
+ MCAuto<DataArrayInt> ids=DataArrayInt::New(); ids->alloc(0,1);
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++)
{
const MEDFileAnyTypeField1TSWithoutSDA *cur(*it);
if(!cur)
MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const
{
int id=0;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids=DataArrayInt::New(); ids->alloc(0,1);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++)
+ MCAuto<DataArrayInt> ids=DataArrayInt::New(); ids->alloc(0,1);
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++)
{
const MEDFileAnyTypeField1TSWithoutSDA *cur(*it);
if(!cur)
bool MEDFileAnyTypeFieldMultiTSWithoutSDA::presenceOfMultiDiscPerGeoType() const
{
- 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++)
{
const MEDFileAnyTypeField1TSWithoutSDA *cur(*it);
if(!cur)
int MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepPos(int iteration, int order) const
{
int ret=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
{
const MEDFileAnyTypeField1TSWithoutSDA *pt(*it);
if(pt->isDealingTS(iteration,order))
bool MEDFileAnyTypeFieldMultiTSWithoutSDA::changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab)
{
bool ret=false;
- 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++)
{
MEDFileAnyTypeField1TSWithoutSDA *cur(*it);
if(cur)
MEDFileFieldGlobsReal& glob)
{
bool ret=false;
- 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++)
{
MEDFileAnyTypeField1TSWithoutSDA *f1ts(*it);
if(f1ts)
oss << startLine << " - \"" << *it << "\"" << std::endl;
}
int i=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
{
std::string chapter(17,'0'+i);
oss << startLine << chapter << std::endl;
return ret;
}
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep(MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA>& tse)
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep(MCAuto<MEDFileAnyTypeField1TSWithoutSDA>& tse)
{
MEDFileAnyTypeField1TSWithoutSDA *tse2(tse);
if(!tse2)
void MEDFileAnyTypeFieldMultiTSWithoutSDA::synchronizeNameScope()
{
std::size_t nbOfCompo=_infos.size();
- 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++)
{
MEDFileAnyTypeField1TSWithoutSDA *cur=(*it);
if(cur)
void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc)
{
- 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++)
{
MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
if(elt)
void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursivelyIfNecessary(med_idt fid, const MEDFileFieldNameScope& nasc)
{
- 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++)
{
MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
if(elt)
void MEDFileAnyTypeFieldMultiTSWithoutSDA::unloadArrays()
{
- 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++)
{
MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
if(elt)
void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseEmptyTS()
{
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > newTS;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > newTS;
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
{
const MEDFileAnyTypeField1TSWithoutSDA *tmp=(*it);
if(tmp)
void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds(const int *startIds, const int *endIds)
{
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > newTS;
+ std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > newTS;
int maxId=(int)_time_steps.size();
int ii=0;
std::set<int> idsToDel;
int j=bg;
for(int i=0;i<nbOfEntriesToKill;i++,j+=step)
b[j]=false;
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > newTS;
+ std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > newTS;
for(std::size_t i=0;i<sz;i++)
if(b[i])
newTS.push_back(_time_steps[i]);
{
int ret=0;
std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getPosOfTimeStep : No such time step (" << iteration << "," << order << ") !\nPossibilities are : ";
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
{
const MEDFileAnyTypeField1TSWithoutSDA *tmp(*it);
if(tmp)
int ret=0;
std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getPosGivenTime : No such time step " << time << "! \nPossibilities are : ";
oss.precision(15);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
{
const MEDFileAnyTypeField1TSWithoutSDA *tmp(*it);
if(tmp)
{
std::vector<std::string> ret;
std::set<std::string> 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<std::string> tmp=(*it)->getPflsReallyUsed2();
for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
{
std::vector<std::string> ret;
std::set<std::string> 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<std::string> tmp=(*it)->getLocsReallyUsed2();
for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
std::vector<std::string> MEDFileAnyTypeFieldMultiTSWithoutSDA::getPflsReallyUsedMulti2() const
{
std::vector<std::string> 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<std::string> tmp=(*it)->getPflsReallyUsedMulti2();
ret.insert(ret.end(),tmp.begin(),tmp.end());
std::vector<std::string> MEDFileAnyTypeFieldMultiTSWithoutSDA::getLocsReallyUsedMulti2() const
{
std::vector<std::string> 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<std::string> tmp=(*it)->getLocsReallyUsedMulti2();
ret.insert(ret.end(),tmp.begin(),tmp.end());
void MEDFileAnyTypeFieldMultiTSWithoutSDA::changePflsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, 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::vector<std::string>, 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);
}
return getTimeStepEntry(iteration,order).getFieldSplitedByType(mname,types,typesF,pfls,locs);
}
-MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::deepCpy() const
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::deepCopy() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret=shallowCpy();
+ MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret=shallowCpy();
std::size_t i=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::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> > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitComponents() const
+std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitComponents() const
{
std::size_t sz(_infos.size()),sz2(_time_steps.size());
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret(sz);
- std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > > ts(sz2);
+ std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret(sz);
+ std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > > ts(sz2);
for(std::size_t i=0;i<sz;i++)
{
ret[i]=shallowCpy();
}
for(std::size_t i=0;i<sz2;i++)
{
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > ret1=_time_steps[i]->splitComponents();
+ std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > 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 << " !";
* This method splits into discretization each time steps in \a this.
* ** WARNING ** the returned instances are not compulsary defined on the same time steps series !
*/
-std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitDiscretizations() const
+std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitDiscretizations() const
{
std::size_t sz(_time_steps.size());
- std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > > items(sz);
+ std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > > items(sz);
for(std::size_t i=0;i<sz;i++)
{
const MEDFileAnyTypeField1TSWithoutSDA *timeStep(_time_steps[i]);
items[i]=timeStep->splitDiscretizations();
}
//
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret;
- std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > > ret2;
+ std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret;
+ std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > > ret2;
std::vector< TypeOfField > types;
- for(std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > >::const_iterator it0=items.begin();it0!=items.end();it0++)
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
+ for(std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > >::const_iterator it0=items.begin();it0!=items.end();it0++)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
{
std::vector<TypeOfField> ts=(*it1)->getTypesOfFieldAvailable();
if(ts.size()!=1)
types.push_back(ts[0]);
}
ret.resize(types.size()); ret2.resize(types.size());
- for(std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > >::const_iterator it0=items.begin();it0!=items.end();it0++)
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
+ for(std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > >::const_iterator it0=items.begin();it0!=items.end();it0++)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::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));
}
for(std::size_t i=0;i<types.size();i++)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> elt(createNew());
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it1=ret2[i].begin();it1!=ret2[i].end();it1++)
+ MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> elt(createNew());
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::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);
/*!
* Contrary to splitDiscretizations method this method makes the hypothesis that the times series are **NOT** impacted by the splitting of multi discretization.
*/
-std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes() const
+std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes() const
{
std::size_t sz(_time_steps.size());
- std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > > items(sz);
+ std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > > items(sz);
std::size_t szOut(std::numeric_limits<std::size_t>::max());
for(std::size_t i=0;i<sz;i++)
{
}
if(szOut==std::numeric_limits<std::size_t>::max())
throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes : empty field !");
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret(szOut);
+ std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret(szOut);
for(std::size_t i=0;i<szOut;i++)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> elt(createNew());
+ MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> elt(createNew());
for(std::size_t j=0;j<sz;j++)
elt->pushBackTimeStep(items[j][i]);
ret[i]=elt;
{
std::size_t sz=_infos.size();
int j=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,j++)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,j++)
{
const MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
if(elt)
if(!_time_steps.empty())
checkCoherencyOfTinyInfo(field,arr);
MEDFileAnyTypeField1TSWithoutSDA *objC=createNew1TSWithoutSDAEmptyInstance();
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> obj(objC);
+ MCAuto<MEDFileAnyTypeField1TSWithoutSDA> obj(objC);
objC->setFieldNoProfileSBT(field,arr,glob,*this);
copyTinyInfoFrom(field,arr);
_time_steps.push_back(obj);
if(!_time_steps.empty())
checkCoherencyOfTinyInfo(field,arr);
MEDFileField1TSWithoutSDA *objC=new MEDFileField1TSWithoutSDA;
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> obj(objC);
+ MCAuto<MEDFileAnyTypeField1TSWithoutSDA> 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<MEDFileAnyTypeField1TSWithoutSDA> ts)
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration(int i, MCAuto<MEDFileAnyTypeField1TSWithoutSDA> ts)
{
int sz=(int)_time_steps.size();
if(i<0 || i>=sz)
MEDFileIntFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::convertToInt() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileIntFieldMultiTSWithoutSDA> ret(new MEDFileIntFieldMultiTSWithoutSDA);
+ MCAuto<MEDFileIntFieldMultiTSWithoutSDA> ret(new MEDFileIntFieldMultiTSWithoutSDA);
ret->MEDFileAnyTypeFieldMultiTSWithoutSDA::operator =(*this);
int i=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
{
const MEDFileAnyTypeField1TSWithoutSDA *eltToConv(*it);
if(eltToConv)
const MEDFileField1TSWithoutSDA *eltToConvC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(eltToConv);
if(!eltToConvC)
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::convertToInt : presence of an invalid 1TS type ! Should be of type FLOAT64 !");
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> elt=eltToConvC->convertToInt();
+ MCAuto<MEDFileAnyTypeField1TSWithoutSDA> elt=eltToConvC->convertToInt();
ret->setIteration(i,elt);
}
}
std::string dtunit;
int i=-1;
MEDFileAnyTypeField1TS::LocateField(fid,fileName,fieldName,i,typcha,infos,dtunit);
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret;
+ MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret;
switch(typcha)
{
case MED_FLOAT64:
std::vector<std::string> infos;
std::string dtunit,fieldName;
MEDFileAnyTypeField1TS::LocateField2(fid,fileName,0,true,fieldName,typcha,infos,dtunit);
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret;
+ MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret;
switch(typcha)
{
case MED_FLOAT64:
throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent : empty content in input : unable to build a new instance !");
if(dynamic_cast<const MEDFileFieldMultiTSWithoutSDA *>(c))
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> ret=MEDFileFieldMultiTS::New();
+ MCAuto<MEDFileFieldMultiTS> ret=MEDFileFieldMultiTS::New();
ret->setFileName(fileName);
ret->_content=c; c->incrRef();
return ret.retn();
}
if(dynamic_cast<const MEDFileIntFieldMultiTSWithoutSDA *>(c))
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileIntFieldMultiTS> ret=MEDFileIntFieldMultiTS::New();
+ MCAuto<MEDFileIntFieldMultiTS> ret=MEDFileIntFieldMultiTS::New();
ret->setFileName(fileName);
ret->_content=c; c->incrRef();
return ret.retn();
MEDFileFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::convertToDouble() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTSWithoutSDA> ret(new MEDFileFieldMultiTSWithoutSDA);
+ MCAuto<MEDFileFieldMultiTSWithoutSDA> ret(new MEDFileFieldMultiTSWithoutSDA);
ret->MEDFileAnyTypeFieldMultiTSWithoutSDA::operator =(*this);
int i=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
{
const MEDFileAnyTypeField1TSWithoutSDA *eltToConv(*it);
if(eltToConv)
const MEDFileIntField1TSWithoutSDA *eltToConvC=dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(eltToConv);
if(!eltToConvC)
throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTSWithoutSDA::convertToInt : presence of an invalid 1TS type ! Should be of type INT32 !");
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> elt=eltToConvC->convertToDouble();
+ MCAuto<MEDFileAnyTypeField1TSWithoutSDA> elt=eltToConvC->convertToDouble();
ret->setIteration(i,elt);
}
}
{
MEDFileUtilities::CheckFileForRead(fileName);
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> c=BuildContentFrom(fid,fileName,loadAll,0);
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTS> ret=BuildNewInstanceFromContent(c,fileName);
+ MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> c=BuildContentFrom(fid,fileName,loadAll,0);
+ MCAuto<MEDFileAnyTypeFieldMultiTS> ret=BuildNewInstanceFromContent(c,fileName);
ret->loadGlobals(fid);
return ret.retn();
}
{
MEDFileUtilities::CheckFileForRead(fileName);
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> c(BuildContentFrom(fid,fileName,fieldName,loadAll,0,0));
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTS> ret=BuildNewInstanceFromContent(c,fileName);
+ MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> c(BuildContentFrom(fid,fileName,fieldName,loadAll,0,0));
+ MCAuto<MEDFileAnyTypeFieldMultiTS> ret=BuildNewInstanceFromContent(c,fileName);
ret->loadGlobals(fid);
return ret.retn();
}
MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::buildSubPart(const int *startIds, const int *endIds) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> c=contentNotNullBase()->buildFromTimeStepIds(startIds,endIds);
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTS> ret=shallowCpy();
+ MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> c=contentNotNullBase()->buildFromTimeStepIds(startIds,endIds);
+ MCAuto<MEDFileAnyTypeFieldMultiTS> ret=shallowCpy();
ret->_content=c;
return ret.retn();
}
MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::buildSubPartSlice(int bg, int end, int step) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> c=contentNotNullBase()->buildFromTimeStepIds2(bg,end,step);
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTS> ret=shallowCpy();
+ MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> c=contentNotNullBase()->buildFromTimeStepIds2(bg,end,step);
+ MCAuto<MEDFileAnyTypeFieldMultiTS> ret=shallowCpy();
ret->_content=c;
return ret.retn();
}
int nbOfTS(fmts->getNumberOfTS());
for(int i=0;i<nbOfTS;i++)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> elt(fmts->getTimeStepAtPos(i));
+ MCAuto<MEDFileAnyTypeField1TS> elt(fmts->getTimeStepAtPos(i));
pushBackTimeStep(elt);
}
}
throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep : input pointer is NULL !");
checkCoherencyOfType(f1ts);
f1ts->incrRef();
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> f1tsSafe(f1ts);
+ MCAuto<MEDFileAnyTypeField1TS> f1tsSafe(f1ts);
MEDFileAnyTypeField1TSWithoutSDA *c=f1ts->contentNotNullBase();
c->incrRef();
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> cSafe(c);
+ MCAuto<MEDFileAnyTypeField1TSWithoutSDA> cSafe(c);
if(!((MEDFileAnyTypeFieldMultiTSWithoutSDA *)_content))
throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep : no content in this !");
_content->pushBackTimeStep(cSafe);
* 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<MEDFileAnyTypeFieldMultiTSWithoutSDA> > contentsSplit=content->splitComponents();
+ std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > 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<sz;i++)
{
ret[i]=shallowCpy();
* 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<MEDFileAnyTypeFieldMultiTSWithoutSDA> > contentsSplit(content->splitDiscretizations());
+ std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > 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<sz;i++)
{
ret[i]=shallowCpy();
* 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<MEDFileAnyTypeFieldMultiTSWithoutSDA> > contentsSplit(content->splitMultiDiscrPerGeoTypes());
+ std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > 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<sz;i++)
{
ret[i]=shallowCpy();
return ret;
}
-MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::deepCpy() const
+MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::deepCopy() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTS> ret=shallowCpy();
+ MCAuto<MEDFileAnyTypeFieldMultiTS> ret=shallowCpy();
if((const MEDFileAnyTypeFieldMultiTSWithoutSDA *)_content)
- ret->_content=_content->deepCpy();
+ ret->_content=_content->deepCopy();
ret->deepCpyGlobs(*this);
return ret.retn();
}
-MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> MEDFileAnyTypeFieldMultiTS::getContent()
+MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> MEDFileAnyTypeFieldMultiTS::getContent()
{
return _content;
}
* \throw If an element in \a vectFMTS is null.
* \sa MEDFileAnyTypeFieldMultiTS::AreOnSameSupportAcrossTime
*/
-std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS, const MEDFileMesh *mesh, std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFastCellSupportComparator> >& fsc)
+std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS, const MEDFileMesh *mesh, std::vector< MCAuto<MEDFileFastCellSupportComparator> >& fsc)
{
static const char msg[]="MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport : presence of a null instance in the input vector !";
if(!mesh)
else
vectFMTSNotNodes.push_back(*it);
}
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFastCellSupportComparator> > cmps;
+ std::vector< MCAuto<MEDFileFastCellSupportComparator> > cmps;
std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > retCell=SplitPerCommonSupportNotNodesAlg(vectFMTSNotNodes,mesh,cmps);
ret=retCell;
for(std::vector<MEDFileAnyTypeFieldMultiTS *>::const_iterator it2=vectFMTSNodes.begin();it2!=vectFMTSNodes.end();it2++)
if(!isFetched)
{
std::vector<MEDFileAnyTypeFieldMultiTS *> tmp(1,*it2);
- MEDCouplingAutoRefCountObjectPtr<MEDFileMeshStruct> tmp2(MEDFileMeshStruct::New(mesh));
+ MCAuto<MEDFileMeshStruct> tmp2(MEDFileMeshStruct::New(mesh));
ret.push_back(tmp); retCell.push_back(tmp); cmps.push_back(MEDFileFastCellSupportComparator::New(tmp2,*it2));
}
}
* 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 *> > MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupportNotNodesAlg(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS, const MEDFileMesh *mesh, std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFastCellSupportComparator> >& cmps)
+std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupportNotNodesAlg(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS, const MEDFileMesh *mesh, std::vector< MCAuto<MEDFileFastCellSupportComparator> >& cmps)
{
std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret;
std::list<MEDFileAnyTypeFieldMultiTS *> lstFMTS(vectFMTS.begin(),vectFMTS.end());
MEDFileAnyTypeFieldMultiTS *ref(*it);
std::vector<MEDFileAnyTypeFieldMultiTS *> elt;
elt.push_back(ref); it=lstFMTS.erase(it);
- MEDCouplingAutoRefCountObjectPtr<MEDFileMeshStruct> mst(MEDFileMeshStruct::New(mesh));
- MEDCouplingAutoRefCountObjectPtr<MEDFileFastCellSupportComparator> cmp(MEDFileFastCellSupportComparator::New(mst,ref));
+ MCAuto<MEDFileMeshStruct> mst(MEDFileMeshStruct::New(mesh));
+ MCAuto<MEDFileFastCellSupportComparator> cmp(MEDFileFastCellSupportComparator::New(mst,ref));
while(it!=lstFMTS.end())
{
MEDFileAnyTypeFieldMultiTS *curIt(*it);
return nts;
for(int i=0;i<nts;i++)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> f0cur=f0->getTimeStepAtPos(i);
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> f1cur=f1->getTimeStepAtPos(i);
+ MCAuto<MEDFileAnyTypeField1TS> f0cur=f0->getTimeStepAtPos(i);
+ MCAuto<MEDFileAnyTypeField1TS> f1cur=f1->getTimeStepAtPos(i);
std::vector<TypeOfField> 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 !");
*/
MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const std::string& fileName, bool loadAll)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> ret=new MEDFileFieldMultiTS(fileName,loadAll,0);
+ MCAuto<MEDFileFieldMultiTS> ret=new MEDFileFieldMultiTS(fileName,loadAll,0);
ret->contentNotNull();//to check that content type matches with \a this type.
return ret.retn();
}
*/
MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const std::string& fileName, const std::string& fieldName, bool loadAll)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> ret=new MEDFileFieldMultiTS(fileName,fieldName,loadAll,0);
+ MCAuto<MEDFileFieldMultiTS> ret=new MEDFileFieldMultiTS(fileName,fieldName,loadAll,0);
ret->contentNotNull();//to check that content type matches with \a this type.
return ret.retn();
}
MEDFileFieldMultiTS *MEDFileFieldMultiTS::LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> >& entities, bool loadAll)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> ret(new MEDFileFieldMultiTS(fileName,fieldName,loadAll,0,&entities));
+ MCAuto<MEDFileFieldMultiTS> ret(new MEDFileFieldMultiTS(fileName,fieldName,loadAll,0,&entities));
ret->contentNotNull();//to check that content type matches with \a this type.
return ret.retn();
}
*/
MEDFileIntFieldMultiTS *MEDFileFieldMultiTS::convertToInt(bool isDeepCpyGlobs) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileIntFieldMultiTS> ret;
+ MCAuto<MEDFileIntFieldMultiTS> ret;
const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content);
if(content)
{
const MEDFileFieldMultiTSWithoutSDA *contc=dynamic_cast<const MEDFileFieldMultiTSWithoutSDA *>(content);
if(!contc)
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::convertToInt : the content inside this is not FLOAT64 ! This is incoherent !");
- MEDCouplingAutoRefCountObjectPtr<MEDFileIntFieldMultiTSWithoutSDA> newc(contc->convertToInt());
+ MCAuto<MEDFileIntFieldMultiTSWithoutSDA> newc(contc->convertToInt());
ret=static_cast<MEDFileIntFieldMultiTS *>(MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent((MEDFileIntFieldMultiTSWithoutSDA *)newc,getFileName()));
}
else
const MEDFileField1TSWithoutSDA *itemC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(item);
if(itemC)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret=MEDFileField1TS::New(*itemC,false);
+ MCAuto<MEDFileField1TS> ret=MEDFileField1TS::New(*itemC,false);
ret->shallowCpyGlobs(*this);
return ret.retn();
}
const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(&myF1TS);
if(!myF1TSC)
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldAtLevel : mismatch of type of field expecting FLOAT64 !");
- MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut,*contentNotNullBase());
+ MCAuto<DataArray> arrOut;
+ MCAuto<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut,*contentNotNullBase());
MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
return ret.retn();
}
const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(&myF1TS);
if(!myF1TSC)
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldAtTopLevel : mismatch of type of field !");
- MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtTopLevel(type,std::string(),renumPol,this,arrOut,*contentNotNullBase());
+ MCAuto<DataArray> arrOut;
+ MCAuto<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtTopLevel(type,std::string(),renumPol,this,arrOut,*contentNotNullBase());
MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
return ret.retn();
}
const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(&myF1TS);
if(!myF1TSC)
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldOnMeshAtLevel : mismatch of type of field !");
- MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=myF1TSC->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arrOut,*contentNotNullBase());
+ MCAuto<DataArray> arrOut;
+ MCAuto<MEDCouplingFieldDouble> ret=myF1TSC->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arrOut,*contentNotNullBase());
MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
return ret.retn();
}
const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(&myF1TS);
if(!myF1TSC)
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldOnMeshAtLevel : mismatch of type of field !");
- MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=myF1TSC->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arrOut,*contentNotNullBase());
+ MCAuto<DataArray> arrOut;
+ MCAuto<MEDCouplingFieldDouble> ret=myF1TSC->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arrOut,*contentNotNullBase());
MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
return ret.retn();
}
const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(&myF1TS);
if(!myF1TSC)
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldAtLevelOld : mismatch of type of field !");
- MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arrOut,*contentNotNullBase());
+ MCAuto<DataArray> arrOut;
+ MCAuto<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arrOut,*contentNotNullBase());
MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
return ret.retn();
}
const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(&myF1TS);
if(!myF1TSC)
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldWithProfile : mismatch of type of field !");
- MEDCouplingAutoRefCountObjectPtr<DataArray> ret=myF1TSC->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNullBase());
+ MCAuto<DataArray> ret=myF1TSC->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNullBase());
return MEDFileField1TS::ReturnSafelyDataArrayDouble(ret);
}
*/
MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const std::string& fileName, bool loadAll)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileIntFieldMultiTS> ret=new MEDFileIntFieldMultiTS(fileName,loadAll,0);
+ MCAuto<MEDFileIntFieldMultiTS> ret=new MEDFileIntFieldMultiTS(fileName,loadAll,0);
ret->contentNotNull();//to check that content type matches with \a this type.
return ret.retn();
}
*/
MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const std::string& fileName, const std::string& fieldName, bool loadAll)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileIntFieldMultiTS> ret=new MEDFileIntFieldMultiTS(fileName,fieldName,loadAll,0);
+ MCAuto<MEDFileIntFieldMultiTS> ret=new MEDFileIntFieldMultiTS(fileName,fieldName,loadAll,0);
ret->contentNotNull();//to check that content type matches with \a this type.
return ret.retn();
}
MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> >& entities, bool loadAll)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileIntFieldMultiTS> ret=new MEDFileIntFieldMultiTS(fileName,fieldName,loadAll,0,&entities);
+ MCAuto<MEDFileIntFieldMultiTS> ret=new MEDFileIntFieldMultiTS(fileName,fieldName,loadAll,0,&entities);
ret->contentNotNull();//to check that content type matches with \a this type.
return ret.retn();
}
*/
MEDFileFieldMultiTS *MEDFileIntFieldMultiTS::convertToDouble(bool isDeepCpyGlobs) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> ret;
+ MCAuto<MEDFileFieldMultiTS> ret;
const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content);
if(content)
{
const MEDFileIntFieldMultiTSWithoutSDA *contc=dynamic_cast<const MEDFileIntFieldMultiTSWithoutSDA *>(content);
if(!contc)
throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::convertToInt : the content inside this is not INT32 ! This is incoherent !");
- MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTSWithoutSDA> newc(contc->convertToDouble());
+ MCAuto<MEDFileFieldMultiTSWithoutSDA> newc(contc->convertToDouble());
ret=static_cast<MEDFileFieldMultiTS *>(MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent((MEDFileFieldMultiTSWithoutSDA *)newc,getFileName()));
}
else
const MEDFileIntField1TSWithoutSDA *myF1TSC=dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(&myF1TS);
if(!myF1TSC)
throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::getFieldAtLevel : mismatch of type of field expecting INT32 !");
- MEDCouplingAutoRefCountObjectPtr<DataArray> arr;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arr,*contentNotNullBase());
+ MCAuto<DataArray> arr;
+ MCAuto<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arr,*contentNotNullBase());
arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
return ret.retn();
}
const MEDFileIntField1TSWithoutSDA *myF1TSC=dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(&myF1TS);
if(!myF1TSC)
throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::getFieldAtTopLevel : mismatch of type of field ! INT32 expected !");
- MEDCouplingAutoRefCountObjectPtr<DataArray> arr;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtTopLevel(type,std::string(),renumPol,this,arr,*contentNotNullBase());
+ MCAuto<DataArray> arr;
+ MCAuto<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtTopLevel(type,std::string(),renumPol,this,arr,*contentNotNullBase());
arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
return ret.retn();
}
const MEDFileIntField1TSWithoutSDA *myF1TSC=dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(&myF1TS);
if(!myF1TSC)
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldOnMeshAtLevel : mismatch of type of field ! INT32 expected !");
- MEDCouplingAutoRefCountObjectPtr<DataArray> arr;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=myF1TSC->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arr,*contentNotNullBase());
+ MCAuto<DataArray> arr;
+ MCAuto<MEDCouplingFieldDouble> ret=myF1TSC->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arr,*contentNotNullBase());
arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
return ret.retn();
}
const MEDFileIntField1TSWithoutSDA *myF1TSC=dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(&myF1TS);
if(!myF1TSC)
throw INTERP_KERNEL::Exception("MEDFileFieldIntMultiTS::getFieldOnMeshAtLevel : mismatch of type of field ! INT32 expected !");
- MEDCouplingAutoRefCountObjectPtr<DataArray> arr;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=myF1TSC->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arr,*contentNotNullBase());
+ MCAuto<DataArray> arr;
+ MCAuto<MEDCouplingFieldDouble> ret=myF1TSC->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arr,*contentNotNullBase());
arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
return ret.retn();
}
const MEDFileIntField1TSWithoutSDA *myF1TSC=dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(&myF1TS);
if(!myF1TSC)
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldOnMeshAtLevel : mismatch of type of field ! INT32 expected !");
- MEDCouplingAutoRefCountObjectPtr<DataArray> arr;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arr,*contentNotNullBase());
+ MCAuto<DataArray> arr;
+ MCAuto<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arr,*contentNotNullBase());
arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
return ret.retn();
}
const MEDFileIntField1TSWithoutSDA *myF1TSC=dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(&myF1TS);
if(!myF1TSC)
throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::getFieldWithProfile : mismatch of type of field ! INT32 expected !");
- MEDCouplingAutoRefCountObjectPtr<DataArray> ret=myF1TSC->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNullBase());
+ MCAuto<DataArray> ret=myF1TSC->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNullBase());
return MEDFileIntField1TS::ReturnSafelyDataArrayInt(ret);
}
const MEDFileIntField1TSWithoutSDA *itemC=dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(item);
if(itemC)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret=MEDFileIntField1TS::New(*itemC,false);
+ MCAuto<MEDFileIntField1TS> ret=MEDFileIntField1TS::New(*itemC,false);
ret->shallowCpyGlobs(*this);
return ret.retn();
}
std::size_t MEDFileFields::getHeapMemorySizeWithoutChildren() const
{
std::size_t ret(MEDFileFieldGlobsReal::getHeapMemorySizeWithoutChildren());
- ret+=_fields.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA>);
+ ret+=_fields.capacity()*sizeof(MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA>);
return ret;
}
std::vector<const BigMemoryObject *> MEDFileFields::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> 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++)
ret.push_back((const MEDFileAnyTypeFieldMultiTSWithoutSDA *)*it);
return ret;
}
-MEDFileFields *MEDFileFields::deepCpy() const
+MEDFileFields *MEDFileFields::deepCopy() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileFields> ret=shallowCpy();
+ MCAuto<MEDFileFields> ret=shallowCpy();
std::size_t i=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::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();
std::set< std::pair<int,int> > s;
bool firstShot=true;
areThereSomeForgottenTS=false;
- 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++)
{
if(!(const MEDFileAnyTypeFieldMultiTSWithoutSDA*)*it)
continue;
{
std::vector<std::string> ret(_fields.size());
int i=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
{
const MEDFileAnyTypeFieldMultiTSWithoutSDA *f=(*it);
if(f)
std::vector<std::string> MEDFileFields::getMeshesNames() const
{
std::vector<std::string> 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++)
{
const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(*it);
if(cur)
std::string startLine(bkOffset,' ');
oss << startLine << "There are " << nbOfFields << " fields in this :" << std::endl;
int i=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
{
const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur=(*it);
if(cur)
}
}
i=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
{
const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur=(*it);
std::string chapter(17,'0'+i);
{
int i=0;
writeGlobals(fid,*this);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
{
const MEDFileAnyTypeFieldMultiTSWithoutSDA *elt=*it;
if(!elt)
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<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
{
MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it);
if(elt)
if(!getFileName().empty())
{
MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName().c_str(),MED_ACC_RDONLY);
- 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++)
{
MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it);
if(elt)
*/
void MEDFileFields::unloadArrays()
{
- 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++)
{
MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it);
if(elt)
{
std::vector<std::string> ret;
std::set<std::string> 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<std::string> tmp=(*it)->getPflsReallyUsed2();
for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
{
std::vector<std::string> ret;
std::set<std::string> 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<std::string> tmp=(*it)->getLocsReallyUsed2();
for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
std::vector<std::string> MEDFileFields::getPflsReallyUsedMulti() const
{
std::vector<std::string> 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<std::string> tmp=(*it)->getPflsReallyUsedMulti2();
ret.insert(ret.end(),tmp.begin(),tmp.end());
std::vector<std::string> MEDFileFields::getLocsReallyUsedMulti() const
{
std::vector<std::string> 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<std::string> tmp=(*it)->getLocsReallyUsed2();
ret.insert(ret.end(),tmp.begin(),tmp.end());
void MEDFileFields::changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, 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::vector<std::string>, 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);
}
}
b[*i]=false;
}
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > fields(std::count(b.begin(),b.end(),true));
+ std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > 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])
}
b[k]=false;
}
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > fields(std::count(b.begin(),b.end(),true));
+ std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > 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])
bool MEDFileFields::changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab)
{
bool ret=false;
- 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++)
{
MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(*it);
if(cur)
bool MEDFileFields::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N)
{
bool ret=false;
- 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++)
{
MEDFileAnyTypeFieldMultiTSWithoutSDA *fmts(*it);
if(fmts)
const MEDFileAnyTypeFieldMultiTSWithoutSDA *fmts=_fields[i];
if(!fmts)
return 0;
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTS> ret;
+ MCAuto<MEDFileAnyTypeFieldMultiTS> ret;
const MEDFileFieldMultiTSWithoutSDA *fmtsC=dynamic_cast<const MEDFileFieldMultiTSWithoutSDA *>(fmts);
const MEDFileIntFieldMultiTSWithoutSDA *fmtsC2=dynamic_cast<const MEDFileIntFieldMultiTSWithoutSDA *>(fmts);
if(fmtsC)
*/
MEDFileFields *MEDFileFields::buildSubPart(const int *startIds, const int *endIds) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileFields> ret=shallowCpy();
+ MCAuto<MEDFileFields> ret=shallowCpy();
std::size_t sz=std::distance(startIds,endIds);
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > fields(sz);
+ std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > fields(sz);
int j=0;
for(const int *i=startIds;i!=endIds;i++,j++)
{
*/
bool MEDFileFields::removeFieldsWithoutAnyTimeStep()
{
- std::vector<MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > newFields;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
+ std::vector<MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > newFields;
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
{
const MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it);
if(elt)
*/
MEDFileFields *MEDFileFields::partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileFields> ret=MEDFileFields::New();
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
+ MCAuto<MEDFileFields> ret=MEDFileFields::New();
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
{
const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur=(*it);
if(!cur)
if(cur->getMeshName()==meshName)
{
cur->incrRef();
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> cur2(const_cast<MEDFileAnyTypeFieldMultiTSWithoutSDA *>(cur));
+ MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> cur2(const_cast<MEDFileAnyTypeFieldMultiTSWithoutSDA *>(cur));
ret->_fields.push_back(cur2);
}
}
*/
MEDFileFields *MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileFields> ret=MEDFileFields::New();
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
+ MCAuto<MEDFileFields> ret=MEDFileFields::New();
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
{
const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur=(*it);
if(!cur)
continue;
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> elt=cur->partOfThisLyingOnSpecifiedTimeSteps(timeSteps);
+ MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> elt=cur->partOfThisLyingOnSpecifiedTimeSteps(timeSteps);
ret->_fields.push_back(elt);
}
ret->shallowCpyOnlyUsedGlobs(*this);
*/
MEDFileFields *MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileFields> ret=MEDFileFields::New();
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
+ MCAuto<MEDFileFields> ret=MEDFileFields::New();
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
{
const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur=(*it);
if(!cur)
continue;
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> elt=cur->partOfThisNotLyingOnSpecifiedTimeSteps(timeSteps);
+ MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> elt=cur->partOfThisNotLyingOnSpecifiedTimeSteps(timeSteps);
if(elt->getNumberOfTS()!=0)
ret->_fields.push_back(elt);
}
#include "MEDFileFieldOverView.hxx"
#include "MEDFileUtilities.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "MEDCouplingRefCountObject.hxx"
#include "MEDCouplingMemArray.hxx"
static MEDFileFieldLoc *New(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
std::size_t getHeapMemorySizeWithoutChildren() const;
std::vector<const BigMemoryObject *> 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;
static MEDFileFieldPerMeshPerTypePerDisc *New(const MEDFileFieldPerMeshPerTypePerDisc& other);
std::size_t getHeapMemorySizeWithoutChildren() const;
std::vector<const BigMemoryObject *> 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);
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<int>& newCode,
- MEDFileFieldGlobsReal& glob, DataArrayDouble *arr, std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >& result);
+ MEDFileFieldGlobsReal& glob, DataArrayDouble *arr, std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >& 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);
//! 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<PartDefinition> _pd;
+ MCAuto<PartDefinition> _pd;
public:
mutable int _tmp_work1;
};
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<const BigMemoryObject *> 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);
const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(int locId) const;
void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
void fillValues(int& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& 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<int,int> >& its);
bool keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair<int,int> >& its);
static med_entity_type ConvertIntoMEDFileType(TypeOfField ikType, INTERP_KERNEL::NormalizedCellType ikGeoType, med_geometry_type& medfGeoType);
MEDFileFieldPerMeshPerType(MEDFileFieldPerMesh *fath, INTERP_KERNEL::NormalizedCellType geoType);
private:
MEDFileFieldPerMesh *_father;
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> > _field_pm_pt_pd;
+ std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> > _field_pm_pt_pd;
INTERP_KERNEL::NormalizedCellType _geo_type;
};
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<TypeOfField,INTERP_KERNEL::NormalizedCellType> > *entities);
std::size_t getHeapMemorySizeWithoutChildren() const;
std::vector<const BigMemoryObject *> 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<int>& code, const std::vector<int>& code2, const std::vector<DataArrayInt *>& idsInPflPerType, const std::vector<DataArrayInt *>& idsPerType, const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
void keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair<int,int> >& its);
void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
- MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
+ MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto<DataArray> &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<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId);
private:
int addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type);
MEDCouplingFieldDouble *finishField(TypeOfField type, const MEDFileFieldGlobsReal *glob,
- const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs, const MEDCouplingMesh *mesh, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
+ const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
MEDCouplingFieldDouble *finishField2(TypeOfField type, const MEDFileFieldGlobsReal *glob,
const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs,
const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes,
- const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
+ const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
MEDCouplingFieldDouble *finishFieldNode2(const MEDFileFieldGlobsReal *glob,
const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs,
- const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
+ const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
DataArray *finishField4(const std::vector< std::pair<int,int> >& 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<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<int,int> >& dads, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& locs,
std::vector<int>& code, std::vector<DataArrayInt *>& notNullPfls);
int _mesh_iteration;
int _mesh_order;
MEDFileAnyTypeField1TSWithoutSDA *_father;
- std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > > _field_pm_pt;
+ std::vector< MCAuto< MEDFileFieldPerMeshPerType > > _field_pm_pt;
};
class MEDFileFieldGlobsReal;
static MEDFileFieldGlobs *New();
std::size_t getHeapMemorySizeWithoutChildren() const;
std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
- MEDFileFieldGlobs *deepCpy() const;
+ MEDFileFieldGlobs *deepCopy() const;
MEDFileFieldGlobs *shallowCpyPart(const std::vector<std::string>& pfls, const std::vector<std::string>& locs) const;
MEDFileFieldGlobs *deepCpyPart(const std::vector<std::string>& pfls, const std::vector<std::string>& locs) const;
void simpleRepr(std::ostream& oss) const;
MEDFileFieldGlobs();
~MEDFileFieldGlobs();
protected:
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > _pfls;
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldLoc> > _locs;
+ std::vector< MCAuto<DataArrayInt> > _pfls;
+ std::vector< MCAuto<MEDFileFieldLoc> > _locs;
std::string _file_name;
};
MEDFileFieldGlobs *contentNotNull();
const MEDFileFieldGlobs *contentNotNull() const;
protected:
- MEDCouplingAutoRefCountObjectPtr< MEDFileFieldGlobs > _globals;
+ MCAuto< MEDFileFieldGlobs > _globals;
};
class MEDFileFieldNameScope
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<MEDFileAnyTypeField1TSWithoutSDA> > splitComponents() const;
+ MEDLOADER_EXPORT virtual std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > 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<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const = 0;
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<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
- MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
- MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr<DataArray> &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<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
+ MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
+ MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
+ MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MCAuto<DataArray> &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<DataArray> &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<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob);
- MEDLOADER_EXPORT std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > splitDiscretizations() const;
- MEDLOADER_EXPORT std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > splitMultiDiscrPerGeoTypes() const;
+ MEDLOADER_EXPORT std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > splitDiscretizations() const;
+ MEDLOADER_EXPORT std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > splitMultiDiscrPerGeoTypes() const;
MEDLOADER_EXPORT int keepOnlySpatialDiscretization(TypeOfField tof, std::vector< std::pair<int,int> >& its);
MEDLOADER_EXPORT int keepOnlyGaussDiscretization(std::size_t idOfDisc, std::vector< std::pair<int,int> >& its);
public:
int addNewEntryIfNecessary(const MEDCouplingMesh *mesh);
void updateData(int newLgth, const std::vector< std::pair<int,int> >& oldStartStops);
protected:
- std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > > _field_per_mesh;
+ std::vector< MCAuto< MEDFileFieldPerMesh > > _field_per_mesh;
int _iteration;
int _order;
double _dt;
MEDLOADER_EXPORT MEDFileField1TSWithoutSDA();
MEDLOADER_EXPORT MEDFileField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order, const std::vector<std::string>& 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();
MEDLOADER_EXPORT const DataArrayDouble *getOrCreateAndGetArrayDouble() const;
MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA *convertToInt() const;
protected:
- MEDCouplingAutoRefCountObjectPtr< DataArrayDouble > _arr;
+ MCAuto< DataArrayDouble > _arr;
public:
static const char TYPE_STR[];
};
public:
MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA();
MEDLOADER_EXPORT static MEDFileIntField1TSWithoutSDA *New(const std::string& fieldName, int csit, int iteration, int order, const std::vector<std::string>& 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;
protected:
MEDFileIntField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos);
protected:
- MEDCouplingAutoRefCountObjectPtr< DataArrayInt > _arr;
+ MCAuto< DataArrayInt > _arr;
public:
MEDLOADER_EXPORT static const char TYPE_STR[];
};
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:
MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *contentNotNullBase();
MEDLOADER_EXPORT const MEDFileAnyTypeField1TSWithoutSDA *contentNotNullBase() const;
protected:
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> _content;
+ MCAuto<MEDFileAnyTypeField1TSWithoutSDA> _content;
};
class MEDFileIntField1TS;
MEDLOADER_EXPORT std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
public:
- MEDLOADER_EXPORT static void SetDataArrayDoubleInField(MEDCouplingFieldDouble *f, MEDCouplingAutoRefCountObjectPtr<DataArray>& arr);
- MEDLOADER_EXPORT static DataArrayDouble *ReturnSafelyDataArrayDouble(MEDCouplingAutoRefCountObjectPtr<DataArray>& arr);
+ MEDLOADER_EXPORT static void SetDataArrayDoubleInField(MEDCouplingFieldDouble *f, MCAuto<DataArray>& arr);
+ MEDLOADER_EXPORT static DataArrayDouble *ReturnSafelyDataArrayDouble(MCAuto<DataArray>& arr);
private:
med_field_type getMEDFileFieldType() const { return MED_FLOAT64; }
const MEDFileField1TSWithoutSDA *contentNotNull() const;
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<DataArray>& arr);
+ MEDLOADER_EXPORT static DataArrayInt *ReturnSafelyDataArrayInt(MCAuto<DataArray>& arr);
private:
med_field_type getMEDFileFieldType() const { return MED_INT32; }
const MEDFileIntField1TSWithoutSDA *contentNotNull() const;
public:
MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
- MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTSWithoutSDA *deepCpy() const;
- MEDLOADER_EXPORT virtual std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > splitComponents() const;
- MEDLOADER_EXPORT virtual std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > splitDiscretizations() const;
- MEDLOADER_EXPORT virtual std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > splitMultiDiscrPerGeoTypes() const;
+ MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTSWithoutSDA *deepCopy() const;
+ MEDLOADER_EXPORT virtual std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > splitComponents() const;
+ MEDLOADER_EXPORT virtual std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > splitDiscretizations() const;
+ MEDLOADER_EXPORT virtual std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > splitMultiDiscrPerGeoTypes() const;
MEDLOADER_EXPORT virtual const char *getTypeStr() const = 0;
MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const = 0;
MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTSWithoutSDA *createNew() const = 0;
MEDLOADER_EXPORT int getPosGivenTime(double time, double eps=1e-8) const;
MEDLOADER_EXPORT std::vector< std::pair<int,int> > getIterations() const;
MEDLOADER_EXPORT std::vector< std::pair<int,int> > getTimeSteps(std::vector<double>& ret1) const;
- MEDLOADER_EXPORT void pushBackTimeStep(MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA>& tse);
+ MEDLOADER_EXPORT void pushBackTimeStep(MCAuto<MEDFileAnyTypeField1TSWithoutSDA>& 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<int>& levs) const;
MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsedMulti2() const;
MEDLOADER_EXPORT void changePflsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
MEDLOADER_EXPORT void changeLocsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
- MEDLOADER_EXPORT void setIteration(int i, MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> ts);
+ MEDLOADER_EXPORT void setIteration(int i, MCAuto<MEDFileAnyTypeField1TSWithoutSDA> ts);
protected:
virtual med_field_type getMEDFileFieldType() const = 0;
void copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr);
void checkThatNbOfCompoOfTSMatchThis() const;
protected:
std::vector<std::string> _infos;
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > _time_steps;
+ std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > _time_steps;
};
class MEDFileIntFieldMultiTSWithoutSDA;
MEDLOADER_EXPORT void writeLL(med_idt fid) const;
MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDLOADER_EXPORT std::vector<const BigMemoryObject *> 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;
//
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<MEDFileAnyTypeFieldMultiTS *> > SplitIntoCommonTimeSeries(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS);
- MEDLOADER_EXPORT static std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > SplitPerCommonSupport(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS, const MEDFileMesh *mesh, std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFastCellSupportComparator> >& fsc);
+ MEDLOADER_EXPORT static std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > SplitPerCommonSupport(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS, const MEDFileMesh *mesh, std::vector< MCAuto<MEDFileFastCellSupportComparator> >& 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;
MEDLOADER_EXPORT int getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector<int>& levs) const;
MEDLOADER_EXPORT std::vector< std::vector<TypeOfField> > getTypesOfFieldAvailable() const;
MEDLOADER_EXPORT std::vector< std::vector< std::pair<int,int> > > getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
- MEDLOADER_EXPORT MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> getContent();
+ MEDLOADER_EXPORT MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> getContent();
public:
MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsed() const;
MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsed() const;
MEDFileAnyTypeFieldMultiTSWithoutSDA *contentNotNullBase();
const MEDFileAnyTypeFieldMultiTSWithoutSDA *contentNotNullBase() const;
private:
- static std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > SplitPerCommonSupportNotNodesAlg(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS, const MEDFileMesh *mesh, std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFastCellSupportComparator> >& cmps);
+ static std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > SplitPerCommonSupportNotNodesAlg(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS, const MEDFileMesh *mesh, std::vector< MCAuto<MEDFileFastCellSupportComparator> >& cmps);
protected:
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> _content;
+ MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> _content;
};
class MEDFileIntFieldMultiTS;
MEDLOADER_EXPORT ~MEDFileAnyTypeFieldMultiTSIterator();
MEDLOADER_EXPORT MEDFileAnyTypeField1TS *nextt();
private:
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTS> _fmts;
+ MCAuto<MEDFileAnyTypeFieldMultiTS> _fmts;
int _iter_id;
int _nb_iter;
};
MEDLOADER_EXPORT static MEDFileFields *LoadSpecificEntities(const std::string& fileName, const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> >& entities, bool loadAll=true);
MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDLOADER_EXPORT std::vector<const BigMemoryObject *> 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;
MEDFileFields();
MEDFileFields(const std::string& fileName, bool loadAll, const MEDFileMeshes *ms, const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > *entities);
private:
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > _fields;
+ std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > _fields;
};
class MEDFileFieldsIterator
MEDLOADER_EXPORT ~MEDFileFieldsIterator();
MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *nextt();
private:
- MEDCouplingAutoRefCountObjectPtr<MEDFileFields> _fs;
+ MCAuto<MEDFileFields> _fs;
int _iter_id;
int _nb_iter;
};
MEDMeshMultiLev *MEDMeshMultiLev::NewOnlyOnNode(const MEDFileMesh *m, const DataArrayInt *pflOnNode)
{
- MEDCouplingAutoRefCountObjectPtr<MEDMeshMultiLev> ret(MEDMeshMultiLev::New(m,m->getNonEmptyLevels()));
+ MCAuto<MEDMeshMultiLev> ret(MEDMeshMultiLev::New(m,m->getNonEmptyLevels()));
ret->selectPartOfNodes(pflOnNode);
return ret.retn();
}
DataArray *MEDMeshMultiLev::buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArray> ret(const_cast<DataArray *>(vals)); ret->incrRef();
+ MCAuto<DataArray> ret(const_cast<DataArray *>(vals)); ret->incrRef();
if(isFastlyTheSameStruct(fst,globs))
return ret.retn();
else
{ famIds=const_cast<DataArrayInt *>(fids); famIds->incrRef(); isWithoutCopy=_mesh->isObjectInTheProgeny(famIds); return ; }
//bad luck the slowest part
isWithoutCopy=false;
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > retSafe(sz);
+ std::vector< MCAuto<DataArrayInt> > retSafe(sz);
std::vector< const DataArrayInt *> ret(sz);
int start(0);
for(std::size_t i=0;i<sz;i++)
int lgth(_nb_entities[i]);
if(pfl)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp(fids->selectByTupleId2(start,start+lgth,1));
+ MCAuto<DataArrayInt> 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;
{ numIds=const_cast<DataArrayInt *>(nids); numIds->incrRef(); isWithoutCopy=_mesh->isObjectInTheProgeny(numIds); return ; }
//bad luck the slowest part
isWithoutCopy=false;
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > retSafe(sz);
+ std::vector< MCAuto<DataArrayInt> > retSafe(sz);
std::vector< const DataArrayInt *> ret(sz);
int start(0);
for(std::size_t i=0;i<sz;i++)
int lgth(_nb_entities[i]);
if(pfl)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp(nids->selectByTupleId2(start,start+lgth,1));
+ MCAuto<DataArrayInt> 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;
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<DataArrayInt> p1(globs->getProfile(pflName.c_str())->deepCpy());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> p2(nr->deepCpy());
+ MCAuto<DataArrayInt> p1(globs->getProfile(pflName.c_str())->deepCopy());
+ MCAuto<DataArrayInt> 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<DataArray> ret(vals->deepCpy());
+ MCAuto<DataArray> ret(vals->deepCopy());
ret->renumberInPlace(p1->begin());
return ret.retn();
}
if(!pflName.empty() && !nr)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> p1(globs->getProfile(pflName.c_str())->deepCpy());
+ MCAuto<DataArrayInt> 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<DataArray> ret(vals->deepCpy());
+ MCAuto<DataArray> ret(vals->deepCopy());
ret->renumberInPlace(globs->getProfile(pflName.c_str())->begin());
return ret.retn();
}
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<DataArray> > arrSafe(s.size());
+ std::vector< MCAuto<DataArray> > arrSafe(s.size());
int iii(0);
int nc(vals->getNumberOfComponents());
std::vector<std::string> compInfo(vals->getInfoOnComponents());
int nbi(ps[0]->getNbOfIntegrationPts(globs));
const DataArrayInt *otherP(ps[0]->getPfl(globs));
const std::pair<int,int>& strtStop(ps[0]->getStartStop());
- MEDCouplingAutoRefCountObjectPtr<DataArray> ret(vals->selectByTupleId2(strtStop.first,strtStop.second,1));
+ MCAuto<DataArray> ret(vals->selectByTupleIdSafeSlice(strtStop.first,strtStop.second,1));
if(!thisP && !otherP)
{
arrSafe[iii]=ret; arr[iii]=ret;
}
if(thisP && otherP)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> p1(otherP->invertArrayN2O2O2N(getNumberOfCells(ps[0]->getGeo())));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> p2(thisP->deepCpy());
+ MCAuto<DataArrayInt> p1(otherP->invertArrayN2O2O2N(getNumberOfCells(ps[0]->getGeo())));
+ MCAuto<DataArrayInt> 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;
}
if(!thisP && otherP)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> p1(otherP->deepCpy());
+ MCAuto<DataArrayInt> p1(otherP->deepCopy());
p1->sort(true);
p1->checkAllIdsInRange(0,getNumberOfCells(ps[0]->getGeo()));
p1=DataArrayInt::FindPermutationFromFirstToSecond(otherP,p1);
{
std::vector< const DataArrayInt * >otherPS(ps.size());
std::vector< const DataArray * > arr2(ps.size());
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArray> > arr2Safe(ps.size());
+ std::vector< MCAuto<DataArray> > arr2Safe(ps.size());
std::vector< const DataArrayInt * > nbis(ps.size());
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > nbisSafe(ps.size());
+ std::vector< MCAuto<DataArrayInt> > nbisSafe(ps.size());
int jj(0);
for(std::vector<const MEDFileField1TSStructItem2 *>::const_iterator it2=ps.begin();it2!=ps.end();it2++,jj++)
{
int nbi((*it2)->getNbOfIntegrationPts(globs));
const DataArrayInt *otherPfl((*it2)->getPfl(globs));
const std::pair<int,int>& strtStop((*it2)->getStartStop());
- MEDCouplingAutoRefCountObjectPtr<DataArray> ret2(vals->selectByTupleId2(strtStop.first,strtStop.second,1));
+ MCAuto<DataArray> 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<DataArray> arr3(DataArray::Aggregate(arr2));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> otherP(DataArrayInt::Aggregate(otherPS));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> zenbis(DataArrayInt::Aggregate(nbis));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> otherPN(otherP->invertArrayN2O2O2N(getNumberOfCells(*it)));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> p1;
+ MCAuto<DataArray> arr3(DataArray::Aggregate(arr2));
+ MCAuto<DataArrayInt> otherP(DataArrayInt::Aggregate(otherPS));
+ MCAuto<DataArrayInt> zenbis(DataArrayInt::Aggregate(nbis));
+ MCAuto<DataArrayInt> otherPN(otherP->invertArrayN2O2O2N(getNumberOfCells(*it)));
+ MCAuto<DataArrayInt> p1;
if(thisP)
p1=DataArrayInt::FindPermutationFromFirstToSecond(otherP,thisP);
else
- p1=otherP->deepCpy();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> zenbisN(zenbis->renumber(p1->begin()));
- zenbisN->computeOffsets2();
+ p1=otherP->deepCopy();
+ MCAuto<DataArrayInt> zenbisN(zenbis->renumber(p1->begin()));
+ zenbisN->computeOffsetsFull();
jj=0;
for(std::vector<const MEDFileField1TSStructItem2 *>::const_iterator it2=ps.begin();it2!=ps.end();it2++,jj++)
{
//int nbi((*it2)->getNbOfIntegrationPts(globs));
const DataArrayInt *otherPfl((*it2)->getPfl(globs));
const std::pair<int,int>& strtStop((*it2)->getStartStop());
- MEDCouplingAutoRefCountObjectPtr<DataArray> ret2(vals->selectByTupleId2(strtStop.first,strtStop.second,1));
+ MCAuto<DataArray> ret2(vals->selectByTupleIdSafeSlice(strtStop.first,strtStop.second,1));
//
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> p2(otherPfl->deepCpy());
+ MCAuto<DataArrayInt> p2(otherPfl->deepCopy());
p2->transformWithIndArr(otherPN->begin(),otherPN->end());
p2->transformWithIndArr(p1->begin(),p1->end());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> idsN(p2->buildExplicitArrByRanges(zenbisN));
+ MCAuto<DataArrayInt> idsN(p2->buildExplicitArrByRanges(zenbisN));
arr3->setPartOfValuesBase3(ret2,idsN->begin(),idsN->end(),0,nc,1);
}
arrSafe[iii]=arr3; arr[iii]=arr3;
const DataArrayInt *cf(_cell_fam_ids),*cn(_cell_num_ids),*nf(_node_fam_ids),*nn(_node_num_ids);
if(cf)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
+ MCAuto<DataArrayInt> tmp;
std::vector<const DataArrayInt *> a(2);
a[0]=cf;
if(nf)
}
if(cn)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
+ MCAuto<DataArrayInt> tmp;
std::vector<const DataArrayInt *> a(2);
a[0]=cn;
if(nn)
return ;
}
//
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > famIdsSafe(sz);
+ std::vector< MCAuto<DataArrayInt> > famIdsSafe(sz);
std::vector<const DataArrayInt *> famIds(sz);
bool f(true);
for(std::size_t i=0;i<sz;i++)
}
if(f)
_cell_fam_ids=DataArrayInt::Aggregate(famIds);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > numIdsSafe(sz);
+ std::vector< MCAuto<DataArrayInt> > numIdsSafe(sz);
std::vector<const DataArrayInt *> numIds(sz);
bool n(true);
for(std::size_t i=0;i<sz;i++)
if(!pflNodes || !pflNodes->isAllocated())
return ;
std::size_t sz(_parts.size());
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > a(sz);
+ std::vector< MCAuto<DataArrayInt> > a(sz);
std::vector< const DataArrayInt *> aa(sz);
for(std::size_t i=0;i<sz;i++)
{
const DataArrayInt *pfl(_pfls[i]);
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> m(_parts[i]);
+ MCAuto<MEDCoupling1GTUMesh> m(_parts[i]);
if(pfl)
m=dynamic_cast<MEDCoupling1GTUMesh *>(_parts[i]->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end()));
DataArrayInt *cellIds=0;
m->fillCellIdsToKeepFromNodeIds(pflNodes->begin(),pflNodes->end(),true,cellIds);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellIdsSafe(cellIds);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingPointSet> m2(m->buildPartOfMySelfKeepCoords(cellIds->begin(),cellIds->end()));
+ MCAuto<DataArrayInt> cellIdsSafe(cellIds);
+ MCAuto<MEDCouplingPointSet> m2(m->buildPartOfMySelfKeepCoords(cellIds->begin(),cellIds->end()));
int tmp=-1;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n(m2->getNodeIdsInUse(tmp));
+ MCAuto<DataArrayInt> o2n(m2->getNodeIdsInUse(tmp));
a[i]=o2n->invertArrayO2N2N2O(tmp); aa[i]=a[i];
if(pfl)
_pfls[i]=pfl->selectByTupleIdSafe(cellIds->begin(),cellIds->end());
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())
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<DataArrayInt> pflNodes2(pflNodes->deepCpy());
+ MCAuto<DataArrayInt> pflNodes2(pflNodes->deepCopy());
pflNodes2->sort(true);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> diff(pflNodes2->buildSubstractionOptimized(_node_reduction));
+ MCAuto<DataArrayInt> diff(pflNodes2->buildSubstractionOptimized(_node_reduction));
appendVertices(diff,pflNodes2);
}
{
}
-MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh>& part):MEDMeshMultiLev(other)
+MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const MCAuto<MEDCoupling1GTUMesh>& part):MEDMeshMultiLev(other)
{
_parts.resize(1);
_parts[0]=part;
tmp=_parts[0]->getCoords();
if(!tmp)
throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : the coordinates are null !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> a(const_cast<DataArrayDouble *>(tmp)); tmp->incrRef();
+ MCAuto<DataArrayDouble> a(const_cast<DataArrayDouble *>(tmp)); tmp->incrRef();
int szBCE(0),szD(0),szF(0);
bool isPolyh(false);
int iii(0);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> >::const_iterator it=_parts.begin();it!=_parts.end();it++,iii++)
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::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<MEDCoupling1GTUMesh> cur2;
+ MCAuto<MEDCoupling1GTUMesh> cur2;
if(!pfl)
{ cur2=const_cast<MEDCoupling1GTUMesh *>(cur); cur2->incrRef(); }
else
else
{
isPolyh=true;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp2(cur->computeEffectiveNbOfNodesPerCell());
+ MCAuto<DataArrayInt> tmp2(cur->computeEffectiveNbOfNodesPerCell());
szD+=tmp2->accumulate(0)+curNbCells;
szF+=2*curNbCells+cur->getNodalConnectivity()->getNumberOfTuples();
}
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayByte> b(DataArrayByte::New()); b->alloc(szBCE,1); char *bPtr(b->getPointer());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> c(DataArrayInt::New()); c->alloc(szBCE,1); int *cPtr(c->getPointer());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d(DataArrayInt::New()); d->alloc(szD,1); int *dPtr(d->getPointer());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> e(DataArrayInt::New()),f(DataArrayInt::New()); int *ePtr(0),*fPtr(0);
+ MCAuto<DataArrayByte> b(DataArrayByte::New()); b->alloc(szBCE,1); char *bPtr(b->getPointer());
+ MCAuto<DataArrayInt> c(DataArrayInt::New()); c->alloc(szBCE,1); int *cPtr(c->getPointer());
+ MCAuto<DataArrayInt> d(DataArrayInt::New()); d->alloc(szD,1); int *dPtr(d->getPointer());
+ MCAuto<DataArrayInt> 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<MEDCoupling1GTUMesh> >::const_iterator it=_parts.begin();it!=_parts.end();it++,iii++)
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_parts.begin();it!=_parts.end();it++,iii++)
{
const MEDCoupling1GTUMesh *cur(*it);
//
const DataArrayInt *pfl(_pfls[iii]);
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> cur2;
+ MCAuto<MEDCoupling1GTUMesh> cur2;
if(!pfl)
{ cur2=const_cast<MEDCoupling1GTUMesh *>(cur); cur2->incrRef(); }
else
return _mesh->isObjectInTheProgeny(coords);
}
-void MEDUMeshMultiLev::reorderNodesIfNecessary(MEDCouplingAutoRefCountObjectPtr<DataArrayDouble>& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const
+void MEDUMeshMultiLev::reorderNodesIfNecessary(MCAuto<DataArrayDouble>& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const
{
const DataArrayInt *nr(_node_reduction);
if(!nr)
if(szExp!=nr->getNumberOfTuples())
throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::reorderNodesIfNecessary : internal error #3 !");
// Go renumbering !
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n(DataArrayInt::New()); o2n->alloc(sz,1);
+ MCAuto<DataArrayInt> o2n(DataArrayInt::New()); o2n->alloc(sz,1);
int *o2nPtr(o2n->getPointer());
int newId(0);
for(int i=0;i<sz;i++,o2nPtr++)
if(b[i]) *o2nPtr=newId++; else *o2nPtr=-1;
const int *o2nPtrc(o2n->begin());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> n2o(o2n->invertArrayO2N2N2O(nr->getNumberOfTuples()));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> perm(DataArrayInt::FindPermutationFromFirstToSecond(n2o,nr));
+ MCAuto<DataArrayInt> n2o(o2n->invertArrayO2N2N2O(nr->getNumberOfTuples()));
+ MCAuto<DataArrayInt> perm(DataArrayInt::FindPermutationFromFirstToSecond(n2o,nr));
const int *permPtr(perm->begin());
int *work2(nodalConnVTK->getPointer()),*endW2(nodalConnVTK->getPointer()+nodalConnVTK->getNumberOfTuples());
while(work2!=endW2)
{
int nbOfCells(verticesToAdd->getNumberOfTuples());//it is not a bug cells are NORM_POINT1
MEDMeshMultiLev::appendVertices(verticesToAdd,nr);
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> elt(MEDCoupling1SGTUMesh::New("",INTERP_KERNEL::NORM_POINT1));
+ MCAuto<MEDCoupling1SGTUMesh> elt(MEDCoupling1SGTUMesh::New("",INTERP_KERNEL::NORM_POINT1));
elt->allocateCells(nbOfCells);
for(int i=0;i<nbOfCells;i++)
{
if(_parts.empty())
throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::appendVertices : parts are empty !");
elt->setCoords(_parts[0]->getCoords());
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> elt2((MEDCoupling1SGTUMesh *)elt); elt2->incrRef();
+ MCAuto<MEDCoupling1GTUMesh> elt2((MEDCoupling1SGTUMesh *)elt); elt2->incrRef();
_parts.push_back(elt2);
}
const DataArrayInt *pfl(0),*nr(_node_reduction);
if(!_pfls.empty())
pfl=_pfls[0];
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> facesIfPresent2(facesIfPresent); facesIfPresent->incrRef();
+ MCAuto<MEDCoupling1GTUMesh> facesIfPresent2(facesIfPresent); facesIfPresent->incrRef();
moveFaceToCell();
- MEDCouplingAutoRefCountObjectPtr<MEDUMeshMultiLev> ret2(new MEDUMeshMultiLev(*this,facesIfPresent2));
+ MCAuto<MEDUMeshMultiLev> ret2(new MEDUMeshMultiLev(*this,facesIfPresent2));
if(pfl)
ret2->setCellReduction(pfl);
if(nr)
if(!pflNodes || !pflNodes->isAllocated())
return ;
std::vector<int> ngs(getNodeGridStructure());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(MEDCouplingStructuredMesh::Build1GTNodalConnectivity(&ngs[0],&ngs[0]+ngs.size()));
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> m(MEDCoupling1SGTUMesh::New("",MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(ngs.size())));
+ MCAuto<DataArrayInt> conn(MEDCouplingStructuredMesh::Build1GTNodalConnectivity(&ngs[0],&ngs[0]+ngs.size()));
+ MCAuto<MEDCoupling1SGTUMesh> m(MEDCoupling1SGTUMesh::New("",MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(ngs.size())));
m->setNodalConnectivity(conn);
const DataArrayInt *pfl(_pfls[0]);
if(pfl)
}
DataArrayInt *cellIds=0;
m->fillCellIdsToKeepFromNodeIds(pflNodes->begin(),pflNodes->end(),true,cellIds);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellIdsSafe(cellIds);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingPointSet> m2(m->buildPartOfMySelfKeepCoords(cellIds->begin(),cellIds->end()));
+ MCAuto<DataArrayInt> cellIdsSafe(cellIds);
+ MCAuto<MEDCouplingPointSet> m2(m->buildPartOfMySelfKeepCoords(cellIds->begin(),cellIds->end()));
int tmp=-1;
_node_reduction=m2->getNodeIdsInUse(tmp);
if(pfl)
const DataArrayInt *pfl(0),*nr(_node_reduction);
if(!_pfls.empty())
pfl=_pfls[0];
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nnr;
+ MCAuto<DataArrayInt> nnr;
std::vector<int> cgs,ngs(getNodeGridStructure());
cgs.resize(ngs.size());
std::transform(ngs.begin(),ngs.end(),cgs.begin(),std::bind2nd(std::plus<int>(),-1));
if(pfl)
{
std::vector< std::pair<int,int> > cellParts;
- MEDCouplingAutoRefCountObjectPtr<MEDMeshMultiLev> ret2;
+ MCAuto<MEDMeshMultiLev> ret2;
if(MEDCouplingStructuredMesh::IsPartStructured(pfl->begin(),pfl->end(),cgs,cellParts))
{
- MEDCouplingAutoRefCountObjectPtr<MEDCMeshMultiLev> ret(new MEDCMeshMultiLev(*this));
+ MCAuto<MEDCMeshMultiLev> 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<DataArrayDouble> > coords(_coords.size());
+ std::vector< MCAuto<DataArrayDouble> > 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<MEDCouplingCMesh> m(MEDCouplingCMesh::New());
+ MCAuto<MEDCouplingCMesh> m(MEDCouplingCMesh::New());
for(std::size_t i=0;i<ngs.size();i++)
m->setCoordsAt(i,_coords[i]);
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> m2(m->build1SGTUnstructured());
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> m3=dynamic_cast<MEDCoupling1GTUMesh *>(m2->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end()));
- MEDCouplingAutoRefCountObjectPtr<MEDUMeshMultiLev> ret(new MEDUMeshMultiLev(*this,m3));
+ MCAuto<MEDCoupling1SGTUMesh> m2(m->build1SGTUnstructured());
+ MCAuto<MEDCoupling1GTUMesh> m3=dynamic_cast<MEDCoupling1GTUMesh *>(m2->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end()));
+ MCAuto<MEDUMeshMultiLev> 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<DataArrayInt> tmp(famIds->selectByTupleIdSafe(pfl->begin(),pfl->end()));
+ MCAuto<DataArrayInt> tmp(famIds->selectByTupleIdSafe(pfl->begin(),pfl->end()));
ret2->setFamilyIdsOnCells(tmp);
}
if(numIds)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp(numIds->selectByTupleIdSafe(pfl->begin(),pfl->end()));
+ MCAuto<DataArrayInt> tmp(numIds->selectByTupleIdSafe(pfl->begin(),pfl->end()));
ret2->setNumberIdsOnCells(tmp);
}
return ret2.retn();
}
else
{
- MEDCouplingAutoRefCountObjectPtr<MEDCMeshMultiLev> ret(new MEDCMeshMultiLev(*this));
+ MCAuto<MEDCMeshMultiLev> 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();
}
}
const DataArrayInt *pfl(0),*nr(_node_reduction);
if(!_pfls.empty())
pfl=_pfls[0];
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nnr;
+ MCAuto<DataArrayInt> nnr;
std::vector<int> cgs,ngs(getNodeGridStructure());
cgs.resize(ngs.size());
std::transform(ngs.begin(),ngs.end(),cgs.begin(),std::bind2nd(std::plus<int>(),-1));
if(pfl)
{
std::vector< std::pair<int,int> > cellParts,nodeParts;
- MEDCouplingAutoRefCountObjectPtr<MEDMeshMultiLev> ret2;
+ MCAuto<MEDMeshMultiLev> ret2;
if(MEDCouplingStructuredMesh::IsPartStructured(pfl->begin(),pfl->end(),cgs,cellParts))
{
nodeParts=cellParts;
nodeParts[i].second++;
st[i]=nodeParts[i].second-nodeParts[i].first;
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> p(MEDCouplingStructuredMesh::BuildExplicitIdsFrom(ngs,nodeParts));
- MEDCouplingAutoRefCountObjectPtr<MEDCurveLinearMeshMultiLev> ret(new MEDCurveLinearMeshMultiLev(*this));
+ MCAuto<DataArrayInt> p(MEDCouplingStructuredMesh::BuildExplicitIdsFrom(ngs,nodeParts));
+ MCAuto<MEDCurveLinearMeshMultiLev> 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());
}
else
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCurveLinearMesh> m(MEDCouplingCurveLinearMesh::New());
+ MCAuto<MEDCouplingCurveLinearMesh> m(MEDCouplingCurveLinearMesh::New());
m->setCoords(_coords); m->setNodeGridStructure(&_structure[0],&_structure[0]+_structure.size());
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> m2(m->build1SGTUnstructured());
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> m3=dynamic_cast<MEDCoupling1GTUMesh *>(m2->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end()));
- MEDCouplingAutoRefCountObjectPtr<MEDUMeshMultiLev> ret(new MEDUMeshMultiLev(*this,m3));
+ MCAuto<MEDCoupling1SGTUMesh> m2(m->build1SGTUnstructured());
+ MCAuto<MEDCoupling1GTUMesh> m3=dynamic_cast<MEDCoupling1GTUMesh *>(m2->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end()));
+ MCAuto<MEDUMeshMultiLev> 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<DataArrayInt> tmp(famIds->selectByTupleIdSafe(pfl->begin(),pfl->end()));
+ MCAuto<DataArrayInt> tmp(famIds->selectByTupleIdSafe(pfl->begin(),pfl->end()));
ret2->setFamilyIdsOnCells(tmp);
}
if(numIds)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp(numIds->selectByTupleIdSafe(pfl->begin(),pfl->end()));
+ MCAuto<DataArrayInt> tmp(numIds->selectByTupleIdSafe(pfl->begin(),pfl->end()));
ret2->setNumberIdsOnCells(tmp);
}
return ret2.retn();
}
else
{
- MEDCouplingAutoRefCountObjectPtr<MEDCurveLinearMeshMultiLev> ret(new MEDCurveLinearMeshMultiLev(*this));
+ MCAuto<MEDCurveLinearMeshMultiLev> 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();
}
}
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<DataArrayInt> arr(DataArrayInt::Aggregate(arrs));
+ MCAuto<DataArrayInt> 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<int,int> p(0,nbEntityRef);
std::string a,b;
else
{
const DataArrayInt *pfl=globs->getProfile(otherNodeIt.getPflName().c_str());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cpyPfl(pfl->deepCpy());
+ MCAuto<DataArrayInt> cpyPfl(pfl->deepCopy());
cpyPfl->sort();
- if(cpyPfl->isIdentity2(nbOfNodes))
+ if(cpyPfl->isIota(nbOfNodes))
{//on all nodes also !
if(!ret0)
return false;
int pos0(-1),pos1(-1);
if(presenceOfCellDiscr(pos0))
{
- MEDCouplingAutoRefCountObjectPtr<MEDMeshMultiLev> ret(_already_checked[pos0].buildFromScratchDataSetSupportOnCells(mst,globs));
+ MCAuto<MEDMeshMultiLev> ret(_already_checked[pos0].buildFromScratchDataSetSupportOnCells(mst,globs));
if(presenceOfPartialNodeDiscr(pos1))
ret->setNodeReduction(_already_checked[pos1][0].getPfl(globs));
return ret.retn();
_f1ts_cmps.resize(nbPts);
for(int i=0;i<nbPts;i++)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> elt=ref->getTimeStepAtPos(i);
+ MCAuto<MEDFileAnyTypeField1TS> elt=ref->getTimeStepAtPos(i);
try
{
_f1ts_cmps[i]=MEDFileField1TSStruct::New(elt,_mesh_comp);
std::size_t MEDFileFastCellSupportComparator::getHeapMemorySizeWithoutChildren() const
{
- std::size_t ret(_f1ts_cmps.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSStruct>));
+ std::size_t ret(_f1ts_cmps.capacity()*sizeof(MCAuto<MEDFileField1TSStruct>));
return ret;
}
const MEDFileMeshStruct *mst(_mesh_comp);
if(mst)
ret.push_back(mst);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSStruct> >::const_iterator it=_f1ts_cmps.begin();it!=_f1ts_cmps.end();it++)
+ for(std::vector< MCAuto<MEDFileField1TSStruct> >::const_iterator it=_f1ts_cmps.begin();it!=_f1ts_cmps.end();it++)
ret.push_back((const MEDFileField1TSStruct *)*it);
return ret;
}
}
for(int i=0;i<nbPts;i++)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> elt=other->getTimeStepAtPos(i);
+ MCAuto<MEDFileAnyTypeField1TS> elt=other->getTimeStepAtPos(i);
if(!_f1ts_cmps[i]->isEqualConsideringThePast(elt,_mesh_comp))
if(!_f1ts_cmps[i]->isSupportSameAs(elt,_mesh_comp))
return false;
}
for(int i=0;i<nbPts;i++)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> elt=other->getTimeStepAtPos(i);
+ MCAuto<MEDFileAnyTypeField1TS> elt=other->getTimeStepAtPos(i);
if(!_f1ts_cmps[i]->isCompatibleWithNodesDiscr(elt,_mesh_comp))
return false;
}
#include "MEDLoaderDefines.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "MEDCouplingRefCountObject.hxx"
#include "MEDCoupling1GTUMesh.hxx"
MEDMeshMultiLev(const MEDFileMesh *mesh, int nbNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
protected:
const MEDFileMesh *_mesh;
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > _pfls;
+ std::vector< MCAuto<DataArrayInt> > _pfls;
std::vector< INTERP_KERNEL::NormalizedCellType > _geo_types;
std::vector<int> _nb_entities;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _node_reduction;
+ MCAuto<DataArrayInt> _node_reduction;
int _nb_nodes;
//
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _cell_fam_ids;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _cell_num_ids;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _node_fam_ids;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _node_num_ids;
+ MCAuto<DataArrayInt> _cell_fam_ids;
+ MCAuto<DataArrayInt> _cell_num_ids;
+ MCAuto<DataArrayInt> _node_fam_ids;
+ MCAuto<DataArrayInt> _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];
static MEDUMeshMultiLev *New(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
void selectPartOfNodes(const DataArrayInt *pflNodes);
MEDMeshMultiLev *prepare() const;
- MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh>& part);
+ MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const MCAuto<MEDCoupling1GTUMesh>& 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<DataArrayDouble>& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const;
+ void reorderNodesIfNecessary(MCAuto<DataArrayDouble>& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const;
private:
MEDUMeshMultiLev(const MEDUMeshMultiLev& other);
MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector<int>& levs);
MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
private:
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> > _parts;
+ std::vector< MCAuto<MEDCoupling1GTUMesh> > _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<DataArrayDouble> _coords;
+ MCAuto<DataArrayDouble> _coords;
};
class MEDStructuredMeshMultiLev : public MEDMeshMultiLev
void initStdFieldOfIntegers(const MEDFileStructuredMesh *m);
protected:
bool _is_internal;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _face_fam_ids;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _face_num_ids;
+ MCAuto<DataArrayInt> _face_fam_ids;
+ MCAuto<DataArrayInt> _face_num_ids;
};
class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev
MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector<int>& levs);
MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
private:
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > _coords;
+ std::vector< MCAuto<DataArrayDouble> > _coords;
};
class MEDCurveLinearMeshMultiLev : public MEDStructuredMeshMultiLev
MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector<int>& levs);
MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
private:
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> _coords;
+ MCAuto<DataArrayDouble> _coords;
std::vector<int> _structure;
};
private:
INTERP_KERNEL::NormalizedCellType _geo_type;
std::pair<int,int> _start_end;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _pfl;
+ MCAuto<DataArrayInt> _pfl;
std::string _loc;
int _nb_of_entity;
};
private:
MEDFileFastCellSupportComparator(const MEDFileMeshStruct *m, const MEDFileAnyTypeFieldMultiTS *ref);
private:
- MEDCouplingAutoRefCountObjectPtr<MEDFileMeshStruct> _mesh_comp;
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSStruct> > _f1ts_cmps;
+ MCAuto<MEDFileMeshStruct> _mesh_comp;
+ std::vector< MCAuto<MEDFileField1TSStruct> > _f1ts_cmps;
};
}
std::size_t MEDFileJointCorrespondence::getHeapMemorySizeWithoutChildren() const
{
- return sizeof(MEDCouplingAutoRefCountObjectPtr<DataArrayInt>);
+ return sizeof(MCAuto<DataArrayInt>);
}
std::vector<const BigMemoryObject *> MEDFileJointCorrespondence::getDirectChildrenWithNull() const
return true;
}
-MEDFileJointCorrespondence *MEDFileJointCorrespondence::deepCpy() const
+MEDFileJointCorrespondence *MEDFileJointCorrespondence::deepCopy() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileJointCorrespondence> ret=new MEDFileJointCorrespondence(*this);
+ MCAuto<MEDFileJointCorrespondence> ret=new MEDFileJointCorrespondence(*this);
return ret.retn();
}
MEDFileJointCorrespondence *MEDFileJointCorrespondence::shallowCpy() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileJointCorrespondence> ret=new MEDFileJointCorrespondence(*this);
+ MCAuto<MEDFileJointCorrespondence> ret=new MEDFileJointCorrespondence(*this);
return ret.retn();
}
std::size_t MEDFileJointOneStep::getHeapMemorySizeWithoutChildren() const
{
- return _correspondences.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr<DataArrayInt>);
+ return _correspondences.capacity()*sizeof(MCAuto<DataArrayInt>);
}
std::vector<const BigMemoryObject *> MEDFileJointOneStep::getDirectChildrenWithNull() const
&loc_ent_type, &loc_geo_type, &rem_ent_type, &rem_geo_type, &num_entity));
if ( num_entity > 0 )
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> correspondence=DataArrayInt::New();
+ MCAuto<DataArrayInt> 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()));
void MEDFileJointOneStep::writeLL(med_idt fid, const std::string& localMeshName, const std::string& jointName) const
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileJointCorrespondence> >::const_iterator it=_correspondences.begin();it!=_correspondences.end();it++)
+ for(std::vector< MCAuto<MEDFileJointCorrespondence> >::const_iterator it=_correspondences.begin();it!=_correspondences.end();it++)
{
(*it)->writeLL(fid, localMeshName, jointName, getOrder(), getIteration());
}
return true;
}
-MEDFileJointOneStep *MEDFileJointOneStep::deepCpy() const
+MEDFileJointOneStep *MEDFileJointOneStep::deepCopy() const
{
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileJointCorrespondence> > correspondences(_correspondences.size());
+ std::vector< MCAuto<MEDFileJointCorrespondence> > correspondences(_correspondences.size());
std::size_t i=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileJointCorrespondence> >::const_iterator it=_correspondences.begin();it!=_correspondences.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileJointCorrespondence> >::const_iterator it=_correspondences.begin();it!=_correspondences.end();it++,i++)
if((const MEDFileJointCorrespondence *)*it)
- correspondences[i]=(*it)->deepCpy();
- MEDCouplingAutoRefCountObjectPtr<MEDFileJointOneStep> ret= new MEDFileJointOneStep;
+ correspondences[i]=(*it)->deepCopy();
+ MCAuto<MEDFileJointOneStep> ret= new MEDFileJointOneStep;
ret->_correspondences=correspondences;
return ret.retn();
}
MEDFileJointOneStep *MEDFileJointOneStep::shallowCpy() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileJointOneStep> ret=new MEDFileJointOneStep(*this);
+ MCAuto<MEDFileJointOneStep> ret=new MEDFileJointOneStep(*this);
return ret.retn();
}
std::ostringstream oss;
oss << "(*************************************)\n(* JOINT_ONE_STEP INFORMATION: *)\n(*************************************)\n";
oss << "- Number of the correspondences : <<" << _correspondences.size() << ">>\n";
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileJointCorrespondence> >::const_iterator it=_correspondences.begin();it!=_correspondences.end();it++)
+ for(std::vector< MCAuto<MEDFileJointCorrespondence> >::const_iterator it=_correspondences.begin();it!=_correspondences.end();it++)
{
oss << (*it)->simpleRepr();
}
}
std::size_t MEDFileJoint::getHeapMemorySizeWithoutChildren() const
{
- return _joint.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr<MEDFileJointOneStep>);
+ return _joint.capacity()*sizeof(MCAuto<MEDFileJointOneStep>);
}
std::vector<const BigMemoryObject *> MEDFileJoint::getDirectChildrenWithNull() 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<MEDFileJointOneStep> >::const_iterator it=_joint.begin();it!=_joint.end();it++) {
+ for(std::vector< MCAuto<MEDFileJointOneStep> >::const_iterator it=_joint.begin();it!=_joint.end();it++) {
(*it)->writeLL(fid, getLocalMeshName(),getJointName());
}
}
return true;
}
-MEDFileJoint *MEDFileJoint::deepCpy() const
+MEDFileJoint *MEDFileJoint::deepCopy() const
{
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileJointOneStep> > joint(_joint.size());
+ std::vector< MCAuto<MEDFileJointOneStep> > joint(_joint.size());
std::size_t i=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileJointOneStep> >::const_iterator it=_joint.begin();it!=_joint.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileJointOneStep> >::const_iterator it=_joint.begin();it!=_joint.end();it++,i++)
if((const MEDFileJointOneStep *)*it)
- joint[i]=(*it)->deepCpy();
- MEDCouplingAutoRefCountObjectPtr<MEDFileJoint> ret=MEDFileJoint::New();
+ joint[i]=(*it)->deepCopy();
+ MCAuto<MEDFileJoint> ret=MEDFileJoint::New();
ret->_joint=joint;
return ret.retn();
}
MEDFileJoint *MEDFileJoint::shallowCpy() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileJoint> ret=new MEDFileJoint(*this);
+ MCAuto<MEDFileJoint> ret=new MEDFileJoint(*this);
return ret.retn();
}
oss << "- Description : <<" << getDescription() << ">>\n";
oss << "- Joint name : <<" << getJointName() << ">>\n";
oss << "- Domain number : " << getDomainNumber() << "\n";
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileJointOneStep> >::const_iterator it=_joint.begin();it!=_joint.end();it++)
+ for(std::vector< MCAuto<MEDFileJointOneStep> >::const_iterator it=_joint.begin();it!=_joint.end();it++)
{
oss << (*it)->simpleRepr();
}
void MEDFileJoints::write(med_idt fid) const
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileJoint> >::const_iterator it=_joints.begin();it!=_joints.end();it++)
+ for(std::vector< MCAuto<MEDFileJoint> >::const_iterator it=_joints.begin();it!=_joints.end();it++)
{
(*it)->write(fid);
}
{
std::vector<std::string> ret(_joints.size());
int i=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileJoint> >::const_iterator it=_joints.begin();it!=_joints.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileJoint> >::const_iterator it=_joints.begin();it!=_joints.end();it++,i++)
{
const MEDFileJoint *f=(*it);
if(f)
bool MEDFileJoints::changeJointNames(const std::vector< std::pair<std::string,std::string> >& modifTab)
{
bool ret=false;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileJoint> >::iterator it=_joints.begin();it!=_joints.end();it++)
+ for(std::vector< MCAuto<MEDFileJoint> >::iterator it=_joints.begin();it!=_joints.end();it++)
{
MEDFileJoint *cur(*it);
if(cur)
_joints.push_back(MEDFileJoint::New(fid,meshName,i));
}
-MEDFileJoints *MEDFileJoints::deepCpy() const
+MEDFileJoints *MEDFileJoints::deepCopy() const
{
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileJoint> > joints(_joints.size());
+ std::vector< MCAuto<MEDFileJoint> > joints(_joints.size());
std::size_t i=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileJoint> >::const_iterator it=_joints.begin();it!=_joints.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileJoint> >::const_iterator it=_joints.begin();it!=_joints.end();it++,i++)
if((const MEDFileJoint *)*it)
- joints[i]=(*it)->deepCpy();
- MEDCouplingAutoRefCountObjectPtr<MEDFileJoints> ret=MEDFileJoints::New();
+ joints[i]=(*it)->deepCopy();
+ MCAuto<MEDFileJoints> ret=MEDFileJoints::New();
ret->_joints=joints;
return ret.retn();
}
std::size_t MEDFileJoints::getHeapMemorySizeWithoutChildren() const
{
- return _joints.capacity()*(sizeof(MEDCouplingAutoRefCountObjectPtr<MEDFileJoint>));
+ return _joints.capacity()*(sizeof(MCAuto<MEDFileJoint>));
}
std::vector<const BigMemoryObject *> MEDFileJoints::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileJoint> >::const_iterator it=_joints.begin();it!=_joints.end();it++)
+ for(std::vector< MCAuto<MEDFileJoint> >::const_iterator it=_joints.begin();it!=_joints.end();it++)
ret.push_back((const MEDFileJoint *)*it);
return ret;
}
std::vector<std::string> jns=getJointsNames();
for(int i=0;i<nbOfJoints;i++)
oss << " - #" << i << " \"" << jns[i] << "\"\n";
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileJoint> >::const_iterator it=_joints.begin();it!=_joints.end();it++)
+ for(std::vector< MCAuto<MEDFileJoint> >::const_iterator it=_joints.begin();it!=_joints.end();it++)
{
oss << (*it)->simpleRepr();
}
#include "MEDLoaderDefines.hxx"
#include "MEDFileUtilities.hxx"
#include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
namespace MEDCoupling
{
INTERP_KERNEL::NormalizedCellType rem_geo_type);
MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDLOADER_EXPORT std::vector<const BigMemoryObject *> 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; }
bool _is_nodal;
INTERP_KERNEL::NormalizedCellType _loc_geo_type;
INTERP_KERNEL::NormalizedCellType _rem_geo_type;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _correspondence;
+ MCAuto<DataArrayInt> _correspondence;
};
/*!
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<const BigMemoryObject *> 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; }
int _order;
int _iteration;
private:
- std::vector<MEDCouplingAutoRefCountObjectPtr<MEDFileJointCorrespondence> > _correspondences;
+ std::vector<MCAuto<MEDFileJointCorrespondence> > _correspondences;
};
/*!
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<const BigMemoryObject *> 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; }
std::string _desc_name;
int _domain_number;
std::string _rem_mesh_name;
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileJointOneStep> > _joint;
+ std::vector< MCAuto<MEDFileJointOneStep> > _joint;
};
/*!
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<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDLOADER_EXPORT std::string simpleRepr() const;
MEDFileJoints();
MEDFileJoints(med_idt fid, const std::string& meshName);
private:
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileJoint> > _joints;
+ std::vector< MCAuto<MEDFileJoint> > _joints;
};
}
std::string dummy2;
MEDCoupling::MEDCouplingAxisType dummy3;
MEDFileMeshL2::GetMeshIdFromName(fid,ms.front(),meshType,dummy3,dt,it,dummy2);
- MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> ret;
+ MCAuto<MEDFileMesh> ret;
switch(meshType)
{
case UNSTRUCTURED:
std::string dummy2;
MEDCoupling::MEDCouplingAxisType dummy3;
MEDFileMeshL2::GetMeshIdFromName(fid,mName,meshType,dummy3,dummy0,dummy1,dummy2);
- MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> ret;
+ MCAuto<MEDFileMesh> ret;
switch(meshType)
{
case UNSTRUCTURED:
*/
std::vector<std::string> MEDFileMesh::removeOrphanFamilies()
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> allFamIdsInUse=computeAllFamilyIdsInUse();
+ MCAuto<DataArrayInt> allFamIdsInUse=computeAllFamilyIdsInUse();
std::vector<std::string> ret;
if(!((DataArrayInt*)allFamIdsInUse))
{
std::vector<bool> v(fams->getNumberOfTuples(),false);
for(std::set<int>::const_iterator pt=idsRefed.begin();pt!=idsRefed.end();pt++)
fams->switchOnTupleEqualTo(*pt,v);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> unfetchedIds(DataArrayInt::BuildListOfSwitchedOff(v));
+ MCAuto<DataArrayInt> unfetchedIds(DataArrayInt::BuildListOfSwitchedOff(v));
if(!unfetchedIds->empty())
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newFams(fams->deepCpy());
+ MCAuto<DataArrayInt> newFams(fams->deepCopy());
newFams->setPartOfValuesSimple3(0,unfetchedIds->begin(),unfetchedIds->end(),0,1,1);
setFamilyFieldArr(*it,newFams);
}
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<DataArrayInt> famIds=fieldFamIds->getDifferentValues();
+ MCAuto<DataArrayInt> famIds=fieldFamIds->getDifferentValues();
std::vector<std::string> familiesOnWholeGroup;
for(const int *it=famIds->begin();it!=famIds->end();it++)
{
const DataArrayInt *fieldFamIds=getFamilyFieldAtLevel(*it);
if(fieldFamIds)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> famIds3=fieldFamIds->getDifferentValues();
+ MCAuto<DataArrayInt> famIds3=fieldFamIds->getDifferentValues();
std::vector<int> tmp;
std::set_intersection(famIds3->begin(),famIds3->end(),famIds2.begin(),famIds2.end(),std::back_insert_iterator< std::vector<int> >(tmp));
for(std::vector<int>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
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<DataArrayInt> famArrTmp(famArr);
+ famArr->incrRef(); MCAuto<DataArrayInt> famArrTmp(famArr);
std::vector<std::string> 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<DataArrayInt> > allFamIds(getAllNonNullFamilyIds());
+ std::list< MCAuto<DataArrayInt> > allFamIds(getAllNonNullFamilyIds());
allFamIds.erase(std::find(allFamIds.begin(),allFamIds.end(),famArrTmp));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> famIds=famArr->selectByTupleIdSafe(ids->begin(),ids->end());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> diffFamIds=famIds->getDifferentValues();
+ MCAuto<DataArrayInt> famIds=famArr->selectByTupleIdSafe(ids->begin(),ids->end());
+ MCAuto<DataArrayInt> diffFamIds=famIds->getDifferentValues();
std::vector<int> familyIds;
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > idsPerfamiliyIds;
+ std::vector< MCAuto<DataArrayInt> > idsPerfamiliyIds;
int maxVal=getTheMaxAbsFamilyId()+1;
std::map<std::string,int> families(_families);
std::map<std::string, std::vector<std::string> > groups(_groups);
bool created(false);
for(const int *famId=diffFamIds->begin();famId!=diffFamIds->end();famId++)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids2Tmp=famIds->getIdsEqual(*famId);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids2=ids->selectByTupleId(ids2Tmp->begin(),ids2Tmp->end());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids1=famArr->getIdsEqual(*famId);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret0(ids1->buildSubstractionOptimized(ids2));
+ MCAuto<DataArrayInt> ids2Tmp=famIds->findIdsEqual(*famId);
+ MCAuto<DataArrayInt> ids2=ids->selectByTupleId(ids2Tmp->begin(),ids2Tmp->end());
+ MCAuto<DataArrayInt> ids1=famArr->findIdsEqual(*famId);
+ MCAuto<DataArrayInt> ret0(ids1->buildSubstractionOptimized(ids2));
if(ret0->empty())
{
bool isFamPresent=false;
- for(std::list< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >::const_iterator itl=allFamIds.begin();itl!=allFamIds.end() && !isFamPresent;itl++)
+ for(std::list< MCAuto<DataArrayInt> >::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
*/
DataArrayInt *MEDFileMesh::getAllFamiliesIdsReferenced() const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ MCAuto<DataArrayInt> ret=DataArrayInt::New();
std::set<int> v;
for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
v.insert((*it).second);
DataArrayInt *MEDFileMesh::computeAllFamilyIdsInUse() const
{
std::vector<int> famLevs=getFamArrNonEmptyLevelsExt();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
+ MCAuto<DataArrayInt> ret;
for(std::vector<int>::const_iterator it=famLevs.begin();it!=famLevs.end();it++)
{
const DataArrayInt *arr=getFamilyFieldAtLevel(*it);//arr not null due to spec of getFamArrNonEmptyLevelsExt
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> dv=arr->getDifferentValues();
+ MCAuto<DataArrayInt> dv=arr->getDifferentValues();
if((DataArrayInt *) ret)
ret=dv->buildUnion(ret);
else
const DataArrayInt *fam=getFamilyFieldAtLevel(*it);
if(fam)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp=fam->getDifferentValues();
+ MCAuto<DataArrayInt> tmp=fam->getDifferentValues();
std::set<int> r2;
std::set_intersection(tmp->begin(),tmp->end(),allFamIds.begin(),allFamIds.end(),std::inserter(r2,r2.end()));
if(!r2.empty())
}
if(famIdsToRenum.empty())
return true;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> allIds=getAllFamiliesIdsReferenced();
+ MCAuto<DataArrayInt> allIds=getAllFamiliesIdsReferenced();
for(std::map<int,std::vector<int> >::const_iterator it2=famIdsToRenum.begin();it2!=famIdsToRenum.end();it2++)
{
DataArrayInt *fam=const_cast<DataArrayInt *>(getFamilyFieldAtLevel((*it2).first));
addFamilyOnGrp((*it4),newFam);
}
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids=fam->getIdsEqualList(&(*it2).second[0],&(*it2).second[0]+(*it2).second.size());
+ MCAuto<DataArrayInt> 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]];
}
void MEDFileMesh::normalizeFamIdsTrio()
{
ensureDifferentFamIdsPerLevel();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> allIds=getAllFamiliesIdsReferenced();
+ MCAuto<DataArrayInt> allIds=getAllFamiliesIdsReferenced();
std::vector<int> levs=getNonEmptyLevelsExt();
std::set<int> levsS(levs.begin(),levs.end());
std::set<std::string> famsFetched;
if(fam)
{
int refId=1;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp=fam->getDifferentValues();
+ MCAuto<DataArrayInt> tmp=fam->getDifferentValues();
std::map<int,int> ren;
for(const int *it=tmp->begin();it!=tmp->end();it++,refId++)
ren[*it]=refId;
if(fam)
{
int refId=-1;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp=fam->getDifferentValues();
+ MCAuto<DataArrayInt> tmp=fam->getDifferentValues();
std::map<int,int> ren;
for(const int *it=tmp->begin();it!=tmp->end();it++,refId--)
ren[*it]=refId;
DataArrayInt *fam=const_cast<DataArrayInt*>(getFamilyFieldAtLevel(*it2));
if(fam)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp=fam->getDifferentValues();
+ MCAuto<DataArrayInt> tmp=fam->getDifferentValues();
fam->fillWithZero();
for(const int *it3=tmp->begin();it3!=tmp->end();it3++)
if(allIds->presenceOfValue(*it3))
void MEDFileMesh::normalizeFamIdsMEDFile()
{
ensureDifferentFamIdsPerLevel();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> allIds=getAllFamiliesIdsReferenced();
+ MCAuto<DataArrayInt> allIds=getAllFamiliesIdsReferenced();
std::vector<int> levs=getNonEmptyLevelsExt();
std::set<int> levsS(levs.begin(),levs.end());
std::set<std::string> famsFetched;
const DataArrayInt *fam=getFamilyFieldAtLevel(1);
if(fam)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp=fam->getDifferentValues();
+ MCAuto<DataArrayInt> tmp=fam->getDifferentValues();
std::map<int,int> ren;
for(const int *it=tmp->begin();it!=tmp->end();it++,refId++)
ren[*it]=refId;
const DataArrayInt *fam=getFamilyFieldAtLevel(*it2);
if(fam)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp=fam->getDifferentValues();
+ MCAuto<DataArrayInt> tmp=fam->getDifferentValues();
std::map<int,int> ren;
for(const int *it=tmp->begin();it!=tmp->end();it++,refId--)
ren[*it]=refId;
DataArrayInt *ret(getFamilyFieldAtLevel(meshDimRelToMaxExt));
if(ret)
return ret;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr(DataArrayInt::New());
+ MCAuto<DataArrayInt> arr(DataArrayInt::New());
arr->alloc(getSizeAtLevel(meshDimRelToMaxExt),1);
arr->fillWithZero();
setFamilyFieldArr(meshDimRelToMaxExt,arr);
if(grpsName.find(std::string(""))!=grpsName.end())
throw INTERP_KERNEL::Exception("MEDFileUMesh::setGroupsAtLevel : groups name must be different empty string !");
int sz=getSizeAtLevel(meshDimRelToMaxExt);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> fam;
+ MCAuto<DataArrayInt> fam;
std::vector< std::vector<int> > fidsOfGroups;
if(!renum)
{
}
else
{
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > grps2(grps.size());
+ std::vector< MCAuto<DataArrayInt> > grps2(grps.size());
for(unsigned int ii=0;ii<grps.size();ii++)
{
grps2[ii]=MEDFileUMeshSplitL1::Renumber(getRevNumberFieldAtLevel(meshDimRelToMaxExt),grps[ii]);
if(!_families.empty())
offset=getMaxAbsFamilyId()+1;
TranslateFamilyIds(meshDimRelToMaxExt==1?offset:-offset,fam,fidsOfGroups);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids=fam->getDifferentValues();
+ MCAuto<DataArrayInt> ids=fam->getDifferentValues();
appendFamilyEntries(ids,fidsOfGroups,grpsName2);
setFamilyFieldArr(meshDimRelToMaxExt,fam);
}
std::vector<int> MEDFileMesh::getDistributionOfTypes(int meshDimRelToMax) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> mLev(getMeshAtLevel(meshDimRelToMax));
+ MCAuto<MEDCouplingMesh> mLev(getMeshAtLevel(meshDimRelToMax));
return mLev->getDistributionOfTypes();
}
*/
MEDFileUMesh *MEDFileUMesh::LoadPartOf(med_idt fid, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> ret(MEDFileUMesh::New());
+ MCAuto<MEDFileUMesh> ret(MEDFileUMesh::New());
ret->loadPartUMeshFromFile(fid,mName,types,slicPerTyp,dt,it,mrs);
return ret.retn();
}
std::size_t MEDFileUMesh::getHeapMemorySizeWithoutChildren() const
{
std::size_t ret(MEDFileMesh::getHeapMemorySizeWithoutChildren());
- ret+=_ms.capacity()*(sizeof(MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1>));
+ ret+=_ms.capacity()*(sizeof(MCAuto<MEDFileUMeshSplitL1>));
return ret;
}
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<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
ret.push_back((const MEDFileUMeshSplitL1*) *it);
return ret;
}
MEDFileMesh *MEDFileUMesh::shallowCpy() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> ret(new MEDFileUMesh(*this));
+ MCAuto<MEDFileUMesh> ret(new MEDFileUMesh(*this));
return ret.retn();
}
return new MEDFileUMesh;
}
-MEDFileMesh *MEDFileUMesh::deepCpy() const
+MEDFileMesh *MEDFileUMesh::deepCopy() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> ret(new MEDFileUMesh(*this));
+ MCAuto<MEDFileUMesh> 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<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::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();
}
const DataArrayAsciiChar *namc1=_name_coords;
if(namc1)
(const_cast<DataArrayAsciiChar *>(namc1))->setName("");//This parameter is not discriminant for comparison
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
{
const MEDFileUMeshSplitL1 *tmp=(*it);
if(tmp)
void MEDFileUMesh::setName(const std::string& name)
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::iterator it=_ms.begin();it!=_ms.end();it++)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::iterator it=_ms.begin();it!=_ms.end();it++)
if((MEDFileUMeshSplitL1 *)(*it)!=0)
(*it)->setName(name);
MEDFileMesh::setName(name);
{
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
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());
}
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 << "' !";
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<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::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);
{
std::vector<int> ret;
int lev=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--)
if((const MEDFileUMeshSplitL1 *)(*it)!=0)
if(!(*it)->empty())
ret.push_back(lev);
if(famCoo)
ret.push_back(1);
int lev=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--)
{
const MEDFileUMeshSplitL1 *cur(*it);
if(cur)
if(numCoo)
ret.push_back(1);
int lev=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--)
{
const MEDFileUMeshSplitL1 *cur(*it);
if(cur)
if(nameCoo)
ret.push_back(1);
int lev=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev--)
{
const MEDFileUMeshSplitL1 *cur(*it);
if(cur)
int val=_fam_coords->getMaxValue(tmp);
ret=std::max(ret,std::abs(val));
}
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
{
if((const MEDFileUMeshSplitL1 *)(*it))
{
int val=_fam_coords->getMaxValue(tmp);
ret=std::max(ret,val);
}
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
{
if((const MEDFileUMeshSplitL1 *)(*it))
{
int val=_fam_coords->getMinValue(tmp);
ret=std::min(ret,val);
}
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
{
if((const MEDFileUMeshSplitL1 *)(*it))
{
int MEDFileUMesh::getMeshDimension() const
{
int lev=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++,lev++)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::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 !");
else
{
const DataArrayInt *arr(globs->getProfile(st[i].getPflName()));
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> m2(dynamic_cast<MEDCoupling1GTUMesh *>(m->buildPartOfMySelf(arr->begin(),arr->end(),true)));
+ MCAuto<MEDCoupling1GTUMesh> m2(dynamic_cast<MEDCoupling1GTUMesh *>(m->buildPartOfMySelf(arr->begin(),arr->end(),true)));
m2->computeNodeIdsAlg(nodesFetched);
}
}
MEDFileMesh *MEDFileUMesh::cartesianize() const
{
- if(getAxType()==AX_CART)
+ if(getAxisType()==AX_CART)
{
incrRef();
return const_cast<MEDFileUMesh *>(this);
}
else
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> ret(new MEDFileUMesh(*this));
+ MCAuto<MEDFileUMesh> ret(new MEDFileUMesh(*this));
const DataArrayDouble *coords(_coords);
if(!coords)
throw INTERP_KERNEL::Exception("MEDFileUMesh::cartesianize : coordinates are null !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsCart(_coords->cartesianize(getAxType()));
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::iterator it=ret->_ms.begin();it!=ret->_ms.end();it++)
+ MCAuto<DataArrayDouble> coordsCart(_coords->cartesianize(getAxisType()));
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::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();
}
}
DataArrayDouble *MEDFileUMesh::getCoords() const
{
checkCartesian();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp(_coords);
+ MCAuto<DataArrayDouble> tmp(_coords);
if((DataArrayDouble *)tmp)
{
return tmp;
checkCartesian();
synchronizeTinyInfoOnLeaves();
std::vector<std::string> fams2=getFamiliesOnGroups(grps);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> zeRet=getFamilies(meshDimRelToMaxExt,fams2,renum);
+ MCAuto<MEDCouplingUMesh> zeRet=getFamilies(meshDimRelToMaxExt,fams2,renum);
if(grps.size()==1 && ((MEDCouplingUMesh *)zeRet))
zeRet->setName(grps[0]);
return zeRet.retn();
synchronizeTinyInfoOnLeaves();
if(meshDimRelToMaxExt==1)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr=getFamiliesArr(1,fams,renum);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MEDCouplingUMesh::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> c=_coords->selectByTupleId(arr->getConstPointer(),arr->getConstPointer()+arr->getNbOfElems());
+ MCAuto<DataArrayInt> arr=getFamiliesArr(1,fams,renum);
+ MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New();
+ MCAuto<DataArrayDouble> c=_coords->selectByTupleId(arr->getConstPointer(),arr->getConstPointer()+arr->getNbOfElems());
ret->setCoords(c);
return ret.retn();
}
std::vector<int> famIds=getFamiliesIds(fams);
const MEDFileUMeshSplitL1 *l1=getMeshAtLevSafe(meshDimRelToMaxExt);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> zeRet;
+ MCAuto<MEDCouplingUMesh> zeRet;
if(!famIds.empty())
zeRet=l1->getFamilyPart(&famIds[0],&famIds[0]+famIds.size(),renum);
else
{
if((const DataArrayInt *)_fam_coords)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da;
+ MCAuto<DataArrayInt> 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
if(!renum)
{
MEDCouplingUMesh *umesh=MEDCouplingUMesh::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> cc=_coords->deepCpy();
+ MCAuto<DataArrayDouble> cc=_coords->deepCopy();
umesh->setCoords(cc);
MEDFileUMeshSplitL1::ClearNonDiscrAttributes(umesh);
umesh->setName(getName());
*/
void MEDFileUMesh::forceComputationOfParts() const
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
{
const MEDFileUMeshSplitL1 *elt(*it);
if(elt)
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<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++,i++)
{
if(((const MEDFileUMeshSplitL1*) (*it))!=0)
{
_fam_coords=DataArrayInt::New();
_fam_coords->alloc(nbOfTuples,1);
_fam_coords->fillWithZero();
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::iterator it=_ms.begin();it!=_ms.end();it++)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::iterator it=_ms.begin();it!=_ms.end();it++)
if((MEDFileUMeshSplitL1 *)(*it))
(*it)->setCoords(coords);
}
for(std::vector<int>::const_iterator it=levs.begin();it!=levs.end();it++)
{
const DataArrayInt *ffield=getFamilyFieldAtLevel(*it);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids=ffield->getDifferentValues();
+ MCAuto<DataArrayInt> ids=ffield->getDifferentValues();
std::set<int> res;
std::set_union(ids->begin(),ids->end(),allFamsIds.begin(),allFamsIds.end(),std::inserter(res,res.begin()));
allFamsIds=res;
std::vector<int> 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<MEDCouplingUMesh> m0=getMeshAtLevel(0);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m1=getMeshAtLevel(-1);
+ MCAuto<MEDCouplingUMesh> m0=getMeshAtLevel(0);
+ MCAuto<MEDCouplingUMesh> m1=getMeshAtLevel(-1);
int nbNodes=m0->getNumberOfNodes();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m11=getGroup(-1,grpNameM1);
+ MCAuto<MEDCouplingUMesh> m11=getGroup(-1,grpNameM1);
DataArrayInt *tmp00=0,*tmp11=0,*tmp22=0;
m0->findNodesToDuplicate(*m11,tmp00,tmp11,tmp22);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nodeIdsToDuplicate(tmp00);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellsToModifyConn0(tmp11);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellsToModifyConn1(tmp22);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> tmp0=static_cast<MEDCouplingUMesh *>(m0->buildPartOfMySelf(cellsToModifyConn0->begin(),cellsToModifyConn0->end(),true));
+ MCAuto<DataArrayInt> nodeIdsToDuplicate(tmp00);
+ MCAuto<DataArrayInt> cellsToModifyConn0(tmp11);
+ MCAuto<DataArrayInt> cellsToModifyConn1(tmp22);
+ MCAuto<MEDCouplingUMesh> tmp0=static_cast<MEDCouplingUMesh *>(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<DataArrayInt> descTmp0=DataArrayInt::New(),descITmp0=DataArrayInt::New(),revDescTmp0=DataArrayInt::New(),revDescITmp0=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> tmp0Desc=tmp0->buildDescendingConnectivity(descTmp0,descITmp0,revDescTmp0,revDescITmp0);
+ MCAuto<DataArrayInt> descTmp0=DataArrayInt::New(),descITmp0=DataArrayInt::New(),revDescTmp0=DataArrayInt::New(),revDescITmp0=DataArrayInt::New();
+ MCAuto<MEDCouplingUMesh> tmp0Desc=tmp0->buildDescendingConnectivity(descTmp0,descITmp0,revDescTmp0,revDescITmp0);
descTmp0=0; descITmp0=0; revDescTmp0=0; revDescITmp0=0;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellsInM1ToRenumW2=tmp0Desc->getCellIdsLyingOnNodes(nodeIdsToDuplicate->begin(),nodeIdsToDuplicate->end(),false);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> cellsInM1ToRenumW3=static_cast<MEDCouplingUMesh *>(tmp0Desc->buildPartOfMySelf(cellsInM1ToRenumW2->begin(),cellsInM1ToRenumW2->end(),true));
+ MCAuto<DataArrayInt> cellsInM1ToRenumW2=tmp0Desc->getCellIdsLyingOnNodes(nodeIdsToDuplicate->begin(),nodeIdsToDuplicate->end(),false);
+ MCAuto<MEDCouplingUMesh> cellsInM1ToRenumW3=static_cast<MEDCouplingUMesh *>(tmp0Desc->buildPartOfMySelf(cellsInM1ToRenumW2->begin(),cellsInM1ToRenumW2->end(),true));
DataArrayInt *cellsInM1ToRenumW4Tmp=0;
m1->areCellsIncludedIn(cellsInM1ToRenumW3,2,cellsInM1ToRenumW4Tmp);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellsInM1ToRenumW4(cellsInM1ToRenumW4Tmp);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellsInM1ToRenumW5=cellsInM1ToRenumW4->getIdsInRange(0,m1->getNumberOfCells());
+ MCAuto<DataArrayInt> cellsInM1ToRenumW4(cellsInM1ToRenumW4Tmp);
+ MCAuto<DataArrayInt> cellsInM1ToRenumW5=cellsInM1ToRenumW4->findIdsInRange(0,m1->getNumberOfCells());
cellsInM1ToRenumW5->transformWithIndArr(cellsInM1ToRenumW4->begin(),cellsInM1ToRenumW4->end());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> grpIds=getGroupArr(-1,grpNameM1);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellsInM1ToRenum=cellsInM1ToRenumW5->buildSubstraction(grpIds);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m1Part=static_cast<MEDCouplingUMesh *>(m1->buildPartOfMySelf(cellsInM1ToRenum->begin(),cellsInM1ToRenum->end(),true));
+ MCAuto<DataArrayInt> grpIds=getGroupArr(-1,grpNameM1);
+ MCAuto<DataArrayInt> cellsInM1ToRenum=cellsInM1ToRenumW5->buildSubstraction(grpIds);
+ MCAuto<MEDCouplingUMesh> m1Part=static_cast<MEDCouplingUMesh *>(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'
// duplication of cells in group 'grpNameM1' on level -1
m11->duplicateNodesInConn(nodeIdsToDuplicate->begin(),nodeIdsToDuplicate->end(),nbNodes); m11->setCoords(m0->getCoords());
std::vector<const MEDCouplingUMesh *> v(2); v[0]=m1; v[1]=m11;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> newm1=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(v,tmp00,tmp11);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> szOfCellGrpOfSameType(tmp00);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> idInMsOfCellGrpOfSameType(tmp11);
+ MCAuto<MEDCouplingUMesh> newm1=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(v,tmp00,tmp11);
+ MCAuto<DataArrayInt> szOfCellGrpOfSameType(tmp00);
+ MCAuto<DataArrayInt> idInMsOfCellGrpOfSameType(tmp11);
//
newm1->setName(getName());
const DataArrayInt *fam=getFamilyFieldAtLevel(-1);
if(!fam)
throw INTERP_KERNEL::Exception("MEDFileUMesh::buildInnerBoundaryAlongM1Group : internal problem !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newFam=DataArrayInt::New();
+ MCAuto<DataArrayInt> 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.
if(idInMsOfCellGrpOfSameType->getIJ(i,0)==0)
{
end=start+szOfCellGrpOfSameType->getIJ(i,0);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> part=fam->selectByTupleId2(start,end,1);
+ MCAuto<DataArrayInt> part=fam->selectByTupleIdSafeSlice(start,end,1);
newFam->setPartOfValues1(part,globStart,globEnd,1,0,1,1,true);
start=end;
}
std::vector<int> levs=getNonEmptyLevels();
bool ret=false;
std::vector< const DataArrayInt* > renumCellsSplited;//same than memorySaverIfThrow
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > memorySaverIfThrow;//same than renumCellsSplited only in case of throw
+ std::vector< MCAuto<DataArrayInt> > memorySaverIfThrow;//same than renumCellsSplited only in case of throw
int start=0;
int end=0;
for(std::vector<int>::reverse_iterator it=levs.rbegin();it!=levs.rend();it++)
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m=getMeshAtLevel(*it);
+ MCAuto<MEDCouplingUMesh> m=getMeshAtLevel(*it);
std::vector<int> code1=m->getDistributionOfTypes();
end=PutInThirdComponentOfCodeOffset(code1,start);
oldCode.insert(oldCode.end(),code1.begin(),code1.end());
bool hasChanged=m->unPolyze();
DataArrayInt *fake=0;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2nCellsPart=m->getLevArrPerCellTypes(MEDCouplingUMesh::MEDMEM_ORDER,
+ MCAuto<DataArrayInt> 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<DataArrayInt> o2nCellsPart2=o2nCellsPart->buildPermArrPerLevel();
+ MCAuto<DataArrayInt> o2nCellsPart2=o2nCellsPart->buildPermArrPerLevel();
m->renumberCells(o2nCellsPart2->getConstPointer(),false);
ret=true;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> famField2,numField2;
+ MCAuto<DataArrayInt> famField2,numField2;
const DataArrayInt *famField=getFamilyFieldAtLevel(*it); if(famField) { famField->incrRef(); famField2=const_cast<DataArrayInt *>(famField); }
const DataArrayInt *numField=getNumberFieldAtLevel(*it); if(numField) { numField->incrRef(); numField2=const_cast<DataArrayInt *>(numField); }
setMeshAtLevel(*it,m);
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<DataArrayInt> newFamField=famField->renumber(o2nCellsPart2->getConstPointer());
+ MCAuto<DataArrayInt> newFamField=famField->renumber(o2nCellsPart2->getConstPointer());
setFamilyFieldArr(*it,newFamField);
}
if(numField)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newNumField=numField->renumber(o2nCellsPart2->getConstPointer());
+ MCAuto<DataArrayInt> newNumField=numField->renumber(o2nCellsPart2->getConstPointer());
setRenumFieldArr(*it,newNumField);
}
}
}
if(ret)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> renumCells=DataArrayInt::Aggregate(renumCellsSplited);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2nRenumCellRet=renumCells->buildPermArrPerLevel();
+ MCAuto<DataArrayInt> renumCells=DataArrayInt::Aggregate(renumCellsSplited);
+ MCAuto<DataArrayInt> o2nRenumCellRet=renumCells->buildPermArrPerLevel();
o2nRenumCell=o2nRenumCellRet.retn();
}
return ret;
}
else
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh(zeLev->getWholeMesh(false));
+ MCAuto<MEDCouplingUMesh> 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<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(nbOfNodes,1);
+ MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(nbOfNodes,1);
std::transform(nodeIdsInUse.begin(),nodeIdsInUse.end(),ret->getPointer(),MEDLoaderAccVisit1());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret2(ret->invertArrayO2N2N2OBis(nbrOfNodesInUse));
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> newCoords(coo->selectByTupleIdSafe(ret2->begin(),ret2->end()));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newFamCoords;
- MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> newNameCoords;
+ MCAuto<DataArrayInt> ret2(ret->invertArrayO2N2N2OBis(nbrOfNodesInUse));
+ MCAuto<DataArrayDouble> newCoords(coo->selectByTupleIdSafe(ret2->begin(),ret2->end()));
+ MCAuto<DataArrayInt> newFamCoords;
+ MCAuto<DataArrayAsciiChar> newNameCoords;
if((const DataArrayInt *)_fam_coords)
newFamCoords=_fam_coords->selectByTupleIdSafe(ret2->begin(),ret2->end());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newNumCoords;
+ MCAuto<DataArrayInt> newNumCoords;
if((const DataArrayInt *)_num_coords)
newNumCoords=_num_coords->selectByTupleIdSafe(ret2->begin(),ret2->end());
if((const DataArrayAsciiChar *)_name_coords)
newNameCoords=static_cast<DataArrayAsciiChar *>(_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<MEDFileUMeshSplitL1> >::iterator it=_ms.begin();it!=_ms.end();it++)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::iterator it=_ms.begin();it!=_ms.end();it++)
{
if((MEDFileUMeshSplitL1*)*it)
{
const PartDefinition *pc(_part_coords);
if(pc)
{
- MEDCouplingAutoRefCountObjectPtr<PartDefinition> tmpPD(DataArrayPartDefinition::New(ret2));
+ MCAuto<PartDefinition> tmpPD(DataArrayPartDefinition::New(ret2));
_part_coords=tmpPD->composeWith(pc);
}
return ret.retn();
checkCartesian();
if(getMeshDimension()!=2)
throw INTERP_KERNEL::Exception("MEDFileUMesh::buildExtrudedMesh : this is expected to be with mesh dimension equal to 2 !");
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> ret(MEDFileUMesh::New());
- m1D->checkCoherency();
+ MCAuto<MEDFileUMesh> 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<int> levs(getNonEmptyLevels());
std::vector<std::string> grps(getGroupsNames());
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> > zeList;
+ std::vector< MCAuto<MEDCouplingUMesh> > zeList;
DataArrayDouble *coords(0);
std::size_t nbOfLevsOut(levs.size()+1);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > o2ns(nbOfLevsOut);
+ std::vector< MCAuto<DataArrayInt> > o2ns(nbOfLevsOut);
for(std::vector<int>::const_iterator lev=levs.begin();lev!=levs.end();lev++)
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> item(getMeshAtLevel(*lev));
+ MCAuto<MEDCouplingUMesh> 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<MEDCouplingUMesh> tmp(static_cast<MEDCouplingUMesh *>(m1D->deepCpy()));
+ MCAuto<MEDCouplingUMesh> tmp(static_cast<MEDCouplingUMesh *>(m1D->deepCopy()));
tmp->changeSpaceDimension(3+(*lev),0.);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> elt(item->buildExtrudedMesh(tmp,policy));
+ MCAuto<MEDCouplingUMesh> 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<MEDCouplingUMesh> >::iterator it=zeList.begin();it!=zeList.end();it++)
+ for(std::vector< MCAuto<MEDCouplingUMesh> >::iterator it=zeList.begin();it!=zeList.end();it++)
{
(*it)->setName(getName());
(*it)->setCoords(coords);
for(std::size_t ii=0;ii!=zeList.size();ii++)
{
int lev(levs[ii]);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> elt(zeList[ii]);
+ MCAuto<MEDCouplingUMesh> elt(zeList[ii]);
if(lev<=-1)
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> elt1(getMeshAtLevel(lev+1));
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> elt2(elt1->clone(false));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp(elt2->getNodalConnectivity()->deepCpy());
+ MCAuto<MEDCouplingUMesh> elt1(getMeshAtLevel(lev+1));
+ MCAuto<MEDCouplingUMesh> elt2(elt1->clone(false));
+ MCAuto<DataArrayInt> tmp(elt2->getNodalConnectivity()->deepCopy());
elt2->setConnectivity(tmp,elt2->getNodalConnectivityIndex());
elt2->shiftNodeNumbersInConn(nbRep*elt1->getNumberOfNodes());
elt1->setCoords(elt->getCoords()); elt2->setCoords(elt->getCoords());
o2ns[ii]=elt->sortCellsInMEDFileFrmt();
ret->setMeshAtLevel(lev,elt);
}
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> endLev(getMeshAtLevel(levs.back())),endLev2;
+ MCAuto<MEDCouplingUMesh> endLev(getMeshAtLevel(levs.back())),endLev2;
endLev=endLev->clone(false); endLev->setCoords(coords);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp(endLev->getNodalConnectivity()->deepCpy());
+ MCAuto<DataArrayInt> tmp(endLev->getNodalConnectivity()->deepCopy());
endLev2=endLev->clone(false); endLev2->setConnectivity(tmp,endLev->getNodalConnectivityIndex());
endLev2->shiftNodeNumbersInConn(nbRep*getNumberOfNodes());
endLev=MEDCouplingUMesh::MergeUMeshesOnSameCoords(endLev,endLev2);
for(std::size_t ii=0;ii!=zeList.size();ii++)
{
int lev(levs[ii]);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > outGrps;
+ std::vector< MCAuto<DataArrayInt> > outGrps;
std::vector< const DataArrayInt * > outGrps2;
if(lev<=-1)
{
for(std::vector<std::string>::const_iterator grp=grps.begin();grp!=grps.end();grp++)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> grpArr(getGroupArr(lev+1,*grp));
+ MCAuto<DataArrayInt> grpArr(getGroupArr(lev+1,*grp));
if(!grpArr->empty())
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> grpArr1(grpArr->deepCpy()),grpArr2(grpArr->deepCpy());
+ MCAuto<DataArrayInt> 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);
//
for(std::vector<std::string>::const_iterator grp=grps.begin();grp!=grps.end();grp++)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> grpArr(getGroupArr(lev,*grp));
+ MCAuto<DataArrayInt> grpArr(getGroupArr(lev,*grp));
if(!grpArr->empty())
{
int nbCellsB4Extrusion(getNumberOfCellsAtLevel(lev));
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > grpArrs(nbRep);
+ std::vector< MCAuto<DataArrayInt> > grpArrs(nbRep);
std::vector< const DataArrayInt *> grpArrs2(nbRep);
for(int iii=0;iii<nbRep;iii++)
{
- grpArrs[iii]=grpArr->deepCpy(); grpArrs[iii]->applyLin(1,iii*nbCellsB4Extrusion);
+ grpArrs[iii]=grpArr->deepCopy(); grpArrs[iii]->applyLin(1,iii*nbCellsB4Extrusion);
grpArrs2[iii]=grpArrs[iii];
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> grpArrExt(DataArrayInt::Aggregate(grpArrs2));
+ MCAuto<DataArrayInt> grpArrExt(DataArrayInt::Aggregate(grpArrs2));
grpArrExt->transformWithIndArr(o2ns[ii]->begin(),o2ns[ii]->end());
std::ostringstream grpName; grpName << *grp << "_extruded";
grpArrExt->setName(grpName.str());
}
ret->setGroupsAtLevel(lev,outGrps2);
}
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > outGrps;
+ std::vector< MCAuto<DataArrayInt> > outGrps;
std::vector< const DataArrayInt * > outGrps2;
for(std::vector<std::string>::const_iterator grp=grps.begin();grp!=grps.end();grp++)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> grpArr1(getGroupArr(levs.back(),*grp));
+ MCAuto<DataArrayInt> grpArr1(getGroupArr(levs.back(),*grp));
if(grpArr1->empty())
continue;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> grpArr2(grpArr1->deepCpy());
+ MCAuto<DataArrayInt> grpArr2(grpArr1->deepCopy());
std::ostringstream grpName; grpName << *grp << "_top";
grpArr2->setName(grpName.str());
grpArr2->applyLin(1,getNumberOfCellsAtLevel(levs.back()));
MEDFileUMesh *MEDFileUMesh::linearToQuadratic(int conversionType, double eps) const
{
checkCartesian();
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> ret(MEDFileUMesh::New());
+ MCAuto<MEDFileUMesh> ret(MEDFileUMesh::New());
int initialNbNodes(getNumberOfNodes());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m0Tmp(getMeshAtLevel(0));
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m0(dynamic_cast<MEDCouplingUMesh *>(m0Tmp->deepCpy()));
+ MCAuto<MEDCouplingUMesh> m0Tmp(getMeshAtLevel(0));
+ MCAuto<MEDCouplingUMesh> m0(dynamic_cast<MEDCouplingUMesh *>(m0Tmp->deepCopy()));
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> notUsed(m0->convertLinearCellsToQuadratic(conversionType));
+ MCAuto<DataArrayInt> notUsed(m0->convertLinearCellsToQuadratic(conversionType));
}
DataArrayDouble *zeCoords(m0->getCoords());
ret->setMeshAtLevel(0,m0);
const DataArrayInt *famField(getFamilyFieldAtLevel(0));
if(famField)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> famFieldCpy(famField->deepCpy());
+ MCAuto<DataArrayInt> famFieldCpy(famField->deepCopy());
ret->setFamilyFieldArr(0,famFieldCpy);
}
famField=getFamilyFieldAtLevel(1);
if(famField)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> fam(DataArrayInt::New()); fam->alloc(zeCoords->getNumberOfTuples(),1);
+ MCAuto<DataArrayInt> 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<DataArrayDouble> partZeCoords(zeCoords->selectByTupleId2(initialNbNodes,zeCoords->getNumberOfTuples(),1));
+ MCAuto<DataArrayDouble> partZeCoords(zeCoords->selectByTupleIdSafeSlice(initialNbNodes,zeCoords->getNumberOfTuples(),1));
for(std::vector<int>::const_iterator lev=levs.begin();lev!=levs.end();lev++)
{
if(*lev==0)
continue;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m1Tmp(getMeshAtLevel(*lev));
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m1(dynamic_cast<MEDCouplingUMesh *>(m1Tmp->deepCpy()));
+ MCAuto<MEDCouplingUMesh> m1Tmp(getMeshAtLevel(*lev));
+ MCAuto<MEDCouplingUMesh> m1(dynamic_cast<MEDCouplingUMesh *>(m1Tmp->deepCopy()));
if(m1->getMeshDimension()!=0)
{
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> notUsed(m1->convertLinearCellsToQuadratic(conversionType));
+ MCAuto<DataArrayInt> notUsed(m1->convertLinearCellsToQuadratic(conversionType));
}//kill unused notUsed var
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> m1Coords(m1->getCoords()->selectByTupleId2(initialNbNodes,m1->getNumberOfNodes(),1));
+ MCAuto<DataArrayDouble> m1Coords(m1->getCoords()->selectByTupleIdSafeSlice(initialNbNodes,m1->getNumberOfNodes(),1));
DataArrayInt *b(0);
bool a(partZeCoords->areIncludedInMe(m1Coords,eps,b));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bSafe(b);
+ MCAuto<DataArrayInt> 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<DataArrayInt> l0(DataArrayInt::New()); l0->alloc(initialNbNodes,1); l0->iota();
+ MCAuto<DataArrayInt> l0(DataArrayInt::New()); l0->alloc(initialNbNodes,1); l0->iota();
std::vector<const DataArrayInt *> v(2); v[0]=l0; v[1]=b;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> renum(DataArrayInt::Aggregate(v));
+ MCAuto<DataArrayInt> renum(DataArrayInt::Aggregate(v));
m1->renumberNodesInConn(renum->begin());
}
m1->setCoords(zeCoords);
famField=getFamilyFieldAtLevel(*lev);
if(famField)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> famFieldCpy(famField->deepCpy());
+ MCAuto<DataArrayInt> famFieldCpy(famField->deepCopy());
ret->setFamilyFieldArr(*lev,famFieldCpy);
}
}
MEDFileUMesh *MEDFileUMesh::quadraticToLinear(double eps) const
{
checkCartesian();
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> ret(MEDFileUMesh::New());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m0Tmp(getMeshAtLevel(0));
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m0(dynamic_cast<MEDCouplingUMesh *>(m0Tmp->deepCpy()));
+ MCAuto<MEDFileUMesh> ret(MEDFileUMesh::New());
+ MCAuto<MEDCouplingUMesh> m0Tmp(getMeshAtLevel(0));
+ MCAuto<MEDCouplingUMesh> m0(dynamic_cast<MEDCouplingUMesh *>(m0Tmp->deepCopy()));
m0->convertQuadraticCellsToLinear();
m0->zipCoords();
DataArrayDouble *zeCoords(m0->getCoords());
const DataArrayInt *famField(getFamilyFieldAtLevel(0));
if(famField)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> famFieldCpy(famField->deepCpy());
+ MCAuto<DataArrayInt> famFieldCpy(famField->deepCopy());
ret->setFamilyFieldArr(0,famFieldCpy);
}
famField=getFamilyFieldAtLevel(1);
if(famField)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> fam(famField->selectByTupleId2(0,zeCoords->getNumberOfTuples(),1));
+ MCAuto<DataArrayInt> fam(famField->selectByTupleIdSafeSlice(0,zeCoords->getNumberOfTuples(),1));
ret->setFamilyFieldArr(1,fam);
}
ret->copyFamGrpMapsFrom(*this);
{
if(*lev==0)
continue;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m1Tmp(getMeshAtLevel(*lev));
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m1(dynamic_cast<MEDCouplingUMesh *>(m1Tmp->deepCpy()));
+ MCAuto<MEDCouplingUMesh> m1Tmp(getMeshAtLevel(*lev));
+ MCAuto<MEDCouplingUMesh> m1(dynamic_cast<MEDCouplingUMesh *>(m1Tmp->deepCopy()));
m1->convertQuadraticCellsToLinear();
m1->zipCoords();
DataArrayInt *b(0);
bool a(zeCoords->areIncludedInMe(m1->getCoords(),eps,b));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bSafe(b);
+ MCAuto<DataArrayInt> bSafe(b);
if(!a)
{
std::ostringstream oss; oss << "MEDFileUMesh::quadraticToLinear : for level " << *lev << " problem to identify nodes generated !";
famField=getFamilyFieldAtLevel(*lev);
if(famField)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> famFieldCpy(famField->deepCpy());
+ MCAuto<DataArrayInt> famFieldCpy(famField->deepCopy());
ret->setFamilyFieldArr(*lev,famFieldCpy);
}
}
return ret.retn();
}
-void MEDFileUMesh::serialize(std::vector<double>& tinyDouble, std::vector<int>& tinyInt, std::vector<std::string>& tinyStr, std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >& bigArraysI, MEDCouplingAutoRefCountObjectPtr<DataArrayDouble>& bigArrayD)
+void MEDFileUMesh::serialize(std::vector<double>& tinyDouble, std::vector<int>& tinyInt, std::vector<std::string>& tinyStr, std::vector< MCAuto<DataArrayInt> >& bigArraysI, MCAuto<DataArrayDouble>& bigArrayD)
{
clearNonDiscrAttributes();
forceComputationOfParts();
tinyDouble.clear(); tinyInt.clear(); tinyStr.clear(); bigArraysI.clear(); bigArrayD=0;
std::vector<int> 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
}
void MEDFileUMesh::unserialize(std::vector<double>& tinyDouble, std::vector<int>& tinyInt, std::vector<std::string>& tinyStr,
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >& bigArraysI, MEDCouplingAutoRefCountObjectPtr<DataArrayDouble>& bigArrayD)
+ std::vector< MCAuto<DataArrayInt> >& bigArraysI, MCAuto<DataArrayDouble>& bigArrayD)
{
int sz0(tinyInt[0]);
std::vector<int> layer0(tinyInt.begin()+1,tinyInt.begin()+1+sz0);
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();
*/
void MEDFileUMesh::setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> elt(new MEDFileUMeshSplitL1(m));
+ MCAuto<MEDFileUMeshSplitL1> elt(new MEDFileUMeshSplitL1(m));
checkAndGiveEntryInSplitL1(meshDimRelToMax,m)=elt;
}
*/
void MEDFileUMesh::setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> elt(new MEDFileUMeshSplitL1(m,newOrOld));
+ MCAuto<MEDFileUMeshSplitL1> elt(new MEDFileUMeshSplitL1(m,newOrOld));
checkAndGiveEntryInSplitL1(meshDimRelToMax,m)=elt;
}
-MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1>& MEDFileUMesh::checkAndGiveEntryInSplitL1(int meshDimRelToMax, MEDCouplingPointSet *m)
+MCAuto<MEDFileUMeshSplitL1>& MEDFileUMesh::checkAndGiveEntryInSplitL1(int meshDimRelToMax, MEDCouplingPointSet *m)
{
dealWithTinyInfo(m);
std::vector<int> levSet=getNonEmptyLevels();
* \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.
*/
if((DataArrayDouble *)_coords!=coo)
throw INTERP_KERNEL::Exception("MEDFileUMesh::setGroupsFromScratch : coordinates mismatches !");
std::vector<DataArrayInt *> corr;
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m=MEDCouplingUMesh::FuseUMeshesOnSameCoords(ms,_zipconn_pol,corr);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > corr3(corr.begin(),corr.end());
+ MCAuto<MEDCouplingUMesh> m=MEDCouplingUMesh::FuseUMeshesOnSameCoords(ms,_zipconn_pol,corr);
+ std::vector< MCAuto<DataArrayInt> > corr3(corr.begin(),corr.end());
setMeshAtLevel(meshDimRelToMax,m,renum);
std::vector<const DataArrayInt *> corr2(corr.begin(),corr.end());
setGroupsAtLevel(meshDimRelToMax,corr2,true);
* \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.
*/
if((DataArrayDouble *)_coords!=coo)
throw INTERP_KERNEL::Exception("MEDFileUMesh::setGroupsOnSetMesh : coordinates mismatches !");
MEDCouplingUMesh *m=getMeshAtLevel(meshDimRelToMax,renum);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > corr(ms.size());
+ std::vector< MCAuto<DataArrayInt> > corr(ms.size());
int i=0;
for(std::vector<const MEDCouplingUMesh *>::const_iterator it=ms.begin();it!=ms.end();it++,i++)
{
int mdim=ms[0]->getMeshDimension();
for(unsigned int i=1;i<ms.size();i++)
{
- ms[i]->checkCoherency();
+ 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)
void MEDFileUMesh::synchronizeTinyInfoOnLeaves() const
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
if((const MEDFileUMeshSplitL1 *)(*it))
(*it)->synchronizeTinyInfo(*this);
}
DataArrayInt *arr=_fam_coords;
if(arr)
arr->changeValue(oldId,newId);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::iterator it=_ms.begin();it!=_ms.end();it++)
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::iterator it=_ms.begin();it!=_ms.end();it++)
{
MEDFileUMeshSplitL1 *sp=(*it);
if(sp)
}
}
-std::list< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > MEDFileUMesh::getAllNonNullFamilyIds() const
+std::list< MCAuto<DataArrayInt> > MEDFileUMesh::getAllNonNullFamilyIds() const
{
- std::list< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > ret;
+ std::list< MCAuto<DataArrayInt> > ret;
const DataArrayInt *da(_fam_coords);
if(da)
- { da->incrRef(); ret.push_back(MEDCouplingAutoRefCountObjectPtr<DataArrayInt>(const_cast<DataArrayInt *>(da))); }
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
+ { da->incrRef(); ret.push_back(MCAuto<DataArrayInt>(const_cast<DataArrayInt *>(da))); }
+ for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::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<DataArrayInt>(const_cast<DataArrayInt *>(da))); }
+ { da->incrRef(); ret.push_back(MCAuto<DataArrayInt>(const_cast<DataArrayInt *>(da))); }
}
}
return ret;
{
if((const DataArrayInt *)_fam_nodes)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da;
+ MCAuto<DataArrayInt> 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
{
if((const DataArrayInt *)_fam_cells)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da;
+ MCAuto<DataArrayInt> 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
{
if((const DataArrayInt *)_fam_faces)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da;
+ MCAuto<DataArrayInt> 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
arr->changeValue(oldId,newId);
}
-std::list< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > MEDFileStructuredMesh::getAllNonNullFamilyIds() const
+std::list< MCAuto<DataArrayInt> > MEDFileStructuredMesh::getAllNonNullFamilyIds() const
{
- std::list< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > ret;
+ std::list< MCAuto<DataArrayInt> > ret;
const DataArrayInt *da(_fam_nodes);
if(da)
- { da->incrRef(); ret.push_back(MEDCouplingAutoRefCountObjectPtr<DataArrayInt>(const_cast<DataArrayInt *>(da))); }
+ { da->incrRef(); ret.push_back(MCAuto<DataArrayInt>(const_cast<DataArrayInt *>(da))); }
da=_fam_cells;
if(da)
- { da->incrRef(); ret.push_back(MEDCouplingAutoRefCountObjectPtr<DataArrayInt>(const_cast<DataArrayInt *>(da))); }
+ { da->incrRef(); ret.push_back(MCAuto<DataArrayInt>(const_cast<DataArrayInt *>(da))); }
da=_fam_faces;
if(da)
- { da->incrRef(); ret.push_back(MEDCouplingAutoRefCountObjectPtr<DataArrayInt>(const_cast<DataArrayInt *>(da))); }
+ { da->incrRef(); ret.push_back(MCAuto<DataArrayInt>(const_cast<DataArrayInt *>(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();
}
/*!
}
void MEDFileStructuredMesh::LoadStrMeshDAFromFile(med_idt fid, int meshDim, int dt, int it, const std::string& mName, MEDFileMeshReadSelector *mrs,
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& famCells, MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& numCells, MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar>& namesCells)
+ MCAuto<DataArrayInt>& famCells, MCAuto<DataArrayInt>& numCells, MCAuto<DataArrayAsciiChar>& namesCells)
{
med_bool chgt=MED_FALSE,trsf=MED_FALSE;
med_geometry_type geoTypeReq=MEDFileStructuredMesh::GetGeoTypeFromMeshDim(meshDim);
MEDFileMesh *MEDFileCMesh::shallowCpy() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileCMesh> ret(new MEDFileCMesh(*this));
+ MCAuto<MEDFileCMesh> ret(new MEDFileCMesh(*this));
return ret.retn();
}
return new MEDFileCMesh;
}
-MEDFileMesh *MEDFileCMesh::deepCpy() const
+MEDFileMesh *MEDFileCMesh::deepCopy() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileCMesh> ret(new MEDFileCMesh(*this));
+ MCAuto<MEDFileCMesh> ret(new MEDFileCMesh(*this));
ret->deepCpyEquivalences(*this);
if((const MEDCouplingCMesh*)_cmesh)
- ret->_cmesh=static_cast<MEDCouplingCMesh*>(_cmesh->deepCpy());
+ ret->_cmesh=static_cast<MEDCouplingCMesh*>(_cmesh->deepCopy());
ret->deepCpyAttributes();
return ret.retn();
}
}
MEDFileCMeshL2 loaderl2;
loaderl2.loadAll(fid,mid,mName,dt,it);
- setAxType(axType);
+ setAxisType(axType);
MEDCouplingCMesh *mesh=loaderl2.getMesh();
mesh->incrRef();
_cmesh=mesh;
MEDFileMesh *MEDFileCMesh::cartesianize() const
{
- if(getAxType()==AX_CART)
+ if(getAxisType()==AX_CART)
{
incrRef();
return const_cast<MEDFileCMesh *>(this);
const MEDCouplingCMesh *cmesh(getMesh());
if(!cmesh)
throw INTERP_KERNEL::Exception("MEDFileCMesh::cartesianize : impossible to turn into cartesian because the mesh is null !");
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCurveLinearMesh> clmesh(cmesh->buildCurveLinear());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coords(clmesh->getCoords()->cartesianize(getAxType()));
+ MCAuto<MEDCouplingCurveLinearMesh> clmesh(cmesh->buildCurveLinear());
+ MCAuto<DataArrayDouble> coords(clmesh->getCoords()->cartesianize(getAxisType()));
clmesh->setCoords(coords);
- MEDCouplingAutoRefCountObjectPtr<MEDFileCurveLinearMesh> ret(MEDFileCurveLinearMesh::New());
+ MCAuto<MEDFileCurveLinearMesh> ret(MEDFileCurveLinearMesh::New());
ret->MEDFileStructuredMesh::operator=(*this);
ret->setMesh(clmesh);
- ret->setAxType(AX_CART);
+ ret->setAxisType(AX_CART);
return ret.retn();
}
}
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;i<spaceDim;i++)
{
const DataArrayDouble *da=_cmesh->getCoordsAt(i);
MEDFileMesh *MEDFileCurveLinearMesh::shallowCpy() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileCurveLinearMesh> ret(new MEDFileCurveLinearMesh(*this));
+ MCAuto<MEDFileCurveLinearMesh> ret(new MEDFileCurveLinearMesh(*this));
return ret.retn();
}
return new MEDFileCurveLinearMesh;
}
-MEDFileMesh *MEDFileCurveLinearMesh::deepCpy() const
+MEDFileMesh *MEDFileCurveLinearMesh::deepCopy() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileCurveLinearMesh> ret(new MEDFileCurveLinearMesh(*this));
+ MCAuto<MEDFileCurveLinearMesh> ret(new MEDFileCurveLinearMesh(*this));
ret->deepCpyEquivalences(*this);
if((const MEDCouplingCurveLinearMesh*)_clmesh)
- ret->_clmesh=static_cast<MEDCouplingCurveLinearMesh*>(_clmesh->deepCpy());
+ ret->_clmesh=static_cast<MEDCouplingCurveLinearMesh*>(_clmesh->deepCopy());
ret->deepCpyAttributes();
return ret.retn();
}
MEDFileMesh *MEDFileCurveLinearMesh::cartesianize() const
{
- if(getAxType()==AX_CART)
+ if(getAxisType()==AX_CART)
{
incrRef();
return const_cast<MEDFileCurveLinearMesh *>(this);
const DataArrayDouble *coords(mesh->getCoords());
if(!coords)
throw INTERP_KERNEL::Exception("MEDFileCurveLinearMesh::cartesianize : coordinate pointer in mesh is null !");
- MEDCouplingAutoRefCountObjectPtr<MEDFileCurveLinearMesh> ret(new MEDFileCurveLinearMesh(*this));
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCurveLinearMesh> mesh2(mesh->clone(false));
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsCart(coords->cartesianize(getAxType()));
+ MCAuto<MEDFileCurveLinearMesh> ret(new MEDFileCurveLinearMesh(*this));
+ MCAuto<MEDCouplingCurveLinearMesh> mesh2(mesh->clone(false));
+ MCAuto<DataArrayDouble> coordsCart(coords->cartesianize(getAxisType()));
mesh2->setCoords(coordsCart);
ret->setMesh(mesh2);
- ret->setAxType(AX_CART);
+ ret->setAxisType(AX_CART);
return ret.retn();
}
}
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));
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 !";
return new MEDFileMeshMultiTS(fileName,mName);
}
-MEDFileMeshMultiTS *MEDFileMeshMultiTS::deepCpy() const
+MEDFileMeshMultiTS *MEDFileMeshMultiTS::deepCopy() const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileMeshMultiTS> ret=MEDFileMeshMultiTS::New();
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> > meshOneTs(_mesh_one_ts.size());
+ MCAuto<MEDFileMeshMultiTS> ret=MEDFileMeshMultiTS::New();
+ std::vector< MCAuto<MEDFileMesh> > meshOneTs(_mesh_one_ts.size());
std::size_t i=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> >::const_iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileMesh> >::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<MEDFileMesh>);
+ return _mesh_one_ts.capacity()*sizeof(MCAuto<MEDFileMesh>);
}
std::vector<const BigMemoryObject *> MEDFileMeshMultiTS::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> >::const_iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++)
+ for(std::vector< MCAuto<MEDFileMesh> >::const_iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++)
ret.push_back((const MEDFileMesh *)*it);
return ret;
}
bool MEDFileMeshMultiTS::changeNames(const std::vector< std::pair<std::string,std::string> >& modifTab)
{
bool ret=false;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> >::iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++)
+ for(std::vector< MCAuto<MEDFileMesh> >::iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++)
{
MEDFileMesh *cur(*it);
if(cur)
void MEDFileMeshMultiTS::cartesianizeMe()
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> >::iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++)
+ for(std::vector< MCAuto<MEDFileMesh> >::iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++)
{
MEDFileMesh *cur(*it);
if(cur)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> ccur(cur->cartesianize());// Attention ! Do not wrap these two lines because memory leak !
+ MCAuto<MEDFileMesh> ccur(cur->cartesianize());// Attention ! Do not wrap these two lines because memory leak !
*it=ccur;
}
}
throw INTERP_KERNEL::Exception("MEDFileMeshMultiTS::setOneTimeStep : input pointer should be different from 0 !");
_mesh_one_ts.resize(1);
mesh1TimeStep->incrRef();
- //MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> toto=mesh1TimeStep;
+ //MCAuto<MEDFileMesh> toto=mesh1TimeStep;
_mesh_one_ts[0]=mesh1TimeStep;
}
*/
void MEDFileMeshMultiTS::setJoints( MEDFileJoints* joints )
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> >::iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++)
+ for(std::vector< MCAuto<MEDFileMesh> >::iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++)
{
(*it)->setJoints( joints );
}
MEDFileJoints *joints(getJoints());
bool jointsWritten(false);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> >::const_iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++)
+ for(std::vector< MCAuto<MEDFileMesh> >::const_iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++)
{
if ( jointsWritten )
const_cast<MEDFileMesh&>(**it).setJoints( 0 );
void MEDFileMeshes::write(med_idt fid) const
{
- checkCoherency();
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileMeshMultiTS> >::const_iterator it=_meshes.begin();it!=_meshes.end();it++)
+ checkConsistencyLight();
+ for(std::vector< MCAuto<MEDFileMeshMultiTS> >::const_iterator it=_meshes.begin();it!=_meshes.end();it++)
{
(*it)->copyOptionsFrom(*this);
(*it)->write(fid);
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);
}
{
std::vector<std::string> ret(_meshes.size());
int i=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileMeshMultiTS> >::const_iterator it=_meshes.begin();it!=_meshes.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileMeshMultiTS> >::const_iterator it=_meshes.begin();it!=_meshes.end();it++,i++)
{
const MEDFileMeshMultiTS *f=(*it);
if(f)
bool MEDFileMeshes::changeNames(const std::vector< std::pair<std::string,std::string> >& modifTab)
{
bool ret=false;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileMeshMultiTS> >::iterator it=_meshes.begin();it!=_meshes.end();it++)
+ for(std::vector< MCAuto<MEDFileMeshMultiTS> >::iterator it=_meshes.begin();it!=_meshes.end();it++)
{
MEDFileMeshMultiTS *cur(*it);
if(cur)
void MEDFileMeshes::cartesianizeMe()
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileMeshMultiTS> >::iterator it=_meshes.begin();it!=_meshes.end();it++)
+ for(std::vector< MCAuto<MEDFileMeshMultiTS> >::iterator it=_meshes.begin();it!=_meshes.end();it++)
{
MEDFileMeshMultiTS *cur(*it);
if(cur)
{
}
-MEDFileMeshes *MEDFileMeshes::deepCpy() const
+MEDFileMeshes *MEDFileMeshes::deepCopy() const
{
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileMeshMultiTS> > meshes(_meshes.size());
+ std::vector< MCAuto<MEDFileMeshMultiTS> > meshes(_meshes.size());
std::size_t i=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileMeshMultiTS> >::const_iterator it=_meshes.begin();it!=_meshes.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileMeshMultiTS> >::const_iterator it=_meshes.begin();it!=_meshes.end();it++,i++)
if((const MEDFileMeshMultiTS *)*it)
- meshes[i]=(*it)->deepCpy();
- MEDCouplingAutoRefCountObjectPtr<MEDFileMeshes> ret=MEDFileMeshes::New();
+ meshes[i]=(*it)->deepCopy();
+ MCAuto<MEDFileMeshes> ret=MEDFileMeshes::New();
ret->_meshes=meshes;
return ret.retn();
}
std::size_t MEDFileMeshes::getHeapMemorySizeWithoutChildren() const
{
- return _meshes.capacity()*(sizeof(MEDCouplingAutoRefCountObjectPtr<MEDFileMeshMultiTS>));
+ return _meshes.capacity()*(sizeof(MCAuto<MEDFileMeshMultiTS>));
}
std::vector<const BigMemoryObject *> MEDFileMeshes::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileMeshMultiTS> >::const_iterator it=_meshes.begin();it!=_meshes.end();it++)
+ for(std::vector< MCAuto<MEDFileMeshMultiTS> >::const_iterator it=_meshes.begin();it!=_meshes.end();it++)
ret.push_back((const MEDFileMeshMultiTS *)*it);
return ret;
}
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<std::string> s;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileMeshMultiTS> >::const_iterator it=_meshes.begin();it!=_meshes.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileMeshMultiTS> >::const_iterator it=_meshes.begin();it!=_meshes.end();it++,i++)
{
const MEDFileMeshMultiTS *elt=(*it);
if(!elt)
MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDLOADER_EXPORT std::vector<const BigMemoryObject *> 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;
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<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
MEDLOADER_EXPORT virtual int getNumberOfNodes() const = 0;
MEDLOADER_EXPORT virtual int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const = 0;
void getFamilyRepr(std::ostream& oss) const;
virtual void appendFamilyEntries(const DataArrayInt *famIds, const std::vector< std::vector<int> >& fidsOfGrps, const std::vector<std::string>& grpNames);
virtual void changeFamilyIdArr(int oldId, int newId) = 0;
- virtual std::list< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > getAllNonNullFamilyIds() const = 0;
+ virtual std::list< MCAuto<DataArrayInt> > 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);
bool _univ_wr_status;
std::string _desc_name;
MEDCouplingAxisType _axis_type;
- MEDCouplingAutoRefCountObjectPtr<MEDFileJoints> _joints;
- MEDCouplingAutoRefCountObjectPtr<MEDFileEquivalences> _equiv;
+ MCAuto<MEDFileJoints> _joints;
+ MCAuto<MEDFileEquivalences> _equiv;
protected:
std::map<std::string, std::vector<std::string> > _groups;
std::map<std::string,int> _families;
MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDLOADER_EXPORT std::vector<const BigMemoryObject *> 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;
MEDLOADER_EXPORT MEDFileUMesh *quadraticToLinear(double eps=1e-12) const;
// serialization
MEDLOADER_EXPORT void serialize(std::vector<double>& tinyDouble, std::vector<int>& tinyInt, std::vector<std::string>& tinyStr,
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >& bigArraysI, MEDCouplingAutoRefCountObjectPtr<DataArrayDouble>& bigArrayD);
+ std::vector< MCAuto<DataArrayInt> >& bigArraysI, MCAuto<DataArrayDouble>& bigArrayD);
MEDLOADER_EXPORT void unserialize(std::vector<double>& tinyDouble, std::vector<int>& tinyInt, std::vector<std::string>& tinyStr,
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >& bigArraysI, MEDCouplingAutoRefCountObjectPtr<DataArrayDouble>& bigArrayD);
+ std::vector< MCAuto<DataArrayInt> >& bigArraysI, MCAuto<DataArrayDouble>& bigArrayD);
private:
MEDLOADER_EXPORT ~MEDFileUMesh();
void writeLL(med_idt fid) const;
void computeRevNum() const;
void synchronizeTinyInfoOnLeaves() const;
void changeFamilyIdArr(int oldId, int newId);
- std::list< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > getAllNonNullFamilyIds() const;
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1>& checkAndGiveEntryInSplitL1(int meshDimRelToMax, MEDCouplingPointSet *m);
+ std::list< MCAuto<DataArrayInt> > getAllNonNullFamilyIds() const;
+ MCAuto<MEDFileUMeshSplitL1>& checkAndGiveEntryInSplitL1(int meshDimRelToMax, MEDCouplingPointSet *m);
private:
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> > _ms;
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> _coords;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _fam_coords;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _num_coords;
- MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> _name_coords;
- mutable MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _rev_num_coords;
- MEDCouplingAutoRefCountObjectPtr<PartDefinition> _part_coords;
+ std::vector< MCAuto<MEDFileUMeshSplitL1> > _ms;
+ MCAuto<DataArrayDouble> _coords;
+ MCAuto<DataArrayInt> _fam_coords;
+ MCAuto<DataArrayInt> _num_coords;
+ MCAuto<DataArrayAsciiChar> _name_coords;
+ mutable MCAuto<DataArrayInt> _rev_num_coords;
+ MCAuto<PartDefinition> _part_coords;
};
class MEDFileStructuredMesh : public MEDFileMesh
protected:
~MEDFileStructuredMesh() { }
void changeFamilyIdArr(int oldId, int newId);
- std::list< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > getAllNonNullFamilyIds() const;
+ std::list< MCAuto<DataArrayInt> > 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;
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<DataArrayInt>& famCells, MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& numCells, MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar>& namesCells);
+ MCAuto<DataArrayInt>& famCells, MCAuto<DataArrayInt>& numCells, MCAuto<DataArrayAsciiChar>& namesCells);
private:
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _fam_nodes;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _num_nodes;
- MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> _names_nodes;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _fam_cells;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _num_cells;
- MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> _names_cells;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _fam_faces;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _num_faces;
- MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> _names_faces;
- mutable MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _rev_num_nodes;
- mutable MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _rev_num_cells;
- mutable MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> _faces_if_necessary;
+ MCAuto<DataArrayInt> _fam_nodes;
+ MCAuto<DataArrayInt> _num_nodes;
+ MCAuto<DataArrayAsciiChar> _names_nodes;
+ MCAuto<DataArrayInt> _fam_cells;
+ MCAuto<DataArrayInt> _num_cells;
+ MCAuto<DataArrayAsciiChar> _names_cells;
+ MCAuto<DataArrayInt> _fam_faces;
+ MCAuto<DataArrayInt> _num_faces;
+ MCAuto<DataArrayAsciiChar> _names_faces;
+ mutable MCAuto<DataArrayInt> _rev_num_nodes;
+ mutable MCAuto<DataArrayInt> _rev_num_cells;
+ mutable MCAuto<MEDCoupling1SGTUMesh> _faces_if_necessary;
};
class MEDFileCMesh : public MEDFileStructuredMesh
MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDLOADER_EXPORT std::vector<const BigMemoryObject *> 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;
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<MEDCouplingCMesh> _cmesh;
+ MCAuto<MEDCouplingCMesh> _cmesh;
};
class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDLOADER_EXPORT std::vector<const BigMemoryObject *> 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;
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<MEDCouplingCurveLinearMesh> _clmesh;
+ MCAuto<MEDCouplingCurveLinearMesh> _clmesh;
};
class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritable
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<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDLOADER_EXPORT std::string getName() const;
MEDFileMeshMultiTS(const std::string& fileName);
MEDFileMeshMultiTS(const std::string& fileName, const std::string& mName);
private:
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> > _mesh_one_ts;
+ std::vector< MCAuto<MEDFileMesh> > _mesh_one_ts;
};
class MEDFileMeshesIterator;
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<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDLOADER_EXPORT std::string simpleRepr() const;
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<MEDFileMeshMultiTS> > _meshes;
+ std::vector< MCAuto<MEDFileMeshMultiTS> > _meshes;
};
class MEDFileMeshesIterator
MEDLOADER_EXPORT ~MEDFileMeshesIterator();
MEDLOADER_EXPORT MEDFileMesh *nextt();
private:
- MEDCouplingAutoRefCountObjectPtr<MEDFileMeshes> _ms;
+ MCAuto<MEDFileMeshes> _ms;
int _iter_id;
int _nb_iter;
};
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<MEDFileUMeshPerType> ret(new MEDFileUMeshPerType);
+ MCAuto<MEDFileUMeshPerType> ret(new MEDFileUMeshPerType);
ret->loadPart(fid,mName,dt,it,mdim,geoElt,geoElt2,whichEntity,strt,stp,step,mrs);
return ret.retn();
}
{
_m=MEDCoupling1SGTUMesh::New(mName,type);
MEDCoupling1SGTUMesh *mc(dynamic_cast<MEDCoupling1SGTUMesh *>((MEDCoupling1GTUMesh *)_m));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(DataArrayInt::New());
+ MCAuto<DataArrayInt> 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()));
int nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(strt,end,step,"MEDFileUMeshPerType::loadPartStaticType"));
_m=MEDCoupling1SGTUMesh::New(mName,type);
MEDCoupling1SGTUMesh *mc(dynamic_cast<MEDCoupling1SGTUMesh *>((MEDCoupling1GTUMesh *)_m));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(DataArrayInt::New());
+ MCAuto<DataArrayInt> conn(DataArrayInt::New());
int nbOfNodesPerCell(mc->getNumberOfNodesPerCell());
conn->alloc(nbOfNodesPerCell*nbOfEltsToLoad,1);
med_filter filter=MED_FILTER_INIT;
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<MEDCoupling1DGTUMesh> mc(DynamicCast<MEDCoupling1GTUMesh,MEDCoupling1DGTUMesh>(_m));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(DataArrayInt::New()),connI(DataArrayInt::New());
+ MCAuto<MEDCoupling1DGTUMesh> mc(DynamicCast<MEDCoupling1GTUMesh,MEDCoupling1DGTUMesh>(_m));
+ MCAuto<DataArrayInt> 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<int>(),-1));
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<MEDCoupling1DGTUMesh> mc(DynamicCastSafe<MEDCoupling1GTUMesh,MEDCoupling1DGTUMesh>(_m));
+ MCAuto<MEDCoupling1DGTUMesh> mc(DynamicCastSafe<MEDCoupling1GTUMesh,MEDCoupling1DGTUMesh>(_m));
INTERP_KERNEL::AutoPtr<int> index=new int[curNbOfElem+1];
INTERP_KERNEL::AutoPtr<int> indexFace=new int[indexFaceLgth];
INTERP_KERNEL::AutoPtr<int> locConn=new int[connFaceLgth];
MEDFILESAFECALLERRD0(MEDmeshPolyhedronRd,(fid,mName,dt,it,MED_CELL,MED_NODAL,index,indexFace,locConn));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(DataArrayInt::New()),connI(DataArrayInt::New());
+ MCAuto<DataArrayInt> conn(DataArrayInt::New()),connI(DataArrayInt::New());
int arraySize=connFaceLgth;
for(int i=0;i<curNbOfElem;i++)
arraySize+=index[i+1]-index[i]-1;
const MEDCoupling1SGTUMesh *m0(dynamic_cast<const MEDCoupling1SGTUMesh *>(m));
if(!m0)
throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::Write : internal error #1 !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr(m0->getNodalConnectivity()->deepCpy());
+ MCAuto<DataArrayInt> arr(m0->getNodalConnectivity()->deepCopy());
std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus<int>(),1));
MEDFILESAFECALLERWR0(MEDmeshElementConnectivityWr,(fid,mname.c_str(),dt,it,timm,MED_CELL,curMedType,MED_NODAL,MED_FULL_INTERLACE,nbOfCells,arr->begin()));
}
throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::Write : internal error #2 !");
if(ikt==INTERP_KERNEL::NORM_POLYGON || ikt==INTERP_KERNEL::NORM_QPOLYG)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr(m0->getNodalConnectivity()->deepCpy()),arrI(m0->getNodalConnectivityIndex()->deepCpy());
+ MCAuto<DataArrayInt> arr(m0->getNodalConnectivity()->deepCopy()),arrI(m0->getNodalConnectivityIndex()->deepCopy());
std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus<int>(),1));
std::transform(arrI->begin(),arrI->end(),arrI->getPointer(),std::bind2nd(std::plus<int>(),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()));
#include "MEDCouplingMemArray.hxx"
#include "MEDCoupling1GTUMesh.hxx"
#include "MEDCouplingPartDefinition.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "NormalizedUnstructuredMesh.hxx"
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<MEDCoupling1GTUMesh> _m;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _num;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _fam;
- MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> _names;
- MEDCouplingAutoRefCountObjectPtr<PartDefinition> _pd;
+ MCAuto<MEDCoupling1GTUMesh> _m;
+ MCAuto<DataArrayInt> _num;
+ MCAuto<DataArrayInt> _fam;
+ MCAuto<DataArrayAsciiChar> _names;
+ MCAuto<PartDefinition> _pd;
med_entity_type _entity;
};
}
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<bool> fetchedNodeIds(nCoords,false);
- for(std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshPerType> > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++)
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshPerType> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
+ for(std::vector< std::vector< MCAuto<MEDFileUMeshPerType> > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++)
+ for(std::vector< MCAuto<MEDFileUMeshPerType> >::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<MEDFileUMeshPerType> > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++)
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshPerType> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
+ for(std::vector< std::vector< MCAuto<MEDFileUMeshPerType> > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++)
+ for(std::vector< MCAuto<MEDFileUMeshPerType> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
(*it1)->getMesh()->renumberNodesWithOffsetInConn(-nMin);
loadPartCoords(fid,mId,infosOnComp,mName,dt,it,nMin,nMax);
}
for(std::size_t ii=0;ii<nbOfTypes;ii++)
{
int strt(slicPerTyp[3*ii+0]),stp(slicPerTyp[3*ii+1]),step(slicPerTyp[3*ii+2]);
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshPerType> tmp(MEDFileUMeshPerType::NewPart(fid,mName.c_str(),dt,it,mdim,types[ii],strt,stp,step,mrs));
+ MCAuto<MEDFileUMeshPerType> tmp(MEDFileUMeshPerType::NewPart(fid,mName.c_str(),dt,it,mdim,types[ii],strt,stp,step,mrs));
_per_type_mesh[0].push_back(tmp);
}
sortTypes();
void MEDFileUMeshL2::sortTypes()
{
std::set<int> mdims;
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshPerType> > tmp(_per_type_mesh[0]);
+ std::vector< MCAuto<MEDFileUMeshPerType> > tmp(_per_type_mesh[0]);
_per_type_mesh.clear();
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshPerType> >::const_iterator it=tmp.begin();it!=tmp.end();it++)
+ for(std::vector< MCAuto<MEDFileUMeshPerType> >::const_iterator it=tmp.begin();it!=tmp.end();it++)
mdims.insert((*it)->getDim());
if(mdims.empty())
return;
_per_type_mesh.resize(mdim+1);
for(int dim=mdim+1;dim!=0;dim--)
{
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshPerType> >& elt=_per_type_mesh[mdim+1-dim];
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshPerType> >::const_iterator it=tmp.begin();it!=tmp.end();it++)
+ std::vector< MCAuto<MEDFileUMeshPerType> >& elt=_per_type_mesh[mdim+1-dim];
+ for(std::vector< MCAuto<MEDFileUMeshPerType> >::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<MEDFileUMeshPerType> > >::reverse_iterator it2=_per_type_mesh.rbegin();it2!=_per_type_mesh.rend();it2++)
+ for(std::vector< std::vector< MCAuto<MEDFileUMeshPerType> > >::reverse_iterator it2=_per_type_mesh.rbegin();it2!=_per_type_mesh.rend();it2++)
{
if((*it2).empty() && isFirst)
{
bool MEDFileUMeshL2::isFamDefinedOnLev(int levId) const
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshPerType> >::const_iterator it=_per_type_mesh[levId].begin();it!=_per_type_mesh[levId].end();it++)
+ for(std::vector< MCAuto<MEDFileUMeshPerType> >::const_iterator it=_per_type_mesh[levId].begin();it!=_per_type_mesh[levId].end();it++)
if((*it)->getFam()==0)
return false;
return true;
bool MEDFileUMeshL2::isNumDefinedOnLev(int levId) const
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshPerType> >::const_iterator it=_per_type_mesh[levId].begin();it!=_per_type_mesh[levId].end();it++)
+ for(std::vector< MCAuto<MEDFileUMeshPerType> >::const_iterator it=_per_type_mesh[levId].begin();it!=_per_type_mesh[levId].end();it++)
if((*it)->getNum()==0)
return false;
return true;
bool MEDFileUMeshL2::isNamesDefinedOnLev(int levId) const
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshPerType> >::const_iterator it=_per_type_mesh[levId].begin();it!=_per_type_mesh[levId].end();it++)
+ for(std::vector< MCAuto<MEDFileUMeshPerType> >::const_iterator it=_per_type_mesh[levId].begin();it!=_per_type_mesh[levId].end();it++)
if((*it)->getNames()==0)
return false;
return true;
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<DataArrayDouble> da=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> da=DataArrayDouble::New();
da->alloc(nbOfElt,1);
da->setInfoOnComponent(0,infosOnComp[i]);
MEDFILESAFECALLERRD0(MEDmeshGridIndexCoordinateRd,(fid,mName.c_str(),dt,it,i+1,da->getPointer()));
_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<DataArrayDouble> da=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> da=DataArrayDouble::New();
da->alloc(nbNodes,infosOnComp.size());
da->setInfoOnComponents(infosOnComp);
MEDFILESAFECALLERRD0(MEDmeshNodeCoordinateRd,(fid,mName.c_str(),dt,it,MED_FULL_INTERLACE,da->getPointer()));
if((MEDCouplingUMesh *)_m==0)
{
updateTime();
- _m=static_cast<MEDCouplingUMesh *>(_st->_m_by_types.getUmesh()->deepCpy());
+ _m=static_cast<MEDCouplingUMesh *>(_st->_m_by_types.getUmesh()->deepCopy());
_m->renumberCells(_st->_num->getConstPointer(),true);
return _m.retn();
}
else
{
updateTime();
- _m=static_cast<MEDCouplingUMesh *>(_st->_m_by_types.getUmesh()->deepCpy());
+ _m=static_cast<MEDCouplingUMesh *>(_st->_m_by_types.getUmesh()->deepCopy());
_m->renumberCells(_st->_num->getConstPointer(),true);
return _m.retn();
}
MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const std::string& mName, int id):_m(this)
{
- const std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshPerType> >& v=l2.getLev(id);
+ const std::vector< MCAuto<MEDFileUMeshPerType> >& v=l2.getLev(id);
if(v.empty())
return;
int sz=v.size();
for(int i=0;i<sz;i++)
{
MEDCoupling1GTUMesh *elt(v[i]->getMesh());
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp2=l2.getCoords();
+ MCAuto<DataArrayDouble> tmp2=l2.getCoords();
elt->setCoords(tmp2);
ms[i]=elt;
pds[i]=v[i]->getPartDef();
MEDFileUMeshSplitL1 *MEDFileUMeshSplitL1::shallowCpyUsingCoords(DataArrayDouble *coords) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> ret(new MEDFileUMeshSplitL1(*this));
+ MCAuto<MEDFileUMeshSplitL1> 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<MEDFileUMeshSplitL1> ret(new MEDFileUMeshSplitL1(*this));
- ret->_m_by_types=_m_by_types.deepCpy(coords);
+ MCAuto<MEDFileUMeshSplitL1> 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();
}
{
m->incrRef();
_m=m;
- _m_by_types.assignUMesh(dynamic_cast<MEDCouplingUMesh *>(m->deepCpy()));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=_m_by_types.getUmesh()->getRenumArrForConsecutiveCellTypesSpec(typmai2,typmai2+MED_N_CELL_FIXED_GEO);
- if(!da->isIdentity2(m->getNumberOfCells()))
+ _m_by_types.assignUMesh(dynamic_cast<MEDCouplingUMesh *>(m->deepCopy()));
+ MCAuto<DataArrayInt> 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();
MEDCouplingUMesh *MEDFileUMeshSplitL1::getFamilyPart(const int *idsBg, const int *idsEnd, bool renum) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> eltsToKeep=_fam->getIdsEqualList(idsBg,idsEnd);
+ MCAuto<DataArrayInt> 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());
DataArrayInt *MEDFileUMeshSplitL1::getFamilyPartArr(const int *idsBg, const int *idsEnd, bool renum) const
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=_fam->getIdsEqualList(idsBg,idsEnd);
+ MCAuto<DataArrayInt> da=_fam->findIdsEqualList(idsBg,idsEnd);
if(renum)
return renumIfNeededArr(da);
return da.retn();
MEDCouplingUMesh *MEDFileUMeshSplitL1::getWholeMesh(bool renum) const
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> tmp;
+ MCAuto<MEDCouplingUMesh> tmp;
if(renum && ((const DataArrayInt *)_num))
tmp=_m;
else
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
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()
{
std::vector< DataArrayInt * > corr;
_m=MEDCouplingUMesh::FuseUMeshesOnSameCoords(ms,0,corr);
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > corrMSafe(corr.begin(),corr.end());
+ std::vector< MCAuto<DataArrayInt> > corrMSafe(corr.begin(),corr.end());
std::vector< std::vector<int> > fidsOfGroups;
std::vector< const DataArrayInt * > corr2(corr.begin(),corr.end());
_fam=DataArrayInt::MakePartition(corr2,((MEDCouplingUMesh *)_m)->getNumberOfCells(),fidsOfGroups);
{
int nbCells=(*it)->getNumberOfCells();
int end=start+nbCells;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> fam,num;
- MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> names;
+ MCAuto<DataArrayInt> fam,num;
+ MCAuto<DataArrayAsciiChar> names;
if((const DataArrayInt *)_fam)
fam=_fam->substr(start,end);
if((const DataArrayInt *)_num)
_m_by_types.renumberNodesInConnWithoutComputation(newNodeNumbersO2N);
}
-void MEDFileUMeshSplitL1::serialize(std::vector<int>& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >& bigArraysI) const
+void MEDFileUMeshSplitL1::serialize(std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& 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<int>& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >& bigArraysI)
+void MEDFileUMeshSplitL1::unserialize(const std::string& name, DataArrayDouble *coo, std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI)
{
_fam=bigArraysI.back(); bigArraysI.pop_back();
_num=bigArraysI.back(); bigArraysI.pop_back();
m->renumberCells(renum->getConstPointer(),true);
else
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> locnum=renum->selectByTupleId(cellIds,cellIds+m->getNumberOfCells());
+ MCAuto<DataArrayInt> 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<int>& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >& bigArraysI)
+MEDFileUMeshSplitL1 *MEDFileUMeshSplitL1::Unserialize(const std::string& name, DataArrayDouble *coo, std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> ret(new MEDFileUMeshSplitL1);
+ MCAuto<MEDFileUMeshSplitL1> ret(new MEDFileUMeshSplitL1);
ret->unserialize(name,coo,tinyInt,bigArraysI);
return ret.retn();
}
}
if(_mp_time>=_m_time)
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> >::iterator it=_m_parts.begin();it!=_m_parts.end();it++)
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::iterator it=_m_parts.begin();it!=_m_parts.end();it++)
{
MEDCoupling1GTUMesh *tmp(*it);
if(tmp)
void MEDFileUMeshAggregateCompute::assignParts(const std::vector< const MEDCoupling1GTUMesh * >& mParts)
{
std::size_t sz(mParts.size());
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> > ret(sz);
+ std::vector< MCAuto<MEDCoupling1GTUMesh> > ret(sz);
for(std::size_t i=0;i<sz;i++)
{
const MEDCoupling1GTUMesh *elt(mParts[i]);
if(_mp_time<=_m_time)
return _m->getNumberOfCells();
int ret(0);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
ret+=(*it)->getNumberOfCells();
return ret;
}
{
if(_mp_time>=_m_time)
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
{
const MEDCoupling1GTUMesh *elt(*it);
if(elt && elt->getCellModelEnum()==ct)
//
std::vector<MEDCoupling1GTUMesh *> ret(_m_parts.size());
std::size_t i(0);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++,i++)
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++,i++)
{
const MEDCoupling1GTUMesh *elt(*it);
ret[i]=const_cast<MEDCoupling1GTUMesh *>(elt);
{
if(_mp_time>_m_time)
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> >::iterator it=_m_parts.begin();it!=_m_parts.end();it++)
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::iterator it=_m_parts.begin();it!=_m_parts.end();it++)
{
MEDCoupling1GTUMesh *m(*it);
if(m)
return ;// no needs to compte parts they are already here !
}
std::vector<MEDCouplingUMesh *> ms(m->splitByType());
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> > msMSafe(ms.begin(),ms.end());
+ std::vector< MCAuto<MEDCouplingUMesh> > msMSafe(ms.begin(),ms.end());
std::size_t sz(msMSafe.size());
_m_parts.resize(sz);
for(std::size_t i=0;i<sz;i++)
throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getPartDefOfWithoutComputation : The input geo type is not existing in this !");
}
-void MEDFileUMeshAggregateCompute::serialize(std::vector<int>& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >& bigArraysI) const
+void MEDFileUMeshAggregateCompute::serialize(std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI) const
{
if(_mp_time<_m_time)
throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::serialize : the parts require a computation !");
DataArrayInt *elt(mesh1->getNodalConnectivity());
if(elt)
elt->incrRef();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elt1(elt);
+ MCAuto<DataArrayInt> elt1(elt);
bigArraysI.push_back(elt1);
}
else if(mesh2)
elt1->incrRef();
if(elt2)
elt2->incrRef();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elt11(elt1),elt22(elt2);
+ MCAuto<DataArrayInt> elt11(elt1),elt22(elt2);
bigArraysI.push_back(elt11); bigArraysI.push_back(elt22);
}
else
}
}
-void MEDFileUMeshAggregateCompute::unserialize(const std::string& name, DataArrayDouble *coo, std::vector<int>& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >& bigArraysI)
+void MEDFileUMeshAggregateCompute::unserialize(const std::string& name, DataArrayDouble *coo, std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI)
{
int nbParts(tinyInt.back()); tinyInt.pop_back();
_part_def.clear(); _part_def.resize(nbParts);
for(int i=0;i<nbParts;i++)
{
INTERP_KERNEL::NormalizedCellType tp((INTERP_KERNEL::NormalizedCellType) tinyInt.back()); tinyInt.pop_back();
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> mesh(MEDCoupling1GTUMesh::New(name,tp));
+ MCAuto<MEDCoupling1GTUMesh> mesh(MEDCoupling1GTUMesh::New(name,tp));
mesh->setCoords(coo);
MEDCoupling1SGTUMesh *mesh1(dynamic_cast<MEDCoupling1SGTUMesh *>((MEDCoupling1GTUMesh *) mesh));
MEDCoupling1DGTUMesh *mesh2(dynamic_cast<MEDCoupling1DGTUMesh *>((MEDCoupling1GTUMesh *) mesh));
}
else if(mesh2)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elt0,elt1;
+ MCAuto<DataArrayInt> elt0,elt1;
elt0=bigArraysI.back(); bigArraysI.pop_back();
elt1=bigArraysI.back(); bigArraysI.pop_back();
mesh2->setNodalConnectivity(elt0,elt1);
std::size_t MEDFileUMeshAggregateCompute::getTimeOfParts() const
{
std::size_t ret(0);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
{
const MEDCoupling1GTUMesh *elt(*it);
if(!elt)
std::size_t MEDFileUMeshAggregateCompute::getHeapMemorySizeWithoutChildren() const
{
- std::size_t ret(_m_parts.size()*sizeof(MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh>));
+ std::size_t ret(_m_parts.size()*sizeof(MCAuto<MEDCoupling1GTUMesh>));
return ret;
}
std::vector<const BigMemoryObject *> MEDFileUMeshAggregateCompute::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::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());
const MEDCoupling1GTUMesh *elt(_m_parts[i]);
if(elt)
{
- ret._m_parts[i]=static_cast<MEDCoupling::MEDCoupling1GTUMesh*>(elt->deepCpy());
+ ret._m_parts[i]=static_cast<MEDCoupling::MEDCoupling1GTUMesh*>(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<MEDCoupling::MEDCouplingUMesh*>(_m->deepCpy());
+ ret._m=static_cast<MEDCoupling::MEDCouplingUMesh*>(_m->deepCopy());
ret._m->setCoords(coords);
}
std::size_t sz(_part_def.size());
{
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<MEDCoupling1GTUMesh> >::iterator it=_m_parts.begin();it!=_m_parts.end();it++)
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::iterator it=_m_parts.begin();it!=_m_parts.end();it++)
{
const MEDCoupling1GTUMesh *elt(*it);
if(elt)
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> elt2(elt->clone(false));
+ MCAuto<MEDCouplingMesh> elt2(elt->clone(false));
*it=DynamicCastSafe<MEDCouplingMesh,MEDCoupling1GTUMesh>(elt2);
}
}
void MEDFileUMeshAggregateCompute::clearNonDiscrAttributes() const
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::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<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
{
const MEDCoupling1GTUMesh *tmp(*it);
if(tmp)
else
{
std::vector<int> ret;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
{
const MEDCoupling1GTUMesh *tmp(*it);
if(!tmp)
else
{
int ret=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
{
const MEDCoupling1GTUMesh *m(*it);
if(!m)
void MEDFileUMeshAggregateCompute::setCoords(DataArrayDouble *coords)
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> >::iterator it=_m_parts.begin();it!=_m_parts.end();it++)
+ for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::iterator it=_m_parts.begin();it!=_m_parts.end();it++)
{
MEDCoupling1GTUMesh *tmp(*it);
if(tmp)
#include "MEDCoupling1GTUMesh.hxx"
#include "MEDCouplingPartDefinition.hxx"
#include "MEDCouplingCurveLinearMesh.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "med.h"
int getIteration() const { return _iteration; }
int getOrder() const { return _order; }
double getTime() const { return _time; }
- MEDCouplingAutoRefCountObjectPtr<PartDefinition> getPartDefOfCoo() const { return _part_coords; }
+ MCAuto<PartDefinition> getPartDefOfCoo() const { return _part_coords; }
std::vector<std::string> 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);
int _iteration;
int _order;
double _time;
- MEDCouplingAutoRefCountObjectPtr<PartDefinition> _part_coords;
+ MCAuto<PartDefinition> _part_coords;
};
class MEDFileUMeshL2 : public MEDFileMeshL2
void loadPartCoords(med_idt fid, int mId, const std::vector<std::string>& 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<MEDFileUMeshPerType> >& getLev(int levId) const { return _per_type_mesh[levId]; }
+ const std::vector< MCAuto<MEDFileUMeshPerType> >& 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<DataArrayDouble> getCoords() const { return _coords; }
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> getCoordsFamily() const { return _fam_coords; }
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> getCoordsNum() const { return _num_coords; }
- MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> getCoordsName() const { return _name_coords; }
+ MCAuto<DataArrayDouble> getCoords() const { return _coords; }
+ MCAuto<DataArrayInt> getCoordsFamily() const { return _fam_coords; }
+ MCAuto<DataArrayInt> getCoordsNum() const { return _num_coords; }
+ MCAuto<DataArrayAsciiChar> 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<MEDFileUMeshPerType> > > _per_type_mesh;
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> _coords;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _fam_coords;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _num_coords;
- MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> _name_coords;
+ std::vector< std::vector< MCAuto<MEDFileUMeshPerType> > > _per_type_mesh;
+ MCAuto<DataArrayDouble> _coords;
+ MCAuto<DataArrayInt> _fam_coords;
+ MCAuto<DataArrayInt> _num_coords;
+ MCAuto<DataArrayAsciiChar> _name_coords;
};
class MEDFileStrMeshL2 : public MEDFileMeshL2
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<MEDCouplingCMesh> _cmesh;
+ MCAuto<MEDCouplingCMesh> _cmesh;
MEDCoupling::MEDCouplingAxisType _ax_type;
};
void loadAll(med_idt fid, int mId, const std::string& mName, int dt, int it);
MEDCouplingCurveLinearMesh *getMesh() { return _clmesh; }
private:
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCurveLinearMesh> _clmesh;
+ MCAuto<MEDCouplingCurveLinearMesh> _clmesh;
};
class MEDFileMesh;
const MEDFileUMeshSplitL1 *_st;
mutable std::size_t _mpt_time;
mutable std::size_t _num_time;
- mutable MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> _m;
+ mutable MCAuto<MEDCouplingUMesh> _m;
};
class MEDFileUMeshAggregateCompute : public BigMemoryObject
std::size_t getTimeOfThis() const;
std::size_t getHeapMemorySizeWithoutChildren() const;
std::vector<const BigMemoryObject *> 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;
void setCoords(DataArrayDouble *coords);
void forceComputationOfPartsFromUMesh() const;
const PartDefinition *getPartDefOfWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const;
- void serialize(std::vector<int>& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >& bigArraysI) const;
- void unserialize(const std::string& name, DataArrayDouble *coo, std::vector<int>& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >& bigArraysI);
+ void serialize(std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI) const;
+ void unserialize(const std::string& name, DataArrayDouble *coo, std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI);
private:
std::size_t getTimeOfParts() const;
std::size_t getTimeOfUMesh() const;
private:
- mutable std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> > _m_parts;
+ mutable std::vector< MCAuto<MEDCoupling1GTUMesh> > _m_parts;
mutable std::size_t _mp_time;
mutable std::size_t _m_time;
- mutable MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> _m;
- mutable std::vector< MEDCouplingAutoRefCountObjectPtr<PartDefinition> > _part_def;
+ mutable MCAuto<MEDCouplingUMesh> _m;
+ mutable std::vector< MCAuto<PartDefinition> > _part_def;
};
class MEDFileUMeshSplitL1 : public RefCountObject
std::size_t getHeapMemorySizeWithoutChildren() const;
std::vector<const BigMemoryObject *> 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;
//
void renumberNodesInConn(const int *newNodeNumbersO2N);
//
- void serialize(std::vector<int>& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >& bigArraysI) const;
- void unserialize(const std::string& name, DataArrayDouble *coo, std::vector<int>& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >& bigArraysI);
+ void serialize(std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI) const;
+ void unserialize(const std::string& name, DataArrayDouble *coo, std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI);
//
static void ClearNonDiscrAttributes(const MEDCouplingMesh *tmp);
static std::vector<int> GetNewFamiliesNumber(int nb, const std::map<std::string,int>& families);
std::map<int,int>& famIdTrad, std::map<int,std::string>& 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<int>& tinyInt, std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >& bigArraysI);
+ static MEDFileUMeshSplitL1 *Unserialize(const std::string& name, DataArrayDouble *coo, std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI);
private:
MEDFileUMeshSplitL1();
void assignCommonPart();
void computeRevNum() const;
private:
MEDFileUMeshAggregateCompute _m_by_types;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _fam;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _num;
- MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> _names;
- mutable MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _rev_num;
+ MCAuto<DataArrayInt> _fam;
+ MCAuto<DataArrayInt> _num;
+ MCAuto<DataArrayAsciiChar> _names;
+ mutable MCAuto<DataArrayInt> _rev_num;
MEDFileUMeshPermCompute _m;
};
}
return true;
}
-MEDFileParameter1TS *MEDFileParameterDouble1TSWTI::deepCpy() const
+MEDFileParameter1TS *MEDFileParameterDouble1TSWTI::deepCopy() const
{
return new MEDFileParameterDouble1TSWTI(*this);
}
return true;
}
-MEDFileParameter1TS *MEDFileParameterDouble1TS::deepCpy() const
+MEDFileParameter1TS *MEDFileParameterDouble1TS::deepCopy() const
{
return new MEDFileParameterDouble1TS(*this);
}
{
const MEDFileParameter1TS *elt=_param_per_ts[i];
if(elt)
- _param_per_ts[i]=elt->deepCpy();
+ _param_per_ts[i]=elt->deepCopy();
}
}
std::size_t MEDFileParameterMultiTS::getHeapMemorySizeWithoutChildren() const
{
std::size_t ret(sizeof(MEDFileParameterMultiTS));
- ret+=sizeof(MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS>)*_param_per_ts.capacity();
+ ret+=sizeof(MCAuto<MEDFileParameter1TS>)*_param_per_ts.capacity();
return ret;
}
std::vector<const BigMemoryObject *> MEDFileParameterMultiTS::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
+ for(std::vector< MCAuto<MEDFileParameter1TS> >::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);
}
void MEDFileParameterMultiTS::writeLL(med_idt fid, const MEDFileWritable& mw) const
{
std::set<med_parameter_type> diffType;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
+ for(std::vector< MCAuto<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
{
const MEDFileParameter1TS *elt(*it);
if(dynamic_cast<const MEDFileParameterDouble1TSWTI *>(elt))
return;
med_parameter_type typ=*diffType.begin();
MEDFileParameterTinyInfo::writeLLHeader(fid,typ);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
+ for(std::vector< MCAuto<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
{
const MEDFileParameter1TS *elt(*it);
if(elt)
void MEDFileParameterMultiTS::simpleRepr2(int bkOffset, std::ostream& oss) const
{
MEDFileParameterTinyInfo::mainRepr(bkOffset,oss);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
+ for(std::vector< MCAuto<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
{
const MEDFileParameter1TS *elt(*it);
if(elt)
void MEDFileParameterMultiTS::appendValue(int dt, int it, double time, double val)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileParameterDouble1TSWTI> elt=MEDFileParameterDouble1TSWTI::New(dt,it,time);
+ MCAuto<MEDFileParameterDouble1TSWTI> elt=MEDFileParameterDouble1TSWTI::New(dt,it,time);
elt->setValue(val);
- MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> elt2((MEDFileParameterDouble1TSWTI*)elt); elt2->incrRef();
+ MCAuto<MEDFileParameter1TS> elt2((MEDFileParameterDouble1TSWTI*)elt); elt2->incrRef();
_param_per_ts.push_back(elt2);
}
{
int ret=0;
std::ostringstream oss; oss << "MEDFileParameterMultiTS::getPosOfTimeStep : no such iteration=" << iteration << " order=" << order << " ! Possibilities are :";
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++,ret++)
+ for(std::vector< MCAuto<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++,ret++)
{
const MEDFileParameter1TS *elt(*it);
if(elt)
{
int ret=0;
std::ostringstream oss; oss << "MEDFileParameterMultiTS::getPosGivenTime : no such time=" << time << " ! Possibilities are :";
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++,ret++)
+ for(std::vector< MCAuto<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++,ret++)
{
const MEDFileParameter1TS *elt(*it);
if(elt)
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<MEDFileParameter1TS> > paramPerTs(newNb);
+ std::vector< MCAuto<MEDFileParameter1TS> > paramPerTs(newNb);
std::size_t j=0;
for(std::size_t i=0;i<_param_per_ts.size();i++)
if(b[i])
std::vector< std::pair<int,int> > MEDFileParameterMultiTS::getIterations() const
{
std::vector< std::pair<int,int> > ret;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
+ for(std::vector< MCAuto<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
{
const MEDFileParameter1TS *elt(*it);
if(elt)
{
std::vector< std::pair<int,int> > ret0;
ret1.clear();
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
+ for(std::vector< MCAuto<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
{
const MEDFileParameter1TS *elt(*it);
if(elt)
std::size_t MEDFileParameters::getHeapMemorySizeWithoutChildren() const
{
std::size_t ret(sizeof(MEDFileParameters));
- ret+=sizeof(MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS>)*_params.capacity();
+ ret+=sizeof(MCAuto<MEDFileParameterMultiTS>)*_params.capacity();
return ret;
}
std::vector<const BigMemoryObject *> MEDFileParameters::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++)
+ for(std::vector< MCAuto<MEDFileParameterMultiTS> >::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);
}
{
const MEDFileParameterMultiTS *elt=_params[i];
if(elt)
- _params[i]=elt->deepCpy();
+ _params[i]=elt->deepCopy();
}
}
void MEDFileParameters::writeLL(med_idt fid) const
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++)
+ for(std::vector< MCAuto<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++)
{
const MEDFileParameterMultiTS *elt(*it);
if(elt)
{
std::vector<std::string> ret(_params.size());
int i=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++,i++)
{
const MEDFileParameterMultiTS *p=(*it);
if(p)
void MEDFileParameters::simpleReprWithoutHeader(std::ostream& oss) const
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++)
+ for(std::vector< MCAuto<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++)
{
const MEDFileParameterMultiTS *elt(*it);
if(elt)
{
if(param)
param->incrRef();
- MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS> elt(param);
+ MCAuto<MEDFileParameterMultiTS> elt(param);
_params.push_back(elt);
}
_params.resize(i+1);
if(param)
param->incrRef();
- MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS> elt(param);
+ MCAuto<MEDFileParameterMultiTS> elt(param);
_params[i]=elt;
}
std::ostringstream oss; oss << "MEDFileParameters::destroyParamAtPos : should be in [0," << _params.size() << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- _params[i]=MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS>(0);
+ _params[i]=MCAuto<MEDFileParameterMultiTS>(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<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++,ret++)
+ for(std::vector< MCAuto<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++,ret++)
{
const MEDFileParameterMultiTS *elt(*it);
if(elt)
#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;
{
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;
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;
MEDLOADER_EXPORT void setName(const std::string& name) { _name=name; }
MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDLOADER_EXPORT std::vector<const BigMemoryObject *> 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;
MEDFileParameterMultiTS(const std::string& fileName, const std::string& paramName);
void finishLoading(med_idt fid, med_parameter_type typ, int nbOfSteps);
protected:
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> > _param_per_ts;
+ std::vector< MCAuto<MEDFileParameter1TS> > _param_per_ts;
};
class MEDFileParameters : public RefCountObject, public MEDFileWritable
MEDLOADER_EXPORT static MEDFileParameters *New(const std::string& fileName);
MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDLOADER_EXPORT std::vector<const BigMemoryObject *> 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;
MEDFileParameters(const MEDFileParameters& other, bool deepCopy);
MEDFileParameters();
protected:
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS> > _params;
+ std::vector< MCAuto<MEDFileParameterMultiTS> > _params;
};
}
#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingGaussLocalization.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "InterpKernelAutoPtr.hxx"
std::vector<MEDCoupling::TypeOfField> MEDCoupling::GetTypesOfField(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
{
std::vector<MEDCoupling::TypeOfField> ret;
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTS> fs(MEDFileAnyTypeFieldMultiTS::New(fileName,fieldName,false));
+ MCAuto<MEDFileAnyTypeFieldMultiTS> 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 << "\"";
return ret;
for(int i=0;i<nbTS;i++)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> f1ts(fs->getTimeStepAtPos(i));
+ MCAuto<MEDFileAnyTypeField1TS> f1ts(fs->getTimeStepAtPos(i));
std::vector<MEDCoupling::TypeOfField> tof(f1ts->getTypesOfFieldAvailable());
for(std::vector<MEDCoupling::TypeOfField>::const_iterator it=tof.begin();it!=tof.end();it++)
if(std::find(ret.begin(),ret.end(),*it)==ret.end())
MEDCoupling::MEDCouplingMesh *MEDCoupling::ReadMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax)
{
MEDCoupling::CheckFileForRead(fileName);
- MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
+ MCAuto<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
MEDFileMesh *mmPtr(mm);
MEDFileUMesh *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
if(mmuPtr)
MEDCoupling::MEDCouplingMesh *MEDCoupling::ReadMeshFromFile(const std::string& fileName, int meshDimRelToMax)
{
MEDCoupling::CheckFileForRead(fileName);
- MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm(MEDFileMesh::New(fileName));
+ MCAuto<MEDFileMesh> mm(MEDFileMesh::New(fileName));
MEDFileMesh *mmPtr(mm);
MEDFileUMesh *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
if(mmuPtr)
MEDCoupling::MEDCouplingUMesh *MEDCoupling::ReadUMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax)
{
MEDCoupling::CheckFileForRead(fileName);
- MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
+ MCAuto<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
MEDFileMesh *mmPtr(mm);
MEDFileUMesh *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
if(!mmuPtr)
MEDCoupling::MEDCouplingUMesh *MEDCoupling::ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax)
{
MEDCoupling::CheckFileForRead(fileName);
- MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm(MEDFileMesh::New(fileName));
+ MCAuto<MEDFileMesh> mm(MEDFileMesh::New(fileName));
MEDFileMesh *mmPtr(mm);
MEDFileUMesh *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
if(!mmuPtr)
MEDCoupling::MEDCouplingUMesh *MEDCoupling::ReadUMeshFromFamilies(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector<std::string>& fams)
{
MEDCoupling::CheckFileForRead(fileName);
- MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
+ MCAuto<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
MEDFileMesh *mmPtr(mm);
MEDFileUMesh *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
if(!mmuPtr)
MEDCoupling::MEDCouplingUMesh *MEDCoupling::ReadUMeshFromGroups(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector<std::string>& grps)
{
MEDCoupling::CheckFileForRead(fileName);
- MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm=MEDFileMesh::New(fileName,meshName);
+ MCAuto<MEDFileMesh> mm=MEDFileMesh::New(fileName,meshName);
MEDFileMesh *mmPtr(mm);
MEDFileUMesh *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
if(!mmuPtr)
return std::vector<MEDCoupling::MEDCouplingFieldDouble *>();
MEDCoupling::CheckFileForRead(fileName);
std::vector<MEDCoupling::MEDCouplingFieldDouble *> ret(its.size());
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> > retSafe(its.size());
+ std::vector< MCAuto<MEDCouplingFieldDouble> > retSafe(its.size());
if(its.empty())
return ret;
//Retrieving mesh of rank 0 and field on rank 0 too.
- MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm=MEDFileMesh::New(fileName,meshName);
+ MCAuto<MEDFileMesh> mm=MEDFileMesh::New(fileName,meshName);
MEDFileMesh *mmPtr(mm);
MEDFileUMesh *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
if(!mmuPtr)
throw INTERP_KERNEL::Exception("ReadFieldsOnSameMesh : only unstructured mesh is managed !");
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m=mmuPtr->getMeshAtLevel(meshDimRelToMax);
+ MCAuto<MEDCouplingUMesh> m=mmuPtr->getMeshAtLevel(meshDimRelToMax);
const DataArrayInt *o2n=mmuPtr->getNumberFieldAtLevel(meshDimRelToMax);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m2(m->clone(true));
+ MCAuto<MEDCouplingUMesh> m2(m->clone(true));
if(o2n)
m2->renumberCells(o2n->begin(),true);
int i=0;
for(std::vector<std::pair<int,int> >::const_iterator it=its.begin();it!=its.end();it++,i++)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ff=MEDFileField1TS::New(fileName,fieldName,(*it).first,(*it).second);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> retElt=ff->getFieldOnMeshAtLevel(type,m);
+ MCAuto<MEDFileField1TS> ff=MEDFileField1TS::New(fileName,fieldName,(*it).first,(*it).second);
+ MCAuto<MEDCouplingFieldDouble> retElt=ff->getFieldOnMeshAtLevel(type,m);
if(o2n)
retElt->renumberCells(o2n->begin(),true);
retElt->setMesh(m2);
MEDCoupling::MEDCouplingFieldDouble *MEDCoupling::ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ff(MEDFileField1TS::New(fileName,fieldName,iteration,order));
- MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> m(mm->getMeshAtLevel(meshDimRelToMax,false));
+ MCAuto<MEDFileField1TS> ff(MEDFileField1TS::New(fileName,fieldName,iteration,order));
+ MCAuto<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
+ MCAuto<MEDCouplingMesh> m(mm->getMeshAtLevel(meshDimRelToMax,false));
MEDFileMesh *mPtr(mm);
MEDFileUMesh *muPtr=dynamic_cast<MEDFileUMesh *>(mPtr);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret(ff->getFieldOnMeshAtLevel(ON_CELLS,m));
+ MCAuto<MEDCouplingFieldDouble> ret(ff->getFieldOnMeshAtLevel(ON_CELLS,m));
if(muPtr)
{
const DataArrayInt *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax));
MEDCoupling::MEDCouplingFieldDouble *MEDCoupling::ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ff(MEDFileField1TS::New(fileName,fieldName,iteration,order));
- MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> m(mm->getMeshAtLevel(meshDimRelToMax,false));
+ MCAuto<MEDFileField1TS> ff(MEDFileField1TS::New(fileName,fieldName,iteration,order));
+ MCAuto<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
+ MCAuto<MEDCouplingMesh> m(mm->getMeshAtLevel(meshDimRelToMax,false));
MEDFileMesh *mPtr(mm);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret(ff->getFieldOnMeshAtLevel(ON_NODES,m));
+ MCAuto<MEDCouplingFieldDouble> ret(ff->getFieldOnMeshAtLevel(ON_NODES,m));
MEDFileUMesh *muPtr=dynamic_cast<MEDFileUMesh *>(mPtr);
if(ff->getPflsReallyUsed().empty())
{
else
{
DataArrayInt *pfl=0,*arr2=0;
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr(ff->getFieldWithProfile(ON_NODES,meshDimRelToMax,mm,pfl));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> pflSafe(pfl);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> mp(m->getCellIdsFullyIncludedInNodeIds(pfl->begin(),pfl->end()));
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mzip(static_cast<MEDCouplingUMesh *>(m->buildPartAndReduceNodes(mp->begin(),mp->end(),arr2)));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr2Safe(arr2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr3(arr2->invertArrayO2N2N2O(mzip->getNumberOfNodes()));
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> pflSorted(pflSafe->deepCpy()); pflSorted->sort(true);
+ MCAuto<DataArrayDouble> arr(ff->getFieldWithProfile(ON_NODES,meshDimRelToMax,mm,pfl));
+ MCAuto<DataArrayInt> pflSafe(pfl);
+ MCAuto<DataArrayInt> mp(m->getCellIdsFullyIncludedInNodeIds(pfl->begin(),pfl->end()));
+ MCAuto<MEDCouplingUMesh> mzip(static_cast<MEDCouplingUMesh *>(m->buildPartAndReduceNodes(mp->begin(),mp->end(),arr2)));
+ MCAuto<DataArrayInt> arr2Safe(arr2);
+ MCAuto<DataArrayInt> arr3(arr2->invertArrayO2N2N2O(mzip->getNumberOfNodes()));
+ MCAuto<DataArrayInt> pflSorted(pflSafe->deepCopy()); pflSorted->sort(true);
if(!arr3->isEqualWithoutConsideringStr(*pflSorted))
throw INTERP_KERNEL::Exception("ReadFieldNode : not implemented yet !");
if(!arr3->isEqualWithoutConsideringStr(*pflSafe))
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n2(pflSafe->checkAndPreparePermutation());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> n2o2(o2n2->invertArrayO2N2N2O(o2n2->getNumberOfTuples()));
+ MCAuto<DataArrayInt> o2n2(pflSafe->checkAndPreparePermutation());
+ MCAuto<DataArrayInt> n2o2(o2n2->invertArrayO2N2N2O(o2n2->getNumberOfTuples()));
mzip->renumberNodes(n2o2->begin(),n2o2->getNumberOfTuples());
arr->setName("");
ret->setArray(arr);
MEDCoupling::MEDCouplingFieldDouble *MEDCoupling::ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ff(MEDFileField1TS::New(fileName,fieldName,iteration,order));
- MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> m(mm->getMeshAtLevel(meshDimRelToMax,false));
+ MCAuto<MEDFileField1TS> ff(MEDFileField1TS::New(fileName,fieldName,iteration,order));
+ MCAuto<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
+ MCAuto<MEDCouplingMesh> m(mm->getMeshAtLevel(meshDimRelToMax,false));
MEDFileMesh *mPtr(mm);
MEDFileUMesh *muPtr=dynamic_cast<MEDFileUMesh *>(mPtr);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret(ff->getFieldOnMeshAtLevel(ON_GAUSS_PT,m));
+ MCAuto<MEDCouplingFieldDouble> ret(ff->getFieldOnMeshAtLevel(ON_GAUSS_PT,m));
if(muPtr)
{
const DataArrayInt *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax));
MEDCoupling::MEDCouplingFieldDouble *MEDCoupling::ReadFieldGaussNE(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ff(MEDFileField1TS::New(fileName,fieldName,iteration,order));
- MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> m(mm->getMeshAtLevel(meshDimRelToMax,false));
+ MCAuto<MEDFileField1TS> ff(MEDFileField1TS::New(fileName,fieldName,iteration,order));
+ MCAuto<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
+ MCAuto<MEDCouplingMesh> m(mm->getMeshAtLevel(meshDimRelToMax,false));
MEDFileMesh *mPtr(mm);
MEDFileUMesh *muPtr=dynamic_cast<MEDFileUMesh *>(mPtr);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret(ff->getFieldOnMeshAtLevel(ON_GAUSS_NE,m));
+ MCAuto<MEDCouplingFieldDouble> ret(ff->getFieldOnMeshAtLevel(ON_GAUSS_NE,m));
if(muPtr)
{
const DataArrayInt *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax));
const MEDCoupling1GTUMesh *um2(dynamic_cast<const MEDCoupling1GTUMesh *>(mesh));
if(um2)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> mmu(MEDFileUMesh::New());
+ MCAuto<MEDFileUMesh> mmu(MEDFileUMesh::New());
AssignStaticWritePropertiesTo(*mmu);
mmu->setMeshAtLevel(0,const_cast<MEDCoupling1GTUMesh *>(um2));
mmu->write(fileName,mod);
const MEDCouplingCMesh *um3(dynamic_cast<const MEDCouplingCMesh *>(mesh));
if(um3)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileCMesh> mmc(MEDFileCMesh::New());
+ MCAuto<MEDFileCMesh> mmc(MEDFileCMesh::New());
AssignStaticWritePropertiesTo(*mmc);
mmc->setMesh(const_cast<MEDCouplingCMesh *>(um3));
mmc->write(fileName,mod);
const MEDCouplingCurveLinearMesh *um4(dynamic_cast<const MEDCouplingCurveLinearMesh *>(mesh));
if(um4)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileCurveLinearMesh> mmc(MEDFileCurveLinearMesh::New());
+ MCAuto<MEDFileCurveLinearMesh> mmc(MEDFileCurveLinearMesh::New());
AssignStaticWritePropertiesTo(*mmc);
mmc->setMesh(const_cast<MEDCouplingCurveLinearMesh *>(um4));
mmc->write(fileName,mod);
if(!mesh)
throw INTERP_KERNEL::Exception("WriteUMesh : input mesh is null !");
int mod=writeFromScratch?2:0;
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> m(MEDFileUMesh::New());
+ MCAuto<MEDFileUMesh> m(MEDFileUMesh::New());
AssignStaticWritePropertiesTo(*m);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mcpy(static_cast<MEDCouplingUMesh *>(mesh->deepCpy()));
+ MCAuto<MEDCouplingUMesh> mcpy(static_cast<MEDCouplingUMesh *>(mesh->deepCopy()));
m->setMeshAtLevel(0,mcpy,true);
m->write(fileName,mod);
}
std::ostringstream oss; oss << "File with name \'" << fileName << "\' has not valid permissions !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> m(MEDFileUMesh::New());
+ MCAuto<MEDFileUMesh> m(MEDFileUMesh::New());
AssignStaticWritePropertiesTo(*m);
m->setGroupsFromScratch(0,meshes,true);
m->setName(meshNameC);
void MEDCoupling::WriteUMeshes(const std::string& fileName, const std::vector<const MEDCoupling::MEDCouplingUMesh *>& meshes, bool writeFromScratch)
{
int mod=writeFromScratch?2:0;
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> m(MEDFileUMesh::New());
+ MCAuto<MEDFileUMesh> m(MEDFileUMesh::New());
AssignStaticWritePropertiesTo(*m);
m->setMeshes(meshes,true);
m->write(fileName,mod);
void MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(const std::string& fileName, const MEDCoupling::MEDCouplingFieldDouble *f, bool writeFromScratch)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ff(MEDFileField1TS::New());
+ MCAuto<MEDFileField1TS> ff(MEDFileField1TS::New());
AssignStaticWritePropertiesTo(*ff);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f2(f->deepCpy());
+ MCAuto<MEDCouplingFieldDouble> f2(f->deepCopy());
const MEDCouplingMesh *m(f2->getMesh());
const MEDCouplingUMesh *um(dynamic_cast<const MEDCouplingUMesh *>(m));
const MEDCoupling1GTUMesh *um2(dynamic_cast<const MEDCoupling1GTUMesh *>(m));
const MEDCouplingCMesh *um3(dynamic_cast<const MEDCouplingCMesh *>(m));
const MEDCouplingCurveLinearMesh *um4(dynamic_cast<const MEDCouplingCurveLinearMesh *>(m));
- MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm;
+ MCAuto<MEDFileMesh> mm;
int mod=writeFromScratch?2:0;
if(um)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> mmu(MEDFileUMesh::New());
+ MCAuto<MEDFileUMesh> mmu(MEDFileUMesh::New());
AssignStaticWritePropertiesTo(*mmu);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n(um->getRenumArrForMEDFileFrmt());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> n2o(o2n->invertArrayO2N2N2O(o2n->getNumberOfTuples()));
+ MCAuto<DataArrayInt> o2n(um->getRenumArrForMEDFileFrmt());
+ MCAuto<DataArrayInt> n2o(o2n->invertArrayO2N2N2O(o2n->getNumberOfTuples()));
f2->renumberCells(o2n->begin(),false);
mmu->setMeshAtLevel(0,const_cast<MEDCouplingUMesh *>(static_cast<const MEDCouplingUMesh *>(f2->getMesh())));
mmu->setRenumFieldArr(0,n2o);
}
else if(um2)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> mmu(MEDFileUMesh::New());
+ MCAuto<MEDFileUMesh> mmu(MEDFileUMesh::New());
AssignStaticWritePropertiesTo(*mmu);
mmu->setMeshAtLevel(0,const_cast<MEDCoupling1GTUMesh *>(um2));
ff->setFieldNoProfileSBT(f2);
}
else if(um3)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileCMesh> mmc(MEDFileCMesh::New());
+ MCAuto<MEDFileCMesh> mmc(MEDFileCMesh::New());
AssignStaticWritePropertiesTo(*mmc);
mmc->setMesh(const_cast<MEDCouplingCMesh *>(um3));
ff->setFieldNoProfileSBT(f2);
}
else if(um4)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileCurveLinearMesh> mmc(MEDFileCurveLinearMesh::New());
+ MCAuto<MEDFileCurveLinearMesh> mmc(MEDFileCurveLinearMesh::New());
AssignStaticWritePropertiesTo(*mmc);
mmc->setMesh(const_cast<MEDCouplingCurveLinearMesh *>(um4));
ff->setFieldNoProfileSBT(f2);
{
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)
{
MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(fileName,f,false);
else
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm(MEDFileMesh::New(fileName,f->getMesh()->getName().c_str()));
+ MCAuto<MEDFileMesh> mm(MEDFileMesh::New(fileName,f->getMesh()->getName().c_str()));
AssignStaticWritePropertiesTo(*mm);
const MEDFileMesh *mmPtr(mm);
const MEDFileUMesh *mmuPtr=dynamic_cast<const MEDFileUMesh *>(mmPtr);
if(!mmuPtr)
throw INTERP_KERNEL::Exception("WriteField : only umeshes are supported now !");
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f2(f->deepCpy());
+ MCAuto<MEDCouplingFieldDouble> f2(f->deepCopy());
MEDCouplingUMesh *m=dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f2->getMesh()));
if(!m)
throw INTERP_KERNEL::Exception("WriteField : only umesh in input field supported !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n=m->getRenumArrForMEDFileFrmt();
+ MCAuto<DataArrayInt> o2n=m->getRenumArrForMEDFileFrmt();
f2->renumberCells(o2n->begin(),false);
m=static_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f2->getMesh()));
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mread=mmuPtr->getMeshAtLevel(m->getMeshDimension()-mm->getMeshDimension());
+ MCAuto<MEDCouplingUMesh> 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<DataArrayInt> partSafe(part);
+ MCAuto<DataArrayInt> 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<MEDFileField1TS> f1ts(MEDFileField1TS::New());
+ MCAuto<MEDFileField1TS> f1ts(MEDFileField1TS::New());
AssignStaticWritePropertiesTo(*f1ts);
- if(part->isIdentity2(mread->getNumberOfCells()))
+ if(part->isIota(mread->getNumberOfCells()))
f1ts->setFieldNoProfileSBT(f2);
else
{
{
DataArrayInt *part=0;
bool b=mread->getCoords()->areIncludedInMe(m->getCoords(),_EPS_FOR_NODE_COMP,part);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> partSafe(part);
+ MCAuto<DataArrayInt> 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<MEDFileField1TS> f1ts(MEDFileField1TS::New());
+ MCAuto<MEDFileField1TS> f1ts(MEDFileField1TS::New());
AssignStaticWritePropertiesTo(*f1ts);
- if(part->isIdentity2(mread->getNumberOfNodes()))
+ if(part->isIota(mread->getNumberOfNodes()))
f1ts->setFieldNoProfileSBT(f2);
else
{
{
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<MEDFileField1TS> f1ts(MEDFileField1TS::New());
+ MCAuto<MEDFileField1TS> f1ts(MEDFileField1TS::New());
AssignStaticWritePropertiesTo(*f1ts);
MEDCouplingUMesh *m(dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f->getMesh())));
if(m)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n(m->getRenumArrForMEDFileFrmt());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f2(f->deepCpy());
+ MCAuto<DataArrayInt> o2n(m->getRenumArrForMEDFileFrmt());
+ MCAuto<MEDCouplingFieldDouble> f2(f->deepCopy());
f2->renumberCells(o2n->begin(),false);
f1ts->setFieldNoProfileSBT(f2);
}
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 );
const int meshDimRelToMaxExt = ( dim == 0 ? 1 : dim - meshDim );
std::vector<const DataArrayInt *> medGroups;
- std::vector<MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > refGroups;
+ std::vector<MCAuto<DataArrayInt> > refGroups;
for ( size_t i = 0; i < _groups.size(); ++i )
{
Group& grp = _groups[i];
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() );
}
// 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
<DataArrayDouble> 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
<MEDCouplingMesh> subMesh = dimMesh->buildPart(support->_medGroup->begin(),
support->_medGroup->end());
timeStamp->setMesh( subMesh);
timeStamp->setOrder( nbTS );
// add the time-stamp
- timeStamp->checkCoherency();
+ timeStamp->checkConsistencyLight();
if ( onAll )
fld->_curMedField->appendFieldNoProfileSBT( timeStamp );
else
#include "SauvReader.hxx"
#include "SauvMedConvertor.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "NormalizedUnstructuredMesh.hxx"
#include "MEDCouplingRefCountObject.hxx"
{
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() );
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;
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 )
{
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 );
code[2] = -1;
}
vector<const DataArrayInt *> idsPerType( 1, profile );
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt>
+ MCAuto<DataArrayInt>
resIDs = uMesh->checkTypeConsistencyAndContig( code, idsPerType );
if (( const DataArrayInt *) resIDs )
{
void SauvWriter::writeFileHead()
{
- MEDCouplingAutoRefCountObjectPtr< MEDCouplingMesh > mesh = _fileMesh->getMeshAtLevel(0);
+ MCAuto< MEDCouplingMesh > mesh = _fileMesh->getMeshAtLevel(0);
*_sauvFile
<< " ENREGISTREMENT DE TYPE 4" << endl
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 )
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
_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)
{
void SauvWriter::writeFieldNames( const bool isNodal,
std::map<std::string,int>& fldNamePrefixMap)
{
- vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldMultiTS > >&
+ vector< MCAuto< MEDFileFieldMultiTS > >&
flds = isNodal ? _nodeFields : _cellFields;
map<string,int> nameNbMap;
#include "MEDCouplingRefCountObject.hxx"
#include "NormalizedUnstructuredMesh.hxx"
#include "SauvUtilities.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include <vector>
#include <string>
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<SubMesh> _subs;
std::map< int, SubMesh* > _famIDs2Sub;
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):
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)
c[a]=DataArrayInt(arr2)
#
m.setConnectivity(c,arr1mc1,True)
- m.checkCoherency1()
+ m.checkConsistency()
return m
def __traduceMeshForPolygon(self,name,coords,arr0,arr1):
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):
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
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
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)
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 %{
%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__;
%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__;
%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;
%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;
%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;
%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__;
INTERP_KERNEL::NormalizedCellType rem_geo_type)
throw(INTERP_KERNEL::Exception);
std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
- MEDFileJointCorrespondence *deepCpy() const;
+ MEDFileJointCorrespondence *deepCopy() const;
MEDFileJointCorrespondence *shallowCpy() const;
void setIsNodal(bool isNodal);
bool getIsNodal() const;
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);
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);
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;
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);
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);
std::vector<double> a0;
std::vector<int> a1;
std::vector<std::string> a2;
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > a3;
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> a4;
+ std::vector< MCAuto<DataArrayInt> > a3;
+ MCAuto<DataArrayDouble> a4;
self->serialize(a0,a1,a2,a3,a4);
PyObject *ret(PyTuple_New(5));
PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
std::vector<double> a0;
std::vector<int> a1;
std::vector<std::string> a2;
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > a3;
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> a4;
+ std::vector< MCAuto<DataArrayInt> > a3;
+ MCAuto<DataArrayDouble> a4;
//
PyObject *a0py(PyTuple_GetItem(inp,0)),*a1py(PyTuple_GetItem(inp,1)),*a2py(PyTuple_GetItem(inp,2));
int tmp(-1);
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);
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<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
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
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<sz;i++)
PyObject *splitDiscretizations() const throw(INTERP_KERNEL::Exception)
{
- std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > 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<sz;i++)
PyObject *splitMultiDiscrPerGeoTypes() const throw(INTERP_KERNEL::Exception)
{
- std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > 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<sz;i++)
public:
static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
- MEDFileAnyTypeFieldMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
+ MEDFileAnyTypeFieldMultiTS *deepCopy() const throw(INTERP_KERNEL::Exception);
virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const throw(INTERP_KERNEL::Exception);
std::string getName() const throw(INTERP_KERNEL::Exception);
void setName(const std::string& name) throw(INTERP_KERNEL::Exception);
if(elt0 && PyList_Check(elt0))
{
int sz=PyList_Size(elt0);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
+ MCAuto<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
int *pt=da->getPointer();
for(int i=0;i<sz;i++,pt++)
{
PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
{
- std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > 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<sz;i++)
PyObject *splitDiscretizations() const throw(INTERP_KERNEL::Exception)
{
- std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > 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<sz;i++)
PyObject *splitMultiDiscrPerGeoTypes() const throw(INTERP_KERNEL::Exception)
{
- std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > 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<sz;i++)
{
std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTS;
convertFromPyObjVectorOfObj<MEDCoupling::MEDFileAnyTypeFieldMultiTS *>(li,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS);
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFastCellSupportComparator> > ret2;
+ std::vector< MCAuto<MEDFileFastCellSupportComparator> > ret2;
std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret=MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(vectFMTS,mesh,ret2);
if(ret2.size()!=ret.size())
{
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);
if(obj && PyList_Check(obj))
{
int sz=PyList_Size(obj);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
+ MCAuto<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
int *pt=da->getPointer();
for(int i=0;i<sz;i++,pt++)
{
static MEDFileParameterDouble1TS *New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName) throw(INTERP_KERNEL::Exception);
static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName, int dt, int it) throw(INTERP_KERNEL::Exception);
- virtual MEDFileParameter1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
+ virtual MEDFileParameter1TS *deepCopy() const throw(INTERP_KERNEL::Exception);
virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
void setName(const std::string& name) throw(INTERP_KERNEL::Exception);
std::string getName() const throw(INTERP_KERNEL::Exception);
static MEDFileParameterMultiTS *New(const std::string& fileName, const std::string& paramName) throw(INTERP_KERNEL::Exception);
std::string getName() const;
void setName(const std::string& name);
- MEDFileParameterMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
+ MEDFileParameterMultiTS *deepCopy() const throw(INTERP_KERNEL::Exception);
void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
void appendValue(int dt, int it, double time, double val) throw(INTERP_KERNEL::Exception);
public:
static MEDFileParameters *New();
static MEDFileParameters *New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
- MEDFileParameters *deepCpy() const throw(INTERP_KERNEL::Exception);
+ MEDFileParameters *deepCopy() const throw(INTERP_KERNEL::Exception);
void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
std::vector<std::string> getParamsNames() const throw(INTERP_KERNEL::Exception);
std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
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);
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)
m.insertNextCell(NORM_POLYGON,o2n[6*i:6*(i+1)].getValues())
pass
m.finishInsertingCells()
-m.checkCoherency()
+m.checkConsistencyLight()
#
m.writeVTK("My7hexagons.vtu")
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)
#
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))
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")
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
#
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
#
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)
#
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")
#
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)
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)
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
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
######
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"]
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]
#
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)
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]
f1.setArray(array);
tmp=array.getPointer();
f1.setTime(2.,0,1);
- f1.checkCoherency();
+ f1.checkConsistencyLight();
return f1;
def buildVecFieldOnNodes_1(cls):
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):
f.setName("MyFirstFieldOnGaussPoint");
array.setInfoOnComponent(0,"power [MW/m^3]");
array.setInfoOnComponent(1,"density");
- f.checkCoherency();
+ f.checkConsistencyLight();
return f;
def buildVecFieldOnGauss_2(cls):
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
f.setName("MyFirstFieldOnGaussPoint");
array.setInfoOnComponent(0,"power [MW/m^3]");
array.setInfoOnComponent(1,"density");
- f.checkCoherency();
+ f.checkConsistencyLight();
return f;
def buildVecFieldOnGaussNE_1(cls):
array.setInfoOnComponent(0,"power [W]");
array.setInfoOnComponent(1,"temperature");
f.setName("MyFieldOnGaussNE");
- f.checkCoherency();
+ f.checkConsistencyLight();
return f;
def buildACompleteMEDDataStructureWithFieldsOnCells_1(cls):
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
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)
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
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")
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
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)
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));
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));
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));
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));
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));
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
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));
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));
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]
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
#
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));
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");
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());
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
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
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)
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));
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));
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));
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));
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));
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));
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));
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);
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);
m2.insertNextCell(NORM_POINT1,1,[6])
m2.finishInsertingCells();
m2.setCoords(c)
- m2.checkCoherency()
+ m2.checkConsistencyLight()
#
mm=MEDFileUMesh.New()
self.assertTrue(mm.getUnivNameWrStatus())
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);
#
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);
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);
m2.insertNextCell(NORM_POINT1,1,[6])
m2.finishInsertingCells();
m2.setCoords(c)
- m2.checkCoherency()
+ m2.checkConsistencyLight()
#
mm=MEDFileUMesh.New()
mm.setName("My2ndMEDCouplingMEDmesh")
#
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()
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)
#
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("")
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("")
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
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)
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")
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()
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()
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]))
#
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()
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]))
#
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
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
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()
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)
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)
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()
## 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]
## 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]
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)
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)
a1.iota(7.) ; a1.rearrange(3);
mesh.setCoords(a1);
mesh.setNodeGridStructure([4,5]);
- mesh.checkCoherency();
+ mesh.checkConsistencyLight();
#
m=MEDFileCurveLinearMesh()
m.setMesh(mesh)
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])
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)
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
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]))
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)
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]
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)
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)
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)
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)
#
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),'','')])]
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','')])]
## 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))
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)
#
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)
#
# 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','')])]
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)
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)
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)
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
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)
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);
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")
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)
arr[:,0]=range(200,236)
arr[:,1]=range(300,336)
f.setArray(arr)
- f.checkCoherency()
+ f.checkConsistencyLight()
WriteFieldUsingAlreadyWrittenMesh(fileName,f)
#
ms=MEDFileMeshes()
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)
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)
arr[:,0]=range(200,236)
arr[:,1]=range(300,336)
f.setArray(arr)
- f.checkCoherency()
+ f.checkConsistencyLight()
WriteFieldUsingAlreadyWrittenMesh(fileName,f)
#
ms=MEDFileMeshes()
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)
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);
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);
m2.insertNextCell(NORM_POINT1,1,[6])
m2.finishInsertingCells();
m2.setCoords(c)
- m2.checkCoherency()
+ m2.checkConsistencyLight()
#
mm=MEDFileUMesh.New()
self.assertTrue(mm.getUnivNameWrStatus())
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):
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(),())
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(),())
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]]
#
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]:
f.setMesh(m)
f.setArray(DataArrayDouble(100))
f.getArray()[:]=100.
- f.checkCoherency()
+ f.checkConsistencyLight()
f1ts=MEDFileField1TS()
f1ts.setFieldNoProfileSBT(f)
# redirect stderr
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
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))
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
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
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())
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
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)
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
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
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
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)
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()
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)
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
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
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
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)
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()
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)
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
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
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
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
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()
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)
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)
#
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)
#
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
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)
#
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)
#
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
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)
#
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)
#
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
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)
#
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)
#
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
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)
#
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)
#
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()
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()
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)
#
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
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)
#
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
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)
#
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)
#
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)
#
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)
#
#
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()
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)
#
#
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()
#
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()
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()
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)
#
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()
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)
#
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)
#
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)
#
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()
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)
#
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()
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)
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)
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)
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)
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")
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)
#
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
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)
#
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
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)
#
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)
#
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))
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))
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))
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))
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
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)
#
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)
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)
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)
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)
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)
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)
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)
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)
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)
#
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")
#
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
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)
#
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()
arr=DataArrayDouble(7) ; arr.iota(2000)
f1.setArray(arr)
f1.setName("bbb")
- f1.checkCoherency()
+ f1.checkConsistencyLight()
f1.setTime(*zeTime)
ff1.setFieldNoProfileSBT(f1)
#
arr=DataArrayDouble(9) ; arr.iota(4000)
f2.setArray(arr)
f2.setName("ddd")
- f2.checkCoherency()
+ f2.checkConsistencyLight()
f2.setTime(*zeTime)
ff2.setFieldNoProfileSBT(f2)
#
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)
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)
#
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)
#
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)
#
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)
#
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)
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)
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:
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)
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));
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));
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));
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));
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));
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
//
std::vector<MEDCoupling::TypeOfField> 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();
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<MEDCouplingMesh *>(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();
//
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();
//
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));
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));
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);
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));
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");
};
std::copy(arr2,arr2+24,tmp);
f2->setTime(3.14,2,7);
- f2->checkCoherency();
+ f2->checkConsistencyLight();
//
WriteField(fileName,f1,true);
std::vector<MEDCoupling::TypeOfField> ts=GetTypesOfField(fileName,f1->getMesh()->getName().c_str(),f1->getName().c_str());
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());
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());
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());
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());
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());
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());
std::vector<std::pair<int,int> > 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());
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());
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());
vector<string> 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());
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;
}
};
std::copy(arr1,arr1+36,tmp);
f1->setTime(2.12,2,3);
- f1->checkCoherency();
+ f1->checkConsistencyLight();
mesh->decrRef();
return f1;
}
array->setInfoOnComponent(0,"power [MW/m^3]");
array->setInfoOnComponent(1,"density");
array->decrRef();
- f->checkCoherency();
+ f->checkConsistencyLight();
m->decrRef();
return f;
}
array->setInfoOnComponent(1,"temperature");
f->setName("MyFieldOnGaussNE");
array->decrRef();
- f->checkCoherency();
+ f->checkConsistencyLight();
m->decrRef();
return f;
}
{
// read a file containing all types of readable piles
std::string file = INTERP_TEST::getResourceFile("allPillesTest.sauv", 3);
- MEDCouplingAutoRefCountObjectPtr<SauvReader> sr=SauvReader::New(file.c_str());
- MEDCouplingAutoRefCountObjectPtr<MEDFileData> d2=sr->loadInMEDFileDS();
+ MCAuto<SauvReader> sr=SauvReader::New(file.c_str());
+ MCAuto<MEDFileData> d2=sr->loadInMEDFileDS();
// write MED
d2->write("allPillesTest.med",0);
// check
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<MEDCouplingUMesh> mesh2d=MEDCouplingUMesh::New("Mesh",spaceDim);
+ MCAuto<MEDCouplingUMesh> 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<DataArrayDouble> myCoords=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> myCoords=DataArrayDouble::New();
myCoords->alloc(nbOfNodes,spaceDim);
std::copy(coords,coords+nbOfNodes*spaceDim,myCoords->getPointer());
mesh2d->setCoords(myCoords);
// create a MedFileUMesh
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> m= MEDFileUMesh::New();
+ MCAuto<MEDFileUMesh> m= MEDFileUMesh::New();
m->setMeshAtLevel(0,mesh2d);
// Create families and groups
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> fam = DataArrayInt::New();
+ MCAuto<DataArrayInt> fam = DataArrayInt::New();
fam->alloc(2,1);
int elemsFams[2] = {-2,-3};
std::copy(elemsFams,elemsFams+2,fam->getPointer());
// write to SAUV
const char* sauvFile = "mesh_with_void_family.sauv";
- MEDCouplingAutoRefCountObjectPtr<MEDFileData> medData = MEDFileData::New();
- MEDCouplingAutoRefCountObjectPtr<MEDFileMeshes> medMeshes = MEDFileMeshes::New();
- MEDCouplingAutoRefCountObjectPtr<SauvWriter> sw=SauvWriter::New();
+ MCAuto<MEDFileData> medData = MEDFileData::New();
+ MCAuto<MEDFileMeshes> medMeshes = MEDFileMeshes::New();
+ MCAuto<SauvWriter> sw=SauvWriter::New();
medMeshes->setMeshAtPos(0, m);
medData->setMeshes(medMeshes);
sw->setMEDFileDS(medData);
sw->write(sauvFile);
// read SAUV and check groups
- MEDCouplingAutoRefCountObjectPtr<SauvReader> sr=SauvReader::New(sauvFile);
- MEDCouplingAutoRefCountObjectPtr<MEDFileData> d2=sr->loadInMEDFileDS();
+ MCAuto<SauvReader> sr=SauvReader::New(sauvFile);
+ MCAuto<MEDFileData> d2=sr->loadInMEDFileDS();
MEDFileUMesh* m2 = static_cast<MEDFileUMesh*>( d2->getMeshes()->getMeshAtPos(0) );
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> group1 = m2->getGroup(0, "Group1");
+ MCAuto<MEDCouplingUMesh> group1 = m2->getGroup(0, "Group1");
CPPUNIT_ASSERT_EQUAL(1,(int)group1->getNumberOfCells());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> group2 = m2->getGroup(0, "Group2");
+ MCAuto<MEDCouplingUMesh> group2 = m2->getGroup(0, "Group2");
CPPUNIT_ASSERT_EQUAL(1,(int)group2->getNumberOfCells());
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> grptot = m2->getGroup(0, "Grouptot");
+ MCAuto<MEDCouplingUMesh> grptot = m2->getGroup(0, "Grouptot");
CPPUNIT_ASSERT_EQUAL(2,(int)grptot->getNumberOfCells());
}
{
// read SAUV
std::string sauvFile = INTERP_TEST::getResourceFile("portico_3subs.sauv", 3);
- MEDCouplingAutoRefCountObjectPtr<SauvReader> sr=SauvReader::New(sauvFile.c_str());
- MEDCouplingAutoRefCountObjectPtr<MEDFileData> d2=sr->loadInMEDFileDS();
+ MCAuto<SauvReader> sr=SauvReader::New(sauvFile.c_str());
+ MCAuto<MEDFileData> d2=sr->loadInMEDFileDS();
// check mesh
MEDFileUMesh* m2 = static_cast<MEDFileUMesh*>(d2->getMeshes()->getMeshAtPos(0));
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh1d = m2->getMeshAtLevel(0);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> length1dField = mesh1d->getMeasureField(0);
+ MCAuto<MEDCouplingUMesh> mesh1d = m2->getMeshAtLevel(0);
+ MCAuto<MEDCouplingFieldDouble> 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<MEDFileFieldMultiTS> field =
+ MCAuto<MEDFileFieldMultiTS> field =
dynamic_cast<MEDFileFieldMultiTS *>(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<int,int> > timesteps = field->getIterations();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field1d =
+ MCAuto<MEDCouplingFieldDouble> field1d =
field->getFieldOnMeshAtLevel(ON_GAUSS_NE, timesteps[0].first, timesteps[0].second, 0, m2);
// Check first component of the field
{
// read pointe.med
std::string file = INTERP_TEST::getResourceFile("pointe.med", 3);
- MEDCouplingAutoRefCountObjectPtr<MEDFileData> pointeMed=MEDFileData::New(file.c_str());
+ MCAuto<MEDFileData> pointeMed=MEDFileData::New(file.c_str());
// add 3 faces to pointeMed
MEDFileUMesh* pointeMedMesh = static_cast<MEDFileUMesh*>(pointeMed->getMeshes()->getMeshAtPos(0));
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> pointeM1D = MEDCouplingUMesh::New();
+ MCAuto<MEDCouplingUMesh> pointeM1D = MEDCouplingUMesh::New();
DataArrayDouble *coords = pointeMedMesh->getCoords();
pointeM1D->setCoords( coords );
pointeM1D->setMeshDimension( 2 );
pointeMed->getMeshes()->setMeshAtPos( 0, pointeMedMesh );
// add a field on 2 faces to pointeMed
- MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> ff1=MEDFileFieldMultiTS::New();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f1=MEDCouplingFieldDouble::New(ON_GAUSS_NE,ONE_TIME);
+ MCAuto<MEDFileFieldMultiTS> ff1=MEDFileFieldMultiTS::New();
+ MCAuto<MEDCouplingFieldDouble> f1=MEDCouplingFieldDouble::New(ON_GAUSS_NE,ONE_TIME);
f1->setMesh( pointeM1D );
f1->setName("Field on 2 faces");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> d=DataArrayDouble::New();
+ MCAuto<DataArrayDouble> d=DataArrayDouble::New();
d->alloc(3+4,2);
d->setInfoOnComponent(0,"sigX [MPa]");
d->setInfoOnComponent(1,"sigY [GPa]");
};
std::copy(vals,vals+d->getNbOfElems(),d->getPointer());
f1->setArray(d);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New();
+ MCAuto<DataArrayInt> da=DataArrayInt::New();
int ids[] =
{
0,2
MEDFileFields* pointeFields = pointeMed->getFields();
for ( int i = 0; i < pointeFields->getNumberOfFields(); ++i )
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTS> ts = pointeFields->getFieldAtPos(i);
+ MCAuto<MEDFileAnyTypeFieldMultiTS> ts = pointeFields->getFieldAtPos(i);
if ( std::string("fieldnodeint") == ts->getName())
{
pointeFields->destroyFieldAtPos( i );
}
// write pointeMed to SAUV
const char* sauvFile = "pointe.sauv";
- MEDCouplingAutoRefCountObjectPtr<SauvWriter> sw=SauvWriter::New();
+ MCAuto<SauvWriter> sw=SauvWriter::New();
sw->setMEDFileDS(pointeMed);
sw->write(sauvFile);
// read SAUV and check
- MEDCouplingAutoRefCountObjectPtr<SauvReader> sr=SauvReader::New(sauvFile);
- MEDCouplingAutoRefCountObjectPtr<MEDFileData> d2=sr->loadInMEDFileDS();
+ MCAuto<SauvReader> sr=SauvReader::New(sauvFile);
+ MCAuto<MEDFileData> d2=sr->loadInMEDFileDS();
CPPUNIT_ASSERT_EQUAL(1,d2->getNumberOfMeshes());
CPPUNIT_ASSERT_EQUAL(4,d2->getNumberOfFields());
MEDFileUMesh * m = static_cast<MEDFileUMesh*>( d2->getMeshes()->getMeshAtPos(0) );
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<MEDCouplingMesh> um0 = m->getMeshAtLevel(0);
+ MCAuto<MEDCouplingMesh> 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<MEDCouplingMesh> um1 = m->getMeshAtLevel(-1);
+ MCAuto<MEDCouplingMesh> um1 = m->getMeshAtLevel(-1);
CPPUNIT_ASSERT_EQUAL(2, um1->getNumberOfCellsWithType( INTERP_KERNEL::NORM_TRI3 ));
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> pointeUM0 =
+ MCAuto<MEDCouplingUMesh> pointeUM0 =
static_cast<MEDCouplingUMesh*>( pointeMedMesh->getMeshAtLevel(0));
DataArrayDouble *coo = m->getCoords();
DataArrayDouble *pointeCoo = pointeMedMesh->getCoords();
CPPUNIT_ASSERT(coo->isEqualWithoutConsideringStr(*pointeCoo,1e-12));
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> vol = um0->getMeasureField(0);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> pointeVol = pointeUM0->getMeasureField(0);
+ MCAuto<MEDCouplingFieldDouble> vol = um0->getMeasureField(0);
+ MCAuto<MEDCouplingFieldDouble> pointeVol = pointeUM0->getMeasureField(0);
CPPUNIT_ASSERT_DOUBLES_EQUAL( vol->accumulate(0), pointeVol->accumulate(0),1e-12);
// check fields
// fieldnodedouble
- MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> fieldnodedoubleTS1 =
+ MCAuto<MEDFileFieldMultiTS> fieldnodedoubleTS1 =
dynamic_cast<MEDFileFieldMultiTS *>(pointeMed->getFields()->getFieldWithName("fieldnodedouble"));
- MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> fieldnodedoubleTS2 =
+ MCAuto<MEDFileFieldMultiTS> fieldnodedoubleTS2 =
dynamic_cast<MEDFileFieldMultiTS *>(d2->getFields()->getFieldWithName("fieldnodedouble"));
CPPUNIT_ASSERT_EQUAL( fieldnodedoubleTS1->getInfo().size(), fieldnodedoubleTS2->getInfo().size());
for ( size_t i = 0; i < fieldnodedoubleTS1->getInfo().size(); ++i )
std::vector< std::pair<int,int> > io2 = fieldnodedoubleTS2->getIterations();
for ( int i =0; i < fieldnodedoubleTS1->getNumberOfTS(); ++i )
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> fnd1 =
+ MCAuto<MEDCouplingFieldDouble> fnd1 =
fieldnodedoubleTS1->getFieldOnMeshAtLevel(ON_NODES, io1[i].first,io1[i].second,pointeUM0);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> fnd2 =
+ MCAuto<MEDCouplingFieldDouble> fnd2 =
fieldnodedoubleTS2->getFieldOnMeshAtLevel(ON_NODES, io2[i].first,io2[i].second,um0);
CPPUNIT_ASSERT( fnd1->getArray()->isEqual( *fnd2->getArray(), 1e-12 ));
}
// fieldcelldoublevector
- MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> fieldcelldoublevectorTS1 =
+ MCAuto<MEDFileFieldMultiTS> fieldcelldoublevectorTS1 =
dynamic_cast<MEDFileFieldMultiTS *>(pointeMed->getFields()->getFieldWithName("fieldcelldoublevector"));
- MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> fieldcelldoublevectorTS2 =
+ MCAuto<MEDFileFieldMultiTS> fieldcelldoublevectorTS2 =
dynamic_cast<MEDFileFieldMultiTS *>(d2->getFields()->getFieldWithName("fieldcelldoublevector"));
CPPUNIT_ASSERT_EQUAL( fieldcelldoublevectorTS1->getInfo().size(), fieldcelldoublevectorTS2->getInfo().size());
for ( size_t i = 0; i < fieldcelldoublevectorTS1->getInfo().size(); ++i )
io2 = fieldcelldoublevectorTS2->getIterations();
for ( int i =0; i < fieldcelldoublevectorTS1->getNumberOfTS(); ++i )
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> fnd1 =
+ MCAuto<MEDCouplingFieldDouble> fnd1 =
fieldcelldoublevectorTS1->getFieldOnMeshAtLevel(ON_CELLS, io1[i].first,io1[i].second,pointeUM0);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> fnd2 =
+ MCAuto<MEDCouplingFieldDouble> 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<MEDFileFieldMultiTS> fieldOnFaces =
+ MCAuto<MEDFileFieldMultiTS> fieldOnFaces =
dynamic_cast<MEDFileFieldMultiTS *>(d2->getFields()->getFieldWithName(f1->getName().c_str()));
io1 = fieldOnFaces->getIterations();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> fof =
+ MCAuto<MEDCouplingFieldDouble> fof =
fieldOnFaces->getFieldOnMeshAtLevel(f1->getTypeOfField(),io1[0].first,io1[0].second,um1);
CPPUNIT_ASSERT( d->isEqual( *fof->getArray(), 1e-12 ));
}
*/
void MEDPARTITIONER::ConnectZone::setNodeCorresp(const int * nodeCorresp, int nbnode)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> indexArr( DataArrayInt::New() );
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> valueArr( DataArrayInt::New() );
+ MCAuto<DataArrayInt> indexArr( DataArrayInt::New() );
+ MCAuto<DataArrayInt> valueArr( DataArrayInt::New() );
indexArr->alloc( nbnode+1 );
valueArr->alloc( 2*nbnode );
int * index = indexArr->getPointer();
*/
void MEDPARTITIONER::ConnectZone::setFaceCorresp(const int * faceCorresp, int nbface)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> indexArr( DataArrayInt::New() );
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> valueArr( DataArrayInt::New() );
+ MCAuto<DataArrayInt> indexArr( DataArrayInt::New() );
+ MCAuto<DataArrayInt> valueArr( DataArrayInt::New() );
indexArr->alloc( nbface+1 );
valueArr->alloc( 2*nbface );
int * index = indexArr->getPointer();
void MEDPARTITIONER::ConnectZone::setEntityCorresp(int localEntity, int distantEntity,
const int *entityCorresp, int nbentity)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> indexArr( DataArrayInt::New() );
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> valueArr( DataArrayInt::New() );
+ MCAuto<DataArrayInt> indexArr( DataArrayInt::New() );
+ MCAuto<DataArrayInt> valueArr( DataArrayInt::New() );
indexArr->alloc( nbentity+1 );
valueArr->alloc( 2*nbentity );
int * index = indexArr->getPointer();
#include "MEDPARTITIONER_JointFinder.hxx"
#endif
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingNormalizedUnstructuredMesh.hxx"
for (int iold =0; iold< ioldMax; iold++)
if (isParallelMode() && _domain_selector->isMyDomain(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();
{
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();
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;
}
bool removeEqual = false)
{
// sort
- MEDCouplingAutoRefCountObjectPtr< DataArrayInt > renumN2O = ids1->buildPermArrPerLevel();
+ MCAuto< DataArrayInt > renumN2O = ids1->buildPermArrPerLevel();
ids1->renumberInPlaceR( renumN2O->begin() );
ids2->renumberInPlaceR( renumN2O->begin() );
// separate ids of two domains
const MEDCoupling::MEDCouplingSkyLineArray *corrArray = cz->getEntityCorresp( 0, 0 );
const DataArrayInt* ids12 = corrArray->getValueArray();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids1, ids2, ids12Sorted;
- ids1 = ids12->selectByTupleId2( 0, corrArray->getLength(), 2 );
- ids2 = ids12->selectByTupleId2( 1, corrArray->getLength(), 2 );
+ MCAuto<DataArrayInt> 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() ]);
// separate ids of two domains
const MEDCoupling::MEDCouplingSkyLineArray *corrArray = cz->getNodeCorresp();
const DataArrayInt *ids12 = corrArray->getValueArray();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids1, ids2, ids12Sorted;
- ids1 = ids12->selectByTupleId2( 0, corrArray->getLength(), 2 );
- ids2 = ids12->selectByTupleId2( 1, corrArray->getLength(), 2 );
+ MCAuto<DataArrayInt> 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 );
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,
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();
(_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);
{
(_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(...)
{
(_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";
cellMesh->setName(finalMeshName);
mfm->setMeshAtLevel( 0, cellMesh );
- faceMesh->checkCoherency();
+ faceMesh->checkConsistencyLight();
if (faceMesh->getNumberOfCells()>0)
{
faceMesh->tryToShareSameCoordsPermute(*cellMesh, 1e-10);
// add joints
- using MEDCoupling::MEDCouplingAutoRefCountObjectPtr;
+ using MEDCoupling::MCAuto;
using MEDCoupling::MEDCouplingSkyLineArray;
using MEDCoupling::MEDFileJoint;
using MEDCoupling::MEDFileJointCorrespondence;
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 )
{
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 );
}
{
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 );
}
}
field->setArray(da);
field->setTime(time,DT,IT);
- field->checkCoherency();
+ field->checkConsistencyLight();
}
return field;
}
{
MEDCoupling::MEDFileData* newdata = MEDCoupling::MEDFileData::New();
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::MEDFileMeshes> meshes;
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::MEDFileFields> fields;
+ MEDCoupling::MCAuto<MEDCoupling::MEDFileMeshes> meshes;
+ MEDCoupling::MCAuto<MEDCoupling::MEDFileFields> fields;
meshes = MEDCoupling::MEDFileMeshes::New();
fields = MEDCoupling::MEDFileFields::New();
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "InterpKernelException.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "InterpKernelAutoPtr.hxx"
#include <fstream>
umesh->setCoords(myCoords);
umesh->setName("EMPTY");
myCoords->decrRef();
- umesh->checkCoherency();
+ umesh->checkConsistencyLight();
return umesh;
}
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "InterpKernelException.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "InterpKernelAutoPtr.hxx"
#include <fstream>
#include "MEDLoader.hxx"
#include "MEDLoaderBase.hxx"
#include "MEDCouplingUMesh.hxx"
-#include "MEDCouplingExtrudedMesh.hxx"
+#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingMultiFields.hxx"
mesh->setCoords(myCoords);
mesh->setName(_mesh_name.c_str());
myCoords->decrRef();
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
return mesh;
}
mesh->setCoords(myCoords);
mesh->setName(_mesh_name.c_str());
myCoords->decrRef();
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
return mesh;
}
mesh->setCoords(myCoords);
mesh->setName(_mesh_name.c_str());
myCoords->decrRef();
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
return mesh;
}
myField->setInfoOnComponent(2,"vz");
myField->decrRef();
f1->setTime(2.,0,1);
- f1->checkCoherency();
+ f1->checkConsistencyLight();
mesh->decrRef();
return f1;
}
myField->setInfoOnComponent(2,"vz");
myField->decrRef();
f1->setTime(2.,0,1);
- f1->checkCoherency();
+ f1->checkConsistencyLight();
mesh->decrRef();
return f1;
}
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);
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];
array->decrRef();
WriteField(name.c_str(),f3,true);
if (_verbose) cout<<endl<<name<<" created"<<endl;
- f3->checkCoherency();
+ f3->checkConsistencyLight();
f1->decrRef();
if (_ntot<1000000) //too long
{
mesh->setCoords(myCoords);
mesh->setName("FacesIn2D");
myCoords->decrRef();
- mesh->checkCoherency();
+ mesh->checkConsistencyLight();
// groups of cells
DataArrayInt* cellsFam=DataArrayInt::New();
#include <iostream>
#include "MEDCouplingUMesh.hxx"
-#include "MEDCouplingExtrudedMesh.hxx"
+#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
class MEDPARTITIONERTEST_EXPORT MEDPARTITIONERTest : public CppUnit::TestFixture
#include "MEDLoader.hxx"
#include "MEDLoaderBase.hxx"
#include "MEDCouplingUMesh.hxx"
-#include "MEDCouplingExtrudedMesh.hxx"
+#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingMultiFields.hxx"
// Author : Anthony Geay (EDF R&D)
#include "ParaMEDFileMesh.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "MEDFileMesh.hxx"
#include "MEDFileMeshLL.hxx"
#include "MEDLoader.hxx"
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<MEDFileUMesh> ret;
+ MCAuto<MEDFileUMesh> ret;
int meshDim, spaceDim, numberOfNodes;
std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > typesDistrib(GetUMeshGlobalInfo(fileName,mName,meshDim,spaceDim,numberOfNodes));
std::vector<INTERP_KERNEL::NormalizedCellType> types;
MEDFileMeshes *ParaMEDFileMeshes::New(int iPart, int nbOfParts, const std::string& fileName)
{
std::vector<std::string> ms(GetMeshNames(fileName));
- MEDCouplingAutoRefCountObjectPtr<MEDFileMeshes> ret(MEDFileMeshes::New());
+ MCAuto<MEDFileMeshes> ret(MEDFileMeshes::New());
for(std::vector<std::string>::const_iterator it=ms.begin();it!=ms.end();it++)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mesh(ParaMEDFileMesh::New(iPart,nbOfParts,fileName,(*it)));
+ MCAuto<MEDFileMesh> mesh(ParaMEDFileMesh::New(iPart,nbOfParts,fileName,(*it)));
ret->pushMesh(mesh);
}
return ret.retn();
MEDFileMeshes *ParaMEDFileMeshes::ParaNew(int iPart, int nbOfParts, const MPI_Comm& com, const MPI_Info& nfo, const std::string& fileName)
{
std::vector<std::string> ms(GetMeshNames(fileName));
- MEDCouplingAutoRefCountObjectPtr<MEDFileMeshes> ret(MEDFileMeshes::New());
+ MCAuto<MEDFileMeshes> ret(MEDFileMeshes::New());
for(std::vector<std::string>::const_iterator it=ms.begin();it!=ms.end();it++)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mesh(ParaMEDFileMesh::ParaNew(iPart,nbOfParts,com,nfo,fileName,(*it)));
+ MCAuto<MEDFileMesh> mesh(ParaMEDFileMesh::ParaNew(iPart,nbOfParts,com,nfo,fileName,(*it)));
ret->pushMesh(mesh);
}
return ret.retn();
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)
#include "ProcessorGroup.hxx"
#include "MPIProcessorGroup.hxx"
#include "MEDCouplingFieldDouble.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "DirectedBoundingBox.hxx"
#include <map>
if (find(_distant_proc_ids.begin(), _distant_proc_ids.end(),rank)==_distant_proc_ids.end())
return;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elems;
+ MCAuto<DataArrayInt> elems;
#ifdef USE_DIRECTED_BB
INTERP_KERNEL::DirectedBoundingBox dbb;
double* distant_bb = _domain_bounding_boxes+rank*dbb.dataSize(_local_cell_mesh_space_dim);
CommInterface comm;
DataArrayInt *globalIds=_local_para_field.returnGlobalNumbering();
const int *globalIdsC=globalIds->getConstPointer();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> candidates=_local_para_field.getSupport()->getCellMesh()->findBoundaryNodes();
+ MCAuto<DataArrayInt> candidates=_local_para_field.getSupport()->getCellMesh()->findBoundaryNodes();
for(int *iter1=candidates->getPointer();iter1!=candidates->getPointer()+candidates->getNumberOfTuples();iter1++)
(*iter1)=globalIdsC[*iter1];
std::set<int> candidatesS(candidates->begin(),candidates->end());
NatureOfField nature=elementLocator.getLocalNature();
switch(nature)
{
- case ConservativeVolumic:
+ case IntensiveMaximum:
computeConservVolDenoW(elementLocator);
break;
- case Integral:
+ case ExtensiveMaximum:
{
if(!elementLocator.isM1DCorr())
computeIntegralDenoW(elementLocator);
computeGlobConstraintDenoW(elementLocator);
break;
}
- case IntegralGlobConstraint:
+ case ExtensiveConservation:
computeGlobConstraintDenoW(elementLocator);
break;
- case RevIntegral:
+ case IntensiveConservation:
{
if(!elementLocator.isM1DCorr())
computeRevIntegralDenoW(elementLocator);
NatureOfField nature=elementLocator.getLocalNature();
switch(nature)
{
- case ConservativeVolumic:
+ case IntensiveMaximum:
computeConservVolDenoL(elementLocator);
break;
- case Integral:
+ case ExtensiveMaximum:
{
if(!elementLocator.isM1DCorr())
computeIntegralDenoL(elementLocator);
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);
}
- MPIProcessorGroup *MPIProcessorGroup::deepCpy() const
+ MPIProcessorGroup *MPIProcessorGroup::deepCopy() const
{
return new MPIProcessorGroup(*this);
}
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;
#include "MEDCouplingNatureOfField.hxx"
#include "MEDCouplingPointSet.hxx"
#include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include <mpi.h>
#include <vector>
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<int,bool> 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;
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<MEDCouplingFieldDouble> f;
+// MCAuto<MEDCouplingFieldDouble> f;
// int orient = getOrientation(); // From InterpolationOptions inheritance
// if(orient == 2) // absolute areas
// f = _target_support->getMeasureField(true);
// _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!");
// }
}
#include "MPIProcessorGroup.hxx"
#include "MEDCouplingFieldDouble.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "InterpKernelAutoPtr.hxx"
}
///*!
-// * 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()
{
const std::vector< SparseDoubleVec >& mat=_the_matrix_st[i];
int curSrcId=_the_matrix_st_source_proc_id[i];
- map < int, MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >::const_iterator isItem1 = _sent_trg_ids.find(curSrcId);
+ map < int, MCAuto<DataArrayInt> >::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.
{
int rowId=0;
const std::vector< SparseDoubleVec >& mat=_the_matrix_st[i];
int curSrcId=_the_matrix_st_source_proc_id[i];
- map < int, MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >::const_iterator isItem1 = _sent_trg_ids.find(curSrcId);
+ map < int, MCAuto<DataArrayInt> >::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.
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<DataArrayDouble> vals;
+ MCAuto<DataArrayDouble> vals;
if(_locator.isInMyTodoList(myProcID, procID))
{
map<int, vector<int> >::const_iterator isItem11 = _src_ids_zip_comp.find(procID);
}
else
{
- map < int, MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >::const_iterator isItem11 = _sent_src_ids.find( procID );
+ map < int, MCAuto<DataArrayInt> >::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);
int newId=0;
for(vector<int>::const_iterator it=vec.begin();it!=vec.end();it++,newId++)
revert_zip[*it]=newId;
- map < int, MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >::const_iterator isItem24 = _sent_trg_ids.find(srcProcID);
+ map < int, MCAuto<DataArrayInt> >::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;
#ifndef __OVERLAPMAPPING_HXX__
#define __OVERLAPMAPPING_HXX__
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "OverlapElementLocator.hxx"
#include <vector>
* 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<DataArrayInt> > _sent_src_ids;
+ map < int, MCAuto<DataArrayInt> > _sent_src_ids;
//! See _sent_src_ids. Same for target mesh.
- map < int, MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > _sent_trg_ids;
+ map < int, MCAuto<DataArrayInt> > _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. */
_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(); }
value[0]=34+13*((double)grank);
MEDCoupling::InterpKernelDEC dec(*source,*target);
- parafield->getField()->setNature(ConservativeVolumic);
+ parafield->getField()->setNature(IntensiveMaximum);
dec.setMethod("P0");
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);
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.;
}
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();
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.;
}
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();
MEDCouplingUMesh *init_quadGauthier1(int is_master)
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m(MEDCouplingUMesh::New("champ_quad",2));
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coo(DataArrayDouble::New());
+ MCAuto<MEDCouplingUMesh> m(MEDCouplingUMesh::New("champ_quad",2));
+ MCAuto<DataArrayDouble> 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};
MEDCouplingUMesh *init_triangleGauthier1(int is_master)
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m(MEDCouplingUMesh::New("champ_triangle",2));
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coo(DataArrayDouble::New());
+ MCAuto<MEDCouplingUMesh> m(MEDCouplingUMesh::New("champ_triangle",2));
+ MCAuto<DataArrayDouble> 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};
InterpKernelDEC dec_emetteur(emetteur_group, recepteur_group);
MEDCoupling::ParaFIELD *champ_emetteur(0),*champ_recepteur(0);
MEDCoupling::ParaMESH *paramesh(0);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh;
+ MCAuto<MEDCouplingUMesh> mesh;
dec_emetteur.setOrientation(2);
if (send==0)
{
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)
{
}
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")
{
if ( entree_chaude_group.containsMyRank())
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh(MEDCouplingUMesh::New("mesh",2));
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr(DataArrayDouble::New()); arr->alloc(63,3);
+ MCAuto<MEDCouplingUMesh> mesh(MEDCouplingUMesh::New("mesh",2));
+ MCAuto<DataArrayDouble> 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);
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<MEDCouplingFieldDouble> f(MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME));
+ MCAuto<MEDCouplingFieldDouble> 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);
}
else
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh(MEDCouplingUMesh::New("mesh",2));
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr(DataArrayDouble::New()); arr->alloc(22,3);
+ MCAuto<MEDCouplingUMesh> mesh(MEDCouplingUMesh::New("mesh",2));
+ MCAuto<DataArrayDouble> 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);
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<MEDCouplingFieldDouble> f(MEDCouplingFieldDouble::New(type==0?ON_CELLS:ON_NODES,ONE_TIME));
+ MCAuto<MEDCouplingFieldDouble> 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);
InterpKernelDEC& dec_emetteur=decu[0];
MEDCoupling::ParaFIELD *champ_emetteur(0),*champ_recepteur(0);
MEDCoupling::ParaMESH *paramesh(0);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh;
+ MCAuto<MEDCouplingUMesh> mesh;
dec_emetteur.setOrientation(2);
if (send==0)
{
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)
{
}
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")
{
//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");
MEDCouplingUMesh *init_quad()
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m(MEDCouplingUMesh::New("champ_quad",2));
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coo(DataArrayDouble::New());
+ MCAuto<MEDCouplingUMesh> m(MEDCouplingUMesh::New("champ_quad",2));
+ MCAuto<DataArrayDouble> 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());
MEDCouplingUMesh *init_triangle()
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m(MEDCouplingUMesh::New("champ_triangle",2));
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coo(DataArrayDouble::New());
+ MCAuto<MEDCouplingUMesh> m(MEDCouplingUMesh::New("champ_triangle",2));
+ MCAuto<DataArrayDouble> 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());
MEDCoupling::ParaMESH *paramesh(0);
if (cas=="emetteur")
{
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling::MEDCouplingUMesh> mesh_emetteur(init_triangle());
+ MCAuto<MEDCoupling::MEDCouplingUMesh> 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<MEDCoupling::MEDCouplingUMesh> mesh_recepteur(init_quad());
+ MCAuto<MEDCoupling::MEDCouplingUMesh> 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);
}
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.;
}
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);
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.;
}
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);
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);
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);
array->alloc(mcfield->getNumberOfTuples(),1);
mcfield->setArray(array);
array->decrRef();
- mcfield->setNature(ConservativeVolumic);
+ mcfield->setNature(IntensiveMaximum);
}
else
{
array->alloc(mcfield->getNumberOfTuples(),1);
mcfield->setArray(array);
array->decrRef();
- mcfield->setNature(ConservativeVolumic);
+ mcfield->setNature(IntensiveMaximum);
}
else
{
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);
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);
}
//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");
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");
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");
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");
}
//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");
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");
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");
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");
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.;
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);
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.; }
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())
}
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();
//
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();
//
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();
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);
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();
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
}
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);
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);
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);
using namespace std;
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "MEDLoader.hxx"
#include "MEDLoaderBase.hxx"
#include "MEDCouplingFieldDouble.hxx"
using namespace MEDCoupling;
-typedef MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> MUMesh;
-typedef MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> MFDouble;
-typedef MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> DADouble;
+typedef MCAuto<MEDCouplingUMesh> MUMesh;
+typedef MCAuto<MEDCouplingFieldDouble> MFDouble;
+typedef MCAuto<DataArrayDouble> DADouble;
//void ParaMEDMEMTest::testOverlapDEC_LMEC_seq()
//{
// 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.
// 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.;
// }
if(rank==0)
{
const double tr1[] = {1.5, 0.0};
- MEDCouplingUMesh *meshS_1 = static_cast<MEDCouplingUMesh*>(meshS_0->deepCpy());
+ MEDCouplingUMesh *meshS_1 = static_cast<MEDCouplingUMesh*>(meshS_0->deepCopy());
meshS_1->translate(tr1);
const double tr2[] = {3.0, 0.0};
- MEDCouplingUMesh *meshS_2 = static_cast<MEDCouplingUMesh*>(meshS_0->deepCpy());
+ MEDCouplingUMesh *meshS_2 = static_cast<MEDCouplingUMesh*>(meshS_0->deepCopy());
meshS_2->translate(tr2);
std::vector<const MEDCouplingUMesh*> vec;
//
const double tr3[] = {0.0, -1.5};
- MEDCouplingUMesh *meshT_3 = static_cast<MEDCouplingUMesh*>(meshT_0->deepCpy());
+ MEDCouplingUMesh *meshT_3 = static_cast<MEDCouplingUMesh*>(meshT_0->deepCopy());
meshT_3->translate(tr3);
vec.clear();
vec.push_back(meshT_0);vec.push_back(meshT_3);
if(rank==1)
{
const double tr3[] = {0.0, -1.5};
- MEDCouplingUMesh *meshS_3 = static_cast<MEDCouplingUMesh*>(meshS_0->deepCpy());
+ MEDCouplingUMesh *meshS_3 = static_cast<MEDCouplingUMesh*>(meshS_0->deepCopy());
meshS_3->translate(tr3);
const double tr4[] = {1.5, -1.5};
- MEDCouplingUMesh *meshS_4 = static_cast<MEDCouplingUMesh*>(meshS_0->deepCpy());
+ MEDCouplingUMesh *meshS_4 = static_cast<MEDCouplingUMesh*>(meshS_0->deepCopy());
meshS_4->translate(tr4);
std::vector<const MEDCouplingUMesh*> vec;
//
const double tr5[] = {1.5, 0.0};
- MEDCouplingUMesh *meshT_1 = static_cast<MEDCouplingUMesh*>(meshT_0->deepCpy());
+ MEDCouplingUMesh *meshT_1 = static_cast<MEDCouplingUMesh*>(meshT_0->deepCopy());
meshT_1->translate(tr5);
const double tr6[] = {3.0, 0.0};
- MEDCouplingUMesh *meshT_2 = static_cast<MEDCouplingUMesh*>(meshT_0->deepCpy());
+ MEDCouplingUMesh *meshT_2 = static_cast<MEDCouplingUMesh*>(meshT_0->deepCopy());
meshT_2->translate(tr6);
const double tr7[] = {1.5, -1.5};
- MEDCouplingUMesh *meshT_4 = static_cast<MEDCouplingUMesh*>(meshT_0->deepCpy());
+ MEDCouplingUMesh *meshT_4 = static_cast<MEDCouplingUMesh*>(meshT_0->deepCopy());
meshT_4->translate(tr7);
vec.clear();
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);
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);
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)
// {
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)
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)
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 = []
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)
#include "RENUMBER_BOOSTRenumbering.hxx"
#include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include <boost/config.hpp>
#include <boost/graph/adjacency_list.hpp>
void BOOSTRenumbering::renumber(const int *graph, const int *index_graph, int nbCell, MEDCoupling::DataArrayInt *&iperm, MEDCoupling::DataArrayInt *&perm)
{
- MEDCoupling::MEDCouplingAutoRefCountObjectPtr<MEDCoupling::DataArrayInt> out0(MEDCoupling::DataArrayInt::New()),out1(MEDCoupling::DataArrayInt::New());
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayInt> out0(MEDCoupling::DataArrayInt::New()),out1(MEDCoupling::DataArrayInt::New());
out0->alloc(nbCell,1); out1->alloc(nbCell,1);
out0->fillWithZero(); out1->fillWithZero();
//
}
#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<MEDCoupling::DataArrayInt> out0(MEDCoupling::DataArrayInt::New()),out1(MEDCoupling::DataArrayInt::New());
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayInt> out0(MEDCoupling::DataArrayInt::New()),out1(MEDCoupling::DataArrayInt::New());
out0->alloc(nbCell,1); out1->alloc(nbCell,1);
out0->fillWithZero(); out1->fillWithZero();
int num_flag=1;
}
// Reading file structure
cout << "Reading : " << flush;
- MEDCouplingAutoRefCountObjectPtr<MEDFileData> fd(MEDFileData::New(filename_in));
+ MCAuto<MEDFileData> fd(MEDFileData::New(filename_in));
MEDFileMesh *m=fd->getMeshes()->getMeshWithName(meshname);
MEDFileUMesh *mc=dynamic_cast<MEDFileUMesh *>(m);
if(!mc)
t_read_st=clock();
cout << (t_read_st-t_begin)/(double) CLOCKS_PER_SEC << "s" << endl << flush;
// Reading mesh
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> workMesh=mc->getMeshAtLevel(0);
+ MCAuto<MEDCouplingUMesh> workMesh=mc->getMeshAtLevel(0);
std::vector<int> code=workMesh->getDistributionOfTypes();
cout << "Building the graph : " << flush;
DataArrayInt *neighb=0,*neighbI=0;
workMesh->computeNeighborsOfCells(neighb,neighbI);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> neighbSafe(neighb),neighbISafe(neighbI),ipermSafe,permSafe;
+ MCAuto<DataArrayInt> neighbSafe(neighb),neighbISafe(neighbI),ipermSafe,permSafe;
const int *graph=neighbSafe->begin();
const int *graph_index=neighbISafe->begin();
// Compute permutation iperm->new2old perm->old2new
const DataArrayInt *famField=mc->getFamilyFieldAtLevel(0);
if(famField)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> famField2=famField->renumber(perm->begin());
+ MCAuto<DataArrayInt> famField2=famField->renumber(perm->begin());
mc->setFamilyFieldArr(0,famField2);
}
mc->write(filename_out,2);
%{
#include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "MEDCouplingDataArrayTypemaps.i"
#include "RenumberingFactory.hxx"
("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
]