- edited description
Providing np.int64 as subdomain id to a measure leads to wrong ffc code with empty measures
Issue #1102
new
Providing a np.int64
value with an empty cache to a Dolfin measure leads to zero measures. Even providing a Python int
afterwards keeps the wrong code and does neither trigger an error or a recompile.
Clearing the cache and first calling the measure with an int
creates the correct ffc code which then can be called with a np.int64
as well and producing in the correct results.
Minimal Working Example for FEniCS 2019.1.0
from multiprocessing import Process
import numpy as np
import dijitso
import dolfin as df
def square_perimeter(data_type, clear_cache):
if clear_cache:
dijitso.main(("clean",))
mesh = df.UnitSquareMesh(10, 10)
mf = df.MeshFunction("size_t", mesh, 1, 0)
measure = df.Measure("ds")(subdomain_data=mf, domain=mesh)
perimeter = df.assemble(1.0 * measure(data_type(0)))
print(f"{data_type}: {perimeter}")
def call(*args):
p = Process(target=square_perimeter, args=args)
p.start()
p.join()
if __name__ == "__main__":
call(int, True) # result correct
call(np.int64, False) # result correct
call(np.int64, True) # result wrong
call(int, False) # result wrong
Output
<class 'int'>: 4.000000000000003
<class 'numpy.int64'>: 4.000000000000003
<class 'numpy.int64'>: 0.0
<class 'int'>: 0.0
Comments (2)
-
reporter -
reporter - edited description
- Log in to comment