convert users of the ASSERT and the ASSERT2 macros to standard assert()

This commit is contained in:
Andreas Lauser 2013-08-28 14:00:35 +02:00
parent 19e5d5cea2
commit c25ec5999e
38 changed files with 123 additions and 123 deletions

View File

@ -141,7 +141,7 @@ namespace Opm
if (grid_.dimensions == 2) {
return 3*(grid_.cell_facepos[cell_ + 1] - grid_.cell_facepos[cell_]);
}
ASSERT(grid_.dimensions == 3);
assert(grid_.dimensions == 3);
int sumnodes = 0;
for (int hf = grid_.cell_facepos[cell_]; hf < grid_.cell_facepos[cell_ + 1]; ++hf) {
const int face = grid_.cell_faces[hf];
@ -181,7 +181,7 @@ namespace Opm
}
return;
}
ASSERT(dim == 3);
assert(dim == 3);
int tetindex = index / 4;
const int subindex = index % 4;
const double* nc = grid_.node_coordinates;
@ -227,7 +227,7 @@ namespace Opm
const double* nc1 = grid_.node_coordinates + dim*nptr[1];
return triangleArea2d(nc0, nc1, cc)/3.0;
}
ASSERT(dim == 3);
assert(dim == 3);
int tetindex = index / 4;
const double* nc = grid_.node_coordinates;
for (int hf = grid_.cell_facepos[cell_]; hf < grid_.cell_facepos[cell_ + 1]; ++hf) {

View File

@ -120,12 +120,12 @@ namespace Opm
const int* fnodes = grid_.face_nodes + grid_.face_nodepos[face_];
const double* nc = grid_.node_coordinates;
if (dim == 2) {
ASSERT(nn == 2);
assert(nn == 2);
const double* pa[3] = { nc + dim*fnodes[0], fc, nc + dim*fnodes[1] };
std::copy(pa[index], pa[index] + dim, coord);
return;
}
ASSERT(dim == 3);
assert(dim == 3);
if (index < nn) {
// Boundary edge midpoint.
const int node0 = fnodes[index];
@ -154,7 +154,7 @@ namespace Opm
const double simpsonw[3] = { 1.0/6.0, 4.0/6.0, 1.0/6.0 };
return grid_.face_areas[face_]*simpsonw[index];
}
ASSERT(dim == 3);
assert(dim == 3);
const double* fc = grid_.face_centroids + dim*face_;
const int nn = grid_.face_nodepos[face_ + 1] - grid_.face_nodepos[face_];
const int* fnodes = grid_.face_nodes + grid_.face_nodepos[face_];

View File

@ -418,7 +418,7 @@ void EclipseGridParser::readImpl(istream& is)
tstep = dynamic_cast<TSTEP*>(sb_ptr.get());
sm["TSTEP"] = sb_ptr;
}
ASSERT(tstep != 0);
assert(tstep != 0);
// Append new steps to current TSTEP object
if (keyword == "TSTEP") {
const int num_steps_old = tstep->tstep_.size();
@ -448,7 +448,7 @@ void EclipseGridParser::readImpl(istream& is)
current_reading_mode_ = Regular;
special_field_by_epoch_.push_back(SpecialMap());
++current_epoch_;
ASSERT(int(special_field_by_epoch_.size()) == current_epoch_ + 1);
assert(int(special_field_by_epoch_.size()) == current_epoch_ + 1);
// Add clones of all existing special fields to new map.
SpecialMap& oldmap = special_field_by_epoch_[current_epoch_ - 1];
SpecialMap& newmap = special_field_by_epoch_[current_epoch_];
@ -457,7 +457,7 @@ void EclipseGridParser::readImpl(istream& is)
newmap[it->first] = cloneSpecialField(it->first, it->second);
//}
}
//ASSERT(newmap.count("TSTEP") == 0);
//assert(newmap.count("TSTEP") == 0);
}
// Check if the keyword already exists. If so, append. Otherwise, create new.
SpecialMap::iterator it = special_field_by_epoch_[current_epoch_].find(keyword);
@ -663,7 +663,7 @@ int EclipseGridParser::numberOfEpochs() const
void EclipseGridParser::setCurrentEpoch(int epoch)
//---------------------------------------------------------------------------
{
ASSERT(epoch >= 0 && epoch < numberOfEpochs());
assert(epoch >= 0 && epoch < numberOfEpochs());
current_epoch_ = epoch;
}

View File

@ -138,7 +138,7 @@ namespace
template<class Vec>
inline int readDefaultedVectorData(std::istream& is, Vec& data, int max_values)
{
ASSERT(int(data.size()) >= max_values);
assert(int(data.size()) >= max_values);
const std::ctype<char>& ct = std::use_facet< std::ctype<char> >(std::locale::classic());
int num_values = 0;
while (is) {
@ -210,7 +210,7 @@ namespace
} else {
if (is.peek() == int('*')) {
is.ignore(); // ignore the '*'
ASSERT(int(candidate) == 1);
assert(int(candidate) == 1);
data.push_back(-1); // Set new flag for interpolation.
} else {
data.push_back(candidate);

View File

@ -45,8 +45,8 @@ namespace Opm
int dimension = 3;
int num_cells = dims[0]*dims[1]*dims[2];
ASSERT(dimension == 2 || dimension == 3);
ASSERT(num_cells == dims[0]*dims[1]* (dimension == 2 ? 1 : dims[2]));
assert(dimension == 2 || dimension == 3);
assert(num_cells == dims[0]*dims[1]* (dimension == 2 ? 1 : dims[2]));
os << "# vtk DataFile Version 2.0\n";
os << "Structured Grid\n \n";

View File

@ -488,7 +488,7 @@ namespace Opm
// only inject pure fluids.
props_.matrix(1, &perf_p, comp_frac, &c, wpA, NULL);
props_.viscosity(1, &perf_p, comp_frac, &c, &mu[0], NULL);
ASSERT(std::fabs(std::accumulate(comp_frac, comp_frac + np, 0.0) - 1.0) < 1e-6);
assert(std::fabs(std::accumulate(comp_frac, comp_frac + np, 0.0) - 1.0) < 1e-6);
props_.relperm (1, comp_frac, &c, wpM , NULL);
for (int phase = 0; phase < np; ++phase) {
wpM[phase] /= mu[phase];

View File

@ -182,9 +182,9 @@ namespace Opm
ix /= dims[dim];
}
ASSERT2 (ix == 0,
"Lexicographic index is not consistent "
"with grid dimensions.");
// Make sure that lexicographic index is consistent with
// grid dimensions.
assert(ix == 0);
}
@ -202,12 +202,12 @@ namespace Opm
OPM_THROW(std::runtime_error, "Faces not tagged - cannot extract " << sideString(side) << " faces.");
}
ASSERT2 (grid.dimensions <= 3,
"Grid must have three dimensions or less.");
// make sure that grid has three dimensions or less.
assert(grid.dimensions <= 3);
ASSERT2 (side < 2 * grid.dimensions,
"Boundary condition side not consistent with "
"number of physical grid dimensions.");
// Make sure boundary condition side is consistent with
// number of physical grid dimensions.
assert(side < 2 * grid.dimensions);
// Get all boundary faces with the correct tag and with
// min/max i/j/k (depending on side).

View File

@ -186,14 +186,14 @@ namespace Opm
linsolver_.solve(h_->A, h_->b, h_->x);
// Obtain solution.
ASSERT(int(state.pressure().size()) == grid_.number_of_cells);
ASSERT(int(state.faceflux().size()) == grid_.number_of_faces);
assert(int(state.pressure().size()) == grid_.number_of_cells);
assert(int(state.faceflux().size()) == grid_.number_of_faces);
ifs_tpfa_solution soln = { NULL, NULL, NULL, NULL };
soln.cell_press = &state.pressure()[0];
soln.face_flux = &state.faceflux()[0];
if (wells_ != NULL) {
ASSERT(int(well_state.bhp().size()) == wells_->number_of_wells);
ASSERT(int(well_state.perfRates().size()) == wells_->well_connpos[ wells_->number_of_wells ]);
assert(int(well_state.bhp().size()) == wells_->number_of_wells);
assert(int(well_state.perfRates().size()) == wells_->well_connpos[ wells_->number_of_wells ]);
soln.well_flux = &well_state.perfRates()[0];
soln.well_press = &well_state.bhp()[0];
}
@ -473,8 +473,8 @@ namespace Opm
// Make sure h_->x contains the direct solution vector.
ASSERT(int(state.pressure().size()) == grid_.number_of_cells);
ASSERT(int(state.faceflux().size()) == grid_.number_of_faces);
assert(int(state.pressure().size()) == grid_.number_of_cells);
assert(int(state.faceflux().size()) == grid_.number_of_faces);
std::copy(state.pressure().begin(), state.pressure().end(), h_->x);
std::copy(well_state.bhp().begin(), well_state.bhp().end(), h_->x + grid_.number_of_cells);
@ -483,8 +483,8 @@ namespace Opm
soln.cell_press = &state.pressure()[0];
soln.face_flux = &state.faceflux()[0];
if (wells_ != NULL) {
ASSERT(int(well_state.bhp().size()) == wells_->number_of_wells);
ASSERT(int(well_state.perfRates().size()) == wells_->well_connpos[ wells_->number_of_wells ]);
assert(int(well_state.bhp().size()) == wells_->number_of_wells);
assert(int(well_state.perfRates().size()) == wells_->well_connpos[ wells_->number_of_wells ]);
soln.well_flux = &well_state.perfRates()[0];
soln.well_press = &well_state.bhp()[0];
}

View File

@ -128,7 +128,7 @@ namespace Opm
double* dAdp) const
{
const int np = numPhases();
ASSERT(np <= 2);
assert(np <= 2);
double B[2]; // Must be enough since component classes do not handle more than 2.
pvt_.B(1, 0, 0, B);
// Compute A matrix

View File

@ -98,7 +98,7 @@ namespace Opm
pu.phase_pos[BlackoilPhases::Liquid] = 1;
pu.phase_pos[BlackoilPhases::Vapour] = 1; // Unused.
} else {
ASSERT(pu.num_phases == 3);
assert(pu.num_phases == 3);
pu.phase_used[BlackoilPhases::Aqua] = true;
pu.phase_used[BlackoilPhases::Liquid] = true;
pu.phase_used[BlackoilPhases::Vapour] = true;

View File

@ -77,7 +77,7 @@ namespace Opm
while (undersat_oil_tables_[iNext][0].size() < 2) {
++iNext;
}
ASSERT(iNext < sz);
assert(iNext < sz);
for (int i=0; i<sz; ++i) {
if (undersat_oil_tables_[i][0].size() > 1) {
iPrev = i;
@ -356,8 +356,8 @@ namespace Opm
int is = tableIndex(saturated_oil_table_[3], maxR);
double w = (maxR - saturated_oil_table_[3][is]) /
(saturated_oil_table_[3][is+1] - saturated_oil_table_[3][is]);
ASSERT(undersat_oil_tables_[is][0].size() >= 2);
ASSERT(undersat_oil_tables_[is+1][0].size() >= 2);
assert(undersat_oil_tables_[is][0].size() >= 2);
assert(undersat_oil_tables_[is+1][0].size() >= 2);
double val1 =
linearInterpolationDerivative(undersat_oil_tables_[is][0],
undersat_oil_tables_[is][item],
@ -379,8 +379,8 @@ namespace Opm
int is = tableIndex(saturated_oil_table_[3], maxR);
double w = (maxR - saturated_oil_table_[3][is]) /
(saturated_oil_table_[3][is+1] - saturated_oil_table_[3][is]);
ASSERT(undersat_oil_tables_[is][0].size() >= 2);
ASSERT(undersat_oil_tables_[is+1][0].size() >= 2);
assert(undersat_oil_tables_[is][0].size() >= 2);
assert(undersat_oil_tables_[is+1][0].size() >= 2);
double val1 =
linearInterpolation(undersat_oil_tables_[is][0],
undersat_oil_tables_[is][item],
@ -414,8 +414,8 @@ namespace Opm
int is = tableIndex(saturated_oil_table_[3], r);
double w = (r - saturated_oil_table_[3][is]) /
(saturated_oil_table_[3][is+1] - saturated_oil_table_[3][is]);
ASSERT(undersat_oil_tables_[is][0].size() >= 2);
ASSERT(undersat_oil_tables_[is+1][0].size() >= 2);
assert(undersat_oil_tables_[is][0].size() >= 2);
assert(undersat_oil_tables_[is+1][0].size() >= 2);
double val1 =
linearInterpolationDerivative(undersat_oil_tables_[is][0],
undersat_oil_tables_[is][item],
@ -433,8 +433,8 @@ namespace Opm
return 0;
} else { // Undersaturated case
int is = tableIndex(saturated_oil_table_[3], r);
ASSERT(undersat_oil_tables_[is][0].size() >= 2);
ASSERT(undersat_oil_tables_[is+1][0].size() >= 2);
assert(undersat_oil_tables_[is][0].size() >= 2);
assert(undersat_oil_tables_[is+1][0].size() >= 2);
double val1 =
linearInterpolation(undersat_oil_tables_[is][0],
undersat_oil_tables_[is][item],
@ -459,8 +459,8 @@ namespace Opm
int is = tableIndex(saturated_oil_table_[3], r);
double w = (r - saturated_oil_table_[3][is]) /
(saturated_oil_table_[3][is+1] - saturated_oil_table_[3][is]);
ASSERT(undersat_oil_tables_[is][0].size() >= 2);
ASSERT(undersat_oil_tables_[is+1][0].size() >= 2);
assert(undersat_oil_tables_[is][0].size() >= 2);
assert(undersat_oil_tables_[is+1][0].size() >= 2);
double val1 =
linearInterpolation(undersat_oil_tables_[is][0],
undersat_oil_tables_[is][item],

View File

@ -89,7 +89,7 @@ namespace Opm
const int num_global_cells = grid.cartdims[0]*grid.cartdims[1]*grid.cartdims[2];
const int nc = grid.number_of_cells;
ASSERT (num_global_cells > 0);
assert(num_global_cells > 0);
permeability_.assign(dim * dim * nc, 0.0);
@ -273,7 +273,7 @@ namespace Opm
if (kind == Invalid) {
OPM_THROW(std::runtime_error, "Invalid set of permeability fields given.");
}
ASSERT (tensor.size() == 1);
assert(tensor.size() == 1);
for (int i = 0; i < 9; ++i) { kmap[i] = 0; }
enum { xx, xy, xz, // 0, 1, 2

View File

@ -111,7 +111,7 @@ namespace Opm
kr[wpos] = krw;
kr[opos] = krow;
} else {
ASSERT(phase_usage.phase_used[Vapour]);
assert(phase_usage.phase_used[Vapour]);
int gpos = phase_usage.phase_pos[Vapour];
int opos = phase_usage.phase_pos[Liquid];
double sg = s[gpos];
@ -176,7 +176,7 @@ namespace Opm
dkrds[wpos + wpos*np] = dkrww;
dkrds[opos + wpos*np] = dkrow; // Row opos, column wpos, fortran order.
} else {
ASSERT(phase_usage.phase_used[Vapour]);
assert(phase_usage.phase_used[Vapour]);
int gpos = phase_usage.phase_pos[Vapour];
int opos = phase_usage.phase_pos[Liquid];
double sg = s[gpos];
@ -316,7 +316,7 @@ namespace Opm
kr[wpos] = krw;
kr[opos] = krow;
} else {
ASSERT(phase_usage.phase_used[Vapour]);
assert(phase_usage.phase_used[Vapour]);
int gpos = phase_usage.phase_pos[Vapour];
int opos = phase_usage.phase_pos[Liquid];
double sg = s[gpos];
@ -381,7 +381,7 @@ namespace Opm
dkrds[wpos + wpos*np] = dkrww;
dkrds[opos + wpos*np] = dkrow; // Row opos, column wpos, fortran order.
} else {
ASSERT(phase_usage.phase_used[Vapour]);
assert(phase_usage.phase_used[Vapour]);
int gpos = phase_usage.phase_pos[Vapour];
int opos = phase_usage.phase_pos[Liquid];
double sg = s[gpos];

View File

@ -132,7 +132,7 @@ namespace Opm
kr[wpos] = krw;
kr[opos] = krow;
} else {
ASSERT(phase_usage.phase_used[Vapour]);
assert(phase_usage.phase_used[Vapour]);
int gpos = phase_usage.phase_pos[Vapour];
int opos = phase_usage.phase_pos[Liquid];
double sg = s[gpos];
@ -194,7 +194,7 @@ namespace Opm
dkrds[wpos + wpos*np] = dkrww;
dkrds[opos + wpos*np] = dkrow; // Row opos, column wpos, fortran order.
} else {
ASSERT(phase_usage.phase_used[Vapour]);
assert(phase_usage.phase_used[Vapour]);
int gpos = phase_usage.phase_pos[Vapour];
int opos = phase_usage.phase_pos[Liquid];
double sg = s[gpos];
@ -358,7 +358,7 @@ namespace Opm
kr[wpos] = krw;
kr[opos] = krow;
} else {
ASSERT(phase_usage.phase_used[Vapour]);
assert(phase_usage.phase_used[Vapour]);
int gpos = phase_usage.phase_pos[Vapour];
int opos = phase_usage.phase_pos[Liquid];
double sg = s[gpos];
@ -420,7 +420,7 @@ namespace Opm
dkrds[wpos + wpos*np] = dkrww;
dkrds[opos + wpos*np] = dkrow; // Row opos, column wpos, fortran order.
} else {
ASSERT(phase_usage.phase_used[Vapour]);
assert(phase_usage.phase_used[Vapour]);
int gpos = phase_usage.phase_pos[Vapour];
int opos = phase_usage.phase_pos[Liquid];
double sg = s[gpos];

View File

@ -107,7 +107,7 @@ namespace Opm
kr[wpos] = krw;
kr[opos] = krow;
} else {
ASSERT(phase_usage.phase_used[Vapour]);
assert(phase_usage.phase_used[Vapour]);
int gpos = phase_usage.phase_pos[Vapour];
int opos = phase_usage.phase_pos[Liquid];
double sg = s[gpos];
@ -164,7 +164,7 @@ namespace Opm
dkrds[wpos + wpos*np] = dkrww;
dkrds[opos + wpos*np] = dkrow; // Row opos, column wpos, fortran order.
} else {
ASSERT(phase_usage.phase_used[Vapour]);
assert(phase_usage.phase_used[Vapour]);
int gpos = phase_usage.phase_pos[Vapour];
int opos = phase_usage.phase_pos[Liquid];
double sg = s[gpos];
@ -301,7 +301,7 @@ namespace Opm
kr[wpos] = krw;
kr[opos] = krow;
} else {
ASSERT(phase_usage.phase_used[Vapour]);
assert(phase_usage.phase_used[Vapour]);
int gpos = phase_usage.phase_pos[Vapour];
int opos = phase_usage.phase_pos[Liquid];
double sg = s[gpos];
@ -358,7 +358,7 @@ namespace Opm
dkrds[wpos + wpos*np] = dkrww;
dkrds[opos + wpos*np] = dkrow; // Row opos, column wpos, fortran order.
} else {
ASSERT(phase_usage.phase_used[Vapour]);
assert(phase_usage.phase_used[Vapour]);
int gpos = phase_usage.phase_pos[Vapour];
int opos = phase_usage.phase_pos[Liquid];
double sg = s[gpos];

View File

@ -159,7 +159,7 @@ namespace Opm
double* kr,
double* dkrds) const
{
ASSERT (cells != 0);
assert(cells != 0);
const int np = phase_usage_.num_phases;
if (dkrds) {
@ -203,7 +203,7 @@ namespace Opm
double* pc,
double* dpcds) const
{
ASSERT (cells != 0);
assert(cells != 0);
const int np = phase_usage_.num_phases;
if (dpcds) {
@ -233,7 +233,7 @@ namespace Opm
double* smin,
double* smax) const
{
ASSERT (cells != 0);
assert(cells != 0);
const int np = phase_usage_.num_phases;
for (int i = 0; i < n; ++i) {

View File

@ -65,7 +65,7 @@ namespace Opm
return;
}
const int n = cells.size();
ASSERT(n > 0);
assert(n > 0);
std::vector<double> smin(num_phases_*n);
std::vector<double> smax(num_phases_*n);
props.satRange(n, &cells[0], &smin[0], &smax[0]);

View File

@ -85,7 +85,7 @@ namespace Opm
/// Current step length.
double SimulatorTimer::currentStepLength() const
{
ASSERT(!done());
assert(!done());
return timesteps_[current_step_];
}
@ -131,7 +131,7 @@ namespace Opm
/// Next step.
SimulatorTimer& SimulatorTimer::operator++()
{
ASSERT(!done());
assert(!done());
current_time_ += timesteps_[current_step_];
++current_step_;
return *this;

View File

@ -154,7 +154,7 @@ namespace Opm
Density(const BlackoilPropertiesInterface& props) : props_(props) {}
double operator()(const double pressure, const int phase)
{
ASSERT(props_.numPhases() == 2);
assert(props_.numPhases() == 2);
const double surfvol[2][2] = { { 1.0, 0.0 },
{ 0.0, 1.0 } };
// We do not handle multi-region PVT/EQUIL at this point.
@ -183,7 +183,7 @@ namespace Opm
const double datum_p,
State& state)
{
ASSERT(props.numPhases() == 2);
assert(props.numPhases() == 2);
// Obtain max and min z for which we will need to compute p.
const int num_cells = grid.number_of_cells;

View File

@ -651,7 +651,7 @@ namespace Opm
limiter = 0.0;
basis_func_->addConstant(min_upstream_tof - tof_c, tof + num_basis*cell);
}
ASSERT(limiter >= 0.0);
assert(limiter >= 0.0);
// Actually do the limiting (if applicable).
if (limiter < 1.0) {
@ -674,7 +674,7 @@ namespace Opm
// any limiting applied to its upstream cells.
const std::vector<int>& seq = ReorderSolverInterface::sequence();
const int nc = seq.size();
ASSERT(nc == grid_.number_of_cells);
assert(nc == grid_.number_of_cells);
for (int i = 0; i < nc; ++i) {
const int cell = seq[i];
applyLimiter(cell, tof_coeff_);

View File

@ -331,7 +331,7 @@ namespace Opm
// Identify the adjacent faces of the upwind cell.
const int* face_nodes_beg = grid_.face_nodes + grid_.face_nodepos[face];
const int* face_nodes_end = grid_.face_nodes + grid_.face_nodepos[face + 1];
ASSERT(face_nodes_end - face_nodes_beg == 2 || grid_.dimensions != 2);
assert(face_nodes_end - face_nodes_beg == 2 || grid_.dimensions != 2);
adj_faces_.clear();
for (int hf = grid_.cell_facepos[upwind_cell]; hf < grid_.cell_facepos[upwind_cell + 1]; ++hf) {
const int f = grid_.cell_faces[hf];
@ -358,7 +358,7 @@ namespace Opm
const int num_adj = adj_faces_.size();
// The assertion below only holds if the grid is edge-conformal.
// No longer testing, since method no longer requires it.
// ASSERT(num_adj == face_nodes_end - face_nodes_beg);
// assert(num_adj == face_nodes_end - face_nodes_beg);
const double flux_face = std::fabs(darcyflux_[face]);
face_term = 0.0;
cell_term_factor = 0.0;

View File

@ -165,7 +165,7 @@ namespace Opm
if (c1 == prev_cell || c2 == prev_cell) {
DL[ci-1] += j2contrib;
} else {
ASSERT(c1 == next_cell || c2 == next_cell);
assert(c1 == next_cell || c2 == next_cell);
DU[ci] += j2contrib;
}
D[ci] += j1contrib;

View File

@ -83,11 +83,11 @@ namespace Opm{
double dpcow[4];
props_.capPress(1, &s[0], &c, pcow, dpcow);
pcap = pcow[0];
ASSERT(pcow[1] == 0.0);
assert(pcow[1] == 0.0);
dpcap = dpcow[0];
ASSERT(dpcow[1] == 0.0);
ASSERT(dpcow[2] == 0.0);
ASSERT(dpcow[3] == 0.0);
assert(dpcow[1] == 0.0);
assert(dpcow[2] == 0.0);
assert(dpcow[3] == 0.0);
}
inline double SimpleFluid2pWrappingProps::s_min(int c) const

View File

@ -415,7 +415,7 @@ namespace Opm
const int nc = grid_.number_of_cells;
const int nf = grid_.number_of_faces;
const int np = props_.numPhases();
ASSERT(np == 2);
assert(np == 2);
const int dim = grid_.dimensions;
density_.resize(nc*np);
props_.density(grid_.number_of_cells, &A_[0], &density_[0]);

View File

@ -127,7 +127,7 @@ namespace Opm
const std::vector<T>& y_values)
: x_values_(x_values), y_values_(y_values)
{
ASSERT(isNondecreasing(x_values.begin(), x_values.end()));
assert(isNondecreasing(x_values.begin(), x_values.end()));
}
template<typename T>
@ -180,7 +180,7 @@ namespace Opm
if (y_values_reversed_.empty()) {
y_values_reversed_ = y_values_;
std::reverse(y_values_reversed_.begin(), y_values_reversed_.end());
ASSERT(isNondecreasing(y_values_reversed_.begin(), y_values_reversed_.end()));
assert(isNondecreasing(y_values_reversed_.begin(), y_values_reversed_.end()));
x_values_reversed_ = x_values_;
std::reverse(x_values_reversed_.begin(), x_values_reversed_.end());
}

View File

@ -284,7 +284,7 @@ namespace Opm
const double fa,
const double fb)
{
ASSERT(fa*fb < 0.0);
assert(fa*fb < 0.0);
return (b*fa - a*fb)/(fa - fb);
}

View File

@ -149,7 +149,7 @@ namespace Opm
/// Returns the size of a table row.
int rowSize(int row) const
{
ASSERT(row >= 0 && row < size());
assert(row >= 0 && row < size());
return row_start_[row + 1] - row_start_[row];
}
@ -167,7 +167,7 @@ namespace Opm
/// Returns a row of the table.
row_type operator[](int row) const
{
ASSERT(row >= 0 && row < size());
assert(row >= 0 && row < size());
const T* start_ptr = data_.empty() ? 0 : &data_[0];
return row_type(start_ptr + row_start_[row], start_ptr + row_start_[row + 1]);
}
@ -175,7 +175,7 @@ namespace Opm
/// Returns a mutable row of the table.
mutable_row_type operator[](int row)
{
ASSERT(row >= 0 && row < size());
assert(row >= 0 && row < size());
T* start_ptr = data_.empty() ? 0 : &data_[0];
return mutable_row_type(start_ptr + row_start_[row], start_ptr + row_start_[row + 1]);
}

View File

@ -81,8 +81,8 @@ namespace Opm
default_elem_()
{
#ifndef NDEBUG
ASSERT(sz >= 0);
ASSERT(indices_.size() == data_.size());
assert(sz >= 0);
assert(indices_.size() == data_.size());
int last_index = -1;
int num_ind = indices_.size();
for (int i = 0; i < num_ind; ++i) {
@ -101,8 +101,8 @@ namespace Opm
/// Elements must be added in index order.
void addElement(const T& elem, int index)
{
ASSERT(indices_.empty() || index > indices_.back());
ASSERT(index < size_);
assert(indices_.empty() || index > indices_.back());
assert(index < size_);
data_.push_back(elem);
indices_.push_back(index);
}
@ -146,8 +146,8 @@ namespace Opm
/// the vector has the given index.
const T& element(int index) const
{
ASSERT(index >= 0);
ASSERT(index < size_);
assert(index >= 0);
assert(index < size_);
std::vector<int>::const_iterator lb = std::lower_bound(indices_.begin(), indices_.end(), index);
if (lb != indices_.end() && *lb == index) {
return data_[lb - indices_.begin()];
@ -161,8 +161,8 @@ namespace Opm
/// \return the nzindex'th nonzero element.
const T& nonzeroElement(int nzindex) const
{
ASSERT(nzindex >= 0);
ASSERT(nzindex < nonzeroSize());
assert(nzindex >= 0);
assert(nzindex < nonzeroSize());
return data_[nzindex];
}
@ -171,8 +171,8 @@ namespace Opm
/// \return the index of the nzindex'th nonzero element.
int nonzeroIndex(int nzindex) const
{
ASSERT(nzindex >= 0);
ASSERT(nzindex < nonzeroSize());
assert(nzindex >= 0);
assert(nzindex < nonzeroSize());
return indices_[nzindex];
}

View File

@ -75,7 +75,7 @@ namespace Opm
} else if (state_ == Stopped) {
run_time = stop_time_;
} else {
ASSERT(state_ == UnStarted);
assert(state_ == UnStarted);
OPM_THROW(std::runtime_error, "Called secsSinceLast() on a StopWatch that had not been started.");
}
boost::posix_time::time_duration dur = run_time - last_time_;
@ -91,7 +91,7 @@ namespace Opm
} else if (state_ == Stopped) {
run_time = stop_time_;
} else {
ASSERT(state_ == UnStarted);
assert(state_ == UnStarted);
OPM_THROW(std::runtime_error, "Called secsSinceStart() on a StopWatch that had not been started.");
}
boost::posix_time::time_duration dur = run_time - start_time_;

View File

@ -123,8 +123,8 @@ namespace Opm {
: xmin_(xmin), xmax_(xmax), y_values_(y_values),
left_(ClosestValue), right_(ClosestValue)
{
ASSERT(xmax > xmin);
ASSERT(y_values.size() > 1);
assert(xmax > xmin);
assert(y_values.size() > 1);
xdelta_ = (xmax - xmin)/(y_values.size() - 1);
}
@ -139,8 +139,8 @@ namespace Opm {
y_values_(y_values, y_values + num_y_values),
left_(ClosestValue), right_(ClosestValue)
{
ASSERT(xmax > xmin);
ASSERT(y_values_.size() > 1);
assert(xmax > xmin);
assert(y_values_.size() > 1);
xdelta_ = (xmax - xmin)/(y_values_.size() - 1);
}

View File

@ -72,7 +72,7 @@ namespace Opm
if (cell == grid_.face_cells[2*face]) {
face_flux = flux_[face];
} else {
ASSERT(cell == grid_.face_cells[2*face + 1]);
assert(cell == grid_.face_cells[2*face + 1]);
face_flux = -flux_[face];
}
for (int dd = 0; dd < dim; ++dd) {

View File

@ -57,7 +57,7 @@ namespace Opm
/// the vectors n[i] for i = 0..(dim-1), each n[i] is of size dim.
double cornerVolume(double** n, const int dim)
{
ASSERT(dim == 2 || dim == 3);
assert(dim == 2 || dim == 3);
double det = (dim == 2) ? determinantOf(n[0], n[1]) : determinantOf(n[0], n[1], n[2]);
return std::fabs(det);
}
@ -140,7 +140,7 @@ namespace Opm
fnorm[fi] = grid_.face_normals + dim*(face_it->second);
vert_adj_faces[fi] = face_it->second;
}
ASSERT(fi == dim);
assert(fi == dim);
adj_faces_.insert(adj_faces_.end(), vert_adj_faces.begin(), vert_adj_faces.end());
const double corner_vol = cornerVolume(fnorm, dim);
ci.volume = corner_vol;
@ -154,7 +154,7 @@ namespace Opm
}
corner_info_.appendRow(cell_corner_info.begin(), cell_corner_info.end());
}
ASSERT(corner_id_count == corner_info_.dataSize());
assert(corner_id_count == corner_info_.dataSize());
}
@ -221,7 +221,7 @@ namespace Opm
}
// Assumes outward-pointing normals, so negate factor if necessary.
if (grid_.face_cells[2*face] != cell) {
ASSERT(grid_.face_cells[2*face + 1] == cell);
assert(grid_.face_cells[2*face + 1] == cell);
factor = -factor;
}
xb[i] *= factor;

View File

@ -273,7 +273,7 @@ namespace Opm
const std::vector<int>::size_type nc = cells.size();
const std::size_t np = props.numPhases();
ASSERT (s.size() == nc * np);
assert(s.size() == nc * np);
std::vector<double>(nc * np, 0.0).swap(pmobc );
double* dpmobc = 0;
@ -382,7 +382,7 @@ namespace Opm
<< perf_rate/Opm::unit::day << " m^3/day." << std::endl;
perf_rate = 0.0;
} else {
ASSERT(std::fabs(comp_frac[0] + comp_frac[1] - 1.0) < 1e-6);
assert(std::fabs(comp_frac[0] + comp_frac[1] - 1.0) < 1e-6);
perf_rate *= comp_frac[0];
}
}
@ -555,7 +555,7 @@ namespace Opm
{
const int np = wells.number_of_phases;
const int nw = wells.number_of_wells;
ASSERT(int(flow_rates_per_well_cell.size()) == wells.well_connpos[nw]);
assert(int(flow_rates_per_well_cell.size()) == wells.well_connpos[nw]);
phase_flow_per_well.resize(nw * np);
for (int wix = 0; wix < nw; ++wix) {
for (int phase = 0; phase < np; ++phase) {
@ -598,7 +598,7 @@ namespace Opm
const std::vector<double>& well_perfrates)
{
int nw = well_bhp.size();
ASSERT(nw == wells.number_of_wells);
assert(nw == wells.number_of_wells);
int np = props.numPhases();
const int max_np = 3;
if (np > max_np) {
@ -657,7 +657,7 @@ namespace Opm
{
// TODO: refactor, since this is almost identical to the other push().
int nw = well_bhp.size();
ASSERT(nw == wells.number_of_wells);
assert(nw == wells.number_of_wells);
int np = props.numPhases();
const int max_np = 3;
if (np > max_np) {

View File

@ -200,7 +200,7 @@ namespace Opm
const int nc = props.numCells();
const int np = props.numPhases();
ASSERT (int(s.size()) == nc * np);
assert(int(s.size()) == nc * np);
std::vector<double> mu(nc*np);
props.viscosity(nc, &p[0], &z[0], &cells[0], &mu[0], 0);
@ -318,7 +318,7 @@ namespace Opm
<< perf_rate/Opm::unit::day << " m^3/day." << std::endl;
perf_rate = 0.0;
} else {
ASSERT(std::fabs(comp_frac[0] + comp_frac[1] - 1.0) < 1e-6);
assert(std::fabs(comp_frac[0] + comp_frac[1] - 1.0) < 1e-6);
perf_rate *= comp_frac[0]; // Water reservoir volume rate.
props.matrix(1, &well_state.perfPress()[perf], comp_frac, &perf_cell, &A[0], 0);
perf_rate *= A[0]; // Water surface volume rate.

View File

@ -106,7 +106,7 @@ namespace Opm
if (parent == NULL) {
OPM_THROW(std::runtime_error, "Parent with name = " << parent_name << " not found.");
}
ASSERT(!parent->isLeafNode());
assert(!parent->isLeafNode());
static_cast<WellsGroup*>(parent)->addChild(child_node);
if (child_node->isLeafNode()) {
leaf_nodes_.push_back(static_cast<WellNode*>(child_node.get()));

View File

@ -788,7 +788,7 @@ namespace Opm
return;
}
if (wells_->type[self_index_] != INJECTOR) {
ASSERT(target == 0.0);
assert(target == 0.0);
return;
}
@ -865,7 +865,7 @@ namespace Opm
return;
}
if (wells_->type[self_index_] != PRODUCER) {
ASSERT(target == 0.0);
assert(target == 0.0);
return;
}
// We're a producer, so we need to negate the input

View File

@ -406,7 +406,7 @@ namespace Opm
// Set up reference depths that were defaulted. Count perfs.
int num_perfs = 0;
ASSERT(grid.dimensions == 3);
assert(grid.dimensions == 3);
for (int w = 0; w < num_wells; ++w) {
num_perfs += wellperf_data[w].size();
if (well_data[w].reference_bhp_depth < 0.0) {
@ -493,7 +493,7 @@ namespace Opm
for (int wix = 0; wix < num_wells; ++wix) {
if (well_names[wix].compare(0,len, name) == 0) { //equal
well_found = true;
ASSERT(well_data[wix].type == w_->type[wix]);
assert(well_data[wix].type == w_->type[wix]);
if (well_data[wix].type != INJECTOR) {
OPM_THROW(std::runtime_error, "Found WCONINJE entry for a non-injector well: " << well_names[wix]);
}
@ -604,7 +604,7 @@ namespace Opm
for (int wix = 0; wix < num_wells; ++wix) {
if (well_names[wix].compare(0,len, name) == 0) { //equal
well_found = true;
ASSERT(well_data[wix].type == w_->type[wix]);
assert(well_data[wix].type == w_->type[wix]);
if (well_data[wix].type != PRODUCER) {
OPM_THROW(std::runtime_error, "Found WCONPROD entry for a non-producer well: " << well_names[wix]);
}
@ -758,13 +758,13 @@ namespace Opm
if (cur_ctrl >= 0) {
cur_ctrl = ~cur_ctrl;
}
ASSERT(w_->ctrls[index]->current < 0);
assert(w_->ctrls[index]->current < 0);
} else if (line.openshutflag_ == "OPEN") {
int& cur_ctrl = w_->ctrls[index]->current;
if (cur_ctrl < 0) {
cur_ctrl = ~cur_ctrl;
}
ASSERT(w_->ctrls[index]->current >= 0);
assert(w_->ctrls[index]->current >= 0);
} else {
OPM_THROW(std::runtime_error, "Unknown Open/close keyword: \"" << line.openshutflag_<< "\". Allowed values: OPEN, SHUT.");
}
@ -797,7 +797,7 @@ namespace Opm
std::string name = lines[i].well_;
const int wix = well_names_to_index[name];
WellNode& wellnode = *well_collection_.getLeafNodes()[wix];
ASSERT(wellnode.name() == name);
assert(wellnode.name() == name);
if (well_data[wix].type == PRODUCER) {
wellnode.prodSpec().guide_rate_ = lines[i].guide_rate_;
if (lines[i].phase_ == "OIL") {

View File

@ -41,7 +41,7 @@ namespace
void computeFlux(const UnstructuredGrid& grid, const std::vector<double>& v, std::vector<double>& flux)
{
const int dim = v.size();
ASSERT(dim == grid.dimensions);
assert(dim == grid.dimensions);
flux.resize(grid.number_of_faces);
for (int face = 0; face < grid.number_of_faces; ++face) {
flux[face] = std::inner_product(v.begin(), v.end(), grid.face_normals + face*dim, 0.0);
@ -54,7 +54,7 @@ namespace
const std::vector<double>& x,
std::vector<double>& v)
{
ASSERT(v0.size() == v1.size() && v0.size() == x.size());
assert(v0.size() == v1.size() && v0.size() == x.size());
const int dim = v0.size();
v.resize(dim);
for (int dd = 0; dd < dim; ++dd) {
@ -70,7 +70,7 @@ namespace
std::vector<double>& flux)
{
const int dim = v0.size();
ASSERT(dim == grid.dimensions);
assert(dim == grid.dimensions);
flux.resize(grid.number_of_faces);
std::vector<double> x(dim);
std::vector<double> v(dim);
@ -85,7 +85,7 @@ namespace
double vectorDiff2(const std::vector<double>& v1, const std::vector<double>& v2)
{
ASSERT(v1.size() == v2.size());
assert(v1.size() == v2.size());
const int sz = v1.size();
double vdiff = 0.0;
for (int i = 0; i < sz; ++i) {