summaryrefslogtreecommitdiffstats
path: root/tksao
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2019-03-15 21:02:59 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2019-03-15 21:02:59 (GMT)
commit97188ea8de794e7604ca7398418ed4aadaadb46b (patch)
tree4ef4bc8fdb9d0f4cfbfad9f315fff7676bbbcef1 /tksao
parent9d8e9f68356e5c054e2c54513fe05eb56d809329 (diff)
downloadblt-97188ea8de794e7604ca7398418ed4aadaadb46b.zip
blt-97188ea8de794e7604ca7398418ed4aadaadb46b.tar.gz
blt-97188ea8de794e7604ca7398418ed4aadaadb46b.tar.bz2
thread contour
Diffstat (limited to 'tksao')
-rw-r--r--tksao/frame/context.C3
-rw-r--r--tksao/frame/fitsanalysis.C41
-rw-r--r--tksao/frame/fitsimage.h16
-rw-r--r--tksao/util/convolve.C8
-rw-r--r--tksao/util/convolve.h13
5 files changed, 37 insertions, 44 deletions
diff --git a/tksao/frame/context.C b/tksao/frame/context.C
index fb97996..4fe3245 100644
--- a/tksao/frame/context.C
+++ b/tksao/frame/context.C
@@ -17,6 +17,7 @@
#include "socket.h"
#include "socketgz.h"
#include "var.h"
+#include "convolve.h"
#include "head.h"
@@ -115,7 +116,7 @@ void Context::analysis()
if (thread_)
delete [] thread_;
thread_ = new pthread_t[parent_->nthreads_];
- t_smooth_arg* targ = new t_smooth_arg[parent_->nthreads_];
+ t_convolve_arg* targ = new t_convolve_arg[parent_->nthreads_];
int cnt =0;
FitsImage* ptr = fits;
diff --git a/tksao/frame/fitsanalysis.C b/tksao/frame/fitsanalysis.C
index 283b185..ce6e816 100644
--- a/tksao/frame/fitsanalysis.C
+++ b/tksao/frame/fitsanalysis.C
@@ -9,21 +9,11 @@
#include "context.h"
#include "convolve.h"
-void FitsImage::analysis(int which, pthread_t* thread, t_smooth_arg* targ)
+void FitsImage::analysis(int which, pthread_t* thread, void* targ)
{
if (DebugPerf)
cerr << "FitsImage::analysis()" << endl;
- targ->kernel =NULL;
- targ->src =NULL;
- targ->dest =NULL;
- targ->xmin =0;
- targ->xmax =0;
- targ->ymin =0;
- targ->ymax =0;
- targ->width =0;
- targ->r =0;
-
if (manageAnalysis_) {
if (analysis_)
delete analysis_;
@@ -52,15 +42,7 @@ void FitsImage::analysis(int which, pthread_t* thread, t_smooth_arg* targ)
data_ = analysisdata_;
}
-void* convolveThread(void* vv)
-{
- t_smooth_arg* tt = (t_smooth_arg*)vv;
- convolve(tt->kernel, tt->src, tt->dest,
- tt->xmin, tt->ymin, tt->xmax, tt->ymax, tt->width, tt->r);
- return NULL;
-}
-
-void FitsImage::smooth(pthread_t* thread, t_smooth_arg* targ)
+void FitsImage::smooth(pthread_t* thread, void* targ)
{
FitsBound* params = getDataParams(context_->secMode());
int width = analysis_->head()->naxis(0);
@@ -96,15 +78,16 @@ void FitsImage::smooth(pthread_t* thread, t_smooth_arg* targ)
}
// convolve
- targ->kernel = kernel;
- targ->src = src;
- targ->dest = dest;
- targ->xmin = params->xmin;
- targ->xmax = params->xmax;
- targ->ymin = params->ymin;
- targ->ymax = params->ymax;
- targ->width = width;
- targ->r = context_->smoothRadius();
+ t_convolve_arg* tt = (t_convolve_arg*)targ;
+ tt->kernel = kernel;
+ tt->src = src;
+ tt->dest = dest;
+ tt->xmin = params->xmin;
+ tt->xmax = params->xmax;
+ tt->ymin = params->ymin;
+ tt->ymax = params->ymax;
+ tt->width = width;
+ tt->r = context_->smoothRadius();
int result = pthread_create(thread, NULL, convolveThread, targ);
if (result)
diff --git a/tksao/frame/fitsimage.h b/tksao/frame/fitsimage.h
index ec95573..76680c3 100644
--- a/tksao/frame/fitsimage.h
+++ b/tksao/frame/fitsimage.h
@@ -18,18 +18,6 @@
#define MULTWCSA 28
typedef struct {
- double* kernel;
- double* src;
- double* dest;
- int xmin;
- int ymin;
- int xmax;
- int ymax;
- int width;
- int r;
-} t_smooth_arg;
-
-typedef struct {
FitsFile* base;
FitsData* basedata;
FitsFile* block;
@@ -146,7 +134,7 @@ class FitsImage {
protected:
void reset();
Vector getHistCenter();
- void smooth(pthread_t*, t_smooth_arg*);
+ void smooth(pthread_t*, void*);
void process(const char*, int);
void initCompress();
void initNRRD();
@@ -289,7 +277,7 @@ class FitsImage {
void setContext(Context* cx) {context_ = cx;}
void load();
- void analysis(int, pthread_t*, t_smooth_arg*);
+ void analysis(int, pthread_t*, void*);
void block();
void block(pthread_t*);
diff --git a/tksao/util/convolve.C b/tksao/util/convolve.C
index d09a69e..4ba83fa 100644
--- a/tksao/util/convolve.C
+++ b/tksao/util/convolve.C
@@ -83,6 +83,14 @@ double* gaussian(int k, double ss)
return kernel;
}
+void* convolveThread(void* vv)
+{
+ t_convolve_arg* tt = (t_convolve_arg*)vv;
+ convolve(tt->kernel, tt->src, tt->dest,
+ tt->xmin, tt->ymin, tt->xmax, tt->ymax, tt->width, tt->r);
+ return NULL;
+}
+
double* elliptic(int k, int rm, double ss, double sm, double aa)
{
int kk = 2*k+1;
diff --git a/tksao/util/convolve.h b/tksao/util/convolve.h
index 637cf97..d8d240c 100644
--- a/tksao/util/convolve.h
+++ b/tksao/util/convolve.h
@@ -5,11 +5,24 @@
#ifndef __convolve_h__
#define __convolve_h__
+typedef struct {
+ double* kernel;
+ double* src;
+ double* dest;
+ int xmin;
+ int ymin;
+ int xmax;
+ int ymax;
+ int width;
+ int r;
+} t_convolve_arg;
+
double* boxcar(int r);
double* tophat(int r);
double* gaussian(int r, double sigma);
double* elliptic(int r, int m, double ss, double sm, double aa);
+void* convolveThread(void* vv);
void* convolve(double* kernel, double* src, double* dest,
int xmin, int ymin, int xmax, int ymax, int width, int k);