Changeset bbfad0a in sasview for realSpaceModeling


Ignore:
Timestamp:
Mar 6, 2008 8:27:48 AM (16 years ago)
Author:
Mathieu Doucet <doucetm@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
914caf52
Parents:
c510183
Message:

Updated realSpaceModeling to be thread-friendly

Location:
realSpaceModeling/pointsmodelpy
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • realSpaceModeling/pointsmodelpy/libpointsmodelpy/points_model.cc

    r41e8114 rbbfad0a  
    159159    } 
    160160  } 
    161  
     161   
    162162  //normalize Pr 
    163163  for (int j = 0; j != sizeofpr; ++j){           //final column2 for P(r) 
  • realSpaceModeling/pointsmodelpy/pointsmodelpymodule/misc.cc

    r41e8114 rbbfad0a  
    274274  LORESModel * thislores = static_cast<LORESModel *>(temp); 
    275275 
     276  Py_BEGIN_ALLOW_THREADS 
    276277  vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2); 
    277278  thislores->DistDistributionXY(*thisvec); 
    278  
     279  Py_END_ALLOW_THREADS 
     280   
    279281  return Py_BuildValue("i", 0); 
    280282} 
     
    314316  vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2); 
    315317 
     318  Py_BEGIN_ALLOW_THREADS 
    316319  PDBModel * thispdb = static_cast<PDBModel *>(temp); 
    317320  thispdb->DistDistribution(*thisvec); 
    318  
     321  Py_END_ALLOW_THREADS 
     322   
    319323  return Py_BuildValue("i", 0); 
    320324} 
     
    335339 
    336340  ComplexModel * thiscomplex = static_cast<ComplexModel *>(temp); 
     341  Py_BEGIN_ALLOW_THREADS 
    337342  thiscomplex->DistDistribution(*thisvec); 
    338  
     343  Py_END_ALLOW_THREADS 
    339344  return Py_BuildValue("i", 0); 
    340345} 
     
    356361  IQ * thisiq = static_cast<IQ *>(temp2); 
    357362 
     363  Py_BEGIN_ALLOW_THREADS 
    358364  thislores->CalculateIQ(thisiq); 
    359  
     365  Py_END_ALLOW_THREADS 
     366   
    360367  return Py_BuildValue("i",0); 
    361368} 
     
    375382 
    376383  LORESModel * thislores = static_cast<LORESModel *>(temp); 
    377  
    378   double I = thislores->CalculateIQ(q); 
    379  
     384   
     385  double I = 0.0; 
     386  Py_BEGIN_ALLOW_THREADS 
     387  I = thislores->CalculateIQ(q); 
     388  Py_END_ALLOW_THREADS 
     389   
    380390  return Py_BuildValue("d",I); 
    381391} 
     
    397407  LORESModel * thislores = static_cast<LORESModel *>(temp); 
    398408  IQ * thisiq = static_cast<IQ *>(temp2); 
    399  
     409   
     410  Py_BEGIN_ALLOW_THREADS 
    400411  thislores->CalculateIQ_2D(thisiq,theta); 
    401  
     412  Py_END_ALLOW_THREADS 
     413   
    402414  return Py_BuildValue("i",0); 
    403415} 
     
    418430  void *temp = PyCObject_AsVoidPtr(pylores); 
    419431  LORESModel * thislores = static_cast<LORESModel *>(temp); 
    420  
     432   
     433  Py_BEGIN_ALLOW_THREADS 
    421434  I = thislores->CalculateIQ_2D(qx,qy); 
    422  
     435  Py_END_ALLOW_THREADS 
     436   
    423437  return Py_BuildValue("d",I); 
    424438} 
     
    442456  vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2); 
    443457   
     458  Py_BEGIN_ALLOW_THREADS 
    444459  I = thislores->CalculateIQ_2D(*thisvec, qx,qy); 
    445  
     460  Py_END_ALLOW_THREADS 
     461   
    446462  return Py_BuildValue("d",I); 
    447463} 
     
    463479  IQ * thisiq = static_cast<IQ *>(temp2); 
    464480 
     481  Py_BEGIN_ALLOW_THREADS 
    465482  thispdb->CalculateIQ(thisiq); 
    466  
     483  Py_END_ALLOW_THREADS 
     484   
    467485  return Py_BuildValue("i",0); 
    468486} 
     
    484502  PDBModel * thispdb = static_cast<PDBModel *>(temp); 
    485503 
     504  Py_BEGIN_ALLOW_THREADS 
    486505  I = thispdb->CalculateIQ_2D(qx,qy); 
    487  
     506  Py_END_ALLOW_THREADS 
     507   
    488508  return Py_BuildValue("d",I); 
    489509} 
     
    507527  vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2); 
    508528 
     529  Py_BEGIN_ALLOW_THREADS 
    509530  I = thispdb->CalculateIQ_2D(*thisvec,qx,qy); 
    510  
     531  Py_END_ALLOW_THREADS 
     532   
    511533  return Py_BuildValue("d",I); 
    512534} 
     
    528550  IQ * thisiq = static_cast<IQ *>(temp2); 
    529551 
     552  Py_BEGIN_ALLOW_THREADS 
    530553  thiscomplex->CalculateIQ(thisiq); 
    531  
     554  Py_END_ALLOW_THREADS 
     555   
    532556  return Py_BuildValue("i",0); 
    533557} 
     
    549573  vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2); 
    550574 
    551   double I = thiscomplex->CalculateIQ_2D(*thisvec,qx,qy); 
    552  
     575  double I = 0.0; 
     576  Py_BEGIN_ALLOW_THREADS 
     577  I = thiscomplex->CalculateIQ_2D(*thisvec,qx,qy); 
     578  Py_END_ALLOW_THREADS 
     579   
    553580  return Py_BuildValue("d",I); 
    554581} 
     
    570597  vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2); 
    571598 
    572   double I = thiscomplex->CalculateIQ_2D_Error(*thisvec,qx,qy); 
    573  
     599  double I = 0.0; 
     600  Py_BEGIN_ALLOW_THREADS 
     601  I = thiscomplex->CalculateIQ_2D_Error(*thisvec,qx,qy); 
     602  Py_END_ALLOW_THREADS 
     603   
    574604  return Py_BuildValue("d",I); 
    575605} 
     
    589619 
    590620  ComplexModel * thiscomplex = static_cast<ComplexModel *>(temp); 
    591  
    592   double I = thiscomplex->CalculateIQ(q); 
    593  
     621   
     622  double I = 0.0; 
     623  Py_BEGIN_ALLOW_THREADS 
     624  I = thiscomplex->CalculateIQ(q); 
     625  Py_END_ALLOW_THREADS 
     626   
    594627  return Py_BuildValue("d",I); 
    595628} 
     
    609642  ComplexModel * thiscomplex = static_cast<ComplexModel *>(temp); 
    610643 
    611   double I = thiscomplex->CalculateIQError(q); 
    612  
     644  double I = 0.0; 
     645  Py_BEGIN_ALLOW_THREADS 
     646  I = thiscomplex->CalculateIQError(q); 
     647  Py_END_ALLOW_THREADS 
     648   
    613649  return Py_BuildValue("d",I); 
    614650} 
Note: See TracChangeset for help on using the changeset viewer.