diff --git a/Source/EBGeometry_AnalyticDistanceFunctions.hpp b/Source/EBGeometry_AnalyticDistanceFunctions.hpp index bd585f24..871207ab 100644 --- a/Source/EBGeometry_AnalyticDistanceFunctions.hpp +++ b/Source/EBGeometry_AnalyticDistanceFunctions.hpp @@ -86,7 +86,7 @@ class PlaneSDF : public SignedDistanceFunction @param[in] a_point Point on the plane @param[in] a_normal Plane normal vector. */ - PlaneSDF(const Vec3T& a_point, const Vec3T& a_normal) + PlaneSDF(const Vec3T& a_point, const Vec3T& a_normal) noexcept { m_point = a_point; m_normal = a_normal / a_normal.length(); @@ -131,7 +131,7 @@ class SphereSDF : public SignedDistanceFunction @param[in] a_center Sphere center @param[in] a_radius Sphere radius */ - SphereSDF(const Vec3T& a_center, const T& a_radius) + SphereSDF(const Vec3T& a_center, const T& a_radius) noexcept { this->m_center = a_center; this->m_radius = a_radius; @@ -140,7 +140,7 @@ class SphereSDF : public SignedDistanceFunction /*! @brief Copy constructor */ - SphereSDF(const SphereSDF& a_other) + SphereSDF(const SphereSDF& a_other) noexcept { this->m_center = a_other.m_center; this->m_radius = a_other.m_radius; @@ -149,7 +149,7 @@ class SphereSDF : public SignedDistanceFunction /*! @brief Destructor */ - virtual ~SphereSDF() = default; + virtual ~SphereSDF() noexcept = default; /*! @brief Get center @@ -226,7 +226,7 @@ class BoxSDF : public SignedDistanceFunction @param[in] a_loCorner Lower left corner @param[in] a_hiCorner Upper right corner */ - BoxSDF(const Vec3T& a_loCorner, const Vec3T& a_hiCorner) + BoxSDF(const Vec3T& a_loCorner, const Vec3T& a_hiCorner) noexcept { this->m_loCorner = a_loCorner; this->m_hiCorner = a_hiCorner; @@ -235,7 +235,7 @@ class BoxSDF : public SignedDistanceFunction /*! @brief Destructor (does nothing). */ - virtual ~BoxSDF() + virtual ~BoxSDF() noexcept {} /*! @@ -334,7 +334,7 @@ class TorusSDF : public SignedDistanceFunction @param[in] a_majorRadius Major torus radius. @param[in] a_minorRadius Minor torus radius. */ - TorusSDF(const Vec3T& a_center, const T& a_majorRadius, const T& a_minorRadius) + TorusSDF(const Vec3T& a_center, const T& a_majorRadius, const T& a_minorRadius) noexcept { this->m_center = a_center; this->m_majorRadius = a_majorRadius; @@ -344,7 +344,7 @@ class TorusSDF : public SignedDistanceFunction /*! @brief Destructor (does nothing). */ - virtual ~TorusSDF() + virtual ~TorusSDF() noexcept {} /*! @@ -455,7 +455,7 @@ class CylinderSDF : public SignedDistanceFunction @param[in] a_center2 Other endpoint. @param[in] a_radius Cylinder radius. */ - CylinderSDF(const Vec3T& a_center1, const Vec3T& a_center2, const T& a_radius) + CylinderSDF(const Vec3T& a_center1, const Vec3T& a_center2, const T& a_radius) noexcept { this->m_center1 = a_center1; this->m_center2 = a_center2; @@ -470,7 +470,7 @@ class CylinderSDF : public SignedDistanceFunction /*! @brief Destructor (does nothing). */ - virtual ~CylinderSDF() + virtual ~CylinderSDF() noexcept {} /*! @@ -592,7 +592,7 @@ class InfiniteCylinderSDF : public SignedDistanceFunction @param[in] a_radius Cylinder radius. @param[in] a_axis Cylinder axis. */ - InfiniteCylinderSDF(const Vec3T& a_center, const T& a_radius, const size_t a_axis) + InfiniteCylinderSDF(const Vec3T& a_center, const T& a_radius, const size_t a_axis) noexcept { m_center = a_center; m_radius = a_radius; @@ -650,7 +650,7 @@ class CapsuleSDF : public SignedDistanceFunction @param[in] a_tip2 Other center point. @param[in] a_radius Radius. */ - CapsuleSDF(const Vec3T& a_tip1, const Vec3T a_tip2, const T& a_radius) + CapsuleSDF(const Vec3T& a_tip1, const Vec3T a_tip2, const T& a_radius) noexcept { const Vec3T axis = (a_tip2 - a_tip1) / length(a_tip2 - a_tip1); m_center1 = a_tip1 + a_radius * axis; @@ -708,7 +708,7 @@ class InfiniteConeSDF : public SignedDistanceFunction @param[in] a_tip Cone tip position @param[in] a_angle Cone opening angle. */ - InfiniteConeSDF(const Vec3T& a_tip, const T& a_angle) + InfiniteConeSDF(const Vec3T& a_tip, const T& a_angle) noexcept { constexpr T pi = 3.14159265358979323846; @@ -769,7 +769,7 @@ class ConeSDF : public SignedDistanceFunction @param[in] a_height Cone height, measured from top to bottom. @param[in] a_angle Cone opening angle. */ - ConeSDF(const Vec3T& a_tip, const T& a_height, const T& a_angle) + ConeSDF(const Vec3T& a_tip, const T& a_height, const T& a_angle) noexcept { constexpr T pi = 3.14159265358979323846; @@ -849,7 +849,7 @@ class RoundedBoxSDF : public SignedDistanceFunction @param[in] a_curvature Corner curvature. @note Curvature must be > 0.0 */ - RoundedBoxSDF(const Vec3T& a_dimensions, const T a_curvature) + RoundedBoxSDF(const Vec3T& a_dimensions, const T a_curvature) noexcept { this->m_dimensions = 0.5 * a_dimensions; diff --git a/Source/EBGeometry_BVH.hpp b/Source/EBGeometry_BVH.hpp index b9d35784..8146a91b 100644 --- a/Source/EBGeometry_BVH.hpp +++ b/Source/EBGeometry_BVH.hpp @@ -140,7 +140,7 @@ namespace BVH { @brief Function for splitting a vector of some size into K almost-equal chunks. This is a utility function. */ template - auto equalCounts = [](const std::vector& a_primitives) -> std::array, K> { + auto equalCounts = [](const std::vector& a_primitives) noexcept -> std::array, K> { int length = a_primitives.size() / K; int remain = a_primitives.size() % K; @@ -167,7 +167,7 @@ namespace BVH { */ template auto PrimitiveCentroidPartitioner = - [](const PrimAndBVListT& a_primsAndBVs) -> std::array, K> { + [](const PrimAndBVListT& a_primsAndBVs) noexcept -> std::array, K> { Vec3T lo = Vec3T::max(); Vec3T hi = -Vec3T::max(); @@ -224,7 +224,7 @@ namespace BVH { */ template auto DefaultStopFunction = - [](const BVH::NodeT& a_node) -> bool { return (a_node.getPrimitives()).size() < K; }; + [](const BVH::NodeT& a_node) noexcept -> bool { return (a_node.getPrimitives()).size() < K; }; /*! @brief Class which encapsulates a node in a bounding volume hierarchy. diff --git a/Source/EBGeometry_CSGImplem.hpp b/Source/EBGeometry_CSGImplem.hpp index 01dee552..bc03acee 100644 --- a/Source/EBGeometry_CSGImplem.hpp +++ b/Source/EBGeometry_CSGImplem.hpp @@ -319,18 +319,18 @@ FastUnionIF::value(const Vec3T& a_point) const noexcept T minDist = std::numeric_limits::infinity(); BVH::Updater

updater = [&minDist, - &a_point](const std::vector>& a_implicitFunctions) -> void { + &a_point](const std::vector>& a_implicitFunctions) noexcept -> void { for (const auto& implicitFunction : a_implicitFunctions) { minDist = std::min(minDist, implicitFunction->value(a_point)); } }; - BVH::Visiter visiter = [&minDist](const Node& a_node, const T& a_bvDist) -> bool { + BVH::Visiter visiter = [&minDist](const Node& a_node, const T& a_bvDist) noexcept -> bool { return a_bvDist <= 0.0 || a_bvDist <= minDist; }; BVH::Sorter sorter = - [&a_point](std::array, T>, K>& a_leaves) -> void { + [&a_point](std::array, T>, K>& a_leaves) noexcept -> void { std::sort( a_leaves.begin(), a_leaves.end(), @@ -338,7 +338,7 @@ FastUnionIF::value(const Vec3T& a_point) const noexcept const std::pair, T>& n2) -> bool { return n1.second > n2.second; }); }; - BVH::MetaUpdater metaUpdater = [&a_point](const Node& a_node) -> T { + BVH::MetaUpdater metaUpdater = [&a_point](const Node& a_node) noexcept -> T { return a_node.getDistanceToBoundingVolume(a_point); }; @@ -378,7 +378,7 @@ FastSmoothUnionIF::value(const Vec3T& a_point) const noexcept T b = std::numeric_limits::infinity(); BVH::Updater

updater = - [&a, &b, &a_point](const std::vector>& a_implicitFunctions) -> void { + [&a, &b, &a_point](const std::vector>& a_implicitFunctions) noexcept -> void { for (const auto& implicitFunction : a_implicitFunctions) { const auto& d = implicitFunction->value(a_point); @@ -392,12 +392,12 @@ FastSmoothUnionIF::value(const Vec3T& a_point) const noexcept } }; - BVH::Visiter visiter = [&a, &b](const Node& a_node, const T& a_bvDist) -> bool { + BVH::Visiter visiter = [&a, &b](const Node& a_node, const T& a_bvDist) noexcept -> bool { return a_bvDist <= 0.0 || a_bvDist <= a || a_bvDist <= b; }; BVH::Sorter sorter = - [&a_point](std::array, T>, K>& a_leaves) -> void { + [&a_point](std::array, T>, K>& a_leaves) noexcept -> void { std::sort( a_leaves.begin(), a_leaves.end(), @@ -405,7 +405,7 @@ FastSmoothUnionIF::value(const Vec3T& a_point) const noexcept const std::pair, T>& n2) -> bool { return n1.second > n2.second; }); }; - BVH::MetaUpdater metaUpdater = [&a_point](const Node& a_node) -> T { + BVH::MetaUpdater metaUpdater = [&a_point](const Node& a_node) noexcept -> T { return a_node.getDistanceToBoundingVolume(a_point); }; diff --git a/Source/EBGeometry_DCEL_Mesh.hpp b/Source/EBGeometry_DCEL_Mesh.hpp index f675e00c..3e36b534 100644 --- a/Source/EBGeometry_DCEL_Mesh.hpp +++ b/Source/EBGeometry_DCEL_Mesh.hpp @@ -108,7 +108,7 @@ namespace DCEL { /*! @brief Default constructor. Leaves unobject in an unusable state */ - MeshT(); + MeshT() noexcept; /*! @brief Disallowed copy construction @@ -127,12 +127,12 @@ namespace DCEL { description. This is usually done through a file parser which reads a mesh file format and creates the DCEL mesh structure */ - MeshT(std::vector& a_faces, std::vector& a_edges, std::vector& a_vertices); + MeshT(std::vector& a_faces, std::vector& a_edges, std::vector& a_vertices) noexcept; /*! @brief Destructor (does nothing) */ - virtual ~MeshT(); + virtual ~MeshT() noexcept; /*! @brief Define function. Puts Mesh in usable state. diff --git a/Source/EBGeometry_DCEL_MeshImplem.hpp b/Source/EBGeometry_DCEL_MeshImplem.hpp index f353a4f1..dad65140 100644 --- a/Source/EBGeometry_DCEL_MeshImplem.hpp +++ b/Source/EBGeometry_DCEL_MeshImplem.hpp @@ -23,7 +23,7 @@ namespace DCEL { template - inline MeshT::MeshT() + inline MeshT::MeshT() noexcept { m_algorithm = SearchAlgorithm::Direct2; } @@ -31,14 +31,14 @@ namespace DCEL { template inline MeshT::MeshT(std::vector& a_faces, std::vector& a_edges, - std::vector& a_vertices) + std::vector& a_vertices) noexcept : MeshT() { this->define(a_faces, a_edges, a_vertices); } template - inline MeshT::~MeshT() + inline MeshT::~MeshT() noexcept {} template diff --git a/Source/EBGeometry_MeshDistanceFunctionsImplem.hpp b/Source/EBGeometry_MeshDistanceFunctionsImplem.hpp index 0dfbf146..68f77e9f 100644 --- a/Source/EBGeometry_MeshDistanceFunctionsImplem.hpp +++ b/Source/EBGeometry_MeshDistanceFunctionsImplem.hpp @@ -100,7 +100,7 @@ FastMeshSDF::signedDistance(const Vec3T& a_point) const noexc { T minDist = std::numeric_limits::infinity(); - BVH::Updater updater = [&minDist, &a_point](const std::vector>& faces) -> void { + BVH::Updater updater = [&minDist, &a_point](const std::vector>& faces) noexcept -> void { for (const auto& f : faces) { const T curDist = f->signedDistance(a_point); @@ -108,12 +108,12 @@ FastMeshSDF::signedDistance(const Vec3T& a_point) const noexc } }; - BVH::Visiter visiter = [&minDist, &a_point](const Node& a_node, const T& a_bvDist) -> bool { + BVH::Visiter visiter = [&minDist, &a_point](const Node& a_node, const T& a_bvDist) noexcept -> bool { return a_bvDist <= std::abs(minDist); }; BVH::Sorter sorter = - [&a_point](std::array, T>, K>& a_leaves) -> void { + [&a_point](std::array, T>, K>& a_leaves) noexcept -> void { std::sort( a_leaves.begin(), a_leaves.end(), @@ -121,7 +121,7 @@ FastMeshSDF::signedDistance(const Vec3T& a_point) const noexc const std::pair, T>& n2) -> bool { return n1.second > n2.second; }); }; - BVH::MetaUpdater metaUpdater = [&a_point](const Node& a_node) -> T { + BVH::MetaUpdater metaUpdater = [&a_point](const Node& a_node) noexcept -> T { return a_node.getDistanceToBoundingVolume(a_point); }; @@ -150,13 +150,13 @@ FastMeshSDF::getClosestFaces(const Vec3T& a_point, const bool // Visitation pattern - go into the node if the point is inside or the distance to the BV is shorter than // the shortest distance so far. EBGeometry::BVH::Visiter visiter = [&shortestDistanceSoFar](const Node& a_node, - const BVHMeta& a_bvDist) -> bool { + const BVHMeta& a_bvDist) noexcept -> bool { return a_bvDist <= 0.0 || a_bvDist <= shortestDistanceSoFar; }; // Sorter for BVH nodes, visit closest nodes first EBGeometry::BVH::Sorter sorter = - [&a_point](std::array, T>, K>& a_leaves) -> void { + [&a_point](std::array, T>, K>& a_leaves) noexcept -> void { std::sort( a_leaves.begin(), a_leaves.end(), @@ -165,13 +165,13 @@ FastMeshSDF::getClosestFaces(const Vec3T& a_point, const bool }; // Meta-data updater - this meta-data enters into the visitor pattern. - EBGeometry::BVH::MetaUpdater metaUpdater = [&a_point](const Node& a_node) -> BVHMeta { + EBGeometry::BVH::MetaUpdater metaUpdater = [&a_point](const Node& a_node) noexcept -> BVHMeta { return a_node.getDistanceToBoundingVolume(a_point); }; // Update rule for the BVH. Go through the faces and check EBGeometry::BVH::Updater updater = [&shortestDistanceSoFar, &a_point, &candidateFaces]( - const std::vector>& a_faces) -> void { + const std::vector>& a_faces) noexcept -> void { // Calculate the distance to each face in the leaf node. If it is shorter than the shortest distance so far, add this face // to the list of faces and update the shortest distance. for (const auto& f : a_faces) { @@ -234,7 +234,8 @@ FastCompactMeshSDF::signedDistance(const Vec3T& a_point) cons { T minDist = std::numeric_limits::infinity(); - BVH::Updater updater = [&minDist, &a_point](const std::vector>& faces) -> void { + BVH::Updater updater = [&minDist, + &a_point](const std::vector>& faces) noexcept -> void { for (const auto& f : faces) { const T curDist = f->signedDistance(a_point); @@ -242,12 +243,12 @@ FastCompactMeshSDF::signedDistance(const Vec3T& a_point) cons } }; - BVH::Visiter visiter = [&minDist, &a_point](const Node& a_node, const T& a_bvDist) -> bool { + BVH::Visiter visiter = [&minDist, &a_point](const Node& a_node, const T& a_bvDist) noexcept -> bool { return a_bvDist <= std::abs(minDist); }; BVH::Sorter sorter = - [&a_point](std::array, T>, K>& a_leaves) -> void { + [&a_point](std::array, T>, K>& a_leaves) noexcept -> void { std::sort( a_leaves.begin(), a_leaves.end(), @@ -255,7 +256,7 @@ FastCompactMeshSDF::signedDistance(const Vec3T& a_point) cons const std::pair, T>& n2) -> bool { return n1.second > n2.second; }); }; - BVH::MetaUpdater metaUpdater = [&a_point](const Node& a_node) -> T { + BVH::MetaUpdater metaUpdater = [&a_point](const Node& a_node) noexcept -> T { return a_node.getDistanceToBoundingVolume(a_point); }; @@ -282,13 +283,13 @@ FastCompactMeshSDF::getClosestFaces(const Vec3T& a_point, con // Visitation pattern - go into the node if the point is inside or the distance to the BV is shorter than // the shortest distance so far. EBGeometry::BVH::Visiter visiter = [&shortestDistanceSoFar](const Node& a_node, - const BVHMeta& a_bvDist) -> bool { + const BVHMeta& a_bvDist) noexcept -> bool { return a_bvDist <= 0.0 || a_bvDist <= shortestDistanceSoFar; }; // Sorter for BVH nodes, visit closest nodes first EBGeometry::BVH::Sorter sorter = - [&a_point](std::array, T>, K>& a_leaves) -> void { + [&a_point](std::array, T>, K>& a_leaves) noexcept -> void { std::sort( a_leaves.begin(), a_leaves.end(), @@ -297,13 +298,13 @@ FastCompactMeshSDF::getClosestFaces(const Vec3T& a_point, con }; // Meta-data updater - this meta-data enters into the visitor pattern. - EBGeometry::BVH::MetaUpdater metaUpdater = [&a_point](const Node& a_node) -> BVHMeta { + EBGeometry::BVH::MetaUpdater metaUpdater = [&a_point](const Node& a_node) noexcept -> BVHMeta { return a_node.getDistanceToBoundingVolume(a_point); }; // Update rule for the BVH. Go through the faces and check EBGeometry::BVH::Updater updater = [&shortestDistanceSoFar, &a_point, &candidateFaces]( - const std::vector>& a_faces) -> void { + const std::vector>& a_faces) noexcept -> void { // Calculate the distance to each face in the leaf node. If it is shorter than the shortest distance so far, add this face // to the list of faces and update the shortest distance. for (const auto& f : a_faces) { diff --git a/Source/EBGeometry_Vec.hpp b/Source/EBGeometry_Vec.hpp index 6f4c18d5..262989ca 100644 --- a/Source/EBGeometry_Vec.hpp +++ b/Source/EBGeometry_Vec.hpp @@ -231,7 +231,7 @@ class Vec3T /*! @brief Default constructor. Sets the vector to the zero vector. */ - Vec3T(); + Vec3T() noexcept; /*! @brief Copy constructor @@ -247,12 +247,12 @@ class Vec3T @param[in] a_z Third vector component @details Sets this->x = a_x, this->y = a_y, and this->z = a_z */ - constexpr Vec3T(const T& a_x, const T& a_y, const T& a_z); + constexpr Vec3T(const T& a_x, const T& a_y, const T& a_z) noexcept; /*! @brief Destructor (does nothing) */ - ~Vec3T() = default; + ~Vec3T() noexcept = default; /*! @brief Return av vector with x = y = z = 0 diff --git a/Source/EBGeometry_VecImplem.hpp b/Source/EBGeometry_VecImplem.hpp index 7b1a2219..71520cce 100644 --- a/Source/EBGeometry_VecImplem.hpp +++ b/Source/EBGeometry_VecImplem.hpp @@ -200,7 +200,7 @@ operator/(const T& s, const Vec2T& a_other) noexcept } template -inline Vec3T::Vec3T() +inline Vec3T::Vec3T() noexcept { (*this) = Vec3T::zero(); } @@ -214,7 +214,7 @@ inline Vec3T::Vec3T(const Vec3T& u) noexcept } template -inline constexpr Vec3T::Vec3T(const T& a_x, const T& a_y, const T& a_z) : m_X{a_x, a_y, a_z} +inline constexpr Vec3T::Vec3T(const T& a_x, const T& a_y, const T& a_z) noexcept : m_X{a_x, a_y, a_z} {} template