Ejemplo n.º 1
0
void OutCoreInterp::updateInterpArray(int fileNum, double data_x, double data_y, double data_z)
{
    double x;
    double y;

    int lower_grid_x;
    int lower_grid_y;

    lower_grid_x = (int)floor((double)data_x/GRID_DIST_X); // global/local coordinate
    lower_grid_y = (int)floor((double)data_y/GRID_DIST_Y); // global coordinate

    x = data_x - lower_grid_x * GRID_DIST_X;
    y = data_y - lower_grid_y * GRID_DIST_Y;


    //if(lower_grid_y == 30 && data_y > GRID_DIST_Y * lower_grid_y)
    //printf("(%f %f) = (%d, %d)\n", data_x, data_y, lower_grid_x, lower_grid_y);

    // if the opened file is not the 0th file, then you have to consider the offset of the grid of the file!!!
    lower_grid_y -= gridMap[fileNum]->getOverlapLowerBound(); // local coordinate

    //cout << fileNum << ":(" << lower_grid_x << "," << lower_grid_y << ")" << endl;

    update_first_quadrant(fileNum, data_z, lower_grid_x + 1, lower_grid_y + 1, GRID_DIST_X -x, GRID_DIST_Y - y);
    update_second_quadrant(fileNum, data_z, lower_grid_x, lower_grid_y + 1, x, GRID_DIST_Y - y);
    update_third_quadrant(fileNum, data_z, lower_grid_x, lower_grid_y, x, y);
    update_fourth_quadrant(fileNum, data_z, lower_grid_x + 1, lower_grid_y, GRID_DIST_X - x, y);
}
Ejemplo n.º 2
0
int InCoreInterp::update(double data_x, double data_y, double data_z)
{
    double x;
    double y;

    int lower_grid_x;
    int lower_grid_y;

    //cerr << GRID_DIST_X << " " << GRID_DIST_Y;
    lower_grid_x = (int)floor((double)data_x/GRID_DIST_X);
    lower_grid_y = (int)floor((double)data_y/GRID_DIST_Y);

    if(lower_grid_x > GRID_SIZE_X || lower_grid_y > GRID_SIZE_Y)
    {
        cerr << "larger at (" << lower_grid_x << "," << lower_grid_y << "): ("<< data_x << ", " << data_y << ")" << endl;
        return 0;
    }

    //printf("lower_grid_x: %d, grid_y: %d, arrX: %.2f, arrY: %.2f\n", lower_grid_x, lower_grid_y, arrX[i], arrY[i]);
    x = (data_x - (lower_grid_x) * GRID_DIST_X);
    y = (data_y - (lower_grid_y) * GRID_DIST_Y);

    //cerr << "(" << data_x << " " << data_y << ")=(" << lower_grid_x << ", " << lower_grid_y << "): ";
    //printf("(%f %f) = (%d, %d): ", data_x, data_y, lower_grid_x, lower_grid_y);

    //if(lower_grid_y == 30 && data_y > GRID_DIST_Y * lower_grid_y)
    //printf("(%f %f) = (%d, %d)\n", data_x, data_y, lower_grid_x, lower_grid_y);

    update_first_quadrant(data_z, lower_grid_x+1, lower_grid_y+1, GRID_DIST_X - x, GRID_DIST_Y - y);
    update_second_quadrant(data_z, lower_grid_x, lower_grid_y+1, x, GRID_DIST_Y - y);
    update_third_quadrant(data_z, lower_grid_x, lower_grid_y, x, y);
    update_fourth_quadrant(data_z, lower_grid_x+1, lower_grid_y, GRID_DIST_X - x, y);

    //cerr << "test" << endl;
    return 0;
}