From 486eb286228e21604f2acdcb20c1d025960c9963 Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Thu, 25 Jan 2024 15:45:24 -0800 Subject: [PATCH 01/10] Remove unused boost headers --- src/Boundary/ConstantBoundary.cc | 2 -- src/Boundary/InflowOutflowBoundary.cc | 1 - 2 files changed, 3 deletions(-) diff --git a/src/Boundary/ConstantBoundary.cc b/src/Boundary/ConstantBoundary.cc index a1a598d8a..cfdaf7f86 100644 --- a/src/Boundary/ConstantBoundary.cc +++ b/src/Boundary/ConstantBoundary.cc @@ -15,8 +15,6 @@ #include "Boundary/ConstantBoundary.hh" #include "Boundary/ConstantBoundaryUtilities.hh" -#include "boost/algorithm/string.hpp" - using std::vector; using std::map; using std::string; diff --git a/src/Boundary/InflowOutflowBoundary.cc b/src/Boundary/InflowOutflowBoundary.cc index ee74624ed..dc83c4ff7 100644 --- a/src/Boundary/InflowOutflowBoundary.cc +++ b/src/Boundary/InflowOutflowBoundary.cc @@ -19,7 +19,6 @@ #include "Boundary/ConstantBoundaryUtilities.hh" #include "boost/lexical_cast.hpp" -#include "boost/algorithm/string.hpp" using std::vector; using std::map; From 67a4b3a555cf1763322892c3977321ef6785f5eb Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Thu, 25 Jan 2024 16:59:02 -0800 Subject: [PATCH 02/10] Remove more boost --- src/Boundary/InflowOutflowBoundary.cc | 4 ++-- src/Boundary/ReflectingBoundary.hh | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Boundary/InflowOutflowBoundary.cc b/src/Boundary/InflowOutflowBoundary.cc index dc83c4ff7..76fcbfaa5 100644 --- a/src/Boundary/InflowOutflowBoundary.cc +++ b/src/Boundary/InflowOutflowBoundary.cc @@ -18,7 +18,7 @@ #include "Boundary/InflowOutflowBoundary.hh" #include "Boundary/ConstantBoundaryUtilities.hh" -#include "boost/lexical_cast.hpp" +#include using std::vector; using std::map; @@ -515,7 +515,7 @@ InflowOutflowBoundary::clearStoredValues() { template std::string InflowOutflowBoundary::label() const { - return "InflowOutflowBoundary" + boost::lexical_cast(mBoundaryCount); + return "InflowOutflowBoundary" + std::to_string(mBoundaryCount); } //------------------------------------------------------------------------------ diff --git a/src/Boundary/ReflectingBoundary.hh b/src/Boundary/ReflectingBoundary.hh index c85ec770f..a96dcbdc9 100644 --- a/src/Boundary/ReflectingBoundary.hh +++ b/src/Boundary/ReflectingBoundary.hh @@ -11,7 +11,6 @@ #include "Boundary/Boundary.hh" #include "Boundary/PlanarBoundary.hh" #include "RK/RKCorrectionParams.hh" -#include "boost/unordered_map.hpp" #include "Eigen/Sparse" @@ -99,7 +98,7 @@ public: private: //--------------------------- Private Interface ---------------------------// Tensor mReflectOperator; - boost::unordered_map> mrkReflectOperators; + std::unordered_map> mrkReflectOperators; }; } From 470bdc4c599cb33582b2e2fe55932eb1667d4253 Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Thu, 25 Jan 2024 17:12:35 -0800 Subject: [PATCH 03/10] Remove more boost --- src/Damage/IvanoviSALEDamageModel.cc | 2 -- src/DataBase/StateBase.cc | 42 ++++++++++++++-------------- src/DataBase/StateBase.hh | 7 ++--- src/DataBase/StateBaseInline.hh | 6 ++-- src/DataBase/StateDerivatives.cc | 12 ++++---- 5 files changed, 33 insertions(+), 36 deletions(-) diff --git a/src/Damage/IvanoviSALEDamageModel.cc b/src/Damage/IvanoviSALEDamageModel.cc index 92dd1aba8..ff64baba5 100644 --- a/src/Damage/IvanoviSALEDamageModel.cc +++ b/src/Damage/IvanoviSALEDamageModel.cc @@ -40,8 +40,6 @@ #include "Utilities/allReduce.hh" #include "Utilities/uniform_random.hh" -#include // hash_combine - #include #include #include diff --git a/src/DataBase/StateBase.cc b/src/DataBase/StateBase.cc index c11aa57dd..1dc4094f5 100644 --- a/src/DataBase/StateBase.cc +++ b/src/DataBase/StateBase.cc @@ -30,11 +30,11 @@ namespace Spheral { // //------------------------------------------------------------------------------ // template // T* -// extractType(boost::any& anyT) { +// extractType(std::any& anyT) { // try { -// T* result = boost::any_cast(anyT); +// T* result = std::any_cast(anyT); // return result; -// } catch (boost::any_cast_error) { +// } catch (std::any_cast_error) { // return NULL; // } // } @@ -125,21 +125,21 @@ operator==(const StateBase& rhs) const { rhsItr != rhs.mStorage.end(); ++rhsItr, ++lhsItr) { try { - auto lhsPtr = boost::any_cast*>(lhsItr->second); - auto rhsPtr = boost::any_cast*>(rhsItr->second); + auto lhsPtr = std::any_cast*>(lhsItr->second); + auto rhsPtr = std::any_cast*>(rhsItr->second); if (*lhsPtr != *rhsPtr) { cerr << "Fields for " << lhsItr->first << " don't match." << endl; result = false; } - } catch (const boost::bad_any_cast&) { + } catch (const std::bad_any_cast&) { try { - auto lhsPtr = boost::any_cast*>(lhsItr->second); - auto rhsPtr = boost::any_cast*>(rhsItr->second); + auto lhsPtr = std::any_cast*>(lhsItr->second); + auto rhsPtr = std::any_cast*>(rhsItr->second); if (*lhsPtr != *rhsPtr) { cerr << "vector for " << lhsItr->first << " don't match." << endl; result = false; } - } catch (const boost::bad_any_cast&) { + } catch (const std::bad_any_cast&) { std::cerr << "StateBase::operator== WARNING: unable to compare values for " << lhsItr->first << "\n"; } } @@ -205,7 +205,7 @@ void StateBase:: enroll(FieldBase& field) { const KeyType key = this->key(field); - boost::any fieldptr; + std::any fieldptr; fieldptr = &field; mStorage[key] = fieldptr; mNodeListPtrs.insert(field.nodeListPtr()); @@ -382,15 +382,15 @@ assign(const StateBase& rhs) { auto& anylhs = mStorage[itr->first]; const auto& anyrhs = itr->second; try { - auto lhsptr = boost::any_cast*>(anylhs); - const auto rhsptr = boost::any_cast*>(anyrhs); + auto lhsptr = std::any_cast*>(anylhs); + const auto rhsptr = std::any_cast*>(anyrhs); *lhsptr = *rhsptr; - } catch(const boost::bad_any_cast&) { + } catch(const std::bad_any_cast&) { try { - auto lhsptr = boost::any_cast*>(anylhs); - const auto rhsptr = boost::any_cast*>(anyrhs); + auto lhsptr = std::any_cast*>(anylhs); + const auto rhsptr = std::any_cast*>(anyrhs); *lhsptr = *rhsptr; - } catch(const boost::bad_any_cast&) { + } catch(const std::bad_any_cast&) { // We'll assume other things don't need to be assigned... // VERIFY2(false, "StateBase::assign ERROR: unknown type for key " << itr->first << "\n"); } @@ -430,22 +430,22 @@ copyState() { for (auto itr = mStorage.begin(); itr != mStorage.end(); ++itr) { - boost::any anythingPtr = itr->second; + std::any anythingPtr = itr->second; // Is this a Field? try { - auto ptr = boost::any_cast*>(anythingPtr); + auto ptr = std::any_cast*>(anythingPtr); mFieldCache.push_back(ptr->clone()); itr->second = mFieldCache.back().get(); - } catch (const boost::bad_any_cast&) { + } catch (const std::bad_any_cast&) { try { - auto ptr = boost::any_cast*>(anythingPtr); + auto ptr = std::any_cast*>(anythingPtr); auto clone = std::shared_ptr>(new vector(*ptr)); mCache.push_back(clone); itr->second = clone.get(); - } catch (const boost::bad_any_cast&) { + } catch (const std::bad_any_cast&) { // We'll assume other things don't need to be copied... // VERIFY2(false, "StateBase::copyState ERROR: unrecognized type for " << itr->first << "\n"); } diff --git a/src/DataBase/StateBase.hh b/src/DataBase/StateBase.hh index e78cbea4b..73c6df8cd 100644 --- a/src/DataBase/StateBase.hh +++ b/src/DataBase/StateBase.hh @@ -18,8 +18,7 @@ #include "Field/FieldBase.hh" -#include "boost/any.hpp" - +#include #include #include #include @@ -162,9 +161,9 @@ public: protected: //--------------------------- Protected Interface ---------------------------// - typedef std::map StorageType; + typedef std::map StorageType; typedef std::list>> FieldCacheType; - typedef std::list CacheType; + typedef std::list CacheType; // Protected data. StorageType mStorage; diff --git a/src/DataBase/StateBaseInline.hh b/src/DataBase/StateBaseInline.hh index 4b60520ce..77759fa6a 100644 --- a/src/DataBase/StateBaseInline.hh +++ b/src/DataBase/StateBaseInline.hh @@ -36,7 +36,7 @@ allFields(const Value&) const { itr != mStorage.end(); ++itr) { try { - Field* ptr = dynamic_cast*>(boost::any_cast*>(itr->second)); + Field* ptr = dynamic_cast*>(std::any_cast*>(itr->second)); if (ptr != 0) result.push_back(ptr); } catch (...) { // The field must have been the wrong type. @@ -88,9 +88,9 @@ Value& StateBase:: getAny(const typename StateBase::KeyType& key) const { try { - Value& result = *boost::any_cast(mStorage.find(key)->second); + Value& result = *std::any_cast(mStorage.find(key)->second); return result; - } catch (const boost::bad_any_cast&) { + } catch (const std::bad_any_cast&) { VERIFY2(false, "StateBase::getAny ERROR: unable to extract Value for " << key << "\n"); } } diff --git a/src/DataBase/StateDerivatives.cc b/src/DataBase/StateDerivatives.cc index e7e54ee23..540942622 100644 --- a/src/DataBase/StateDerivatives.cc +++ b/src/DataBase/StateDerivatives.cc @@ -164,20 +164,20 @@ Zero() { ++itr) { try { - auto ptr = boost::any_cast*>(itr->second); + auto ptr = std::any_cast*>(itr->second); ptr->Zero(); - } catch (const boost::bad_any_cast&) { + } catch (const std::bad_any_cast&) { try { - auto ptr = boost::any_cast*>(itr->second); + auto ptr = std::any_cast*>(itr->second); ptr->clear(); - } catch (const boost::bad_any_cast&) { + } catch (const std::bad_any_cast&) { try { - auto ptr = boost::any_cast*>(itr->second); + auto ptr = std::any_cast*>(itr->second); ptr->clear(); - } catch (const boost::bad_any_cast&) { + } catch (const std::bad_any_cast&) { VERIFY2(false, "StateDerivatives::Zero ERROR: unknown type for key " << itr->first << "\n"); } } From 76de1e1c74cc0e82e4061ee41477e5b5ed27de37 Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Fri, 26 Jan 2024 08:05:54 -0800 Subject: [PATCH 04/10] Remove more unused boost headers --- src/Distributed/VoronoiRedistributeNodes.cc | 2 -- src/FractalStruct/libs.hh | 1 - src/Geometry/RankNTensorInline.hh | 1 - src/Geometry/invertRankNTensor.cc | 1 - src/KernelIntegrator/BilinearIndex.hh | 3 --- src/SolidMaterial/ANEOS.cc | 1 - src/SolidMaterial/Geodyn.hh | 2 -- src/SolidMaterial/PhysicsEvolvingMaterialLibrary.hh | 2 -- 8 files changed, 13 deletions(-) diff --git a/src/Distributed/VoronoiRedistributeNodes.cc b/src/Distributed/VoronoiRedistributeNodes.cc index 1ab00f530..8b38cafe8 100644 --- a/src/Distributed/VoronoiRedistributeNodes.cc +++ b/src/Distributed/VoronoiRedistributeNodes.cc @@ -47,8 +47,6 @@ using std::min; using std::max; using std::abs; -#include - namespace Spheral { diff --git a/src/FractalStruct/libs.hh b/src/FractalStruct/libs.hh index 8f585d53c..cbd16ed28 100755 --- a/src/FractalStruct/libs.hh +++ b/src/FractalStruct/libs.hh @@ -18,7 +18,6 @@ #include #include #include -#include #include "fftw3-mpi.h" #include "_hypre_utilities.h" #include "HYPRE_krylov.h" diff --git a/src/Geometry/RankNTensorInline.hh b/src/Geometry/RankNTensorInline.hh index dddfbf6f3..7b76d4368 100644 --- a/src/Geometry/RankNTensorInline.hh +++ b/src/Geometry/RankNTensorInline.hh @@ -1,7 +1,6 @@ #include #include #include -#include "boost/static_assert.hpp" #include "Utilities/SpheralFunctions.hh" #include "Utilities/DBC.hh" diff --git a/src/Geometry/invertRankNTensor.cc b/src/Geometry/invertRankNTensor.cc index 0d9676a81..f7df6b872 100644 --- a/src/Geometry/invertRankNTensor.cc +++ b/src/Geometry/invertRankNTensor.cc @@ -7,7 +7,6 @@ #include #include -#include "boost/static_assert.hpp" #include #include "Eigen/Dense" diff --git a/src/KernelIntegrator/BilinearIndex.hh b/src/KernelIntegrator/BilinearIndex.hh index 8dbe8b7d9..f8118694a 100644 --- a/src/KernelIntegrator/BilinearIndex.hh +++ b/src/KernelIntegrator/BilinearIndex.hh @@ -8,7 +8,6 @@ #include #include -// #include #include "DataBase/DataBase.hh" #include "Field/FieldList.hh" @@ -30,7 +29,6 @@ public: // Typedefs for bilinear indexing typedef typename std::pair Pair; typedef typename std::unordered_map> MapPair; - // typedef typename std::unordered_map> MapPair; typedef typename std::vector VectorPair; typedef FieldList PairToFlat; typedef FieldList FlatToPair; @@ -38,7 +36,6 @@ public: // Typedefs for surface indexing typedef typename std::array ArrayDim; typedef typename std::unordered_map> MapNormal; - // typedef typename std::unordered_map> MapNormal; typedef typename std::vector NormalType; typedef FieldList NormalToFlat; typedef FieldList FlatToNormal; diff --git a/src/SolidMaterial/ANEOS.cc b/src/SolidMaterial/ANEOS.cc index a54d8fbcf..817badc55 100644 --- a/src/SolidMaterial/ANEOS.cc +++ b/src/SolidMaterial/ANEOS.cc @@ -14,7 +14,6 @@ #include "Utilities/bisectRoot.hh" #include "Utilities/DBC.hh" -#include "boost/multi_array.hpp" #include #include using std::vector; diff --git a/src/SolidMaterial/Geodyn.hh b/src/SolidMaterial/Geodyn.hh index c6682004b..4c406d46a 100644 --- a/src/SolidMaterial/Geodyn.hh +++ b/src/SolidMaterial/Geodyn.hh @@ -14,8 +14,6 @@ #ifndef __Spheral_Geodyn_hh__ #define __Spheral_Geodyn_hh__ -#include "boost/multi_array.hpp" - #include "SolidMaterial/SolidEquationOfState.hh" #include "SolidMaterial/StrengthModel.hh" #include "Physics/Physics.hh" diff --git a/src/SolidMaterial/PhysicsEvolvingMaterialLibrary.hh b/src/SolidMaterial/PhysicsEvolvingMaterialLibrary.hh index ae0506856..e3111e8b9 100644 --- a/src/SolidMaterial/PhysicsEvolvingMaterialLibrary.hh +++ b/src/SolidMaterial/PhysicsEvolvingMaterialLibrary.hh @@ -20,8 +20,6 @@ #include "SolidMaterial/StrengthModel.hh" #include "Physics/Physics.hh" -#include "boost/multi_array.hpp" - namespace Spheral { template From ce0858bb2697414e917bec1611d0e11097fbafd2 Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Fri, 26 Jan 2024 09:44:53 -0800 Subject: [PATCH 05/10] Remove more boost --- src/Neighbor/NodePairList.hh | 3 --- src/Utilities/Tree.hh | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Neighbor/NodePairList.hh b/src/Neighbor/NodePairList.hh index 51c4077a1..ab40cee5f 100644 --- a/src/Neighbor/NodePairList.hh +++ b/src/Neighbor/NodePairList.hh @@ -9,7 +9,6 @@ #include #include #include -// #include // These are based on what we get from size_t_bits #define MAX_NODE_INDEX (size_t(1u) << ((SIZE_T_BITS - 10)/2)) @@ -103,8 +102,6 @@ namespace std { struct hash { size_t operator()(const Spheral::NodePairIdxType& x) const { return x.hash(); - // boost::hash> hasher; - // return hasher(std::make_tuple(x.i_node, x.i_list, x.j_node, x.j_list)); } }; } // namespace std diff --git a/src/Utilities/Tree.hh b/src/Utilities/Tree.hh index 331e81a52..5940490e8 100644 --- a/src/Utilities/Tree.hh +++ b/src/Utilities/Tree.hh @@ -15,7 +15,7 @@ #include #include -#include "boost/unordered_map.hpp" +#include #include "NullCellValue.hh" #include "UniqueNodeLeaf.hh" @@ -88,7 +88,7 @@ public: //--------------------------- Private Interface ----------------------------// // Define the types we use to build the tree. - typedef boost::unordered_map TreeLevel; + typedef std::unordered_map TreeLevel; typedef std::vector Tree; // Private data. From 8ab85b081f861376821a7e578924d77f810a0ed4 Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Fri, 26 Jan 2024 10:02:18 -0800 Subject: [PATCH 06/10] Remove more boost --- src/Utilities/timingUtilities.hh | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Utilities/timingUtilities.hh b/src/Utilities/timingUtilities.hh index 68cfde543..91ecb0659 100644 --- a/src/Utilities/timingUtilities.hh +++ b/src/Utilities/timingUtilities.hh @@ -5,8 +5,6 @@ // // JMO: Tue Dec 9 10:31:14 PST 2008 //------------------------------------------------------------------------------ -// #define BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG // Enable nanosecond timings. -// #include #include // C++11 namespace Spheral { From d952cc881736fd7e615dc4449986e99b49f93dc1 Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Fri, 26 Jan 2024 11:05:53 -0800 Subject: [PATCH 07/10] Remove more boost --- src/Gravity/Tree.hh | 4 ++-- src/Gravity/TreeGravity.hh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Gravity/Tree.hh b/src/Gravity/Tree.hh index 8446e09a1..c88063ff4 100644 --- a/src/Gravity/Tree.hh +++ b/src/Gravity/Tree.hh @@ -15,7 +15,7 @@ #include #include "boost/unordered_map.hpp" -#include "boost/unordered_set.hpp" +#include namespace Spheral { @@ -59,7 +59,7 @@ public: // Data types we use to build the internal tree structure. typedef uint32_t LevelKey; typedef std::pair NodeID; - typedef boost::unordered_map > > CompletedCellSet; + typedef boost::unordered_map > > CompletedCellSet; typedef boost::unordered_map TreeLevel; static unsigned num1dbits; // The number of bits we quantize 1D coordinates to. We have to fit three of these in 64 bits. diff --git a/src/Gravity/TreeGravity.hh b/src/Gravity/TreeGravity.hh index 6bf3c8627..bdefae11a 100644 --- a/src/Gravity/TreeGravity.hh +++ b/src/Gravity/TreeGravity.hh @@ -13,7 +13,7 @@ #include #include "boost/unordered_map.hpp" -#include "boost/unordered_set.hpp" +#include namespace Spheral { @@ -132,7 +132,7 @@ private: typedef uint32_t LevelKey; typedef uint64_t CellKey; typedef std::pair NodeID; - typedef boost::unordered_map > > CompletedCellSet; + typedef boost::unordered_map > > CompletedCellSet; static unsigned num1dbits; // The number of bits we quantize 1D coordinates to. We have to fit three of these in 64 bits. static CellKey max1dKey; // The maximum number of cells this corresponds to in a direction. From d4170fe99f50e69acde344aa07b3c26c28b5dee1 Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Fri, 26 Jan 2024 11:35:56 -0800 Subject: [PATCH 08/10] Remove more boost --- src/Gravity/TreeGravity.cc | 2 +- src/Mesh/MeshConstructionUtilities.hh | 4 ---- src/PYB11/Gravity/Tree.py | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Gravity/TreeGravity.cc b/src/Gravity/TreeGravity.cc index 9c8a95073..d6beb8d45 100644 --- a/src/Gravity/TreeGravity.cc +++ b/src/Gravity/TreeGravity.cc @@ -178,7 +178,7 @@ evaluateDerivatives(const typename Dimension::Scalar /*time*/, CompletedCellSet cellsCompleted; for (unsigned nodeListi = 0; nodeListi != mass.numFields(); ++nodeListi) { for (unsigned i = 0; i != mass[nodeListi]->numInternalElements(); ++i) { - cellsCompleted[NodeID(nodeListi, i)] = vector >(num1dbits); + cellsCompleted[NodeID(nodeListi, i)] = vector >(num1dbits); } } diff --git a/src/Mesh/MeshConstructionUtilities.hh b/src/Mesh/MeshConstructionUtilities.hh index a475afef0..3cc572a01 100644 --- a/src/Mesh/MeshConstructionUtilities.hh +++ b/src/Mesh/MeshConstructionUtilities.hh @@ -235,7 +235,6 @@ collapseDegenerateVertices(const std::vector& vertices, const Vector& xmax, const Vector& boxInv, const Uint tol) { - using namespace boost; typedef std::tuple Key; using std::vector; using std::set; @@ -330,7 +329,6 @@ exchangeTuples(const std::vector >& localKeys, CONTRACT_VAR(neighborDomains); CONTRACT_VAR(neighborKeys); #ifdef USE_MPI - using namespace boost; typedef std::tuple Key; using std::vector; @@ -395,7 +393,6 @@ exchangeTuples(const std::vector >& localKeys, CONTRACT_VAR(sendIndices); CONTRACT_VAR(neighborKeys); #ifdef USE_MPI - using namespace boost; typedef std::tuple Key; const unsigned numNeighborDomains = neighborDomains.size(); @@ -781,7 +778,6 @@ inline std::tuple hashEdge(const std::tuple& hashi, const std::tuple& hashj) { - using namespace boost; return (hashi < hashj ? std::make_tuple(std::get<0>(hashi), std::get<1>(hashi), std::get<2>(hashi), std::get<0>(hashj), std::get<1>(hashj), std::get<2>(hashj)) : diff --git a/src/PYB11/Gravity/Tree.py b/src/PYB11/Gravity/Tree.py index 57b012839..46888049c 100644 --- a/src/PYB11/Gravity/Tree.py +++ b/src/PYB11/Gravity/Tree.py @@ -16,7 +16,7 @@ class Tree: typedef uint64_t CellKey; typedef uint32_t LevelKey; typedef std::pair NodeID; - typedef boost::unordered_map > > CompletedCellSet; + typedef boost::unordered_map > > CompletedCellSet; // typedef boost::unordered_map TreeLevel; """ From 7fe2cbe372c325649992f0fc3a14d10c6cc4e575 Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Fri, 26 Jan 2024 12:08:18 -0800 Subject: [PATCH 09/10] Remove boost from tests --- tests/unit/Utilities/testFastMath.cc | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/tests/unit/Utilities/testFastMath.cc b/tests/unit/Utilities/testFastMath.cc index c287b175a..e264be5c7 100644 --- a/tests/unit/Utilities/testFastMath.cc +++ b/tests/unit/Utilities/testFastMath.cc @@ -1,8 +1,9 @@ +#include +#include +#include +#include #include #include -#include - -#include "boost/random.hpp" #include "Utilities/FastMath.hh" #include "Utilities/DBC.hh" @@ -13,21 +14,19 @@ int main(int argc, char* argv[]) { // Make some random number generators. // Doubles. - typedef boost::mt19937 BaseGenerator; - typedef boost::uniform_real DoubleDistribution; - typedef boost::variate_generator DoubleRandomGenerator; - BaseGenerator baseGen; - DoubleRandomGenerator unitDoubleGenerator(baseGen, DoubleDistribution(0.0, 1.0)); - DoubleRandomGenerator tinyDoubleGenerator(baseGen, DoubleDistribution(0.0, 1.0e-20)); - DoubleRandomGenerator hugeDoubleGenerator(baseGen, DoubleDistribution(0.0, sqrt(numeric_limits::max()))); + std::random_device rd; + std::mt19937 generator(rd()); + std::uniform_real_distribution unitDoubleDistribution(0.0, 1.0); + std::uniform_real_distribution tinyDoubleDistribution(0.0, 1.0e-20); + std::uniform_real_distribution hugeDoubleDistribution(0.0, sqrt(numeric_limits::max())); // Make a big ass vector of doubles. const int n = 10000; cerr << "Generating random input..." << endl; vector xinput(3*n); - for (int i = 0; i != n; ++i) xinput[i] = unitDoubleGenerator(); - for (int i = n; i != 2*n; ++i) xinput[i] = tinyDoubleGenerator(); - for (int i = 2*n; i != 3*n; ++i) xinput[i] = hugeDoubleGenerator(); + for (int i = 0; i != n; ++i) xinput[i] = unitDoubleDistribution(generator); + for (int i = n; i != 2*n; ++i) xinput[i] = tinyDoubleDistribution(generator); + for (int i = 2*n; i != 3*n; ++i) xinput[i] = hugeDoubleDistribution(generator); //=========================================================================== // Check the correctness of sqrt. From 3281fdb1451b55110cad29f4589e591614ba7443 Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Fri, 26 Jan 2024 12:09:09 -0800 Subject: [PATCH 10/10] Clean up --- tests/unit/Utilities/testFastMath.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/Utilities/testFastMath.cc b/tests/unit/Utilities/testFastMath.cc index e264be5c7..c02b75f3f 100644 --- a/tests/unit/Utilities/testFastMath.cc +++ b/tests/unit/Utilities/testFastMath.cc @@ -20,7 +20,7 @@ int main(int argc, char* argv[]) { std::uniform_real_distribution tinyDoubleDistribution(0.0, 1.0e-20); std::uniform_real_distribution hugeDoubleDistribution(0.0, sqrt(numeric_limits::max())); - // Make a big ass vector of doubles. + // Make a big vector of doubles. const int n = 10000; cerr << "Generating random input..." << endl; vector xinput(3*n);