53    const int    BYTES_PER_DOUBLE = 
sizeof( double );
 
   54    const int    BYTES_PER_FLOAT  = 
sizeof( float );
 
   55    const int    BYTES_PER_INT    = 
sizeof( int );
 
   59    const double PI               = 3.14159265358979323;
 
   61    const double PIDIV2           = PI / 2.0;
 
   62    const double TWOPI            = 2.0 * 
PI; 
 
   64    const double DEG_PER_RAD      = 180.0 / 
PI;
 
   65    const double RAD_PER_DEG      = PI / 180.0;
 
  103          "Error: Egm2008GeoidGrid: constructor failed.");
 
  114    const std::string  &gridFname )              
 
  149          "Error: Egm2008GeoidGrid: constructor failed.");
 
  186       kount             = _nGridRows * _nGridCols;
 
  188       _heightGrid       = 
new float[ kount ];
 
  190       for ( i = 0; i < kount; i++ )
 
  200          "Error: Egm2008GeoidGrid: copy contructor failed");
 
  246    if ( 
this == & oldGrid )                                
return ( *
this );
 
  262       for ( i = 0; i < kount; i++ )
 
  273          "Error: Egm2008GeoidGrid: assignment operator failed");
 
  347       const int           TWENTY = 20;
 
  367       double              latSupport[ TWENTY ];
 
  368       double              lonSupport[ TWENTY ];
 
  369       double              moments   [ TWENTY ];
 
  379       if (( latitude < -PIDIV2 ) || ( latitude > PIDIV2 )) 
return( 1 );
 
  383       while ( longitude <   0.0 ) longitude += TWOPI;
 
  384       while ( longitude > TWOPI ) longitude -= TWOPI;
 
  386       for (i = 0; i < TWENTY; i++)
 
  388          latSupport[ i ] = lonSupport[ i ] = moments[ i ] = 0.0;
 
  402          if ( status != 0 )                                
return( 1 ); 
 
  417       oddSize  = ( wSize != (( wSize / 2 ) * 2 ));
 
  420          i0   = int( latIndex + 0.5 );
 
  421          j0   = int( lonIndex + 0.5 );
 
  423          iMin = i0 - ( wSize / 2 );
 
  424          jMin = j0 - ( wSize / 2 );
 
  427          i0   = int( latIndex );
 
  428          j0   = int( lonIndex );
 
  430          iMin = i0 - ( wSize / 2 ) + 1;
 
  431          jMin = j0 - ( wSize / 2 ) + 1;
 
  441          lonIndex - double( jMin ); 
 
  446       for ( i = 0; i < wSize; i++ ) 
 
  456          for ( j = 0; j < wSize; j++ ) 
 
  460             kIndex        = jIndex + offset;  
 
  471             this->
initSpline( wSize, lonSupport, moments );
 
  473          if ( status != 0 )                                
return( 1 ); 
 
  476             this->
spline( wSize, temp, lonSupport, moments ); 
 
  484          latIndex - double( iMin );  
 
  490          this->
initSpline( wSize, latSupport, moments ); 
 
  492       if ( status != 0 )                                   
return( 1 ); 
 
  495          this->
spline( wSize, temp, latSupport, moments );
 
  502    catch ( ... ) { gHeight = 0.0;                          
return( 1 ); }
 
  574       if (( latitude < -PIDIV2 ) || ( latitude > PIDIV2 )) 
return( 1 );
 
  576       while ( longitude <   0.0 ) longitude += TWOPI;
 
  577       while ( longitude > TWOPI ) longitude -= TWOPI;
 
  583             ( latitude, longitude, i1, j1 );
 
  585       if ( status != 0 )                                   
return( 1 ); 
 
  621       a3      = n1 + n3 - n2 - n4;
 
  635       x       = ( longitude  - lon1 ) / 
_dLon;
 
  636       y       = ( latitude   - lat1 ) / 
_dLat;
 
  640       gHeight = a0 + a1 * x + a2 * y + a3 * x * y;   
 
  644    catch ( ... ) { gHeight = 0.0;                          
return( 1 ); }
 
  692             std::ifstream::binary | std::ifstream::in );
 
  694       if ( fin.fail() )                                    
return( 1 );
 
  698       fin.read((
char*) &
_nGridPad,  BYTES_PER_INT );
 
  700       if (fin.fail()) { fin.close();                       
return( 1 ); }
 
  702       fin.read((
char*) &
_nOrigRows, BYTES_PER_INT );
 
  704       if (fin.fail()) { fin.close();                       
return( 1 ); }
 
  706       fin.read((
char*) &
_nOrigCols, BYTES_PER_INT );
 
  708       if (fin.fail()) { fin.close();                       
return( 1 ); }
 
  710       fin.read((
char*) &
_dLat,      BYTES_PER_DOUBLE );
 
  712       if (fin.fail()) { fin.close();                       
return( 1 ); }
 
  714       fin.read((
char*) &
_dLon,      BYTES_PER_DOUBLE );
 
  716       if (fin.fail()) { fin.close();                       
return( 1 ); }
 
  730       _dLat         *= RAD_PER_DEG;  
 
  731       _dLon         *= RAD_PER_DEG;  
 
  761       for ( i = startRow; i >= endRow; i-- ) 
 
  767                ( _nGridCols * BYTES_PER_FLOAT ));
 
  769          if ( fin.fail() ) { fin.close();                  
return( 1 ); }
 
  776                &
_heightGrid[ index0 ], BYTES_PER_FLOAT, _nGridCols ); 
 
  787    catch ( ... ) {                                         
return( 1 ); }