Skip to content

Commit

Permalink
WIP on suppressing noexcept warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
rmrsk committed Aug 26, 2024
1 parent ec037c9 commit 89734df
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 53 deletions.
30 changes: 15 additions & 15 deletions Source/EBGeometry_AnalyticDistanceFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class PlaneSDF : public SignedDistanceFunction<T>
@param[in] a_point Point on the plane
@param[in] a_normal Plane normal vector.
*/
PlaneSDF(const Vec3T<T>& a_point, const Vec3T<T>& a_normal)
PlaneSDF(const Vec3T<T>& a_point, const Vec3T<T>& a_normal) noexcept
{
m_point = a_point;
m_normal = a_normal / a_normal.length();
Expand Down Expand Up @@ -131,7 +131,7 @@ class SphereSDF : public SignedDistanceFunction<T>
@param[in] a_center Sphere center
@param[in] a_radius Sphere radius
*/
SphereSDF(const Vec3T<T>& a_center, const T& a_radius)
SphereSDF(const Vec3T<T>& a_center, const T& a_radius) noexcept
{
this->m_center = a_center;
this->m_radius = a_radius;
Expand All @@ -140,7 +140,7 @@ class SphereSDF : public SignedDistanceFunction<T>
/*!
@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;
Expand All @@ -149,7 +149,7 @@ class SphereSDF : public SignedDistanceFunction<T>
/*!
@brief Destructor
*/
virtual ~SphereSDF() = default;
virtual ~SphereSDF() noexcept = default;

/*!
@brief Get center
Expand Down Expand Up @@ -226,7 +226,7 @@ class BoxSDF : public SignedDistanceFunction<T>
@param[in] a_loCorner Lower left corner
@param[in] a_hiCorner Upper right corner
*/
BoxSDF(const Vec3T<T>& a_loCorner, const Vec3T<T>& a_hiCorner)
BoxSDF(const Vec3T<T>& a_loCorner, const Vec3T<T>& a_hiCorner) noexcept
{
this->m_loCorner = a_loCorner;
this->m_hiCorner = a_hiCorner;
Expand All @@ -235,7 +235,7 @@ class BoxSDF : public SignedDistanceFunction<T>
/*!
@brief Destructor (does nothing).
*/
virtual ~BoxSDF()
virtual ~BoxSDF() noexcept
{}

/*!
Expand Down Expand Up @@ -334,7 +334,7 @@ class TorusSDF : public SignedDistanceFunction<T>
@param[in] a_majorRadius Major torus radius.
@param[in] a_minorRadius Minor torus radius.
*/
TorusSDF(const Vec3T<T>& a_center, const T& a_majorRadius, const T& a_minorRadius)
TorusSDF(const Vec3T<T>& a_center, const T& a_majorRadius, const T& a_minorRadius) noexcept
{
this->m_center = a_center;
this->m_majorRadius = a_majorRadius;
Expand All @@ -344,7 +344,7 @@ class TorusSDF : public SignedDistanceFunction<T>
/*!
@brief Destructor (does nothing).
*/
virtual ~TorusSDF()
virtual ~TorusSDF() noexcept
{}

/*!
Expand Down Expand Up @@ -455,7 +455,7 @@ class CylinderSDF : public SignedDistanceFunction<T>
@param[in] a_center2 Other endpoint.
@param[in] a_radius Cylinder radius.
*/
CylinderSDF(const Vec3T<T>& a_center1, const Vec3T<T>& a_center2, const T& a_radius)
CylinderSDF(const Vec3T<T>& a_center1, const Vec3T<T>& a_center2, const T& a_radius) noexcept
{
this->m_center1 = a_center1;
this->m_center2 = a_center2;
Expand All @@ -470,7 +470,7 @@ class CylinderSDF : public SignedDistanceFunction<T>
/*!
@brief Destructor (does nothing).
*/
virtual ~CylinderSDF()
virtual ~CylinderSDF() noexcept
{}

/*!
Expand Down Expand Up @@ -592,7 +592,7 @@ class InfiniteCylinderSDF : public SignedDistanceFunction<T>
@param[in] a_radius Cylinder radius.
@param[in] a_axis Cylinder axis.
*/
InfiniteCylinderSDF(const Vec3T<T>& a_center, const T& a_radius, const size_t a_axis)
InfiniteCylinderSDF(const Vec3T<T>& a_center, const T& a_radius, const size_t a_axis) noexcept
{
m_center = a_center;
m_radius = a_radius;
Expand Down Expand Up @@ -650,7 +650,7 @@ class CapsuleSDF : public SignedDistanceFunction<T>
@param[in] a_tip2 Other center point.
@param[in] a_radius Radius.
*/
CapsuleSDF(const Vec3T<T>& a_tip1, const Vec3T<T> a_tip2, const T& a_radius)
CapsuleSDF(const Vec3T<T>& a_tip1, const Vec3T<T> a_tip2, const T& a_radius) noexcept
{
const Vec3T<T> axis = (a_tip2 - a_tip1) / length(a_tip2 - a_tip1);
m_center1 = a_tip1 + a_radius * axis;
Expand Down Expand Up @@ -708,7 +708,7 @@ class InfiniteConeSDF : public SignedDistanceFunction<T>
@param[in] a_tip Cone tip position
@param[in] a_angle Cone opening angle.
*/
InfiniteConeSDF(const Vec3T<T>& a_tip, const T& a_angle)
InfiniteConeSDF(const Vec3T<T>& a_tip, const T& a_angle) noexcept
{
constexpr T pi = 3.14159265358979323846;

Expand Down Expand Up @@ -769,7 +769,7 @@ class ConeSDF : public SignedDistanceFunction<T>
@param[in] a_height Cone height, measured from top to bottom.
@param[in] a_angle Cone opening angle.
*/
ConeSDF(const Vec3T<T>& a_tip, const T& a_height, const T& a_angle)
ConeSDF(const Vec3T<T>& a_tip, const T& a_height, const T& a_angle) noexcept
{
constexpr T pi = 3.14159265358979323846;

Expand Down Expand Up @@ -849,7 +849,7 @@ class RoundedBoxSDF : public SignedDistanceFunction<T>
@param[in] a_curvature Corner curvature.
@note Curvature must be > 0.0
*/
RoundedBoxSDF(const Vec3T<T>& a_dimensions, const T a_curvature)
RoundedBoxSDF(const Vec3T<T>& a_dimensions, const T a_curvature) noexcept
{
this->m_dimensions = 0.5 * a_dimensions;

Expand Down
6 changes: 3 additions & 3 deletions Source/EBGeometry_BVH.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <class X, size_t K>
auto equalCounts = [](const std::vector<X>& a_primitives) -> std::array<std::vector<X>, K> {
auto equalCounts = [](const std::vector<X>& a_primitives) noexcept -> std::array<std::vector<X>, K> {
int length = a_primitives.size() / K;
int remain = a_primitives.size() % K;

Expand All @@ -167,7 +167,7 @@ namespace BVH {
*/
template <class T, class P, class BV, size_t K>
auto PrimitiveCentroidPartitioner =
[](const PrimAndBVListT<P, BV>& a_primsAndBVs) -> std::array<PrimAndBVListT<P, BV>, K> {
[](const PrimAndBVListT<P, BV>& a_primsAndBVs) noexcept -> std::array<PrimAndBVListT<P, BV>, K> {
Vec3T<T> lo = Vec3T<T>::max();
Vec3T<T> hi = -Vec3T<T>::max();

Expand Down Expand Up @@ -224,7 +224,7 @@ namespace BVH {
*/
template <class T, class P, class BV, size_t K>
auto DefaultStopFunction =
[](const BVH::NodeT<T, P, BV, K>& a_node) -> bool { return (a_node.getPrimitives()).size() < K; };
[](const BVH::NodeT<T, P, BV, K>& a_node) noexcept -> bool { return (a_node.getPrimitives()).size() < K; };

/*!
@brief Class which encapsulates a node in a bounding volume hierarchy.
Expand Down
16 changes: 8 additions & 8 deletions Source/EBGeometry_CSGImplem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,26 +319,26 @@ FastUnionIF<T, P, BV, K>::value(const Vec3T<T>& a_point) const noexcept
T minDist = std::numeric_limits<T>::infinity();

BVH::Updater<P> updater = [&minDist,
&a_point](const std::vector<std::shared_ptr<const P>>& a_implicitFunctions) -> void {
&a_point](const std::vector<std::shared_ptr<const P>>& a_implicitFunctions) noexcept -> void {
for (const auto& implicitFunction : a_implicitFunctions) {
minDist = std::min(minDist, implicitFunction->value(a_point));
}
};

BVH::Visiter<Node, T> visiter = [&minDist](const Node& a_node, const T& a_bvDist) -> bool {
BVH::Visiter<Node, T> visiter = [&minDist](const Node& a_node, const T& a_bvDist) noexcept -> bool {
return a_bvDist <= 0.0 || a_bvDist <= minDist;
};

BVH::Sorter<Node, T, K> sorter =
[&a_point](std::array<std::pair<std::shared_ptr<const Node>, T>, K>& a_leaves) -> void {
[&a_point](std::array<std::pair<std::shared_ptr<const Node>, T>, K>& a_leaves) noexcept -> void {
std::sort(
a_leaves.begin(),
a_leaves.end(),
[&a_point](const std::pair<std::shared_ptr<const Node>, T>& n1,
const std::pair<std::shared_ptr<const Node>, T>& n2) -> bool { return n1.second > n2.second; });
};

BVH::MetaUpdater<Node, T> metaUpdater = [&a_point](const Node& a_node) -> T {
BVH::MetaUpdater<Node, T> metaUpdater = [&a_point](const Node& a_node) noexcept -> T {
return a_node.getDistanceToBoundingVolume(a_point);
};

Expand Down Expand Up @@ -378,7 +378,7 @@ FastSmoothUnionIF<T, P, BV, K>::value(const Vec3T<T>& a_point) const noexcept
T b = std::numeric_limits<T>::infinity();

BVH::Updater<P> updater =
[&a, &b, &a_point](const std::vector<std::shared_ptr<const P>>& a_implicitFunctions) -> void {
[&a, &b, &a_point](const std::vector<std::shared_ptr<const P>>& a_implicitFunctions) noexcept -> void {
for (const auto& implicitFunction : a_implicitFunctions) {
const auto& d = implicitFunction->value(a_point);

Expand All @@ -392,20 +392,20 @@ FastSmoothUnionIF<T, P, BV, K>::value(const Vec3T<T>& a_point) const noexcept
}
};

BVH::Visiter<Node, T> visiter = [&a, &b](const Node& a_node, const T& a_bvDist) -> bool {
BVH::Visiter<Node, T> 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<Node, T, K> sorter =
[&a_point](std::array<std::pair<std::shared_ptr<const Node>, T>, K>& a_leaves) -> void {
[&a_point](std::array<std::pair<std::shared_ptr<const Node>, T>, K>& a_leaves) noexcept -> void {
std::sort(
a_leaves.begin(),
a_leaves.end(),
[&a_point](const std::pair<std::shared_ptr<const Node>, T>& n1,
const std::pair<std::shared_ptr<const Node>, T>& n2) -> bool { return n1.second > n2.second; });
};

BVH::MetaUpdater<Node, T> metaUpdater = [&a_point](const Node& a_node) -> T {
BVH::MetaUpdater<Node, T> metaUpdater = [&a_point](const Node& a_node) noexcept -> T {
return a_node.getDistanceToBoundingVolume(a_point);
};

Expand Down
6 changes: 3 additions & 3 deletions Source/EBGeometry_DCEL_Mesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ namespace DCEL {
/*!
@brief Default constructor. Leaves unobject in an unusable state
*/
MeshT();
MeshT() noexcept;

/*!
@brief Disallowed copy construction
Expand All @@ -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<FacePtr>& a_faces, std::vector<EdgePtr>& a_edges, std::vector<VertexPtr>& a_vertices);
MeshT(std::vector<FacePtr>& a_faces, std::vector<EdgePtr>& a_edges, std::vector<VertexPtr>& a_vertices) noexcept;

/*!
@brief Destructor (does nothing)
*/
virtual ~MeshT();
virtual ~MeshT() noexcept;

/*!
@brief Define function. Puts Mesh in usable state.
Expand Down
6 changes: 3 additions & 3 deletions Source/EBGeometry_DCEL_MeshImplem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@
namespace DCEL {

template <class T, class Meta>
inline MeshT<T, Meta>::MeshT()
inline MeshT<T, Meta>::MeshT() noexcept
{
m_algorithm = SearchAlgorithm::Direct2;
}

template <class T, class Meta>
inline MeshT<T, Meta>::MeshT(std::vector<FacePtr>& a_faces,
std::vector<EdgePtr>& a_edges,
std::vector<VertexPtr>& a_vertices)
std::vector<VertexPtr>& a_vertices) noexcept
: MeshT()
{
this->define(a_faces, a_edges, a_vertices);
}

template <class T, class Meta>
inline MeshT<T, Meta>::~MeshT()
inline MeshT<T, Meta>::~MeshT() noexcept
{}

template <class T, class Meta>
Expand Down
Loading

0 comments on commit 89734df

Please sign in to comment.