diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2019-03-19 14:35:02 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2019-03-19 14:35:02 (GMT) |
commit | c31bd7553b6efd2407fc521dc14aec1936e3cbf0 (patch) | |
tree | 0b2c355180c8efb3c61462fa6339221fd6613639 /tksao/frame | |
parent | a333433ba1d8e160950c9662088be3d3de3b6018 (diff) | |
download | blt-c31bd7553b6efd2407fc521dc14aec1936e3cbf0.zip blt-c31bd7553b6efd2407fc521dc14aec1936e3cbf0.tar.gz blt-c31bd7553b6efd2407fc521dc14aec1936e3cbf0.tar.bz2 |
thread contour
Diffstat (limited to 'tksao/frame')
-rw-r--r-- | tksao/frame/context.C | 78 | ||||
-rw-r--r-- | tksao/frame/context.h | 3 | ||||
-rw-r--r-- | tksao/frame/frame3dbase.C | 4 | ||||
-rw-r--r-- | tksao/frame/framebase.C | 2 |
4 files changed, 37 insertions, 50 deletions
diff --git a/tksao/frame/context.C b/tksao/frame/context.C index 49fbc1c..5310824 100644 --- a/tksao/frame/context.C +++ b/tksao/frame/context.C @@ -386,13 +386,43 @@ void Context::contourCreateFV(const char* color, int width, int dash, if (!ptr) return; + fvcontour_.create(parent_, ptr, &fr, + color, width, dash, method, numlevel, smooth, level); + contourThreadFV(ptr); + hasContour_ =1; +} + +void Context::contourUpdateFV() +{ + if (!cfits) + return; + + if (!hasContour_) + return; + + switch (fvcontour_.frScale()->clipScope()) { + case FrScale::GLOBAL: + break; + case FrScale::LOCAL: + updateClip(fvcontour_.frScale()); + break; + } + + FitsImage* ptr = isMosaic() ? fits : cfits; + if (!ptr) + return; + + fvcontour_.update(ptr); + contourThreadFV(ptr); +} + +void Context::contourThreadFV(FitsImage* ptr) +{ if (thread_) delete [] thread_; thread_ = new pthread_t[parent_->nthreads_]; t_fvcontour_arg* targ = new t_fvcontour_arg[parent_->nthreads_]; - fvcontour_.create(parent_, ptr, &fr, - color, width, dash, method, numlevel, smooth, level); int cnt =0; while (ptr) { fvcontour_.append(ptr, &thread_[cnt], &targ[cnt]); @@ -438,8 +468,6 @@ void Context::contourCreateFV(const char* color, int width, int dash, delete [] targ; delete [] thread_; thread_ =NULL; - - hasContour_ =1; } void Context::contourDeleteFV() @@ -2667,48 +2695,6 @@ void Context::updateClipLocal(FrScale* fr) } } -void Context::updateContours() -{ - if (!cfits) - return; - - if (!hasContour_) - return; - - switch (fvcontour_.frScale()->clipScope()) { - case FrScale::GLOBAL: - break; - case FrScale::LOCAL: - updateClip(fvcontour_.frScale()); - break; - } - - fvcontour_.update(cfits); - if (thread_) - delete [] thread_; - thread_ = new pthread_t[1]; - t_fvcontour_arg* targ = new t_fvcontour_arg[1]; - - fvcontour_.append(cfits, &thread_[0], &targ[0]); - - int rr = pthread_join(thread_[0], NULL); - if (rr) - internalError("Unable to Join Thread"); - - fvcontour_.append(targ[0].lcl); - - if (targ[0].lcl) - delete targ[0].lcl; - if (targ[0].src) - delete [] targ[0].src; - if (targ[0].dest) - delete [] targ[0].dest; - - delete [] targ; - delete [] thread_; - thread_ =NULL; -} - void Context::updateContours(const Matrix& mx) { if (!cfits) diff --git a/tksao/frame/context.h b/tksao/frame/context.h index b7340bf..e7fe647 100644 --- a/tksao/frame/context.h +++ b/tksao/frame/context.h @@ -90,6 +90,7 @@ class Context { void updateClipGlobal(FrScale*); void updateClipLocal(FrScale*); + void contourThreadFV(FitsImage*); void contourList(ostream&, Coord::CoordSystem, Coord::SkyFrame, List<ContourLevel>&); @@ -134,6 +135,7 @@ class Context { FrScale::ClipMode clipMode, float, FrScale::ClipScope clipScope, double low, double high, const char* level); + void contourUpdateFV(); void contourDeleteFV(); void contourDeleteAux(); void contourListFV(ostream&, Coord::CoordSystem, Coord::SkyFrame); @@ -235,7 +237,6 @@ class Context { void updateBinFileNames(); void clearHist(); void updateClip(); - void updateContours(); void updateContours(const Matrix&); void updateSlice(int, int); diff --git a/tksao/frame/frame3dbase.C b/tksao/frame/frame3dbase.C index 90ee455..d993b50 100644 --- a/tksao/frame/frame3dbase.C +++ b/tksao/frame/frame3dbase.C @@ -725,7 +725,7 @@ void Frame3dBase::setSlice(int id, int ss) currentContext->updateSlice(id, ss); if (id==2) { - currentContext->updateContours(); + currentContext->contourUpdateFV(); update(PIXMAP); } else { @@ -733,7 +733,7 @@ void Frame3dBase::setSlice(int id, int ss) currentContext->clearHist(); currentContext->updateClip(); - currentContext->updateContours(); + currentContext->contourUpdateFV(); updateColorScale(); update(MATRIX); } diff --git a/tksao/frame/framebase.C b/tksao/frame/framebase.C index ec8a06c..693fe36 100644 --- a/tksao/frame/framebase.C +++ b/tksao/frame/framebase.C @@ -265,7 +265,7 @@ void FrameBase::setSlice(int id, int ss) break; } - currentContext->updateContours(); + currentContext->contourUpdateFV(); updateColorScale(); update(MATRIX); |