mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-30 11:06:55 -06:00
Catch exceptions by const reference to prevent warnings.
e.g. gcc issued: "warning: catching polymorphic type ‘class cl::Error’ by value [-Wcatch-value=]"
This commit is contained in:
parent
faaee51d09
commit
efd3aeb290
@ -514,13 +514,13 @@ void openclSolverBackend<block_size>::initialize(int N_, int nnz_, int dim, doub
|
|||||||
|
|
||||||
prec->setKernels(ILU_apply1_k.get(), ILU_apply2_k.get());
|
prec->setKernels(ILU_apply1_k.get(), ILU_apply2_k.get());
|
||||||
|
|
||||||
} catch (cl::Error error) {
|
} catch (const cl::Error& error) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "OpenCL Error: " << error.what() << "(" << error.err() << ")\n";
|
oss << "OpenCL Error: " << error.what() << "(" << error.err() << ")\n";
|
||||||
oss << getErrorString(error.err());
|
oss << getErrorString(error.err());
|
||||||
// rethrow exception
|
// rethrow exception
|
||||||
OPM_THROW(std::logic_error, oss.str());
|
OPM_THROW(std::logic_error, oss.str());
|
||||||
} catch (std::logic_error error) {
|
} catch (const std::logic_error& error) {
|
||||||
// rethrow exception by OPM_THROW in the try{}, without this, a segfault occurs
|
// rethrow exception by OPM_THROW in the try{}, without this, a segfault occurs
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
@ -665,13 +665,13 @@ void openclSolverBackend<block_size>::solve_system(WellContributions& wellContri
|
|||||||
// actually solve
|
// actually solve
|
||||||
try {
|
try {
|
||||||
gpu_pbicgstab(wellContribs, res);
|
gpu_pbicgstab(wellContribs, res);
|
||||||
} catch (cl::Error error) {
|
} catch (const cl::Error& error) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "openclSolverBackend::solve_system error: " << error.what() << "(" << error.err() << ")\n";
|
oss << "openclSolverBackend::solve_system error: " << error.what() << "(" << error.err() << ")\n";
|
||||||
oss << getErrorString(error.err());
|
oss << getErrorString(error.err());
|
||||||
// rethrow exception
|
// rethrow exception
|
||||||
OPM_THROW(std::logic_error, oss.str());
|
OPM_THROW(std::logic_error, oss.str());
|
||||||
} catch (std::logic_error error) {
|
} catch (const std::logic_error& error) {
|
||||||
// rethrow exception by OPM_THROW in the try{}, without this, a segfault occurs
|
// rethrow exception by OPM_THROW in the try{}, without this, a segfault occurs
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user