From 55253e4e15b093a0826fc10b376f7724cea2ba7e Mon Sep 17 00:00:00 2001 From: Franz Zotter Date: Mon, 12 Jan 2009 17:09:13 +0000 Subject: added [mtx_sh] for spherical harmonics evaluation. svn path=/trunk/externals/iem/iemmatrix/; revision=10515 --- src/mtx_sh/cmdline/sharmonics_cmd.c | 57 +++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/mtx_sh/cmdline/sharmonics_cmd.c (limited to 'src/mtx_sh/cmdline/sharmonics_cmd.c') diff --git a/src/mtx_sh/cmdline/sharmonics_cmd.c b/src/mtx_sh/cmdline/sharmonics_cmd.c new file mode 100644 index 0000000..5b2f22a --- /dev/null +++ b/src/mtx_sh/cmdline/sharmonics_cmd.c @@ -0,0 +1,57 @@ + +/* command line test for chebyshev12.c + * Franz Zotter, 2009, see ../LICENSE.txt */ + +#include + +#include "sharmonics.h" + +int main (int argc, char *argv[]) { + int nmax, l, lc, n, m; + SHWorkSpace *ws=0; + double *ptr,*phi,*theta; + + if (argc <4) { + printf("sharmonics requires nmax as input argument followed by phi theta value pairs\n"); + return 0; + } + + nmax=atoi(argv[1]); + l=(argc-2)/2; + if ((phi=(double*)calloc(l,sizeof(double)))==0) { + printf("sharmonics could not allocate memory for %d phi-values\n",l); + return 0; + } + if ((theta=(double*)calloc(l,sizeof(double)))==0) { + printf("sharmonics could not allocate memory for %d theta-values\n",l); + free(phi); + return 0; + } + if ((ws=sharmonics_alloc(nmax,l))==0) { + printf("sharmonics could not allocate memory for n=%d\n and l=%d\n",nmax,l); + free(theta); + free(phi); + return 0; + } + for (n=0;ny; + for (lc=0;lc