Ignore:
Timestamp:
Jan 5, 2012 8:52:13 AM (12 years ago)
Author:
Mathieu Doucet <doucetm@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
dd60b45
Parents:
7ffa8196
Message:

refactor refl model and auto-generate c++ wrapper at compile time.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/python_wrapper/WrapperGenerator.py

    rd62f422 r2d1b700  
    5656    """ 
    5757     
    58     def __init__(self, filename): 
     58    def __init__(self, filename, output_dir='.'): 
    5959        """ Initialization """ 
    6060         
     
    9090        ## parameters with orientation 
    9191        self.orientation_params =[] 
     92        ## output directory for wrappers 
     93        self.output_dir = output_dir 
    9294         
    9395         
     
    289291            The file is written in C[PYTHONCLASS].c 
    290292        """ 
    291          
    292         file = open("C"+self.pythonClass+'.cpp', 'w') 
    293         template = open("classTemplate.txt", 'r') 
     293        file_path = os.path.join(self.output_dir, "C"+self.pythonClass+'.cpp') 
     294        file = open(file_path, 'w') 
     295         
     296        template = open(os.path.join(os.path.dirname(__file__), "classTemplate.txt"), 'r') 
    294297         
    295298        tmp_buf = template.read() 
     
    414417            The file is written in ../[PYTHONCLASS].py 
    415418        """ 
    416          
    417         file = open("../sans/models/"+self.pythonClass+'.py', 'w') 
    418         template = open("modelTemplate.txt", 'r') 
     419        file_path = os.path.join(self.output_dir, "../sans/models/"+self.pythonClass+'.py') 
     420        file = open(file_path, 'w') 
     421        template = open(os.path.join(os.path.dirname(__file__), "modelTemplate.txt"), 'r') 
    419422         
    420423        tmp_buf = template.read() 
Note: See TracChangeset for help on using the changeset viewer.