GeoTessCPP  2.6.1
Software to facilitate storage and retrieval of 3D information about the Earth.
All Classes Namespaces Files Functions Variables Typedefs Friends Macros
GeoTessGrid.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 GEOTESSGRID_OBJECT_H
37 #define GEOTESSGRID_OBJECT_H
38 
39 // **** _SYSTEM INCLUDES_ ******************************************************
40 
41 #include <iostream>
42 #include <string>
43 #include <fstream>
44 #include <vector>
45 #include <set>
46 #include <list>
47 #include <set>
48 #include <sstream>
49 
50 // use standard library objects
51 using namespace std;
52 
53 // **** _LOCAL INCLUDES_ *******************************************************
54 
55 #include "CPPUtils.h"
56 #include "GeoTessUtils.h"
57 #include "ArrayReuse.h"
58 #include "GeoTessException.h"
60 
61 // **** _BEGIN GEOTESS NAMESPACE_ **********************************************
62 
63 namespace geotess
64 {
65 
66 // **** _FORWARD REFERENCES_ ***************************************************
67 
68 class IFStreamAscii;
69 class IFStreamBinary;
70 
71 // **** _CLASS DEFINITION_ *****************************************************
72 
101 struct Edge
102 {
106  int vj;
107 
111  int vk;
112 
113  int cornerj;
114 
118  int tLeft;
119 
123  int tRight;
124 
128  double normal[3]; //
129 
134  Edge* next; //
135 };
136 
167 {
168 protected:
169 
177  double** vertices;
178 
183 
189  int** triangles;
190 
195 
207  int** levels;
208 
212  int nLevels;
213 
228 
233 
239  void initialize();
240 
244  GeoTessGrid(const string& gid) :
245  vertices(NULL), nVertices(0),
246  triangles(NULL), nTriangles(0),
247  levels(NULL), nLevels(0),
248  tessellations(NULL), nTessellations(0),
249  descendants(NULL), gridID(gid),
250  gridInputFile("null"), gridOutputFile("null"), gridSoftwareVersion(""),
251  gridGenerationDate(""), refCount(0)
252  {
253  }
254 
255 private:
256 
264  int* descendants;
265 
283  vector<vector<Edge*> > edgeList;
284 
297  mutable vector<vector<Edge*> > spokeList;
298 
305  mutable vector<double*> circumCenters;
306 
315  string gridID;
316 
320  string gridInputFile;
321 
325  string gridOutputFile;
326 
330  string gridSoftwareVersion;
331 
336  string gridGenerationDate;
337 
341  int refCount;
342 
347  vector< vector< vector<int> > > vtxTriangles;
348 
354  mutable vector< set<int> > connectedVertices;
355 
359  GeoTessGrid* loadGridAscii(const string& inputFile);
360 
365  GeoTessGrid* loadGridAscii(IFStreamAscii& input);
366 
370  GeoTessGrid* loadGridBinary(const string& inputFile);
371 
375  virtual GeoTessGrid* loadGridBinary(IFStreamBinary& ifs);
376 
377  static void loadGridAsciiFront(IFStreamAscii& input, int& gridFileFormat,
378  string& gridSWVersion, string& fileCreationDate,
379  string& gridid, const string& grdInptFile);
380 
381  static void loadGridBinaryFront(IFStreamBinary& ifs, int& gridFileFormat,
382  string& gridSWVersion, string& fileCreationDate,
383  string& gridid, const string& grdInptFile);
384 
399  const set<int>& getVertexIndices(const int& level);
400 
401  void computeSpokeLists(const int& level) const;
402 
403 public:
404 
411  vertices(NULL), nVertices(0),
412  triangles(NULL), nTriangles(0),
413  levels(NULL), nLevels(0),
414  tessellations(NULL), nTessellations(0),
415  descendants(NULL), gridID(""),
416  gridInputFile("null"), gridOutputFile("null"), gridSoftwareVersion(""),
417  gridGenerationDate(""), refCount(0)
418  { }
419 
424  vertices(NULL), triangles(NULL), levels(NULL), tessellations(NULL),
425  descendants(NULL), gridID(""),
426  gridInputFile("null"), gridOutputFile("null"), gridSoftwareVersion(""),
427  gridGenerationDate(""), refCount(0)
428  { loadGridAscii(input); }
429 
434  vertices(NULL), triangles(NULL), levels(NULL), tessellations(NULL),
435  descendants(NULL), gridID(""),
436  gridInputFile("null"), gridOutputFile("null"), gridSoftwareVersion(""),
437  gridGenerationDate(""), refCount(0)
438  { loadGridBinary(input); }
439 
445 
451  GeoTessGrid& operator= (const GeoTessGrid& other);
452 
458  {
459  LONG_INT memory = (LONG_INT)sizeof(GeoTessGrid);
460 
461  // double** vertices
462  memory += nVertices * (LONG_INT)sizeof(double*) + nVertices * 3 * (LONG_INT)sizeof(double);
463 
464  // int** triangles
465  memory += nTriangles * (LONG_INT)sizeof(int*) + nTriangles * 3 * (LONG_INT)sizeof(int);
466 
467  // int** levels
468  memory += nLevels * (LONG_INT)sizeof(int*) + nLevels * 2 * (LONG_INT)sizeof(int);
469 
470  // int** tessellations
471  memory += nTessellations * (LONG_INT)sizeof(int*) + nTessellations * 2 * (LONG_INT)sizeof(int);
472 
473  // int* descendants
474  memory += nTriangles * (LONG_INT)sizeof(int);
475 
476  // vector<vector<Edge*> > edgeList : nTriangles x 3 array of Edges
477  memory += (LONG_INT) (edgeList.capacity() * sizeof(vector<Edge*>)
478  + edgeList.size() * 3 * (sizeof(Edge*) + sizeof(Edge)));
479 
480  // vector<vector<Edge*> > spokeList;
481  memory += (LONG_INT) (spokeList.capacity() * sizeof(vector<Edge*>)
482  + spokeList.size() * 3 * sizeof(Edge*));
483 
484  // vector<double*> circumCenters is nTriangles x 3 array of doubles
485  memory += (LONG_INT) (circumCenters.capacity() * sizeof(double*));
486  for (int i=0; i<(int)circumCenters.size(); ++i)
487  if (circumCenters[i]) memory += 3 * (LONG_INT)sizeof(double);
488 
489  // An nLevels x nVertices x n array that stores the indices of the n
490  // triangles of which each vertex is a member.
491  // vector< vector< vector<int> > > vtxTriangles;
492  memory += (LONG_INT) (vtxTriangles.capacity() * sizeof(vector< vector<int> >));
493  for (int i=0; i<(int)vtxTriangles.size(); ++i)
494  {
495  memory += (LONG_INT) (vtxTriangles[i].capacity() * sizeof(vector<int>));
496  for (int j=0; j<(int)vtxTriangles[i].size(); ++j)
497  memory += (LONG_INT) (vtxTriangles[i][j].capacity() * sizeof(int));
498  }
499 
500  // An nLevels x n array that stores the indexes of the n vertices
501  // that are connected together by triangles on the corresponding
502  // level. Lazy evaluation is used to construct this array of sets.
503  // vector< set<int> > connectedVertices;
504  memory += (LONG_INT) (connectedVertices.capacity() * sizeof(set<int>));
505  for (int i=0; i<(int)connectedVertices.size(); ++i)
506  memory += (LONG_INT) (connectedVertices[i].size() * sizeof(int));
507 
508  // add memory requirements for all the string variables.
509  memory += (LONG_INT) (gridID.length() + gridInputFile.length() + gridOutputFile.length()
510  + gridSoftwareVersion.length() + gridGenerationDate.length());
511 
512  return memory;
513  }
514 
520  GeoTessGrid* loadGrid(const string& inputFile);
521 
528  static string getGridID(const string& fileName);
529 
536  static bool isGeoTessGrid(const string& inputFile);
537 
543  bool operator == (const GeoTessGrid& g) const
544  { return (gridID == g.gridID); }
545 
551  bool operator != (const GeoTessGrid& g) const
552  { return !(*this == g); }
553 
564  const string& getGridID() const
565  {
566  return gridID;
567  }
568 
575  void setGridSoftwareVersion(const string& swVersion) {gridSoftwareVersion = swVersion; };
576 
583  const string& getGridSoftwareVersion() const {return gridSoftwareVersion; };
584 
591  void setGridGenerationDate(const string& gridDate) {gridGenerationDate = gridDate; };
592 
599  const string& getGridGenerationDate() const {return gridGenerationDate; };
600 
605  void setGridInputFile(const string& gridFile) { gridInputFile = gridFile; }
606 
614  const string& getGridInputFile() const {return gridInputFile; }
615 
623  const string& getGridOutputFile() const { return gridOutputFile; }
624 
630  const double* getVertex(int vertex) const
631  {
632  return vertices[vertex];
633  }
634 
643  int findClosestVertex(double* unit_vector, int tessId)
644  {
645  int* t = triangles[getTriangle(getFirstTriangle(tessId, 0), unit_vector)];
646 
647  int index = 0;
648  double dot = GeoTessUtils::dot(unit_vector, vertices[t[0]]);
649 
650  double doti = GeoTessUtils::dot(unit_vector, vertices[t[1]]);
651  if (doti > dot)
652  {
653  index = 1;
654  dot = doti;
655  }
656 
657  doti = GeoTessUtils::dot(unit_vector, vertices[t[2]]);
658  if (doti > dot)
659  {
660  index = 2;
661  dot = doti;
662  }
663 
664  return t[index];
665  }
666 
675  int getVertexIndex(int triangle, int corner) const
676  { return triangles[triangle][corner]; }
677 
693  int getVertexIndex(int tessId, int level, int triangle, int corner) const
694  {
695  return triangles[levels[tessellations[tessId][0] + level][0] + triangle][corner];
696  }
697 
704  int getVertexIndex(const double* u)
705  {
706  for (int i=nTessellations-1; i>=0; --i)
707  {
708  int vid = getVertexIndex(u, i);
709  if (vid >= 0)
710  return vid;
711  }
712  return -1;
713  }
714 
723  int getVertexIndex(const double* u, int tessId)
724  {
725  int* t = triangles[getTriangle(getFirstTriangle(tessId, 0), u)];
726 
727  if (GeoTessUtils::dot(u, vertices[t[0]]) > cos(1e-7))
728  return t[0];
729  if (GeoTessUtils::dot(u, vertices[t[1]]) > cos(1e-7))
730  return t[1];
731  if (GeoTessUtils::dot(u, vertices[t[2]]) > cos(1e-7))
732  return t[2];
733  return -1;
734  }
735 
747  double* getVertex(int tessId, int level, int triangle, int corner)
748  {
749  return vertices[triangles[levels[tessellations[tessId][0] + level][0] + triangle][corner]];
750  }
751 
761  double const* const* getVertices() const { return vertices; }
762 
771  void getVerticesTopLevel(const int& tessellation, set<const double*>& vectors)
772  {
773  getVertices(tessellation, getNLevels(tessellation)-1, vectors);
774  }
775 
785  void getVertices(const int& tessellation, const int& level, set<const double*>& vectors);
786 
799  const set<int>& getVertexIndices(const int& tessId, const int& level)
800  { return getVertexIndices(getLevel(tessId, level)); }
801 
813  const set<int>& getVertexIndicesTopLevel(const int& tessId)
814  { return getVertexIndices(tessellations[tessId][1] - 1); }
815 
820  int getNVertices() const { return nVertices; }
821 
826  int getNTessellations() const { return nTessellations; }
827 
835  int getNLevels(int tessellation) const
836  { return tessellations[tessellation][1] - tessellations[tessellation][0]; }
837 
846  int getLevel(int tessellation, int i) const
847  { return tessellations[tessellation][0] + i; }
848 
864  int getLastLevel(int tessellation) const
865  { return tessellations[tessellation][1] - 1; }
866 
881  int getTopLevel(int tessellation) const
882  { return tessellations[tessellation][1] - tessellations[tessellation][0] - 1; }
883 
893  int getNTriangles(int tessellation, int level) const
894  {
895  return levels[tessellations[tessellation][0] + level][1]
896  - levels[tessellations[tessellation][0] + level][0];
897  }
898 
910  int getTriangle(int tessellation, int level, int i) const
911  { return levels[tessellations[tessellation][0] + level][0] + i; }
912 
922  int getFirstTriangle(int tessellation, int level) const
923  { return levels[tessellations[tessellation][0] + level][0]; }
924 
934  int getLastTriangle(int tessellation, int level) const
935  { return levels[tessellations[tessellation][0] + level][1]-1; }
936 
946  int const* const* getTriangles() const { return triangles; }
947 
959  const int* getTriangleVertexIndexes(int triangleIndex) const
960  { return triangles[triangleIndex]; }
961 
973  int getTriangleVertexIndex(int triangleIndex, int cornerIndex) const
974  { return triangles[triangleIndex][cornerIndex]; }
975 
987  const double* getTriangleVertex(int triangleIndex, int cornerIndex) const
988  { return vertices[triangles[triangleIndex][cornerIndex]]; }
989 
990 
999  void getTriangleVertices(int triangle, double** triVrt)
1000  {
1001  int* corners = triangles[triangle];
1002  triVrt[0][0] = vertices[corners[0]][0];
1003  triVrt[0][1] = vertices[corners[0]][1];
1004  triVrt[0][2] = vertices[corners[0]][2];
1005  triVrt[1][0] = vertices[corners[1]][0];
1006  triVrt[1][1] = vertices[corners[1]][1];
1007  triVrt[1][2] = vertices[corners[1]][2];
1008  triVrt[2][0] = vertices[corners[2]][0];
1009  triVrt[2][1] = vertices[corners[2]][1];
1010  triVrt[2][2] = vertices[corners[2]][2];
1011  }
1012 
1018  {
1019  if (circumCenters.empty()) circumCenters.resize(nTriangles, NULL);
1020 
1021  for (int triangle=0; triangle<nTriangles; ++triangle)
1022  if (circumCenters[triangle] == NULL)
1023  {
1024  int* corners = triangles[triangle];
1025  circumCenters[triangle] = GeoTessUtils::circumCenterPlus(vertices[corners[0]],
1026  vertices[corners[1]], vertices[corners[2]]);
1027  }
1028  }
1029 
1034  const void computeCircumCenters(const int& level)
1035  {
1036  if (circumCenters.empty()) circumCenters.resize(nTriangles);
1037 
1038  if (circumCenters[levels[level][0]] == NULL)
1039  {
1040  for (int triangle=levels[level][0]; triangle<levels[level][1]; ++triangle)
1041  {
1042  int* corners = triangles[triangle];
1043  circumCenters[triangle] = GeoTessUtils::circumCenterPlus(vertices[corners[0]],
1044  vertices[corners[1]], vertices[corners[2]]);
1045  }
1046  }
1047  }
1048 
1064  const double* getCircumCenter(const int& triangle) const { return circumCenters[triangle]; }
1065 
1083  void getCircumCenter(const int& triangle, double* cc) const
1084  { cc[0]=circumCenters[triangle][0]; cc[1]=circumCenters[triangle][1]; cc[2]=circumCenters[triangle][2]; }
1085 
1100  int getNeighbor(const int& triangleIndex, const int& neighborIndex) const
1101  { return neighborIndex == 3 ? descendants[triangleIndex] : edgeList[triangleIndex][neighborIndex]->tLeft; }
1102 
1127  int getNeighbor(const int& tessellation, const int& level, const int& triangle, const int& side)
1128  { return getNeighbor(getTriangle(tessellation, level, triangle), side); }
1129 
1144  void getNeighbors(int triangleIndex, vector<int>& neighbors)
1145  {
1146  neighbors.clear();
1147  vector<Edge*> edges = edgeList[triangleIndex];
1148  neighbors.push_back(edges[0]->tLeft);
1149  neighbors.push_back(edges[1]->tLeft);
1150  neighbors.push_back(edges[2]->tLeft);
1151  neighbors.push_back(descendants[triangleIndex]);
1152  }
1153 
1176  void getNeighbors(const int& tessellation, const int& level, const int& triangle, vector<int>& neighbors)
1177  { getNeighbors(getTriangle(tessellation, level, triangle), neighbors); }
1178 
1192  int getNeighborIndex(const int& tid, const int& nid)
1193  {
1194  if (edgeList[tid][0]->tLeft == nid)
1195  return 0;
1196  if (edgeList[tid][1]->tLeft == nid)
1197  return 1;
1198  if (edgeList[tid][2]->tLeft == nid)
1199  return 2;
1200  return -1;
1201  }
1202 
1203  int const* getDescendants() const { return descendants; }
1204 
1205  int getDescendant(const int& triangle) const { return descendants[triangle]; }
1206 
1207  int getDescendant(const int& tessId, const int& level, const int& triangle) const
1208  { return descendants[getTriangle(tessId, level, triangle)]; }
1209 
1213  string toString();
1214 
1222  int getTriangle(int triangleIndex, const double* vector);
1223 
1231  const vector<vector<int> >& getVertexTriangles(const int& level) const { return vtxTriangles[level]; }
1232 
1245  const vector<int>& getVertexTriangles(const int& tessId, const int& level, const int& vertex) const
1246  { return vtxTriangles[tessellations[tessId][0] + level][vertex]; }
1247 
1261  const vector<int>& getVertexTriangles(int tessId, int vertex) const
1262  { return getVertexTriangles(tessId, getNLevels(tessId)-1, vertex); }
1263 
1270  //void clearVertexTriangles();
1271 
1281  void getVertexNeighborsOrdered(const int& tessId, const int& level, const int& vertex, vector<int>& v);
1282 
1294  void getVertexNeighbors(const int& tessId, const int& level, const int& vertex, set<int>& nbrs)
1295  { getVertexNeighbors(tessId, level, vertex, 1, nbrs); }
1296 
1314  void getVertexNeighbors(const int& tessId, const int& level, const int& vertex,
1315  const int& order, set<int>& nbrs);
1316 
1317  // All methods below this point are public but are not documented in the doxygen documentation.
1318  // These are methods that typical applications will never need to call. They have to be
1319  // public because other classes in the GeoTess namespace need to access them.
1320  //
1322 
1328  GeoTessGrid(const GeoTessOptimizationType* opttype) :
1329  vertices(NULL), nVertices(0),
1330  triangles(NULL), nTriangles(0),
1331  levels(NULL), nLevels(0),
1332  tessellations(NULL), nTessellations(0),
1333  descendants(NULL), gridID(""),
1334  gridInputFile("null"), gridOutputFile("null"), gridSoftwareVersion(""),
1335  gridGenerationDate(""), refCount(0)
1336  { }
1337 
1342  GeoTessGrid(IFStreamAscii& input, const GeoTessOptimizationType* opttype) :
1343  vertices(NULL), triangles(NULL), levels(NULL), tessellations(NULL),
1344  descendants(NULL), gridID(""),
1345  gridInputFile("null"), gridOutputFile("null"), gridSoftwareVersion(""),
1346  gridGenerationDate(""), refCount(0)
1347  { loadGridAscii(input); }
1348 
1353  GeoTessGrid(IFStreamBinary& input, const GeoTessOptimizationType* opttype) :
1354  vertices(NULL), triangles(NULL), levels(NULL), tessellations(NULL),
1355  descendants(NULL), gridID(""),
1356  gridInputFile("null"), gridOutputFile("null"), gridSoftwareVersion(""),
1357  gridGenerationDate(""), refCount(0)
1358  { loadGridBinary(input); }
1359 
1364  GeoTessGrid(double** _vertices, int& _nVertices,
1365  int** _triangles, int& _nTriangles,
1366  int** _levels, int& _nLevels,
1367  int** _tessellations, int& _nTessellations,
1368  string& _gridID,
1369  string& _gridInputFile,
1370  string& _gridOutputFile,
1371  string& _gridSoftwareVersion,
1372  string& _gridGenerationDate) :
1373  vertices(_vertices), nVertices(_nVertices),
1374  triangles(_triangles), nTriangles(_nTriangles),
1375  levels(_levels), nLevels(_nLevels),
1376  tessellations(_tessellations), nTessellations(_nTessellations),
1377  descendants(NULL),
1378  gridID(_gridID),
1379  gridInputFile(_gridInputFile),
1380  gridOutputFile(_gridOutputFile),
1381  gridSoftwareVersion(_gridSoftwareVersion),
1382  gridGenerationDate(_gridGenerationDate),
1383  refCount(0)
1384  { initialize(); }
1385 
1389  virtual ~GeoTessGrid();
1390 
1394  int getReferenceCount() { return refCount; }
1395 
1399  void addReference() { ++refCount; }
1400 
1404  void removeReference()
1405  {
1406  if (isNotReferenced())
1407  {
1408  ostringstream os;
1409  os << endl << "ERROR in GeoTessGrid::removeReference" << endl
1410  << "Reference count (" << refCount << ") is already zero." << endl;
1411  throw GeoTessException(os, __FILE__, __LINE__, 2001);
1412  }
1413 
1414  --refCount;
1415  }
1416 
1420  bool isNotReferenced() { return (refCount == 0); }
1421 
1427  void writeGrid(const string& fileName);
1428 
1432  void writeGridAscii(const string& fileName);
1433 
1437  void writeGridAscii(IFStreamAscii& output);
1438 
1442  void writeGridBinary(const string& fileName);
1443 
1447  void writeGridBinary(IFStreamBinary& output);
1448 
1454  bool isSupportedFormatVersion(int frmtVrsn)
1455  { return (frmtVrsn == 2); }
1456 
1457  // deprecated. GeoTessOptimizationType is no longer used. Always optimized for speed.
1458  const GeoTessOptimizationType& getOptimizationType() const { return GeoTessOptimizationType::SPEED; }
1459 
1461 
1470  void testGrid();
1471 
1477  int getNLevels() const { return nLevels; }
1478 
1490  int const* const* getLevels() const { return levels; }
1491 
1506  int const* const* getTessellations() const { return tessellations; }
1507 
1515  int getNTriangles() const { return nTriangles; }
1516 
1517  vector<Edge*>& getSpokeList(const int& level) const
1518  { computeSpokeLists(level); return spokeList[level]; }
1519 
1520  const vector<vector<Edge*> >& getEdgeList() const { return edgeList; }
1521 
1522  const vector<Edge*>& getEdgeList(const int& triangle) const { return edgeList[triangle]; }
1523 
1530  void getCenter(const int& triangle, double* center)
1531  {
1532  vector<double*> corners;
1533  corners.push_back(vertices[triangles[triangle][0]]);
1534  corners.push_back(vertices[triangles[triangle][1]]);
1535  corners.push_back(vertices[triangles[triangle][2]]);
1536  GeoTessUtils::center(corners, center);
1537  }
1538 
1544  int delaunay();
1545 
1546 };
1547 // end class GeoTessGrid
1548 
1549 }// end namespace geotess
1550 
1551 #endif // GEOTESSGRID_OBJECT_H
#define GEOTESS_EXP_IMP
Definition: CPPGlobals.h:71
#define LONG_INT
Definition: CPPGlobals.h:111
Manages the geometry and topology of one or more multi-level triangular tessellations of a unit spher...
Definition: GeoTessGrid.h:167
const double * getVertex(int vertex) const
Definition: GeoTessGrid.h:630
vector< Edge * > & getSpokeList(const int &level) const
Definition: GeoTessGrid.h:1517
const string & getGridOutputFile() const
Definition: GeoTessGrid.h:623
int findClosestVertex(double *unit_vector, int tessId)
Definition: GeoTessGrid.h:643
void getNeighbors(const int &tessellation, const int &level, const int &triangle, vector< int > &neighbors)
Definition: GeoTessGrid.h:1176
int getTriangle(int tessellation, int level, int i) const
Definition: GeoTessGrid.h:910
void getVertices(const int &tessellation, const int &level, set< const double * > &vectors)
int getNTriangles(int tessellation, int level) const
Definition: GeoTessGrid.h:893
int getLastLevel(int tessellation) const
Definition: GeoTessGrid.h:864
int getDescendant(const int &tessId, const int &level, const int &triangle) const
Definition: GeoTessGrid.h:1207
GeoTessGrid(IFStreamBinary &input)
Definition: GeoTessGrid.h:433
GeoTessGrid * loadGrid(const string &inputFile)
const vector< int > & getVertexTriangles(int tessId, int vertex) const
Definition: GeoTessGrid.h:1261
double const *const * getVertices() const
Definition: GeoTessGrid.h:761
void getVertexNeighbors(const int &tessId, const int &level, const int &vertex, set< int > &nbrs)
Definition: GeoTessGrid.h:1294
int getNLevels() const
Definition: GeoTessGrid.h:1477
const vector< Edge * > & getEdgeList(const int &triangle) const
Definition: GeoTessGrid.h:1522
int getNLevels(int tessellation) const
Definition: GeoTessGrid.h:835
int getTriangleVertexIndex(int triangleIndex, int cornerIndex) const
Definition: GeoTessGrid.h:973
const set< int > & getVertexIndicesTopLevel(const int &tessId)
Definition: GeoTessGrid.h:813
double * getVertex(int tessId, int level, int triangle, int corner)
Definition: GeoTessGrid.h:747
void setGridGenerationDate(const string &gridDate)
Definition: GeoTessGrid.h:591
static bool isGeoTessGrid(const string &inputFile)
void setGridInputFile(const string &gridFile)
Definition: GeoTessGrid.h:605
int getLastTriangle(int tessellation, int level) const
Definition: GeoTessGrid.h:934
void getVertexNeighbors(const int &tessId, const int &level, const int &vertex, const int &order, set< int > &nbrs)
const string & getGridGenerationDate() const
Definition: GeoTessGrid.h:599
int getNeighborIndex(const int &tid, const int &nid)
Definition: GeoTessGrid.h:1192
void getCenter(const int &triangle, double *center)
Definition: GeoTessGrid.h:1530
int getVertexIndex(int triangle, int corner) const
Definition: GeoTessGrid.h:675
int getNeighbor(const int &tessellation, const int &level, const int &triangle, const int &side)
Definition: GeoTessGrid.h:1127
int getNeighbor(const int &triangleIndex, const int &neighborIndex) const
Definition: GeoTessGrid.h:1100
int const * getDescendants() const
Definition: GeoTessGrid.h:1203
int getVertexIndex(int tessId, int level, int triangle, int corner) const
Definition: GeoTessGrid.h:693
void getTriangleVertices(int triangle, double **triVrt)
Definition: GeoTessGrid.h:999
void getCircumCenter(const int &triangle, double *cc) const
Definition: GeoTessGrid.h:1083
const void computeCircumCenters(const int &level)
Definition: GeoTessGrid.h:1034
int getLevel(int tessellation, int i) const
Definition: GeoTessGrid.h:846
GeoTessGrid(const string &gid)
Definition: GeoTessGrid.h:244
void getVertexNeighborsOrdered(const int &tessId, const int &level, const int &vertex, vector< int > &v)
int getDescendant(const int &triangle) const
Definition: GeoTessGrid.h:1205
void getNeighbors(int triangleIndex, vector< int > &neighbors)
Definition: GeoTessGrid.h:1144
int getFirstTriangle(int tessellation, int level) const
Definition: GeoTessGrid.h:922
int getVertexIndex(const double *u)
Definition: GeoTessGrid.h:704
int getTopLevel(int tessellation) const
Definition: GeoTessGrid.h:881
int getTriangle(int triangleIndex, const double *vector)
void setGridSoftwareVersion(const string &swVersion)
Definition: GeoTessGrid.h:575
const string & getGridInputFile() const
Definition: GeoTessGrid.h:614
const vector< vector< Edge * > > & getEdgeList() const
Definition: GeoTessGrid.h:1520
int getNVertices() const
Definition: GeoTessGrid.h:820
int getVertexIndex(const double *u, int tessId)
Definition: GeoTessGrid.h:723
const void computeCircumCenters()
Definition: GeoTessGrid.h:1017
int getNTriangles() const
Definition: GeoTessGrid.h:1515
const vector< int > & getVertexTriangles(const int &tessId, const int &level, const int &vertex) const
Definition: GeoTessGrid.h:1245
const set< int > & getVertexIndices(const int &tessId, const int &level)
Definition: GeoTessGrid.h:799
const double * getCircumCenter(const int &triangle) const
Definition: GeoTessGrid.h:1064
const double * getTriangleVertex(int triangleIndex, int cornerIndex) const
Definition: GeoTessGrid.h:987
const vector< vector< int > > & getVertexTriangles(const int &level) const
Definition: GeoTessGrid.h:1231
const string & getGridID() const
Definition: GeoTessGrid.h:564
static string getGridID(const string &fileName)
int const *const * getLevels() const
Definition: GeoTessGrid.h:1490
LONG_INT getMemory()
Definition: GeoTessGrid.h:457
GeoTessGrid(IFStreamAscii &input)
Definition: GeoTessGrid.h:423
int const *const * getTriangles() const
Definition: GeoTessGrid.h:946
GeoTessGrid(GeoTessGrid &other)
const int * getTriangleVertexIndexes(int triangleIndex) const
Definition: GeoTessGrid.h:959
const string & getGridSoftwareVersion() const
Definition: GeoTessGrid.h:583
int getNTessellations() const
Definition: GeoTessGrid.h:826
int const *const * getTessellations() const
Definition: GeoTessGrid.h:1506
void getVerticesTopLevel(const int &tessellation, set< const double * > &vectors)
Definition: GeoTessGrid.h:771
Enumeration of the optimization strategies supported by GeoTess including OptimizationType::SPEED and...
Opens ascii file for read and write access.
Definition: IFStreamAscii.h:81
Opens a file for binary read and write access.
Stores information about the connection between two adjacent vertices which separates two neighboring...
Definition: GeoTessGrid.h:102