GeoTessCExamples  2.0
Data Structures | Macros | Functions
PopulateModel3D.c File Reference
#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)
 

Macro Definition Documentation

◆ len

#define len   1024

Definition at line 49 of file PopulateModel3D.c.

Function Documentation

◆ errorCheck()

void errorCheck ( )

Definition at line 348 of file PopulateModel3D.c.

◆ getNodeData()

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.

Parameters
ak135the struct defining the AK135 model.
latthe latitude of the profile
lonthe longitude of the profile
layerthe index of the layer.
nodeDataan nNodes by nAttributes array of floats that will be populated with model values from the ak135 model.
nNodesthe number of nodes in nodeData that got populated.
Returns

Definition at line 435 of file PopulateModel3D.c.

◆ getRadii()

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.

Parameters
ak135the struct defining the AK135 model.
latthe latitude of the profile
lonthe longitude of the profile
layerthe index of the layer.
radiia 1D array of floats that will be populated with radius values for the current layer.
nRadiithe number of radii populated in radii.

Definition at line 382 of file PopulateModel3D.c.

◆ main()

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.

◆ populateAK135()

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.