Revision 1233 branches/threaded2merge/src/linad99/thread_stuff.cpp

thread_stuff.cpp (revision 1233)
464 464
  ::memcpy(x,scurrent_bptr[s1][s2],nbytes);
465 465
  scurrent_bptr[s1][s2]+=nbytes;
466 466
}
467
void adpthread_manager::verify_id_string_from_master(const char * s,int sno)
467
void adpthread_manager::verify_id_string(const char * s,int sno)
468 468
{
469 469
#if defined(CHK_ID_STRING)
470 470
  char s1[10];
......
473 473
  readbuffer(s1,sz,sno);
474 474
  if (strcmp(s,s1))
475 475
  {
476
    cerr << "Error verifying master string " << s << endl;
476
    cerr << "Error verifying string " << s <<  "  got " << s1  << " instead" << endl;
477 477
    ad_exit(1);
478 478
  }
479 479
#endif
480 480
}
481
void adpthread_manager::verify_id_string_from_slave(const char * s,int sno)
482
{
483
#if defined(CHK_ID_STRING)
484
  char s1[10];
485
  int sz=strlen(s);
486
  s1[sz]='\0';
487
  readbuffer(s1,sz,sno);
488
  if (strcmp(s,s1))
489
  {
490
    cerr << "Error verifying slave string " << s <<  "  got " 
491
         << s1  << " instead" << endl;
492
    ad_exit(1);
493
  }
494
#endif
495
}
496 481
void adpthread_manager::send_double(const double &x,int sno)
497 482
{
498
  send_id_string_to_slave("TY",sno);
483
  send_id_string("TY",sno);
499 484
  writebuffer(&x,sizeof(double),sno);
500 485
}
501 486
void adpthread_manager::send_int(int x,int sno)
502 487
{
503
  send_id_string_to_slave("ES",sno);
488
  send_id_string("ES",sno);
504 489
  writebuffer(&x,sizeof(int),sno);
505 490
}
506 491
int adpthread_manager::get_int(int sno)
507 492
{
508
  verify_id_string_from_master("ES",sno);
493
  verify_id_string("ES",sno);
509 494
  int x;
510 495
  readbuffer(&x,sizeof(int),sno);
511 496
  return x;
512 497
}
513 498
double adpthread_manager::get_double(int sno)
514 499
{
515
  verify_id_string_from_master("TY",sno);
500
  verify_id_string("TY",sno);
516 501
  double x;
517 502
  readbuffer(&x,sizeof(double),sno);
518 503
  return x;
519 504
}
520
void adpthread_manager::send_id_string_to_slave(const char * x,int sno)
505
void adpthread_manager::send_id_string(const char * x,int sno)
521 506
{
522 507
#if defined(CHK_ID_STRING)
523 508
  int sz=strlen(x);
524 509
  writebuffer(x,sz,sno);
525 510
#endif
526 511
}
527
void adpthread_manager::send_id_string_to_master(const char * x,int sno)
512
void adjoint_get_dvar_vector(void)
528 513
{
529
#if defined(CHK_ID_STRING)
530
  int sz=strlen(x);
531
  writebuffer(x,sz,sno);
532
#endif
533
}
534
void adjoint_get_dvar_vector_from_master(void)
535
{
536 514
  verify_identifier_string("D4");
537 515
  adpthread_manager * ptr=(adpthread_manager*)(restore_pointer_value());
538
  ptr->adjoint_get_dvar_vector_from_master();
516
  ptr->adjoint_get_dvar_vector();
539 517
}
540
void adpthread_manager::adjoint_get_dvar_vector_from_master(void)
518
void adpthread_manager::adjoint_get_dvar_vector(void)
541 519
{
542 520
  verify_identifier_string("K6");
543 521
  int sno=restore_int_value();
544 522
  verify_identifier_string("Y7");
545 523
  dvar_vector_position dvpos=restore_dvar_vector_position();
546 524
  verify_identifier_string("C");
547
  send_id_string_to_master("SUX",sno);
525
  send_id_string("SUX",sno);
548 526
  dvector dv=restore_dvar_vector_derivatives(dvpos);
549 527
  int mmin=dv.indexmin();
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff