Interface Documentation
Version: invalid
data.hh
Go to the documentation of this file.
1 /*
2  @@@@@@@@ @@ @@@@@@ @@@@@@@@ @@
3  /@@///// /@@ @@////@@ @@////// /@@
4  /@@ /@@ @@@@@ @@ // /@@ /@@
5  /@@@@@@@ /@@ @@///@@/@@ /@@@@@@@@@/@@
6  /@@//// /@@/@@@@@@@/@@ ////////@@/@@
7  /@@ /@@/@@//// //@@ @@ /@@/@@
8  /@@ @@@//@@@@@@ //@@@@@@ @@@@@@@@ /@@
9  // /// ////// ////// //////// //
10 
11  Copyright (c) 2016, Triad National Security, LLC
12  All rights reserved.
13  */
14 #pragma once
15 
24 #include "flecsi/topo/global.hh"
25 #include "flecsi/topo/index.hh"
30 #include <flecsi/data/accessor.hh>
31 #include <flecsi/data/coloring.hh>
32 
33 namespace flecsi {
34 
35 /*
36  Default global topology instance.
37  */
38 inline topo::global::slot global_topology;
39 
40 /*
41  Per-process coloring.
42  */
43 inline topo::index::cslot process_coloring;
44 
45 /*
46  Per-process topology instance.
47  */
48 inline topo::index::slot process_topology;
49 
50 namespace detail {
52 struct data_guard {
53  struct global_guard {
54  global_guard() {
55  global_topology.allocate({});
56  }
57  global_guard(global_guard &&) = delete;
58  ~global_guard() {
59  global_topology.deallocate();
60  }
61  } g;
62  struct color_guard {
63  color_guard() {
64  process_coloring.allocate(run::context::instance().processes());
65  }
66  color_guard(color_guard &&) = delete;
67  ~color_guard() {
68  process_coloring.deallocate();
69  }
70  } c;
71  struct process_guard {
72  process_guard() {
73  process_topology.allocate(process_coloring.get());
74  }
75  process_guard(process_guard &&) = delete;
76  ~process_guard() {
77  process_topology.deallocate();
78  }
79  } p;
80 };
81 } // namespace detail
82 
83 } // namespace flecsi
An RAII type to manage the global coloring and topologies.
Definition: data.hh:52
size_t processes()
Definition: execution.hh:294
Definition: control.hh:31