fix some clang 3.3 warnings

The most severe change probably is the removal of the AutoDiff
debugging helper functions which were useful from within a debugger
but unfortunately had to rely on a presumed linker bug in order not to
be removed in the final binary.

Also, some private attributes were unused. These have been removed and
the constructors of their respective classes have been adapted. Once
their intended functionality is actually implemented, they should be
brought back on an as-needed basis.

Thanks to @bska for the review!
This commit is contained in:
Andreas Lauser 2013-10-22 12:12:20 +02:00 committed by Andreas Lauser
parent ecd2fb8382
commit 1c62934034
7 changed files with 4 additions and 124 deletions

View File

@ -169,14 +169,6 @@ try
simple_wells->ctrls[1]->current = 0;
}
// Boundary conditions.
FlowBCManager bcs;
if (param.getDefault("use_pside", false)) {
int pside = param.get<int>("pside");
double pside_pressure = param.get<double>("pside_pressure");
bcs.pressureSide(*grid->c_grid(), FlowBCManager::Side(pside), pside_pressure);
}
// Linear solver.
LinearSolverFactory linsolver(param);
@ -217,7 +209,6 @@ try
*props,
rock_comp->isActive() ? rock_comp.get() : 0,
wells,
bcs.c_bcs(),
linsolver,
grav);
SimulatorTimer simtimer;
@ -271,7 +262,6 @@ try
*props,
rock_comp->isActive() ? rock_comp.get() : 0,
wells,
bcs.c_bcs(),
linsolver,
grav);
if (epoch == 0) {

View File

@ -130,14 +130,6 @@ try
bool use_gravity = (gravity[0] != 0.0 || gravity[1] != 0.0 || gravity[2] != 0.0);
const double *grav = use_gravity ? &gravity[0] : 0;
// Boundary conditions.
FlowBCManager bcs;
if (param.getDefault("use_pside", false)) {
int pside = param.get<int>("pside");
double pside_pressure = param.get<double>("pside_pressure");
bcs.pressureSide(*grid->c_grid(), FlowBCManager::Side(pside), pside_pressure);
}
// Linear solver.
LinearSolverFactory linsolver(param);
@ -214,7 +206,6 @@ try
*new_props,
rock_comp->isActive() ? rock_comp.get() : 0,
wells,
bcs.c_bcs(),
linsolver,
grav);
if (epoch == 0) {

View File

@ -25,6 +25,7 @@
#include <opm/core/utility/ErrorMacros.hpp>
#include <iostream>
#include <vector>
namespace Opm
{
@ -116,86 +117,6 @@ struct HelperOps
}
};
// -------------------- debugger output helpers --------------------
#if !defined(NDEBUG)
#include <cstdio>
#include <string>
namespace {
void
printSparseMatrix(const Eigen::SparseMatrix<double>& A,
std::FILE* fp)
{
typedef Eigen::SparseMatrix<double>::Index Index;
const Index osize = A.outerSize();
for (Index k = 0; k < osize; ++k) {
for (Eigen::SparseMatrix<double>::InnerIterator
i(A, k); i ; ++i) {
std::fprintf(fp, "%lu %lu %26.18e\n",
static_cast<unsigned long>(i.row() + 1),
static_cast<unsigned long>(i.col() + 1),
i.value());
}
}
}
void
printSparseMatrix(const Eigen::SparseMatrix<double>& A ,
const char* const fn)
{
std::FILE* fp;
fp = std::fopen(fn, "w");
if (fp != 0) {
printSparseMatrix(A, fp);
}
std::fclose(fp);
}
void
writeAsMATLAB(const std::vector< Eigen::SparseMatrix<double> >& vA,
std::FILE* fp ,
const char* const vname)
{
const int n = static_cast<int>(vA.size());
fprintf(fp, "%s = cell([1, %d]);\n\n", vname, n);
for (int i = 0; i < n; ++i) {
fprintf(fp, "%s{%d} = spconvert([\n", vname, i + 1);
printSparseMatrix(vA[i], fp);
const int rows = vA[i].rows();
const int cols = vA[i].cols();
fprintf(fp, "%d %d 0.0]);\n\n", rows, cols);
}
}
void
writeAsMATLAB(const std::vector< Eigen::SparseMatrix<double> >& vA,
const char* const fn ,
const char* const vname)
{
std::FILE* fp;
fp = std::fopen(fn, "w");
if (fp != 0) {
writeAsMATLAB(vA, fp, vname);
}
std::fclose(fp);
}
} // anonymous namespace
#endif // !defined(NDEBUG)
// -------------------- upwinding helper class --------------------
@ -587,7 +508,6 @@ inline Eigen::ArrayXd sign (const Eigen::ArrayXd& x)
return retval;
}
} // namespace Opm
#endif // OPM_AUTODIFFHELPERS_HEADER_INCLUDED

View File

