LIBINT 2.9.0
traits.h
1/*
2 * Copyright (C) 2004-2024 Edward F. Valeev
3 *
4 * This file is part of Libint compiler.
5 *
6 * Libint compiler is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * Libint compiler is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with Libint compiler. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21#include <bfset.h>
22#include <global_macros.h>
23#include <smart_ptr.h>
24
25#ifndef _libint2_src_bin_libint_traits_h_
26#define _libint2_src_bin_libint_traits_h_
27
28namespace libint2 {
29
30template <typename T>
32 typedef std::shared_ptr<T> StorageType;
33 enum { StoredAsPtr = true };
34 static const T& const_ref(const StorageType& s) { return *s; };
35};
36
37#if USE_BRAKET_H
38template <>
40 typedef CGShell StorageType;
41 enum { StoredAsPtr = false };
42 static const CGShell& const_ref(const StorageType& s) { return s; };
43};
44
45template <>
47 typedef CGF StorageType;
48 enum { StoredAsPtr = false };
49 static const CGF& const_ref(const StorageType& s) { return s; };
50};
51
52template <CartesianAxis Axis>
53struct StorageTraits<CGShell1d<Axis> > {
55 enum { StoredAsPtr = false };
56 static const CGShell1d<Axis>& const_ref(const StorageType& s) { return s; };
57};
58
59template <CartesianAxis Axis>
60struct StorageTraits<CGF1d<Axis> > {
62 enum { StoredAsPtr = false };
63 static const CGF1d<Axis>& const_ref(const StorageType& s) { return s; };
64};
65#endif
66
68
71template <typename Ref, typename Base>
73 typedef const Base& result;
74};
75template <typename Ref, typename Base>
76struct ReturnTypeAnalog<std::shared_ptr<Ref>, Base> {
77 typedef std::shared_ptr<Base> result;
78};
79
81
82template <typename T>
83struct TypeTraits {
85 typedef typename StorageTraits<T>::StorageType StorageType;
87 enum { StoredAsPtr = StorageTraits<T>::StoredAsPtr };
89 static const T& const_ref(const StorageType& s) {
91 }
92};
93}; // namespace libint2
94
95#endif
Cartesian components of 3D CGF = 1D CGF.
Definition bfset.h:457
3D Cartesian Gaussian Function
Definition bfset.h:345
a "shell" of 1D CGFs with quantum number L is a set of 1D CGFs with quantum numbers 0 .
Definition bfset.h:647
3D Cartesian Gaussian Shell
Definition bfset.h:256
Defaults definitions for various parameters assumed by Libint.
Definition algebra.cc:24
Converts Base to a type of the same signature as Ref.
Definition traits.h:72
Definition traits.h:31
Definition traits.h:83
static const T & const_ref(const StorageType &s)
Convert an object of StorageType to const T&.
Definition traits.h:89
StorageTraits< T >::StorageType StorageType
By default, use std::shared_ptr to manage these objects.
Definition traits.h:85