Skip to content

Commit a2895e9

Browse files
committed
Non-defaulted padding in BoundingBoxTree c++ constructor
- Changed argument order to match Python constructor
1 parent 15f647e commit a2895e9

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

cpp/dolfinx/geometry/BoundingBoxTree.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ class BoundingBoxTree
224224
/// @param[in] padding Value to pad (extend) the the bounding box of
225225
/// each entity by.
226226
BoundingBoxTree(const mesh::Mesh<T>& mesh, int tdim,
227-
std::span<const std::int32_t> entities, double padding = 0)
227+
double padding, std::span<const std::int32_t> entities)
228228
: _tdim(tdim)
229229
{
230230
if (tdim < 0 or tdim > mesh.topology()->dim())
@@ -266,7 +266,7 @@ class BoundingBoxTree
266266
/// build the bounding box tree for
267267
/// @param[in] padding Value to pad (extend) the the bounding box of
268268
/// each entity by.
269-
BoundingBoxTree(const mesh::Mesh<T>& mesh, int tdim, T padding = 0)
269+
BoundingBoxTree(const mesh::Mesh<T>& mesh, int tdim, T padding)
270270
: BoundingBoxTree::BoundingBoxTree(
271271
mesh, tdim, range(mesh.topology_mutable(), tdim), padding)
272272
{

cpp/dolfinx/geometry/utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ PointOwnershipData<T> determine_point_ownership(const mesh::Mesh<T>& mesh,
697697
}
698698
// Create a global bounding-box tree to find candidate processes with
699699
// cells that could collide with the points
700-
BoundingBoxTree bb(mesh, tdim, cells, padding);
700+
BoundingBoxTree bb(mesh, tdim, padding, cells);
701701
BoundingBoxTree global_bbtree = bb.create_global_tree(comm);
702702

703703
// Compute collisions:

python/dolfinx/geometry.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,11 @@ def bb_tree(
128128
dtype = mesh.geometry.x.dtype
129129
if np.issubdtype(dtype, np.float32):
130130
return BoundingBoxTree(
131-
_cpp.geometry.BoundingBoxTree_float32(mesh._cpp_object, dim, entities, padding)
131+
_cpp.geometry.BoundingBoxTree_float32(mesh._cpp_object, dim, padding, entities)
132132
)
133133
elif np.issubdtype(dtype, np.float64):
134134
return BoundingBoxTree(
135-
_cpp.geometry.BoundingBoxTree_float64(mesh._cpp_object, dim, entities, padding)
135+
_cpp.geometry.BoundingBoxTree_float64(mesh._cpp_object, dim, padding, entities)
136136
)
137137
else:
138138
raise NotImplementedError(f"Type {dtype} not supported.")

python/dolfinx/wrappers/geometry.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,16 @@ void declare_bbtree(nb::module_& m, std::string type)
3333
"__init__",
3434
[](dolfinx::geometry::BoundingBoxTree<T>* bbt,
3535
const dolfinx::mesh::Mesh<T>& mesh, int dim,
36+
double padding,
3637
nb::ndarray<const std::int32_t, nb::ndim<1>, nb::c_contig>
37-
entities,
38-
double padding)
38+
entities)
3939
{
4040
new (bbt) dolfinx::geometry::BoundingBoxTree<T>(
4141
mesh, dim,
42-
std::span<const std::int32_t>(entities.data(), entities.size()),
43-
padding);
42+
padding,
43+
std::span<const std::int32_t>(entities.data(), entities.size()));
4444
},
45-
nb::arg("mesh"), nb::arg("dim"), nb::arg("entities"),
46-
nb::arg("padding") = 0.0)
45+
nb::arg("mesh"), nb::arg("dim"), nb::arg("padding"), nb::arg("entities"))
4746
.def_prop_ro("num_bboxes",
4847
&dolfinx::geometry::BoundingBoxTree<T>::num_bboxes)
4948
.def(

0 commit comments

Comments
 (0)