- edited description
cpp_compile_expression can not be used twice on expression with same type-declaration
As shown in the example, if one tries to compile the same expression with identical class name twice, ditjitso throws a cryptic error, this can be fixed by renaming the class
cpp_code = base_code.replace("MyCppExpression", "MyExp2")
cpp_code = cpp_code.replace("EXPRESSION", "(x[0] - a_)")
The error message should be clearer, so that non-developers are able to fix this.
Comments (10)
-
reporter -
Message is
Something went wrong loading module
for me. -
reporter @chris_richardson I get the same message. The first compile_cpp_expression yields
<module 'dolfin_cpp_module_f39a9ad369d77806206009e6203e7329' from '/home/dokken/V_envs/dolfin_lfs/env/.cache/dijitso/lib/dolfin_cpp_module_f39a9ad369d77806206009e6203e7329.so'>
The second one returns
None
-
The problem is that you are trying to register two types with the same name "MyCppExpression". If you rename the second expression, it should work OK. Maybe dijitso should raise, instead of printing that cryptic error.
-
reporter Got the same message when i did the following:
cpp_code = base_code.replace("MyCppExpression", "MyExp2") cpp_code = base_code.replace("EXPRESSION", "(x[0] - a_)") d=compile_cpp_code(da_cpp_code) f=compile_cpp_code(cpp_code)
-
There is an error in your code, you overwrite
cpp_code
in second line. -
reporter You are correct. By renaming the expression, the code works. However, I agree that a less cryptic error should be printed.
-
reporter - edited description
- changed title to cpp_compile_expression can not be used twice on expression with same type-declaration
- marked as minor
-
reporter - edited description
-
- changed status to resolved
Needs a fix for error message in "dijitso", so not really a DOLFIN issue
- Log in to comment