40 int main(
int argc,
const char*
const argv[]) {
46 cerr <<
"Usage: " << argv[0]
47 <<
" gravity-model intervals-per-degree output.gtx\n";
52 int ndigits = Utility::set_digits();
53 string model(argv[1]);
55 int ndeg = Utility::val<int>(string(argv[2]));
59 nlat = 180 * ndeg + 1,
66 ofstream
file(filename.c_str(), ios::binary);
71 unsigned sizes[] = {unsigned(nlat), unsigned(nlon)};
72 Utility::writearray<double, Math::real, true>(
file,
transform, 4);
73 Utility::writearray<unsigned, unsigned, true>(
file,
sizes, 2);
77 const int nbatch = 64;
78 vector< vector<float> >
N(nbatch, vector<float>(nlon));
80 for (
int ilat0 = 0; ilat0 < nlat; ilat0 += nbatch) {
81 int nlat0 =
min(nlat, ilat0 + nbatch);
84 # pragma omp parallel for 86 for (
int ilat = ilat0; ilat < nlat0; ++ilat) {
87 Utility::set_digits(ndigits);
89 lat = latorg + (ilat / ndeg) + delta * (ilat - ndeg * (ilat / ndeg)),
92 for (
int ilon = 0; ilon < nlon; ++ilon) {
94 + (ilon / ndeg) + delta * (ilon - ndeg * (ilon / ndeg));
95 N[ilat - ilat0][ilon] =
float(
c.GeoidHeight(lon));
99 for (
int ilat = ilat0; ilat < nlat0; ++ilat)
100 Utility::writearray<float, float, true>(
file, N[ilat - ilat0]);
103 catch (
const exception&
e) {
104 cerr <<
"Caught exception: " << e.what() <<
"\n";
108 cerr <<
"Caught unknown exception\n";
noiseModel::Diagonal::shared_ptr model
Header for GeographicLib::Utility class.
std::vector< Array2i > sizes
Header for GeographicLib::GravityModel class.
void g(const string &key, int i)
GravityCircle Circle(real lat, real h, unsigned caps=ALL) const
int main(int argc, const char *const argv[])
Namespace for GeographicLib.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
EIGEN_DONT_INLINE void transform(const Transformation &t, Data &data)
Model of the earth's gravity field.
Header for GeographicLib::GravityCircle class.
Gravity on a circle of latitude.