Replace the ASSERT and ASSERT2 macros by assert

This commit is contained in:
Andreas Lauser 2013-09-03 13:55:36 +02:00
parent db1299cf0c
commit a26483b51d
6 changed files with 56 additions and 56 deletions

View File

@ -473,7 +473,7 @@ public:
}
int operator[](const int i) const
{
ASSERT(i >= 0 && i < num_);
assert(i >= 0 && i < num_);
return start_ + i*stride_;
}
int size() const
@ -503,17 +503,17 @@ public:
}
bool operator<(const SpanIterator& rhs) const
{
ASSERT(span_ == rhs.span_);
assert(span_ == rhs.span_);
return index_ < rhs.index_;
}
bool operator==(const SpanIterator& rhs) const
{
ASSERT(span_ == rhs.span_);
assert(span_ == rhs.span_);
return index_ == rhs.index_;
}
bool operator!=(const SpanIterator& rhs) const
{
ASSERT(span_ == rhs.span_);
assert(span_ == rhs.span_);
return index_ != rhs.index_;
}
int operator*()

View File

@ -110,7 +110,7 @@ namespace Opm
THROW("Cannot call muWat(): water phase not present.");
}
const int n = cells.size();
ASSERT(pw.size() == n);
assert(pw.size() == n);
const int np = props_.numPhases();
Block z = Block::Zero(n, np);
Block mu(n, np);
@ -131,7 +131,7 @@ namespace Opm
THROW("Cannot call muOil(): oil phase not present.");
}
const int n = cells.size();
ASSERT(po.size() == n);
assert(po.size() == n);
const int np = props_.numPhases();
Block z = Block::Zero(n, np);
if (pu_.phase_used[Gas]) {
@ -156,7 +156,7 @@ namespace Opm
THROW("Cannot call muGas(): gas phase not present.");
}
const int n = cells.size();
ASSERT(pg.size() == n);
assert(pg.size() == n);
const int np = props_.numPhases();
Block z = Block::Zero(n, np);
Block mu(n, np);
@ -178,7 +178,7 @@ namespace Opm
THROW("Cannot call muWat(): water phase not present.");
}
const int n = cells.size();
ASSERT(pw.value().size() == n);
assert(pw.value().size() == n);
const int np = props_.numPhases();
Block z = Block::Zero(n, np);
Block mu(n, np);
@ -210,7 +210,7 @@ namespace Opm
THROW("Cannot call muOil(): oil phase not present.");
}
const int n = cells.size();
ASSERT(po.value().size() == n);
assert(po.value().size() == n);
const int np = props_.numPhases();
Block z = Block::Zero(n, np);
if (pu_.phase_used[Gas]) {
@ -249,7 +249,7 @@ namespace Opm
THROW("Cannot call muGas(): gas phase not present.");
}
const int n = cells.size();
ASSERT(pg.value().size() == n);
assert(pg.value().size() == n);
const int np = props_.numPhases();
Block z = Block::Zero(n, np);
Block mu(n, np);
@ -294,7 +294,7 @@ namespace Opm
THROW("Cannot call bWat(): water phase not present.");
}
const int n = cells.size();
ASSERT(pw.size() == n);
assert(pw.size() == n);
const int np = props_.numPhases();
Block z = Block::Zero(n, np);
Block matrix(n, np*np);
@ -316,7 +316,7 @@ namespace Opm
THROW("Cannot call bOil(): oil phase not present.");
}
const int n = cells.size();
ASSERT(po.size() == n);
assert(po.size() == n);
const int np = props_.numPhases();
Block z = Block::Zero(n, np);
if (pu_.phase_used[Gas]) {
@ -342,7 +342,7 @@ namespace Opm
THROW("Cannot call bGas(): gas phase not present.");
}
const int n = cells.size();
ASSERT(pg.size() == n);
assert(pg.size() == n);
const int np = props_.numPhases();
Block z = Block::Zero(n, np);
Block matrix(n, np*np);
@ -362,7 +362,7 @@ namespace Opm
THROW("Cannot call muWat(): water phase not present.");
}
const int n = cells.size();
ASSERT(pw.value().size() == n);
assert(pw.value().size() == n);
const int np = props_.numPhases();
Block z = Block::Zero(n, np);
Block matrix(n, np*np);
@ -392,7 +392,7 @@ namespace Opm
THROW("Cannot call muOil(): oil phase not present.");
}
const int n = cells.size();
ASSERT(po.value().size() == n);
assert(po.value().size() == n);
const int np = props_.numPhases();
Block z = Block::Zero(n, np);
if (pu_.phase_used[Gas]) {
@ -429,7 +429,7 @@ namespace Opm
THROW("Cannot call muGas(): gas phase not present.");
}
const int n = cells.size();
ASSERT(pg.value().size() == n);
assert(pg.value().size() == n);
const int np = props_.numPhases();
Block z = Block::Zero(n, np);
Block matrix(n, np*np);
@ -487,15 +487,15 @@ namespace Opm
const int np = props_.numPhases();
Block s_all(n, np);
if (pu_.phase_used[Water]) {
ASSERT(sw.size() == n);
assert(sw.size() == n);
s_all.col(pu_.phase_pos[Water]) = sw;
}
if (pu_.phase_used[Oil]) {
ASSERT(so.size() == n);
assert(so.size() == n);
s_all.col(pu_.phase_pos[Oil]) = so;
}
if (pu_.phase_used[Gas]) {
ASSERT(sg.size() == n);
assert(sg.size() == n);
s_all.col(pu_.phase_pos[Gas]) = sg;
}
Block kr(n, np);
@ -528,17 +528,17 @@ namespace Opm
const int np = props_.numPhases();
Block s_all(n, np);
if (pu_.phase_used[Water]) {
ASSERT(sw.value().size() == n);
assert(sw.value().size() == n);
s_all.col(pu_.phase_pos[Water]) = sw.value();
}
if (pu_.phase_used[Oil]) {
ASSERT(so.value().size() == n);
assert(so.value().size() == n);
s_all.col(pu_.phase_pos[Oil]) = so.value();
} else {
THROW("BlackoilPropsAd::relperm() assumes oil phase is active.");
}
if (pu_.phase_used[Gas]) {
ASSERT(sg.value().size() == n);
assert(sg.value().size() == n);
s_all.col(pu_.phase_pos[Gas]) = sg.value();
}
Block kr(n, np);

