summaryrefslogtreecommitdiff
path: root/cell.cpp
blob: 0f18478a7c1c1e7db2035715d886bf63d3018e47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
// -*- mode: c++ -*-

#include "cell.hpp"

// ------------------------------------------------------------------------
// constructors
// ------------------------------------------------------------------------

Cell::Cell()
{
  
  cell_id = -1;
  coupled_neighbor = -1;
  characteristic_length = -1.0;
  maximum_length = -1.0;
  
  water_depth = 0.0;
  water_depth_next = 0.0;

  velocity.resize(DIM);
  velocity_next.resize(DIM);
  coordinates.resize(DIM);

  neighbors.resize(N_NEIGHBORS);
  
  for (size_t i = 0; i < DIM; i ++) {
    coordinates[i] = 0.0;
    velocity[i] = 0.0;
    velocity_next[i] = 0.0;
  }

  for (size_t i = 0; i < N_NEIGHBORS; i ++)
    neighbors[i] = -1;
  
}

Cell::Cell(double x, double y, double z)
{

  cell_id = -1;
  coupled_neighbor = -1;
  characteristic_length = -1.0;
  maximum_length = -1.0;

  water_depth = 0.0;
  water_depth_next = 0.0;

  velocity.resize(DIM);
  velocity_next.resize(DIM);
  coordinates.resize(DIM);
  neighbors.resize(N_NEIGHBORS);

  coordinates[0] = x;
  coordinates[1] = y;
  coordinates[2] = z;
  
  for (size_t i = 0; i < DIM; i ++) {
    velocity[i] = 0.0;
    velocity_next[i] = 0.0;
  }

  for (size_t i = 0; i < N_NEIGHBORS; i ++)
    neighbors[i] = -1;
  
}

// ------------------------------------------------------------------------
// methods
// ------------------------------------------------------------------------

hsize_t Cell::get_neighbor(int index) {
  return neighbors[index];
}

void Cell::set_neighbor(int index, hsize_t value) {
  neighbors[index] = value;
}

void Cell::set_cell_id(int value) {
  cell_id = value;
}

int Cell::get_cell_id() {
  return cell_id;
}

void Cell::set_coupled_neighbor(hsize_t value) {
  coupled_neighbor = value;
}

hsize_t Cell::get_coupled_neighbor() {
  return coupled_neighbor;
}
  
void Cell::set_water_depth(double value) {
  water_depth = value;
}

void Cell::set_water_depth_next(double value) {
  water_depth_next = value;
}

void Cell::set_velocity(int index, double value) {
  velocity[index] = value;
}

void Cell::set_velocity_next(int index, double value) {
  velocity_next[index] = value;
}

double Cell::get_coordinate(int index) {
  return coordinates[index];
}

void Cell::set_coordinate(int index, double value) {
  coordinates[index] = value;
}

double Cell::get_water_depth() {
  return water_depth;
}

double Cell::get_water_depth_next() {
  return water_depth_next;
}

double Cell::get_velocity(int index) {
  return velocity[index];
}

double Cell::get_velocity_next(int index) {
  return velocity_next[index];
}

double Cell::get_characteristic_length() {
  return characteristic_length;
}

void Cell::set_characteristic_length(double value) {
  characteristic_length = value;
}

double Cell::get_maximum_length() {
  return maximum_length;
}

void Cell::set_maximum_length(double value) {
  maximum_length = value;
}