FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
parti_zoltan.hpp
1// FEAT3: Finite Element Analysis Toolbox, Version 3
2// Copyright (C) 2010 by Stefan Turek & the FEAT group
3// FEAT3 is released under the GNU General Public License version 3,
4// see the file 'copyright.txt' in the top level directory for details.
5
6#pragma once
7
9
10#if defined(FEAT_HAVE_ZOLTAN) || defined(DOXYGEN)
11#include <kernel/util/dist.hpp>
12#include <kernel/adjacency/graph.hpp>
13#include <kernel/adjacency/coloring.hpp>
14#include <kernel/geometry/conformal_mesh.hpp>
15
16namespace FEAT
17{
18 namespace Geometry
19 {
39 {
40 public:
43 {
44 public:
50 std::vector<float> weights;
51
52 Hypergraph() :
53 first_elem(0u),
54 sub_graph(),
55 weights()
56 {
57 }
58 }; // class Hypergraph
59
60 private:
78 void* _zz;
79
80 public:
92 explicit PartiZoltan(const Dist::Comm& comm, Index min_elems = 1000u, int max_procs = 1000);
93
95 virtual ~PartiZoltan();
96
115 template<int n_>
116 bool execute(const IndexSet<n_>& faces_at_elem, const Index num_parts, const std::vector<Real>& weights)
117 {
119 return execute(graph, num_parts, weights);
120 }
121
140 bool execute(const Adjacency::Graph& faces_at_elem, const Index num_parts, const std::vector<Real>& weights);
141
146 {
148 }
149
156 {
157 return _zoltan_comm.size();
158 }
159
160 protected:
162 void _create_hypergraph(const Adjacency::Graph& faces_at_elem, const std::vector<Real>& weights);
166 bool _gather_coloring(const int num_export, const int* export_parts);
168 bool _broadcast_coloring(bool zoltan_ok);
169 }; // class PartiZoltan
170 } // namespace Geometry
171} // namespace FEAT
172
173#endif // FEAT_HAVE_ZOLTAN
FEAT Kernel base header.
Coloring object implementation.
Definition: coloring.hpp:37
Graph create_partition_graph() const
Creates a color partition graph.
Definition: coloring.cpp:292
Adjacency Graph implementation.
Definition: graph.hpp:34
Communicator class.
Definition: dist.hpp:1349
int size() const
Returns the size of this communicator.
Definition: dist.hpp:1506
Conformal Index-Set class template.
Definition: index_set.hpp:82
internal data class to be used by callback functions
Adjacency::Graph sub_graph
the sub-graph for this process
std::vector< float > weights
the weights for the elements of this sub-graph
Index first_elem
the first element of this process
Zoltan hypergraph partitioner backend.
Index _min_elems
minimum number of elements per MPI process
void * _zz
zoltan internal data
bool _apply_zoltan()
auxiliary function: applies Zoltan onto the hypergraph
bool execute(const Adjacency::Graph &faces_at_elem, const Index num_parts, const std::vector< Real > &weights)
Executes the Zoltan partitioner.
Index _num_elems
the total number of elements
Hypergraph _hypergraph
our hypergraph structure
int _max_procs
maximum number of MPI processes to use
int get_sub_comm_size() const
Returns the size of the internal sub-communicator.
bool _broadcast_coloring(bool zoltan_ok)
auxiliary function: broadcasts the coloring from the root process
bool execute(const IndexSet< n_ > &faces_at_elem, const Index num_parts, const std::vector< Real > &weights)
Executes the Zoltan partitioner.
void _create_hypergraph(const Adjacency::Graph &faces_at_elem, const std::vector< Real > &weights)
auxiliary function: builds a hypergraph from the adjacency graph
const Dist::Comm & _comm
our main communicator
bool _gather_coloring(const int num_export, const int *export_parts)
auxiliary function: gathers the partitioned coloring onto the root process
Adjacency::Coloring _coloring
the element coloring
Dist::Comm _zoltan_comm
a sub-communicator for the partitioner
Adjacency::Graph build_elems_at_rank() const
Builds and returns the elements-at-rank graph representing the partitioning.
Index _num_parts
the desired number of partitions
PartiZoltan(const Dist::Comm &comm, Index min_elems=1000u, int max_procs=1000)
Constructor.
virtual ~PartiZoltan()
virtual destructor
@ as_is
Render-As-Is mode.
FEAT namespace.
Definition: adjactor.hpp:12
std::uint64_t Index
Index data type.