65 #include "GeoTessPolygon.h"
109 static bool fileExists(
const string& fileName);
114 virtual bool operator == (
const Grid& other);
119 virtual bool operator != (
const Grid& other) {
return !(*
this == other);};
187 virtual GridProfile* getProfile(
const int& nodeId);
218 const double& latSource,
219 const double& lonSource,
220 const double& depthSource,
221 const double& latReceiver,
222 const double& lonReceiver,
223 const double& depthReceiver,
225 const double& ch_max);
248 const double& lat,
const double& lon,
const double& depth);
251 const double& lat,
const double& lon,
const double& depth);
256 virtual void clearCrustalProfiles();
334 virtual int getNCrustalProfiles();
356 vector<GridProfile*>& neighbors, vector<int>& nodeIds,
357 vector<double>& coefficients) = ABSTRACT;
369 double activeNodeLonMin,
370 double activeNodeLatMax,
371 double activeNodeLonMax);
396 {
return (activeNodeId < 0 ? -1 : activeNodes[activeNodeId]); };
404 {
return profiles[nodeId]->getActiveNodeId(); };
411 virtual void getNodeNeighbors(
const int& nodeId,
int neighbors[],
int& nNeighbors) = ABSTRACT;
428 double distance[],
double azimuth[],
int& nNeighbors);
438 vector<double>& distance, vector<double>& azimuth);
445 double distance[],
double azimuth[],
int& nNeighbors);
448 vector<double>& distance, vector<double>& azimuth);
460 virtual void getNodeAzimuth(
const int& node1,
const int& node2,
double& azimuth);
463 { hitCount = profiles[nodeId]->getHitCount(); };
465 virtual void clearNodeHitCount();
471 virtual size_t memSizeCrustalProfiles();
510 vector<vector<UncertaintyPIU*> >
piu;
512 vector<UncertaintyPDU*>
pdu;
521 string outputDirectory;
527 if (n < 0 || n >= (
int)profiles.size())
530 os << setiosflags(ios::fixed) << setiosflags(ios::showpoint) << setprecision(4);
531 os << endl <<
"ERROR in Grid::getProfile. NodeId "<< n <<
" is out of range. " << endl
532 <<
"Valid range is >= 0 and < " << profiles.size() << endl
533 <<
"Version " << SlbmVersion <<
" File " << __FILE__ <<
" line " << __LINE__ << endl << endl;
556 const double& lat,
const double& lon,
const double& depth)
558 return sources->getCrustalProfile(phase, lat, lon, depth);
562 const double& lat,
const double& lon,
const double& depth)
564 return receivers->getCrustalProfile(phase, lat, lon, depth);
567 inline void Grid::clearCrustalProfiles()
573 inline int Grid::getNCrustalProfiles()
575 return receivers->getNCrustalProfiles()
576 + sources->getNCrustalProfiles();
579 inline size_t Grid::memSizeCrustalProfiles()
581 return receivers->
memSize() + sources->memSize();
584 inline void Grid::clearNodeHitCount()
586 for (
int i=0; i<(int)profiles.size(); ++i)
587 profiles[i]->clearHitCount();
590 inline bool Grid::fileExists(
const string& fileName)
594 f.open(fileName.c_str(), ios::in);
A profile through the Earth model that stores interface radius, and interval P or S wave velocity inf...
CrustalProfileStore supports pool allocation for CrustalProfile objects.
Manages all information related to a single node in a Grid object.
The GreatCircle class manages information related to a great circle path between two Locations on the...
int getPhase()
Retrieve the phase that this GreatCircle supports. Will be one of SLBMGlobals::Pn,...
A 2 dimensional, horizontal grid of GirdProfile objects.
void writeBufferToFile(util::DataBuffer &buffer, string fileName)
virtual 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.
static Grid * getGrid(const string &modelDirectory)
virtual void getNodeHitCount(const int &nodeId, int &hitCount)
virtual void saveVelocityModel(util::DataBuffer &buffer)
Save the Earth model currently in memory, to a DataBuffer.
virtual void setInterpolatorType(const string &interpolatorType)
virtual void getActiveNodeNeighborInfo(const int &nid, vector< int > &neighbors, vector< double > &distance, vector< double > &azimuth)
vector< vector< UncertaintyPIU * > > piu
void reaDataBuffererFromFile(util::DataBuffer &buffer, string dirname, string fileName)
virtual int getActiveNodeId(int nodeId)
Retrieve the grid node id that corresponds to a specified active node id.
virtual void saveVelocityModel(const string &filename, const int &format)
Save the Earth model currently in memory, to an ascii flat file.
Grid()
Default constructor.
virtual int addGeoStack(GeoStack *geoStack)
virtual double getAverageMantleVelocity(const int &waveType)
Retrieve the average P or S wave velocity of the mantle, in km/sec.
virtual void clear()
Clears and releases all memory held by this Grid object.
virtual void getNodeNeighborInfo(const int &nodeId, vector< int > &neighbors, vector< double > &distance, vector< double > &azimuth)
Retrieve the grid node id of the nodes that are direct neighbors of the specified grid node.
virtual void loadFromFile(const string &filename)
Load the depth, velocity and gradient information from an ascii flat file.
virtual int getNActiveNodes()
Retrieve the number of active nodes.
virtual void getActiveNodeNeighbors(const int &nodeid, vector< int > &neighbors)
virtual GeoTessModelSLBM * getModel()
UncertaintyPIU & getUncertaintyPIU(int phase, int attribute)
CrustalProfileStore * sources
virtual void loadFromDataBuffer(util::DataBuffer &buffer)
Load the depth, velocity and gradient information from DataBuffer.
virtual ~Grid()
Destructor.
virtual void getNodeNeighborInfo(const int &nodeId, int neighbors[], double distance[], double azimuth[], int &nNeighbors)
Retrieve the grid node id of the nodes that are direct neighbors of the specified grid node.
vector< GridProfile * > profiles
The GridProfile objects which constitute the nodes in a Grid object.
virtual void loadFromDirectory(const string &dirName)
Load the depth, velocity and gradient information from binary files in specified directory.
virtual bool is_directory(const string &dir)
vector< UncertaintyPDU * > & getUncertaintyPDU()
virtual int getNNodes()
Retrieve the number of nodes in the model.
vector< int > activeNodes
const string getOutputDirectory()
string modelPath
The name of the file or directory from which the velocity model was loaded.
void initializeActiveNodes(GeoTessPolygon *polygon)
Specify the Polygon that will define which grid nodes are also active nodes.
vector< vector< UncertaintyPIU * > > & getUncertaintyPIU()
virtual 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.
virtual void getNodeSeparation(const int &node1, const int &node2, double &distance)
Retrieve the angular separation in radians between any pair of.
virtual string toString()
virtual string getTessId()
virtual int getGridNodeId(int activeNodeId)
Retrieve the grid node id that corresponds to a specified active node id.
virtual void setAverageMantleVelocity(const int &waveType, const double &velocity)
Retrieve the average P or S wave velocity of the mantle, in km/sec.
virtual bool findProfile(Location &location, vector< GridProfile * > &neighbors, vector< int > &nodeIds, vector< double > &coefficients)
Find the neighboring GridProfile objects and associated interpolation coefficients at a specified Loc...
virtual int getNIntervals()
Retrieve the number of intervals in each Profile.
UncertaintyPDU & getUncertaintyPDU(int phase)
static Grid * getGrid(util::DataBuffer &buffer)
static string class_name()
vector< UncertaintyPDU * > pdu
virtual void getActiveNodeNeighbors(const int &nodeid, int neighbors[], int &nNeighbors)
virtual GreatCircle * getGreatCircle(const int &phase, const double &latSource, const double &lonSource, const double &depthSource, const double &latReceiver, const double &lonReceiver, const double &depthReceiver, const double &delta, const double &ch_max)
Retrieve a GreatCircle object between a source and a receiver.
void initializeActiveNodes(double activeNodeLatMin, double activeNodeLonMin, double activeNodeLatMax, double activeNodeLonMax)
Specify the latitude, longitude range in radians that will define which grid nodes are also active no...
virtual string getInterpolatorType()
virtual int getBufferSize() const
virtual void getNodeAzimuth(const int &node1, const int &node2, double &azimuth)
Retrieve the azimuth in radians from one grid node to another.
CrustalProfileStore * receivers
virtual void getActiveNodeNeighborInfo(const int &nid, int neighbors[], double distance[], double azimuth[], int &nNeighbors)
vector< vector< UncertaintyPIU * > > & getUncertainty()
void specifyOutputDirectory(const string &outputDir)
Manages all information related to a single node in a Grid object.
A LayerProfile with mantle velocity gradient information.
A Profile object based on values interpolated from nearby GridProfile objects.
The Location Class manages a single point in/on the Earth, which is described by the GRS80 ellipsoid.
An InterpolatedProfile object that also has information about the the P and S wave velocity as a func...
An Exception class for Grid and related objects.
A UncertaintyPDU object contains the raw data to calculate a path dependent modeling error in seconds...
A UncertaintyPIU object contains the raw data to calculate a modeling error in seconds as a function ...
A byte array container used to hold binary data in the same manner as disk based file system.