gm3d/src/out_obs.cpp

20 lines
630 B
C++
Raw Normal View History

2021-04-10 14:08:49 +08:00
#include "gm3d.h"
2021-04-19 16:33:07 +08:00
int GM3D::OutObs(const char* filename){
time_t now = time(0);
char* dt = ctime(&now);
2021-04-10 14:08:49 +08:00
ofstream outfile;
2021-04-19 16:33:07 +08:00
gctl::open_outfile(outfile,filename);
outfile << "# Created by : gm3d" << endl;
outfile << "# At time: " << dt; //dt包含换行符
outfile << "# Model id: " << model_id_ << endl;
2021-04-10 14:08:49 +08:00
outfile << "# y(m)-easting x(m)-northing ele(m) obs-val(mGal|Eo) obs-dev(mGal|Eo)" << endl;
for (int i = 0; i < obs_num_; i++){
outfile << obs_p_[i].y << " " << obs_p_[i].x << " " << -1.0*obs_p_[i].z << " "
<< setprecision(16) << obs_p_[i].val << " " << obs_p_[i].dev << endl;
}
outfile.close();
return 0;
}