Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
nifty_gridder
Commits
bcfb7c6a
Commit
bcfb7c6a
authored
Oct 01, 2019
by
Martin Reinecke
Browse files
factor out min/max computation for w; tweak beta values
parent
8e2ad904
Changes
1
Hide whitespace changes
Inline
Side-by-side
gridder_cxx.h
View file @
bcfb7c6a
...
...
@@ -375,7 +375,7 @@ class ES_Kernel
public:
ES_Kernel
(
size_t
supp_
,
size_t
nthreads
)
:
beta
(
2.3
*
supp_
),
p
(
int
(
1.5
*
supp_
+
2
)),
supp
(
supp_
)
:
beta
(
get_beta
(
supp_
)
*
supp_
),
p
(
int
(
1.5
*
supp_
+
2
)),
supp
(
supp_
)
{
legendre_prep
(
2
*
p
,
x
,
wgt
,
nthreads
);
psi
=
x
;
...
...
@@ -392,16 +392,24 @@ class ES_Kernel
tmp
+=
wgt
[
i
]
*
psi
[
i
]
*
cos
(
pi
*
supp
*
v
*
x
[
i
]);
return
1.
/
(
supp
*
tmp
);
}
static
double
get_beta
(
size_t
supp
)
{
static
const
vector
<
double
>
opt_beta
{
-
1
,
0.14
,
1.70
,
2.08
,
2.205
,
2.26
,
2.29
,
2.307
,
2.316
,
2.3265
,
2.3324
,
2.282
,
2.294
,
2.304
,
2.3138
,
2.317
};
myassert
(
supp
<
opt_beta
.
size
(),
"bad support size"
);
return
opt_beta
[
supp
];
}
static
size_t
get_supp
(
double
epsilon
)
{
static
const
vector
<
double
>
maxmaperr
{
1e8
,
0.
32
,
0.021
,
6.2
e-
4
,
1.
08
e-
5
,
1.25
e-
7
,
8.2
5e-10
,
5.
70
e-12
,
1.22
e-1
3
,
2.48
e-15
,
4.82
e-17
,
6.74
e-19
,
5.41
e-21
,
4.41
e-23
,
7.88
e-25
,
3.9
e-2
6
};
static
const
vector
<
double
>
maxmaperr
{
1e8
,
0.
19
,
2.98e-3
,
5.98
e-
5
,
1.
11
e-
6
,
2.01
e-
8
,
3.5
5e-10
,
5.
31
e-12
,
8.81
e-1
4
,
1.34
e-15
,
2.17
e-17
,
2.12
e-19
,
2.88
e-21
,
3.92
e-23
,
8.21
e-25
,
7.13
e-2
7
};
double
epssq
=
epsilon
*
epsilon
;
for
(
size_t
i
=
1
;
i
<
maxmaperr
.
size
();
++
i
)
if
(
epssq
>
maxmaperr
[
i
])
return
i
;
myfail
(
"requested epsilon too small - minimum is
2
e-13"
);
myfail
(
"requested epsilon too small - minimum is
1
e-13"
);
}
};
...
...
@@ -552,7 +560,7 @@ class GridderConfig
psx
(
pixsize_x
),
psy
(
pixsize_y
),
supp
(
ES_Kernel
::
get_supp
(
epsilon
)),
nsafe
((
supp
+
1
)
/
2
),
nu
(
max
(
2
*
nsafe
,
2
*
nx_dirty
)),
nv
(
max
(
2
*
nsafe
,
2
*
ny_dirty
)),
beta
(
2.3
*
supp
),
beta
(
ES_Kernel
::
get_beta
(
supp
)
*
supp
),
cfu
(
nx_dirty
),
cfv
(
ny_dirty
),
nthreads
(
nthreads_
),
ushift
(
supp
*
(
-
0.5
)
+
1
+
nu
),
vshift
(
supp
*
(
-
0.5
)
+
1
+
nv
),
maxiu0
((
nu
+
nsafe
)
-
supp
),
maxiv0
((
nv
+
nsafe
)
-
supp
)
...
...
@@ -1214,16 +1222,14 @@ template<typename T> void apply_wcorr(const GridderConfig &gconf,
}
}
template
<
typename
Serv
>
void
wstack_common
(
const
GridderConfig
&
gconf
,
const
Serv
&
srv
,
double
&
wmin
,
double
&
dw
,
size_t
&
nplanes
,
vector
<
size_t
>
&
nvis_plane
,
vector
<
int
>
&
minplane
,
size_t
verbosity
)
template
<
typename
Serv
>
void
wminmax
(
const
GridderConfig
&
gconf
,
const
Serv
&
srv
,
double
&
wmin
,
double
&
wmax
)
{
size_t
nvis
=
srv
.
Nvis
();
size_t
nthreads
=
gconf
.
Nthreads
();
wmin
=
1e38
;
double
wmax
=-
1e38
;
wmin
=
1e38
;
wmax
=-
1e38
;
// FIXME maybe this can be done more intelligently
#pragma omp parallel for num_threads(nthreads) reduction(min:wmin) reduction(max:wmax)
for
(
size_t
ipart
=
0
;
ipart
<
nvis
;
++
ipart
)
...
...
@@ -1232,6 +1238,18 @@ template<typename Serv> void wstack_common(
wmin
=
min
(
wmin
,
wval
);
wmax
=
max
(
wmax
,
wval
);
}
}
template
<
typename
Serv
>
void
wstack_common
(
const
GridderConfig
&
gconf
,
const
Serv
&
srv
,
double
&
wmin
,
double
&
dw
,
size_t
&
nplanes
,
vector
<
size_t
>
&
nvis_plane
,
vector
<
int
>
&
minplane
,
size_t
verbosity
)
{
size_t
nvis
=
srv
.
Nvis
();
size_t
nthreads
=
gconf
.
Nthreads
();
double
wmax
;
wminmax
(
gconf
,
srv
,
wmin
,
wmax
);
if
(
verbosity
>
0
)
cout
<<
"Using "
<<
nthreads
<<
" threads"
<<
endl
;
if
(
verbosity
>
0
)
cout
<<
"W range: "
<<
wmin
<<
" to "
<<
wmax
<<
endl
;
double
x0
=
-
0.5
*
gconf
.
Nxdirty
()
*
gconf
.
Pixsize_x
(),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment