mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: move get_or_create_cylinder() to struct dive
Other cylinder-creation functions were already there. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
777e7f32a5
commit
9bb2255ba8
12 changed files with 83 additions and 83 deletions
|
|
@ -17,7 +17,7 @@ void TestformatDiveGasString::test_empty()
|
|||
void TestformatDiveGasString::test_air()
|
||||
{
|
||||
struct dive dive;
|
||||
cylinder_t *cylinder = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cylinder = dive.get_or_create_cylinder(0);
|
||||
|
||||
cylinder->start.mbar = 230000;
|
||||
cylinder->end.mbar = 100000;
|
||||
|
|
@ -28,7 +28,7 @@ void TestformatDiveGasString::test_air()
|
|||
void TestformatDiveGasString::test_nitrox()
|
||||
{
|
||||
struct dive dive;
|
||||
cylinder_t *cylinder = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cylinder = dive.get_or_create_cylinder(0);
|
||||
|
||||
cylinder->gasmix.o2.permille = 320;
|
||||
cylinder->start.mbar = 230000;
|
||||
|
|
@ -40,13 +40,13 @@ void TestformatDiveGasString::test_nitrox()
|
|||
void TestformatDiveGasString::test_nitrox_not_use()
|
||||
{
|
||||
struct dive dive;
|
||||
cylinder_t *cylinder = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cylinder = dive.get_or_create_cylinder(0);
|
||||
|
||||
cylinder->gasmix.o2.permille = 320;
|
||||
cylinder->start.mbar = 230000;
|
||||
cylinder->end.mbar = 100000;
|
||||
|
||||
cylinder = get_or_create_cylinder(&dive, 1);
|
||||
cylinder = dive.get_or_create_cylinder(1);
|
||||
|
||||
cylinder->gasmix.o2.permille = 1000;
|
||||
cylinder->cylinder_use = NOT_USED;
|
||||
|
|
@ -59,13 +59,13 @@ void TestformatDiveGasString::test_nitrox_not_use()
|
|||
void TestformatDiveGasString::test_nitrox_deco()
|
||||
{
|
||||
struct dive dive;
|
||||
cylinder_t *cylinder = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cylinder = dive.get_or_create_cylinder(0);
|
||||
|
||||
cylinder->gasmix.o2.permille = 320;
|
||||
cylinder->start.mbar = 230000;
|
||||
cylinder->end.mbar = 100000;
|
||||
|
||||
cylinder = get_or_create_cylinder(&dive, 1);
|
||||
cylinder = dive.get_or_create_cylinder(1);
|
||||
|
||||
cylinder->gasmix.o2.permille = 1000;
|
||||
cylinder->start.mbar = 230000;
|
||||
|
|
@ -77,13 +77,13 @@ void TestformatDiveGasString::test_nitrox_deco()
|
|||
void TestformatDiveGasString::test_reverse_nitrox_deco()
|
||||
{
|
||||
struct dive dive;
|
||||
cylinder_t *cylinder = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cylinder = dive.get_or_create_cylinder(0);
|
||||
|
||||
cylinder->gasmix.o2.permille = 1000;
|
||||
cylinder->start.mbar = 230000;
|
||||
cylinder->end.mbar = 100000;
|
||||
|
||||
cylinder = get_or_create_cylinder(&dive, 1);
|
||||
cylinder = dive.get_or_create_cylinder(1);
|
||||
|
||||
cylinder->gasmix.o2.permille = 270;
|
||||
cylinder->start.mbar = 230000;
|
||||
|
|
@ -95,7 +95,7 @@ void TestformatDiveGasString::test_reverse_nitrox_deco()
|
|||
void TestformatDiveGasString::test_trimix()
|
||||
{
|
||||
struct dive dive;
|
||||
cylinder_t *cylinder = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cylinder = dive.get_or_create_cylinder(0);
|
||||
|
||||
cylinder->gasmix.o2.permille = 210;
|
||||
cylinder->gasmix.he.permille = 350;
|
||||
|
|
@ -108,21 +108,21 @@ void TestformatDiveGasString::test_trimix()
|
|||
void TestformatDiveGasString::test_trimix_deco()
|
||||
{
|
||||
struct dive dive;
|
||||
cylinder_t *cylinder = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cylinder = dive.get_or_create_cylinder(0);
|
||||
|
||||
cylinder->gasmix.o2.permille = 210;
|
||||
cylinder->gasmix.he.permille = 350;
|
||||
cylinder->start.mbar = 230000;
|
||||
cylinder->end.mbar = 100000;
|
||||
|
||||
cylinder = get_or_create_cylinder(&dive, 1);
|
||||
cylinder = dive.get_or_create_cylinder(1);
|
||||
|
||||
cylinder->gasmix.o2.permille = 500;
|
||||
cylinder->gasmix.he.permille = 200;
|
||||
cylinder->start.mbar = 230000;
|
||||
cylinder->end.mbar = 100000;
|
||||
|
||||
cylinder = get_or_create_cylinder(&dive, 2);
|
||||
cylinder = dive.get_or_create_cylinder(2);
|
||||
|
||||
cylinder->gasmix.o2.permille = 1000;
|
||||
cylinder->start.mbar = 230000;
|
||||
|
|
@ -134,20 +134,20 @@ void TestformatDiveGasString::test_trimix_deco()
|
|||
void TestformatDiveGasString::test_reverse_trimix_deco()
|
||||
{
|
||||
struct dive dive;
|
||||
cylinder_t *cylinder = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cylinder = dive.get_or_create_cylinder(0);
|
||||
|
||||
cylinder->gasmix.o2.permille = 1000;
|
||||
cylinder->start.mbar = 230000;
|
||||
cylinder->end.mbar = 100000;
|
||||
|
||||
cylinder = get_or_create_cylinder(&dive, 1);
|
||||
cylinder = dive.get_or_create_cylinder(1);
|
||||
|
||||
cylinder->gasmix.o2.permille = 500;
|
||||
cylinder->gasmix.he.permille = 200;
|
||||
cylinder->start.mbar = 230000;
|
||||
cylinder->end.mbar = 100000;
|
||||
|
||||
cylinder = get_or_create_cylinder(&dive, 2);
|
||||
cylinder = dive.get_or_create_cylinder(2);
|
||||
|
||||
cylinder->gasmix.o2.permille = 210;
|
||||
cylinder->gasmix.he.permille = 350;
|
||||
|
|
@ -160,14 +160,14 @@ void TestformatDiveGasString::test_reverse_trimix_deco()
|
|||
void TestformatDiveGasString::test_trimix_and_nitrox_same_o2()
|
||||
{
|
||||
struct dive dive;
|
||||
cylinder_t *cylinder = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cylinder = dive.get_or_create_cylinder(0);
|
||||
|
||||
cylinder->gasmix.o2.permille = 250;
|
||||
cylinder->gasmix.he.permille = 0;
|
||||
cylinder->start.mbar = 230000;
|
||||
cylinder->end.mbar = 100000;
|
||||
|
||||
cylinder = get_or_create_cylinder(&dive, 1);
|
||||
cylinder = dive.get_or_create_cylinder(1);
|
||||
|
||||
cylinder->gasmix.o2.permille = 250;
|
||||
cylinder->gasmix.he.permille = 250;
|
||||
|
|
@ -180,14 +180,14 @@ void TestformatDiveGasString::test_trimix_and_nitrox_same_o2()
|
|||
void TestformatDiveGasString::test_trimix_and_nitrox_lower_o2()
|
||||
{
|
||||
struct dive dive;
|
||||
cylinder_t *cylinder = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cylinder = dive.get_or_create_cylinder(0);
|
||||
|
||||
cylinder->gasmix.o2.permille = 220;
|
||||
cylinder->gasmix.he.permille = 0;
|
||||
cylinder->start.mbar = 230000;
|
||||
cylinder->end.mbar = 100000;
|
||||
|
||||
cylinder = get_or_create_cylinder(&dive, 1);
|
||||
cylinder = dive.get_or_create_cylinder(1);
|
||||
|
||||
cylinder->gasmix.o2.permille = 250;
|
||||
cylinder->gasmix.he.permille = 250;
|
||||
|
|
@ -200,14 +200,14 @@ void TestformatDiveGasString::test_trimix_and_nitrox_lower_o2()
|
|||
void TestformatDiveGasString::test_ccr()
|
||||
{
|
||||
struct dive dive;
|
||||
cylinder_t *cylinder = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cylinder = dive.get_or_create_cylinder(0);
|
||||
|
||||
cylinder->gasmix.o2.permille = 1000;
|
||||
cylinder->cylinder_use = OXYGEN;
|
||||
cylinder->start.mbar = 230000;
|
||||
cylinder->end.mbar = 100000;
|
||||
|
||||
cylinder = get_or_create_cylinder(&dive, 1);
|
||||
cylinder = dive.get_or_create_cylinder(1);
|
||||
|
||||
cylinder->gasmix.o2.permille = 210;
|
||||
cylinder->gasmix.he.permille = 350;
|
||||
|
|
@ -221,14 +221,14 @@ void TestformatDiveGasString::test_ccr()
|
|||
void TestformatDiveGasString::test_ccr_bailout()
|
||||
{
|
||||
struct dive dive;
|
||||
cylinder_t *cylinder = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cylinder = dive.get_or_create_cylinder(0);
|
||||
|
||||
cylinder->gasmix.o2.permille = 1000;
|
||||
cylinder->cylinder_use = OXYGEN;
|
||||
cylinder->start.mbar = 230000;
|
||||
cylinder->end.mbar = 100000;
|
||||
|
||||
cylinder = get_or_create_cylinder(&dive, 1);
|
||||
cylinder = dive.get_or_create_cylinder(1);
|
||||
|
||||
cylinder->gasmix.o2.permille = 220;
|
||||
cylinder->gasmix.he.permille = 200;
|
||||
|
|
@ -236,7 +236,7 @@ void TestformatDiveGasString::test_ccr_bailout()
|
|||
cylinder->start.mbar = 230000;
|
||||
cylinder->end.mbar = 100000;
|
||||
|
||||
cylinder = get_or_create_cylinder(&dive, 2);
|
||||
cylinder = dive.get_or_create_cylinder(2);
|
||||
|
||||
cylinder->gasmix.o2.permille = 210;
|
||||
cylinder->gasmix.he.permille = 0;
|
||||
|
|
|
|||
|
|
@ -55,9 +55,9 @@ void setupPlan(struct diveplan *dp)
|
|||
// Note: we add the highest-index cylinder first, because
|
||||
// pointers to cylinders are not stable when reallocating.
|
||||
// For testing OK - don't do this in actual code!
|
||||
cylinder_t *cyl2 = get_or_create_cylinder(&dive, 2);
|
||||
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||
cylinder_t *cyl2 = dive.get_or_create_cylinder(2);
|
||||
cylinder_t *cyl0 = dive.get_or_create_cylinder(0);
|
||||
cylinder_t *cyl1 = dive.get_or_create_cylinder(1);
|
||||
cyl0->gasmix = bottomgas;
|
||||
cyl0->type.size.mliter = 36000;
|
||||
cyl0->type.workingpressure.mbar = 232000;
|
||||
|
|
@ -89,9 +89,9 @@ void setupPlanVpmb45m30mTx(struct diveplan *dp)
|
|||
// Note: we add the highest-index cylinder first, because
|
||||
// pointers to cylinders are not stable when reallocating.
|
||||
// For testing OK - don't do this in actual code!
|
||||
cylinder_t *cyl2 = get_or_create_cylinder(&dive, 2);
|
||||
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||
cylinder_t *cyl2 = dive.get_or_create_cylinder(2);
|
||||
cylinder_t *cyl0 = dive.get_or_create_cylinder(0);
|
||||
cylinder_t *cyl1 = dive.get_or_create_cylinder(1);
|
||||
cyl0->gasmix = bottomgas;
|
||||
cyl0->type.size.mliter = 24000;
|
||||
cyl0->type.workingpressure.mbar = 232000;
|
||||
|
|
@ -123,9 +123,9 @@ void setupPlanVpmb60m10mTx(struct diveplan *dp)
|
|||
// Note: we add the highest-index cylinder first, because
|
||||
// pointers to cylinders are not stable when reallocating.
|
||||
// For testing OK - don't do this in actual code!
|
||||
cylinder_t *cyl2 = get_or_create_cylinder(&dive, 2);
|
||||
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||
cylinder_t *cyl2 = dive.get_or_create_cylinder(2);
|
||||
cylinder_t *cyl0 = dive.get_or_create_cylinder(0);
|
||||
cylinder_t *cyl1 = dive.get_or_create_cylinder(1);
|
||||
cyl0->gasmix = bottomgas;
|
||||
cyl0->type.size.mliter = 24000;
|
||||
cyl0->type.workingpressure.mbar = 232000;
|
||||
|
|
@ -149,7 +149,7 @@ void setupPlanVpmb60m30minAir(struct diveplan *dp)
|
|||
dp->decosac = prefs.decosac;
|
||||
|
||||
struct gasmix bottomgas = {{210}, {0}};
|
||||
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cyl0 = dive.get_or_create_cylinder(0);
|
||||
cyl0->gasmix = bottomgas;
|
||||
cyl0->type.size.mliter = 100000;
|
||||
cyl0->type.workingpressure.mbar = 232000;
|
||||
|
|
@ -175,8 +175,8 @@ void setupPlanVpmb60m30minEan50(struct diveplan *dp)
|
|||
// Note: we add the highest-index cylinder first, because
|
||||
// pointers to cylinders are not stable when reallocating.
|
||||
// For testing OK - don't do this in actual code!
|
||||
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cyl1 = dive.get_or_create_cylinder(1);
|
||||
cylinder_t *cyl0 = dive.get_or_create_cylinder(0);
|
||||
cyl0->gasmix = bottomgas;
|
||||
cyl0->type.size.mliter = 36000;
|
||||
cyl0->type.workingpressure.mbar = 232000;
|
||||
|
|
@ -204,8 +204,8 @@ void setupPlanVpmb60m30minTx(struct diveplan *dp)
|
|||
// Note: we add the highest-index cylinder first, because
|
||||
// pointers to cylinders are not stable when reallocating.
|
||||
// For testing OK - don't do this in actual code!
|
||||
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cyl1 = dive.get_or_create_cylinder(1);
|
||||
cylinder_t *cyl0 = dive.get_or_create_cylinder(0);
|
||||
cyl0->gasmix = bottomgas;
|
||||
cyl0->type.size.mliter = 36000;
|
||||
cyl0->type.workingpressure.mbar = 232000;
|
||||
|
|
@ -228,7 +228,7 @@ void setupPlanVpmbMultiLevelAir(struct diveplan *dp)
|
|||
dp->decosac = prefs.decosac;
|
||||
|
||||
struct gasmix bottomgas = {{210}, {0}};
|
||||
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cyl0 = dive.get_or_create_cylinder(0);
|
||||
cyl0->gasmix = bottomgas;
|
||||
cyl0->type.size.mliter = 200000;
|
||||
cyl0->type.workingpressure.mbar = 232000;
|
||||
|
|
@ -257,9 +257,9 @@ void setupPlanVpmb100m60min(struct diveplan *dp)
|
|||
// Note: we add the highest-index cylinder first, because
|
||||
// pointers to cylinders are not stable when reallocating.
|
||||
// For testing OK - don't do this in actual code!
|
||||
cylinder_t *cyl2 = get_or_create_cylinder(&dive, 2);
|
||||
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||
cylinder_t *cyl2 = dive.get_or_create_cylinder(2);
|
||||
cylinder_t *cyl0 = dive.get_or_create_cylinder(0);
|
||||
cylinder_t *cyl1 = dive.get_or_create_cylinder(1);
|
||||
cyl0->gasmix = bottomgas;
|
||||
cyl0->type.size.mliter = 200000;
|
||||
cyl0->type.workingpressure.mbar = 232000;
|
||||
|
|
@ -290,9 +290,9 @@ void setupPlanVpmb100m10min(struct diveplan *dp)
|
|||
// Note: we add the highest-index cylinder first, because
|
||||
// pointers to cylinders are not stable when reallocating.
|
||||
// For testing OK - don't do this in actual code!
|
||||
cylinder_t *cyl2 = get_or_create_cylinder(&dive, 2);
|
||||
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||
cylinder_t *cyl2 = dive.get_or_create_cylinder(2);
|
||||
cylinder_t *cyl0 = dive.get_or_create_cylinder(0);
|
||||
cylinder_t *cyl1 = dive.get_or_create_cylinder(1);
|
||||
cyl0->gasmix = bottomgas;
|
||||
cyl0->type.size.mliter = 60000;
|
||||
cyl0->type.workingpressure.mbar = 232000;
|
||||
|
|
@ -317,7 +317,7 @@ void setupPlanVpmb30m20min(struct diveplan *dp)
|
|||
dp->decosac = prefs.decosac;
|
||||
|
||||
struct gasmix bottomgas = {{210}, {0}};
|
||||
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cyl0 = dive.get_or_create_cylinder(0);
|
||||
cyl0->gasmix = bottomgas;
|
||||
cyl0->type.size.mliter = 36000;
|
||||
cyl0->type.workingpressure.mbar = 232000;
|
||||
|
|
@ -345,10 +345,10 @@ void setupPlanVpmb100mTo70m30min(struct diveplan *dp)
|
|||
// Note: we add the highest-index cylinder first, because
|
||||
// pointers to cylinders are not stable when reallocating.
|
||||
// For testing OK - don't do this in actual code!
|
||||
cylinder_t *cyl3 = get_or_create_cylinder(&dive, 3);
|
||||
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||
cylinder_t *cyl2 = get_or_create_cylinder(&dive, 2);
|
||||
cylinder_t *cyl3 = dive.get_or_create_cylinder(3);
|
||||
cylinder_t *cyl0 = dive.get_or_create_cylinder(0);
|
||||
cylinder_t *cyl1 = dive.get_or_create_cylinder(1);
|
||||
cylinder_t *cyl2 = dive.get_or_create_cylinder(2);
|
||||
cyl0->gasmix = bottomgas;
|
||||
cyl0->type.size.mliter = 36000;
|
||||
cyl0->type.workingpressure.mbar = 232000;
|
||||
|
|
@ -384,8 +384,8 @@ void setupPlanSeveralGases(struct diveplan *dp)
|
|||
// Note: we add the highest-index cylinder first, because
|
||||
// pointers to cylinders are not stable when reallocating.
|
||||
// For testing OK - don't do this in actual code!
|
||||
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cyl1 = dive.get_or_create_cylinder(1);
|
||||
cylinder_t *cyl0 = dive.get_or_create_cylinder(0);
|
||||
cyl0->gasmix = ean36;
|
||||
cyl0->type.size.mliter = 36000;
|
||||
cyl0->type.workingpressure.mbar = 232000;
|
||||
|
|
@ -416,9 +416,9 @@ void setupPlanCcr(struct diveplan *dp)
|
|||
// Note: we add the highest-index cylinder first, because
|
||||
// pointers to cylinders are not stable when reallocating.
|
||||
// For testing OK - don't do this in actual code!
|
||||
cylinder_t *cyl2 = get_or_create_cylinder(&dive, 2);
|
||||
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||
cylinder_t *cyl2 = dive.get_or_create_cylinder(2);
|
||||
cylinder_t *cyl0 = dive.get_or_create_cylinder(0);
|
||||
cylinder_t *cyl1 = dive.get_or_create_cylinder(1);
|
||||
cyl0->gasmix = diluent;
|
||||
cyl0->depth = dive.gas_mod(diluent, po2, M_OR_FT(3, 10));
|
||||
cyl0->type.size.mliter = 3000;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue