Zoltan2
Toggle main menu visibility
Loading...
Searching...
No Matches
Zoltan2_ColoringSolution.hpp
Go to the documentation of this file.
1
// @HEADER
2
// *****************************************************************************
3
// Zoltan2: A package of combinatorial algorithms for scientific computing
4
//
5
// Copyright 2012 NTESS and the Zoltan2 contributors.
6
// SPDX-License-Identifier: BSD-3-Clause
7
// *****************************************************************************
8
// @HEADER
9
13
14
#ifndef _ZOLTAN2_COLORINGSOLUTION_HPP_
15
#define _ZOLTAN2_COLORINGSOLUTION_HPP_
16
17
#include <
Zoltan2_Standards.hpp
>
18
#include <
Zoltan2_Solution.hpp
>
19
20
namespace
Zoltan2
{
21
32
33
template
<
typename
Adapter>
34
class
ColoringSolution
:
public
Solution
35
{
36
private
:
37
typedef
typename
Adapter::gno_t gno_t;
38
typedef
typename
Adapter::scalar_t scalar_t;
39
typedef
typename
Adapter::lno_t lno_t;
40
41
public
:
42
45
ColoringSolution
(
46
size_t
length
// This should be equal to nlids. TODO: Optional?
47
)
48
{
49
HELLO
;
50
length_
= length;
51
colors_
= ArrayRCP<int>(
length_
);
52
}
53
55
// Accessor functions, allowing algorithms to get ptrs to solution memory.
56
// Algorithms can then load the memory.
57
// Non-RCP versions are provided for applications to use.
58
61
inline
size_t
getColorsSize
() {
return
length_
;}
// TODO Deprecate or rename? Should always be numVertices?
62
65
inline
ArrayRCP<int> &
getColorsRCP
() {
return
colors_
;}
66
69
inline
int
*
getColors
() {
return
&(*colors_);}
70
74
int
getNumColors
()
75
{
76
int
maxColor = 0;
77
for
(
size_t
i=0; i<
length_
; i++){
78
if
(
colors_
[i] > maxColor)
79
maxColor =
colors_
[i];
80
}
81
return
maxColor;
82
}
83
86
//int getGlobalNumColors(); // TODO
87
88
protected
:
89
// Coloring solution consists of permutation vector(s).
90
size_t
length_
;
91
ArrayRCP<int>
colors_
;
// zero-based local color array
92
//int numColors_; // Number of colors (local on this proc)
93
//int numColorsGlobal_; // For future distributed coloring
94
};
95
96
}
97
98
#endif
Zoltan2_Solution.hpp
Defines the Solution base class.
Zoltan2_Standards.hpp
Gathering definitions used in software development.
HELLO
#define HELLO
Definition
Zoltan2_Standards.hpp:96
Zoltan2::ColoringSolution::colors_
ArrayRCP< int > colors_
Definition
Zoltan2_ColoringSolution.hpp:91
Zoltan2::ColoringSolution::ColoringSolution
ColoringSolution(size_t length)
Constructor allocates memory for the solution.
Definition
Zoltan2_ColoringSolution.hpp:45
Zoltan2::ColoringSolution::getColorsRCP
ArrayRCP< int > & getColorsRCP()
Get (local) color array by RCP.
Definition
Zoltan2_ColoringSolution.hpp:65
Zoltan2::ColoringSolution::getColors
int * getColors()
Get (local) color array by raw pointer (no RCP).
Definition
Zoltan2_ColoringSolution.hpp:69
Zoltan2::ColoringSolution::length_
size_t length_
Get global number of colors.
Definition
Zoltan2_ColoringSolution.hpp:90
Zoltan2::ColoringSolution::getColorsSize
size_t getColorsSize()
Get (local) size of color array.
Definition
Zoltan2_ColoringSolution.hpp:61
Zoltan2::ColoringSolution::getNumColors
int getNumColors()
Get local number of colors. This is computed from the coloring each time, as this is cheap.
Definition
Zoltan2_ColoringSolution.hpp:74
Zoltan2::Solution
Just a placeholder for now.
Definition
Zoltan2_Solution.hpp:33
Zoltan2
Created by mbenlioglu on Aug 31, 2020.
Definition
Zoltan2_AlgHybrid2GL.hpp:47
core
src
problems
Zoltan2_ColoringSolution.hpp
Generated by
1.17.0