162 {V0[waveType] = velocity; };
183 virtual bool findProfile(
Location& location,
184 vector<GridProfile*>& neighbors, vector<int>& nodeIds,
185 vector<double>& coefficients);
210 { geoStacks.push_back(geoStack);
return geoStacks.size(); };
214 void setInterpolatorType(
const string& interpolatorType);
220 int getGeoStacksSize() {
return geoStacks.size(); };
222 vector<GeoStack*>& getGeoStacks() {
return geoStacks; };
224 vector<Triangle*>& getTriangles() {
return triangles; };
229 vector<float>& elev, vector<float>& waterThick,
230 vector<int>& stackId);
233 const vector<float>& elev,
234 const vector<float>& waterThick,
235 const vector<int>& stackId,
236 vector< vector<Triangle*> >& triset);
238 void defineTessAdjacency(
int nNodes,
239 const vector< vector<Triangle*> >& triset);
243 vector<GeoStack*> geoStacks;
245 vector<Triangle*> triangles;
247 vector<Triangle*> specialTriangles;
257 Triangle* findTriangle(
const Location& location,
258 vector<double>& coefficients);
260 void findSpecialTriangles();
262 void saveSlbmFile(
const string& fileName);
263 void saveSlbmDirectory(
const string& directoryName);
265 void saveGeotessFile(
const string& fileName);
266 void saveGeotessDirectory(
const string& directoryName);
268 void saveGeotess(
const string& path,
const string& pathToGrid,
const string& gridFilePath);
272 inline Triangle* GridSLBM::findTriangle(
const Location& location,
273 vector<double>& coefficients)
277 double dot, dmax = -1e30;
279 for (
int i=0; i<(int)specialTriangles.size(); i++)
283 dot = location.dot(*specialTriangles[i]->getNode(0));
290 tr = specialTriangles[i];
293 if (dot > cos_min)
break;
300 tr = tr->walk(location, coefficients);
304 specialTriangles[0] = tr;
309 inline bool GridSLBM::findProfile(
Location& location,
310 vector<GridProfile*>& neighbors, vector<int>& nodeIds,
311 vector<double>& coefficients)
314 coefficients.resize(3);
317 Triangle* tr = findTriangle(location, coefficients);
319 for (
int i=0; i<3; i++)
328 inline void GridSLBM::setInterpolatorType(
const string& interpolatorType)
330 if (geotess::CPPUtils::uppercase_string(interpolatorType) !=
"LINEAR")
333 os << setiosflags(ios::fixed) << setiosflags(ios::showpoint) << setprecision(9);
334 os << endl <<
"ERROR in GridSLBM::setInterpolatorType()" << endl
335 << interpolatorType <<
" is not a recognized interpolator type." << endl
336 <<
"The only interpolator type recognized by the old style SLBM grids is LINEAR"
337 <<
"Version " << SlbmVersion <<
" File " << __FILE__ <<
" line " << __LINE__ << endl << endl;
Manages all information related to a single node in a Grid object.
A 2 dimensional, horizontal grid of GirdProfile objects.
const int getNodeId() const
Retrieve the node index of this node in the model grid.
A 2 dimensional, horizontal grid of GirdProfile objects.
static string class_name()
void setAverageMantleVelocity(const int &waveType, const double &velocity)
Retreive the average P or S wave velocity of the mantle, in km/sec.
void getNodeNeighbors(const int &nodeId, int neighbors[], int &nNeighbors)
Retrieve the grid node id of the nodes that are direct neighbors of the specified grid node.
string getInterpolatorType()
void loadFromDataBuffer(util::DataBuffer &buffer)
Load the depth, velocity and gradient information from DataBuffer.
void saveVelocityModel(util::DataBuffer &buffer)
Save the Earth model currently in memory, to a DataBuffer.
void saveVelocityModel(const string &destination, const int &format)
Save the Earth model currently in memory, to file(s)
void getActiveNodeNeighbors(const int &nodeid, int neighbors[], int &nNeighbors)
void clear()
Clears and releases all memory held by this GridSLBM object.
void getActiveNodeNeighbors(const int &nodeid, vector< int > &neighbors)
void getNodeNeighbors(const int &nodeId, vector< int > &neighbors)
Retrieve the grid node ids of the nodes that are direct neighbors of the specified grid node.
double getAverageMantleVelocity(const int &waveType)
Retreive the average P or S wave velocity of the mantle, in km/sec.
void loadFromFile(const string &filename)
Load the depth, velocity and gradient information from an ascii flat file.
int addGeoStack(GeoStack *geoStack)
void loadFromDirectory(const string &dirName)
Load the depth, velocity and gradient information from binary files in specified directory.
int getBufferSize() const
GridSLBM()
Default constructor.
The Location Class manages a single point in/on the Earth, which is described by the GRS80 ellipsoid.
An Exception class for Grid and related objects.
GridProfile * getNode(const int &i)
Retrieve a handle to one of the 3 nodes that defines the corners of this triangle.
A byte array container used to hold binary data in the same manner as disk based file system.