source: anuga_work/production/test_dampier_2006/project.py @ 4525

Last change on this file since 4525 was 4288, checked in by duncan, 18 years ago

A test for the dampier boundary problem.

File size: 1.7 KB
Line 
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
14class Project:   
15    def __init__(self,
16                 trunk,
17                 outputdir_name = None,
18                 home = None):
19       
20        self.user = get_user_name()
21        if home is None:
22            home = getenv('INUNDATIONHOME') #Sandpit's parent dir   
23        self.home = home
24        # Create the structure of where the output directories will go
25        scenariodir=add_directories(home, trunk)
26
27        #Derive subdirectories and filenames
28        if outputdir_name is None:
29            #gets time for dir
30            outputdir_name = strftime('%Y%m%d_%H%M%S',localtime()) 
31        general_outputdir = scenariodir+sep+'output'+sep
32        self.outputdir = general_outputdir+outputdir_name+sep
33        self.meshdir = scenariodir+sep+'meshes'+sep
34
35        # creates copy of output dir structure, if it doesn't exist
36        if not access(self.meshdir,F_OK):
37            mkdir (self.meshdir)       
38        if not access(general_outputdir,F_OK):
39            mkdir (general_outputdir)
40        if not access(self.outputdir,F_OK):
41            mkdir (self.outputdir)
42
43        self.codedir = getcwd()+sep
44
45
46#-------------------------------------------------------------
47if __name__ == "__main__":
48    p = Project(['eagle'], 'lego','.')
49    print p.outputdir
50    print p.meshdir
Note: See TracBrowser for help on using the repository browser.