ALPS MPS Codes
Reference documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Public Attributes | List of all members
Boundary< Matrix, SymmGroup > Class Template Reference

#include <boundary.h>

Inheritance diagram for Boundary< Matrix, SymmGroup >:
storage::disk::serializable< Boundary< Matrix, SymmGroup > > storage::disk::descriptor

Public Types

typedef
maquis::traits::scalar_type
< Matrix >::type 
scalar_type
 
typedef Matrix::value_type value_type
 
typedef std::pair< typename
SymmGroup::charge, std::size_t > 
access_type
 
enum  { core, storing, uncore, prefetching }
 

Public Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 
 Boundary (Index< SymmGroup > const &ud=Index< SymmGroup >(), Index< SymmGroup > const &ld=Index< SymmGroup >(), std::size_t ad=1)
 
Boundaryoperator= (const Boundary &rhs)
 
template<class OtherMatrix >
 Boundary (Boundary< OtherMatrix, SymmGroup > const &rhs)
 
std::size_t aux_dim () const
 
void resize (size_t n)
 
std::vector< scalar_typetraces () const
 
bool reasonable () const
 
template<class Archive >
void load (Archive &ar)
 
template<class Archive >
void save (Archive &ar) const
 
block_matrix< Matrix, SymmGroup > & operator[] (std::size_t k)
 
block_matrix< Matrix,
SymmGroup > const & 
operator[] (std::size_t k) const
 
void fetch ()
 
void prefetch ()
 
void evict ()
 
void drop ()
 
void thread (boost::thread *t)
 
void join ()
 

Public Attributes

enum
storage::disk::descriptor:: { ... }  
state
 
bool dumped
 
size_t sid
 
boost::thread * worker
 
size_t record
 

Detailed Description

template<class Matrix, class SymmGroup>
class Boundary< Matrix, SymmGroup >

Definition at line 40 of file boundary.h.

Member Typedef Documentation

template<class Matrix, class SymmGroup>
typedef std::pair<typename SymmGroup::charge, std::size_t> Boundary< Matrix, SymmGroup >::access_type

Definition at line 45 of file boundary.h.

template<class Matrix, class SymmGroup>
typedef maquis::traits::scalar_type<Matrix>::type Boundary< Matrix, SymmGroup >::scalar_type

Definition at line 43 of file boundary.h.

template<class Matrix, class SymmGroup>
typedef Matrix::value_type Boundary< Matrix, SymmGroup >::value_type

Definition at line 44 of file boundary.h.

Member Enumeration Documentation

anonymous enum
inherited
Enumerator
core 
storing 
uncore 
prefetching 

Definition at line 169 of file storage.h.

Constructor & Destructor Documentation

template<class Matrix, class SymmGroup>
Boundary< Matrix, SymmGroup >::Boundary ( Index< SymmGroup > const &  ud = Index<SymmGroup>(),
Index< SymmGroup > const &  ld = Index<SymmGroup>(),
std::size_t  ad = 1 
)
inline

Definition at line 52 of file boundary.h.

55  : data_(ad, block_matrix<Matrix, SymmGroup>(ud, ld))
56  { }
template<class Matrix, class SymmGroup>
template<class OtherMatrix >
Boundary< Matrix, SymmGroup >::Boundary ( Boundary< OtherMatrix, SymmGroup > const &  rhs)
inline

Definition at line 65 of file boundary.h.

66  {
67  data_.reserve(rhs.aux_dim());
68  for (std::size_t n=0; n<rhs.aux_dim(); ++n)
69  data_.push_back(rhs[n]);
70  }
std::size_t aux_dim() const
Definition: boundary.h:72

Member Function Documentation

template<class Matrix, class SymmGroup>
std::size_t Boundary< Matrix, SymmGroup >::aux_dim ( ) const
inline

Definition at line 72 of file boundary.h.

72  {
73  return data_.size();
74  }
void storage::disk::serializable< Boundary< Matrix, SymmGroup > >::drop ( )
inlineinherited

Definition at line 211 of file storage.h.

211  {
212  std::remove(disk::fp(sid).c_str());
213  if(state == core) drop_request<T>(disk::fp(sid), (T*)this)();
214  assert(this->state != storing); // drop of already stored data
215  assert(this->state != uncore); // drop of already stored data
216  assert(this->state != prefetching); // drop of prefetched data
217  }
enum storage::disk::descriptor::@0 state
void storage::disk::serializable< Boundary< Matrix, SymmGroup > >::evict ( )
inlineinherited

Definition at line 198 of file storage.h.

198  {
199  if(state == core){
200  if(!dumped){
201  state = storing;
202  dumped = true;
203  this->thread(new boost::thread(evict_request<T>(disk::fp(sid), (T*)this)));
204  }else{
205  state = uncore;
206  drop_request<T>(disk::fp(sid), (T*)this)();
207  }
208  }
209  assert(this->state != prefetching); // evict of prefetched
210  }
enum storage::disk::descriptor::@0 state
void thread(boost::thread *t)
Definition: storage.h:157
void storage::disk::serializable< Boundary< Matrix, SymmGroup > >::fetch ( )
inlineinherited

