38 #ifndef SlbmInterfaceToJNI_H
39 #define SlbmInterfaceToJNI_H
85 void accessGridProfile(
const int& nodeId);
93 void getGridDepth(vector<double>& depths);
95 void getGridVelocity(
const int& waveType,
double* velocity);
97 void getGridGradient(
double* gradient);
105 void createQueryProfile(
const double& lat,
const double& lon);
107 void deleteQueryProfile();
109 int getQueryNCoefficients();
111 vector<int>& getQueryNodeId();
113 vector<double>& getQueryCoefficient();
115 double* getQueryDepth();
117 double* getQueryVelocity(
const int& waveType);
119 double* getQueryGradient();
121 void computeWeights();
123 void computeWeightsSource();
125 void computeWeightsReceiver();
133 string getGreatCirclePhase();
135 double getActualPathIncrement();
137 void getGreatCircleNeighbors(
const int& i,
int* nodeIds,
int& size);
139 void getGreatCircleCoefficients(
const int& i,
double* coeff,
int& size);
141 void getGreatCircleSourceDepth(
double* depths,
int& n);
143 void getGreatCircleReceiverDepth(
double* depths,
int& n);
145 double* getGreatCircleSourceVelocity(
int& n);
147 double* getGreatCircleReceiverVelocity(
int& n);
149 void getGreatCircleHeadwaveVelocity(vector<double>& velocities);
151 void getGreatCircleHeadwaveGradient(vector<double>& gradients);
153 void computeGreatCirclePoints(
159 const bool& onCenters);
161 void computeGreatCircleLocations();
164 { greatCirclePointsLat.clear(); greatCirclePointsLon.clear(); greatCirclePointsDepth.clear(); };
174 int getNHeadWavePoints();
178 static bool modelsEqual(
const string modelPath1,
const string modelPath2);
189 vector<double> weights;
191 vector<double> greatCirclePointsLat, greatCirclePointsLon, greatCirclePointsDepth;
195 inline void SlbmInterfaceToJNI::computeGreatCirclePoints(
201 const bool& onCenters)
203 deleteGreatCirclePoints();
207 double delta, delta0;
220 double moveDirection[3];
222 for (
int i=0; i<npoints; i++)
224 a.
move(moveDirection, delta0+i*delta, b);
225 greatCirclePointsLat.push_back(b.
getLat());
226 greatCirclePointsLon.push_back(b.
getLon());
230 inline void SlbmInterfaceToJNI::computeGreatCircleLocations()
232 deleteGreatCirclePoints();
235 for (
int i=0; i<greatCircle->getNProfiles(); i++)
238 greatCircle->getLayerProfileLocation(i, loc);
239 greatCirclePointsLat.push_back(loc.
getLat());
240 greatCirclePointsLon.push_back(loc.
getLon());
241 greatCirclePointsDepth.push_back(loc.
getDepth());
245 inline string SlbmInterfaceToJNI::getPhase()
247 if (greatCircle->getPhase() == Pn)
249 if (greatCircle->getPhase() == Sn)
251 if (greatCircle->getPhase() == Pg)
253 if (greatCircle->getPhase() == Lg)
258 inline void SlbmInterfaceToJNI::accessGridProfile(
const int& nodeId)
260 gridProfile = grid->getProfile(nodeId);
263 inline double SlbmInterfaceToJNI::getGridLat()
265 return gridProfile->
getLat();
268 inline double SlbmInterfaceToJNI::getGridLon()
270 return gridProfile->getLon();
274 inline void SlbmInterfaceToJNI::getGridDepth(vector<double>& depths)
276 gridProfile->getInterfaceDepths(depths);
279 inline void SlbmInterfaceToJNI::getGridVelocity(
const int& waveType,
double* velocity)
281 gridProfile->getVelocity(waveType, velocity);
284 inline void SlbmInterfaceToJNI::getGridGradient(
double* gradient)
286 gridProfile->getMantleGradient(gradient);
305 inline void SlbmInterfaceToJNI::createQueryProfile(
const double &lat,
const double &lon)
307 deleteQueryProfile();
309 queryProfile = grid->getQueryProfile(loc);
312 inline void SlbmInterfaceToJNI::deleteQueryProfile()
314 if (queryProfile)
delete queryProfile;
318 inline int SlbmInterfaceToJNI::getQueryNCoefficients()
320 return queryProfile->getNCoefficients();
323 inline vector<int>& SlbmInterfaceToJNI::getQueryNodeId()
325 return queryProfile->getNodeIds();
328 inline vector<double>& SlbmInterfaceToJNI::getQueryCoefficient()
330 return queryProfile->getCoefficients();
333 inline double* SlbmInterfaceToJNI::getQueryDepth()
335 return queryProfile->getDepth();
338 inline double* SlbmInterfaceToJNI::getQueryVelocity(
const int& waveType)
340 return queryProfile->getVelocity(waveType);
343 inline double* SlbmInterfaceToJNI::getQueryGradient()
345 return queryProfile->getMantleGradient();
348 inline void SlbmInterfaceToJNI::computeWeights()
350 SlbmInterface::getWeights(nodeIds, weights);
354 inline string SlbmInterfaceToJNI::getGreatCirclePhase()
356 return greatCircle->getPhaseString();
359 inline double SlbmInterfaceToJNI::getActualPathIncrement()
361 return greatCircle->getActualPathIncrement();
364 inline void SlbmInterfaceToJNI::getGreatCircleNeighbors(
const int& i,
int* nodeids,
int& size)
366 greatCircle->getProfile(i)->getNodeIds(nodeids, size);
369 inline void SlbmInterfaceToJNI::getGreatCircleCoefficients(
const int& i,
double* coeff,
int& size)
371 greatCircle->getProfile(i)->getCoefficients(coeff, size);
374 inline void SlbmInterfaceToJNI::getGreatCircleSourceDepth(
double* depths,
int& n)
376 n = greatCircle->getSourceProfile()->getNIntervals();
377 greatCircle->getSourceProfile()->getDepths(depths);
380 inline void SlbmInterfaceToJNI::getGreatCircleReceiverDepth(
double* depths,
int& n)
382 n = greatCircle->getReceiverProfile()->getNIntervals();
383 greatCircle->getReceiverProfile()->getDepths(depths);
386 inline double* SlbmInterfaceToJNI::getGreatCircleSourceVelocity(
int& n)
388 n = greatCircle->getSourceProfile()->getNIntervals();
389 return greatCircle->getSourceProfile()->getVelocities();
392 inline double* SlbmInterfaceToJNI::getGreatCircleReceiverVelocity(
int& n)
394 n = greatCircle->getReceiverProfile()->getNIntervals();
395 return greatCircle->getReceiverProfile()->getVelocities();
398 inline void SlbmInterfaceToJNI::getGreatCircleHeadwaveVelocity(vector<double>& v)
401 for (
int i=0; i<greatCircle->getNProfiles(); i++)
402 v.push_back(greatCircle->getProfile(i)->getVelocity());
405 inline void SlbmInterfaceToJNI::getGreatCircleHeadwaveGradient(vector<double>& g)
408 for (
int i=0; i<greatCircle->getNProfiles(); i++)
409 g.push_back(greatCircle->getProfile(i)->getGradient());
412 inline int SlbmInterfaceToJNI::getNGridNodes()
415 n = grid->getNNodes();
419 inline int SlbmInterfaceToJNI::getNHeadWavePoints()
421 int nHeadWavePoints = -1;
422 nHeadWavePoints = greatCircle->getNProfiles();
423 return nHeadWavePoints;
426 inline void SlbmInterfaceToJNI::computeWeightsSource()
428 nodeIds = greatCircle->getSourceProfile()->getNodeIds();
429 weights = greatCircle->getSourceProfile()->getCoefficients();
431 inline void SlbmInterfaceToJNI::computeWeightsReceiver()
433 nodeIds = greatCircle->getReceiverProfile()->getNodeIds();
434 weights = greatCircle->getReceiverProfile()->getCoefficients();
436 bool SlbmInterfaceToJNI::modelsEqual(
const string modelPath1,
const string modelPath2)
438 return SlbmInterface::modelsEqual(modelPath1, modelPath2);
Manages all information related to a single node in a Grid object.
The Location Class manages a single point in/on the Earth, which is described by the GRS80 ellipsoid.
double getLon() const
Retrieve the longitude of this Location. Value will be between -PI and PI radians.
double distance(const Location &other) const
bool vectorTripleProduct(const Location &other, double vtp[]) const
Compute the vector triple product (this x other) x this, normalized to unit length....
void move(const double &azimuth, const double &distance, Location &loc) const
Retrieve a Location that is a specified distance away from this Location, in a specified direction.
double getLat() const
Retrieve the geographic latitude of this Location, radians.
An InterpolatedProfile object that also has information about the the P and S wave velocity as a func...
The primary interface to the SLBM library, providing access to all supported functionality.
Adds functionality to SlbmInterface to support the Java Native Interface (JNI). The JNI allows libSLB...
SlbmInterfaceToJNI()
Default constructor.
const vector< int > & getWeightNodes()
~SlbmInterfaceToJNI()
Destructor.
const vector< double > & getGreatCirclePointsLon()
void accessGridNodeNeighbors(int nid)
void deleteGreatCirclePoints()
const vector< double > & getWeights()
const vector< double > & getGreatCirclePointsLat()
const vector< double > & getGreatCirclePointsDepth()
SlbmInterfaceToJNI(const double &earthRadius)