- edited description
garbage values in adapted FacetFunction
the new edges in adapted facet function are not initialized to a sensible values (0 would be better?)
from dolfin import *
parameters["refinement_algorithm"] = "plaza_with_parent_facets"
mesh = UnitSquareMesh(1, 1)
mesh1 = refine(mesh)
f = FacetFunction("size_t", mesh)
f.set_all(0)
f.array()[1] = 1
print f.array()
f1 = adapt(f, mesh1)
print f1.array()
plot(f,interactive=True)
plot(f1,interactive=True)
Comments (15)
-
reporter -
- removed responsible
-
- marked as minor
-
0 is not better because 0 may have a specific meaning in the user application. Therefore we use some numeric limits value. Don't remember off the top of my head how to fetch that value but there is a simple way.
-
reporter ok, thanks for the explanation - any number may have a specific meaning in user application, but somehow 0 would seem more natural and expected placeholder value.... i should have checked the source.
-
Problem is that zero is commonly used (it used to be the 'default'). We could add an extra argument for the value on entities that are not otherwise set.
-
The returned value is
np.uintp(-1)
on my system. This should be fine as long as it is documented. -
Maybe think also of
#377when/if fixing this. It could cause unusability of the Python interface. -
Maybe we can transition to using signed integer types in
MeshFunction
, which would solve the problem (use -1).MeshFunction
already supportsint
, so it would just be a case of movingsize_t
toint64
or something. -
The problem will be the same as long as a new value is not documented. I'm quite reluctant to adding another integer type while not necessary.
FWI, we have been discussing integer types clean-up in
fem
andla
code recently with Garth and figured out that the current situation is probably the best (not ideal but best while considering PETSc restrictions). So we quit changing int types there. Anyway we could still changesize_t
to signedint64
but that does not far consequences indofmap
andla
code and was not priority.So I would not be against introducing
int64
if getting rid ofsize_t
in whole DOLFIN. -
I like Garths idea of introducing a user-settable default value. Kind of like python's defaultdict.
-
Well, maybe not a priority, but there are good reasons for using signed integers. -1 is always -1 in either integer size, for example... agree we should document whatever we decide.
-
Issue
#557was marked as a duplicate of this issue. -
- changed milestone to 2017.2
-
assigned issue to
-
- changed milestone to 2018.1
- Log in to comment