21#ifndef _libint2_src_bin_libint_policy_h_
22#define _libint2_src_bin_libint_policy_h_
27#include <boost/type_traits/is_same.hpp>
37template <
class T,
bool exists>
38struct ExistsDefaultSubobjAllocator;
41struct ExistsDefaultSubobjAllocator<T, true> {
43 typedef typename TypeTraits<obj_type>::StorageType obj_stype;
44 typedef typename TypeTraits<obj_type>::StorageType subobj_stype;
45 typedef typename obj_type::iter_type subobj_type;
47 static void default_init_subobj(
const obj_stype& obj,
48 std::vector<subobj_stype>& subobj) {
49 subobj.push_back(obj);
51 static void default_dealloc_subobj(std::vector<subobj_stype>& subobj) {}
58struct StdLibintTDPolicy {
60 typedef typename obj_type::iter_type subobj_type;
62 typedef typename TypeTraits<obj_type>::StorageType obj_stype;
64 typedef typename TypeTraits<subobj_type>::StorageType subobj_stype;
68 static void init_subobj(
const obj_stype& obj,
69 std::vector<subobj_stype>& subobj) {
72 ExistsDefaultSubobjAllocator<T,
73 boost::is_same<obj_type, subobj_type>::value>::
74 default_init_subobj(obj, subobj);
76 static void dealloc_subobj(std::vector<subobj_stype>& subobj) {
79 ExistsDefaultSubobjAllocator<T, boost::is_same<obj_type, subobj_type>::
80 value>::default_dealloc_subobj(subobj);
87class StdLibintTIPolicy {
89 static unsigned int max_set_size_to_unroll_;
92 StdLibintTIPolicy() {}
94 virtual void set_max_set_size_to_unroll(
unsigned int i) {
95 max_set_size_to_unroll_ = i;
98 virtual unsigned int max_set_size_to_unroll()
const {
99 return max_set_size_to_unroll_;
107#if CXX_ALLOWS_DEFPARAMTEMPLATE_AS_TEMPTEMPPARAM
108template <
class T,
class TIPol = StdLibintTIPolicy,
109 template <
class>
class TDPol = StdLibintTDPolicy>
110class Policy :
public TDPol<T>,
public TIPol {
112#define TDPol StdLibintTDPolicy
113#define TIPol StdLibintTIPolicy
115class Policy :
public TDPol<T>,
public TIPol {
119 typedef typename TDPol<T>::obj_stype obj_stype;
121 typedef typename TDPol<T>::subobj_stype subobj_stype;
142 bool can_unroll_intset(
const std::shared_ptr<T>& iset) {
143 return iset->set_size() <= TIPol::max_set_size_to_unroll();
Defaults definitions for various parameters assumed by Libint.
Definition algebra.cc:24