![]() |
Vulpes
0.1.0
Versatile and parallel compUtational Library for high-order discontinuous Polytopal Element Simulations
|
Agglomeration model that delegates partitioning to ParMETIS. More...
#include <parmetis_agglomeration.hpp>
Public Types | |
| using | ClassFloatType = typename AbstractAgglomerationModel<MeshType>::float_t |
| using | ClassIndexType = typename AbstractAgglomerationModel<MeshType>::index_t |
| using | MapType = typename AbstractAgglomerationModel<MeshType>::MapType |
| using | MeshFloatType = typename MeshType::float_t |
| using | MeshIndexType = typename MeshType::index_t |
| using | CellType = Cell<MeshType::self_dim, MeshFloatType, MeshIndexType> |
| using | IndVec = typename AbstractAgglomerationModel<MeshType>::IndVec |
| using | IndexTrackerType |
| using | ParamType = typename AbstractAgglomerationModel<MeshType>::ParamType |
| using | float_t = double |
| using | index_t = int64_t |
Public Member Functions | |
| ParmetisAgglomeration ()=default | |
| 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. | |
| std::vector< IndVec > | multFactor (const MeshType &mesh, const float_t target_h, IndexTrackerType &indicator, const std::vector< bool > &agglomerate) |
| Partitions the mesh based on a multiplicative factor strategy. | |
| std::vector< IndVec > | bisectNRef (const MeshType &mesh, const index_t n_refs, IndexTrackerType &indicator, const std::vector< bool > &agglomerate) |
| Applies recursive bisection n_refs times. | |
Static Public Attributes | |
| static constexpr ClassIndexType | dim = MeshType::self_dim |
Protected Member Functions | |
| std::vector< IndVec > | invokeMethod (const MeshType &mesh, MethodType method_type, ParamType params, const std::string &segregation_tag, const IndVec &subset) |
| Dispatches to the correct agglomeration method to compute cell labels. | |
| void | connectedComponents (const IndVec &subset, IndexTrackerType &indicator, index_t &max_id) |
| Splits a set of cells into its connected components. | |
| void | groupToBisection (const IndVec &subset, const IndVec &classes, IndexTrackerType &indicator, index_t new_id) |
| Post-processes a binary labeling to ensure two connected partitions. | |
Protected Attributes | |
| MapType | m_dual_map |
| The dual graph of the mesh, cached for performance. | |
Private Member Functions | |
| 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. | |
| IndVec | bisectSubGraph (const MeshType &mesh, const IndVec &subgraph) override |
2-way split of subset using ParMETIS, then enforce bisection labels. | |
| IndVec | splitSubsetKWay (const MeshType &mesh, std::size_t n_groups, const IndVec &subgraph) |
Agglomeration model that delegates partitioning to ParMETIS.
Builds/uses the dual graph of the input mesh and calls ParMETIS to obtain a partition. Implements the low-level split primitive bisectSubGraph() via 2-way graph partitioning and the direct directKWay() routine via k-way partitioning. High-level strategies (BisectNRef, MultFactor, etc.) are inherited from AbstractAgglomerationModel.
| MeshType | Concrete mesh type exposing: |
| using vulpes::geometry::ParmetisAgglomeration< MeshType >::CellType = Cell<MeshType::self_dim, MeshFloatType, MeshIndexType> |
| using vulpes::geometry::ParmetisAgglomeration< MeshType >::ClassFloatType = typename AbstractAgglomerationModel<MeshType>::float_t |
| using vulpes::geometry::ParmetisAgglomeration< MeshType >::ClassIndexType = typename AbstractAgglomerationModel<MeshType>::index_t |
|
inherited |
|
inherited |
| using vulpes::geometry::ParmetisAgglomeration< MeshType >::IndexTrackerType |
| using vulpes::geometry::ParmetisAgglomeration< MeshType >::IndVec = typename AbstractAgglomerationModel<MeshType>::IndVec |
| using vulpes::geometry::ParmetisAgglomeration< MeshType >::MapType = typename AbstractAgglomerationModel<MeshType>::MapType |
| using vulpes::geometry::ParmetisAgglomeration< MeshType >::MeshFloatType = typename MeshType::float_t |
| using vulpes::geometry::ParmetisAgglomeration< MeshType >::MeshIndexType = typename MeshType::index_t |
| using vulpes::geometry::ParmetisAgglomeration< MeshType >::ParamType = typename AbstractAgglomerationModel<MeshType>::ParamType |
|
default |
|
overridevirtual |
Agglomerate using a selected strategy with ParMETIS as backend.
Sets backend policy (connectivity post-process for DirectKWay), prepares the dual graph, computes labels via the base dispatcher, removes empty sets, and returns the agglomerated mesh.
| mesh | Input mesh. |
| method_type | Strategy to apply (see MethodType). |
| params | Strategy parameter (k, n_refs, or mult_fact). |
| return_hierarchy | If true, returns all intermediate meshes from recursive strategies. If false, returns only the final agglomerated mesh. |
| segregated_tag | If non-empty, specifies the mesh tag for segregated agglomeration, where each tagged region is processed independently. |
| subset | Optional list of cell IDs to agglomerate. If empty, the entire mesh is processed. |
Implements vulpes::geometry::AbstractAgglomerationModel< MeshType >.
|
inherited |
Applies recursive bisection n_refs times.
This method takes an initial partitioning and refines it by applying the bisectSubGraph() primitive recursively for n_refs levels. Each step splits a partition into two. The base cases are finalized by ensuring connectivity via connectedComponents().
| mesh | The input mesh. | |
| n_refs | The number of recursive bisection levels to apply ( \(n_{refs} \ge 0\)). | |
| [in,out] | indicator | The label tracker, which is updated with the results. |
| agglomerate | A boolean vector indicating which initial classes in indicator are eligible for bisection. |
|
overrideprivatevirtual |
2-way split of subset using ParMETIS, then enforce bisection labels.
Calls directKWay() with k=2 on subset and converts the binary labels into a proper bisection by assigning one side to new_id and the other side to the existing id via groupToBisection().
| mesh | The input mesh. |
| subgraph | A vector of cell IDs to be split. |
Implements vulpes::geometry::AbstractAgglomerationModel< MeshType >.
|
protectedinherited |
Splits a set of cells into its connected components.
This function examines the dual graph restricted to the cells in subset. If the subgraph is disconnected, each connected component is assigned a new, unique label. This is often used as a finalization step in recursive strategies.
| subset | The set of cell IDs to process. | |
| [in,out] | indicator | The global label tracker, which will be updated. |
| [in,out] | max_id | The last used label ID; it is incremented for each new component found. |
|
overrideprivatevirtual |
Direct k-way partition via ParMETIS on the (sub)dual graph.
Splits the mesh dual graph into k parts using ParMETIS_V3_PartKway. If subset is non-empty, builds and partitions the induced subgraph; otherwise partitions the whole dual graph stored in m_dual_map.
| mesh | The input mesh. | |
| n_groups | The target number of partitions. | |
| [in,out] | indicator | The label tracker. It can be pre-filled to provide a warm start. It will be updated with the final labels. |
| agglomerate | A boolean vector where the i-th element indicates if the i-th class in the initial indicator should be re-partitioned. |
m_compute_connected is true, connected-components are enforced inside each part after ParMETIS, possibly increasing the number of labels. Implements vulpes::geometry::AbstractAgglomerationModel< MeshType >.
|
protectedinherited |
Post-processes a binary labeling to ensure two connected partitions.
Given a provisional two-class labeling for a subset of cells, this method refines the labels to ensure that the resulting two partitions are each internally connected. It can relabel "islands" of cells to join the surrounding partition.
| subset | The set of cell IDs under consideration. | |
| classes | A vector of provisional binary labels for the cells in subset. | |
| [in,out] | indicator | The global label tracker to update with the final bisection. |
| new_id | The fresh label ID to be assigned to one of the two final partitions. |
|
protectedinherited |
Dispatches to the correct agglomeration method to compute cell labels.
This is a wrapper function typically used by agglomerate(). It selects the appropriate backend method based on method_type and restricts the computation to subset if it is non-empty.
| mesh | The input mesh. |
| method_type | The strategy to apply. |
| params | The parameters for the chosen strategy. |
| segregation_tag | If non-empty, the mesh tag to use for segregated processing. |
| subset | An optional subset of cell IDs to operate on. |
|
inherited |
Partitions the mesh based on a multiplicative factor strategy.
This method recursively bisects any group whose vertex-vertex diameter exceeds the target_h. After geometric splitting, each resulting group is finalized by splitting it into its connected components. It uses bisectSubGraph() as the core splitting primitive.
| mesh | The input mesh. | |
| target_h | The target characteristic length. Any group with a diameter larger than this will be split. | |
| [in,out] | indicator | The label tracker, which is updated with the results. |
| agglomerate | A boolean vector indicating which initial classes in indicator are eligible for splitting. |
|
private |
|
staticconstexpr |
|
protectedinherited |
The dual graph of the mesh, cached for performance.