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
Simon Perkins
ducc
Commits
a7c3d242
Commit
a7c3d242
authored
Jan 20, 2020
by
Martin Reinecke
Browse files
avoid copying std::any
parent
e1ddc187
Changes
5
Hide whitespace changes
Inline
Side-by-side
libsharp2/sharp.h
View file @
a7c3d242
...
...
@@ -52,9 +52,9 @@ class sharp_geom_info
virtual
double
phi0
(
size_t
iring
)
const
=
0
;
virtual
Tpair
pair
(
size_t
ipair
)
const
=
0
;
virtual
void
clear_map
(
std
::
any
map
)
const
=
0
;
virtual
void
get_ring
(
bool
weighted
,
size_t
iring
,
std
::
any
map
,
double
*
ringtmp
)
const
=
0
;
virtual
void
add_ring
(
bool
weighted
,
size_t
iring
,
const
double
*
ringtmp
,
std
::
any
map
)
const
=
0
;
virtual
void
clear_map
(
const
std
::
any
&
map
)
const
=
0
;
virtual
void
get_ring
(
bool
weighted
,
size_t
iring
,
const
std
::
any
&
map
,
double
*
ringtmp
)
const
=
0
;
virtual
void
add_ring
(
bool
weighted
,
size_t
iring
,
const
double
*
ringtmp
,
const
std
::
any
&
map
)
const
=
0
;
};
/*! \defgroup almgroup Helpers for dealing with a_lm */
...
...
@@ -68,9 +68,9 @@ class sharp_alm_info
virtual
size_t
mmax
()
const
=
0
;
virtual
size_t
nm
()
const
=
0
;
virtual
size_t
mval
(
size_t
i
)
const
=
0
;
virtual
void
clear_alm
(
std
::
any
alm
)
const
=
0
;
virtual
void
get_alm
(
size_t
mi
,
std
::
any
alm
,
std
::
complex
<
double
>
*
almtmp
,
size_t
nalm
)
const
=
0
;
virtual
void
add_alm
(
size_t
mi
,
const
std
::
complex
<
double
>
*
almtmp
,
std
::
any
alm
,
size_t
nalm
)
const
=
0
;
virtual
void
clear_alm
(
const
std
::
any
&
alm
)
const
=
0
;
virtual
void
get_alm
(
size_t
mi
,
const
std
::
any
&
alm
,
std
::
complex
<
double
>
*
almtmp
,
size_t
nalm
)
const
=
0
;
virtual
void
add_alm
(
size_t
mi
,
const
std
::
complex
<
double
>
*
almtmp
,
const
std
::
any
&
alm
,
size_t
nalm
)
const
=
0
;
};
/*! \} */
...
...
libsharp2/sharp_almhelpers.cc
View file @
a7c3d242
...
...
@@ -60,7 +60,7 @@ template<typename T> void sharp_standard_alm_info::tclear (T *alm) const
for
(
size_t
l
=
mval_
[
mi
];
l
<=
lmax_
;
++
l
)
reinterpret_cast
<
T
*>
(
alm
)[
mvstart
[
mi
]
+
l
*
stride
]
=
0.
;
}
void
sharp_standard_alm_info
::
clear_alm
(
std
::
any
alm
)
const
void
sharp_standard_alm_info
::
clear_alm
(
const
any
&
alm
)
const
{
if
(
alm
.
type
()
==
typeid
(
dcmplx
*
))
tclear
(
any_cast
<
dcmplx
*>
(
alm
));
else
if
(
alm
.
type
()
==
typeid
(
fcmplx
*
))
tclear
(
any_cast
<
fcmplx
*>
(
alm
));
...
...
@@ -71,7 +71,7 @@ template<typename T> void sharp_standard_alm_info::tget(size_t mi, const T *alm,
for
(
auto
l
=
mval_
[
mi
];
l
<=
lmax_
;
++
l
)
almtmp
[
nalm
*
l
]
=
alm
[
mvstart
[
mi
]
+
l
*
stride
];
}
void
sharp_standard_alm_info
::
get_alm
(
size_t
mi
,
any
alm
,
dcmplx
*
almtmp
,
size_t
nalm
)
const
void
sharp_standard_alm_info
::
get_alm
(
size_t
mi
,
const
any
&
alm
,
dcmplx
*
almtmp
,
size_t
nalm
)
const
{
if
(
alm
.
type
()
==
typeid
(
dcmplx
*
))
tget
(
mi
,
any_cast
<
dcmplx
*>
(
alm
),
almtmp
,
nalm
);
else
if
(
alm
.
type
()
==
typeid
(
const
dcmplx
*
))
tget
(
mi
,
any_cast
<
const
dcmplx
*>
(
alm
),
almtmp
,
nalm
);
...
...
@@ -84,7 +84,7 @@ template<typename T> void sharp_standard_alm_info::tadd(size_t mi, const dcmplx
for
(
auto
l
=
mval_
[
mi
];
l
<=
lmax_
;
++
l
)
alm
[
mvstart
[
mi
]
+
l
*
stride
]
+=
T
(
almtmp
[
nalm
*
l
]);
}
void
sharp_standard_alm_info
::
add_alm
(
size_t
mi
,
const
dcmplx
*
almtmp
,
any
alm
,
size_t
nalm
)
const
void
sharp_standard_alm_info
::
add_alm
(
size_t
mi
,
const
dcmplx
*
almtmp
,
const
any
&
alm
,
size_t
nalm
)
const
{
if
(
alm
.
type
()
==
typeid
(
dcmplx
*
))
tadd
(
mi
,
almtmp
,
any_cast
<
dcmplx
*>
(
alm
),
nalm
);
else
if
(
alm
.
type
()
==
typeid
(
fcmplx
*
))
tadd
(
mi
,
almtmp
,
any_cast
<
fcmplx
*>
(
alm
),
nalm
);
...
...
libsharp2/sharp_almhelpers.h
View file @
a7c3d242
...
...
@@ -83,9 +83,9 @@ class sharp_standard_alm_info: public sharp_alm_info
virtual
size_t
mmax
()
const
;
virtual
size_t
nm
()
const
{
return
mval_
.
size
();
}
virtual
size_t
mval
(
size_t
i
)
const
{
return
mval_
[
i
];
}
virtual
void
clear_alm
(
std
::
any
alm
)
const
;
virtual
void
get_alm
(
size_t
mi
,
std
::
any
alm
,
std
::
complex
<
double
>
*
almtmp
,
size_t
nalm
)
const
;
virtual
void
add_alm
(
size_t
mi
,
const
std
::
complex
<
double
>
*
almtmp
,
std
::
any
alm
,
size_t
nalm
)
const
;
virtual
void
clear_alm
(
const
std
::
any
&
alm
)
const
;
virtual
void
get_alm
(
size_t
mi
,
const
std
::
any
&
alm
,
std
::
complex
<
double
>
*
almtmp
,
size_t
nalm
)
const
;
virtual
void
add_alm
(
size_t
mi
,
const
std
::
complex
<
double
>
*
almtmp
,
const
std
::
any
&
alm
,
size_t
nalm
)
const
;
};
/*! Initialises an a_lm data structure according to the scheme used by
...
...
libsharp2/sharp_geomhelpers.cc
View file @
a7c3d242
...
...
@@ -99,7 +99,7 @@ template<typename T> void sharp_standard_geom_info::tclear(T *map) const
}
}
void
sharp_standard_geom_info
::
clear_map
(
any
map
)
const
void
sharp_standard_geom_info
::
clear_map
(
const
any
&
map
)
const
{
if
(
map
.
type
()
==
typeid
(
double
*
))
tclear
(
any_cast
<
double
*>
(
map
));
else
if
(
map
.
type
()
==
typeid
(
float
*
))
tclear
(
any_cast
<
float
*>
(
map
));
...
...
@@ -114,7 +114,7 @@ template<typename T> void sharp_standard_geom_info::tadd(bool weighted, size_t i
p1
[
m
*
stride
]
+=
T
(
ringtmp
[
m
]
*
wgt
);
}
//virtual
void
sharp_standard_geom_info
::
add_ring
(
bool
weighted
,
size_t
iring
,
const
double
*
ringtmp
,
any
map
)
const
void
sharp_standard_geom_info
::
add_ring
(
bool
weighted
,
size_t
iring
,
const
double
*
ringtmp
,
const
any
&
map
)
const
{
if
(
map
.
type
()
==
typeid
(
double
*
))
tadd
(
weighted
,
iring
,
ringtmp
,
any_cast
<
double
*>
(
map
));
else
if
(
map
.
type
()
==
typeid
(
float
*
))
tadd
(
weighted
,
iring
,
ringtmp
,
any_cast
<
float
*>
(
map
));
...
...
@@ -128,7 +128,7 @@ template<typename T> void sharp_standard_geom_info::tget(bool weighted, size_t i
ringtmp
[
m
]
=
p1
[
m
*
stride
]
*
wgt
;
}
//virtual
void
sharp_standard_geom_info
::
get_ring
(
bool
weighted
,
size_t
iring
,
any
map
,
double
*
ringtmp
)
const
void
sharp_standard_geom_info
::
get_ring
(
bool
weighted
,
size_t
iring
,
const
any
&
map
,
double
*
ringtmp
)
const
{
if
(
map
.
type
()
==
typeid
(
const
double
*
))
tget
(
weighted
,
iring
,
any_cast
<
const
double
*>
(
map
),
ringtmp
);
else
if
(
map
.
type
()
==
typeid
(
double
*
))
tget
(
weighted
,
iring
,
any_cast
<
double
*>
(
map
),
ringtmp
);
...
...
libsharp2/sharp_geomhelpers.h
View file @
a7c3d242
...
...
@@ -72,9 +72,9 @@ class sharp_standard_geom_info: public sharp_geom_info
virtual
double
sth
(
size_t
iring
)
const
{
return
ring
[
iring
].
sth
;
}
virtual
double
phi0
(
size_t
iring
)
const
{
return
ring
[
iring
].
phi0
;
}
virtual
Tpair
pair
(
size_t
ipair
)
const
{
return
pair_
[
ipair
];
}
virtual
void
clear_map
(
std
::
any
map
)
const
;
virtual
void
get_ring
(
bool
weighted
,
size_t
iring
,
std
::
any
map
,
double
*
ringtmp
)
const
;
virtual
void
add_ring
(
bool
weighted
,
size_t
iring
,
const
double
*
ringtmp
,
std
::
any
map
)
const
;
virtual
void
clear_map
(
const
std
::
any
&
map
)
const
;
virtual
void
get_ring
(
bool
weighted
,
size_t
iring
,
const
std
::
any
&
map
,
double
*
ringtmp
)
const
;
virtual
void
add_ring
(
bool
weighted
,
size_t
iring
,
const
double
*
ringtmp
,
const
std
::
any
&
map
)
const
;
};
/*! Creates a geometry information describing a HEALPix map with an
...
...
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