src/oceanbox.cpp
//------------------------------------------------------------------------------
/*! \brief          Add (or replace) a box-to-box connection
 *  \param[in] ob   pointer to another oceanbox
 *  \param[in] k    weight of the connection
 *  \param[in] ws   connection window size: 0=current state only, 1=mean of current and 1 year back, etc.
 *  \exception      if ob is same as current box
 *
 *  Establishes a one-way connection from the current box to another, with a weight of
 *  k. If a connection already exists, it will be overwritten (i.e. only two connections
 *  between any two boxes are allowed, one in each direction).  Window establishes how many previous
 *  time step connections to use.
 */
\brief          Add (or replace) a box-to-box connection
\param[in] ob   pointer to another oceanbox
\param[in] k    weight of the connection
\param[in] ws   connection window size: 0=current state only, 1=mean of current and 1 year back, etc.
\exception      if ob is same as current box

Establishes a one-way connection from the current box to another, with a weight of
k. If a connection already exists, it will be overwritten .  Window establishes how many previous
time step connections to use.
\ brief Add ( or replace ) a box - to - box connection \ param [ in ] ob pointer to another oceanbox \ param [ in ] k weight of the connection \ param [ in ] ws connection window size : 0 = current state only 1 = mean of current and 1 year back etc . \ exception if ob is same as current box Establishes a one - way connection from the current box to another with a weight of k . If a connection already exists it will be overwritten . Window establishes how many previous time step connections to use .
void oceanbox::make_connection( oceanbox* ob, const double k, const int ws ) { 
	H_ASSERT( ob != this, "can't make connection to same box" );
	OB_LOG( logger, Logger::NOTICE) << "Adding connection " << Name << " to " << ob->Name << ", k=" << k << endl;
	for( unsigned i=0; i<connection_list.size(); i++ ) {
		if( connection_list[ i ]==ob ) {
			connection_k[ i ] = k;
			connection_window[ i ] = ws;
			OB_LOG( logger, Logger::WARNING) << "** overwriting connection in " << Name << " ** " << endl;
			OB_LOG( logger, Logger::WARNING) << "** Are you sure about this? ** " << endl;
			return;
		}
	}
	connection_list.push_back( ob ); 
	connection_k.push_back( k );
	H_ASSERT( ws >= 0, "window negative number" );
	connection_window.push_back( ws );
}
void oceanbox :: make_connection ( oceanbox * ob , const double k , const int ws ) { H_ASSERT ( ob != this , " " ) ; OB_LOG ( logger , Logger :: NOTICE ) << " " << Name << " " << ob -> Name << " " << k << endl ; for ( unsigned i = 0 ; i < connection_list . size ( ) ; i ++ ) { if ( connection_list [ i ] == ob ) { connection_k [ i ] = k ; connection_window [ i ] = ws ; OB_LOG ( logger , Logger :: WARNING ) << " " << Name << " " << endl ; OB_LOG ( logger , Logger :: WARNING ) << " " << endl ; return ; } } connection_list . push_back ( ob ) ; connection_k . push_back ( k ) ; H_ASSERT ( ws >= 0 , " " ) ; connection_window . push_back ( ws ) ; }
\brief          Add (or replace) a box-to-box connection
  \param[in] ob   pointer to another oceanbox
  \param[in] k    weight of the connection
  \param[in] ws   connection window size: 0=current state only, 1=mean of current and 1 year back, etc.
\ brief Add ( or replace ) a box - to - box connection \ param [ in ] ob pointer to another oceanbox \ param [ in ] k weight of the connection \ param [ in ] ws connection window size : 0 = current state only 1 = mean of current and 1 year back etc .
//, window=1 or whatever we are averaging over.  use curent state of 1 or will use what we tell it to use. // If a connection to this box already exists, replace it // Otherwise, make a new connection // add new element to vector