LinkedListCube.h
Go to the documentation of this file.
1 //
2 // This file is part of the FFEA simulation package
3 //
4 // Copyright (c) by the Theory and Development FFEA teams,
5 // as they appear in the README.md file.
6 //
7 // FFEA is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // FFEA is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with FFEA. If not, see <http://www.gnu.org/licenses/>.
19 //
20 // To help us fund FFEA development, we humbly ask that you cite
21 // the research papers on the package.
22 //
23 
24 #ifndef LINKEDLISTCUBE_H_INCLUDED
25 #define LINKEDLISTCUBE_H_INCLUDED
26 
27 #include "FFEA_return_codes.h"
28 #include "Face.h"
29 
30 template <class T>
33  T *obj;
34 
37 
39  int index;
40 
42 
43  int x, y, z;
45 };
46 
47 template <class T>
49 public:
50 
53 
55  ~LinkedListCube();
56 
58  int alloc(int N_x, int N_y, int N_z, int max_num_nodes_in_pool);
59 
62  int alloc_dual(int N_x, int N_y, int N_z, int max_num_nodes_in_pool);
63 
65  int add_to_pool(T *t);
66 
68  int add_to_pool_dual(T *t);
69 
71  LinkedListNode<T> * get_from_pool(int i);
72 
77  void clear();
78  void clear_layer(int l);
79  void clear_shadow_layer();
80 
86  int add_node_to_stack(int i, int x, int y, int z);
87  int add_node_to_stack_shadow(int i, int x, int y, int z);
88 
90  LinkedListNode<T> * get_top_of_stack(int x, int y, int z);
91 
93  int get_pool_size();
94 
95  void get_dim(int *Nx, int *Ny, int *Nz);
96 
97  int safely_swap_layers();
98 
99  void allow_swapping();
100  void forbid_swapping();
101 
102 
103 protected:
104 
106  int N_x, N_y, N_z;
107 
110 
113 
119 
125 
128 
129  void swap_layers();
130  bool can_swap;
131 
132 private:
135 
136  void pbc(int *x, int *y, int *z);
137 
138 };
139 
140 #include "../src/LinkedListCube.tpp"
141 
142 #endif
T * obj
Definition: LinkedListCube.h:33
LinkedListNode< T > * pool2
Definition: LinkedListCube.h:122
LinkedListNode< T > ** root2
Definition: LinkedListCube.h:116
int shadow_layer
Definition: LinkedListCube.h:127
LinkedListNode * next
Definition: LinkedListCube.h:36
int num_nodes_in_pool
Definition: LinkedListCube.h:112
LinkedListNode< T > ** root1
Definition: LinkedListCube.h:115
int x
Definition: LinkedListCube.h:43
LinkedListNode< T > * pool_shadow
Definition: LinkedListCube.h:124
Definition: LinkedListCube.h:48
int N_z
Definition: LinkedListCube.h:106
LinkedListNode< T > * pool1
Definition: LinkedListCube.h:121
int z
Definition: LinkedListCube.h:43
int index
Definition: LinkedListCube.h:39
int max_num_nodes_in_pool
Definition: LinkedListCube.h:109
static const int i
index of ith thing
Definition: rod_math_v9.h:63
LinkedListNode< T > * pool
Definition: LinkedListCube.h:123
LinkedListNode< T > ** root
Definition: LinkedListCube.h:117
LinkedListNode< T > ** root_shadow
Definition: LinkedListCube.h:118
bool can_swap
Definition: LinkedListCube.h:130
int add_index
Definition: LinkedListCube.h:134
int y
Definition: LinkedListCube.h:43
int active_layer
Definition: LinkedListCube.h:126
Definition: LinkedListCube.h:31