View File

@ -198,7 +198,7 @@ namespace Opm
THROW("Cannot call muWat(): water phase not present.");
}
const int n = cells.size();
ASSERT(pw.size() == n);
assert(pw.size() == n);
V mu(n);
V dmudp(n);
V dmudr(n);
@ -222,7 +222,7 @@ namespace Opm
THROW("Cannot call muOil(): oil phase not present.");
}
const int n = cells.size();
ASSERT(po.size() == n);
assert(po.size() == n);
V mu(n);
V dmudp(n);
V dmudr(n);
@ -243,7 +243,7 @@ namespace Opm
THROW("Cannot call muGas(): gas phase not present.");
}
const int n = cells.size();
ASSERT(pg.size() == n);
assert(pg.size() == n);
V mu(n);
V dmudp(n);
V dmudr(n);
@ -265,7 +265,7 @@ namespace Opm
THROW("Cannot call muWat(): water phase not present.");
}
const int n = cells.size();
ASSERT(pw.size() == n);
assert(pw.size() == n);
V mu(n);
V dmudp(n);
V dmudr(n);
@ -295,7 +295,7 @@ namespace Opm
THROW("Cannot call muOil(): oil phase not present.");
}
const int n = cells.size();
ASSERT(po.size() == n);
assert(po.size() == n);
V mu(n);
V dmudp(n);
V dmudr(n);
@ -324,7 +324,7 @@ namespace Opm
THROW("Cannot call muGas(): gas phase not present.");
}
const int n = cells.size();
ASSERT(pg.value().size() == n);
assert(pg.value().size() == n);
V mu(n);
V dmudp(n);
V dmudr(n);
@ -371,7 +371,7 @@ namespace Opm
THROW("Cannot call bWat(): water phase not present.");
}
const int n = cells.size();
ASSERT(pw.size() == n);
assert(pw.size() == n);
V b(n);
V dbdp(n);
@ -397,7 +397,7 @@ namespace Opm
THROW("Cannot call bOil(): oil phase not present.");
}
const int n = cells.size();
ASSERT(po.size() == n);
assert(po.size() == n);
V b(n);
V dbdp(n);
@ -420,7 +420,7 @@ namespace Opm
THROW("Cannot call bGas(): gas phase not present.");
}
const int n = cells.size();
ASSERT(pg.size() == n);
assert(pg.size() == n);
V b(n);
V dbdp(n);
@ -444,7 +444,7 @@ namespace Opm
THROW("Cannot call muWat(): water phase not present.");
}
const int n = cells.size();
ASSERT(pw.size() == n);
assert(pw.size() == n);
V b(n);
V dbdp(n);
@ -476,7 +476,7 @@ namespace Opm
THROW("Cannot call muOil(): oil phase not present.");
}
const int n = cells.size();
ASSERT(po.size() == n);
assert(po.size() == n);
V b(n);
V dbdp(n);
@ -506,7 +506,7 @@ namespace Opm
THROW("Cannot call muGas(): gas phase not present.");
}
const int n = cells.size();
ASSERT(pg.size() == n);
assert(pg.size() == n);
V b(n);
V dbdp(n);
@ -540,7 +540,7 @@ namespace Opm
THROW("Cannot call rsMax(): oil phase not present.");
}
const int n = cells.size();
ASSERT(po.size() == n);
assert(po.size() == n);
V rbub(n);
V drbubdp(n);
props_[Oil]->rbub(n, po.data(), rbub.data(), drbubdp.data());
@ -558,7 +558,7 @@ namespace Opm
THROW("Cannot call rsMax(): oil phase not present.");
}
const int n = cells.size();
ASSERT(po.size() == n);
assert(po.size() == n);
V rbub(n);
V drbubdp(n);
props_[Oil]->rbub(n, po.value().data(), rbub.data(), drbubdp.data());
@ -589,15 +589,15 @@ namespace Opm
const int np = numPhases();
Block s_all(n, np);
if (phase_usage_.phase_used[Water]) {
ASSERT(sw.size() == n);
assert(sw.size() == n);
s_all.col(phase_usage_.phase_pos[Water]) = sw;
}
if (phase_usage_.phase_used[Oil]) {
ASSERT(so.size() == n);
assert(so.size() == n);
s_all.col(phase_usage_.phase_pos[Oil]) = so;
}
if (phase_usage_.phase_used[Gas]) {
ASSERT(sg.size() == n);
assert(sg.size() == n);
s_all.col(phase_usage_.phase_pos[Gas]) = sg;
}
Block kr(n, np);
@ -630,17 +630,17 @@ namespace Opm
const int np = numPhases();
Block s_all(n, np);
if (phase_usage_.phase_used[Water]) {
ASSERT(sw.value().size() == n);
assert(sw.value().size() == n);
s_all.col(phase_usage_.phase_pos[Water]) = sw.value();
}
if (phase_usage_.phase_used[Oil]) {
ASSERT(so.value().size() == n);
assert(so.value().size() == n);
s_all.col(phase_usage_.phase_pos[Oil]) = so.value();
} else {
THROW("BlackoilPropsAdFromDeck::relperm() assumes oil phase is active.");
}
if (phase_usage_.phase_used[Gas]) {
ASSERT(sg.value().size() == n);
assert(sg.value().size() == n);
s_all.col(phase_usage_.phase_pos[Gas]) = sg.value();
}
Block kr(n, np);

