Changeset 8389beb in sasview
- Timestamp:
- Jul 25, 2012 5:31:31 PM (12 years ago)
- 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:
- 32ea318
- Parents:
- a8d3b4f
- Location:
- sansmodels/src/python_wrapper
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/python_wrapper/WrapperGenerator.py
r5da3cc5 r8389beb 44 44 cylinder.h defines the following: 45 45 46 47 48 49 50 46 /// 1D scattering function 47 double cylinder_analytical_1D(CylinderParameters *pars, double q); 48 49 /// 2D scattering function 50 double cylinder_analytical_2D(CylinderParameters *pars, double q, double phi); 51 51 52 52 The .c file implements those functions. … … 318 318 The file is written in C[PYTHONCLASS].c 319 319 """ 320 file_path = os.path.join(self.c_wrapper_dir, "C"+self.pythonClass+'.cpp') 320 file_path = os.path.join(self.c_wrapper_dir, 321 "C"+self.pythonClass+'.cpp') 321 322 file = open(file_path, 'w') 322 323 323 template = open(os.path.join(os.path.dirname(__file__), "classTemplate.txt"), 'r') 324 template = open(os.path.join(os.path.dirname(__file__), 325 "classTemplate.txt"), 'r') 324 326 325 327 tmp_buf = template.read() … … 405 407 if self.foundCPP: 406 408 newline = self.replaceToken(newline, 407 409 "[C_INCLUDE_FILE]", "") 408 410 newline = self.replaceToken(newline, 409 411 "[CPP_INCLUDE_FILE]", "#include \"%s\"" % basename) 410 412 else: 411 413 newline = self.replaceToken(newline, 412 414 "[C_INCLUDE_FILE]", "#include \"%s\"" % basename) 413 415 newline = self.replaceToken(newline, 414 416 "[CPP_INCLUDE_FILE]", "#include \"models.hh\"") 415 417 416 418 # Numerical calcs dealloc … … 458 460 file_path = os.path.join(self.output_dir, self.pythonClass+'.py') 459 461 file = open(file_path, 'w') 460 template = open(os.path.join(os.path.dirname(__file__), "modelTemplate.txt"), 'r') 462 template = open(os.path.join(os.path.dirname(__file__), 463 "modelTemplate.txt"), 'r') 461 464 462 465 tmp_buf = template.read() … … 490 493 if self.is_multifunc: 491 494 newline = self.replaceToken(newline,"[CALL_CPYTHON_INIT]", 492 'C' + self.pythonClass + ".__init__(self,multfactor)\n\tself.is_multifunc = True") 493 newline = self.replaceToken(newline,"[MULTIPLICITY_INFO]",self.multiplicity_info) 495 'C' + self.pythonClass + \ 496 ".__init__(self,multfactor)\n\tself.is_multifunc = True") 497 newline = self.replaceToken(newline,"[MULTIPLICITY_INFO]", 498 self.multiplicity_info) 494 499 else: 495 500 newline = self.replaceToken(newline,"[CALL_CPYTHON_INIT]", 496 'C' + self.pythonClass + ".__init__(self)\n\tself.is_multifunc = False") 497 newline = self.replaceToken(newline,"[MULTIPLICITY_INFO]","None") 501 'C' + self.pythonClass + \ 502 ".__init__(self)\n self.is_multifunc = False") 503 newline = self.replaceToken(newline, 504 "[MULTIPLICITY_INFO]","None") 498 505 499 506 -
sansmodels/src/python_wrapper/modelTemplate.txt
r5da3cc5 r8389beb 51 51 #apply([CPYTHONCLASS].__init__, (self,)) 52 52 53 53 [CALL_CPYTHON_INIT] 54 54 55 55 ## Name of the model
Note: See TracChangeset
for help on using the changeset viewer.