From eb37866e92db8f10584d83ff305e1231d14875ba Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Mon, 6 Feb 2023 00:19:15 -0800 Subject: [PATCH] GTSAM_CONCEPT_ASSERT to replace BOOST equivalent. --- GTSAM-Concepts.md | 2 +- gtsam/base/FastSet.h | 2 +- gtsam/base/Group.h | 16 +++++----- gtsam/base/Lie.h | 4 +-- gtsam/base/Manifold.h | 21 +++++-------- gtsam/base/ProductLieGroup.h | 4 +-- gtsam/base/Testable.h | 12 +++---- gtsam/base/VectorSpace.h | 8 ++--- gtsam/base/chartTesting.h | 2 +- gtsam/base/concepts.h | 38 ++++++++++------------- gtsam/base/tests/testGroup.cpp | 6 ++-- gtsam/base/tests/testMatrix.cpp | 31 ++++++++++++------ gtsam/base/tests/testVector.cpp | 11 ++++--- gtsam/geometry/tests/testBearingRange.cpp | 4 +-- gtsam/geometry/tests/testCyclic.cpp | 6 ++-- gtsam/geometry/tests/testPoint2.cpp | 12 +++---- gtsam/geometry/tests/testPoint3.cpp | 6 ++-- gtsam/geometry/tests/testPose2.cpp | 6 ++-- gtsam/geometry/tests/testQuaternion.cpp | 6 ++-- gtsam/geometry/tests/testRot3.cpp | 6 ++-- gtsam/geometry/tests/testSO3.cpp | 6 ++-- gtsam/geometry/tests/testSO4.cpp | 6 ++-- gtsam/geometry/tests/testSOn.cpp | 6 ++-- gtsam/geometry/tests/testSimilarity2.cpp | 6 ++-- gtsam/geometry/tests/testSimilarity3.cpp | 6 ++-- gtsam/geometry/tests/testStereoPoint2.cpp | 6 ++-- gtsam/nonlinear/Expression.h | 4 +-- gtsam/nonlinear/ExpressionFactor.h | 2 +- gtsam/nonlinear/ExtendedKalmanFilter.h | 4 +-- gtsam/nonlinear/internal/ExpressionNode.h | 4 +-- gtsam/sfm/BinaryMeasurement.h | 2 +- gtsam/slam/BetweenFactor.h | 4 +-- tests/testLie.cpp | 6 ++-- tests/testManifold.cpp | 26 ++++++++-------- 34 files changed, 147 insertions(+), 144 deletions(-) diff --git a/GTSAM-Concepts.md b/GTSAM-Concepts.md index 953357eded..9911b37649 100644 --- a/GTSAM-Concepts.md +++ b/GTSAM-Concepts.md @@ -166,7 +166,7 @@ Concept Checks Boost provides a nice way to check whether a given type satisfies a concept. For example, the following - BOOST_CONCEPT_ASSERT(IsVectorSpace) + GTSAM_CONCEPT_ASSERT(IsVectorSpace) asserts that Point2 indeed is a model for the VectorSpace concept. diff --git a/gtsam/base/FastSet.h b/gtsam/base/FastSet.h index 37912449c5..a1be08d808 100644 --- a/gtsam/base/FastSet.h +++ b/gtsam/base/FastSet.h @@ -51,7 +51,7 @@ template class FastSet: public std::set, typename internal::FastDefaultAllocator::type> { - BOOST_CONCEPT_ASSERT ((IsTestable )); + GTSAM_CONCEPT_ASSERT(IsTestable); public: diff --git a/gtsam/base/Group.h b/gtsam/base/Group.h index cf5f35e395..baacd85c85 100644 --- a/gtsam/base/Group.h +++ b/gtsam/base/Group.h @@ -52,8 +52,8 @@ class IsGroup { typedef typename traits::group_flavor flavor_tag; //typedef typename traits::identity::value_type identity_value_type; - BOOST_CONCEPT_USAGE(IsGroup) { - BOOST_STATIC_ASSERT_MSG( + GTSAM_CONCEPT_USAGE(IsGroup) { + static_assert( (std::is_base_of::value), "This type's structure_category trait does not assert it as a group (or derived)"); e = traits::Identity(); @@ -82,7 +82,7 @@ class IsGroup { /// Check invariants template -BOOST_CONCEPT_REQUIRES(((IsGroup)),(bool)) // +GTSAM_CONCEPT_REQUIRES(IsGroup,bool) // check_group_invariants(const G& a, const G& b, double tol = 1e-9) { G e = traits::Identity(); return traits::Equals(traits::Compose(a, traits::Inverse(a)), e, tol) @@ -128,7 +128,7 @@ struct AdditiveGroup : AdditiveGroupTraits, Testable {}; /// compose multiple times template -BOOST_CONCEPT_REQUIRES(((IsGroup)),(G)) // +GTSAM_CONCEPT_REQUIRES(IsGroup,G) // compose_pow(const G& g, size_t n) { if (n == 0) return traits::Identity(); else if (n == 1) return g; @@ -139,8 +139,8 @@ compose_pow(const G& g, size_t n) { /// Assumes nothing except group structure and Testable from G and H template class DirectProduct: public std::pair { - BOOST_CONCEPT_ASSERT((IsGroup)); - BOOST_CONCEPT_ASSERT((IsGroup)); + GTSAM_CONCEPT_ASSERT1(IsGroup); + GTSAM_CONCEPT_ASSERT2(IsGroup); public: /// Default constructor yields identity @@ -170,8 +170,8 @@ struct traits > : /// Assumes existence of three additive operators for both groups template class DirectSum: public std::pair { - BOOST_CONCEPT_ASSERT((IsGroup)); // TODO(frank): check additive - BOOST_CONCEPT_ASSERT((IsGroup)); // TODO(frank): check additive + GTSAM_CONCEPT_ASSERT1(IsGroup); // TODO(frank): check additive + GTSAM_CONCEPT_ASSERT2(IsGroup); // TODO(frank): check additive const G& g() const { return this->first; } const H& h() const { return this->second;} diff --git a/gtsam/base/Lie.h b/gtsam/base/Lie.h index 3ea5e94a8c..b8460efb23 100644 --- a/gtsam/base/Lie.h +++ b/gtsam/base/Lie.h @@ -264,8 +264,8 @@ class IsLieGroup: public IsGroup, public IsManifold { typedef typename traits::TangentVector TangentVector; typedef typename traits::ChartJacobian ChartJacobian; - BOOST_CONCEPT_USAGE(IsLieGroup) { - BOOST_STATIC_ASSERT_MSG( + GTSAM_CONCEPT_USAGE(IsLieGroup) { + static_assert( (std::is_base_of::value), "This type's trait does not assert it is a Lie group (or derived)"); diff --git a/gtsam/base/Manifold.h b/gtsam/base/Manifold.h index 92f9ba9ac1..377e36f07b 100644 --- a/gtsam/base/Manifold.h +++ b/gtsam/base/Manifold.h @@ -22,12 +22,7 @@ #include #include #include - -#ifdef GTSAM_USE_BOOST_FEATURES -#include -#include -#include -#endif +#include namespace gtsam { @@ -66,7 +61,7 @@ struct HasManifoldPrereqs { Eigen::Matrix v; OptionalJacobian Hp, Hq, Hv; - BOOST_CONCEPT_USAGE(HasManifoldPrereqs) { + GTSAM_CONCEPT_USAGE(HasManifoldPrereqs) { v = p.localCoordinates(q); q = p.retract(v); } @@ -97,7 +92,7 @@ template struct ManifoldTraits: GetDimensionImpl { // Check that Class has the necessary machinery - BOOST_CONCEPT_ASSERT((HasManifoldPrereqs)); + GTSAM_CONCEPT_ASSERT(HasManifoldPrereqs); // Dimension of the manifold enum { dimension = Class::dimension }; @@ -125,7 +120,7 @@ template struct Manifold: ManifoldTraits, Testable {} /// Check invariants for Manifold type template -BOOST_CONCEPT_REQUIRES(((IsTestable)),(bool)) // +GTSAM_CONCEPT_REQUIRES(IsTestable, bool) // check_manifold_invariants(const T& a, const T& b, double tol=1e-9) { typename traits::TangentVector v0 = traits::Local(a,a); typename traits::TangentVector v = traits::Local(a,b); @@ -144,11 +139,11 @@ class IsManifold { typedef typename traits::ManifoldType ManifoldType; typedef typename traits::TangentVector TangentVector; - BOOST_CONCEPT_USAGE(IsManifold) { - BOOST_STATIC_ASSERT_MSG( + GTSAM_CONCEPT_USAGE(IsManifold) { + static_assert( (std::is_base_of::value), "This type's structure_category trait does not assert it as a manifold (or derived)"); - BOOST_STATIC_ASSERT(TangentVector::SizeAtCompileTime == dim); + static_assert(TangentVector::SizeAtCompileTime == dim); // make sure Chart methods are defined v = traits::Local(p, q); @@ -166,7 +161,7 @@ template struct FixedDimension { typedef const int value_type; static const int value = traits::dimension; - BOOST_STATIC_ASSERT_MSG(value != Eigen::Dynamic, + static_assert(value != Eigen::Dynamic, "FixedDimension instantiated for dymanically-sized type."); }; } // \ namespace gtsam diff --git a/gtsam/base/ProductLieGroup.h b/gtsam/base/ProductLieGroup.h index 831968bc8c..a8bb2ef980 100644 --- a/gtsam/base/ProductLieGroup.h +++ b/gtsam/base/ProductLieGroup.h @@ -27,8 +27,8 @@ namespace gtsam { /// Assumes Lie group structure for G and H template class ProductLieGroup: public std::pair { - BOOST_CONCEPT_ASSERT((IsLieGroup)); - BOOST_CONCEPT_ASSERT((IsLieGroup)); + GTSAM_CONCEPT_ASSERT1(IsLieGroup); + GTSAM_CONCEPT_ASSERT2(IsLieGroup); typedef std::pair Base; protected: diff --git a/gtsam/base/Testable.h b/gtsam/base/Testable.h index e9e8ad932e..412b69f7ea 100644 --- a/gtsam/base/Testable.h +++ b/gtsam/base/Testable.h @@ -33,9 +33,7 @@ #pragma once -#ifdef GTSAM_USE_BOOST_FEATURES -#include -#endif +#include #include #include @@ -63,7 +61,7 @@ namespace gtsam { bool r1,r2; public: - BOOST_CONCEPT_USAGE(IsTestable) { + GTSAM_CONCEPT_USAGE(IsTestable) { // check print function, with optional string traits::Print(t, std::string()); traits::Print(t); @@ -136,7 +134,7 @@ namespace gtsam { template struct HasTestablePrereqs { - BOOST_CONCEPT_USAGE(HasTestablePrereqs) { + GTSAM_CONCEPT_USAGE(HasTestablePrereqs) { t->print(str); b = t->equals(*s,tol); } @@ -154,7 +152,7 @@ namespace gtsam { struct Testable { // Check that T has the necessary methods - BOOST_CONCEPT_ASSERT((HasTestablePrereqs)); + GTSAM_CONCEPT_ASSERT(HasTestablePrereqs); static void Print(const T& m, const std::string& str = "") { m.print(str); @@ -173,7 +171,7 @@ namespace gtsam { * * NOTE: intentionally not in the gtsam namespace to allow for classes not in * the gtsam namespace to be more easily enforced as testable - * @deprecated please use BOOST_CONCEPT_ASSERT and + * @deprecated please use GTSAM_CONCEPT_ASSERT and */ #define GTSAM_CONCEPT_TESTABLE_INST(T) template class gtsam::IsTestable; #define GTSAM_CONCEPT_TESTABLE_TYPE(T) using _gtsam_Testable_##T = gtsam::IsTestable; diff --git a/gtsam/base/VectorSpace.h b/gtsam/base/VectorSpace.h index 9246ad8718..0d13ecfb0d 100644 --- a/gtsam/base/VectorSpace.h +++ b/gtsam/base/VectorSpace.h @@ -168,7 +168,7 @@ struct HasVectorSpacePrereqs { Class p, q; Vector v; - BOOST_CONCEPT_USAGE(HasVectorSpacePrereqs) { + GTSAM_CONCEPT_USAGE(HasVectorSpacePrereqs) { p = Class::Identity(); // identity q = p + p; // addition q = p - p; // subtraction @@ -185,7 +185,7 @@ template struct VectorSpaceTraits: VectorSpaceImpl { // Check that Class has the necessary machinery - BOOST_CONCEPT_ASSERT((HasVectorSpacePrereqs)); + GTSAM_CONCEPT_ASSERT(HasVectorSpacePrereqs); typedef vector_space_tag structure_category; @@ -472,8 +472,8 @@ class IsVectorSpace: public IsLieGroup { typedef typename traits::structure_category structure_category_tag; - BOOST_CONCEPT_USAGE(IsVectorSpace) { - BOOST_STATIC_ASSERT_MSG( + GTSAM_CONCEPT_USAGE(IsVectorSpace) { + static_assert( (std::is_base_of::value), "This type's trait does not assert it as a vector space (or derived)"); r = p + q; diff --git a/gtsam/base/chartTesting.h b/gtsam/base/chartTesting.h index 8f5213f91a..05b06a4899 100644 --- a/gtsam/base/chartTesting.h +++ b/gtsam/base/chartTesting.h @@ -39,7 +39,7 @@ void testDefaultChart(TestResult& result_, // First, check the basic chart concept. This checks that the interface is satisfied. // The rest of the function is even more detailed, checking the correctness of the chart. - BOOST_CONCEPT_ASSERT((ChartConcept)); + GTSAM_CONCEPT_ASSERT(ChartConcept); T other = value; diff --git a/gtsam/base/concepts.h b/gtsam/base/concepts.h index f7776ab9b0..8962dd28da 100644 --- a/gtsam/base/concepts.h +++ b/gtsam/base/concepts.h @@ -8,28 +8,22 @@ #pragma once -// This is a helper to ease the transition to the new traits defined in this file. -// Uncomment this if you want all methods that are tagged as not implemented -// to cause compilation errors. -#ifdef COMPILE_ERROR_NOT_IMPLEMENTED - #ifdef GTSAM_USE_BOOST_FEATURES -#include -#endif - -#define CONCEPT_NOT_IMPLEMENTED BOOST_STATIC_ASSERT_MSG(boost::false_type, \ -"This method is required by the new concepts framework but has not been implemented yet."); - -#else - -#include -#define CONCEPT_NOT_IMPLEMENTED \ - throw std::runtime_error("This method is required by the new concepts framework but has not been implemented yet."); - +#include +#define GTSAM_CONCEPT_USAGE(concept) BOOST_CONCEPT_USAGE((concept)) +#define GTSAM_CONCEPT_ASSERT(concept) BOOST_CONCEPT_ASSERT((concept)) +#define GTSAM_CONCEPT_ASSERT1(concept) BOOST_CONCEPT_ASSERT((concept)) +#define GTSAM_CONCEPT_ASSERT2(concept) BOOST_CONCEPT_ASSERT((concept)) +#define GTSAM_CONCEPT_ASSERT3(concept) BOOST_CONCEPT_ASSERT((concept)) +#define GTSAM_CONCEPT_REQUIRES(concept, return_type) BOOST_CONCEPT_REQUIRES((concept), (return_type)) +#else +// These do something sensible: +#define GTSAM_CONCEPT_USAGE(concept) void check##concept() +#define GTSAM_CONCEPT_ASSERT(concept) concept checkConcept [[maybe_unused]]; +#define GTSAM_CONCEPT_ASSERT1(concept) concept checkConcept1 [[maybe_unused]]; +#define GTSAM_CONCEPT_ASSERT2(concept) concept checkConcept2 [[maybe_unused]]; +#define GTSAM_CONCEPT_ASSERT3(concept) concept checkConcept3 [[maybe_unused]]; +// This one just ignores concept for now: +#define GTSAM_CONCEPT_REQUIRES(concept, return_type) return_type #endif -namespace gtsam { - -template struct traits; - -} diff --git a/gtsam/base/tests/testGroup.cpp b/gtsam/base/tests/testGroup.cpp index 7e8cb7821c..3c8b04f39a 100644 --- a/gtsam/base/tests/testGroup.cpp +++ b/gtsam/base/tests/testGroup.cpp @@ -80,7 +80,7 @@ using namespace gtsam; typedef Symmetric<2> S2; TEST(Group, S2) { S2 e, s1 = S2::Transposition(0, 1); - BOOST_CONCEPT_ASSERT((IsGroup)); + GTSAM_CONCEPT_ASSERT(IsGroup); EXPECT(check_group_invariants(e, s1)); } @@ -88,7 +88,7 @@ TEST(Group, S2) { typedef Symmetric<3> S3; TEST(Group, S3) { S3 e, s1 = S3::Transposition(0, 1), s2 = S3::Transposition(1, 2); - BOOST_CONCEPT_ASSERT((IsGroup)); + GTSAM_CONCEPT_ASSERT(IsGroup); EXPECT(check_group_invariants(e, s1)); EXPECT(assert_equal(s1, s1 * e)); EXPECT(assert_equal(s1, e * s1)); @@ -127,7 +127,7 @@ struct traits : internal::MultiplicativeGroupTraits { TEST(Group, Dih6) { Dih6 e, g(S2::Transposition(0, 1), S3::Transposition(0, 1) * S3::Transposition(1, 2)); - BOOST_CONCEPT_ASSERT((IsGroup)); + GTSAM_CONCEPT_ASSERT(IsGroup); EXPECT(check_group_invariants(e, g)); EXPECT(assert_equal(e, compose_pow(g, 0))); EXPECT(assert_equal(g, compose_pow(g, 1))); diff --git a/gtsam/base/tests/testMatrix.cpp b/gtsam/base/tests/testMatrix.cpp index 925369d5ea..a000e4864a 100644 --- a/gtsam/base/tests/testMatrix.cpp +++ b/gtsam/base/tests/testMatrix.cpp @@ -1146,17 +1146,30 @@ TEST(Matrix, DLT ) } //****************************************************************************** -TEST(Matrix , IsVectorSpace) { - BOOST_CONCEPT_ASSERT((IsVectorSpace)); - typedef Eigen::Matrix RowMajor; - BOOST_CONCEPT_ASSERT((IsVectorSpace)); - BOOST_CONCEPT_ASSERT((IsVectorSpace)); - BOOST_CONCEPT_ASSERT((IsVectorSpace)); - typedef Eigen::Matrix RowVector; - BOOST_CONCEPT_ASSERT((IsVectorSpace)); - BOOST_CONCEPT_ASSERT((IsVectorSpace)); +TEST(Matrix, Matrix24IsVectorSpace) { + GTSAM_CONCEPT_ASSERT(IsVectorSpace); } +TEST(Matrix, RowMajorIsVectorSpace) { + typedef Eigen::Matrix RowMajor; + GTSAM_CONCEPT_ASSERT(IsVectorSpace); +} + +TEST(Matrix, MatrixIsVectorSpace) { + GTSAM_CONCEPT_ASSERT(IsVectorSpace); +} + +TEST(Matrix, VectorIsVectorSpace) { + GTSAM_CONCEPT_ASSERT(IsVectorSpace); +} + +TEST(Matrix, RowVectorIsVectorSpace) { + typedef Eigen::Matrix RowVector; + GTSAM_CONCEPT_ASSERT1(IsVectorSpace); + GTSAM_CONCEPT_ASSERT2(IsVectorSpace); +} + +//****************************************************************************** TEST(Matrix, AbsoluteError) { double a = 2000, b = 1997, tol = 1e-1; bool isEqual; diff --git a/gtsam/base/tests/testVector.cpp b/gtsam/base/tests/testVector.cpp index 4d479b3c08..c749a5191c 100644 --- a/gtsam/base/tests/testVector.cpp +++ b/gtsam/base/tests/testVector.cpp @@ -266,11 +266,14 @@ TEST(Vector, linear_dependent3 ) } //****************************************************************************** -TEST(Vector, IsVectorSpace) { - BOOST_CONCEPT_ASSERT((IsVectorSpace)); - BOOST_CONCEPT_ASSERT((IsVectorSpace)); +TEST(Vector, VectorIsVectorSpace) { + GTSAM_CONCEPT_ASSERT1(IsVectorSpace); + GTSAM_CONCEPT_ASSERT2(IsVectorSpace); +} + +TEST(Vector, RowVectorIsVectorSpace) { typedef Eigen::Matrix RowVector; - BOOST_CONCEPT_ASSERT((IsVectorSpace)); + GTSAM_CONCEPT_ASSERT(IsVectorSpace); } /* ************************************************************************* */ diff --git a/gtsam/geometry/tests/testBearingRange.cpp b/gtsam/geometry/tests/testBearingRange.cpp index 1216a63968..ff2a9a6a40 100644 --- a/gtsam/geometry/tests/testBearingRange.cpp +++ b/gtsam/geometry/tests/testBearingRange.cpp @@ -34,7 +34,7 @@ BearingRange3D br3D(Pose3().bearing(Point3(1, 0, 0)), 1); //****************************************************************************** TEST(BearingRange2D, Concept) { - BOOST_CONCEPT_ASSERT((IsManifold)); + GTSAM_CONCEPT_ASSERT(IsManifold); } /* ************************************************************************* */ @@ -46,7 +46,7 @@ TEST(BearingRange, 2D) { //****************************************************************************** TEST(BearingRange3D, Concept) { - BOOST_CONCEPT_ASSERT((IsManifold)); + GTSAM_CONCEPT_ASSERT(IsManifold); } /* ************************************************************************* */ diff --git a/gtsam/geometry/tests/testCyclic.cpp b/gtsam/geometry/tests/testCyclic.cpp index abcef9e5bb..e2b250f500 100644 --- a/gtsam/geometry/tests/testCyclic.cpp +++ b/gtsam/geometry/tests/testCyclic.cpp @@ -27,7 +27,7 @@ typedef Cyclic<2> Z2; //****************************************************************************** TEST(Cyclic, Concept) { - BOOST_CONCEPT_ASSERT((IsGroup)); + GTSAM_CONCEPT_ASSERT(IsGroup); EXPECT_LONGS_EQUAL(0, traits::Identity()); } @@ -107,8 +107,8 @@ struct traits : internal::AdditiveGroupTraits { TEST(Cyclic , DirectSum) { // The Direct sum of Z2 and Z2 is *not* Cyclic<4>, but the // smallest non-cyclic group called the Klein four-group: - BOOST_CONCEPT_ASSERT((IsGroup)); - BOOST_CONCEPT_ASSERT((IsTestable)); + GTSAM_CONCEPT_ASSERT1(IsGroup); + GTSAM_CONCEPT_ASSERT2(IsTestable); // Refer to http://en.wikipedia.org/wiki/Klein_four-group K4 e(0,0), a(0, 1), b(1, 0), c(1, 1); diff --git a/gtsam/geometry/tests/testPoint2.cpp b/gtsam/geometry/tests/testPoint2.cpp index 6e4d408c72..4083970b6f 100644 --- a/gtsam/geometry/tests/testPoint2.cpp +++ b/gtsam/geometry/tests/testPoint2.cpp @@ -34,9 +34,9 @@ TEST(Point2 , Constructor) { //****************************************************************************** TEST(Double , Concept) { - BOOST_CONCEPT_ASSERT((IsGroup)); - BOOST_CONCEPT_ASSERT((IsManifold)); - BOOST_CONCEPT_ASSERT((IsVectorSpace)); + GTSAM_CONCEPT_ASSERT1(IsGroup); + GTSAM_CONCEPT_ASSERT2(IsManifold); + GTSAM_CONCEPT_ASSERT3(IsVectorSpace); } //****************************************************************************** @@ -48,9 +48,9 @@ TEST(Double , Invariants) { //****************************************************************************** TEST(Point2 , Concept) { - BOOST_CONCEPT_ASSERT((IsGroup)); - BOOST_CONCEPT_ASSERT((IsManifold)); - BOOST_CONCEPT_ASSERT((IsVectorSpace)); + GTSAM_CONCEPT_ASSERT1(IsGroup); + GTSAM_CONCEPT_ASSERT2(IsManifold); + GTSAM_CONCEPT_ASSERT3(IsVectorSpace); } //****************************************************************************** diff --git a/gtsam/geometry/tests/testPoint3.cpp b/gtsam/geometry/tests/testPoint3.cpp index b19aa0adde..e4263ffd71 100644 --- a/gtsam/geometry/tests/testPoint3.cpp +++ b/gtsam/geometry/tests/testPoint3.cpp @@ -34,9 +34,9 @@ TEST(Point3 , Constructor) { //****************************************************************************** TEST(Point3 , Concept) { - BOOST_CONCEPT_ASSERT((IsGroup)); - BOOST_CONCEPT_ASSERT((IsManifold)); - BOOST_CONCEPT_ASSERT((IsVectorSpace)); + GTSAM_CONCEPT_ASSERT1(IsGroup); + GTSAM_CONCEPT_ASSERT2(IsManifold); + GTSAM_CONCEPT_ASSERT3(IsVectorSpace); } //****************************************************************************** diff --git a/gtsam/geometry/tests/testPose2.cpp b/gtsam/geometry/tests/testPose2.cpp index e38bfbd756..3985f6ba5f 100644 --- a/gtsam/geometry/tests/testPose2.cpp +++ b/gtsam/geometry/tests/testPose2.cpp @@ -35,9 +35,9 @@ GTSAM_CONCEPT_LIE_INST(Pose2) //****************************************************************************** TEST(Pose2 , Concept) { - BOOST_CONCEPT_ASSERT((IsGroup)); - BOOST_CONCEPT_ASSERT((IsManifold)); - BOOST_CONCEPT_ASSERT((IsLieGroup)); + GTSAM_CONCEPT_ASSERT1(IsGroup); + GTSAM_CONCEPT_ASSERT2(IsManifold); + GTSAM_CONCEPT_ASSERT3(IsLieGroup); } /* ************************************************************************* */ diff --git a/gtsam/geometry/tests/testQuaternion.cpp b/gtsam/geometry/tests/testQuaternion.cpp index 281c71f7c6..546a1f5b54 100644 --- a/gtsam/geometry/tests/testQuaternion.cpp +++ b/gtsam/geometry/tests/testQuaternion.cpp @@ -29,9 +29,9 @@ typedef traits::ChartJacobian QuaternionJacobian; //****************************************************************************** TEST(Quaternion , Concept) { - BOOST_CONCEPT_ASSERT((IsGroup)); - BOOST_CONCEPT_ASSERT((IsManifold)); - BOOST_CONCEPT_ASSERT((IsLieGroup)); + GTSAM_CONCEPT_ASSERT1(IsGroup); + GTSAM_CONCEPT_ASSERT2(IsManifold); + GTSAM_CONCEPT_ASSERT3(IsLieGroup); } //****************************************************************************** diff --git a/gtsam/geometry/tests/testRot3.cpp b/gtsam/geometry/tests/testRot3.cpp index 8a1bc1e5c5..39cc05fde4 100644 --- a/gtsam/geometry/tests/testRot3.cpp +++ b/gtsam/geometry/tests/testRot3.cpp @@ -38,9 +38,9 @@ static double error = 1e-9, epsilon = 0.001; //****************************************************************************** TEST(Rot3 , Concept) { - BOOST_CONCEPT_ASSERT((IsGroup)); - BOOST_CONCEPT_ASSERT((IsManifold)); - BOOST_CONCEPT_ASSERT((IsLieGroup)); + GTSAM_CONCEPT_ASSERT1(IsGroup); + GTSAM_CONCEPT_ASSERT2(IsManifold); + GTSAM_CONCEPT_ASSERT3(IsLieGroup); } /* ************************************************************************* */ diff --git a/gtsam/geometry/tests/testSO3.cpp b/gtsam/geometry/tests/testSO3.cpp index 1afe9ff213..2086318cbc 100644 --- a/gtsam/geometry/tests/testSO3.cpp +++ b/gtsam/geometry/tests/testSO3.cpp @@ -36,9 +36,9 @@ TEST(SO3, Identity) { //****************************************************************************** TEST(SO3, Concept) { - BOOST_CONCEPT_ASSERT((IsGroup)); - BOOST_CONCEPT_ASSERT((IsManifold)); - BOOST_CONCEPT_ASSERT((IsLieGroup)); + GTSAM_CONCEPT_ASSERT1(IsGroup); + GTSAM_CONCEPT_ASSERT2(IsManifold); + GTSAM_CONCEPT_ASSERT3(IsLieGroup); } //****************************************************************************** diff --git a/gtsam/geometry/tests/testSO4.cpp b/gtsam/geometry/tests/testSO4.cpp index fa550723a6..17d9694bea 100644 --- a/gtsam/geometry/tests/testSO4.cpp +++ b/gtsam/geometry/tests/testSO4.cpp @@ -42,9 +42,9 @@ TEST(SO4, Identity) { //****************************************************************************** TEST(SO4, Concept) { - BOOST_CONCEPT_ASSERT((IsGroup)); - BOOST_CONCEPT_ASSERT((IsManifold)); - BOOST_CONCEPT_ASSERT((IsLieGroup)); + GTSAM_CONCEPT_ASSERT1(IsGroup); + GTSAM_CONCEPT_ASSERT2(IsManifold); + GTSAM_CONCEPT_ASSERT3(IsLieGroup); } //****************************************************************************** diff --git a/gtsam/geometry/tests/testSOn.cpp b/gtsam/geometry/tests/testSOn.cpp index d9d4da34c1..eb453d8c64 100644 --- a/gtsam/geometry/tests/testSOn.cpp +++ b/gtsam/geometry/tests/testSOn.cpp @@ -84,9 +84,9 @@ TEST(SOn, SO5) { //****************************************************************************** TEST(SOn, Concept) { - BOOST_CONCEPT_ASSERT((IsGroup)); - BOOST_CONCEPT_ASSERT((IsManifold)); - BOOST_CONCEPT_ASSERT((IsLieGroup)); + GTSAM_CONCEPT_ASSERT1(IsGroup); + GTSAM_CONCEPT_ASSERT2(IsManifold); + GTSAM_CONCEPT_ASSERT3(IsLieGroup); } //****************************************************************************** diff --git a/gtsam/geometry/tests/testSimilarity2.cpp b/gtsam/geometry/tests/testSimilarity2.cpp index ca041fc7be..8d537fd72f 100644 --- a/gtsam/geometry/tests/testSimilarity2.cpp +++ b/gtsam/geometry/tests/testSimilarity2.cpp @@ -35,9 +35,9 @@ static const double s = 4; //****************************************************************************** TEST(Similarity2, Concepts) { - BOOST_CONCEPT_ASSERT((IsGroup)); - BOOST_CONCEPT_ASSERT((IsManifold)); - BOOST_CONCEPT_ASSERT((IsLieGroup)); + GTSAM_CONCEPT_ASSERT1(IsGroup); + GTSAM_CONCEPT_ASSERT2(IsManifold); + GTSAM_CONCEPT_ASSERT3(IsLieGroup); } //****************************************************************************** diff --git a/gtsam/geometry/tests/testSimilarity3.cpp b/gtsam/geometry/tests/testSimilarity3.cpp index fad24f7431..d0f6617878 100644 --- a/gtsam/geometry/tests/testSimilarity3.cpp +++ b/gtsam/geometry/tests/testSimilarity3.cpp @@ -54,9 +54,9 @@ const double degree = M_PI / 180; //****************************************************************************** TEST(Similarity3, Concepts) { - BOOST_CONCEPT_ASSERT((IsGroup)); - BOOST_CONCEPT_ASSERT((IsManifold)); - BOOST_CONCEPT_ASSERT((IsLieGroup)); + GTSAM_CONCEPT_ASSERT1(IsGroup); + GTSAM_CONCEPT_ASSERT2(IsManifold); + GTSAM_CONCEPT_ASSERT3(IsLieGroup); } //****************************************************************************** diff --git a/gtsam/geometry/tests/testStereoPoint2.cpp b/gtsam/geometry/tests/testStereoPoint2.cpp index ddcc9238aa..236ea8b012 100644 --- a/gtsam/geometry/tests/testStereoPoint2.cpp +++ b/gtsam/geometry/tests/testStereoPoint2.cpp @@ -31,9 +31,9 @@ GTSAM_CONCEPT_TESTABLE_INST(StereoPoint2) //****************************************************************************** TEST(StereoPoint2 , Concept) { - BOOST_CONCEPT_ASSERT((IsGroup)); - BOOST_CONCEPT_ASSERT((IsManifold)); - BOOST_CONCEPT_ASSERT((IsVectorSpace)); + GTSAM_CONCEPT_ASSERT1(IsGroup); + GTSAM_CONCEPT_ASSERT2(IsManifold); + GTSAM_CONCEPT_ASSERT3(IsVectorSpace); } /* ************************************************************************* */ diff --git a/gtsam/nonlinear/Expression.h b/gtsam/nonlinear/Expression.h index 6e3c634cc6..fb8087133b 100644 --- a/gtsam/nonlinear/Expression.h +++ b/gtsam/nonlinear/Expression.h @@ -218,7 +218,7 @@ class Expression { template class ScalarMultiplyExpression : public Expression { // Check that T is a vector space - BOOST_CONCEPT_ASSERT((gtsam::IsVectorSpace)); + GTSAM_CONCEPT_ASSERT(gtsam::IsVectorSpace); public: explicit ScalarMultiplyExpression(double s, const Expression& e); @@ -231,7 +231,7 @@ class ScalarMultiplyExpression : public Expression { template class BinarySumExpression : public Expression { // Check that T is a vector space - BOOST_CONCEPT_ASSERT((gtsam::IsVectorSpace)); + GTSAM_CONCEPT_ASSERT(gtsam::IsVectorSpace); public: explicit BinarySumExpression(const Expression& e1, const Expression& e2); diff --git a/gtsam/nonlinear/ExpressionFactor.h b/gtsam/nonlinear/ExpressionFactor.h index 80a7660fce..269bdf9243 100644 --- a/gtsam/nonlinear/ExpressionFactor.h +++ b/gtsam/nonlinear/ExpressionFactor.h @@ -42,7 +42,7 @@ namespace gtsam { */ template class ExpressionFactor : public NoiseModelFactor { - BOOST_CONCEPT_ASSERT((IsTestable)); + GTSAM_CONCEPT_ASSERT(IsTestable); protected: diff --git a/gtsam/nonlinear/ExtendedKalmanFilter.h b/gtsam/nonlinear/ExtendedKalmanFilter.h index e931fc561a..a270bc4b15 100644 --- a/gtsam/nonlinear/ExtendedKalmanFilter.h +++ b/gtsam/nonlinear/ExtendedKalmanFilter.h @@ -44,8 +44,8 @@ namespace gtsam { template class ExtendedKalmanFilter { // Check that VALUE type is a testable Manifold - BOOST_CONCEPT_ASSERT((IsTestable)); - BOOST_CONCEPT_ASSERT((IsManifold)); + GTSAM_CONCEPT_ASSERT1(IsTestable); + GTSAM_CONCEPT_ASSERT2(IsManifold); public: typedef std::shared_ptr > shared_ptr; diff --git a/gtsam/nonlinear/internal/ExpressionNode.h b/gtsam/nonlinear/internal/ExpressionNode.h index cf30b1f657..878b2b9d8f 100644 --- a/gtsam/nonlinear/internal/ExpressionNode.h +++ b/gtsam/nonlinear/internal/ExpressionNode.h @@ -38,7 +38,7 @@ T & upAlign(T & value, unsigned requiredAlignment = TraceAlignment) { // right now only word sized types are supported. // Easy to extend if needed, // by somehow inferring the unsigned integer of same size - BOOST_STATIC_ASSERT(sizeof(T) == sizeof(size_t)); + static_assert(sizeof(T) == sizeof(size_t)); size_t & uiValue = reinterpret_cast(value); size_t misAlignment = uiValue % requiredAlignment; if (misAlignment) { @@ -559,7 +559,7 @@ class TernaryExpression: public ExpressionNode { template class ScalarMultiplyNode : public ExpressionNode { // Check that T is a vector space - BOOST_CONCEPT_ASSERT((gtsam::IsVectorSpace)); + GTSAM_CONCEPT_ASSERT(gtsam::IsVectorSpace); double scalar_; std::shared_ptr > expression_; diff --git a/gtsam/sfm/BinaryMeasurement.h b/gtsam/sfm/BinaryMeasurement.h index 1f991a05a3..debb27bc15 100644 --- a/gtsam/sfm/BinaryMeasurement.h +++ b/gtsam/sfm/BinaryMeasurement.h @@ -35,7 +35,7 @@ namespace gtsam { template class BinaryMeasurement : public Factor { // Check that T type is testable - BOOST_CONCEPT_ASSERT((IsTestable)); + GTSAM_CONCEPT_ASSERT(IsTestable); public: // shorthand for a smart pointer to a measurement diff --git a/gtsam/slam/BetweenFactor.h b/gtsam/slam/BetweenFactor.h index 3e5b154e3a..ee533c2157 100644 --- a/gtsam/slam/BetweenFactor.h +++ b/gtsam/slam/BetweenFactor.h @@ -40,8 +40,8 @@ namespace gtsam { class BetweenFactor: public NoiseModelFactorN { // Check that VALUE type is a testable Lie group - BOOST_CONCEPT_ASSERT((IsTestable)); - BOOST_CONCEPT_ASSERT((IsLieGroup)); + GTSAM_CONCEPT_ASSERT1(IsTestable); + GTSAM_CONCEPT_ASSERT2(IsLieGroup); public: diff --git a/tests/testLie.cpp b/tests/testLie.cpp index fe1173f22e..f411bd6ef1 100644 --- a/tests/testLie.cpp +++ b/tests/testLie.cpp @@ -47,9 +47,9 @@ template<> struct traits : internal::LieGroupTraits { //****************************************************************************** TEST(Lie, ProductLieGroup) { - BOOST_CONCEPT_ASSERT((IsGroup)); - BOOST_CONCEPT_ASSERT((IsManifold)); - BOOST_CONCEPT_ASSERT((IsLieGroup)); + GTSAM_CONCEPT_ASSERT1(IsGroup); + GTSAM_CONCEPT_ASSERT2(IsManifold); + GTSAM_CONCEPT_ASSERT3(IsLieGroup); Product pair1; Vector5 d; d << 1, 2, 0.1, 0.2, 0.3; diff --git a/tests/testManifold.cpp b/tests/testManifold.cpp index 7d788d1099..5e93da2f53 100644 --- a/tests/testManifold.cpp +++ b/tests/testManifold.cpp @@ -37,27 +37,27 @@ typedef PinholeCamera Camera; //****************************************************************************** TEST(Manifold, SomeManifoldsGTSAM) { - //BOOST_CONCEPT_ASSERT((IsManifold)); // integer is not a manifold - BOOST_CONCEPT_ASSERT((IsManifold)); - BOOST_CONCEPT_ASSERT((IsManifold)); - BOOST_CONCEPT_ASSERT((IsManifold)); - BOOST_CONCEPT_ASSERT((IsManifold)); + //GTSAM_CONCEPT_ASSERT(IsManifold); // integer is not a manifold + GTSAM_CONCEPT_ASSERT(IsManifold); + GTSAM_CONCEPT_ASSERT(IsManifold); + GTSAM_CONCEPT_ASSERT(IsManifold); + GTSAM_CONCEPT_ASSERT(IsManifold); } //****************************************************************************** TEST(Manifold, SomeLieGroupsGTSAM) { - BOOST_CONCEPT_ASSERT((IsLieGroup)); - BOOST_CONCEPT_ASSERT((IsLieGroup)); - BOOST_CONCEPT_ASSERT((IsLieGroup)); - BOOST_CONCEPT_ASSERT((IsLieGroup)); + GTSAM_CONCEPT_ASSERT(IsLieGroup); + GTSAM_CONCEPT_ASSERT(IsLieGroup); + GTSAM_CONCEPT_ASSERT(IsLieGroup); + GTSAM_CONCEPT_ASSERT(IsLieGroup); } //****************************************************************************** TEST(Manifold, SomeVectorSpacesGTSAM) { - BOOST_CONCEPT_ASSERT((IsVectorSpace)); - BOOST_CONCEPT_ASSERT((IsVectorSpace)); - BOOST_CONCEPT_ASSERT((IsVectorSpace)); - BOOST_CONCEPT_ASSERT((IsVectorSpace)); + GTSAM_CONCEPT_ASSERT(IsVectorSpace); + GTSAM_CONCEPT_ASSERT(IsVectorSpace); + GTSAM_CONCEPT_ASSERT(IsVectorSpace); + GTSAM_CONCEPT_ASSERT(IsVectorSpace); } //******************************************************************************