2015-01-28 08:37:07 -06:00
|
|
|
/*
|
|
|
|
Copyright 2015 Dr. Markus Blatt - HPC-Simulation-Software & Services
|
|
|
|
Copyright 2015 NTNU
|
|
|
|
|
|
|
|
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>
|
|
|
|
#include "ExtractParallelGridInformationToISTL.hpp"
|
2019-05-07 06:06:02 -05:00
|
|
|
#include <opm/simulators/linalg/ParallelIstlInformation.hpp>
|
2015-01-28 08:37:07 -06:00
|
|
|
#include <dune/common/version.hh>
|
2015-02-06 03:41:10 -06:00
|
|
|
#include <dune/common/shared_ptr.hh>
|
2015-01-28 08:37:07 -06:00
|
|
|
namespace Opm
|
|
|
|
{
|
2016-04-05 08:17:17 -05:00
|
|
|
#if defined(HAVE_OPM_GRID)
|
2017-10-11 08:53:45 -05:00
|
|
|
#if defined(HAVE_MPI) && defined(HAVE_DUNE_ISTL)
|
2015-01-28 08:37:07 -06:00
|
|
|
// Extracts the information about the data decomposition from the grid for dune-istl
|
2020-02-19 03:14:49 -06:00
|
|
|
void extractParallelGridInformationToISTL(const Dune::CpGrid& grid, std::any& anyComm)
|
2015-01-28 08:37:07 -06:00
|
|
|
{
|
|
|
|
if(grid.comm().size()>1)
|
|
|
|
{
|
|
|
|
// this is a parallel run with distributed data.
|
|
|
|
Dune::CpGrid& mgrid=const_cast<Dune::CpGrid&>(grid);
|
2015-02-06 03:41:10 -06:00
|
|
|
Dune::CpGrid::ParallelIndexSet& idx=mgrid.getCellIndexSet();
|
|
|
|
Dune::CpGrid::RemoteIndices& ridx=mgrid.getCellRemoteIndices();
|
2020-02-19 03:14:49 -06:00
|
|
|
anyComm=std::any(Opm::ParallelISTLInformation(Dune::stackobject_to_shared_ptr(idx),
|
2015-02-06 03:41:10 -06:00
|
|
|
Dune::stackobject_to_shared_ptr(ridx),
|
2015-01-28 08:37:07 -06:00
|
|
|
grid.comm()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
// Missing support for MPI or dune-istl -> do nothing.
|
2020-02-19 03:14:49 -06:00
|
|
|
void extractParallelGridInformationToISTL(const Dune::CpGrid&, std::any&)
|
2015-01-28 08:37:07 -06:00
|
|
|
{}
|
2017-10-11 08:53:45 -05:00
|
|
|
#endif //defined(HAVE_MPI) && defined(HAVE_DUNE_ISTL)
|
2016-04-05 08:17:17 -05:00
|
|
|
#endif //defined(HAVE_OPM_GRID)
|
2015-01-28 08:37:07 -06:00
|
|
|
} // end namespace Opm
|