Interface Documentation
Version: invalid
interface.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 
18 #if !defined(__FLECSI_PRIVATE__)
19 #error Do not include this file directly!
20 #endif
21 
22 #include "flecsi/data/accessor.hh"
23 #include "flecsi/data/topology.hh"
25 #include "flecsi/topo/core.hh" // base
26 
27 #include <string>
28 
29 namespace flecsi {
30 namespace topo {
31 
38 template<typename Policy>
40  template<std::size_t>
41  struct access;
42 
43  template<class F>
44  static void fields(F f) {
45  f(mine);
46  }
47 
48  canonical(const coloring & c)
49  : vert(data::make_region<Policy, vertices>(c.size + 1),
50  c.parts,
51  split(c.size + 1, c.parts),
52  data::disjoint,
53  data::complete),
54  cell(data::make_region<Policy, cells>(c.size),
55  c.parts,
56  split(c.size, c.parts),
57  data::disjoint,
58  data::complete) {}
59 
60  static inline const field<int>::definition<Policy, cells> mine;
61 
62  data::partitioned vert, cell;
63 
64  template<index_space S>
65  auto & get_partition() const {
66  return S == cells ? cell : vert;
67  }
68 
69 private:
70  static auto split(std::size_t n, std::size_t p) {
71  return [=](std::size_t i) { return std::pair{i * n / p, (i + 1) * n / p}; };
72  }
73 }; // struct canonical
74 
75 template<class P>
76 template<std::size_t Priv>
77 struct canonical<P>::access {
78  template<const auto & F>
81 
82  template<class F>
83  void bind(F f) {
84  f(mine);
85  }
86 };
87 
88 template<>
90  using type = canonical_base;
91 };
92 
93 } // namespace topo
94 } // namespace flecsi
Definition: types.hh:29
Definition: core.hh:40
Definition: interface.hh:39
Definition: field.hh:103
Definition: field.hh:133
Definition: interface.hh:41
Definition: control.hh:31
Definition: topology.hh:55