VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
MetisPartitioner.h
Go to the documentation of this file.
1//=======================================================================================
2// ____ ____ __ ______ __________ __ __ __ __
3// \ \ | | | | | _ \ |___ ___| | | | | / \ | |
4// \ \ | | | | | |_) | | | | | | | / \ | |
5// \ \ | | | | | _ / | | | | | | / /\ \ | |
6// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____
7// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______|
8// \ \ | | ________________________________________________________________
9// \ \ | | | ______________________________________________________________|
10// \ \| | | | __ __ __ __ ______ _______
11// \ | | |_____ | | | | | | | | | _ \ / _____)
12// \ | | _____| | | | | | | | | | | \ \ \_______
13// \ | | | | |_____ | \_/ | | | | |_/ / _____ |
14// \ _____| |__| |________| \_______/ |__| |______/ (_______/
15//
16// This file is part of VirtualFluids. VirtualFluids is free software: you can
17// redistribute it and/or modify it under the terms of the GNU General Public
18// License as published by the Free Software Foundation, either version 3 of
19// the License, or (at your option) any later version.
20//
21// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
22// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24// for more details.
25//
26// SPDX-License-Identifier: GPL-3.0-or-later
27// SPDX-FileCopyrightText: Copyright © VirtualFluids Project contributors, see AUTHORS.md in root folder
28//
32//=======================================================================================
33
34
35#ifndef METISPARTITIONER_H
36#define METISPARTITIONER_H
37
38#if defined VF_METIS
39
41#include "metis.h"
42#include "PointerDefinitions.h"
43#include <string>
44#include <vector>
45
46
50
51
53{
54public:
56
57public:
60 void setMetisOptions(int option, idx_t value);
62
63public:
64 std::vector<idx_t> xadj; // adjncy offset of nodes
65 //(size = n+1, n=nofNodes)
66 std::vector<idx_t> adjncy; // array that stores the adjacency lists of nodes
67 //(size = m*2, m= nofEdged, factor 2 because edge A->B AND B->A has to be stored)
68 std::vector<idx_t> vwgt; // vertex weights (size=n*ncon, ncon=nofNodeWeightsPerNode)
69 std::vector<idx_t> adjwgt; // array that stores the weights of the adjacency lists
70 // (size=2*m)
71 idx_t *vsize; // array that stores the computation weights per node
72 // (size=n)
73
74 real_t *tpwgts; // holds the wished fratcion of segment i, e.g. tpwgts={0.2, 0.2, 0.6}
75 // -> patisions 0 and one will get 20% of the weight each and part 3 60%!
76 // (size=nofPartitions) sum of tpwgts must be 1.0
77
78 real_t *
79 ubvec; // This is an array of size ncon that specifies the allowed load imbalance tolerance for each constraint.
80 // For the ith partition and jth constraint the allowed weight is the ubvec[j]*tpwgts[i*ncon+j] fraction
81 // of the jths constraint total weight. The load imbalances must be greater than 1.0.
82 // A NULL value can be passed indicating that the load imbalance tolerance for each constraint should
83 // be 1.001 (for ncon=1) or 1.01 (for ncon1).
84
85 std::vector<idx_t>
86 part; // This is a vector of size n that upon successful completion stores the partition vector of the graph.
87 // The numbering of this vector starts from 0
88private:
89 idx_t options[METIS_NOPTIONS];
90};
91
92#endif
93
94#endif
95
Class use METIS library for graph-based partitioning.
std::vector< idx_t > adjncy
std::vector< idx_t > adjwgt
std::vector< idx_t > part
std::vector< idx_t > xadj
std::vector< idx_t > vwgt
std::shared_ptr< T > SPtr
int partition(int nofParts, PartType ptype)
void setMetisOptions(int option, idx_t value)