summaryrefslogtreecommitdiff
path: root/lib/data.c
diff options
context:
space:
mode:
authorJaron <jaron@kent-dobias.com>2017-06-22 22:40:47 -0400
committerJaron <jaron@kent-dobias.com>2017-06-22 22:40:47 -0400
commitd59fc339a40a47405bfef8c1313e324adca70479 (patch)
treeaddf46044c3a1507bd4069797c6218c457b67e5f /lib/data.c
parentf4a50f1332ff323c42aa9664292910fd78933c15 (diff)
parent4764d5d407347d4dd5990411b243b3ec4bd75bff (diff)
downloadfuse_networks-d59fc339a40a47405bfef8c1313e324adca70479.tar.gz
fuse_networks-d59fc339a40a47405bfef8c1313e324adca70479.tar.bz2
fuse_networks-d59fc339a40a47405bfef8c1313e324adca70479.zip
lots of changes for merge
Diffstat (limited to 'lib/data.c')
-rw-r--r--lib/data.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/data.c b/lib/data.c
new file mode 100644
index 0000000..2047c44
--- /dev/null
+++ b/lib/data.c
@@ -0,0 +1,35 @@
+
+#include "fracture.h"
+
+data_t *data_create(uint_t ne) {
+ data_t *data = malloc(1 * sizeof(data_t));
+ assert(data != NULL);
+
+ data->num_broken = 0;
+
+ data->break_list = (uint_t *)malloc(ne * sizeof(uint_t));
+ assert(data->break_list != NULL);
+
+ data->extern_field = (long double *)malloc(ne * sizeof(long double));
+ assert(data->extern_field != NULL);
+
+ data->conductivity = (double *)malloc(ne * sizeof(double));
+ assert(data->conductivity != NULL);
+
+ return data;
+}
+
+void data_free(data_t *data) {
+ free(data->break_list);
+ free(data->extern_field);
+ free(data->conductivity);
+ free(data);
+}
+
+void data_update(data_t *data, uint_t last_broke, long double strength, double conductivity) {
+ data->break_list[data->num_broken] = last_broke;
+ data->extern_field[data->num_broken] = strength;
+ data->conductivity[data->num_broken] = conductivity;
+ data->num_broken++;
+}
+