*/
BoundingBox() = default;
+ /**
+ * Standard copy constructor operator.
+ */
+ BoundingBox(const BoundingBox<spacedim, Number> &box) = default;
+
+ /**
+ * Standard copy assignment operator.
+ */
+ BoundingBox<spacedim, Number> &
+ operator=(const BoundingBox<spacedim, Number> &t) = default;
+
+ /**
+ * Standard constructor for an empty box around a point @p point.
+ */
+ BoundingBox(const Point<spacedim, Number> &point);
+
/**
* Standard constructor for non-empty boxes: it uses a pair of points
* which describe the box: one for the bottom and one for the top
void
extend(const Number amount);
+ /**
+ * The same as above with the difference that a new BoundingBox instance is
+ * created without changing the current object.
+ */
+ BoundingBox<spacedim, Number>
+ create_extended(const Number amount) const;
+
/**
* Compute the volume (i.e. the dim-dimensional measure) of the BoundingBox.
*/
#ifndef DOXYGEN
+template <int spacedim, typename Number>
+inline BoundingBox<spacedim, Number>::BoundingBox(
+ const Point<spacedim, Number> &p)
+ : BoundingBox({p, p})
+{}
+
+
+
template <int spacedim, typename Number>
inline BoundingBox<spacedim, Number>::BoundingBox(
const std::pair<Point<spacedim, Number>, Point<spacedim, Number>>
}
+
+template <int spacedim, typename Number>
+inline BoundingBox<spacedim, Number>
+BoundingBox<spacedim, Number>::create_extended(const Number amount) const
+{
+ // create and modify copy
+ auto bb = *this;
+ bb.extend(amount);
+
+ return bb;
+}
+
+
template <int spacedim, typename Number>
template <class Archive>
void
deallog << "Boxes should not be equal : " << (b2 != b) << std::endl;
}
deallog << std::endl;
+
+ // Initalize box with point
+ {
+ Point<spacedim> p;
+ for (unsigned int i = 0; i < spacedim; ++i)
+ p[i] = i + 1;
+
+ BoundingBox<spacedim> b(p);
+ deallog << "Boundary points: " << std::endl;
+ deallog << b.get_boundary_points().first << std::endl;
+ deallog << b.get_boundary_points().second << std::endl;
+ }
+ deallog << std::endl;
+
+ // Initalize box with box
+ {
+ BoundingBox<spacedim> bb(b);
+ deallog << "Boundary points: " << std::endl;
+ deallog << bb.get_boundary_points().first << std::endl;
+ deallog << bb.get_boundary_points().second << std::endl;
+ }
+ deallog << std::endl;
+
+ // Initalize box with box
+ {
+ BoundingBox<spacedim> bb;
+ bb = b;
+ deallog << "Boundary points: " << std::endl;
+ deallog << bb.get_boundary_points().first << std::endl;
+ deallog << bb.get_boundary_points().second << std::endl;
+ }
+ deallog << std::endl;
}
void
DEAL::-12.5000 is inside: 0
DEAL::Boxes should not be equal : 1
DEAL::
+DEAL::Boundary points:
+DEAL::1.00000
+DEAL::1.00000
+DEAL::
+DEAL::Boundary points:
+DEAL::0.200000
+DEAL::0.800000
+DEAL::
+DEAL::Boundary points:
+DEAL::0.200000
+DEAL::0.800000
+DEAL::
DEAL::
DEAL::Test for dimension 2
DEAL::Empty constructor:
DEAL::-12.5000 -20.0000 is inside: 0
DEAL::Boxes should not be equal : 1
DEAL::
+DEAL::Boundary points:
+DEAL::1.00000 2.00000
+DEAL::1.00000 2.00000
+DEAL::
+DEAL::Boundary points:
+DEAL::0.200000 0.00000
+DEAL::0.800000 1.60000
+DEAL::
+DEAL::Boundary points:
+DEAL::0.200000 0.00000
+DEAL::0.800000 1.60000
+DEAL::
DEAL::
DEAL::Test for dimension 3
DEAL::Empty constructor:
DEAL::-12.5000 -20.0000 -27.5000 is inside: 0
DEAL::Boxes should not be equal : 1
DEAL::
+DEAL::Boundary points:
+DEAL::1.00000 2.00000 3.00000
+DEAL::1.00000 2.00000 3.00000
+DEAL::
+DEAL::Boundary points:
+DEAL::0.200000 0.00000 -0.200000
+DEAL::0.800000 1.60000 2.40000
+DEAL::
+DEAL::Boundary points:
+DEAL::0.200000 0.00000 -0.200000
+DEAL::0.800000 1.60000 2.40000
+DEAL::
DEAL::
DEAL::Test for dimension 3, unitary box
DEAL::Boundary points:
//
// ---------------------------------------------------------------------
-// test BoundingBox::extend
+// test BoundingBox::extend() and BoundingBox::create_extend()
#include <deal.II/base/bounding_box.h>
BoundingBox<dim> box({p0, p1});
+ const auto box1 = box.create_extended(.5);
+
+ deallog << "New points: " << box1.get_boundary_points().first << ", "
+ << box1.get_boundary_points().second << std::endl;
+
box.extend(.5);
deallog << "New points: " << box.get_boundary_points().first << ", "
<< box.get_boundary_points().second << std::endl;
+ const auto box2 = box.create_extended(-.8);
+
+ deallog << "New points: " << box2.get_boundary_points().first << ", "
+ << box2.get_boundary_points().second << std::endl;
box.extend(-.8);
DEAL::New points: -0.500000, 1.50000
+DEAL::New points: -0.500000, 1.50000
+DEAL::New points: 0.300000, 0.700000
DEAL::New points: 0.300000, 0.700000
DEAL::New points: -0.500000 -0.500000, 1.50000 1.50000
+DEAL::New points: -0.500000 -0.500000, 1.50000 1.50000
DEAL::New points: 0.300000 0.300000, 0.700000 0.700000
+DEAL::New points: 0.300000 0.300000, 0.700000 0.700000
+DEAL::New points: -0.500000 -0.500000 -0.500000, 1.50000 1.50000 1.50000
DEAL::New points: -0.500000 -0.500000 -0.500000, 1.50000 1.50000 1.50000
DEAL::New points: 0.300000 0.300000 0.300000, 0.700000 0.700000 0.700000
+DEAL::New points: 0.300000 0.300000 0.300000, 0.700000 0.700000 0.700000