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

Accessing DofMap data in c++

+1 vote

I have seen the following q&a entry:

http://fenicsproject.org/qa/4224/create-dofmap-in-c?show=4224#q4224

The dofmap returned in this example is a GenericDofMap class, and I am not able to interrogate this object since it contains virtual functions and is an abstract class (it seems). So how do I get access to the actual DofMap?? I would like (for now) to print something to screen that provides information about how the dofs are mapped amongst different processors in parallel operation.

For example:

std::shared_ptr dofmap = V.dofmap();
std::vector dofs = dofmap.dofs();

Returns the error:

‘class std::shared_ptr’ has no member named ‘dofs’

Thank you,

Ben

asked Sep 2, 2015 by brk888 FEniCS Novice (990 points)
edited Sep 2, 2015 by brk888

1 Answer

+1 vote
 
Best answer

std::shared_ptr is a pointer class, and has to be dereferenced with "->",

e.g. dofmap->dofs()

answered Sep 2, 2015 by chris_richardson FEniCS Expert (31,740 points)
selected Sep 4, 2015 by johannr

Thank you, that did the trick!

...