ALPS MPS Codes
Reference documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
none.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * ALPS MPS DMRG Project
4  *
5  * Copyright (C) 2013 Institute for Theoretical Physics, ETH Zurich
6  * 2011-2011 by Bela Bauer <bauerb@phys.ethz.ch>
7  *
8  * This software is part of the ALPS Applications, published under the ALPS
9  * Application License; you can use, redistribute it and/or modify it under
10  * the terms of the license, either version 1 or (at your option) any later
11  * version.
12  *
13  * You should have received a copy of the ALPS Application License along with
14  * the ALPS Applications; see the file LICENSE.txt. If not, the license is also
15  * available from http://alps.comp-phys.org/.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
20  * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
21  * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
22  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23  * DEALINGS IN THE SOFTWARE.
24  *
25  *****************************************************************************/
26 
27 #ifndef SYMMETRY_NONE_H
28 #define SYMMETRY_NONE_H
29 
30 #include <iostream>
31 
32 #include <boost/functional/hash.hpp>
33 
34 #include <alps/hdf5.hpp>
35 
36 #include <boost/serialization/serialization.hpp>
37 #include <boost/array.hpp>
38 
40 {
41 public:
42  typedef enum { Plus } charge;
43  typedef int subcharge; // Used if charge is site_dependent
44  static const charge IdentityCharge = Plus;
45  static const bool finite = true;
46 
47 
48  static inline charge fuse(charge a, charge b) { return Plus; }
49  template<int R> static charge fuse(boost::array<charge, R>) { return Plus; }
50 };
51 
52 namespace boost {
53  template <>
54  class hash<TrivialGroup::charge>{
55  public :
56  size_t operator()(TrivialGroup::charge const &Charge ) const {
57  return hash<int>()(TrivialGroup::IdentityCharge); // return 0 ??
58  }
59  };
60 
61  template <>
62  class hash<std::pair<TrivialGroup::charge,TrivialGroup::charge > >{
63  public :
64  size_t operator()(std::pair<TrivialGroup::charge, TrivialGroup::charge> const &Pair_of_charge ) const {
65  return boost::hash_value(Pair_of_charge);
66  }
67  };
68 };
69 
70 inline void save(alps::hdf5::archive & ar
71  , std::string const & path
72  , TrivialGroup::charge const & value
73  , std::vector<std::size_t> size = std::vector<std::size_t>()
74  , std::vector<std::size_t> chunk = std::vector<std::size_t>()
75  , std::vector<std::size_t> offset = std::vector<std::size_t>())
76 {
77  int k = 1;
78  ar[path] << k;
79 }
80 
81 inline void load(alps::hdf5::archive & ar
82  , std::string const & path
83  , TrivialGroup::charge & value
84  , std::vector<std::size_t> chunk = std::vector<std::size_t>()
85  , std::vector<std::size_t> offset = std::vector<std::size_t>())
86 {
87  value = TrivialGroup::Plus;
88 }
89 
90 template <class Archive>
91 inline void serialize(Archive & ar, TrivialGroup::charge & c, const unsigned int version)
92 {
93  ar & c;
94 }
95 
97 
98 #endif
size_t operator()(TrivialGroup::charge const &Charge) const
Definition: none.h:56
static charge fuse(charge a, charge b)
Definition: none.h:48
void load(alps::hdf5::archive &ar, std::string const &path, TrivialGroup::charge &value, std::vector< std::size_t > chunk=std::vector< std::size_t >(), std::vector< std::size_t > offset=std::vector< std::size_t >())
Definition: none.h:81
size_t operator()(std::pair< TrivialGroup::charge, TrivialGroup::charge > const &Pair_of_charge) const
Definition: none.h:64
static charge fuse(boost::array< charge, R >)
Definition: none.h:49
TrivialGroup::charge operator-(TrivialGroup::charge a)
Definition: none.h:96
void save(alps::hdf5::archive &ar, std::string const &path, TrivialGroup::charge const &value, std::vector< std::size_t > size=std::vector< std::size_t >(), std::vector< std::size_t > chunk=std::vector< std::size_t >(), std::vector< std::size_t > offset=std::vector< std::size_t >())
Definition: none.h:70
int subcharge
Definition: none.h:43
static const charge IdentityCharge
Definition: none.h:44
static const bool finite
Definition: none.h:45
void serialize(Archive &ar, TrivialGroup::charge &c, const unsigned int version)
Definition: none.h:91