-
Notifications
You must be signed in to change notification settings - Fork 35
/
jig_load.hpp
1136 lines (1010 loc) · 33.1 KB
/
jig_load.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
--------------------------------------------------------
* JIG-LOAD: parse *.JIG file into JCFG data.
--------------------------------------------------------
*
* This program may be freely redistributed under the
* condition that the copyright notices (including this
* entire header) are not removed, and no compensation
* is received through use of the software. Private,
* research, and institutional use is free. You may
* distribute modified versions of this code UNDER THE
* CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE
* TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE
* ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE
* MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR
* NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution
* of this code as part of a commercial system is
* permissible ONLY BY DIRECT ARRANGEMENT WITH THE
* AUTHOR. (If you are not directly supplying this
* code to a customer, and you are instead telling them
* how they can obtain it for free, then you are not
* required to make any arrangement with me.)
*
* Disclaimer: Neither I nor THE CONTRIBUTORS warrant
* this code in any way whatsoever. This code is
* provided "as-is" to be used at your own risk.
*
* THE CONTRIBUTORS include:
* (a) The University of Sydney
* (b) The Massachusetts Institute of Technology
* (c) Columbia University
* (d) The National Aeronautics & Space Administration
* (e) Los Alamos National Laboratory
*
--------------------------------------------------------
*
* Last updated: 12 Dec., 2022
*
* Copyright 2013-2022
* Darren Engwirda
* https://github.com/dengwirda/
*
--------------------------------------------------------
*/
# pragma once
# include "jig_read.hpp"
# ifndef __JIG_LOAD__
# define __JIG_LOAD__
/*
--------------------------------------------------------
* READ-JCFG: read *.JCFG input file.
--------------------------------------------------------
*/
template <
typename jlog_data
>
__normal_call iptr_type read_jcfg (
jcfg_data &_jcfg ,
jlog_data &_jlog
)
{
class jcfg_loader:
public jcfg_reader_base
{
public :
jcfg_data *_jjig;
public :
/*------------------------------------- create loader */
__normal_call jcfg_loader (
jcfg_data *_jsrc = nullptr
) : _jjig( _jsrc ) {}
/*------------------------------------- MISC keywords */
__normal_call void_type push_verbosity (
std::int32_t _verb
)
{
this->_jjig->_verbosity = _verb ;
this->_jjig->
_mesh_opts.verb() = _verb;
this->_jjig->
_iter_opts.verb() = _verb;
}
__normal_call void_type push_numthread (
std::int32_t _nprt
)
{
if (_nprt <= 0 )
# ifdef __use_openmp
_nprt = omp_get_num_procs() ;
# else
_nprt = +1 ;
# endif//__use_openmp
this->_jjig->_numthread = _nprt ;
this->_jjig->
_mesh_opts.nprt() = _nprt;
this->_jjig->
_iter_opts.nprt() = _nprt;
}
/*------------------------------------- GEOM keywords */
__normal_call void_type push_geom_file (
std::string _file
)
{
this->
_jjig->_geom_file = _file;
}
__normal_call void_type push_geom_seed (
std::int32_t _seed
)
{
this->_jjig->
_mesh_opts.seed() = _seed;
}
__normal_call void_type push_geom_feat (
bool _feat
)
{
this->_jjig->
_mesh_opts.feat() = _feat;
}
__normal_call void_type push_geom_phi1 (
double _phi1
)
{
this->_jjig->
_mesh_opts.phi1() = _phi1;
}
__normal_call void_type push_geom_phi2 (
double _phi2
)
{
this->_jjig->
_mesh_opts.phi2() = _phi2;
}
__normal_call void_type push_geom_eta1 (
double _eta1
)
{
this->_jjig->
_mesh_opts.eta1() = _eta1;
}
__normal_call void_type push_geom_eta2 (
double _eta2
)
{
this->_jjig->
_mesh_opts.eta2() = _eta2;
}
/*------------------------------------- INIT keywords */
__normal_call void_type push_init_near (
double _near
)
{
this->_jjig->
_mesh_opts.near() = _near;
}
/*------------------------------------- HFUN keywords */
__normal_call void_type push_hfun_file (
std::string _file
)
{
this->
_jjig->_hfun_file = _file;
}
__normal_call void_type push_hfun_scal (
std::int32_t _scal
)
{
this->_jjig->_hfun_scal =
(jcfg_data::hfun_scal::enum_data)_scal ;
}
__normal_call void_type push_hfun_hmax (
double _hmax
)
{
this->
_jjig->_hfun_hmax = _hmax;
}
__normal_call void_type push_hfun_hmin (
double _hmin
)
{
this->
_jjig->_hfun_hmin = _hmin;
}
/*------------------------------------- INIT keywords */
__normal_call void_type push_init_file (
std::string _file
)
{
this->
_jjig->_init_file = _file;
}
/*------------------------------------- BNDS keywords */
__normal_call void_type push_bnds_kern (
std::int32_t _kern
)
{
this->_jjig->_bnds_pred =
(jcfg_data::bnds_pred::enum_data)_kern ;
}
/*------------------------------------- MESH keywords */
__normal_call void_type push_mesh_kern (
std::int32_t _kern
)
{
this->_jjig->_mesh_pred =
(jcfg_data::mesh_pred::enum_data)_kern ;
}
__normal_call void_type push_mesh_file (
std::string _file
)
{
this->
_jjig->_mesh_file = _file;
}
__normal_call void_type push_tria_file (
std::string _file
)
{
this->
_jjig->_tria_file = _file;
}
__normal_call void_type push_bnds_file (
std::string _file
)
{
this->
_jjig->_bnds_file = _file;
}
__normal_call void_type push_mesh_dims (
std::int32_t _dims
)
{
this->_jjig->
_mesh_opts.dims() = _dims;
}
__normal_call void_type push_mesh_iter (
std::int32_t _iter
)
{
this->_jjig->
_mesh_opts.iter() = _iter;
}
__normal_call void_type push_mesh_rule (
std::int32_t _rule
)
{
this->_jjig->
_mesh_opts.rule() = _rule;
}
__normal_call void_type push_mesh_siz1 (
double _siz1
)
{
this->_jjig->
_mesh_opts.siz1() = _siz1;
}
__normal_call void_type push_mesh_siz2 (
double _siz2
)
{
this->_jjig->
_mesh_opts.siz2() = _siz2;
}
__normal_call void_type push_mesh_siz3 (
double _siz3
)
{
this->_jjig->
_mesh_opts.siz3() = _siz3;
}
__normal_call void_type push_mesh_top1 (
bool _top1
)
{
this->_jjig->
_mesh_opts.top1() = _top1;
}
__normal_call void_type push_mesh_top2 (
bool _top2
)
{
this->_jjig->
_mesh_opts.top2() = _top2;
}
__normal_call void_type push_mesh_rad2 (
double _rad2
)
{
this->_jjig->
_mesh_opts.rad2() = _rad2;
}
__normal_call void_type push_mesh_rad3 (
double _rad3
)
{
this->_jjig->
_mesh_opts.rad3() = _rad3;
}
__normal_call void_type push_mesh_off2 (
double _off2
)
{
this->_jjig->
_mesh_opts.off2() = _off2;
}
__normal_call void_type push_mesh_off3 (
double _off3
)
{
this->_jjig->
_mesh_opts.off3() = _off3;
}
__normal_call void_type push_mesh_snk2 (
double _snk2
)
{
this->_jjig->
_mesh_opts.snk2() = _snk2;
}
__normal_call void_type push_mesh_snk3 (
double _snk3
)
{
this->_jjig->
_mesh_opts.snk3() = _snk3;
}
__normal_call void_type push_mesh_eps1 (
double _eps1
)
{
this->_jjig->
_mesh_opts.eps1() = _eps1;
}
__normal_call void_type push_mesh_eps2 (
double _eps2
)
{
this->_jjig->
_mesh_opts.eps2() = _eps2;
}
__normal_call void_type push_mesh_vol3 (
double _vol3
)
{
this->_jjig->
_mesh_opts.vol3() = _vol3;
}
/*------------------------------------- OPTM keywords */
__normal_call void_type push_optm_kern (
std::int32_t _kern
)
{
this->_jjig->_iter_pred =
(jcfg_data::iter_pred::enum_data)_kern ;
}
__normal_call void_type push_optm_cost (
std::int32_t _cost
)
{
this->_jjig->_iter_cost =
(jcfg_data::iter_cost::enum_data)_cost ;
}
__normal_call void_type push_optm_iter (
std::int32_t _iter
)
{
this->_jjig->
_iter_opts.iter() = _iter;
}
__normal_call void_type push_optm_beta (
double _beta
)
{
this->_jjig->
_iter_opts.beta() = _beta;
}
__normal_call void_type push_optm_zeta (
double _zeta
)
{
this->_jjig->
_iter_opts.zeta() = _zeta;
}
__normal_call void_type push_optm_qtol (
double _qtol
)
{
this->_jjig->
_iter_opts.qtol() = _qtol;
}
__normal_call void_type push_optm_qlim (
double _qlim
)
{
this->_jjig->
_iter_opts.qlim() = _qlim;
}
__normal_call void_type push_optm_tria (
bool _flag
)
{
this->_jjig->
_iter_opts.tria() = _flag;
}
__normal_call void_type push_optm_dual (
bool _flag
)
{
this->_jjig->
_iter_opts.dual() = _flag;
}
__normal_call void_type push_optm_div_ (
bool _flag
)
{
this->_jjig->
_iter_opts.div_() = _flag;
}
__normal_call void_type push_optm_zip_ (
bool _flag
)
{
this->_jjig->
_iter_opts.zip_() = _flag;
}
} ;
/*---------------------------------- parse JCFG. file */
iptr_type _errv = __no_error ;
try
{
jcfg_reader _read;
std::ifstream _file;
_file. open(
_jcfg._jcfg_file, std::ifstream::in) ;
if (_file.is_open())
{
_read.read_file (
_file, jcfg_loader(&_jcfg));
}
else
{
_jlog.push(
"**parse error: file not found!\n" ) ;
_errv = __file_not_located ;
}
_file.close ();
for (auto _iter =
_read._errs.head();
_iter !=
_read._errs.tend();
++_iter )
{
_jlog.push(
"**parse error: " + * _iter + "\n" ) ;
_errv = __invalid_useropts ;
}
}
catch (...)
{
_errv = __unknown_error ;
}
return ( _errv ) ;
}
/*
--------------------------------------------------------
* COPY-JCFG: read *.JCFG input data.
--------------------------------------------------------
*/
template <
typename jlog_data
>
__normal_call iptr_type copy_jcfg (
jcfg_data &_jcfg ,
jlog_data &_jlog ,
jigsaw_jig_t &_jjig
)
{
iptr_type _errv = __no_error ;
try
{
__unreferenced(_jlog) ;
/*------------------------------------- MISC keywords */
_jcfg._verbosity =
_jjig._verbosity ;
_jcfg._mesh_opts.
verb() = _jjig._verbosity ;
_jcfg._iter_opts.
verb() = _jjig._verbosity ;
if (_jjig._numthread <= 0 )
# ifdef __use_openmp
_jjig._numthread =
omp_get_num_procs();
# else
_jjig._numthread = +1 ;
# endif//__use_openmp
_jcfg._numthread =
_jjig._numthread ;
_jcfg._mesh_opts.
nprt() = _jjig._numthread ;
_jcfg._iter_opts.
nprt() = _jjig._numthread ;
/*------------------------------------- BNDS keywords */
if (_jjig._bnds_kern ==
JIGSAW_BNDS_TRIACELL)
_jcfg._bnds_pred =
jcfg_data::bnds_pred::bnd_tria ;
else
if (_jjig._bnds_kern ==
JIGSAW_BNDS_DUALCELL)
_jcfg._bnds_pred =
jcfg_data::bnds_pred::bnd_dual ;
else
_errv = __invalid_useropts ;
/*------------------------------------- GEOM keywords */
_jcfg._mesh_opts.
seed() = _jjig._geom_seed ;
_jcfg._mesh_opts.
feat() = _jjig._geom_feat ;
_jcfg._mesh_opts.
eta1() = _jjig._geom_eta1 ;
_jcfg._mesh_opts.
eta2() = _jjig._geom_eta2 ;
/*------------------------------------- INIT keywords */
_jcfg._mesh_opts.
near() = _jjig._init_near ;
/*------------------------------------- HFUN keywords */
if (_jjig._hfun_scal ==
JIGSAW_HFUN_RELATIVE)
_jcfg._hfun_scal =
jcfg_data::hfun_scal::relative ;
else
if (_jjig._hfun_scal ==
JIGSAW_HFUN_ABSOLUTE)
_jcfg._hfun_scal =
jcfg_data::hfun_scal::absolute ;
else
_errv = __invalid_useropts ;
_jcfg.
_hfun_hmax = _jjig._hfun_hmax ;
_jcfg.
_hfun_hmin = _jjig._hfun_hmin ;
/*------------------------------------- RDEL keywords */
if (_jjig._mesh_kern ==
JIGSAW_KERN_DELFRONT)
_jcfg._mesh_pred =
jcfg_data::mesh_pred::delfront ;
else
if (_jjig._mesh_kern ==
JIGSAW_KERN_DELAUNAY)
_jcfg._mesh_pred =
jcfg_data::mesh_pred::delaunay ;
else
if (_jjig._mesh_kern ==
JIGSAW_KERN_BISECTOR)
_jcfg._mesh_pred =
jcfg_data::mesh_pred::bisector ;
else
_errv = __invalid_useropts ;
_jcfg._mesh_opts.
dims() = _jjig._mesh_dims ;
_jcfg._mesh_opts.
iter() = _jjig._mesh_iter ;
_jcfg._mesh_opts.
siz1() = _jjig._mesh_siz1 ;
_jcfg._mesh_opts.
siz2() = _jjig._mesh_siz2 ;
_jcfg._mesh_opts.
siz3() = _jjig._mesh_siz3 ;
_jcfg._mesh_opts.
top1() = _jjig._mesh_top1 ;
_jcfg._mesh_opts.
top2() = _jjig._mesh_top2 ;
_jcfg._mesh_opts.
rad2() = _jjig._mesh_rad2 ;
_jcfg._mesh_opts.
rad3() = _jjig._mesh_rad3 ;
_jcfg._mesh_opts.
off2() = _jjig._mesh_off2 ;
_jcfg._mesh_opts.
off3() = _jjig._mesh_off3 ;
_jcfg._mesh_opts.
snk2() = _jjig._mesh_snk2 ;
_jcfg._mesh_opts.
snk3() = _jjig._mesh_snk3 ;
_jcfg._mesh_opts.
eps1() = _jjig._mesh_eps1 ;
_jcfg._mesh_opts.
eps2() = _jjig._mesh_eps2 ;
_jcfg._mesh_opts.
vol3() = _jjig._mesh_vol3 ;
/*------------------------------------- ITER keywords */
if (_jjig._optm_kern ==
JIGSAW_KERN_ODT_DQDX)
_jcfg._iter_pred =
jcfg_data::iter_pred::odt_dqdx ;
else
if (_jjig._optm_kern ==
JIGSAW_KERN_CVT_DQDX)
_jcfg._iter_pred =
jcfg_data::iter_pred::cvt_dqdx ;
else
if (_jjig._optm_kern ==
JIGSAW_KERN_H95_DQDX)
_jcfg._iter_pred =
jcfg_data::iter_pred::h95_dqdx ;
else
_errv = __invalid_useropts ;
if (_jjig._optm_cost ==
JIGSAW_KERN_AREA_LEN)
_jcfg._iter_cost =
jcfg_data::iter_cost::area_len ;
else
if (_jjig._optm_cost ==
JIGSAW_KERN_SKEW_COS)
_jcfg._iter_cost =
jcfg_data::iter_cost::skew_cos ;
else
_errv = __invalid_useropts ;
_jcfg._iter_opts.
iter() = _jjig._optm_iter ;
_jcfg._iter_opts.
beta() = _jjig._optm_beta ;
_jcfg._iter_opts.
zeta() = _jjig._optm_zeta ;
_jcfg._iter_opts.
qtol() = _jjig._optm_qtol ;
_jcfg._iter_opts.
qlim() = _jjig._optm_qlim ;
_jcfg._iter_opts.
tria() = _jjig._optm_tria ;
_jcfg._iter_opts.
dual() = _jjig._optm_dual ;
_jcfg._iter_opts.
div_() = _jjig._optm_div_ ;
_jcfg._iter_opts.
zip_() = _jjig._optm_zip_ ;
}
catch (...)
{
_errv = __unknown_error ;
}
return ( _errv ) ;
}
/*
--------------------------------------------------------
* TEST-JCFG: test the JCFG data for validity.
--------------------------------------------------------
*/
template <
typename jlog_data
>
__normal_call iptr_type test_jcfg (
jcfg_data &_jcfg ,
jlog_data &_jlog
)
{
std::stringstream _sstr;
/*---------------------------------- read "ints" data */
#define __testINTS(__tag, __var, __vlo, __vhi) \
if ( (__var < __vlo) || \
(__var > __vhi) ) \
{ \
_errv = __invalid_useropts ; \
_sstr.str(""); \
_sstr.clear(); \
_sstr << \
"**input error: " __tag " = " \
<< std::setw(+9) \
<< std::setfill(' ') \
<< __var << "\n"; \
_jlog.push(_sstr.str()) ; \
} \
/*---------------------------------- test "real" data */
#define __testREAL(__tag, __var, __vlo, __vhi) \
if ( (__var < __vlo) || \
(__var > __vhi) ) \
{ \
_errv = __invalid_useropts ; \
_sstr.str(""); \
_sstr.clear(); \
_sstr << \
"**input error: " __tag " = " \
<< std::scientific \
<< std::setprecision(2) \
<< __var << "\n"; \
_jlog.push(_sstr.str()) ; \
} \
/*---------------------------------- warn "real" data */
#define __warnREAL(__tag, __var, __vlo, __vhi) \
if ( (__var < __vlo) || \
(__var > __vhi) ) \
{ \
_sstr.str(""); \
_sstr.clear(); \
_sstr << \
"**input warning: " __tag " = " \
<< std::scientific \
<< std::setprecision(2) \
<< __var << "\n"; \
_jlog.push(_sstr.str()) ; \
} \
iptr_type _errv = __no_error ;
/*---------------------------- test GEOM keywords */
__testINTS("GEOM-SEED",
_jcfg._mesh_opts.seed(),
(iptr_type) + 0,
std::numeric_limits<iptr_type>:: max())
__testREAL("GEOM-PHI1",
_jcfg._mesh_opts.phi1(),
(real_type) 0.,
(real_type)180.)
__testREAL("GEOM-PHI2",
_jcfg._mesh_opts.phi2(),
(real_type) 0.,
(real_type)180.)
__testREAL("GEOM-ETA1",
_jcfg._mesh_opts.eta1(),
(real_type) 0.,
(real_type)180.)
__testREAL("GEOM-ETA2",
_jcfg._mesh_opts.eta2(),
(real_type) 0.,
(real_type)180.)
/*---------------------------- test INIT keywords */
__testREAL("INIT-NEAR",
_jcfg._mesh_opts.near(),
(real_type) 0.,
(real_type) 1.)
/*---------------------------- test HFUN keywords */
__testREAL("HFUN-HMAX",
_jcfg ._hfun_hmax ,
(real_type) 0.,
std::numeric_limits<real_type>::infinity())
__testREAL("HFUN-HMIN",
_jcfg ._hfun_hmin ,
(real_type) 0.,
std::numeric_limits<real_type>::infinity())
/*---------------------------- test MESH keywords */
__testINTS("MESH-ITER",
_jcfg._mesh_opts.iter(),
(iptr_type) + 0,
std::numeric_limits<iptr_type>:: max())
__testINTS("MESH-DIMS",
_jcfg._mesh_opts.dims(),
(iptr_type) + 0,
(iptr_type) + 3)
__testREAL("MESH-SIZ1",
_jcfg._mesh_opts.siz1(),
(real_type) 0.,
std::numeric_limits<real_type>::infinity())
__testREAL("MESH-SIZ2",
_jcfg._mesh_opts.siz2(),
(real_type) 0.,
std::numeric_limits<real_type>::infinity())
__testREAL("MESH-SIZ3",
_jcfg._mesh_opts.siz3(),
(real_type) 0.,
std::numeric_limits<real_type>::infinity())
__testREAL("MESH-EPS1",
_jcfg._mesh_opts.eps1(),
(real_type) 0.,
std::numeric_limits<real_type>::infinity())
__testREAL("MESH-EPS2",
_jcfg._mesh_opts.eps2(),
(real_type) 0.,
std::numeric_limits<real_type>::infinity())
__testREAL("MESH-RAD2",
_jcfg._mesh_opts.rad2(),
(real_type) 0.,
std::numeric_limits<real_type>::infinity())
__testREAL("MESH-RAD3",
_jcfg._mesh_opts.rad3(),
(real_type) 0.,
std::numeric_limits<real_type>::infinity())
__warnREAL("MESH-RAD2",
_jcfg._mesh_opts.rad2(),
(real_type) 1.,
std::numeric_limits<real_type>::infinity())
__warnREAL("MESH-RAD3",
_jcfg._mesh_opts.rad3(),
(real_type) 2.,
std::numeric_limits<real_type>::infinity())
__testREAL("MESH-OFF2",
_jcfg._mesh_opts.off2(),
(real_type) 0.,
std::numeric_limits<real_type>::infinity())
__testREAL("MESH-OFF3",
_jcfg._mesh_opts.off3(),
(real_type) 0.,
std::numeric_limits<real_type>::infinity())
__testREAL("MESH-SNK2",
_jcfg._mesh_opts.snk2(),
(real_type) 0.,
(real_type) 1.)
__testREAL("MESH-SNK3",
_jcfg._mesh_opts.snk3(),
(real_type) 0.,
(real_type) 1.)
__testREAL("MESH-VOL3",
_jcfg._mesh_opts.vol3(),
(real_type) 0.,
(real_type) 1.)
__warnREAL("MESH-VOL3",
_jcfg._mesh_opts.vol3(),
(real_type) 0.,
(real_type) .3)
/*---------------------------- test OPTM keywords */
__testINTS("OPTM-ITER",
_jcfg._iter_opts.iter(),
(iptr_type) + 0,
std::numeric_limits<iptr_type>:: max())
__testREAL("OPTM-BETA",
_jcfg._iter_opts.beta(),
(real_type) 0.,
(real_type) .5)
__testREAL("OPTM-ZETA",
_jcfg._iter_opts.zeta(),
(real_type) 0.,
(real_type) 1.)
__testREAL("OPTM-QTOL",
_jcfg._iter_opts.qtol(),
(real_type) 0.,
(real_type) 1.)
__testREAL("OPTM-QLIM",
_jcfg._iter_opts.qlim(),
(real_type) 0.,
(real_type) 1.)
#undef __testINTS
#undef __testREAL
#undef __warnREAL
return ( _errv ) ;
}
/*
--------------------------------------------------------
* ECHO-JCFG: print a summary of the JCFG data.
--------------------------------------------------------
*/
template <
typename jlog_data
>
__normal_call iptr_type echo_jcfg (
jcfg_data &_jcfg ,
jlog_data &_jlog
)
{
iptr_type _errv = __no_error ;
/*---------------------------------- push "bool" data */
#define __pushBVAL(__var) \
std::string(__var ? "TRUE" : "FALSE") + "\n"
/*---------------------------------- push "ints" data */
#define __pushIVAL(__var) \
(__var != \
std::numeric_limits<iptr_type>::max() ? \
std::to_string(__var) : "MAXINT"\
) + "\n"
/*---------------------------------- push "real" data */
#define __pushRVAL(__var) \
(__var != \
std::numeric_limits<real_type>::max() ? \
to_string_prec(__var, +2) : "MAXFLT"\
) + "\n"
_jlog.push(" GEOM-FILE = " +
_jcfg._geom_file + "\n" ) ;
_jlog.push(" MESH-FILE = " +
_jcfg._mesh_file + "\n" ) ;
_jlog.push(" HFUN-FILE = " +
_jcfg._hfun_file + "\n" ) ;
_jlog.push(" INIT-FILE = " +
_jcfg._init_file + "\n" ) ;
_jlog.push(" TRIA-FILE = " +
_jcfg._tria_file + "\n" ) ;
_jlog.push(" BNDS-FILE = " +
_jcfg._bnds_file + "\n" ) ;
_jlog.push("\n") ;
_jlog.push(" NUMTHREAD = " +
__pushIVAL(_jcfg._numthread) + "\n" ) ;
if (_jcfg._verbosity > +0)
{
/*---------------------------- push GEOM keywords */
_jlog.push(" GEOM-SEED = " +
__pushIVAL(_jcfg._mesh_opts.seed()));
_jlog.push(" GEOM-PHI1 = " +
__pushRVAL(_jcfg._mesh_opts.phi1()));
_jlog.push(" GEOM-PHI2 = " +
__pushRVAL(_jcfg._mesh_opts.phi2()));
_jlog.push(" GEOM-ETA1 = " +
__pushRVAL(_jcfg._mesh_opts.eta1()));
_jlog.push(" GEOM-ETA2 = " +
__pushRVAL(_jcfg._mesh_opts.eta2()));
_jlog.push(" GEOM-FEAT = " +
__pushBVAL(_jcfg._mesh_opts.feat()));
_jlog.push("\n") ;
/*---------------------------- push INIT keywords */
_jlog.push(" INIT-NEAR = " +
__pushRVAL(_jcfg._mesh_opts.near()));
_jlog.push("\n") ;
/*---------------------------- push HFUN keywords */
if(_jcfg._hfun_scal ==
jcfg_data::hfun_scal::absolute)