World Ocean Simulation System (WOSS) library
sediment-deck41-db-logic-control.h
Go to the documentation of this file.
1/* WOSS - World Ocean Simulation System -
2 *
3 * Copyright (C) 2009 Federico Guerra
4 * and regents of the SIGNET lab, University of Padova
5 *
6 * Author: Federico Guerra - federico@guerra-tlc.com
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation;
11 *
12 * This program 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 this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22/*
23 * This software has been developed by Federico Guerra and SIGNET lab,
24 * University of Padova, in collaboration with the NATO Centre for
25 * Maritime Research and Experimentation (http://www.cmre.nato.int ;
26 * E-mail: pao@cmre.nato.int), whose support is gratefully acknowledged.
27 */
28
29
40#ifndef FLOOR_CONDITIONS_H
41#define FLOOR_CONDITIONS_H
42
43
44#ifdef WOSS_NETCDF_SUPPORT
45
47
48
49namespace woss {
50
51
52 static const int DECK41_FLOORTYPE_GRAVEL = 0;
54 static const int DECK41_FLOORTYPE_SAND = 1;
56 static const int DECK41_FLOORTYPE_SILT = 2;
58 static const int DECK41_FLOORTYPE_CLAY = 3;
60 static const int DECK41_FLOORTYPE_OOZE = 4;
62 static const int DECK41_FLOORTYPE_MUD = 5;
64 static const int DECK41_FLOORTYPE_ROCKS = 6;
66 static const int DECK41_FLOORTYPE_ORGANIC = 7;
68 static const int DECK41_FLOORTYPE_NODULES = 8;
70 static const int DECK41_FLOORTYPE_HARDBOTTOM = 9;
72 static const int DECK41_FLOORTYPE_NODATA = 11;
82
83
84 public:
85
86
91
92 virtual ~Deck41TypeTests();
93
94
100 bool conditionFloorA( const Deck41Types& types ) const ;
101
107 bool conditionFloorB( const Deck41Types& types ) const ;
108
115 bool conditionFloorC( const Deck41Types& types ) const ;
116
123 bool conditionFloorD( const Deck41Types& types ) const ;
124
131 bool conditionFloorE( const Deck41Types& types ) const ;
132
139 bool conditionFloorF( const Deck41Types& types ) const ;
140
147 bool conditionFloorG( const Deck41Types& types ) const ;
148
149
154 bool getConditionA() const { return condition_a; }
155
160 bool getConditionB() const { return condition_b; }
161
166 bool getConditionC() const { return condition_c; }
167
172 bool getConditionD() const { return condition_d; }
173
178 bool getConditionE() const { return condition_e; }
179
184 bool getConditionF() const { return condition_f; }
185
190 bool getConditionG() const { return condition_g; }
191
192
197 void updateAllConditions( const Deck41Types& types );
198
199
200 private:
201
202
203 bool condition_a;
204
205 bool condition_b;
206
207 bool condition_c;
208
209 bool condition_d;
210
211 bool condition_e;
212
213 bool condition_f;
214
215 bool condition_g;
216
217
218 };
219
220
221 //inline functions
223 inline bool Deck41TypeTests::conditionFloorA(const Deck41Types& types) const { // first = return main type
224 bool equal = (types.first == types.second);
225 bool first = (types.first == DECK41_FLOORTYPE_GRAVEL) || (types.first == DECK41_FLOORTYPE_SAND) || (types.first == DECK41_FLOORTYPE_SILT)
226 || (types.first == DECK41_FLOORTYPE_MUD) || (types.first == DECK41_FLOORTYPE_HARDBOTTOM);
227 bool second = (types.second == DECK41_FLOORTYPE_ROCKS) || (types.second == DECK41_FLOORTYPE_ORGANIC) ||
228 (types.second == DECK41_FLOORTYPE_NODULES) || (types.second == DECK41_FLOORTYPE_NODATA) ||
229 (types.second == DECK41_FLOORTYPE_HARDBOTTOM);
230
231 return ( (equal && first ) || (first && second));
232 }
233
234
235 inline bool Deck41TypeTests::conditionFloorB(const Deck41Types& types) const { // second = return secondary type
236 bool first = (types.first == DECK41_FLOORTYPE_NODATA);
237 bool second = (types.second == DECK41_FLOORTYPE_GRAVEL) || (types.second == DECK41_FLOORTYPE_SAND) ||
238 (types.second == DECK41_FLOORTYPE_SILT) || (types.second == DECK41_FLOORTYPE_MUD);
239
240 return (first && second);
241 }
242
243
244 inline bool Deck41TypeTests::conditionFloorC(const Deck41Types& types) const { // first* = try other coords, if fails get main type
245 bool first = (types.first == DECK41_FLOORTYPE_CLAY) || (types.first == DECK41_FLOORTYPE_OOZE) || (types.first == DECK41_FLOORTYPE_ORGANIC)
246 || (types.first == DECK41_FLOORTYPE_ROCKS) || (types.first == DECK41_FLOORTYPE_NODULES);
247 bool second = (types.second == DECK41_FLOORTYPE_ROCKS) || (types.second == DECK41_FLOORTYPE_ORGANIC) ||
248 (types.second == DECK41_FLOORTYPE_NODULES) || (types.second == DECK41_FLOORTYPE_NODATA) ||
249 (types.second == DECK41_FLOORTYPE_HARDBOTTOM);
250
251 return (first && second);
252 }
253
254
255 inline bool Deck41TypeTests::conditionFloorD(const Deck41Types& types) const { // second* = try other coords, if fails get secondary type
256 if ( types.first == DECK41_FLOORTYPE_ORGANIC ) return true;
257 else {
258 bool first = (types.first == DECK41_FLOORTYPE_ROCKS) || (types.first == DECK41_FLOORTYPE_NODULES) ||
259 (types.first == DECK41_FLOORTYPE_NODATA) ;
260 bool second = (types.second == DECK41_FLOORTYPE_GRAVEL) || (types.second == DECK41_FLOORTYPE_SAND) ||
261 (types.second == DECK41_FLOORTYPE_SILT) || (types.second == DECK41_FLOORTYPE_MUD);
262
263 return (first && second);
264 }
265 }
266
267 inline bool Deck41TypeTests::conditionFloorE(const Deck41Types& types) const { // 65%/35% = weighted avg
268 bool nequal = types.first != types.second;
269 bool first = (types.first == DECK41_FLOORTYPE_GRAVEL) || (types.first == DECK41_FLOORTYPE_SAND) || (types.first == DECK41_FLOORTYPE_SILT)
270 || (types.first == DECK41_FLOORTYPE_MUD);
271 bool second = first || (types.second == DECK41_FLOORTYPE_OOZE) || (types.second == DECK41_FLOORTYPE_CLAY);
272 bool special = (types.first == DECK41_FLOORTYPE_OOZE) && (types.second == DECK41_FLOORTYPE_CLAY);
273
274 return ( (first && second && nequal) || special );
275 }
276
277
278 inline bool Deck41TypeTests::conditionFloorF(const Deck41Types& types) const { // 40%/60% = weighted avg
279 bool nequal = types.first != types.second;
280 bool first = (types.first == DECK41_FLOORTYPE_CLAY) || (types.first == DECK41_FLOORTYPE_OOZE);
281 bool second = (types.second == DECK41_FLOORTYPE_GRAVEL) || (types.second == DECK41_FLOORTYPE_SAND) || (types.second == DECK41_FLOORTYPE_SILT)
282 || (types.second == DECK41_FLOORTYPE_MUD) || (types.second == DECK41_FLOORTYPE_OOZE);
283
284 return (first && second && nequal);
285 }
286
287
288 inline bool Deck41TypeTests::conditionFloorG(const Deck41Types& types) const { // exit* = try other coords, if fails exit program
289 return ( (types.first == DECK41_FLOORTYPE_NODATA) && (types.second == DECK41_FLOORTYPE_NODATA));
290 }
291
292
293 inline void Deck41TypeTests::updateAllConditions(const Deck41Types& types) {
294 condition_a = conditionFloorA(types); // first = return main type
295 condition_b = conditionFloorB(types); // second = return secondary type
296 condition_c = conditionFloorC(types); // first* = try other coords, if fails get main type
297 condition_d = conditionFloorD(types); // second* = try other coords, if fails get secondary type
298 condition_e = conditionFloorE(types); // 65%/35% = weighted avg
299 condition_f = conditionFloorF(types); // 40%/60% = weighted avg
300 condition_g = conditionFloorG(types);
301 }
302
303
304}
305
306#endif // WOSS_NETCDF_SUPPORT
307
308#endif /* FLOOR_CONDITIONS_H */
309
Abstraction layer for database and data manipulation.
Definition sediment-deck41-db-logic-control.h:81
void updateAllConditions(const Deck41Types &types)
Definition sediment-deck41-db-logic-control.h:293
bool conditionFloorB(const Deck41Types &types) const
Definition sediment-deck41-db-logic-control.h:235
bool conditionFloorG(const Deck41Types &types) const
Definition sediment-deck41-db-logic-control.h:288
bool getConditionF() const
Definition sediment-deck41-db-logic-control.h:184
bool conditionFloorD(const Deck41Types &types) const
Definition sediment-deck41-db-logic-control.h:255
bool getConditionG() const
Definition sediment-deck41-db-logic-control.h:190
Deck41TypeTests()
Definition sediment-deck41-db-logic-control.cpp:48
bool conditionFloorC(const Deck41Types &types) const
Definition sediment-deck41-db-logic-control.h:244
bool getConditionE() const
Definition sediment-deck41-db-logic-control.h:178
bool conditionFloorA(const Deck41Types &types) const
Definition sediment-deck41-db-logic-control.h:223
bool getConditionC() const
Definition sediment-deck41-db-logic-control.h:166
bool getConditionB() const
Definition sediment-deck41-db-logic-control.h:160
bool getConditionA() const
Definition sediment-deck41-db-logic-control.h:154
bool conditionFloorF(const Deck41Types &types) const
Definition sediment-deck41-db-logic-control.h:278
bool conditionFloorE(const Deck41Types &types) const
Definition sediment-deck41-db-logic-control.h:267
bool getConditionD() const
Definition sediment-deck41-db-logic-control.h:172
Definitions and library for woss::Sediment class.