11#include <kernel/util/memory_pool.hpp> 
   14#include <kernel/util/cuda_util.hpp> 
   39      using IndexVector = std::vector < Index>;
 
  112        const IndexVector& coloring);
 
  276      template<
typename ColoringType_>
 
  287      ColoringDataHandler(
const ColoringDataHandler&) = 
delete;
 
  289      ColoringDataHandler& operator=(
const ColoringDataHandler&) = 
delete;
 
  292      ColoringDataHandler(ColoringDataHandler&& other) 
noexcept 
  296        other._coloring_maps.clear();
 
  297        other._coloring_map_sizes.clear();
 
  300      ColoringDataHandler& operator=(ColoringDataHandler&& other) 
noexcept 
  307        other._coloring_maps.clear();
 
  308        other._coloring_map_sizes.clear();
 
  323      std::vector<Index>& get_color_sizes()
 
  328      const std::vector<Index>& get_color_sizes()
 const 
  370      void fill_color(
const std::vector<int>& coloring, 
int hint = -1)
 
  372        int num_colors = hint;
 
  375          num_colors = *std::max_element(coloring.begin(), coloring.end()) + 1;
 
  378        std::vector<std::vector<int>> tmp_vector;
 
  379        tmp_vector.resize(
Index(num_colors));
 
  380        for(std::size_t i = 0; i < coloring.size(); ++i)
 
  382          tmp_vector.at(std::size_t(coloring.at(i))).push_back(
int(i));
 
  388          _coloring_maps.at(i) = MemoryPool::allocate_memory<int>(tmp_vector.at(i).size());
 
  407          ASSERTM(num_colors == hint, 
"Hint and number of colors do not fit!");
 
  411        std::vector<std::vector<int>> tmp_vector;
 
  412        tmp_vector.resize(
Index(num_colors));
 
  413        for(std::size_t i = 0; i < coloring.
size(); ++i)
 
  415          tmp_vector.at(std::size_t(coloring[i])).push_back(
int(i));
 
  421          _coloring_maps.at(i) = MemoryPool::allocate_memory<int>(tmp_vector.at(i).size());
 
  437      bool initialized()
 const 
  442      Index get_max_size()
 const 
#define ASSERT(expr)
Debug-Assertion macro definition.
#define ASSERTM(expr, msg)
Debug-Assertion macro definition with custom message.
Datahandler for inverse coloring data.
Index get_max_color_size() const
Get max size of all colors.
Index get_num_colors() const
Returns the number of colors.
int * get_color_map(Index k)
Get the k-th color map.
void fill_color(const std::vector< int > &coloring, int hint=-1)
Fill in the coloring array.
const std::vector< int * > & get_coloring_maps() const
Retrieve the color maps.
const int * get_color_map(Index k) const
Get the k-th color map.
void fill_color(const Coloring &coloring, int hint=-1)
Fill in the coloring array.
std::vector< int * > _coloring_maps
vector of unified memory pointer
std::vector< int * > & get_coloring_maps()
Retrieve the color maps.
std::vector< Index > _coloring_map_sizes
vector of coloring sizes
ColoringDataHandler(const ColoringType_ &coloring, int hint=-1)
Constructor receiving coloring data and optional hint.
Coloring object implementation.
const Index & operator[](Index i) const
Returns the color for a node i.
Index & operator[](Index i)
Returns the color for a node i.
IndexVector _coloring
coloring vector
Graph create_partition_graph() const
Creates a color partition graph.
Index _num_colors
total number of colors used
Index get_num_nodes() const
Returns the total number of nodes.
virtual ~Coloring()
virtual destructor
bool empty() const
Checks whether the coloring is empty.
auto size() const -> decltype(_coloring.size())
Returns the total number of nodes.
Coloring & operator=(Coloring &&other) noexcept
move-assign operator
Index get_max_color() const
Returns the maximum color index.
Coloring()
Default constructor.
Index * get_coloring()
Returns the coloring array.
const Index * get_coloring() const
Returns the coloring array.
Index get_num_colors() const
Returns the number of colors.
Coloring clone() const
Clones this coloring.
Adjacency Graph implementation.
static void copy(DT_ *dest, const DT_ *src, const Index count)
Copy memory area from src to dest.
static void release_memory(void *address)
release memory or decrease reference counter
std::uint64_t Index
Index data type.