GeoTessCExamples
2.0
|
#include "CpuTimerC.h"
#include "GeoTessMetaDataC.h"
#include "GeoTessModelC.h"
#include "GeoTessUtilsC.h"
#include "GeoTessGridC.h"
#include "InterpolatorTypeC.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "DataTypeC.h"
#include "ErrorHandler.h"
Go to the source code of this file.
Data Structures | |
struct | AK135Model |
Macros | |
#define | len 1024 |
Functions | |
void | errorCheck () |
void | populateAK135 (struct AK135Model *ak135) |
void | getRadii (struct AK135Model *ak135, double *lat, double *lon, int *layer, float *radii, int *nRadii) |
void | getNodeData (struct AK135Model *ak135, double *lat, double *lon, int *layer, float **nodeData, int *nNodes) |
int | main (int argc, char **argv) |
#define len 1024 |
Definition at line 49 of file PopulateModel3D.c.
void errorCheck | ( | ) |
Definition at line 348 of file PopulateModel3D.c.
void getNodeData | ( | struct AK135Model * | ak135, |
double * | lat, | ||
double * | lon, | ||
int * | layer, | ||
float ** | nodeData, | ||
int * | nNodes | ||
) |
extract p-velocity, s-velocity and density data from the ak135 model for a single layer.
Retrieve a 2D array of floats with nNodes x nAttributes elements. The number of attributes is 3, for the vp, vs and rho. nNodes varies in the different layers. For core and mantle layers, nNodes will equal the number of radii in the corresponding layers of the AK135 model. For the crustal layers, nNodes will be one, reflecting the fact that the attribute values are constant in the crustal layers of the ak135 model. Used by populateModel3D.
In this example, the data returned are independent of latitude and longitude since ak135 is a '1D' model, but this will not generally be true for real 3D models.
ak135 | the struct defining the AK135 model. |
lat | the latitude of the profile |
lon | the longitude of the profile |
layer | the index of the layer. |
nodeData | an nNodes by nAttributes array of floats that will be populated with model values from the ak135 model. |
nNodes | the number of nodes in nodeData that got populated. |
Definition at line 435 of file PopulateModel3D.c.
void getRadii | ( | struct AK135Model * | ak135, |
double * | lat, | ||
double * | lon, | ||
int * | layer, | ||
float * | radii, | ||
int * | nRadii | ||
) |
extract the radii from the ak135 model for a single layer.
Returns a 1D profile of monotonically increasing radius values that define the radial positions of nodes along a radial profile through a single layer in the model. Used by populateModel3D.
For this example, we will return the radius positions of the nodes in the AK135 model, stretched a little bit so that the top of the model will coincide with the radius of the WGS84 ellipsoid instead of the ak135 value of 6371 km.
ak135 | the struct defining the AK135 model. |
lat | the latitude of the profile |
lon | the longitude of the profile |
layer | the index of the layer. |
radii | a 1D array of floats that will be populated with radius values for the current layer. |
nRadii | the number of radii populated in radii. |
Definition at line 382 of file PopulateModel3D.c.
int main | ( | int | argc, |
char ** | argv | ||
) |
Populate a 3D model with values from the AK135 Earth model
Definition at line 90 of file PopulateModel3D.c.
void populateAK135 | ( | struct AK135Model * | ak135 | ) |
function that loads the ak135 model into memory from hard coded information.
Load hard-coded data for the ak135 velocity model. Values loaded are radius, p-velocity, s-velocity and density.
Definition at line 455 of file PopulateModel3D.c.