def ComputeMesh(MEFISTO2=False): an1DHypothesis = StdMeshers_Arithmetic1D(0,0,aMeshGen) #print dir(an1DHypothesis) #print an1DHypothesis.SaveTo() an1DHypothesis.SetLength(1.,False) an1DHypothesis.SetLength(2.,True) an1DAlgo = StdMeshers_Regular_1D(1,0,aMeshGen) if MEFISTO2: #2D a2dHypothseis = StdMeshers_TrianglePreference(2,0,aMeshGen) #define the boundary a2dAlgo = StdMeshers_MEFISTO_2D(3,0,aMeshGen) else: a2dHypothseis = StdMeshers_QuadranglePreference(2,0,aMeshGen) a2dAlgo = StdMeshers_Quadrangle_2D(3,0,aMeshGen) #Calculate mesh aMesh.ShapeToMesh(aShape) #Assign hyptothesis to mesh aMesh.AddHypothesis(aShape,0) aMesh.AddHypothesis(aShape,1) aMesh.AddHypothesis(aShape,2) aMesh.AddHypothesis(aShape,3) #Compute the data aMeshGen.Compute(aMesh,aMesh.GetShapeToMesh())
def is_applicable(shape, check_all=True): """ Check if this algorithm can mesh the shape. :param shape: The shape. :param bool check_all: If *True*, this check returns *True* if all shapes are applicable. If *False* this check returns *True* if at least one shape is ok. :return: Check whether algorithm is applicable. :rtype: bool """ return StdMeshers_Quadrangle_2D.IsApplicable_(shape.object, check_all)
def is_applicable(shape, check_all=True): """ Check if this algorithm can mesh the shape. :param afem.topology.entities.Shape shape: The shape. :param bool check_all: If *True*, this check returns *True* if all shapes are applicable. If *False* this check returns *True* if at least one shape is ok. :return: Check whether algorithm is applicable. :rtype: bool """ if not StdMeshers_Quadrangle_2D.IsApplicable_(shape.object, check_all): return False # Check for 3-sided faces for face in shape.faces: if face.num_edges < 4: return False return True
aMeshGen = SMESH_Gen() aMesh = aMeshGen.CreateMesh(0, True) print('Done.') print('Adding hypothesis and algorithms ...', end='') # 1D an1DHypothesis = StdMeshers_Arithmetic1D(0, 0, aMeshGen) #discretization of the wire an1DHypothesis.SetLength(5., False) #the smallest distance between 2 points an1DHypothesis.SetLength(10., True) # the longest distance between 2 points an1DAlgo = StdMeshers_Regular_1D(1, 0, aMeshGen) # interpolation # 2D a2dHypothseis = StdMeshers_QuadranglePreference(2, 0, aMeshGen) #define the boundary a2dAlgo = StdMeshers_Quadrangle_2D(3, 0, aMeshGen) # the 2D mesh # 3D: Just uncomment the line to use the volumic mesher you want a3dHypothesis = StdMeshers_Prism_3D(4, 0, aMeshGen) #OK #Calculate mesh aMesh.ShapeToMesh(aShape) #Assign hyptothesis to mesh aMesh.AddHypothesis(aShape, 0) aMesh.AddHypothesis(aShape, 1) aMesh.AddHypothesis(aShape, 2) aMesh.AddHypothesis(aShape, 3) aMesh.AddHypothesis(aShape, 4) print('Done.')
def __init__(self, gen): hyp = StdMeshers_Quadrangle_2D(gen.new_id(), -1, gen.object) super(QuadrangleAlgo2D, self).__init__(hyp)