OGS
MeshComponentMap.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
8#include "numlib_export.h"
9
10namespace NumLib
11{
18
21{
22public:
24
25public:
28 MeshComponentMap(std::vector<MeshLib::MeshSubset> const& components,
29 ComponentOrder order);
30
42 std::vector<MeshLib::MeshSubset> const& bulk_mesh_subsets,
43 MeshLib::MeshSubset const& new_mesh_subset) const;
44
46 std::size_t dofSizeWithGhosts() const { return _dict.size(); }
47
55 std::vector<int> getComponentIDs(const Location& l) const;
56
62 GlobalIndexType getGlobalIndex(Location const& l, int const comp_id) const;
63
74 std::vector<GlobalIndexType> getGlobalIndices(const Location& l) const;
75
89 std::vector<GlobalIndexType> getGlobalIndicesByLocation(
90 const std::vector<Location>& ls) const;
91
104 std::vector<GlobalIndexType> getGlobalIndicesByComponent(
105 const std::vector<Location>& ls) const;
106
109 std::size_t dofSizeWithoutGhosts() const { return _num_local_dof; }
110
112 std::vector<GlobalIndexType> const& getGhostIndices() const
113 {
114 return _ghosts_indices;
115 }
116
122 GlobalIndexType getLocalIndex(Location const& l, int const comp_id,
123 std::size_t const range_begin,
124 std::size_t const range_end) const;
125
128 static constexpr NUMLIB_EXPORT GlobalIndexType const nop =
129 std::numeric_limits<GlobalIndexType>::max();
130
131#ifndef NDEBUG
133 {
134 return _dict;
135 }
136
137 friend std::ostream& operator<<(std::ostream& os, MeshComponentMap const& m)
138 {
139 os << "Dictionary size: " << m._dict.size() << "\n";
140 for (auto l : m._dict)
141 os << l << "\n";
142 return os;
143 }
144#endif // NDEBUG
145
146private:
149 : _dict(dict)
150 {
151 }
152
153 void renumberByLocation(GlobalIndexType offset = 0);
154
156
159 std::size_t _num_local_dof = 0;
160
161#ifdef USE_PETSC
163 std::size_t _num_global_dof = 0;
164#endif
165
167 std::vector<GlobalIndexType> _ghosts_indices;
168
172 std::vector<MeshLib::MeshSubset> const& components,
173 ComponentOrder order);
174
175#ifdef USE_PETSC
179 std::vector<MeshLib::MeshSubset> const& components,
180 ComponentOrder order);
181#endif
182};
183
184} // namespace NumLib
GlobalMatrix::IndexType GlobalIndexType
A subset of nodes on a single mesh.
Definition MeshSubset.h:17
std::size_t dofSizeWithoutGhosts() const
void createParallelMeshComponentMap(std::vector< MeshLib::MeshSubset > const &components, ComponentOrder order)
std::vector< int > getComponentIDs(const Location &l) const
MeshLib::Location Location
std::size_t _num_global_dof
Number of global unknowns. Used internally only.
MeshComponentMap(std::vector< MeshLib::MeshSubset > const &components, ComponentOrder order)
friend std::ostream & operator<<(std::ostream &os, MeshComponentMap const &m)
GlobalIndexType getGlobalIndex(Location const &l, int const comp_id) const
GlobalIndexType getLocalIndex(Location const &l, int const comp_id, std::size_t const range_begin, std::size_t const range_end) const
static constexpr NUMLIB_EXPORT GlobalIndexType const nop
MeshComponentMap getSubset(std::vector< MeshLib::MeshSubset > const &bulk_mesh_subsets, MeshLib::MeshSubset const &new_mesh_subset) const
detail::ComponentGlobalIndexDict _dict
std::vector< GlobalIndexType > getGlobalIndices(const Location &l) const
MeshComponentMap(detail::ComponentGlobalIndexDict &dict)
Private constructor used by internally created mesh component maps.
void renumberByLocation(GlobalIndexType offset=0)
std::size_t dofSizeWithGhosts() const
The number of dofs including the those located in the ghost nodes.
std::vector< GlobalIndexType > _ghosts_indices
Global ID for ghost entries.
std::vector< GlobalIndexType > getGlobalIndicesByComponent(const std::vector< Location > &ls) const
void createSerialMeshComponentMap(std::vector< MeshLib::MeshSubset > const &components, ComponentOrder order)
std::vector< GlobalIndexType > const & getGhostIndices() const
Get ghost indices (for DDC).
const detail::ComponentGlobalIndexDict & getDictionary() const
std::vector< GlobalIndexType > getGlobalIndicesByLocation(const std::vector< Location > &ls) const
boost::multi_index::multi_index_container< Line, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag< ByLocationAndComponent >, boost::multi_index::identity< Line >, LineByLocationAndComponentComparator >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< ByLocation >, boost::multi_index::identity< Line >, LineByLocationComparator >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< ByComponent >, boost::multi_index::member< Line, int, &Line::comp_id > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< ByGlobalIndex >, boost::multi_index::member< Line, GlobalIndexType, &Line::global_index > > > > ComponentGlobalIndexDict
ComponentOrder
Ordering of components in global matrix/vector.
@ BY_LOCATION
Ordering data by spatial location.
@ BY_COMPONENT
Ordering data by component type.
#define NUMLIB_EXPORT