Zoltan2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Zoltan2_MatchingSolution.hpp
Go to the documentation of this file.
1 #if 0
2 // @HEADER
3 // *****************************************************************************
4 // Zoltan2: A package of combinatorial algorithms for scientific computing
5 //
6 // Copyright 2012 NTESS and the Zoltan2 contributors.
7 // SPDX-License-Identifier: BSD-3-Clause
8 // *****************************************************************************
9 // @HEADER
10 
15 #ifndef _ZOLTAN2_MATCHINGSOLUTION_HPP_
16 #define _ZOLTAN2_MATCHINGSOLUTION_HPP_
17 
18 #include <Zoltan2_Standards.hpp>
19 #include <Zoltan2_Solution.hpp>
20 
21 namespace Zoltan2 {
22 
34 template <typename Adapter>
35  class MatchingSolution : public Solution
36 {
37 private:
38  typedef typename Adapter::gno_t gno_t;
39  typedef typename Adapter::scalar_t scalar_t;
40  typedef typename Adapter::lno_t lno_t;
41 
42 public:
43 
46  MatchingSolution(
47  size_t length // This should be equal to nlids. TODO: Optional?
48  )
49  {
50  HELLO;
51  length_ = length;
52  colors_ = ArrayRCP<int>(length_);
53  }
54 
56  // Accessor functions, allowing algorithms to get ptrs to solution memory.
57  // Algorithms can then load the memory.
58  // Non-RCP versions are provided for applications to use.
59 
62  inline size_t getMatchsSize() {return length_;}
63 
66  inline ArrayRCP<int> &getMatchsRCP() {return colors_;}
67 
70  inline int * getMatchs() {return &(*colors_);}
71 
75  int getNumColors()
76  {
77  int maxColor = 0;
78  for (size_t i=0; i<length_; i++){
79  if (colors_[i] > maxColor)
80  maxColor = colors_[i];
81  }
82  return maxColor;
83  }
84 
87  //int getGlobalNumColors(); // TODO
88 
89 protected:
90  // Matching solution consists of permutation vector(s).
91  size_t length_;
92  ArrayRCP<int> colors_; // zero-based local color array
93  //int numMatchs_; // Number of colors (local on this proc)
94  //int numMatchsGlobal_; // For future distributed coloring
95 };
96 
97 }
98 
99 #endif
100 #endif
#define HELLO
Defines the Solution base class.
map_t::global_ordinal_type gno_t
Definition: mapRemotes.cpp:27
map_t::local_ordinal_type lno_t
Definition: mapRemotes.cpp:26
Gathering definitions used in software development.