Skip to content
Snippets Groups Projects
Commit bd186928 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Fix error management in parallel (MPI or threads)

parent f3150c5b
No related branches found
No related tags found
1 merge request!96Add random number engine encapsulation.
......@@ -36,16 +36,21 @@ class MeshNodeBoundary // clazy:exclude=copyable-polymorphic
const auto& face_to_cell_matrix = mesh.connectivity().faceToCellMatrix();
const Array<const FaceId>& face_list = ref_face_list.list();
parallel_for(
face_list.size(), PUGS_LAMBDA(int l) {
bool is_bad = false;
parallel_for(face_list.size(), [=, &is_bad](int l) {
const auto& face_cells = face_to_cell_matrix[face_list[l]];
if (face_cells.size() > 1) {
is_bad = true;
}
});
if (parallel::allReduceOr(is_bad)) {
std::ostringstream ost;
ost << "invalid boundary " << rang::fgB::yellow << this->m_boundary_name << rang::style::reset
<< ": inner faces cannot be used to define mesh boundaries";
throw NormalError(ost.str());
}
});
Kokkos::vector<unsigned int> node_ids;
// not enough but should reduce significantly the number of resizing
......@@ -109,16 +114,21 @@ class MeshFlatNodeBoundary : public MeshNodeBoundary<Dimension> // clazy:exclu
const NodeValue<const Rd>& xr = mesh.xr();
parallel_for(
this->m_node_list.size(), PUGS_LAMBDA(const size_t r) {
bool is_bad = false;
parallel_for(this->m_node_list.size(), [=, &is_bad](int r) {
const Rd& x = xr[this->m_node_list[r]];
if (dot(x - origin, normal) > 1E-13 * length) {
is_bad = true;
}
});
if (parallel::allReduceOr(is_bad)) {
std::ostringstream ost;
ost << "invalid boundary " << rang::fgB::yellow << this->m_boundary_name << rang::style::reset
<< ": boundary is not flat!";
throw NormalError(ost.str());
}
});
}
template <typename MeshType>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment