surprising results from DoFHandler.locally_owned_dofs() calls in the fully distributed triangulation

60 views
Skip to first unread message

Marek Čapek

unread,
Dec 15, 2017, 5:14:24 PM12/15/17
to deal.II User Group
Hello,
I have downloaded and installed 8.5.1 version of dealii library
using candi. I needed to use calls of

const IndexSet& DoFHandler< dim, spacedim >::locally_owned_dofs
(
) const



And

void DoFTools::extract_locally_relevant_dofs ( const DoFHandlerType &  dof_handler,


IndexSet dof_set 

)





For setting up of ghosted vectors.
May be I understand wrongly some design concepts, however it appears to me,
that these functions do not work correctly.
Namely, they both return IndexSet with size of the "complete universum" of dofs,
i.e. the indexsets are not distributed.

My code is rather complicated, so I have prepared slight modification of step-40,
where the following printout shows the misbehaviour:


pcout<<"--------------------------------------------this works correctly-------------"<<std::endl;
      std::vector<types::global_dof_index> n_dofs_per_core = dof_handler.n_locally_owned_dofs_per_processor    ();

    for(std::vector<types::global_dof_index>::iterator it=n_dofs_per_core.begin();it!=n_dofs_per_core.end();++it)
       pcout<<"size of dofs per core according to dof_handler.n_locally_owned_dofs_per_processor() "<<*it<<std::endl;


    pcout<<"--------------------------------------------this is strange-------------"<<std::endl;

     std::vector<IndexSet>   dof_per_core = dof_handler.locally_owned_dofs_per_processor();

    for( std::vector<IndexSet>::iterator it=dof_per_core.begin();it!=dof_per_core.end();++it)
           pcout<<"size of dofs pers core according to dof_handler.locally_owned_dofs_per_processor()  "<<(*it).size()<<std::endl;
    pcout<<"-------------------------------------------AND-------------"<<std::endl;
    std::cout<<"number of  locally owned dofs  "<<locally_owned_dofs.size()<<std::endl;
        std::cout<<"number of locally relevant dofs  "<<locally_relevant_dofs.size()<<std::endl;



It appears to me, that the data structure with Dofs in in inconsistent state. I have tried both Trilinos and
Petsc backends.
I am adding the complete modified step-40 to the attachment.
Please take a look at it, or maybe correct my opinion.

Thank You

Marek C



step-40.cc

Denis Davydov

unread,
Dec 16, 2017, 12:59:44 AM12/16/17
to deal.II User Group
Hi,


On Friday, December 15, 2017 at 11:14:24 PM UTC+1, Marek Čapek wrote:
Hello,
I have downloaded and installed 8.5.1 version of dealii library
using candi. I needed to use calls of

const IndexSet& DoFHandler< dim, spacedim >::locally_owned_dofs
(
) const



And

void DoFTools::extract_locally_relevant_dofs ( const DoFHandlerType &  dof_handler,


IndexSet dof_set 

)





For setting up of ghosted vectors.
May be I understand wrongly some design concepts, however it appears to me,
that these functions do not work correctly.
Namely, they both return IndexSet with size of the "complete universum" of dofs,

You need to check documentation of IndexSet class https://www.dealii.org/developer/doxygen/deal.II/classIndexSet.html 
which is designed to represent a subset of the [0, size)
So both represent the subsets of the same set of all DoFs in your problem and their size() is the same,
however n_elements() will be different.

Cheers,
Denis.
Reply all
Reply to author
Forward
0 new messages