Changeset 2441 for branches/newmole
- Timestamp:
- 11/04/08 14:35:50 (2 months ago)
- Location:
- branches/newmole/source
- Files:
-
- 3 modified
-
cddefines.h (modified) (2 diffs)
-
mole.h (modified) (1 diff)
-
mole_solve.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/newmole/source/cddefines.h
r2440 r2441 1561 1561 /**get_ptr attribute shim to get raw pointer to contained data with 1562 1562 * correct type */ 1563 template<class T> inline T* get_ptr(T *v) 1564 { 1565 return v; 1566 } 1563 1567 template<class T> inline T* get_ptr(valarray<T> &v) 1564 1568 { … … 1577 1581 return const_cast<const T*>(&const_cast<vector<T>&>(v)[0]); 1578 1582 } 1579 1580 1583 1581 1584 /************************************************************************** -
branches/newmole/source/mole.h
r2430 r2441 192 192 extern struct chem_element_s *element_list[LIMELM]; 193 193 194 template<class T> inline const T* get_const_address(const valarray<T> &v)195 {196 return const_cast<const T*>(&const_cast<valarray<T>&>(v)[0]);197 }198 template<class T> inline const T* get_const_address(const vector<T> &v)199 {200 return const_cast<const T*>(&const_cast<vector<T>&>(v)[0]);201 }202 203 194 #endif /* _MOLE_H_ */ -
branches/newmole/source/mole_solve.cpp
r2426 r2441 105 105 nPrevBad = nBad; 106 106 107 MoleMap.setup( &oldmols[0]);108 109 grouped_elems( &oldmols[0],molElems);107 MoleMap.setup(get_ptr(oldmols)); 108 109 grouped_elems(get_ptr(oldmols),molElems); 110 110 111 111 long j; … … 117 117 if (0) 118 118 { 119 grouped_elems( &newmols[0],molElemsNew);119 grouped_elems(get_ptr(newmols),molElemsNew); 120 120 for (long nelem=0; nelem <LIMELM; nelem++) 121 121 { … … 358 358 (c[][], first iteration) from reaction list */ 359 359 360 mole_eval_dynamic_balance(mole.num_total, &b[0],lgJac,c);360 mole_eval_dynamic_balance(mole.num_total,get_ptr(b),lgJac,c); 361 361 362 362 /*------------------------------------------------------------------ */ … … 518 518 double molnow[LIMELM]; 519 519 520 grouped_elems(get_ const_address(b2vec), molnow);520 grouped_elems(get_ptr(b2vec), molnow); 521 521 522 522 iamax = 0; … … 742 742 if (0) 743 743 { 744 grouped_elems( &ervals[0],molElemsNew);744 grouped_elems(get_ptr(ervals),molElemsNew); 745 745 for ( long nelem=0; nelem<LIMELM; nelem++) 746 746 {