Definition at line 183 of file storage.h.

183  {
184  if(this->state == core) return;
185  else if(this->state == prefetching) this->join();
186  assert(this->state != storing); // isn't prefetched prior load
187  assert(this->state != uncore); // isn't prefetched prior load
188  this->state = core;
189  }
enum storage::disk::descriptor::@0 state
void storage::disk::descriptor::join ( )
inlineinherited

Definition at line 161 of file storage.h.

161  {
162  if(this->worker){
163  this->worker->join();
164  delete this->worker;
165  this->worker = NULL;
166  disk::untrack(this);
167  }
168  }
boost::thread * worker
Definition: storage.h:172
static void untrack(descriptor *d)
Definition: storage.h:242
template<class Matrix, class SymmGroup>
template<class Archive >
void Boundary< Matrix, SymmGroup >::load ( Archive &  ar)
inline

Definition at line 97 of file boundary.h.

97  {
98  std::vector<std::string> children = ar.list_children("data");
99  data_.resize(children.size());
100  semi_parallel_for(/*removed...*/, std::size_t i=0; i<children.size(); ++i){
101  ar["data/"+children[i]] >> data_[alps::cast<std::size_t>(children[i])];
102  }
103  }
#define semi_parallel_for(constraint,...)
template<class Matrix, class SymmGroup>
Boundary& Boundary< Matrix, SymmGroup >::operator= ( const Boundary< Matrix, SymmGroup > &  rhs)
inline

Definition at line 58 of file boundary.h.

58  {
60  data_ = rhs.data_;
61  return *this;
62  }
serializable & operator=(const serializable &rhs)
Definition: storage.h:178
template<class Matrix, class SymmGroup>
block_matrix<Matrix, SymmGroup>& Boundary< Matrix, SymmGroup >::operator[] ( std::size_t  k)
inline

Definition at line 110 of file boundary.h.

110 { return data_[k]; }
template<class Matrix, class SymmGroup>
block_matrix<Matrix, SymmGroup> const& Boundary< Matrix, SymmGroup >::operator[] ( std::size_t  k) const
inline

Definition at line 111 of file boundary.h.

111 { return data_[k]; }
void storage::disk::serializable< Boundary< Matrix, SymmGroup > >::prefetch ( )
inlineinherited

Definition at line 190 of file storage.h.

190  {
191  if(this->state == core) return;
192  else if(this->state == prefetching) return;
193  else if(this->state == storing) this->join();
194 
195  state = prefetching;
196  this->thread(new boost::thread(fetch_request<T>(disk::fp(sid), (T*)this)));
197  }
enum storage::disk::descriptor::@0 state
void thread(boost::thread *t)
Definition: storage.h:157
template<class Matrix, class SymmGroup>
bool Boundary< Matrix, SymmGroup >::reasonable ( ) const
inline

Definition at line 90 of file boundary.h.

90  {
91  for(size_t i = 0; i < data_.size(); ++i)
92  if(!data_[i].reasonable()) return false;
93  return true;
94  }
bool reasonable() const
Definition: boundary.h:90
template<class Matrix, class SymmGroup>
void Boundary< Matrix, SymmGroup >::resize ( size_t  n)
inline

Definition at line 76 of file boundary.h.

76  {
77  if(n < data_.size())
78  return data_.resize(n);
79  data_.reserve(n);
80  for(int i = data_.size(); i < n; ++i)
81  data_.push_back(block_matrix<Matrix, SymmGroup>());
82  }
template<class Matrix, class SymmGroup>
template<class Archive >
void Boundary< Matrix, SymmGroup >::save ( Archive &  ar) const
inline

Definition at line 106 of file boundary.h.

106  {
107  ar["data"] << data_;
108  }
template<class Matrix, class SymmGroup>
template<class Archive >
void Boundary< Matrix, SymmGroup >::serialize ( Archive &  ar,
const unsigned int  version 
)
inline

Definition at line 48 of file boundary.h.

48  {
49  ar & data_;
50  }
void storage::disk::descriptor::thread ( boost::thread *  t)
inlineinherited

Definition at line 157 of file storage.h.

157  {
158  this->worker = t;
159  disk::track(this);
160  }
static void track(descriptor *d)
Definition: storage.h:238
boost::thread * worker
Definition: storage.h:172
template<class Matrix, class SymmGroup>
std::vector<scalar_type> Boundary< Matrix, SymmGroup >::traces ( ) const
inline

Definition at line 84 of file boundary.h.

84  {
85  std::vector<scalar_type> ret; ret.reserve(data_.size());
86  for (size_t k=0; k < data_.size(); ++k) ret.push_back(data_[k].trace());
87  return ret;
88  }

Member Data Documentation

bool storage::disk::descriptor::dumped
inherited

Definition at line 170 of file storage.h.

size_t storage::disk::descriptor::record
inherited

Definition at line 173 of file storage.h.

size_t storage::disk::descriptor::sid
inherited

Definition at line 171 of file storage.h.

enum { ... } storage::disk::descriptor::state
boost::thread* storage::disk::descriptor::worker
inherited

Definition at line 172 of file storage.h.


The documentation for this class was generated from the following file: