From 6d8ee342dcfebbdd7d2f621a8e5435f5031de762 Mon Sep 17 00:00:00 2001 From: Martin Genet <martin@mortis.local> Date: Fri, 14 Sep 2018 10:51:16 +0200 Subject: [PATCH] Generated image expression now contains the displacement field --- generated_image_expressions_cpp.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/generated_image_expressions_cpp.py b/generated_image_expressions_cpp.py index 0ed3fa4..e193a36 100644 --- a/generated_image_expressions_cpp.py +++ b/generated_image_expressions_cpp.py @@ -46,6 +46,7 @@ public: vtkSmartPointer<vtkImageInterpolator> interpolator; // MG20180913: pointer would be instantiated at class object construction, but would point toward nothing; object would not be instantiated double static_scaling; std::shared_ptr<dolfin::Mesh> mesh; + std::shared_ptr<dolfin::Function> U; MyExpr(): Expression(), @@ -73,14 +74,20 @@ public: } void init_mesh( - const dolfin::Mesh* mesh) + const std::shared_ptr<dolfin::Mesh> mesh_) { - mesh = mesh; + mesh = mesh_; std::cout << mesh->num_vertices() << std::endl; std::cout << mesh->num_cells() << std::endl; } + void init_disp( + const std::shared_ptr<dolfin::Function> U_) + { + U = U_; + } + void eval(Array<double>& expr, const Array<double>& X) const {'''+(''' std::cout << "X = " << X.str(1) << std::endl;''')*(verbose)+''' -- GitLab