GemaPCR
The GeMA PCR (Partition-Color-Renumber) Plugin
Loading...
Searching...
No Matches
gmpMetisPartitioning.h
Go to the documentation of this file.
1/************************************************************************
2**
3** Copyright (C) 2014 by Carlos Augusto Teixeira Mendes
4** All rights reserved.
5**
6** This file is part of the "GeMA" software. It's use should respect
7** the terms in the license agreement that can be found together
8** with this source code.
9** It is provided AS IS, with NO WARRANTY OF ANY KIND,
10** INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR
11** A PARTICULAR PURPOSE.
12**
13************************************************************************/
14
24#ifndef _GEMA_PLUGIN_GEMA_PCR_METISPARTITIONING_H_
25#define _GEMA_PLUGIN_GEMA_PCR_METISPARTITIONING_H_
26
27#include "gmpGemaPCR.h"
28
29/* Important: GEMA_PCR_USE_METIS is defined if the project was compiled with
30 Metis support (cmake must be present at the user environment). It
31 will be absent if not available. In that case, this class basically
32 does nothing and returns false for both checkOptions() and
33 partition() calls.
34*/
35
36#ifdef GEMA_PCR_USE_METIS
37#include <metis.h>
38
41{
42public:
43 GmpMetisPartitioning(const QVariantMap& options);
44
45 virtual bool checkOptions (const GmLogCategory& logger);
46 virtual void printParameters(const GmLogCategory& logger) const;
47
48 virtual bool partition(GmCellMesh* mesh, int numPartitions, QVector<int>& cellPartition,
49 const GmLogCategory& logger) const;
50private:
51 idx_t _metisOptions[METIS_NOPTIONS];
52 int _ncommon;
53 int _objVal;
54 QVector<float> _partWeights;
55};
56
57#else
58
61{
62public:
63 // Inherit base class constructor
64 using GmpPartitionMethod::GmpPartitionMethod;
65
66 virtual bool checkOptions(const GmLogCategory& logger)
67 {
68 gmErrorMsg(logger, QObject::tr("GemaPCR was not compiled with Metis support"));
69 return false;
70 }
71
72 virtual void printParameters(const GmLogCategory& logger) const
73 {
74 GmLogIdenter ident;
75 gmInfoMsg(logger, QObject::tr("Partition method : Metis"));
76 }
77
78 virtual bool partition(GmCellMesh* mesh, int numPartitions, QVector<int>& cellPartition,
79 const GmLogCategory& logger) const
80 {
81 Q_UNUSED(mesh); Q_UNUSED(numPartitions); Q_UNUSED(cellPartition);
82 gmErrorMsg(logger, QObject::tr("GemaPCR was not compiled with Metis support"));
83 return false;
84 }
85};
86#endif
87
88
89#endif
Implements a dummy class since the plugin was compiled without the Metis library.
Definition gmpMetisPartitioning.h:61
virtual bool partition(GmCellMesh *mesh, int numPartitions, QVector< int > &cellPartition, const GmLogCategory &logger) const
The cell partition function. It gets as input parameters the cell mesh with a valid cell incidence in...
Definition gmpMetisPartitioning.h:78
virtual bool checkOptions(const GmLogCategory &logger)
Virtual method responsible for validating the parameters supplied on the class constructor....
Definition gmpMetisPartitioning.h:66
virtual void printParameters(const GmLogCategory &logger) const
Virtual method responsible for printing the partition method description.
Definition gmpMetisPartitioning.h:72
The abstract interface for a partition method implementation.
Definition gmpGemaPCR.h:31
Declaration of the GmpGemaPCR class.
QString tr(const char *sourceText, const char *disambiguation, int n)