Flow123d  jenkins-Flow123d-windows32-release-multijob-51
partitioning.hh
Go to the documentation of this file.
1 /*
2  * partition.hh
3  *
4  * Created on: May 3, 2013
5  * Author: jb
6  */
7 
8 #ifndef PARTITIONING_HH_
9 #define PARTITIONING_HH_
10 
11 #include "input/input_type.hh"
12 #include "input/accessors.hh"
13 
14 class Mesh;
15 class SparseGraph;
16 class Distribution;
17 
18 /**
19  * @brief Class for the mesh partitioning.
20  * This should provide:
21  * - construction of cenectivity graph from the mesh
22  * - call a partitioner
23  * - provide new element numbering and new element distribution
24  * (global numbers for the local part - at least for ghost part)
25  * (+ old indices of elements for the local part of the mesh - in order to do not change current implementation)
26  * TODO:
27  * - deal with partitioining of boundary mesh
28  */
29 class Partitioning {
30 public:
31 
32  /// Input specification objects.
36 
37  /**
38  * Constructor. A pointer to the mesh and accessor to an input record have to be provided.
39  */
40  Partitioning(Mesh *mesh, Input::Record in);
41 
42  /**
43  * Get initial distribution.
44  */
45  const Distribution *get_init_distr() const;
46  /**
47  * Get local part of mesh partition.
48  */
49  const int *get_loc_part() const;
50 
51  /**
52  * Creates and returns vector with element partitioning for output.
53  */
55 
56  /**
57  * Obsolete see source file for doc.
58  */
59  void id_maps(int n_ids, int *id_4_old,
60  Distribution * &new_ds, int * &id_4_loc, int * &new_4_id);
61 
62 
63  static void id_maps(int n_ids, int *id_4_old,
64  const Distribution &old_ds, int *loc_part,
65  Distribution * &new_ds, int * &id_4_loc, int * &new_4_id);
66 
67  /// Destructor.
68  ~Partitioning();
69 
70 private:
71  /**
72  * Types of partitioning algorithms.
73  */
75  PETSc, ///< Use PETSc interface to various partitioing tools.
76  METIS ///< Use direct interface to Metis.
77  };
78 
79  /**
80  * Types of weights used for element partitioning.
81  */
83  any_neighboring, ///< Add edge for any pair of neighboring elements
84  any_weight_lower_dim_cuts, ///< Same as before and assign higher weight to cuts of lower dimension in order to make them stick to one face
85  same_dimension_neighboring, ///< Add edge for any pair of neighboring elements of same dimension (bad for matrix multiply)
86  };
87 
88  /// The input mesh
90  /// Input Record accessor.
92 
93  /// Graph used to partitioning the mesh.
95  /// Partition numbers for local elements in original distribution of elements given be @p init_el_ds_.
96  int * loc_part_;
97  /// Original distribution of elements. Depends on type of partitioner
99  /// Sequential partitioning for output.
101 
102  /**
103  * Creates sparse parallel graph from the mesh (using algorithm given by the key "graph_type" of the input record accessor @p in_
104  */
106  /**
107  * Creates sparse parallel graph from the mesh (using algorithm given by the key "graph_type" of the input record accessor @p in_)
108  * calls partitioning tool given by the key "tool" of the input record accessor @p in_)
109  * result is local part of the partitioning. Can be retrieved by @p get_loc_part().
110  */
111  void make_partition();
112 
113 
114 };
115 
116 
117 #endif /* PARTITIONING_HH_ */
Class for the mesh partitioning. This should provide:
Definition: partitioning.hh:29
Mesh * mesh_
The input mesh.
Definition: partitioning.hh:89
~Partitioning()
Destructor.
Definition: partitioning.cc:49
void id_maps(int n_ids, int *id_4_old, Distribution *&new_ds, int *&id_4_loc, int *&new_4_id)
void make_element_connection_graph()
Definition: partitioning.cc:72
Add edge for any pair of neighboring elements.
Definition: partitioning.hh:83
Definition: mesh.h:108
Use PETSc interface to various partitioing tools.
Definition: partitioning.hh:75
Input::Record in_
Input Record accessor.
Definition: partitioning.hh:91
static Input::Type::Record input_type
Definition: partitioning.hh:35
static Input::Type::Selection tool_sel
Definition: partitioning.hh:34
Virtual class for construction and partitioning of a distributed sparse graph.
Definition: sparse_graph.hh:66
Accessor to the data with type Type::Record.
Definition: accessors.hh:308
Use direct interface to Metis.
Definition: partitioning.hh:76
static Input::Type::Selection graph_type_sel
Input specification objects.
Definition: partitioning.hh:33
Distribution * init_el_ds_
Original distribution of elements. Depends on type of partitioner.
Definition: partitioning.hh:98
vector< int > & seq_output_partition()
vector< int > seq_part_
Sequential partitioning for output.
Same as before and assign higher weight to cuts of lower dimension in order to make them stick to one...
Definition: partitioning.hh:84
const Distribution * get_init_distr() const
Definition: partitioning.cc:58
const int * get_loc_part() const
Definition: partitioning.cc:65
void make_partition()
Record type proxy class.
Definition: type_record.hh:161
SparseGraph * graph_
Graph used to partitioning the mesh.
Definition: partitioning.hh:94
Add edge for any pair of neighboring elements of same dimension (bad for matrix multiply) ...
Definition: partitioning.hh:85
Partitioning(Mesh *mesh, Input::Record in)
Definition: partitioning.cc:41
Template for classes storing finite set of named values.
int * loc_part_
Partition numbers for local elements in original distribution of elements given be init_el_ds_...
Definition: partitioning.hh:96