# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2015 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2016 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
fileName = "testExample_MEDCouplingFieldDouble_WriteVTK"
fs = [ field1, field2, field3 ] # field series
writtenFileName=MEDCouplingFieldDouble.WriteVTK( fileName, fs )
- print "The file name with correct extension is : %s"%(writtenFileName)
+ print("The file name with correct extension is : %s"%(writtenFileName))
#! [PySnippet_MEDCouplingFieldDouble_WriteVTK_1]
import os
os.remove( writtenFileName )
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.]
#! [Snippet_DataArrayInt_getTuple_1]
#! [Snippet_DataArrayInt_getTuple_2]
for tpl in dv:
- print tpl
+ print(tpl)
#! [Snippet_DataArrayInt_getTuple_2]
return
da.setValues(arr1,6,1)
da2=da.invertArrayO2N2N2O(6)
expected1=[1,3,0,5,2,4]
- for i in xrange(6):
+ for i in range(6):
self.assertEqual(expected1[i],da2.getIJ(i,0))
pass
#! [PySnippet_DataArrayInt_invertArrayO2N2N2O_1]
da.setValues(arr1,6,1)
da2=da.invertArrayN2O2O2N(7)
expected1=[1,3,0,5,2,4,-1]
- for i in xrange(6):
+ for i in range(6):
self.assertEqual(expected1[i],da2.getIJ(i,0))
pass
#! [PySnippet_DataArrayInt_invertArrayN2O2O2N_1]
#! [PySnippet_DataArrayDouble_getIdsInRange_1]
da=DataArrayDouble()
da.alloc( 10, 1 )
- da[ :, :] = range(10)
- da2 = da.getIdsInRange( 2.5, 6 )
+ da[ :, :] = list(range(10))
+ 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]
dv=da.getDifferentValues(2e-1)
expected2=[2.301,1.3,0.8]
self.assertEqual(3,dv.getNbOfElems())
- for i in xrange(3):
+ for i in range(3):
self.assertAlmostEqual(expected2[i],dv.getIJ(i,0),14)
pass
#! [Snippet_DataArrayDouble_getDifferentValues1]
da3.setInfoOnComponent(1,"c1da3")
da3.setInfoOnComponent(2,"c2da3")
#
- da1C=da1.deepCpy()
+ da1C=da1.deepCopy()
da1.meldWith(da3)
#! [PySnippet_DataArrayDouble_Meld1_1]
self.assertEqual(3,f2.getNumberOfTuples())
self.assertEqual(2,f2.getNumberOfComponents())
expected1=[5.,105.,4.,104.,7.,107.]
- for i in xrange(6):
+ for i in range(6):
self.assertAlmostEqual(f2.getIJ(0,i),expected1[i],12)
pass
self.assertEqual(3,f2.getMesh().getNumberOfCells())
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):
+ for i in range(12):
self.assertAlmostEqual(expected2[i],m2C.getCoords().getIJ(0,i),12)
pass
expected3=[3,2,3,1,3,0,2,1,4,4,5,3,2]
self.assertEqual(4,f2.getNumberOfTuples())
self.assertEqual(2,f2.getNumberOfComponents())
expected5=[4.,104.,5.,105.,7.,107.,8.,108.]
- for i in xrange(8):
+ for i in range(8):
self.assertAlmostEqual(f2.getIJ(0,i),expected5[i],12)
pass
self.assertEqual(2,f2.getMesh().getNumberOfCells())
self.assertEqual(2,f2.getMesh().getSpaceDimension())
self.assertEqual(2,f2.getMesh().getMeshDimension())
m2C=f2.getMesh()
- self.assertEqual(8,m2C.getMeshLength())
- for i in xrange(8):#8 is not an error
+ self.assertEqual(8,m2C.getNodalConnectivityArrayLen())
+ for i in range(8): # 8 is not an error
self.assertAlmostEqual(expected2[i],m2C.getCoords().getIJ(0,i),12)
pass
self.assertEqual(expected3[:4],[int(i) for i in m2C.getNodalConnectivity()][4:])
f2=f1.buildSubPart(arrr)
self.assertEqual(4,f2.getNumberOfTuples())
self.assertEqual(2,f2.getNumberOfComponents())
- for i in xrange(8):
+ for i in range(8):
self.assertAlmostEqual(f2.getIJ(0,i),expected5[i],12)
pass
self.assertEqual(2,f2.getMesh().getNumberOfCells())
self.assertEqual(2,f2.getMesh().getSpaceDimension())
self.assertEqual(2,f2.getMesh().getMeshDimension())
m2C=f2.getMesh()
- self.assertEqual(8,m2C.getMeshLength())
- for i in xrange(8):#8 is not an error
+ self.assertEqual(8,m2C.getNodalConnectivityArrayLen())
+ for i in range(8): # 8 is not an error
self.assertAlmostEqual(expected2[i],m2C.getCoords().getIJ(0,i),12)
pass
self.assertEqual(expected3[:4],[int(i) for i in m2C.getNodalConnectivity()][4:8])
self.assertEqual(6,f2.getNumberOfTuples())
self.assertEqual(2,f2.getNumberOfComponents())
expected6=[4.,104.,5.,105.,7.,107.,8.,108.,10.,110.,11.,111.]
- for i in xrange(12):
+ for i in range(12):
self.assertAlmostEqual(f2.getIJ(0,i),expected6[i],12)
pass
self.assertEqual(3,f2.getMesh().getNumberOfCells())
self.assertEqual(2,f2.getMesh().getSpaceDimension())
self.assertEqual(2,f2.getMesh().getMeshDimension())
m2C=f2.getMesh()
- self.assertEqual(13,m2C.getMeshLength())
- for i in xrange(12):
+ self.assertEqual(13,m2C.getNodalConnectivityArrayLen())
+ for i in range(12):
self.assertAlmostEqual(expected2[i],m2C.getCoords().getIJ(0,i),12)
pass
self.assertEqual(expected3[0:4],m2C.getNodalConnectivity().getValues()[4:8])
# ! [PySnippetUMeshStdBuild1_4]
# ! [PySnippetUMeshStdBuild1_5]
# ! [PySnippetUMeshStdBuild1_5]
- mesh.checkCoherency()
+ mesh.checkConsistencyLight()
return
def testExampleCMeshStdBuild1(self):
self.assertEqual(9*7,mesh.getNumberOfNodes())
self.assertEqual(2,mesh.getSpaceDimension())
self.assertEqual(2,mesh.getMeshDimension())
+# ! [PySnippetCMeshStdBuild1_4]
+# ! [PySnippetCMeshStdBuild1_4]
return
def testExampleUMeshAdvBuild1(self):
# ! [PySnippetUMeshAdvBuild1_4]
# ! [PySnippetUMeshAdvBuild1_5]
# ! [PySnippetUMeshAdvBuild1_5]
- mesh.checkCoherency()
+ mesh.checkConsistencyLight()
return
def testExampleDataArrayBuild1(self):
fieldOnCells.setName("MyTensorFieldOnCellNoTime")
fieldOnCells.setMesh(mesh)
array=DataArrayDouble()
- array.alloc(fieldOnCells.getMesh().getNumberOfCells(),9) # Implicitely fieldOnCells will be a 9 components field.
+ array.alloc(fieldOnCells.getMesh().getNumberOfCells(),9) # Implicitly fieldOnCells will be a 9 components field.
array.fillWithValue(7.)
fieldOnCells.setArray(array)
# fieldOnCells is now usable
fieldOnNodes.setName("MyScalarFieldOnNodeNoTime")
fieldOnNodes.setMesh(mesh)
array=DataArrayDouble()
- array.alloc(fieldOnNodes.getMesh().getNumberOfNodes(),1) # Implicitely fieldOnNodes will be a 1 component field.
+ array.alloc(fieldOnNodes.getMesh().getNumberOfNodes(),1) # Implicitly fieldOnNodes will be a 1 component field.
array.fillWithValue(7.)
fieldOnNodes.setArray(array)
# fieldOnNodes is now usable
fieldOnCells.setTime(4.22,2,-1) # Time attached is 4.22 ms, iteration id is 2 and order id (or sub iteration id) is -1
fieldOnCells.setMesh(mesh)
array=DataArrayDouble()
- array.alloc(fieldOnCells.getMesh().getNumberOfCells(),2) # Implicitely fieldOnCells will be a 2 components field.
+ array.alloc(fieldOnCells.getMesh().getNumberOfCells(),2) # Implicitly fieldOnCells will be a 2 components field.
array.fillWithValue(7.)
fieldOnCells.setArray(array)
# fieldOnCells is now usable
fieldOnNodes.setEndTime(6.44,4,-1)# fieldOnNodes is defined in interval [4.22 ms,6.44 ms]
fieldOnNodes.setMesh(mesh)
array=DataArrayDouble()
- array.alloc(fieldOnNodes.getMesh().getNumberOfNodes(),3) # Implicitely fieldOnNodes will be a 3 components field.
+ array.alloc(fieldOnNodes.getMesh().getNumberOfNodes(),3) # Implicitly fieldOnNodes will be a 3 components field.
array.fillWithValue(7.)
fieldOnNodes.setArray(array)
# fieldOnNodes is now usable
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