void Interpol2D::setYmax( double value ) { if ( !doubleApprox( ymin_, value ) ) { ymax_ = value; invDy_ = ydivs() / ( ymax_ - ymin_ ); } else { cerr << "Error: Interpol2D::setYmax: Ymin ~= Ymax : Assignment failed\n"; } }
void Interpol2D::setXmax( double value ) { if ( !doubleApprox( xmin_, value ) ) { xmax_ = value; invDx_ = xdivs() / ( xmax_ - xmin_ ); } else { cerr << "Error: Interpol2D::setXmax: Xmin ~= Xmax : Assignment failed\n"; } }
int CubeMesh::compareMeshSpacing( const CubeMesh* other ) const { if ( doubleApprox( dx_, other->dx_ ) && doubleApprox( dy_, other->dy_ ) && doubleApprox( dz_, other->dz_ ) ) return 0; // equal if ( dx_ >= other->dx_ && dy_ >= other->dy_ && dz_ >= other->dz_ ) return 1; // bigger if ( dx_ <= other->dx_ && dy_ <= other->dy_ && dz_ <= other->dz_ ) return -1; // smaller than other. cout << "Warning: CubeMesh::compareMeshSpacing: inconsistent spacing\n"; return 0; }
void testMMenzProcess() { Shell* shell = reinterpret_cast< Shell* >( Id().eref().data() ); ////////////////////////////////////////////////////////////////////// // This set is the test kinetic calculation using MathFunc ////////////////////////////////////////////////////////////////////// Id nid = shell->doCreate( "Neutral", Id(), "n", 1 ); ////////////////////////////////////////////////////////////////////// // This set is the reference kinetic calculation using MMEnz ////////////////////////////////////////////////////////////////////// Id pid = shell->doCreate( "Pool", nid, "p", 1 ); // substrate Id qid = shell->doCreate( "Pool", nid, "q", 1 ); // enz mol Id rid = shell->doCreate( "Pool", nid, "r", 1 ); // product Id mmid = shell->doCreate( "MMenz", nid, "mm", 1 ); // mmenz Id tabid2 = shell->doCreate( "Table", nid, "tab2", 1 ); //output plot Field< double >::set( mmid, "Km", 1.0 ); Field< double >::set( mmid, "kcat", 1.0 ); Field< double >::set( pid, "nInit", 1.0 ); Field< double >::set( qid, "nInit", 1.0 ); Field< double >::set( rid, "nInit", 0.0 ); shell->doAddMsg( "Single", ObjId( mmid ), "sub", ObjId( pid ), "reac" ); shell->doAddMsg( "Single", ObjId( mmid ), "prd", ObjId( rid ), "reac" ); shell->doAddMsg( "Single", ObjId( qid ), "nOut", ObjId( mmid ), "enzDest" ); shell->doAddMsg( "Single", ObjId( pid ), "nOut", ObjId( tabid2 ), "input" ); shell->doSetClock( 0, 0.01 ); shell->doSetClock( 1, 0.01 ); shell->doUseClock( "/n/mm,/n/tab2", "process", 0 ); shell->doUseClock( "/n/#[ISA=Pool]", "process", 1 ); ////////////////////////////////////////////////////////////////////// // Now run models and compare outputs ////////////////////////////////////////////////////////////////////// shell->doReinit(); shell->doStart( 10 ); vector< double > vec = Field< vector< double > >::get( tabid2, "vec" ); assert( vec.size() == 1001 ); for ( unsigned int i = 0; i < vec.size(); ++i ) { double t = 0.01 * i; double et = estT( vec[i] ); assert( doubleApprox( t, et ) ); } shell->doDelete( nid ); cout << "." << flush; }