src/NFcore/observable.cpp
/* Remove multiple matches fron an observable (rather than call 'subtract' a bunch of times --justin */
/* Necessary to make counters fast! */
Remove multiple matches fron an observable (rather than call 'subtract' a bunch of times --justin
Necessary to make counters fast!
Remove multiple matches fron an observable ( rather than call ' subtract ' a bunch of times -- justin Necessary to make counters fast!
void Observable::subtract( int n_matches )
{
	if (count - n_matches < 0)
	{
		cerr << "Error in observable count!! Removing " << n_matches << " matches will result in a negative match count!"
		     << "Observable named: " << obsName << endl;
		exit(1);
	}
	count -= n_matches;
	for (int r=0; r<n_dependentRxns; r++)
	{
		double old_a = dependentRxns[r]->get_a();
		double new_a = dependentRxns[r]->update_a();
		templateMolecules[0]->getMoleculeType()->getSystem()->update_A_tot( dependentRxns[r], old_a, new_a);
	}
}
void Observable :: subtract ( int n_matches ) { if ( count - n_matches < 0 ) { cerr << " " << n_matches << " " << " " << obsName << endl ; exit ( 1 ) ; } count -= n_matches ; for ( int r = 0 ; r < n_dependentRxns ; r ++ ) { double old_a = dependentRxns [ r ] -> get_a ( ) ; double new_a = dependentRxns [ r ] -> update_a ( ) ; templateMolecules [ 0 ] -> getMoleculeType ( ) -> getSystem ( ) -> update_A_tot ( dependentRxns [ r ] , old_a , new_a ) ; } }
Remove multiple matches fron an observable (rather than call 'subtract' a bunch of times --justin
Necessary to make counters fast!
Remove multiple matches fron an observable ( rather than call ' subtract ' a bunch of times -- justin Necessary to make counters fast!
//debug //cout << "Observable::subtract( " << n_matches << " )" << endl; // First, we subtract from our observable count // Next, we update our dependent reactions, if there are any