@ -70,7 +70,6 @@ namespace Opm
const BlackoilPropertiesInterface& props,
const RockCompressibility* rock_comp_props,
WellsManager& wells_manager,
const FlowBoundaryConditions* bcs,
LinearSolverInterface& linsolver,
const double* gravity);
@ -98,7 +97,6 @@ namespace Opm
const RockCompressibility* rock_comp_props_;
WellsManager& wells_manager_;
const Wells* wells_;
const FlowBoundaryConditions* bcs_;
const double* gravity_;
// Solvers
BlackoilPropsAd fluid_;
@ -119,11 +117,10 @@ namespace Opm
const BlackoilPropertiesInterface& props,
const RockCompressibility* rock_comp_props,
WellsManager& wells_manager,
const FlowBoundaryConditions* bcs,
LinearSolverInterface& linsolver,
const double* gravity)
{
pimpl_.reset(new Impl(param, grid, props, rock_comp_props, wells_manager, bcs, linsolver, gravity));
pimpl_.reset(new Impl(param, grid, props, rock_comp_props, wells_manager, linsolver, gravity));
}
@ -238,7 +235,6 @@ namespace Opm
const BlackoilPropertiesInterface& props,
const RockCompressibility* rock_comp_props,
WellsManager& wells_manager,
const FlowBoundaryConditions* bcs,
LinearSolverInterface& linsolver,
const double* gravity)
: grid_(grid),
@ -246,7 +242,6 @@ namespace Opm
rock_comp_props_(rock_comp_props),
wells_manager_(wells_manager),
wells_(wells_manager.c_wells()),
bcs_(bcs),
gravity_(gravity),
fluid_(props_),
geo_(grid_, fluid_, gravity_),

View File

@ -63,7 +63,6 @@ namespace Opm
/// \param[in] props fluid and rock properties
/// \param[in] rock_comp_props if non-null, rock compressibility properties
/// \param[in] well_manager well manager
/// \param[in] bcs boundary conditions, treat as all noflow if null
/// \param[in] linsolver linear solver
/// \param[in] gravity if non-null, gravity vector
SimulatorCompressibleAd(const parameter::ParameterGroup& param,
@ -71,7 +70,6 @@ namespace Opm
const BlackoilPropertiesInterface& props,
const RockCompressibility* rock_comp_props,
WellsManager& wells_manager,
const FlowBoundaryConditions* bcs,
LinearSolverInterface& linsolver,
const double* gravity);

View File

@ -70,7 +70,6 @@ namespace Opm
const BlackoilPropsAdInterface& props,
const RockCompressibility* rock_comp_props,
WellsManager& wells_manager,
const FlowBoundaryConditions* bcs,
LinearSolverInterface& linsolver,
const double* gravity);
@ -89,16 +88,12 @@ namespace Opm
// Parameters for well control
bool check_well_controls_;
int max_well_control_iterations_;
// Parameters for transport solver.
int num_transport_substeps_;
bool use_segregation_split_;
// Observed objects.
const UnstructuredGrid& grid_;
const BlackoilPropsAdInterface& props_;
const RockCompressibility* rock_comp_props_;
WellsManager& wells_manager_;
const Wells* wells_;
const FlowBoundaryConditions* bcs_;
const double* gravity_;
// Solvers
DerivedGeology geo_;
@ -115,11 +110,10 @@ namespace Opm
const BlackoilPropsAdInterface& props,
const RockCompressibility* rock_comp_props,
WellsManager& wells_manager,
const FlowBoundaryConditions* bcs,
LinearSolverInterface& linsolver,
const double* gravity)
{
pimpl_.reset(new Impl(param, grid, props, rock_comp_props, wells_manager, bcs, linsolver, gravity));
pimpl_.reset(new Impl(param, grid, props, rock_comp_props, wells_manager, linsolver, gravity));
}
@ -256,13 +250,12 @@ namespace Opm
#endif
// \TODO: Treat bcs properly.
// \TODO: Treat bcs.
SimulatorFullyImplicitBlackoil::Impl::Impl(const parameter::ParameterGroup& param,
const UnstructuredGrid& grid,
const BlackoilPropsAdInterface& props,
const RockCompressibility* rock_comp_props,
WellsManager& wells_manager,
const FlowBoundaryConditions* bcs,
LinearSolverInterface& linsolver,
const double* gravity)
: grid_(grid),
@ -270,7 +263,6 @@ namespace Opm
rock_comp_props_(rock_comp_props),
wells_manager_(wells_manager),
wells_(wells_manager.c_wells()),
bcs_(bcs),
gravity_(gravity),
geo_(grid_, props_, gravity_),
solver_(grid_, props_, geo_, rock_comp_props, *wells_manager.c_wells(), linsolver)
@ -279,10 +271,6 @@ namespace Opm
param.getDefault("nl_pressure_maxiter", 10),
gravity, */
{
// Intercept usage of bcs, since we do not handle it.
if (bcs && bcs->nbc != 0) {
OPM_THROW(std::runtime_error, "SimulatorFullyImplicitBlackoil cannot handle boundary conditions other than no-flow. Not implemented yet.");
}
// For output.
output_ = param.getDefault("output", true);
if (output_) {

View File

@ -63,7 +63,6 @@ namespace Opm
/// \param[in] props fluid and rock properties
/// \param[in] rock_comp_props if non-null, rock compressibility properties
/// \param[in] well_manager well manager, may manage no (null) wells
/// \param[in] bcs boundary conditions, treat as all noflow if null
/// \param[in] linsolver linear solver
/// \param[in] gravity if non-null, gravity vector
SimulatorFullyImplicitBlackoil(const parameter::ParameterGroup& param,
@ -71,7 +70,6 @@ namespace Opm
const BlackoilPropsAdInterface& props,
const RockCompressibility* rock_comp_props,
WellsManager& wells_manager,
const FlowBoundaryConditions* bcs,
LinearSolverInterface& linsolver,
const double* gravity);