public:
/**
- * AdditionalData structure for construction arguments needed by
- * RemotePointEvaluation. Default values are the same as the ones in
- * RemotePointEvaluation.
+ * 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.
*/
struct AdditionalData
{
AdditionalData(const double tol = 1e-6,
const bool enf_unique_mapping = false,
const unsigned int rtree_l = 0,
- const std::function<std::vector<bool>()> &marked_verts = {})
+ const std::function<std::vector<bool>()> &marked_verts = {},
+ const bool enf_all_points_found = true)
: 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());
memory_consumption() const override;
protected:
+ AdditionalData additional_data;
/**
* Perform prolongation.
*/
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,
// hand points over to RPE
rpe->reinit(points, dof_handler_coarse.get_triangulation(), mapping_coarse);
+ if (additional_data.enforce_all_points_found)
+ AssertThrow(
+ rpe->all_points_found(),
+ 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);
}
// set up transfer operator
+ typename MGTwoLevelTransferNonNested<dim, VectorType>::AdditionalData data;
+ data.enforce_all_points_found = false;
for (unsigned int l = min_level; l < max_level; ++l)
{
transfers[l + 1] =
- std::make_shared<MGTwoLevelTransferNonNested<dim, VectorType>>();
+ std::make_shared<MGTwoLevelTransferNonNested<dim, VectorType>>(data);
transfers[l + 1]->reinit(dof_handlers[l + 1],
dof_handlers[l],
mappings[l + 1],
constraint_fine.close();
// setup transfer operator
+ typename MGTwoLevelTransferNonNested<
+ dim,
+ LinearAlgebra::distributed::Vector<Number>>::AdditionalData data;
+ data.enforce_all_points_found = false;
MGTwoLevelTransferNonNested<dim, LinearAlgebra::distributed::Vector<Number>>
- transfer;
+ transfer(data);
MappingQ1<dim> mapping_fine, mapping_coarse;
transfer.reinit(dof_handler_fine,
dof_handler_coarse,