Skip to content

Commit

Permalink
refactor: remove using declarations of pointer cast
Browse files Browse the repository at this point in the history
  • Loading branch information
e-kwsm committed Nov 13, 2023
1 parent ad73a6e commit d45c646
Show file tree
Hide file tree
Showing 31 changed files with 138 additions and 142 deletions.
4 changes: 2 additions & 2 deletions src/bin/libint/algebra.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ namespace libint2 {
#if ALGEBRAICOPERATOR_USE_KEY_TO_COMPARE
#if USE_INT_KEY_TO_COMPARE
if (key() == a->key())
return *this == static_pointer_cast<AlgebraicOperator,DGVertex>(a);
return *this == std::static_pointer_cast<AlgebraicOperator,DGVertex>(a);
else
return false;
#else
return description() == a->description();
#endif
#else
return *this == static_pointer_cast<AlgebraicOperator,DGVertex>(a);
return *this == std::static_pointer_cast<AlgebraicOperator,DGVertex>(a);
#endif
}
else
Expand Down
32 changes: 16 additions & 16 deletions src/bin/libint/build_libint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ build_onebody_1b_1k(std::ostream& os, std::string label, const std::shared_ptr<C

// shove all targets on the graph, IN ORDER
for(auto t = targets.begin(); t!=targets.end(); ++t) {
std::shared_ptr<DGVertex> t_ptr = dynamic_pointer_cast<DGVertex,Onebody_sh_1_1>(*t);
std::shared_ptr<DGVertex> t_ptr = std::dynamic_pointer_cast<DGVertex,Onebody_sh_1_1>(*t);
dg->append_target(t_ptr);
}

Expand Down Expand Up @@ -1029,7 +1029,7 @@ build_TwoPRep_2b_2k(std::ostream& os, const std::shared_ptr<CompilationParameter
for(std::vector< std::shared_ptr<TwoPRep_sh_11_11> >::const_iterator t=targets.begin();
t != targets.end();
++t) {
std::shared_ptr<DGVertex> t_ptr = dynamic_pointer_cast<DGVertex,TwoPRep_sh_11_11>(*t);
std::shared_ptr<DGVertex> t_ptr = std::dynamic_pointer_cast<DGVertex,TwoPRep_sh_11_11>(*t);
dg_xxxx->append_target(t_ptr);
}

Expand Down Expand Up @@ -1219,7 +1219,7 @@ build_TwoPRep_1b_2k(std::ostream& os, const std::shared_ptr<CompilationParameter
for(std::vector< std::shared_ptr<TwoPRep_sh_11_11> >::const_iterator t=targets.begin();
t != targets.end();
++t) {
std::shared_ptr<DGVertex> t_ptr = dynamic_pointer_cast<DGVertex,TwoPRep_sh_11_11>(*t);
std::shared_ptr<DGVertex> t_ptr = std::dynamic_pointer_cast<DGVertex,TwoPRep_sh_11_11>(*t);
dg_xxx->append_target(t_ptr);
}

Expand Down Expand Up @@ -1404,7 +1404,7 @@ build_TwoPRep_1b_1k(std::ostream& os, const std::shared_ptr<CompilationParameter
for(std::vector< std::shared_ptr<TwoPRep_sh_11_11> >::const_iterator t=targets.begin();
t != targets.end();
++t) {
std::shared_ptr<DGVertex> t_ptr = dynamic_pointer_cast<DGVertex,TwoPRep_sh_11_11>(*t);
std::shared_ptr<DGVertex> t_ptr = std::dynamic_pointer_cast<DGVertex,TwoPRep_sh_11_11>(*t);
dg_xxx->append_target(t_ptr);
}

Expand Down Expand Up @@ -1558,7 +1558,7 @@ build_R12kG12_2b_2k(std::ostream& os, const std::shared_ptr<CompilationParameter
#endif
std::shared_ptr<int_type> abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper);
os << "building " << abcd->description() << endl;
std::shared_ptr<DGVertex> abcd_ptr = dynamic_pointer_cast<DGVertex,int_type>(abcd);
std::shared_ptr<DGVertex> abcd_ptr = std::dynamic_pointer_cast<DGVertex,int_type>(abcd);
dg_xxxx->append_target(abcd_ptr);
}

Expand All @@ -1571,7 +1571,7 @@ build_R12kG12_2b_2k(std::ostream& os, const std::shared_ptr<CompilationParameter
#endif
std::shared_ptr<int_type> abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper);
os << "building " << abcd->description() << endl;
std::shared_ptr<DGVertex> abcd_ptr = dynamic_pointer_cast<DGVertex,int_type>(abcd);
std::shared_ptr<DGVertex> abcd_ptr = std::dynamic_pointer_cast<DGVertex,int_type>(abcd);
dg_xxxx->append_target(abcd_ptr);
}

Expand All @@ -1587,7 +1587,7 @@ build_R12kG12_2b_2k(std::ostream& os, const std::shared_ptr<CompilationParameter
#endif
std::shared_ptr<int_type> abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper);
os << "building " << abcd->description() << endl;
std::shared_ptr<DGVertex> abcd_ptr = dynamic_pointer_cast<DGVertex,int_type>(abcd);
std::shared_ptr<DGVertex> abcd_ptr = std::dynamic_pointer_cast<DGVertex,int_type>(abcd);
dg_xxxx->append_target(abcd_ptr);
}

Expand All @@ -1602,7 +1602,7 @@ build_R12kG12_2b_2k(std::ostream& os, const std::shared_ptr<CompilationParameter
#endif
std::shared_ptr<int_type> abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper);
os << "building " << abcd->description() << endl;
std::shared_ptr<DGVertex> abcd_ptr = dynamic_pointer_cast<DGVertex,int_type>(abcd);
std::shared_ptr<DGVertex> abcd_ptr = std::dynamic_pointer_cast<DGVertex,int_type>(abcd);
dg_xxxx->append_target(abcd_ptr);
}
#endif
Expand All @@ -1618,7 +1618,7 @@ build_R12kG12_2b_2k(std::ostream& os, const std::shared_ptr<CompilationParameter
#endif
std::shared_ptr<int_type> abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper);
os << "building " << abcd->description() << endl;
std::shared_ptr<DGVertex> abcd_ptr = dynamic_pointer_cast<DGVertex,int_type>(abcd);
std::shared_ptr<DGVertex> abcd_ptr = std::dynamic_pointer_cast<DGVertex,int_type>(abcd);
dg_xxxx->append_target(abcd_ptr);
}

