예제 #1
0
def mesh_Cube(n=10):
    dom = mshr.Box(Point(0., 0., 0.), Point(1., 1., 1.))
    gen = mshr.CSGCGALMeshGenerator3D()
    #gen.parameters["facet_angle"] = 30.0
    #gen.parameters["facet_size"] = 0.5
    #gen.parameters["edge_size"] = 0.5
    gen.parameters["mesh_resolution"] = 0.01
    gen.parameters["odt_optimize"] = True
    mesh = gen.generate(mshr.CSGCGALDomain3D(dom))
    return mesh
예제 #2
0
imp = implicitModeller(
    mergeActors(tf, bx),
    distance=0.04,
    outer=True,
    #                       res=[50,20,10],
    res=[110, 40, 20],
    bounds=[-1.0, 10.0, -1.0, 2.0, -.5, .5],
    maxdist=0.25,
)

imp.write(mytext + '.stl', binary=False)
show(imp)

#### tetralize
import mshr
import dolfin

surface = mshr.Surface3D(mytext + '.stl')
polyhedral_domain = mshr.CSGCGALDomain3D(surface)
dolfin.info(polyhedral_domain, True)

generator = mshr.CSGCGALMeshGenerator3D()
generator.parameters["mesh_resolution"] = 40.0
mesh = generator.generate(polyhedral_domain)

dolfin.File(mytext + ".xml") << mesh
printc('saved', mytext + ".xml")

#from vtkplotter.dolfin import plot
#plot(mesh)