diff --git a/src/bin/libint/algebra.cc b/src/bin/libint/algebra.cc index a80c7da05..34419475b 100644 --- a/src/bin/libint/algebra.cc +++ b/src/bin/libint/algebra.cc @@ -25,7 +25,7 @@ namespace libint2 { template <> void - AlgebraicOperator::add_exit_arc(const SafePtr& a) + AlgebraicOperator::add_exit_arc(const std::shared_ptr& a) { DGVertex::add_exit_arc(a); #if CHECK_SAFETY diff --git a/src/bin/libint/algebra.h b/src/bin/libint/algebra.h index e4af9e079..8d374a175 100644 --- a/src/bin/libint/algebra.h +++ b/src/bin/libint/algebra.h @@ -54,8 +54,8 @@ namespace libint2 { typedef algebra::OperatorTypes::OperatorType OperatorType; AlgebraicOperator(OperatorType OT, - const SafePtr& left, - const SafePtr& right) : + const std::shared_ptr& left, + const std::shared_ptr& right) : DGVertex(ClassInfo::Instance().id()), OT_(OT), left_(left), right_(right), label_(algebra::OperatorSymbol[OT_]) { @@ -63,9 +63,9 @@ namespace libint2 { virtual ~AlgebraicOperator() {} /// Clone A but replace operands with left and right - AlgebraicOperator(const SafePtr& A, - const SafePtr& left, - const SafePtr& right) : + AlgebraicOperator(const std::shared_ptr& A, + const std::shared_ptr& left, + const std::shared_ptr& right) : DGVertex(static_cast(*A)), OT_(A->OT_), left_(left), right_(right), label_(A->label_) { @@ -90,16 +90,16 @@ namespace libint2 { /// Returns the OperatorType OperatorType type() const { return OT_; } /// Returns the left argument - const SafePtr& left() const { return left_; } + const std::shared_ptr& left() const { return left_; } /// Returns the right argument - const SafePtr& right() const { return right_; } + const std::shared_ptr& right() const { return right_; } /// Overloads DGVertex::add_exit_arc(). The default definition is used unless T = DGVertex (see algebra.cc) - void add_exit_arc(const SafePtr& a) override; + void add_exit_arc(const std::shared_ptr& a) override; /// Implements DGVertex::size() unsigned int size() const override { return 1; } /// Implements DGVertex::equiv() - bool equiv(const SafePtr& a) const override + bool equiv(const std::shared_ptr& a) const override { if (typeid_ == a->typeid_) { #if ALGEBRAICOPERATOR_USE_KEY_TO_COMPARE @@ -120,7 +120,7 @@ namespace libint2 { } /// laboriously compare 2 operators element by element - bool operator==(const SafePtr& a) const { + bool operator==(const std::shared_ptr& a) const { #if ALGEBRAICOPERATOR_USE_SAFEPTR // Find out why sometimes equivalent left_ and a->left_ have non-equivalent pointers if (left_->equiv(a->left()) && left_ != a->left_) { @@ -189,8 +189,8 @@ namespace libint2 { private: OperatorType OT_; - SafePtr left_; - SafePtr right_; + std::shared_ptr left_; + std::shared_ptr right_; /// Implements DGVertex::this_precomputed() bool this_precomputed() const override @@ -204,7 +204,7 @@ namespace libint2 { /* template <> void - AlgebraicOperator::add_exit_arc(const SafePtr& a) + AlgebraicOperator::add_exit_arc(const std::shared_ptr& a) { DGVertex::add_exit_arc(a); if (left_->equiv(a->dest())) diff --git a/src/bin/libint/bfset.h b/src/bin/libint/bfset.h index 51a9f4545..7b619adde 100644 --- a/src/bin/libint/bfset.h +++ b/src/bin/libint/bfset.h @@ -37,7 +37,7 @@ namespace libint2 { /** Set of basis functions. Sets must be constructable using - SafePtr or SafePtr. + std::shared_ptr or std::shared_ptr. */ class BFSet : public ConstructablePolymorphically { @@ -52,7 +52,7 @@ namespace libint2 { }; /** Set of basis functions with incrementable/decrementable quantum numbers. - Sets must be constructable using SafePtr or SafePtr. + Sets must be constructable using std::shared_ptr or std::shared_ptr. Call to dec() may invalidate the object. No further modification of such object's state is possible. diff --git a/src/bin/libint/build_libint.cc b/src/bin/libint/build_libint.cc index 448350e3b..dda36e7d7 100644 --- a/src/bin/libint/build_libint.cc +++ b/src/bin/libint/build_libint.cc @@ -194,39 +194,39 @@ int main(int argc, char* argv[]) static void print_header(std::ostream& os); static void print_config(std::ostream& os); // Put all configuration-specific API elements in here -static void config_to_api(const SafePtr& cparams, SafePtr& iface); +static void config_to_api(const std::shared_ptr& cparams, std::shared_ptr& iface); #ifdef INCLUDE_ERI #define USE_GENERIC_ERI_BUILD 1 # if !USE_GENERIC_ERI_BUILD -static void build_TwoPRep_2b_2k(std::ostream& os, const SafePtr& cparams, - SafePtr& iface); +static void build_TwoPRep_2b_2k(std::ostream& os, const std::shared_ptr& cparams, + std::shared_ptr& iface); # else -static void build_TwoPRep_2b_2k(std::ostream& os, const SafePtr& cparams, - SafePtr& iface, unsigned int deriv_level); +static void build_TwoPRep_2b_2k(std::ostream& os, const std::shared_ptr& cparams, + std::shared_ptr& iface, unsigned int deriv_level); # endif #endif #ifdef INCLUDE_ERI3 -static void build_TwoPRep_1b_2k(std::ostream& os, const SafePtr& cparams, - SafePtr& iface, unsigned int deriv_level); +static void build_TwoPRep_1b_2k(std::ostream& os, const std::shared_ptr& cparams, + std::shared_ptr& iface, unsigned int deriv_level); #endif #ifdef INCLUDE_ERI2 -static void build_TwoPRep_1b_1k(std::ostream& os, const SafePtr& cparams, - SafePtr& iface, unsigned int deriv_level); +static void build_TwoPRep_1b_1k(std::ostream& os, const std::shared_ptr& cparams, + std::shared_ptr& iface, unsigned int deriv_level); #endif #ifdef INCLUDE_G12 -static void build_R12kG12_2b_2k(std::ostream& os, const SafePtr& cparams, - SafePtr& iface); -static void build_R12kG12_2b_2k_separate(std::ostream& os, const SafePtr& cparams, - SafePtr& iface); +static void build_R12kG12_2b_2k(std::ostream& os, const std::shared_ptr& cparams, + std::shared_ptr& iface); +static void build_R12kG12_2b_2k_separate(std::ostream& os, const std::shared_ptr& cparams, + std::shared_ptr& iface); #endif #ifdef INCLUDE_G12DKH -static void build_G12DKH_2b_2k(std::ostream& os, const SafePtr& cparams, - SafePtr& iface); +static void build_G12DKH_2b_2k(std::ostream& os, const std::shared_ptr& cparams, + std::shared_ptr& iface); #endif #ifdef INCLUDE_ONEBODY @@ -263,8 +263,8 @@ namespace { template void -build_onebody_1b_1k(std::ostream& os, std::string label, const SafePtr& cparams, - SafePtr& iface, unsigned int deriv_level) +build_onebody_1b_1k(std::ostream& os, std::string label, const std::shared_ptr& cparams, + std::shared_ptr& iface, unsigned int deriv_level) { // implement overlap as a special case of cartesian emultipole using OperType = typename std::conditional::value,CartesianMultipoleOper<3u>,_OperType>::type; @@ -310,10 +310,10 @@ build_onebody_1b_1k(std::ostream& os, std::string label, const SafePtr dg(new DirectedGraph); - SafePtr strat(new Strategy()); - SafePtr context(new CppCodeContext(cparams)); - SafePtr memman(new WorstFitMemoryManager()); + std::shared_ptr dg(new DirectedGraph); + std::shared_ptr strat(new Strategy()); + std::shared_ptr context(new CppCodeContext(cparams)); + std::shared_ptr memman(new WorstFitMemoryManager()); for(unsigned int la=0; la<=lmax; la++) { for(unsigned int lb=0; lb<=lmax; lb++) { @@ -325,10 +325,10 @@ build_onebody_1b_1k(std::ostream& os, std::string label, const SafePtr tactic(new TwoCenter_OS_Tactic(la,lb)); + std::shared_ptr tactic(new TwoCenter_OS_Tactic(la,lb)); // this will hold all target shell sets - std::vector< SafePtr > targets; + std::vector< std::shared_ptr > targets; ///////////////////////////////// // loop over operator components @@ -397,7 +397,7 @@ build_onebody_1b_1k(std::ostream& os, std::string label, const SafePtr target = Onebody_sh_1_1::Instance(a,b,nullaux,oper); + std::shared_ptr target = Onebody_sh_1_1::Instance(a,b,nullaux,oper); targets.push_back(target); } // loop over operator components @@ -422,7 +422,7 @@ build_onebody_1b_1k(std::ostream& os, std::string label, const SafePtr t_ptr = dynamic_pointer_cast(*t); + std::shared_ptr t_ptr = dynamic_pointer_cast(*t); dg->append_target(t_ptr); } @@ -451,7 +451,7 @@ build_onebody_1b_1k(std::ostream& os, std::string label, const SafePtr& tparams = taskmgr.current().params(); + const std::shared_ptr& tparams = taskmgr.current().params(); tparams->max_stack_size(max_am, memman->max_memory_used()); tparams->max_ntarget(targets.size()); //os << " Max memory used = " << memman->max_memory_used() << std::endl; @@ -557,7 +557,7 @@ BOOST_PP_LIST_FOR_EACH ( BOOST_PP_ONEBODY_MCR1, _, BOOST_PP_ONEBODY_TASK_LIST) #endif // use default parameters - SafePtr cparams(new CompilationParameters); + std::shared_ptr cparams(new CompilationParameters); cparams->max_am("default",LIBINT_MAX_AM); cparams->max_am_opt("default",LIBINT_OPT_AM); @@ -750,9 +750,9 @@ BOOST_PP_LIST_FOR_EACH ( BOOST_PP_ONEBODY_MCR1, _, BOOST_PP_ONEBODY_TASK_LIST) #endif // initialize code context to produce library API - SafePtr icontext(new CppCodeContext(cparams)); + std::shared_ptr icontext(new CppCodeContext(cparams)); // initialize object to generate interface - SafePtr iface(new Libint2Iface(cparams,icontext)); + std::shared_ptr iface(new Libint2Iface(cparams,icontext)); print_header(os); print_config(os); @@ -860,7 +860,7 @@ BOOST_PP_LIST_FOR_EACH ( BOOST_PP_ONEBODY_MCR1, _, BOOST_PP_ONEBODY_TASK_LIST) typedef LibraryTaskManager::TasksCIter tciter; const tciter tend = taskmgr.plast(); for(tciter t=taskmgr.first(); t!=tend; ++t) { - const SafePtr tsymbols = t->symbols(); + const std::shared_ptr tsymbols = t->symbols(); typedef TaskExternSymbols::SymbolList SymbolList; const SymbolList& symbols = tsymbols->symbols(); // print out the labels @@ -933,8 +933,8 @@ print_config(std::ostream& os) #ifdef INCLUDE_ERI void -build_TwoPRep_2b_2k(std::ostream& os, const SafePtr& cparams, - SafePtr& iface, unsigned int deriv_level) +build_TwoPRep_2b_2k(std::ostream& os, const std::shared_ptr& cparams, + std::shared_ptr& iface, unsigned int deriv_level) { const std::string task = task_label("eri", deriv_level); typedef TwoPRep_11_11_sq TwoPRep_sh_11_11; @@ -958,10 +958,10 @@ build_TwoPRep_2b_2k(std::ostream& os, const SafePtr& cpar // 3) at the end, for each unresolved recurrence relation generate // explicit source code // - SafePtr dg_xxxx(new DirectedGraph); - SafePtr strat(new Strategy()); - SafePtr context(new CppCodeContext(cparams)); - SafePtr memman(new WorstFitMemoryManager()); + std::shared_ptr dg_xxxx(new DirectedGraph); + std::shared_ptr strat(new Strategy()); + std::shared_ptr context(new CppCodeContext(cparams)); + std::shared_ptr memman(new WorstFitMemoryManager()); for(unsigned int la=0; la<=lmax; la++) { for(unsigned int lb=0; lb<=lmax; lb++) { @@ -971,8 +971,8 @@ build_TwoPRep_2b_2k(std::ostream& os, const SafePtr& cpar if (!ShellQuartetSetPredicate(LIBINT_SHELL_SET)>::value(la,lb,lc,ld)) continue; - //SafePtr tactic(new ParticleDirectionTactic(la+lb > lc+ld ? false : true)); - SafePtr tactic(new FourCenter_OS_Tactic(la, lb, lc, ld)); + //std::shared_ptr tactic(new ParticleDirectionTactic(la+lb > lc+ld ? false : true)); + std::shared_ptr tactic(new FourCenter_OS_Tactic(la, lb, lc, ld)); #if STUDY_MEMORY_USAGE const int lim = 1; @@ -1003,7 +1003,7 @@ build_TwoPRep_2b_2k(std::ostream& os, const SafePtr& cpar //////////// // NB translational invariance is now handled by CR_DerivGauss CartesianDerivIterator<4> diter(deriv_level); - std::vector< SafePtr > targets; + std::vector< std::shared_ptr > targets; bool last_deriv = false; do { CGShell a(la); @@ -1020,16 +1020,16 @@ build_TwoPRep_2b_2k(std::ostream& os, const SafePtr& cpar } } - SafePtr abcd = TwoPRep_sh_11_11::Instance(a,b,c,d,mType(0u)); + std::shared_ptr abcd = TwoPRep_sh_11_11::Instance(a,b,c,d,mType(0u)); targets.push_back(abcd); last_deriv = diter.last(); if (!last_deriv) diter.next(); } while (!last_deriv); // append all derivatives as targets to the graph - for(std::vector< SafePtr >::const_iterator t=targets.begin(); + for(std::vector< std::shared_ptr >::const_iterator t=targets.begin(); t != targets.end(); ++t) { - SafePtr t_ptr = dynamic_pointer_cast(*t); + std::shared_ptr t_ptr = dynamic_pointer_cast(*t); dg_xxxx->append_target(t_ptr); } @@ -1041,7 +1041,7 @@ build_TwoPRep_2b_2k(std::ostream& os, const SafePtr& cpar CGShell b(lb); CGShell c(lc); CGShell d(ld); - SafePtr abcd = TwoPRep_sh_11_11::Instance(a,b,c,d,mType(0u)); + std::shared_ptr abcd = TwoPRep_sh_11_11::Instance(a,b,c,d,mType(0u)); abcd_label = abcd->label(); } // + derivative level (if deriv_level > 0) @@ -1068,7 +1068,7 @@ build_TwoPRep_2b_2k(std::ostream& os, const SafePtr& cpar prefix, label, false); // update max stack size and # of targets - const SafePtr& tparams = taskmgr.current().params(); + const std::shared_ptr& tparams = taskmgr.current().params(); tparams->max_stack_size(max_am, memman->max_memory_used()); tparams->max_ntarget(targets.size()); //os << " Max memory used = " << memman->max_memory_used() << std::endl; @@ -1108,8 +1108,8 @@ build_TwoPRep_2b_2k(std::ostream& os, const SafePtr& cpar #ifdef INCLUDE_ERI3 void -build_TwoPRep_1b_2k(std::ostream& os, const SafePtr& cparams, - SafePtr& iface, unsigned int deriv_level) +build_TwoPRep_1b_2k(std::ostream& os, const std::shared_ptr& cparams, + std::shared_ptr& iface, unsigned int deriv_level) { const std::string task = task_label("3eri", deriv_level); typedef TwoPRep_11_11_sq TwoPRep_sh_11_11; @@ -1137,10 +1137,10 @@ build_TwoPRep_1b_2k(std::ostream& os, const SafePtr& cpar // 3) at the end, for each unresolved recurrence relation generate // explicit source code // - SafePtr dg_xxx(new DirectedGraph); - SafePtr strat(new Strategy()); - SafePtr context(new CppCodeContext(cparams)); - SafePtr memman(new WorstFitMemoryManager()); + std::shared_ptr dg_xxx(new DirectedGraph); + std::shared_ptr strat(new Strategy()); + std::shared_ptr context(new CppCodeContext(cparams)); + std::shared_ptr memman(new WorstFitMemoryManager()); for(unsigned int lbra=0; lbra<=lmax; lbra++) { for(unsigned int lc=0; lc<=lmax_default; lc++) { @@ -1154,8 +1154,8 @@ build_TwoPRep_1b_2k(std::ostream& os, const SafePtr& cpar // unfortunately, depending on the direction in which the build goes it must be A(0) or B(1) const unsigned int dummy_center = (LIBINT_SHELL_SET == LIBINT_SHELL_SET_ORCA) ? 0 : 1; - //SafePtr tactic(new ParticleDirectionTactic(lbra > lc+ld ? false : true)); - SafePtr tactic(new FourCenter_OS_Tactic(dummy_center==0?0:lbra, + //std::shared_ptr tactic(new ParticleDirectionTactic(lbra > lc+ld ? false : true)); + std::shared_ptr tactic(new FourCenter_OS_Tactic(dummy_center==0?0:lbra, dummy_center==1?0:lbra, lc, ld)); #if STUDY_MEMORY_USAGE @@ -1184,7 +1184,7 @@ build_TwoPRep_1b_2k(std::ostream& os, const SafePtr& cpar //////////// // NB translational invariance is now handled by CR_DerivGauss CartesianDerivIterator<3> diter(deriv_level); - std::vector< SafePtr > targets; + std::vector< std::shared_ptr > targets; bool last_deriv = false; do { CGShell a = (dummy_center == 0) ? CGShell::unit() : CGShell(lbra); @@ -1210,16 +1210,16 @@ build_TwoPRep_1b_2k(std::ostream& os, const SafePtr& cpar } // use 4-center integrals - SafePtr abcd = TwoPRep_sh_11_11::Instance(a,b,c,d,mType(0u)); + std::shared_ptr abcd = TwoPRep_sh_11_11::Instance(a,b,c,d,mType(0u)); targets.push_back(abcd); last_deriv = diter.last(); if (!last_deriv) diter.next(); } while (!last_deriv); // append all derivatives as targets to the graph - for(std::vector< SafePtr >::const_iterator t=targets.begin(); + for(std::vector< std::shared_ptr >::const_iterator t=targets.begin(); t != targets.end(); ++t) { - SafePtr t_ptr = dynamic_pointer_cast(*t); + std::shared_ptr t_ptr = dynamic_pointer_cast(*t); dg_xxx->append_target(t_ptr); } @@ -1235,7 +1235,7 @@ build_TwoPRep_1b_2k(std::ostream& os, const SafePtr& cpar if (dummy_center == 1 && deriv_level == 0) a.pure_sh(true); if (dummy_center == 0 && deriv_level == 0) b.pure_sh(true); #endif - SafePtr abcd = TwoPRep_sh_11_11::Instance(a,b,c,d,mType(0u)); + std::shared_ptr abcd = TwoPRep_sh_11_11::Instance(a,b,c,d,mType(0u)); abcd_label = abcd->label(); } // + derivative level (if deriv_level > 0) @@ -1263,7 +1263,7 @@ build_TwoPRep_1b_2k(std::ostream& os, const SafePtr& cpar prefix, label, false); // update max stack size and # of targets - const SafePtr& tparams = taskmgr.current().params(); + const std::shared_ptr& tparams = taskmgr.current().params(); tparams->max_stack_size(max_am, memman->max_memory_used()); tparams->max_ntarget(targets.size()); //os << " Max memory used = " << memman->max_memory_used() << std::endl; @@ -1299,8 +1299,8 @@ build_TwoPRep_1b_2k(std::ostream& os, const SafePtr& cpar #ifdef INCLUDE_ERI2 void -build_TwoPRep_1b_1k(std::ostream& os, const SafePtr& cparams, - SafePtr& iface, unsigned int deriv_level) +build_TwoPRep_1b_1k(std::ostream& os, const std::shared_ptr& cparams, + std::shared_ptr& iface, unsigned int deriv_level) { const std::string task = task_label("2eri", deriv_level); typedef TwoPRep_11_11_sq TwoPRep_sh_11_11; @@ -1324,10 +1324,10 @@ build_TwoPRep_1b_1k(std::ostream& os, const SafePtr& cpar // 3) at the end, for each unresolved recurrence relation generate // explicit source code // - SafePtr dg_xxx(new DirectedGraph); - SafePtr strat(new Strategy()); - SafePtr context(new CppCodeContext(cparams)); - SafePtr memman(new WorstFitMemoryManager()); + std::shared_ptr dg_xxx(new DirectedGraph); + std::shared_ptr strat(new Strategy()); + std::shared_ptr context(new CppCodeContext(cparams)); + std::shared_ptr memman(new WorstFitMemoryManager()); for(unsigned int lbra=0; lbra<=lmax; lbra++) { for(unsigned int lket=0; lket<=lmax; lket++) { @@ -1337,8 +1337,8 @@ build_TwoPRep_1b_1k(std::ostream& os, const SafePtr& cpar const unsigned int dummy_center1 = (LIBINT_SHELL_SET == LIBINT_SHELL_SET_ORCA) ? 0 : 1; const unsigned int dummy_center2 = (LIBINT_SHELL_SET == LIBINT_SHELL_SET_ORCA) ? 2 : 3; - //SafePtr tactic(new ParticleDirectionTactic(lbra > lket ? false : true)); - SafePtr tactic(new FourCenter_OS_Tactic(dummy_center1==0?0:lbra, + //std::shared_ptr tactic(new ParticleDirectionTactic(lbra > lket ? false : true)); + std::shared_ptr tactic(new FourCenter_OS_Tactic(dummy_center1==0?0:lbra, dummy_center1==1?0:lbra, dummy_center2==2?0:lket, dummy_center2==3?0:lket)); @@ -1367,7 +1367,7 @@ build_TwoPRep_1b_1k(std::ostream& os, const SafePtr& cpar //////////// // NB translational invariance is now handled by CR_DerivGauss CartesianDerivIterator<2> diter(deriv_level); - std::vector< SafePtr > targets; + std::vector< std::shared_ptr > targets; bool last_deriv = false; do { CGShell a = (dummy_center1 == 0) ? CGShell::unit() : CGShell(lbra); @@ -1395,16 +1395,16 @@ build_TwoPRep_1b_1k(std::ostream& os, const SafePtr& cpar } // use 4-center integrals - SafePtr abcd = TwoPRep_sh_11_11::Instance(a,b,c,d,mType(0u)); + std::shared_ptr abcd = TwoPRep_sh_11_11::Instance(a,b,c,d,mType(0u)); targets.push_back(abcd); last_deriv = diter.last(); if (!last_deriv) diter.next(); } while (!last_deriv); // append all derivatives as targets to the graph - for(std::vector< SafePtr >::const_iterator t=targets.begin(); + for(std::vector< std::shared_ptr >::const_iterator t=targets.begin(); t != targets.end(); ++t) { - SafePtr t_ptr = dynamic_pointer_cast(*t); + std::shared_ptr t_ptr = dynamic_pointer_cast(*t); dg_xxx->append_target(t_ptr); } @@ -1422,7 +1422,7 @@ build_TwoPRep_1b_1k(std::ostream& os, const SafePtr& cpar if (dummy_center2 == 3 && deriv_level == 0) c.pure_sh(true); if (dummy_center2 == 2 && deriv_level == 0) d.pure_sh(true); #endif - SafePtr abcd = TwoPRep_sh_11_11::Instance(a,b,c,d,mType(0u)); + std::shared_ptr abcd = TwoPRep_sh_11_11::Instance(a,b,c,d,mType(0u)); abcd_label = abcd->label(); } // + derivative level (if deriv_level > 0) @@ -1450,7 +1450,7 @@ build_TwoPRep_1b_1k(std::ostream& os, const SafePtr& cpar prefix, label, false); // update max stack size and # of targets - const SafePtr& tparams = taskmgr.current().params(); + const std::shared_ptr& tparams = taskmgr.current().params(); tparams->max_stack_size(max_am, memman->max_memory_used()); tparams->max_ntarget(targets.size()); //os << " Max memory used = " << memman->max_memory_used() << std::endl; @@ -1485,8 +1485,8 @@ build_TwoPRep_1b_1k(std::ostream& os, const SafePtr& cpar #ifdef INCLUDE_G12 void -build_R12kG12_2b_2k(std::ostream& os, const SafePtr& cparams, - SafePtr& iface) +build_R12kG12_2b_2k(std::ostream& os, const std::shared_ptr& cparams, + std::shared_ptr& iface) { const std::string task("r12kg12"); vector shells; @@ -1514,13 +1514,13 @@ build_R12kG12_2b_2k(std::ostream& os, const SafePtr& cpar // 3) at the end, for each unresolved recurrence relation generate // explicit source code // - SafePtr dg_xxxx(new DirectedGraph); - SafePtr strat(new Strategy); - SafePtr tactic(new FirstChoiceTactic); - //SafePtr tactic(new RandomChoiceTactic()); - //SafePtr tactic(new FewestNewVerticesTactic(dg_xxxx)); - SafePtr context(new CppCodeContext(cparams)); - SafePtr memman(new WorstFitMemoryManager()); + std::shared_ptr dg_xxxx(new DirectedGraph); + std::shared_ptr strat(new Strategy); + std::shared_ptr tactic(new FirstChoiceTactic); + //std::shared_ptr tactic(new RandomChoiceTactic()); + //std::shared_ptr tactic(new FewestNewVerticesTactic(dg_xxxx)); + std::shared_ptr context(new CppCodeContext(cparams)); + std::shared_ptr memman(new WorstFitMemoryManager()); for(unsigned int la=0; la<=lmax; la++) { for(unsigned int lb=0; lb<=lmax; lb++) { @@ -1556,9 +1556,9 @@ build_R12kG12_2b_2k(std::ostream& os, const SafePtr& cpar #if LIBINT_CONTRACTED_INTS oper.descr().contract(); #endif - SafePtr abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper); + std::shared_ptr abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper); os << "building " << abcd->description() << endl; - SafePtr abcd_ptr = dynamic_pointer_cast(abcd); + std::shared_ptr abcd_ptr = dynamic_pointer_cast(abcd); dg_xxxx->append_target(abcd_ptr); } @@ -1569,9 +1569,9 @@ build_R12kG12_2b_2k(std::ostream& os, const SafePtr& cpar #if LIBINT_CONTRACTED_INTS oper.descr().contract(); #endif - SafePtr abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper); + std::shared_ptr abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper); os << "building " << abcd->description() << endl; - SafePtr abcd_ptr = dynamic_pointer_cast(abcd); + std::shared_ptr abcd_ptr = dynamic_pointer_cast(abcd); dg_xxxx->append_target(abcd_ptr); } @@ -1585,9 +1585,9 @@ build_R12kG12_2b_2k(std::ostream& os, const SafePtr& cpar #if LIBINT_CONTRACTED_INTS oper.descr().contract(); #endif - SafePtr abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper); + std::shared_ptr abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper); os << "building " << abcd->description() << endl; - SafePtr abcd_ptr = dynamic_pointer_cast(abcd); + std::shared_ptr abcd_ptr = dynamic_pointer_cast(abcd); dg_xxxx->append_target(abcd_ptr); } @@ -1600,9 +1600,9 @@ build_R12kG12_2b_2k(std::ostream& os, const SafePtr& cpar #if LIBINT_CONTRACTED_INTS oper.descr().contract(); #endif - SafePtr abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper); + std::shared_ptr abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper); os << "building " << abcd->description() << endl; - SafePtr abcd_ptr = dynamic_pointer_cast(abcd); + std::shared_ptr abcd_ptr = dynamic_pointer_cast(abcd); dg_xxxx->append_target(abcd_ptr); } #endif @@ -1616,9 +1616,9 @@ build_R12kG12_2b_2k(std::ostream& os, const SafePtr& cpar #if LIBINT_CONTRACTED_INTS oper.descr().contract(); #endif - SafePtr abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper); + std::shared_ptr abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper); os << "building " << abcd->description() << endl; - SafePtr abcd_ptr = dynamic_pointer_cast(abcd); + std::shared_ptr abcd_ptr = dynamic_pointer_cast(abcd); dg_xxxx->append_target(abcd_ptr); } @@ -1644,7 +1644,7 @@ build_R12kG12_2b_2k(std::ostream& os, const SafePtr& cpar prefix, label, false); // update max stack size - const SafePtr& tparams = taskmgr.current().params(); + const std::shared_ptr& tparams = taskmgr.current().params(); tparams->max_stack_size(max_am, memman->max_memory_used()); tparams->max_ntarget(5); @@ -1678,8 +1678,8 @@ build_R12kG12_2b_2k(std::ostream& os, const SafePtr& cpar #ifdef INCLUDE_G12 void -build_R12kG12_2b_2k_separate(std::ostream& os, const SafePtr& cparams, - SafePtr& iface) +build_R12kG12_2b_2k_separate(std::ostream& os, const std::shared_ptr& cparams, + std::shared_ptr& iface) { // do not support this if the commutator integrals are needed #if SUPPORT_T1G12 @@ -1707,11 +1707,11 @@ build_R12kG12_2b_2k_separate(std::ostream& os, const SafePtrto_params(iface->macro_define(std::string("MAX_AM_") + task_NAMES[task],lmax)); iface->to_params(iface->macro_define("SUPPORT_T1G12",0)); - SafePtr dg_xxxx(new DirectedGraph); - SafePtr strat(new Strategy); - SafePtr tactic(new FirstChoiceTactic); - SafePtr context(new CppCodeContext(cparams)); - SafePtr memman(new WorstFitMemoryManager()); + std::shared_ptr dg_xxxx(new DirectedGraph); + std::shared_ptr strat(new Strategy); + std::shared_ptr tactic(new FirstChoiceTactic); + std::shared_ptr context(new CppCodeContext(cparams)); + std::shared_ptr memman(new WorstFitMemoryManager()); for(unsigned int la=0; la<=lmax; la++) { for(unsigned int lb=0; lb<=lmax; lb++) { @@ -1744,9 +1744,9 @@ build_R12kG12_2b_2k_separate(std::ostream& os, const SafePtr abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper); + std::shared_ptr abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper); os << "building " << abcd->description() << endl; - SafePtr abcd_ptr = dynamic_pointer_cast(abcd); + std::shared_ptr abcd_ptr = dynamic_pointer_cast(abcd); dg_xxxx->append_target(abcd_ptr); _label = abcd_ptr->label(); } @@ -1760,9 +1760,9 @@ build_R12kG12_2b_2k_separate(std::ostream& os, const SafePtr abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper); + std::shared_ptr abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper); os << "building " << abcd->description() << endl; - SafePtr abcd_ptr = dynamic_pointer_cast(abcd); + std::shared_ptr abcd_ptr = dynamic_pointer_cast(abcd); dg_xxxx->append_target(abcd_ptr); _label = abcd_ptr->label(); } @@ -1778,7 +1778,7 @@ build_R12kG12_2b_2k_separate(std::ostream& os, const SafePtr& tparams = taskmgr.current().params(); + const std::shared_ptr& tparams = taskmgr.current().params(); tparams->max_stack_size(max_am, memman->max_memory_used()); tparams->max_ntarget(1); @@ -1814,8 +1814,8 @@ build_R12kG12_2b_2k_separate(std::ostream& os, const SafePtr& cparams, - SafePtr& iface) +build_G12DKH_2b_2k(std::ostream& os, const std::shared_ptr& cparams, + std::shared_ptr& iface) { const std::string task("g12dkh"); vector shells; @@ -1838,9 +1838,9 @@ build_G12DKH_2b_2k(std::ostream& os, const SafePtr& cpara // 3) at the end, for each unresolved recurrence relation generate // explicit source code // - SafePtr dg_xxxx(new DirectedGraph); - SafePtr strat(new Strategy); - SafePtr tactic(new FirstChoiceTactic); + std::shared_ptr dg_xxxx(new DirectedGraph); + std::shared_ptr strat(new Strategy); + std::shared_ptr tactic(new FirstChoiceTactic); for(int la=0; la<=lmax; la++) { for(int lb=0; lb<=lmax; lb++) { for(int lc=0; lc<=lmax; lc++) { @@ -1874,9 +1874,9 @@ build_G12DKH_2b_2k(std::ostream& os, const SafePtr& cpara typedef R12kG12_11_11_sq int_type; typedef R12kG12 oper_type; typedef oper_type::Descriptor oper_descr; - SafePtr abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper_type(oper_descr(0))); + std::shared_ptr abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper_type(oper_descr(0))); os << "building " << abcd->description() << endl; - SafePtr abcd_ptr = dynamic_pointer_cast(abcd); + std::shared_ptr abcd_ptr = dynamic_pointer_cast(abcd); dg_xxxx->append_target(abcd_ptr); } // k=2 @@ -1884,9 +1884,9 @@ build_G12DKH_2b_2k(std::ostream& os, const SafePtr& cpara typedef R12kG12_11_11_sq int_type; typedef R12kG12 oper_type; typedef oper_type::Descriptor oper_descr; - SafePtr abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper_type(oper_descr(2))); + std::shared_ptr abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper_type(oper_descr(2))); os << "building " << abcd->description() << endl; - SafePtr abcd_ptr = dynamic_pointer_cast(abcd); + std::shared_ptr abcd_ptr = dynamic_pointer_cast(abcd); dg_xxxx->append_target(abcd_ptr); } // k=4 @@ -1894,9 +1894,9 @@ build_G12DKH_2b_2k(std::ostream& os, const SafePtr& cpara typedef R12kG12_11_11_sq int_type; typedef R12kG12 oper_type; typedef oper_type::Descriptor oper_descr; - SafePtr abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper_type(oper_descr(4))); + std::shared_ptr abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper_type(oper_descr(4))); os << "building " << abcd->description() << endl; - SafePtr abcd_ptr = dynamic_pointer_cast(abcd); + std::shared_ptr abcd_ptr = dynamic_pointer_cast(abcd); dg_xxxx->append_target(abcd_ptr); } // (G12prime.Div1)^2 @@ -1904,9 +1904,9 @@ build_G12DKH_2b_2k(std::ostream& os, const SafePtr& cpara typedef DivG12prime_xTx_11_11_sq int_type; typedef int_type::OperType oper_type; typedef oper_type::Descriptor oper_descr; - SafePtr abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper_type(oper_descr(0))); + std::shared_ptr abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper_type(oper_descr(0))); os << "building " << abcd->description() << endl; - SafePtr abcd_ptr = dynamic_pointer_cast(abcd); + std::shared_ptr abcd_ptr = dynamic_pointer_cast(abcd); dg_xxxx->append_target(abcd_ptr); } // (G12prime.Div2)^2 @@ -1914,14 +1914,14 @@ build_G12DKH_2b_2k(std::ostream& os, const SafePtr& cpara typedef DivG12prime_xTx_11_11_sq int_type; typedef int_type::OperType oper_type; typedef oper_type::Descriptor oper_descr; - SafePtr abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper_type(oper_descr(1))); + std::shared_ptr abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper_type(oper_descr(1))); os << "building " << abcd->description() << endl; - SafePtr abcd_ptr = dynamic_pointer_cast(abcd); + std::shared_ptr abcd_ptr = dynamic_pointer_cast(abcd); dg_xxxx->append_target(abcd_ptr); } - SafePtr context(new CppCodeContext(cparams)); - SafePtr memman(new WorstFitMemoryManager()); + std::shared_ptr context(new CppCodeContext(cparams)); + std::shared_ptr memman(new WorstFitMemoryManager()); dg_xxxx->apply(strat,tactic); dg_xxxx->optimize_rr_out(context); dg_xxxx->traverse(); @@ -1944,10 +1944,10 @@ build_G12DKH_2b_2k(std::ostream& os, const SafePtr& cpara std::string src_filename(prefix + context->label_to_name(label)); src_filename += ".cc"; std::basic_ofstream declfile(decl_filename.c_str()); std::basic_ofstream srcfile(src_filename.c_str()); - dg_xxxx->generate_code(context,memman,ImplicitDimensions::default_dims(),SafePtr(new CodeSymbols),label,declfile,srcfile); + dg_xxxx->generate_code(context,memman,ImplicitDimensions::default_dims(),std::shared_ptr(new CodeSymbols),label,declfile,srcfile); // update max stack size - const SafePtr& tparams = taskmgr.current().params(); + const std::shared_ptr& tparams = taskmgr.current().params(); tparams->max_stack_size(max_am, memman->max_memory_used()); tparams->max_ntarget(3); @@ -1984,7 +1984,7 @@ build_G12DKH_2b_2k(std::ostream& os, const SafePtr& cpara #endif // INCLUDE_G12DKH void -config_to_api(const SafePtr& cparams, SafePtr& iface) +config_to_api(const std::shared_ptr& cparams, std::shared_ptr& iface) { int max_deriv_order = 0; #ifdef INCLUDE_ONEBODY diff --git a/src/bin/libint/buildtest.cc b/src/bin/libint/buildtest.cc index 2130d1a32..d7fc443c7 100644 --- a/src/bin/libint/buildtest.cc +++ b/src/bin/libint/buildtest.cc @@ -34,15 +34,15 @@ namespace libint2 { void generate_rr_code(std::ostream& os, - const SafePtr& cparams, + const std::shared_ptr& cparams, std::deque& decl_filenames, std::deque& def_filenames) { - SafePtr context(new CppCodeContext(cparams)); + std::shared_ptr context(new CppCodeContext(cparams)); ImplicitDimensions::set_default_dims(cparams); std::string prefix(cparams->source_directory()); - SafePtr rrstack = RRStack::Instance(); + std::shared_ptr rrstack = RRStack::Instance(); #define GENERATE_ALL_RRS 0 #if GENERATE_ALL_RRS @@ -51,7 +51,7 @@ namespace libint2 { // RRStack::citer_type it = rrstack->begin(); while (it != rrstack->end()) { - SafePtr rr = (*it).second.second; + std::shared_ptr rr = (*it).second.second; #else // // generate code for all recurrence relation actually used @@ -62,7 +62,7 @@ namespace libint2 { const tciter tend = taskmgr.plast(); std::set aggregate_rrlist; for(tciter t=taskmgr.first(); t!=tend; ++t) { - const SafePtr tsymbols = t->symbols(); + const std::shared_ptr tsymbols = t->symbols(); typedef TaskExternSymbols::SymbolList SymbolList; auto rrlist = tsymbols->rrlist(); aggregate_rrlist.insert(rrlist.begin(), rrlist.end()); diff --git a/src/bin/libint/buildtest.h b/src/bin/libint/buildtest.h index 3ce60c542..665e91105 100644 --- a/src/bin/libint/buildtest.h +++ b/src/bin/libint/buildtest.h @@ -37,18 +37,18 @@ namespace libint2 { // defined in buildtest.cc - void generate_rr_code(std::ostream& os, const SafePtr& cparams, + void generate_rr_code(std::ostream& os, const std::shared_ptr& cparams, std::deque& decl_filenames, std::deque& def_filenames); /// defined below generates code for dg; dg and memman are reset at the end void - GenerateCode(const SafePtr& dg, - const SafePtr& context, - const SafePtr& cparams, - const SafePtr& strat, - const SafePtr& tactic, - const SafePtr& memman, + GenerateCode(const std::shared_ptr& dg, + const std::shared_ptr& context, + const std::shared_ptr& cparams, + const std::shared_ptr& strat, + const std::shared_ptr& tactic, + const std::shared_ptr& memman, std::deque& decl_filenames, std::deque& def_filenames, const std::string& prefix, @@ -82,7 +82,7 @@ namespace libint2 { to be produced (i.e. include header files + set-level recurrence relations code) */ template - void BuildTest(const std::vector< SafePtr >& targets, unsigned int size_to_unroll, unsigned int veclen, + void BuildTest(const std::vector< std::shared_ptr >& targets, unsigned int size_to_unroll, unsigned int veclen, bool vec_by_line, bool do_cse, const std::string& complabel = "buildtest", std::ostream& os = std::cout); @@ -91,23 +91,23 @@ namespace libint2 { to be produced (i.e. include header files + set-level recurrence relations code) */ template - void __BuildTest(const std::vector< SafePtr >& targets, const SafePtr& cparams, + void __BuildTest(const std::vector< std::shared_ptr >& targets, const std::shared_ptr& cparams, unsigned int size_to_unroll, std::ostream& os = std::cout, - const SafePtr& tactic = SafePtr(new FirstChoiceTactic), - const SafePtr& memman = SafePtr(new WorstFitMemoryManager), + const std::shared_ptr& tactic = std::shared_ptr(new FirstChoiceTactic), + const std::shared_ptr& memman = std::shared_ptr(new WorstFitMemoryManager), const std::string& complabel = "general_integral"); template void - __BuildTest(const std::vector< SafePtr >& targets, const SafePtr& cparams, + __BuildTest(const std::vector< std::shared_ptr >& targets, const std::shared_ptr& cparams, unsigned int size_to_unroll, std::ostream& os, - const SafePtr& tactic, const SafePtr& memman, + const std::shared_ptr& tactic, const std::shared_ptr& memman, const std::string& complabel) { const std::string prefix(""); const std::string label = cparams->api_prefix() + complabel; - SafePtr strat(new Strategy); - SafePtr context(new CppCodeContext(cparams)); + std::shared_ptr strat(new Strategy); + std::shared_ptr context(new CppCodeContext(cparams)); LibraryTaskManager& taskmgr = LibraryTaskManager::Instance(); taskmgr.add(complabel); @@ -118,7 +118,7 @@ namespace libint2 { // unsigned int max_am = 0; for(unsigned int t=0; t& target = targets[t]; + const std::shared_ptr& target = targets[t]; const unsigned int np = target->bra().num_part(); // bra for(unsigned int p=0; p dg_xxxx(new DirectedGraph); + std::shared_ptr dg_xxxx(new DirectedGraph); dg_xxxx->set_label(complabel); // configure the graph @@ -159,8 +159,8 @@ namespace libint2 { dg_xxxx->registry()->unroll_threshold(size_to_unroll); for(unsigned int t=0; t& target = targets[t]; - SafePtr target_ptr = dynamic_pointer_cast(target); + const std::shared_ptr& target = targets[t]; + std::shared_ptr target_ptr = dynamic_pointer_cast(target); assert(target_ptr != 0); dg_xxxx->append_target(target_ptr); } @@ -177,9 +177,9 @@ namespace libint2 { if (GenAllCode) { // initialize code context to produce library API - SafePtr icontext(new CppCodeContext(cparams)); + std::shared_ptr icontext(new CppCodeContext(cparams)); // initialize object to generate interface - SafePtr iface(new Libint2Iface(cparams,icontext)); + std::shared_ptr iface(new Libint2Iface(cparams,icontext)); // generate interface std::ostringstream oss; @@ -215,12 +215,12 @@ namespace libint2 { } void - GenerateCode(const SafePtr& dg, - const SafePtr& context, - const SafePtr& cparams, - const SafePtr& strat, - const SafePtr& tactic, - const SafePtr& memman, + GenerateCode(const std::shared_ptr& dg, + const std::shared_ptr& context, + const std::shared_ptr& cparams, + const std::shared_ptr& strat, + const std::shared_ptr& tactic, + const std::shared_ptr& memman, std::deque& decl_filenames, std::deque& def_filenames, const std::string& prefix, @@ -245,7 +245,7 @@ namespace libint2 { //std::cout << "missing some prerequisites!" << std::endl; dg->foreach(pe); } - std::deque< SafePtr > prereq_list = pe.vertices; + std::deque< std::shared_ptr > prereq_list = pe.vertices; dg->traverse(); //dg->debug_print_traversal(cout); @@ -262,7 +262,7 @@ namespace libint2 { std::basic_ofstream declfile(decl_filename.c_str()); std::basic_ofstream deffile(def_filename.c_str()); // if have parent graph, it will pass its stack where this graph will put its results - SafePtr args(new CodeSymbols); + std::shared_ptr args(new CodeSymbols); if (have_parent) args->append_symbol("parent_stack"); dg->generate_code(context,memman,ImplicitDimensions::default_dims(),args, @@ -286,9 +286,9 @@ namespace libint2 { // last: missing prerequisites? create new graph computing prereqs and move them onto it if (dg->missing_prerequisites()) { - SafePtr dg_prereq(new DirectedGraph); + std::shared_ptr dg_prereq(new DirectedGraph); // configure identically - dg_prereq->registry() = SafePtr(dg->registry()->clone()); + dg_prereq->registry() = std::shared_ptr(dg->registry()->clone()); // except: // - allow uncontraction // - no need to return targets via inteval->targets_ -- their locations are known by the parent graph (see allocate_mem) @@ -324,7 +324,7 @@ namespace libint2 { } template - void BuildTest(const std::vector< SafePtr >& targets, unsigned int size_to_unroll, unsigned int veclen, + void BuildTest(const std::vector< std::shared_ptr >& targets, unsigned int size_to_unroll, unsigned int veclen, bool vec_by_line, bool do_cse, const std::string& complabel, std::ostream& os) { @@ -336,7 +336,7 @@ namespace libint2 { taskmgr.current(complabel); // initialize cparams - SafePtr cparams(new CompilationParameters); + std::shared_ptr cparams(new CompilationParameters); cparams->max_am(complabel,max_am); cparams->num_bf(complabel,4u); cparams->max_vector_length(veclen); @@ -379,26 +379,26 @@ namespace libint2 { // set default dims ImplicitDimensions::set_default_dims(cparams); - SafePtr rpolicy(new StdRandomizePolicy(0.00)); + std::shared_ptr rpolicy(new StdRandomizePolicy(0.00)); // use 4-center OS if the target is a 4-center integral - SafePtr tactic; + std::shared_ptr tactic; { typedef GenIntegralSet_11_11 genint_11_11_t; - SafePtr< genint_11_11_t > cast_ptr = dynamic_pointer_cast(targets.front()); + std::shared_ptr< genint_11_11_t > cast_ptr = dynamic_pointer_cast(targets.front()); if (cast_ptr) { const unsigned int la = cast_ptr->bra(0, 0).norm(); const unsigned int lb = cast_ptr->ket(0, 0).norm(); const unsigned int lc = cast_ptr->bra(1, 0).norm(); const unsigned int ld = cast_ptr->ket(1, 0).norm(); - tactic = SafePtr(new FourCenter_OS_Tactic(la, lb, lc, ld)); + tactic = std::shared_ptr(new FourCenter_OS_Tactic(la, lb, lc, ld)); } else { - tactic = SafePtr(new FirstChoiceTactic(rpolicy)); + tactic = std::shared_ptr(new FirstChoiceTactic(rpolicy)); } } - const SafePtr memman(new WorstFitMemoryManager); + const std::shared_ptr memman(new WorstFitMemoryManager); __BuildTest(targets,cparams,size_to_unroll,os,tactic,memman,complabel); } diff --git a/src/bin/libint/codeblock.cc b/src/bin/libint/codeblock.cc index ecd1d3c7b..c012ace04 100644 --- a/src/bin/libint/codeblock.cc +++ b/src/bin/libint/codeblock.cc @@ -24,8 +24,8 @@ using namespace std; using namespace libint2; -ForLoop::ForLoop(const SafePtr& context, std::string& varname, - const SafePtr& less_than, const SafePtr& start_at) : +ForLoop::ForLoop(const std::shared_ptr& context, std::string& varname, + const std::shared_ptr& less_than, const std::shared_ptr& start_at) : CodeBlock(context), varname_(varname), less_than_(less_than), start_at_(start_at) { init_(); @@ -38,11 +38,11 @@ ForLoop::~ForLoop() void ForLoop::init_() { - SafePtr ctext = context(); - SafePtr< CTimeEntity > lt_cptr = dynamic_pointer_cast,Entity>(less_than_); - SafePtr< CTimeEntity > sa_cptr = dynamic_pointer_cast,Entity>(start_at_); - SafePtr< RTimeEntity > lt_rptr = dynamic_pointer_cast,Entity>(less_than_); - SafePtr< RTimeEntity > sa_rptr = dynamic_pointer_cast,Entity>(start_at_); + std::shared_ptr ctext = context(); + std::shared_ptr< CTimeEntity > lt_cptr = dynamic_pointer_cast,Entity>(less_than_); + std::shared_ptr< CTimeEntity > sa_cptr = dynamic_pointer_cast,Entity>(start_at_); + std::shared_ptr< RTimeEntity > lt_rptr = dynamic_pointer_cast,Entity>(less_than_); + std::shared_ptr< RTimeEntity > sa_rptr = dynamic_pointer_cast,Entity>(start_at_); if (lt_cptr != 0) { ostringstream oss; @@ -75,7 +75,7 @@ ForLoop::init_() std::string ForLoop::open() { - SafePtr ctext = context(); + std::shared_ptr ctext = context(); ostringstream oss; if (dummy_loop_) { diff --git a/src/bin/libint/codeblock.h b/src/bin/libint/codeblock.h index 8c3cee173..a52716314 100644 --- a/src/bin/libint/codeblock.h +++ b/src/bin/libint/codeblock.h @@ -30,11 +30,11 @@ namespace libint2 { class CodeBlock { public: - CodeBlock(const SafePtr& context) : + CodeBlock(const std::shared_ptr& context) : context_(context) {} virtual ~CodeBlock() {} - SafePtr context() const { return context_; } + std::shared_ptr context() const { return context_; } /// Opens a code block virtual std::string open() =0; @@ -42,13 +42,13 @@ namespace libint2 { virtual std::string close() =0; private: - SafePtr context_; + std::shared_ptr context_; }; class ForLoop : public CodeBlock { public: - ForLoop(const SafePtr& context, std::string& varname, - const SafePtr& less_than, const SafePtr& start_at); + ForLoop(const std::shared_ptr& context, std::string& varname, + const std::shared_ptr& less_than, const std::shared_ptr& start_at); virtual ~ForLoop(); /// Implementation of CodeBlock::open() @@ -58,8 +58,8 @@ namespace libint2 { private: std::string varname_; - SafePtr less_than_; - SafePtr start_at_; + std::shared_ptr less_than_; + std::shared_ptr start_at_; // checks less_than_ and start_at_ and initializes // lt_expr_, sa_expr_, and dummy_loop_ diff --git a/src/bin/libint/comp_11_DivG12prime_xTx_11.h b/src/bin/libint/comp_11_DivG12prime_xTx_11.h index ffdeda11b..5a1830626 100644 --- a/src/bin/libint/comp_11_DivG12prime_xTx_11.h +++ b/src/bin/libint/comp_11_DivG12prime_xTx_11.h @@ -56,14 +56,14 @@ namespace libint2 { using ParentType::is_simple; /// Constructor is private, used by ParentType::Instance that maintains registry of these objects - CR_11_DivG12prime_xTx_11(const SafePtr&, unsigned int dir); + CR_11_DivG12prime_xTx_11(const std::shared_ptr&, unsigned int dir); static std::string descr() { return "CR"; } template friend class ChildFactory; }; template - CR_11_DivG12prime_xTx_11::CR_11_DivG12prime_xTx_11(const SafePtr& Tint, + CR_11_DivG12prime_xTx_11::CR_11_DivG12prime_xTx_11(const std::shared_ptr& Tint, unsigned int dir) : ParentType(Tint,dir) { diff --git a/src/bin/libint/comp_11_g12tig12_11.h b/src/bin/libint/comp_11_g12tig12_11.h index 313b3a1f5..f6ff88d46 100644 --- a/src/bin/libint/comp_11_g12tig12_11.h +++ b/src/bin/libint/comp_11_g12tig12_11.h @@ -53,21 +53,21 @@ namespace libint2 { using ParentType::is_simple; /// Constructor is private, used by ParentType::Instance that maintains registry of these objects - CR_11_G12TiG12_11(const SafePtr&, unsigned int dir); + CR_11_G12TiG12_11(const std::shared_ptr&, unsigned int dir); static std::string descr() { return "CR"; } #if LIBINT_ENABLE_GENERIC_CODE /// Implementation of RecurrenceRelation::has_generic() - bool has_generic(const SafePtr& cparams) const override; + bool has_generic(const std::shared_ptr& cparams) const override; /// Implementation of RecurrenceRelation::generic_header() std::string generic_header() const override { return "GenericScale.h"; } /// Implementation of RecurrenceRelation::generic_instance() - std::string generic_instance(const SafePtr& context, const SafePtr& args) const override; + std::string generic_instance(const std::shared_ptr& context, const std::shared_ptr& args) const override; #endif }; template - CR_11_G12TiG12_11::CR_11_G12TiG12_11(const SafePtr& Tint, + CR_11_G12TiG12_11::CR_11_G12TiG12_11(const std::shared_ptr& Tint, unsigned int dir) : ParentType(Tint,dir) { @@ -104,7 +104,7 @@ namespace libint2 { #if LIBINT_ENABLE_GENERIC_CODE template bool - CR_11_G12TiG12_11::has_generic(const SafePtr& cparams) const + CR_11_G12TiG12_11::has_generic(const std::shared_ptr& cparams) const { F sh_a(target_->bra(0,0)); F sh_b(target_->ket(0,0)); @@ -125,7 +125,7 @@ namespace libint2 { template std::string - CR_11_G12TiG12_11::generic_instance(const SafePtr& context, const SafePtr& args) const { + CR_11_G12TiG12_11::generic_instance(const std::shared_ptr& context, const std::shared_ptr& args) const { std::ostringstream oss; const bool vec = (context->cparams()->max_vector_length() != 1); diff --git a/src/bin/libint/comp_11_gtg_11_1d.h b/src/bin/libint/comp_11_gtg_11_1d.h index 824427895..0a20f0a9d 100644 --- a/src/bin/libint/comp_11_gtg_11_1d.h +++ b/src/bin/libint/comp_11_gtg_11_1d.h @@ -53,21 +53,21 @@ namespace libint2 { using ParentType::is_simple; /// Constructor is private, used by ParentType::Instance that maintains registry of these objects - CR_11_GTG_11_1d(const SafePtr&, unsigned int dir); + CR_11_GTG_11_1d(const std::shared_ptr&, unsigned int dir); static std::string descr() { return "CR"; } #if LIBINT_ENABLE_GENERIC_CODE /// Implementation of RecurrenceRelation::has_generic() - bool has_generic(const SafePtr& cparams) const override { return true; } + bool has_generic(const std::shared_ptr& cparams) const override { return true; } /// Implementation of RecurrenceRelation::generic_header() std::string generic_header() const override { return "VRR_GTG_1d_xx_xx.h"; } /// Implementation of RecurrenceRelation::generic_instance() - std::string generic_instance(const SafePtr& context, const SafePtr& args) const override; + std::string generic_instance(const std::shared_ptr& context, const std::shared_ptr& args) const override; #endif }; template - CR_11_GTG_11_1d::CR_11_GTG_11_1d(const SafePtr& Tint, + CR_11_GTG_11_1d::CR_11_GTG_11_1d(const std::shared_ptr& Tint, unsigned int dir) : ParentType(Tint,dir) { @@ -88,7 +88,7 @@ namespace libint2 { #if LIBINT_ENABLE_GENERIC_CODE template std::string - CR_11_GTG_11_1d::generic_instance(const SafePtr& context, const SafePtr& args) const { + CR_11_GTG_11_1d::generic_instance(const std::shared_ptr& context, const std::shared_ptr& args) const { std::ostringstream oss; auto a = target_->bra(0,0); diff --git a/src/bin/libint/comp_11_r12kr12lg12_11.h b/src/bin/libint/comp_11_r12kr12lg12_11.h index 181d74481..3fd03a47c 100644 --- a/src/bin/libint/comp_11_r12kr12lg12_11.h +++ b/src/bin/libint/comp_11_r12kr12lg12_11.h @@ -58,13 +58,13 @@ namespace libint2 { template friend class ChildFactory; /// Constructor is private, used by ParentType::Instance that maintains registry of these objects - CR_11_R12kR12lG12_11(const SafePtr&, unsigned int dir); + CR_11_R12kR12lG12_11(const std::shared_ptr&, unsigned int dir); static std::string descr() { return "CR"; } }; template - CR_11_R12kR12lG12_11::CR_11_R12kR12lG12_11(const SafePtr& Tint, + CR_11_R12kR12lG12_11::CR_11_R12kR12lG12_11(const std::shared_ptr& Tint, unsigned int dir) : ParentType(Tint,dir) { diff --git a/src/bin/libint/comp_11_r1dotr1g12_11.h b/src/bin/libint/comp_11_r1dotr1g12_11.h index 86e11ae7f..394893ad3 100644 --- a/src/bin/libint/comp_11_r1dotr1g12_11.h +++ b/src/bin/libint/comp_11_r1dotr1g12_11.h @@ -58,21 +58,21 @@ namespace libint2 { typedef RecurrenceRelation::ExprType ExprType; /** Use Instance() to obtain an instance of RR. This function is provided to avoid - issues with getting a SafePtr from constructor (as needed for registry to work). + issues with getting a std::shared_ptr from constructor (as needed for registry to work). */ - static SafePtr Instance(const SafePtr&); + static std::shared_ptr Instance(const std::shared_ptr&); virtual ~CR_11_R1dotR1G12_11() {} /// Implementation of RecurrenceRelation::num_children() unsigned int num_children() const override { return nchildren_; } /// target() returns pointer to the i-th child - SafePtr target() const { return target_; }; + std::shared_ptr target() const { return target_; }; /// child(i) returns pointer to the i-th child - SafePtr child(unsigned int i) const; + std::shared_ptr child(unsigned int i) const; /// Implementation of RecurrenceRelation::rr_target() - SafePtr rr_target() const override { return static_pointer_cast(target()); } + std::shared_ptr rr_target() const override { return static_pointer_cast(target()); } /// Implementation of RecurrenceRelation::rr_child() - SafePtr rr_child(unsigned int i) const override { return dynamic_pointer_cast(child(i)); } + std::shared_ptr rr_child(unsigned int i) const override { return dynamic_pointer_cast(child(i)); } /// Implementation of RecurrenceRelation::is_simple() bool is_simple() const override { return TrivialBFSet::result; @@ -84,7 +84,7 @@ namespace libint2 { For example, dir can be 0 (x), 1(y), or 2(z) if BFSet is a Cartesian Gaussian. */ - CR_11_R1dotR1G12_11(const SafePtr&); + CR_11_R1dotR1G12_11(const std::shared_ptr&); #if 0 /// registers this RR with the stack, if needed @@ -92,8 +92,8 @@ namespace libint2 { #endif static const unsigned int max_nchildren_ = 18; - SafePtr target_; - SafePtr children_[max_nchildren_]; + std::shared_ptr target_; + std::shared_ptr children_[max_nchildren_]; unsigned int nchildren_; std::string generate_label() const override @@ -107,20 +107,20 @@ namespace libint2 { }; template