-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
OpenFOAM-v1912.patch
2267 lines (2031 loc) · 80.7 KB
/
OpenFOAM-v1912.patch
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
bin/tools/RunFunctions | 4 +
bin/tools/lib-dir | 8 +-
etc/bashrc | 2 +-
etc/config.csh/functions | 12 ++-
etc/config.csh/mac/paraview | 13 +++
etc/config.csh/paraview | 23 ++++-
etc/config.csh/settings | 1 +
etc/config.csh/setup | 48 +++++++--
etc/config.csh/unset | 26 +++--
etc/config.sh/CGAL | 4 +-
etc/config.sh/FFTW | 2 +-
etc/config.sh/adios2 | 2 +-
etc/config.sh/functions | 2 +
etc/config.sh/kahip | 4 +-
etc/config.sh/mac/paraview | 18 ++++
etc/config.sh/metis | 2 +-
etc/config.sh/paraview | 2 +-
etc/config.sh/petsc | 2 +-
etc/config.sh/scotch | 2 +-
etc/config.sh/settings | 1 +
etc/config.sh/setup | 50 ++++++++--
etc/config.sh/unset | 26 ++++-
etc/config.sh/vtk | 10 +-
etc/cshrc | 2 +-
src/OSspecific/POSIX/signals/sigFpe.C | 51 +++++++++-
.../containers/HashTables/HashSet/HashSet.C | 44 +++++----
.../containers/HashTables/HashSet/HashSet.H | 61 ++++++------
.../containers/HashTables/HashTable/HashTable.H | 107 ++++++++++++---------
.../HashTables/HashTable/HashTableCore.H | 39 +++-----
.../HashTables/HashTable/HashTableCoreI.H | 51 +++-------
.../HashTables/HashTable/HashTableIterI.H | 66 +++++--------
.../LinkedLists/linkTypes/DLListBase/DLListBase.H | 6 +-
.../LinkedLists/linkTypes/SLListBase/SLListBase.H | 6 +-
src/OpenFOAM/containers/Lists/ListOps/ListOps.H | 3 +-
src/OpenFOAM/db/dictionary/dictionary.H | 44 ++++-----
.../dimensionedType/dimensionedType.H | 9 +-
.../GeometricField/GeometricField.H | 3 +-
src/OpenFOAM/global/argList/argList.H | 36 +++----
src/OpenFOAM/matrices/Matrix/Matrix.H | 22 +++--
src/OpenFOAM/meshes/meshShapes/face/face.H | 4 +-
src/OpenFOAM/meshes/meshShapes/triFace/triFace.H | 4 +-
.../meshes/primitiveShapes/triangle/triangle.H | 4 +-
src/OpenFOAM/primitives/Scalar/doubleFloat.H | 8 ++
src/OpenFOAM/primitives/enums/Enum.H | 4 +-
src/OpenFOAM/primitives/enums/NamedEnum.H | 4 +-
.../primitives/strings/lists/hashedWordList.H | 4 +-
src/fileFormats/ensight/part/ensightPart.H | 4 +-
src/functionObjects/graphics/Allwmake | 2 +-
wmake/rules/General/Clang/c++ | 2 +-
wmake/rules/General/Clang/openmp | 4 +-
50 files changed, 515 insertions(+), 343 deletions(-)
diff --git a/bin/tools/RunFunctions b/bin/tools/RunFunctions
index 8adacd73..32fd5b51 100644
--- a/bin/tools/RunFunctions
+++ b/bin/tools/RunFunctions
@@ -26,6 +26,10 @@
#------------------------------------------------------------------------------
+# Work-around for cleared DYLD_LIBRARY_PATH variable
+[ -z "$DYLD_LIBRARY_PATH" -a -n "$FOAM_DYLD_LIBRARY_PATH" ] \
+ && export DYLD_LIBRARY_PATH="$FOAM_DYLD_LIBRARY_PATH"
+
#
# Check presence of '-parallel' in the argument list.
#
diff --git a/bin/tools/lib-dir b/bin/tools/lib-dir
index 5cc17801..daba1550 100755
--- a/bin/tools/lib-dir
+++ b/bin/tools/lib-dir
@@ -157,10 +157,10 @@ then
printf "%s\n" "-L$resolved"
;;
csh-Darwin*)
- echo "setenv DYLD_LIBRARY_PATH $resolved:$DYLD_LIBRARY_PATH"
+ echo "setenv FOAM_DYLD_LIBRARY_PATH $resolved:$FOAM_DYLD_LIBRARY_PATH"
if [ -n "$verboseOutput" ]
then
- echo "setenv DYLD_LIBRARY_PATH $resolved:$DYLD_LIBRARY_PATH" 1>&2
+ echo "setenv FOAM_DYLD_LIBRARY_PATH $resolved:$FOAM_DYLD_LIBRARY_PATH" 1>&2
fi
;;
csh*)
@@ -171,10 +171,10 @@ then
fi
;;
sh-Darwin*)
- echo "DYLD_LIBRARY_PATH=$resolved:$DYLD_LIBRARY_PATH"
+ echo "FOAM_DYLD_LIBRARY_PATH=$resolved:$FOAM_DYLD_LIBRARY_PATH"
if [ -n "$verboseOutput" ]
then
- echo "DYLD_LIBRARY_PATH=$resolved:$DYLD_LIBRARY_PATH" 1>&2
+ echo "FOAM_DYLD_LIBRARY_PATH=$resolved:$FOAM_DYLD_LIBRARY_PATH" 1>&2
fi
;;
*)
diff --git a/etc/bashrc b/etc/bashrc
index 9743498f..c03edda9 100644
--- a/etc/bashrc
+++ b/etc/bashrc
@@ -1,4 +1,4 @@
-#----------------------------------*-sh-*--------------------------------------
+
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
diff --git a/etc/config.csh/functions b/etc/config.csh/functions
index f71dd990..91523b7b 100644
--- a/etc/config.csh/functions
+++ b/etc/config.csh/functions
@@ -28,12 +28,20 @@ alias _foamClean 'eval `$WM_PROJECT_DIR/bin/foamCleanPath -csh-env=\!*`'
# Prepend PATH, MANPATH, LD_LIBRARY_PATH
alias _foamAddPath 'setenv PATH \!*\:${PATH}'
alias _foamAddMan 'setenv MANPATH \!*\:${MANPATH}'
-alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'
+if ( $foamDarwin ) then
+ alias _foamAddLib 'setenv DYLD_LIBRARY_PATH \!*\:${DYLD_LIBRARY_PATH}; setenv FOAM_DYLD_LIBRARY_PATH \!*\:${FOAM_DYLD_LIBRARY_PATH}'
+else
+ alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'
+endif
# Prefix to LD_LIBRARY_PATH with additional checking
# $1 = base directory for 'lib' or 'lib64'
# $2 = fallback libname ('lib' or 'lib64')
-alias _foamAddLibAuto 'eval `$WM_PROJECT_DIR/bin/tools/lib-dir -csh \!*`'
+if (`uname -s` == "Darwin") then
+ alias _foamAddLibAuto 'eval `$WM_PROJECT_DIR/bin/tools/lib-dir -csh \!*`; setenv DYLD_LIBRARY_PATH "$FOAM_DYLD_LIBRARY_PATH"'
+else
+ alias _foamAddLibAuto 'eval `$WM_PROJECT_DIR/bin/tools/lib-dir -csh \!*`'
+endif
# Echo values when FOAM_VERBOSE is on, no-op otherwise
if ($?FOAM_VERBOSE && $?prompt) then
diff --git a/etc/config.csh/mac/paraview b/etc/config.csh/mac/paraview
new file mode 100644
index 00000000..53adbcca
--- /dev/null
+++ b/etc/config.csh/mac/paraview
@@ -0,0 +1,13 @@
+set _paraview = /Applications/[Pp][Aa][Rr][Aa][Vv][Ii][Ee][Ww]*.app
+if ( -d $_paraview ) then
+ if ( $?prompt ) echo Using $_paraview
+ alias paraview "$_paraview/Contents/MacOS/paraview"
+else
+ echo
+ echo "Please download binary Paraview release from"
+ echo "http://paraview.org and install it in /Applications"
+ echo "folder."
+ echo
+endif
+
+#----------------------------- vi: set ft=csh et: ----------------------------
diff --git a/etc/config.csh/paraview b/etc/config.csh/paraview
index bc57ed56..d69dbfcb 100644
--- a/etc/config.csh/paraview
+++ b/etc/config.csh/paraview
@@ -65,9 +65,14 @@ if (! $?WM_COMPILER_LIB_ARCH ) setenv WM_COMPILER_LIB_ARCH
# Compiler-specific location for ThirdParty installations
set archDir="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER"
-# Clean PATH and LD_LIBRARY_PATH
+# Clean PATH and [DY]LD_LIBRARY_PATH
eval `$WM_PROJECT_DIR/bin/foamCleanPath -csh-env=PATH "$ParaView_DIR $archDir/ParaView- $archDir/qt- $archDir/cmake-"`
-eval `$WM_PROJECT_DIR/bin/foamCleanPath -csh-env=LD_LIBRARY_PATH "$ParaView_DIR $archDir/ParaView- $archDir/qt-"`
+if ( $foamDarwin ) then
+ eval `$WM_PROJECT_DIR/bin/foamCleanPath -csh-env=FOAM_DYLD_LIBRARY_PATH "$ParaView_DIR $archDir/ParaView- $archDir/qt-"`
+ setenv DYLD_LIBRARY_PATH $FOAM_DYLD_LIBRARY_PATH
+else
+ eval `$WM_PROJECT_DIR/bin/foamCleanPath -csh-env=LD_LIBRARY_PATH "$ParaView_DIR $archDir/ParaView- $archDir/qt-"`
+endif
# Evaluate command-line parameters for ParaView and cmake
while ( $#argv > 0 )
@@ -165,7 +170,12 @@ default:
endsw
foreach libDir ("lib$WM_COMPILER_LIB_ARCH" "lib")
if ( -d "${qtDir}/${libDir}" ) then
- setenv LD_LIBRARY_PATH "${qtDir}/${libDir}:${LD_LIBRARY_PATH}"
+ if ( $foamDarwin ) then
+ setenv DYLD_LIBRARY_PATH "${qtDir}/${libDir}:${DYLD_LIBRARY_PATH}"
+ setenv FOAM_DYLD_LIBRARY_PATH "${qtDir}/${libDir}:${FOAM_DYLD_LIBRARY_PATH}"
+ else
+ setenv LD_LIBRARY_PATH "${qtDir}/${libDir}:${LD_LIBRARY_PATH}"
+ endif
break
endif
end
@@ -183,7 +193,12 @@ default:
set libDir="$pvLibDir" # Needs lib/paraview-X.X (not lib)
breaksw
endsw
- setenv LD_LIBRARY_PATH "${ParaView_DIR}/${libDir}:${LD_LIBRARY_PATH}"
+ if ( $foamDarwin ) then
+ setenv DYLD_LIBRARY_PATH "${ParaView_DIR}/${libDir}:${DYLD_LIBRARY_PATH}"
+ setenv FOAM_DYLD_LIBRARY_PATH "${ParaView_DIR}/${libDir}:${FOAM_DYLD_LIBRARY_PATH}"
+ else
+ setenv LD_LIBRARY_PATH "${ParaView_DIR}/${libDir}:${LD_LIBRARY_PATH}"
+ endif
break
endif
set pvLibDir="unknown"
diff --git a/etc/config.csh/settings b/etc/config.csh/settings
index 206846e1..8702115e 100644
--- a/etc/config.csh/settings
+++ b/etc/config.csh/settings
@@ -93,6 +93,7 @@ case Linux:
case Darwin: # Presumably x86_64
setenv WM_ARCH darwin64
+ setenv WM_COMPILER Clang
echo "Darwin support is clang/llvm only"
breaksw
diff --git a/etc/config.csh/setup b/etc/config.csh/setup
index 51a92cd0..ce7449ea 100644
--- a/etc/config.csh/setup
+++ b/etc/config.csh/setup
@@ -32,6 +32,9 @@ setenv FOAM_API `$WM_PROJECT_DIR/bin/foamEtcFile -show-api`
# The installation parent directory
set prefixDir="${WM_PROJECT_DIR:h}"
+# Are we under Darwin
+@ foamDarwin = ( `uname -s` == "Darwin" )
+
# Load shell "functions" (actually aliases)
source "$WM_PROJECT_DIR/etc/config.csh/functions"
@@ -124,13 +127,33 @@ end
# Clean standard environment variables (PATH, MANPATH, LD_LIBRARY_PATH)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Prevent local variables from shadowing setenv variables
-unset PATH MANPATH LD_LIBRARY_PATH
-if (! $?LD_LIBRARY_PATH ) setenv LD_LIBRARY_PATH
+unset PATH MANPATH
+if ( $foamDarwin ) then
+ unset DYLD_LIBRARY_PATH FOAM_DYLD_LIBRARY_PATH
+else
+ unset LD_LIBRARY_PATH
+endif
+if ( $foamDarwin ) then
+ if (! $?DYLD_LIBRARY_PATH ) setenv DYLD_LIBRARY_PATH
+ if ( $?DYLD_LIBRARY_PATH ) then
+ # Initial value copy
+ setenv FOAM_DYLD_LIBRARY_PATH $DYLD_LIBRARY_PATH
+ else
+ setenv FOAM_DYLD_LIBRARY_PATH
+ endif
+else
+ if (! $?LD_LIBRARY_PATH ) setenv LD_LIBRARY_PATH
+endif
if (! $?MANPATH ) setenv MANPATH
_foamClean PATH "$foamOldDirs"
_foamClean MANPATH "$foamOldDirs"
-_foamClean LD_LIBRARY_PATH "$foamOldDirs"
+if ( $foamDarwin ) then
+ _foamClean FOAM_DYLD_LIBRARY_PATH "$foamOldDirs"
+ setenv DYLD_LIBRARY_PATH $FOAM_DYLD_LIBRARY_PATH
+else
+ _foamClean LD_LIBRARY_PATH "$foamOldDirs"
+endif
# Setup for OpenFOAM compilation etc
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -139,8 +162,12 @@ _foamEtc -config settings
# Setup for third-party packages
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_foamEtc -config mpi
-_foamEtc -config paraview -- "$FOAM_SETTINGS" # Pass through for evaluation
-_foamEtc -config vtk
+if ( $foamDarwin ) then
+ _foamEtc -config mac/paraview
+else
+ _foamEtc -config paraview -- "$FOAM_SETTINGS" # Pass through for evaluation
+ _foamEtc -config vtk
+endif
_foamEtc -config adios2
_foamEtc -config CGAL
_foamEtc -config FFTW
@@ -161,7 +188,12 @@ endif
_foamClean PATH
_foamClean MANPATH
-_foamClean LD_LIBRARY_PATH
+if ( $foamDarwin ) then
+ _foamClean FOAM_DYLD_LIBRARY_PATH
+ setenv DYLD_LIBRARY_PATH $FOAM_DYLD_LIBRARY_PATH
+else
+ _foamClean LD_LIBRARY_PATH
+endif
# Add trailing ':' for system manpages
if ( $?MANPATH ) then
@@ -182,6 +214,6 @@ unalias _foamAddLib
unalias _foamAddLibAuto
# Variables (done as final statement for a clean exit code)
-unset cleaned foamOldDirs foundDir foamDir prefixDir
+unset cleaned foamOldDirs foundDir foamDir prefixDir foamDarwin
-#------------------------------------------------------------------------------
+#--------------------- vi: set ft=csh et sw=4 ts=4 sts=4: ---------------------
diff --git a/etc/config.csh/unset b/etc/config.csh/unset
index c3405cd6..bda35572 100644
--- a/etc/config.csh/unset
+++ b/etc/config.csh/unset
@@ -20,6 +20,8 @@
#
#------------------------------------------------------------------------------
+@ foamDarwin = ( `uname -s` == "Darwin" )
+
# Clean standard environment variables (PATH, LD_LIBRARY_PATH, MANPATH)
unset foamClean
@@ -75,7 +77,6 @@ unsetenv WM_PROJECT_VERSION
unsetenv WM_SCHEDULER
unsetenv WM_THIRD_PARTY_DIR
-
#------------------------------------------------------------------------------
# Unset FOAM_* environment variables
@@ -102,7 +103,6 @@ unsetenv FOAM_USER_APPBIN
unsetenv FOAM_USER_LIBBIN
unsetenv FOAM_UTILITIES
-
#------------------------------------------------------------------------------
# Unset MPI-related environment variables
@@ -134,6 +134,7 @@ unsetenv CGAL_ARCH_PATH
unsetenv FFTW_ARCH_PATH
unsetenv GPERFTOOLS_ARCH_PATH
unsetenv GMP_ARCH_PATH
+unsetenv LLVM_ARCH_PATH
unsetenv MPFR_ARCH_PATH
unsetenv MESA_ARCH_PATH
unsetenv METIS_ARCH_PATH
@@ -147,9 +148,17 @@ if ( $?foamClean ) then
eval `$foamClean -csh-env=PATH "$foamOldDirs"`
- if ($?LD_LIBRARY_PATH) then
- eval `$foamClean -csh-env=LD_LIBRARY_PATH "$foamOldDirs"`
- if ( ${%LD_LIBRARY_PATH} == 0 ) unsetenv LD_LIBRARY_PATH
+ if ( $foamDarwin ) then
+ if ($?DYLD_LIBRARY_PATH) then
+ eval `$foamClean -csh-env=FOAM_DYLD_LIBRARY_PATH "$foamOldDirs"`
+ setenv DYLD_LIBRARY_PATH $FOAM_DYLD_LIBRARY_PATH
+ if ( ${%FOAM_DYLD_LIBRARY_PATH} == 0 ) unsetenv DYLD_LIBRARY_PATH
+ endif
+ else
+ if ($?LD_LIBRARY_PATH) then
+ eval `$foamClean -csh-env=LD_LIBRARY_PATH "$foamOldDirs"`
+ if ( ${%LD_LIBRARY_PATH} == 0 ) unsetenv LD_LIBRARY_PATH
+ endif
endif
if ($?MANPATH) then
@@ -159,6 +168,9 @@ if ( $?foamClean ) then
endif
+if ( $foamDarwin ) then
+unsetenv FOAM_DYLD_LIBRARY_PATH
+endif
#------------------------------------------------------------------------------
# Cleanup aliases
@@ -194,6 +206,8 @@ unalias wmRefresh
unalias foamVersion
unalias foamPV
+if ( $foamDarwin ) unalias paraview
+
# Remove old completions, which look like:
# complete APPNAME 'p,*,`bash $WM_PROJECT_DIR/etc/ ...
if ($?prompt && $?tcsh) then # Interactive tcsh only
@@ -205,6 +219,6 @@ endif
#------------------------------------------------------------------------------
# Intermediate variables (do as last for a clean exit code)
-unset cleaned foamClean foamOldDirs
+unset cleaned foamClean foamOldDirs foamDarwin
#------------------------------------------------------------------------------
diff --git a/etc/config.sh/CGAL b/etc/config.sh/CGAL
index 38014a26..31f1b783 100644
--- a/etc/config.sh/CGAL
+++ b/etc/config.sh/CGAL
@@ -44,8 +44,8 @@
#------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
-boost_version=boost_1_64_0
-cgal_version=CGAL-4.9.1
+boost_version=boost-system
+cgal_version=CGAL-system
export BOOST_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$boost_version
export CGAL_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cgal_version
diff --git a/etc/config.sh/FFTW b/etc/config.sh/FFTW
index 65e16581..1ddd3bc6 100644
--- a/etc/config.sh/FFTW
+++ b/etc/config.sh/FFTW
@@ -35,7 +35,7 @@
#------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
-fftw_version=fftw-3.3.7
+fftw_version=fftw-system
export FFTW_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$fftw_version
# END OF (NORMAL) USER EDITABLE PART
diff --git a/etc/config.sh/adios2 b/etc/config.sh/adios2
index 3840a1ad..8cb91f2f 100644
--- a/etc/config.sh/adios2
+++ b/etc/config.sh/adios2
@@ -22,7 +22,7 @@
#------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
-adios2_version=ADIOS2-2.4.0
+adios2_version=ADIOS2-system
export ADIOS2_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$adios2_version
# END OF (NORMAL) USER EDITABLE PART
diff --git a/etc/config.sh/functions b/etc/config.sh/functions
index 6bd5ac74..f9244404 100644
--- a/etc/config.sh/functions
+++ b/etc/config.sh/functions
@@ -156,6 +156,7 @@ then
_foamAddLib()
{
[ -n "$1" ] && export DYLD_LIBRARY_PATH="$1:$DYLD_LIBRARY_PATH"
+ [ -n "$1" ] && export FOAM_DYLD_LIBRARY_PATH="$1:$FOAM_DYLD_LIBRARY_PATH"
}
# Prepend to DYLD_LIBRARY_PATH with additional checking
@@ -163,6 +164,7 @@ then
_foamAddLibAuto()
{
eval "$($WM_PROJECT_DIR/bin/tools/lib-dir -sh $@)";
+ export DYLD_LIBRARY_PATH="$FOAM_DYLD_LIBRARY_PATH"
}
fi
diff --git a/etc/config.sh/kahip b/etc/config.sh/kahip
index 6eb38547..9abec1c2 100644
--- a/etc/config.sh/kahip
+++ b/etc/config.sh/kahip
@@ -37,8 +37,8 @@
#------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
-KAHIP_VERSION=kahip-2.12
-export KAHIP_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$KAHIP_VERSION
+KAHIP_VERSION=kahip-system
+export KAHIP_ARCH_PATH=/usr/local/opt/kahip
# END OF (NORMAL) USER EDITABLE PART
#------------------------------------------------------------------------------
diff --git a/etc/config.sh/mac/paraview b/etc/config.sh/mac/paraview
new file mode 100644
index 00000000..cc69c194
--- /dev/null
+++ b/etc/config.sh/mac/paraview
@@ -0,0 +1,18 @@
+_paraviews=(/Applications/[Pp][Aa][Rr][Aa][Vv][Ii][Ee][Ww]*.app)
+if test -d $_paraviews;
+then
+ [ "$FOAM_VERBOSE" -a "$PS1" ] && echo Using $_paraviews
+
+ paraview () {
+ local _paraviews=(/Applications/[Pp][Aa][Rr][Aa][Vv][Ii][Ee][Ww]*.app)
+ $_paraviews/Contents/MacOS/paraview "$@"
+ }
+
+ export -f paraview
+else
+ echo
+ echo "Please download binary Paraview release from"
+ echo "http://paraview.org and install it in /Applications"
+ echo "folder."
+ echo
+fi
diff --git a/etc/config.sh/metis b/etc/config.sh/metis
index ce42f62a..8a481a8f 100644
--- a/etc/config.sh/metis
+++ b/etc/config.sh/metis
@@ -34,7 +34,7 @@
#------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
-METIS_VERSION=metis-5.1.0
+METIS_VERSION=metis-system
export METIS_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$METIS_VERSION
# END OF (NORMAL) USER EDITABLE PART
diff --git a/etc/config.sh/paraview b/etc/config.sh/paraview
index ab2f12e6..e3f2b6f8 100644
--- a/etc/config.sh/paraview
+++ b/etc/config.sh/paraview
@@ -54,7 +54,7 @@
#------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
-ParaView_VERSION=5.6.3
+ParaView_VERSION=system
ParaView_QT=qt-system
cmake_version=cmake-system
diff --git a/etc/config.sh/petsc b/etc/config.sh/petsc
index 75492913..e1463d59 100644
--- a/etc/config.sh/petsc
+++ b/etc/config.sh/petsc
@@ -28,7 +28,7 @@
#------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
-petsc_version=petsc-3.9.3
+petsc_version=petsc-system
export PETSC_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$petsc_version
# END OF (NORMAL) USER EDITABLE PART
diff --git a/etc/config.sh/scotch b/etc/config.sh/scotch
index b7538a7b..ac5261d8 100644
--- a/etc/config.sh/scotch
+++ b/etc/config.sh/scotch
@@ -34,7 +34,7 @@
#------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
-SCOTCH_VERSION=scotch_6.0.9
+SCOTCH_VERSION=scotch-system
export SCOTCH_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$SCOTCH_VERSION
# END OF (NORMAL) USER EDITABLE PART
diff --git a/etc/config.sh/settings b/etc/config.sh/settings
index 8b3ba124..a0c53cc4 100644
--- a/etc/config.sh/settings
+++ b/etc/config.sh/settings
@@ -85,6 +85,7 @@ Linux)
Darwin) # Presumably x86_64
WM_ARCH=darwin64
+ WM_COMPILER=Clang
echo "Darwin support is clang/llvm only" 1>&2
;;
diff --git a/etc/config.sh/setup b/etc/config.sh/setup
index d502e835..ae371310 100644
--- a/etc/config.sh/setup
+++ b/etc/config.sh/setup
@@ -26,6 +26,10 @@
#
#------------------------------------------------------------------------------
+# Are we on Darwin?
+isDarwin=0
+[ "$(uname -s)" = "Darwin" ] && isDarwin=1
+
# [FOAM_API] - The API level for the project
export FOAM_API="$($WM_PROJECT_DIR/bin/foamEtcFile -show-api)"
@@ -107,10 +111,23 @@ fi
# Clean standard environment variables (PATH, MANPATH, LD_LIBRARY_PATH)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-export PATH MANPATH LD_LIBRARY_PATH
+export PATH MANPATH
+if [ $isDarwin ]
+then
+ [ -n "$DYLD_LIBRARY_PATH" ] && FOAM_DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH"
+ export DYLD_LIBRARY_PATH FOAM_DYLD_LIBRARY_PATH
+else
+ export LD_LIBRARY_PATH
+fi
_foamClean PATH "$foamOldDirs"
_foamClean MANPATH "$foamOldDirs"
-_foamClean LD_LIBRARY_PATH "$foamOldDirs"
+if [ $isDarwin ]
+then
+ _foamClean FOAM_DYLD_LIBRARY_PATH "$foamOldDirs"
+ DYLD_LIBRARY_PATH=$FOAM_DYLD_LIBRARY_PATH
+else
+ _foamClean LD_LIBRARY_PATH "$foamOldDirs"
+fi
# Setup for OpenFOAM compilation etc
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -119,9 +136,14 @@ _foamEtc -config settings
# Setup for third-party packages
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_foamEtc -config mpi
-_foamEtc -config paraview -- "$@" # Pass through for evaluation
-_foamEtc -config vtk
-_foamEtc -config gperftools
+if [ $isDarwin ]
+then
+ _foamEtc -config mac/paraview -- "$@" # Pass through for evaluation
+else
+ _foamEtc -config paraview -- "$@" # Pass through for evaluation
+ _foamEtc -config vtk
+ _foamEtc -config gperftools
+fi
_foamEtc -config adios2
_foamEtc -config CGAL
_foamEtc -config scotch
@@ -142,11 +164,23 @@ fi
# Clean environment paths again. Only remove duplicates
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-export PATH MANPATH LD_LIBRARY_PATH
+export PATH MANPATH
+if [ $isDarwin ]
+then
+ export FOAM_DYLD_LIBRARY_PATH DYLD_LIBRARY_PATH
+else
+ export LD_LIBRARY_PATH
+fi
_foamClean PATH
_foamClean MANPATH
-_foamClean LD_LIBRARY_PATH
+if [ $isDarwin ]
+then
+ _foamClean FOAM_DYLD_LIBRARY_PATH
+ DYLD_LIBRARY_PATH=$FOAM_DYLD_LIBRARY_PATH
+else
+ _foamClean LD_LIBRARY_PATH
+fi
# Add trailing ':' for system manpages
if [ -n "$MANPATH" ]
@@ -162,6 +196,6 @@ fi
. "$WM_PROJECT_DIR/etc/config.sh/functions"
# Variables (done as the last statement for a clean exit code)
-unset cleaned foamOldDirs foundDir prefixDir
+unset cleaned foamOldDirs foundDir prefixDir isDarwin
#------------------------------------------------------------------------------
diff --git a/etc/config.sh/unset b/etc/config.sh/unset
index 3676b19c..2a70c295 100644
--- a/etc/config.sh/unset
+++ b/etc/config.sh/unset
@@ -20,6 +20,9 @@
#
#------------------------------------------------------------------------------
+isDarwin=0
+[ "$(uname -s)" = "Darwin" ] && isDarwin=1
+
# Clean standard environment variables (PATH, LD_LIBRARY_PATH, MANPATH)
foamClean=$WM_PROJECT_DIR/bin/foamCleanPath
[ -f "$foamClean" -a -x "$foamClean" ] || unset foamClean
@@ -66,6 +69,7 @@ unset WM_THIRD_PARTY_DIR
#------------------------------------------------------------------------------
# Unset FOAM_* environment variables
+# Note: keep FOAM_DYLD_LIBRARY_PATH for clean-up of DYLD_LIBRARY_PATH
unset FOAM_API
unset FOAM_APPBIN
@@ -139,21 +143,35 @@ unset SCOTCH_ARCH_PATH
#------------------------------------------------------------------------------
# Cleanup environment
-# PATH, LD_LIBRARY_PATH, MANPATH
+# PATH, [FOAM_][DY]LD_LIBRARY_PATH, MANPATH
if [ -n "$foamClean" ]
then
eval "$($foamClean -sh-env=PATH $foamOldDirs)"
- eval "$($foamClean -sh-env=LD_LIBRARY_PATH $foamOldDirs)"
+ if [ $isDarwin ]
+ then
+ eval "$($foamClean -sh-env=FOAM_DYLD_LIBRARY_PATH $foamOldDirs)"
+ DYLD_LIBRARY_PATH="$FOAM_DYLD_LIBRARY_PATH"
+ else
+ eval "$($foamClean -sh-env=LD_LIBRARY_PATH $foamOldDirs)"
+ fi
eval "$($foamClean -sh-env=MANPATH $foamOldDirs)"
fi
-[ -n "$LD_LIBRARY_PATH" ] || unset LD_LIBRARY_PATH
+if [ $isDarwin ]
+then
+ [ -n "$DYLD_LIBRARY_PATH" ] || unset DYLD_LIBRARY_PATH
+ unset FOAM_DYLD_LIBRARY_PATH
+else
+ [ -n "$LD_LIBRARY_PATH" ] || unset LD_LIBRARY_PATH
+fi
[ -n "$MANPATH" ] || unset MANPATH
#------------------------------------------------------------------------------
# Cleanup aliases and functions
+[ $isDarwin ] && unset -f paraview 2>/dev/null
+
unalias wmSet 2>/dev/null
unalias wmInt32 2>/dev/null
unalias wmInt64 2>/dev/null
@@ -208,6 +226,6 @@ unset _of_complete_cache_
#------------------------------------------------------------------------------
# Intermediate variables (do as last for a clean exit code)
-unset cleaned foamClean foamOldDirs
+unset cleaned foamClean foamOldDirs isDarwin
#------------------------------------------------------------------------------
diff --git a/etc/config.sh/vtk b/etc/config.sh/vtk
index 312034f8..3d703f23 100644
--- a/etc/config.sh/vtk
+++ b/etc/config.sh/vtk
@@ -34,13 +34,13 @@
#------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
-vtk_version=VTK-8.2.0
-mesa_version=mesa-17.1.1
+vtk_version=none
+mesa_version=none
mesa_llvm=none
-export VTK_DIR="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$vtk_version"
-export MESA_ARCH_PATH="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$mesa_version"
-export LLVM_ARCH_PATH="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH/$mesa_llvm"
+export VTK_DIR=
+export MESA_ARCH_PATH=
+export LLVM_ARCH_PATH=
# Define paraview-mesa directory as required
unset ParaView_MESA_DIR
diff --git a/etc/cshrc b/etc/cshrc
index 91dcace4..39faf137 100644
--- a/etc/cshrc
+++ b/etc/cshrc
@@ -97,7 +97,7 @@ setenv WM_PROJECT OpenFOAM
# If the directory naming does not match WM_PROJECT, need to change here
set projectName="$WM_PROJECT"
set projectDir=`lsof +p $$ |& \
- sed -ne 's@^[^/]*@@;\@/'"$projectName"'[^/]*/etc/cshrc@{s@/etc/cshrc.*@@p; q}'`
+ sed -ne 's@^[^/]*@@;\@/'"$projectName"'[^/]*/etc/cshrc@{s@/etc/cshrc.*@@p; q; }'`
# set projectDir="$HOME/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION"
# set projectDir="/opt/openfoam/OpenFOAM-$WM_PROJECT_VERSION"
diff --git a/src/OSspecific/POSIX/signals/sigFpe.C b/src/OSspecific/POSIX/signals/sigFpe.C
index 55c1fed7..39aca0c3 100644
--- a/src/OSspecific/POSIX/signals/sigFpe.C
+++ b/src/OSspecific/POSIX/signals/sigFpe.C
@@ -44,6 +44,12 @@ License
#include <malloc.h>
#endif
+#if defined(__APPLE__)
+ #include <malloc/malloc.h>
+ #include <sys/mman.h>
+ #include <unistd.h>
+#endif
+
#ifdef __APPLE__
#include "feexceptErsatz.H"
#endif
@@ -60,8 +66,20 @@ bool Foam::sigFpe::switchNan_(Foam::debug::optimisationSwitch("setNaN", 0));
bool Foam::sigFpe::sigActive_ = false;
bool Foam::sigFpe::nanActive_ = false;
-
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
+#if defined(__APPLE__)
+static void* (*oldMalloc)(struct _malloc_zone_t *zone, size_t size) = nullptr;
+
+static void* nanMalloc(struct _malloc_zone_t *zone, size_t size)
+{
+ if (!oldMalloc) return nullptr;
+ void* result = oldMalloc(zone, size);
+ Foam::UList<Foam::scalar> lst(reinterpret_cast<Foam::scalar*>(result),
+ size/sizeof(Foam::scalar));
+ Foam::sigFpe::fillNan(lst);
+ return result;
+}
+#endif
// Can turn on/off via env variable containing a bool (true|false|on|off ...)
// or by the specified flag
@@ -226,6 +244,25 @@ void Foam::sigFpe::set(bool verbose)
nanActive_ = true;
#endif
+ #ifdef __APPLE__
+ malloc_zone_t *zone = malloc_default_zone();
+ if (zone != nullptr)
+ {
+ oldMalloc = zone->malloc;
+ if(mprotect(zone, getpagesize(), PROT_READ | PROT_WRITE) == 0)
+ {
+ zone->malloc = nanMalloc;
+ if
+ (
+ mprotect(zone, getpagesize(), PROT_READ) == 0
+ )
+ {
+ nanActive_ = true;
+ }
+ }
+ }
+ #endif
+
if (verbose)
{
Info<< "setNaN : Initialise allocated memory to NaN ";
@@ -276,6 +313,18 @@ void Foam::sigFpe::unset(bool verbose)
#endif
nanActive_ = false;
+ #if defined(__APPLE__)
+ if (oldMalloc != nullptr)
+ {
+ malloc_zone_t *zone = malloc_default_zone();
+ if (zone != nullptr)
+ {
+ mprotect(zone, getpagesize(), PROT_READ | PROT_WRITE);
+ zone->malloc = oldMalloc;
+ mprotect(zone, getpagesize(), PROT_READ);
+ }
+ }
+ #endif
}
diff --git a/src/OpenFOAM/containers/HashTables/HashSet/HashSet.C b/src/OpenFOAM/containers/HashTables/HashSet/HashSet.C
index c4012bd3..227c109a 100644
--- a/src/OpenFOAM/containers/HashTables/HashSet/HashSet.C
+++ b/src/OpenFOAM/containers/HashTables/HashSet/HashSet.C
@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
- Copyright (C) 2016-2019 OpenCFD Ltd.
+ Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -246,14 +246,14 @@ inline Foam::label Foam::HashSet<Key, Hash>::unset
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Key, class Hash>
-inline bool Foam::HashSet<Key, Hash>::operator()(const Key& key) const
+inline bool Foam::HashSet<Key, Hash>::operator()(const Key& key) const noexcept
{
return this->found(key);
}
template<class Key, class Hash>
-inline bool Foam::HashSet<Key, Hash>::operator[](const Key& key) const
+inline bool Foam::HashSet<Key, Hash>::operator[](const Key& key) const noexcept
{
return this->found(key);
}
@@ -353,6 +353,14 @@ Foam::HashSet<Key, Hash>::operator^=(const HashSet<Key, Hash>& rhs)
}
+template<class Key, class Hash>
+inline Foam::HashSet<Key, Hash>&
+Foam::HashSet<Key, Hash>::operator+=(const HashSet<Key, Hash>& rhs)
+{
+ return this->operator|=(rhs);
+}
+
+
template<class Key, class Hash>
inline Foam::HashSet<Key, Hash>&
Foam::HashSet<Key, Hash>::operator-=(const HashSet<Key, Hash>& rhs)
@@ -419,9 +427,9 @@ template<class Key, class Hash>
inline typename Foam::HashSet<Key, Hash>::iterator
Foam::HashSet<Key, Hash>::begin()
{
- return HashTableCore::iterator_begin<iterator>
+ return iterator
(
- static_cast<parent_type&>(*this)
+ static_cast<parent_type&>(*this).begin()
);
}
@@ -430,9 +438,9 @@ template<class Key, class Hash>
inline typename Foam::HashSet<Key, Hash>::const_iterator
Foam::HashSet<Key, Hash>::begin() const
{
- return HashTableCore::iterator_cbegin<const_iterator>
+ return const_iterator
(
- static_cast<const parent_type&>(*this)
+ static_cast<const parent_type&>(*this).begin()
);
}
@@ -441,34 +449,34 @@ template<class Key, class Hash>
inline typename Foam::HashSet<Key, Hash>::const_iterator
Foam::HashSet<Key, Hash>::cbegin() const
{
- return HashTableCore::iterator_cbegin<const_iterator>
+ return const_iterator
(
- static_cast<const parent_type&>(*this)
+ static_cast<const parent_type&>(*this).cbegin()
);
}
template<class Key, class Hash>
-inline const typename Foam::HashSet<Key, Hash>::iterator&
-Foam::HashSet<Key, Hash>::end()
+inline typename Foam::HashSet<Key, Hash>::iterator
+Foam::HashSet<Key, Hash>::end() noexcept
{
- return HashTableCore::iterator_end<iterator>();
+ return iterator();
}
template<class Key, class Hash>
-inline const typename Foam::HashSet<Key, Hash>::const_iterator&
-Foam::HashSet<Key, Hash>::end() const
+inline typename Foam::HashSet<Key, Hash>::const_iterator
+Foam::HashSet<Key, Hash>::end() const noexcept
{
- return HashTableCore::iterator_cend<const_iterator>();
+ return const_iterator();
}
template<class Key, class Hash>
-inline const typename Foam::HashSet<Key, Hash>::const_iterator&
-Foam::HashSet<Key, Hash>::cend() const
+inline constexpr typename Foam::HashSet<Key, Hash>::const_iterator
+Foam::HashSet<Key, Hash>::cend() const noexcept
{
- return HashTableCore::iterator_cend<const_iterator>();
+ return const_iterator();
}
diff --git a/src/OpenFOAM/containers/HashTables/HashSet/HashSet.H b/src/OpenFOAM/containers/HashTables/HashSet/HashSet.H
index 0f22599e..12af96c8 100644
--- a/src/OpenFOAM/containers/HashTables/HashSet/HashSet.H
+++ b/src/OpenFOAM/containers/HashTables/HashSet/HashSet.H
@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
- Copyright (C) 2016-2019 OpenCFD Ltd.
+ Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -73,10 +73,9 @@ Description
namespace Foam
{
-// Forward declarations
+// Forward Declarations
template<class T> class MinMax;
-
/*---------------------------------------------------------------------------*\
Class HashSet Declaration
\*---------------------------------------------------------------------------*/
@@ -115,12 +114,24 @@ public:
// Constructors
- //- Construct null with default (128) table capacity
+ //- Default construct with default (128) table capacity
HashSet()
:
parent_type()
{}
+ //- Copy construct
+ HashSet(const this_type& rhs)
+ :
+ parent_type(rhs)
+ {}
+
+ //- Move construct
+ HashSet(this_type&& rhs)
+ :
+ parent_type(std::move(rhs))
+ {}
+
//- Construct given initial table capacity
explicit HashSet(const label size)
: