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
53 std::vector<MeshLib::MeshSubset> const& bulk_mesh_subsets,
54 MeshLib::MeshSubset const& new_mesh_subset,
55 std::vector<int> const& new_global_component_ids) const;
56
58 std::size_t dofSizeWithGhosts() const { return _dict.size(); }
59
67 std::vector<int> getComponentIDs(const Location& l) const;
68
74 GlobalIndexType getGlobalIndex(Location const& l, int const comp_id) const;
75
86 std::vector<GlobalIndexType> getGlobalIndices(const Location& l) const;
87
101 std::vector<GlobalIndexType> getGlobalIndicesByLocation(
102 const std::vector<Location>& ls) const;
103
116 std::vector<GlobalIndexType> getGlobalIndicesByComponent(
117 const std::vector<Location>& ls) const;
118
121 std::size_t dofSizeWithoutGhosts() const { return _num_local_dof; }
122
124 std::vector<GlobalIndexType> const& getGhostIndices() const
125 {
126 return _ghosts_indices;
127 }
128
134 GlobalIndexType getLocalIndex(Location const& l, int const comp_id,
135 std::size_t const range_begin,
136 std::size_t const range_end) const;
137
140 static constexpr NUMLIB_EXPORT GlobalIndexType const nop =
141 std::numeric_limits<GlobalIndexType>::max();
142
143#ifndef NDEBUG
145 {
146 return _dict;
147 }
148
149 friend std::ostream& operator<<(std::ostream& os, MeshComponentMap const& m)
150 {
151 os << "Dictionary size: " << m._dict.size() << "\n";
152 for (auto l : m._dict)
153 os << l << "\n";
154 return os;
155 }
156#endif // NDEBUG
157
158private:
161 : _dict(dict)
162 {
163 }
164
165 void renumberByLocation(GlobalIndexType offset = 0);
166
168
171 std::size_t _num_local_dof = 0;
172
173#ifdef USE_PETSC
175 std::size_t _num_global_dof = 0;
176#endif
177
179 std::vector<GlobalIndexType> _ghosts_indices;
180
184 std::vector<MeshLib::MeshSubset> const& components,
185 ComponentOrder order);
186
187#ifdef USE_PETSC
191 std::vector<MeshLib::MeshSubset> const& components,
192 ComponentOrder order);
193#endif
194};
195
196} // 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
detail::ComponentGlobalIndexDict _dict
std::vector< GlobalIndexType > getGlobalIndices(const Location &l) const
MeshComponentMap getSubset(std::vector< MeshLib::MeshSubset > const &bulk_mesh_subsets, MeshLib::MeshSubset const &new_mesh_subset, std::vector< int > const &new_global_component_ids) 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