No constructor defined for CSG operator python binding

Issue #95 resolved
Murray Cutforth created an issue

The python bindings for the CSG operators appear to be lacking a constructor definition. I think it’s an easy fix, and I’ve labelled this as trivial priority since the + and - operators can be used to avoid the problem. I will try and add the fix to the python/src/mshr.cpp file and submit a PR at some point.

import mshr
import dolfin

g1 = mshr.Circle(dolfin.Point(0.0, 0.0), 1.0)
g2 = mshr.Circle(dolfin.Point(0.5, 0.0), 1.0)

intersection = (g1 + g2) - (g1 - g2) - (g2 - g1)  # Works
intersection = mshr.CSGIntersection(g1, g2)  # Error

Results in:

Traceback (most recent call last):
File "mshr_issue_mwe.py", line 8, in <module>
intersection = mshr.CSGIntersection(g1, g2) # Error
TypeError: mshr.cpp.CSGIntersection: No constructor defined!

Comments (1)

  1. Murray Cutforth reporter

    I looked at the python/src/mshr.cpp file a bit more closely and realised that the * operator is already an alias for CSGIntersection 🙈

  2. Log in to comment