mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-26 01:10:35 +05:00
PR: packaging: from salome.smesh import smeshBuilder
This commit is contained in:
parent
36cfe45a94
commit
1d673b7232
@ -64,7 +64,7 @@ fi
|
||||
|
||||
#CCRTif test -f ${SMESH_DIR}/bin/salome/libSMESH_Swig.py ; then
|
||||
#if test -f ${SMESH_DIR}/bin/salome/MED_Test ; then
|
||||
if test -f ${SMESH_DIR}/bin/salome/smesh.py ; then
|
||||
if test -f ${SMESH_DIR}/bin/salome/SMESH_test.py ; then
|
||||
SMesh_ok=yes
|
||||
AC_MSG_RESULT(Using SMesh module distribution in ${SMESH_DIR})
|
||||
|
||||
|
@ -27,10 +27,6 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am
|
||||
|
||||
# Scripts to be installed.
|
||||
dist_salomescript_PYTHON = \
|
||||
smesh.py \
|
||||
smeshDC.py \
|
||||
smesh_algorithm.py \
|
||||
StdMeshersDC.py \
|
||||
batchmode_smesh.py \
|
||||
batchmode_mefisto.py \
|
||||
ex00_all.py \
|
||||
@ -99,5 +95,16 @@ dist_salomescript_PYTHON = \
|
||||
PAL_MESH_043_3D.py \
|
||||
SMESH_reg.py
|
||||
|
||||
mypkgpythondir = $(salomepythondir)/salome/smesh
|
||||
mypkgpython_PYTHON = \
|
||||
smesh.py \
|
||||
smeshBuilder.py \
|
||||
smesh_algorithm.py
|
||||
|
||||
stdpkgpythondir = $(salomepythondir)/salome/StdMeshers
|
||||
stdpkgpython_PYTHON = \
|
||||
__init__.py \
|
||||
StdMeshersBuilder.py
|
||||
|
||||
sharedpkgpython_PYTHON = \
|
||||
SMESH_shared_modules.py
|
||||
|
1326
src/SMESH_SWIG/StdMeshersBuilder.py
Normal file
1326
src/SMESH_SWIG/StdMeshersBuilder.py
Normal file
File diff suppressed because it is too large
Load Diff
25
src/SMESH_SWIG/__init__.py
Normal file
25
src/SMESH_SWIG/__init__.py
Normal file
@ -0,0 +1,25 @@
|
||||
# -*- coding: iso-8859-1 -*-
|
||||
# Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
#
|
||||
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
# File : __init__.py
|
||||
# Package : StdMeshers
|
@ -32,34 +32,35 @@
|
||||
import salome
|
||||
from salome import *
|
||||
|
||||
import geompy
|
||||
from salome.geom import geompy
|
||||
import SMESH, SALOMEDS
|
||||
import smeshDC
|
||||
#from smeshDC import *
|
||||
from salome.smesh import smeshBuilder
|
||||
#from smeshBuilder import *
|
||||
|
||||
# retrieve SMESH engine in try/except block
|
||||
# to avoid problems in some cases, e.g. when generating documentation
|
||||
try:
|
||||
# get instance of class smeshDC
|
||||
# get instance of class smeshBuilder
|
||||
engineSmesh = salome.lcc.FindOrLoadComponent( "FactoryServer", "SMESH" )
|
||||
smesh = smeshDC.smeshInstance(salome.myStudy, engineSmesh)
|
||||
smesh = smeshBuilder.New(salome.myStudy, engineSmesh)
|
||||
except:
|
||||
smesh = None
|
||||
pass
|
||||
|
||||
# load plugins and add dynamically generated methods to Mesh class,
|
||||
# the same for for global variables declared by plug-ins
|
||||
from smeshDC import Mesh, algoCreator
|
||||
from smeshBuilder import Mesh, algoCreator
|
||||
for pluginName in os.environ[ "SMESH_MeshersList" ].split( ":" ):
|
||||
#
|
||||
pluginName += "DC"
|
||||
print "pluginName: ", pluginName
|
||||
pluginBuilderName = pluginName + "Builder"
|
||||
try:
|
||||
exec( "from %s import *" % pluginName )
|
||||
exec( "from salome.%s.%s import *" % (pluginName, pluginBuilderName))
|
||||
except Exception, e:
|
||||
print "Exception while loading %s: %s" % ( pluginName, e )
|
||||
print "Exception while loading %s: %s" % ( pluginBuilderName, e )
|
||||
continue
|
||||
exec( "import %s" % pluginName )
|
||||
plugin = eval( pluginName )
|
||||
exec( "from salome.%s import %s" % (pluginName, pluginBuilderName))
|
||||
plugin = eval( pluginBuilderName )
|
||||
|
||||
# add methods creating algorithms to Mesh
|
||||
for k in dir( plugin ):
|
||||
@ -75,7 +76,7 @@ for pluginName in os.environ[ "SMESH_MeshersList" ].split( ":" ):
|
||||
pass
|
||||
del pluginName
|
||||
|
||||
# export the methods of smeshDC
|
||||
# export the methods of smeshBuilder
|
||||
if smesh:
|
||||
for k in dir( smesh ):
|
||||
if k[0] == '_': continue
|
||||
@ -100,12 +101,13 @@ smesh.SetCurrentStudy(theStudy) |
|
||||
with |
|
||||
---- |
|
||||
|
|
||||
import smeshDC, SMESH, SALOMEDS |
|
||||
smesh = smeshDC.smeshInstance(theStudy) |
|
||||
import SMESH, SALOMEDS |
|
||||
from salome.smesh import smeshBuilder |
|
||||
smesh = smeshBuilder.New(theStudy) |
|
||||
|
|
||||
you also need to modify some lines where smeshDC is used instead of smesh: |
|
||||
you also need to modify some lines where smeshBuilder is used instead of smesh|
|
||||
|
|
||||
algo=smesh.xxxx ==> algo.smeshDC.xxxx |
|
||||
algo=smesh.xxxx ==> algo.smeshBuilder.xxxx |
|
||||
|
|
||||
===============================================================================
|
||||
"""
|
||||
|
4405
src/SMESH_SWIG/smeshBuilder.py
Normal file
4405
src/SMESH_SWIG/smeshBuilder.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -22,7 +22,7 @@
|
||||
# This package is a part of SALOME %Mesh module Python API
|
||||
|
||||
import salome
|
||||
import geompyDC
|
||||
from salome.geom import geomBuilder
|
||||
import SMESH
|
||||
|
||||
## The base class to define meshing algorithms
|
||||
@ -166,7 +166,7 @@ class Mesh_Algorithm:
|
||||
|
||||
## Gets the name of the algorithm
|
||||
def GetName(self):
|
||||
from smeshDC import GetName
|
||||
from salome.smesh.smeshBuilder import GetName
|
||||
return GetName(self.algo)
|
||||
|
||||
## Sets the name to the algorithm
|
||||
@ -190,7 +190,7 @@ class Mesh_Algorithm:
|
||||
|
||||
## Private method
|
||||
def Assign(self, algo, mesh, geom):
|
||||
from smeshDC import AssureGeomPublished, TreatHypoStatus, GetName
|
||||
from salome.smesh.smeshBuilder import AssureGeomPublished, TreatHypoStatus, GetName
|
||||
if geom is None:
|
||||
raise RuntimeError, "Attemp to create " + algo + " algoritm on None shape"
|
||||
self.mesh = mesh
|
||||
@ -221,7 +221,7 @@ class Mesh_Algorithm:
|
||||
## Private method
|
||||
def Hypothesis (self, hyp, args=[], so="libStdMeshersEngine.so",
|
||||
UseExisting=0, CompareMethod=""):
|
||||
from smeshDC import TreatHypoStatus, GetName
|
||||
from salome.smesh.smeshBuilder import TreatHypoStatus, GetName
|
||||
hypo = None
|
||||
if UseExisting:
|
||||
if CompareMethod == "": CompareMethod = self.CompareHyp
|
||||
@ -233,7 +233,7 @@ class Mesh_Algorithm:
|
||||
s = "="
|
||||
for arg in args:
|
||||
argStr = str(arg)
|
||||
if isinstance( arg, geompyDC.GEOM._objref_GEOM_Object ):
|
||||
if isinstance( arg, geomBuilder.GEOM._objref_GEOM_Object ):
|
||||
argStr = arg.GetStudyEntry()
|
||||
if not argStr: argStr = "GEOM_Obj_%s", arg.GetEntry()
|
||||
if len( argStr ) > 10:
|
||||
@ -273,7 +273,7 @@ class Mesh_Algorithm:
|
||||
raise TypeError, "ViscousLayers are supported by 3D algorithms only"
|
||||
if not "ViscousLayers" in self.GetCompatibleHypothesis():
|
||||
raise TypeError, "ViscousLayers are not supported by %s"%self.algo.GetName()
|
||||
if ignoreFaces and isinstance( ignoreFaces[0], geompyDC.GEOM._objref_GEOM_Object ):
|
||||
if ignoreFaces and isinstance( ignoreFaces[0], geomBuilder.GEOM._objref_GEOM_Object ):
|
||||
ignoreFaces = [ self.mesh.geompyD.GetSubShapeID(self.mesh.geom, f) for f in ignoreFaces ]
|
||||
hyp = self.Hypothesis("ViscousLayers",
|
||||
[thickness, numberOfLayers, stretchFactor, ignoreFaces])
|
||||
@ -296,7 +296,7 @@ class Mesh_Algorithm:
|
||||
raise TypeError, "ViscousLayers2D are supported by 2D algorithms only"
|
||||
if not "ViscousLayers2D" in self.GetCompatibleHypothesis():
|
||||
raise TypeError, "ViscousLayers2D are not supported by %s"%self.algo.GetName()
|
||||
if ignoreEdges and isinstance( ignoreEdges[0], geompyDC.GEOM._objref_GEOM_Object ):
|
||||
if ignoreEdges and isinstance( ignoreEdges[0], geomBuilder.GEOM._objref_GEOM_Object ):
|
||||
ignoreEdges = [ self.mesh.geompyD.GetSubShapeID(self.mesh.geom, f) for f in ignoreEdges ]
|
||||
hyp = self.Hypothesis("ViscousLayers2D",
|
||||
[thickness, numberOfLayers, stretchFactor, ignoreEdges])
|
||||
@ -310,30 +310,30 @@ class Mesh_Algorithm:
|
||||
# into a list acceptable to SetReversedEdges() of some 1D hypotheses
|
||||
# @ingroup l3_hypos_1dhyps
|
||||
def ReversedEdgeIndices(self, reverseList):
|
||||
from smeshDC import FirstVertexOnCurve
|
||||
from salome.smesh.smeshBuilder import FirstVertexOnCurve
|
||||
resList = []
|
||||
geompy = self.mesh.geompyD
|
||||
for i in reverseList:
|
||||
if isinstance( i, int ):
|
||||
s = geompy.SubShapes(self.mesh.geom, [i])[0]
|
||||
if s.GetShapeType() != geompyDC.GEOM.EDGE:
|
||||
if s.GetShapeType() != geomBuilder.GEOM.EDGE:
|
||||
raise TypeError, "Not EDGE index given"
|
||||
resList.append( i )
|
||||
elif isinstance( i, geompyDC.GEOM._objref_GEOM_Object ):
|
||||
if i.GetShapeType() != geompyDC.GEOM.EDGE:
|
||||
elif isinstance( i, geomBuilder.GEOM._objref_GEOM_Object ):
|
||||
if i.GetShapeType() != geomBuilder.GEOM.EDGE:
|
||||
raise TypeError, "Not an EDGE given"
|
||||
resList.append( geompy.GetSubShapeID(self.mesh.geom, i ))
|
||||
elif len( i ) > 1:
|
||||
e = i[0]
|
||||
v = i[1]
|
||||
if not isinstance( e, geompyDC.GEOM._objref_GEOM_Object ) or \
|
||||
not isinstance( v, geompyDC.GEOM._objref_GEOM_Object ):
|
||||
if not isinstance( e, geomBuilder.GEOM._objref_GEOM_Object ) or \
|
||||
not isinstance( v, geomBuilder.GEOM._objref_GEOM_Object ):
|
||||
raise TypeError, "A list item must be a tuple (edge, 1st_vertex_of_edge)"
|
||||
if v.GetShapeType() == geompyDC.GEOM.EDGE and \
|
||||
e.GetShapeType() == geompyDC.GEOM.VERTEX:
|
||||
if v.GetShapeType() == geomBuilder.GEOM.EDGE and \
|
||||
e.GetShapeType() == geomBuilder.GEOM.VERTEX:
|
||||
v,e = e,v
|
||||
if e.GetShapeType() != geompyDC.GEOM.EDGE or \
|
||||
v.GetShapeType() != geompyDC.GEOM.VERTEX:
|
||||
if e.GetShapeType() != geomBuilder.GEOM.EDGE or \
|
||||
v.GetShapeType() != geomBuilder.GEOM.VERTEX:
|
||||
raise TypeError, "A list item must be a tuple (edge, 1st_vertex_of_edge)"
|
||||
vFirst = FirstVertexOnCurve( e )
|
||||
tol = geompy.Tolerance( vFirst )[-1]
|
||||
|
Loading…
Reference in New Issue
Block a user