GeoTessCPP
2.6.1
Software to facilitate storage and retrieval of 3D information about the Earth.
|
Top level class that manages the GeoTessMetaData, GeoTessGrid and GeoTessData that comprise a 3D Earth model. More...
#include <GeoTessModel.h>
Public Member Functions | |
GeoTessModel () | |
GeoTessModel (const string &inputFile, const string &relativeGridPath) | |
GeoTessModel (const string &modelInputFile) | |
GeoTessModel (vector< int > &attributeFilter) | |
GeoTessModel (const string &inputFile, const string &relativeGridPath, vector< int > &attributeFilter) | |
GeoTessModel (const string &modelInputFile, vector< int > &attributeFilter) | |
GeoTessModel (const string &gridFileName, GeoTessMetaData *metaData) | |
GeoTessModel (GeoTessGrid *grid, GeoTessMetaData *metaData) | |
virtual | ~GeoTessModel () |
virtual string | class_name () |
GeoTessModel * | loadModel (const string &inputFile, const string &relGridFilePath="") |
virtual LONG_INT | getMemory () |
EarthShape & | getEarthShape () |
void | setEarthShape (const string &earthShapeName) |
const GeoTessGrid & | getGrid () const |
GeoTessGrid & | getGrid () |
GeoTessMetaData & | getMetaData () |
GeoTessPosition * | getPosition () |
GeoTessPosition * | getPosition (const GeoTessInterpolatorType &horizontalType) |
GeoTessPosition * | getPosition (const GeoTessInterpolatorType &horizontalType, const GeoTessInterpolatorType &radialType) |
int | getNVertices () const |
int | getNLayers () const |
int | getNRadii (int vertexId, int layerId) |
int | getNData (int vertexId, int layerId) |
int | getNAttributes () |
double | getRadius (int vertexId, int layerId, int nodeId) |
double | getDepth (int vertexId, int layerId, int nodeId) |
double | getValueDouble (int vertexId, int layerId, int nodeId, int attributeIndex) |
float | getValueFloat (int vertexId, int layerId, int nodeId, int attributeIndex) |
LONG_INT | getValueLong (int vertexId, int layerId, int nodeId, int attributeIndex) |
int | getValueInt (int vertexId, int layerId, int nodeId, int attributeIndex) |
short | getValueShort (int vertexId, int layerId, int nodeId, int attributeIndex) |
byte | getValueByte (int vertexId, int layerId, int nodeId, int attributeIndex) |
template<typename T > | |
void | setValue (int vertexId, int layerId, int nodeId, int attributeIndex, T value) |
double | getRadius (int pointIndex) |
double | getDepth (int pointIndex) |
double | getValueDouble (int pointIndex, int attributeIndex) |
float | getValueFloat (int pointIndex, int attributeIndex) |
LONG_INT | getValueLong (int pointIndex, int attributeIndex) |
int | getValueInt (int pointIndex, int attributeIndex) |
short | getValueShort (int pointIndex, int attributeIndex) |
byte | getValueByte (int pointIndex, int attributeIndex) |
template<typename T > | |
void | setValue (int pointIndex, int attributeIndex, T value) |
int | getNPoints () |
virtual bool | operator== (const GeoTessModel &other) const |
virtual bool | operator!= (const GeoTessModel &other) const |
bool | is2D () |
bool | is3D () |
GeoTessPointMap * | getPointMap () |
const set< int > & | getConnectedVertices (int layerIndex) |
void | setActiveRegion () |
void | setActiveRegion (const string &polygon) |
void | setActiveRegion (GeoTessPolygon *polygon) |
GeoTessPolygon * | getPolygon () |
void | getLayerCount (bool activeOnly, int *layerCount) |
GeoTessProfile * | getProfile (int vertex, int layer) |
GeoTessProfile ** | getProfiles (int vertex) |
GeoTessProfile *** | getProfiles () const |
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) |
void | writeModel (const string &outputFile, const string &gridFileName="*") |
string | toString () |
void | getLayerCount (vector< int > &layerCount, const bool &activeOnly) |
void | profileCount (vector< vector< int > > &count) |
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) |
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) |
double | getPathIntegral (const int &attribute, const map< int, double > &weights) |
double | getPathIntegral (const int &attribute, 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 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 double *firstPoint, const double *lastPoint, double pointSpacing, double earthRadius, const GeoTessInterpolatorType &horizontalType, map< int, double > *weights=NULL) |
double | getPathIntegral2D (const int &attribute, GeoTessGreatCircle &greatCircle, double pointSpacing, double earthRadius, const GeoTessInterpolatorType &horizontalType, map< int, double > *weights=NULL) |
Static Public Member Functions | |
static bool | isGeoTessModel (const string &fileName) |
static string | getClassName (const string &fileName, const string &relGridFilePath=".") |
static LONG_INT | getReuseGridMapMemory () |
static int | getReuseGridMapSize () |
static void | clearReuseGrid () |
Top level class that manages the GeoTessMetaData, GeoTessGrid and GeoTessData that comprise a 3D Earth model.
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.
Definition at line 119 of file GeoTessModel.h.
geotess::GeoTessModel::GeoTessModel | ( | ) |
Default constructor.
geotess::GeoTessModel::GeoTessModel | ( | const string & | inputFile, |
const string & | relativeGridPath | ||
) |
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. |
geotess::GeoTessModel::GeoTessModel | ( | const string & | modelInputFile | ) |
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. |
geotess::GeoTessModel::GeoTessModel | ( | vector< int > & | attributeFilter | ) |
Default constructor.
attributeFilter | the indexes of available attributes that should be loaded into memory. |
geotess::GeoTessModel::GeoTessModel | ( | const string & | inputFile, |
const string & | relativeGridPath, | ||
vector< int > & | attributeFilter | ||
) |
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. |
geotess::GeoTessModel::GeoTessModel | ( | const string & | modelInputFile, |
vector< int > & | attributeFilter | ||
) |
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. |
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.
|
inlinevirtual |
|
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.
Definition at line 609 of file GeoTessModel.h.
|
static |
Determine the class name of a model stored in a file, i.e., whether it is a GeoTessModel, GeoTessModelSLBM, LibCorr3DModel, etc.
fileName |
|
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 |
Definition at line 1071 of file GeoTessModel.h.
|
inline |
Return the depth below surface of the current EarthShape in km of the node at pointIndex.
pointIndex |
Definition at line 906 of file GeoTessModel.h.
|
inline |
Return the depth below surface of current EarthShape in km of the node at vertexId, layerId, nodeId.
vertexId | the vertex index |
layerId | the layer index |
nodeId | the node index |
Definition at line 785 of file GeoTessModel.h.
|
inline |
Retrieve a reference to the ellipsoid that is stored in this GeoTessModel. This EarthShape object can be used to convert between geographic and geocentric latitude, and between radius and depth in the Earth.
The following EarthShapes are supported:
Definition at line 639 of file GeoTessModel.h.
|
inline |
Return a reference to the grid object.
Definition at line 679 of file GeoTessModel.h.
|
inline |
Return a reference to the grid object.
Definition at line 673 of file GeoTessModel.h.
|
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. |
Definition at line 1140 of file GeoTessModel.h.
|
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. |
Definition at line 1338 of file GeoTessModel.h.
|
inlinevirtual |
Return the amount of memory currently occupied by this GeoTessModel object NOT INCLUDING THE GRID. The returned value includes the memory needed for the GeoTessMetaData, all the Profiles (including all the radii and Data objects), and memory for the PointMap.
To retrieve the size of the grid call model.getGrid().getMemory(). Note that multiple GeoTessModels may reference the same GeoTessGrid object so if you are working with multiple models and they might be sharing references to the same grids then the best way to find the memory requirements of the set of GeoTessGrid objects currently in use is to call the static method GeoTessModel::getReuseGridMapMemory().
Definition at line 560 of file GeoTessModel.h.
|
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.
Definition at line 688 of file GeoTessModel.h.
|
inline |
Return the number of attributes that are associated with each node in the model.
Definition at line 765 of file GeoTessModel.h.
|
inline |
Return the number of Data objects that are specified in the Profile at vertexId, layerId
vertexId | the vertex index |
layerId | the layer index |
Definition at line 759 of file GeoTessModel.h.
|
inline |
Return the number of layers that comprise the model.
Definition at line 741 of file GeoTessModel.h.
|
inline |
Retrieve the number of points in the model, including all nodes along all profiles at all grid vertices.
Definition at line 1006 of file GeoTessModel.h.
|
inline |
Return the number of radii that are specified in the Profile at vertexId, layerId.
vertexId | the vertex index |
layerId | the layer index |
Definition at line 750 of file GeoTessModel.h.
|
inline |
Return number of vertices in the 2D geographic grid.
Definition at line 735 of file GeoTessModel.h.
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 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. |
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::getPathIntegral | ( | const int & | attribute, |
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. |
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::getPathIntegral2D | ( | const int & | attribute, |
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. |
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, |
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. |
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.
Definition at line 1056 of file GeoTessModel.h.
|
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.
Definition at line 1130 of file GeoTessModel.h.
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 |
Definition at line 1172 of file GeoTessModel.h.
|
inline |
Get a reference to all Profile objects.
Definition at line 1192 of file GeoTessModel.h.
|
inline |
Get a reference to the array of Profile objects for the specified vertex.
vertex | index of a vertex in the 2D grid |
Definition at line 1183 of file GeoTessModel.h.
|
inline |
Return the radius in km of the node at pointIndex.
pointIndex |
Definition at line 897 of file GeoTessModel.h.
|
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 |
Definition at line 774 of file GeoTessModel.h.
|
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 amount of memory required by all the grids stored.
Definition at line 582 of file GeoTessModel.h.
|
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.
Definition at line 602 of file GeoTessModel.h.
|
inline |
Return the value of the attribute at the specified pointIndex, attributeIndex, cast to a byte if necessary.
pointIndex | |
attributeIndex | the attributeIndex |
Definition at line 981 of file GeoTessModel.h.
|
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 |
Definition at line 873 of file GeoTessModel.h.
|
inline |
Return the value of the attribute at the specified pointIndex, attributeIndex, cast to a double if necessary.
pointIndex | |
attributeIndex | the attributeIndex |
Definition at line 916 of file GeoTessModel.h.
|
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 |
Definition at line 798 of file GeoTessModel.h.
|
inline |
Return the value of the attribute at the specified pointIndex, attributeIndex, cast to a float if necessary.
pointIndex | |
attributeIndex | the attributeIndex |
Definition at line 929 of file GeoTessModel.h.
|
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 |
Definition at line 813 of file GeoTessModel.h.
|
inline |
Return the value of the attribute at the specified pointIndex, attributeIndex, cast to a int if necessary.
pointIndex | |
attributeIndex | the attributeIndex |
Definition at line 955 of file GeoTessModel.h.
|
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 |
Definition at line 843 of file GeoTessModel.h.
|
inline |
Return the value of the attribute at the specified pointIndex, attributeIndex, cast to a LONG_INT if necessary.
pointIndex | |
attributeIndex | the attributeIndex |
Definition at line 942 of file GeoTessModel.h.
|
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 |
Definition at line 828 of file GeoTessModel.h.
|
inline |
Return the value of the attribute at the specified pointIndex, attributeIndex, cast to a short if necessary.
pointIndex | |
attributeIndex | the attributeIndex |
Definition at line 968 of file GeoTessModel.h.
|
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 |
Definition at line 858 of file GeoTessModel.h.
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 | ( | 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. |
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. |
|
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 |
Definition at line 1500 of file GeoTessModel.h.
|
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. |
Definition at line 1435 of file GeoTessModel.h.
|
inline |
Definition at line 1028 of file GeoTessModel.h.
|
inline |
Definition at line 1034 of file GeoTessModel.h.
|
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. |
Definition at line 1026 of file GeoTessModel.h.
|
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. |
Definition at line 1367 of file GeoTessModel.h.
|
inline |
Set the active region such that it encompasses all the nodes in the model.
Definition at line 1081 of file GeoTessModel.h.
|
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 |
Definition at line 1098 of file GeoTessModel.h.
|
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. |
Definition at line 1114 of file GeoTessModel.h.
|
inline |
Specify the name of the ellipsoid that is to be used to convert between geocentric and geographic latitude and between depth and radius. This ellipsoid will be save in this GeoTessModel if it is written to file. The following EarthShapes are supported:
earthShapeName | the name of the ellipsoid that is to be used. |
Definition at line 667 of file GeoTessModel.h.
|
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 |
Definition at line 1306 of file GeoTessModel.h.
|
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]; |
Definition at line 1273 of file GeoTessModel.h.
|
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 |
Definition at line 1243 of file GeoTessModel.h.
|
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 |
Definition at line 1298 of file GeoTessModel.h.
|
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. |
Definition at line 1285 of file GeoTessModel.h.
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 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]; |
Definition at line 1260 of file GeoTessModel.h.
|
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. |
Definition at line 1220 of file GeoTessModel.h.
|
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). |
Definition at line 995 of file GeoTessModel.h.
|
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). |
Definition at line 889 of file GeoTessModel.h.
string geotess::GeoTessModel::toString | ( | ) |
To string method.
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 '*' or omitted 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 (just the name; no path 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 (no path info), or "*" |