import mesh function in UFL file or access UFL file python dict data inside main cpp file

7 weeks ago by
Hi Everyone,

Need some help on getting some data transfer between UFL and main cpp file for a C++ model

I have two needs and if one can be solved it can serve my purpose
1. Can I somehow import facet Mesh Function data into UFL file itself. It's because I have some python functions to evaluate some function on a particular facets.
2. Is there any way to access python dict data which have been read in UFL file. Seems like I can only access ufl specific variables like coefficients, constant, form etc.

I think second point is more important to reduce python based calculation in point one within UFL

For point one I tried this within UFL file:
element = FiniteElement("Lagrange", tetrahedron, 1)
mesh = Mesh("../mesh.xdmf")

But it gives this error:

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
*** -------------------------------------------------------------------------
*** Error:   Unable to creating dolfin.Form.
*** Reason:  Expecting to find a Mesh in the form..
*** Where:   This error was encountered inside
*** Process: 0
*** DOLFIN version: 2017.2.0
*** Git changeset:  774aa9b05f5a21fcf3d1bd632e722933a05fdb45
*** -------------------------------------------------------------------------

Community: FEniCS Project
Please login to add an answer/comment or follow this question.

Similar posts:
Search »