2015-12-01 20:59:13 -06:00
|
|
|
/*
|
|
|
|
Copyright 2015 Statoil ASA.
|
|
|
|
|
|
|
|
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 <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
/* --- Boost.Test boilerplate --- */
|
|
|
|
#if HAVE_DYNAMIC_BOOST_TEST
|
|
|
|
#define BOOST_TEST_DYN_LINK
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define NVERBOSE // Suppress own messages when throw()ing
|
|
|
|
|
|
|
|
#define BOOST_TEST_MODULE RelpermDiagnostics
|
2015-12-14 08:25:27 -06:00
|
|
|
|
|
|
|
|
|
|
|
#include <opm/common/utility/platform_dependent/disable_warnings.h>
|
2015-12-01 20:59:13 -06:00
|
|
|
#include <boost/test/unit_test.hpp>
|
|
|
|
#include <boost/test/floating_point_comparison.hpp>
|
2015-12-14 08:25:27 -06:00
|
|
|
#include <opm/common/utility/platform_dependent/reenable_warnings.h>
|
2016-03-31 21:49:27 -05:00
|
|
|
#include <opm/common/OpmLog/OpmLog.hpp>
|
2016-05-18 20:47:57 -05:00
|
|
|
#include <opm/common/OpmLog/CounterLog.hpp>
|
2015-12-01 20:59:13 -06:00
|
|
|
|
|
|
|
#include <opm/core/grid.h>
|
|
|
|
#include <opm/core/grid/cart_grid.h>
|
|
|
|
#include <opm/core/grid/GridManager.hpp>
|
|
|
|
|
|
|
|
#include <opm/core/props/satfunc/RelpermDiagnostics.hpp>
|
|
|
|
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
2016-03-16 20:57:59 -05:00
|
|
|
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
2015-12-01 20:59:13 -06:00
|
|
|
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
|
|
|
|
|
|
|
BOOST_AUTO_TEST_SUITE ()
|
|
|
|
|
|
|
|
BOOST_AUTO_TEST_CASE(diagnosis)
|
|
|
|
{
|
|
|
|
using namespace Opm;
|
|
|
|
EclipseStateConstPtr eclState;
|
|
|
|
ParserPtr parser(new Opm::Parser);
|
2016-03-16 20:57:59 -05:00
|
|
|
Opm::ParseContext parseContext({{ ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE },
|
|
|
|
{ ParseContext::PARSE_UNKNOWN_KEYWORD, InputError::IGNORE},
|
|
|
|
{ ParseContext::PARSE_RANDOM_TEXT, InputError::IGNORE}
|
2015-12-01 20:59:13 -06:00
|
|
|
});
|
2016-03-16 20:57:59 -05:00
|
|
|
Opm::DeckConstPtr deck(parser->parseFile("../tests/relpermDiagnostics.DATA", parseContext));
|
2016-08-08 03:02:53 -05:00
|
|
|
eclState.reset(new EclipseState(*deck, parseContext));
|
2016-08-31 03:02:24 -05:00
|
|
|
GridManager gm(*eclState->getInputGrid());
|
2015-12-01 20:59:13 -06:00
|
|
|
const UnstructuredGrid& grid = *gm.c_grid();
|
2016-05-18 20:47:57 -05:00
|
|
|
std::shared_ptr<CounterLog> counterLog = std::make_shared<CounterLog>(Log::DefaultMessageTypes);
|
|
|
|
OpmLog::addBackend( "COUNTERLOG" , counterLog );
|
2016-03-31 21:49:27 -05:00
|
|
|
RelpermDiagnostics diagnostics;
|
2015-12-01 20:59:13 -06:00
|
|
|
diagnostics.diagnosis(eclState, deck, grid);
|
2016-05-18 20:47:57 -05:00
|
|
|
BOOST_CHECK_EQUAL(1, counterLog->numMessages(Log::MessageType::Warning));
|
2015-12-01 20:59:13 -06:00
|
|
|
}
|
|
|
|
BOOST_AUTO_TEST_SUITE_END()
|