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
35
|
#include "fracture.h"
net_t *net_copy(const net_t *net, cholmod_common *c) {
net_t *net_copy = (net_t *)calloc(1, sizeof(net_t));
assert(net_copy != NULL);
memcpy(net_copy, net, sizeof(net_t));
size_t fuses_size = (net->graph)->ne * sizeof(bool);
net_copy->fuses = (bool *)malloc(fuses_size);
assert(net_copy->fuses != NULL);
memcpy(net_copy->fuses, net->fuses, fuses_size);
size_t thres_size = (net->graph)->ne * sizeof(double);
net_copy->thres = (double *)malloc(thres_size);
assert(net_copy->thres != NULL);
memcpy(net_copy->thres, net->thres, thres_size);
size_t marks_size = (net->graph->break_dim) * sizeof(uint_t);
net_copy->marks = (uint_t *)malloc(marks_size);
assert(net_copy->marks != NULL);
memcpy(net_copy->marks, net->marks, marks_size);
size_t dual_marks_size = (net->graph->dnv) * sizeof(uint_t);
net_copy->dual_marks = (uint_t *)malloc(dual_marks_size);
assert(net_copy->dual_marks != NULL);
memcpy(net_copy->dual_marks, net->dual_marks, dual_marks_size);
net_copy->adjacency = CHOL_F(copy_sparse)(net->adjacency, c);
net_copy->boundary_cond = CHOL_F(copy_dense)(net->boundary_cond, c);
net_copy->factor = CHOL_F(copy_factor)(net->factor, c);
return net_copy;
}
|