From 0ea819f668358b930407f65c7b2c519fc0f84f0d Mon Sep 17 00:00:00 2001 From: prascle Date: Fri, 12 Apr 2013 16:27:32 +0000 Subject: [PATCH] PR: doc on script migration --- .../gui/SMESH/input/smesh_migration.doc | 105 ++++++++++++++++++ .../gui/SMESH/input/smeshpy_interface.doc | 4 + 2 files changed, 109 insertions(+) create mode 100644 doc/salome/gui/SMESH/input/smesh_migration.doc diff --git a/doc/salome/gui/SMESH/input/smesh_migration.doc b/doc/salome/gui/SMESH/input/smesh_migration.doc new file mode 100644 index 000000000..47b0f1c33 --- /dev/null +++ b/doc/salome/gui/SMESH/input/smesh_migration.doc @@ -0,0 +1,105 @@ +/*! + +\page smesh_migration_page Modifing Python scripts from SALOME 6 and before + +\n With SALOME 7.2, the Python interface for %Mesh has been slightly modified to offer new functionality: + + + +\n Scripts generated for SALOME 6 and older versions must be adapted to work in SALOME 7.2 with all functionality. +\n A compatibility mode allows old scripts to work in almost all cases, but with a warning. + +TODO: see geometry migration + +Salome initialisation must always be done as shown below +\n (salome_init() can be invoked safely several times): +\code +import salome +salome.salome_init() +\endcode + +smesh initialisation is modified. +\n old mode (from dump): +\code +import smesh, SMESH, SALOMEDS +smesh.SetCurrentStudy(theStudy) +\endcode +new mode: +\code +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +\endcode + + + Of course, from smesh import * is no more possible. +\n You have to explicitely write smesh.some_method(). + +algorithms are no longer in the namespace smesh but in smeshBuilder. +\n For instance: +\code +MEFISTO_2D_1 = Mesh_1.Triangle(algo=smesh.MEFISTO,geom=Face_1) +\endcode +is replaced by: +\code +MEFISTO_2D_1 = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO,geom=Face_1) +\endcode +\n StdMeshers algoritms concerned are REGULAR, PYTHON, COMPOSITE, MEFISTO, Hexa, QUADRANGLE, RADIAL_QUAD. +\n SMESH Plugins provides algorithms such as: NETGEN, NETGEN_FULL, FULL_NETGEN, NETGEN_1D2D3D, NETGEN_1D2D, NETGEN_2D, NETGEN_3D. +\n If you use DISTENE plugins, you also have BLSURF, GHS3D, GHS3DPRL, Hexotic. + +Some variables where at the same time in namespaces smesh and SMESH. +They are now only in namespace SMESH.. +\n The dump function was already using the namespace SMESH, +so, if your script was built with the help of dump function, it should be already OK for that part. + +The more used variables concerned are: +\n NODE, EDGE, FACE, VOLUME, ALL. +\n FT_xxx, geom_xxx, ADD_xxx... + +\n For instance: +\code +srcFaceGroup = srcMesh.GroupOnGeom( midFace0, "src faces", smesh.FACE ) +mesh.MakeGroup("Tetras",smesh.VOLUME,smesh.FT_ElemGeomType,"=",smesh.Geom_TETRA) +filter = smesh.GetFilter(smesh.FACE, smesh.FT_AspectRatio, smesh.FT_MoreThan, 6.5) +\endcode +is replaced by: +\code +srcFaceGroup = srcMesh.GroupOnGeom( midFace0, "src faces", SMESH.FACE ) +mesh.MakeGroup("Tetras",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_TETRA) +filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_AspectRatio, SMESH.FT_MoreThan, 6.5) +\endcode + + +The namespace smesh.smesh does not exist any more, use smesh instead. +\n For instance: +\code +Compound1 = smesh.smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 0, 1, 1e-05) +\endcode +is replaced by: +\code +Compound1 = smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 0, 1, 1e-05) +\endcode + +If you need to import explicitely an %SMESH Plugin, they are now in separate namespaces. +\n For instance: +\code +import StdMeshers +import NETGENPlugin +import BLSURFPlugin +import GHS3DPlugin +import HexoticPLUGIN +\endcode +is replaced by: +\code +from salome.StdMeshers import StdMeshersBuilder +from salome.NETGENPlugin import NETGENPluginBuilder +from salome.BLSURFPlugin import BLSURFPluginBuilder +from salomeGHS3DPlugin .import GHS3DPluginBuilder +from salome.HexoticPLUGIN import HexoticPLUGINBuilder +\endcode + +*/ diff --git a/doc/salome/gui/SMESH/input/smeshpy_interface.doc b/doc/salome/gui/SMESH/input/smeshpy_interface.doc index 9e77d970c..583eb1a8f 100644 --- a/doc/salome/gui/SMESH/input/smeshpy_interface.doc +++ b/doc/salome/gui/SMESH/input/smeshpy_interface.doc @@ -11,6 +11,10 @@ classes are grouped by their functionality, like it is done in the GUI documenta - Linear documentation grouped only by classes, declared in the \ref smeshBuilder and \ref StdMeshersBuilder Python packages. +\n With SALOME 7.2, the Python interface for %Mesh has been slightly modified to offer new functionality, +\n You may have to modify your scripts generated with SALOME 6 or older versions. +\n Please see
  • \ref smesh_migration_page
  • + Class \ref smeshBuilder.smeshBuilder "smeshBuilder" provides an interface to create and handle meshes. It can be used to create an empty mesh or to import mesh from the data file.