# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2016 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2019 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
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-from MEDCoupling import *
+
+import sys
+if sys.platform == "win32":
+ from MEDCouplingCompat import *
+else:
+ from medcoupling import *
from math import pi, sqrt
# ! [PySnippetUMeshStdBuild1_1]
mesh.setCoords(arrX,arrY)
# ! [PySnippetCMeshStdBuild1_2]
-nodalConnPerCell=range(4*4)
+nodalConnPerCell=list(range(4*4))
# ! [GU_MEDCoupling1SGTUMesh_0]
mesh=MEDCoupling1SGTUMesh("myQuadMesh",NORM_QUAD4)
mesh.allocateCells(3)
from MEDCouplingDataForTest import MEDCouplingDataForTest
m=MEDCouplingDataForTest.build2DTargetMesh_1();
-Ids=range(1,3)
+Ids=list(range(1,3))
#! [UG_ExtractForMeshes_0]
part=m[Ids]
#! [UG_ExtractForMeshes_0]
#! [UG_ExtractForMeshes_20]
# make a structured mesh 1x5
-coords=DataArrayDouble(range(6))
+coords=DataArrayDouble(list(range(6)))
cmesh=MEDCouplingCMesh("cmesh")
cmesh.setCoords(coords,coords[:2])
print([ ids.getValues() for ids in zoneArrays])
#! [UG_ExtractForMeshes_20]
-coordsArr=DataArrayDouble(range(6))
+coordsArr=DataArrayDouble(list(range(6)))
mesh2d=MEDCouplingCMesh("mesh2d")
mesh2d.setCoords(coordsArr,coordsArr[:2])
mesh2d=mesh2d.buildUnstructured()
tupleIds2 = DataArrayInt.buildSubstraction(tupleIds,tupleIds1)
#! [UG_ExtractForArrays_2]
-valsArr1=DataArrayDouble(range(9*2),9,2)
+valsArr1=DataArrayDouble(list(range(9*2)),9,2)
field4 = MEDCouplingFieldDouble(ON_NODES)
field4.setArray(valsArr1)
mesh=MEDCouplingCMesh("My2D_CMesh")
#! [UG_ExtractForFields_0]
m4=MEDCouplingCMesh("box")
-coo=DataArrayDouble(range(7))
+coo=DataArrayDouble(list(range(7)))
m4.setCoords(coo[:5],coo[:5],coo)
m4=m4.buildUnstructured()
valsArr1=m4.computeCellCenterOfMass()
rem.prepare(src,tgt,"P0P0")
print(rem.getCrudeMatrix())
#! [UG_Projection_10]
-
-from MEDCouplingDataForTest import MEDCouplingDataForTest
-m=MEDCouplingDataForTest.build2DTargetMesh_1();
-#! [UG_Optimization_0]
-from MEDRenumber import RenumberingFactory
-ren=RenumberingFactory("BOOST")
-a,b=m.computeNeighborsOfCells()
-n2o,_=ren.renumber(a,b)
-mrenum=m[n2o]
-#! [UG_Optimization_0]
-
-#! [UG_Optimization_1]
-from MEDCoupling import MEDCouplingSkyLineArray
-import MEDPartitioner
-# prepare a MEDPartitioner
-a,b=m.computeNeighborsOfCells()
-sk=MEDCouplingSkyLineArray(b,a)
-g=MEDPartitioner.MEDPartitioner.Graph(sk)
-# compute partitioning into 4 parts
-g.partGraph(4)
-# get the 1st of parts of m
-procIdOnCells=g.getPartition().getValuesArray()
-p0=procIdOnCells.findIdsEqual(0)
-part0=m[p0]
-#! [UG_Optimization_1]
-#! [UG_Optimization_2]
-boundary_nodes_part0=part0.findBoundaryNodes()
-boundary_cells_part0=p0[part0.getCellIdsLyingOnNodes(boundary_nodes_part0,False)]
-# starting from knowledge of neighborhood it s possible to know the neighbors of boundary_cells_part0
-neighbors_boundary_cells_part0=MEDCouplingUMesh.ExtractFromIndexedArrays(boundary_cells_part0,a,b)[0]
-neighbors_boundary_cells_part0.sort()
-neighbors_boundary_cells_part0=neighbors_boundary_cells_part0.buildUnique()
-#
-layer_of_part0=neighbors_boundary_cells_part0.buildSubstraction(p0)
-#
-whole_part_with_layer=DataArrayInt.Aggregate([p0,layer_of_part0])
-whole_part_with_layer.sort()
-part0_with_layer=m[whole_part_with_layer]
-#! [UG_Optimization_2]
-