FrontISTR 5.2.0
Large-scale structural analysis program with finit element method
Loading...
Searching...
No Matches
hecmw_dist.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.h"
10#include "hecmw_util.h"
11#include "hecmw_struct.h"
12
14 const char *name) {
15 static int i;
16
17 if (mat == NULL) return -1;
18
19 if (name == NULL) return -1;
20
21 if (i < mat->n_mat) {
22 if (strcmp(mat->mat_name[i], name) == 0) {
23 i++;
24 return i;
25 }
26 }
27
28 for (i = 0; i < mat->n_mat; i++) {
29 if (strcmp(mat->mat_name[i], name) == 0) {
30 i++;
31 return i;
32 }
33 }
34
35 return -1;
36}
37
39 const char *name) {
40 static int i;
41
42 if (ngrp == NULL) return -1;
43
44 if (name == NULL) return -1;
45
46 if (i < ngrp->n_grp) {
47 if (strcmp(ngrp->grp_name[i], name) == 0) {
48 i++;
49 return i;
50 }
51 }
52
53 for (i = 0; i < ngrp->n_grp; i++) {
54 if (strcmp(ngrp->grp_name[i], name) == 0) {
55 i++;
56 return i;
57 }
58 }
59
60 return -1;
61}
62
64 const char *name) {
65 static int i = 0;
66
67 if (egrp == NULL) return -1;
68
69 if (name == NULL) return -1;
70
71 if (i < egrp->n_grp) {
72 if (strcmp(egrp->grp_name[i], name) == 0) {
73 i++;
74 return i;
75 }
76 }
77
78 for (i = 0; i < egrp->n_grp; i++) {
79 if (strcmp(egrp->grp_name[i], name) == 0) {
80 i++;
81 return i;
82 }
83 }
84
85 return -1;
86}
87
89 const char *name) {
90 static int i;
91
92 if (sgrp == NULL) return -1;
93
94 if (name == NULL) return -1;
95
96 if (i < sgrp->n_grp) {
97 if (strcmp(sgrp->grp_name[i], name) == 0) {
98 i++;
99 return i;
100 }
101 }
102
103 for (i = 0; i < sgrp->n_grp; i++) {
104 if (strcmp(sgrp->grp_name[i], name) == 0) {
105 i++;
106 return i;
107 }
108 }
109
110 return -1;
111}
112
113int HECMW_dist_gid2lid_node(const struct hecmwST_local_mesh *mesh, int gid) {
114 static int i;
115
116 if (mesh == NULL) return -1;
117
118 if (i < mesh->n_node) {
119 if (mesh->global_node_ID[i] == gid) {
120 i++;
121 return i;
122 }
123 }
124
125 for (i = 0; i < mesh->n_node; i++) {
126 if (mesh->global_node_ID[i] == gid) {
127 i++;
128 return i;
129 }
130 }
131
132 return -1;
133}
134
135int HECMW_dist_gid2lid_elem(const struct hecmwST_local_mesh *mesh, int gid) {
136 static int i;
137
138 if (mesh == NULL) return -1;
139
140 if (i < mesh->n_elem) {
141 if (mesh->global_elem_ID[i] == gid) {
142 i++;
143 return i;
144 }
145 }
146
147 for (i = 0; i < mesh->n_elem; i++) {
148 if (mesh->global_elem_ID[i] == gid) {
149 i++;
150 return i;
151 }
152 }
153
154 return -1;
155}
int HECMW_dist_gid2lid_elem(const struct hecmwST_local_mesh *mesh, int gid)
Definition: hecmw_dist.c:135
int HECMW_dist_get_mat_id(const struct hecmwST_material *mat, const char *name)
Definition: hecmw_dist.c:13
int HECMW_dist_get_ngrp_id(const struct hecmwST_node_grp *ngrp, const char *name)
Definition: hecmw_dist.c:38
int HECMW_dist_gid2lid_node(const struct hecmwST_local_mesh *mesh, int gid)
Definition: hecmw_dist.c:113
int HECMW_dist_get_egrp_id(const struct hecmwST_elem_grp *egrp, const char *name)
Definition: hecmw_dist.c:63
int HECMW_dist_get_sgrp_id(const struct hecmwST_surf_grp *sgrp, const char *name)
Definition: hecmw_dist.c:88
struct hecmwST_local_mesh * mesh
Definition: hecmw_repart.h:71
#define NULL