FrontISTR 5.2.0
Large-scale structural analysis program with finit element method
Loading...
Searching...
No Matches
hecmw_put_mesh_if.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_struct.h"
10#include "hecmw_util.h"
11#include "hecmw_dist_copy_f2c.h"
12#include "hecmw_io_put_mesh.h"
13#include "hecmw_dist_free.h"
14
15static struct hecmwST_local_mesh *mesh;
16
17static int alloc_struct(void) {
18 mesh = HECMW_malloc(sizeof(*mesh));
19 if (mesh == NULL) {
20 HECMW_set_error(errno, "");
21 return -1;
22 }
23
24 mesh->section = HECMW_malloc(sizeof(*mesh->section));
25 if (mesh->section == NULL) {
26 HECMW_set_error(errno, "");
27 return -1;
28 }
29
30 mesh->material = HECMW_malloc(sizeof(*mesh->material));
31 if (mesh->material == NULL) {
32 HECMW_set_error(errno, "");
33 return -1;
34 }
35
36 mesh->mpc = HECMW_malloc(sizeof(*mesh->mpc));
37 if (mesh->mpc == NULL) {
38 HECMW_set_error(errno, "");
39 return -1;
40 }
41
42 mesh->amp = HECMW_malloc(sizeof(*mesh->amp));
43 if (mesh->amp == NULL) {
44 HECMW_set_error(errno, "");
45 return -1;
46 }
47
48 mesh->node_group = HECMW_malloc(sizeof(*mesh->node_group));
49 if (mesh->node_group == NULL) {
50 HECMW_set_error(errno, "");
51 return -1;
52 }
53
54 mesh->elem_group = HECMW_malloc(sizeof(*mesh->elem_group));
55 if (mesh->elem_group == NULL) {
56 HECMW_set_error(errno, "");
57 return -1;
58 }
59
60 mesh->surf_group = HECMW_malloc(sizeof(*mesh->surf_group));
61 if (mesh->surf_group == NULL) {
62 HECMW_set_error(errno, "");
63 return -1;
64 }
65
66 mesh->contact_pair = HECMW_malloc(sizeof(*mesh->contact_pair));
67 if (mesh->contact_pair == NULL) {
68 HECMW_set_error(errno, "");
69 return -1;
70 }
71
72 return 0;
73}
74
75/*----------------------------------------------------------------------------*/
76
77void hecmw_put_mesh_if(char *name_ID, int *err, int len) {
78 char cname[HECMW_NAME_LEN + 1];
79
80 *err = 1;
81
82 if (HECMW_strcpy_f2c_r(name_ID, len, cname, sizeof(cname)) == NULL) {
83 return;
84 }
85
86 if (HECMW_put_mesh(mesh, cname)) {
87 return;
88 }
89
90 *err = 0;
91}
92
93void hecmw_put_mesh_if_(char *name_ID, int *err, int len) {
94 hecmw_put_mesh_if(name_ID, err, len);
95}
96
97void hecmw_put_mesh_if__(char *name_ID, int *err, int len) {
98 hecmw_put_mesh_if(name_ID, err, len);
99}
100
101void HECMW_PUT_MESH_IF(char *name_ID, int *err, int len) {
102 hecmw_put_mesh_if(name_ID, err, len);
103}
104
105/*----------------------------------------------------------------------------*/
106
108 *err = 1;
109
110 if (alloc_struct()) {
111 return;
112 }
113
114 if (HECMW_dist_copy_f2c_init(mesh)) {
115 return;
116 }
117
118 *err = 0;
119}
120
122
124
126
127/*----------------------------------------------------------------------------*/
128
130 *err = 1;
131
133 return;
134 }
135 HECMW_dist_free(mesh);
136 mesh = NULL;
137
138 *err = 0;
139}
140
142
144
#define HECMW_NAME_LEN
Definition: hecmw_config.h:70
int HECMW_dist_copy_f2c_init(struct hecmwST_local_mesh *local_mesh)
int HECMW_dist_copy_f2c_finalize(void)
void HECMW_dist_free(struct hecmwST_local_mesh *mesh)
int HECMW_set_error(int errorno, const char *fmt,...)
Definition: hecmw_error.c:37
#define NULL
int HECMW_put_mesh(struct hecmwST_local_mesh *mesh, char *name_ID)
char * HECMW_strcpy_f2c_r(const char *fstr, int flen, char *buf, int bufsize)
Definition: hecmw_lib_fc.c:45
#define HECMW_malloc(size)
Definition: hecmw_malloc.h:20
void hecmw_put_mesh_finalize_if_(int *err)
void hecmw_put_mesh_finalize_if(int *err)
void hecmw_put_mesh_init_if(int *err)
void hecmw_put_mesh_if(char *name_ID, int *err, int len)
void hecmw_put_mesh_init_if_(int *err)
void HECMW_PUT_MESH_FINALIZE_IF(int *err)
void hecmw_put_mesh_if__(char *name_ID, int *err, int len)
void hecmw_put_mesh_init_if__(int *err)
void HECMW_PUT_MESH_IF(char *name_ID, int *err, int len)
void HECMW_PUT_MESH_INIT_IF(int *err)
void hecmw_put_mesh_finalize_if__(int *err)
void hecmw_put_mesh_if_(char *name_ID, int *err, int len)
struct hecmwST_section * section
Definition: hecmw_struct.h:244
struct hecmwST_amplitude * amp
Definition: hecmw_struct.h:247
struct hecmwST_material * material
Definition: hecmw_struct.h:245
struct hecmwST_mpc * mpc
Definition: hecmw_struct.h:246
struct hecmwST_node_grp * node_group
Definition: hecmw_struct.h:248
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