#include #include #include "Fourier.h" #include "SphericalGrid.h" #include "cmdLineParser.h" #include int main(int argc,char* argv[]){ // Read the parameters in from the command line cmdLineString In,Out; cmdLineFloat Smooth; char* paramNames[]={"in","out","smooth"}; cmdLineReadable* params[]={&In,&Out,&Smooth}; cmdLineParse(argc-1,&argv[1],paramNames,sizeof(paramNames)/sizeof(char*),params); if(!In.set){ fprintf(stderr,"You must specify an input file\n"); return EXIT_FAILURE; } if(!Out.set){ fprintf(stderr,"You must specify an output file\n"); return EXIT_FAILURE; } if(!Smooth.set){ fprintf(stderr,"You must specify a smoothing parameter\n"); return EXIT_FAILURE; } SphericalGrid<> grid; FourierKeyS2<> key; HarmonicTransform<> xForm; float smooth=Smooth.value/50; // Read in the input spherical function if(!grid.read(In.value)){ fprintf(stderr,"Failed to read in: %s\n",In.value); return EXIT_FAILURE; } // Compute the spherical harmonic transform xForm.ForwardFourier(grid,key); // Compute the spherical harmonic coefficients of the smoothed function here, // over-writing the spherical harmonic coefficients in the FourierKeyS2 "key" with // the spherical harmonic coefficients of the smoothed function. // ... // Compute the inverse spherical harmonic transform xForm.InverseFourier(key,grid); // Write out the smoothed function grid.write(Out.value); return EXIT_SUCCESS; }