tCheck simulation size before initializing arrays - cngf-pf - continuum model f… | |
git clone git://src.adamsgaard.dk/cngf-pf | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit a4b9b3cadad2a9cc40ea76c202bfebb91fecdeb5 | |
parent 3c032ad517b519a8b500dc877e3a6ce2067b770b | |
Author: Anders Damsgaard <[email protected]> | |
Date: Wed, 11 Dec 2019 13:09:50 +0100 | |
Check simulation size before initializing arrays | |
Diffstat: | |
M max_depth_simple_shear.c | 1 + | |
M simulation.c | 5 +++++ | |
2 files changed, 6 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/max_depth_simple_shear.c b/max_depth_simple_shear.c | |
t@@ -187,6 +187,7 @@ main(int argc, char* argv[]) | |
return 1; | |
}*/ | |
+ sim.nz = 1; | |
prepare_arrays(&sim); | |
if (!isnan(new_phi)) | |
diff --git a/simulation.c b/simulation.c | |
t@@ -9,6 +9,11 @@ | |
void | |
prepare_arrays(struct simulation* sim) | |
{ | |
+ if (sim->nz < 2) { | |
+ fprintf(stderr, "error: grid size (nz) must be at least 2 but … | |
+ sim->nz); | |
+ exit(1); | |
+ } | |
sim->z = linspace(sim->origo_z, /* spatial coordinates */ | |
sim->origo_z + sim->L_z, | |
sim->nz); |