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();
187 vector<double> weights;
189 vector<double> greatCirclePointsLat, greatCirclePointsLon, greatCirclePointsDepth;
193 inline void SlbmInterfaceToJNI::computeGreatCirclePoints(
199 const bool& onCenters)
201 deleteGreatCirclePoints();
205 double delta, delta0;
218 double moveDirection[3];
220 for (
int i=0; i<npoints; i++)
222 a.
move(moveDirection, delta0+i*delta, b);
223 greatCirclePointsLat.push_back(b.
getLat());
224 greatCirclePointsLon.push_back(b.
getLon());
228 inline void SlbmInterfaceToJNI::computeGreatCircleLocations()
230 deleteGreatCirclePoints();
233 for (
int i=0; i<greatCircle->getNProfiles(); i++)
236 greatCircle->getLayerProfileLocation(i, loc);
237 greatCirclePointsLat.push_back(loc.
getLat());
238 greatCirclePointsLon.push_back(loc.
getLon());
239 greatCirclePointsDepth.push_back(loc.
getDepth());
243 inline string SlbmInterfaceToJNI::getPhase()
245 if (greatCircle->getPhase() == Pn)
247 if (greatCircle->getPhase() == Sn)
249 if (greatCircle->getPhase() == Pg)
251 if (greatCircle->getPhase() == Lg)
256 inline void SlbmInterfaceToJNI::accessGridProfile(
const int& nodeId)
258 gridProfile = grid->getProfile(nodeId);
261 inline double SlbmInterfaceToJNI::getGridLat()
263 return gridProfile->
getLat();
266 inline double SlbmInterfaceToJNI::getGridLon()
268 return gridProfile->getLon();
272 inline void SlbmInterfaceToJNI::getGridDepth(vector<double>& depths)
274 gridProfile->getInterfaceDepths(depths);
277 inline void SlbmInterfaceToJNI::getGridVelocity(
const int& waveType,
double* velocity)
279 gridProfile->getVelocity(waveType, velocity);
282 inline void SlbmInterfaceToJNI::getGridGradient(
double* gradient)
284 gridProfile->getMantleGradient(gradient);
303 inline void SlbmInterfaceToJNI::createQueryProfile(
const double &lat,
const double &lon)
305 deleteQueryProfile();
307 queryProfile = grid->getQueryProfile(loc);
310 inline void SlbmInterfaceToJNI::deleteQueryProfile()
312 if (queryProfile)
delete queryProfile;
316 inline int SlbmInterfaceToJNI::getQueryNCoefficients()
318 return queryProfile->getNCoefficients();
321 inline vector<int>& SlbmInterfaceToJNI::getQueryNodeId()
323 return queryProfile->getNodeIds();
326 inline vector<double>& SlbmInterfaceToJNI::getQueryCoefficient()
328 return queryProfile->getCoefficients();
331 inline double* SlbmInterfaceToJNI::getQueryDepth()
333 return queryProfile->getDepth();
336 inline double* SlbmInterfaceToJNI::getQueryVelocity(
const int& waveType)
338 return queryProfile->getVelocity(waveType);
341 inline double* SlbmInterfaceToJNI::getQueryGradient()
343 return queryProfile->getMantleGradient();
346 inline void SlbmInterfaceToJNI::computeWeights()
348 SlbmInterface::getWeights(nodeIds, weights);
352 inline string SlbmInterfaceToJNI::getGreatCirclePhase()
354 return greatCircle->getPhaseString();
357 inline double SlbmInterfaceToJNI::getActualPathIncrement()
359 return greatCircle->getActualPathIncrement();
362 inline void SlbmInterfaceToJNI::getGreatCircleNeighbors(
const int& i,
int* nodeids,
int& size)
364 greatCircle->getProfile(i)->getNodeIds(nodeids, size);
367 inline void SlbmInterfaceToJNI::getGreatCircleCoefficients(
const int& i,
double* coeff,
int& size)
369 greatCircle->getProfile(i)->getCoefficients(coeff, size);
372 inline void SlbmInterfaceToJNI::getGreatCircleSourceDepth(
double* depths,
int& n)
374 n = greatCircle->getSourceProfile()->getNIntervals();
375 greatCircle->getSourceProfile()->getDepths(depths);
378 inline void SlbmInterfaceToJNI::getGreatCircleReceiverDepth(
double* depths,
int& n)
380 n = greatCircle->getReceiverProfile()->getNIntervals();
381 greatCircle->getReceiverProfile()->getDepths(depths);
384 inline double* SlbmInterfaceToJNI::getGreatCircleSourceVelocity(
int& n)
386 n = greatCircle->getSourceProfile()->getNIntervals();
387 return greatCircle->getSourceProfile()->getVelocities();
390 inline double* SlbmInterfaceToJNI::getGreatCircleReceiverVelocity(
int& n)
392 n = greatCircle->getReceiverProfile()->getNIntervals();
393 return greatCircle->getReceiverProfile()->getVelocities();
396 inline void SlbmInterfaceToJNI::getGreatCircleHeadwaveVelocity(vector<double>& v)
399 for (
int i=0; i<greatCircle->getNProfiles(); i++)
400 v.push_back(greatCircle->getProfile(i)->getVelocity());
403 inline void SlbmInterfaceToJNI::getGreatCircleHeadwaveGradient(vector<double>& g)
406 for (
int i=0; i<greatCircle->getNProfiles(); i++)
407 g.push_back(greatCircle->getProfile(i)->getGradient());
410 inline int SlbmInterfaceToJNI::getNGridNodes()
413 n = grid->getNNodes();
417 inline int SlbmInterfaceToJNI::getNHeadWavePoints()
419 int nHeadWavePoints = -1;
420 nHeadWavePoints = greatCircle->getNProfiles();
421 return nHeadWavePoints;
424 inline void SlbmInterfaceToJNI::computeWeightsSource()
426 nodeIds = greatCircle->getSourceProfile()->getNodeIds();
427 weights = greatCircle->getSourceProfile()->getCoefficients();
429 inline void SlbmInterfaceToJNI::computeWeightsReceiver()
431 nodeIds = greatCircle->getReceiverProfile()->getNodeIds();
432 weights = greatCircle->getReceiverProfile()->getCoefficients();