Merge pull request #391 from akva2/janitorin_sca

Quell some low-hanging SCA warnings
This commit is contained in:
Bård Skaflestad 2024-08-27 12:11:45 +02:00 committed by GitHub
commit 2a38ff2a3f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 24 additions and 23 deletions

View File

@ -56,6 +56,12 @@ class ASMHandler {
delete it->second; delete it->second;
} }
//! \brief No copying of this class
ASMHandler(const ASMHandler&) = delete;
//! \brief No copying of this class
ASMHandler& operator=(const ASMHandler&) = delete;
//! \brief A vectorial node value //! \brief A vectorial node value
typedef Dune::FieldVector<double,dim> NodeValue; typedef Dune::FieldVector<double,dim> NodeValue;
@ -227,11 +233,6 @@ class ASMHandler {
//! \brief The number of equations in the system //! \brief The number of equations in the system
size_t maxeqn; size_t maxeqn;
private:
//! \brief No copying of this class
ASMHandler(const ASMHandler&) {}
//! \brief No copying of this class
ASMHandler& operator=(const ASMHandler&) {}
}; };
} }

View File

@ -44,12 +44,12 @@ Schwarz::type* Schwarz::setup2(std::shared_ptr<Operator>& op,
int nel2 = gv.logicalCartesianSize()[1]; int nel2 = gv.logicalCartesianSize()[1];
rows.resize(nel1/cps*nel2/cps); rows.resize(nel1/cps*nel2/cps);
auto set = gv.leafGridView().indexSet(); const auto& set = gv.leafGridView().indexSet();
for (auto it = gv.leafGridView().begin<0>(), e = gv.leafGridView().end<0>(); for (auto it = gv.leafGridView().begin<0>(), e = gv.leafGridView().end<0>();
it != e; ++it) { it != e; ++it) {
std::array<int, 3> ijk; std::array<int, 3> ijk;
gv.getIJK(set.index(*it), ijk); gv.getIJK(set.index(*it), ijk);
const int rowix = (ijk[0]/cps) + (nel1/cps)*(ijk[1]/cps); auto rowix = [&ijk,nel1]{ return (ijk[0]/cps) + (nel1/cps)*(ijk[1]/cps); };
// loop over nodes // loop over nodes
for (int n=0;n<8;++n) { for (int n=0;n<8;++n) {
int idx = set.subIndex(*it, n, 3); int idx = set.subIndex(*it, n, 3);
@ -59,11 +59,11 @@ Schwarz::type* Schwarz::setup2(std::shared_ptr<Operator>& op,
for (size_t q=0;q<mpc->getNoMaster();++q) { for (size_t q=0;q<mpc->getNoMaster();++q) {
int idx2 = A.getEquationForDof(mpc->getMaster(q).node, m); int idx2 = A.getEquationForDof(mpc->getMaster(q).node, m);
if (idx2 > -1) if (idx2 > -1)
rows[rowix].insert(idx2); rows[rowix()].insert(idx2);
} }
} else { } else {
if (A.getEquationForDof(idx, m) > -1) if (A.getEquationForDof(idx, m) > -1)
rows[rowix].insert(A.getEquationForDof(idx, m)); rows[rowix()].insert(A.getEquationForDof(idx, m));
} }
} }
} }

View File

@ -16,7 +16,7 @@
#include <opm/grid/CpGrid.hpp> #include <opm/grid/CpGrid.hpp>
#ifdef HAVE_OPENMP #if _OPENMP
#include <omp.h> #include <omp.h>
#endif #endif
@ -26,12 +26,12 @@ void MeshColorizer<Dune::CpGrid>::calcGroups()
int nel1 = grid.logicalCartesianSize()[0]; int nel1 = grid.logicalCartesianSize()[0];
int nel2 = grid.logicalCartesianSize()[1]; int nel2 = grid.logicalCartesianSize()[1];
int nel3 = grid.logicalCartesianSize()[2]; int nel3 = grid.logicalCartesianSize()[2];
int threads=1; int threads;
int stripsize=0; int stripsize;
int remainder=0; int remainder = 0;
int dir=0, mul=1; int dir, mul;
#ifdef HAVE_OPENMP #if _OPENMP
threads = omp_get_max_threads(); threads = omp_get_max_threads();
int parts = threads > 1 ? 2*threads : 1; int parts = threads > 1 ? 2*threads : 1;
dir = getStripDirection(nel1,nel2,nel3,parts); dir = getStripDirection(nel1,nel2,nel3,parts);
@ -53,6 +53,8 @@ void MeshColorizer<Dune::CpGrid>::calcGroups()
<< "\n\tstripsize " << stripsize << "\n\tstripsize " << stripsize
<< "\n\t# of strips " << els/stripsize << "\n\t# of strips " << els/stripsize
<< "\n\tremainder " << remainder << std::endl; << "\n\tremainder " << remainder << std::endl;
#else
threads = 1;
#endif #endif
if (threads == 1) { if (threads == 1) {

View File

@ -54,7 +54,7 @@ namespace {
createIntehead(const int nx, const int ny, const int nz, const int nactive, createIntehead(const int nx, const int ny, const int nz, const int nactive,
const time_t time_stamp) const time_t time_stamp)
{ {
const auto ih = ::Opm::RestartIO::InteHEAD{} return ::Opm::RestartIO::InteHEAD{}
.dimensions (nx, ny, nz) .dimensions (nx, ny, nz)
.numActive (nactive) .numActive (nactive)
.unitConventions (Opm::UnitSystem::newMETRIC()) .unitConventions (Opm::UnitSystem::newMETRIC())
@ -62,9 +62,8 @@ namespace {
.wellTableDimensions({ 0, 0, 0, 0, 0, 0, 0 }) .wellTableDimensions({ 0, 0, 0, 0, 0, 0, 0 })
.calendarDate (timeStamp(time_stamp)) .calendarDate (timeStamp(time_stamp))
.activePhases (phases()) .activePhases (phases())
.variousParam (201702, 100); .variousParam (201702, 100)
.data();
return ih.data();
} }
std::vector<double> std::vector<double>
@ -82,10 +81,9 @@ namespace {
>(start), dur >(start), dur
}; };
const auto dh = ::Opm::RestartIO::DoubHEAD{} return ::Opm::RestartIO::DoubHEAD{}
.timeStamp(ts); .timeStamp(ts)
.data();
return dh.data();
} }
} }