diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index daefa3497..b32b8ff9d 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -34,6 +34,7 @@ list (APPEND MAIN_SOURCE_FILES opm/autodiff/NewtonIterationUtilities.cpp opm/autodiff/GridHelpers.cpp opm/autodiff/ImpesTPFAAD.cpp + opm/autodiff/moduleVersion.cpp opm/autodiff/SimulatorFullyImplicitBlackoilOutput.cpp opm/autodiff/SimulatorIncompTwophaseAd.cpp opm/autodiff/TransportSolverTwophaseAd.cpp @@ -118,6 +119,7 @@ list (APPEND PUBLIC_HEADER_FILES opm/autodiff/GeoProps.hpp opm/autodiff/GridHelpers.hpp opm/autodiff/ImpesTPFAAD.hpp + opm/autodiff/moduleVersion.hpp opm/autodiff/NewtonIterationBlackoilCPR.hpp opm/autodiff/NewtonIterationBlackoilInterface.hpp opm/autodiff/NewtonIterationBlackoilInterleaved.hpp diff --git a/dune.module b/dune.module index 62c396563..d64eb3609 100644 --- a/dune.module +++ b/dune.module @@ -1,7 +1,7 @@ Module: opm-autodiff Description: Utilities for automatic differentiation and simulators based on AD -Version: 0.9 -Label: 2013.10 +Version: 2016.04-pre +Label: 2016.04-pre Maintainer: atgeirr@sintef.no -Depends: opm-common opm-core dune-istl (>=2.2) -Suggests: dune-cornerpoint +Depends: opm-common opm-material opm-core dune-cornerpoint dune-istl (>=2.2) +Suggests: diff --git a/examples/flow.cpp b/examples/flow.cpp index 4acfaee69..971014e2e 100644 --- a/examples/flow.cpp +++ b/examples/flow.cpp @@ -80,6 +80,7 @@ #include #include #include +#include #include @@ -141,11 +142,13 @@ try // Write parameters used for later reference. (only if rank is zero) const bool output_cout = ( mpi_rank == 0 ); - if(output_cout) + if (output_cout) { + std::string version = moduleVersionName(); std::cout << "**********************************************************************\n"; std::cout << "* *\n"; - std::cout << "* This is Flow (version 2015.04) *\n"; + std::cout << "* This is Flow (version " << version << ")" + << std::string(26 - version.size(), ' ') << "*\n"; std::cout << "* *\n"; std::cout << "* Flow is a simulator for fully implicit three-phase black-oil flow, *\n"; std::cout << "* and is part of OPM. For more information see: *\n"; diff --git a/examples/flow_solvent.cpp b/examples/flow_solvent.cpp index 528d7b8b6..573372b3a 100644 --- a/examples/flow_solvent.cpp +++ b/examples/flow_solvent.cpp @@ -81,6 +81,7 @@ #include #include #include +#include #include @@ -138,14 +139,16 @@ try // Write parameters used for later reference. (only if rank is zero) const bool output_cout = ( mpi_rank == 0 ); - if(output_cout) + if (output_cout) { + std::string version = moduleVersionName(); std::cout << "**********************************************************************\n"; std::cout << "* *\n"; - std::cout << "* This is Flow-Solvent (version XXXX.XX) *\n"; + std::cout << "* This is Flow-Solvent (version " << version << ")" + << std::string(18 - version.size(), ' ') << "*\n"; std::cout << "* *\n"; std::cout << "* Flow-Solvent is a simulator for fully implicit three-phase, *\n"; - std::cout << "* forth component (black-oil + solvent) flow, and is part of OPM. *\n"; + std::cout << "* four-component (black-oil + solvent) flow, and is part of OPM. *\n"; std::cout << "* For more information see http://opm-project.org *\n"; std::cout << "* *\n"; std::cout << "**********************************************************************\n\n"; diff --git a/opm/autodiff/moduleVersion.cpp b/opm/autodiff/moduleVersion.cpp new file mode 100644 index 000000000..767356b98 --- /dev/null +++ b/opm/autodiff/moduleVersion.cpp @@ -0,0 +1,49 @@ +/* + Copyright 2015 SINTEF ICT, Applied Mathematics. + + This file is part of the Open Porous Media project (OPM). + + OPM is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OPM is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OPM. If not, see . +*/ + +#include +#include "project-version.h" + +namespace Opm +{ + + /// Return the version name of the module, for example "2015.10" + /// (for a release branch) or "2016.04-pre" (for a master branch). + std::string moduleVersionName() + { + return PROJECT_VERSION_NAME; + } + + /// Return a (short) git hash for the current version of the + /// module if this is a Release build (as defined by CMake), or + /// "debug" for Debug builds. + std::string moduleVersionHash() + { + return PROJECT_VERSION_HASH; + } + + /// Return a string containing both the name and hash, if N is the + /// name and H is the hash it will be "N (H)". For example + /// "2016.04-pre (f15be17)" or "2016.04-pre (debug)". + std::string moduleVersion() + { + return PROJECT_VERSION; + } + +} // namespace Opm diff --git a/opm/autodiff/moduleVersion.hpp b/opm/autodiff/moduleVersion.hpp new file mode 100644 index 000000000..5165ac57e --- /dev/null +++ b/opm/autodiff/moduleVersion.hpp @@ -0,0 +1,44 @@ +/* + Copyright 2015 SINTEF ICT, Applied Mathematics. + + This file is part of the Open Porous Media project (OPM). + + OPM is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OPM is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OPM. If not, see . +*/ + +#ifndef OPM_MODULEVERSION_HEADER_INCLUDED +#define OPM_MODULEVERSION_HEADER_INCLUDED + +#include + +namespace Opm +{ + + /// Return the version name of the module, for example "2015.10" + /// (for a release branch) or "2016.04-pre" (for a master branch). + std::string moduleVersionName(); + + /// Return a (short) git hash for the current version of the + /// module if this is a Release build (as defined by CMake), or + /// "debug" for Debug builds. + std::string moduleVersionHash(); + + /// Return a string containing both the name and hash, if N is the + /// name and H is the hash it will be "N (H)". For example + /// "2016.04-pre (f15be17)" or "2016.04-pre (debug)". + std::string moduleVersion(); + +} // namespace Opm + +#endif // OPM_MODULEVERSION_HEADER_INCLUDED