DOLFIN
DOLFIN C++ interface
ZoltanInterface.h
1 // Copyright (C) 2010 Garth N. Wells
2 //
3 // This file is part of DOLFIN.
4 //
5 // DOLFIN is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // DOLFIN is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
17 //
18 // First added: 2010-11-16
19 // Last changed:
20 
21 #ifndef __DOLFIN_ZOLTAN_GRAPH_COLORING_H
22 #define __DOLFIN_ZOLTAN_GRAPH_COLORING_H
23 
24 #include <vector>
25 
26 #ifdef HAS_TRILINOS
27 #include <zoltan_cpp.h>
28 #endif
29 
30 #include "Graph.h"
31 
32 namespace dolfin
33 {
34 
35  class Mesh;
36 
39 
41  {
42 
43  public:
44 
46  static std::size_t
48  std::vector<std::size_t>& colors);
49 
50  private:
51 
52  #ifdef HAS_TRILINOS
53  class ZoltanGraphInterface
54  {
55 
56  public:
57 
59  ZoltanGraphInterface(const Graph& graph);
60 
61  private:
62 
63  // Graph object
64  const Graph& _graph;
65 
66  public:
67 
69  void num_vertex_edges(unsigned int* num_edges) const;
70 
71  // Zoltan call-back functions
72  static int get_number_of_objects(void* data, int* ierr);
73 
74  static void get_object_list(void* data, int sizeGID, int sizeLID,
75  ZOLTAN_ID_PTR globalID,
76  ZOLTAN_ID_PTR localID, int wgt_dim,
77  float* obj_wgts, int* ierr);
78 
79  static void get_number_edges(void* data, int num_gid_entries,
80  int num_lid_entries,
81  int num_obj, ZOLTAN_ID_PTR global_ids,
82  ZOLTAN_ID_PTR local_ids, int* num_edges,
83  int* ierr);
84 
85  static void get_all_edges(void* data, int num_gid_entries,
86  int num_lid_entries, int num_obj,
87  ZOLTAN_ID_PTR global_ids,
88  ZOLTAN_ID_PTR local_ids,
89  int* num_edges,
90  ZOLTAN_ID_PTR nbor_global_id,
91  int* nbor_procs, int wgt_dim,
92  float* ewgts, int* ierr);
93 
94  };
95  #endif
96 
97  };
98 }
99 
100 #endif
Definition: ZoltanInterface.h:40
Definition: adapt.h:29
std::vector< graph_set_type > Graph
Vector of unordered Sets.
Definition: Graph.h:39
static std::size_t compute_local_vertex_coloring(const Graph &graph, std::vector< std::size_t > &colors)
Compute vertex colors.
Definition: ZoltanInterface.cpp:38