Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 from geompy import *
00027
00028 import smesh
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 arete = 100
00039
00040 arete0 = 0
00041 arete1 = arete
00042 arete2 = arete*2
00043 arete3 = arete*3
00044
00045
00046
00047
00048 box_tetra1 = MakeBox(arete0, arete0, 0, arete1, arete1, arete)
00049
00050 box_ijk1 = MakeBox(arete1, arete0, 0, arete2, arete1, arete)
00051
00052 box_hexa = MakeBox(arete1, arete1, 0, arete2, arete2, arete)
00053
00054 box_ijk2 = MakeBox(arete2, arete1, 0, arete3, arete2, arete)
00055
00056 box_tetra2 = MakeBox(arete2, arete2, 0, arete3 ,arete3, arete)
00057
00058
00059
00060
00061 piece_cpd = MakeCompound([box_tetra1, box_ijk1, box_hexa, box_ijk2, box_tetra2])
00062
00063 piece = MakeGlueFaces(piece_cpd, 1e-4)
00064
00065 piece_id = addToStudy(piece, "ex04_cube5tetraHexa")
00066
00067
00068
00069
00070 smesh.SetCurrentStudy(salome.myStudy)
00071
00072
00073
00074
00075 mixed = smesh.Mesh(piece, "ex04_cube5tetraHexa:mixed")
00076
00077 algo = mixed.Segment()
00078
00079 algo.StartEndLength(3, 25)
00080
00081 mixed.Quadrangle()
00082
00083 mixed.Hexahedron()
00084
00085
00086
00087
00088 def localMesh(b, hyp):
00089 box = GetInPlace(piece, b)
00090 faces = SubShapeAll(box, ShapeType["FACE"])
00091
00092 i = 0
00093 n = len(faces)
00094 while i<n:
00095 algo = mixed.Triangle(faces[i])
00096 if hyp:
00097 algo.MaxElementArea(80)
00098 else:
00099 algo.LengthFromEdges()
00100 i = i + 1
00101
00102 algo = mixed.Tetrahedron(smesh.NETGEN, box)
00103 algo.MaxElementVolume(400)
00104
00105 localMesh(box_tetra1, 1)
00106 localMesh(box_tetra2, 0)
00107
00108
00109
00110
00111 mixed.Compute()