mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-27 20:20:33 +05:00
New updated and tested smesh.py with some examples. Provided by FKL.
This commit is contained in:
parent
d6439e67b4
commit
4ea1b27c68
@ -39,22 +39,29 @@ LIB_SRC =
|
||||
|
||||
SWIG_DEF = libSMESH_Swig.i
|
||||
EXPORT_PYSCRIPTS = libSMESH_Swig.py \
|
||||
meshpy.py \
|
||||
smesh.py \
|
||||
batchmode_smesh.py \
|
||||
batchmode_mefisto.py \
|
||||
cube2pyGibi.py \
|
||||
cube2geometry.py \
|
||||
cube2partition.py \
|
||||
grid4pyGibi.py \
|
||||
grid4partition.py \
|
||||
grid3partition.py \
|
||||
grid17partition.py \
|
||||
hole1geometry.py \
|
||||
hole1partition.py \
|
||||
hole1pyGibi.py \
|
||||
hole2pyGibi.py \
|
||||
cyl2geometry.py \
|
||||
cyl2complementary.py \
|
||||
ex00_all.py \
|
||||
ex01_cube2build.py \
|
||||
ex02_cube2primitive.py \
|
||||
ex03_cube2partition.py \
|
||||
ex04_cube5tetraHexa.py \
|
||||
ex05_hole1build.py \
|
||||
ex06_hole1boolean.py \
|
||||
ex07_hole1partition.py \
|
||||
ex08_hole2build.py \
|
||||
ex09_grid4build.py \
|
||||
ex10_grid4geometry.py \
|
||||
ex11_grid3partition.py \
|
||||
ex12_grid17partition.py \
|
||||
ex13_hole1partial.py \
|
||||
ex14_cyl1holed.py \
|
||||
ex15_cyl2geometry.py \
|
||||
ex16_cyl2complementary.py \
|
||||
ex17_dome1.py \
|
||||
ex18_dome2.py \
|
||||
ex19_sphereINcube.py \
|
||||
SMESH_test.py\
|
||||
SMESH_test0.py\
|
||||
SMESH_test1.py \
|
||||
|
@ -29,7 +29,7 @@
|
||||
from geompy import *
|
||||
from math import *
|
||||
|
||||
from meshpy import *
|
||||
import smesh
|
||||
|
||||
# It is an example of creating a hexahedrical mesh on a sphere.
|
||||
#
|
||||
@ -103,5 +103,9 @@ Id_Result = addToStudy(Result, "Result")
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
#Meshing
|
||||
my_hexa = MeshHexa(Result, NbSeg, "Sphere_Mesh")
|
||||
my_hexa = smesh.Mesh(Result, "Sphere_Mesh")
|
||||
algo = my_hexa.Segment()
|
||||
algo.NumberOfSegments(NbSeg)
|
||||
my_hexa.Quadrangle()
|
||||
my_hexa.Hexahedron()
|
||||
my_hexa.Compute()
|
||||
|
@ -1,92 +0,0 @@
|
||||
# CEA/LGLS 2004, Francis KLOSS (OCC)
|
||||
# ==================================
|
||||
|
||||
# Import
|
||||
# ------
|
||||
|
||||
from geompy import *
|
||||
from meshpy import *
|
||||
|
||||
# Geometry
|
||||
# ========
|
||||
|
||||
# Piece
|
||||
# -----
|
||||
|
||||
# A small cube centered and put on a great cube
|
||||
|
||||
ox = 0
|
||||
oy = 0
|
||||
oz = 0
|
||||
|
||||
arete = 10
|
||||
|
||||
# Points
|
||||
# ------
|
||||
|
||||
blockPoint111 = MakeVertex(ox , oy, oz)
|
||||
blockPoint211 = MakeVertex(ox+arete, oy, oz)
|
||||
blockPoint112 = MakeVertex(ox , oy, oz+arete)
|
||||
blockPoint212 = MakeVertex(ox+arete, oy, oz+arete)
|
||||
|
||||
# Faces
|
||||
# -----
|
||||
|
||||
blockFace1 = MakeQuad4Vertices(blockPoint111, blockPoint211, blockPoint212, blockPoint112)
|
||||
|
||||
# Solids
|
||||
# ------
|
||||
|
||||
blockSolid11 = MakePrismVecH(blockFace1, MakeVectorDXDYDZ(0, 1, 0), arete)
|
||||
|
||||
# Translations
|
||||
# ------------
|
||||
|
||||
blockSolid21 = MakeTranslation(blockSolid11, arete, 0, 0)
|
||||
blockSolid31 = MakeTranslation(blockSolid21, arete, 0, 0)
|
||||
|
||||
blockSolid12 = MakeTranslation(blockSolid11, 0, 0, arete)
|
||||
blockSolid22 = MakeTranslation(blockSolid12, arete, 0, 0)
|
||||
blockSolid32 = MakeTranslation(blockSolid22, arete, 0, 0)
|
||||
|
||||
blockSolid13 = MakeTranslation(blockSolid12, 0, 0, arete)
|
||||
blockSolid23 = MakeTranslation(blockSolid13, arete, 0, 0)
|
||||
blockSolid33 = MakeTranslation(blockSolid23, arete, 0, 0)
|
||||
|
||||
blockSolid111 = MakeTranslation(blockSolid22, 0, arete, 0)
|
||||
|
||||
# Compound
|
||||
# --------
|
||||
|
||||
c_l = []
|
||||
c_l.append(blockSolid11)
|
||||
c_l.append(blockSolid21)
|
||||
c_l.append(blockSolid31)
|
||||
c_l.append(blockSolid12)
|
||||
c_l.append(blockSolid22)
|
||||
c_l.append(blockSolid32)
|
||||
c_l.append(blockSolid13)
|
||||
c_l.append(blockSolid23)
|
||||
c_l.append(blockSolid33)
|
||||
c_l.append(blockSolid111)
|
||||
|
||||
c_cpd = MakeCompound(c_l)
|
||||
piece = MakeGlueFaces(c_cpd, 1.e-5)
|
||||
|
||||
# Add in study
|
||||
# ------------
|
||||
|
||||
piece_id = addToStudy(piece, "Cubes2geometry")
|
||||
|
||||
# Meshing
|
||||
# =======
|
||||
|
||||
# Create hexahedrical mesh on piece
|
||||
# ---------------------------------
|
||||
|
||||
m_hexa=MeshHexa(piece, 4, "Cubes2geometryHexa")
|
||||
|
||||
# Compute
|
||||
# -------
|
||||
|
||||
m_hexa.Compute()
|
@ -1,83 +0,0 @@
|
||||
# CEA/LGLS 2004, Francis KLOSS (OCC)
|
||||
# ==================================
|
||||
|
||||
# Import
|
||||
# ------
|
||||
|
||||
from geompy import *
|
||||
from meshpy import *
|
||||
|
||||
# Piece
|
||||
# -----
|
||||
|
||||
# A small cube centered and put on a great cube
|
||||
|
||||
# Geometry
|
||||
# --------
|
||||
|
||||
g_ox = 0
|
||||
g_oy = 0
|
||||
g_oz = 0
|
||||
|
||||
g_arete = 10
|
||||
|
||||
g_trim = 1000
|
||||
|
||||
# Points
|
||||
# ------
|
||||
|
||||
v_arete2 = g_arete*2
|
||||
v_arete3 = g_arete*3
|
||||
|
||||
v_1 = MakeVertex(g_ox , g_oy , g_oz )
|
||||
v_2 = MakeVertex(g_ox+v_arete3, g_oy+g_arete , g_oz+v_arete3)
|
||||
|
||||
v_3 = MakeVertex(g_ox+g_arete , g_oy+g_arete , g_oz+g_arete )
|
||||
v_4 = MakeVertex(g_ox+v_arete2, g_oy+v_arete2, g_oz+v_arete2)
|
||||
|
||||
# Solids
|
||||
# ------
|
||||
|
||||
s_base = MakeBoxTwoPnt(v_1, v_2)
|
||||
s_haut = MakeBoxTwoPnt(v_3, v_4)
|
||||
|
||||
# Partition
|
||||
# ---------
|
||||
|
||||
p_dir1 = MakeVectorDXDYDZ(1, 0, 0)
|
||||
p_dir2 = MakeVectorDXDYDZ(0, 0, 1)
|
||||
|
||||
p_tools = []
|
||||
p_tools.append(MakePlane(v_3, p_dir1, g_trim))
|
||||
p_tools.append(MakePlane(v_4, p_dir1, g_trim))
|
||||
p_tools.append(MakePlane(v_3, p_dir2, g_trim))
|
||||
p_tools.append(MakePlane(v_4, p_dir2, g_trim))
|
||||
|
||||
p_element = MakePartition([s_base], p_tools, [], [], ShapeType["SOLID"])
|
||||
|
||||
# Compound
|
||||
# --------
|
||||
|
||||
c_element = SubShapeAll(p_element, ShapeType["SOLID"])
|
||||
c_element.append(s_haut)
|
||||
|
||||
c_cpd = MakeCompound(c_element)
|
||||
piece = MakeGlueFaces(c_cpd, 1.e-5)
|
||||
|
||||
# Study
|
||||
# -----
|
||||
|
||||
piece_id = addToStudy(piece, "Cubes2partition")
|
||||
|
||||
# Meshing
|
||||
# =======
|
||||
|
||||
# Create hexahedrical mesh on piece
|
||||
# ---------------------------------
|
||||
|
||||
m_hexa=MeshHexa(piece, 4, "Cubes2partitionHexa")
|
||||
|
||||
# Compute
|
||||
# -------
|
||||
|
||||
m_hexa.Compute()
|
@ -1,295 +0,0 @@
|
||||
# CEA/LGLS 2004, Francis KLOSS (OCC)
|
||||
# ==================================
|
||||
|
||||
# Import
|
||||
# ------
|
||||
|
||||
from geompy import *
|
||||
from meshpy import *
|
||||
|
||||
# Geometry
|
||||
# ========
|
||||
|
||||
# A small cube centered and put on a great cube
|
||||
|
||||
# Points
|
||||
# ------
|
||||
|
||||
greatPoint111 = MakeVertex( 0, 0, 0)
|
||||
greatPoint211 = MakeVertex(10, 0, 0)
|
||||
greatPoint311 = MakeVertex(20, 0, 0)
|
||||
greatPoint411 = MakeVertex(30, 0, 0)
|
||||
|
||||
greatPoint121 = MakeVertex( 0, 10, 0)
|
||||
greatPoint221 = MakeVertex(10, 10, 0)
|
||||
greatPoint321 = MakeVertex(20, 10, 0)
|
||||
greatPoint421 = MakeVertex(30, 10, 0)
|
||||
|
||||
greatPoint112 = MakeVertex( 0, 0, 10)
|
||||
greatPoint212 = MakeVertex(10, 0, 10)
|
||||
greatPoint312 = MakeVertex(20, 0, 10)
|
||||
greatPoint412 = MakeVertex(30, 0, 10)
|
||||
|
||||
greatPoint122 = MakeVertex( 0, 10, 10)
|
||||
greatPoint222 = MakeVertex(10, 10, 10)
|
||||
greatPoint322 = MakeVertex(20, 10, 10)
|
||||
greatPoint422 = MakeVertex(30, 10, 10)
|
||||
|
||||
greatPoint113 = MakeVertex( 0, 0, 20)
|
||||
greatPoint213 = MakeVertex(10, 0, 20)
|
||||
greatPoint313 = MakeVertex(20, 0, 20)
|
||||
greatPoint413 = MakeVertex(30, 0, 20)
|
||||
|
||||
greatPoint123 = MakeVertex( 0, 10, 20)
|
||||
greatPoint223 = MakeVertex(10, 10, 20)
|
||||
greatPoint323 = MakeVertex(20, 10, 20)
|
||||
greatPoint423 = MakeVertex(30, 10, 20)
|
||||
|
||||
greatPoint114 = MakeVertex( 0, 0, 30)
|
||||
greatPoint214 = MakeVertex(10, 0, 30)
|
||||
greatPoint314 = MakeVertex(20, 0, 30)
|
||||
greatPoint414 = MakeVertex(30, 0, 30)
|
||||
|
||||
greatPoint124 = MakeVertex( 0, 10, 30)
|
||||
greatPoint224 = MakeVertex(10, 10, 30)
|
||||
greatPoint324 = MakeVertex(20, 10, 30)
|
||||
greatPoint424 = MakeVertex(30, 10, 30)
|
||||
|
||||
|
||||
smallPoint111 = greatPoint222
|
||||
smallPoint211 = greatPoint322
|
||||
smallPoint121 = MakeVertex(10, 20, 10)
|
||||
smallPoint221 = MakeVertex(20, 20, 10)
|
||||
|
||||
smallPoint112 = greatPoint223
|
||||
smallPoint212 = greatPoint323
|
||||
smallPoint122 = MakeVertex(10, 20, 20)
|
||||
smallPoint222 = MakeVertex(20, 20, 20)
|
||||
|
||||
# Edges
|
||||
# -----
|
||||
|
||||
smallEdgeX11 = MakeEdge(smallPoint111, smallPoint211)
|
||||
smallEdgeX21 = MakeEdge(smallPoint121, smallPoint221)
|
||||
smallEdgeX12 = MakeEdge(smallPoint112, smallPoint212)
|
||||
smallEdgeX22 = MakeEdge(smallPoint122, smallPoint222)
|
||||
|
||||
smallEdgeY11 = MakeEdge(smallPoint111, smallPoint121)
|
||||
smallEdgeY21 = MakeEdge(smallPoint211, smallPoint221)
|
||||
smallEdgeY12 = MakeEdge(smallPoint112, smallPoint122)
|
||||
smallEdgeY22 = MakeEdge(smallPoint212, smallPoint222)
|
||||
|
||||
smallEdgeZ11 = MakeEdge(smallPoint111, smallPoint112)
|
||||
smallEdgeZ21 = MakeEdge(smallPoint211, smallPoint212)
|
||||
smallEdgeZ12 = MakeEdge(smallPoint121, smallPoint122)
|
||||
smallEdgeZ22 = MakeEdge(smallPoint221, smallPoint222)
|
||||
|
||||
|
||||
greatEdgeX111 = MakeEdge(greatPoint111, greatPoint211)
|
||||
greatEdgeX211 = MakeEdge(greatPoint211, greatPoint311)
|
||||
greatEdgeX311 = MakeEdge(greatPoint311, greatPoint411)
|
||||
greatEdgeX121 = MakeEdge(greatPoint121, greatPoint221)
|
||||
greatEdgeX221 = MakeEdge(greatPoint221, greatPoint321)
|
||||
greatEdgeX321 = MakeEdge(greatPoint321, greatPoint421)
|
||||
|
||||
greatEdgeX112 = MakeEdge(greatPoint112, greatPoint212)
|
||||
greatEdgeX212 = MakeEdge(greatPoint212, greatPoint312)
|
||||
greatEdgeX312 = MakeEdge(greatPoint312, greatPoint412)
|
||||
greatEdgeX122 = MakeEdge(greatPoint122, greatPoint222)
|
||||
greatEdgeX222 = smallEdgeX11
|
||||
greatEdgeX322 = MakeEdge(greatPoint322, greatPoint422)
|
||||
|
||||
greatEdgeX113 = MakeEdge(greatPoint113, greatPoint213)
|
||||
greatEdgeX213 = MakeEdge(greatPoint213, greatPoint313)
|
||||
greatEdgeX313 = MakeEdge(greatPoint313, greatPoint413)
|
||||
greatEdgeX123 = MakeEdge(greatPoint123, greatPoint223)
|
||||
greatEdgeX223 = smallEdgeX12
|
||||
greatEdgeX323 = MakeEdge(greatPoint323, greatPoint423)
|
||||
|
||||
greatEdgeX114 = MakeEdge(greatPoint114, greatPoint214)
|
||||
greatEdgeX214 = MakeEdge(greatPoint214, greatPoint314)
|
||||
greatEdgeX314 = MakeEdge(greatPoint314, greatPoint414)
|
||||
greatEdgeX124 = MakeEdge(greatPoint124, greatPoint224)
|
||||
greatEdgeX224 = MakeEdge(greatPoint224, greatPoint324)
|
||||
greatEdgeX324 = MakeEdge(greatPoint324, greatPoint424)
|
||||
|
||||
greatEdgeY11 = MakeEdge(greatPoint111, greatPoint121)
|
||||
greatEdgeY21 = MakeEdge(greatPoint211, greatPoint221)
|
||||
greatEdgeY31 = MakeEdge(greatPoint311, greatPoint321)
|
||||
greatEdgeY41 = MakeEdge(greatPoint411, greatPoint421)
|
||||
|
||||
greatEdgeY12 = MakeEdge(greatPoint112, greatPoint122)
|
||||
greatEdgeY22 = MakeEdge(greatPoint212, greatPoint222)
|
||||
greatEdgeY32 = MakeEdge(greatPoint312, greatPoint322)
|
||||
greatEdgeY42 = MakeEdge(greatPoint412, greatPoint422)
|
||||
|
||||
greatEdgeY13 = MakeEdge(greatPoint113, greatPoint123)
|
||||
greatEdgeY23 = MakeEdge(greatPoint213, greatPoint223)
|
||||
greatEdgeY33 = MakeEdge(greatPoint313, greatPoint323)
|
||||
greatEdgeY43 = MakeEdge(greatPoint413, greatPoint423)
|
||||
|
||||
greatEdgeY14 = MakeEdge(greatPoint114, greatPoint124)
|
||||
greatEdgeY24 = MakeEdge(greatPoint214, greatPoint224)
|
||||
greatEdgeY34 = MakeEdge(greatPoint314, greatPoint324)
|
||||
greatEdgeY44 = MakeEdge(greatPoint414, greatPoint424)
|
||||
|
||||
greatEdgeZ111 = MakeEdge(greatPoint111, greatPoint112)
|
||||
greatEdgeZ211 = MakeEdge(greatPoint211, greatPoint212)
|
||||
greatEdgeZ311 = MakeEdge(greatPoint311, greatPoint312)
|
||||
greatEdgeZ411 = MakeEdge(greatPoint411, greatPoint412)
|
||||
|
||||
greatEdgeZ121 = MakeEdge(greatPoint121, greatPoint122)
|
||||
greatEdgeZ221 = MakeEdge(greatPoint221, greatPoint222)
|
||||
greatEdgeZ321 = MakeEdge(greatPoint321, greatPoint322)
|
||||
greatEdgeZ421 = MakeEdge(greatPoint421, greatPoint422)
|
||||
|
||||
greatEdgeZ112 = MakeEdge(greatPoint112, greatPoint113)
|
||||
greatEdgeZ212 = MakeEdge(greatPoint212, greatPoint213)
|
||||
greatEdgeZ312 = MakeEdge(greatPoint312, greatPoint313)
|
||||
greatEdgeZ412 = MakeEdge(greatPoint412, greatPoint413)
|
||||
|
||||
greatEdgeZ122 = MakeEdge(greatPoint122, greatPoint123)
|
||||
greatEdgeZ222 = smallEdgeZ11
|
||||
greatEdgeZ322 = smallEdgeZ21
|
||||
greatEdgeZ422 = MakeEdge(greatPoint422, greatPoint423)
|
||||
|
||||
greatEdgeZ113 = MakeEdge(greatPoint113, greatPoint114)
|
||||
greatEdgeZ213 = MakeEdge(greatPoint213, greatPoint214)
|
||||
greatEdgeZ313 = MakeEdge(greatPoint313, greatPoint314)
|
||||
greatEdgeZ413 = MakeEdge(greatPoint413, greatPoint414)
|
||||
|
||||
greatEdgeZ123 = MakeEdge(greatPoint123, greatPoint124)
|
||||
greatEdgeZ223 = MakeEdge(greatPoint223, greatPoint224)
|
||||
greatEdgeZ323 = MakeEdge(greatPoint323, greatPoint324)
|
||||
greatEdgeZ423 = MakeEdge(greatPoint423, greatPoint424)
|
||||
|
||||
# Faces
|
||||
# -----
|
||||
|
||||
smallFaceX1 = MakeQuad(smallEdgeY11, smallEdgeZ11, smallEdgeY12, smallEdgeZ12)
|
||||
smallFaceX2 = MakeQuad(smallEdgeY21, smallEdgeZ21, smallEdgeY22, smallEdgeZ22)
|
||||
smallFaceY1 = MakeQuad(smallEdgeX11, smallEdgeZ11, smallEdgeX12, smallEdgeZ21)
|
||||
smallFaceY2 = MakeQuad(smallEdgeX21, smallEdgeZ12, smallEdgeX22, smallEdgeZ22)
|
||||
smallFaceZ1 = MakeQuad(smallEdgeX11, smallEdgeY11, smallEdgeX21, smallEdgeY21)
|
||||
smallFaceZ2 = MakeQuad(smallEdgeX12, smallEdgeY12, smallEdgeX22, smallEdgeY22)
|
||||
|
||||
|
||||
greatFaceX11 = MakeQuad(greatEdgeY11, greatEdgeZ111, greatEdgeY12, greatEdgeZ121)
|
||||
greatFaceX21 = MakeQuad(greatEdgeY21, greatEdgeZ211, greatEdgeY22, greatEdgeZ221)
|
||||
greatFaceX31 = MakeQuad(greatEdgeY31, greatEdgeZ311, greatEdgeY32, greatEdgeZ321)
|
||||
greatFaceX41 = MakeQuad(greatEdgeY41, greatEdgeZ411, greatEdgeY42, greatEdgeZ421)
|
||||
|
||||
greatFaceX12 = MakeQuad(greatEdgeY12, greatEdgeZ112, greatEdgeY13, greatEdgeZ122)
|
||||
greatFaceX22 = MakeQuad(greatEdgeY22, greatEdgeZ212, greatEdgeY23, greatEdgeZ222)
|
||||
greatFaceX32 = MakeQuad(greatEdgeY32, greatEdgeZ312, greatEdgeY33, greatEdgeZ322)
|
||||
greatFaceX42 = MakeQuad(greatEdgeY42, greatEdgeZ412, greatEdgeY43, greatEdgeZ422)
|
||||
|
||||
greatFaceX13 = MakeQuad(greatEdgeY13, greatEdgeZ113, greatEdgeY14, greatEdgeZ123)
|
||||
greatFaceX23 = MakeQuad(greatEdgeY23, greatEdgeZ213, greatEdgeY24, greatEdgeZ223)
|
||||
greatFaceX33 = MakeQuad(greatEdgeY33, greatEdgeZ313, greatEdgeY34, greatEdgeZ323)
|
||||
greatFaceX43 = MakeQuad(greatEdgeY43, greatEdgeZ413, greatEdgeY44, greatEdgeZ423)
|
||||
|
||||
greatFaceY111 = MakeQuad(greatEdgeX111, greatEdgeZ111, greatEdgeX112, greatEdgeZ211)
|
||||
greatFaceY211 = MakeQuad(greatEdgeX211, greatEdgeZ211, greatEdgeX212, greatEdgeZ311)
|
||||
greatFaceY311 = MakeQuad(greatEdgeX311, greatEdgeZ311, greatEdgeX312, greatEdgeZ411)
|
||||
greatFaceY121 = MakeQuad(greatEdgeX121, greatEdgeZ121, greatEdgeX122, greatEdgeZ221)
|
||||
greatFaceY221 = MakeQuad(greatEdgeX221, greatEdgeZ221, greatEdgeX222, greatEdgeZ321)
|
||||
greatFaceY321 = MakeQuad(greatEdgeX321, greatEdgeZ321, greatEdgeX322, greatEdgeZ421)
|
||||
|
||||
greatFaceY112 = MakeQuad(greatEdgeX112, greatEdgeZ112, greatEdgeX113, greatEdgeZ212)
|
||||
greatFaceY212 = MakeQuad(greatEdgeX212, greatEdgeZ212, greatEdgeX213, greatEdgeZ312)
|
||||
greatFaceY312 = MakeQuad(greatEdgeX312, greatEdgeZ312, greatEdgeX313, greatEdgeZ412)
|
||||
greatFaceY122 = MakeQuad(greatEdgeX122, greatEdgeZ122, greatEdgeX123, greatEdgeZ222)
|
||||
greatFaceY222 = smallFaceY1
|
||||
greatFaceY322 = MakeQuad(greatEdgeX322, greatEdgeZ322, greatEdgeX323, greatEdgeZ422)
|
||||
|
||||
greatFaceY113 = MakeQuad(greatEdgeX113, greatEdgeZ113, greatEdgeX114, greatEdgeZ213)
|
||||
greatFaceY213 = MakeQuad(greatEdgeX213, greatEdgeZ213, greatEdgeX214, greatEdgeZ313)
|
||||
greatFaceY313 = MakeQuad(greatEdgeX313, greatEdgeZ313, greatEdgeX314, greatEdgeZ413)
|
||||
greatFaceY123 = MakeQuad(greatEdgeX123, greatEdgeZ123, greatEdgeX124, greatEdgeZ223)
|
||||
greatFaceY223 = MakeQuad(greatEdgeX223, greatEdgeZ223, greatEdgeX224, greatEdgeZ323)
|
||||
greatFaceY323 = MakeQuad(greatEdgeX323, greatEdgeZ323, greatEdgeX324, greatEdgeZ423)
|
||||
|
||||
greatFaceZ11 = MakeQuad(greatEdgeX111, greatEdgeY11, greatEdgeX121, greatEdgeY21)
|
||||
greatFaceZ21 = MakeQuad(greatEdgeX211, greatEdgeY21, greatEdgeX221, greatEdgeY31)
|
||||
greatFaceZ31 = MakeQuad(greatEdgeX311, greatEdgeY31, greatEdgeX321, greatEdgeY41)
|
||||
|
||||
greatFaceZ12 = MakeQuad(greatEdgeX112, greatEdgeY12, greatEdgeX122, greatEdgeY22)
|
||||
greatFaceZ22 = MakeQuad(greatEdgeX212, greatEdgeY22, greatEdgeX222, greatEdgeY32)
|
||||
greatFaceZ32 = MakeQuad(greatEdgeX312, greatEdgeY32, greatEdgeX322, greatEdgeY42)
|
||||
|
||||
greatFaceZ13 = MakeQuad(greatEdgeX113, greatEdgeY13, greatEdgeX123, greatEdgeY23)
|
||||
greatFaceZ23 = MakeQuad(greatEdgeX213, greatEdgeY23, greatEdgeX223, greatEdgeY33)
|
||||
greatFaceZ33 = MakeQuad(greatEdgeX313, greatEdgeY33, greatEdgeX323, greatEdgeY43)
|
||||
|
||||
greatFaceZ14 = MakeQuad(greatEdgeX114, greatEdgeY14, greatEdgeX124, greatEdgeY24)
|
||||
greatFaceZ24 = MakeQuad(greatEdgeX214, greatEdgeY24, greatEdgeX224, greatEdgeY34)
|
||||
greatFaceZ34 = MakeQuad(greatEdgeX314, greatEdgeY34, greatEdgeX324, greatEdgeY44)
|
||||
|
||||
# Solids
|
||||
# ------
|
||||
|
||||
smallBlock = MakeHexa(smallFaceX1, smallFaceX2, smallFaceY1, smallFaceY2, smallFaceZ1, smallFaceZ2)
|
||||
|
||||
greatBlock11 = MakeHexa(greatFaceX11, greatFaceX21, greatFaceY111, greatFaceY121, greatFaceZ11, greatFaceZ12)
|
||||
greatBlock21 = MakeHexa(greatFaceX21, greatFaceX31, greatFaceY211, greatFaceY221, greatFaceZ21, greatFaceZ22)
|
||||
greatBlock31 = MakeHexa(greatFaceX31, greatFaceX41, greatFaceY311, greatFaceY321, greatFaceZ31, greatFaceZ32)
|
||||
|
||||
greatBlock12 = MakeHexa(greatFaceX12, greatFaceX22, greatFaceY112, greatFaceY122, greatFaceZ12, greatFaceZ13)
|
||||
greatBlock22 = MakeHexa(greatFaceX22, greatFaceX32, greatFaceY212, greatFaceY222, greatFaceZ22, greatFaceZ23)
|
||||
greatBlock32 = MakeHexa(greatFaceX32, greatFaceX42, greatFaceY312, greatFaceY322, greatFaceZ32, greatFaceZ33)
|
||||
|
||||
greatBlock13 = MakeHexa(greatFaceX13, greatFaceX23, greatFaceY113, greatFaceY123, greatFaceZ13, greatFaceZ14)
|
||||
greatBlock23 = MakeHexa(greatFaceX23, greatFaceX33, greatFaceY213, greatFaceY223, greatFaceZ23, greatFaceZ24)
|
||||
greatBlock33 = MakeHexa(greatFaceX33, greatFaceX43, greatFaceY313, greatFaceY323, greatFaceZ33, greatFaceZ34)
|
||||
|
||||
# Compound
|
||||
# --------
|
||||
|
||||
c_l = []
|
||||
c_l.append(smallBlock)
|
||||
c_l.append(greatBlock11)
|
||||
c_l.append(greatBlock21)
|
||||
c_l.append(greatBlock31)
|
||||
c_l.append(greatBlock12)
|
||||
c_l.append(greatBlock22)
|
||||
c_l.append(greatBlock32)
|
||||
c_l.append(greatBlock13)
|
||||
c_l.append(greatBlock23)
|
||||
c_l.append(greatBlock33)
|
||||
|
||||
c_cpd = MakeCompound(c_l)
|
||||
piece = MakeGlueFaces(c_cpd, 1.e-5)
|
||||
|
||||
# Add in study
|
||||
# ------------
|
||||
|
||||
piece_id = addToStudy(piece, "Cubes2pyGibi")
|
||||
|
||||
# Meshing
|
||||
# =======
|
||||
|
||||
# Create hexahedrical mesh on piece
|
||||
# ---------------------------------
|
||||
|
||||
m_hexa=MeshHexa(piece, 4, "Cubes2pyGibiHexa")
|
||||
|
||||
# Get edges
|
||||
# ---------
|
||||
|
||||
e_edges = SubShapeAllSorted(piece, ShapeType["EDGE"])
|
||||
|
||||
# Create local hypothesis
|
||||
# -----------------------
|
||||
|
||||
m_local=3
|
||||
|
||||
m_i=10
|
||||
while m_i<18:
|
||||
m_hexa.local(e_edges[m_i], m_local)
|
||||
m_i=m_i+1
|
||||
|
||||
# Compute
|
||||
# -------
|
||||
|
||||
m_hexa.Compute()
|
@ -1,102 +0,0 @@
|
||||
# CEA/LGLS 2004, Francis KLOSS (OCC)
|
||||
# ==================================
|
||||
|
||||
# Import
|
||||
# ------
|
||||
|
||||
from geompy import *
|
||||
from meshpy import *
|
||||
|
||||
# Piece
|
||||
# -----
|
||||
|
||||
# Create the hexahedrical block geometry of a holed parallelepipede.
|
||||
# The hole has a T form composed by 2 cylinders with different radius, and their axis are normal.
|
||||
# This piece is meshed in hexahedrical.
|
||||
|
||||
gx = 0
|
||||
gy = 0
|
||||
gz = 0
|
||||
|
||||
g_dx = 250
|
||||
g_dy = 200
|
||||
g_dz = 150
|
||||
|
||||
g_rayonGrand = 70
|
||||
g_rayonPetit = 50
|
||||
|
||||
g_trim = 1000
|
||||
|
||||
# Geometry
|
||||
# ========
|
||||
|
||||
# The parallelepipede
|
||||
# -------------------
|
||||
|
||||
p_boite = MakeBox(gx-g_dx, gy-g_dy, gz-g_dz, gx+g_dx, gy+g_dy, gz+g_dz)
|
||||
|
||||
# The great cylinder
|
||||
# ------------------
|
||||
|
||||
g_base = MakeVertex(gx-g_dx, gy, gz)
|
||||
g_dir = MakeVectorDXDYDZ(1, 0, 0)
|
||||
g_cyl = MakeCylinder(g_base, g_dir, g_rayonGrand, g_dx*2)
|
||||
|
||||
# The first hole
|
||||
# --------------
|
||||
|
||||
b_boite = MakeCut(p_boite , g_cyl)
|
||||
|
||||
# Partitioning
|
||||
# ------------
|
||||
|
||||
p_base = MakeVertex(gx, gy, gz)
|
||||
|
||||
p_tools = []
|
||||
|
||||
p_tools.append(MakePlane(p_base, MakeVectorDXDYDZ(0, 1 , 0 ), g_trim))
|
||||
p_tools.append(MakePlane(p_base, MakeVectorDXDYDZ(0, g_dz, g_dy), g_trim))
|
||||
p_tools.append(MakePlane(p_base, MakeVectorDXDYDZ(0, -g_dz, g_dy), g_trim))
|
||||
|
||||
p_tools.append(MakePlane(MakeVertex(gx-g_rayonPetit, gy, gz), g_dir, g_trim))
|
||||
p_tools.append(MakePlane(MakeVertex(gx+g_rayonPetit, gy, gz), g_dir, g_trim))
|
||||
|
||||
p_piece = MakePartition([b_boite], p_tools, [], [], ShapeType["SOLID"])
|
||||
|
||||
# The small cylinder
|
||||
# ------------------
|
||||
|
||||
c_cyl = MakeCylinder(p_base, MakeVectorDXDYDZ(0, 0, 1), g_rayonPetit, g_dz)
|
||||
|
||||
# The second hole
|
||||
# ---------------
|
||||
|
||||
d_element = SubShapeAllSorted(p_piece, ShapeType["SOLID"])
|
||||
|
||||
d_element[ 8] = MakeCut(d_element[ 8], c_cyl)
|
||||
d_element[10] = MakeCut(d_element[10], c_cyl)
|
||||
|
||||
# Compound
|
||||
# --------
|
||||
|
||||
comp_all = MakeCompound(d_element)
|
||||
piece = BlocksOp.RemoveExtraEdges(comp_all)
|
||||
#piece = MakeCompound(d_element)
|
||||
|
||||
# Add piece in study
|
||||
# ------------------
|
||||
|
||||
piece_id = addToStudy(piece, "BoxHoled2Cylinders")
|
||||
|
||||
# Meshing
|
||||
# =======
|
||||
|
||||
# Mesh with hexahedrons
|
||||
# ---------------------
|
||||
|
||||
m_hexa=MeshHexa(piece, 4, "BoxHoled2CylindersHexa")
|
||||
|
||||
# Compute mesh
|
||||
# ------------
|
||||
|
||||
m_hexa.Compute()
|
@ -1,171 +0,0 @@
|
||||
# CEA/LGLS 2004, Francis KLOSS (OCC)
|
||||
# ==================================
|
||||
|
||||
# Import
|
||||
# ------
|
||||
|
||||
from geompy import *
|
||||
from meshpy import *
|
||||
|
||||
# Piece
|
||||
# -----
|
||||
|
||||
# Creer la geometrie en bloc hexahedrique d'une piece en forme de T composee de 2 cylindres de diametre different dont les axes se coupent orthogonalement,
|
||||
# puis mailler en hexahedrique.
|
||||
|
||||
cx = 0
|
||||
cy = 0
|
||||
cz = 0
|
||||
|
||||
g_rayon = 100.0
|
||||
g_hauteur = 500
|
||||
|
||||
p_rayon = 50.0
|
||||
p_hauteur = 500
|
||||
|
||||
g_trim = 1000
|
||||
|
||||
# Geometrie
|
||||
# =========
|
||||
|
||||
cpd = []
|
||||
|
||||
# Gros cylindre
|
||||
# -------------
|
||||
|
||||
g_base = MakeVertex(cx, cy, cz)
|
||||
g_dir = MakeVectorDXDYDZ(0, 0, 1)
|
||||
t_hauteur = p_rayon+10.0
|
||||
|
||||
g_cyl = MakeCylinder(g_base, g_dir, g_rayon, g_hauteur)
|
||||
|
||||
g_coupe = MakeVectorDXDYDZ(1, 0, 0)
|
||||
|
||||
g_tools = []
|
||||
g_tools.append(MakePlane(MakeVertex(cx+t_hauteur, cy, cz), g_coupe, g_trim))
|
||||
g_tools.append(MakePlane(MakeVertex(cx-t_hauteur, cy, cz), g_coupe, g_trim))
|
||||
|
||||
g_partie = MakePartition([g_cyl], g_tools, [], [], ShapeType["SOLID"])
|
||||
g_bas, g_centre, g_haut = SubShapeAllSorted(g_partie, ShapeType["SOLID"])
|
||||
|
||||
# Partie basse du gros cylindre
|
||||
# -----------------------------
|
||||
|
||||
b_hauteur = 10
|
||||
b_base = 20
|
||||
|
||||
b_boite = MakeBox(cx-t_hauteur, cy-b_base, cz, cx-t_hauteur-b_hauteur, cy+b_base, cz+g_hauteur)
|
||||
cpd.append(b_boite)
|
||||
|
||||
b_cyl = MakeCut(g_bas, b_boite)
|
||||
|
||||
b_tools = []
|
||||
b_tools.append(MakePlane(MakeVertex(cx-t_hauteur-b_hauteur, cy+b_base, cz), MakeVectorDXDYDZ( 1, 1, 0), g_trim))
|
||||
b_tools.append(MakePlane(MakeVertex(cx-t_hauteur-b_hauteur, cy-b_base, cz), MakeVectorDXDYDZ(-1, 1, 0), g_trim))
|
||||
|
||||
b_partie = MakePartition([b_cyl], b_tools, [], [], ShapeType["SOLID"])
|
||||
b_element = SubShapeAll(b_partie, ShapeType["SOLID"])
|
||||
cpd = cpd + b_element
|
||||
|
||||
# Partie haute du gros cylindre
|
||||
# -----------------------------
|
||||
|
||||
h_plan = MakePlane(g_base, g_coupe, g_trim)
|
||||
|
||||
cpd.append(MakeMirrorByPlane(b_boite, h_plan))
|
||||
|
||||
for h in b_element:
|
||||
h_symetrie = MakeMirrorByPlane(h, h_plan)
|
||||
cpd.append(h_symetrie)
|
||||
|
||||
# Petit cylindre
|
||||
# --------------
|
||||
|
||||
z_arete = p_rayon/2
|
||||
x_arete = z_arete*t_hauteur*2/g_hauteur
|
||||
|
||||
px = cx-x_arete
|
||||
py = cy-1.5*g_rayon
|
||||
pz = cz+g_hauteur/2
|
||||
|
||||
p_base = MakeVertex(cx, py, pz)
|
||||
p_dir = MakeVectorDXDYDZ(0, 1, 0)
|
||||
p_cyl = MakeCylinder(p_base, p_dir, p_rayon, p_hauteur)
|
||||
|
||||
p_boite = MakeBox(px, py, pz-z_arete, cx+x_arete, py+p_hauteur, pz+z_arete)
|
||||
|
||||
# Partie interieure du petit cylindre
|
||||
# -----------------------------------
|
||||
|
||||
i_cyl = MakeCommon(p_cyl, g_cyl)
|
||||
i_tuyau = MakeCut(i_cyl, p_boite)
|
||||
i_boite = MakeCommon(p_boite, g_cyl)
|
||||
|
||||
# Partie exterieure du petit cylindre
|
||||
# -----------------------------------
|
||||
|
||||
e_cyl0 = MakeCut(p_cyl, g_cyl)
|
||||
e_cyl = SubShapeAllSorted(e_cyl0, ShapeType["SOLID"])
|
||||
|
||||
e_tuyau = MakeCut(e_cyl[1], p_boite)
|
||||
|
||||
e_boite0 = MakeCut(p_boite, g_cyl)
|
||||
e_boite = SubShapeAllSorted(e_boite0, ShapeType["SOLID"])
|
||||
|
||||
cpd.append(e_boite[1])
|
||||
|
||||
# Partie centrale du gros cylindre
|
||||
# --------------------------------
|
||||
|
||||
c_cyl = MakeCut(g_centre, p_cyl)
|
||||
|
||||
# Partitionner
|
||||
# ------------
|
||||
|
||||
p_tools = []
|
||||
p_tools.append(MakePlane(MakeVertex(px, py, pz-z_arete), MakeVectorDXDYDZ(-z_arete, 0, x_arete), g_trim))
|
||||
p_tools.append(MakePlane(MakeVertex(px, py, pz+z_arete), MakeVectorDXDYDZ( z_arete, 0, x_arete), g_trim))
|
||||
|
||||
p_partie = MakePartition([e_tuyau], p_tools, [], [], ShapeType["SOLID"])
|
||||
p_element = SubShapeAll(p_partie, ShapeType["SOLID"])
|
||||
cpd = cpd + p_element
|
||||
|
||||
q_partie = MakePartition([i_tuyau, c_cyl], p_tools, [], [], ShapeType["SOLID"])
|
||||
q_element = SubShapeAll(q_partie, ShapeType["SOLID"])
|
||||
|
||||
q_element = q_element + [i_boite]
|
||||
|
||||
q_tools = []
|
||||
q_tools.append(MakePlane(MakeVertex(cx, cy-b_base, cz), MakeVectorDXDYDZ(0, 1, 0), g_trim))
|
||||
q_tools.append(MakePlane(MakeVertex(cx, cy+b_base, cz), MakeVectorDXDYDZ(0, 1, 0), g_trim))
|
||||
|
||||
r_element = []
|
||||
for e in q_element:
|
||||
r_partie = MakePartition([e], q_tools, [], [], ShapeType["SOLID"])
|
||||
r_element = r_element + SubShapeAll(r_partie, ShapeType["SOLID"])
|
||||
|
||||
cpd = cpd + r_element
|
||||
|
||||
# Compound
|
||||
# --------
|
||||
|
||||
comp_all = MakeCompound(cpd)
|
||||
piece = BlocksOp.RemoveExtraEdges(comp_all)
|
||||
|
||||
# Ajouter la piece dans l'etude
|
||||
# -----------------------------
|
||||
|
||||
piece_id = addToStudy(piece, "T2Cylindres")
|
||||
|
||||
# Maillage
|
||||
# ========
|
||||
|
||||
# Mailler des hexahedres
|
||||
# ----------------------
|
||||
|
||||
m_hexa=MeshHexa(piece, 4, "T2CylindresHexa")
|
||||
|
||||
# Calculer le maillage
|
||||
# --------------------
|
||||
|
||||
m_hexa.Compute()
|
@ -1,108 +0,0 @@
|
||||
# CEA/LGLS 2004, Francis KLOSS (OCC)
|
||||
# ==================================
|
||||
|
||||
# Import
|
||||
# ------
|
||||
|
||||
from geompy import *
|
||||
from meshpy import *
|
||||
|
||||
# Piece
|
||||
# -----
|
||||
|
||||
# grid compound of 17 x 17 elements
|
||||
# an element is compound of 3 cylinders concentriques
|
||||
# an element is centered in a square of the grid
|
||||
# prisme the grid
|
||||
|
||||
# Geometry
|
||||
# --------
|
||||
|
||||
g_x = 0
|
||||
g_y = 0
|
||||
g_z = 0
|
||||
|
||||
g_arete = 50
|
||||
g_hauteur = 30
|
||||
|
||||
g_rayon1 = 20
|
||||
g_rayon2 = 30
|
||||
g_rayon3 = 40
|
||||
|
||||
# The real value for CEA, but need 3 days for computing
|
||||
#g_grid = 17
|
||||
g_grid = 3
|
||||
|
||||
g_trim = 1000
|
||||
|
||||
# Solids
|
||||
# ------
|
||||
|
||||
s_boite = MakeBox(g_x-g_arete, g_y-g_hauteur, g_z-g_arete, g_x+g_arete, g_y+g_hauteur, g_z+g_arete)
|
||||
|
||||
s_pi4 = 3.141592653/4
|
||||
s_hauteur = 2*g_hauteur
|
||||
s_centre = MakeVertex(g_x, g_y-g_hauteur, g_z)
|
||||
s_dir = MakeVectorDXDYDZ(0, 1, 0)
|
||||
|
||||
s_cyl0 = MakeCylinder(s_centre, s_dir, g_rayon3, s_hauteur)
|
||||
s_cyl1 = MakeRotation(s_cyl0, s_dir, s_pi4)
|
||||
|
||||
s_blo1 = MakeCut(s_boite, s_cyl1)
|
||||
|
||||
s_cyl0 = MakeCylinder(s_centre, s_dir, g_rayon2, s_hauteur)
|
||||
s_cyl2 = MakeRotation(s_cyl0, s_dir, s_pi4)
|
||||
|
||||
s_blo2 = MakeCut(s_cyl1, s_cyl2)
|
||||
|
||||
s_cyl0 = MakeCylinder(s_centre, s_dir, g_rayon1, s_hauteur)
|
||||
s_cyl3 = MakeRotation(s_cyl0, s_dir, s_pi4)
|
||||
|
||||
s_blo3 = MakeCut(s_cyl2, s_cyl3)
|
||||
|
||||
s_arete = g_rayon1/2
|
||||
|
||||
s_blo4 = MakeBox(g_x-s_arete, g_y-g_hauteur, g_z-s_arete, g_x+s_arete, g_y+g_hauteur, g_z+s_arete)
|
||||
|
||||
s_blo5 = MakeCut(s_cyl3, s_blo4)
|
||||
|
||||
# Partition
|
||||
# ---------
|
||||
|
||||
p_tools = []
|
||||
p_tools.append(MakePlane(s_centre, MakeVectorDXDYDZ( 1, 0, 1), g_trim))
|
||||
p_tools.append(MakePlane(s_centre, MakeVectorDXDYDZ(-1, 0, 1), g_trim))
|
||||
|
||||
p_partie = MakePartition([s_blo1, s_blo2, s_blo3, s_blo5], p_tools, [], [], ShapeType["SOLID"])
|
||||
|
||||
# Compound
|
||||
# --------
|
||||
|
||||
c_cpd = SubShapeAll(p_partie, ShapeType["SOLID"])
|
||||
c_cpd.append(s_blo4)
|
||||
|
||||
c_element = MakeCompound(c_cpd)
|
||||
|
||||
# Grid
|
||||
# ----
|
||||
|
||||
piece = MakeMultiTranslation2D(c_element, MakeVectorDXDYDZ(1, 0, 0), 2*g_arete, g_grid,
|
||||
MakeVectorDXDYDZ(0, 0, 1), 2*g_arete, g_grid)
|
||||
|
||||
# Add in study
|
||||
# ------------
|
||||
|
||||
piece_id = addToStudy(piece, "Grid17partition")
|
||||
|
||||
# Meshing
|
||||
# =======
|
||||
|
||||
# Create hexahedrical mesh on piece
|
||||
# ---------------------------------
|
||||
|
||||
m_hexa=MeshHexa(piece, 4, "Grid17partitionHexa")
|
||||
|
||||
# Compute
|
||||
# -------
|
||||
|
||||
m_hexa.Compute()
|
@ -1,94 +0,0 @@
|
||||
# CEA/LGLS 2004, Francis KLOSS (OCC)
|
||||
# ==================================
|
||||
|
||||
# Import
|
||||
# ------
|
||||
|
||||
from geompy import *
|
||||
from meshpy import *
|
||||
|
||||
# Piece
|
||||
# -----
|
||||
|
||||
# grid compound of 3 x 3 elements
|
||||
# an element is compound of 3 cylinders concentriques
|
||||
# an element is centered in a square of the grid
|
||||
# the smaller cylinder is a hole
|
||||
|
||||
# prisme the grid
|
||||
|
||||
# Geometry
|
||||
# --------
|
||||
|
||||
g_x = 0
|
||||
g_y = 0
|
||||
g_z = 0
|
||||
|
||||
g_arete = 50
|
||||
g_hauteur = 30
|
||||
|
||||
g_rayon1 = 20
|
||||
g_rayon2 = 30
|
||||
g_rayon3 = 40
|
||||
|
||||
g_grid = 3
|
||||
|
||||
g_trim = 1000
|
||||
|
||||
# Element
|
||||
# -------
|
||||
|
||||
e_boite = MakeBox(g_x-g_arete, g_y-g_hauteur, g_z-g_arete, g_x+g_arete, g_y+g_hauteur, g_z+g_arete)
|
||||
|
||||
e_pi4 = 3.141592653/4
|
||||
e_hauteur = 2*g_hauteur
|
||||
e_centre = MakeVertex(g_x, g_y-g_hauteur, g_z)
|
||||
e_dir = MakeVectorDXDYDZ(0, 1, 0)
|
||||
|
||||
e_cyl0 = MakeCylinder(e_centre, e_dir, g_rayon3, e_hauteur)
|
||||
e_cyl1 = MakeRotation(e_cyl0, e_dir, e_pi4)
|
||||
|
||||
e_blo1 = MakeCut(e_boite, e_cyl1)
|
||||
|
||||
e_cyl0 = MakeCylinder(e_centre, e_dir, g_rayon2, e_hauteur)
|
||||
e_cyl2 = MakeRotation(e_cyl0, e_dir, e_pi4)
|
||||
|
||||
e_blo2 = MakeCut(e_cyl1, e_cyl2)
|
||||
|
||||
e_cyl0 = MakeCylinder(e_centre, e_dir, g_rayon1, e_hauteur)
|
||||
e_cyl3 = MakeRotation(e_cyl0, e_dir, e_pi4)
|
||||
|
||||
e_blo3 = MakeCut(e_cyl2, e_cyl3)
|
||||
|
||||
# Partition
|
||||
# ---------
|
||||
|
||||
p_tools = []
|
||||
p_tools.append(MakePlane(e_centre, MakeVectorDXDYDZ( 1, 0, 1), g_trim))
|
||||
p_tools.append(MakePlane(e_centre, MakeVectorDXDYDZ(-1, 0, 1), g_trim))
|
||||
|
||||
p_element = MakePartition([e_blo1, e_blo2, e_blo3], p_tools, [], [], ShapeType["SOLID"])
|
||||
|
||||
# Grid
|
||||
# ----
|
||||
|
||||
piece = MakeMultiTranslation2D(p_element, MakeVectorDXDYDZ(1, 0, 0), 2*g_arete, g_grid,
|
||||
MakeVectorDXDYDZ(0, 0, 1), 2*g_arete, g_grid)
|
||||
|
||||
# Add in study
|
||||
# ------------
|
||||
|
||||
piece_id = addToStudy(piece, "Grid3partition")
|
||||
|
||||
# Meshing
|
||||
# =======
|
||||
|
||||
# Create hexahedrical mesh on piece
|
||||
# ---------------------------------
|
||||
|
||||
m_hexa=MeshHexa(piece, 4, "Grid3partitionHexa")
|
||||
|
||||
# Compute
|
||||
# -------
|
||||
|
||||
m_hexa.Compute()
|
@ -1,72 +0,0 @@
|
||||
# CEA/LGLS 2004, Francis KLOSS (OCC)
|
||||
# ==================================
|
||||
|
||||
# Import
|
||||
# ------
|
||||
|
||||
from geompy import *
|
||||
from meshpy import *
|
||||
|
||||
# Piece
|
||||
# -----
|
||||
|
||||
# grid compound by a square with a cylinder on each vertex
|
||||
|
||||
# Geometry
|
||||
# --------
|
||||
|
||||
ox = 0
|
||||
oy = 0
|
||||
oz = 0
|
||||
|
||||
arete = 50
|
||||
hauteur = 100
|
||||
rayon = 10
|
||||
|
||||
g_trim = 1000
|
||||
|
||||
# Box
|
||||
# ---
|
||||
|
||||
piecePoint = MakeVertex(ox, oy, oz)
|
||||
|
||||
pieceBox = MakeBoxTwoPnt(piecePoint, MakeVertex(ox+arete, oy+hauteur, oz+arete))
|
||||
|
||||
# Cut by cylinders
|
||||
# ----------------
|
||||
|
||||
dirUp = MakeVectorDXDYDZ(0, 1, 0)
|
||||
|
||||
pieceCut1 = MakeCut(pieceBox , MakeCylinder(piecePoint , dirUp, rayon, hauteur))
|
||||
pieceCut2 = MakeCut(pieceCut1, MakeCylinder(MakeVertex(ox+arete, oy, oz ), dirUp, rayon, hauteur))
|
||||
pieceCut3 = MakeCut(pieceCut2, MakeCylinder(MakeVertex(ox , oy, oz+arete), dirUp, rayon, hauteur))
|
||||
pieceCut4 = MakeCut(pieceCut3, MakeCylinder(MakeVertex(ox+arete, oy, oz+arete), dirUp, rayon, hauteur))
|
||||
|
||||
# Compound by make a partition of a solid
|
||||
# ---------------------------------------
|
||||
|
||||
dir = MakeVectorDXDYDZ(-1, 0, 1)
|
||||
|
||||
tools = []
|
||||
tools.append(MakePlane(MakeVertex(ox+rayon, oy, oz ), dir, g_trim))
|
||||
tools.append(MakePlane(MakeVertex(ox , oy, oz+rayon), dir, g_trim))
|
||||
|
||||
piece = MakePartition([pieceCut4], tools, [], [], ShapeType["SOLID"])
|
||||
|
||||
# Add in study
|
||||
# ------------
|
||||
|
||||
piece_id = addToStudy(piece, "Grid4partition")
|
||||
|
||||
# Meshing
|
||||
# =======
|
||||
|
||||
# Create hexahedrical mesh on piece
|
||||
# ---------------------------------
|
||||
|
||||
m_hexa=MeshHexa(piece, 4, "Grid4partitionHexa")
|
||||
|
||||
# Compute
|
||||
# -------
|
||||
|
||||
m_hexa.Compute()
|
@ -1,114 +0,0 @@
|
||||
# CEA/LGLS 2004, Francis KLOSS (OCC)
|
||||
# ==================================
|
||||
|
||||
# Import
|
||||
# ------
|
||||
|
||||
from geompy import *
|
||||
from meshpy import *
|
||||
|
||||
import math
|
||||
|
||||
# Piece
|
||||
# -----
|
||||
|
||||
# grid compound by a square with a cylinder on each vertex
|
||||
|
||||
# Geometry
|
||||
# --------
|
||||
|
||||
ox = 0
|
||||
oy = 0
|
||||
oz = 0
|
||||
|
||||
arete = 50
|
||||
hauteur = 100
|
||||
|
||||
rayon = 10
|
||||
|
||||
demi = rayon/2
|
||||
r3 = demi*math.sqrt(3)
|
||||
|
||||
# Points
|
||||
# ------
|
||||
|
||||
piecePoint111 = MakeVertex(ox+rayon , oy, oz)
|
||||
piecePoint211 = MakeVertex(ox+arete-rayon, oy, oz)
|
||||
piecePoint112 = MakeVertex(ox , oy, oz+rayon)
|
||||
piecePoint212 = MakeVertex(ox+arete , oy, oz+rayon)
|
||||
piecePoint113 = MakeVertex(ox , oy, oz+arete-rayon)
|
||||
piecePoint213 = MakeVertex(ox+arete , oy, oz+arete-rayon)
|
||||
piecePoint114 = MakeVertex(ox+rayon , oy, oz+arete)
|
||||
piecePoint214 = MakeVertex(ox+arete-rayon, oy, oz+arete)
|
||||
|
||||
pieceCenter1 = MakeVertex(ox , oy, oz)
|
||||
pieceCenter2 = MakeVertex(ox+arete , oy, oz)
|
||||
pieceCenter3 = MakeVertex(ox , oy, oz+arete)
|
||||
pieceCenter4 = MakeVertex(ox+arete , oy, oz+arete)
|
||||
|
||||
piecePass1 = MakeVertex(ox+demi , oy, oz+r3)
|
||||
piecePass2 = MakeVertex(ox+arete-demi , oy, oz+r3)
|
||||
piecePass3 = MakeVertex(ox+arete-demi , oy, oz+arete-r3)
|
||||
piecePass4 = MakeVertex(ox+demi , oy, oz+arete-r3)
|
||||
|
||||
# Edges
|
||||
# -----
|
||||
|
||||
pieceEdgeSquare1 = MakeEdge(piecePoint111, piecePoint211)
|
||||
pieceEdgeSquare2 = MakeEdge(piecePoint114, piecePoint214)
|
||||
pieceEdgeSquare3 = MakeEdge(piecePoint112, piecePoint113)
|
||||
pieceEdgeSquare4 = MakeEdge(piecePoint212, piecePoint213)
|
||||
|
||||
pieceEdgeDiagonal1 = MakeEdge(piecePoint111, piecePoint213)
|
||||
pieceEdgeDiagonal2 = MakeEdge(piecePoint112, piecePoint214)
|
||||
|
||||
pieceEdgeArc1 = MakeArc(piecePoint111, piecePass1, piecePoint112)
|
||||
pieceEdgeArc2 = MakeArc(piecePoint211, piecePass2, piecePoint212)
|
||||
pieceEdgeArc3 = MakeArc(piecePoint213, piecePass3, piecePoint214)
|
||||
pieceEdgeArc4 = MakeArc(piecePoint113, piecePass4, piecePoint114)
|
||||
|
||||
# Faces
|
||||
# -----
|
||||
|
||||
pieceFace1 = MakeQuad(pieceEdgeSquare1, pieceEdgeArc2, pieceEdgeSquare4, pieceEdgeDiagonal1)
|
||||
pieceFace2 = MakeQuad(pieceEdgeSquare2, pieceEdgeArc4, pieceEdgeSquare3, pieceEdgeDiagonal2)
|
||||
|
||||
pieceFace3 = MakeQuad(pieceEdgeArc1, pieceEdgeDiagonal1, pieceEdgeArc3, pieceEdgeDiagonal2)
|
||||
|
||||
# Solids
|
||||
# ------
|
||||
|
||||
pieceVector = MakeVectorDXDYDZ(0, 1, 0)
|
||||
|
||||
pieceSolid1 = MakePrismVecH(pieceFace1, pieceVector, hauteur)
|
||||
pieceSolid2 = MakePrismVecH(pieceFace2, pieceVector, hauteur)
|
||||
pieceSolid3 = MakePrismVecH(pieceFace3, pieceVector, hauteur)
|
||||
|
||||
# Compound
|
||||
# --------
|
||||
|
||||
c_l = []
|
||||
c_l.append(pieceSolid1)
|
||||
c_l.append(pieceSolid2)
|
||||
c_l.append(pieceSolid3)
|
||||
|
||||
c_cpd = MakeCompound(c_l)
|
||||
piece = MakeGlueFaces(c_cpd, 1.e-5)
|
||||
|
||||
# Add in study
|
||||
# ------------
|
||||
|
||||
piece_id = addToStudy(piece, "Grid4pyGibi")
|
||||
|
||||
# Meshing
|
||||
# =======
|
||||
|
||||
# Create hexahedrical mesh on piece
|
||||
# ---------------------------------
|
||||
|
||||
m_hexa=MeshHexa(piece, 4, "Grid4pyGibiHexa")
|
||||
|
||||
# Compute
|
||||
# -------
|
||||
|
||||
m_hexa.Compute()
|
@ -1,109 +0,0 @@
|
||||
# CEA/LGLS 2004, Francis KLOSS (OCC)
|
||||
# ==================================
|
||||
|
||||
# Import
|
||||
# ------
|
||||
|
||||
from geompy import *
|
||||
from meshpy import *
|
||||
|
||||
# Piece
|
||||
# -----
|
||||
|
||||
# A holed cube
|
||||
|
||||
# Geometry
|
||||
# --------
|
||||
|
||||
ox = 0
|
||||
oy = 0
|
||||
oz = 0
|
||||
|
||||
longueur1 = 30
|
||||
longueur2 = 70
|
||||
|
||||
largeur1 = 30
|
||||
largeur2 = 50
|
||||
|
||||
hauteur = 50
|
||||
|
||||
rayon = 10
|
||||
|
||||
# Triangular face
|
||||
# ---------------
|
||||
|
||||
def triangle(p1, p2, p3):
|
||||
l = []
|
||||
l.append(MakeEdge(p1, p2))
|
||||
l.append(MakeEdge(p2, p3))
|
||||
l.append(MakeEdge(p3, p1))
|
||||
w = MakeWire(l)
|
||||
return MakeFace(w, 1)
|
||||
|
||||
# Points
|
||||
# ------
|
||||
|
||||
basePoint111 = MakeVertex(ox-longueur1, oy, oz-largeur1)
|
||||
basePoint211 = MakeVertex(ox+longueur2, oy, oz-largeur1)
|
||||
basePoint112 = MakeVertex(ox-longueur1, oy, oz+largeur2)
|
||||
basePoint212 = MakeVertex(ox+longueur2, oy, oz+largeur2)
|
||||
|
||||
holePoint = MakeVertex(ox, oy, oz)
|
||||
|
||||
# Faces
|
||||
# -----
|
||||
|
||||
baseFace1 = triangle(basePoint111, basePoint211, holePoint)
|
||||
baseFace2 = triangle(basePoint211, basePoint212, holePoint)
|
||||
baseFace3 = triangle(basePoint212, basePoint112, holePoint)
|
||||
baseFace4 = triangle(basePoint112, basePoint111, holePoint)
|
||||
|
||||
# Solids
|
||||
# ------
|
||||
|
||||
baseVector = MakeVectorDXDYDZ(0, 1, 0)
|
||||
|
||||
baseSolid1 = MakePrismVecH(baseFace1, baseVector, hauteur)
|
||||
baseSolid2 = MakePrismVecH(baseFace2, baseVector, hauteur)
|
||||
baseSolid3 = MakePrismVecH(baseFace3, baseVector, hauteur)
|
||||
baseSolid4 = MakePrismVecH(baseFace4, baseVector, hauteur)
|
||||
|
||||
holeSolid = MakeCylinder(holePoint, baseVector, rayon, hauteur)
|
||||
|
||||
# Boolean operations
|
||||
# ------------------
|
||||
|
||||
baseHexa1 = MakeCut(baseSolid1, holeSolid)
|
||||
baseHexa2 = MakeCut(baseSolid2, holeSolid)
|
||||
baseHexa3 = MakeCut(baseSolid3, MakeRotation(holeSolid, baseVector, 3.141592653))
|
||||
baseHexa4 = MakeCut(baseSolid4, holeSolid)
|
||||
|
||||
# Compound
|
||||
# --------
|
||||
|
||||
c_l = []
|
||||
c_l.append(baseHexa1)
|
||||
c_l.append(baseHexa2)
|
||||
c_l.append(baseHexa3)
|
||||
c_l.append(baseHexa4)
|
||||
|
||||
c_cpd = MakeCompound(c_l)
|
||||
piece = MakeGlueFaces(c_cpd, 1.e-5)
|
||||
|
||||
# Add in study
|
||||
# ------------
|
||||
|
||||
piece_id = addToStudy(piece, "Hole1geometry")
|
||||
|
||||
# Meshing
|
||||
# =======
|
||||
|
||||
# Create hexahedrical mesh on piece
|
||||
# ---------------------------------
|
||||
|
||||
m_hexa=MeshHexa(piece, 4, "Hole1geometryHexa")
|
||||
|
||||
# Compute
|
||||
# -------
|
||||
|
||||
m_hexa.Compute()
|
@ -1,75 +0,0 @@
|
||||
# CEA/LGLS 2004, Francis KLOSS (OCC)
|
||||
# ==================================
|
||||
|
||||
# Import
|
||||
# ------
|
||||
|
||||
from geompy import *
|
||||
from meshpy import *
|
||||
|
||||
import math
|
||||
|
||||
# Piece
|
||||
# -----
|
||||
|
||||
# A holed cube at center for partitioning
|
||||
|
||||
# Geometry
|
||||
# --------
|
||||
|
||||
g_x = 0
|
||||
g_y = 0
|
||||
g_z = 0
|
||||
|
||||
g_longueur = 50.0
|
||||
g_largeur = 40.0
|
||||
g_hauteur = 25.0
|
||||
|
||||
g_rayon = 10
|
||||
|
||||
g_trim = 1000
|
||||
|
||||
# Box
|
||||
# ---
|
||||
|
||||
b_boite = MakeBox(g_x-g_longueur, g_y-g_hauteur, g_z-g_largeur,
|
||||
g_x+g_longueur, g_y+g_hauteur, g_z+g_largeur)
|
||||
|
||||
# Cylinder
|
||||
# --------
|
||||
|
||||
c_axe = MakeVectorDXDYDZ(0, 1, 0)
|
||||
|
||||
c_cyl0 = MakeCylinder(MakeVertex(g_x, g_y-g_hauteur, g_z), c_axe, g_rayon, g_hauteur*2)
|
||||
c_cyl = MakeRotation(c_cyl0, c_axe, math.atan(g_longueur/g_largeur))
|
||||
|
||||
c_piece = MakeCut(b_boite, c_cyl)
|
||||
|
||||
# Partition
|
||||
# ---------
|
||||
|
||||
p_centre = MakeVertex(g_x, g_y, g_z)
|
||||
|
||||
p_tools = []
|
||||
p_tools.append(MakePlane(p_centre, MakeVectorDXDYDZ( g_largeur, 0, g_longueur), g_trim))
|
||||
p_tools.append(MakePlane(p_centre, MakeVectorDXDYDZ(-g_largeur, 0, g_longueur), g_trim))
|
||||
|
||||
piece = MakePartition([c_piece], p_tools, [], [], ShapeType["SOLID"])
|
||||
|
||||
# Add in study
|
||||
# ------------
|
||||
|
||||
piece_id = addToStudy(piece, "Hole1partition")
|
||||
|
||||
# Meshing
|
||||
# =======
|
||||
|
||||
# Create hexahedrical mesh on piece
|
||||
# ---------------------------------
|
||||
|
||||
m_hexa=MeshHexa(piece, 4, "Hole1partitionHexa")
|
||||
|
||||
# Compute
|
||||
# -------
|
||||
|
||||
m_hexa.Compute()
|
@ -1,116 +0,0 @@
|
||||
# CEA/LGLS 2004, Francis KLOSS (OCC)
|
||||
# ==================================
|
||||
|
||||
# Import
|
||||
# ------
|
||||
|
||||
from geompy import *
|
||||
from meshpy import *
|
||||
|
||||
import math
|
||||
|
||||
# Piece
|
||||
# -----
|
||||
|
||||
# A centered holed cube
|
||||
|
||||
# Geometry
|
||||
# --------
|
||||
|
||||
ox = 0
|
||||
oy = 0
|
||||
oz = 0
|
||||
|
||||
longueur = 100
|
||||
largeur = 80
|
||||
hauteur = 50
|
||||
|
||||
rayon = 10
|
||||
|
||||
# Points
|
||||
# ------
|
||||
|
||||
basePoint111 = MakeVertex(ox , oy, oz)
|
||||
basePoint211 = MakeVertex(ox+longueur, oy, oz)
|
||||
basePoint112 = MakeVertex(ox , oy, oz+largeur)
|
||||
basePoint212 = MakeVertex(ox+longueur, oy, oz+largeur)
|
||||
|
||||
cx = ox+longueur/2
|
||||
cy = oy
|
||||
cz = oz+largeur/2
|
||||
|
||||
ll = longueur/largeur
|
||||
ll = ll*ll
|
||||
dx = rayon/math.sqrt(1+ll)
|
||||
dz = rayon/math.sqrt(1+1/ll)
|
||||
|
||||
circlePoint1 = MakeVertex(cx-dx, cy, cz-dz)
|
||||
circlePoint2 = MakeVertex(cx+dx, cy, cz-dz)
|
||||
circlePoint3 = MakeVertex(cx+dx, cy, cz+dz)
|
||||
circlePoint4 = MakeVertex(cx-dx, cy, cz+dz)
|
||||
|
||||
# Edges
|
||||
# -----
|
||||
|
||||
squareEdge1 = MakeEdge(basePoint111, basePoint211)
|
||||
squareEdge2 = MakeEdge(basePoint211, basePoint212)
|
||||
squareEdge3 = MakeEdge(basePoint212, basePoint112)
|
||||
squareEdge4 = MakeEdge(basePoint112, basePoint111)
|
||||
|
||||
diagEdge1 = MakeEdge(basePoint111, circlePoint1)
|
||||
diagEdge2 = MakeEdge(basePoint211, circlePoint2)
|
||||
diagEdge3 = MakeEdge(basePoint212, circlePoint3)
|
||||
diagEdge4 = MakeEdge(basePoint112, circlePoint4)
|
||||
|
||||
arcEdge1 = MakeArc(circlePoint1, MakeVertex(cx , cy, cz-rayon), circlePoint2)
|
||||
arcEdge2 = MakeArc(circlePoint2, MakeVertex(cx+rayon, cy, cz ), circlePoint3)
|
||||
arcEdge3 = MakeArc(circlePoint3, MakeVertex(cx , cy, cz+rayon), circlePoint4)
|
||||
arcEdge4 = MakeArc(circlePoint4, MakeVertex(cx-rayon, cy, cz ), circlePoint1)
|
||||
|
||||
# Faces
|
||||
# -----
|
||||
|
||||
baseFace1 = MakeQuad(squareEdge1, diagEdge2, arcEdge1, diagEdge1)
|
||||
baseFace2 = MakeQuad(squareEdge2, diagEdge3, arcEdge2, diagEdge2)
|
||||
baseFace3 = MakeQuad(squareEdge3, diagEdge4, arcEdge3, diagEdge3)
|
||||
baseFace4 = MakeQuad(squareEdge4, diagEdge1, arcEdge4, diagEdge4)
|
||||
|
||||
# Solids
|
||||
# ------
|
||||
|
||||
baseVector = MakeVectorDXDYDZ(0, 1, 0)
|
||||
|
||||
baseSolid1 = MakePrismVecH(baseFace1, baseVector, hauteur)
|
||||
baseSolid2 = MakePrismVecH(baseFace2, baseVector, hauteur)
|
||||
baseSolid3 = MakePrismVecH(baseFace3, baseVector, hauteur)
|
||||
baseSolid4 = MakePrismVecH(baseFace4, baseVector, hauteur)
|
||||
|
||||
# Compound
|
||||
# --------
|
||||
|
||||
c_l = []
|
||||
c_l.append(baseSolid1)
|
||||
c_l.append(baseSolid2)
|
||||
c_l.append(baseSolid3)
|
||||
c_l.append(baseSolid4)
|
||||
|
||||
c_cpd = MakeCompound(c_l)
|
||||
piece = MakeGlueFaces(c_cpd, 1.e-5)
|
||||
|
||||
# Add in study
|
||||
# ------------
|
||||
|
||||
piece_id = addToStudy(piece, "Hole1pyGibi")
|
||||
|
||||
# Meshing
|
||||
# =======
|
||||
|
||||
# Create hexahedrical mesh on piece
|
||||
# ---------------------------------
|
||||
|
||||
m_hexa=MeshHexa(piece, 4, "Hole1pyGibiHexa")
|
||||
|
||||
# Compute
|
||||
# -------
|
||||
|
||||
m_hexa.Compute()
|
@ -1,113 +0,0 @@
|
||||
# CEA/LGLS 2004, Francis KLOSS (OCC)
|
||||
# ==================================
|
||||
|
||||
# Import
|
||||
# ------
|
||||
|
||||
from geompy import *
|
||||
from meshpy import *
|
||||
|
||||
# Piece
|
||||
# -----
|
||||
|
||||
# A twice holed cube
|
||||
|
||||
# Geometry
|
||||
# --------
|
||||
|
||||
ox = 0
|
||||
oy = 0
|
||||
oz = 0
|
||||
|
||||
longueur = 200
|
||||
largeur = 100
|
||||
hauteur = 80
|
||||
|
||||
cylindre = 50
|
||||
|
||||
rayon = 20
|
||||
|
||||
# Points
|
||||
# ------
|
||||
|
||||
piecePoint1 = MakeVertex(ox , oy, oz)
|
||||
piecePoint2 = MakeVertex(ox+longueur, oy, oz)
|
||||
piecePoint3 = MakeVertex(ox+longueur, oy, oz+largeur)
|
||||
piecePoint4 = MakeVertex(ox , oy, oz+largeur)
|
||||
|
||||
cz = oz+largeur/2
|
||||
|
||||
cylPoint1 = MakeVertex(ox+cylindre , oy, cz-rayon)
|
||||
cylPoint2 = MakeVertex(ox+longueur-cylindre, oy, cz-rayon)
|
||||
cylPoint3 = MakeVertex(ox+longueur-cylindre, oy, cz+rayon)
|
||||
cylPoint4 = MakeVertex(ox+cylindre , oy, cz+rayon)
|
||||
|
||||
# Edges
|
||||
# -----
|
||||
|
||||
pieceEdge1 = MakeEdge(piecePoint1, piecePoint4)
|
||||
pieceEdge2 = MakeEdge(piecePoint1, cylPoint1)
|
||||
pieceEdge3 = MakeEdge(piecePoint4, cylPoint4)
|
||||
|
||||
pieceEdge4 = MakeEdge(piecePoint2, piecePoint3)
|
||||
pieceEdge5 = MakeEdge(piecePoint2, cylPoint2)
|
||||
pieceEdge6 = MakeEdge(piecePoint3, cylPoint3)
|
||||
|
||||
pieceEdge7 = MakeEdge(cylPoint1, cylPoint2)
|
||||
pieceEdge8 = MakeEdge(cylPoint3, cylPoint4)
|
||||
|
||||
cylEdge1 = MakeArc(cylPoint1, MakeVertex(ox+cylindre-rayon , oy, cz), cylPoint4)
|
||||
cylEdge2 = MakeArc(cylPoint1, MakeVertex(ox+cylindre+rayon , oy, cz), cylPoint4)
|
||||
cylEdge3 = MakeArc(cylPoint2, MakeVertex(ox+longueur-cylindre-rayon, oy, cz), cylPoint3)
|
||||
cylEdge4 = MakeArc(cylPoint2, MakeVertex(ox+longueur-cylindre+rayon, oy, cz), cylPoint3)
|
||||
|
||||
# Faces
|
||||
# -----
|
||||
|
||||
pieceFace1 = MakeQuad4Vertices(piecePoint1, piecePoint2, cylPoint2 , cylPoint1 )
|
||||
pieceFace2 = MakeQuad (pieceEdge1 , pieceEdge2 , cylEdge1 , pieceEdge3)
|
||||
pieceFace3 = MakeQuad4Vertices(piecePoint3, piecePoint4, cylPoint4 , cylPoint3 )
|
||||
pieceFace4 = MakeQuad (pieceEdge4 , pieceEdge5 , cylEdge4 , pieceEdge6)
|
||||
pieceFace5 = MakeQuad (pieceEdge7 , cylEdge3 , pieceEdge8, cylEdge2 )
|
||||
|
||||
# Solids
|
||||
# ------
|
||||
|
||||
pieceVector = MakeVectorDXDYDZ(0, 1, 0)
|
||||
|
||||
pieceSolid1 = MakePrismVecH(pieceFace1, pieceVector, hauteur)
|
||||
pieceSolid2 = MakePrismVecH(pieceFace2, pieceVector, hauteur)
|
||||
pieceSolid3 = MakePrismVecH(pieceFace3, pieceVector, hauteur)
|
||||
pieceSolid4 = MakePrismVecH(pieceFace4, pieceVector, hauteur)
|
||||
pieceSolid5 = MakePrismVecH(pieceFace5, pieceVector, hauteur)
|
||||
|
||||
# Compound
|
||||
# --------
|
||||
|
||||
c_l = []
|
||||
c_l.append(pieceSolid1)
|
||||
c_l.append(pieceSolid2)
|
||||
c_l.append(pieceSolid3)
|
||||
c_l.append(pieceSolid4)
|
||||
c_l.append(pieceSolid5)
|
||||
|
||||
c_cpd = MakeCompound(c_l)
|
||||
piece = MakeGlueFaces(c_cpd, 1.e-5)
|
||||
|
||||
# Add in study
|
||||
# ------------
|
||||
|
||||
piece_id = addToStudy(piece, "Hole2pyGibi")
|
||||
|
||||
# Meshing
|
||||
# =======
|
||||
|
||||
# Create hexahedrical mesh on piece
|
||||
# ---------------------------------
|
||||
|
||||
m_hexa=MeshHexa(piece, 4, "Hole2pyGibiHexa")
|
||||
|
||||
# Compute
|
||||
# -------
|
||||
|
||||
m_hexa.Compute()
|
@ -1,165 +0,0 @@
|
||||
# CEA/LGLS 2004, Francis KLOSS (OCC)
|
||||
# ==================================
|
||||
|
||||
# Import
|
||||
# ------
|
||||
|
||||
import geompy
|
||||
import salome
|
||||
|
||||
import StdMeshers
|
||||
import SMESH
|
||||
|
||||
"""
|
||||
\namespace meshpy
|
||||
\brief Module meshpy
|
||||
"""
|
||||
|
||||
# Variables
|
||||
# ---------
|
||||
|
||||
smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
|
||||
smesh.SetCurrentStudy(salome.myStudy)
|
||||
smeshgui = salome.ImportComponentGUI("SMESH")
|
||||
smeshgui.Init(salome.myStudyId)
|
||||
|
||||
class MeshHexaImpl:
|
||||
"""
|
||||
Class MeshHexaImpl for Hexahedrical meshing
|
||||
|
||||
Examples: cube2pyGibi.py, lines 270-295
|
||||
cube2partition.py, lines 72-83
|
||||
"""
|
||||
piece = 0
|
||||
name = 0
|
||||
mesh = 0
|
||||
cpt = 0
|
||||
|
||||
def Mesh1D(self, shape, n, propagate=0):
|
||||
"""
|
||||
Define Wires discretization.
|
||||
Sets algorithm and hypothesis for 1D discretization of \a shape:
|
||||
- algorithm "Regular_1D"
|
||||
- hypothesis "NumberOfSegments" with number of segments \a n
|
||||
\param shape Main shape or sub-shape to define wire discretization of
|
||||
\param n Number of segments to split eash wire of the \a shape on
|
||||
\param propagate Boolean flag. If propagate = 1,
|
||||
"Propagation" hypothesis will be applied also to the \a shape
|
||||
"""
|
||||
hyp1D=smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
|
||||
smeshgui.SetName(salome.ObjectToID(hyp1D), self.name+"/WireDiscretisation/"+str(self.cpt))
|
||||
self.mesh.AddHypothesis(shape, hyp1D)
|
||||
|
||||
hyp=smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
|
||||
hyp.SetNumberOfSegments(n)
|
||||
smeshgui.SetName(salome.ObjectToID(hyp), self.name+"/Segments_"+str(n)+"/"+str(self.cpt))
|
||||
self.mesh.AddHypothesis(shape, hyp)
|
||||
|
||||
if propagate:
|
||||
hypPro=smesh.CreateHypothesis("Propagation", "libStdMeshersEngine.so")
|
||||
smeshgui.SetName(salome.ObjectToID(hypPro), self.name+"/Propagation/"+str(self.cpt))
|
||||
self.mesh.AddHypothesis(shape, hypPro)
|
||||
|
||||
self.cpt=self.cpt+1
|
||||
|
||||
def __init__(self, piece, n, name):
|
||||
"""
|
||||
Constructor
|
||||
|
||||
Creates mesh on the shape \a piece,
|
||||
sets GUI name of this mesh to \a name. \n
|
||||
Sets the following global algorithms and hypotheses:
|
||||
- for 1D discretization:
|
||||
- algorithm "Regular_1D"
|
||||
- hypothesis "NumberOfSegments" with number of segments \a n
|
||||
- for 2D discretization:
|
||||
- algorithm "Quadrangle_2D"
|
||||
- for 3D discretization:
|
||||
- algorithm "Hexa_3D"
|
||||
\param piece Shape to be meshed
|
||||
\param n Global number of segments for wires discretization
|
||||
\param name Name for mesh to be created
|
||||
"""
|
||||
self.piece = piece
|
||||
self.name = name
|
||||
|
||||
self.mesh = smesh.CreateMesh(piece)
|
||||
smeshgui.SetName(salome.ObjectToID(self.mesh), name)
|
||||
|
||||
self.Mesh1D(piece, n)
|
||||
|
||||
hyp2D=smesh.CreateHypothesis("Quadrangle_2D", "libStdMeshersEngine.so")
|
||||
smeshgui.SetName(salome.ObjectToID(hyp2D), name+"/Quadrangle")
|
||||
self.mesh.AddHypothesis(piece, hyp2D)
|
||||
|
||||
hyp3D=smesh.CreateHypothesis("Hexa_3D", "libStdMeshersEngine.so")
|
||||
smeshgui.SetName(salome.ObjectToID(hyp3D), name+"/ijk")
|
||||
self.mesh.AddHypothesis(piece, hyp3D)
|
||||
|
||||
def local(self, edge, n):
|
||||
"""
|
||||
Creates sub-mesh of the mesh, created by constructor.
|
||||
This sub-mesh will be created on edge \a edge.
|
||||
Set algorithm and hypothesis for 1D discretization of the \a edge:
|
||||
- algorithm "Regular_1D"
|
||||
- hypothesis "NumberOfSegments" with number of segments \a n
|
||||
\param edge Sub-edge of the main shape
|
||||
\param n Number of segments to split the \a edge on
|
||||
\note: \a edge will be automatically published in study under the shape, given in constructor.
|
||||
"""
|
||||
geompy.addToStudyInFather(self.piece, edge, geompy.SubShapeName(edge, self.piece))
|
||||
submesh = self.mesh.GetSubMesh(edge, self.name+"/SubMeshEdge/"+str(self.cpt))
|
||||
self.Mesh1D(edge, n)
|
||||
|
||||
def Propagate(self, edge, n):
|
||||
"""
|
||||
Creates sub-mesh of the mesh, created by constructor.
|
||||
This sub-mesh will be created on edge \a edge and
|
||||
propagate the hypothesis on all correspondant edges.
|
||||
Set algorithm and hypothesis for 1D discretization of the \a edge and all other propagate edges:
|
||||
- algorithm "Regular_1D"
|
||||
- hypothesis "NumberOfSegments" with number of segments \a n
|
||||
- hypothesis "Propagation"
|
||||
\param edge Sub-edge of the main shape
|
||||
\param n Number of segments to split the \a edge and all other propagate edges on
|
||||
\note: \a edge will be automatically published in study under the shape, given in constructor.
|
||||
"""
|
||||
geompy.addToStudyInFather(self.piece, edge, geompy.SubShapeName(edge, self.piece))
|
||||
submesh = self.mesh.GetSubMesh(edge, self.name+"/SubMeshEdge/"+str(self.cpt))
|
||||
self.Mesh1D(edge, n, 1)
|
||||
|
||||
def Compute(self):
|
||||
"""
|
||||
Computes mesh, created by constructor.
|
||||
"""
|
||||
smesh.Compute(self.mesh, self.piece)
|
||||
salome.sg.updateObjBrowser(1)
|
||||
|
||||
def Group(self, grp, name=""):
|
||||
"""
|
||||
Creates mesh group based on a geometric group
|
||||
\param grp Geometric group
|
||||
\param name Name for mesh group to be created
|
||||
"""
|
||||
if name == "":
|
||||
name = grp.GetName()
|
||||
tgeo = geompy.GroupOp.GetType(grp)
|
||||
if tgeo == geompy.ShapeType["VERTEX"]:
|
||||
type = SMESH.NODE
|
||||
elif tgeo == geompy.ShapeType["EDGE"]:
|
||||
type = SMESH.EDGE
|
||||
elif tgeo == geompy.ShapeType["FACE"]:
|
||||
type = SMESH.FACE
|
||||
elif tgeo == geompy.ShapeType["SOLID"]:
|
||||
type = SMESH.VOLUME
|
||||
return self.mesh.CreateGroupFromGEOM(type, name, grp)
|
||||
|
||||
def ExportMED(self, filename, groups=0):
|
||||
"""
|
||||
Export mesh in a MED file
|
||||
\param filename Name for MED file to be created
|
||||
\param groups Boolean flag. If groups = 1, mesh groups will be also stored in file
|
||||
"""
|
||||
self.mesh.ExportMED(filename, groups)
|
||||
|
||||
MeshHexa = MeshHexaImpl
|
Loading…
Reference in New Issue
Block a user