23#ifndef VULPES_GEOMETRY_AGGLOMERATION_KMEANS_AGGLOMERATION_HPP_
24#define VULPES_GEOMETRY_AGGLOMERATION_KMEANS_AGGLOMERATION_HPP_
56template <
typename MeshType>
70 Eigen::Matrix<ClassFloatType, MeshType::self_dim, Eigen::Dynamic>;
87 size_t max_iter = 1e6,
111 const MeshType& mesh,
114 bool return_hierarchy =
true,
115 const std::string& segregated_tag =
"",
116 const IndVec& subset = {})
override;
132 const MeshType& mesh,
133 std::size_t n_groups,
155 const MeshType& mesh, std::size_t n_groups,
const IndVec& subgraph);
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
Agglomeration model that clusters cell barycenters with K-Means.
Definition kmeans_agglomeration.hpp:57
MatType m_barycenters_mat
Cached barycenter matrix used in the current call.
Definition kmeans_agglomeration.hpp:158
float_t m_tol
Convergence tolerance on centroids.
Definition kmeans_agglomeration.hpp:164
Cell< MeshType::self_dim, MeshFloatType, MeshIndexType > CellType
Definition kmeans_agglomeration.hpp:66
typename MeshType::float_t MeshFloatType
Definition kmeans_agglomeration.hpp:63
typename AbstractAgglomerationModel< MeshType >::IndVec IndVec
Definition kmeans_agglomeration.hpp:68
typename MeshType::index_t MeshIndexType
Definition kmeans_agglomeration.hpp:64
static constexpr ClassIndexType dim
Definition kmeans_agglomeration.hpp:76
IndVec splitSubsetKWay(const MeshType &mesh, std::size_t n_groups, const IndVec &subgraph)
Definition kmeans_agglomeration.cpp:89
typename AbstractAgglomerationModel< MeshType >::ParamType ParamType
Definition kmeans_agglomeration.hpp:74
size_t m_seed
Random seed for initialization.
Definition kmeans_agglomeration.hpp:166
IndVec bisectSubGraph(const MeshType &mesh, const IndVec &subgraph) override
Bisect a subgraph by clustering barycenters with 2-means.
Definition kmeans_agglomeration.cpp:82
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 a mesh using a selected high-level strategy.
Definition kmeans_agglomeration.cpp:38
Eigen::Matrix< ClassFloatType, MeshType::self_dim, Eigen::Dynamic > MatType
Definition kmeans_agglomeration.hpp:69
void directKWay(const MeshType &mesh, std::size_t n_groups, IndexTrackerType &indicator, const std::vector< bool > &agglomerate) override
Direct k-way partition via K-Means on barycenters.
Definition kmeans_agglomeration.cpp:104
typename AbstractAgglomerationModel< MeshType >::IndexTrackerType IndexTrackerType
Definition kmeans_agglomeration.hpp:71
typename AbstractAgglomerationModel< MeshType >::float_t ClassFloatType
Definition kmeans_agglomeration.hpp:59
typename AbstractAgglomerationModel< MeshType >::MapType MapType
Definition kmeans_agglomeration.hpp:61
KMeansAlgType m_alg_t
Selected K-Means algorithm family.
Definition kmeans_agglomeration.hpp:160
KMeansAgglomeration(KMeansAlgType alg_t=KMeansAlgType::Base, size_t max_iter=1e6, ClassFloatType tol=1e-6, size_t seed=0)
Construct a K-Means agglomerator.
Definition kmeans_agglomeration.hpp:85
size_t m_max_iter
Maximum number of iterations.
Definition kmeans_agglomeration.hpp:162
typename AbstractAgglomerationModel< MeshType >::index_t ClassIndexType
Definition kmeans_agglomeration.hpp:60
Definition abs_agg_model.cpp:40
@ Base
Definition gnn_agglomeration.hpp:63
KMeansAlgType
K-Means algorithm types.
Definition kmeans_agglomeration.hpp:44
@ Base
Definition kmeans_agglomeration.hpp:44
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