FrontISTR 5.2.0
Large-scale structural analysis program with finit element method
Loading...
Searching...
No Matches
hecmw_dist_free.c
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright (c) 2019 FrontISTR Commons
3 * This software is released under the MIT License, see LICENSE.txt
4 *****************************************************************************/
5
6#include <stdio.h>
7#include <stdlib.h>
8#include <errno.h>
9#include "hecmw_dist_free.h"
10#include "hecmw_dist_alloc.h"
11#include "hecmw_util.h"
12#include "hecmw_struct.h"
13
14static void free_section(struct hecmwST_section *section) {
15 if (section == NULL) return;
16 HECMW_free(section->sect_type);
17 HECMW_free(section->sect_opt);
20 HECMW_free(section->sect_I_index);
21 HECMW_free(section->sect_I_item);
22 HECMW_free(section->sect_R_index);
23 HECMW_free(section->sect_R_item);
24}
25
26static void free_material(struct hecmwST_material *material) {
27 int i;
28
29 if (material == NULL) return;
30 for (i = 0; i < material->n_mat; i++) {
31 HECMW_free(material->mat_name[i]);
32 }
33 HECMW_free(material->mat_name);
34 HECMW_free(material->mat_item_index);
36 HECMW_free(material->mat_table_index);
37 HECMW_free(material->mat_val);
38 HECMW_free(material->mat_temp);
39}
40
41static void free_mpc(struct hecmwST_mpc *mpc) {
42 if (mpc == NULL) return;
44 HECMW_free(mpc->mpc_item);
45 HECMW_free(mpc->mpc_dof);
46 HECMW_free(mpc->mpc_val);
48}
49
50static void free_amplitude(struct hecmwST_amplitude *amp) {
51 int i;
52
53 if (amp == NULL) return;
54
55 for (i = 0; i < amp->n_amp; i++) {
56 HECMW_free(amp->amp_name[i]);
57 }
58 HECMW_free(amp->amp_name);
63 HECMW_free(amp->amp_val);
65}
66
67static void free_ngrp(struct hecmwST_node_grp *grp) {
68 int i;
69
70 if (grp == NULL) return;
71
72 for (i = 0; i < grp->n_grp; i++) {
73 HECMW_free(grp->grp_name[i]);
74 }
75 HECMW_free(grp->grp_name);
77 HECMW_free(grp->grp_item);
83}
84
85static void free_egrp(struct hecmwST_elem_grp *grp) {
86 int i;
87
88 if (grp == NULL) return;
89
90 for (i = 0; i < grp->n_grp; i++) {
91 HECMW_free(grp->grp_name[i]);
92 }
93 HECMW_free(grp->grp_name);
95 HECMW_free(grp->grp_item);
100}
101
102static void free_sgrp(struct hecmwST_surf_grp *grp) {
103 int i;
104
105 if (grp == NULL) return;
106
107 for (i = 0; i < grp->n_grp; i++) {
108 HECMW_free(grp->grp_name[i]);
109 }
110 HECMW_free(grp->grp_name);
111 HECMW_free(grp->grp_index);
112 HECMW_free(grp->grp_item);
113 HECMW_free(grp->bc_grp_ID);
117}
118
119static void free_contact_pair(struct hecmwST_contact_pair *cpair) {
120 int i;
121
122 if (cpair == NULL) return;
123
124 for (i = 0; i < cpair->n_pair; i++) {
125 HECMW_free(cpair->name[i]);
126 }
127
128 HECMW_free(cpair->type);
129 HECMW_free(cpair->name);
130 HECMW_free(cpair->slave_grp_id);
133}
134
135static void free_refine_origin(struct hecmwST_refine_origin *reforg) {
136 int i;
137
138 if (reforg == NULL) return;
139
140 HECMW_free(reforg->index);
141 HECMW_free(reforg->item_index);
142 HECMW_free(reforg->item_item);
143}
144
146 int i;
147
148 if (mesh == NULL) return;
149
150 for (i = 0; i < mesh->hecmw_n_file; i++) {
151 HECMW_free(mesh->files[i]);
152 }
154
165
181
189
198
204
205 free_section(mesh->section);
206 free_material(mesh->material);
207 free_mpc(mesh->mpc);
208 free_amplitude(mesh->amp);
209 free_ngrp(mesh->node_group);
210 free_egrp(mesh->elem_group);
211 free_sgrp(mesh->surf_group);
212 free_contact_pair(mesh->contact_pair);
213 free_refine_origin(mesh->refine_origin);
214
216}
217
219 if (mesh == NULL) return;
220
222
232
234}
int HECMW_dist_init(struct hecmwST_local_mesh *mesh)
void HECMW_dist_free(struct hecmwST_local_mesh *mesh)
void HECMW_dist_clean(struct hecmwST_local_mesh *mesh)
struct hecmwST_local_mesh * mesh
Definition: hecmw_repart.h:71
#define NULL
#define HECMW_free(ptr)
Definition: hecmw_malloc.h:24
int * amp_type_definition
Definition: hecmw_struct.h:61
double * amp_table
Definition: hecmw_struct.h:72
double * bc_grp_val
Definition: hecmw_struct.h:103
struct hecmwST_section * section
Definition: hecmw_struct.h:244
double * elem_val_item
Definition: hecmw_struct.h:204
double * elem_mat_int_val
Definition: hecmw_struct.h:202
struct hecmwST_amplitude * amp
Definition: hecmw_struct.h:247
struct hecmwST_material * material
Definition: hecmw_struct.h:245
struct hecmwST_refine_origin * refine_origin
Definition: hecmw_struct.h:252
double * node_val_item
Definition: hecmw_struct.h:177
struct hecmwST_mpc * mpc
Definition: hecmw_struct.h:246
struct hecmwST_node_grp * node_group
Definition: hecmw_struct.h:248
double * node_init_val_item
Definition: hecmw_struct.h:180
struct hecmwST_contact_pair * contact_pair
Definition: hecmw_struct.h:251
struct hecmwST_surf_grp * surf_group
Definition: hecmw_struct.h:250
struct hecmwST_elem_grp * elem_group
Definition: hecmw_struct.h:249
int * when_i_was_refined_node
Definition: hecmw_struct.h:226
int * when_i_was_refined_elem
Definition: hecmw_struct.h:227
int * mat_subitem_index
Definition: hecmw_struct.h:42
double * mat_val
Definition: hecmw_struct.h:44
double * mat_temp
Definition: hecmw_struct.h:45
int * mpc_dof
Definition: hecmw_struct.h:52
double * mpc_val
Definition: hecmw_struct.h:53
double * mpc_const
Definition: hecmw_struct.h:54
int * mpc_index
Definition: hecmw_struct.h:50
int * mpc_item
Definition: hecmw_struct.h:51
double * bc_grp_val
Definition: hecmw_struct.h:89
double * sect_R_item
Definition: hecmw_struct.h:32
int * sect_mat_ID_index
Definition: hecmw_struct.h:27
int * sect_mat_ID_item
Definition: hecmw_struct.h:28
double * bc_grp_val
Definition: hecmw_struct.h:118