Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Triangulation: implement global_*_cell_index_partitioner() #14270

Merged

Conversation

peterrum
Copy link
Member

... so that one does not have to cast the Triangulation object to parallel::TriangulationBase. CellAccessor has the necessary information independent of type of mesh.

@@ -1615,6 +1616,22 @@ class Triangulation : public Subscriptor
virtual MPI_Comm
get_communicator() const;

/**
* Return partitioner for the global indices of the cells on the active
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we have this text also in the derived class, but I believe we typically use the style

Suggested change
* Return partitioner for the global indices of the cells on the active
* Return the partitioner for the global indices of the cells on the active

See also the documentation of the function set_mesh_smoothing below. (On the other hand, the one immediately preceding this does not use the article, so I am a bit split.)

const std::weak_ptr<const Utilities::MPI::Partitioner>
Triangulation<dim, spacedim>::global_active_cell_index_partitioner() const
{
return std::make_shared<const Utilities::MPI::Partitioner>(n_active_cells());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we never use this inside loops and rather only in basic circumstances? While the setup of an MPI_COMM_SELF partitioner should be cheap, it is not that cheap that we would like to do it millions of times.

Copy link
Member

@drwells drwells Sep 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how this can work - won't the object always get deleted immediately since weak_ptr won't keep it alive? For example, if I do

#include <memory>
#include <iostream>

std::weak_ptr<int>
get_42()
{
    return std::make_shared<int>(42);
}

int main()
{
    auto v = get_42();
    std::cout << "expired() = " << v.expired() << std::endl;
}

then the output is expired() = 1.

@peterrum peterrum force-pushed the tria_global_active_cell_index_partitioner branch from 97fe4dd to c8bc1b8 Compare September 14, 2022 19:42
Copy link
Member

@drwells drwells left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this also now works in 1D - nice!

@drwells
Copy link
Member

drwells commented Sep 15, 2022

/rebuild

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants