sharp_map_size and sharp_alm_count functions
This commit is contained in:
parent
c50c0fe27a
commit
cf7de6ba70
2 changed files with 33 additions and 0 deletions
|
@ -169,6 +169,19 @@ ptrdiff_t sharp_alm_index (const sharp_alm_info *self, int l, int mi)
|
|||
return self->mvstart[mi]+self->stride*l;
|
||||
}
|
||||
|
||||
ptrdiff_t sharp_alm_count(const sharp_alm_info *self)
|
||||
{
|
||||
ptrdiff_t result=0;
|
||||
for (int im=0; im!=self->nm; ++im)
|
||||
{
|
||||
int m=self->mval[im];
|
||||
ptrdiff_t x=(self->lmax + 1 - m);
|
||||
if ((m!=0)&&((self->flags&SHARP_PACKED)!=0)) result+=2*x;
|
||||
else result+=x;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void sharp_destroy_alm_info (sharp_alm_info *info)
|
||||
{
|
||||
DEALLOC (info->mval);
|
||||
|
@ -226,6 +239,17 @@ void sharp_make_geom_info (int nrings, const int *nph, const ptrdiff_t *ofs,
|
|||
qsort(info->pair,info->npairs,sizeof(sharp_ringpair),ringpair_compare);
|
||||
}
|
||||
|
||||
ptrdiff_t sharp_map_size(const sharp_geom_info *info)
|
||||
{
|
||||
ptrdiff_t result = 0;
|
||||
for (int m=0; m<info->npairs; ++m)
|
||||
{
|
||||
result+=info->pair[m].r1.nph;
|
||||
result+=(info->pair[m].r2.nph>=0) ? (info->pair[m].r2.nph) : 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void sharp_destroy_geom_info (sharp_geom_info *geom_info)
|
||||
{
|
||||
DEALLOC (geom_info->pair);
|
||||
|
|
|
@ -134,6 +134,10 @@ void sharp_make_general_alm_info (int lmax, int nm, int stride, const int *mval,
|
|||
\note for a \a sharp_alm_info generated by sharp_make_alm_info() this is
|
||||
the index for the coefficient with the quantum numbers \a l, \a mi. */
|
||||
ptrdiff_t sharp_alm_index (const sharp_alm_info *self, int l, int mi);
|
||||
/*! Returns the number of alm coefficients described by \a self. If the SHARP_PACKED
|
||||
flag is set, this is number of "real" coeffecients (for m < 0 and m >= 0),
|
||||
otherwise it is the number of complex coefficients (with m>=0). */
|
||||
ptrdiff_t sharp_alm_count(const sharp_alm_info *self);
|
||||
/*! Deallocates the a_lm info object. */
|
||||
void sharp_destroy_alm_info (sharp_alm_info *info);
|
||||
|
||||
|
@ -159,6 +163,11 @@ void sharp_make_geom_info (int nrings, const int *nph, const ptrdiff_t *ofs,
|
|||
const int *stride, const double *phi0, const double *theta,
|
||||
const double *wgt, sharp_geom_info **geom_info);
|
||||
|
||||
/*! Counts the number of grid points needed for (the local part of) a map described
|
||||
by \a info.
|
||||
*/
|
||||
ptrdiff_t sharp_map_size(const sharp_geom_info *info);
|
||||
|
||||
/*! Deallocates the geometry information in \a info. */
|
||||
void sharp_destroy_geom_info (sharp_geom_info *info);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue