Problem with custom mesh quality in docker

Hi,

I’ve got a problem regarding a custom implementation of a mesh quality measure. I’ve developed this under Linux (installed fenics with conda), and tested it there (with the ubuntu ppa images) and it works.

Now, I was also testing this under Windows 10, using the docker image quay.io/fenicsproject/stable:latest
and unfortunately, the program does not work.

To reproduce this problem, I have the following MWE

from fenics import *

_cpp_code_mesh_quality = """
			#include <pybind11/pybind11.h>
			#include <pybind11/eigen.h>
			namespace py = pybind11;

			#include <dolfin/mesh/Mesh.h>
			#include <dolfin/mesh/MeshFunction.h>
			#include <dolfin/mesh/Cell.h>

			using namespace dolfin;

			dolfin::MeshFunction<double>
			quality(std::shared_ptr<const Mesh> mesh)
			{
			  MeshFunction<double> cf(mesh, mesh->topology().dim(), 0.0);

			  for (CellIterator cell(*mesh); !cell.end(); ++cell)
			  {
				cf[*cell] = 1.0;
			  }
			  return cf;
			}

			PYBIND11_MODULE(SIGNATURE, m)
			{
			  m.def("quality", &quality);
			}

		"""

obj = compile_cpp_code(_cpp_code_mesh_quality)
mesh = UnitSquareMesh(10,10)
mf = obj.quality(mesh)

which should just return a MeshFunction which has values 1.0 everywhere. This works fine under my Linux installation, but with the Docker image I get the following error:

Traceback (most recent call last):
 File "mwe_meshqual.py", line 41, in <module>
 mf = obj.quality(mesh)
TypeError: quality(): incompatible function arguments. The following argument types are supported:
 1. (arg0: dolfin::Mesh) -> dolfin::MeshFunction<double>

Invoked with: <dolfin.cpp.generation.UnitSquareMesh object at 0x7f460bb8ba98> 

So, apparently the class for this is not correct, but I have no clue why there is a different behavior between docker and my installation (I also use fenics 2019.1.0, which is the same used for docker)

Thanks a lot for your time.

Interesting… I just threw this into a a testing container that I have on binder (which essentially is a docker container under the hood) and it works absolutely fine.

Well, that’s good news, but makes the problem seems a bit more erratic then…

Thanks for trying this out!

Just tested this on a docker container that I have on my laptop (albeit it has dolfin 2019.2.0.dev0) and it runs fine there too. The one on binder runs 2019.1.0 version.

I’ve now tested 2019.2.0.dev0, too, and it again works there. Same for the stable:2019.1.0.r3 version.
This is a rather strange behavior, maybe a bug in the stable:latest image?