TypeError: in method 'CSGCGALMeshGenerator2D_generate', argument 2 of type 'std::shared_ptr< mshr::CSGCGALDomain2D const >'

Issue #61 new
Nico Schlömer created an issue

This

import dolfin
import mshr

domain = mshr.Circle(dolfin.Point(0, 0), 1.0)

generator = mshr.CSGCGALMeshGenerator2D()
m = generator.generate(domain)

fails with

Traceback (most recent call last):
  File "s.py", line 7, in <module>
    m = generator.generate(domain)
TypeError: in method 'CSGCGALMeshGenerator2D_generate', argument 2 of type 'std::shared_ptr< mshr::CSGCGALDomain2D const >'
Aborted (core dumped)

Comments (2)

  1. Aleix BP
    import dolfin
    import mshr
    
    geo = mshr.Circle(dolfin.Point(0, 0), 1.0)
    domain = mshr.CSGCGALDomain2D(geo)
    generator = mshr.CSGCGALMeshGenerator2D()
    m = generator.generate(domain)
    

    Try with this. It looks like CSGCGALMeshGenerator2D needs to be fed a CSGCGALDomain2D not a geometry (for some reason this is not supported?). This is in contrast with CSGCGALMeshGenerator3D which does support generation from both a Domain3D and a geometry. The latter 3D case is the one depicted in the examples.

    Hope this helps!

    PS: if you want to play with the cell_size parameter you may have to "turn off" the mesh_resolution parameter by setting it to zero

    cell_size = 0.5
    generator.parameters["mesh_resolution"] = 0.
    generator.parameters["cell_size"] = cell_size
    
  2. Log in to comment