Changeset 2697
- Timestamp:
- 01/25/12 02:12:12 (4 months ago)
- Location:
- simo/trunk
- Files:
-
- 16 edited
-
dev/pyinstaller/simo_onedir.spec (modified) (6 diffs)
-
dev/utils/cextensions.py (modified) (5 diffs)
-
src/models/Finland/c/BiomassmodelLibrary.h (modified) (2 diffs)
-
src/models/Finland/c/DistributionmodelLibrary.c (modified) (12 diffs)
-
src/models/Finland/c/DistributionmodelLibrary.h (modified) (2 diffs)
-
src/models/Finland/c/GeomodelLibrary.h (modified) (2 diffs)
-
src/models/Finland/c/InitmodelLibrary.c (modified) (8 diffs)
-
src/models/Finland/c/InitmodelLibrary.h (modified) (2 diffs)
-
src/models/Finland/c/NaturalremovalmodelLibrary.h (modified) (2 diffs)
-
src/models/Finland/c/SeedlingmodelLibrary.h (modified) (2 diffs)
-
src/models/Finland/c/StandgrowthmodelLibrary.h (modified) (2 diffs)
-
src/models/Finland/c/StandmodelLibrary.h (modified) (2 diffs)
-
src/models/Finland/c/ThinningmodelLibrary.h (modified) (1 diff)
-
src/models/Finland/c/TreegrowthmodelLibrary.h (modified) (2 diffs)
-
src/models/Finland/c/TreemodelLibrary.h (modified) (2 diffs)
-
src/models/Finland/c/make_dll.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
simo/trunk/dev/pyinstaller/simo_onedir.spec
r2670 r2697 19 19 #################################### 20 20 EXTRA_LIBS = '/EXTRA_LIBS' 21 libnames = ('libgeos', 'libiconv', 'libproj', 'libspatialite', 'libfreexl', 22 'libstdc++', 'libgcc_s_dw2') 21 libnames = ('geos_c', 'iconv', 'proj', 'libspatialite-2', 'sqlite3') 23 22 spatialite_libs = [] 24 23 for name in libnames: … … 26 25 spatialite_libs.append((os.path.basename(lib), lib, 'BINARY')) 27 26 27 op_ext_file = '../../simulator/models/operation/silviculture.py' 28 29 exclude_dlls = [('powrprof.dll', '', ''), 30 ('secur32.dll', '', ''), 31 ('crypt32.dll', '', ''), 32 ('mswsock.dll', '', ''), 33 ('shfolder.dll', '', ''), 34 ('API-MS-Win-Core-ErrorHandling-L1-1-0.dll', '', ''), 35 ('API-MS-Win-Core-Interlocked-L1-1-0.dll', '', ''), 36 ('API-MS-Win-Core-LibraryLoader-L1-1-0.dll', '', ''), 37 ('API-MS-Win-Core-LocalRegistry-L1-1-0.dll', '', ''), 38 ('API-MS-Win-Core-Misc-L1-1-0.dll', '', ''), 39 ('API-MS-Win-Core-ProcessThreads-L1-1-0.dll', '', ''), 40 ('API-MS-Win-Core-Profile-L1-1-0.dll', '', ''), 41 ('API-MS-Win-Core-Synch-L1-1-0.dll', '', ''), 42 ('API-MS-Win-Core-SysInfo-L1-1-0.dll', '', ''), 43 ('API-MS-Win-Security-Base-L1-1-0.dll', '', ''), 44 ('HID.dll', '', ''), 45 ('SETUPAPI.dll', '', ''), 46 ('CFGMGR.dll', '', ''), 47 ('DEVOBJ.dll', '', ''), 48 ('MSASN1.dll', '', ''),] 49 28 50 ######################## 29 51 # Builder … … 47 69 console=True) 48 70 coll = COLLECT( exe, 49 a.binaries-[('powrprof.dll', '', ''), 50 ('secur32.dll', '', ''), 51 ('crypt32.dll', '', ''), ], 71 a.binaries-exclude_dlls, 52 72 a.zipfiles, 53 73 a.datas, … … 74 94 console=True ) 75 95 coll = COLLECT( exe, 76 a.binaries-[('powrprof.dll', '', ''), 77 ('secur32.dll', '', ''), 78 ('crypt32.dll', '', ''),]+spatialite_libs, 96 a.binaries-exclude_dlls+spatialite_libs, 79 97 a.zipfiles, 80 98 a.datas, … … 90 108 print '#' * 70 91 109 basefiles[-1] = '../../src/runner.py' 110 basefiles.append(op_ext_file) 92 111 a = Analysis(basefiles, pathex=[''], hookspath=['hooks']) 93 112 pyz = PYZ(a.pure) … … 101 120 console=True ) 102 121 coll = COLLECT( exe, 103 a.binaries-[('powrprof.dll', '', ''), 104 ('secur32.dll', '', ''), 105 ('crypt32.dll', '', ''),]+spatialite_libs, 122 a.binaries-exclude_dlls+spatialite_libs, 106 123 a.zipfiles, 107 124 a.datas, -
simo/trunk/dev/utils/cextensions.py
r1599 r2697 56 56 'build_ext', '--force', '--inplace'] 57 57 else: 58 script_args = ['build', '--build-base', tmp_dir,58 script_args = ['build', '--build-base', tmp_dir, 59 59 'build_ext', '--force', '--inplace'] 60 include_dir = '%s/numpy/core/include' % (numpy_path,) 60 include_dirs = ['%s/numpy/core/include' % (numpy_path,)] 61 61 62 try: 62 63 # compile the operation model C extensions … … 64 65 description = "C extension modules for SIMO operation libraries", 65 66 script_args = script_args, 66 ext_modules=[Extension("operations_ext", ["operations_ext.c"], 67 include_dirs=[include_dir]) 67 ext_modules=[Extension("operations_ext", 68 sources=["operations_ext.c"], 69 include_dirs=include_dirs,) 68 70 ], 69 71 ) … … 75 77 cmdclass = {'build_ext': build_ext}, 76 78 ext_modules = [Extension('handler_ext', ['handler_ext.pyx'], 77 include_dirs= [include_dir])79 include_dirs=include_dirs) 78 80 ], 79 81 ) … … 85 87 cmdclass = {'build_ext': build_ext}, 86 88 ext_modules = [Extension('opt_ext', ['opt_ext.pyx'], 87 include_dirs= [include_dir])89 include_dirs=include_dirs) 88 90 ], 89 91 ) … … 95 97 cmdclass = {'build_ext': build_ext}, 96 98 ext_modules = [Extension('out_ext', ['out_ext.pyx'], 97 include_dirs= [include_dir])99 include_dirs=include_dirs) 98 100 ], 99 101 ) -
simo/trunk/src/models/Finland/c/BiomassmodelLibrary.h
r1708 r2697 45 45 // factor for the model. This way the models can be called easily from python 46 46 // and C/C++ implementation. / AM 2.9.2005 47 48 //Undecorate C++ functions 49 #ifdef __cplusplus 50 extern "C" { 51 #endif 47 52 48 53 DLLEXPORT int Biomass_stem_pine_Marklund (double d, double h, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); … … 128 133 DLLEXPORT int Biomass_tree_JKK (double d, double h, double a, double SP, double TS, int *nres, struct Biomass_tree *biomass, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 129 134 DLLEXPORT int Biomass_tree_Yasso_JKK (double d, double h, double a, double SP, double TS, int *nres, struct Biomass_tree_Yasso *biomass, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 135 136 #ifdef __cplusplus 137 } 138 #endif -
simo/trunk/src/models/Finland/c/DistributionmodelLibrary.c
r2695 r2697 458 458 int i; 459 459 double low_boundary, high_boundary, low_mass, high_mass, stem_number, left_out; 460 double dist_2[class_count][2]; 461 460 //double dist_2[class_count][2]; 461 double** dist_2 = NULL; 462 dist_2 = new double*[class_count]; 463 for (int i=0; i < class_count; i++) { 464 dist_2[i] = new double[2]; 465 for (int j=0; j<2; j++) { 466 dist_2[i][j] = 0; 467 } 468 } 469 462 470 left_out = 0; 463 471 //diameters & stem numbers … … 530 538 dist[2].n = N/3; 531 539 class_count_new = 3; 532 } 540 } 541 542 for (int i=0; i < class_count; i++) { 543 delete[] dist_2[i]; 544 dist_2[i] = NULL; 545 } 546 delete[] dist_2; 547 dist_2 = NULL; 548 533 549 return class_count_new; 534 550 } … … 546 562 int i; 547 563 double low_boundary, high_boundary, low_mass, high_mass, stem_number, left_out; 548 double dist_2[class_count][2]; 549 564 //double dist_2[class_count][2]; 565 double** dist_2 = NULL; 566 dist_2 = new double*[class_count]; 567 for (int i=0; i < class_count; i++) { 568 dist_2[i] = new double[2]; 569 for (int j=0; j<2; j++) { 570 dist_2[i][j] = 0; 571 } 572 } 573 550 574 left_out = 0; 551 575 //diameters & stem numbers … … 635 659 dist[2].n = (BA/3)/(PI * pow(( dist_2[biggest_class+1][0] / 200 ), 2)); 636 660 class_count_new = 3; 637 } 661 } 662 for (int i=0; i < class_count; i++) { 663 delete[] dist_2[i]; 664 dist_2[i] = NULL; 665 } 666 delete[] dist_2; 667 dist_2 = NULL; 638 668 return class_count_new; 639 669 } … … 650 680 int i; 651 681 double low_boundary, high_boundary, low_mass, high_mass, stem_number, N_calc, left_out; 652 double dist_2[class_count][2]; 653 654 N_calc = 0; 682 //double dist_2[class_count][2]; 683 double** dist_2 = NULL; 684 dist_2 = new double*[class_count]; 685 for (int i=0; i < class_count; i++) { 686 dist_2[i] = new double[2]; 687 for (int j=0; j<2; j++) { 688 dist_2[i][j] = 0; 689 } 690 } 691 692 N_calc = 0; 655 693 left_out = 0; 656 694 //diameters & stem numbers … … 747 785 dist[2].n = N_calc/3; 748 786 class_count_new = 3; 749 } 787 } 788 for (int i=0; i < class_count; i++) { 789 delete[] dist_2[i]; 790 dist_2[i] = NULL; 791 } 792 delete[] dist_2; 793 dist_2 = NULL; 750 794 return class_count_new; 751 795 … … 791 835 int i; 792 836 double cur_dbh, cur_N, low_boundary, high_boundary, low_mass, high_mass, stem_number, left_out; 793 double dist_2[class_count][2]; 794 837 //double dist_2[class_count][2]; 838 double** dist_2 = NULL; 839 dist_2 = new double*[class_count]; 840 for (int i=0; i < class_count; i++) { 841 dist_2[i] = new double[2]; 842 for (int j=0; j<2; j++) { 843 dist_2[i][j] = 0; 844 } 845 } 846 795 847 left_out = 0; 796 848 //diameters & stem numbers … … 869 921 dist[2].n = (BA/3)/(PI * pow(( dist_2[biggest_class+1][0] / 200 ), 2)); 870 922 class_count_new = 3; 871 } 923 } 924 for (int i=0; i < class_count; i++) { 925 delete[] dist_2[i]; 926 dist_2[i] = NULL; 927 } 928 delete[] dist_2; 929 dist_2 = NULL; 872 930 return class_count_new; 873 931 } … … 3167 3225 double low_boundary, high_boundary, low_mass, high_mass, stem_number, left_out; 3168 3226 double sum_ppa, sum_ppa_d, ppa, ppa_d, D_g, step, counter1, counter2, counter3; 3169 double dist_2[class_count][3]; 3170 3227 //double dist_2[class_count][3]; 3228 3229 double** dist_2 = NULL; 3230 dist_2 = new double*[class_count]; 3231 for (int i=0; i < class_count; i++) { 3232 dist_2[i] = new double[3]; 3233 for (int j=0; j<3; j++) { 3234 dist_2[i][j] = 0; 3235 } 3236 } 3237 3171 3238 left_out = 0; 3172 3239 counter1 = 0; … … 3363 3430 counter3++; 3364 3431 } 3365 } 3432 } 3433 3434 for (int i=0; i < class_count; i++) { 3435 delete[] dist_2[i]; 3436 dist_2[i] = NULL; 3437 } 3438 delete[] dist_2; 3439 dist_2 = NULL; 3440 3366 3441 return class_count_new; 3367 3442 … … 3479 3554 int i, j; 3480 3555 double low_boundary, high_boundary, low_mass, high_mass, stem_number, left_out; 3481 double sum_ppa, sum_ppa_d, ppa, ppa_d, D_g, step; 3482 double dist_2[class_count][3]; 3483 3556 double sum_ppa, sum_ppa_d, ppa, ppa_d, D_g, step; 3557 //double dist_2[class_count][3]; 3558 3559 double** dist_2 = NULL; 3560 dist_2 = new double*[class_count]; 3561 for (int i=0; i < class_count; i++) { 3562 dist_2[i] = new double[3]; 3563 for (int j=0; j<3; j++) { 3564 dist_2[i][j] = 0; 3565 } 3566 } 3567 3484 3568 left_out = 0; 3485 3569 //heights & stem numbers … … 3616 3700 } 3617 3701 } 3702 3703 for (int i=0; i < class_count; i++) { 3704 delete[] dist_2[i]; 3705 dist_2[i] = NULL; 3706 } 3707 delete[] dist_2; 3708 dist_2 = NULL; 3709 3618 3710 return class_count_new; 3619 3711 -
simo/trunk/src/models/Finland/c/DistributionmodelLibrary.h
r2692 r2697 58 58 // and C/C++ implementation. / AM 2.9.2005 59 59 60 //Undecorate C++ functions 61 #ifdef __cplusplus 62 extern "C" { 63 #endif 64 60 65 DLLEXPORT int Diameter_distribution_pine_percent_point_KangasMaltamo ( double BA, double DgM, double Age, double N, double DIAM_CLASS_WIDTH, double MAX_CLASS_COUNT, double CLASS_N_MIN, int *nres, struct diamclass *dist, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 61 66 DLLEXPORT int Diameter_distribution_spruce_percent_point_KangasMaltamo ( double BA, double BA_total, double DgM, double Age, double N, double DIAM_CLASS_WIDTH, double SC, double MAX_CLASS_COUNT, double CLASS_N_MIN, int *nres, struct diamclass *dist, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); … … 96 101 DLLEXPORT int Height_distribution_young_pine_Siipilehto (double N, double H_gM, double H_dom, double HEIGHT_CLASS_WIDTH, double max_class_count, int *nres, struct heightclass_weibull *dist, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 97 102 DLLEXPORT int Diameter_distribution_little_ba_and_n_JKK (double N, double D_gM, double H_gM, double BA, double BA_measured, double MAX_CLASS_COUNT, int *nres, struct diamclass_seedtree *dist, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 103 104 #ifdef __cplusplus 105 } 106 #endif -
simo/trunk/src/models/Finland/c/GeomodelLibrary.h
r1708 r2697 30 30 }; 31 31 32 //Undecorate C++ functions 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 32 37 DLLEXPORT int Coordinates_JKK (double Municipal_id, int *nres, struct coordinates *coor, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 33 38 DLLEXPORT int Altitude_JKK (double Municipal_id, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); … … 43 48 DLLEXPORT int YKJ_rectangular_to_EUREF_FIN_geographical_coordinates_JKK (double Y, double X, int *nres, struct coordinates *coor, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 44 49 DLLEXPORT int EUREF_FIN_rectangular_to_EUREF_FIN_geographical_coordinates_JKK (double Y, double X, int *nres, struct coordinates *coor, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 50 51 #ifdef __cplusplus 52 } 53 #endif -
simo/trunk/src/models/Finland/c/InitmodelLibrary.c
r2696 r2697 1997 1997 double Age_init, H_dom, N_init, BA, V, DgM_real, DgM_init, H_gM; 1998 1998 1999 int iSC = (int) SC; 2000 double diff; 1999 2001 2000 2002 DgM_real=D_gM; 2001 2003 2002 int iSC = (int) SC;2003 2004 switch ( iSC ) 2004 2005 { … … 2087 2088 *nres = 1; 2088 2089 2089 double diff;2090 2090 diff=fabs(DgM_real-(Age*DgM_init))/(Age*DgM_init); 2091 2091 … … 2127 2127 int ret = 1; 2128 2128 double Age_init, H_dom, N_init, BA, V, SP, DgM_real, DgM_init, H_gM; 2129 2129 int iSC = (int) SC; 2130 double diff; 2130 2131 2131 2132 DgM_real=D_gM; 2132 2133 2133 int iSC = (int) SC;2134 2134 switch ( iSC ) 2135 2135 { … … 2218 2218 *nres = 1; 2219 2219 2220 double diff;2221 2220 diff=fabs(DgM_real-(Age*DgM_init))/(Age*DgM_init); 2222 2221 … … 2259 2258 int ret = 1; 2260 2259 double Age_init, H_dom, N_init, BA, V, SP, DgM_real, DgM_init, H_gM; 2260 int iSC = (int) SC; 2261 double diff; 2261 2262 2262 2263 2263 2264 DgM_real=D_gM; 2264 2265 2265 int iSC = (int) SC;2266 2266 switch ( iSC ) 2267 2267 { … … 2350 2350 *nres = 1; 2351 2351 2352 double diff;2353 2352 diff=fabs(DgM_real-(Age*DgM_init))/(Age*DgM_init); 2354 2353 … … 2391 2390 int ret = 1; 2392 2391 double Age_init, H_dom, N_init, BA, V, DgM_real, DgM_init, H_gM; 2392 int iSC = (int) SC; 2393 double diff; 2393 2394 2394 2395 2395 2396 DgM_real=D_gM; 2396 2397 2397 int iSC = (int) SC;2398 2398 switch ( iSC ) 2399 2399 { … … 2487 2487 N=5000; 2488 2488 2489 double diff;2490 2489 diff=fabs(DgM_real-(Age*DgM_init))/(Age*DgM_init); 2491 2490 -
simo/trunk/src/models/Finland/c/InitmodelLibrary.h
r2696 r2697 529 529 // and C/C++ implementation. / AM 2.9.2005 530 530 531 //Undecorate C++ functions 532 #ifdef __cplusplus 533 extern "C" { 534 #endif 535 531 536 DLLEXPORT int Assign_to_zero_after_clearcut_comp_unit_JKK (int *nres, struct To_zero_clearcut_comp_unit *to_zero, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 532 537 DLLEXPORT int Assign_to_zero_after_seedtreecut_comp_unit_JKK (int *nres, struct To_zero_seedtreecut_comp_unit *to_zero, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); … … 561 566 DLLEXPORT int Initial_values_supplemental_planting_spruce_JKK (double SC, double N_Sp, double N_Ns, double N_sb, double SP_regen, int *nres, struct initial_values *init, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 562 567 DLLEXPORT int Initial_values_supplemental_planting_white_birch_JKK (double SC, double N_Sp, double N_Ns, double N_sb, double SP_regen, int *nres, struct initial_values *init, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 568 569 #ifdef __cplusplus 570 } 571 #endif -
simo/trunk/src/models/Finland/c/NaturalremovalmodelLibrary.h
r1757 r2697 51 51 // and C/C++ implementation. / AM 2.9.2005 52 52 53 //Undecorate C++ functions 54 #ifdef __cplusplus 55 extern "C" { 56 #endif 57 53 58 DLLEXPORT int Mimimum_growing_space_pine_Hynynenym (double d_s, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 54 59 DLLEXPORT int Mimimum_growing_space_spruce_Hynynenym (double d_s, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); … … 89 94 DLLEXPORT int Tree_survival_urban_area_forest_JKK (double d, double age, double SP, double BA, double BA_L, double RDF_L, double SC, double TS, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 90 95 DLLEXPORT int Probability_a_tree_to_die_due_to_aging_urban_area_forest_Hynynenym (double age, double sp, double TS, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 96 97 #ifdef __cplusplus 98 } 99 #endif -
simo/trunk/src/models/Finland/c/SeedlingmodelLibrary.h
r2343 r2697 37 37 // factor for the model. This way the models can be called easily from python 38 38 // and C/C++ implementation. / AM 2.9.2005 39 40 //Undecorate C++ functions 41 #ifdef __cplusplus 42 extern "C" { 43 #endif 44 39 45 DLLEXPORT int Initial_age_for_a_new_tree_pine_Hynynenym (double TS, double random, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 40 46 DLLEXPORT int Initial_age_for_a_new_tree_spruce_Hynynenym (double TS, double random, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); … … 115 121 DLLEXPORT int Diameter_small_tree_pine_Siipilehto (double h, double D_gM, double H_gM, double H_dom, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 116 122 DLLEXPORT int Initial_age_JKK (double SP, double TS, double random, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 123 124 #ifdef __cplusplus 125 } 126 #endif -
simo/trunk/src/models/Finland/c/StandgrowthmodelLibrary.h
r1708 r2697 34 34 // and C/C++ implementation. / AM 2.9.2005 35 35 36 //Undecorate C++ functions 37 #ifdef __cplusplus 38 extern "C" { 39 #endif 36 40 37 41 DLLEXPORT int Basal_area_growth_under_bark_pine_VuokilaValiaho (double BA_u, double Age, double H_dom, double SI_100, double SC, double SC1, double SC2, double SC3, double SC4, double SC5, double SC6, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); … … 78 82 DLLEXPORT int Dominant_height_growth_pine_Gustavsen (double Age, double H_dom, double SI_100, double SC, double SC1, double SC2, double SC3, double SC4, double SC5, double SC6, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 79 83 DLLEXPORT int Dominant_height_growth_spruce_Gustavsen (double Age, double H_dom, double SI_100, double SC, double SC1, double SC2, double SC3, double SC4, double SC5, double SC6, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 84 85 #ifdef __cplusplus 86 } 87 #endif -
simo/trunk/src/models/Finland/c/StandmodelLibrary.h
r2687 r2697 118 118 // factor for the model. This way the models can be called easily from python 119 119 // and C/C++ implementation. / AM 2.9.2005 120 121 //Undecorate C++ functions 122 #ifdef __cplusplus 123 extern "C" { 124 #endif 120 125 121 126 DLLEXPORT int Volume_BAHdomF (double BA, double H_dom, double F, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); … … 237 242 DLLEXPORT int Site_index_increment_JKK (double SI_50, double climate_change_scenario, double time_step, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 238 243 DLLEXPORT int Site_index_present_state_JKK (double SI_50, double climate_change_scenario, double year, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 244 245 #ifdef __cplusplus 246 } 247 #endif -
simo/trunk/src/models/Finland/c/ThinningmodelLibrary.h
r2347 r2697 34 34 }; 35 35 36 //Undecorate C++ functions 37 #ifdef __cplusplus 38 extern "C" { 39 #endif 40 36 41 DLLEXPORT int Thinning_limits_JKK (double H_dom, double BA, double MAIN_SP, double MANAGEMENT_REGION, double SC, double TS, double PEAT, double THINNING_LEVEL, int *nres, struct Thinning_limits *limits, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 37 42 DLLEXPORT int Thinning_statutory_limits_JKK (double H_dom, double BA, double MAIN_SP, double MANAGEMENT_REGION, double SC, double TS, double PEAT, double Municipal_id, double THINNING_LEVEL, int *nres, struct Thinning_statutory_limits *limits, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 43 44 #ifdef __cplusplus 45 } 46 #endif -
simo/trunk/src/models/Finland/c/TreegrowthmodelLibrary.h
r1708 r2697 34 34 // factor for the model. This way the models can be called easily from python 35 35 // and C/C++ implementation. / AM 2.9.2005 36 37 //Undecorate C++ functions 38 #ifdef __cplusplus 39 extern "C" { 40 #endif 36 41 37 42 DLLEXPORT int Height_growth_pine_Hynynenym (double d, double D_domvmi, double i_Hdom5, double cr, double CR_domvmi, double RDF_L, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); … … 74 79 DLLEXPORT int Dominant_height_after_5_years_spruce_with_bias_corr_Hynynenym (double A, double TS, double LAKE, double SEA, double SC, double STONY, double PALU, double HUMUS, double ALT, double SCRUB, double WASTE, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 75 80 DLLEXPORT int Dominant_height_after_5_years_birch_with_bias_corr_Hynynenym (double A, double TS, double LAKE, double PLANT, double SC, double SP, double PUB, double PALU, double HUMUS, double SEA, double ALT, double SCRUB, double WASTE, double STONY, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 81 82 #ifdef __cplusplus 83 } 84 #endif -
simo/trunk/src/models/Finland/c/TreemodelLibrary.h
r2587 r2697 34 34 // factor for the model. This way the models can be called easily from python 35 35 // and C/C++ implementation. / AM 2.9.2005 36 37 //Undecorate C++ functions 38 #ifdef __cplusplus 39 extern "C" { 40 #endif 36 41 37 42 DLLEXPORT int Age_pine_hemib_h_KalliovirtaTokola (double h, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); … … 203 208 DLLEXPORT int Calibration_height_JKK (double Age, double BA, double D_gM, double H_gM, double H_dom, double SP, double TS, double ALT, double SC, double PEAT, double PEAT_transf, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 204 209 DLLEXPORT int Crown_ratio_JKK (double d, double h, double SP, double BA, double BA_prosb, double H_dom, double RDF, double RDF_L, double TS, double ALT, double LAKE, double SEA, double SCRUB, double SC, double SI_50, double STONY, double PALU, double HUMUS, double SINCE_THINNING, double PLANT, int *nres, double *modelresult, char *errors, int errorCheckMode, double allowedRiskLevel, double rectFactor); 210 211 #ifdef __cplusplus 212 } 213 #endif -
simo/trunk/src/models/Finland/c/make_dll.py
r738 r2697 1 1 import sys, os 2 3 python_include = os.path.join(os.path.dirname(sys.executable), 'include') 4 python_libs = os.path.join(os.path.dirname(sys.executable), 'libs') 5 python_PC = os.path.join(os.path.dirname(sys.executable), 'PC') 6 python_PCbuild = os.path.join(os.path.dirname(sys.executable), 'PCbuild') 7 python_lib = os.path.join(os.path.dirname(sys.executable), 8 'libs\\python%d%d.lib' % sys.version_info[:2]) 2 9 3 10 def make_dll(filenames): … … 26 33 else: 27 34 dmode = '-DMODE=3' 28 for filename in filenames[1:]: 35 if sys.version_info[:2] <= (2, 5) or sys_id != 'win': 36 for filename in filenames[1:]: 29 37 print "Compiling %s..." % filename 30 38 os.system(' '.join(('gcc', fpic, '-c', dmode, posix_source, 31 39 '%s.h' % filename, '%s.c' % filename))) 32 40 input=' '.join((input, '%s.o' % filename)) 33 print "output =", dllname 34 print "input =", input 35 print "Creating dll..." 36 os.system(' '.join(('gcc', '-shared', '-dynamiclib', '-o', 37 ''.join((dllname, input)) )) ) 41 print "output =", dllname 42 print "input =", input 43 print "Creating dll..." 44 os.system(' '.join(('gcc', '-shared', '-dynamiclib', '-o', 45 ''.join((dllname, input)) )) ) 46 else: 47 #for filename in filenames[1:]: 48 print "Compiling %s..." % dllname 49 to_run = ' '.join(('cl', '/c', dmode, '/O2', '/MD', 50 '/W3', '/GS-', 51 '/DNDEBUG', 52 '/D_CRT_SECURE_NO_WARNINGS', '-I'+python_include, 53 '-I'+python_PC, 54 ' '.join(['/Tp%s.c' % filename \ 55 for filename in filenames[1:]]))) 56 print to_run 57 os.system(to_run) 58 to_run = ' '.join(('link', '/DLL', '/nologo', '/INCREMENTAL:NO', 59 '/LIBPATH:'+python_libs, 60 '/LIBPATH:'+python_PCbuild, 61 ' '.join(['%s.obj' % filename \ 62 for filename in filenames[1:]]), 63 '/OUT:'+filenames[0]+'.dll', 64 '/IMPLIB:'+filenames[0]+'.lib', 65 '/MANIFESTFILE:'+filenames[0]+'.dll.manifest', 66 )) 67 print to_run 68 os.system(to_run) 69 to_run = ' '.join(('mt', '-nologo', '-manifest', 70 filenames[0]+'.dll.manifest', 71 '-outputresource:'+filenames[0]+'.dll;2')) 72 print to_run 73 os.system(to_run) 74 75 38 76 print "Removing lingering files..." 39 77 40 78 tmpfiles = [file for file in os.listdir('.') if file.endswith('.o') or 41 file.endswith('.gch')] 79 file.endswith('.gch') or file.endswith('.exp') or 80 file.endswith('.obj') or file.endswith('.lib') or 81 file.endswith('.exe') or file.endswith('.manifest')] 42 82 for file in tmpfiles: 43 83 os.remove(os.path.join(file))
Note: See TracChangeset
for help on using the changeset viewer.
