blob: 0ce6730a50a1c6799a81f970a8939b8d16457f7b (
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
|
#include "fracture.h"
break_data *alloc_break_data(unsigned int num_edges) {
break_data *data = malloc(1 * sizeof(break_data)); assert(data != NULL);
data->num_broken = 0;
data->break_list = (unsigned int *)malloc(num_edges * sizeof(unsigned int));
assert(data->break_list != NULL);
data->extern_field = (double *)malloc(num_edges * sizeof(double));
assert(data->extern_field != NULL);
data->conductivity = (double *)malloc(num_edges * sizeof(double));
assert(data->conductivity != NULL);
return data;
}
void free_break_data(break_data *data) {
free(data->break_list);
free(data->extern_field);
free(data->conductivity);
free(data);
}
void update_break_data(break_data *data, unsigned int last_broke, 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++;
}
|