00001
00005 #pragma once
00006
00007 #include <usml/ocean/profile_model.h>
00008
00009 namespace usml {
00010 namespace ocean {
00011
00014
00030 class profile_grid_fast : public profile_model {
00031
00032 public:
00033
00034
00035
00036
00047 profile_grid_fast(data_grid_svp* speed, attenuation_model* attmodel = NULL) :
00048 profile_model(attmodel), _sound_speed(speed) {
00049 }
00050
00054 virtual ~profile_grid_fast() {
00055 delete _sound_speed;
00056 }
00057
00066 virtual void sound_speed(const wposition& location, matrix<double>* speed,
00067 wvector* gradient = NULL) {
00068 if (gradient) {
00069 matrix<double> rho(location.size1(), location.size2());
00070 matrix<double> theta(location.size1(), location.size2());
00071 matrix<double> phi(location.size1(), location.size2());
00072 this->_sound_speed->interpolate(location.rho(), location.theta(),
00073 location.phi(), speed, &rho, &theta, &phi);
00074 gradient->rho(rho);
00075 gradient->theta(theta);
00076 gradient->phi(phi);
00077 } else {
00078 this->_sound_speed->interpolate(location.rho(), location.theta(),
00079 location.phi(), speed);
00080 }
00081 this->adjust_speed(location, speed, gradient);
00082 }
00083
00084 private:
00085
00087 data_grid_svp* _sound_speed;
00088
00089 };
00090
00091
00093 }
00094 }