| 1997 | //------------------------------------------------------------------------------ |
| 1998 | |
| 1999 | void vtkMPASReader::FixPoints() |
| 2000 | { |
| 2001 | vtkDebugMacro(<< "In FixPoints..." << endl); |
| 2002 | |
| 2003 | for (size_t j = this->CellOffset; j < this->NumberOfCells + this->CellOffset; j++) |
| 2004 | { |
| 2005 | int* conns = this->OrigConnections + (j * this->PointsPerCell); |
| 2006 | |
| 2007 | // go through and make sure none of the referenced points are |
| 2008 | // out of range |
| 2009 | // if so, set all to point 0 |
| 2010 | for (size_t k = 0; k < this->PointsPerCell; k++) |
| 2011 | { |
| 2012 | if ((conns[k] <= 0) || (static_cast<size_t>(conns[k]) > this->NumberOfPoints)) |
| 2013 | { |
| 2014 | for (size_t m = 0; m < this->PointsPerCell; m++) |
| 2015 | { |
| 2016 | conns[m] = 0; |
| 2017 | } |
| 2018 | break; |
| 2019 | } |
| 2020 | } |
| 2021 | |
| 2022 | if (this->DoBugFix) |
| 2023 | { |
| 2024 | // BUG FIX for problem where cells are stretching to a faraway point |
| 2025 | size_t lastk = this->PointsPerCell - 1; |
| 2026 | constexpr double thresh = .06981317007977; // 4 degrees |
| 2027 | for (size_t k = 0; k < this->PointsPerCell; k++) |
| 2028 | { |
| 2029 | double ydiff = std::abs(this->PointY[conns[k]] - this->PointY[conns[lastk]]); |
| 2030 | // Don't look at cells at map border |
| 2031 | if (ydiff > thresh) |
| 2032 | { |
| 2033 | for (size_t m = 0; m < this->PointsPerCell; m++) |
| 2034 | { |
| 2035 | conns[m] = 0; |
| 2036 | } |
| 2037 | break; |
| 2038 | } |
| 2039 | } |
| 2040 | } |
| 2041 | } |
| 2042 | vtkDebugMacro(<< "Leaving FixPoints..." << endl); |
| 2043 | } |
| 2044 | |
| 2045 | //------------------------------------------------------------------------------ |
| 2046 | // Eliminate wraparound at east/west edges of lat/lon projection |
no test coverage detected