Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/area extraction test #179

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Prev Previous commit
Next Next commit
Robustness
wdeconinck committed Mar 11, 2024
commit 3c6fb6ab5507bda66f3a597a49645e147377e2d1
19 changes: 13 additions & 6 deletions src/atlas/grid/StructuredPartitionPolygon.cc
Original file line number Diff line number Diff line change
@@ -35,6 +35,11 @@ void compute(const functionspace::FunctionSpaceImpl& _fs, idx_t _halo, std::vect
const auto grid = fs.grid();
const auto dom = RectangularDomain(grid.domain());

if ( fs.size() == 0 ) {
bb.clear();
return;
}

if (_halo > 0 && _halo != fs.halo()) {
throw_Exception("halo must zero or matching the one of the StructuredColumns", Here());
}
@@ -324,13 +329,15 @@ StructuredPartitionPolygon::StructuredPartitionPolygon(const functionspace::Func
fs_(fs), halo_(halo) {
ATLAS_TRACE("StructuredPartitionPolygon");
compute(fs, halo, points_, inner_bounding_box_);
auto min = Point2(std::numeric_limits<double>::max(), std::numeric_limits<double>::max());
auto max = Point2(std::numeric_limits<double>::lowest(), std::numeric_limits<double>::lowest());
for (size_t i = 0; i < inner_bounding_box_.size() - 1; ++i) {
min = Point2::componentsMin(min, inner_bounding_box_[i]);
max = Point2::componentsMax(max, inner_bounding_box_[i]);
if (inner_bounding_box_.size()) {
auto min = Point2(std::numeric_limits<double>::max(), std::numeric_limits<double>::max());
auto max = Point2(std::numeric_limits<double>::lowest(), std::numeric_limits<double>::lowest());
for (size_t i = 0; i < inner_bounding_box_.size() - 1; ++i) {
min = Point2::componentsMin(min, inner_bounding_box_[i]);
max = Point2::componentsMax(max, inner_bounding_box_[i]);
}
inscribed_domain_ = {{min[XX], max[XX]}, {min[YY], max[YY]}};
}
inscribed_domain_ = {{min[XX], max[XX]}, {min[YY], max[YY]}};
}

size_t StructuredPartitionPolygon::footprint() const {