Definition at line 8 of file make_problem.py.
def make_problem.MakeProblem.__init__ |
( |
|
self, |
|
|
|
work_dir, |
|
|
|
pluto_dir, |
|
|
|
auto_update_def, |
|
|
|
auto_update_mkfl |
|
) |
| |
Create the makefile for the PLUTO code from the defintions header file.
This class creates a makefile with all necessary information
that would compile the code based on the problem defined by user
in defintions.h file.
In case the makefile is already present, this class will
read those default values to re-create the file.
**Inputs**:
1. work_dir = Path to PLUTO code working directory
2. pluto_dir = Path to PLUTO source directory
3. auto-update_def = Boolean that indicates auto-update of defintions.h.
4. auto-update_mkfl = Boolean that indicates auto-update of makefile.
**Output**:
It generates a makefile for compilation.
Definition at line 9 of file make_problem.py.
9 def __init__(self, work_dir, pluto_dir, auto_update_def, auto_update_mkfl):
10 """Create the makefile for the PLUTO code from the defintions header file.
12 This class creates a makefile with all necessary information
13 that would compile the code based on the problem defined by user
15 In case the makefile is already present, this class will
16 read those default values to re-create the file.
19 1. work_dir = Path to PLUTO code working directory
20 2. pluto_dir = Path to PLUTO source directory
21 3. auto-update_def = Boolean that indicates auto-update of defintions.h.
22 4. auto-update_mkfl = Boolean that indicates auto-update of makefile.
25 It generates a makefile for compilation.
40 menu.Print (
"> Generating makefile... ["+self.
arch+
"]", row=self.
row,sleep=1)
def UpdateMkflTemplate(self)
def __init__(self, work_dir, pluto_dir, auto_update_def, auto_update_mkfl)
def make_problem.MakeProblem.ChomboMakeVars |
( |
|
self | ) |
|
Adds CHOMBO specific vars in the Makefile.
This method of the MakeProblem class does necessary
modification to the makefile so as to accomodate
compilation of chombo (AMR) specific variables.
Definition at line 79 of file make_problem.py.
80 """Adds CHOMBO specific vars in the Makefile.
82 This method of the MakeProblem class does necessary
83 modification to the makefile so as to accomodate
84 compilation of chombo (AMR) specific variables.
86 pf = pfIO.PlutoFiles(self.
work_dir+
'/definitions.h')
87 scrh = pf.LocateString(
'DIMENSIONS')
88 dims = scrh[0][1].split()[2]
89 chombo_config_string =
'DIM='+dims
91 if '--with-chombo:' in sys.argv:
92 i = sys.argv.index(
'--with-chombo:') + 1
96 print "Additional Configration Details Required for '--with-chombo:' flag"
99 for y
in sys.argv[i:]:
100 chombo_config_string +=
' '+y
103 menu.Print(
" - Chombo config string: "+chombo_config_string,row=self.
row)
106 os.chdir(self.
pluto_dir+
"/Lib/Chombo-3.2/lib")
107 os.system(
"make "+chombo_config_string+
" vars > make.vars\n")
108 os.system(
"cp make.vars "+self.
work_dir+
"\n")
def make_problem.MakeProblem.SetArch |
( |
|
self | ) |
|
Sets the Architecture for compilation of code.
This attribute of the MakeProblem class looks for the
'ARCH' keyword in makefile and if not defined will define it
based on user's choice of the Makefile configuration
from the Config/ folder. If already defined then will use
that architecture for compilation of Makefile.
Definition at line 51 of file make_problem.py.
52 """Sets the Architecture for compilation of code.
54 This attribute of the MakeProblem class looks for the
55 'ARCH' keyword in makefile and if not defined will define it
56 based on user's choice of the Makefile configuration
57 from the Config/ folder. If already defined then will use
58 that architecture for compilation of Makefile.
60 mkfl_exits = os.path.exists(self.
mkfl_name)
63 scrh = pf.LocateString(
'ARCH')
65 if self.
auto_update == 0
or not mkfl_exits
or len(scrh[0]) == 0:
67 entries = os.listdir(self.
pluto_dir +
'/Config')
68 for def_file
in entries:
69 if (def_file.endswith(
'.defs')): def_list.append(def_file)
77 self.
arch = self.arch_string.split()[2]
def make_problem.MakeProblem.UpdateMkflTemplate |
( |
|
self | ) |
|
Updates Makefile with additional flags, files and modular makefile paths.
Definition at line 112 of file make_problem.py.
114 Updates Makefile with additional flags, files and modular makefile paths.
118 pf.ReplaceWord(
'PLUTO_DIR',
'PLUTO_DIR = '+self.
pluto_dir+
'\n',DelOld=
True)
119 pf.ReplaceWord(
'ARCH',self.
arch_string, DelOld=
True)
121 scrh = pf.LocateString(
'Additional_header_files_here')
122 ipos = scrh[0][0] + 3
124 pf.InsertLine(
'HEADERS += '+ x +
'\n',ipos)
127 scrh = pf.LocateString(
'Additional_object_files_here')
128 ipos = scrh[0][0] + 3
130 pf.InsertLine(
'OBJ += '+x +
'\n', ipos)
134 pf.InsertLine(
'include $(SRC)/' + x +
'makefile' +
'\n',ipos)
138 pf.InsertLine(
'CFLAGS += '+x+
'\n', ipos)
141 def UpdateMkflTemplate(self)
make_problem.MakeProblem.additional_files |
make_problem.MakeProblem.additional_flags |
make_problem.MakeProblem.arch |
make_problem.MakeProblem.arch_string |
make_problem.MakeProblem.auto_update |
make_problem.MakeProblem.chomboflag |
make_problem.MakeProblem.header_files |
make_problem.MakeProblem.makefile_template |
make_problem.MakeProblem.mkfl_name |
make_problem.MakeProblem.pluto_dir |
make_problem.MakeProblem.pluto_path |
make_problem.MakeProblem.row |
make_problem.MakeProblem.work_dir |
The documentation for this class was generated from the following file: