source: anuga_work/development/near_shore_PMD/project.py @ 5192

Last change on this file since 5192 was 5093, checked in by duncan, 16 years ago

Add more to simulation

File size: 1.7 KB
RevLine 
[5093]1"""Common filenames and locations for topographic data, meshes and outputs.
2Also includes origin for slump scenario.
3"""
4
5from os import sep, environ, getenv, getcwd
6import sys
7from time import localtime, strftime
8from os import mkdir, access, F_OK
9from anuga.abstract_2d_finite_volumes.util import add_directories, \
10     copy_code_files
11
12from anuga.utilities.system_tools import get_user_name
13
14boundary_file = 'boundary.tsm'
15
16class Project:   
17    def __init__(self,
18                 trunk,
19                 outputdir_name = None,
20                 home = None):
21       
22        self.user = get_user_name()
23        if home is None:
24            home = getenv('INUNDATIONHOME') #Sandpit's parent dir   
25        self.home = home
26        # Create the structure of where the output directories will go
27        scenariodir=add_directories(home, trunk)
28
29        #Derive subdirectories and filenames
30        if outputdir_name is None:
31            #gets time for dir
32            outputdir_name = strftime('%Y%m%d_%H%M%S',localtime()) 
33        general_outputdir = scenariodir+sep+'output'+sep
34        self.outputdir = general_outputdir+outputdir_name+sep
35        self.meshdir = scenariodir+sep+'meshes'+sep
36
37        # creates copy of output dir structure, if it doesn't exist
38        if not access(self.meshdir,F_OK):
39            mkdir (self.meshdir)       
40        if not access(general_outputdir,F_OK):
41            mkdir (general_outputdir)
42        if not access(self.outputdir,F_OK):
43            mkdir (self.outputdir)
44
45        self.codedir = getcwd()+sep
46
47
48#-------------------------------------------------------------
49if __name__ == "__main__":
50    p = Project(['eagle'], 'lego','.')
51    print p.outputdir
52    print p.meshdir
Note: See TracBrowser for help on using the repository browser.