Debian Codegraph @

packages/seacas/libraries/nemesis/ne_ctest_wrap.c

raw
1 /*
2 * Copyright(C) 1999-2021 National Technology & Engineering Solutions
3 * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
4 * NTESS, the U.S. Government retains certain rights in this software.
5 *
6 * See packages/seacas/LICENSE for details
7 */
8 /*****************************************************************************/
9 /*****************************************************************************/
10 /*****************************************************************************/
11 /* This file contains the source code for the program used to test the
12 * Nemesis distribution.
13 *****************************************************************************
14 * Written By: Gary L. Hennigan (SNL, 1421)
15 *****************************************************************************
16 * Functions contained in this file:
17 * main() - Entry point and main calling program.
18 */
19 /*****************************************************************************/
20 /*****************************************************************************/
21 /*****************************************************************************/
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <string.h>
25
26 #include <exodusII.h>
27
28 #include "ne_nemesisI.h"
29
30 /* Constants for init_global functions */
31 #define NNG 100
32 #define NEG 50
33 #define NEBG 5
34 #define NEBCG 10
35 #define NNSG 2
36 #define NSSG 3
37
38 /* Constants for load-balance functions */
39 #define NPROC 10
40 #define NPROCF NPROC
41 #define NINTN 200
42 #define NBORN 10
43 #define NEXTN 5
44 #define NINTE 100
45 #define NBORE 20
46 #define NNCMAP 4
47 #define NECMAP 2
48
49 /* Constants for communication map */
50 #define NCNTCM 20
51 #define ECNTCM 17
52
53 int main(int argc, char *argv[])
54 {
55
56 /* Local function calls */
57 int ne_test_glbp(int);
58 int ne_test_piinf(int);
59 int ne_test_pinig(int);
60 int ne_test_pelbid(int);
61 int ne_test_pnsp(int);
62 int ne_test_pssp(int);
63 int ne_test_pnm(int);
64 int ne_test_pem(int);
65 int ne_test_pcmp(int);
66 int ne_test_pncm(int);
67 int ne_test_pecm(int);
68
69 int ne_test_giinf(int);
70 int ne_test_ginig(int);
71 int ne_test_gelbid(int);
72 int ne_test_gnsp(int);
73 int ne_test_gssp(int);
74 int ne_test_gnm(int);
75 int ne_test_gem(int);
76 int ne_test_gncm(int);
77 int ne_test_gecm(int);
78
79 int ne_test_plbpc(int);
80 int ne_test_pcmpc(int);
81
82 /* Uninitialized local variables */
83 int ne_file_id;
84 char *file_name = "./ne_test.exoII";
85 float version;
86
87 /* Initialized local variables */
88 int mode3 = EX_CLOBBER;
89 int mode4 = EX_CLOBBER | EX_NETCDF4 | EX_NOCLASSIC;
90
91 char *yo = "main";
92 int io_ws = 0, cpu_ws = 0, t_pass = 0, t_fail = 0;
93
94 /*---------------------------------------------------------------------------*/
95 /* OUTPUT TEST SECTION */
96 /*---------------------------------------------------------------------------*/
97
98 printf("*********************Output Tests***********************\n");
99
100 /* Create the ExodusII/Nemesis file */
101 printf("creating ExodusII file...");
102 fflush(stdout);
103
104 /* Attempt to create a netcdf4-format file; if it fails, then assume
105 that the netcdf library does not support that mode and fall back
106 to classic netcdf3 format. If that fails, issue an error and
107 die.
108 */
109 if ((ne_file_id = ex_create(file_name, mode4, &cpu_ws, &io_ws)) < 0) {
110 /* netcdf4 create failed, try netcdf3 */
111 if ((ne_file_id = ex_create(file_name, mode3, &cpu_ws, &io_ws)) < 0) {
112 printf("FAILED\n");
113 t_fail++;
114 fprintf(stderr, "[%s]: ERROR, unable to create test file \"%s\"!\n", yo, file_name);
115 exit(-1);
116 }
117 else {
118 printf(" (netcdf3 format) ");
119 }
120 }
121 else {
122 printf(" (netcdf4 format) ");
123 }
124 printf("successful\n");
125 fflush(stdout);
126 t_pass++;
127
128 /* Test the output of initial information */
129 printf("testing init info output...");
130 fflush(stdout);
131 if (ne_test_piinf(ne_file_id) < 0) {
132 printf("FAILED\n");
133 fflush(stdout);
134 t_fail++;
135 }
136 else {
137 printf("successful\n");
138 fflush(stdout);
139 t_pass++;
140 }
141
142 /* Test the output of initial global information */
143 printf("testing global init info output...");
144 fflush(stdout);
145 if (ne_test_pinig(ne_file_id) < 0) {
146 printf("FAILED\n");
147 fflush(stdout);
148 t_fail++;
149 }
150 else {
151 printf("successful\n");
152 fflush(stdout);
153 t_pass++;
154 }
155
156 /* Test the output of the global element block IDs */
157 printf("testing global element block ID output...");
158 fflush(stdout);
159 if (ne_test_pelbid(ne_file_id) < 0) {
160 printf("FAILED\n");
161 fflush(stdout);
162 t_fail++;
163 }
164 else {
165 printf("successful\n");
166 fflush(stdout);
167 t_pass++;
168 }
169
170 /* Test the output of the global node-set info */
171 printf("testing global node-set params output...");
172 fflush(stdout);
173 if (ne_test_pnsp(ne_file_id) < 0) {
174 printf("FAILED\n");
175 fflush(stdout);
176 t_fail++;
177 }
178 else {
179 printf("successful\n");
180 fflush(stdout);
181 t_pass++;
182 }
183
184 /* Test the output of the global side-set info */
185 printf("testing global side-set params output...");
186 fflush(stdout);
187 if (ne_test_pssp(ne_file_id) < 0) {
188 printf("FAILED\n");
189 fflush(stdout);
190 t_fail++;
191 }
192 else {
193 printf("successful\n");
194 fflush(stdout);
195 t_pass++;
196 }
197
198 /* Test the output of the concatenated load-balance parameters */
199 printf("testing concatenated load balance info output...");
200 fflush(stdout);
201 if (ne_test_plbpc(ne_file_id) < 0) {
202 printf("FAILED\n");
203 fflush(stdout);
204 }
205 else {
206 printf("successful\n");
207 fflush(stdout);
208 }
209
210 /* Test the output of the node map */
211 printf("testing node map output...");
212 fflush(stdout);
213 if (ne_test_pnm(ne_file_id) < 0) {
214 printf("FAILED\n");
215 fflush(stdout);
216 t_fail++;
217 }
218 else {
219 printf("successful\n");
220 fflush(stdout);
221 t_pass++;
222 }
223
224 /* Test the output of the element map */
225 printf("testing element map output...");
226 fflush(stdout);
227 if (ne_test_pem(ne_file_id) < 0) {
228 printf("FAILED\n");
229 fflush(stdout);
230 t_fail++;
231 }
232 else {
233 printf("successful\n");
234 fflush(stdout);
235 t_pass++;
236 }
237
238 /* Test the output of the concatenated communication map params */
239 printf("testing concatenated communication map params output...");
240 fflush(stdout);
241 if (ne_test_pcmpc(ne_file_id) < 0) {
242 printf("FAILED\n");
243 fflush(stdout);
244 t_fail++;
245 }
246 else {
247 printf("successful\n");
248 fflush(stdout);
249 t_pass++;
250 }
251
252 /* Test nodal communication map output */
253 printf("testing nodal communication map output...");
254 fflush(stdout);
255 if (ne_test_pncm(ne_file_id) < 0) {
256 printf("FAILED\n");
257 fflush(stdout);
258 t_fail++;
259 }
260 else {
261 printf("successful\n");
262 fflush(stdout);
263 t_pass++;
264 }
265
266 /* Test elemental communication map output */
267 printf("testing elemental communication map output...");
268 fflush(stdout);
269 if (ne_test_pecm(ne_file_id) < 0) {
270 printf("FAILED\n");
271 fflush(stdout);
272 t_fail++;
273 }
274 else {
275 printf("successful\n");
276 fflush(stdout);
277 t_pass++;
278 }
279
280 /* Close the ExodusII/Nemesis test file */
281 printf("closing ExodusII file...");
282 fflush(stdout);
283 if (ex_close(ne_file_id) < 0) {
284 printf("FAILED\n");
285 fflush(stdout);
286 t_fail++;
287 fprintf(stderr, "[%s]: ERROR, unable to close test file \"%s\"!\n", yo, file_name);
288 exit(-1);
289 }
290 printf("successful\n");
291 fflush(stdout);
292 t_pass++;
293
294 /*---------------------------------------------------------------------------*/
295 /* INPUT TEST SECTION */
296 /*---------------------------------------------------------------------------*/
297
298 printf("**********************Input Tests***********************\n");
299
300 /* Re-open the ExodusII/NemesisI file */
301 printf("reopening ExodusII file...");
302 fflush(stdout);
303 if (ex_open(file_name, EX_READ, &cpu_ws, &io_ws, &version) < 0) {
304 printf("FAILED\n");
305 fflush(stdout);
306 t_fail++;
307 }
308 else {
309 printf("successful\n");
310 fflush(stdout);
311 t_pass++;
312 }
313
314 /* Test read of of the initial information */
315 printf("testing init info input...");
316 fflush(stdout);
317 if (ne_test_giinf(ne_file_id) < 0) {
318 printf("FAILED\n");
319 fflush(stdout);
320 t_fail++;
321 }
322 else {
323 printf("successful\n");
324 fflush(stdout);
325 t_pass++;
326 }
327
328 /* Test read of initial global information */
329 printf("testing global init info input...");
330 fflush(stdout);
331 if (ne_test_ginig(ne_file_id) < 0) {
332 printf("FAILED\n");
333 fflush(stdout);
334 t_fail++;
335 }
336 else {
337 printf("successful\n");
338 fflush(stdout);
339 t_pass++;
340 }
341
342 /* Test read of global element block IDs */
343 printf("testing global element block IDs input...");
344 fflush(stdout);
345 if (ne_test_gelbid(ne_file_id) < 0) {
346 printf("FAILED\n");
347 fflush(stdout);
348 t_fail++;
349 }
350 else {
351 printf("successful\n");
352 fflush(stdout);
353 t_pass++;
354 }
355
356 /* Test read of global node-set params */
357 printf("testing global node-set params input...");
358 fflush(stdout);
359 if (ne_test_gnsp(ne_file_id) < 0) {
360 printf("FAILED\n");
361 fflush(stdout);
362 t_fail++;
363 }
364 else {
365 printf("successful\n");
366 fflush(stdout);
367 t_pass++;
368 }
369
370 /* Test read of global side-set params */
371 printf("testing global side-set params input...");
372 fflush(stdout);
373 if (ne_test_gssp(ne_file_id) < 0) {
374 printf("FAILED\n");
375 fflush(stdout);
376 t_fail++;
377 }
378 else {
379 printf("successful\n");
380 fflush(stdout);
381 t_pass++;
382 }
383
384 /* Test read of load-balance params */
385 printf("testing load-balance params input...");
386 fflush(stdout);
387 if (ne_test_glbp(ne_file_id) < 0) {
388 printf("FAILED\n");
389 fflush(stdout);
390 t_fail++;
391 }
392 else {
393 printf("successful\n");
394 fflush(stdout);
395 t_pass++;
396 }
397
398 /* Test read of the node map */
399 printf("testing node map input...");
400 fflush(stdout);
401 if (ne_test_gnm(ne_file_id) < 0) {
402 printf("FAILED\n");
403 fflush(stdout);
404 t_fail++;
405 }
406 else {
407 printf("successful\n");
408 fflush(stdout);
409 t_pass++;
410 }
411
412 /* Test read of element map */
413 printf("testing element map input...");
414 fflush(stdout);
415 if (ne_test_gem(ne_file_id) < 0) {
416 printf("FAILED\n");
417 fflush(stdout);
418 t_fail++;
419 }
420 else {
421 printf("successful\n");
422 fflush(stdout);
423 t_pass++;
424 }
425
426 /* Test read of nodal communication maps */
427 printf("testing nodal communication map input...");
428 fflush(stdout);
429 if (ne_test_gncm(ne_file_id) < 0) {
430 printf("FAILED\n");
431 fflush(stdout);
432 t_fail++;
433 }
434 else {
435 printf("successful\n");
436 fflush(stdout);
437 t_pass++;
438 }
439
440 /* Test read of elemental communication maps */
441 printf("testing elemental communication map input...");
442 fflush(stdout);
443 if (ne_test_gecm(ne_file_id) < 0) {
444 printf("FAILED\n");
445 fflush(stdout);
446 t_fail++;
447 }
448 else {
449 printf("successful\n");
450 fflush(stdout);
451 t_pass++;
452 }
453
454 /* Close the ExodusII/Nemesis test file */
455 printf("closing ExodusII file...");
456 fflush(stdout);
457 if (ex_close(ne_file_id) < 0) {
458 printf("FAILED\n");
459 fflush(stdout);
460 t_fail++;
461 fprintf(stderr, "[%s]: ERROR, unable to close test file \"%s\"!\n", yo, file_name);
462 exit(-1);
463 }
464 printf("successful\n");
465 fflush(stdout);
466 t_pass++;
467
468 /* Output a test summary */
469 printf("\n");
470 printf("Tests Passed: %d\n", t_pass);
471 printf("Tests Failed: %d\n", t_fail);
472
473 return 0;
474 }
475
476 /*****************************************************************************/
477 int ne_test_piinf(int fileid)
478 {
479 char ftype[3];
480
481 ex_copy_string(ftype, "s", 3);
482
483 return (ne_put_init_info(fileid, NPROC, NPROCF, ftype));
484 }
485
486 /*****************************************************************************/
487 int ne_test_pinig(int fileid)
488 {
489
490 int nng = NNG, neg = NEG, nebg = NEBG, nnsg = NNSG, nssg = NSSG;
491
492 return (ne_put_init_global(fileid, nng, neg, nebg, nnsg, nssg));
493 }
494
495 /*****************************************************************************/
496 int ne_test_pelbid(int fileid)
497 {
498 int elblk_ids[NEBG], elblk_cnt[NEBG];
499
500 for (int i = 0; i < NEBG; i++) {
501 elblk_ids[i] = (i + 1);
502 elblk_cnt[i] = NEBCG;
503 }
504
505 return (ne_put_eb_info_global(fileid, elblk_ids, elblk_cnt));
506 }
507
508 /*****************************************************************************/
509 int ne_test_pnsp(int fileid)
510 {
511 int global_ids[NNSG], global_n_cnts[NNSG], global_df_cnts[NNSG];
512
513 for (int i = 0; i < NNSG; i++) {
514 global_ids[i] = 2 * (i + 1);
515 global_n_cnts[i] = 3 * (i + 1);
516 global_df_cnts[i] = 1;
517 }
518
519 return (ne_put_ns_param_global(fileid, global_ids, global_n_cnts, global_df_cnts));
520 }
521
522 /*****************************************************************************/
523 int ne_test_pssp(int fileid)
524 {
525 int global_ids[NSSG], global_el_cnts[NSSG], global_df_cnts[NSSG];
526
527 for (int i = 0; i < NSSG; i++) {
528 global_ids[i] = 3 * (i + 1);
529 global_el_cnts[i] = 2 * (i + 1);
530 global_df_cnts[i] = 1;
531 }
532
533 return (ne_put_ss_param_global(fileid, global_ids, global_el_cnts, global_df_cnts));
534 }
535
536 /*****************************************************************************/
537 int ne_test_pnm(int fileid)
538 {
539 int j1 = 0;
540 int node_mapi[NINTN], node_mapb[NBORN], node_mape[NEXTN];
541
542 for (int iproc = 0; iproc < NPROCF; iproc++) {
543 for (int j = 0; j < NINTN; node_mapi[j++] = j1++) {
544 ;
545 }
546 for (int j = 0; j < NBORN; node_mapb[j++] = j1++) {
547 ;
548 }
549 for (int j = 0; j < NEXTN; node_mape[j++] = j1++) {
550 ;
551 }
552 j1 = 0;
553 int error = ne_put_node_map(fileid, node_mapi, node_mapb, node_mape, iproc);
554 if (error < 0) {
555 return error;
556 }
557 }
558
559 return 0;
560 }
561
562 /*****************************************************************************/
563 int ne_test_pem(int fileid)
564 {
565 int j1 = 0;
566 int elem_mapi[NINTE], elem_mapb[NBORE];
567
568 for (int iproc = 0; iproc < NPROCF; iproc++) {
569 for (int j = 0; j < NINTE; elem_mapi[j++] = j1++) {
570 ;
571 }
572 for (int j = 0; j < NBORE; elem_mapb[j++] = j1++) {
573 ;
574 }
575 j1 = 0;
576 int error = ne_put_elem_map(fileid, elem_mapi, elem_mapb, iproc);
577 if (error < 0) {
578 return error;
579 }
580 }
581
582 return 0;
583 }
584
585 /*****************************************************************************/
586 int ne_test_pcmp(int fileid)
587 {
588 int node_map_ids[NNCMAP], node_map_node_cnts[NNCMAP];
589 int elem_map_ids[NECMAP], elem_map_elem_cnts[NECMAP];
590
591 for (int iproc = 0; iproc < NPROCF; iproc++) {
592 for (int i = 0; i < NNCMAP; i++) {
593 node_map_ids[i] = (i + 1);
594 node_map_node_cnts[i] = NCNTCM;
595 }
596
597 for (int i = 0; i < NECMAP; i++) {
598 elem_map_ids[i] = 2 * (i + 1);
599 elem_map_elem_cnts[i] = ECNTCM;
600 }
601
602 int error = ne_put_cmap_params(fileid, node_map_node_cnts, node_map_ids, elem_map_elem_cnts,
603 elem_map_ids, iproc);
604 if (error < 0) {
605 return error;
606 }
607 }
608
609 return 0;
610 }
611
612 /*****************************************************************************/
613 int ne_test_pncm(int fileid)
614 {
615 int node_map_ids[NNCMAP], node_ids[NCNTCM], proc_ids[NCNTCM];
616
617 for (int iproc = 0; iproc < NPROCF; iproc++) {
618 for (int i = 0; i < NNCMAP; i++) {
619 node_map_ids[i] = (i + 1);
620 }
621 for (int i = 0; i < NCNTCM; i++) {
622 node_ids[i] = 2 * (i + 1);
623 proc_ids[i] = 3 * (i + 1);
624 }
625
626 for (int i = 0; i < NNCMAP; i++) {
627 int error = ne_put_node_cmap(fileid, node_map_ids[i], node_ids, proc_ids, iproc);
628 if (error < 0) {
629 return error;
630 }
631 }
632 }
633
634 return 0;
635 }
636
637 /*****************************************************************************/
638 int ne_test_pecm(int fileid)
639 {
640 int elem_map_ids[NECMAP], elem_ids[ECNTCM], side_ids[ECNTCM];
641 int proc_ids[ECNTCM];
642
643 for (int iproc = 0; iproc < NPROCF; iproc++) {
644 for (int i = 0; i < NECMAP; i++) {
645 elem_map_ids[i] = 2 * (i + 1);
646 }
647 for (int i = 0; i < ECNTCM; i++) {
648 elem_ids[i] = 2 * (i + 1);
649 side_ids[i] = 3 * (i + 1);
650 proc_ids[i] = 4 * (i + 1);
651 }
652
653 for (int i = 0; i < NECMAP; i++) {
654 int error = ne_put_elem_cmap(fileid, elem_map_ids[i], elem_ids, side_ids, proc_ids, iproc);
655 if (error < 0) {
656 return error;
657 }
658 }
659 }
660
661 return 0;
662 }
663
664 /*****************************************************************************/
665 int ne_test_giinf(int fileid)
666 {
667 int nproc, nprocf;
668 char ftype[2];
669
670 int error = ne_get_init_info(fileid, &nproc, &nprocf, ftype);
671
672 if (error < 0) {
673 return error;
674 }
675
676 if (nproc != NPROC) {
677 return -1;
678 }
679 if (nprocf != NPROCF) {
680 return -1;
681 }
682 if (strcmp(ftype, "s") != 0) {
683 return -1;
684 }
685
686 return 0;
687 }
688
689 /*****************************************************************************/
690 int ne_test_ginig(int fileid)
691 {
692 int num_nodes_g, num_elems_g, num_elem_blks_g, num_ns_g, num_ss_g;
693
694 int error = ne_get_init_global(fileid, &num_nodes_g, &num_elems_g, &num_elem_blks_g, &num_ns_g,
695 &num_ss_g);
696
697 if (error < 0) {
698 return error;
699 }
700
701 if (num_nodes_g != NNG) {
702 return -1;
703 }
704 if (num_elems_g != NEG) {
705 return -1;
706 }
707 if (num_elem_blks_g != NEBG) {
708 return -1;
709 }
710 if (num_ns_g != NNSG) {
711 return -1;
712 }
713 if (num_ss_g != NSSG) {
714 return -1;
715 }
716
717 return 0;
718 }
719
720 /*****************************************************************************/
721 int ne_test_gelbid(int fileid)
722 {
723 int el_blk_ids[NEBG], el_blk_cnt[NEBG];
724
725 int error = ne_get_eb_info_global(fileid, el_blk_ids, el_blk_cnt);
726
727 if (error < 0) {
728 return error;
729 }
730
731 for (int i = 0; i < NEBG; i++) {
732 if (el_blk_ids[i] != (i + 1)) {
733 return -1;
734 }
735 if (el_blk_cnt[i] != NEBCG) {
736 return -1;
737 }
738 }
739
740 return 0;
741 }
742
743 /*****************************************************************************/
744 int ne_test_gnsp(int fileid)
745 {
746 int global_ids[NNSG], global_n_cnts[NNSG], global_df_cnts[NNSG];
747
748 int error = ne_get_ns_param_global(fileid, global_ids, global_n_cnts, global_df_cnts);
749
750 if (error < 0) {
751 return error;
752 }
753
754 for (int i = 0; i < NNSG; i++) {
755 if (global_ids[i] != 2 * (i + 1)) {
756 return -1;
757 }
758 if (global_n_cnts[i] != 3 * (i + 1)) {
759 return -1;
760 }
761 if (global_df_cnts[i] != 1) {
762 return -1;
763 }
764 }
765
766 return 0;
767 }
768
769 /*****************************************************************************/
770 int ne_test_gssp(int fileid)
771 {
772 int global_ids[NSSG], global_e_cnts[NSSG], global_df_cnts[NSSG];
773
774 int error = ne_get_ss_param_global(fileid, global_ids, global_e_cnts, global_df_cnts);
775
776 if (error < 0) {
777 return error;
778 }
779
780 for (int i = 0; i < NSSG; i++) {
781 if (global_ids[i] != 3 * (i + 1)) {
782 return -1;
783 }
784 if (global_e_cnts[i] != 2 * (i + 1)) {
785 return -1;
786 }
787 if (global_df_cnts[i] != 1) {
788 return -1;
789 }
790 }
791
792 return 0;
793 }
794
795 /*****************************************************************************/
796 int ne_test_glbp(int fileid)
797 {
798 int nintn, nborn, nextn, ninte, nbore, nncmap, necmap;
799
800 for (int iproc = 0; iproc < NPROCF; iproc++) {
801 int error = ne_get_loadbal_param(fileid, &nintn, &nborn, &nextn, &ninte, &nbore, &nncmap,
802 &necmap, iproc);
803
804 if (error < 0) {
805 return error;
806 }
807
808 if (nintn != NINTN) {
809 return -1;
810 }
811 if (nborn != NBORN) {
812 return -1;
813 }
814 if (nextn != NEXTN) {
815 return -1;
816 }
817 if (ninte != NINTE) {
818 return -1;
819 }
820 if (nbore != NBORE) {
821 return -1;
822 }
823 if (nncmap != NNCMAP) {
824 return -1;
825 }
826 if (necmap != NECMAP) {
827 return -1;
828 }
829 }
830
831 return 0;
832 }
833
834 /*****************************************************************************/
835 int ne_test_gnm(int fileid)
836 {
837 int j1 = 0;
838 int node_mapi[NINTN], node_mapb[NBORN], node_mape[NEXTN];
839
840 for (int iproc = 0; iproc < NPROCF; iproc++) {
841 int error = ne_get_node_map(fileid, node_mapi, node_mapb, node_mape, iproc);
842
843 if (error < 0) {
844 return error;
845 }
846
847 for (int j = 0; j < NINTN; j++) {
848 if (node_mapi[j] != j1++) {
849 return -1;
850 }
851 }
852 for (int j = 0; j < NBORN; j++) {
853 if (node_mapb[j] != j1++) {
854 return -1;
855 }
856 }
857 for (int j = 0; j < NEXTN; j++) {
858 if (node_mape[j] != j1++) {
859 return -1;
860 }
861 }
862
863 j1 = 0;
864 }
865
866 return 0;
867 }
868
869 /*****************************************************************************/
870 int ne_test_gem(int fileid)
871 {
872 int j1 = 0;
873 int elem_mapi[NINTE], elem_mapb[NBORE];
874
875 for (int iproc = 0; iproc < NPROCF; iproc++) {
876
877 int error = ne_get_elem_map(fileid, elem_mapi, elem_mapb, iproc);
878
879 if (error < 0) {
880 return error;
881 }
882
883 for (int j = 0; j < NINTE; j++) {
884 if (elem_mapi[j] != j1++) {
885 return -1;
886 }
887 }
888 for (int j = 0; j < NBORE; j++) {
889 if (elem_mapb[j] != j1++) {
890 return -1;
891 }
892 }
893 j1 = 0;
894 }
895
896 return 0;
897 }
898
899 /*****************************************************************************/
900 int ne_test_gncm(int fileid)
901 {
902 int node_map_ids[NNCMAP], node_map_cnts[NNCMAP];
903 int node_ids[NCNTCM], proc_ids[NCNTCM];
904
905 for (int iproc = 0; iproc < NPROCF; iproc++) {
906
907 int error = ne_get_cmap_params(fileid, node_map_ids, node_map_cnts, NULL, NULL, iproc);
908
909 if (error < 0) {
910 return error;
911 }
912
913 for (int i = 0; i < NNCMAP; i++) {
914 error = ne_get_node_cmap(fileid, node_map_ids[i], node_ids, proc_ids, iproc);
915
916 if (error < 0) {
917 return error;
918 }
919
920 for (int j = 0; j < NCNTCM; j++) {
921 if (node_ids[j] != 2 * (j + 1)) {
922 return -1;
923 }
924 if (proc_ids[j] != 3 * (j + 1)) {
925 return -1;
926 }
927 }
928 }
929 }
930
931 return 0;
932 }
933
934 /*****************************************************************************/
935 int ne_test_gecm(int fileid)
936 {
937 int elem_ids[ECNTCM], elem_map_cnts[NECMAP], proc_ids[ECNTCM];
938 int side_ids[ECNTCM], elem_map_ids[NECMAP];
939
940 for (int iproc = 0; iproc < NPROCF; iproc++) {
941
942 int error = ne_get_cmap_params(fileid, NULL, NULL, elem_map_ids, elem_map_cnts, iproc);
943
944 if (error < 0) {
945 return error;
946 }
947
948 for (int i = 0; i < NECMAP; i++) {
949 error = ne_get_elem_cmap(fileid, elem_map_ids[i], elem_ids, side_ids, proc_ids, iproc);
950
951 if (error < 0) {
952 return error;
953 }
954
955 for (int j = 0; j < ECNTCM; j++) {
956 if (elem_ids[j] != 2 * (j + 1)) {
957 return -1;
958 }
959 if (side_ids[j] != 3 * (j + 1)) {
960 return -1;
961 }
962 if (proc_ids[j] != 4 * (j + 1)) {
963 return -1;
964 }
965 }
966 }
967 }
968
969 return 0;
970 }
971
972 /*****************************************************************************/
973 int ne_test_plbpc(int fileid)
974 {
975 int num_int_nodes[NPROCF], num_bor_nodes[NPROCF], num_ext_nodes[NPROCF];
976 int num_int_elems[NPROCF], num_bor_elems[NPROCF];
977 int num_node_cmaps[NPROCF], num_elem_cmaps[NPROCF];
978
979 /* Set up the vectors */
980 for (int iproc = 0; iproc < NPROCF; iproc++) {
981 num_int_nodes[iproc] = NINTN;
982 num_bor_nodes[iproc] = NBORN;
983 num_ext_nodes[iproc] = NEXTN;
984
985 num_int_elems[iproc] = NINTE;
986 num_bor_elems[iproc] = NBORE;
987
988 num_node_cmaps[iproc] = NNCMAP;
989 num_elem_cmaps[iproc] = NECMAP;
990 }
991
992 return (ne_put_loadbal_param_cc(fileid, num_int_nodes, num_bor_nodes, num_ext_nodes,
993 num_int_elems, num_bor_elems, num_node_cmaps, num_elem_cmaps));
994 }
995
996 /*****************************************************************************/
997 int ne_test_pcmpc(int fileid)
998 {
999 int nmap_ids[NNCMAP * NPROCF], nmap_n_cnts[NNCMAP * NPROCF];
1000 int nmap_proc_ptr[NPROCF + 1];
1001 int emap_ids[NECMAP * NPROCF], emap_e_cnts[NECMAP * NPROCF];
1002 int emap_proc_ptr[NPROCF + 1];
1003
1004 nmap_proc_ptr[0] = 0;
1005 emap_proc_ptr[0] = 0;
1006 int n_cntr = 0;
1007 int e_cntr = 0;
1008 for (int iproc = 0; iproc < NPROCF; iproc++) {
1009
1010 for (int j = 0; j < NNCMAP; j++) {
1011 nmap_ids[n_cntr] = (j + 1);
1012 nmap_n_cnts[n_cntr++] = NCNTCM;
1013 }
1014
1015 for (int j = 0; j < NECMAP; j++) {
1016 emap_ids[e_cntr] = 2 * (j + 1);
1017 emap_e_cnts[e_cntr++] = ECNTCM;
1018 }
1019
1020 nmap_proc_ptr[iproc + 1] = nmap_proc_ptr[iproc] + NNCMAP;
1021 emap_proc_ptr[iproc + 1] = emap_proc_ptr[iproc] + NECMAP;
1022 }
1023
1024 return (ne_put_cmap_params_cc(fileid, nmap_ids, nmap_n_cnts, nmap_proc_ptr, emap_ids, emap_e_cnts,
1025 emap_proc_ptr));
1026 }