Expand Down Expand Up @@ -1746,7 +1746,7 @@ build_R12kG12_2b_2k_separate(std::ostream& os, const std::shared_ptr<Compilation
#endif
std::shared_ptr<int_type> abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper);
os << "building " << abcd->description() << endl;
std::shared_ptr<DGVertex> abcd_ptr = dynamic_pointer_cast<DGVertex,int_type>(abcd);
std::shared_ptr<DGVertex> abcd_ptr = std::dynamic_pointer_cast<DGVertex,int_type>(abcd);
dg_xxxx->append_target(abcd_ptr);
_label = abcd_ptr->label();
}
Expand All @@ -1762,7 +1762,7 @@ build_R12kG12_2b_2k_separate(std::ostream& os, const std::shared_ptr<Compilation
#endif
std::shared_ptr<int_type> abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper);
os << "building " << abcd->description() << endl;
std::shared_ptr<DGVertex> abcd_ptr = dynamic_pointer_cast<DGVertex,int_type>(abcd);
std::shared_ptr<DGVertex> abcd_ptr = std::dynamic_pointer_cast<DGVertex,int_type>(abcd);
dg_xxxx->append_target(abcd_ptr);
_label = abcd_ptr->label();
}
Expand Down Expand Up @@ -1876,7 +1876,7 @@ build_G12DKH_2b_2k(std::ostream& os, const std::shared_ptr<CompilationParameters
typedef oper_type::Descriptor oper_descr;
std::shared_ptr<int_type> abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper_type(oper_descr(0)));
os << "building " << abcd->description() << endl;
std::shared_ptr<DGVertex> abcd_ptr = dynamic_pointer_cast<DGVertex,int_type>(abcd);
std::shared_ptr<DGVertex> abcd_ptr = std::dynamic_pointer_cast<DGVertex,int_type>(abcd);
dg_xxxx->append_target(abcd_ptr);
}
// k=2
Expand All @@ -1886,7 +1886,7 @@ build_G12DKH_2b_2k(std::ostream& os, const std::shared_ptr<CompilationParameters
typedef oper_type::Descriptor oper_descr;
std::shared_ptr<int_type> abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper_type(oper_descr(2)));
os << "building " << abcd->description() << endl;
std::shared_ptr<DGVertex> abcd_ptr = dynamic_pointer_cast<DGVertex,int_type>(abcd);
std::shared_ptr<DGVertex> abcd_ptr = std::dynamic_pointer_cast<DGVertex,int_type>(abcd);
dg_xxxx->append_target(abcd_ptr);
}
// k=4
Expand All @@ -1896,7 +1896,7 @@ build_G12DKH_2b_2k(std::ostream& os, const std::shared_ptr<CompilationParameters
typedef oper_type::Descriptor oper_descr;
std::shared_ptr<int_type> abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper_type(oper_descr(4)));
os << "building " << abcd->description() << endl;
std::shared_ptr<DGVertex> abcd_ptr = dynamic_pointer_cast<DGVertex,int_type>(abcd);
std::shared_ptr<DGVertex> abcd_ptr = std::dynamic_pointer_cast<DGVertex,int_type>(abcd);
dg_xxxx->append_target(abcd_ptr);
}
// (G12prime.Div1)^2
Expand All @@ -1906,7 +1906,7 @@ build_G12DKH_2b_2k(std::ostream& os, const std::shared_ptr<CompilationParameters
typedef oper_type::Descriptor oper_descr;
std::shared_ptr<int_type> abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper_type(oper_descr(0)));
os << "building " << abcd->description() << endl;
std::shared_ptr<DGVertex> abcd_ptr = dynamic_pointer_cast<DGVertex,int_type>(abcd);
std::shared_ptr<DGVertex> abcd_ptr = std::dynamic_pointer_cast<DGVertex,int_type>(abcd);
dg_xxxx->append_target(abcd_ptr);
}
// (G12prime.Div2)^2
Expand All @@ -1916,7 +1916,7 @@ build_G12DKH_2b_2k(std::ostream& os, const std::shared_ptr<CompilationParameters
typedef oper_type::Descriptor oper_descr;
std::shared_ptr<int_type> abcd = int_type::Instance(*shells[la],*shells[lb],*shells[lc],*shells[ld],0u,oper_type(oper_descr(1)));
os << "building " << abcd->description() << endl;
std::shared_ptr<DGVertex> abcd_ptr = dynamic_pointer_cast<DGVertex,int_type>(abcd);
std::shared_ptr<DGVertex> abcd_ptr = std::dynamic_pointer_cast<DGVertex,int_type>(abcd);
dg_xxxx->append_target(abcd_ptr);
}

