-
Notifications
You must be signed in to change notification settings - Fork 708
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
Expose RemotePointEvaluation parameters in non-nested multigrid #15899
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -706,6 +706,35 @@ class MGTwoLevelTransferNonNested<dim, | |||||
using VectorizedArrayType = VectorizedArray<Number, 1>; | ||||||
|
||||||
public: | ||||||
/** | ||||||
* AdditionalData structure with the arguments needed by | ||||||
* RemotePointEvaluation. Default values are the same as the ones described in | ||||||
* the documentation of RemotePointEvaluation. The last boolean parameter, @p enf_all_points_found is true by defaults and | ||||||
* checks if RemotePointEvaluation::all_points_found() evaluates to true, i.e. | ||||||
* all submitted points have been found inside the domain. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would write the text more general, since we plan to add more parameters. |
||||||
*/ | ||||||
struct AdditionalData | ||||||
{ | ||||||
AdditionalData(const double tol = 1e-6, | ||||||
const bool enf_unique_mapping = false, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not needed. |
||||||
const unsigned int rtree_l = 0, | ||||||
const std::function<std::vector<bool>()> &marked_verts = {}, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not needed. |
||||||
const bool enf_all_points_found = true) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
: tolerance(tol) | ||||||
, enforce_unique_mapping(enf_unique_mapping) | ||||||
, rtree_level(rtree_l) | ||||||
, marked_vertices(marked_verts) | ||||||
, enforce_all_points_found(enf_all_points_found) | ||||||
{} | ||||||
double tolerance; | ||||||
bool enforce_unique_mapping; | ||||||
unsigned int rtree_level; | ||||||
std::function<std::vector<bool>()> marked_vertices; | ||||||
bool enforce_all_points_found; | ||||||
}; | ||||||
|
||||||
MGTwoLevelTransferNonNested(const AdditionalData &data = AdditionalData()); | ||||||
|
||||||
/** | ||||||
* Set up transfer operator between the given DoFHandler objects ( | ||||||
* @p dof_handler_fine and @p dof_handler_coarse). | ||||||
|
@@ -749,6 +778,7 @@ class MGTwoLevelTransferNonNested<dim, | |||||
memory_consumption() const override; | ||||||
|
||||||
protected: | ||||||
AdditionalData additional_data; | ||||||
/** | ||||||
* Perform prolongation. | ||||||
*/ | ||||||
|
@@ -788,7 +818,7 @@ class MGTwoLevelTransferNonNested<dim, | |||||
* Object to evaluate shape functions on one mesh on visited support points of | ||||||
* the other mesh. | ||||||
*/ | ||||||
Utilities::MPI::RemotePointEvaluation<dim> rpe; | ||||||
std::shared_ptr<Utilities::MPI::RemotePointEvaluation<dim>> rpe; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The change to shared_ptr is not needed!? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, it was a leftover from debugging. Fixed, thanks |
||||||
|
||||||
/** | ||||||
* MappingInfo object needed as Mapping argument by FEPointEvaluation. | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4100,6 +4100,19 @@ namespace internal | |||||
} // namespace internal | ||||||
|
||||||
|
||||||
|
||||||
template <int dim, typename Number> | ||||||
MGTwoLevelTransferNonNested<dim, LinearAlgebra::distributed::Vector<Number>>:: | ||||||
MGTwoLevelTransferNonNested(const AdditionalData &data) | ||||||
: additional_data(data) | ||||||
{ | ||||||
rpe = std::make_shared<Utilities::MPI::RemotePointEvaluation<dim>>( | ||||||
data.tolerance, | ||||||
data.enforce_unique_mapping, | ||||||
data.rtree_level, | ||||||
data.marked_vertices); | ||||||
} | ||||||
|
||||||
template <int dim, typename Number> | ||||||
void | ||||||
MGTwoLevelTransferNonNested<dim, LinearAlgebra::distributed::Vector<Number>>:: | ||||||
|
@@ -4170,13 +4183,19 @@ MGTwoLevelTransferNonNested<dim, LinearAlgebra::distributed::Vector<Number>>:: | |||||
this->partitioner_fine->global_to_local(global_dof_indices[i]); | ||||||
|
||||||
// hand points over to RPE | ||||||
rpe.reinit(points, dof_handler_coarse.get_triangulation(), mapping_coarse); | ||||||
rpe->reinit(points, dof_handler_coarse.get_triangulation(), mapping_coarse); | ||||||
|
||||||
if (additional_data.enforce_all_points_found) | ||||||
AssertThrow( | ||||||
rpe->all_points_found(), | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
ExcMessage( | ||||||
"You requested that all points should be found, but this didn't happen. You can change this option through the AdditionaData struct in the constructor.")); | ||||||
|
||||||
// set up MappingInfo for easier data access | ||||||
mapping_info = internal::fill_mapping_info<dim, Number>(rpe); | ||||||
mapping_info = internal::fill_mapping_info<dim, Number>(*rpe); | ||||||
|
||||||
// set up constraints | ||||||
const auto &cell_data = rpe.get_cell_data(); | ||||||
const auto &cell_data = rpe->get_cell_data(); | ||||||
|
||||||
constraint_info.reinit(dof_handler_coarse, | ||||||
cell_data.cells.size(), | ||||||
|
@@ -4185,7 +4204,7 @@ MGTwoLevelTransferNonNested<dim, LinearAlgebra::distributed::Vector<Number>>:: | |||||
for (unsigned int i = 0; i < cell_data.cells.size(); ++i) | ||||||
{ | ||||||
typename DoFHandler<dim>::active_cell_iterator cell( | ||||||
&rpe.get_triangulation(), | ||||||
&rpe->get_triangulation(), | ||||||
cell_data.cells[i].first, | ||||||
cell_data.cells[i].second, | ||||||
&dof_handler_coarse); | ||||||
|
@@ -4295,18 +4314,18 @@ MGTwoLevelTransferNonNested<dim, LinearAlgebra::distributed::Vector<Number>>:: | |||||
} | ||||||
}; | ||||||
|
||||||
rpe.template evaluate_and_process<value_type>(evaluation_point_results, | ||||||
buffer, | ||||||
evaluation_function); | ||||||
rpe->template evaluate_and_process<value_type>(evaluation_point_results, | ||||||
buffer, | ||||||
evaluation_function); | ||||||
|
||||||
// Weight operator in case some points are owned by multiple cells. | ||||||
if (rpe.is_map_unique() == false) | ||||||
if (rpe->is_map_unique() == false) | ||||||
{ | ||||||
const auto evaluation_point_results_temp = evaluation_point_results; | ||||||
evaluation_point_results.clear(); | ||||||
evaluation_point_results.reserve(rpe.get_point_ptrs().size() - 1); | ||||||
evaluation_point_results.reserve(rpe->get_point_ptrs().size() - 1); | ||||||
|
||||||
const auto &ptr = rpe.get_point_ptrs(); | ||||||
const auto &ptr = rpe->get_point_ptrs(); | ||||||
|
||||||
for (unsigned int i = 0; i < ptr.size() - 1; ++i) | ||||||
{ | ||||||
|
@@ -4388,7 +4407,7 @@ MGTwoLevelTransferNonNested<dim, LinearAlgebra::distributed::Vector<Number>>:: | |||||
std::vector<value_type> evaluation_point_results; | ||||||
std::vector<value_type> buffer; | ||||||
|
||||||
evaluation_point_results.resize(rpe.get_point_ptrs().size() - 1); | ||||||
evaluation_point_results.resize(rpe->get_point_ptrs().size() - 1); | ||||||
|
||||||
for (unsigned int j = 0; j < evaluation_point_results.size(); ++j) | ||||||
{ | ||||||
|
@@ -4423,9 +4442,9 @@ MGTwoLevelTransferNonNested<dim, LinearAlgebra::distributed::Vector<Number>>:: | |||||
} | ||||||
|
||||||
// Weight operator in case some points are owned by multiple cells. | ||||||
if (rpe.is_map_unique() == false) | ||||||
if (rpe->is_map_unique() == false) | ||||||
{ | ||||||
const auto &ptr = rpe.get_point_ptrs(); | ||||||
const auto &ptr = rpe->get_point_ptrs(); | ||||||
|
||||||
for (unsigned int i = 0; i < ptr.size() - 1; ++i) | ||||||
{ | ||||||
|
@@ -4470,9 +4489,9 @@ MGTwoLevelTransferNonNested<dim, LinearAlgebra::distributed::Vector<Number>>:: | |||||
} | ||||||
}; | ||||||
|
||||||
rpe.template process_and_evaluate<value_type>(evaluation_point_results, | ||||||
buffer, | ||||||
evaluation_function); | ||||||
rpe->template process_and_evaluate<value_type>(evaluation_point_results, | ||||||
buffer, | ||||||
evaluation_function); | ||||||
} | ||||||
|
||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.