-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpartitioning.h
More file actions
47 lines (43 loc) · 1.71 KB
/
partitioning.h
File metadata and controls
47 lines (43 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef FUNTIDES_MODEL_MESH_API_INCLUDE_PARTITIONING_H_
#define FUNTIDES_MODEL_MESH_API_INCLUDE_PARTITIONING_H_
#include "cartesian_params.h"
namespace model
{
/** @brief Interface for domain decomposition strategy.
* Responsible for determining local mesh parameters from global ones.
* Different partitioning strategies (1D X-decomposition, 2D XY-decomposition,
* METIS-based, etc.) can be implemented by subclassing this interface.
*
* @tparam GlobalParams Type describing the global problem (e.g.,
* CartesianParams, or a filename string)
* @tparam LocalParams Type describing the local partition (e.g.,
* CartesianParams, or a list of element IDs)
*/
template <typename GlobalParams, typename LocalParams = GlobalParams>
class PartitioningStrategy
{
public:
virtual ~PartitioningStrategy() = default;
/** @brief Partition global domain into local subdomain for given rank.
*
* Takes global mesh parameters and computes the local parameters for
* the given rank. This includes:
* - Number of elements in local domain
* - Physical size of local domain
* - Global origin of local domain (for coordinate mapping)
*
* @param[in] globalParams Description of the global domain/mesh
* @param[in] rank Current MPI rank (0-based)
* @param[in] numRanks Total number of ranks
*
* @return CartesianParams containing local mesh parameters with correct
* origin, element count, and dimensions
*
* @throws std::invalid_argument if rank or
* numRanks are invalid
*/
virtual LocalParams partition(const GlobalParams& globalParams, int rank,
int numRanks) const = 0;
};
} // namespace model
#endif // FUNTIDES_MODEL_MESH_API_INCLUDE_PARTITIONING_H_