opm-core: make it work nicely with clang

This commit is contained in:
Andreas Lauser 2012-06-27 11:10:25 +02:00 committed by Bård Skaflestad
parent 6672a94fb2
commit 6f69de969a
6 changed files with 56 additions and 70 deletions

View File

@ -191,21 +191,7 @@ namespace {
return us; return us;
} }
inline std::string readKeyword(std::istream& is) inline bool readKeyword(std::istream& is, std::string& keyword)
{
std::string keyword_candidate;
while (!is.eof()) {
is >> keyword_candidate;
if(keyword_candidate.find("--") == 0) {
is >> ignoreLine; // This line is a comment
} else {
return upcase(keyword_candidate);
}
}
return "CONTINUE"; // Last line in included file is a comment
}
inline bool readKeywordNew(std::istream& is, std::string& keyword)
{ {
char buf[9]; char buf[9];
int i, j; int i, j;
@ -377,7 +363,7 @@ void EclipseGridParser::readImpl(istream& is)
std::string keyword; std::string keyword;
while (is.good()) { while (is.good()) {
is >> ignoreWhitespace; is >> ignoreWhitespace;
bool ok = readKeywordNew(is, keyword); bool ok = readKeyword(is, keyword);
if (ok) { if (ok) {
//#ifdef VERBOSE //#ifdef VERBOSE
cout << "Keyword found: " << keyword << endl; cout << "Keyword found: " << keyword << endl;

View File

@ -129,47 +129,47 @@ public:
{ return dynamic_cast<const keyword&>(*getSpecialValue(#keyword)); } { return dynamic_cast<const keyword&>(*getSpecialValue(#keyword)); }
// Support for special fields. // Support for special fields.
SPECIAL_FIELD(SPECGRID); SPECIAL_FIELD(SPECGRID)
SPECIAL_FIELD(FAULTS); SPECIAL_FIELD(FAULTS)
SPECIAL_FIELD(MULTFLT); SPECIAL_FIELD(MULTFLT)
SPECIAL_FIELD(TITLE); SPECIAL_FIELD(TITLE)
SPECIAL_FIELD(START); SPECIAL_FIELD(START)
SPECIAL_FIELD(DATES); SPECIAL_FIELD(DATES)
SPECIAL_FIELD(DENSITY); SPECIAL_FIELD(DENSITY)
SPECIAL_FIELD(PVDG); SPECIAL_FIELD(PVDG)
SPECIAL_FIELD(PVDO); SPECIAL_FIELD(PVDO)
SPECIAL_FIELD(PVTG); SPECIAL_FIELD(PVTG)
SPECIAL_FIELD(PVTO); SPECIAL_FIELD(PVTO)
SPECIAL_FIELD(PVTW); SPECIAL_FIELD(PVTW)
SPECIAL_FIELD(SGOF); SPECIAL_FIELD(SGOF)
SPECIAL_FIELD(SWOF); SPECIAL_FIELD(SWOF)
SPECIAL_FIELD(ROCK); SPECIAL_FIELD(ROCK)
SPECIAL_FIELD(ROCKTAB); SPECIAL_FIELD(ROCKTAB)
SPECIAL_FIELD(WELSPECS); SPECIAL_FIELD(WELSPECS)
SPECIAL_FIELD(COMPDAT); SPECIAL_FIELD(COMPDAT)
SPECIAL_FIELD(WCONINJE); SPECIAL_FIELD(WCONINJE)
SPECIAL_FIELD(WCONPROD); SPECIAL_FIELD(WCONPROD)
SPECIAL_FIELD(WELTARG); SPECIAL_FIELD(WELTARG)
SPECIAL_FIELD(WELOPEN); SPECIAL_FIELD(WELOPEN)
SPECIAL_FIELD(EQUIL); SPECIAL_FIELD(EQUIL)
SPECIAL_FIELD(PVCDO); SPECIAL_FIELD(PVCDO)
SPECIAL_FIELD(TSTEP); SPECIAL_FIELD(TSTEP)
SPECIAL_FIELD(PLYVISC); SPECIAL_FIELD(PLYVISC)
SPECIAL_FIELD(PLYROCK); SPECIAL_FIELD(PLYROCK)
SPECIAL_FIELD(PLYADS); SPECIAL_FIELD(PLYADS)
SPECIAL_FIELD(PLYMAX); SPECIAL_FIELD(PLYMAX)
SPECIAL_FIELD(TLMIXPAR); SPECIAL_FIELD(TLMIXPAR)
SPECIAL_FIELD(WPOLYMER); SPECIAL_FIELD(WPOLYMER)
SPECIAL_FIELD(GRUPTREE); SPECIAL_FIELD(GRUPTREE)
SPECIAL_FIELD(GCONINJE); SPECIAL_FIELD(GCONINJE)
SPECIAL_FIELD(GCONPROD); SPECIAL_FIELD(GCONPROD)
SPECIAL_FIELD(WGRUPCON); SPECIAL_FIELD(WGRUPCON)
// The following fields only have a dummy implementation // The following fields only have a dummy implementation
// that allows us to ignore them. // that allows us to ignore them.
SPECIAL_FIELD(SWFN); SPECIAL_FIELD(SWFN)
SPECIAL_FIELD(SOF2); SPECIAL_FIELD(SOF2)
SPECIAL_FIELD(TUNING); SPECIAL_FIELD(TUNING)
#undef SPECIAL_FIELD #undef SPECIAL_FIELD

View File

@ -89,9 +89,9 @@ namespace Opm
const RockCompressibility* rock_comp_; const RockCompressibility* rock_comp_;
const Wells* wells_; const Wells* wells_;
const std::vector<double>& src_; const std::vector<double>& src_;
const FlowBoundaryConditions* bcs_; //const FlowBoundaryConditions* bcs_;
const LinearSolverInterface& linsolver_; //const LinearSolverInterface& linsolver_;
const double* gravity_; //const double* gravity_;
// Solvers // Solvers
IncompTpfa psolver_; IncompTpfa psolver_;
TransportModelTwophase tsolver_; TransportModelTwophase tsolver_;
@ -207,9 +207,9 @@ namespace Opm
rock_comp_(rock_comp), rock_comp_(rock_comp),
wells_(wells), wells_(wells),
src_(src), src_(src),
bcs_(bcs), //bcs_(bcs),
linsolver_(linsolver), //linsolver_(linsolver),
gravity_(gravity), //gravity_(gravity),
psolver_(grid, props, rock_comp, linsolver, psolver_(grid, props, rock_comp, linsolver,
param.getDefault("nl_pressure_residual_tolerance", 0.0), param.getDefault("nl_pressure_residual_tolerance", 0.0),
param.getDefault("nl_pressure_change_tolerance", 1.0), param.getDefault("nl_pressure_change_tolerance", 1.0),

View File

@ -36,7 +36,7 @@ namespace Opm
class SimulatorTimer; class SimulatorTimer;
class TwophaseState; class TwophaseState;
class WellState; class WellState;
class SimulatorReport; struct SimulatorReport;
/// Class collecting all necessary components for a two-phase simulation. /// Class collecting all necessary components for a two-phase simulation.
class SimulatorTwophase class SimulatorTwophase

View File

@ -86,7 +86,7 @@ namespace Opm
template<class Derived> template<class Derived>
static void addCreator(const std::string& type) static void addCreator(const std::string& type)
{ {
instance().doAddCreator<Derived>(type); instance().template doAddCreator<Derived>(type);
} }
private: private:

View File

@ -73,7 +73,7 @@ class MonotCubicInterpolator {
if (!read(datafilename)) { if (!read(datafilename)) {
throw("Unable to constuct MonotCubicInterpolator from file.") ; throw("Unable to constuct MonotCubicInterpolator from file.") ;
} ; } ;
} ; }
/** /**
@ -94,7 +94,7 @@ class MonotCubicInterpolator {
if (!read(std::string(datafilename))) { if (!read(std::string(datafilename))) {
throw("Unable to constuct MonotCubicInterpolator from file.") ; throw("Unable to constuct MonotCubicInterpolator from file.") ;
} ; } ;
} ; }
/** /**
@ -110,7 +110,7 @@ class MonotCubicInterpolator {
if (!read(std::string(datafilename),xColumn,fColumn)) { if (!read(std::string(datafilename),xColumn,fColumn)) {
throw("Unable to constuct MonotCubicInterpolator from file.") ; throw("Unable to constuct MonotCubicInterpolator from file.") ;
} ; } ;
} ; }
/** /**
@param datafilename data file @param datafilename data file
@ -125,7 +125,7 @@ class MonotCubicInterpolator {
if (!read(datafilename,xColumn,fColumn)) { if (!read(datafilename,xColumn,fColumn)) {
throw("Unable to constuct MonotCubicInterpolator from file.") ; throw("Unable to constuct MonotCubicInterpolator from file.") ;
} ; } ;
} ; }
/** /**
@param x vector of x values @param x vector of x values
@ -144,7 +144,7 @@ class MonotCubicInterpolator {
This object must be treated with care until This object must be treated with care until
populated. populated.
*/ */
MonotCubicInterpolator() {;} ; MonotCubicInterpolator() { }
@ -163,7 +163,7 @@ class MonotCubicInterpolator {
*/ */
bool read(const std::string & datafilename) { bool read(const std::string & datafilename) {
return read(datafilename,1,2) ; return read(datafilename,1,2) ;
} ; }
/** /**
@param datafilename data file @param datafilename data file
@ -188,7 +188,7 @@ class MonotCubicInterpolator {
@return f(x) for a given x @return f(x) for a given x
*/ */
double operator () (double x) const { return evaluate(x) ; } ; double operator () (double x) const { return evaluate(x) ; }
/** /**
@param x x value @param x x value
@ -485,7 +485,7 @@ class MonotCubicInterpolator {
*/ */
void shrinkFlatAreas() { void shrinkFlatAreas() {
shrinkFlatAreas(1e-14); shrinkFlatAreas(1e-14);
}; }