View File

@ -123,7 +123,7 @@ namespace {
const int nperf = wells.well_connpos[nw];
const int dim = grid.dimensions;
V wdp = V::Zero(nperf,1);
ASSERT(wdp.size() == rho.size());
assert(wdp.size() == rho.size());
// Main loop, iterate over all perforations,
// using the following formula:
@ -339,7 +339,7 @@ namespace Opm {
// well bottom-hole pressure
// Note that oil is assumed to always be present, but is never
// a primary variable.
ASSERT(active_[ Oil ]);
assert(active_[ Oil ]);
std::vector<int> bpat(np, nc);
const bool gasandoil = (active_[ Oil ] && active_[ Gas ]);
if (gasandoil) {
@ -432,7 +432,7 @@ namespace Opm {
const DataBlock s = Eigen::Map<const DataBlock>(& x.saturation()[0], nc, np);
const Opm::PhaseUsage pu = fluid_.phaseUsage();
// We do not handle a Water/Gas situation correctly, guard against it.
ASSERT (active_[ Oil]);
assert (active_[ Oil]);
if (active_[ Water ]) {
const V sw = s.col(pu.phase_pos[ Water ]);
vars0.push_back(sw);
@ -507,7 +507,7 @@ namespace Opm {
// Bhp.
state.bhp = vars[ nextvar++ ];
ASSERT(nextvar == int(vars.size()));
assert(nextvar == int(vars.size()));
return state;
}
@ -643,7 +643,7 @@ namespace Opm {
if (g) {
// Guard against gravity in anything but last dimension.
for (int dd = 0; dd < dim - 1; ++dd) {
ASSERT(g[dd] == 0.0);
assert(g[dd] == 0.0);
}
}
ADB cell_rho_total = ADB::constant(V::Zero(nc), state.pressure.blockPattern());
@ -655,7 +655,7 @@ namespace Opm {
}
}
ADB inj_rho_total = ADB::constant(V::Zero(nperf), state.pressure.blockPattern());
ASSERT(np == wells_.number_of_phases);
assert(np == wells_.number_of_phases);
const DataBlock compi = Eigen::Map<const DataBlock>(wells_.comp_frac, nw, np);
for (int phase = 0; phase < 3; ++phase) {
if (active_[phase]) {
@ -801,7 +801,7 @@ namespace Opm {
const int nc = grid_.number_of_cells;
const int nw = wells_.number_of_wells;
const V null;
ASSERT(null.size() == 0);
assert(null.size() == 0);
const V zero = V::Zero(nc);
const V one = V::Constant(nc, 1.0);
@ -818,7 +818,7 @@ namespace Opm {
varstart += dqs.size();
const V dbhp = subset(dx, Span(nw, 1, varstart));
varstart += dbhp.size();
ASSERT(varstart == dx.size());
assert(varstart == dx.size());
// Pressure update.
const double dpmaxrel = 0.8;

View File

@ -100,7 +100,7 @@ namespace {
const int nperf = wells.well_connpos[nw];
const int dim = grid.dimensions;
V wdp = V::Zero(nperf,1);
ASSERT(wdp.size() == rho.size());
assert(wdp.size() == rho.size());
// Main loop, iterate over all perforations,
// using the following formula:
@ -165,7 +165,7 @@ namespace Opm {
computeExplicitData(dt, state, well_state);
// Compute relperms once and for all (since saturations are explicit).
DataBlock s = Eigen::Map<const DataBlock>(state.saturation().data(), nc, np);
ASSERT(np == 2);
assert(np == 2);
kr_ = fluid_.relperm(s.col(0), s.col(1), V::Zero(nc,1), buildAllCells(nc));
// Compute relperms for wells. This must be revisited for crossflow.
const int nw = wells_.number_of_wells;
@ -235,7 +235,7 @@ namespace Opm {
// Compute relperms.
DataBlock s = Eigen::Map<const DataBlock>(state.saturation().data(), nc, np);
ASSERT(np == 2);
assert(np == 2);
kr_ = fluid_.relperm(s.col(0), s.col(1), V::Zero(nc,1), buildAllCells(nc));
// Compute relperms for wells. This must be revisited for crossflow.
@ -256,7 +256,7 @@ namespace Opm {
if (g) {
// Guard against gravity in anything but last dimension.
for (int dd = 0; dd < dim - 1; ++dd) {
ASSERT(g[dd] == 0.0);
assert(g[dd] == 0.0);
}
}
V cell_rho_total = V::Zero(nc,1);

View File

@ -186,7 +186,7 @@ namespace Opm
typedef Eigen::Array<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> DynArr;
const V z = Eigen::Map<DynArr>(grid_.cell_centroids, nc, grid_.dimensions).rightCols<1>();
const V ndz = (ops_.ngrad * z.matrix()).array();
ASSERT(num_internal == ndp.size());
assert(num_internal == ndp.size());
const double* density = props_.density();
const V dhw = ndp - ndz*(gravity_*density[0]);
const V dho = ndp - ndz*(gravity_*density[1]);
@ -228,7 +228,7 @@ namespace Opm
// Solve linear system.
Eigen::SparseMatrix<double, Eigen::RowMajor> smatr = transport_residual.derivative()[0];
ASSERT(smatr.isCompressed());
assert(smatr.isCompressed());
V ds(nc);
LinearSolverInterface::LinearSolverReport rep
= linsolver_.solve(nc, smatr.nonZeros(),