Logo Tesseroids 1.0: User Manual and API Documentation

src/c/utils.h

Go to the documentation of this file.
00001 /* *****************************************************************************
00002 Copyright 2011 Leonardo Uieda
00003 
00004 Tesseroids is free software: you can redistribute it and/or modify
00005 it under the terms of the GNU General Public License as published by
00006 the Free Software Foundation, either version 3 of the License, or
00007 (at your option) any later version.
00008 
00009 Tesseroids is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with Tesseroids.  If not, see <http://www.gnu.org/licenses/>.
00016 ***************************************************************************** */
00017 
00027 #ifndef _TESSEROIDS_UTILS_H_
00028 #define _TESSEROIDS_UTILS_H_
00029 
00030 
00031 /* Need for the definition of FILE */
00032 #include <stdio.h>
00033 
00034 
00036 typedef struct tess_struct {
00037     /* s, n, w, e in degrees. r1 and r2 are the smaller and larger radius */
00038     double density; 
00039     double w; 
00040     double e; 
00041     double s; 
00042     double n; 
00043     double r1; 
00044     double r2; 
00045 } TESSEROID;
00046 
00047 
00049 typedef struct prism_struct {
00050     double density; 
00051     double x1; 
00052     double x2; 
00053     double y1; 
00054     double y2; 
00055     double z1; 
00056     double z2; 
00057     /* Geodetic coordinates of the center of the top face of the prism */
00058     /* double lonc, latc, rc;*/
00059 } PRISM;
00060 
00061 
00063 typedef struct sphere_struct {
00064     double density; 
00065     double r; 
00066     double lonc; 
00067     double latc; 
00068     double rc; 
00069 } SPHERE;
00070 
00071 
00077 extern void split_tess(TESSEROID tess, TESSEROID *split);
00078 
00079 
00089 extern double tess_total_mass(TESSEROID *model, int size);
00090 
00091 
00103 extern double tess_range_mass(TESSEROID *model, int size, double low_dens,
00104                               double high_dens);
00105 
00106 
00127 extern void tess2prism(TESSEROID tess, PRISM *prism);
00128 
00129 
00136 extern void tess2sphere(TESSEROID tess, SPHERE *sphere);
00137 
00138 
00148 extern void prism2sphere(PRISM prism, double lonc, double latc, double rc,
00149                          SPHERE *sphere);
00150 
00151 
00158 extern double tess_volume(TESSEROID tess);
00159 
00160 
00167 extern double sphere_volume(SPHERE sphere);
00168 
00169 
00176 extern double prism_volume(PRISM prism);
00177 
00178 
00185 extern void strstrip(char *str);
00186 
00187 
00195 extern int gets_tess(const char *str, TESSEROID *tess);
00196 
00197 
00207 extern TESSEROID * read_tess_model(FILE *modelfile, int *size);
00208 
00209 
00217 extern int gets_prism(const char *str, PRISM *prism);
00218 
00219 
00229 extern PRISM * read_prism_model(FILE *modelfile, int *size);
00230 
00231 #endif
Generated on Tue Apr 26 12:17:07 2011 for Tesseroids 1.0: User manual and API documentation by doxygen 1.6.3