Exemple #1
0
ssize_t ClientServer::write_global(uint32_t session_id, const string& data)
{
    return write_global(session_id, data.data(), data.length());
}
Exemple #2
0
int main (void)
{
	{
		char buff[100];
		strcpy(buff, "abc");
		cj_jail(strcpy, 2, buff, "def");
		presult(1, strcmp(buff, "abc") == 0);
	}

	{
		char buff[100];
		strcpy(buff, "abc");
		cj_jail(strcpy, 2, buff, "def");
		cj_recv(buff, sizeof(buff));
		presult(2, strcmp(buff, "def") == 0);
	}

	cj_jail(set_global, 1, 12345);
	presult(3, cj_jail(get_global, 0) == 12345);
	presult(4, *(int *)cj_jail(get_globalref, 0) == 12345);

	{
		char buff[100];
		strcpy(buff, "Hello World!");
		cj_jail(strtoupper, 1, buff);
		presult(5, strcmp(buff, "Hello World!") == 0);
		cj_recv(buff, sizeof(buff));
		presult(6, strcmp(buff, "HELLO WORLD!") == 0);
	}

	{
		char *buff = malloc(100);
		write_global("foo7");
		presult(7, strcmp(read_globalref(), "foo7") == 0);
		read_global(buff);
		presult(8, strcmp(buff, "foo7") == 0);
		strcpy(buff, "foo8");
		cj_jail(read_global, 1, buff);
		presult(9, strcmp(buff, "foo8") == 0);
		cj_recv(buff, 100);
		presult(10, strcmp(buff, "foo7") == 0);
	}

	{
		const int num = 1000;
		void *arr[num];
		int i;

		srand(1);
		for (i = 0; i < num; i ++) {
			arr[i] = malloc(rand() % 500 + 1);
			if (arr[i] == NULL)
				break;
			if (rand() % 2) {
				int j = rand() % (i + 1);
				free(arr[j]);
				arr[j] = malloc(rand() % 500 + 1);
				if (arr[j] == NULL)
					break;
			}
		}
		presult(11, i == num);
		for (i = 0; i < num; i ++)
			free(arr[i]);

		for (i = 0; i < num; i ++) {
			arr[i] = (void *)cj_jail(malloc, 1, rand() % 500 + 1);
			if (arr[i] == NULL)
				break;
			if (rand() % 2) {
				int j = rand() % (i + 1);
				if (rand() % 2)
					free(arr[j]);
				else
					cj_jail(free, 1, arr[j]);
				arr[j] = (void *)cj_jail(malloc, 1, rand() % 500 + 1);
				if (arr[j] == NULL)
					break;
			}
		}
		presult(12, i == num);
		for (i = 0; i < num; i ++)
			free(arr[i]);
	}

	presult(13, call_callback(callback1, 1) == 4);
	presult(14, cj_jail(call_callback, 2, cj_reg_callback(callback1, NULL, 1), 1) == 4);
	presult(15, cj_jail(call_callback, 2, cj_reg_callback(callback1, callback1_wrapper, 1), 1) == 14);
	presult(16, cj_jail(call_callback, 2, cj_reg_callback(callback2, NULL, 1), 1) == 8);

	return 0;
}
Exemple #3
0
boolean Global::ChangeS1S5(int value)
{
  boolean ret = false;
  int nbtap, tot, ct;

  if ( Menu->ChangeS1S5(value) )
  {
    if ( Menu->FirstPage )
    {  
      switch (Menu->S1S5)
      {
      case 1 : // Tap Tempo


        for (ct=TAPTEMPO_MAX-1;ct>0;ct--) tapTempo[ct]=tapTempo[ct-1]; 
        tapTempo[ 0 ] = millis();
        nbtap=0;
        tot=0;
        for ( int ct=0;ct<TAPTEMPO_MAX-1; ct++ )
        {
          if ( tapTempo[ ct ] - tapTempo[ ct + 1] < (60000/TEMPO_MIN) )
          {
            tot +=  ( tapTempo[ct] - tapTempo[ct+1] );
            nbtap++;
          }
        }
        if ( nbtap > 0 )  
        { 
          ParamGlo.Tempo = (uint16_t)60000 / ( tot / nbtap );
          if ( ParamGlo.Tempo < TEMPO_MIN ) ParamGlo.Tempo=TEMPO_MIN;
          if ( ParamGlo.Tempo > TEMPO_MAX ) ParamGlo.Tempo=TEMPO_MAX;
          Menu->SetM1(ParamGlo.Tempo);
          SClock.ChangeTempo();
        }
        break;



      case 3 :
        if (!is_played) {
          ExStart(false);
          lcdM.setCursor(8,3);
          lcdM.print("Stop");
        }
        else
        {
          ExStop();
          lcdM.setCursor(8,3);
          lcdM.print("Play");
        }
        break;
        
      case 2 :
        if (!is_played) {
          ExStart(true);
          lcdM.setCursor(8,3);
          lcdM.print("Stop");
        }
        else
        {
          ExStop();
          lcdM.setCursor(8,3);
          lcdM.print("Play");
        }
        break;
        
        
      case 4 :
        switch (Recorder.mode_Record)
        {
        case  RECORD_OFF:
          Recorder.mode_Record=RECORD_PLAY;
          lcdM.setCursor(13,3);
          lcdM.print("Ply");
          Recorder.cur_Play_Record=0;
          clock_count=0;
          break;

        case  RECORD_PLAY:
          if ( !is_played )
          {
            Recorder.mode_Record=RECORD_ON;
            lcdM.setCursor(13,3);
            lcdM.print("Rec");
          }
          else
          {
            Recorder.mode_Record=RECORD_OFF;
            lcdM.setCursor(13,3);
            lcdM.print("Off");
          }
          break;

        case  RECORD_ON:
          Recorder.mode_Record=RECORD_OFF;
          lcdM.setCursor(13,3);
          lcdM.print("Off");
          break;


        }
        break;

      }
    }        
    else
    {
      switch (Menu->S1S5)
      {
      case 3:
        switch( Menu->curCmd )
        {
        case 0:  /* Load */
          SPOut.AutoOff( ParamGlo.UpperDest );
          SPOut.AutoOff( ParamGlo.LowerDest );

          if ( MySD.OpenFileForRead(MODE_PARAM, Menu->GetFName(FileName) ) )
          {
            Restore();
            MySD.CloseFile();
          }
          PatLed.Show(0);
          UpdateRoute(0);
          DessinPage();
          break;

        case 1:  /* Save */

          if ( MySD.OpenFileForWrite(MODE_PARAM, Menu->MenuFName(FileName) ) )
          {
            Backup();
            MySD.CloseFile();
          }
          PatLed.Show(0);
          break;

        case 2:  /* Load All*/
          SPOut.AutoOff( ParamGlo.UpperDest );
          SPOut.AutoOff( ParamGlo.LowerDest );

          read_global(Menu->GetFName(FileName));
          PatLed.Show(0);
          DessinPage();
          break;


        case 3:  /* Save All*/
          write_global(Menu->MenuFName(FileName) );
          PatLed.Show(0);
          break;


        case 4:  /* Init */

          SPOut.AutoOff( ParamGlo.UpperDest );
          SPOut.AutoOff( ParamGlo.LowerDest );

          if ( Menu->V1 == 0 )
            Init();
          else
            init_global();

          PatLed.Show(0);
          DessinPage();        
          break;



        case 5:
          S4822.Send(CV_1, 400*Menu->V1 );
          S4822.Send(CV_2, 400*Menu->V1);
          S4822.Send(CV_3, 400*Menu->V1 );
          S4822.Send(CV_4, 400*Menu->V1 );
          S4822.Send(CV_5, 400*Menu->V1 );
          S4822.Send(CV_6, 400*Menu->V1 );
          S4822.Send(CV_7, 400*Menu->V1 );
          S4822.Send(CV_8, 400*Menu->V1 );
//          analogWrite(DAC0, 400*Menu->V1 );
//            analogWrite(DAC1, 400*Menu->V1 );
          PatLed.Show(0);
          break;


        case 6: 
          digitalWrite(TRIG_1, Menu->V1 );
          digitalWrite(TRIG_2, Menu->V1 );
          digitalWrite(TRIG_3, Menu->V1 );
          digitalWrite(TRIG_4, Menu->V1 );
          digitalWrite(TRIG_5, Menu->V1 );
          digitalWrite(TRIG_6, Menu->V1 );
          digitalWrite(TRIG_7, Menu->V1 );
          digitalWrite(TRIG_8, Menu->V1 );
          PatLed.Show(0);
          break;
        }
        break;
      }
    }
  }
  return ret;
}
void US_MPI_Analysis::dmga_master( void )
{
   current_dataset     = 0;
   datasets_to_process = data_sets.size();
   max_depth           = 0;
   calculated_solutes.clear();

   // Set noise and debug flags
   simulation_values.noisflag   = 0;
   simulation_values.dbg_level  = dbg_level;
   simulation_values.dbg_timing = dbg_timing;
DbgLv(0) << "DEBUG_LEVEL" << simulation_values.dbg_level;

   if ( data_sets.size() == 1 )
   {
      US_AstfemMath::initSimData( simulation_values.sim_data,
                                  data_sets[ 0 ]->run_data, 0.0 );
      US_AstfemMath::initSimData( simulation_values.residuals,
                                  data_sets[ 0 ]->run_data, 0.0 );
   }
   else
   {
      int ntscan        = data_sets[ 0 ]->run_data.scanCount();
      for ( int ii = 1; ii < data_sets.size(); ii++ )
         ntscan           += data_sets[ ii ]->run_data.scanCount();
      simulation_values.sim_data .scanData.resize( ntscan );
      simulation_values.residuals.scanData.resize( ntscan );
   }

   // Initialize best fitness
   best_dgenes .reserve( gcores_count );
   best_fitness.reserve( gcores_count );

   // Read in the constraints model and build constraints
   QString cmfname  = "../" + parameters[ "DC_model" ];
   wmodel.load( cmfname );                  // Load the constraints model
   constraints.load_constraints( &wmodel ); // Build the constraints object
   constraints.get_work_model  ( &wmodel ); // Get the base work model
DbgLv(1) << "dmga_master: cmfname" << cmfname;
DbgLv(1) << "dmga_master: wmodel #comps" << wmodel.components.size()
 << "#assoc" << wmodel.associations.size();

   // Report on the constraints attribute values and ranges

   DbgLv(0) << parameters[ "DC_model" ] << "Constraints --";

   QString attrtype = tr( "UNKNOWN" );
   US_dmGA_Constraints::AttribType atype;
   QVector< US_dmGA_Constraints::Constraint > cnsv;

   for ( int mcompx = 0; mcompx < wmodel.components.size(); mcompx++ )
   {
      int compno  = mcompx + 1;
      int ncompc  = constraints.comp_constraints( mcompx, &cnsv, NULL );

      DbgLv(0) << "  Component" << compno << ":";
//DbgLv(0) << "mcompx ncompc c0atype" << mcompx << ncompc << cnsv[0].atype
// << "_FF0" << US_dmGA_Constraints::ATYPE_FF0;

      for ( int cx = 0; cx < ncompc; cx++ )
      {
         atype       = cnsv[ cx ].atype;
//DbgLv(0) << " cx" << cx << "atype" << atype;
         bool floats = cnsv[ cx ].floats;
         bool logscl = cnsv[ cx ].logscl;
         double vmin = cnsv[ cx ].low;
         double vmax = cnsv[ cx ].high;
         attrtype    = tr( "UNKNOWN" );
//DbgLv(0) << "  cx" << cx << "fl ls mn mx" << floats << logscl << vmin << vmax;

         if      ( atype == US_dmGA_Constraints::ATYPE_S    )
            attrtype = tr( "Segmentation Coefficient" );
         else if ( atype == US_dmGA_Constraints::ATYPE_FF0  )
            attrtype = tr( "Frictional Ratio" );
         else if ( atype == US_dmGA_Constraints::ATYPE_MW   )
            attrtype = tr( "Molecular Weight" );
         else if ( atype == US_dmGA_Constraints::ATYPE_D    )
            attrtype = tr( "Diffusion Coefficient" );
         else if ( atype == US_dmGA_Constraints::ATYPE_F    )
            attrtype = tr( "Frictional Coefficient" );
         else if ( atype == US_dmGA_Constraints::ATYPE_VBAR )
            attrtype = tr( "Vbar (Specific Density)" );
         else if ( atype == US_dmGA_Constraints::ATYPE_CONC )
            attrtype = tr( "Signal Concentration" );
         else if ( atype == US_dmGA_Constraints::ATYPE_EXT  )
            attrtype = tr( "Extinction" );

//DbgLv(0) << "  cx" << cx << "attrtype" << attrtype;
         if ( floats )
         {
//DbgLv(0) << "      FLOATS";
            if ( logscl )
            {
//DbgLv(0) << "       LOGSCL";
               DbgLv(0) << "    " << attrtype << "floats from "
                        << vmin << "to" << vmax << "(log scale)";
            }
            else
            {
//DbgLv(0) << "       !LOGSCL";
               DbgLv(0) << "    " << attrtype << "floats from "
                        << vmin << "to" << vmax;
            }
         }
         else
         {
//DbgLv(0) << "      !FLOATS";
            DbgLv(0) << "    " << attrtype << "is fixed at "
                     << vmin;
         }
      }
   }

   for ( int assocx = 0; assocx < wmodel.associations.size(); assocx++ )
   {
      int compno  = assocx + 1;
      int nassoc  = constraints.assoc_constraints( assocx, &cnsv, NULL );
      int ncomp   = wmodel.associations[ assocx ].rcomps.size();

      DbgLv(0) << "  Reaction" << compno << ":";

      if ( ncomp == 2 )
      {
         DbgLv(0) << "    Reactant is component"
                  << wmodel.associations[ assocx ].rcomps[ 0 ] + 1
                  << ", Product is component"
                  << wmodel.associations[ assocx ].rcomps[ 1 ] + 1;
      }

      else
      {
         DbgLv(0) << "    Reactants are components"
                  << wmodel.associations[ assocx ].rcomps[ 0 ] + 1
                  << " and" << wmodel.associations[ assocx ].rcomps[ 1 ] + 1
                  << ", Product is component"
                  << wmodel.associations[ assocx ].rcomps[ 2 ] + 1;
      }

      for ( int rx = 0; rx < nassoc; rx++ )
      {
         atype       = cnsv[ rx ].atype;
         bool floats = cnsv[ rx ].floats;
         bool logscl = cnsv[ rx ].logscl;
         double vmin = cnsv[ rx ].low;
         double vmax = cnsv[ rx ].high;
         attrtype    = tr( "UNKNOWN" );

         if      ( atype == US_dmGA_Constraints::ATYPE_KD   )
            attrtype = tr( "K_Dissociation" );
         else if ( atype == US_dmGA_Constraints::ATYPE_KOFF )
            attrtype = tr( "k_Off Rate" );

         if ( floats )
         {
            if ( logscl )
            {
               DbgLv(0) << "    " << attrtype << "floats from "
                        << vmin << "to" << vmax << "(log scale)";
            }
            else
            {
               DbgLv(0) << "    " << attrtype << "floats from "
                        << vmin << "to" << vmax;
            }
         }
         else
         {
            DbgLv(0) << "    " << attrtype << "is fixed at "
                     << vmin;
         }
      }
   }
DbgLv(0) << " wmodel as1 K_d k_off" << wmodel.associations[0].k_d
 << wmodel.associations[0].k_off;

   Fitness empty_fitness;
   empty_fitness.fitness = LARGE;
   // Get base Gene and set up mutation controls
   dgene      = wmodel;
   nfloatc    = constraints.float_constraints( &cns_flt );
   nfvari     = ( 1 << nfloatc ) - 1;
   dgmarker.resize( nfloatc );
   do_astfem  = ( wmodel.components[ 0 ].sigma == 0.0  &&
                  wmodel.components[ 0 ].delta == 0.0  &&
                  wmodel.coSedSolute < 0  &&
                  data_sets[ 0 ]->compress == 0.0 );
   lfvari.fill( 0, nfvari );
//DbgLv(0) << " wmodel DUMP";
//wmodel.debug();

   // Initialize arrays
   for ( int ii = 0; ii < gcores_count; ii++ )
   {
      best_dgenes << dgene;

      empty_fitness.index = ii;
      best_fitness << empty_fitness;
   }

   QDateTime time = QDateTime::currentDateTime();

   // Handle Monte Carlo iterations.  There will always be at least 1.
   while ( true )
   {
      // Compute all generations of an MC iteration

      dmga_master_loop();

      // Get the best-fit gene

      qSort( best_fitness );
DbgLv(1) << "GaMast: EOML: fitness sorted  bfx" << best_fitness[0].index
         << "bestdg size" << best_dgenes.size();

      Fitness* bfit  = &best_fitness[ 0 ];
      DbgLv(0) << "Last generation best RMSD" << sqrt( bfit->fitness );

      if ( minimize_opt == 2 )
      {  // If gradient search method for all terminations, minimize now
         double aval;
         in_gsm         = true;
         double fitness = bfit->fitness;
         dgene          = best_dgenes[ bfit->index ];
         int nlim       = 0;

         bfit->fitness  = minimize_dmga( dgene, fitness );

         for ( int ii = 0; ii < nfloatc; ii++ )
         {  // Insure all the new gene attribute values are inside range
            US_dmGA_Constraints::AttribType
                 atype    = cns_flt[ ii ].atype;
            int  mcompx   = cns_flt[ ii ].mcompx;
            double vmin   = cns_flt[ ii ].low;
            double vmax   = cns_flt[ ii ].high;
            fetch_attr_value( aval, dgene, atype, mcompx );

            if ( aval < vmin  ||  aval > vmax )
            {
               aval          = qMax( vmin, qMin( vmax, aval ) );
               store_attr_value( aval, dgene, atype, mcompx );
               nlim++;
            }
         }

         if ( nlim > 0 )
         {  // If adjustments due to limits, recompute fitness
            bfit->fitness  = get_fitness_dmga( dgene );
         }

         DbgLv(0) << "Post-minimization RMSD" << sqrt( bfit->fitness );
         best_dgenes[ bfit->index ] = dgene;
         in_gsm         = false;
      }

      // Compute the variance (fitness) for the final best-fit model

DbgLv(1) << "GaMast: EOML: call calc_residuals";
      calc_residuals_dmga( 0, data_sets.size(), simulation_values, dgene );
DbgLv(1) << "GaMast: EOML: variance" << simulation_values.variance;

      // Output the model

      if ( data_sets.size() == 1 )
      {  // Output the single-data model
DbgLv(1) << "GaMast: EOML: CALL write_output";
         write_output();
      }
      else
      {  // Output the global model
         write_global();
      }

      // Handle any MonteCarlo iteration logic

DbgLv(1) << "GaMast:  mc_iter iters" << mc_iteration << mc_iterations;
      mc_iteration++;
      if ( mc_iterations > 1 )
      {
         qDebug() << "Fit RMSD" << sqrt( simulation_values.variance )
            << " of MC_Iteration" << mc_iteration;
         if ( mc_iteration < mc_iterations )
         {
            // Set scaled_data the first time
            if ( mc_iteration <= mgroup_count )
            {
               scaled_data = simulation_values.sim_data;
            }

            time_mc_iterations();

DbgLv(1) << "GaMast:    set_gaMC call";
            set_dmga_MonteCarlo();
DbgLv(1) << "GaMast:    set_gaMC  return";
         }
         else
            break;
      }
      else
      {
DbgLv(1) << "GaMast: FFrmsd: variance" << simulation_values.variance;
         qDebug() << "Final Fit RMSD" << sqrt( simulation_values.variance );
         break;
      }
   }

   DbgLv(0) << my_rank << ": Master signalling FINISHED to all Demes";

   // Report on the attribute values in the final model

   US_Model* fmodel = &data_sets[ 0 ]->model;
//*DEBUG
double vsum=0.0;
for (int ii=0; ii<simulation_values.sim_data.scanCount(); ii++)
 for (int jj=0; jj<simulation_values.sim_data.pointCount(); jj++ )
  vsum += sq(simulation_values.sim_data.value(ii,jj));
DbgLv(0) << "VSUM=" << vsum;
int hh=simulation_values.sim_data.pointCount()/2;
int ss=simulation_values.sim_data.scanCount();
DbgLv(0) << "SDAT 0-3"
 << simulation_values.sim_data.value(0,hh)
 << simulation_values.sim_data.value(1,hh)
 << simulation_values.sim_data.value(2,hh)
 << simulation_values.sim_data.value(3,hh);
DbgLv(0) << "SDAT *-n"
 << simulation_values.sim_data.value(ss-4,hh)
 << simulation_values.sim_data.value(ss-3,hh)
 << simulation_values.sim_data.value(ss-2,hh)
 << simulation_values.sim_data.value(ss-1,hh);
DbgLv(0) << "MDL comp1 s,k,w,D,f"
 << fmodel->components[0].s    / data_sets[0]->s20w_correction
 << fmodel->components[0].f_f0
 << fmodel->components[0].mw
 << fmodel->components[0].D    / data_sets[0]->D20w_correction
 << fmodel->components[0].f;
DbgLv(0) << "MDL comp2 s,k,w,D,f"
 << fmodel->components[1].s    / data_sets[0]->s20w_correction
 << fmodel->components[1].f_f0
 << fmodel->components[1].mw
 << fmodel->components[1].D    / data_sets[0]->D20w_correction
 << fmodel->components[1].f;
DbgLv(0) << "MDL asoc1 Kd,koff"
 << fmodel->associations[0].k_d
 << fmodel->associations[0].k_off;
DbgLv(0) << "DS dens visc manual temp"
 << data_sets[0]->density
 << data_sets[0]->viscosity
 << data_sets[0]->manual
 << data_sets[0]->temperature;
US_SimulationParameters* simpar = &data_sets[0]->simparams;
DbgLv(0) << "SIMP simpt mType gType rreso menis"
 << simpar->simpoints
 << simpar->meshType
 << simpar->gridType
 << simpar->radial_resolution
 << simpar->meniscus;
DbgLv(0) << "SIMP bott temp rnoise tinoise rinoise"
 << simpar->bottom
 << simpar->temperature
 << simpar->rnoise
 << simpar->tinoise
 << simpar->rinoise;
DbgLv(0) << "SIMP bform bvol bottpos rcoeffs"
 << simpar->band_forming
 << simpar->band_volume
 << simpar->bottom_position
 << simpar->rotorcoeffs[0]
 << simpar->rotorcoeffs[1];
US_SimulationParameters::SpeedProfile* spstep = &simpar->speed_step[0];
DbgLv(0) << "STEP0 durmin dlymin w2tf w2tl timf timl"
 << spstep->duration_minutes
 << spstep->delay_minutes
 << spstep->w2t_first
 << spstep->w2t_last
 << spstep->time_first
 << spstep->time_last;
DbgLv(0) << "STEP0 speed accel accelf"
 << spstep->rotorspeed
 << spstep->acceleration
 << spstep->acceleration_flag; 
//*DEBUG
   DbgLv(0) << fmodel->description;
   DbgLv(0) << " Final Model Attribute Values --";

   for ( int mcompx = 0; mcompx < fmodel->components.size(); mcompx++ )
   {
      int compno  = mcompx + 1;
      int ncompc  = constraints.comp_constraints( mcompx, &cnsv, NULL );

      DbgLv(0) << "  Component" << compno << ":";
//DbgLv(0) << "   mcompx" << mcompx << "ncompc" << ncompc;
//DbgLv(0) << "   at[n-2] at[n-1]" << cnsv[ncompc-2].atype << cnsv[ncompc-1].atype;

      for ( int cx = 0; cx < ncompc; cx++ )
      {
         atype       = cnsv[ cx ].atype;

         if      ( atype == US_dmGA_Constraints::ATYPE_S    )
            attrtype    = tr( "Segmentation Coefficient" );
         else if ( atype == US_dmGA_Constraints::ATYPE_FF0  )
            attrtype    = tr( "Frictional Ratio" );
         else if ( atype == US_dmGA_Constraints::ATYPE_MW   )
            attrtype    = tr( "Molecular Weight" );
         else if ( atype == US_dmGA_Constraints::ATYPE_D    )
            attrtype    = tr( "Diffusion Coefficient" );
         else if ( atype == US_dmGA_Constraints::ATYPE_F    )
            attrtype    = tr( "Frictional Coefficient" );
         else if ( atype == US_dmGA_Constraints::ATYPE_VBAR )
            attrtype    = tr( "Vbar (Specific Density)" );
         else if ( atype == US_dmGA_Constraints::ATYPE_CONC )
            attrtype    = tr( "Signal Concentration" );
         else if ( atype == US_dmGA_Constraints::ATYPE_EXT  )
            attrtype    = tr( "Extinction" );
         else
            attrtype    = tr( "Unknown" );

         double aval = constraints.fetch_attrib( fmodel->components[ mcompx ],
                                                 atype );
         DbgLv(0) << "    " << attrtype << "has a value of"
                  << aval;
      }
   }

   for ( int assocx = 0; assocx < fmodel->associations.size(); assocx++ )
   {
      int compno  = assocx + 1;
      int nassoc  = constraints.assoc_constraints( assocx, &cnsv, NULL );
      int ncomp   = fmodel->associations[ assocx ].rcomps.size();

      DbgLv(0) << "  Reaction" << compno << ":";

      if ( ncomp == 2 )
      {
         DbgLv(0) << "    Reactant is component"
                  << fmodel->associations[ assocx ].rcomps[ 0 ] + 1
                  << ", Product is component"
                  << fmodel->associations[ assocx ].rcomps[ 1 ] + 1;
      }

      else
      {
         DbgLv(0) << "    Reactants are components"
                  << fmodel->associations[ assocx ].rcomps[ 0 ] + 1
                  << " and" << fmodel->associations[ assocx ].rcomps[ 1 ] + 1
                  << ", Product is component"
                  << fmodel->associations[ assocx ].rcomps[ 2 ] + 1;
      }

      for ( int rx = 0; rx < nassoc; rx++ )
      {
         atype       = cnsv[ rx ].atype;

         if      ( atype == US_dmGA_Constraints::ATYPE_KD   )
            attrtype = tr( "K_Dissociation" );
         else if ( atype == US_dmGA_Constraints::ATYPE_KOFF )
            attrtype = tr( "k_Off Rate" );

         double aval = constraints.fetch_attrib( fmodel->associations[ assocx ],
                                                 atype );
         DbgLv(0) << "    " << attrtype << "has a value of"
                  << aval;
      }
   }

   MPI_Job job;

   // Send finish to workers ( in the tag )
   for ( int worker = 1; worker <= my_workers; worker++ )
   {
      MPI_Send( &job,              // MPI #0
                sizeof( job ),
                MPI_BYTE,
                worker,
                FINISHED,
                my_communicator );
   }            
}