-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtmpcopy
More file actions
executable file
·344 lines (313 loc) · 8.92 KB
/
tmpcopy
File metadata and controls
executable file
·344 lines (313 loc) · 8.92 KB
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
#!/bin/bash
###############################################################################
#
# Copyright 2008-2025 Mississippi State University
#
# This file is part of the Loci Framework.
#
# The Loci Framework is free software: you can redistribute it and/or modify
# it under the terms of the Lesser GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# The Loci Framework 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
# Lesser GNU General Public License for more details.
#
# You should have received a copy of the Lesser GNU General Public License
# along with the Loci Framework. If not, see <http://www.gnu.org/licenses>
#
###############################################################################
set -e
set -u
#profiling
#set -x
#PS4='+ $(date "+%s.%N ($LINENO) ")'
# Make a copy of an entire directory structure to target using symbolic links
# for files
copy_with_symlinks() {
local src=$1
local dst=$2
echo symlink_copy "${src#${PWD}}" > /dev/tty 2>/dev/null || true
if [ ! -d "$src" ]; then
echo "Error: $src is not a directory."
return 1
fi
mkdir -p "$dst"
while IFS= read -r -d '' file; do
local rel_path="${file#$src/}"
local target_path="$dst/$rel_path"
# if file does not exist
if [ ! -f "$target_path" ]; then
local target_dir=$(dirname "$target_path")
# if directory doesn't exist, make it
if [ ! -d "$target_dir" ]; then
mkdir -p "$target_dir"
fi
ln -s "$file" "$target_path"
fi
done < <(find "$src" -type f \( -name '*.cc' -o -name '*.cpp' \
-o -name '*.c' -o -name '*.loci' -o -name '*.sh' \
-o -name '*.h' -o -name '*.hh' -o -name '*.lh' \
-o -name '*.hpp'\
-o -name '*.txt' -o -name '*.dat' -o -name '*.vog'\
-o -name '*.vars' -o -name Makefile \
-o -name Loci -o -name overset \) -print0)
}
source=`pwd`
logname=${LOGNAME-user}
target=${LOCI_TARGET-/usr/tmp/$logname/}
subdir=Loci
LIB_POSTFIX="so"
ARCH=${LOCI_ARCH-`uname -s`}
if [ $ARCH == "Darwin" ]; then
LIB_POSTFIX="dylib"
fi
while [ $# -ne 0 ]; do
case "$1" in
--subdir)
shift
subdir=$1
;;
--target)
shift
subdir=""
target=$1
;;
--source)
shift
source=$1
;;
--compiler)
shift
COMP=$1
;;
*)
break
;;
esac
shift
done
if [ $# -eq 1 ]; then
target=$1
fi
if [ $# -eq 2 ]; then
target=$1
COMP=$2
fi
if [ ${target:0:1} != "/" ]; then
target=`pwd`/${target}
echo setting target to \'$target\'
fi
TARGET_DIRS="Tools System lpp FVMtools FVMMod FVMAdapt FVMOverset sprng include"
echo -n "Making Directory Structure: "
mkdir -p $target
if [ "$subdir" == "" ]; then
fulltarget=$target
else
fulltarget=$target/$subdir
mkdir -p $fulltarget
fi
mkdir -p $fulltarget/lib
mkdir -p $fulltarget/bin
if [ ! -h $fulltarget/Tutorial ]; then
ln -s $source/Tutorial $fulltarget/Tutorial
fi
for dir in $TARGET_DIRS; do
echo "Making symlink copy of directory $source/src/$dir"
copy_with_symlinks $source/src/$dir $fulltarget/$dir
done
TOOLS_DIRS=""
DO_METIS_INSTALL=${INSTALL_METIS:-1}
if [ ! ${DO_METIS_INSTALL} == 0 ]; then
TOOLS_DIRS=$TOOLS_DIRS" ParMetis-4.0 ParMetis-4.0/GKLib ParMetis-4.0/METISLib ParMetis-4.0/ParMETISLib"
fi
echo TOOLS_DIR=${TOOLS_DIRS}
# remove Makefile link if it already exists in case external metis option
# changed
rm -f $fulltarget/ParMetis-4.0/Makefile
for i in $TOOLS_DIRS ; do
echo -n $i " "
mkdir -p $fulltarget/$i
done
echo
if [ ! -h $fulltarget/src/FVMtools/extract_movie ]; then
cp src/FVMtools/extract_movie $fulltarget/FVMtools/extract_movie
chmod a+rx $fulltarget/FVMtools/extract_movie
fi
pushd $fulltarget
if [ ! -h Makefile ]; then
echo ln -s $source/src/Makefile Makefile
ln -s $source/src/Makefile Makefile
fi
if [ ! -h Loci.conf ]; then
echo ln -s $source/src/conf/Loci.conf Loci.conf
ln -s $source/src/conf/Loci.conf Loci.conf
fi
if [ ! -h Install.bash ]; then
echo ln -s $source/src/Install.bash Install.bash
ln -s $source/src/Install.bash Install.bash
fi
if [ ! -e comp.conf ]; then
echo cp $source/src/conf/${COMP}.conf comp.conf
cp $source/src/conf/${COMP}.conf comp.conf
fi
if [ ! -e sys.conf ]; then
if [ -e $source/src/conf/${ARCH}.conf ]; then
echo cp $source/src/conf/${ARCH}.conf sys.conf
cp $source/src/conf/${ARCH}.conf sys.conf
fi
fi
if [ ! -e version.conf ]; then
if [ -e $source/src/version.conf ]; then
echo cp $source/src/version.conf version.conf
cp $source/src/version.conf version.conf
else
echo cp $source/src/conf/version.conf version.conf
cp $source/src/conf/version.conf version.conf
fi
fi
cd lib
if [ ! -h libTools.${LIB_POSTFIX} ]; then
ln -s ../Tools/libTools.${LIB_POSTFIX} libTools.${LIB_POSTFIX}
fi
if [ ! -h libLoci.${LIB_POSTFIX} ]; then
ln -s ../System/libLoci.${LIB_POSTFIX} libLoci.${LIB_POSTFIX}
fi
if [ ! -h fvm_m.so ]; then
ln -s ../FVMMod/fvm_m.so fvm_m.so
fi
if [ ! -h fvmFAD_m.so ]; then
ln -s ../FVMMod/fvmFAD_m.so fvmFAD_m.so
fi
if [ ! -h fvmVFAD_m.so ]; then
ln -s ../FVMMod/fvmVFAD_m.so fvmVFAD_m.so
fi
if [ ! -h libfvmadaptfunc.${LIB_POSTFIX} ]; then
ln -s ../FVMAdapt/libfvmadaptfunc.${LIB_POSTFIX} libfvmadaptfunc.${LIB_POSTFIX}
fi
if [ ! -h fvmadapt_m.so ]; then
ln -s ../FVMAdapt/fvmadapt_m.so fvmadapt_m.so
fi
if [ ! -h fvmoverset_m.so ]; then
ln -s ../FVMOverset/fvmoverset_m.so fvmoverset_m.so
fi
if [ ! -h fvmoversetFAD_m.so ]; then
ln -s ../FVMOverset/fvmoversetFAD_m.so fvmoversetFAD_m.so
fi
if [ ! -h fvmoversetVFAD_m.so ]; then
ln -s ../FVMOverset/fvmoversetVFAD_m.so fvmoversetVFAD_m.so
fi
if [ ! ${DO_METIS_INSTALL} == 0 ]; then
if [ ! -h libgk.${LIB_POSTFIX} ] ; then
ln -s ../ParMetis-4.0/GKLib/libgk.${LIB_POSTFIX} libgk.${LIB_POSTFIX}
fi
if [ ! -h libmetis.${LIB_POSTFIX} ] ; then
ln -s ../ParMetis-4.0/METISLib/libmetis.${LIB_POSTFIX} libmetis.${LIB_POSTFIX}
fi
if [ ! -h libparmetis.${LIB_POSTFIX} ] ; then
ln -s ../ParMetis-4.0/ParMETISLib/libparmetis.${LIB_POSTFIX} libparmetis.${LIB_POSTFIX}
fi
else
rm -f libgk.* libmetis.* libparmetis.*
fi
if [ ! -h libsprng.${LIB_POSTFIX} ] ; then
ln -s ../sprng/libsprng.${LIB_POSTFIX} libsprng.${LIB_POSTFIX}
fi
if [ ! -h $fulltarget/bin/extract_movie ]; then
ln -s $source/src/FVMtools/extract_movie $fulltarget/bin/extract_movie
fi
if [ ! -h $fulltarget/bin/mpinorun ]; then
ln -s $source/src/FVMtools/mpinorun $fulltarget/bin/mpinorun
fi
cd ../bin
if [ ! -h lpp ] ; then
ln -s ../lpp/lpp lpp
fi
if [ ! -h extract ] ; then
ln -s ../FVMtools/extract extract
fi
if [ ! -h plot3d2vog ] ; then
ln -s ../FVMtools/plot3d2vog plot3d2vog
fi
if [ ! -h make_periodic ] ; then
ln -s ../FVMtools/make_periodic make_periodic
fi
if [ ! -h ugrid2vog ] ; then
ln -s ../FVMtools/ugrid2vog ugrid2vog
fi
if [ ! -h msh2vog ] ; then
ln -s ../FVMtools/msh2vog msh2vog
fi
if [ ! -h foam2vog ] ; then
ln -s ../FVMtools/foam2vog foam2vog
fi
if [ ! -h cfd++2vog ] ; then
ln -s ../FVMtools/cfd++2vog cfd++2vog
fi
if [ ! -h fluent2vog ] ; then
ln -s ../FVMtools/fluent2vog fluent2vog
fi
if [ ! -h vogmerge ] ; then
ln -s ../FVMtools/vogmerge vogmerge
fi
if [ ! -h vogcut ] ; then
ln -s ../FVMtools/vogcut vogcut
fi
if [ ! -h vogcheck ] ; then
ln -s ../FVMtools/vogcheck vogcheck
fi
if [ ! -h extruder ] ; then
ln -s ../FVMtools/extruder extruder
fi
if [ ! -h vog2surf ] ; then
ln -s ../FVMtools/vog2surf vog2surf
fi
if [ ! -h ccm2vog ] ; then
ln -s ../FVMtools/ccm2vog ccm2vog
fi
if [ ! -h refmesh ] ; then
ln -s ../FVMtools/refmesh refmesh
fi
if [ ! -h marker ] ; then
ln -s ../FVMtools/marker marker
fi
if [ ! -h refine ] ; then
ln -s ../FVMtools/refine refine
fi
if [ ! -h cgns2vog ] ; then
ln -s ../FVMtools/cgns2vog cgns2vog
fi
if [ ! -h ugrid2cgns ] ; then
ln -s ../FVMtools/ugrid2cgns ugrid2cgns
fi
if [ ! -h cgns2ugrid ] ; then
ln -s ../FVMtools/cgns2ugrid cgns2ugrid
fi
if [ ! -h cgns2ensight ] ; then
ln -s ../FVMtools/cgns2ensight cgns2ensight
fi
if [ ! -h cgns2surf ] ; then
ln -s ../FVMtools/cgns2surf cgns2surf
fi
popd
for dir in $TOOLS_DIRS; do
echo "Linking" $dir "directory files..."
pushd $source/$dir
for i in *.cc *.h *.hh *.hpp *.c *.loci *.lh Makefile Loci overset ; do
if [ -f $i ] ; then
if [ ! -h $fulltarget/$dir/$i ] ; then
echo ln -s $source/$dir/$i $fulltarget/$dir/$i
ln -s $source/$dir/$i $fulltarget/$dir/$i
fi
fi
done
popd
done
echo "Linking quickTest directory files"
copy_with_symlinks "$source/quickTest" "$fulltarget/quickTest"
# copy configuration file
if [ ! -f "$fulltarget/quickTest/test.conf" ] ; then
cp "$source/quickTest/test.conf" "$fulltarget/quickTest/test.conf"
fi