-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
OpenFOAM-12-17d0158143.patch
2718 lines (2546 loc) · 86.7 KB
/
OpenFOAM-12-17d0158143.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
Allwmake | 5 +-
applications/Allwmake | 2 +
.../postProcessing/graphics/PVReaders/Allwmake | 6 +
bin/foamMonitor | 8 +-
bin/paraFoam | 8 ++
bin/tools/RunFunctions | 3 +
etc/bashrc | 73 ++++++++---
etc/config.csh/functions | 9 +-
etc/config.csh/mac/paraview | 13 ++
etc/config.csh/mpi | 5 +-
etc/config.csh/settings | 17 ++-
etc/config.csh/unset | 36 ++++--
etc/config.sh/mac/CGAL | 47 ++++++++
etc/config.sh/mac/functions | 134 +++++++++++++++++++++
etc/config.sh/mac/metis | 44 +++++++
etc/config.sh/mac/paraview | 18 +++
etc/config.sh/mac/scotch | 47 ++++++++
etc/config.sh/mpi | 5 +-
etc/config.sh/settings | 18 ++-
etc/config.sh/unset | 23 +++-
etc/cshrc | 61 ++++++++--
src/Allwmake | 2 +
src/OSspecific/POSIX/POSIX.C | 35 +++++-
src/OSspecific/POSIX/clockTime/clockTime.H | 3 +
src/OSspecific/POSIX/fileStat.C | 2 +
src/OSspecific/POSIX/printStack.C | 43 ++++++-
src/OSspecific/POSIX/signals/sigFpe.C | 79 +++++++++++-
src/OSspecific/POSIX/signals/sigFpe.H | 12 +-
src/OpenFOAM/Make/files | 2 +
src/OpenFOAM/containers/Lists/UList/UList.C | 1 +
.../db/dynamicLibrary/dynamicCode/dynamicCode.C | 4 +
.../db/dynamicLibrary/dynamicCode/dynamicCode.H | 4 +
src/OpenFOAM/primitives/Scalar/doubleFloat.H | 40 ++++++
src/OpenFOAM/primitives/hashes/Hasher/Hasher.C | 2 +-
src/OpenFOAM/primitives/ints/int/int.H | 4 +
src/OpenFOAM/primitives/ints/int16/int16.C | 48 ++++++++
src/OpenFOAM/primitives/ints/int16/int16.H | 73 +++++++++++
src/OpenFOAM/primitives/ints/int64/int64.H | 5 +
src/OpenFOAM/primitives/ints/int64/int64IO.C | 12 ++
src/OpenFOAM/primitives/ints/uint/uint.H | 1 +
src/OpenFOAM/primitives/ints/uint16/uint16.C | 48 ++++++++
src/OpenFOAM/primitives/ints/uint16/uint16.H | 73 +++++++++++
src/OpenFOAM/primitives/ints/uint64/uint64.H | 4 +
src/OpenFOAM/primitives/ints/uint64/uint64IO.C | 8 ++
src/fvAgglomerationMethods/Allwmake | 10 +-
.../MGridGenGamgAgglomeration/Make/options | 14 ++-
src/parallel/decompose/ptscotch/Make/options | 7 +-
src/parallel/decompose/scotch/Make/options | 7 +-
src/renumber/SloanRenumber/Make/options | 14 ++-
wmake/makefiles/files | 2 +-
wmake/makefiles/general | 4 +
wmake/rules/General/transform | 1 -
wmake/rules/darwin64Clang/CGAL | 9 ++
wmake/rules/darwin64Clang/bison | 13 ++
wmake/rules/darwin64Clang/c | 23 ++++
wmake/rules/darwin64Clang/c++ | 35 ++++++
wmake/rules/darwin64Clang/c++Debug | 4 +
wmake/rules/darwin64Clang/c++Opt | 5 +
wmake/rules/darwin64Clang/c++Prof | 4 +
wmake/rules/darwin64Clang/cDebug | 4 +
wmake/rules/darwin64Clang/cOpt | 4 +
wmake/rules/darwin64Clang/cProf | 4 +
wmake/rules/darwin64Clang/flex | 5 +
wmake/rules/darwin64Clang/flex++ | 5 +
wmake/rules/darwin64Clang/general | 16 +++
wmake/rules/darwin64Clang/yacc | 13 ++
wmake/rules/darwinArm64Clang/CGAL | 9 ++
wmake/rules/darwinArm64Clang/bison | 13 ++
wmake/rules/darwinArm64Clang/c | 23 ++++
wmake/rules/darwinArm64Clang/c++ | 35 ++++++
wmake/rules/darwinArm64Clang/c++Debug | 4 +
wmake/rules/darwinArm64Clang/c++Opt | 5 +
wmake/rules/darwinArm64Clang/c++Prof | 4 +
wmake/rules/darwinArm64Clang/cDebug | 4 +
wmake/rules/darwinArm64Clang/cOpt | 4 +
wmake/rules/darwinArm64Clang/cProf | 4 +
wmake/rules/darwinArm64Clang/flex | 5 +
wmake/rules/darwinArm64Clang/flex++ | 5 +
wmake/rules/darwinArm64Clang/general | 16 +++
wmake/rules/darwinArm64Clang/yacc | 13 ++
wmake/src/Makefile | 2 +
wmake/wmake | 5 +
wmake/wmakeLnInclude | 13 ++
wmake/wmakeLnIncludeAll | 1 +
84 files changed, 1376 insertions(+), 79 deletions(-)
diff --git a/Allwmake b/Allwmake
index 3f6a7523d2..00810aff6e 100755
--- a/Allwmake
+++ b/Allwmake
@@ -12,11 +12,13 @@ wmakeCheckPwd "$WM_PROJECT_DIR" || {
exit 1
}
+[ "$(uname -s)" = "Darwin" ] || {
[ -n "$FOAM_EXT_LIBBIN" ] || {
echo "Allwmake error: FOAM_EXT_LIBBIN not set"
echo " Check the OpenFOAM entries in your dot-files and source them."
exit 1
}
+}
# Compile wmake support applications
(cd wmake/src && make)
@@ -26,7 +28,8 @@ if [ -d "$WM_THIRD_PARTY_DIR" ]
then
$WM_THIRD_PARTY_DIR/Allwmake
else
- echo "Allwmake: no ThirdParty directory found - skipping"
+ [ "$(uname -s)" = "Darwin" ] \
+ || echo "Allwmake: no ThirdParty directory found - skipping"
fi
# Compile OpenFOAM libraries and applications
diff --git a/applications/Allwmake b/applications/Allwmake
index d11e7c8e1d..c653bfaacc 100755
--- a/applications/Allwmake
+++ b/applications/Allwmake
@@ -12,11 +12,13 @@ wmakeCheckPwd "$WM_PROJECT_DIR/applications" || {
exit 1
}
+[ "$(uname -s)" = "Darwin" ] || {
[ -n "$FOAM_EXT_LIBBIN" ] || {
echo "Allwmake error: FOAM_EXT_LIBBIN not set"
echo " Check the OpenFOAM entries in your dot-files and source them."
exit 1
}
+}
wmake -all $targetType solvers
modules/Allwmake $targetType $*
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/Allwmake b/applications/utilities/postProcessing/graphics/PVReaders/Allwmake
index 1deca76ee0..8756574862 100755
--- a/applications/utilities/postProcessing/graphics/PVReaders/Allwmake
+++ b/applications/utilities/postProcessing/graphics/PVReaders/Allwmake
@@ -4,6 +4,12 @@ cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
+if [ "$(uname -s)" = "Darwin" ]
+then
+ echo "Skipping PVReaders on macOS."
+ exit 0
+fi
+
if [ ! -d "$ParaView_DIR" ]
then
echo " Warning: ParaView not found in $ParaView_DIR. Skipping."
diff --git a/bin/foamMonitor b/bin/foamMonitor
index 3a9bc2179d..0de3c227cd 100755
--- a/bin/foamMonitor
+++ b/bin/foamMonitor
@@ -93,7 +93,9 @@ plotFileHeader() {
[ "$logscale" = yes ] && _ticFormat="%1.e"
_otherAxis="$([ "$AXIS" = x ] && echo y || echo x)"
- printf "set term %s" "$_term"
+ printf "selected_terminal = 'x11'\n"
+ printf "for [t in 'wxt qt'] if (strstrt(GPVAL_TERMINALS, t)) selected_terminal = t\n"
+ printf "set term selected_terminal $_term"
[ "$_size" = default ] || printf " size %s" "$_size"
printf "\n"
@@ -315,9 +317,11 @@ trap 'rm -f $gp_file' EXIT
touch "$file"
# Re-read data file to update graph
+_stat="stat --format=%Y"
+[ "$(uname -s)" = "Darwin" ] && _stat="stat -f %m"
while true
do
- mod_time=$(stat --format=%Y "$file")
+ mod_time=$($_stat "$file")
idle_ago=$(( $(date +%s) - idle ))
test "$mod_time" -gt "$idle_ago" || break
sleep "$refresh"
diff --git a/bin/paraFoam b/bin/paraFoam
index b41a61a18a..cf358908d8 100755
--- a/bin/paraFoam
+++ b/bin/paraFoam
@@ -111,6 +111,14 @@ extension=OpenFOAM
requirePVExe=1
requirePVReader=1
+if [ "$(uname -s)" = "Darwin" ]
+then
+ extension=foam
+
+ requirePVExe=0
+ requirePVReader=0
+fi
+
# Parse options
while [ "$#" -gt 0 ]
do
diff --git a/bin/tools/RunFunctions b/bin/tools/RunFunctions
index 55776db644..fb52df49d8 100644
--- a/bin/tools/RunFunctions
+++ b/bin/tools/RunFunctions
@@ -28,6 +28,9 @@
# Miscellaneous functions for running tutorial cases
#------------------------------------------------------------------------------
+[ -z "$DYLD_LIBRARY_PATH" -a -n "$FOAM_DYLD_LIBRARY_PATH" ] \
+ && export DYLD_LIBRARY_PATH="$FOAM_DYLD_LIBRARY_PATH"
+
isTest()
{
for i in "$@"; do
diff --git a/etc/bashrc b/etc/bashrc
index b8adf28e3b..be668902cc 100644
--- a/etc/bashrc
+++ b/etc/bashrc
@@ -61,6 +61,16 @@ unset bashrcFile
# END OF (NORMAL) USER EDITABLE PART
################################################################################
+_foam_on_macos()
+{
+ if [ "$(uname -s)" = "Darwin" ]
+ then
+ return 0
+ else
+ return 1
+ fi
+}
+
# The default environment variables below can be overridden in a prefs.sh file
# located in ~/.OpenFOAM/$WM_PROJECT_VERSION, ~/.OpenFOAM,
# $FOAM_INST_DIR/site/$WM_PROJECT_VERSION or $FOAM_INST_DIR/site
@@ -72,6 +82,7 @@ export WM_COMPILER_TYPE=system
#- Compiler:
# WM_COMPILER = Gcc | Gcc48 ... Gcc62 | Clang | Icx
export WM_COMPILER=Gcc
+_foam_on_macos && export WM_COMPILER=Clang
unset WM_COMPILER_ARCH WM_COMPILER_LIB_ARCH
#- Memory addressing:
@@ -145,9 +156,10 @@ fi
# Source initialisation functions
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
. $WM_PROJECT_DIR/etc/config.sh/functions
+_foam_on_macos && . $WM_PROJECT_DIR/etc/config.sh/mac/functions
# Add in preset user or site preferences:
-_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.sh`
+_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile prefs.sh)
# Evaluate command-line parameters of the form "param=keyword" or unset
# parameters with "param="
@@ -156,11 +168,14 @@ _foamParams $@
# Location of third-party software
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-if [ ${WM_THIRD_PARTY%%/*} = ${WM_PROJECT_DIR##*/} ]
+if [ ! _foam_on_macos ]
then
- export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/$WM_THIRD_PARTY
-else
- export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/$WM_THIRD_PARTY-$WM_PROJECT_VERSION
+ if [ ${WM_THIRD_PARTY%%/*} = ${WM_PROJECT_DIR##*/} ]
+ then
+ export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/$WM_THIRD_PARTY
+ else
+ export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/$WM_THIRD_PARTY-$WM_PROJECT_VERSION
+ fi
fi
if [ -d "$WM_THIRD_PARTY_DIR" ]
@@ -192,16 +207,27 @@ export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
foamClean=$WM_PROJECT_DIR/bin/foamCleanPath
#- Clean PATH
-cleaned=`$foamClean "$PATH" "$foamOldDirs"` && PATH="$cleaned"
+cleaned=$($foamClean "$PATH" "$foamOldDirs") && PATH="$cleaned"
-#- Clean LD_LIBRARY_PATH
-cleaned=`$foamClean "$LD_LIBRARY_PATH" "$foamOldDirs"` \
- && LD_LIBRARY_PATH="$cleaned"
+if _foam_on_macos
+then
+ #- Clean DYLD_LIBRARY_PATH on macOS
+ cleaned=$($foamClean "$DYLD_LIBRARY_PATH" "$foamOldDirs") \
+ && DYLD_LIBRARY_PATH="$cleaned"
+ export DYLD_LIBRARY_PATH
+ FOAM_DYLD_LIBRARY_PATH="$DYDL_LIBRARY_PATH"
+ export FOAM_DYLD_LIBRARY_PATH
+else
+ #- Clean LD_LIBRARY_PATH
+ cleaned=$($foamClean "$LD_LIBRARY_PATH" "$foamOldDirs") \
+ && LD_LIBRARY_PATH="$cleaned"
+ export LD_LIBRARY_PATH
+fi
#- Clean MANPATH
-cleaned=`$foamClean "$MANPATH" "$foamOldDirs"` && MANPATH="$cleaned"
+cleaned=$($foamClean "$MANPATH" "$foamOldDirs") && MANPATH="$cleaned"
-export PATH LD_LIBRARY_PATH MANPATH
+export PATH MANPATH
# Source project setup files
@@ -213,7 +239,12 @@ _foamSource $WM_PROJECT_DIR/etc/config.sh/aliases
# Source user setup files for optional packages
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/mpi`
-_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/paraview`
+if _foam_on_macos
+then
+ _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/mac/paraview`
+else
+ _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/paraview`
+fi
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/ensight`
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/gperftools`
@@ -223,13 +254,23 @@ _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/gperftools`
#- Clean PATH
cleaned=`$foamClean "$PATH"` && PATH="$cleaned"
-#- Clean LD_LIBRARY_PATH
-cleaned=`$foamClean "$LD_LIBRARY_PATH"` && LD_LIBRARY_PATH="$cleaned"
+if _foam_on_macos
+then
+ #- Clean DYLD_LIBRARY_PATH
+ cleaned=`$foamClean "$DYLD_LIBRARY_PATH"` && DYLD_LIBRARY_PATH="$cleaned"
+ export DYLD_LIBRARY_PATH
+ FOAM_DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH"
+ export FOAM_DYLD_LIBRARY_PATH
+else
+ #- Clean LD_LIBRARY_PATH
+ cleaned=`$foamClean "$LD_LIBRARY_PATH"` && LD_LIBRARY_PATH="$cleaned"
+ export LD_LIBRARY_PATH
+fi
#- Clean MANPATH (trailing ':' to find system pages)
cleaned=`$foamClean "$MANPATH"`: && MANPATH="$cleaned"
-export PATH LD_LIBRARY_PATH MANPATH
+export PATH MANPATH
#- Clean LD_PRELOAD
if [ -n "$LD_PRELOAD" ]
@@ -247,6 +288,8 @@ unset cleaned foamClean foamOldDirs
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
. $WM_PROJECT_DIR/etc/config.sh/functions
+_foam_on_macos && . $WM_PROJECT_DIR/etc/config.sh/mac/functions
+
# Source the bash completion file:
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ "$BASH" ] && . $WM_PROJECT_DIR/etc/config.sh/bash_completion
diff --git a/etc/config.csh/functions b/etc/config.csh/functions
index f10f7c5272..98044f5ea7 100644
--- a/etc/config.csh/functions
+++ b/etc/config.csh/functions
@@ -31,6 +31,7 @@
#------------------------------------------------------------------------------
if ( ! $?WM_CSH_FUNCTIONS ) then
+ @ _foamDarwin = (`uname -s` == "Darwin")
# Temporary environment variable for automatically (un)loading functions
set WM_CSH_FUNCTIONS loaded
@@ -66,7 +67,11 @@ if ( ! $?WM_CSH_FUNCTIONS ) then
alias _foamAddPath 'setenv PATH \!*\:${PATH}'
# Prefix to LD_LIBRARY_PATH
- alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'
+ if ($_foamDarwin) then
+ alias _foamAddLib 'setenv FOAM_DYLD_LIBRARY_PATH \!*\:${FOAM_DYLD_LIBRARY_PATH}; setenv DYLD_LIBRARY_PATH \!*\:${DYLD_LIBRARY_PATH}'
+ else
+ alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'
+ endif
# Prefix to MANPATH
alias _foamAddMan 'setenv MANPATH \!*\:${MANPATH}'
@@ -89,6 +94,8 @@ if ( ! $?WM_CSH_FUNCTIONS ) then
endif\
unset _mostRecentDir'
+ unset _foamDarwin
+
else
# Cleanup environment:
diff --git a/etc/config.csh/mac/paraview b/etc/config.csh/mac/paraview
new file mode 100644
index 0000000000..53adbcca5b
--- /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/mpi b/etc/config.csh/mpi
index 1964101b58..22e7c8b853 100644
--- a/etc/config.csh/mpi
+++ b/etc/config.csh/mpi
@@ -259,7 +259,10 @@ endsw
# Add (non-dummy) MPI implementation
# Dummy MPI already added to LD_LIBRARY_PATH and has no external libraries
if ( "$FOAM_MPI" != dummy ) then
- _foamAddLib ${FOAM_LIBBIN}/${FOAM_MPI}:${FOAM_EXT_LIBBIN}/${FOAM_MPI}
+ if ($?FOAM_EXT_LIBBIN) then
+ _foamAddLib :${FOAM_EXT_LIBBIN}/${FOAM_MPI}
+ endif
+ _foamAddLib ${FOAM_LIBBIN}/${FOAM_MPI}
endif
diff --git a/etc/config.csh/settings b/etc/config.csh/settings
index 6bd7c7db3b..b731666999 100644
--- a/etc/config.csh/settings
+++ b/etc/config.csh/settings
@@ -139,6 +139,13 @@ case SunOS:
setenv WM_LDFLAGS '-mabi=64 -G0'
breaksw
+case Darwin:
+ setenv WM_ARCH darwin64
+ setenv WM_COMPILER_LIB_ARCH 64
+ setenv WM_CC 'clang'
+ setenv WM_CXX 'clang++'
+ breaksw
+
default: # An unsupported operating system
/bin/cat <<USAGE
@@ -166,7 +173,9 @@ setenv FOAM_APPBIN $WM_PROJECT_DIR/platforms/$WM_OPTIONS/bin
setenv FOAM_LIBBIN $WM_PROJECT_DIR/platforms/$WM_OPTIONS/lib
# External (ThirdParty) libraries
-setenv FOAM_EXT_LIBBIN $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/lib
+if (${?WM_THIRD_PARTY_DIR}) then
+ setenv FOAM_EXT_LIBBIN $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/lib
+endif
# Site-specific directory
if ( $?WM_PROJECT_SITE ) then
@@ -217,7 +226,11 @@ endif
unset siteDir
# Make sure to pick up dummy versions of external libraries last
-_foamAddLib ${FOAM_USER_LIBBIN}:${FOAM_SITE_LIBBIN}:${FOAM_LIBBIN}:${FOAM_EXT_LIBBIN}:${FOAM_LIBBIN}/dummy
+_foamAddLib ${FOAM_LIBBIN}/dummy
+if (${?FOAM_EXT_LIBBIN}) then
+ _foamAddLib ${FOAM_EXT_LIBBIN}
+endif
+_foamAddLib ${FOAM_USER_LIBBIN}:${FOAM_SITE_LIBBIN}:${FOAM_LIBBIN}
# Compiler settings
# ~~~~~~~~~~~~~~~~~
diff --git a/etc/config.csh/unset b/etc/config.csh/unset
index d29a12a1b6..9bd67b7fae 100644
--- a/etc/config.csh/unset
+++ b/etc/config.csh/unset
@@ -29,6 +29,8 @@
#
#------------------------------------------------------------------------------
+@ foamDarwin = (`uname -s` == "Darwin")
+
# Clean standard environment variables (PATH, LD_LIBRARY_PATH, MANPATH)
unset foamClean
if ( $?WM_PROJECT_DIR ) then
@@ -37,7 +39,10 @@ if ( $?WM_PROJECT_DIR ) then
endif
# The old dirs to be cleaned from the environment variables
-set foamOldDirs="$WM_PROJECT_DIR $WM_THIRD_PARTY_DIR $HOME/$WM_PROJECT/$LOGNAME $FOAM_SITE_APPBIN $FOAM_SITE_LIBBIN"
+set foamOldDirs="$WM_PROJECT_DIR $HOME/$WM_PROJECT/$LOGNAME $FOAM_SITE_APPBIN $FOAM_SITE_LIBBIN"
+if ( ${?WM_THIRD_PARTY_DIR} ) then
+ set foamOldDirs="$foamOldDirs $WM_THIRD_PARTY_DIR"
+endif
if ( $?WM_PROJECT_SITE ) then
set foamOldDirs="$foamOldDirs $WM_PROJECT_SITE"
endif
@@ -54,6 +59,7 @@ unsetenv WM_ARCH_OPTION
unsetenv WM_CC
unsetenv WM_CFLAGS
unsetenv WM_COMPILER
+unsetenv WM_COMPILER_ARCH
unsetenv WM_COMPILER_TYPE
unsetenv WM_COMPILER_LIB_ARCH
unsetenv WM_COMPILE_OPTION
@@ -78,7 +84,8 @@ unsetenv WM_PROJECT_USER_DIR
unsetenv WM_PROJECT_VERSION
unsetenv WM_SCHEDULER
unsetenv WM_THIRD_PARTY
-unsetenv WM_THIRD_PARTY_DIR
+if ($?WM_THIRD_PARTY_DIR) \
+ unsetenv WM_THIRD_PARTY_DIR
#------------------------------------------------------------------------------
@@ -160,11 +167,21 @@ if ( $?foamClean ) then
set cleaned=`$foamClean "$PATH" "$foamOldDirs"`
if ( $status == 0 ) setenv PATH $cleaned
- if ($?LD_LIBRARY_PATH) then
- set cleaned=`$foamClean "$LD_LIBRARY_PATH" "$foamOldDirs"`
- if ( $status == 0 ) setenv LD_LIBRARY_PATH $cleaned
-
- if ( ${%LD_LIBRARY_PATH} == 0 ) unsetenv LD_LIBRARY_PATH
+ if ($foamDarwin) then
+ if ($?FOAM_DYLD_LIBRARY_PATH) then
+ set cleaned=`$foamClean "$FOAM_DYLD_LIBRARY_PATH" "$foamOldDirs"`
+ if ( $status == 0 ) setenv DYLD_LIBRARY_PATH $cleaned
+
+ if ( ${%DYLD_LIBRARY_PATH} == 0 ) unsetenv DYLD_LIBRARY_PATH
+ unsetenv FOAM_DYLD_LIBRARY_PATH
+ endif
+ else
+ if ($?LD_LIBRARY_PATH) then
+ set cleaned=`$foamClean "$LD_LIBRARY_PATH" "$foamOldDirs"`
+ if ( $status == 0 ) setenv LD_LIBRARY_PATH $cleaned
+
+ if ( ${%LD_LIBRARY_PATH} == 0 ) unsetenv LD_LIBRARY_PATH
+ endif
endif
if ($?MANPATH) then
@@ -177,7 +194,7 @@ if ( $?foamClean ) then
endif
-unset cleaned foamClean foamOldDirs
+unset cleaned foamClean foamOldDirs foamDarwin
#------------------------------------------------------------------------------
@@ -188,6 +205,7 @@ unalias wm64
unalias wm32
unalias wmSP
unalias wmDP
+unalias wmLP
unalias wmRefresh
unalias wmUnset
@@ -210,4 +228,4 @@ unalias foamVersion
unalias foamPV
-#------------------------------------------------------------------------------
+#-------------------- vi: set ft=tcsh et sw=4 ts=4 sts=4: ---------------------
diff --git a/etc/config.sh/mac/CGAL b/etc/config.sh/mac/CGAL
new file mode 100644
index 0000000000..fc6393cf7d
--- /dev/null
+++ b/etc/config.sh/mac/CGAL
@@ -0,0 +1,47 @@
+# CGAL configuration for OS X
+
+. $WM_PROJECT_DIR/etc/config.sh/mac/functions
+if [ "x$(_foamBrew)" = "xY" ]
+then
+ _prefix=$(_foamBrewPrefix)
+
+ boost_version="boost-$(_foamGetPackageVersion boost)"
+ cgal_version="CGAL-$(_foamGetPackageVersion cgal)"
+
+ export BOOST_ARCH_PATH="$_prefix/opt/boost"
+ export CGAL_ARCH_PATH="$_prefix/opt/cgal"
+ export MPFR_ARCH_PATH="$_prefix/opt/mpfr"
+ export GMP_ARCH_PATH="$_prefix/opt/gmp"
+
+ unset _prefix
+elif [ "x$(_foamPort)" = "xY" ]
+then
+ _prefix=$(_foamPortPrefix)
+
+ boost_version=$(_foamGetPackageVersion boost)
+ cgal_version=$(_foamGetPackageVersion cgal)
+
+ export BOOST_ARCH_PATH="$_prefix"
+ export CGAL_ARCH_PATH="$_prefix"
+ export GMP_ARCH_PATH="$_prefix"
+ export MPFR_ARCH_PATH="$_prefix"
+
+ unset _prefix
+else
+ boost_version=boost-unknown
+ cgal_version=CGAL-unknown
+
+ export BOOST_ARCH_PATH=/usr/local
+ export CGAL_ARCH_PATH=/usr/local
+fi
+
+if [ "$FOAM_VERBOSE" -a "$PS1" ]
+then
+ echo "Using CGAL and boost" 1>&2
+ echo " $cgal_version at $CGAL_ARCH_PATH" 1>&2
+ echo " $boost_version at $BOOST_ARCH_PATH" 1>&2
+fi
+unset boost_version cgal_version
+. $WM_PROJECT_DIR/etc/config.sh/mac/functions
+
+# vim: set ft=sh:
diff --git a/etc/config.sh/mac/functions b/etc/config.sh/mac/functions
new file mode 100644
index 0000000000..f2a5d841e7
--- /dev/null
+++ b/etc/config.sh/mac/functions
@@ -0,0 +1,134 @@
+# Additional functions for OS X
+
+if [ -z "$WM_BASH_FUNCTIONS_MAC" ]
+then
+ WM_BASH_FUNCTIONS_MAC=loaded
+
+ # Prefix to DYLD_LIBRARY_PATH and FOAM_DYLD_LIBRARY_PATH
+ _foamAddLib ()
+ {
+ while [ $# -ge 1 ]
+ do
+ export DYLD_LIBRARY_PATH=$1:$DYLD_LIBRARY_PATH
+ export FOAM_DYLD_LIBRARY_PATH=$1:$FOAM_DYLD_LIBRARY_PATH
+ shift
+ done
+ }
+
+ _foamBrew ()
+ {
+ if $(which -s brew)
+ then
+ echo Y
+ return 0
+ else
+ echo N
+ return 1
+ fi
+ }
+
+ _foamPort ()
+ {
+ if $(which -s port)
+ then
+ echo Y
+ return 0
+ else
+ echo N
+ return 1
+ fi
+ }
+
+ _foamPortPrefix ()
+ {
+ echo "$(dirname $(dirname $(which port)))"
+ }
+
+ _foamBrewPrefix ()
+ {
+ echo $(brew --prefix)
+ }
+
+ _foamGetPackageVersion ()
+ {
+ local version="?"
+ local ret=0
+ local pkg="$1"
+
+ if [ "x$(_foamBrew)" = "xY" ]
+ then
+ local prefix="$(_foamBrewPrefix)"
+ if [ -d "$prefix/opt/${pkg}64" -a "$WM_LABEL_SIZE" -eq 64 ]
+ then
+ version="$(basename $(readlink "$prefix/opt/${pkg}64"))"
+ elif [ -d "$prefix/opt/$pkg" ]
+ then
+ version="$(basename $(readlink "$prefix/opt/$pkg"))"
+ else
+ ret=1
+ fi
+ elif [ "x$(_foamPort)" = "xY" ]
+ then
+ version="0.0.x"
+ else
+ ret=1
+ fi
+ echo $version
+ return $ret
+ }
+
+ _foamGetPackageArchPath ()
+ {
+ local arch_path="/usr/local"
+ local ret=0
+ local pkg="$1"
+ if [ "x$(_foamBrew)" = "xY" ]
+ then
+ local prefix="$(_foamBrewPrefix)"
+ if [ -d "$prefix/opt/${pkg}64" -a "$WM_LABEL_SIZE" -eq 64 ]
+ then
+ arch_path="$prefix/opt/${pkg}64"
+ elif [ -d "$prefix/opt/$pkg" ]
+ then
+ arch_path="$prefix/opt/$pkg"
+ else
+ ret=1
+ fi
+ elif [ "x$(_foamPort)" = "xY" ]
+ then
+ arch_path="$(_foamPortPrefix)"
+ else
+ ret=1
+ fi
+ echo $arch_path
+ return $ret
+ }
+
+ _foam_increase_max_open_files ()
+ {
+ # Default value
+ local lim=4096
+
+ # Reset if parameter passed
+ [ -n "$1" ] && lim="$1"
+
+ # Silencing the errors
+ local current_limit=$(ulimit -n)
+ if [ "$current_limit" = "unlimited" ]
+ then
+ return 0
+ elif [ "$current_limit" -lt "$lim" ]
+ then
+ ulimit -n "$lim" > /dev/null 2>&1
+ return 0
+ fi
+ return 0
+ }
+else
+ unset WM_BASH_FUNCTIONS_MAC
+ unset _foamAddLib _foamBrew _foamPort _foamPortPrefix _foamBrewPrefix \
+ _foamGetPackageVersion _foamGetPackageArchPath \
+ _foam_increase_max_open_files
+fi
+
+# vim: set ft=sh:
diff --git a/etc/config.sh/mac/metis b/etc/config.sh/mac/metis
new file mode 100644
index 0000000000..bb87346f7b
--- /dev/null
+++ b/etc/config.sh/mac/metis
@@ -0,0 +1,44 @@
+#----------------------------------*-sh-*--------------------------------------
+# ========= |
+# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+# \\ / O peration |
+# \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
+# \\/ M anipulation |
+#------------------------------------------------------------------------------
+# License
+# This file is part of OpenFOAM.
+#
+# OpenFOAM is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
+#
+# File
+# etc/config.sh/metis
+#
+# Description
+# Setup file for metis include/libraries.
+# Sourced during wmake process only.
+#
+# Note
+# A csh version is not needed, since the values here are only sourced
+# during the wmake process
+#
+#------------------------------------------------------------------------------
+
+. $WM_PROJECT_DIR/etc/config.sh/mac/functions
+
+export METIS_VERSION=$(_foamGetPackageVersion metis)
+export METIS_ARCH_PATH=$(_foamGetPackageArchPath metis)
+
+. $WM_PROJECT_DIR/etc/config.sh/mac/functions
+
+#------------------------------------------------------------------------------
diff --git a/etc/config.sh/mac/paraview b/etc/config.sh/mac/paraview
new file mode 100644
index 0000000000..cc69c19423
--- /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/mac/scotch b/etc/config.sh/mac/scotch
new file mode 100644
index 0000000000..e62931c9b1
--- /dev/null
+++ b/etc/config.sh/mac/scotch
@@ -0,0 +1,47 @@
+#----------------------------------*-sh-*--------------------------------------
+# ========= |
+# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+# \\ / O peration |
+# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
+# \\/ M anipulation |
+#------------------------------------------------------------------------------
+# License
+# This file is part of OpenFOAM.
+#
+# OpenFOAM is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
+#
+# File
+# etc/config.sh/scotch
+#
+# Description
+# Setup file for scotch include/libraries.
+# Sourced during wmake process only.
+#
+# Note
+# A csh version is not needed, since the values here are only sourced
+# during the wmake process
+#
+# If Scotch is to be entirely disabled, either rename this file or create
+# an empty one with the same name at a user or site location.
+#
+#------------------------------------------------------------------------------
+
+. $WM_PROJECT_DIR/etc/config.sh/mac/functions
+
+export SCOTCH_VERSION=$(_foamGetPackageVersion scotch)
+export SCOTCH_ARCH_PATH=$(_foamGetPackageArchPath scotch)
+
+. $WM_PROJECT_DIR/etc/config.sh/mac/functions
+
+#------------------------------------------------------------------------------
diff --git a/etc/config.sh/mpi b/etc/config.sh/mpi
index 8981d68592..e5d0ce8ff1 100644
--- a/etc/config.sh/mpi
+++ b/etc/config.sh/mpi
@@ -47,7 +47,7 @@ SYSTEMOPENMPI)
# Bit of a hack: strip off 'lib' and hope this is the path to openmpi
# include files and libraries.
- export MPI_ARCH_PATH="${libDir%/*}"
+ _foam_on_macos || export MPI_ARCH_PATH="${libDir%/*}"
_foamAddLib $libDir
unset libDir
@@ -263,7 +263,8 @@ esac
# Dummy MPI already added to LD_LIBRARY_PATH and has no external libraries
if [ "$FOAM_MPI" != dummy ]
then
- _foamAddLib $FOAM_LIBBIN/$FOAM_MPI:$FOAM_EXT_LIBBIN/$FOAM_MPI
+ _foamAddLib $FOAM_LIBBIN/$FOAM_MPI
+ [ -n "$FOAM_EXT_LIBBIN" ] && _foamAddLib $FOAM_EXT_LIBBIN/$FOAM_MPI
fi
diff --git a/etc/config.sh/settings b/etc/config.sh/settings
index 0a69a70190..067094d91d 100644
--- a/etc/config.sh/settings
+++ b/etc/config.sh/settings
@@ -135,6 +135,13 @@ SunOS)
export WM_LDFLAGS='-mabi=64 -G0'
;;
+Darwin)
+ WM_ARCH=darwin64
+ export WM_COMPILER_ARCH=64
+ export WM_CC=clang
+ export WM_CXX=clang++
+ ;;
+
*) # An unsupported operating system
/bin/cat <<USAGE 1>&2
@@ -162,7 +169,7 @@ export FOAM_APPBIN=$WM_PROJECT_DIR/platforms/$WM_OPTIONS/bin
export FOAM_LIBBIN=$WM_PROJECT_DIR/platforms/$WM_OPTIONS/lib
# External (ThirdParty) libraries
-export FOAM_EXT_LIBBIN=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/lib
+_foam_on_macos || export FOAM_EXT_LIBBIN=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/lib
# Site-specific directory
siteDir="${WM_PROJECT_SITE:-$WM_PROJECT_INST_DIR/site}"
@@ -211,7 +218,12 @@ fi
unset siteDir
# Make sure to pick up dummy versions of external libraries last
-_foamAddLib $FOAM_USER_LIBBIN:$FOAM_SITE_LIBBIN:$FOAM_LIBBIN:$FOAM_EXT_LIBBIN:$FOAM_LIBBIN/dummy
+if [ -n "$FOAM_EXT_LIBBIN" ]
+then
+ _foamAddLib $FOAM_USER_LIBBIN:$FOAM_SITE_LIBBIN:$FOAM_LIBBIN:$FOAM_EXT_LIBBIN:$FOAM_LIBBIN/dummy
+else
+ _foamAddLib $FOAM_USER_LIBBIN:$FOAM_SITE_LIBBIN:$FOAM_LIBBIN:$FOAM_LIBBIN/dummy
+fi
# Compiler settings
# ~~~~~~~~~~~~~~~~~
@@ -313,6 +325,8 @@ USAGE
;;
esac
+_foam_on_macos && _foam_increase_max_open_files 4096
+
# Cleanup environment:
# ~~~~~~~~~~~~~~~~~~~~
unset WM_COMPILER_TYPE
diff --git a/etc/config.sh/unset b/etc/config.sh/unset
index fa87d0831d..5fc046e336 100644
--- a/etc/config.sh/unset
+++ b/etc/config.sh/unset
@@ -29,6 +29,9 @@
#
#------------------------------------------------------------------------------
+foamDarwin=0
+[ "$(uname -s)" = "Darwin" ] && foamDarwin=1
+
# Clean standard environment variables (PATH, LD_LIBRARY_PATH, MANPATH)
foamClean=$WM_PROJECT_DIR/bin/foamCleanPath
[ -f "$foamClean" -a -x "$foamClean" ] || unset foamClean
@@ -46,6 +49,7 @@ unset WM_ARCH_OPTION
unset WM_CC
unset WM_CFLAGS
unset WM_COMPILER
+unset WM_COMPILER_ARCH
unset WM_COMPILER_TYPE
unset WM_COMPILER_LIB_ARCH
unset WM_COMPILE_OPTION
@@ -154,12 +158,24 @@ unset PV_PLUGIN_PATH
if [ -n "$foamClean" ]
then
cleaned=`$foamClean "$PATH" "$foamOldDirs"` && PATH="$cleaned"
- cleaned=`$foamClean "$LD_LIBRARY_PATH" "$foamOldDirs"` && LD_LIBRARY_PATH="$cleaned"
+ if [ $foamDarwin ]
+ then
+ cleaned=`$foamClean "$FOAM_DYLD_LIBRARY_PATH" "$foamOldDirs"` && FOAM_DYLD_LIBRARY_PATH="$cleaned"
+ DYLD_LIBRARY_PATH=$FOAM_DYLD_LIBRARY_PATH
+ else
+ cleaned=`$foamClean "$LD_LIBRARY_PATH" "$foamOldDirs"` && LD_LIBRARY_PATH="$cleaned"
+ fi
cleaned=`$foamClean "$MANPATH" "$foamOldDirs"` && MANPATH="$cleaned"
fi
-[ -n "$LD_LIBRARY_PATH" ] || unset LD_LIBRARY_PATH
+if [ $foamDarwin ]
+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
[ -n "$LD_PRELOAD" ] || unset LD_PRELOAD