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 cb76a0fd7f
commit d6fa31b452
17 changed files with 48 additions and 48 deletions

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

@@ -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

@@ -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

@@ -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

@@ -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

@@ -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") {