-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathadjust_examples.py
More file actions
executable file
·54 lines (50 loc) · 2.21 KB
/
Copy pathadjust_examples.py
File metadata and controls
executable file
·54 lines (50 loc) · 2.21 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
#!/usr/bin/env python
import os
import sys
import os.path
CC = sys.argv[1]
FC = sys.argv[2]
cc = sys.argv[3]
dir_path = os.path.dirname(os.path.realpath(__file__))
GLPK_DIR= str(dir_path) + "/glpk"
examples = ["combi_example", "combi_example_faults", "gene_distributed", "gene_distributed_linear","dealii_example"]
for example in examples:
pfilein = open(str(dir_path)+ "/distributedcombigrid/examples/" + example + "/Makefile.template" ,'r')
temp = pfilein.read()
pfilein.close()
temp = temp.replace('$(SGPP)', str(dir_path))
temp = temp.replace('$(GLPK)', GLPK_DIR)
temp = temp.replace('$(CC)', CC)
temp = temp.replace('$(FC)', FC)
temp = temp.replace('$(cc)', cc)
pfileout = open(str(dir_path)+ "/distributedcombigrid/examples/" + example + "/Makefile" ,'w')
pfileout.write(temp)
pfileout.close()
gene_versions = ["gene_mgr", "gene-non-linear", "gene-dev-exahd"]
for geneVersion in gene_versions:
fnameList = [str(dir_path) + "/"+ geneVersion + "/makefiles/new_machine/new_machine", str(dir_path) + "/"+ geneVersion + "/makefiles/hazel_hen/hazel_hen"]
for fname in fnameList:
if(os.path.isfile(fname + ".template")):
with open(fname + ".template",'r') as pfilein:
temp = pfilein.read()
temp = temp.replace('$(SGPP)', str(dir_path))
temp = temp.replace('$(GLPK)', GLPK_DIR)
temp = temp.replace('$(CC)', CC)
temp = temp.replace('$(FC)', FC)
temp = temp.replace('$(cc)', cc)
with open(fname + ".mk" ,'w') as pfileout:
pfileout.write(temp)
pfilein = open(str(dir_path)+ "/distributedcombigrid/examples/gene_distributed/preproc.py" ,'r')
temp = pfilein.read()
pfilein.close()
temp = temp.replace('$(SGPP)', str(dir_path))
pfileout = open(str(dir_path)+ "/distributedcombigrid/examples/gene_distributed/preproc.py" ,'w')
pfileout.write(temp)
pfileout.close()
pfilein = open(str(dir_path)+ "/distributedcombigrid/examples/gene_distributed_linear/preproc.py" ,'r')
temp = pfilein.read()
pfilein.close()
temp = temp.replace('$(SGPP)', str(dir_path))
pfileout = open(str(dir_path)+ "/distributedcombigrid/examples/gene_distributed_linear/preproc.py" ,'w')
pfileout.write(temp)
pfileout.close()