FrontISTR 5.2.0
Large-scale structural analysis program with finit element method
Loading...
Searching...
No Matches
hecmw_dist_copy_c2f.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 "hecmw_struct.h"
9#include "hecmw_util.h"
10#include "hecmw_dist_free.h"
11#include "hecmw_io_get_mesh.h"
12#include "hecmw_dist_copy_c2f.h"
13
14static struct hecmwST_local_mesh *mesh;
15
16/*-----------------------------------------------------------------------------
17 * SetFunc
18 */
19
20static int set_hecmw_flag_adapt(void *dst) {
21 void *src;
22 int size;
23
24 src = &mesh->hecmw_flag_adapt;
25 size = sizeof(mesh->hecmw_flag_adapt);
26 memcpy(dst, src, size);
27
28 return 0;
29}
30
31static int set_hecmw_flag_initcon(void *dst) {
32 void *src;
33 int size;
34
35 src = &mesh->hecmw_flag_initcon;
36 size = sizeof(mesh->hecmw_flag_initcon);
37 memcpy(dst, src, size);
38
39 return 0;
40}
41
42static int set_hecmw_flag_parttype(void *dst) {
43 void *src;
44 int size;
45
46 src = &mesh->hecmw_flag_parttype;
47 size = sizeof(mesh->hecmw_flag_parttype);
48 memcpy(dst, src, size);
49
50 return 0;
51}
52
53static int set_hecmw_flag_partdepth(void *dst) {
54 void *src;
55 int size;
56
57 src = &mesh->hecmw_flag_partdepth;
58 size = sizeof(mesh->hecmw_flag_partdepth);
59 memcpy(dst, src, size);
60 return 0;
61}
62
63static int set_hecmw_flag_version(void *dst) {
64 void *src;
65 int size;
66
67 src = &mesh->hecmw_flag_version;
68 size = sizeof(mesh->hecmw_flag_version);
69 memcpy(dst, src, size);
70
71 return 0;
72}
73
74static int set_hecmw_flag_partcontact(void *dst) {
75 void *src;
76 int size;
77
78 src = &mesh->hecmw_flag_partcontact;
79 size = sizeof(mesh->hecmw_flag_partcontact);
80 memcpy(dst, src, size);
81
82 return 0;
83}
84
85static int set_gridfile(void *dst) {
86 void *src;
87
88 src = mesh->gridfile;
90
91 return 0;
92}
93
94static int set_hecmw_n_file(void *dst) {
95 void *src;
96 int size;
97
98 src = &mesh->hecmw_n_file;
99 size = sizeof(mesh->hecmw_n_file);
100 memcpy(dst, src, size);
101
102 return 0;
103}
104
105static int set_files(void *dst) {
106 int i;
107
108 if (mesh->hecmw_n_file <= 0) return 0;
109
110 for (i = 0; i < mesh->hecmw_n_file; i++) {
111 char *dst_point = (char *)dst + HECMW_FILENAME_LEN * i;
112 char *src = mesh->files[i];
113 HECMW_strcpy_c2f(src, dst_point, HECMW_FILENAME_LEN);
114 }
115
116 return 0;
117}
118
119static int set_header(void *dst) {
120 void *src;
121
122 src = mesh->header;
124
125 return 0;
126}
127
128static int set_zero_temp(void *dst) {
129 void *src;
130 int size;
131
132 src = &mesh->zero_temp;
133 size = sizeof(mesh->zero_temp);
134 memcpy(dst, src, size);
135
136 return 0;
137}
138
139static int set_n_node(void *dst) {
140 void *src;
141 int size;
142
143 src = &mesh->n_node;
144 size = sizeof(mesh->n_node);
145 memcpy(dst, src, size);
146
147 return 0;
148}
149
150static int set_n_node_gross(void *dst) {
151 void *src;
152 int size;
153
154 src = &mesh->n_node_gross;
155 size = sizeof(mesh->n_node_gross);
156 memcpy(dst, src, size);
157
158 return 0;
159}
160
161static int set_nn_middle(void *dst) {
162 void *src;
163 int size;
164
165 src = &mesh->nn_middle;
166 size = sizeof(mesh->nn_middle);
167 memcpy(dst, src, size);
168
169 return 0;
170}
171
172static int set_nn_internal(void *dst) {
173 void *src;
174 int size;
175
176 src = &mesh->nn_internal;
177 size = sizeof(mesh->nn_internal);
178 memcpy(dst, src, size);
179
180 return 0;
181}
182
183static int set_node_internal_list(void *dst) {
184 void *src;
185 int size;
186
187 if (mesh->nn_internal <= 0) return 0;
188
189 src = mesh->node_internal_list;
190 size = sizeof(*mesh->node_internal_list) * mesh->nn_internal;
191 memcpy(dst, src, size);
192
193 return 0;
194}
195
196static int set_node_ID(void *dst) {
197 void *src;
198 int size;
199
200 if (mesh->n_node_gross <= 0) return 0;
201
202 src = mesh->node_ID;
203 size = sizeof(*mesh->node_ID) * mesh->n_node_gross * 2;
204 memcpy(dst, src, size);
205
206 return 0;
207}
208
209static int set_global_node_ID(void *dst) {
210 void *src;
211 int size;
212
213 if (mesh->n_node_gross <= 0) return 0;
214
215 src = mesh->global_node_ID;
216 size = sizeof(*mesh->global_node_ID) * mesh->n_node_gross;
217 memcpy(dst, src, size);
218
219 return 0;
220}
221
222static int set_node(void *dst) {
223 void *src;
224 int size;
225
226 if (mesh->n_node_gross <= 0) return 0;
227
228 src = mesh->node;
229 size = sizeof(*mesh->node) * mesh->n_node_gross * 3;
230 memcpy(dst, src, size);
231
232 return 0;
233}
234
235static int set_n_dof(void *dst) {
236 void *src;
237 int size;
238
239 src = &mesh->n_dof;
240 size = sizeof(mesh->n_dof);
241 memcpy(dst, src, size);
242
243 return 0;
244}
245
246static int set_n_dof_grp(void *dst) {
247 void *src;
248 int size;
249
250 src = &mesh->n_dof_grp;
251 size = sizeof(mesh->n_dof_grp);
252 memcpy(dst, src, size);
253
254 return 0;
255}
256
257static int set_n_dof_tot(void *dst) {
258 void *src;
259 int size;
260
261 src = &mesh->n_dof_tot;
262 size = sizeof(mesh->n_dof_tot);
263 memcpy(dst, src, size);
264
265 return 0;
266}
267
268static int set_node_dof_index(void *dst) {
269 void *src;
270 int size;
271
272 if (mesh->n_dof_grp <= 0) return 0;
273
274 src = mesh->node_dof_index;
275 size = sizeof(*mesh->node_dof_index) * (mesh->n_dof_grp + 1);
276 memcpy(dst, src, size);
277
278 return 0;
279}
280
281static int set_node_dof_item(void *dst) {
282 void *src;
283 int size;
284
285 if (mesh->n_dof_grp <= 0) return 0;
286
287 src = mesh->node_dof_item;
288 size = sizeof(*mesh->node_dof_item) * mesh->n_dof_grp;
289 memcpy(dst, src, size);
290
291 return 0;
292}
293
294static int set_node_val_index(void *dst) {
295 void *src;
296 int size;
297
298 if (mesh->n_node_gross <= 0) return 0;
299
300 src = mesh->node_val_index;
301 size = sizeof(*mesh->node_val_index) * (mesh->n_node_gross + 1);
302 memcpy(dst, src, size);
303
304 return 0;
305}
306
307static int set_node_val_item(void *dst) {
308 void *src;
309 int size;
310
311 if (mesh->n_node_gross <= 0) return 0;
312
313 src = mesh->node_val_item;
314 size =
315 sizeof(*mesh->node_val_item) * mesh->node_val_index[mesh->n_node_gross];
316 memcpy(dst, src, size);
317
318 return 0;
319}
320
321static int set_node_init_val_index(void *dst) {
322 void *src;
323 int size;
324
325 if (mesh->n_node_gross <= 0) return 0;
326
327 src = mesh->node_init_val_index;
328 size = sizeof(*mesh->node_init_val_index) * (mesh->n_node_gross + 1);
329 memcpy(dst, src, size);
330
331 return 0;
332}
333
334static int set_node_init_val_item(void *dst) {
335 void *src;
336 int size;
337
338 if (mesh->n_node_gross <= 0) return 0;
339
340 src = mesh->node_init_val_item;
341 size = sizeof(*mesh->node_init_val_item) *
343 memcpy(dst, src, size);
344
345 return 0;
346}
347
348static int set_n_elem(void *dst) {
349 void *src;
350 int size;
351
352 src = &mesh->n_elem;
353 size = sizeof(mesh->n_elem);
354 memcpy(dst, src, size);
355
356 return 0;
357}
358
359static int set_n_elem_gross(void *dst) {
360 void *src;
361 int size;
362
363 src = &mesh->n_elem_gross;
364 size = sizeof(mesh->n_elem_gross);
365 memcpy(dst, src, size);
366
367 return 0;
368}
369
370static int set_ne_internal(void *dst) {
371 void *src;
372 int size;
373
374 src = &mesh->ne_internal;
375 size = sizeof(mesh->ne_internal);
376 memcpy(dst, src, size);
377
378 return 0;
379}
380
381static int set_elem_internal_list(void *dst) {
382 void *src;
383 int size;
384
385 if (mesh->ne_internal <= 0) return 0;
386
387 src = mesh->elem_internal_list;
388 size = sizeof(*mesh->elem_internal_list) * mesh->ne_internal;
389 memcpy(dst, src, size);
390
391 return 0;
392}
393
394static int set_elem_ID(void *dst) {
395 void *src;
396 int size;
397
398 if (mesh->n_elem_gross <= 0) return 0;
399
400 src = mesh->elem_ID;
401 size = sizeof(*mesh->elem_ID) * mesh->n_elem_gross * 2;
402 memcpy(dst, src, size);
403
404 return 0;
405}
406
407static int set_global_elem_ID(void *dst) {
408 void *src;
409 int size;
410
411 if (mesh->n_elem_gross <= 0) return 0;
412
413 src = mesh->global_elem_ID;
414 size = sizeof(*mesh->global_elem_ID) * mesh->n_elem_gross;
415 memcpy(dst, src, size);
416
417 return 0;
418}
419
420static int set_elem_type(void *dst) {
421 void *src;
422 int size;
423
424 if (mesh->n_elem_gross <= 0) return 0;
425
426 src = mesh->elem_type;
427 size = sizeof(*mesh->elem_type) * mesh->n_elem_gross;
428 memcpy(dst, src, size);
429
430 return 0;
431}
432
433static int set_n_elem_type(void *dst) {
434 void *src;
435 int size;
436
437 src = &mesh->n_elem_type;
438 size = sizeof(mesh->n_elem_type);
439 memcpy(dst, src, size);
440
441 return 0;
442}
443
444static int set_elem_type_index(void *dst) {
445 void *src;
446 int size;
447
448 if (mesh->n_elem_type <= 0) return 0;
449
450 src = mesh->elem_type_index;
451 size = sizeof(*mesh->elem_type_index) * (mesh->n_elem_type + 1);
452 memcpy(dst, src, size);
453
454 return 0;
455}
456
457static int set_elem_type_item(void *dst) {
458 void *src;
459 int size;
460
461 if (mesh->n_elem_type <= 0) return 0;
462
463 src = mesh->elem_type_item;
464 size = sizeof(*mesh->elem_type_item) * mesh->n_elem_type;
465 memcpy(dst, src, size);
466
467 return 0;
468}
469
470static int set_elem_node_index(void *dst) {
471 void *src;
472 int size;
473
474 if (mesh->n_elem_gross <= 0) return 0;
475
476 src = mesh->elem_node_index;
477 size = sizeof(*mesh->elem_node_index) * (mesh->n_elem_gross + 1);
478 memcpy(dst, src, size);
479
480 return 0;
481}
482
483static int set_elem_node_item(void *dst) {
484 void *src;
485 int size;
486
487 if (mesh->n_elem_gross <= 0) return 0;
488
489 src = mesh->elem_node_item;
490 size =
491 sizeof(*mesh->elem_node_item) * mesh->elem_node_index[mesh->n_elem_gross];
492 memcpy(dst, src, size);
493
494 return 0;
495}
496
497static int set_section_ID(void *dst) {
498 void *src;
499 int size;
500
501 if (mesh->n_elem_gross <= 0) return 0;
502
503 src = mesh->section_ID;
504 size = sizeof(*mesh->section_ID) * mesh->n_elem_gross;
505 memcpy(dst, src, size);
506
507 return 0;
508}
509
510static int set_n_elem_mat_ID(void *dst) {
511 void *src;
512 int size;
513
514 src = &mesh->n_elem_mat_ID;
515 size = sizeof(mesh->n_elem_mat_ID);
516 memcpy(dst, src, size);
517
518 return 0;
519}
520
521static int set_elem_mat_ID_index(void *dst) {
522 void *src;
523 int size;
524
525 if (mesh->n_elem_gross <= 0) return 0;
526
527 src = mesh->elem_mat_ID_index;
528 size = sizeof(*mesh->elem_mat_ID_index) * (mesh->n_elem_gross + 1);
529 memcpy(dst, src, size);
530
531 return 0;
532}
533
534static int set_elem_mat_ID_item(void *dst) {
535 void *src;
536 int size;
537
538 if (mesh->n_elem_gross <= 0) return 0;
539
540 src = mesh->elem_mat_ID_item;
541 size = sizeof(*mesh->elem_mat_ID_item) *
542 mesh->elem_mat_ID_index[mesh->n_elem_gross];
543 memcpy(dst, src, size);
544
545 return 0;
546}
547
548static int set_elem_mat_int_index(void *dst) {
549 void *src;
550 int size;
551
552 if (mesh->n_elem_mat_ID <= 0) return 0;
553
554 src = mesh->elem_mat_int_index;
555 size = sizeof(*mesh->elem_mat_int_index) * (mesh->n_elem_mat_ID + 1);
556 memcpy(dst, src, size);
557
558 return 0;
559}
560
561static int set_elem_mat_int_val(void *dst) {
562 void *src;
563 int size;
564
565 if (mesh->n_elem_mat_ID <= 0) return 0;
566
567 src = mesh->elem_mat_ID_item;
568 size = sizeof(*mesh->elem_mat_int_val) *
570 memcpy(dst, src, size);
571
572 return 0;
573}
574
575static int set_elem_val_index(void *dst) {
576 void *src;
577 int size;
578
579 if (mesh->n_elem_gross <= 0) return 0;
580
581 src = mesh->elem_val_index;
582 size = sizeof(*mesh->elem_val_index) * (mesh->n_elem_gross + 1);
583 memcpy(dst, src, size);
584
585 return 0;
586}
587
588static int set_elem_val_item(void *dst) {
589 void *src;
590 int size;
591
592 if (mesh->n_elem_gross <= 0) return 0;
593
594 src = mesh->elem_val_item;
595 size =
596 sizeof(*mesh->elem_val_item) * mesh->elem_val_index[mesh->n_elem_gross];
597 memcpy(dst, src, size);
598
599 return 0;
600}
601
602static int set_zero(void *dst) {
603 void *src;
604 int size;
605
606 src = &mesh->zero;
607 size = sizeof(mesh->zero);
608 memcpy(dst, src, size);
609
610 return 0;
611}
612
613static int set_HECMW_COMM(void *dst) {
614 HECMW_Fint comm;
615 void *src;
616 int size;
617
618 comm = HECMW_Comm_c2f(mesh->HECMW_COMM);
619 src = &comm;
620 size = sizeof(comm);
621 memcpy(dst, src, size);
622
623 return 0;
624}
625
626static int set_PETOT(void *dst) {
627 void *src;
628 int size;
629
630 src = &mesh->PETOT;
631 size = sizeof(mesh->PETOT);
632 memcpy(dst, src, size);
633
634 return 0;
635}
636
637static int set_PEsmpTOT(void *dst) {
638 void *src;
639 int size;
640
641 src = &mesh->PEsmpTOT;
642 size = sizeof(mesh->PEsmpTOT);
643 memcpy(dst, src, size);
644
645 return 0;
646}
647
648static int set_my_rank(void *dst) {
649 void *src;
650 int size;
651
652 src = &mesh->my_rank;
653 size = sizeof(mesh->my_rank);
654 memcpy(dst, src, size);
655
656 return 0;
657}
658
659static int set_errnof(void *dst) {
660 void *src;
661 int size;
662
663 src = &mesh->errnof;
664 size = sizeof(mesh->errnof);
665 memcpy(dst, src, size);
666
667 return 0;
668}
669
670static int set_n_subdomain(void *dst) {
671 void *src;
672 int size;
673
674 src = &mesh->n_subdomain;
675 size = sizeof(mesh->n_subdomain);
676 memcpy(dst, src, size);
677
678 return 0;
679}
680
681static int set_n_neighbor_pe(void *dst) {
682 void *src;
683 int size;
684
685 src = &mesh->n_neighbor_pe;
686 size = sizeof(mesh->n_neighbor_pe);
687 memcpy(dst, src, size);
688
689 return 0;
690}
691
692static int set_neighbor_pe(void *dst) {
693 void *src;
694 int size;
695
696 if (mesh->n_neighbor_pe <= 0) return 0;
697
698 src = mesh->neighbor_pe;
699 size = sizeof(*mesh->neighbor_pe) * mesh->n_neighbor_pe;
700 memcpy(dst, src, size);
701
702 return 0;
703}
704
705static int set_import_index(void *dst) {
706 void *src;
707 int size;
708
709 if (mesh->n_neighbor_pe <= 0) return 0;
710
711 src = mesh->import_index;
712 size = sizeof(*mesh->import_index) * (mesh->n_neighbor_pe + 1);
713 memcpy(dst, src, size);
714
715 return 0;
716}
717
718static int set_import_item(void *dst) {
719 void *src;
720 int size;
721
722 if (mesh->n_neighbor_pe <= 0) return 0;
723
724 src = mesh->import_item;
725 size = sizeof(*mesh->import_item) * mesh->import_index[mesh->n_neighbor_pe];
726 memcpy(dst, src, size);
727
728 return 0;
729}
730
731static int set_export_index(void *dst) {
732 void *src;
733 int size;
734
735 if (mesh->n_neighbor_pe <= 0) return 0;
736
737 src = mesh->export_index;
738 size = sizeof(*mesh->export_index) * (mesh->n_neighbor_pe + 1);
739 memcpy(dst, src, size);
740
741 return 0;
742}
743
744static int set_export_item(void *dst) {
745 void *src;
746 int size;
747
748 if (mesh->n_neighbor_pe <= 0) return 0;
749
750 src = mesh->export_item;
751 size = sizeof(*mesh->export_item) * mesh->export_index[mesh->n_neighbor_pe];
752 memcpy(dst, src, size);
753
754 return 0;
755}
756
757static int set_shared_index(void *dst) {
758 void *src;
759 int size;
760
761 if (mesh->n_neighbor_pe <= 0) return 0;
762
763 src = mesh->shared_index;
764 size = sizeof(*mesh->shared_index) * (mesh->n_neighbor_pe + 1);
765 memcpy(dst, src, size);
766
767 return 0;
768}
769
770static int set_shared_item(void *dst) {
771 void *src;
772 int size;
773
774 if (mesh->n_neighbor_pe <= 0) return 0;
775
776 src = mesh->shared_item;
777 size = sizeof(*mesh->shared_item) * mesh->shared_index[mesh->n_neighbor_pe];
778 memcpy(dst, src, size);
779
780 return 0;
781}
782
783static int set_coarse_grid_level(void *dst) {
784 void *src;
785 int size;
786
787 src = &mesh->coarse_grid_level;
788 size = sizeof(mesh->coarse_grid_level);
789 memcpy(dst, src, size);
790
791 return 0;
792}
793
794static int set_n_adapt(void *dst) {
795 void *src;
796 int size;
797
798 src = &mesh->n_adapt;
799 size = sizeof(mesh->n_adapt);
800 memcpy(dst, src, size);
801
802 return 0;
803}
804
805static int set_when_i_was_refined_node(void *dst) {
806 void *src;
807 int size;
808
809 if (mesh->n_node_gross <= 0) return 0;
810
811 src = mesh->when_i_was_refined_node;
812 size = sizeof(*mesh->when_i_was_refined_node) * mesh->n_node_gross;
813 memcpy(dst, src, size);
814
815 return 0;
816}
817
818static int set_when_i_was_refined_elem(void *dst) {
819 void *src;
820 int size;
821
822 if (mesh->n_elem_gross <= 0) return 0;
823
824 src = mesh->when_i_was_refined_elem;
825 size = sizeof(*mesh->when_i_was_refined_elem) * mesh->n_elem_gross;
826 memcpy(dst, src, size);
827
828 return 0;
829}
830
831static int set_adapt_parent_type(void *dst) {
832 void *src;
833 int size;
834
835 if (mesh->n_elem_gross <= 0) return 0;
836
837 src = mesh->adapt_parent_type;
838 size = sizeof(*mesh->adapt_parent_type) * mesh->n_elem_gross;
839 memcpy(dst, src, size);
840
841 return 0;
842}
843
844static int set_adapt_type(void *dst) {
845 void *src;
846 int size;
847
848 if (mesh->n_elem_gross <= 0) return 0;
849
850 src = mesh->adapt_type;
851 size = sizeof(*mesh->adapt_type) * mesh->n_elem_gross;
852 memcpy(dst, src, size);
853
854 return 0;
855}
856
857static int set_adapt_level(void *dst) {
858 void *src;
859 int size;
860
861 if (mesh->n_elem_gross <= 0) return 0;
862
863 src = mesh->adapt_level;
864 size = sizeof(*mesh->adapt_level) * mesh->n_elem_gross;
865 memcpy(dst, src, size);
866
867 return 0;
868}
869
870static int set_adapt_parent(void *dst) {
871 void *src;
872 int size;
873
874 if (mesh->n_elem_gross <= 0) return 0;
875
876 src = mesh->adapt_parent;
877 size = sizeof(*mesh->adapt_parent) * mesh->n_elem_gross * 2;
878 memcpy(dst, src, size);
879
880 return 0;
881}
882
883static int set_adapt_children_index(void *dst) {
884 void *src;
885 int size;
886
887 if (mesh->n_elem_gross <= 0) return 0;
888
889 src = mesh->adapt_children_index;
890 size = sizeof(*mesh->adapt_children_index) * (mesh->n_elem_gross + 1);
891 memcpy(dst, src, size);
892
893 return 0;
894}
895
896static int set_adapt_children_item(void *dst) {
897 void *src;
898 int size;
899
900 if (mesh->n_elem_gross <= 0) return 0;
901
902 src = mesh->adapt_children_item;
903 size = sizeof(*mesh->adapt_children_item) *
904 mesh->adapt_children_index[mesh->n_elem_gross] * 2;
905 memcpy(dst, src, size);
906
907 return 0;
908}
909
910static int set_n_refine(void *dst) {
911 void *src;
912 int size;
913
914 src = &mesh->n_refine;
915 size = sizeof(mesh->n_refine);
916 memcpy(dst, src, size);
917
918 return 0;
919}
920
921static int set_node_old2new(void *dst) {
922 void *src;
923 int size;
924
925 if (mesh->n_node_gross <= 0) return 0;
926
927 src = mesh->node_old2new;
928 size = sizeof(*mesh->node_old2new) * mesh->n_node_gross;
929 memcpy(dst, src, size);
930
931 return 0;
932}
933
934static int set_node_new2old(void *dst) {
935 void *src;
936 int size;
937
938 if (mesh->n_node_gross <= 0) return 0;
939
940 src = mesh->node_new2old;
941 size = sizeof(*mesh->node_new2old) * mesh->n_node_gross;
942 memcpy(dst, src, size);
943
944 return 0;
945}
946
947static int set_elem_old2new(void *dst) {
948 void *src;
949 int size;
950
951 if (mesh->n_elem_gross <= 0) return 0;
952
953 src = mesh->elem_old2new;
954 size = sizeof(*mesh->elem_old2new) * mesh->n_elem_gross;
955 memcpy(dst, src, size);
956
957 return 0;
958}
959
960static int set_elem_new2old(void *dst) {
961 void *src;
962 int size;
963
964 if (mesh->n_elem_gross <= 0) return 0;
965
966 src = mesh->elem_new2old;
967 size = sizeof(*mesh->elem_new2old) * mesh->n_elem_gross;
968 memcpy(dst, src, size);
969
970 return 0;
971}
972
973static int set_n_node_refine_hist(void *dst) {
974 void *src;
975 int size;
976
977 if (mesh->n_refine <= 0) return 0;
978
979 src = mesh->n_node_refine_hist;
980 size = sizeof(*mesh->n_node_refine_hist) * mesh->n_refine;
981
982 memcpy(dst, src, size);
983
984 return 0;
985}
986
987static int set_n_sect(void *dst) {
988 void *src;
989 int size;
990 struct hecmwST_section *sect = mesh->section;
991
992 src = &sect->n_sect;
993 size = sizeof(sect->n_sect);
994 memcpy(dst, src, size);
995
996 return 0;
997}
998
999static int set_sect_type(void *dst) {
1000 void *src;
1001 int size;
1002 struct hecmwST_section *sect = mesh->section;
1003
1004 if (sect->n_sect <= 0) return 0;
1005
1006 src = sect->sect_type;
1007 size = sizeof(*sect->sect_type) * sect->n_sect;
1008 memcpy(dst, src, size);
1009
1010 return 0;
1011}
1012
1013static int set_sect_opt(void *dst) {
1014 void *src;
1015 int size;
1016 struct hecmwST_section *sect = mesh->section;
1017
1018 if (sect->n_sect <= 0) return 0;
1019
1020 src = sect->sect_opt;
1021 size = sizeof(*sect->sect_opt) * sect->n_sect;
1022 memcpy(dst, src, size);
1023
1024 return 0;
1025}
1026
1027static int set_sect_mat_ID_index(void *dst) {
1028 void *src;
1029 int size;
1030 struct hecmwST_section *sect = mesh->section;
1031
1032 if (sect->n_sect <= 0) return 0;
1033
1034 src = sect->sect_mat_ID_index;
1035 size = sizeof(*sect->sect_mat_ID_index) * (sect->n_sect + 1);
1036 memcpy(dst, src, size);
1037
1038 return 0;
1039}
1040
1041static int set_sect_mat_ID_item(void *dst) {
1042 void *src;
1043 int size;
1044 struct hecmwST_section *sect = mesh->section;
1045
1046 if (sect->n_sect <= 0) return 0;
1047
1048 src = sect->sect_mat_ID_item;
1049 size =
1050 sizeof(*sect->sect_mat_ID_item) * sect->sect_mat_ID_index[sect->n_sect];
1051 memcpy(dst, src, size);
1052
1053 return 0;
1054}
1055
1056static int set_sect_I_index(void *dst) {
1057 void *src;
1058 int size;
1059 struct hecmwST_section *sect = mesh->section;
1060
1061 if (sect->n_sect <= 0) return 0;
1062
1063 src = sect->sect_I_index;
1064 size = sizeof(*sect->sect_I_index) * (sect->n_sect + 1);
1065 memcpy(dst, src, size);
1066
1067 return 0;
1068}
1069
1070static int set_sect_I_item(void *dst) {
1071 void *src;
1072 int size;
1073 struct hecmwST_section *sect = mesh->section;
1074
1075 if (sect->n_sect <= 0) return 0;
1076 if (sect->sect_I_item == NULL) return 0;
1077
1078 src = sect->sect_I_item;
1079 size = sizeof(*sect->sect_I_item) * sect->sect_I_index[sect->n_sect];
1080 memcpy(dst, src, size);
1081
1082 return 0;
1083}
1084
1085static int set_sect_R_index(void *dst) {
1086 void *src;
1087 int size;
1088 struct hecmwST_section *sect = mesh->section;
1089
1090 if (sect->n_sect <= 0) return 0;
1091
1092 src = sect->sect_R_index;
1093 size = sizeof(*sect->sect_R_index) * (sect->n_sect + 1);
1094 memcpy(dst, src, size);
1095
1096 return 0;
1097}
1098
1099static int set_sect_R_item(void *dst) {
1100 void *src;
1101 int size;
1102 struct hecmwST_section *sect = mesh->section;
1103
1104 if (sect->n_sect <= 0) return 0;
1105
1106 src = sect->sect_R_item;
1107 size = sizeof(*sect->sect_R_item) * sect->sect_R_index[sect->n_sect];
1108 memcpy(dst, src, size);
1109
1110 return 0;
1111}
1112
1113static int set_n_mat(void *dst) {
1114 void *src;
1115 int size;
1116 struct hecmwST_material *mat = mesh->material;
1117
1118 src = &mat->n_mat;
1119 size = sizeof(mat->n_mat);
1120 memcpy(dst, src, size);
1121
1122 return 0;
1123}
1124
1125static int set_n_mat_item(void *dst) {
1126 void *src;
1127 int size;
1128 struct hecmwST_material *mat = mesh->material;
1129
1130 src = &mat->n_mat_item;
1131 size = sizeof(mat->n_mat_item);
1132 memcpy(dst, src, size);
1133
1134 return 0;
1135}
1136
1137static int set_n_mat_subitem(void *dst) {
1138 void *src;
1139 int size;
1140 struct hecmwST_material *mat = mesh->material;
1141
1142 src = &mat->n_mat_subitem;
1143 size = sizeof(mat->n_mat_subitem);
1144 memcpy(dst, src, size);
1145
1146 return 0;
1147}
1148
1149static int set_n_mat_table(void *dst) {
1150 void *src;
1151 int size;
1152 struct hecmwST_material *mat = mesh->material;
1153
1154 src = &mat->n_mat_table;
1155 size = sizeof(mat->n_mat_table);
1156 memcpy(dst, src, size);
1157
1158 return 0;
1159}
1160
1161static int set_mat_name(void *dst) {
1162 int i;
1163 struct hecmwST_material *mat = mesh->material;
1164
1165 if (mat->n_mat <= 0) return 0;
1166
1167 for (i = 0; i < mat->n_mat; i++) {
1168 char *dst_point = (char *)dst + HECMW_NAME_LEN * i;
1169 char *src = mat->mat_name[i];
1170 HECMW_strcpy_c2f(src, dst_point, HECMW_NAME_LEN);
1171 }
1172
1173 return 0;
1174}
1175
1176static int set_mat_item_index(void *dst) {
1177 void *src;
1178 int size;
1179 struct hecmwST_material *mat = mesh->material;
1180
1181 if (mat->n_mat <= 0) return 0;
1182
1183 src = mat->mat_item_index;
1184 size = sizeof(*mat->mat_item_index) * (mat->n_mat + 1);
1185 memcpy(dst, src, size);
1186
1187 return 0;
1188}
1189
1190static int set_mat_subitem_index(void *dst) {
1191 void *src;
1192 int size;
1193 struct hecmwST_material *mat = mesh->material;
1194
1195 if (mat->n_mat_item <= 0) return 0;
1196
1197 src = mat->mat_subitem_index;
1198 size = sizeof(*mat->mat_subitem_index) * (mat->n_mat_item + 1);
1199 memcpy(dst, src, size);
1200
1201 return 0;
1202}
1203
1204static int set_mat_table_index(void *dst) {
1205 void *src;
1206 int size;
1207 struct hecmwST_material *mat = mesh->material;
1208
1209 if (mat->n_mat_subitem <= 0) return 0;
1210
1211 src = mat->mat_table_index;
1212 size = sizeof(*mat->mat_table_index) * (mat->n_mat_subitem + 1);
1213 memcpy(dst, src, size);
1214
1215 return 0;
1216}
1217
1218static int set_mat_val(void *dst) {
1219 void *src;
1220 int size;
1221 struct hecmwST_material *mat = mesh->material;
1222
1223 if (mat->n_mat <= 0) return 0;
1224
1225 src = mat->mat_val;
1226 size = sizeof(*mat->mat_val) * mat->mat_table_index[mat->n_mat_subitem];
1227 memcpy(dst, src, size);
1228
1229 return 0;
1230}
1231
1232static int set_mat_temp(void *dst) {
1233 void *src;
1234 int size;
1235 struct hecmwST_material *mat = mesh->material;
1236
1237 if (mat->n_mat <= 0) return 0;
1238
1239 src = mat->mat_temp;
1240 size = sizeof(*mat->mat_temp) * mat->mat_table_index[mat->n_mat_subitem];
1241 memcpy(dst, src, size);
1242
1243 return 0;
1244}
1245
1246static int set_n_mpc(void *dst) {
1247 void *src;
1248 int size;
1249 struct hecmwST_mpc *mpc = mesh->mpc;
1250
1251 src = &mpc->n_mpc;
1252 size = sizeof(mpc->n_mpc);
1253 memcpy(dst, src, size);
1254
1255 return 0;
1256}
1257
1258static int set_mpc_index(void *dst) {
1259 void *src;
1260 int size;
1261 struct hecmwST_mpc *mpc = mesh->mpc;
1262
1263 if (mpc->n_mpc <= 0) return 0;
1264
1265 src = mpc->mpc_index;
1266 size = sizeof(*mpc->mpc_index) * (mpc->n_mpc + 1);
1267 memcpy(dst, src, size);
1268
1269 return 0;
1270}
1271
1272static int set_mpc_item(void *dst) {
1273 void *src;
1274 int size;
1275 struct hecmwST_mpc *mpc = mesh->mpc;
1276
1277 if (mpc->n_mpc <= 0) return 0;
1278
1279 src = mpc->mpc_item;
1280 size = sizeof(*mpc->mpc_item) * mpc->mpc_index[mpc->n_mpc];
1281 memcpy(dst, src, size);
1282
1283 return 0;
1284}
1285
1286static int set_mpc_dof(void *dst) {
1287 void *src;
1288 int size;
1289 struct hecmwST_mpc *mpc = mesh->mpc;
1290
1291 if (mpc->n_mpc <= 0) return 0;
1292
1293 src = mpc->mpc_dof;
1294 size = sizeof(*mpc->mpc_dof) * mpc->mpc_index[mpc->n_mpc];
1295 memcpy(dst, src, size);
1296
1297 return 0;
1298}
1299
1300static int set_mpc_val(void *dst) {
1301 void *src;
1302 int size;
1303 struct hecmwST_mpc *mpc = mesh->mpc;
1304
1305 if (mpc->n_mpc <= 0) return 0;
1306
1307 src = mpc->mpc_val;
1308 size = sizeof(*mpc->mpc_val) * mpc->mpc_index[mpc->n_mpc];
1309 memcpy(dst, src, size);
1310
1311 return 0;
1312}
1313
1314static int set_mpc_const(void *dst) {
1315 void *src;
1316 int size;
1317 struct hecmwST_mpc *mpc = mesh->mpc;
1318
1319 if (mpc->n_mpc <= 0) return 0;
1320
1321 src = mpc->mpc_const;
1322 size = sizeof(*mpc->mpc_const) * mpc->n_mpc;
1323 memcpy(dst, src, size);
1324
1325 return 0;
1326}
1327
1328static int set_n_amp(void *dst) {
1329 void *src;
1330 int size;
1331 struct hecmwST_amplitude *amp = mesh->amp;
1332
1333 src = &amp->n_amp;
1334 size = sizeof(amp->n_amp);
1335 memcpy(dst, src, size);
1336
1337 return 0;
1338}
1339
1340static int set_amp_name(void *dst) {
1341 int i;
1342 struct hecmwST_amplitude *amp = mesh->amp;
1343
1344 if (amp->n_amp <= 0) return 0;
1345
1346 for (i = 0; i < amp->n_amp; i++) {
1347 char *dst_point = (char *)dst + HECMW_NAME_LEN * i;
1348 char *src = amp->amp_name[i];
1349 HECMW_strcpy_c2f(src, dst_point, HECMW_NAME_LEN);
1350 }
1351
1352 return 0;
1353}
1354
1355static int set_amp_type_definition(void *dst) {
1356 void *src;
1357 int size;
1358 struct hecmwST_amplitude *amp = mesh->amp;
1359
1360 if (amp->n_amp <= 0) return 0;
1361
1362 src = amp->amp_type_definition;
1363 size = sizeof(*amp->amp_type_definition) * amp->n_amp;
1364 memcpy(dst, src, size);
1365
1366 return 0;
1367}
1368
1369static int set_amp_type_time(void *dst) {
1370 void *src;
1371 int size;
1372 struct hecmwST_amplitude *amp = mesh->amp;
1373
1374 if (amp->n_amp <= 0) return 0;
1375
1376 src = amp->amp_type_time;
1377 size = sizeof(*amp->amp_type_time) * amp->n_amp;
1378 memcpy(dst, src, size);
1379
1380 return 0;
1381}
1382
1383static int set_amp_type_value(void *dst) {
1384 void *src;
1385 int size;
1386 struct hecmwST_amplitude *amp = mesh->amp;
1387
1388 if (amp->n_amp <= 0) return 0;
1389
1390 src = amp->amp_type_value;
1391 size = sizeof(*amp->amp_type_value) * amp->n_amp;
1392 memcpy(dst, src, size);
1393
1394 return 0;
1395}
1396
1397static int set_amp_index(void *dst) {
1398 void *src;
1399 int size;
1400 struct hecmwST_amplitude *amp = mesh->amp;
1401
1402 if (amp->n_amp <= 0) return 0;
1403
1404 src = amp->amp_index;
1405 size = sizeof(*amp->amp_index) * (amp->n_amp + 1);
1406 memcpy(dst, src, size);
1407
1408 return 0;
1409}
1410
1411static int set_amp_val(void *dst) {
1412 void *src;
1413 int size;
1414 struct hecmwST_amplitude *amp = mesh->amp;
1415
1416 if (amp->n_amp <= 0) return 0;
1417
1418 src = amp->amp_val;
1419 size = sizeof(*amp->amp_val) * amp->amp_index[amp->n_amp];
1420 memcpy(dst, src, size);
1421
1422 return 0;
1423}
1424
1425static int set_amp_table(void *dst) {
1426 void *src;
1427 int size;
1428 struct hecmwST_amplitude *amp = mesh->amp;
1429
1430 if (amp->n_amp <= 0) return 0;
1431
1432 src = amp->amp_table;
1433 size = sizeof(*amp->amp_table) * amp->amp_index[amp->n_amp];
1434 memcpy(dst, src, size);
1435
1436 return 0;
1437}
1438
1439static int set_ngrp_n_grp(void *dst) {
1440 void *src;
1441 int size;
1442 struct hecmwST_node_grp *grp = mesh->node_group;
1443
1444 src = &grp->n_grp;
1445 size = sizeof(grp->n_grp);
1446 memcpy(dst, src, size);
1447
1448 return 0;
1449}
1450
1451static int set_ngrp_n_bc(void *dst) {
1452 void *src;
1453 int size;
1454 struct hecmwST_node_grp *grp = mesh->node_group;
1455
1456 src = &grp->n_bc;
1457 size = sizeof(grp->n_bc);
1458 memcpy(dst, src, size);
1459
1460 return 0;
1461}
1462
1463static int set_ngrp_grp_name(void *dst) {
1464 int i;
1465 struct hecmwST_node_grp *grp = mesh->node_group;
1466
1467 if (grp->n_grp <= 0) return 0;
1468
1469 for (i = 0; i < grp->n_grp; i++) {
1470 char *dst_point = (char *)dst + HECMW_NAME_LEN * i;
1471 char *src = grp->grp_name[i];
1472 HECMW_strcpy_c2f(src, dst_point, HECMW_NAME_LEN);
1473 }
1474
1475 return 0;
1476}
1477
1478static int set_ngrp_grp_index(void *dst) {
1479 void *src;
1480 int size;
1481 struct hecmwST_node_grp *grp = mesh->node_group;
1482
1483 if (grp->n_grp <= 0) return 0;
1484
1485 src = grp->grp_index;
1486 size = sizeof(*grp->grp_index) * (grp->n_grp + 1);
1487 memcpy(dst, src, size);
1488
1489 return 0;
1490}
1491
1492static int set_ngrp_grp_item(void *dst) {
1493 void *src;
1494 int size;
1495 struct hecmwST_node_grp *grp = mesh->node_group;
1496
1497 if (grp->n_grp <= 0) return 0;
1498
1499 src = grp->grp_item;
1500 size = sizeof(*grp->grp_item) * grp->grp_index[grp->n_grp];
1501 memcpy(dst, src, size);
1502
1503 return 0;
1504}
1505
1506static int set_ngrp_bc_grp_ID(void *dst) {
1507 void *src;
1508 int size;
1509 struct hecmwST_node_grp *grp = mesh->node_group;
1510
1511 if (grp->n_bc <= 0) return 0;
1512
1513 src = grp->bc_grp_ID;
1514 size = sizeof(*grp->bc_grp_ID) * grp->n_bc;
1515 memcpy(dst, src, size);
1516
1517 return 0;
1518}
1519
1520static int set_ngrp_bc_grp_type(void *dst) {
1521 void *src;
1522 int size;
1523 struct hecmwST_node_grp *grp = mesh->node_group;
1524
1525 if (grp->n_bc <= 0) return 0;
1526
1527 src = grp->bc_grp_type;
1528 size = sizeof(*grp->bc_grp_type) * grp->n_bc;
1529 memcpy(dst, src, size);
1530
1531 return 0;
1532}
1533
1534static int set_ngrp_bc_grp_index(void *dst) {
1535 void *src;
1536 int size;
1537 struct hecmwST_node_grp *grp = mesh->node_group;
1538
1539 if (grp->n_bc <= 0) return 0;
1540
1541 src = grp->bc_grp_index;
1542 size = sizeof(*grp->bc_grp_index) * grp->n_bc;
1543 memcpy(dst, src, size);
1544
1545 return 0;
1546}
1547
1548static int set_ngrp_bc_grp_dof(void *dst) {
1549 void *src;
1550 int size;
1551 struct hecmwST_node_grp *grp = mesh->node_group;
1552
1553 if (grp->n_bc <= 0) return 0;
1554
1555 src = grp->bc_grp_dof;
1556 size = sizeof(*grp->bc_grp_dof) * grp->n_bc;
1557 memcpy(dst, src, size);
1558
1559 return 0;
1560}
1561
1562static int set_ngrp_bc_grp_val(void *dst) {
1563 void *src;
1564 int size;
1565 struct hecmwST_node_grp *grp = mesh->node_group;
1566
1567 if (grp->n_bc <= 0) return 0;
1568
1569 src = grp->bc_grp_val;
1570 size = sizeof(*grp->bc_grp_val) * grp->n_bc;
1571 memcpy(dst, src, size);
1572
1573 return 0;
1574}
1575
1576static int set_egrp_n_grp(void *dst) {
1577 void *src;
1578 int size;
1579 struct hecmwST_elem_grp *grp = mesh->elem_group;
1580
1581 src = &grp->n_grp;
1582 size = sizeof(grp->n_grp);
1583 memcpy(dst, src, size);
1584
1585 return 0;
1586}
1587
1588static int set_egrp_n_bc(void *dst) {
1589 void *src;
1590 int size;
1591 struct hecmwST_elem_grp *grp = mesh->elem_group;
1592
1593 src = &grp->n_bc;
1594 size = sizeof(grp->n_bc);
1595 memcpy(dst, src, size);
1596
1597 return 0;
1598}
1599
1600static int set_egrp_grp_name(void *dst) {
1601 int i;
1602 struct hecmwST_elem_grp *grp = mesh->elem_group;
1603
1604 if (grp->n_grp <= 0) return 0;
1605
1606 for (i = 0; i < grp->n_grp; i++) {
1607 char *dst_point = (char *)dst + HECMW_NAME_LEN * i;
1608 char *src = grp->grp_name[i];
1609 HECMW_strcpy_c2f(src, dst_point, HECMW_NAME_LEN);
1610 }
1611
1612 return 0;
1613}
1614
1615static int set_egrp_grp_index(void *dst) {
1616 void *src;
1617 int size;
1618 struct hecmwST_elem_grp *grp = mesh->elem_group;
1619
1620 if (grp->n_grp <= 0) return 0;
1621
1622 src = grp->grp_index;
1623 size = sizeof(*grp->grp_index) * (grp->n_grp + 1);
1624 memcpy(dst, src, size);
1625
1626 return 0;
1627}
1628
1629static int set_egrp_grp_item(void *dst) {
1630 void *src;
1631 int size;
1632 struct hecmwST_elem_grp *grp = mesh->elem_group;
1633
1634 if (grp->n_grp <= 0) return 0;
1635
1636 src = grp->grp_item;
1637 size = sizeof(*grp->grp_item) * grp->grp_index[grp->n_grp];
1638 memcpy(dst, src, size);
1639
1640 return 0;
1641}
1642
1643static int set_egrp_bc_grp_ID(void *dst) {
1644 void *src;
1645 int size;
1646 struct hecmwST_elem_grp *grp = mesh->elem_group;
1647
1648 if (grp->n_bc <= 0) return 0;
1649
1650 src = grp->bc_grp_ID;
1651 size = sizeof(*grp->bc_grp_ID) * grp->n_bc;
1652 memcpy(dst, src, size);
1653
1654 return 0;
1655}
1656
1657static int set_egrp_bc_grp_type(void *dst) {
1658 void *src;
1659 int size;
1660 struct hecmwST_elem_grp *grp = mesh->elem_group;
1661
1662 if (grp->n_bc <= 0) return 0;
1663
1664 src = grp->bc_grp_type;
1665 size = sizeof(*grp->bc_grp_type) * grp->n_bc;
1666 memcpy(dst, src, size);
1667
1668 return 0;
1669}
1670
1671static int set_egrp_bc_grp_index(void *dst) {
1672 void *src;
1673 int size;
1674 struct hecmwST_elem_grp *grp = mesh->elem_group;
1675
1676 if (grp->n_bc <= 0) return 0;
1677
1678 src = grp->bc_grp_index;
1679 size = sizeof(*grp->bc_grp_index) * grp->n_bc;
1680 memcpy(dst, src, size);
1681
1682 return 0;
1683}
1684
1685static int set_egrp_bc_grp_val(void *dst) {
1686 void *src;
1687 int size;
1688 struct hecmwST_elem_grp *grp = mesh->elem_group;
1689
1690 if (grp->n_bc <= 0) return 0;
1691
1692 src = grp->bc_grp_val;
1693 size = sizeof(*grp->bc_grp_val) * grp->n_bc;
1694 memcpy(dst, src, size);
1695
1696 return 0;
1697}
1698
1699static int set_sgrp_n_grp(void *dst) {
1700 void *src;
1701 int size;
1702 struct hecmwST_surf_grp *grp = mesh->surf_group;
1703
1704 src = &grp->n_grp;
1705 size = sizeof(grp->n_grp);
1706 memcpy(dst, src, size);
1707
1708 return 0;
1709}
1710
1711static int set_sgrp_n_bc(void *dst) {
1712 void *src;
1713 int size;
1714 struct hecmwST_surf_grp *grp = mesh->surf_group;
1715
1716 src = &grp->n_bc;
1717 size = sizeof(grp->n_bc);
1718 memcpy(dst, src, size);
1719
1720 return 0;
1721}
1722
1723static int set_sgrp_grp_name(void *dst) {
1724 int i;
1725 struct hecmwST_surf_grp *grp = mesh->surf_group;
1726
1727 if (grp->n_grp <= 0) return 0;
1728
1729 for (i = 0; i < grp->n_grp; i++) {
1730 char *dst_point = (char *)dst + HECMW_NAME_LEN * i;
1731 char *src = grp->grp_name[i];
1732 HECMW_strcpy_c2f(src, dst_point, HECMW_NAME_LEN);
1733 }
1734
1735 return 0;
1736}
1737
1738static int set_sgrp_grp_index(void *dst) {
1739 void *src;
1740 int size;
1741 struct hecmwST_surf_grp *grp = mesh->surf_group;
1742
1743 if (grp->n_grp <= 0) return 0;
1744
1745 src = grp->grp_index;
1746 size = sizeof(*grp->grp_index) * (grp->n_grp + 1);
1747 memcpy(dst, src, size);
1748
1749 return 0;
1750}
1751
1752static int set_sgrp_grp_item(void *dst) {
1753 void *src;
1754 int size;
1755 struct hecmwST_surf_grp *grp = mesh->surf_group;
1756
1757 if (grp->n_grp <= 0) return 0;
1758
1759 src = grp->grp_item;
1760 size = sizeof(*grp->grp_item) * grp->grp_index[grp->n_grp] * 2;
1761 memcpy(dst, src, size);
1762
1763 return 0;
1764}
1765
1766static int set_sgrp_bc_grp_ID(void *dst) {
1767 void *src;
1768 int size;
1769 struct hecmwST_surf_grp *grp = mesh->surf_group;
1770
1771 if (grp->n_bc <= 0) return 0;
1772
1773 src = grp->bc_grp_ID;
1774 size = sizeof(*grp->bc_grp_ID) * grp->n_bc;
1775 memcpy(dst, src, size);
1776
1777 return 0;
1778}
1779
1780static int set_sgrp_bc_grp_type(void *dst) {
1781 void *src;
1782 int size;
1783 struct hecmwST_surf_grp *grp = mesh->surf_group;
1784
1785 if (grp->n_bc <= 0) return 0;
1786
1787 src = grp->bc_grp_type;
1788 size = sizeof(*grp->bc_grp_type) * grp->n_bc;
1789 memcpy(dst, src, size);
1790
1791 return 0;
1792}
1793
1794static int set_sgrp_bc_grp_index(void *dst) {
1795 void *src;
1796 int size;
1797 struct hecmwST_surf_grp *grp = mesh->surf_group;
1798
1799 if (grp->n_bc <= 0) return 0;
1800
1801 src = grp->bc_grp_index;
1802 size = sizeof(*grp->bc_grp_index) * grp->n_bc;
1803 memcpy(dst, src, size);
1804
1805 return 0;
1806}
1807
1808static int set_sgrp_bc_grp_val(void *dst) {
1809 void *src;
1810 int size;
1811 struct hecmwST_surf_grp *grp = mesh->surf_group;
1812
1813 if (grp->n_bc <= 0) return 0;
1814
1815 src = grp->bc_grp_val;
1816 size = sizeof(*grp->bc_grp_val) * grp->n_bc;
1817 memcpy(dst, src, size);
1818
1819 return 0;
1820}
1821
1822static int set_contact_pair_n_pair(void *dst) {
1823 void *src;
1824 int size;
1825 struct hecmwST_contact_pair *cpair = mesh->contact_pair;
1826
1827 src = &cpair->n_pair;
1828 size = sizeof(cpair->n_pair);
1829 memcpy(dst, src, size);
1830
1831 return 0;
1832}
1833
1834static int set_contact_pair_name(void *dst) {
1835 int i;
1836 struct hecmwST_contact_pair *cpair = mesh->contact_pair;
1837
1838 if (cpair->n_pair <= 0) return 0;
1839
1840 for (i = 0; i < cpair->n_pair; i++) {
1841 char *dst_point = (char *)dst + HECMW_NAME_LEN * i;
1842 char *src = cpair->name[i];
1843 HECMW_strcpy_c2f(src, dst_point, HECMW_NAME_LEN);
1844 }
1845
1846 return 0;
1847}
1848
1849static int set_contact_pair_type(void *dst) {
1850 void *src;
1851 int size;
1852 struct hecmwST_contact_pair *cpair = mesh->contact_pair;
1853
1854 if (cpair->n_pair <= 0) return 0;
1855
1856 src = cpair->type;
1857 size = sizeof(*cpair->type) * (cpair->n_pair);
1858 memcpy(dst, src, size);
1859
1860 return 0;
1861}
1862
1863static int set_contact_pair_slave_grp_id(void *dst) {
1864 void *src;
1865 int size;
1866 struct hecmwST_contact_pair *cpair = mesh->contact_pair;
1867
1868 if (cpair->n_pair <= 0) return 0;
1869
1870 src = cpair->slave_grp_id;
1871 size = sizeof(*cpair->slave_grp_id) * (cpair->n_pair);
1872 memcpy(dst, src, size);
1873
1874 return 0;
1875}
1876
1877static int set_contact_pair_slave_orisgrp_id(void *dst) {
1878 void *src;
1879 int size;
1880 struct hecmwST_contact_pair *cpair = mesh->contact_pair;
1881
1882 if (cpair->n_pair <= 0) return 0;
1883
1884 src = cpair->slave_orisgrp_id;
1885 size = sizeof(*cpair->slave_orisgrp_id) * (cpair->n_pair);
1886 memcpy(dst, src, size);
1887
1888 return 0;
1889}
1890
1891static int set_contact_pair_master_grp_id(void *dst) {
1892 void *src;
1893 int size;
1894 struct hecmwST_contact_pair *cpair = mesh->contact_pair;
1895
1896 if (cpair->n_pair <= 0) return 0;
1897
1898 src = cpair->master_grp_id;
1899 size = sizeof(*cpair->master_grp_id) * (cpair->n_pair);
1900 memcpy(dst, src, size);
1901
1902 return 0;
1903}
1904
1905static int set_refine_origin_index(void *dst) {
1906 void *src;
1907 int size;
1908 struct hecmwST_refine_origin *reforg = mesh->refine_origin;
1909
1910 src = reforg->index;
1911 size = sizeof(*reforg->index) * (mesh->n_refine + 1);
1912 memcpy(dst, src, size);
1913
1914 return 0;
1915}
1916
1917static int set_refine_origin_item_index(void *dst) {
1918 void *src;
1919 int size;
1920 struct hecmwST_refine_origin *reforg = mesh->refine_origin;
1921
1922 src = reforg->item_index;
1923 size = sizeof(*reforg->item_index) * (reforg->index[mesh->n_refine] + 1);
1924 memcpy(dst, src, size);
1925
1926 return 0;
1927}
1928
1929static int set_refine_origin_item_item(void *dst) {
1930 void *src;
1931 int size;
1932 struct hecmwST_refine_origin *reforg = mesh->refine_origin;
1933
1934 src = reforg->item_item;
1935 size = sizeof(*reforg->item_item) *
1936 (reforg->item_index[reforg->index[mesh->n_refine]]);
1937 memcpy(dst, src, size);
1938
1939 return 0;
1940}
1941
1942/*---------------------------------------------------------------------------*/
1943
1944static int is_alloc_node_internal_list(void) {
1945 return mesh->node_internal_list ? 1 : 0;
1946}
1947
1948static int is_alloc_node_val_index(void) {
1949 return mesh->node_val_index ? 1 : 0;
1950}
1951
1952static int is_alloc_node_val_item(void) { return mesh->node_val_item ? 1 : 0; }
1953
1954static int is_alloc_node_init_val_index(void) {
1955 return mesh->node_init_val_index ? 1 : 0;
1956}
1957
1958static int is_alloc_node_init_val_item(void) {
1959 return mesh->node_init_val_item ? 1 : 0;
1960}
1961
1962static int is_alloc_elem_internal_list(void) {
1963 return mesh->elem_internal_list ? 1 : 0;
1964}
1965
1966static int is_alloc_elem_mat_int_index(void) {
1967 return mesh->elem_mat_int_index ? 1 : 0;
1968}
1969
1970static int is_alloc_elem_mat_int_val(void) {
1971 return mesh->elem_mat_int_val ? 1 : 0;
1972}
1973
1974static int is_alloc_elem_val_index(void) {
1975 return mesh->elem_val_index ? 1 : 0;
1976}
1977
1978static int is_alloc_elem_val_item(void) { return mesh->elem_val_item ? 1 : 0; }
1979
1980static int is_alloc_node_old2new(void) { return mesh->node_old2new ? 1 : 0; }
1981
1982static int is_alloc_node_new2old(void) { return mesh->node_new2old ? 1 : 0; }
1983
1984static int is_alloc_elem_old2new(void) { return mesh->elem_old2new ? 1 : 0; }
1985
1986static int is_alloc_elem_new2old(void) { return mesh->elem_new2old ? 1 : 0; }
1987
1988static int is_alloc_n_node_refine_hist(void) {
1989 return mesh->n_node_refine_hist ? 1 : 0;
1990}
1991
1992static int is_alloc_when_i_was_refined_node(void) {
1993 return mesh->when_i_was_refined_node ? 1 : 0;
1994}
1995
1996static int is_alloc_when_i_was_refined_elem(void) {
1997 return mesh->when_i_was_refined_elem ? 1 : 0;
1998}
1999
2000static int is_alloc_adapt_parent_type(void) {
2001 return mesh->adapt_parent_type ? 1 : 0;
2002}
2003
2004static int is_alloc_adapt_type(void) { return mesh->adapt_type ? 1 : 0; }
2005
2006static int is_alloc_adapt_level(void) { return mesh->adapt_level ? 1 : 0; }
2007
2008static int is_alloc_adapt_parent(void) { return mesh->adapt_parent ? 1 : 0; }
2009
2010static int is_alloc_adapt_children_index(void) {
2011 return mesh->adapt_children_index ? 1 : 0;
2012}
2013
2014static int is_alloc_adapt_children_item(void) {
2015 return mesh->adapt_children_item ? 1 : 0;
2016}
2017
2018static int is_alloc_ngrp_bc_grp_ID(void) {
2019 return mesh->node_group->bc_grp_ID ? 1 : 0;
2020}
2021
2022static int is_alloc_ngrp_bc_grp_type(void) {
2023 return mesh->node_group->bc_grp_type ? 1 : 0;
2024}
2025
2026static int is_alloc_ngrp_bc_grp_index(void) {
2027 return mesh->node_group->bc_grp_index ? 1 : 0;
2028}
2029
2030static int is_alloc_ngrp_bc_grp_dof(void) {
2031 return mesh->node_group->bc_grp_dof ? 1 : 0;
2032}
2033
2034static int is_alloc_ngrp_bc_grp_val(void) {
2035 return mesh->node_group->bc_grp_val ? 1 : 0;
2036}
2037
2038static int is_alloc_egrp_bc_grp_ID(void) {
2039 return mesh->elem_group->bc_grp_ID ? 1 : 0;
2040}
2041
2042static int is_alloc_egrp_bc_grp_type(void) {
2043 return mesh->elem_group->bc_grp_type ? 1 : 0;
2044}
2045
2046static int is_alloc_egrp_bc_grp_index(void) {
2047 return mesh->elem_group->bc_grp_index ? 1 : 0;
2048}
2049
2050static int is_alloc_egrp_bc_grp_val(void) {
2051 return mesh->elem_group->bc_grp_val ? 1 : 0;
2052}
2053
2054static int is_alloc_sgrp_bc_grp_ID(void) {
2055 return mesh->surf_group->bc_grp_ID ? 1 : 0;
2056}
2057
2058static int is_alloc_sgrp_bc_grp_type(void) {
2059 return mesh->surf_group->bc_grp_type ? 1 : 0;
2060}
2061
2062static int is_alloc_sgrp_bc_grp_index(void) {
2063 return mesh->surf_group->bc_grp_index ? 1 : 0;
2064}
2065
2066static int is_alloc_sgrp_bc_grp_val(void) {
2067 return mesh->surf_group->bc_grp_val ? 1 : 0;
2068}
2069
2070/*-----------------------------------------------------------------------------
2071 * SetFunc table
2072 */
2073
2074typedef int (*SetFunc)(void *);
2075typedef int (*IsAllocatedFunc)(void);
2076
2077static struct func_table {
2078 char *struct_name;
2079 char *var_name;
2080 SetFunc set_func;
2081 IsAllocatedFunc is_allocated_func;
2082} functions[] =
2083 {
2084 /* { Struct name, Variable name, memcpy function, check allocation
2085 function }*/
2086 {"hecmwST_local_mesh", "hecmw_flag_adapt", set_hecmw_flag_adapt, NULL},
2087 {"hecmwST_local_mesh", "hecmw_flag_initcon", set_hecmw_flag_initcon,
2088 NULL},
2089 {"hecmwST_local_mesh", "hecmw_flag_parttype", set_hecmw_flag_parttype,
2090 NULL},
2091 {"hecmwST_local_mesh", "hecmw_flag_partdepth", set_hecmw_flag_partdepth,
2092 NULL},
2093 {"hecmwST_local_mesh", "hecmw_flag_version", set_hecmw_flag_version,
2094 NULL},
2095 {"hecmwST_local_mesh", "hecmw_flag_partcontact",
2096 set_hecmw_flag_partcontact, NULL},
2097
2098 {"hecmwST_local_mesh", "gridfile", set_gridfile, NULL},
2099 {"hecmwST_local_mesh", "hecmw_n_file", set_hecmw_n_file, NULL},
2100 {"hecmwST_local_mesh", "files", set_files, NULL},
2101 {"hecmwST_local_mesh", "header", set_header, NULL},
2102 {"hecmwST_local_mesh", "zero_temp", set_zero_temp, NULL},
2103
2104 {"hecmwST_local_mesh", "n_node", set_n_node, NULL},
2105 {"hecmwST_local_mesh", "n_node_gross", set_n_node_gross, NULL},
2106 {"hecmwST_local_mesh", "nn_middle", set_nn_middle, NULL},
2107 {"hecmwST_local_mesh", "nn_internal", set_nn_internal, NULL},
2108 {"hecmwST_local_mesh", "node_internal_list", set_node_internal_list,
2109 is_alloc_node_internal_list},
2110 {"hecmwST_local_mesh", "node_ID", set_node_ID, NULL},
2111 {"hecmwST_local_mesh", "global_node_ID", set_global_node_ID, NULL},
2112 {"hecmwST_local_mesh", "node", set_node, NULL},
2113 {"hecmwST_local_mesh", "n_dof", set_n_dof, NULL},
2114 {"hecmwST_local_mesh", "n_dof_grp", set_n_dof_grp, NULL},
2115 {"hecmwST_local_mesh", "n_dof_tot", set_n_dof_tot, NULL},
2116 {"hecmwST_local_mesh", "node_dof_index", set_node_dof_index, NULL},
2117 {"hecmwST_local_mesh", "node_dof_item", set_node_dof_item, NULL},
2118 {"hecmwST_local_mesh", "node_val_index", set_node_val_index,
2119 is_alloc_node_val_index},
2120 {"hecmwST_local_mesh", "node_val_item", set_node_val_item,
2121 is_alloc_node_val_item},
2122 {"hecmwST_local_mesh", "node_init_val_index", set_node_init_val_index,
2123 is_alloc_node_init_val_index},
2124 {"hecmwST_local_mesh", "node_init_val_item", set_node_init_val_item,
2125 is_alloc_node_init_val_item},
2126 {"hecmwST_local_mesh", "n_elem", set_n_elem, NULL},
2127 {"hecmwST_local_mesh", "n_elem_gross", set_n_elem_gross, NULL},
2128 {"hecmwST_local_mesh", "ne_internal", set_ne_internal, NULL},
2129 {"hecmwST_local_mesh", "elem_internal_list", set_elem_internal_list,
2130 is_alloc_elem_internal_list},
2131 {"hecmwST_local_mesh", "elem_ID", set_elem_ID, NULL},
2132 {"hecmwST_local_mesh", "global_elem_ID", set_global_elem_ID, NULL},
2133 {"hecmwST_local_mesh", "elem_type", set_elem_type, NULL},
2134 {"hecmwST_local_mesh", "n_elem_type", set_n_elem_type, NULL},
2135 {"hecmwST_local_mesh", "elem_type_index", set_elem_type_index, NULL},
2136 {"hecmwST_local_mesh", "elem_type_item", set_elem_type_item, NULL},
2137 {"hecmwST_local_mesh", "elem_node_index", set_elem_node_index, NULL},
2138 {"hecmwST_local_mesh", "elem_node_item", set_elem_node_item, NULL},
2139 {"hecmwST_local_mesh", "section_ID", set_section_ID, NULL},
2140 {"hecmwST_local_mesh", "n_elem_mat_ID", set_n_elem_mat_ID, NULL},
2141 {"hecmwST_local_mesh", "elem_mat_ID_index", set_elem_mat_ID_index,
2142 NULL},
2143 {"hecmwST_local_mesh", "elem_mat_ID_item", set_elem_mat_ID_item, NULL},
2144 {"hecmwST_local_mesh", "elem_mat_int_index", set_elem_mat_int_index,
2145 is_alloc_elem_mat_int_index},
2146 {"hecmwST_local_mesh", "elem_mat_int_val", set_elem_mat_int_val,
2147 is_alloc_elem_mat_int_val},
2148 {"hecmwST_local_mesh", "elem_val_index", set_elem_val_index,
2149 is_alloc_elem_val_index},
2150 {"hecmwST_local_mesh", "elem_val_item", set_elem_val_item,
2151 is_alloc_elem_val_item},
2152
2153 {"hecmwST_local_mesh", "zero", set_zero, NULL},
2154 {"hecmwST_local_mesh", "HECMW_COMM", set_HECMW_COMM, NULL},
2155 {"hecmwST_local_mesh", "PETOT", set_PETOT, NULL},
2156 {"hecmwST_local_mesh", "PEsmpTOT", set_PEsmpTOT, NULL},
2157 {"hecmwST_local_mesh", "my_rank", set_my_rank, NULL},
2158 {"hecmwST_local_mesh", "errnof", set_errnof, NULL},
2159 {"hecmwST_local_mesh", "n_subdomain", set_n_subdomain, NULL},
2160 {"hecmwST_local_mesh", "n_neighbor_pe", set_n_neighbor_pe, NULL},
2161 {"hecmwST_local_mesh", "neighbor_pe", set_neighbor_pe, NULL},
2162 {"hecmwST_local_mesh", "import_index", set_import_index, NULL},
2163 {"hecmwST_local_mesh", "import_item", set_import_item, NULL},
2164 {"hecmwST_local_mesh", "export_index", set_export_index, NULL},
2165 {"hecmwST_local_mesh", "export_item", set_export_item, NULL},
2166 {"hecmwST_local_mesh", "shared_index", set_shared_index, NULL},
2167 {"hecmwST_local_mesh", "shared_item", set_shared_item, NULL},
2168
2169 {"hecmwST_local_mesh", "coarse_grid_level", set_coarse_grid_level,
2170 NULL},
2171 {"hecmwST_local_mesh", "n_adapt", set_n_adapt, NULL},
2172 {"hecmwST_local_mesh", "when_i_was_refined_node",
2173 set_when_i_was_refined_node, is_alloc_when_i_was_refined_node},
2174 {"hecmwST_local_mesh", "when_i_was_refined_elem",
2175 set_when_i_was_refined_elem, is_alloc_when_i_was_refined_elem},
2176 {"hecmwST_local_mesh", "adapt_parent_type", set_adapt_parent_type,
2177 is_alloc_adapt_parent_type},
2178 {"hecmwST_local_mesh", "adapt_type", set_adapt_type,
2179 is_alloc_adapt_type},
2180 {"hecmwST_local_mesh", "adapt_level", set_adapt_level,
2181 is_alloc_adapt_level},
2182 {"hecmwST_local_mesh", "adapt_parent", set_adapt_parent,
2183 is_alloc_adapt_parent},
2184 {"hecmwST_local_mesh", "adapt_children_index", set_adapt_children_index,
2185 is_alloc_adapt_children_index},
2186 {"hecmwST_local_mesh", "adapt_children_item", set_adapt_children_item,
2187 is_alloc_adapt_children_item},
2188
2189 {"hecmwST_local_mesh", "n_refine", set_n_refine, NULL},
2190 {"hecmwST_local_mesh", "node_old2new", set_node_old2new,
2191 is_alloc_node_old2new},
2192 {"hecmwST_local_mesh", "node_new2old", set_node_new2old,
2193 is_alloc_node_new2old},
2194 {"hecmwST_local_mesh", "elem_old2new", set_elem_old2new,
2195 is_alloc_elem_old2new},
2196 {"hecmwST_local_mesh", "elem_new2old", set_elem_new2old,
2197 is_alloc_elem_new2old},
2198 {"hecmwST_local_mesh", "n_node_refine_hist", set_n_node_refine_hist,
2199 is_alloc_n_node_refine_hist},
2200
2201 {"hecmwST_section", "n_sect", set_n_sect, NULL},
2202 {"hecmwST_section", "sect_type", set_sect_type, NULL},
2203 {"hecmwST_section", "sect_opt", set_sect_opt, NULL},
2204 {"hecmwST_section", "sect_mat_ID_index", set_sect_mat_ID_index, NULL},
2205 {"hecmwST_section", "sect_mat_ID_item", set_sect_mat_ID_item, NULL},
2206 {"hecmwST_section", "sect_I_index", set_sect_I_index, NULL},
2207 {"hecmwST_section", "sect_I_item", set_sect_I_item, NULL},
2208 {"hecmwST_section", "sect_R_index", set_sect_R_index, NULL},
2209 {"hecmwST_section", "sect_R_item", set_sect_R_item, NULL},
2210
2211 {"hecmwST_material", "n_mat", set_n_mat, NULL},
2212 {"hecmwST_material", "n_mat_item", set_n_mat_item, NULL},
2213 {"hecmwST_material", "n_mat_subitem", set_n_mat_subitem, NULL},
2214 {"hecmwST_material", "n_mat_table", set_n_mat_table, NULL},
2215 {"hecmwST_material", "mat_name", set_mat_name, NULL},
2216 {"hecmwST_material", "mat_item_index", set_mat_item_index, NULL},
2217 {"hecmwST_material", "mat_subitem_index", set_mat_subitem_index, NULL},
2218 {"hecmwST_material", "mat_table_index", set_mat_table_index, NULL},
2219 {"hecmwST_material", "mat_val", set_mat_val, NULL},
2220 {"hecmwST_material", "mat_temp", set_mat_temp, NULL},
2221
2222 {"hecmwST_mpc", "n_mpc", set_n_mpc, NULL},
2223 {"hecmwST_mpc", "mpc_index", set_mpc_index, NULL},
2224 {"hecmwST_mpc", "mpc_item", set_mpc_item, NULL},
2225 {"hecmwST_mpc", "mpc_dof", set_mpc_dof, NULL},
2226 {"hecmwST_mpc", "mpc_val", set_mpc_val, NULL},
2227 {"hecmwST_mpc", "mpc_const", set_mpc_const, NULL},
2228
2229 {"hecmwST_amplitude", "n_amp", set_n_amp, NULL},
2230 {"hecmwST_amplitude", "amp_name", set_amp_name, NULL},
2231 {"hecmwST_amplitude", "amp_type_definition", set_amp_type_definition,
2232 NULL},
2233 {"hecmwST_amplitude", "amp_type_time", set_amp_type_time, NULL},
2234 {"hecmwST_amplitude", "amp_type_value", set_amp_type_value, NULL},
2235 {"hecmwST_amplitude", "amp_index", set_amp_index, NULL},
2236 {"hecmwST_amplitude", "amp_val", set_amp_val, NULL},
2237 {"hecmwST_amplitude", "amp_table", set_amp_table, NULL},
2238
2239 {"hecmwST_node_grp", "n_grp", set_ngrp_n_grp, NULL},
2240 {"hecmwST_node_grp", "grp_name", set_ngrp_grp_name, NULL},
2241 {"hecmwST_node_grp", "grp_index", set_ngrp_grp_index, NULL},
2242 {"hecmwST_node_grp", "grp_item", set_ngrp_grp_item, NULL},
2243 {"hecmwST_node_grp", "n_bc", set_ngrp_n_bc, NULL},
2244 {"hecmwST_node_grp", "bc_grp_ID", set_ngrp_bc_grp_ID,
2245 is_alloc_ngrp_bc_grp_ID},
2246 {"hecmwST_node_grp", "bc_grp_type", set_ngrp_bc_grp_type,
2247 is_alloc_ngrp_bc_grp_type},
2248 {"hecmwST_node_grp", "bc_grp_index", set_ngrp_bc_grp_index,
2249 is_alloc_ngrp_bc_grp_index},
2250 {"hecmwST_node_grp", "bc_grp_dof", set_ngrp_bc_grp_dof,
2251 is_alloc_ngrp_bc_grp_dof},
2252 {"hecmwST_node_grp", "bc_grp_val", set_ngrp_bc_grp_val,
2253 is_alloc_ngrp_bc_grp_val},
2254
2255 {"hecmwST_elem_grp", "n_grp", set_egrp_n_grp, NULL},
2256 {"hecmwST_elem_grp", "grp_name", set_egrp_grp_name, NULL},
2257 {"hecmwST_elem_grp", "grp_index", set_egrp_grp_index, NULL},
2258 {"hecmwST_elem_grp", "grp_item", set_egrp_grp_item, NULL},
2259 {"hecmwST_elem_grp", "n_bc", set_egrp_n_bc, NULL},
2260 {"hecmwST_elem_grp", "bc_grp_ID", set_egrp_bc_grp_ID,
2261 is_alloc_egrp_bc_grp_ID},
2262 {"hecmwST_elem_grp", "bc_grp_type", set_egrp_bc_grp_type,
2263 is_alloc_egrp_bc_grp_type},
2264 {"hecmwST_elem_grp", "bc_grp_index", set_egrp_bc_grp_index,
2265 is_alloc_egrp_bc_grp_index},
2266 {"hecmwST_elem_grp", "bc_grp_val", set_egrp_bc_grp_val,
2267 is_alloc_egrp_bc_grp_val},
2268
2269 {"hecmwST_surf_grp", "n_grp", set_sgrp_n_grp, NULL},
2270 {"hecmwST_surf_grp", "grp_name", set_sgrp_grp_name, NULL},
2271 {"hecmwST_surf_grp", "grp_index", set_sgrp_grp_index, NULL},
2272 {"hecmwST_surf_grp", "grp_item", set_sgrp_grp_item, NULL},
2273 {"hecmwST_surf_grp", "n_bc", set_sgrp_n_bc, NULL},
2274 {"hecmwST_surf_grp", "bc_grp_ID", set_sgrp_bc_grp_ID,
2275 is_alloc_sgrp_bc_grp_ID},
2276 {"hecmwST_surf_grp", "bc_grp_type", set_sgrp_bc_grp_type,
2277 is_alloc_sgrp_bc_grp_type},
2278 {"hecmwST_surf_grp", "bc_grp_index", set_sgrp_bc_grp_index,
2279 is_alloc_sgrp_bc_grp_index},
2280 {"hecmwST_surf_grp", "bc_grp_val", set_sgrp_bc_grp_val,
2281 is_alloc_sgrp_bc_grp_val},
2282
2283 {"hecmwST_contact_pair", "n_pair", set_contact_pair_n_pair, NULL},
2284 {"hecmwST_contact_pair", "name", set_contact_pair_name, NULL},
2285 {"hecmwST_contact_pair", "type", set_contact_pair_type, NULL},
2286 {"hecmwST_contact_pair", "slave_grp_id", set_contact_pair_slave_grp_id,
2287 NULL},
2288 {"hecmwST_contact_pair", "slave_orisgrp_id", set_contact_pair_slave_orisgrp_id,
2289 NULL},
2290 {"hecmwST_contact_pair", "master_grp_id",
2291 set_contact_pair_master_grp_id, NULL},
2292 {"hecmwST_refine_origin", "index", set_refine_origin_index, NULL},
2293 {"hecmwST_refine_origin", "item_index", set_refine_origin_item_index,
2294 NULL},
2295 {"hecmwST_refine_origin", "item_item", set_refine_origin_item_item,
2296 NULL},
2297};
2298
2299static const int NFUNC = sizeof(functions) / sizeof(functions[0]);
2300
2301static IsAllocatedFunc get_is_allocated_func(char *struct_name,
2302 char *var_name) {
2303 int i;
2304
2305 for (i = 0; i < NFUNC; i++) {
2306 if (strcmp(functions[i].struct_name, struct_name) == 0 &&
2307 strcmp(functions[i].var_name, var_name) == 0) {
2308 return functions[i].is_allocated_func;
2309 }
2310 }
2311 return NULL;
2312}
2313
2314static SetFunc get_set_func(char *struct_name, char *var_name) {
2315 int i;
2316
2317 for (i = 0; i < NFUNC; i++) {
2318 if (strcmp(functions[i].struct_name, struct_name) == 0 &&
2319 strcmp(functions[i].var_name, var_name) == 0) {
2320 return functions[i].set_func;
2321 }
2322 }
2323 return NULL;
2324}
2325
2326/*----------------------------------------------------------------------------*/
2327
2329 mesh = local_mesh;
2330 return 0;
2331}
2332
2334 mesh = NULL;
2335 return 0;
2336}
2337
2338/*----------------------------------------------------------------------------*/
2339/*----------------------------------------------------------------------------*/
2340
2341void hecmw_dist_copy_c2f_isalloc_if(char *struct_name, char *var_name,
2342 int *is_allocated, int *err, int len_struct,
2343 int len_var) {
2344 IsAllocatedFunc func;
2345 char sname[HECMW_NAME_LEN + 1];
2346 char vname[HECMW_NAME_LEN + 1];
2347
2348 *err = 1;
2349
2350 if (mesh == NULL) {
2352 "mesh copy(C->Fortran): confirm allocation : 'mesh' has "
2353 "not initialized yet");
2354 return;
2355 }
2356 if (struct_name == NULL) {
2359 "mesh copy(C->Fortran): confirm allocation: 'struct_name' is NULL");
2360 return;
2361 }
2362 if (var_name == NULL) {
2365 "mesh copy(C->Fortran): confirm allocation: 'var_name' is NULL");
2366 return;
2367 }
2368 if (is_allocated == NULL) {
2371 "mesh copy(C->Fortran): confirm allocation: 'is_allocated' is NULL");
2372 return;
2373 }
2374
2375 if (HECMW_strcpy_f2c_r(struct_name, len_struct, sname, sizeof(sname)) ==
2376 NULL) {
2377 return;
2378 }
2379 if (HECMW_strcpy_f2c_r(var_name, len_var, vname, sizeof(vname)) == NULL) {
2380 return;
2381 }
2382
2383 func = get_is_allocated_func(sname, vname);
2384 if (func == NULL) {
2386 "HECMW_mesh_is_allocated(): IsAllocatedFunc not found");
2387 return;
2388 }
2389
2390 if ((*func)()) {
2391 *is_allocated = 1;
2392 } else {
2393 *is_allocated = 0;
2394 }
2395
2396 *err = 0; /* no error */
2397}
2398
2399void hecmw_dist_copy_c2f_isalloc_if_(char *struct_name, char *var_name,
2400 int *is_allocated, int *err,
2401 int len_struct, int len_var) {
2402 hecmw_dist_copy_c2f_isalloc_if(struct_name, var_name, is_allocated, err,
2403 len_struct, len_var);
2404}
2405
2406void hecmw_dist_copy_c2f_isalloc_if__(char *struct_name, char *var_name,
2407 int *is_allocated, int *err,
2408 int len_struct, int len_var) {
2409 hecmw_dist_copy_c2f_isalloc_if(struct_name, var_name, is_allocated, err,
2410 len_struct, len_var);
2411}
2412
2413void HECMW_DIST_COPY_C2F_ISALLOC_IF(char *struct_name, char *var_name,
2414 int *is_allocated, int *err, int len_struct,
2415 int len_var) {
2416 hecmw_dist_copy_c2f_isalloc_if(struct_name, var_name, is_allocated, err,
2417 len_struct, len_var);
2418}
2419
2420/*----------------------------------------------------------------------------*/
2421
2422void hecmw_dist_copy_c2f_set_if(char *struct_name, char *var_name, void *dst,
2423 int *err, int len_struct, int len_var) {
2424 SetFunc func;
2425 char sname[HECMW_NAME_LEN + 1];
2426 char vname[HECMW_NAME_LEN + 1];
2427
2428 *err = 1;
2429
2430 if (mesh == NULL) {
2432 "mesh copy(C->Fortran): 'mesh' has not initialized yet");
2433 return;
2434 }
2435 if (struct_name == NULL) {
2436 HECMW_set_error(HECMW_ALL_E0101, "mesh copy(C->Fortran): 'sname' is NULL");
2437 return;
2438 }
2439 if (var_name == NULL) {
2440 HECMW_set_error(HECMW_ALL_E0101, "mesh copy(C->Fotran): 'vname' is NULL");
2441 return;
2442 }
2443 if (dst == NULL) {
2444 HECMW_set_error(HECMW_ALL_E0101, "mesh copy(C->Fortran): 'dst' is NULL");
2445 return;
2446 }
2447
2448 if (HECMW_strcpy_f2c_r(struct_name, len_struct, sname, sizeof(sname)) ==
2449 NULL) {
2450 return;
2451 }
2452 if (HECMW_strcpy_f2c_r(var_name, len_var, vname, sizeof(vname)) == NULL) {
2453 return;
2454 }
2455
2456 func = get_set_func(sname, vname);
2457 if (func == NULL) {
2459 "mesh copy(C->Fortran): SetFunc not found");
2460 return;
2461 }
2462
2463 if ((*func)(dst)) {
2464 return;
2465 }
2466
2467 *err = 0; /* no error */
2468}
2469
2470void hecmw_dist_copy_c2f_set_if_(char *struct_name, char *var_name, void *dst,
2471 int *err, int len_struct, int len_var) {
2472 hecmw_dist_copy_c2f_set_if(struct_name, var_name, dst, err, len_struct,
2473 len_var);
2474}
2475
2476void hecmw_dist_copy_c2f_set_if__(char *struct_name, char *var_name, void *dst,
2477 int *err, int len_struct, int len_var) {
2478 hecmw_dist_copy_c2f_set_if(struct_name, var_name, dst, err, len_struct,
2479 len_var);
2480}
2481
2482void HECMW_DIST_COPY_C2F_SET_IF(char *struct_name, char *var_name, void *dst,
2483 int *err, int len_struct, int len_var) {
2484 hecmw_dist_copy_c2f_set_if(struct_name, var_name, dst, err, len_struct,
2485 len_var);
2486}
HECMW_Fint HECMW_Comm_c2f(HECMW_Comm comm)
Definition: hecmw_comm.c:715
#define HECMW_FILENAME_LEN
Definition: hecmw_config.h:72
MPI_Fint HECMW_Fint
Definition: hecmw_config.h:42
#define HECMW_HEADER_LEN
Definition: hecmw_config.h:68
#define HECMW_NAME_LEN
Definition: hecmw_config.h:70
int(* SetFunc)(void *)
void HECMW_DIST_COPY_C2F_SET_IF(char *struct_name, char *var_name, void *dst, int *err, int len_struct, int len_var)
void hecmw_dist_copy_c2f_isalloc_if_(char *struct_name, char *var_name, int *is_allocated, int *err, int len_struct, int len_var)
int HECMW_dist_copy_c2f_init(struct hecmwST_local_mesh *local_mesh)
void hecmw_dist_copy_c2f_set_if__(char *struct_name, char *var_name, void *dst, int *err, int len_struct, int len_var)
void hecmw_dist_copy_c2f_isalloc_if(char *struct_name, char *var_name, int *is_allocated, int *err, int len_struct, int len_var)
void hecmw_dist_copy_c2f_isalloc_if__(char *struct_name, char *var_name, int *is_allocated, int *err, int len_struct, int len_var)
int(* IsAllocatedFunc)(void)
void hecmw_dist_copy_c2f_set_if_(char *struct_name, char *var_name, void *dst, int *err, int len_struct, int len_var)
int HECMW_dist_copy_c2f_finalize(void)
void HECMW_DIST_COPY_C2F_ISALLOC_IF(char *struct_name, char *var_name, int *is_allocated, int *err, int len_struct, int len_var)
int(* SetFunc)(void *)
void hecmw_dist_copy_c2f_set_if(char *struct_name, char *var_name, void *dst, int *err, int len_struct, int len_var)
int HECMW_set_error(int errorno, const char *fmt,...)
Definition: hecmw_error.c:37
#define NULL
int HECMW_strcpy_c2f(const char *cstr, char *fstr, int flen)
Definition: hecmw_lib_fc.c:72
char * HECMW_strcpy_f2c_r(const char *fstr, int flen, char *buf, int bufsize)
Definition: hecmw_lib_fc.c:45
#define HECMW_ALL_E0101
Definition: hecmw_msgno.h:12
#define HECMW_ALL_E0102
Definition: hecmw_msgno.h:13
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
char gridfile[HECMW_FILENAME_LEN+1]
Definition: hecmw_struct.h:153
char header[HECMW_HEADER_LEN+1]
Definition: hecmw_struct.h:156
HECMW_Comm HECMW_COMM
Definition: hecmw_struct.h:208
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