This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Suggested statement for deprecated does not work

0 votes

Hi,

I run fenics 2016.1.0 under docker; - Windows 10

Received the following suggestion when running demo_hyperelasticity.py :

Expr.geometric_dimension() is deprecated, please use find_geometric_dimension(expr) instead.

However, when the deprecated statement was used: d = u.geometric_dimension(), the program worked okay.

To avoid this message, accordingly, I changed code from d = u.geometric_dimension() to
d = find_geometric_dimension(u) as suggested.

However the following error was output and the program terminated:
name 'find_geometric_dimension' is not defined

I looked at the following link on All classes and function in DOLFIN(Python) but did not see either of the statements.

https://fenicsproject.org/documentation/dolfin/2016.1.0/python/genindex.html

Any advice why the suggestion was rejected would be appreciated? The broader question is what document should I refer in future in similar situations to see the current specifications?

Thanks
vas

asked Aug 14, 2016 by vas FEniCS Novice (330 points)
edited Aug 15, 2016 by vas

1 Answer

0 votes

Hi, find_geometric_dimension is and UFL function. Consider

from dolfin import *

mesh = UnitSquareMesh(10, 10)
V = FunctionSpace(mesh, 'CG', 1)
f = Function(V)

# Either
print f.ufl_domain().geometric_dimension()

# Or
import ufl
print ufl.domain.find_geometric_dimension(f) 

I agree that the deprecation message does not help much in this case. Consider reporting an issue about it on Bitbucket. About the broader question; my advice is to read directly the source code. FEniCS is also mirrored on GitHub where you can search through code which makes learning much quicker/easier.

answered Aug 18, 2016 by MiroK FEniCS Expert (80,920 points)

Hi

Thank you for the leads. I am really learning the ropes. Bitbucket and Giithub are alien to me at the moment but I will do the hard yards and learn how to use these forums.

Thanks again.

vas

...