OGS
MeshComponentMap.h
Go to the documentation of this file.
1
13#pragma once
14
16#include "MeshLib/MeshSubset.h"
17#include "numlib_export.h"
18
19namespace NumLib
20{
23{
26};
27
30{
31public:
33
34public:
37 MeshComponentMap(std::vector<MeshLib::MeshSubset> const& components,
38 ComponentOrder order);
39
51 std::vector<MeshLib::MeshSubset> const& bulk_mesh_subsets,
52 MeshLib::MeshSubset const& new_mesh_subset) const;
53
55 std::size_t dofSizeWithGhosts() const { return _dict.size(); }
56
64 std::vector<int> getComponentIDs(const Location& l) const;
65
71 GlobalIndexType getGlobalIndex(Location const& l, int const comp_id) const;
72
83 std::vector<GlobalIndexType> getGlobalIndices(const Location& l) const;
84
98 std::vector<GlobalIndexType> getGlobalIndicesByLocation(
99 const std::vector<Location>& ls) const;
100
113 std::vector<GlobalIndexType> getGlobalIndicesByComponent(
114 const std::vector<Location>& ls) const;
115
118 std::size_t dofSizeWithoutGhosts() const { return _num_local_dof; }
119
121 std::vector<GlobalIndexType> const& getGhostIndices() const
122 {
123 return _ghosts_indices;
124 }
125
131 GlobalIndexType getLocalIndex(Location const& l, int const comp_id,
132 std::size_t const range_begin,
133 std::size_t const range_end) const;
134
137 static constexpr NUMLIB_EXPORT GlobalIndexType const nop =
138 std::numeric_limits<GlobalIndexType>::max();
139
140#ifndef NDEBUG
142 {
143 return _dict;
144 }
145
146 friend std::ostream& operator<<(std::ostream& os, MeshComponentMap const& m)
147 {
148 os << "Dictionary size: " << m._dict.size() << "\n";
149 for (auto l : m._dict)
150 os << l << "\n";
151 return os;
152 }
153#endif // NDEBUG
154
155private:
158 : _dict(dict)
159 {
160 }
161
162 void renumberByLocation(GlobalIndexType offset = 0);
163
165
168 std::size_t _num_local_dof = 0;
169
170#ifdef USE_PETSC
172 std::size_t _num_global_dof = 0;
173#endif
174
176 std::vector<GlobalIndexType> _ghosts_indices;
177
181 std::vector<MeshLib::MeshSubset> const& components,
182 ComponentOrder order);
183
184#ifdef USE_PETSC
188 std::vector<MeshLib::MeshSubset> const& components,
189 ComponentOrder order);
190#endif
191};
192
193} // namespace NumLib
GlobalMatrix::IndexType GlobalIndexType
A subset of nodes on a single mesh.
Definition MeshSubset.h:26
Multidirectional mapping between mesh entities and degrees of freedom.
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