Allium  0.1.0
vector_spec.hpp
1 // Copyright 2020 Hannah Rittich
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef ALLIUM_LA_VECTOR_SPEC_HPP
16 #define ALLIUM_LA_VECTOR_SPEC_HPP
17 
18 #include <allium/util/types.hpp>
19 #include <allium/ipc/comm.hpp>
20 
21 namespace allium {
22 
26  class VectorSpec final {
27  public:
28  VectorSpec(const VectorSpec&) = default;
29  VectorSpec(VectorSpec&&) = default;
30  VectorSpec(Comm comm, size_t local_size, global_size_t global_size);
31 
32  VectorSpec& operator= (const VectorSpec&) = default;
33  VectorSpec& operator= (VectorSpec&&) = default;
34 
35  bool operator!= (const VectorSpec& other) {
36  return (m_comm != other.m_comm)
37  || (m_global_size != other.m_global_size)
38  || (m_local_size != other.m_local_size);
39  }
40 
41  Comm comm() { return m_comm; }
42  global_size_t global_size() { return m_global_size; }
43  size_t local_size() { return m_local_size; }
44 
45  global_size_t local_start() { return m_local_start; }
46  global_size_t local_end() { return m_local_end; }
47  private:
48  Comm m_comm;
49  global_size_t m_global_size;
50  size_t m_local_size;
51  global_size_t m_local_start;
52  global_size_t m_local_end;
53  };
54 }
55 
56 #endif
Wraps an MPI communicator to make MPI easier to use.
Definition: comm.hpp:26
The specification of a vector, needed to create distributed vectors.
Definition: vector_spec.hpp:26