Loading...
Searching...
No Matches
GlobalIdMapping.hpp
/*
Copyright 2014 Statoil ASA.
Copyright 2014 Dr. Markus Blatt - HPC-Simulation-Software & Services
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_GLOBALIDMAPPING_HEADER
#define OPM_GLOBALIDMAPPING_HEADER
#include <vector>
namespace Dune
{
namespace cpgrid
{
class GlobalIdMapping
{
public:
void swap(std::vector<int>& cellMapping,
std::vector<int>& faceMapping,
std::vector<int>& pointMapping)
{
cellMapping_.swap(cellMapping);
faceMapping_.swap(faceMapping);
pointMapping_.swap(pointMapping);
}
template<int codim>
std::vector<int>& getMapping()
{
static_assert(codim == 0 || codim == 1 || codim==3,
"Mappings only available for codimension 0, 1, and 3");
if(codim==0)
return cellMapping_;
if(codim==1)
return faceMapping_;
return pointMapping_;
}
template<int codim>
const std::vector<int>& getMapping() const
{
static_assert(codim == 0 || codim == 1 || codim==3,
"Mappings only available for codimension 0, 1, and 3");
if(codim==0)
return cellMapping_;
if(codim==1)
return faceMapping_;
return pointMapping_;
}
protected:
std::vector<int> cellMapping_;
std::vector<int> faceMapping_;
std::vector<int> pointMapping_;
};
}
}
#endif
Dune::cpgrid::GlobalIdMapping
Class managing the mappings of local indices to global ids.
Definition GlobalIdMapping.hpp:31
Dune::cpgrid::GlobalIdMapping::pointMapping_
std::vector< int > pointMapping_
A vector containing the global id of point with index i at position i.
Definition GlobalIdMapping.hpp:79
Dune::cpgrid::GlobalIdMapping::getMapping
std::vector< int > & getMapping()
Get the vector with the mappings for a codimension.
Definition GlobalIdMapping.hpp:49
Dune::cpgrid::GlobalIdMapping::cellMapping_
std::vector< int > cellMapping_
A vector containing the global id of cell with index i at position i.
Definition GlobalIdMapping.hpp:75
Dune::cpgrid::GlobalIdMapping::getMapping
const std::vector< int > & getMapping() const
Get the vector with the mappings for a codimension.
Definition GlobalIdMapping.hpp:63
Dune::cpgrid::GlobalIdMapping::faceMapping_
std::vector< int > faceMapping_
A vector containing the global id of face with index i at position i.
Definition GlobalIdMapping.hpp:77
Dune::cpgrid::GlobalIdMapping::swap
void swap(std::vector< int > &cellMapping, std::vector< int > &faceMapping, std::vector< int > &pointMapping)
Swap data for initialization.
Definition GlobalIdMapping.hpp:38
Dune::cpgrid
Copyright 2019 Equinor AS.
Definition GridPartitioning.cpp:673
Dune
The namespace Dune is the main namespace for all Dune code.
Definition CartesianIndexMapper.hpp:10