GSRLEYYP5OTLYQIPXXIZ2WGKXMO7OKTDN3TAO6FBCO5OEXXTJ76QC
Cactus Code Thorn SHTOOLS
Author(s) : Erik Schnetter
Maintainer(s): Cactus team
Licence : ?
--------------------------------------------------------------------------
1. Purpose
Configure the SHTOOLS library; see
<https://shtools.github.io/SHTOOLS/>
From the web site:
SHTOOLS - Spherical Harmonic Tools
SHTOOLS/pyshtools is an archive of Fortran 95 and Python software that
can be used to perform spherical harmonic transforms, multitaper
spectral analyses on the sphere, expansions of functions into Slepian
bases, and standard operations on global gravitational and magnetic
field data.
Mark A. Wieczorek and Matthias Meschede (2018). SHTools -- Tools for
working with spherical harmonics, Geochemistry, Geophysics,
Geosystems, 19, 2574-2592, doi:10.1029/2018GC007529.
# Configuration definitions for thorn SHTOOLS
REQUIRES BLAS FFTW3 LAPACK
PROVIDES SHTOOLS
{
SCRIPT configure.sh
LANG bash
OPTIONS SHTOOLS_DIR
}
REQUIRES SHTOOLS
#! /bin/bash
################################################################################
# Prepare
################################################################################
# Set up shell
if [ "$(echo ${VERBOSE} | tr '[:upper:]' '[:lower:]')" = 'yes' ]; then
set -x # Output commands
fi
set -e # Abort on errors
################################################################################
# Configure Cactus
################################################################################
if [ -z "${SHTOOLS_DIR}" ]; then
echo "BEGIN ERROR"
echo "Configuration variable SHTOOLS_DIR is not set"
echo "END ERROR"
exit 1
fi
# Set options
: ${SHTOOLS_INC_DIRS="${SHTOOLS_DIR}/include"}
: ${SHTOOLS_LIB_DIRS="${SHTOOLS_DIR}/lib"}
: ${SHTOOLS_LIBS="SHTOOLS-mp"}
SHTOOLS_INC_DIRS="$(${CCTK_HOME}/lib/sbin/strip-incdirs.sh ${SHTOOLS_INC_DIRS})"
SHTOOLS_LIB_DIRS="$(${CCTK_HOME}/lib/sbin/strip-libdirs.sh ${SHTOOLS_LIB_DIRS})"
# Pass options to Cactus
echo "BEGIN MAKE_DEFINITION"
echo "SHTOOLS_DIR = ${SHTOOLS_DIR}"
echo "SHTOOLS_INC_DIRS = ${SHTOOLS_INC_DIRS}"
echo "SHTOOLS_LIB_DIRS = ${SHTOOLS_LIB_DIRS}"
echo "SHTOOLS_LIBS = ${SHTOOLS_LIBS}"
echo "END MAKE_DEFINITION"
echo 'INCLUDE_DIRECTORY $(SHTOOLS_INC_DIRS)'
echo 'LIBRARY_DIRECTORY $(SHTOOLS_LIB_DIRS)'
echo 'LIBRARY $(SHTOOLS_LIBS)'
# Interface definition for thorn SHTOOLS
IMPLEMENTS: SHTOOLS
INCLUDES HEADER: shtools.h IN shtools.h
# Parameter definitions for thorn SHTOOLS
# Schedule definitions for thorn SHTOOLS
# Main make.code.defn file for thorn SHTOOLS
# Source files in this directory
SRCS = shtools.f90
# Subdirectories containing source files
SUBDIRS =
subroutine C_SHExpandDH ( &
grid, n, cilm, lmax, norm, sampling, csphase, &
lmax_calc, exitstatus)
use shtools
implicit none
integer, parameter :: dp = selected_real_kind(p=15)
integer :: n
integer :: norm, sampling, csphase, lmax_calc
real(dp) :: grid(n, sampling*n)
real(dp) :: cilm(2, lmax_calc+1, lmax_calc+1)
integer :: lmax
integer :: exitstatus
call SHExpandDH( &
grid, n, cilm, lmax, norm, sampling, csphase, &
lmax_calc, exitstatus)
end subroutine C_SHExpandDH
subroutine C_MakeGridDH( &
griddh, n, cilm, lmax, norm, sampling, csphase, &
lmax_calc, exitstatus)
use shtools
implicit none
integer, parameter :: dp = selected_real_kind(p=15)
integer :: lmax
integer :: norm, sampling, csphase, lmax_calc
real(dp) :: cilm(2, lmax_calc+1, lmax_calc+1)
real(dp) :: griddh(2*(lmax+1), sampling*(2*(lmax+1)))
integer :: n
integer :: exitstatus
call MakeGridDH( &
griddh, n, cilm, lmax, norm, sampling, csphase, &
lmax_calc, exitstatus)
end subroutine C_MakeGridDH
#ifndef SHTOOLS_H
#define SHTOOLS_H
#include <cctk.h>
#ifdef __cplusplus
extern "C" {
#endif
#define C_SHExpandDH c_shexpanddh_
void C_SHExpandDH(const double *griddh, const int *n, double *cilm, int *lmax,
const int *norm, const int *sampling, const int *csphase,
const int *lmax_calc, int *exitstatus);
#define C_MakeGridDH c_makegriddh_
void C_MakeGridDH(double *griddh, int *n, const double *cilm, const int *lmax,
const int *norm, const int *sampling, const int *csphase,
const int *lmax_calc, int *exitstatus);
#ifdef __cplusplus
}
#endif
#endif // #ifndef SHTOOLS_H