Vulpes  0.1.0
Versatile and parallel compUtational Library for high-order discontinuous Polytopal Element Simulations
Loading...
Searching...
No Matches
parmetis_agglomeration.hpp
Go to the documentation of this file.
1// ----------------------------------------------------------------------
2//
3// Copyright (C) 2024 - 2025 by the Vulpes authors.
4// This file is part of Vulpes.
5//
6// Vulpes is free software; you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation, either version 3 of the License, or
9// (at your option) any later version.
10//
11// Vulpes is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// General Public License for more details.
15//
16// You should have received a copy of the GNU General Public License
17// along with Vulpes. If not, see <http://www.gnu.org/licenses/>.
18//
19// ----------------------------------------------------------------------
20
21// Author: Matteo Caldana <matteo.caldana@polimi.it>
22
23#ifndef VULPES_GEOMETRY_AGGLOMERATION_PARMETIS_AGGLOMERATION_HPP_
24#define VULPES_GEOMETRY_AGGLOMERATION_PARMETIS_AGGLOMERATION_HPP_
25
26#include <parmetis.h>
27
28#include <stdexcept>
29#include <string>
30#include <vector>
31
38
39namespace vulpes {
40namespace geometry {
60template <typename MeshType>
62 public:
66
67 using MeshFloatType = typename MeshType::float_t;
68 using MeshIndexType = typename MeshType::index_t;
69
74
76
77 static constexpr ClassIndexType dim = MeshType::self_dim;
78
100 std::vector<MeshType> agglomerate(
101 const MeshType& mesh,
102 MethodType method_type,
103 ParamType params,
104 bool return_hierarchy = true,
105 const std::string& segregated_tag = "",
106 const IndVec& subset = {}) override;
107
108 private:
129 void directKWay(
130 const MeshType& mesh,
131 std::size_t n_groups,
132 IndexTrackerType& indicator,
133 const std::vector<bool>& agglomerate) override;
134
150 IndVec bisectSubGraph(const MeshType& mesh, const IndVec& subgraph) override;
151
153 const MeshType& mesh, std::size_t n_groups, const IndVec& subgraph);
154};
155
156extern template class ParmetisAgglomeration<Mesh2D<double, int32_t>>;
157extern template class ParmetisAgglomeration<Mesh3D<double, int32_t>>;
158
159} // namespace geometry
160} // namespace vulpes
161
162#endif // VULPES_GEOMETRY_AGGLOMERATION_PARMETIS_AGGLOMERATION_HPP_
Defines an abstract interface for mesh agglomeration strategies.
Definition abs_agg_model.hpp:71
double float_t
Definition abs_agg_model.hpp:73
datastructure::IndexTracker< index_t > IndexTrackerType
Definition abs_agg_model.hpp:78
datastructure::CrsMap< index_t, index_t > MapType
Definition abs_agg_model.hpp:76
std::variant< index_t, float_t > ParamType
Definition abs_agg_model.hpp:77
std::vector< index_t > IndVec
Definition abs_agg_model.hpp:75
int64_t index_t
Definition abs_agg_model.hpp:74
IndVec splitSubsetKWay(const MeshType &mesh, std::size_t n_groups, const IndVec &subgraph)
Definition parmetis_agglomeration.cpp:37
typename MeshType::float_t MeshFloatType
Definition parmetis_agglomeration.hpp:67
typename AbstractAgglomerationModel< MeshType >::IndVec IndVec
Definition parmetis_agglomeration.hpp:71
std::vector< MeshType > agglomerate(const MeshType &mesh, MethodType method_type, ParamType params, bool return_hierarchy=true, const std::string &segregated_tag="", const IndVec &subset={}) override
Agglomerate using a selected strategy with ParMETIS as backend.
Definition parmetis_agglomeration.cpp:126
typename AbstractAgglomerationModel< MeshType >::float_t ClassFloatType
Definition parmetis_agglomeration.hpp:63
Cell< MeshType::self_dim, MeshFloatType, MeshIndexType > CellType
Definition parmetis_agglomeration.hpp:70
typename MeshType::index_t MeshIndexType
Definition parmetis_agglomeration.hpp:68
static constexpr ClassIndexType dim
Definition parmetis_agglomeration.hpp:77
typename AbstractAgglomerationModel< MeshType >::MapType MapType
Definition parmetis_agglomeration.hpp:65
typename AbstractAgglomerationModel< MeshType >::IndexTrackerType IndexTrackerType
Definition parmetis_agglomeration.hpp:72
IndVec bisectSubGraph(const MeshType &mesh, const IndVec &subgraph) override
2-way split of subset using ParMETIS, then enforce bisection labels.
Definition parmetis_agglomeration.cpp:120
typename AbstractAgglomerationModel< MeshType >::ParamType ParamType
Definition parmetis_agglomeration.hpp:75
void directKWay(const MeshType &mesh, std::size_t n_groups, IndexTrackerType &indicator, const std::vector< bool > &agglomerate) override
Direct k-way partition via ParMETIS on the (sub)dual graph.
Definition parmetis_agglomeration.cpp:156
typename AbstractAgglomerationModel< MeshType >::index_t ClassIndexType
Definition parmetis_agglomeration.hpp:64
Definition abs_agg_model.cpp:40
MethodType
Definition abs_agg_model.hpp:41
std::conditional_t< Dim==2, Cell2D< FloatType, IndexType >, Cell3D< FloatType, IndexType > > Cell
Definition cell.hpp:267
Definition cell_manager.hpp:38