Serialbox  2.2.0
Data serialization library and tools for C/C++, Python and Fortran
IJKSize.h
Go to the documentation of this file.
1 //===-- serialbox/core/frontend/stella/IJKSize.h ------------------------------------*- C++ -*-===//
2 //
3 // S E R I A L B O X
4 //
5 // This file is distributed under terms of BSD license.
6 // See LICENSE.txt for more information
7 //
8 //===------------------------------------------------------------------------------------------===//
9 //
13 //===------------------------------------------------------------------------------------------===//
14 
15 #ifndef SERIALBOX_CORE_FRONTEND_STELLA_IJKSIZE_H
16 #define SERIALBOX_CORE_FRONTEND_STELLA_IJKSIZE_H
17 
18 #include <cassert>
19 
20 namespace serialbox {
21 
22 namespace stella {
23 
27 class IJKSize {
28 public:
29  IJKSize() {
30  iSize_ = 0;
31  jSize_ = 0;
32  kSize_ = 0;
33  }
34 
35  ~IJKSize() {}
36 
37  IJKSize(const IJKSize& other) { *this = other; }
38 
39  IJKSize& operator=(const IJKSize& other) {
40  iSize_ = other.iSize_;
41  jSize_ = other.jSize_;
42  kSize_ = other.kSize_;
43  return *this;
44  }
45 
46  bool operator==(const IJKSize& other) const {
47  return ((iSize() == other.iSize()) && (jSize() == other.jSize()) && (kSize() == other.kSize()));
48  }
49 
55  void Init(const int iSize, const int jSize, const int kSize) {
56  assert(iSize >= 0 && jSize >= 0 && kSize >= 0);
57  iSize_ = iSize;
58  jSize_ = jSize;
59  kSize_ = kSize;
60  }
61 
63  int iSize() const { return iSize_; }
64 
66  int jSize() const { return jSize_; }
67 
69  int kSize() const { return kSize_; }
70 
72  bool empty() const { return iSize_ <= 0 || jSize_ <= 0 || kSize_ <= 0; }
73 
74 private:
75  int iSize_, jSize_, kSize_;
76 };
77 
78 } // namespace stella
79 
80 } // namespace serialbox
81 
82 #endif
int jSize() const
Size in j dimension.
Definition: IJKSize.h:66
Namespace of the STELLA frontend.
Definition: ForwardDecl.h:27
Namespace of the serialbox library.
Definition: Archive.h:25
int iSize() const
Size in i dimension.
Definition: IJKSize.h:63
Container for i, j, k Size.
Definition: IJKSize.h:27
void Init(const int iSize, const int jSize, const int kSize)
Init the container.
Definition: IJKSize.h:55
int kSize() const
Size in k dimension.
Definition: IJKSize.h:69