/**************************************************************************** * Copyright (c) 2017-2022 by the ArborX authors * * All rights reserved. * * * * This file is part of the ArborX library. ArborX is * * distributed under a BSD 3-clause license. For the licensing terms see * * the LICENSE file in the top-level directory. * * * * SPDX-License-Identifier: BSD-3-Clause * ****************************************************************************/ #include #include #include #include #include namespace ArborX::GeometryTraits { struct NoGeometryTraitsSpecialization {}; struct NoDimensionSpecialization {}; template <> struct tag { using type = PointTag; }; template <> struct coordinate_type { using type = float; }; struct NoCoordinateSpecialization {}; template <> struct tag { using type = PointTag; }; template <> struct dimension { static constexpr int value = 3; }; struct NoTagSpecialization {}; template <> struct dimension { static constexpr int value = 3; }; template <> struct coordinate_type { using type = float; }; struct EmptyDimensionSpecialization {}; template <> struct dimension {}; template <> struct tag { using type = PointTag; }; template <> struct coordinate_type { using type = float; }; struct EmptyTagSpecialization {}; template <> struct dimension { static constexpr int value = 3; }; template <> struct tag {}; template <> struct coordinate_type { using type = float; }; struct EmptyCoordinateSpecialization {}; template <> struct dimension { static constexpr int value = 3; }; template <> struct tag { using type = PointTag; }; template <> struct coordinate_type {}; struct WrongTypeDimensionSpecialization {}; template <> struct dimension { static constexpr float value = 0.f; }; template <> struct tag { using type = PointTag; }; struct NegativeIntegerDimensionSpecialization {}; template <> struct dimension { static constexpr int value = -1; }; template <> struct tag { using type = PointTag; }; struct WrongTagSpecialization {}; template <> struct dimension { static constexpr int value = 5; }; struct DummyTag {}; template <> struct tag { using type = DummyTag; }; struct WrongCoordinateSpecialization {}; template <> struct dimension { static constexpr int value = 5; }; template <> struct tag { using type = PointTag; }; template <> struct coordinate_type { using type = DummyTag; }; struct CorrectSpecialization {}; template <> struct dimension { static constexpr int value = 15; }; template <> struct tag { using type = SphereTag; }; template <> struct coordinate_type { using type = short; }; void test_geometry_compile_only() { check_valid_geometry_traits(ArborX::Point{}); check_valid_geometry_traits(ArborX::Box{}); check_valid_geometry_traits(ArborX::Sphere{}); check_valid_geometry_traits(CorrectSpecialization{}); // Uncomment to see error messages // check_valid_geometry_traits(NoGeometryTraitsSpecialization{}); // check_valid_geometry_traits(NoDimensionSpecialization{}); // check_valid_geometry_traits(NoTagSpecialization{}); // check_valid_geometry_traits(NoCoordinateSpecialization{}); // check_valid_geometry_traits(EmptyDimensionSpecialization{}); // check_valid_geometry_traits(EmptyTagSpecialization{}); // check_valid_geometry_traits(EmptyCoordinateSpecialization{}); // check_valid_geometry_traits(WrongTypeDimensionSpecialization{}); // check_valid_geometry_traits(NegativeIntegerDimensionSpecialization{}); // check_valid_geometry_traits(WrongTagSpecialization{}); // check_valid_geometry_traits(WrongCoordinateSpecialization{}); } void test_point_ctad() { using ArborX::ExperimentalHyperGeometry::Point; static_assert(std::is_same_v>); static_assert(std::is_same_v>); static_assert(std::is_same_v>); static_assert(std::is_same_v>); static_assert(std::is_same_v>); static_assert(std::is_same_v>); static_assert( std::is_same_v>); static_assert( std::is_same_v{2, 3, 2}), Point<3, int>>); } } // namespace ArborX::GeometryTraits