Zoltan2
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
14#ifndef _ZOLTAN2_COLORINGSOLUTION_HPP_
15#define _ZOLTAN2_COLORINGSOLUTION_HPP_
16
17#include <Zoltan2_Standards.hpp>
18#include <Zoltan2_Solution.hpp>
19
20namespace Zoltan2 {
21
33template <typename Adapter>
35{
36private:
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
41public:
42
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
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
88protected:
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
Defines the Solution base class.
Gathering definitions used in software development.
#define HELLO
The class containing coloring solution.
ColoringSolution(size_t length)
Constructor allocates memory for the solution.
ArrayRCP< int > & getColorsRCP()
Get (local) color array by RCP.
int * getColors()
Get (local) color array by raw pointer (no RCP).
size_t length_
Get global number of colors.
size_t getColorsSize()
Get (local) size of color array.
int getNumColors()
Get local number of colors. This is computed from the coloring each time, as this is cheap.
Just a placeholder for now.
Created by mbenlioglu on Aug 31, 2020.