-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocal_makeset.pl
executable file
·104 lines (76 loc) · 2.5 KB
/
local_makeset.pl
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
#!/usr/bin/perl
$filebase = "box";
$ext = "st";
$t3d_options = "-d 0.1 -p 8 -k 1"; #'-\$ -X';
$decomposition_options = '-sp';
$convert_options = '-v -HumanReadable';#-pr 1.0 1.0 1.0';
$t3d_path = 'InputLib/t3d';
$split_path = 'InputLib/t3d2psifel';
$convert_path = 'InputLib/con3d++';
sub do_error {
my $string = shift;
print ($string);
exit(0);
}
# check for files
if ( !(-e "$filebase.out.periodic") && ($convert_options =~ /pr/) ) { &do_error("File $filebase.out.periodic does not exist.\n");}
$flag = shift;
if ( $flag eq 'clean') {
system ("rm -rf $filebase.out *CPU partitions.*");
$flag = shift;
}
if ( $flag eq '-t3d') {
$flag = shift;
$t3d_path = $flag;
$flag = shift;
}
if ( $flag eq '-t3d2psifel') {
$flag = shift;
$split_path = $flag;
$flag = shift;
}
if ( $flag eq '-lib') {
$flag = shift;
$convert_path = $flag;
$flag = shift;
}
if ( $flag eq '-np' ) {
# iterate through every number specified
while ( $nproc = shift ) {
print ("Preparing data set for $nproc processors.\n\n");
if ( !(-e "$filebase.out") ) {
print "Meshing data set.\n\n";
system "$t3d_path -i $filebase.t3d -o $filebase.out $t3d_options";
system "cp $filebase.out $filebase.out ";
}
$dir = "$filebase"."_$nproc" . "CPU";
mkdir ($dir);
if ( $nproc != 1 && !(-e "partitions.$nproc") ) {
print ("Splitting file...\n");
mkdir ("partitions.$nproc");
system ("$split_path -np $nproc $filebase.out partitions.$nproc/$filebase.out $decomposition_options");
print ("Finished splitting file.\n\n");
}
if ( $nproc != 1 ) {
system ("cd $dir; cp -sf ../partitions.$nproc/$filebase.out.* .");
} else {
system ("cp $filebase.out $dir/$filebase.out.0");
}
print ("Converting set...\n");
system ("$convert_path -f $dir/$filebase -np $nproc $convert_options -d $dir");
print ("Finished converting set.\n\n");
print ("Copying in model_params.in\n\n");
system ("cp model_params.in $dir");
print ("Copying header files...\n");
for ($i=1; $i<$nproc; $i++) {
system("cd $dir; \
cp -sf $filebase"."_0.in.$ext $filebase" . "_$i.in.$ext" );
}
# system("cd $dir; cp -sf ../traction.in .");
print ("\nFinished copying header files.\n\n");
print ("Cleaning up directory...\n");
system ("rm -rf $dir/*.out.*");
print ("Finished cleaning up.\n\n");
print ("Finished creating data set for $nproc processors.\n\n");
} # end while $nproc = shift
} #end $flag eq '-np'