Exemple #1
0
/* ENTRY POINT */
int
target_slave_post(                 /* RETURN: -- 0 - OK, 1 - Error.     */
   TCDevice            * tc_dev,   /* INOUT: -- Iteration comm device.  */
   TargetBodyInit      * init,     /* INOUT: -- Target init state data. */
   TargetBodyState     * state,    /* INOUT: -- Target body state data. */
   TargetBodyData      * target,   /* INOUT: -- Targetting data.        */
   TargetBodyIteration * iterate ) /* INOUT: -- Iteration control data. */
{
   int dv_ret;

   /* Copy the initial state. */
   V_COPY( iterate->v_init, init->velocity );

   /* Call the delta-V computation. */
   dv_ret = target_delta_v( state, target, iterate );

   /* Send F(x) - which is in TargetBodyIteration. */ 
   tc_write( mc_get_connection_device(), (char*)iterate, sizeof(TargetBodyIteration) );

   /* Return to calling function. */
   return( dv_ret );
}
Exemple #2
0
int cannon_post_master(
  CANNON_AERO* C,
  AMOEBA* A )
{
        CANNON_AERO C_curr ;

        // remove warning about unused parameter C
        (void)C ;

        /* Read slave's results */
        tc_read( mc_get_connection_device(),(char*) &C_curr, sizeof(CANNON_AERO) );

        fprintf(stderr, "%03d> F(", mc_get_current_run());
        amoeba_print_point(4, A->curr_point) ;
        fprintf(stderr, "= %.6lf\n", C_curr.pos[0]);

        /*
         * Load function result for either:
         * simplex vertice, centroid, reflection, contraction or expansion point
         */
        A->curr_point[A->num_dims] = C_curr.pos[0] ;

        return(0) ;
}