omega_h
Reliable mesh adaptation
Omega_h_graph.hpp
1 #ifndef OMEGA_H_GRAPH_HPP
2 #define OMEGA_H_GRAPH_HPP
3 
4 #include <utility>
5 #include <vector>
6 
7 #include "Omega_h_array.hpp"
8 
9 namespace Omega_h {
10 
22 struct Graph {
23  OMEGA_H_INLINE Graph() {}
24  explicit Graph(LOs ab2b_) : ab2b(ab2b_) {}
25  Graph(LOs a2ab_, LOs ab2b_) : a2ab(a2ab_), ab2b(ab2b_) {}
26  LOs a2ab; //offset array
27  LOs ab2b; //values array
28  LO nnodes() const;
29  LO nedges() const;
30 };
31 
33 Graph add_edges(Graph g1, Graph g2);
35 Graph unmap_graph(LOs a2b, Graph b2c);
44 template <typename T>
45 Read<T> graph_reduce(Graph a2b, Read<T> b_data, Int width, Omega_h_Op op);
46 Reals graph_weighted_average_arc_data(
47  Graph a2b, Reals ab_weights, Reals ab_data, Int width);
48 Reals graph_weighted_average(
49  Graph a2b, Reals ab_weights, Reals b_data, Int width);
50 Graph filter_graph_edges(Graph g, Read<I8> keep_edge);
51 Graph filter_graph_nodes(Graph g, Read<I8> keep_node);
52 bool operator==(Graph a, Graph b);
53 Graph identity_graph(LO nnodes);
54 
55 Graph add_self_edges(Graph g);
56 
57 template <typename T>
58 void map_into(Read<T> a_data, Graph a2b, Write<T> b_data, Int width);
59 template <typename T>
60 Read<T> map_onto(Read<T> a_data, Graph a2b, LO nb, T init_val, Int width);
61 
62 #define INST_DECL(T) \
63  extern template Read<T> graph_reduce(Graph, Read<T>, Int, Omega_h_Op); \
64  extern template void map_into( \
65  Read<T> a_data, Graph a2b, Write<T> b_data, Int width); \
66  extern template Read<T> map_onto( \
67  Read<T> a_data, Graph a2b, LO nb, T, Int width);
68 INST_DECL(I8)
69 INST_DECL(I32)
70 INST_DECL(I64)
71 INST_DECL(Real)
72 #undef INST_DECL
73 
74 } // end namespace Omega_h
75 
76 #endif
Definition: Omega_h_array.hpp:50
Definition: amr_mpi_test.cpp:6
Graph unmap_graph(LOs a2b, Graph b2c)
traverse two graphs a2b and b2c to form and return a graph from a2c
Definition: Omega_h_graph.cpp:42
Read< T > graph_reduce(Graph a2b, Read< T > b_data, Int width, Omega_h_Op op)
apply reduction operation op to the edge data associated with each source node
Definition: Omega_h_graph.cpp:62
Graph add_edges(Graph g1, Graph g2)
combine the edges of two graphs that have the same set of nodes
Definition: Omega_h_graph.cpp:14
directed graph (as defined by graph theory) in compressed row format
Definition: Omega_h_graph.hpp:22