dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #26284
Re: DofMap.tabulate_vertex_map
-
To:
"Garth N. Wells" <gnw20@xxxxxxxxx>
-
From:
Johan Hake <hake.dev@xxxxxxxxx>
-
Date:
Mon, 28 Jan 2013 22:44:21 +0100
-
Cc:
dolfin-dev <dolfin@xxxxxxxxxxxxxxxxxxx>
-
In-reply-to:
<CAA4C66MSPcp8TYy_jcSY=B3Okz-MBqbCpyq5-auwcCX1UD3x8Q@mail.gmail.com>
-
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2
On 01/28/2013 10:41 PM, Garth N. Wells wrote:
> On 28 January 2013 21:35, Johan Hake <hake.dev@xxxxxxxxx> wrote:
>> On 01/28/2013 10:31 PM, Garth N. Wells wrote:
>>> On 28 January 2013 21:22, Anders Logg <logg@xxxxxxxxx> wrote:
>>>> On Mon, Jan 28, 2013 at 10:10:40PM +0100, Johan Hake wrote:
>>>>> Hello!
>>>>>
>>>>> I have now added a method to DofMap, which tabulate a map between
>>>>> vertices and dofs. It will only work for DofMaps with dofs on vertices.
>>>>> So basically for any CG 1 FunctionSpaces and will raise error else wise.
>>>>>
>>>>> Usage:
>>>>>
>>>>> from dolfin import *
>>>>> import numpy as np
>>>>> mesh = UnitSquareMesh(10,10)
>>>>> V = VectorFunctionSpace(mesh, "CG", 1)
>>>>> u = Function(V)
>>>>> u.interpolate(Constant((1,2)))
>>>>> vert_values = np.zeros(mesh.num_vertices()*2)
>>>>> vert_values[V.dofmap().tabulate_vertex_map(mesh)] = \
>>>>> u.vector().array()
>>>>> print vert_values
>>>>>
>>>>> In parallel the map will follow the local dofs. This means that some
>>>>> values in vert_values above will still be 0. The 0 values will then
>>>>> correspond to vertex values which are owned by another process.
>>>>>
>>>>> In C++ the method returns a std::vector<std::size_t>.
>>>>>
>>>>> Questions:
>>>>> Does the name "tabulate_vertex_map" work?
>>>>
>>>> Sounds ok.
>>>>
>>>
>>> Doesn't mean much to me. Can it be more descriptive?
>>
>> Because it is a member of dofmap I did not include "dof" in the name.
>>
>> But what with one of:
>>
>> vertex_to_dof_map
>
> This is ok.
I am fine with that.
> What does it do if it's not a P1 element?
Throws an error:
-------------------------------------------------------------------------
*** Error: Unable to tabulating vertex to dofs.
*** Reason: Can only tabulate dofs on vertices.
*** Where: This error was encountered inside DofMap.cpp.
*** Process: 0
***
-------------------------------------------------------------------------
Johan
> Garth
>
>> tabulate_vertex_to_dof_map
>>
>>>>> Should a version of this method exist in other classes. FunctionSpace,
>>>>> Function (without the mesh argument of course)?
>>>>
>>>> Yes, would be good to have for convenience.
>>>>
>>>
>>> I don't see the benefit of spreading it around. It should just belong to DofMap.
>>
>> I am fine with both.
>>
>> Johan
>>
>>> Garth
>>>
>>>> What is the relation to Function::compute_vertex_values?
>>>>
>>>> --
>>>> Anders
>>>>
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~dolfin
>>>> Post to : dolfin@xxxxxxxxxxxxxxxxxxx
>>>> Unsubscribe : https://launchpad.net/~dolfin
>>>> More help : https://help.launchpad.net/ListHelp
>>
References