Revision 785 branches/pthreads-737/src/linad99/fvar.hpp

fvar.hpp (revision 785)
8078 8078
  adstring get_string_marker(void);
8079 8079
  class adpvm_manager;
8080 8080
  class adtimer;
8081

  
8081
  /*
8082 8082
  class adpthreads_manager
8083 8083
  {
8084 8084
    static __ADMBTHREAD__ int slave_number;
......
8096 8096
    adpthreads_manager(int n) { slave_number=n;}
8097 8097
    adpthreads_manager(void) { slave_number=0;}
8098 8098
  };
8099
  */
8099 8100

  
8101
  // ******************************************************
8102
  // ******************************************************
8103
  // ******************************************************
8104
  // ******************************************************
8105
  class thread_data;
8106

  
8107
  class adpthread_manager
8108
  {
8109
    static __ADMBTHREAD__ int slave_number;
8110
  public:
8111
    static int is_slave(void) { if (slave_number)
8112
                                  return 1;
8113
                                else
8114
                                  return 0; }
8115
    static int is_master(void) { if (slave_number)
8116
                                  return 0;
8117
                                else
8118
                                  return 1; }
8119
    static int get_slave_number(void) { return slave_number; }
8120
    static void set_slave_number(int n) { slave_number=n; }
8121

  
8122
    char ** transfer_buffer;
8123
    char ** current_bptr;
8124
    char ** buffend;
8125
    int nslaves;
8126
    int bs;
8127
    int * mflag;
8128
    int * sflag;
8129
    ivector buffer_size;
8130
    pthread_mutex_t * smutex;
8131
    pthread_cond_t * scondition;
8132
    pthread_cond_t *mcondition;
8133
    pthread_t * thread1;  /* thread variables */
8134
    adpthread_manager(int ns,int bs);
8135
    void send_double_to_slave(const double &x,int sno);
8136
    void send_double_to_master(double &x,int sno);
8137
    double get_double_from_slave(int sno);
8138
    double get_double_from_master(int sno);
8139
    void send_dvariable_to_slave(const prevariable &x,int sno);
8140
    void send_dvariable_to_master(const prevariable &x,int sno);
8141
    dvariable get_dvariable_from_slave(int sno);
8142
    dvariable get_dvariable_from_master(int sno);
8143
    void send_dvector_to_slave(const dvector &x,int sno);
8144
    void send_dvector_to_master(const dvector &x,int sno);
8145
    dvector get_dvector_from_slave(int sno);
8146
    dvector get_dvector_from_master(int sno);
8147
    dvar_vector get_dvar_vector_from_slave(int sno);
8148
    dvar_vector get_dvar_vector_from_master(int sno);
8149
    void send_dvar_vector_to_slave(const dvar_vector &x,int sno);
8150
    void send_dvar_vector_to_master(const dvar_vector &x,int sno);
8151
    double get_double_from_master_nl(int sno);
8152
    //void send_dvar_vector_to_slave(const dvar_vector &x,int sno);
8153
    void writebuffer(const void *x,int nbytes,int sno);
8154
    void readbuffer(const void *x,int nbytes,int sno);
8155
    void pthread_join_all(void);
8156
    void create_all(void*f,thread_data * ptr);
8157
    void check_buffer_size(int, int);
8158
    void check_buffer_size_read(int, int);
8159
    void memcpy(const double &x,int sno);
8160
    void send_double_to_slave_nl(const double &x,int sno);
8161
    void read_lock_buffer_slave(int sno);
8162
    void write_lock_buffer_slave(int sno);
8163
    void read_lock_buffer_master(int sno);
8164
    void write_lock_buffer_master(int sno);
8165
    void read_unlock_buffer_slave(int sno);
8166
    void write_unlock_buffer_slave(int sno);
8167
    void read_unlock_buffer_master(int sno);
8168
    void write_unlock_buffer_master(int sno);
8169
    void adjoint_slave_write_unlock(int sno);
8170
    void adjoint_slave_write_lock(int sno);
8171
    void adjoint_master_write_lock(int sno);
8172
    void verify_id_string_from_master_nl(const char * s,int sno);
8173
    void send_id_string_to_slave_nl(const char * s,int sno);
8174
    void verify_id_string_from_slave_nl(const char * s,int sno);
8175
    void send_id_string_to_master_nl(const char * s,int sno);
8176
    void adjoint_send_dvariable_to_master(void);
8177
    void adjoint_get_dvariable_from_slave(void);
8178
    void adjoint_get_dvar_vector_from_master(void);
8179
    void adjoint_send_dvar_vector_to_slave(void);
8180
    void adjoint_write_unlock_buffer_master(void);
8181
    void adjoint_read_lock_buffer_master(void);
8182
    void adjoint_read_lock_buffer_slave(void);
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff