GeoTessCPP
2.1
Software to facilitate storage and retrieval of 3D information about the Earth.
|
#include <GeoTessModel.h>
Public Member Functions | |
GeoTessModel (const GeoTessOptimizationType *optimization=&GeoTessOptimizationType::SPEED) | |
GeoTessModel (const string &inputFile, const string &relativeGridPath, const GeoTessOptimizationType *optimization=&GeoTessOptimizationType::SPEED) | |
GeoTessModel (const string &modelInputFile, const GeoTessOptimizationType *optimization=&GeoTessOptimizationType::SPEED) | |
GeoTessModel (vector< int > &attributeFilter, const GeoTessOptimizationType *optimization=&GeoTessOptimizationType::SPEED) | |
GeoTessModel (const string &inputFile, const string &relativeGridPath, vector< int > &attributeFilter, const GeoTessOptimizationType *optimization=&GeoTessOptimizationType::SPEED) | |
GeoTessModel (const string &modelInputFile, vector< int > &attributeFilter, const GeoTessOptimizationType *optimization=&GeoTessOptimizationType::SPEED) | |
GeoTessModel (const string &gridFileName, GeoTessMetaData *metaData) | |
GeoTessModel (GeoTessGrid *grid, GeoTessMetaData *metaData) | |
virtual | ~GeoTessModel () |
const set< int > & | getConnectedVertices (int layerIndex) |
double | getDepth (int vertexId, int layerId, int nodeId) |
double | getDepth (int pointIndex) |
EarthShape & | getEarthShape () |
const GeoTessGrid & | getGrid () const |
GeoTessGrid & | getGrid () |
void | getLayerCount (bool activeOnly, int *layerCount) |
void | getLayerCount (vector< int > &layerCount, const bool &activeOnly) |
GeoTessMetaData & | getMetaData () |
int | getNAttributes () |
int | getNData (int vertexId, int layerId) |
int | getNLayers () const |
int | getNPoints () |
int | getNRadii (int vertexId, int layerId) |
int | getNVertices () const |
double | getPathIntegral (const int &attribute, const map< int, double > &weights) |
double | getPathIntegral (const int &attribute, const bool &reciprocal, double **rayPath, double *radii, int *layerIds, const int &numPoints, const GeoTessInterpolatorType &horizontalType, const GeoTessInterpolatorType &radialType, map< int, double > *weights=NULL) |
double | getPathIntegral (const int &attribute, const bool &reciprocal, const vector< double * > &rayPath, const vector< double > &radii, const vector< int > &layerIds, const GeoTessInterpolatorType &horizontalType, const GeoTessInterpolatorType &radialType, map< int, double > *weights=NULL) |
double | getPathIntegral2D (const int &attribute, const bool &reciprocal, const double *firstPoint, const double *lastPoint, double pointSpacing, double earthRadius, const GeoTessInterpolatorType &horizontalType, map< int, double > *weights=NULL) |
double | getPathIntegral2D (const int &attribute, const bool &reciprocal, GeoTessGreatCircle &greatCircle, double pointSpacing, double earthRadius, const GeoTessInterpolatorType &horizontalType, map< int, double > *weights=NULL) |
GeoTessPointMap * | getPointMap () |
GeoTessPolygon * | getPolygon () |
GeoTessPosition * | getPosition () |
GeoTessPosition * | getPosition (const GeoTessInterpolatorType &horizontalType) |
GeoTessPosition * | getPosition (const GeoTessInterpolatorType &horizontalType, const GeoTessInterpolatorType &radialType) |
GeoTessProfile * | getProfile (int vertex, int layer) |
GeoTessProfile ** | getProfiles (int vertex) |
GeoTessProfile *** | getProfiles () const |
double | getRadius (int vertexId, int layerId, int nodeId) |
double | getRadius (int pointIndex) |
byte | getValueByte (int vertexId, int layerId, int nodeId, int attributeIndex) |
byte | getValueByte (int pointIndex, int attributeIndex) |
double | getValueDouble (int vertexId, int layerId, int nodeId, int attributeIndex) |
double | getValueDouble (int pointIndex, int attributeIndex) |
float | getValueFloat (int vertexId, int layerId, int nodeId, int attributeIndex) |
float | getValueFloat (int pointIndex, int attributeIndex) |
int | getValueInt (int vertexId, int layerId, int nodeId, int attributeIndex) |
int | getValueInt (int pointIndex, int attributeIndex) |
LONG_INT | getValueLong (int vertexId, int layerId, int nodeId, int attributeIndex) |
LONG_INT | getValueLong (int pointIndex, int attributeIndex) |
short | getValueShort (int vertexId, int layerId, int nodeId, int attributeIndex) |
short | getValueShort (int pointIndex, int attributeIndex) |
void | getWeights (const double *pointA, const double *pointB, const double &pointSpacing, const double &radius, const GeoTessInterpolatorType &horizontalType, map< int, double > &weights) |
void | getWeights (GeoTessGreatCircle &greatCircle, const double &pointSpacing, const double &radius, const GeoTessInterpolatorType &horizontalType, map< int, double > &weights) |
void | getWeights (const vector< double * > &rayPath, const vector< double > &radii, const vector< int > &layerIds, const GeoTessInterpolatorType &horizontalType, const GeoTessInterpolatorType &radialType, map< int, double > &weights) |
void | getWeights (double **rayPath, double *radii, int *layerIds, const int &numPoints, const GeoTessInterpolatorType &horizontalType, const GeoTessInterpolatorType &radialType, map< int, double > &weights) |
template<typename T > | |
void | initializeData (const vector< string > &attributeNames, const vector< string > &attributeUnits, T fillValue) |
template<typename T > | |
void | initializeData (const string &attributeNames, const string &attributeUnits, T fillValue) |
bool | is2D () |
bool | is3D () |
GeoTessModel * | loadModel (const string &inputFile, const string &relGridFilePath="") |
virtual bool | operator!= (const GeoTessModel &other) const |
virtual bool | operator== (const GeoTessModel &other) const |
void | profileCount (vector< vector< int > > &count) |
void | setActiveRegion () |
void | setActiveRegion (const string &polygon) |
void | setActiveRegion (GeoTessPolygon *polygon) |
void | setEarthShape (const string &earthShapeName) |
void | setProfile (int vertex, int layer, GeoTessProfile *profile) |
template<typename T > | |
void | setProfile (int vertex, int layer, vector< float > &radii, vector< vector< T > > &values) |
template<typename T > | |
void | setProfile (const int &vertex, const int &layer, float *radii, const int &nRadii, T **values, const int &nNodes, const int &nAttributes) |
void | setProfile (int vertex, int layer, vector< float > &radii) |
template<typename T > | |
void | setProfile (const int &vertex, const int &layer, float *radii, const int &nRadii) |
template<typename T > | |
void | setProfile (const int &vertex, vector< T > &values) |
template<typename T > | |
void | setProfile (const int &vertex, T *values, const int &nAttributes) |
void | setProfile (const int &vertex) |
template<typename T > | |
void | setValue (int vertexId, int layerId, int nodeId, int attributeIndex, T value) |
template<typename T > | |
void | setValue (int pointIndex, int attributeIndex, T value) |
string | toString () |
void | writeModel (const string &outputFile) |
void | writeModel (const string &outputFile, const string &gridFileName) |
Static Public Member Functions | |
static string | class_name () |
static void | clearReuseGrid () |
static int | getReuseGridMapSize () |
static bool | isGeoTessModel (const string &fileName) |
GeoTessModel manages the grid and data that comprise a 3D Earth model. The Earth is assumed to be composed of a number of layers each of which spans the entire geographic extent of the Earth. It is assumed that layer boundaries do not fold back on themselves, i.e., along any radial profile through the model, each layer boundary is intersected exactly one time. Layers may have zero thickness over some or all of their geographic extent. Earth properties stored in the model are assumed to be continuous within a layer, both geographically and radially, but may be discontinuous across layer boundaries.
A GeoTessModel is comprised of 3 major components:
The model grid (geometry and topology) is managed by a GeoTessGrid object. The grid is made up of one or more 2D triangular tessellations of a unit sphere.
The data are managed by a 2D array of Profile objects. A Profile is essentially a list of radii and Data objects distributed along a radial profile that spans a single layer at a single vertex of the 2D grid. The 2D Profile array has dimensions nVertices by nLayers.
The term 'vertex' refers to a position in the 2D tessellation. They are 2D positions represented by unit vectors on a unit sphere. The term 'node' refers to a 1D position on a radial profile associated with a vertex and a layer in the model. Node indexes are unique only within a given profile (all profiles have a node with index 0 for example). The term 'point' refers to all the nodes in all the profiles of the model. There is only one 'point' in the model with index 0. PointMap is introduced to manage all these different indexes.
geotess::GeoTessModel::GeoTessModel | ( | const GeoTessOptimizationType * | optimization = &GeoTessOptimizationType::SPEED | ) |
Default constructor.
optimization | either OptimizationType.SPEED or OptimizationType.MEMORY. The default is SPEED wherein the code will execute faster but require more memory to run. |
geotess::GeoTessModel::GeoTessModel | ( | const string & | inputFile, |
const string & | relativeGridPath, | ||
const GeoTessOptimizationType * | optimization = &GeoTessOptimizationType::SPEED |
||
) |
Construct a new GeoTessModel object and populate it with information from the specified file.
inputFile | name of file containing the model. |
relativeGridPath | the relative path from the directory where the model is stored to the directory where the grid is stored. Often, the model and grid are stored together in the same file in which case this parameter is ignored. Sometimes, however, the grid is stored in a separate file and only the name of the grid file (without path information) is stored in the model file. In this case, the code needs to know which directory to search for the grid file. The default is "" (empty string), which will cause the code to search for the grid file in the same directory in which the model file resides. Bottom line is that the default value is appropriate when the grid is stored in the same file as the model, or the model file is in the same directory as the model file. |
optimization | either OptimizationType.SPEED or OptimizationType.MEMORY. The default is SPEED wherein the code will execute faster but require more memory to run. |
geotess::GeoTessModel::GeoTessModel | ( | const string & | modelInputFile, |
const GeoTessOptimizationType * | optimization = &GeoTessOptimizationType::SPEED |
||
) |
Construct a new GeoTessModel object and populate it with information from the specified file.
relativeGridPath is assumed to be "" (empty string), which is appropriate when the grid information is stored in the same file as the model or when the grid is stored in a separate file located in the same directory as the model file.
modelInputFile | name of file containing the model. |
optimization | either OptimizationType.SPEED or OptimizationType.MEMORY. The default is SPEED wherein the code will execute faster but require more memory to run. |
geotess::GeoTessModel::GeoTessModel | ( | vector< int > & | attributeFilter, |
const GeoTessOptimizationType * | optimization = &GeoTessOptimizationType::SPEED |
||
) |
Default constructor.
attributeFilter | the indexes of available attributes that should be loaded into memory. |
optimization | either OptimizationType.SPEED or OptimizationType.MEMORY. The default is SPEED wherein the code will execute faster but require more memory to run. |
geotess::GeoTessModel::GeoTessModel | ( | const string & | inputFile, |
const string & | relativeGridPath, | ||
vector< int > & | attributeFilter, | ||
const GeoTessOptimizationType * | optimization = &GeoTessOptimizationType::SPEED |
||
) |
Construct a new GeoTessModel object and populate it with information from the specified file.
inputFile | name of file containing the model. |
relativeGridPath | the relative path from the directory where the model is stored to the directory where the grid is stored. Often, the model and grid are stored together in the same file in which case this parameter is ignored. Sometimes, however, the grid is stored in a separate file and only the name of the grid file (without path information) is stored in the model file. In this case, the code needs to know which directory to search for the grid file. The default is "" (empty string), which will cause the code to search for the grid file in the same directory in which the model file resides. Bottom line is that the default value is appropriate when the grid is stored in the same file as the model, or the model file is in the same directory as the model file. |
attributeFilter | the indexes of available attributes that should be loaded into memory. |
optimization | either OptimizationType.SPEED or OptimizationType.MEMORY. The default is SPEED wherein the code will execute faster but require more memory to run. |
geotess::GeoTessModel::GeoTessModel | ( | const string & | modelInputFile, |
vector< int > & | attributeFilter, | ||
const GeoTessOptimizationType * | optimization = &GeoTessOptimizationType::SPEED |
||
) |
Construct a new GeoTessModel object and populate it with information from the specified file.
relativeGridPath is assumed to be "" (empty string), which is appropriate when the grid information is stored in the same file as the model or when the grid is stored in a separate file located in the same directory as the model file.
modelInputFile | name of file containing the model. |
attributeFilter | the indexes of available attributes that should be loaded into memory. |
optimization | either OptimizationType.SPEED or OptimizationType.MEMORY. The default is SPEED wherein the code will execute faster but require more memory to run. |
geotess::GeoTessModel::GeoTessModel | ( | const string & | gridFileName, |
GeoTessMetaData * | metaData | ||
) |
Parameterized constructor, specifying the grid and metadata for the model. The grid is constructed and the data structures are initialized based on information supplied in metadata. The data structures are not populated with any information however (all Profiles are null). The application should populate the new model's Profiles after this constructor completes.
Before calling this constructor, the supplied MetaData object must be populated with required information by calling the following MetaData methods:
gridFileName | name of file from which to load the grid. |
metaData | MetaData the new GeoTessModel instantiates a reference to the supplied metaData. No copy is made. |
GeoTessException | if metadata is incomplete. |
geotess::GeoTessModel::GeoTessModel | ( | GeoTessGrid * | grid, |
GeoTessMetaData * | metaData | ||
) |
Parameterized constructor, specifying the grid and metadata for the model. The grid is constructed and the data structures are initialized based on information supplied in metadata. The data structures are not populated with any information however (all Profiles are null). The application should populate the new model's Profiles after this constructor completes.
Before calling this constructor, the supplied MetaData object must be populated with required information by calling the following MetaData methods:
grid | a pointer to the GeoTessGrid that will support this GeoTessModel. GeoTessModel assumes ownership of the supplied grid object and will delete it when it is done with it. |
metaData | MetaData the new GeoTessModel instantiates a reference to the supplied metaData. No copy is made. |
GeoTessException | if metadata is incomplete. |
|
virtual |
Destructor.
|
inlinestatic |
Returns the class name.
|
inlinestatic |
GeoTessModel will attempt to reuse grids that it has already loaded into memory when a new model tries to reload the same grid. This method clears the map that supports this functionality.
|
inline |
Return a reference to the set<int> of the indexes of all the vertices that are connected together by triangles in the specified layer of the model.
layerIndex |
|
inline |
Return the depth below surface of WGS84 ellipsoid in km of the node at vertexId, layerId, nodeId.
vertexId | the vertex index |
layerId | the layer index |
nodeId | the node index |
|
inline |
Return the depth below surface of WGS84 ellipsoid in km of the node at pointIndex.
pointIndex |
|
inline |
Retrieve the name of the ellipsoid that is currently being used to convert between geocentric and geographic latitude and between depth and radius. The following EarthShapes are supported:
|
inline |
Return a reference to the grid object.
|
inline |
Return a reference to the grid object.
|
inline |
Retrieve the number of points in each layer of the model.
activeOnly | if true, counts only active nodes otherwise counts all nodes. |
layerCount | an int array with at least nLayers elements which will be populated with the number of nodes in each layer. |
|
inline |
Retrieve the number of points in each layer of the model.
activeOnly | if true, counts only active nodes otherwise counts all nodes. |
layerCount | the number of points in each layer of the model. |
|
inline |
Return a reference to the GeoTessMetaData object associated with this model. The metadata object stores information about the models such as a description of the model, the layer names, attribute names, attribute units, the data type, etc.
|
inline |
Return the number of attributes that are associated with each node in the model.
|
inline |
Return the number of Data objects that are specified in the Profile at vertexId, layerId
vertexId | the vertex index |
layerId | the layer index |
|
inline |
Return the number of layers that comprise the model.
|
inline |
Retrieve the number of points in the model, including all nodes along all profiles at all grid vertices.
|
inline |
Return the number of radii that are specified in the Profile at vertexId, layerId.
vertexId | the vertex index |
layerId | the layer index |
|
inline |
Return number of vertices in the 2D geographic grid.
double geotess::GeoTessModel::getPathIntegral | ( | const int & | attribute, |
const map< int, double > & | weights | ||
) |
Compute the path integral of the specified attribute along the specified rayPath. The ray path is comprised of a bunch of pointIndex -> interpolation coefficient pairs computed by one of the getWeights() functions.
attribute | the index of the attribute that is to be integrated. If a value greater than or equal to zero is specified then the path integral of the specified attribute is returned. Otherwise the function returns the total length of the rayPath in km. |
weights | (input) map from pointIndex to weight. The sum of the weights will equal the length of the ray path in km. |
double geotess::GeoTessModel::getPathIntegral | ( | const int & | attribute, |
const bool & | reciprocal, | ||
double ** | rayPath, | ||
double * | radii, | ||
int * | layerIds, | ||
const int & | numPoints, | ||
const GeoTessInterpolatorType & | horizontalType, | ||
const GeoTessInterpolatorType & | radialType, | ||
map< int, double > * | weights = NULL |
||
) |
Compute the path integral of the specified attribute along the specified rayPath. The following procedure is implemented:
attribute | the index of the attribute that is to be integrated. If a value less than zero is specified then only the length of the path increments is summed and the function returns the total length of the rayPath in km. |
reciprocal | if true, then the reciprocal of the attribute value is integrated along the path, not the attribute value itself. This is useful when a model stores seismic velocity (km/sec) but total travel time (sec) is the desired result. |
rayPath | input array of 3-component unit vectors that define points along the ray path. |
radii | input array of radius values, in km, that define the radius of each unit_vector supplied in 'rayPath'. |
layerIds | input array of layer indices that specify the index of the layer in which path increment i resides where i is the path increment between points i and i+1 that define the ray path. If layerIds is null or layerIds[i] is less than zero, then the layer in which the path increment resides will be determined from the position and radius of the midpoint. |
numPoints | the number of elements in rayPath, radii, and layerIds |
horizontalType | (input) the type of interpolator to use in the geographic dimensions, either LINEAR or NATURAL_NEIGHBOR |
radialType | (input) the type of interpolator to use in the radial dimension, either LINEAR or CUBIC_SPLINE |
weights | (optional) If specified, then weight is a map from an integer point index to the weight accrued by that point. |
double geotess::GeoTessModel::getPathIntegral | ( | const int & | attribute, |
const bool & | reciprocal, | ||
const vector< double * > & | rayPath, | ||
const vector< double > & | radii, | ||
const vector< int > & | layerIds, | ||
const GeoTessInterpolatorType & | horizontalType, | ||
const GeoTessInterpolatorType & | radialType, | ||
map< int, double > * | weights = NULL |
||
) |
Compute the path integral of the specified attribute along the specified rayPath. The following procedure is implemented:
attribute | the index of the attribute that is to be integrated. If a value less than zero is specified then only the length of the path increments is summed and the function returns the total length of the rayPath in km. |
reciprocal | if true, then the reciprocal of the attribute value is integrated along the path, not the attribute value itself. This is useful when a model stores seismic velocity (km/sec) but total travel time (sec) is the desired result. |
rayPath | input array of 3-component unit vectors that define points along the ray path. |
radii | input array of radius values, in km, that define the radius of each unit_vector supplied in 'rayPath'. |
layerIds | input array of layer indices that specify the index of the layer in which path increment i resides where i is the path increment between points i and i+1 that define the ray path. If layerIds is null or layerIds[i] is less than zero, then the layer in which the path increment resides will be determined from the position and radius of the midpoint. |
horizontalType | (input) the type of interpolator to use in the geographic dimensions, either LINEAR or NATURAL_NEIGHBOR |
radialType | (input) the type of interpolator to use in the radial dimension, either LINEAR or CUBIC_SPLINE |
weights | (optional) If specified, then weight is a map from an integer point index to the weight accrued by that point. |
double geotess::GeoTessModel::getPathIntegral2D | ( | const int & | attribute, |
const bool & | reciprocal, | ||
const double * | firstPoint, | ||
const double * | lastPoint, | ||
double | pointSpacing, | ||
double | earthRadius, | ||
const GeoTessInterpolatorType & | horizontalType, | ||
map< int, double > * | weights = NULL |
||
) |
Compute the path integral of the specified attribute along the specified rayPath and optionally the weights on each model point that results from interpolating positions along the specified ray path. If weights is null on input, no weights are computed. This method only applies to 2D GeoTessModels.
The following procedure is implemented:
attribute | index of the attribute to be integrated. If a value less than zero is specified then only the length of the path increments is summed and the function returns the total length of the rayPath in km. |
reciprocal | if true, the reciprocal of the attribute is integrated. This is useful for computing travel time through a velocity model. |
firstPoint | unit vector of the first point on the great circle path |
lastPoint | unit vector of the last point on the great circle path |
pointSpacing | maximum point separation in radians. The actual point spacing will generally be slightly less than the specified value so that there will be an integral number of uniformly spaced points along the path. |
earthRadius | the radius of the great circle path, in km. If the value is less than or equal to zero then the radius of the Earth determined by the current EarthShape is used. See getEarthShape() and setEarathShape() for more information about EarthShapes. |
horizontalType | either InterpolatorType.NATURAL_NEIGHBOR or InterpolatorType.LINEAR. |
weights | (optional) If specified, then weight is a map from an integer point index to the weight accrued by that point. |
GeoTessException | if the model is not a 2D model. |
double geotess::GeoTessModel::getPathIntegral2D | ( | const int & | attribute, |
const bool & | reciprocal, | ||
GeoTessGreatCircle & | greatCircle, | ||
double | pointSpacing, | ||
double | earthRadius, | ||
const GeoTessInterpolatorType & | horizontalType, | ||
map< int, double > * | weights = NULL |
||
) |
Compute the path integral of the specified attribute along the specified rayPath and optionally the weights on each model point that results from interpolating positions along the specified ray path. If weights is null on input, no weights are computed. This method only applies to 2D GeoTessModels.
The following procedure is implemented:
attribute | index of the attribute to be integrated. If a value less than zero is specified then only the length of the path increments is summed and the function returns the total length of the rayPath in km. |
reciprocal | if true, the reciprocal of the attribute is integrated. This is useful for computing travel time through a velocity model. |
greatCircle | a GreatCircle object specifying the path to be integrated. |
pointSpacing | maximum point separation in radians. The actual point spacing will generally be slightly less than the specified value so that there will be an integral number of uniformly spaced points along the path. |
earthRadius | the radius of the great circle path, in km. If the value is less than or equal to zero then the radius of the Earth determined by the current EarthShape is used. See getEarthShape() and setEarathShape() for more information about EarthShapes. |
horizontalType | either InterpolatorType.NATURAL_NEIGHBOR or InterpolatorType.LINEAR. |
weights | (optional) If specified, then weight is a map from an integer point index to the weight accrued by that point. |
GeoTessException | if the model is not a 2D model. |
|
inline |
Retrieve a pointer to the pointMap, which is an nPoints by 3 array of indexes. For each point in the 3D grid, pointMap stores 3 indexes: the vertex index, the layer index, and the node index.
The term 'vertex' refers to a position in the 2D tessellation. A vertex is a 2D point represented by unit vectors on a unit sphere. The term 'node' refers to a Data object on a radial profile associated with a vertex and a layer in the model. Node indexes are unique only within a given profile (all profiles have a node with index 0 for example). The term 'point' refers to all the nodes in all the profiles of the model. There is only one 'point' in the model with index 0. PointMap is introduced to help map back and forth between all these different indexes.
Users should not delete this pointer.
|
inline |
Retrieve the pointer to the Polygon or Polygon3D object that supports this PointMap. May be NULL.
Polygon implements referenceCounting so if you wish to retain a copy of this polygon, be sure to addReference() and delete it when you are done with it.
GeoTessPosition* geotess::GeoTessModel::getPosition | ( | ) |
Retrieve a pointer to a new GeoTessPosition object that knows how to interpolate information from the model. Linear interpolation will be performed in both the horizontal and radial dimensions
It is the caller's responsibility to delete this object when it is no longer needed.
GeoTessPosition* geotess::GeoTessModel::getPosition | ( | const GeoTessInterpolatorType & | horizontalType | ) |
Retrieve a pointer to a new GeoTessPosition object that knows how to interpolate information from the model. If the horizontal InterpolatorType is LINEAR then the radial InterpolatorType will be LINEAR as well. If the horizontal InterpolatorType is NATUAL_NEIGHBOR then the radial InterpolatorType will be CUBIC_SPLINE.
It is the caller's responsibility to delete this object when it is no longer needed.
horizontalType | the type of interpolation that is to be used for interpolation in the geographic dimensions; either InterpolatorType:LINEAR or InterpolatorType::NATURAL_NEIGHBOR |
GeoTessPosition* geotess::GeoTessModel::getPosition | ( | const GeoTessInterpolatorType & | horizontalType, |
const GeoTessInterpolatorType & | radialType | ||
) |
Retrieve a pointer to a new GeoTessPosition object that knows how to interpolate information from the model.
It is the caller's responsibility to delete this object when it is no longer needed.
horizontalType | the type of interpolation that is to be used for interpolation in the geographic dimensions; either InterpolatorType:LINEAR or InterpolatorType::NATURAL_NEIGHBOR |
radialType | the type of interpolation that is to be used in the radia dimension; either InterpolatorType:LINEAR or InterpolatorType::CUBIC_SPLINE |
|
inline |
Get a reference to the Profile object for the specified vertex and layer.
vertex | index of a vertex in the 2D grid |
layer | index of one of the layers that comprise the model |
|
inline |
Get a reference to the array of Profile objects for the specified vertex.
vertex | index of a vertex in the 2D grid |
|
inline |
Get a reference to all Profile objects.
|
inline |
Return the radius in km of the node at vertexId, layerId, nodeId.
vertexId | the vertex index |
layerId | the layer index |
nodeId | the node index |
|
inline |
Return the radius in km of the node at pointIndex.
pointIndex |
|
inlinestatic |
GeoTessModel will attempt to reuse grids that it has already loaded into memory when a new model tries to reload the same grid. This method returns the size of the map that supports this functionality.
|
inline |
Return the value of the attribute at the specified vertexId, layerId, nodeId, attributeIndex, cast to a byte if necessary.
vertexId | the vertex index |
layerId | the layer index |
nodeId | the node index |
attributeIndex | the attributeIndex |
|
inline |
Return the value of the attribute at the specified pointIndex, attributeIndex, cast to a byte if necessary.
pointIndex | |
attributeIndex | the attributeIndex |
|
inline |
Return the value of the attribute at the specified vertexId, layerId, nodeId, attributeIndex, cast to a double if necessary.
vertexId | the vertex index |
layerId | the layer index |
nodeId | the node index |
attributeIndex | the attributeIndex |
|
inline |
Return the value of the attribute at the specified pointIndex, attributeIndex, cast to a double if necessary.
pointIndex | |
attributeIndex | the attributeIndex |
|
inline |
Return the value of the attribute at the specified vertexId, layerId, nodeId, attributeIndex, cast to a float if necessary.
vertexId | the vertex index |
layerId | the layer index |
nodeId | the node index |
attributeIndex | the attributeIndex |
|
inline |
Return the value of the attribute at the specified pointIndex, attributeIndex, cast to a float if necessary.
pointIndex | |
attributeIndex | the attributeIndex |
|
inline |
Return the value of the attribute at the specified vertexId, layerId, nodeId, attributeIndex, cast to a int if necessary.
vertexId | the vertex index |
layerId | the layer index |
nodeId | the node index |
attributeIndex | the attributeIndex |
|
inline |
Return the value of the attribute at the specified pointIndex, attributeIndex, cast to a int if necessary.
pointIndex | |
attributeIndex | the attributeIndex |
|
inline |
Return the value of the attribute at the specified vertexId, layerId, nodeId, attributeIndex, cast to a LONG_INT if necessary.
vertexId | the vertex index |
layerId | the layer index |
nodeId | the node index |
attributeIndex | the attributeIndex |
|
inline |
Return the value of the attribute at the specified pointIndex, attributeIndex, cast to a LONG_INT if necessary.
pointIndex | |
attributeIndex | the attributeIndex |
|
inline |
Return the value of the attribute at the specified vertexId, layerId, nodeId, attributeIndex, cast to a short if necessary.
vertexId | the vertex index |
layerId | the layer index |
nodeId | the node index |
attributeIndex | the attributeIndex |
|
inline |
Return the value of the attribute at the specified pointIndex, attributeIndex, cast to a short if necessary.
pointIndex | |
attributeIndex | the attributeIndex |
void geotess::GeoTessModel::getWeights | ( | const double * | pointA, |
const double * | pointB, | ||
const double & | pointSpacing, | ||
const double & | radius, | ||
const GeoTessInterpolatorType & | horizontalType, | ||
map< int, double > & | weights | ||
) |
Compute the weights on each model point that results from interpolating positions along the specified ray path. This method is only applicable to 2D GeoTessModels.
The following procedure is implemented:
pointA | the unit vector defining the beginning of the great circle path |
pointB | the unit vector defining the end of the great circle path |
pointSpacing | the maximum spacing between points, in radians. The actual spacing will generally be slightly less than the specified value in order for there to be an integral number of uniform intervals along the great circle path. |
radius | the radius of the great circle path, in km. If the value is less than or equal to zero then the radius of the Earth determined by the current EarthShape is used. See getEarthShape() and setEarathShape() for more information about EarthShapes. |
horizontalType | either InterpolatorType::LINEAR, or InterpolatorType::NATURAL_NEIGHBOR |
weights | (output) map from pointIndex to weight. The sum of the weights will equal the length of the ray path in km. |
void geotess::GeoTessModel::getWeights | ( | GeoTessGreatCircle & | greatCircle, |
const double & | pointSpacing, | ||
const double & | radius, | ||
const GeoTessInterpolatorType & | horizontalType, | ||
map< int, double > & | weights | ||
) |
Compute the weights on each model point that results from interpolating positions along the specified ray path. This method is only applicable to 2D GeoTessModels.
The following procedure is implemented:
greatCircle | a GreatCircle object that specifies the ray path. |
pointSpacing | the maximum spacing between points, in radians. The actual spacing will generally be slightly less than the specified value in order for there to be an integral number of uniform intervals along the great circle path. |
radius | the radius of the great circle path, in km. If the value is less than or equal to zero then the radius of the Earth determined by the current EarthShape is used. See getEarthShape() and setEarathShape() for more information about EarthShapes. |
horizontalType | either InterpolatorType::LINEAR, or InterpolatorType::NATURAL_NEIGHBOR |
weights | (output) map from pointIndex to weight. The sum of the weights will equal the length of the ray path in km. |
void geotess::GeoTessModel::getWeights | ( | const vector< double * > & | rayPath, |
const vector< double > & | radii, | ||
const vector< int > & | layerIds, | ||
const GeoTessInterpolatorType & | horizontalType, | ||
const GeoTessInterpolatorType & | radialType, | ||
map< int, double > & | weights | ||
) |
Compute the weights on each model point that results from interpolating positions along the specified ray path. The following procedure is implemented:
rayPath | (input) an ordered list of unit vectors that define a ray path through the model space |
radii | (input) an ordered list of the radii in km of each point that defines the ray path |
layerIds | (input) array of layer indices that specify the index of the layer in which path increment i resides where i is the path increment between points i and i+1 that define the ray path. If layerIds is empty, or layerIds[i] is less than zero, then the layer in which the path increment resides will be determined from the position and radius of the midpoint. |
horizontalType | (input) either InterpolatorType::LINEAR, or InterpolatorType::NATURAL_NEIGHBOR |
radialType | (input) either InterpolatorType::LINEAR, or InterpolatorType::CUBIC_SPLINE |
weights | (output) map from pointIndex to weight. The sum of the weights will equal the length of the ray path in km. |
void geotess::GeoTessModel::getWeights | ( | double ** | rayPath, |
double * | radii, | ||
int * | layerIds, | ||
const int & | numPoints, | ||
const GeoTessInterpolatorType & | horizontalType, | ||
const GeoTessInterpolatorType & | radialType, | ||
map< int, double > & | weights | ||
) |
Compute the weights on each model point that results from interpolating positions along the specified ray path. The following procedure is implemented:
rayPath | (input) an ordered list of unit vectors that define a ray path through the model space |
radii | (input) an ordered list of the radii in km of each point that defines the ray path |
layerIds | (input) array of layer indices that specify the index of the layer in which path increment i resides where i is the path increment between points i and i+1 that define the ray path. If layerIds is empty, or layerIds[i] is less than zero, then the layer in which the path increment resides will be determined from the position and radius of the midpoint. |
numPoints | the number of points that define the raypath |
horizontalType | (input) either InterpolatorType::LINEAR, or InterpolatorType::NATURAL_NEIGHBOR |
radialType | (input) either InterpolatorType::LINEAR, or InterpolatorType::CUBIC_SPLINE |
weights | (output) map from pointIndex to weight. The sum of the weights will equal the length of the ray path in km. Input map will be cleared before population. |
|
inline |
Reset all the Data objects in the model. The number of attributes in the new Data objects will equal the number of elements in the supplied lists of attributeNames and attributeUnits (which must be equal in length).
The DataType of the new Data objects will be the type of the supplied fillValue. Data values will be copied from the old to the new Data objects with casting to the type of the new data objects. It is the responsibility of the caller to ensure that casting of data values does not result in corruption of data values or the loss of important information.
If the number of attributes in the new Data objects is less than the number in the old Data objects, old data values are lost. If the number of attributes in the new Data objects is greater than the number in the old Data objects, new values are populated with fillValue.
This method can only modify the Data objects associated with existing Profiles. It does not instantiate Profiles, change the ProfileType of existing profiles, modify the number of nodes in existing Profiles, or modify the radii within a Profile. To do any of those things requires replacing the Profile.
attributeNames | new names of the attributes. These names will replace the old names in the MetaData object. |
attributeUnits | new units of the attributes. These units will replace the old units in the MetaData object. The number of attributeNames and attributeUntis must be the same. |
fillValue | a value of type double, float, LONG_INT, int, short or byte. All data values in this models' Data objects will be of this type after this method executes. The supplied value is used to populate data values that are not copied from the old Data object. |
GeoTessException | if the model has not been populated with Profiles or if the number of attributeNames and attributeUnits is not the same. |
|
inline |
Replace all the Data objects in the entire model. All current Data is lost. The new Data objects will be of the same type as fillValue. The length of the Data arrays will be equal to the number of attributeNames and units supplied.
AttributeNames and attributeUnits must contain the same number of entries.
attributeNames | a semi-colon delimeted list of attribute names. |
attributeUnits | a semi-colon delimeted list of attribute units. |
fillValue | value to populate the model with |
|
inline |
|
inline |
|
static |
Test a file to see if it is a GeoTessModel file.
fileName |
GeoTessModel* geotess::GeoTessModel::loadModel | ( | const string & | inputFile, |
const string & | relGridFilePath = "" |
||
) |
Read model data and grid from a file.
inputFile | the path to the file that contains the model. |
relGridFilePath | if the grid is stored in a separate file then relGridFilePath is the relative path from the directory where the model located to the directory where the grid is located. The default value for relGridFilePath is "" which indicates that the grid file resides in the same directory as the model file. |
|
inlinevirtual |
Return true if this and the input other model are not equal. i.e., their grids have different gridIDs, they have different number of layers, or any of their Profiles are not equal. For profiles to be equal, they must be of the same type and size, and all of their radii must be equal and all of their data must be equal.
other | the other model to which this model is to be compared for equality. |
|
virtual |
Return true if this and the input other model are equal. i.e., their grids have the same gridIDs, they have the same number of layers, and all their Profiles are equal. For profiles to be equal, they must be of the same type and size, and all of their radii must be equal and all of their data must be equal.
other | the other model to which this model is to be compared for equality. |
|
inline |
Retrieve the number of Profiles of each ProfileType in each layer of the model. Also returns the total number of profiles of each type independent of layer.
count | is a 2D vector of ints with dimensions (nLayers+1) x nProfileTypes. |
|
inline |
Set the active region such that it encompasses all the nodes in the model.
|
inline |
Set the active region to encompass only the nodes contained within the specified Polygon.
KML and KMZ formats are not supported by the C++ code. See GeoTessExplorer (Java) which can convert KML/KMZ files to ascii.
polygon | the name of a file containing a valid Polygon2D or Polygon3D object, in ascii format. |
PolygonException |
|
inline |
Set the active region to encompass only the nodes contained within the specified Polygon object.
Polygon implements reference counting. This instance of GeoTessModel will increment polygon's reference count. When this model is done with the polygon, it will decrement polygon's reference count and delete the polygon if its reference count is zero.
polygon | a Polygon object. |
|
inline |
Specify the name of the ellipsoid that is to be used to convert between geocentric and geographic latitude and between depth and radius. The following EarthShapes are supported:
earthShapeName | the name of the ellipsoid that is to be used. |
void geotess::GeoTessModel::setProfile | ( | int | vertex, |
int | layer, | ||
GeoTessProfile * | profile | ||
) |
Replace the Profile object at the specified vertex and layer with a new one. Profile is checked to ensure that radii are monotonically increasing.
GeoTessModel assumes ownership of the Profile object and will delete it when it is no longer needed. Caller should not delete the Profile object.
vertex | index of a vertex in the 2D grid |
layer | index of one of the layers that comprise the model |
profile | a pointer to a Profile object that contains the radii and Data values to be stored in profile[vertex][layer]. |
|
inline |
Replace the Profile object at the specified vertex and layer with a new one. All radius and data values are copied out of the supplied vector<>s. GeoTessModel does not keep any references to the vectors<>
If vertex is not connected to other vertices by any triangles in the specified layer, than the values are ignored and a ProfileEmpty object is instantiated with just the first and last radii provided.
vertex | index of a vertex in the 2D grid |
layer | index of one of the layers that comprise the model |
radii | the radius values in km |
values | nNodes x nAttributes array of model values. |
|
inline |
Replace the Profile object at the specified vertex and layer with a new one. All radius and data values are copied out of the supplied vector<>s. GeoTessModel does not keep any references to the vectors<> If vertex is not connected to other vertices by any triangles in the specified layer, than the values are ignored and a ProfileEmpty object is instantiated with just the first and last radii provided.
vertex | index of a vertex in the 2D grid |
layer | index of one of the layers that comprise the model |
radii | the radius values in km |
nRadii | the number of radius values provided |
values | nNodes x nAttributes array of model values. |
nNodes | |
nAttributes |
|
inline |
Replace the Profile object at the specified vertex and layer with a new ProfileEmpty object.
vertex | index of a vertex in the 2D grid |
layer | index of one of the layers that comprise the model |
radii | the radius values in km. The only ones used are radii[0] and radii[radii.size()-1]; |
|
inline |
Replace the Profile object at the specified vertex and layer with a new ProfileEmpty object.
vertex | index of a vertex in the 2D grid |
layer | index of one of the layers that comprise the model |
radii | the radius values in km |
nRadii | number of radii provided. The only ones used are radii[0] and radii[nRadii-1]; |
|
inline |
Replace the Profile object at the specified vertex with a new one of type ProfileSurface, which supports 2D Earth models. All data values are copied out of the supplied vector<>. GeoTessModel does not keep any references to the vectors<>
vertex | index of a vertex in the 2D grid |
values | array of model values with nAttribute elements. |
|
inline |
Replace the Profile object at the specified vertex with a new one of type ProfileSurface, which supports 2D Earth models. All data values are copied out of the supplied vector<>. GeoTessModel does not keep any references to the array
vertex | index of a vertex in the 2D grid |
values | array of model values with nAttribute elements. |
nAttributes | length of values array |
|
inline |
Replace the Profile object at the specified vertex with a new one of type ProfileSurfEmpty, which supports 2D Earth models.
vertex | index of a vertex in the 2D grid |
|
inline |
Modify the attribute value stored at the specified vertex, layer, node, attribute.
vertexId | the vertex index |
layerId | the layer index |
nodeId | the node index |
attributeIndex | the attributeIndex |
value | the new attribute value (must be of type double, float, LONG_INT, int, short or byte). |
|
inline |
Modify the attribute value stored at the specified vertex, layer, node, attribute.
pointIndex | |
attributeIndex | the attributeIndex |
value | the new attribute value (must be of type double, float, LONG_INT, int, short or byte). |
string geotess::GeoTessModel::toString | ( | ) |
To string method.
|
inline |
Write the model to file. Grid information is included in the specified output file.
outputFile | name of the file to receive the model |
IOException |
void geotess::GeoTessModel::writeModel | ( | const string & | outputFile, |
const string & | gridFileName | ||
) |
Write the model to file. The data (radii and attribute values) are written to outputFile. If gridFileName is '*' then the grid information is written to the same file as the data. If gridFileName is something else, it should be the name of the file that contains the grid information. In the latter case, the gridFile referenced by gridFileName is not overwritten; all that happens is that the name of the grid file (with no path information) is stored in the data file.
outputFile | name of the file to receive the model |
gridFileName | name of file to receive the grid, or "*" |