From 387480168960726b94a94899ff59f135d65ede4e Mon Sep 17 00:00:00 2001 From: symscae Date: Sat, 20 Jun 2026 23:26:27 -0700 Subject: [PATCH 1/7] update cpp version to cpp23 --- src/SConscript | 2 +- src/diffpy/mathutils.hpp | 4 ++-- src/diffpy/srreal/PairQuantity.cpp | 2 +- src/diffpy/srreal/scatteringfactordata.cpp | 3 +-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/SConscript b/src/SConscript index fce570ec..06bf0b81 100644 --- a/src/SConscript +++ b/src/SConscript @@ -21,7 +21,7 @@ fast_linkflags = ['-s'] # Specify minimum C++ standard. Allow later standard from sconscript.local. # In case of multiple `-std` options the last option holds. -env.PrependUnique(CXXFLAGS='-std=c++11', delete_existing=1) +env.PrependUnique(CXXFLAGS='-std=c++23', delete_existing=1) # Platform specific intricacies. if env['PLATFORM'] == 'darwin': diff --git a/src/diffpy/mathutils.hpp b/src/diffpy/mathutils.hpp index f8e8ffec..46894afd 100644 --- a/src/diffpy/mathutils.hpp +++ b/src/diffpy/mathutils.hpp @@ -49,7 +49,7 @@ bool eps_lt(const double& x, const double& y, double eps=SQRT_DOUBLE_EPS); // binary functor for round-off aware less-than comparison -class EpsilonLess : public std::binary_function +class EpsilonLess { public: @@ -77,7 +77,7 @@ class EpsilonLess : public std::binary_function // binary functor for round-off aware equality comparison -class EpsilonEqual : public std::binary_function +class EpsilonEqual { public: diff --git a/src/diffpy/srreal/PairQuantity.cpp b/src/diffpy/srreal/PairQuantity.cpp index b525b546..f420df5d 100644 --- a/src/diffpy/srreal/PairQuantity.cpp +++ b/src/diffpy/srreal/PairQuantity.cpp @@ -150,7 +150,7 @@ void PairQuantity::setEvaluatorType(PQEvaluatorType evtp) { pqev->validate(*this); } - catch (logic_error e) + catch (const logic_error& e) { string emsg("EvaluatorType not supported. "); emsg += e.what(); diff --git a/src/diffpy/srreal/scatteringfactordata.cpp b/src/diffpy/srreal/scatteringfactordata.cpp index 6439269d..808a47e2 100644 --- a/src/diffpy/srreal/scatteringfactordata.cpp +++ b/src/diffpy/srreal/scatteringfactordata.cpp @@ -100,8 +100,7 @@ class WaasKirfFormula }; -class wksmbl_equal : - public binary_function +class wksmbl_equal { public: bool operator() ( From 0bda0721f55555fe34a7d6c012607e781a2c26ac Mon Sep 17 00:00:00 2001 From: symscae Date: Sun, 21 Jun 2026 10:49:17 -0700 Subject: [PATCH 2/7] replace boost smart pointer usages --- src/diffpy/Attributes.hpp | 4 ++-- src/diffpy/HasClassRegistry.hpp | 4 ++-- src/diffpy/serialization.ipp | 8 ++++---- src/diffpy/srreal/AtomicStructureAdapter.cpp | 4 ++-- src/diffpy/srreal/AtomicStructureAdapter.hpp | 2 +- src/diffpy/srreal/BVParametersTable.hpp | 2 +- src/diffpy/srreal/ConstantRadiiTable.cpp | 4 ++-- src/diffpy/srreal/CrystalStructureAdapter.cpp | 4 ++-- src/diffpy/srreal/CrystalStructureAdapter.hpp | 2 +- src/diffpy/srreal/EmptyStructureAdapter.cpp | 4 ++-- src/diffpy/srreal/NoMetaStructureAdapter.cpp | 12 ++++++------ src/diffpy/srreal/NoSymmetryStructureAdapter.cpp | 12 ++++++------ src/diffpy/srreal/OverlapCalculator.cpp | 2 +- src/diffpy/srreal/PQEvaluator.hpp | 4 ++-- src/diffpy/srreal/PeriodicStructureAdapter.cpp | 4 ++-- src/diffpy/srreal/PeriodicStructureAdapter.hpp | 2 +- src/diffpy/srreal/StructureAdapter.hpp | 10 +++++----- src/diffpy/srreal/forwardtypes.hpp | 8 ++++---- src/tests/TestAtomicStructureAdapter.hpp | 8 ++++---- src/tests/TestBVSCalculator.hpp | 6 +++--- src/tests/TestDebyePDFCalculator.hpp | 14 +++++++------- src/tests/TestEmptyStructureAdapter.hpp | 2 +- src/tests/TestObjCrystStructureAdapter.hpp | 6 +++--- src/tests/TestOverlapCalculator.hpp | 4 ++-- src/tests/TestPDFCalculator.hpp | 4 ++-- src/tests/TestPQEvaluator.hpp | 10 +++++----- src/tests/TestPeriodicStructureAdapter.hpp | 6 +++--- src/tests/test_custompqconfig.hpp | 4 ++-- 28 files changed, 78 insertions(+), 78 deletions(-) diff --git a/src/diffpy/Attributes.hpp b/src/diffpy/Attributes.hpp index 8e6a9ae6..31e1e180 100644 --- a/src/diffpy/Attributes.hpp +++ b/src/diffpy/Attributes.hpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include namespace diffpy { namespace attributes { @@ -109,7 +109,7 @@ class Attributes // types typedef std::map > + std::shared_ptr > DoubleAttributeStorage; // data DoubleAttributeStorage mdoubleattrs; diff --git a/src/diffpy/HasClassRegistry.hpp b/src/diffpy/HasClassRegistry.hpp index b3f2a55a..538bd0ad 100644 --- a/src/diffpy/HasClassRegistry.hpp +++ b/src/diffpy/HasClassRegistry.hpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include namespace diffpy { @@ -42,7 +42,7 @@ class HasClassRegistry public: // types - typedef boost::shared_ptr SharedPtr; + typedef std::shared_ptr SharedPtr; // Contains virtual methods virtual ~HasClassRegistry() { } diff --git a/src/diffpy/serialization.ipp b/src/diffpy/serialization.ipp index fba56fff..f73d1f6f 100644 --- a/src/diffpy/serialization.ipp +++ b/src/diffpy/serialization.ipp @@ -18,7 +18,7 @@ * diffpy::serialization_fromstring * * Definition of macros for explicit instantiation of serialization_tostring -* and serialization_fromstring for type C or type boost::shared_ptr. +* and serialization_fromstring for type C or type std::shared_ptr. * * DIFFPY_INSTANTIATE_SERIALIZATION(C) * DIFFPY_INSTANTIATE_PTR_SERIALIZATION(C) @@ -29,7 +29,7 @@ #define SERIALIZATION_IPP_INCLUDED #include -#include +#include #include namespace diffpy { @@ -70,9 +70,9 @@ void serialization_fromstring(T& tobj, const std::string& s) diffpy::serialization_fromstring(C&, const std::string&); \ /// Insert explicit instantiations for serialization_tostring and -/// serialization_fromstring for type boost::shared_ptr. +/// serialization_fromstring for type std::shared_ptr. #define DIFFPY_INSTANTIATE_PTR_SERIALIZATION(C) \ - DIFFPY_INSTANTIATE_SERIALIZATION(boost::shared_ptr) + DIFFPY_INSTANTIATE_SERIALIZATION(std::shared_ptr) #endif // SERIALIZATION_IPP_INCLUDED diff --git a/src/diffpy/srreal/AtomicStructureAdapter.cpp b/src/diffpy/srreal/AtomicStructureAdapter.cpp index ac5a0192..d4856c81 100644 --- a/src/diffpy/srreal/AtomicStructureAdapter.cpp +++ b/src/diffpy/srreal/AtomicStructureAdapter.cpp @@ -170,8 +170,8 @@ AtomicStructureAdapter::diff(StructureAdapterConstPtr other) const using std::min; StructureDifference sd = this->StructureAdapter::diff(other); if (sd.stru0 == sd.stru1) return sd; - typedef boost::shared_ptr APtr; - APtr pother = boost::dynamic_pointer_cast(other); + typedef std::shared_ptr APtr; + APtr pother = std::dynamic_pointer_cast(other); if (!pother) return sd; // try fast side-by-side comparison sd.diffmethod = StructureDifference::Method::SIDEBYSIDE; diff --git a/src/diffpy/srreal/AtomicStructureAdapter.hpp b/src/diffpy/srreal/AtomicStructureAdapter.hpp index 6eb3cbc2..e6eb22fa 100644 --- a/src/diffpy/srreal/AtomicStructureAdapter.hpp +++ b/src/diffpy/srreal/AtomicStructureAdapter.hpp @@ -156,7 +156,7 @@ class AtomicStructureAdapter : public StructureAdapter }; -typedef boost::shared_ptr AtomicStructureAdapterPtr; +typedef std::shared_ptr AtomicStructureAdapterPtr; // Complementary comparison function diff --git a/src/diffpy/srreal/BVParametersTable.hpp b/src/diffpy/srreal/BVParametersTable.hpp index 690ecb04..9a900f4e 100644 --- a/src/diffpy/srreal/BVParametersTable.hpp +++ b/src/diffpy/srreal/BVParametersTable.hpp @@ -30,7 +30,7 @@ namespace diffpy { namespace srreal { -typedef boost::shared_ptr BVParametersTablePtr; +typedef std::shared_ptr BVParametersTablePtr; class BVParametersTable { diff --git a/src/diffpy/srreal/ConstantRadiiTable.cpp b/src/diffpy/srreal/ConstantRadiiTable.cpp index 81014d8b..777df732 100644 --- a/src/diffpy/srreal/ConstantRadiiTable.cpp +++ b/src/diffpy/srreal/ConstantRadiiTable.cpp @@ -43,13 +43,13 @@ ConstantRadiiTable::ConstantRadiiTable() : mdefaultradius(0.0) AtomRadiiTablePtr ConstantRadiiTable::create() const { - return boost::make_shared(); + return std::make_shared(); } AtomRadiiTablePtr ConstantRadiiTable::clone() const { - return boost::make_shared(*this); + return std::make_shared(*this); } diff --git a/src/diffpy/srreal/CrystalStructureAdapter.cpp b/src/diffpy/srreal/CrystalStructureAdapter.cpp index 9db5f0d7..6d51c2ed 100644 --- a/src/diffpy/srreal/CrystalStructureAdapter.cpp +++ b/src/diffpy/srreal/CrystalStructureAdapter.cpp @@ -80,8 +80,8 @@ CrystalStructureAdapter::diff(StructureAdapterConstPtr other) const { StructureDifference sd = this->StructureAdapter::diff(other); if (sd.stru0 == sd.stru1) return sd; - typedef boost::shared_ptr CPtr; - CPtr cother = boost::dynamic_pointer_cast(other); + typedef std::shared_ptr CPtr; + CPtr cother = std::dynamic_pointer_cast(other); if (!cother) return sd; // compare symmetry operations in both adapters assert(cother == sd.stru1); diff --git a/src/diffpy/srreal/CrystalStructureAdapter.hpp b/src/diffpy/srreal/CrystalStructureAdapter.hpp index 56645810..423ef48e 100644 --- a/src/diffpy/srreal/CrystalStructureAdapter.hpp +++ b/src/diffpy/srreal/CrystalStructureAdapter.hpp @@ -129,7 +129,7 @@ class CrystalStructureAdapter : public PeriodicStructureAdapter }; -typedef boost::shared_ptr CrystalStructureAdapterPtr; +typedef std::shared_ptr CrystalStructureAdapterPtr; // Comparison functions diff --git a/src/diffpy/srreal/EmptyStructureAdapter.cpp b/src/diffpy/srreal/EmptyStructureAdapter.cpp index 84c0658d..5c6e872c 100644 --- a/src/diffpy/srreal/EmptyStructureAdapter.cpp +++ b/src/diffpy/srreal/EmptyStructureAdapter.cpp @@ -45,14 +45,14 @@ class EmptyStructureAdapter : public StructureAdapter virtual StructureAdapterPtr clone() const { StructureAdapterPtr rv = - boost::const_pointer_cast(shared_from_this()); + std::const_pointer_cast(shared_from_this()); return rv; } virtual BaseBondGeneratorPtr createBondGenerator() const { - return boost::make_shared(shared_from_this()); + return std::make_shared(shared_from_this()); } diff --git a/src/diffpy/srreal/NoMetaStructureAdapter.cpp b/src/diffpy/srreal/NoMetaStructureAdapter.cpp index 59f9b540..f5d7366c 100644 --- a/src/diffpy/srreal/NoMetaStructureAdapter.cpp +++ b/src/diffpy/srreal/NoMetaStructureAdapter.cpp @@ -38,8 +38,8 @@ namespace srreal { NoMetaStructureAdapter::NoMetaStructureAdapter( StructureAdapterPtr srcstructure) { - boost::shared_ptr nmptr = - boost::dynamic_pointer_cast(srcstructure); + std::shared_ptr nmptr = + std::dynamic_pointer_cast(srcstructure); if (nmptr) srcstructure = nmptr->getSourceStructure(); msrcstructure = srcstructure.get() ? srcstructure : emptyStructureAdapter(); @@ -49,7 +49,7 @@ NoMetaStructureAdapter::NoMetaStructureAdapter( StructureAdapterPtr NoMetaStructureAdapter::clone() const { - boost::shared_ptr rv(new NoMetaStructureAdapter); + std::shared_ptr rv(new NoMetaStructureAdapter); if (msrcstructure) rv->msrcstructure = msrcstructure->clone(); return rv; } @@ -122,8 +122,8 @@ NoMetaStructureAdapter::diff(StructureAdapterConstPtr other) const { StructureDifference sd = this->StructureAdapter::diff(other); if (sd.stru0 == sd.stru1) return sd; - typedef boost::shared_ptr PPtr; - PPtr pother = boost::dynamic_pointer_cast(other); + typedef std::shared_ptr PPtr; + PPtr pother = std::dynamic_pointer_cast(other); if (!pother) return sd; sd = this->getSourceStructure()->diff(pother->getSourceStructure()); assert(sd.stru0 == this->getSourceStructure()); @@ -152,7 +152,7 @@ NoMetaStructureAdapter::getSourceStructure() const StructureAdapterPtr nometa(StructureAdapterPtr stru) { StructureAdapterPtr rv = - boost::dynamic_pointer_cast(stru) ? stru : + std::dynamic_pointer_cast(stru) ? stru : StructureAdapterPtr(new NoMetaStructureAdapter(stru)); return rv; } diff --git a/src/diffpy/srreal/NoSymmetryStructureAdapter.cpp b/src/diffpy/srreal/NoSymmetryStructureAdapter.cpp index 7c080d7b..1502f63b 100644 --- a/src/diffpy/srreal/NoSymmetryStructureAdapter.cpp +++ b/src/diffpy/srreal/NoSymmetryStructureAdapter.cpp @@ -40,8 +40,8 @@ namespace srreal { NoSymmetryStructureAdapter::NoSymmetryStructureAdapter( StructureAdapterPtr srcstructure) { - boost::shared_ptr nmptr = - boost::dynamic_pointer_cast(srcstructure); + std::shared_ptr nmptr = + std::dynamic_pointer_cast(srcstructure); if (nmptr) srcstructure = nmptr->getSourceStructure(); msrcstructure = srcstructure.get() ? srcstructure : emptyStructureAdapter(); @@ -51,7 +51,7 @@ NoSymmetryStructureAdapter::NoSymmetryStructureAdapter( StructureAdapterPtr NoSymmetryStructureAdapter::clone() const { - boost::shared_ptr + std::shared_ptr rv(new NoSymmetryStructureAdapter); if (msrcstructure) rv->msrcstructure = msrcstructure->clone(); return rv; @@ -119,8 +119,8 @@ NoSymmetryStructureAdapter::diff(StructureAdapterConstPtr other) const { StructureDifference sd = this->StructureAdapter::diff(other); if (sd.stru0 == sd.stru1) return sd; - typedef boost::shared_ptr PPtr; - PPtr pother = boost::dynamic_pointer_cast(other); + typedef std::shared_ptr PPtr; + PPtr pother = std::dynamic_pointer_cast(other); if (!pother) return sd; sd = this->getSourceStructure()->diff(pother->getSourceStructure()); assert(sd.stru0 == this->getSourceStructure()); @@ -149,7 +149,7 @@ NoSymmetryStructureAdapter::getSourceStructure() const StructureAdapterPtr nosymmetry(StructureAdapterPtr stru) { StructureAdapterPtr rv = - boost::dynamic_pointer_cast(stru) ? stru : + std::dynamic_pointer_cast(stru) ? stru : StructureAdapterPtr(new NoSymmetryStructureAdapter(stru)); return rv; } diff --git a/src/diffpy/srreal/OverlapCalculator.cpp b/src/diffpy/srreal/OverlapCalculator.cpp index 008addcb..4fc638a9 100644 --- a/src/diffpy/srreal/OverlapCalculator.cpp +++ b/src/diffpy/srreal/OverlapCalculator.cpp @@ -314,7 +314,7 @@ vector< unordered_set > OverlapCalculator::neighborhoods() const { int cntsites = this->countSites(); typedef unordered_set SiteSet; - typedef std::vector< boost::shared_ptr > SiteSetPointers; + typedef std::vector< std::shared_ptr > SiteSetPointers; SiteSetPointers rvptr(cntsites); int n = this->count(); for (int index = 0; index < n; ++index) diff --git a/src/diffpy/srreal/PQEvaluator.hpp b/src/diffpy/srreal/PQEvaluator.hpp index 8fa5f228..f446517b 100644 --- a/src/diffpy/srreal/PQEvaluator.hpp +++ b/src/diffpy/srreal/PQEvaluator.hpp @@ -24,7 +24,7 @@ #ifndef PQEVALUATOR_HPP_INCLUDED #define PQEVALUATOR_HPP_INCLUDED -#include +#include #include #include #include @@ -40,7 +40,7 @@ class PairQuantity; /// shared pointer to PQEvaluatorBasic -typedef boost::shared_ptr PQEvaluatorPtr; +typedef std::shared_ptr PQEvaluatorPtr; enum PQEvaluatorType {NONE, BASIC, OPTIMIZED, CHECK}; diff --git a/src/diffpy/srreal/PeriodicStructureAdapter.cpp b/src/diffpy/srreal/PeriodicStructureAdapter.cpp index 80fdd5f5..29bd4da5 100644 --- a/src/diffpy/srreal/PeriodicStructureAdapter.cpp +++ b/src/diffpy/srreal/PeriodicStructureAdapter.cpp @@ -65,8 +65,8 @@ PeriodicStructureAdapter::diff(StructureAdapterConstPtr other) const { StructureDifference sd = this->StructureAdapter::diff(other); if (sd.stru0 == sd.stru1) return sd; - typedef boost::shared_ptr PPtr; - PPtr pother = boost::dynamic_pointer_cast(other); + typedef std::shared_ptr PPtr; + PPtr pother = std::dynamic_pointer_cast(other); if (!pother) return sd; assert(pother == sd.stru1); if (this->getLattice() != pother->getLattice()) return sd; diff --git a/src/diffpy/srreal/PeriodicStructureAdapter.hpp b/src/diffpy/srreal/PeriodicStructureAdapter.hpp index d3082e0e..0d783515 100644 --- a/src/diffpy/srreal/PeriodicStructureAdapter.hpp +++ b/src/diffpy/srreal/PeriodicStructureAdapter.hpp @@ -64,7 +64,7 @@ class PeriodicStructureAdapter : public AtomicStructureAdapter }; -typedef boost::shared_ptr PeriodicStructureAdapterPtr; +typedef std::shared_ptr PeriodicStructureAdapterPtr; // Comparison functions diff --git a/src/diffpy/srreal/StructureAdapter.hpp b/src/diffpy/srreal/StructureAdapter.hpp index 1ff4218d..9f50dd75 100644 --- a/src/diffpy/srreal/StructureAdapter.hpp +++ b/src/diffpy/srreal/StructureAdapter.hpp @@ -21,7 +21,7 @@ #define STRUCTUREADAPTER_HPP_INCLUDED #include -#include +#include #include #include #include @@ -44,7 +44,7 @@ class StructureDifference; /// PairQuantity calculator class StructureAdapter : - public boost::enable_shared_from_this + public std::enable_shared_from_this { public: @@ -160,10 +160,10 @@ StructureAdapterPtr convertToStructureAdapter(const T& stru) template -StructureAdapterPtr convertToStructureAdapter(const boost::shared_ptr& stru) +StructureAdapterPtr convertToStructureAdapter(const std::shared_ptr& stru) { StructureAdapterPtr rv = - boost::dynamic_pointer_cast(stru); + std::dynamic_pointer_cast(stru); assert(rv); return rv; } @@ -173,7 +173,7 @@ inline StructureAdapterPtr convertToStructureAdapter(StructureAdapterConstPtr stru) { StructureAdapterPtr rv = - boost::const_pointer_cast(stru); + std::const_pointer_cast(stru); return rv; } diff --git a/src/diffpy/srreal/forwardtypes.hpp b/src/diffpy/srreal/forwardtypes.hpp index fe047063..acaafa1e 100644 --- a/src/diffpy/srreal/forwardtypes.hpp +++ b/src/diffpy/srreal/forwardtypes.hpp @@ -20,15 +20,15 @@ #define FORWARDTYPES_HPP_INCLUDED #include -#include +#include namespace diffpy { namespace srreal { /// shared pointers to structure adapter and bond generator related objects -typedef boost::shared_ptr BaseBondGeneratorPtr; -typedef boost::shared_ptr StructureAdapterPtr; -typedef boost::shared_ptr StructureAdapterConstPtr; +typedef std::shared_ptr BaseBondGeneratorPtr; +typedef std::shared_ptr StructureAdapterPtr; +typedef std::shared_ptr StructureAdapterConstPtr; /// type for holding indices for atom sites typedef std::vector SiteIndices; diff --git a/src/tests/TestAtomicStructureAdapter.hpp b/src/tests/TestAtomicStructureAdapter.hpp index c530d6b6..f7ebfe07 100644 --- a/src/tests/TestAtomicStructureAdapter.hpp +++ b/src/tests/TestAtomicStructureAdapter.hpp @@ -47,7 +47,7 @@ class TestAtomicStructureAdapter : public CxxTest::TestSuite { mstru = StructureAdapterPtr(new AtomicStructureAdapter); mpstru = - boost::dynamic_pointer_cast(mstru); + std::dynamic_pointer_cast(mstru); } @@ -73,7 +73,7 @@ class TestAtomicStructureAdapter : public CxxTest::TestSuite mpstru->append(ai); } AtomicStructureAdapterPtr cpstru = - boost::make_shared(*mpstru); + std::make_shared(*mpstru); sd = mstru->diff(mstru); TS_ASSERT(sd.allowsfastupdate()) sd = mstru->diff(cpstru); @@ -122,7 +122,7 @@ class TestAtomicStructureAdapter : public CxxTest::TestSuite StructureAdapterPtr stru1; stru1 = dumpandload(mstru); AtomicStructureAdapterPtr astru1 = - boost::dynamic_pointer_cast(stru1); + std::dynamic_pointer_cast(stru1); TS_ASSERT_EQUALS(2, astru1->countSites()); TS_ASSERT_EQUALS((*mpstru)[0], (*astru1)[0]); TS_ASSERT_EQUALS((*mpstru)[1], (*astru1)[1]); @@ -140,7 +140,7 @@ class TestAtomicStructureAdapter : public CxxTest::TestSuite mpstru->append(ai); } AtomicStructureAdapterPtr cpstru = - boost::make_shared(*mpstru); + std::make_shared(*mpstru); TS_ASSERT_EQUALS(*mpstru, *cpstru); TS_ASSERT(!(*mpstru != *cpstru)); cpstru->at(0).atomtype = "H"; diff --git a/src/tests/TestBVSCalculator.hpp b/src/tests/TestBVSCalculator.hpp index f8001d51..511a0f4d 100644 --- a/src/tests/TestBVSCalculator.hpp +++ b/src/tests/TestBVSCalculator.hpp @@ -39,7 +39,7 @@ class TestBVSCalculator : public CxxTest::TestSuite private: StructureAdapterPtr mnacl; - boost::shared_ptr mbvc; + std::shared_ptr mbvc; public: @@ -92,7 +92,7 @@ class TestBVSCalculator : public CxxTest::TestSuite TS_ASSERT_EQUALS(0.0, mbvc->value()[4]); // create structure with bare atom symbols "Na", "Cl". PeriodicStructureAdapterPtr naclbare = - boost::dynamic_pointer_cast< + std::dynamic_pointer_cast< PeriodicStructureAdapter>(mnacl->clone()); for (int i = 0; i < naclbare->countSites(); ++i) { @@ -147,7 +147,7 @@ class TestBVSCalculator : public CxxTest::TestSuite diffpy::serialization::oarchive oa(storage, ios::binary); oa << mbvc; diffpy::serialization::iarchive ia(storage, ios::binary); - boost::shared_ptr bvc1; + std::shared_ptr bvc1; TS_ASSERT(!bvc1.get()); ia >> bvc1; TS_ASSERT_DIFFERS(mbvc.get(), bvc1.get()); diff --git a/src/tests/TestDebyePDFCalculator.hpp b/src/tests/TestDebyePDFCalculator.hpp index 5bd380d3..6180a09e 100644 --- a/src/tests/TestDebyePDFCalculator.hpp +++ b/src/tests/TestDebyePDFCalculator.hpp @@ -34,7 +34,7 @@ class TestDebyePDFCalculator : public CxxTest::TestSuite { private: - boost::shared_ptr mpdfc; + std::shared_ptr mpdfc; AtomicStructureAdapterPtr memptystru; AtomicStructureAdapterPtr mstru10; AtomicStructureAdapterPtr mstru10d1; @@ -50,8 +50,8 @@ class TestDebyePDFCalculator : public CxxTest::TestSuite const int SZ = 10; meps = diffpy::mathutils::SQRT_DOUBLE_EPS; mpdfc.reset(new DebyePDFCalculator); - memptystru = boost::make_shared(); - mstru10 = boost::make_shared(); + memptystru = std::make_shared(); + mstru10 = std::make_shared(); Atom ai; ai.atomtype = "C"; ai.uij_cartn = R3::identity(); @@ -62,11 +62,11 @@ class TestDebyePDFCalculator : public CxxTest::TestSuite ai.xyz_cartn[0] = i; mstru10->append(ai); } - mstru10d1 = boost::make_shared(*mstru10); + mstru10d1 = std::make_shared(*mstru10); (*mstru10d1)[0].atomtype = "Au"; - mstru10r = boost::make_shared(); + mstru10r = std::make_shared(); mstru10r->assign(mstru10->rbegin(), mstru10->rend()); - mstru9 = boost::make_shared(*mstru10); + mstru9 = std::make_shared(*mstru10); mstru9->erase(9); } @@ -200,7 +200,7 @@ class TestDebyePDFCalculator : public CxxTest::TestSuite diffpy::serialization::oarchive oa(storage, ios::binary); oa << mpdfc; diffpy::serialization::iarchive ia(storage, ios::binary); - boost::shared_ptr pdfc1; + std::shared_ptr pdfc1; ia >> pdfc1; TS_ASSERT_DIFFERS(pdfc1.get(), mpdfc.get()); TS_ASSERT_EQUALS(string("constant"), diff --git a/src/tests/TestEmptyStructureAdapter.hpp b/src/tests/TestEmptyStructureAdapter.hpp index d002a229..932dde17 100644 --- a/src/tests/TestEmptyStructureAdapter.hpp +++ b/src/tests/TestEmptyStructureAdapter.hpp @@ -65,7 +65,7 @@ class TestEmptyStructureAdapter : public CxxTest::TestSuite StructureAdapterPtr stru1; stru1 = dumpandload(mstru); AtomicStructureAdapterPtr astru1 = - boost::dynamic_pointer_cast(stru1); + std::dynamic_pointer_cast(stru1); TS_ASSERT(!astru1); TS_ASSERT_EQUALS(0, stru1->countSites()); TS_ASSERT_EQUALS(stru1, stru1->clone()); diff --git a/src/tests/TestObjCrystStructureAdapter.hpp b/src/tests/TestObjCrystStructureAdapter.hpp index b3320d8c..cd4bf902 100644 --- a/src/tests/TestObjCrystStructureAdapter.hpp +++ b/src/tests/TestObjCrystStructureAdapter.hpp @@ -213,10 +213,10 @@ class TestObjCrystStructureAdapter : public CxxTest::TestSuite { StructureAdapterPtr acto = m_catio3; CrystalStructureAdapterPtr ccto( - boost::dynamic_pointer_cast(acto)); + std::dynamic_pointer_cast(acto)); StructureAdapterPtr acto2 = acto->clone(); CrystalStructureAdapterPtr ccto2( - boost::dynamic_pointer_cast(acto2)); + std::dynamic_pointer_cast(acto2)); TS_ASSERT_EQUALS(0.0, diffdegree(acto, acto)); TS_ASSERT_EQUALS(1.0, diffdegree(acto, StructureAdapterPtr())); TS_ASSERT_EQUALS(0.0, diffdegree(acto, acto2)); @@ -253,7 +253,7 @@ class TestObjCrystStructureAdapter : public CxxTest::TestSuite unique_ptr crst(loadTestCrystal("NH4Br.cif")); StructureAdapterPtr adpt = createStructureAdapter(*crst); CrystalStructureAdapterPtr cadpt = - boost::dynamic_pointer_cast(adpt); + std::dynamic_pointer_cast(adpt); TS_ASSERT_EQUALS(2, cadpt->countSites()); TS_ASSERT_EQUALS(4, cadpt->totalOccupancy()); CrystalStructureAdapter::AtomVector eq0, eq1; diff --git a/src/tests/TestOverlapCalculator.hpp b/src/tests/TestOverlapCalculator.hpp index 6f1dce84..80c24807 100644 --- a/src/tests/TestOverlapCalculator.hpp +++ b/src/tests/TestOverlapCalculator.hpp @@ -35,7 +35,7 @@ class TestOverlapCalculator : public CxxTest::TestSuite { private: - boost::shared_ptr molc; + std::shared_ptr molc; StructureAdapterPtr mnacl; double meps; @@ -347,7 +347,7 @@ class TestOverlapCalculator : public CxxTest::TestSuite stru->append(a0); stru->append(a1); molc->eval(stru); - boost::shared_ptr olc1; + std::shared_ptr olc1; olc1 = dumpandload(molc); TS_ASSERT_DIFFERS(molc.get(), olc1.get()); TS_ASSERT_EQUALS(2, olc1->getStructure()->countSites()); diff --git a/src/tests/TestPDFCalculator.hpp b/src/tests/TestPDFCalculator.hpp index ff70c7ad..c14d6397 100644 --- a/src/tests/TestPDFCalculator.hpp +++ b/src/tests/TestPDFCalculator.hpp @@ -33,7 +33,7 @@ class TestPDFCalculator : public CxxTest::TestSuite { private: - boost::shared_ptr mpdfc; + std::shared_ptr mpdfc; StructureAdapterPtr memptystru; double meps; double mepsdb; @@ -265,7 +265,7 @@ class TestPDFCalculator : public CxxTest::TestSuite diffpy::serialization::oarchive oa(storage, ios::binary); oa << mpdfc; diffpy::serialization::iarchive ia(storage, ios::binary); - boost::shared_ptr pdfc1; + std::shared_ptr pdfc1; ia >> pdfc1; TS_ASSERT_DIFFERS(pdfc1.get(), mpdfc.get()); TS_ASSERT_EQUALS(string("constant"), diff --git a/src/tests/TestPQEvaluator.hpp b/src/tests/TestPQEvaluator.hpp index 0e4141c2..025dde39 100644 --- a/src/tests/TestPQEvaluator.hpp +++ b/src/tests/TestPQEvaluator.hpp @@ -89,7 +89,7 @@ class TestPQEvaluator : public CxxTest::TestSuite mzeros.assign(mpdfcb.getRgrid().size(), 0.0); // setup structure instances const int SZ = 10; - mstru10 = boost::make_shared(); + mstru10 = std::make_shared(); Atom ai; ai.atomtype = "C"; ai.uij_cartn = R3::identity(); @@ -100,11 +100,11 @@ class TestPQEvaluator : public CxxTest::TestSuite ai.xyz_cartn[0] = i; mstru10->append(ai); } - mstru10d1 = boost::make_shared(*mstru10); + mstru10d1 = std::make_shared(*mstru10); (*mstru10d1)[0].atomtype = "Au"; - mstru10r = boost::make_shared(); + mstru10r = std::make_shared(); mstru10r->assign(mstru10->rbegin(), mstru10->rend()); - mstru9 = boost::make_shared(*mstru10); + mstru9 = std::make_shared(*mstru10); mstru9->erase(9); } @@ -176,7 +176,7 @@ class TestPQEvaluator : public CxxTest::TestSuite mpdfcb.setTypeMask("O2-", "all", false); mpdfco.setTypeMask("O2-", "all", false); PeriodicStructureAdapterPtr litao = - boost::dynamic_pointer_cast( + std::dynamic_pointer_cast( loadTestPeriodicStructure("LiTaO3.stru")); TS_ASSERT_EQUALS(mzeros, this->pdfcdiff(litao)); TS_ASSERT_EQUALS(BASIC, mpdfco.getEvaluatorTypeUsed()); diff --git a/src/tests/TestPeriodicStructureAdapter.hpp b/src/tests/TestPeriodicStructureAdapter.hpp index f00e6a0e..19979d16 100644 --- a/src/tests/TestPeriodicStructureAdapter.hpp +++ b/src/tests/TestPeriodicStructureAdapter.hpp @@ -196,7 +196,7 @@ class TestPeriodicStructureAdapter : public CxxTest::TestSuite void test_getLattice() { PeriodicStructureAdapterPtr pkbise = - boost::dynamic_pointer_cast(m_kbise); + std::dynamic_pointer_cast(m_kbise); TS_ASSERT(pkbise); const Lattice& L = pkbise->getLattice(); const double eps = 1.0e-12; @@ -222,9 +222,9 @@ class TestPeriodicStructureAdapter : public CxxTest::TestSuite TS_ASSERT_EQUALS(string("Se"), kbise1->siteAtomType(10)); TS_ASSERT_EQUALS(string("Se"), kbise1->siteAtomType(22)); PeriodicStructureAdapterPtr pkbise = - boost::dynamic_pointer_cast(m_kbise); + std::dynamic_pointer_cast(m_kbise); PeriodicStructureAdapterPtr pkbise1 = - boost::dynamic_pointer_cast(kbise1); + std::dynamic_pointer_cast(kbise1); const Lattice& L = pkbise->getLattice(); const Lattice& L1 = pkbise1->getLattice(); TS_ASSERT_EQUALS(L.a(), L1.a()); diff --git a/src/tests/test_custompqconfig.hpp b/src/tests/test_custompqconfig.hpp index 04b75465..a71ec108 100644 --- a/src/tests/test_custompqconfig.hpp +++ b/src/tests/test_custompqconfig.hpp @@ -70,7 +70,7 @@ BOOST_CLASS_EXPORT(PeriodicAdapterWithPQConfig) // Typedefs and Functions ---------------------------------------------------- -typedef boost::shared_ptr +typedef std::shared_ptr PeriodicAdapterWithPQConfigPtr; inline @@ -78,7 +78,7 @@ PeriodicAdapterWithPQConfigPtr addCustomPQConfig(StructureAdapterPtr stru) { PeriodicStructureAdapterPtr pstru = - boost::dynamic_pointer_cast(stru); + std::dynamic_pointer_cast(stru); return PeriodicAdapterWithPQConfigPtr( new PeriodicAdapterWithPQConfig(*pstru)); } From 3b2252c1ac1fce6328749aca69461d8ed6485e62 Mon Sep 17 00:00:00 2001 From: symscae Date: Sun, 21 Jun 2026 10:59:36 -0700 Subject: [PATCH 3/7] fix scons script failures --- site_scons/site_tools/cxxtest.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/site_scons/site_tools/cxxtest.py b/site_scons/site_tools/cxxtest.py index dc798269..8443e553 100644 --- a/site_scons/site_tools/cxxtest.py +++ b/site_scons/site_tools/cxxtest.py @@ -65,11 +65,11 @@ from SCons.Script import * from SCons.Builder import Builder -from SCons.Util import PrependPath, unique, uniquer +from SCons.Util import PrependPath, unique, uniquer_hashables import os # A warning class to notify users of problems -class ToolCxxTestWarning(SCons.Warnings.Warning): +class ToolCxxTestWarning(SCons.Warnings.SConsWarning): pass SCons.Warnings.enableWarningClass(ToolCxxTestWarning) @@ -105,7 +105,7 @@ def prepend_ld_library_path(env, overrides, **kwargs): """Prepend LD_LIBRARY_PATH with LIBPATH to run successfully programs that were linked against local shared libraries.""" # make it unique but preserve order ... - libpath = uniquer(Split(kwargs.get('CXXTEST_LIBPATH', [])) + + libpath = uniquer_hashables(Split(kwargs.get('CXXTEST_LIBPATH', [])) + Split(env.get( 'CXXTEST_LIBPATH', []))) if len(libpath) > 0: libpath = env.arg2nodes(libpath, env.fs.Dir) From 8f08fe9495d939231644f6ec0865f11baae5c056 Mon Sep 17 00:00:00 2001 From: symscae Date: Sun, 21 Jun 2026 12:17:49 -0700 Subject: [PATCH 4/7] fix test cases --- src/SConscript | 4 ++++ src/diffpy/srreal/ObjCrystStructureAdapter.cpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/SConscript b/src/SConscript index 06bf0b81..6f7e3950 100644 --- a/src/SConscript +++ b/src/SConscript @@ -19,6 +19,10 @@ if env['tool'] == 'intelc': fast_linkflags = ['-s'] +# libobjcryst is built with double precision for ObjCryst's REAL type. +# Match that ABI in all consumers of ObjCryst headers. +env.PrependUnique(CPPDEFINES={'REAL': 'double'}) + # Specify minimum C++ standard. Allow later standard from sconscript.local. # In case of multiple `-std` options the last option holds. env.PrependUnique(CXXFLAGS='-std=c++23', delete_existing=1) diff --git a/src/diffpy/srreal/ObjCrystStructureAdapter.cpp b/src/diffpy/srreal/ObjCrystStructureAdapter.cpp index f6beea70..2b5e5660 100644 --- a/src/diffpy/srreal/ObjCrystStructureAdapter.cpp +++ b/src/diffpy/srreal/ObjCrystStructureAdapter.cpp @@ -86,7 +86,7 @@ fetchSymmetryOperations(const ObjCryst::SpaceGroup& spacegroup) assert(nbtran * last <= nbsym); for (int nt = 0; nt < nbtran; ++nt) { - const float* pt = sgtrans[nt].tr; + const REAL* pt = sgtrans[nt].tr; R3::Vector sgt(pt[0], pt[1], pt[2]); for (int i = 0; i < last; ++i) { From 13e63483b7363e291da5f420b2d5d4f19b715334 Mon Sep 17 00:00:00 2001 From: symscae Date: Sun, 21 Jun 2026 12:25:46 -0700 Subject: [PATCH 5/7] cleanup boost headers --- src/diffpy/srreal/ConstantRadiiTable.cpp | 2 +- src/diffpy/srreal/EmptyStructureAdapter.cpp | 2 +- src/tests/TestAtomicStructureAdapter.hpp | 2 +- src/tests/TestDebyePDFCalculator.hpp | 2 +- src/tests/TestPQEvaluator.hpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/diffpy/srreal/ConstantRadiiTable.cpp b/src/diffpy/srreal/ConstantRadiiTable.cpp index 777df732..4a1e3130 100644 --- a/src/diffpy/srreal/ConstantRadiiTable.cpp +++ b/src/diffpy/srreal/ConstantRadiiTable.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/diffpy/srreal/EmptyStructureAdapter.cpp b/src/diffpy/srreal/EmptyStructureAdapter.cpp index 5c6e872c..a5606acb 100644 --- a/src/diffpy/srreal/EmptyStructureAdapter.cpp +++ b/src/diffpy/srreal/EmptyStructureAdapter.cpp @@ -16,7 +16,7 @@ * *****************************************************************************/ -#include +#include #include #include diff --git a/src/tests/TestAtomicStructureAdapter.hpp b/src/tests/TestAtomicStructureAdapter.hpp index f7ebfe07..80cf2922 100644 --- a/src/tests/TestAtomicStructureAdapter.hpp +++ b/src/tests/TestAtomicStructureAdapter.hpp @@ -19,7 +19,7 @@ #include -#include +#include #include #include diff --git a/src/tests/TestDebyePDFCalculator.hpp b/src/tests/TestDebyePDFCalculator.hpp index 6180a09e..51cc251c 100644 --- a/src/tests/TestDebyePDFCalculator.hpp +++ b/src/tests/TestDebyePDFCalculator.hpp @@ -18,7 +18,7 @@ #include -#include +#include #include #include diff --git a/src/tests/TestPQEvaluator.hpp b/src/tests/TestPQEvaluator.hpp index 025dde39..688729af 100644 --- a/src/tests/TestPQEvaluator.hpp +++ b/src/tests/TestPQEvaluator.hpp @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include From 7a5464a94d599b8424a9a78d12fcca8bb631d8bb Mon Sep 17 00:00:00 2001 From: symscae Date: Sun, 21 Jun 2026 12:28:51 -0700 Subject: [PATCH 6/7] cleanup boost namespaces --- src/tests/TestNoMetaStructureAdapter.hpp | 1 - src/tests/TestOverlapCalculator.hpp | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/tests/TestNoMetaStructureAdapter.hpp b/src/tests/TestNoMetaStructureAdapter.hpp index 09194799..aabf5dd0 100644 --- a/src/tests/TestNoMetaStructureAdapter.hpp +++ b/src/tests/TestNoMetaStructureAdapter.hpp @@ -28,7 +28,6 @@ #include "test_custompqconfig.hpp" using namespace std; -using namespace boost; using namespace diffpy::srreal; ////////////////////////////////////////////////////////////////////////////// diff --git a/src/tests/TestOverlapCalculator.hpp b/src/tests/TestOverlapCalculator.hpp index 80c24807..53654bfe 100644 --- a/src/tests/TestOverlapCalculator.hpp +++ b/src/tests/TestOverlapCalculator.hpp @@ -156,7 +156,6 @@ class TestOverlapCalculator : public CxxTest::TestSuite void test_bccTouch() { - using namespace boost; PeriodicStructureAdapterPtr bcc(new PeriodicStructureAdapter); bcc->setLatPar(2.0, 2.0, 2.0, 90, 90, 90); Atom a; @@ -226,7 +225,6 @@ class TestOverlapCalculator : public CxxTest::TestSuite void test_NaCl_gradient() { - using namespace boost; molc->eval(mnacl); // default gradients are all zero std::vector g = molc->gradients(); From 377dc938effe0e40bfd60a58d90e62c43f5f28e3 Mon Sep 17 00:00:00 2001 From: symscae Date: Sun, 21 Jun 2026 12:40:59 -0700 Subject: [PATCH 7/7] cleanup boost headers --- src/diffpy/srreal/StructureAdapter.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/diffpy/srreal/StructureAdapter.hpp b/src/diffpy/srreal/StructureAdapter.hpp index 9f50dd75..74b5ea56 100644 --- a/src/diffpy/srreal/StructureAdapter.hpp +++ b/src/diffpy/srreal/StructureAdapter.hpp @@ -22,7 +22,6 @@ #include #include -#include #include #include #include