Zoltan2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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 
20 namespace Zoltan2 {
21 
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 
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
#define HELLO
int * getColors()
Get (local) color array by raw pointer (no RCP).
Defines the Solution base class.
Just a placeholder for now.
map_t::global_ordinal_type gno_t
Definition: mapRemotes.cpp:27
int getNumColors()
Get local number of colors. This is computed from the coloring each time, as this is cheap...
size_t length_
Get global number of colors.
ArrayRCP< int > & getColorsRCP()
Get (local) color array by RCP.
ColoringSolution(size_t length)
Constructor allocates memory for the solution.
map_t::local_ordinal_type lno_t
Definition: mapRemotes.cpp:26
Gathering definitions used in software development.
size_t getColorsSize()
Get (local) size of color array.
The class containing coloring solution.