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

Fix parallel normal calculation in 1D

parent 02f1e6d7
No related branches found
No related tags found
1 merge request!11Feature/mpi
......@@ -374,6 +374,9 @@ _getOutgoingNormal(const MeshType& mesh)
const R normal = this->_getNormal(mesh);
double max_height = 0;
if (m_node_list.size()>0) {
const NodeValue<const R>& xr = mesh.xr();
const auto& cell_to_node_matrix
= mesh.connectivity().cellToNodeMatrix();
......@@ -384,13 +387,23 @@ _getOutgoingNormal(const MeshType& mesh)
const NodeId r0 = m_node_list[0];
const CellId j0 = node_to_cell_matrix[r0][0];
const auto& j0_nodes = cell_to_node_matrix[j0];
double max_height = 0;
for (size_t r=0; r<j0_nodes.size(); ++r) {
const double height = (xr[j0_nodes[r]]-xr[r0], normal);
if (std::abs(height) > std::abs(max_height)) {
max_height = height;
}
}
}
Array<double> max_height_array = parallel::allGather(max_height);
for (size_t i=0; i<max_height_array.size(); ++i) {
const double height = max_height_array[i];
if (std::abs(height) > std::abs(max_height)) {
max_height = height;
}
}
if (max_height > 0) {
return -normal;
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment