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

Access number of dofs from a dofmap object

0 votes

Hi,

I want to extract the number of dofs over a given FunctionSpace V :

V = VectorFunctionSpace(MyMesh, "Lagrange", 1)

I though I could access it through "dofmap()" :

dofmap = V.dofmap()

Is there a way to access dimension of this dofmap object ?

Many thanks in advance !

Claire

asked Mar 1, 2016 by Claire L FEniCS User (2,120 points)

2 Answers

+2 votes

The global number of dofs is available through

V.dim()

The local dimension of dofs can be found through

V.dofmap().local_dimension("owned") # For owned dofs only
V.dofmap().local_dimension("unowned") # For unowned dofs only
V.dofmap().local_dimension("unowned") # For both owned and unowned dofs

The local dofs can be accessed through V.dofmap().dofs().

answered Mar 1, 2016 by Øyvind Evju FEniCS Expert (17,700 points)
+1 vote

Hi,
consider:

dofmap.global_dimension()

(see here for some references).

answered Mar 1, 2016 by hernan_mella FEniCS Expert (19,460 points)
...