Changeset 1683 for branches/newmole/source
- Timestamp:
- 12/16/07 11:29:33 (11 months ago)
- Location:
- branches/newmole/source
- Files:
-
- 4 modified
-
mole_co_etc.cpp (modified) (16 diffs)
-
mole_eval_balance.cpp (modified) (2 diffs)
-
mole_priv.h (modified) (1 diff)
-
mole_reactions.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/newmole/source/mole_co_etc.cpp
r1682 r1683 278 278 /* ...first active species */ 279 279 i = 0; 280 for (m ap<string,struct molecule *>::iteratorp280 for (molecule_i p 281 281 =mole_priv.spectab.begin(); p != mole_priv.spectab.end(); p++) 282 282 { … … 290 290 mole_cmp); 291 291 292 for (m ap<string,struct molecule *>::iteratorp292 for (molecule_i p 293 293 =mole_priv.spectab.begin(); p != mole_priv.spectab.end(); p++) 294 294 { … … 531 531 struct molecule *findspecies(const char buf[]) 532 532 { 533 m ap<string,struct molecule *>::iteratorp;533 molecule_i p; 534 534 535 535 DEBUG_ENTRY("findspecies()"); … … 545 545 STATIC struct chem_element_s *findelement(const char buf[]) 546 546 { 547 map<string,struct chem_element_s *>::iteratorp;547 chem_element_i p; 548 548 549 549 DEBUG_ENTRY("findelement()"); … … 559 559 struct mole_reaction_s *mole_findrate_s(const char buf[]) 560 560 { 561 m ap<string,struct mole_reaction_s *>::iteratorp;561 mole_reaction_i p; 562 562 563 563 DEBUG_ENTRY("mole_findrate_s()"); … … 672 672 double mole_sink_rate(const char chSpecies[7]) 673 673 { 674 int ipthis, i , n, nt;674 int ipthis, i; 675 675 double ratev, ratevi; 676 676 struct mole_reaction_s *rate; … … 681 681 sp = findspecies(chSpecies); 682 682 ratev = 0; 683 nt = coreactions.n; 684 685 for(n=0;n<nt;n++)686 { 687 rate = coreactions.list[n];683 684 for(mole_reaction_i p=mole_priv.reactab.begin(); 685 p != mole_priv.reactab.end(); p++) 686 { 687 rate = p->second; 688 688 ipthis = -1; 689 689 for(i=0;i<rate->nreactants && ipthis == -1;i++) … … 729 729 void mole_update_rks(void) 730 730 { 731 int n, nt;732 731 struct mole_reaction_s *rate; 733 732 … … 740 739 hmole_reactions(); 741 740 742 nt = coreactions.n; 743 744 for(n=0;n<nt;n++) 745 { 746 rate = coreactions.list[n]; 741 for (mole_reaction_i p 742 =mole_priv.reactab.begin(); p != mole_priv.reactab.end(); p++) 743 { 744 rate = p->second; 747 745 if(rate->fun != NULL) { 748 746 rate->rk = rate->a*rate->fun(rate); … … 753 751 double mole_dissoc_rate(const char chSpecies[7]) 754 752 { 755 int ipsp, ipph, i , n, nt;753 int ipsp, ipph, i; 756 754 double ratev, ratevi; 757 755 struct mole_reaction_s *rate; … … 763 761 ph = findspecies("PHOTON"); 764 762 ratev = 0; 765 nt = coreactions.n; 766 767 for(n=0;n<nt;n++)768 { 769 rate = coreactions.list[n];763 764 for (mole_reaction_i p 765 =mole_priv.reactab.begin(); p != mole_priv.reactab.end(); p++) 766 { 767 rate = p->second; 770 768 771 769 ipph = 0; … … 807 805 double mole_source_rate(const char chSpecies[7]) 808 806 { 809 int ipthis, i , n, nt;807 int ipthis, i; 810 808 double ratev, ratevi; 811 809 struct mole_reaction_s *rate; … … 816 814 sp = findspecies(chSpecies); 817 815 ratev = 0; 818 nt = coreactions.n; 819 820 for(n=0;n<nt;n++)821 { 822 rate = coreactions.list[n];816 817 for (mole_reaction_i p 818 =mole_priv.reactab.begin(); p != mole_priv.reactab.end(); p++) 819 { 820 rate = p->second; 823 821 ipthis = 0; 824 822 for(i=0;i<rate->nproducts;i++) … … 855 853 */ 856 854 857 long int nt, n,i;855 long int i; 858 856 struct mole_reaction_s *rate; 859 857 double rate_tot, heating; 860 858 realnum reaction_enthalpy; 861 859 862 nt = coreactions.n;863 864 860 heating = 0; 865 861 /* loop over all reactions */ 866 for(n=0;n<nt;n++) 867 { 868 rate = coreactions.list[n]; 862 for (mole_reaction_i p 863 =mole_priv.reactab.begin(); p != mole_priv.reactab.end(); p++) 864 { 865 rate = p->second; 869 866 /* This loop calculates the product of the rate constant times the densities*/ 870 867 rate_tot = rate->rk; … … 904 901 bool lgData, double depth) 905 902 { 906 int n, nt,i, ipthis;903 int i, ipthis; 907 904 double ratevi; 908 905 struct mole_reaction_s *rate; … … 922 919 } 923 920 924 nt = coreactions.n; 925 for(n=0;n<nt;n++) { 926 rate = coreactions.list[n]; 921 for (mole_reaction_i p 922 =mole_priv.reactab.begin(); p != mole_priv.reactab.end(); p++) 923 { 924 rate = p->second; 927 925 ipthis = 0; 928 926 for (i=0;i<rate->nreactants;i++) -
branches/newmole/source/mole_eval_balance.cpp
r1680 r1683 32 32 void mole_eval_balance(long int num_total, double *b, double **c) 33 33 { 34 long int i, j, n , nt, nelem, ratei, ratej, ion, ion2;34 long int i, j, nelem, ratei, ratej, ion, ion2; 35 35 struct mole_reaction_s *rate, *ratesnk=NULL, *ratesrc=NULL; 36 36 double rate_tot, rate_deriv[MAXREACTANTS], rated, rk; … … 77 77 /* Fills matrix elements for passive species -- these can be used to 78 78 derive sources & sinks resulting from this part of the network */ 79 nt = coreactions.n;80 for(n=0;n<nt;n++)81 { 82 rate = coreactions.list[n];79 for(mole_reaction_i p=mole_priv.reactab.begin(); 80 p != mole_priv.reactab.end(); p++) 81 { 82 rate = p->second; 83 83 rk = rate->rk; 84 84 -
branches/newmole/source/mole_priv.h
r1682 r1683 13 13 map <string,double (*)(struct mole_reaction_s *rate)> functab; 14 14 } mole_priv; 15 typedef map<string,struct mole_reaction_s *>::iterator mole_reaction_i; 16 typedef map<string,struct molecule *>::iterator molecule_i; 17 typedef map<string,struct chem_element_s *>::iterator chem_element_i; 15 18 16 19 extern struct molecule **groupspecies; 17 20 18 21 extern struct molecule *null_mole; 19 20 EXTERN struct t_coreactions {21 struct mole_reaction_s **list;22 long int n;23 } coreactions;24 22 25 23 #define MAXREACTANTS 3 -
branches/newmole/source/mole_reactions.cpp
r1682 r1683 40 40 41 41 enum {UDFA = 0}; /* UDFA = 1 for: make UDFA comparison and stop */ 42 43 /* Structures containing reaction data */44 struct t_coreactions coreactions;45 42 46 43 STATIC void newreact(const char label[], … … 146 143 147 144 long int i; 148 /* Initialize number of reactions added to list in coreactions of reactions149 treated by new methodology, incremented by newreact() */150 145 151 146 DEBUG_ENTRY("mole_create_react()"); … … 153 148 if (UDFA) 154 149 read_data("rate05_feb17.csv",parse_udfa); 155 156 coreactions.n = 0;157 150 158 151 /* Set up registry of rate functions -- could do something intelligent about … … 415 408 } 416 409 417 /* Create linear list of reactions ... */418 if (coreactions.n != 0)419 {420 coreactions.list = (struct mole_reaction_s **)421 MALLOC((size_t)coreactions.n*sizeof(struct mole_reaction_s *));422 }423 else424 {425 coreactions.list = NULL;426 }427 428 /* ...and populate it */429 i = 0;430 for (map<string,struct mole_reaction_s *>::iterator p431 =mole_priv.reactab.begin(); p != mole_priv.reactab.end(); p++)432 {433 coreactions.list[i++] = p->second;434 }435 ASSERT (i == coreactions.n);436 437 410 if (0) 438 411 plot_sparsity(); … … 462 435 struct molecule *sp; 463 436 ratefunc func; 464 m ap <string,struct mole_reaction_s *>::iteratorp;437 mole_reaction_i p; 465 438 int i,j,k,exists; 466 439 char buf[NBUF]; … … 653 626 free(p->second); 654 627 } 655 else656 {657 coreactions.n++;658 }659 628 mole_priv.reactab[label] = rate; 660 629 rate->label = label; … … 1487 1456 FILE *sparsefp; 1488 1457 int i, j, nb, ch; 1489 long int ratej , nt, n;1458 long int ratej; 1490 1459 struct mole_reaction_s *rate; 1491 1460 double **c; … … 1508 1477 } 1509 1478 1510 nt = coreactions.n; 1511 1512 for (n=0;n<nt;n++) 1513 { 1514 rate = coreactions.list[n]; 1479 for(mole_reaction_i p=mole_priv.reactab.begin(); 1480 p != mole_priv.reactab.end(); p++) 1481 { 1482 rate = p->second; 1515 1483 1516 1484 for (j=0;j<rate->nreactants;j++)
