mirror of
https://github.com/OPM/opm-upscaling.git
synced 2025-02-25 18:45:23 -06:00
mark variables const
quells static analyzer warnings
This commit is contained in:
parent
efc49e43b2
commit
d8ecc8be90
@ -202,9 +202,8 @@ void writeOutput(const Params& p, Opm::time::StopWatch& watch, int cells,
|
||||
{
|
||||
// get current time
|
||||
time_t rawtime;
|
||||
struct tm* timeinfo;
|
||||
time(&rawtime);
|
||||
timeinfo = localtime(&rawtime);
|
||||
const struct tm* timeinfo = localtime(&rawtime);
|
||||
|
||||
// get hostname
|
||||
char hostname[1024];
|
||||
@ -444,7 +443,7 @@ int run(Params& p)
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch (Dune::Exception &e) {
|
||||
catch (const Dune::Exception &e) {
|
||||
throw e;
|
||||
}
|
||||
catch (...) {
|
||||
@ -496,7 +495,7 @@ try
|
||||
return runAMG<AMG2Level>(p);
|
||||
else
|
||||
return runAMG<AMG1>(p);
|
||||
} catch (Dune::Exception &e) {
|
||||
} catch (const Dune::Exception &e) {
|
||||
std::cerr << "Dune reported error: " << e << std::endl;
|
||||
} catch (const std::exception &e) {
|
||||
throw e;
|
||||
|
@ -170,7 +170,7 @@ void ASMHandler<GridType>::expandSolution(Vector& result, const Vector& u)
|
||||
l = 0;
|
||||
for (int i=0;i<nodes;++i) {
|
||||
for (int j=0;j<dim;++j) {
|
||||
MPC* mpc = getMPC(i,j);
|
||||
const MPC* mpc = getMPC(i,j);
|
||||
if (mpc) {
|
||||
for (size_t n=0;n<mpc->getNoMaster();++n) {
|
||||
int idx = mpc->getMaster(n).node*dim+mpc->getMaster(n).dof-1;
|
||||
@ -322,7 +322,7 @@ void ASMHandler<GridType>::preprocess()
|
||||
fixIt it2 = fixedNodes.find(indexi);
|
||||
if (it2 == fixedNodes.end()) {
|
||||
for (int i=0;i<dim;++i) {
|
||||
MPC* mpc = getMPC(indexi,i);
|
||||
const MPC* mpc = getMPC(indexi,i);
|
||||
if (!mpc)
|
||||
meqn[indexi*dim+i] = maxeqn++;
|
||||
else
|
||||
@ -334,7 +334,7 @@ void ASMHandler<GridType>::preprocess()
|
||||
if (it2->second.first & flag)
|
||||
meqn[indexi*dim+i] = -1;
|
||||
else {
|
||||
MPC* mpc = getMPC(indexi,i);
|
||||
const MPC* mpc = getMPC(indexi,i);
|
||||
if (!mpc)
|
||||
meqn[indexi*dim+i] = maxeqn++;
|
||||
else
|
||||
@ -390,7 +390,7 @@ void ASMHandler<GridType>::determineAdjacencyPattern()
|
||||
for (int i=0; i < vertexsize; i++) {
|
||||
int indexi = set.subIndex(*it,i,dim);
|
||||
for (int k=0;k<dim;++k) {
|
||||
MPC* mpc = getMPC(indexi,k);
|
||||
const MPC* mpc = getMPC(indexi,k);
|
||||
if (mpc) {
|
||||
for (size_t l=0;l<mpc->getNoMaster();++l) {
|
||||
nodeAdjacency(it,vertexsize,
|
||||
|
@ -1084,7 +1084,7 @@ IMPL_FUNC(void, solve(int loadcase))
|
||||
tsolver[solver]->apply(u[loadcase], b[loadcase], r);
|
||||
|
||||
std::cout << "\tsolution norm: " << u[loadcase].two_norm() << std::endl;
|
||||
} catch (Dune::ISTLError& e) {
|
||||
} catch (const Dune::ISTLError& e) {
|
||||
std::cerr << "exception thrown " << e << std::endl;
|
||||
}
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ public:
|
||||
|
||||
PNShapeFunctionSet(int n1, int n2, int n3=0)
|
||||
{
|
||||
int dims[3] = {n1, n2, n3};
|
||||
const int dims[3] = {n1, n2, n3};
|
||||
cfuncs.resize(dim);
|
||||
for (int i=0; i < dim; ++i) {
|
||||
std::vector<double> grid;
|
||||
|
@ -323,7 +323,7 @@ namespace Opm
|
||||
std::cout << "Seconds taken by transport solver: " << clock.secsSinceStart() << std::endl;
|
||||
#endif // VERBOSE
|
||||
{
|
||||
std::vector<double>& sat = state.saturation();
|
||||
const std::vector<double>& sat = state.saturation();
|
||||
for (int i=0; i < mygrid_.numCells(); ++i){
|
||||
saturation[i] = sat[2*i];
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ namespace Opm
|
||||
s.preservoir_properties_->phaseMobility(triv_phase, cell[ups_cell],
|
||||
cell_sat[ups_cell], m_ups[triv_phase].mob);
|
||||
// Compute gravity flow of the nontrivial phase.
|
||||
double sign_G[2] = { -1.0, 1.0 };
|
||||
const double sign_G[2] = { -1.0, 1.0 };
|
||||
double grav_flux_nontriv = sign_G[triv_phase]*loc_area
|
||||
*inner(loc_normal, m_ups[triv_phase].multiply(grav_influence));
|
||||
// Find flow direction of nontrivial phase.
|
||||
|
@ -217,22 +217,22 @@ namespace Opm
|
||||
new_ZCORN_.resize(8*new_dims_[0]*new_dims_[1]*new_dims_[2], 1e100);
|
||||
new_to_old_cell_.resize(new_dims_[0]*new_dims_[1]*new_dims_[2], -1);
|
||||
int cellcount = 0;
|
||||
int delta[3] = { 1, 2*dims_[0], 4*dims_[0]*dims_[1] };
|
||||
int new_delta[3] = { 1, 2*new_dims_[0], 4*new_dims_[0]*new_dims_[1] };
|
||||
const int delta[3] = { 1, 2*dims_[0], 4*dims_[0]*dims_[1] };
|
||||
const int new_delta[3] = { 1, 2*new_dims_[0], 4*new_dims_[0]*new_dims_[1] };
|
||||
for (int k = kmin; k < kmax; ++k) {
|
||||
for (int j = jmin; j < jmax; ++j) {
|
||||
for (int i = imin; i < imax; ++i) {
|
||||
new_to_old_cell_[cellcount++] = dims_[0]*dims_[1]*k + dims_[0]*j + i;
|
||||
int old_ix = 2*(i*delta[0] + j*delta[1] + k*delta[2]);
|
||||
int new_ix = 2*((i-imin)*new_delta[0] + (j-jmin)*new_delta[1] + (k-kmin)*new_delta[2]);
|
||||
int old_indices[8] = { old_ix, old_ix + delta[0],
|
||||
old_ix + delta[1], old_ix + delta[1] + delta[0],
|
||||
old_ix + delta[2], old_ix + delta[2] + delta[0],
|
||||
old_ix + delta[2] + delta[1], old_ix + delta[2] + delta[1] + delta[0] };
|
||||
int new_indices[8] = { new_ix, new_ix + new_delta[0],
|
||||
new_ix + new_delta[1], new_ix + new_delta[1] + new_delta[0],
|
||||
new_ix + new_delta[2], new_ix + new_delta[2] + new_delta[0],
|
||||
new_ix + new_delta[2] + new_delta[1], new_ix + new_delta[2] + new_delta[1] + new_delta[0] };
|
||||
const int old_indices[8] = {old_ix, old_ix + delta[0],
|
||||
old_ix + delta[1], old_ix + delta[1] + delta[0],
|
||||
old_ix + delta[2], old_ix + delta[2] + delta[0],
|
||||
old_ix + delta[2] + delta[1], old_ix + delta[2] + delta[1] + delta[0] };
|
||||
const int new_indices[8] = {new_ix, new_ix + new_delta[0],
|
||||
new_ix + new_delta[1], new_ix + new_delta[1] + new_delta[0],
|
||||
new_ix + new_delta[2], new_ix + new_delta[2] + new_delta[0],
|
||||
new_ix + new_delta[2] + new_delta[1], new_ix + new_delta[2] + new_delta[1] + new_delta[0] };
|
||||
for (int cc = 0; cc < 8; ++cc) {
|
||||
new_ZCORN_[new_indices[cc]] = std::min(zmax, std::max(zmin, ZCORN[old_indices[cc]])) - z_origin_correction;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user