Create small class UDQDims with static methods to enable reuse
This commit is contained in:
@@ -313,6 +313,7 @@ if(ENABLE_ECL_OUTPUT)
|
||||
src/opm/output/eclipse/Inplace.cpp
|
||||
src/opm/output/eclipse/Summary.cpp
|
||||
src/opm/output/eclipse/Tables.cpp
|
||||
src/opm/output/eclipse/UDQDims.cpp
|
||||
src/opm/output/eclipse/RegionCache.cpp
|
||||
src/opm/output/eclipse/RestartValue.cpp
|
||||
src/opm/output/eclipse/WriteInit.cpp
|
||||
@@ -890,6 +891,7 @@ if(ENABLE_ECL_OUTPUT)
|
||||
opm/output/eclipse/Inplace.hpp
|
||||
opm/output/eclipse/Summary.hpp
|
||||
opm/output/eclipse/Tables.hpp
|
||||
opm/output/eclipse/UDQDims.hpp
|
||||
opm/output/eclipse/WindowedArray.hpp
|
||||
opm/output/eclipse/WriteInit.hpp
|
||||
opm/output/eclipse/WriteRFT.hpp
|
||||
|
||||
46
opm/output/eclipse/UDQDims.hpp
Normal file
46
opm/output/eclipse/UDQDims.hpp
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
Copyright (c) 2021 Equinor 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/>.
|
||||
*/
|
||||
|
||||
#ifndef OPM_UDQDIMS_HPP
|
||||
#define OPM_UDQDIMS_HPP
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class UDQConfig;
|
||||
|
||||
|
||||
class UDQDims {
|
||||
public:
|
||||
UDQDims(const UDQConfig& config, const std::vector<int>& intehead);
|
||||
const std::vector<int>& data() const;
|
||||
|
||||
static std::size_t entriesPerIUDQ();
|
||||
static std::size_t entriesPerIUAD();
|
||||
static std::size_t entriesPerZUDN();
|
||||
static std::size_t entriesPerZUDL();
|
||||
|
||||
private:
|
||||
std::vector<int> m_data;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -18,69 +18,13 @@
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <opm/output/eclipse/AggregateUDQData.hpp>
|
||||
#include <opm/output/eclipse/WriteRestartHelpers.hpp>
|
||||
#include <opm/output/eclipse/VectorItems/intehead.hpp>
|
||||
|
||||
#include <opm/output/eclipse/InteHEAD.hpp>
|
||||
#include <opm/output/eclipse/DoubHEAD.hpp>
|
||||
|
||||
#include <opm/output/eclipse/UDQDims.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQInput.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQActive.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/output/eclipse/WriteRestartHelpers.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
||||
#include <opm/parser/eclipse/Units/Units.hpp>
|
||||
|
||||
#include <chrono>
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
|
||||
namespace VI = ::Opm::RestartIO::Helpers::VectorItems;
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
std::size_t entriesPerIUDQ()
|
||||
{
|
||||
std::size_t no_entries = 3;
|
||||
return no_entries;
|
||||
}
|
||||
|
||||
std::size_t entriesPerIUAD()
|
||||
{
|
||||
std::size_t no_entries = 5;
|
||||
return no_entries;
|
||||
}
|
||||
|
||||
std::size_t entriesPerZUDN()
|
||||
{
|
||||
std::size_t no_entries = 2;
|
||||
return no_entries;
|
||||
}
|
||||
|
||||
std::size_t entriesPerZUDL()
|
||||
{
|
||||
std::size_t no_entries = 16;
|
||||
return no_entries;
|
||||
}
|
||||
|
||||
std::size_t noIGphs(const std::vector<int>& inteHead)
|
||||
{
|
||||
std::size_t no_entries = (inteHead[VI::intehead::NO_GROUP_UDQS] > 0) ? inteHead[20] : 0;
|
||||
return no_entries;
|
||||
}
|
||||
|
||||
|
||||
} // Anonymous
|
||||
|
||||
// #####################################################################
|
||||
// Public Interface (createUdqDims()) Below Separator
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
std::vector<int>
|
||||
Opm::RestartIO::Helpers::
|
||||
@@ -89,22 +33,6 @@ createUdqDims(const Schedule& sched,
|
||||
const std::vector<int>& inteHead)
|
||||
{
|
||||
const auto& udqCfg = sched.getUDQConfig(lookup_step);
|
||||
std::vector<int> udqDims;
|
||||
udqDims.resize(13,0);
|
||||
|
||||
udqDims[ 0] = udqCfg.size();
|
||||
udqDims[ 1] = entriesPerIUDQ();
|
||||
udqDims[ 2] = inteHead[VI::intehead::NO_IUADS];
|
||||
udqDims[ 3] = entriesPerIUAD();
|
||||
udqDims[ 4] = entriesPerZUDN();
|
||||
udqDims[ 5] = entriesPerZUDL();
|
||||
udqDims[ 6] = noIGphs(inteHead);
|
||||
udqDims[ 7] = inteHead[VI::intehead::NO_IUAPS];
|
||||
udqDims[ 8] = inteHead[VI::intehead::NWMAXZ];
|
||||
udqDims[ 9] = inteHead[VI::intehead::NO_WELL_UDQS];
|
||||
udqDims[10] = inteHead[VI::intehead::NGMAXZ];
|
||||
udqDims[11] = inteHead[VI::intehead::NO_GROUP_UDQS];
|
||||
udqDims[12] = inteHead[VI::intehead::NO_FIELD_UDQS];
|
||||
|
||||
return udqDims;
|
||||
Opm::UDQDims dims(udqCfg, inteHead);
|
||||
return dims.data();
|
||||
}
|
||||
|
||||
76
src/opm/output/eclipse/UDQDims.cpp
Normal file
76
src/opm/output/eclipse/UDQDims.cpp
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
Copyright (c) 2021 Equinor 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 <opm/output/eclipse/UDQDims.hpp>
|
||||
#include <opm/output/eclipse/VectorItems/intehead.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp>
|
||||
|
||||
|
||||
namespace VI = ::Opm::RestartIO::Helpers::VectorItems;
|
||||
|
||||
namespace Opm {
|
||||
|
||||
std::size_t UDQDims::entriesPerIUDQ()
|
||||
{
|
||||
std::size_t no_entries = 3;
|
||||
return no_entries;
|
||||
}
|
||||
|
||||
std::size_t UDQDims::entriesPerIUAD()
|
||||
{
|
||||
std::size_t no_entries = 5;
|
||||
return no_entries;
|
||||
}
|
||||
|
||||
std::size_t UDQDims::entriesPerZUDN()
|
||||
{
|
||||
std::size_t no_entries = 2;
|
||||
return no_entries;
|
||||
}
|
||||
|
||||
std::size_t UDQDims::entriesPerZUDL()
|
||||
{
|
||||
std::size_t no_entries = 16;
|
||||
return no_entries;
|
||||
}
|
||||
|
||||
const std::vector<int>& UDQDims::data() const {
|
||||
return this->m_data;
|
||||
}
|
||||
|
||||
|
||||
UDQDims::UDQDims(const UDQConfig& config, const std::vector<int>& inteHead)
|
||||
{
|
||||
this->m_data.resize(13,0);
|
||||
|
||||
this->m_data[ 0] = config.size();
|
||||
this->m_data[ 1] = entriesPerIUDQ();
|
||||
this->m_data[ 2] = inteHead[VI::intehead::NO_IUADS];
|
||||
this->m_data[ 3] = entriesPerIUAD();
|
||||
this->m_data[ 4] = entriesPerZUDN();
|
||||
this->m_data[ 5] = entriesPerZUDL();
|
||||
this->m_data[ 6] = (inteHead[VI::intehead::NO_GROUP_UDQS] > 0) ? inteHead[20] : 0;
|
||||
this->m_data[ 7] = inteHead[VI::intehead::NO_IUAPS];
|
||||
this->m_data[ 8] = inteHead[VI::intehead::NWMAXZ];
|
||||
this->m_data[ 9] = inteHead[VI::intehead::NO_WELL_UDQS];
|
||||
this->m_data[10] = inteHead[VI::intehead::NGMAXZ];
|
||||
this->m_data[11] = inteHead[VI::intehead::NO_GROUP_UDQS];
|
||||
this->m_data[12] = inteHead[VI::intehead::NO_FIELD_UDQS];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user