- changed version to dev
Renaming a Function during creation does not work completely
Issue #921
new
Setting the label of a Function during creation does not work. You can only set the label using the .rename("name", "label") method. Here is a short example which shows this behaviour:
from fenics import *
mesh = UnitSquareMesh(4, 4)
V = FunctionSpace(mesh, "P", 1)
v = Function(V, name="v", label="Some quantity")
print("v.name(): {} v.label(): {}".format(v.name(), v.label()))
v.rename("v", "Some quantity")
print("v.name(): {} v.label(): {}".format(v.name(), v.label()))
Comments (5)
-
reporter -
Is anywhere documented that this is supposed to work? I don't see a reason why this should work.
-
reporter Maybe it is not, but this should be very easy to "fix". I located the issue in the init of class Function in src/site-packages/dolfin/functions/function.py:
name = kwargs.get("name") or "f_%d" % self.count() self.rename(name, "a Function")
This should be sufficient:
name = kwargs.get("name") or "f_%d" % self.count() label = kwargs.get("label") or "a Function" self.rename(name, label)
-
Can you open a pull request?
-
reporter Here it is: pull request #388
- Log in to comment