Changeset c437dbb in sasmodels for sasmodels/generate.py
- Timestamp:
- Mar 1, 2016 1:40:08 PM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- ce0b154
- Parents:
- cf85329
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/generate.py
rfa8011eb rc437dbb 193 193 and adds the parameter table to the top. The function :func:`model_sources` 194 194 returns a list of files required by the model. 195 196 Code follows the C99 standard with the following extensions and conditions:: 197 198 M_PI_180 = pi/180 199 M_4PI_3 = 4pi/3 200 square(x) = x*x 201 cube(x) = x*x*x 202 sinc(x) = sin(x)/x, with sin(0)/0 -> 1 203 all double precision constants must include the decimal point 204 all double declarations may be converted to half, float, or long double 205 FLOAT_SIZE is the number of bytes in the converted variables 195 206 """ 196 207 from __future__ import print_function … … 344 355 """ 345 356 if dtype == F16: 357 fbytes = 2 346 358 source = _F16_PRAGMA + _convert_type(source, "half", "f") 347 359 elif dtype == F32: 360 fbytes = 4 348 361 source = _convert_type(source, "float", "f") 349 362 elif dtype == F64: 363 fbytes = 8 350 364 source = _F64_PRAGMA + source # Source is already double 351 365 elif dtype == F128: 366 fbytes = 16 352 367 source = _convert_type(source, "long double", "L") 353 368 else: 354 369 raise ValueError("Unexpected dtype in source conversion: %s"%dtype) 355 return source370 return ("#define FLOAT_SIZE %d\n"%fbytes)+source 356 371 357 372
Note: See TracChangeset
for help on using the changeset viewer.