1
0
Fork 0

Tweaked output formatting a bit.

This commit is contained in:
curt 1999-03-13 23:50:26 +00:00
parent 1c180f1952
commit cac521c151
3 changed files with 19 additions and 13 deletions

View file

@ -78,18 +78,18 @@ int
FGArray::open( const string& file ) { FGArray::open( const string& file ) {
// open input file (or read from stdin) // open input file (or read from stdin)
if ( file == "-" ) { if ( file == "-" ) {
cout << "Opening array data pipe from stdin" << endl; cout << " Opening array data pipe from stdin" << endl;
// fd = stdin; // fd = stdin;
// fd = gzdopen(STDIN_FILENO, "r"); // fd = gzdopen(STDIN_FILENO, "r");
cout << "Not yet ported ..." << endl; cout << " Not yet ported ..." << endl;
return 0; return 0;
} else { } else {
in = new fg_gzifstream( file ); in = new fg_gzifstream( file );
if ( !(*in) ) { if ( !(*in) ) {
cout << "Cannot open " << file << endl; cout << " Cannot open " << file << endl;
return 0; return 0;
} }
cout << "Opening array data file: " << file << endl; cout << " Opening array data file: " << file << endl;
} }
return 1; return 1;
@ -160,7 +160,7 @@ void FGArray::outputmesh_set_pt( int i, int j, double value ) {
// Use least squares to fit a simpler data set to dem data // Use least squares to fit a simpler data set to dem data
void FGArray::fit( FGBucket& p, double error ) { void FGArray::fit( double error ) {
double x[ARRAY_SIZE_1], y[ARRAY_SIZE_1]; double x[ARRAY_SIZE_1], y[ARRAY_SIZE_1];
double m, b, max_error, error_sq; double m, b, max_error, error_sq;
double x1, y1; double x1, y1;
@ -173,7 +173,7 @@ void FGArray::fit( FGBucket& p, double error ) {
error_sq = error * error; error_sq = error * error;
cout << "Initializing output mesh structure" << endl; cout << " Initializing output mesh structure" << endl;
outputmesh_init(); outputmesh_init();
// determine dimensions // determine dimensions
@ -181,7 +181,7 @@ void FGArray::fit( FGBucket& p, double error ) {
colmax = cols; colmax = cols;
rowmin = 0; rowmin = 0;
rowmax = rows; rowmax = rows;
cout << "Fitting region = " << colmin << "," << rowmin << " to " cout << " Fitting region = " << colmin << "," << rowmin << " to "
<< colmax << "," << rowmax << endl;; << colmax << "," << rowmax << endl;;
// include the corners explicitly // include the corners explicitly
@ -190,7 +190,7 @@ void FGArray::fit( FGBucket& p, double error ) {
outputmesh_set_pt(colmax, rowmax, in_data[colmax][rowmax]); outputmesh_set_pt(colmax, rowmax, in_data[colmax][rowmax]);
outputmesh_set_pt(colmax, rowmin, in_data[colmax][rowmin]); outputmesh_set_pt(colmax, rowmin, in_data[colmax][rowmin]);
cout << "Beginning best fit procedure" << endl; cout << " Beginning best fit procedure" << endl;
for ( row = rowmin; row < rowmax; row++ ) { for ( row = rowmin; row < rowmax; row++ ) {
// fit = fopen("fit.dat", "w"); // fit = fopen("fit.dat", "w");
@ -456,15 +456,15 @@ void FGArray::outputmesh_output_nodes( const string& fg_root, FGBucket& p )
// generate the base directory // generate the base directory
string base_path = p.gen_base_path(); string base_path = p.gen_base_path();
cout << "fg_root = " << fg_root << " Base Path = " << base_path << endl; cout << " fg_root = " << fg_root << " Base Path = " << base_path << endl;
dir = fg_root + "/Scenery/" + base_path; dir = fg_root + "/Scenery/" + base_path;
cout << "Dir = " << dir << endl; cout << " Dir = " << dir << endl;
// stat() directory and create if needed // stat() directory and create if needed
errno = 0; errno = 0;
result = stat(dir.c_str(), &stat_buf); result = stat(dir.c_str(), &stat_buf);
if ( result != 0 && errno == ENOENT ) { if ( result != 0 && errno == ENOENT ) {
cout << "Creating directory\n"; cout << " Creating directory\n";
command = "mkdir -p " + dir + "\n"; command = "mkdir -p " + dir + "\n";
system( command.c_str() ); system( command.c_str() );
@ -552,6 +552,9 @@ FGArray::~FGArray( void ) {
// $Log$ // $Log$
// Revision 1.2 1999/03/13 23:50:26 curt
// Tweaked output formatting a bit.
//
// Revision 1.1 1999/03/13 18:45:02 curt // Revision 1.1 1999/03/13 18:45:02 curt
// Initial revision. (derived from libDEM.a code.) // Initial revision. (derived from libDEM.a code.)
// //

View file

@ -110,7 +110,7 @@ public:
int parse(); int parse();
// Use least squares to fit a simpler data set to dem data // Use least squares to fit a simpler data set to dem data
void fit( FGBucket& p, double error ); void fit( double error );
// return the current altitude based on grid data. We should // return the current altitude based on grid data. We should
// rewrite this to interpolate exact values, but for now this is // rewrite this to interpolate exact values, but for now this is
@ -131,6 +131,9 @@ public:
// $Log$ // $Log$
// Revision 1.2 1999/03/13 23:50:27 curt
// Tweaked output formatting a bit.
//
// Revision 1.1 1999/03/13 18:45:02 curt // Revision 1.1 1999/03/13 18:45:02 curt
// Initial revision. (derived from libDEM.a code.) // Initial revision. (derived from libDEM.a code.)
// //

View file

@ -33,5 +33,5 @@ main(int argc, char **argv) {
lat *= 3600; lat *= 3600;
cout << a.interpolate_altitude(lon, lat) << endl; cout << a.interpolate_altitude(lon, lat) << endl;
a.fit(b, 100); a.fit( 100 );
} }