예제 #1
0
/**
 * Get the hourly rot for a given temperature from the precomputed table.
 * @see rot_chart
 */
int get_hourly_rotpoints_at_temp( const int temp )
{
    /**
     * Precomputed rot lookup table.
     */
    static const std::vector<int> rot_chart = calc_rot_array( 200 );

    if( temp < 0 ) {
        return 0;
    }
    if( temp > 150 ) {
        return 3540;
    }
    return rot_chart[temp];
}
예제 #2
0
/**
 * Initialize the rot table.
 * @see rot_chart
 */
std::vector<int> calc_rot_array(const int cap) {
    std::vector<int> ret;
    for (int i = 0; i < cap; i++  ) {
        ret.push_back(calc_hourly_rotpoints_at_temp(i));
    }
    return ret;
}

/**
 * Precomputed rot lookup table.
 */
const std::vector<int> rot_chart = calc_rot_array(200);

/**
 * Get the hourly rot for a given temperature from the precomputed table.
 * @see rot_chart
 */
int get_hourly_rotpoints_at_temp (const int & temp) {
    if ( temp < 0 || temp < -1 ) return 0;
    if ( temp > 150 ) return 3540;
    return rot_chart[temp];
}

///@}
#endif // _WEATHER_DATA_H_