Expand Down
4 changes: 2 additions & 2 deletions src/bin/libint/buildtest.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ namespace libint2 {

for(unsigned int t=0; t<targets.size(); ++t) {
const std::shared_ptr<Integral>& target = targets[t];
std::shared_ptr<DGVertex> target_ptr = dynamic_pointer_cast<DGVertex,Integral>(target);
std::shared_ptr<DGVertex> target_ptr = std::dynamic_pointer_cast<DGVertex,Integral>(target);
assert(target_ptr != 0);
dg_xxxx->append_target(target_ptr);
}
Expand Down Expand Up @@ -386,7 +386,7 @@ namespace libint2 {
typedef GenIntegralSet_11_11<typename Integral::BasisFunctionType,
typename Integral::OperatorType,
typename Integral::AuxIndexType> genint_11_11_t;
std::shared_ptr< genint_11_11_t > cast_ptr = dynamic_pointer_cast<genint_11_11_t>(targets.front());
std::shared_ptr< genint_11_11_t > cast_ptr = std::dynamic_pointer_cast<genint_11_11_t>(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();
Expand Down
8 changes: 4 additions & 4 deletions src/bin/libint/codeblock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ void
ForLoop::init_()
{
std::shared_ptr<CodeContext> ctext = context();
std::shared_ptr< CTimeEntity<int> > lt_cptr = dynamic_pointer_cast<CTimeEntity<int>,Entity>(less_than_);
std::shared_ptr< CTimeEntity<int> > sa_cptr = dynamic_pointer_cast<CTimeEntity<int>,Entity>(start_at_);
std::shared_ptr< RTimeEntity<EntityTypes::Int> > lt_rptr = dynamic_pointer_cast<RTimeEntity<EntityTypes::Int>,Entity>(less_than_);
std::shared_ptr< RTimeEntity<EntityTypes::Int> > sa_rptr = dynamic_pointer_cast<RTimeEntity<EntityTypes::Int>,Entity>(start_at_);
std::shared_ptr< CTimeEntity<int> > lt_cptr = std::dynamic_pointer_cast<CTimeEntity<int>,Entity>(less_than_);
std::shared_ptr< CTimeEntity<int> > sa_cptr = std::dynamic_pointer_cast<CTimeEntity<int>,Entity>(start_at_);
std::shared_ptr< RTimeEntity<EntityTypes::Int> > lt_rptr = std::dynamic_pointer_cast<RTimeEntity<EntityTypes::Int>,Entity>(less_than_);
std::shared_ptr< RTimeEntity<EntityTypes::Int> > sa_rptr = std::dynamic_pointer_cast<RTimeEntity<EntityTypes::Int>,Entity>(start_at_);

if (lt_cptr != 0) {
ostringstream oss;
Expand Down
4 changes: 2 additions & 2 deletions src/bin/libint/comp_11_r1dotr1g12_11.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ namespace libint2 {
/// child(i) returns pointer to the i-th child
std::shared_ptr<ChildType> child(unsigned int i) const;
/// Implementation of RecurrenceRelation::rr_target()
std::shared_ptr<DGVertex> rr_target() const override { return static_pointer_cast<DGVertex,TargetType>(target()); }
std::shared_ptr<DGVertex> rr_target() const override { return std::static_pointer_cast<DGVertex,TargetType>(target()); }
/// Implementation of RecurrenceRelation::rr_child()
std::shared_ptr<DGVertex> rr_child(unsigned int i) const override { return dynamic_pointer_cast<DGVertex,ChildType>(child(i)); }
std::shared_ptr<DGVertex> rr_child(unsigned int i) const override { return std::dynamic_pointer_cast<DGVertex,ChildType>(child(i)); }
/// Implementation of RecurrenceRelation::is_simple()
bool is_simple() const override {
return TrivialBFSet<BFSet>::result;
Expand Down
4 changes: 2 additions & 2 deletions src/bin/libint/comp_11_r1dotr2g12_11.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ namespace libint2 {
/// child(i) returns pointer to the i-th child
std::shared_ptr<ChildType> child(unsigned int i) const;
/// Implementation of RecurrenceRelation::rr_target()
std::shared_ptr<DGVertex> rr_target() const override { return static_pointer_cast<DGVertex,TargetType>(target()); }
std::shared_ptr<DGVertex> rr_target() const override { return std::static_pointer_cast<DGVertex,TargetType>(target()); }
/// Implementation of RecurrenceRelation::rr_child()
std::shared_ptr<DGVertex> rr_child(unsigned int i) const override { return dynamic_pointer_cast<DGVertex,ChildType>(child(i)); }
std::shared_ptr<DGVertex> rr_child(unsigned int i) const override { return std::dynamic_pointer_cast<DGVertex,ChildType>(child(i)); }
/// Implementation of RecurrenceRelation::is_simple()
bool is_simple() const override {
return TrivialBFSet<BFSet>::result;
Expand Down
4 changes: 2 additions & 2 deletions src/bin/libint/comp_11_r2dotr2g12_11.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ namespace libint2 {
/// child(i) returns pointer to the i-th child
std::shared_ptr<ChildType> child(unsigned int i) const;
/// Implementation of RecurrenceRelation::rr_target()
std::shared_ptr<DGVertex> rr_target() const override { return static_pointer_cast<DGVertex,TargetType>(target()); }
std::shared_ptr<DGVertex> rr_target() const override { return std::static_pointer_cast<DGVertex,TargetType>(target()); }
/// Implementation of RecurrenceRelation::rr_child()
std::shared_ptr<DGVertex> rr_child(unsigned int i) const override { return dynamic_pointer_cast<DGVertex,ChildType>(child(i)); }
std::shared_ptr<DGVertex> rr_child(unsigned int i) const override { return std::dynamic_pointer_cast<DGVertex,ChildType>(child(i)); }
/// Implementation of RecurrenceRelation::is_simple()
bool is_simple() const override {
return TrivialBFSet<BFSet>::result;
Expand Down
Loading

0 comments on commit d45c646

Please sign in to comment.