Skip to content
Snippets Groups Projects
Commit 951c95b9 authored by Stephan Schulz's avatar Stephan Schulz
Browse files

the ALL object should not catch exceptions, add error handling to readme

parent e12854e8
Branches
Tags
1 merge request!8Refactor
Pipeline #53200 failed
......@@ -123,6 +123,10 @@ from `ALL.hpp`. All classes are encapsulated in the `ALL` name space.
Simple (and not so simple) examples are available in the `/examples` sub
directory. The simple examples are also documented at length.
Errors are treated as exceptions that are thrown of a (sub) class of
`ALL::CustomException`. Likely candidates that may throw are `balance`,
`setup`, `printVTKoutlines`.
### ALL object
The ALL object can be constructed with
......@@ -239,6 +243,12 @@ becomes
call ALL_get_work(work) !or
!call all%get_work(work)
Since there is no exception handling in Fortran, the error handling from
the libc is borrowed. So there are additional function that retrieve and
reset an error number as well as an additional error message describing
the error. These must be queried and handled by the user. An example of
this usage is shown in the `ALL_Staggered_f` example when printing the
VTK outlines.
### Details of the balancing methods
#### Tensor based
......
......@@ -283,12 +283,7 @@ public:
/// method to call the setup of the chosen balancing method (not all methods
/// require a setup)
void setup() {
try {
balancer->setup();
} catch (CustomException &e) {
std::cout << e.what() << std::endl;
MPI_Abort(MPI_COMM_WORLD, -1);
}
}
/// method the trigger the balancing step, that updates the vertices according
......@@ -297,7 +292,6 @@ public:
/// for some recursive calls of the routine by some methods
/// @result std::vector<ALL::Point<T>> containing the shifted set of vertices
std::vector<Point<T>> &balance() {
try {
nVertices = balancer->getNVertices();
switch (method) {
case LB_t::TENSOR:
......@@ -394,10 +388,6 @@ public:
"Unknown type of loadbalancing passed.");
}
loadbalancing_step++;
} catch (CustomException &e) {
std::cout << e.what() << std::endl;
MPI_Abort(MPI_COMM_WORLD, -1);
}
return balancer->getVertices();
}
......@@ -499,12 +489,7 @@ public:
/// next-near neighbors instead of only with next neighbors
/// @param[in] minSize the minimum size of a domain in each dimension
void setMinDomainSize(const std::vector<T> &minSize) {
try {
(balancer.get())->setMinDomainSize(minSize);
} catch (CustomException &e) {
std::cout << e.what() << std::endl;
MPI_Abort(MPI_COMM_WORLD, -1);
}
}
#ifdef ALL_VTK_OUTPUT
......@@ -666,7 +651,6 @@ public:
/// @param[in] step the number of the loadbalancing step used for numbering
/// the output files
void printVTKvertices(const int step) {
try {
int n_ranks;
int local_rank;
......@@ -788,11 +772,6 @@ public:
delete[] global_vertices;
}
} catch (CustomException &e) {
std::cout << e.what() << std::endl;
MPI_Abort(MPI_COMM_WORLD, -1);
}
}
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment