From 6f69de969a64cad76c51d69726ae2068b461f2fb Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Wed, 27 Jun 2012 11:10:25 +0200 Subject: [PATCH] opm-core: make it work nicely with clang --- opm/core/eclipse/EclipseGridParser.cpp | 18 +---- opm/core/eclipse/EclipseGridParser.hpp | 76 ++++++++++----------- opm/core/simulator/SimulatorTwophase.cpp | 12 ++-- opm/core/simulator/SimulatorTwophase.hpp | 2 +- opm/core/utility/Factory.hpp | 2 +- opm/core/utility/MonotCubicInterpolator.hpp | 16 ++--- 6 files changed, 56 insertions(+), 70 deletions(-) diff --git a/opm/core/eclipse/EclipseGridParser.cpp b/opm/core/eclipse/EclipseGridParser.cpp index fd5f5ef5..45017a46 100644 --- a/opm/core/eclipse/EclipseGridParser.cpp +++ b/opm/core/eclipse/EclipseGridParser.cpp @@ -191,21 +191,7 @@ namespace { return us; } - inline std::string readKeyword(std::istream& is) - { - 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) + inline bool readKeyword(std::istream& is, std::string& keyword) { char buf[9]; int i, j; @@ -377,7 +363,7 @@ void EclipseGridParser::readImpl(istream& is) std::string keyword; while (is.good()) { is >> ignoreWhitespace; - bool ok = readKeywordNew(is, keyword); + bool ok = readKeyword(is, keyword); if (ok) { //#ifdef VERBOSE cout << "Keyword found: " << keyword << endl; diff --git a/opm/core/eclipse/EclipseGridParser.hpp b/opm/core/eclipse/EclipseGridParser.hpp index 56e9ee4f..9f66e9ae 100644 --- a/opm/core/eclipse/EclipseGridParser.hpp +++ b/opm/core/eclipse/EclipseGridParser.hpp @@ -129,47 +129,47 @@ public: { return dynamic_cast(*getSpecialValue(#keyword)); } // Support for special fields. - SPECIAL_FIELD(SPECGRID); - SPECIAL_FIELD(FAULTS); - SPECIAL_FIELD(MULTFLT); - SPECIAL_FIELD(TITLE); - SPECIAL_FIELD(START); - SPECIAL_FIELD(DATES); - SPECIAL_FIELD(DENSITY); - SPECIAL_FIELD(PVDG); - SPECIAL_FIELD(PVDO); - SPECIAL_FIELD(PVTG); - SPECIAL_FIELD(PVTO); - SPECIAL_FIELD(PVTW); - SPECIAL_FIELD(SGOF); - SPECIAL_FIELD(SWOF); - SPECIAL_FIELD(ROCK); - SPECIAL_FIELD(ROCKTAB); - SPECIAL_FIELD(WELSPECS); - SPECIAL_FIELD(COMPDAT); - SPECIAL_FIELD(WCONINJE); - SPECIAL_FIELD(WCONPROD); - SPECIAL_FIELD(WELTARG); - SPECIAL_FIELD(WELOPEN); - SPECIAL_FIELD(EQUIL); - SPECIAL_FIELD(PVCDO); - SPECIAL_FIELD(TSTEP); - SPECIAL_FIELD(PLYVISC); - SPECIAL_FIELD(PLYROCK); - SPECIAL_FIELD(PLYADS); - SPECIAL_FIELD(PLYMAX); - SPECIAL_FIELD(TLMIXPAR); - SPECIAL_FIELD(WPOLYMER); - SPECIAL_FIELD(GRUPTREE); - SPECIAL_FIELD(GCONINJE); - SPECIAL_FIELD(GCONPROD); - SPECIAL_FIELD(WGRUPCON); + SPECIAL_FIELD(SPECGRID) + SPECIAL_FIELD(FAULTS) + SPECIAL_FIELD(MULTFLT) + SPECIAL_FIELD(TITLE) + SPECIAL_FIELD(START) + SPECIAL_FIELD(DATES) + SPECIAL_FIELD(DENSITY) + SPECIAL_FIELD(PVDG) + SPECIAL_FIELD(PVDO) + SPECIAL_FIELD(PVTG) + SPECIAL_FIELD(PVTO) + SPECIAL_FIELD(PVTW) + SPECIAL_FIELD(SGOF) + SPECIAL_FIELD(SWOF) + SPECIAL_FIELD(ROCK) + SPECIAL_FIELD(ROCKTAB) + SPECIAL_FIELD(WELSPECS) + SPECIAL_FIELD(COMPDAT) + SPECIAL_FIELD(WCONINJE) + SPECIAL_FIELD(WCONPROD) + SPECIAL_FIELD(WELTARG) + SPECIAL_FIELD(WELOPEN) + SPECIAL_FIELD(EQUIL) + SPECIAL_FIELD(PVCDO) + SPECIAL_FIELD(TSTEP) + SPECIAL_FIELD(PLYVISC) + SPECIAL_FIELD(PLYROCK) + SPECIAL_FIELD(PLYADS) + SPECIAL_FIELD(PLYMAX) + SPECIAL_FIELD(TLMIXPAR) + SPECIAL_FIELD(WPOLYMER) + SPECIAL_FIELD(GRUPTREE) + SPECIAL_FIELD(GCONINJE) + SPECIAL_FIELD(GCONPROD) + SPECIAL_FIELD(WGRUPCON) // The following fields only have a dummy implementation // that allows us to ignore them. - SPECIAL_FIELD(SWFN); - SPECIAL_FIELD(SOF2); - SPECIAL_FIELD(TUNING); + SPECIAL_FIELD(SWFN) + SPECIAL_FIELD(SOF2) + SPECIAL_FIELD(TUNING) #undef SPECIAL_FIELD diff --git a/opm/core/simulator/SimulatorTwophase.cpp b/opm/core/simulator/SimulatorTwophase.cpp index 9c1f9023..43913095 100644 --- a/opm/core/simulator/SimulatorTwophase.cpp +++ b/opm/core/simulator/SimulatorTwophase.cpp @@ -89,9 +89,9 @@ namespace Opm const RockCompressibility* rock_comp_; const Wells* wells_; const std::vector& src_; - const FlowBoundaryConditions* bcs_; - const LinearSolverInterface& linsolver_; - const double* gravity_; + //const FlowBoundaryConditions* bcs_; + //const LinearSolverInterface& linsolver_; + //const double* gravity_; // Solvers IncompTpfa psolver_; TransportModelTwophase tsolver_; @@ -207,9 +207,9 @@ namespace Opm rock_comp_(rock_comp), wells_(wells), src_(src), - bcs_(bcs), - linsolver_(linsolver), - gravity_(gravity), + //bcs_(bcs), + //linsolver_(linsolver), + //gravity_(gravity), psolver_(grid, props, rock_comp, linsolver, param.getDefault("nl_pressure_residual_tolerance", 0.0), param.getDefault("nl_pressure_change_tolerance", 1.0), diff --git a/opm/core/simulator/SimulatorTwophase.hpp b/opm/core/simulator/SimulatorTwophase.hpp index 5baa161e..818d40db 100644 --- a/opm/core/simulator/SimulatorTwophase.hpp +++ b/opm/core/simulator/SimulatorTwophase.hpp @@ -36,7 +36,7 @@ namespace Opm class SimulatorTimer; class TwophaseState; class WellState; - class SimulatorReport; + struct SimulatorReport; /// Class collecting all necessary components for a two-phase simulation. class SimulatorTwophase diff --git a/opm/core/utility/Factory.hpp b/opm/core/utility/Factory.hpp index eb73d208..124b5b44 100644 --- a/opm/core/utility/Factory.hpp +++ b/opm/core/utility/Factory.hpp @@ -86,7 +86,7 @@ namespace Opm template static void addCreator(const std::string& type) { - instance().doAddCreator(type); + instance().template doAddCreator(type); } private: diff --git a/opm/core/utility/MonotCubicInterpolator.hpp b/opm/core/utility/MonotCubicInterpolator.hpp index 7e1c6710..fb635ac7 100644 --- a/opm/core/utility/MonotCubicInterpolator.hpp +++ b/opm/core/utility/MonotCubicInterpolator.hpp @@ -73,7 +73,7 @@ class MonotCubicInterpolator { if (!read(datafilename)) { throw("Unable to constuct MonotCubicInterpolator from file.") ; } ; - } ; + } /** @@ -94,7 +94,7 @@ class MonotCubicInterpolator { if (!read(std::string(datafilename))) { throw("Unable to constuct MonotCubicInterpolator from file.") ; } ; - } ; + } /** @@ -110,7 +110,7 @@ class MonotCubicInterpolator { if (!read(std::string(datafilename),xColumn,fColumn)) { throw("Unable to constuct MonotCubicInterpolator from file.") ; } ; - } ; + } /** @param datafilename data file @@ -125,7 +125,7 @@ class MonotCubicInterpolator { if (!read(datafilename,xColumn,fColumn)) { throw("Unable to constuct MonotCubicInterpolator from file.") ; } ; - } ; + } /** @param x vector of x values @@ -144,7 +144,7 @@ class MonotCubicInterpolator { This object must be treated with care until populated. */ - MonotCubicInterpolator() {;} ; + MonotCubicInterpolator() { } @@ -163,7 +163,7 @@ class MonotCubicInterpolator { */ bool read(const std::string & datafilename) { return read(datafilename,1,2) ; - } ; + } /** @param datafilename data file @@ -188,7 +188,7 @@ class MonotCubicInterpolator { @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 @@ -485,7 +485,7 @@ class MonotCubicInterpolator { */ void shrinkFlatAreas() { shrinkFlatAreas(1e-14); - }; + }