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

Check parallel ghost layers and stencil layers compatibility

If the number of required stencil layers is greater than the number of
ghost layers in parallel, then the code emits a normal error
indicating to increase the number of ghost layers.
parent fd575f16
No related branches found
No related tags found
1 merge request!205High-order polynomial reconstruction
......@@ -2,6 +2,7 @@
#include <mesh/Connectivity.hpp>
#include <mesh/ItemArray.hpp>
#include <utils/GlobalVariableManager.hpp>
#include <utils/Messenger.hpp>
#include <set>
......@@ -113,6 +114,18 @@ StencilBuilder::_build(const ConnectivityType& connectivity,
size_t number_of_layers,
const BoundaryDescriptorList& symmetry_boundary_descriptor_list) const
{
if ((parallel::size() > 1) and (number_of_layers > GlobalVariableManager::instance().getNumberOfGhostLayers())) {
std::ostringstream error_msg;
error_msg << "Stencil builder requires" << rang::fgB::yellow << number_of_layers << rang::fg::reset
<< " layers while parallel number of ghost layer is "
<< GlobalVariableManager::instance().getNumberOfGhostLayers() << ".\n";
error_msg << "Increase the number of ghost layers (using '--number-of-ghost-layers' option).";
throw NormalError(error_msg.str());
}
if (number_of_layers > 2) {
throw NotImplementedError("number of layers too large");
}
if (symmetry_boundary_descriptor_list.size() == 0) {
if (number_of_layers == 1) {
Array<const uint32_t> row_map = this->_getRowMap(connectivity);
......@@ -120,13 +133,6 @@ StencilBuilder::_build(const ConnectivityType& connectivity,
return {ConnectivityMatrix{row_map, column_indices}, {}};
} else {
if (number_of_layers > 2) {
throw NotImplementedError("number of layers too large");
}
if (parallel::size() > 1) {
throw NotImplementedError("stencils with more than 1 layers are not defined in parallel");
}
auto cell_to_node_matrix = connectivity.cellToNodeMatrix();
auto node_to_cell_matrix = connectivity.nodeToCellMatrix();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment