GeoTessCPP  2.1
Software to facilitate storage and retrieval of 3D information about the Earth.
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
GeoTessModel.h
Go to the documentation of this file.
1 //- ****************************************************************************
2 //-
3 //- Copyright 2009 Sandia Corporation. Under the terms of Contract
4 //- DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
5 //- retains certain rights in this software.
6 //-
7 //- BSD Open Source License.
8 //- All rights reserved.
9 //-
10 //- Redistribution and use in source and binary forms, with or without
11 //- modification, are permitted provided that the following conditions are met:
12 //-
13 //- * Redistributions of source code must retain the above copyright notice,
14 //- this list of conditions and the following disclaimer.
15 //- * Redistributions in binary form must reproduce the above copyright
16 //- notice, this list of conditions and the following disclaimer in the
17 //- documentation and/or other materials provided with the distribution.
18 //- * Neither the name of Sandia National Laboratories nor the names of its
19 //- contributors may be used to endorse or promote products derived from
20 //- this software without specific prior written permission.
21 //-
22 //- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 //- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 //- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 //- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
26 //- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 //- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 //- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 //- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 //- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 //- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 //- POSSIBILITY OF SUCH DAMAGE.
33 //-
34 //- ****************************************************************************
35 
36 #ifndef GEOTESSMODEL_OBJECT_H
37 #define GEOTESSMODEL_OBJECT_H
38 
39 // **** _SYSTEM INCLUDES_ ******************************************************
40 
41 #include <iostream>
42 #include <string>
43 #include <fstream>
44 #include <vector>
45 #include <map>
46 
47 // use standard library objects
48 using namespace std;
49 
50 // **** _LOCAL INCLUDES_ *******************************************************
51 
52 #include "CPPUtils.h"
53 #include "GeoTessUtils.h"
55 #include "GeoTessException.h"
56 #include "GeoTessPointMap.h"
57 #include "GeoTessProfileSurface.h"
58 #include "GeoTessProfileEmpty.h"
60 #include "GeoTessProfileType.h"
61 #include "EarthShape.h"
62 
63 // **** _BEGIN GEOTESS NAMESPACE_ **********************************************
64 
65 namespace geotess
66 {
67 
68 // **** _FORWARD REFERENCES_ ***************************************************
69 
70 class GeoTessPosition;
71 class GeoTessGrid;
72 class GeoTessMetaData;
73 class GeoTessOptimizationType;
74 class GeoTessProfile;
75 class IFStreamAscii;
76 class IFStreamBinary;
77 
78 // **** _CLASS DEFINITION_ *****************************************************
79 
120 {
122 
123 protected:
124 
136  static map<string, GeoTessGrid*> reuseGridMap;
137 
141  GeoTessGrid* grid;
142 
147  GeoTessProfile*** profiles;
148 
165  GeoTessMetaData* metaData;
166 
172  GeoTessPointMap* pointMap;
173 
177  void deleteProfiles();
178 
189  void loadModelAscii(const string& inputFile, const string& relGridFilePath);
190 
207  virtual void loadModelAscii(IFStreamAscii& input, const string& inputDirectory,
208  const string& relGridFilePath);
209 
223  void loadModelBinary(const string& inputFile, const string& relGridFilePath);
224 
240  virtual void loadModelBinary(IFStreamBinary& input, const string& inputDirectory,
241  const string& relGridFilePath);
242 
252  void writeModelAscii(const string& outputFile, const string& gridFileName);
253 
263  virtual void writeModelAscii(IFStreamAscii& output, const string& gridFileName);
264 
274  void writeModelBinary(const string& outputFile, const string& gridFileName);
275 
285  virtual void writeModelBinary(IFStreamBinary& output, const string& gridFileName);
286 
299  template<class T>
300  void loadGrid(T& input, const string& inputDirectory,
301  const string& relGridFilePath, const string& gridFileName,
302  const string& gridID, const string& funcName)
303  {
304  // process grid
305 
306  grid = NULL;
307  map<string, GeoTessGrid*>::iterator it = reuseGridMap.find(gridID);
308  if (it != reuseGridMap.end())
309  grid = it->second;
310 
311  if (gridFileName == "*")
312  {
313  // load the grid from this input file. The grid has to be read from the
314  // file, even a reference was retrieved from the reuseGridMap, so that the
315  // file is positioned where classes that extend GeoTessModel can read
316  // additional data.
317  GeoTessGrid* g = new GeoTessGrid(input);
318  if (!grid)
319  {
320  grid = g;
321 
322  grid->setGridInputFile(metaData->getInputModelFile());
323 
324  if (metaData->isGridReuseOn())
325  reuseGridMap[gridID] = grid;
326  }
327  else
328  delete g;
329  }
330  else if (!grid)
331  {
332  // build the name of the grid file using the input directory and
333  // the relative path to the grid file. Assume that both
334  // inputDirectory and relGridFilePath may be null or empty.
335  string gridFil = gridFileName;
336  if (relGridFilePath != "")
337  gridFil = CPPUtils::insertPathSeparator(relGridFilePath, gridFileName);
338  if (inputDirectory != "")
339  gridFil = CPPUtils::insertPathSeparator(inputDirectory, gridFil);
340 
341  grid = new GeoTessGrid();
342  grid->loadGrid(gridFil);
343  if (metaData->isGridReuseOn())
344  reuseGridMap[gridID] = grid;
345 
346  // throw an error if the grid ID's are not equal
347 
348  if (grid->getGridID() != gridID)
349  {
350  ostringstream os;
351  os << endl << "ERROR in GeoTessModel::" + funcName << endl
352  << "gridIDs in model file and existingGrid are not equal: "
353  << endl << " Model File gridID = " << gridID << endl
354  << " Grid File gridID = " << grid->getGridID() << endl;
355  throw GeoTessException(os, __FILE__, __LINE__, 1002);
356  }
357  }
358 
359  // add a reference to the grid and build the point map
360 
361  grid->addReference();
362  }
363 
364 private:
365 
366  void constructor(const string& gridFileName, GeoTessGrid* grid, GeoTessMetaData* metaData);
367 
369 
370 public:
371 
376  GeoTessModel();
377 
399  GeoTessModel(const string& inputFile, const string& relativeGridPath);
400 
413  GeoTessModel(const string& modelInputFile);
414 
421  GeoTessModel(vector<int>& attributeFilter);
422 
446  GeoTessModel(const string& inputFile, const string& relativeGridPath,
447  vector<int>& attributeFilter);
448 
463  GeoTessModel(const string& modelInputFile, vector<int>& attributeFilter);
464 
494  GeoTessModel(const string& gridFileName, GeoTessMetaData* metaData);
495 
530  GeoTessModel(GeoTessGrid* grid, GeoTessMetaData* metaData);
531 
535  virtual ~GeoTessModel();
536 
541  static string class_name() { return "GeoTessModel"; }
542 
554  GeoTessModel* loadModel(const string& inputFile, const string& relGridFilePath = "");
555 
562  static bool isGeoTessModel(const string& fileName);
563 
578  virtual LONG_INT getMemory()
579  {
580  LONG_INT memory = (LONG_INT)sizeof(GeoTessModel);
581 
582  memory += metaData->getMemory();
583 
584  if (profiles)
585  for (int i=0; i<getNVertices(); ++i)
586  for (int j=0; j<getNLayers(); ++j)
587  if (profiles[i][j])
588  memory += profiles[i][j]->getMemory();
589  if (pointMap)
590  memory += pointMap->getMemory();
591  return memory;
592  }
593 
600  static LONG_INT getReuseGridMapMemory()
601  {
602  // this ignores some memory allocated to support the map. It is complicated and
603  // platform dependent. Also probably small compared to the size of the Grids.
604  LONG_INT memory = sizeof(map<string, GeoTessGrid*>);
605 
606  memory += (LONG_INT) (reuseGridMap.size() * (sizeof(string) + sizeof(GeoTessGrid*)));
607 
608  for (map<string, GeoTessGrid*>::iterator it = reuseGridMap.begin(); it != reuseGridMap.end(); it++)
609  memory += (LONG_INT)it->first.length() + it->second->getMemory();
610 
611  return memory;
612  }
613 
620  static int getReuseGridMapSize() { return reuseGridMap.size(); }
621 
627  static void clearReuseGrid() { reuseGridMap.clear(); }
628 
657  EarthShape& getEarthShape() { return metaData->getEarthShape(); }
658 
685  void setEarthShape(const string& earthShapeName) { metaData->setEarthShape(earthShapeName); }
686 
691  const GeoTessGrid& getGrid() const { return *grid; }
692 
697  GeoTessGrid& getGrid(){ return *grid; }
698 
706  GeoTessMetaData& getMetaData() { return *metaData; }
707 
716  GeoTessPosition* getPosition();
717 
731  GeoTessPosition* getPosition(const GeoTessInterpolatorType& horizontalType);
732 
746  GeoTessPosition* getPosition(const GeoTessInterpolatorType& horizontalType,
747  const GeoTessInterpolatorType& radialType);
748 
753  int getNVertices() const { return grid->getNVertices(); }
754 
759  int getNLayers() const { return metaData->getNLayers(); }
760 
768  int getNRadii(int vertexId, int layerId) { return profiles[vertexId][layerId]->getNRadii(); }
769 
777  int getNData(int vertexId, int layerId) { return profiles[vertexId][layerId]->getNData(); }
778 
783  int getNAttributes() { return metaData->getNAttributes(); }
784 
792  double getRadius(int vertexId, int layerId, int nodeId)
793  { return profiles[vertexId][layerId]->getRadius(nodeId); }
794 
803  double getDepth(int vertexId, int layerId, int nodeId)
804  { return getEarthShape().getEarthRadius(grid->getVertex(vertexId))
805  - profiles[vertexId][layerId]->getRadius(nodeId); }
806 
816  double getValueDouble(int vertexId, int layerId, int nodeId, int attributeIndex)
817  {
818  GeoTessData* data = profiles[vertexId][layerId]->getData(nodeId);
819  return data == NULL ? NaN_DOUBLE : data->getDouble(attributeIndex);
820  }
821 
831  float getValueFloat(int vertexId, int layerId, int nodeId, int attributeIndex)
832  {
833  GeoTessData* data = profiles[vertexId][layerId]->getData(nodeId);
834  return data == NULL ? NaN_FLOAT : data->getFloat(attributeIndex);
835  }
836 
846  LONG_INT getValueLong(int vertexId, int layerId, int nodeId, int attributeIndex)
847  {
848  GeoTessData* data = profiles[vertexId][layerId]->getData(nodeId);
849  return data == NULL ? LONG_MIN : data->getLong(attributeIndex);
850  }
851 
861  int getValueInt(int vertexId, int layerId, int nodeId, int attributeIndex)
862  {
863  GeoTessData* data = profiles[vertexId][layerId]->getData(nodeId);
864  return data == NULL ? INT_MIN : data->getInt(attributeIndex);
865  }
866 
876  short getValueShort(int vertexId, int layerId, int nodeId, int attributeIndex)
877  {
878  GeoTessData* data = profiles[vertexId][layerId]->getData(nodeId);
879  return data == NULL ? SHRT_MIN : data->getShort(attributeIndex);
880  }
881 
891  byte getValueByte(int vertexId, int layerId, int nodeId, int attributeIndex)
892  {
893  GeoTessData* data = profiles[vertexId][layerId]->getData(nodeId);
894  return data == NULL ? CHAR_MIN : data->getByte(attributeIndex);
895  }
896 
906  template<typename T>
907  void setValue(int vertexId, int layerId, int nodeId, int attributeIndex, T value)
908  { profiles[vertexId][layerId]->getData(nodeId)->setValue(attributeIndex, value); }
909 
915  double getRadius(int pointIndex)
916  { return getPointMap()->getPointRadius(pointIndex); }
917 
924  double getDepth(int pointIndex)
925  { return getPointMap()->getPointDepth(pointIndex); }
926 
934  double getValueDouble(int pointIndex, int attributeIndex)
935  {
936  GeoTessData* data = getPointMap()->getPointData(pointIndex);
937  return data == NULL ? NaN_DOUBLE : data->getDouble(attributeIndex);
938  }
939 
947  float getValueFloat(int pointIndex, int attributeIndex)
948  {
949  GeoTessData* data = getPointMap()->getPointData(pointIndex);
950  return data == NULL ? NaN_FLOAT : data->getFloat(attributeIndex);
951  }
952 
960  LONG_INT getValueLong(int pointIndex, int attributeIndex)
961  {
962  GeoTessData* data = getPointMap()->getPointData(pointIndex);
963  return data == NULL ? LONG_MIN : data->getLong(attributeIndex);
964  }
965 
973  int getValueInt(int pointIndex, int attributeIndex)
974  {
975  GeoTessData* data = getPointMap()->getPointData(pointIndex);
976  return data == NULL ? INT_MIN : data->getInt(attributeIndex);
977  }
978 
986  short getValueShort(int pointIndex, int attributeIndex)
987  {
988  GeoTessData* data = getPointMap()->getPointData(pointIndex);
989  return data == NULL ? SHRT_MIN : data->getShort(attributeIndex);
990  }
991 
999  byte getValueByte(int pointIndex, int attributeIndex)
1000  {
1001  GeoTessData* data = getPointMap()->getPointData(pointIndex);
1002  return data == NULL ? CHAR_MIN : data->getByte(attributeIndex);
1003  }
1004 
1012  template<typename T>
1013  void setValue(int pointIndex, int attributeIndex, T value)
1014  {
1015  GeoTessData* data = getPointMap()->getPointData(pointIndex);
1016  if (data != NULL) data->setValue(attributeIndex, value);
1017  }
1018 
1024  int getNPoints() { return getPointMap()->size(); }
1025 
1034  virtual bool operator == (const GeoTessModel& other) const;
1035 
1044  virtual bool operator != (const GeoTessModel& other) const { return !(*this == other); } ;
1045 
1046  bool is2D()
1047  {
1048  return getProfile(0, 0)->getType() == GeoTessProfileType::SURFACE
1049  || getProfile(0, 0)->getType() == GeoTessProfileType::SURFACE_EMPTY;
1050  }
1051 
1052  bool is3D()
1053  {
1054  return !is2D();
1055  }
1056 
1074  GeoTessPointMap* getPointMap()
1075  {
1076  if (!pointMap->isPopulated())
1077  pointMap->setActiveRegion();
1078  return pointMap;
1079  }
1080 
1089  const set<int>& getConnectedVertices(int layerIndex)
1090  {
1091  return grid->getVertexIndicesTopLevel(metaData->getTessellation(layerIndex));
1092  }
1093 
1099  void setActiveRegion()
1100  {
1101  pointMap->setActiveRegion();
1102  }
1103 
1116  void setActiveRegion(const string& polygon)
1117  {
1118  pointMap->setActiveRegion(polygon);
1119  }
1120 
1132  void setActiveRegion(GeoTessPolygon* polygon)
1133  {
1134  if (polygon == NULL)
1135  pointMap->setActiveRegion();
1136  else
1137  pointMap->setActiveRegion(polygon);
1138  }
1139 
1148  GeoTessPolygon* getPolygon() { return pointMap->getPolygon(); }
1149 
1158  void getLayerCount(bool activeOnly, int* layerCount)
1159  {
1160  for (int layer=0; layer<getNLayers(); ++layer)
1161  layerCount[layer] = 0;
1162 
1163  GeoTessProfile** pp;
1164  GeoTessProfile* p;
1165  for (int v=0; v<getNVertices(); ++v)
1166  {
1167  pp = profiles[v];
1168  for (int layer=0; layer<getNLayers(); ++layer)
1169  {
1170  if (activeOnly)
1171  {
1172  p = pp[layer];
1173  for (int n=0; n<p->getNData(); ++n)
1174  if (p->getPointIndex(n) >= 0)
1175  ++layerCount[layer];
1176  }
1177  else
1178  layerCount[layer] += pp[layer]->getNData();
1179  }
1180  }
1181  }
1182 
1190  GeoTessProfile* getProfile(int vertex, int layer)
1191  {
1192  return profiles[vertex][layer];
1193  }
1194 
1201  GeoTessProfile** getProfiles(int vertex)
1202  {
1203  return profiles[vertex];
1204  }
1205 
1210  GeoTessProfile*** getProfiles() const { return profiles; }
1211 
1222  void setProfile(int vertex, int layer, GeoTessProfile* profile);
1223 
1237  template<typename T>
1238  void setProfile(int vertex, int layer, vector<float>& radii, vector<vector<T> >& values)
1239  {
1240  if (getConnectedVertices(layer).count(vertex) == 1)
1241  setProfile(vertex, layer, GeoTessProfile::newProfile(radii, values));
1242  else setProfile(vertex, layer, new GeoTessProfileEmpty(radii[0], radii[radii.size()-1]));
1243  }
1244 
1260  template<typename T>
1261  void setProfile(const int& vertex, const int& layer,
1262  float* radii, const int& nRadii,
1263  T** values, const int& nNodes, const int& nAttributes)
1264  {
1265  if (getConnectedVertices(layer).count(vertex) == 1)
1266  setProfile(vertex, layer, GeoTessProfile::newProfile(radii, nRadii, values, nNodes, nAttributes));
1267  else setProfile(vertex, layer, new GeoTessProfileEmpty(radii[0], radii[nRadii-1]));
1268  }
1269 
1278  void setProfile(int vertex, int layer, vector<float>& radii)
1279  { setProfile(vertex, layer, new GeoTessProfileEmpty(radii[0], radii[radii.size()-1])); }
1280 
1290  template<typename T>
1291  void setProfile(const int& vertex, const int& layer, float* radii, const int& nRadii)
1292  { setProfile(vertex, layer, new GeoTessProfileEmpty(radii[0], radii[nRadii-1])); }
1293 
1302  template<typename T>
1303  void setProfile(const int& vertex, vector<T>& values)
1304  { setProfile(vertex, 0, new GeoTessProfileSurface(GeoTessData::getData(values))); }
1305 
1315  template<typename T>
1316  void setProfile(const int& vertex, T* values, const int& nAttributes)
1317  { setProfile(vertex, 0, new GeoTessProfileSurface(GeoTessData::getData(values, nAttributes))); }
1318 
1324  void setProfile(const int& vertex)
1325  { setProfile(vertex, 0, new GeoTessProfileSurfaceEmpty()); }
1326 
1334  void writeModel(const string& outputFile) { writeModel(outputFile, "*"); }
1335 
1350  void writeModel(const string& outputFile, const string& gridFileName);
1351 
1356  string toString();
1357 
1365  void getLayerCount(vector<int>& layerCount, const bool& activeOnly)
1366  {
1367  layerCount.resize(metaData->getNLayers(), 0);
1368 
1369  GeoTessProfile** pp;
1370  GeoTessProfile* p;
1371  for (int vtx=0; vtx<getNVertices(); ++vtx)
1372  {
1373  pp = profiles[vtx];
1374  for (int layer = 0; layer < metaData->getNLayers(); ++layer)
1375  if (activeOnly)
1376  {
1377  p = pp[layer];
1378  for (int n = 0; n < p->getNData(); ++n)
1379  if (p->getPointIndex(n) >= 0)
1380  ++layerCount[layer];
1381  }
1382  else
1383  layerCount[layer] += pp[layer]->getNData();
1384  }
1385  }
1386 
1394  void profileCount(vector< vector<int> >& count)
1395  {
1396  count.clear();
1397 
1398  getPointMap();
1399 
1400  // this is total number of profiles of each type, independent of layer index.
1401  vector<int> totalCount;
1402  for (int profileType=0; profileType<GeoTessProfileType::size(); ++profileType)
1403  totalCount.push_back(0);
1404 
1405  for (int layer = 0; layer < getNLayers(); ++layer)
1406  {
1407  vector<int> typeCount;
1408 
1409  for (int profileType=0; profileType<GeoTessProfileType::size(); ++profileType)
1410  typeCount.push_back(0);
1411 
1412  count.push_back(typeCount);
1413  }
1414 
1415  for (int layer = 0; layer < getNLayers(); ++layer)
1416  {
1417  for (int vertex = 0; vertex < metaData->getNVertices(); ++vertex)
1418  {
1419  int pType = profiles[vertex][layer]->getType().ordinal();
1420  count[layer][pType] += 1;
1421  totalCount[pType] += 1;
1422  }
1423  }
1424 
1425  count.push_back(totalCount);
1426  }
1427 
1461  template<typename T>
1462  void initializeData(const vector<string>& attributeNames,
1463  const vector<string>& attributeUnits, T fillValue)
1464  {
1465  if (profiles == NULL)
1466  {
1467  ostringstream os;
1468  os << endl << "ERROR in GeoTessModel::initializeData" << endl
1469  << "Attempting to initialize the model data before Profiles" << endl
1470  << "have been specified (profiles == NULL)" << endl;
1471  throw GeoTessException(os, __FILE__, __LINE__, 1001);
1472  }
1473 
1474  const GeoTessDataType& newDataType = GeoTessDataType::getDataType(fillValue);
1475  int nAttributesNew = attributeNames.size();
1476 
1477  int newDataTypeOrdinal = newDataType.ordinal();
1478  int oldDataTypeOrdinal = metaData->getDataType().ordinal();
1479 
1480  // if neither the dataType or the number of attributes has changed, there is no need to
1481  // copy the data. The only thing that happens is that the attributeNames or attributeUnits might change.
1482  if (newDataTypeOrdinal != oldDataTypeOrdinal || nAttributesNew != metaData->getNAttributes())
1483  {
1484  // initialize an array of the new dataType with number of elements
1485  // equal to the number of new attributes and populate it with fillValue.
1486  T* newValues = new T[nAttributesNew];
1487  for (int i=0; i<nAttributesNew; ++i)
1488  newValues[i] = fillValue;
1489 
1490  GeoTessProfile* profile;
1491  vector<GeoTessData*> data;
1492  for (int v = 0; v < getNVertices(); ++v)
1493  for (int lid = 0; lid < getNLayers(); ++lid)
1494  {
1495  profile = profiles[v][lid];
1496  data.reserve(profile->getNData());
1497  data.clear();
1498  for (int n = 0; n < profile->getNData(); ++n)
1499  {
1500  profile->getData(n)->getValues(newValues, nAttributesNew);
1501  data.push_back(GeoTessData::getData(newValues, nAttributesNew));
1502  }
1503  // set new entries into profile and continue
1504  profile->setData(data);
1505  }
1506  delete[] newValues;
1507  }
1508 
1509  metaData->setDataType(newDataType);
1510 
1511  metaData->setAttributes(attributeNames, attributeUnits);
1512  }
1513 
1526  template<typename T>
1527  void initializeData(const string& attributeNames,
1528  const string& attributeUnits, T fillValue)
1529  {
1530  vector<string> names;
1531  CPPUtils::tokenizeString(attributeNames, ";", names);
1532  vector<string> units;
1533  CPPUtils::tokenizeString(attributeUnits, ";", units);
1534  initializeData(names, units, fillValue);
1535  }
1536 
1561  void getWeights(const double* pointA, const double* pointB, const double& pointSpacing, const double& radius,
1562  const GeoTessInterpolatorType& horizontalType, map<int, double>& weights);
1563 
1587  void getWeights(GeoTessGreatCircle& greatCircle, const double& pointSpacing, const double& radius,
1588  const GeoTessInterpolatorType& horizontalType, map<int, double>& weights);
1589 
1613  void getWeights(const vector<double*>& rayPath,
1614  const vector<double>& radii,
1615  const vector<int>& layerIds,
1616  const GeoTessInterpolatorType& horizontalType,
1617  const GeoTessInterpolatorType& radialType,
1618  map<int, double>& weights);
1619 
1644  void getWeights(double** rayPath, double* radii, int* layerIds, const int& numPoints,
1645  const GeoTessInterpolatorType& horizontalType,
1646  const GeoTessInterpolatorType& radialType,
1647  map<int, double>& weights);
1648 
1661  double getPathIntegral(const int& attribute, const map<int, double>& weights);
1662 
1696  double getPathIntegral(const int& attribute,
1697  double** rayPath, double* radii, int* layerIds, const int& numPoints,
1698  const GeoTessInterpolatorType& horizontalType, const GeoTessInterpolatorType& radialType,
1699  map<int, double>* weights = NULL);
1700 
1733  double getPathIntegral(const int& attribute,
1734  const vector<double*>& rayPath, const vector<double>& radii, const vector<int>& layerIds,
1735  const GeoTessInterpolatorType& horizontalType, const GeoTessInterpolatorType& radialType,
1736  map<int, double>* weights = NULL);
1737 
1773  double getPathIntegral2D(const int& attribute,
1774  const double* firstPoint, const double* lastPoint, double pointSpacing,
1775  double earthRadius, const GeoTessInterpolatorType& horizontalType,
1776  map<int, double>* weights = NULL);
1777 
1812  double getPathIntegral2D(const int& attribute,
1813  GeoTessGreatCircle& greatCircle, double pointSpacing,
1814  double earthRadius, const GeoTessInterpolatorType& horizontalType,
1815  map<int, double>* weights = NULL);
1816 
1818 
1819  // the following constructors are all deprecated because GeoTessOptimization is no longer used.
1820  // GeoTess is always optimized for speed.
1821  GeoTessModel(const GeoTessOptimizationType* optimization);
1822  GeoTessModel(const string& inputFile, const string& relativeGridPath, const GeoTessOptimizationType* optimization);
1823  GeoTessModel(const string& modelInputFile, const GeoTessOptimizationType* optimization);
1824  GeoTessModel(vector<int>& attributeFilter, const GeoTessOptimizationType* optimization);
1825  GeoTessModel(const string& inputFile, const string& relativeGridPath,
1826  vector<int>& attributeFilter, const GeoTessOptimizationType* optimization);
1827  GeoTessModel(const string& modelInputFile, vector<int>& attributeFilter,
1828  const GeoTessOptimizationType* optimization);
1829 
1830 // // The following getWeight() and getPathIntegral() functions are deprecated.
1831 // // They were included in GeoTessModel v2.1.1 but were reconfigured in v2.2.0.
1832 // // They are included here for backward compatibility, but will not appear in the documentation.
1833 // void getWeights(const vector<double*>& rayPath, const vector<double>& radii,
1834 // const GeoTessInterpolatorType& ht, const GeoTessInterpolatorType& rt, map<int, double>& weights)
1835 // { vector<int> layerIds; getWeights(rayPath, radii, layerIds, ht, rt, weights);}
1836 //
1837 // void getWeights(double** rayPath, double* radii, const int& numPoints,
1838 // const GeoTessInterpolatorType& ht,const GeoTessInterpolatorType& rt,map<int, double>& weights)
1839 // { getWeights(rayPath, radii, NULL, numPoints, ht, rt, weights);}
1840 //
1841 // double getPathIntegral(const int& attribute, const bool& reciprocal, double** rayPath, double* radii, const int& numPoints,
1842 // const GeoTessInterpolatorType& ht, const GeoTessInterpolatorType& rt)
1843 // { return getPathIntegral(attribute, reciprocal, rayPath, radii, NULL, numPoints, ht, rt); }
1844 //
1845 // double getPathIntegral(const int& attribute, const bool& reciprocal, double** rayPath, double* radii, const int& numPoints,
1846 // const GeoTessInterpolatorType& ht, const GeoTessInterpolatorType& rt, map<int, double>& weights)
1847 // { return getPathIntegral(attribute, reciprocal, rayPath, radii, NULL, numPoints, ht, rt, &weights); }
1848 //
1849 // double getPathIntegral2D(const int& attribute, const bool& reciprocal,
1850 // const double* firstPoint, const double* lastPoint, const double& pointSpacing,
1851 // const double& earthRadius,
1852 // const GeoTessInterpolatorType& horizontalType, map<int, double>& weights)
1853 // { return getPathIntegral2D(attribute, reciprocal, firstPoint, lastPoint, pointSpacing, earthRadius, horizontalType, &weights); }
1854 
1855 
1859  bool isSupportedFormatVersion(int frmtVrsn) { return (frmtVrsn == 1) ? true : false; }
1860 
1866  bool testLayerRadii();
1867 
1868 
1870 
1871 };
1872 // end class GeoTessModel
1873 
1874 }// end namespace geotess
1875 
1876 #endif // GEOTESSMODEL_OBJECT_H