-
Notifications
You must be signed in to change notification settings - Fork 3
/
detsdwsystemconfig.h
68 lines (51 loc) · 2.17 KB
/
detsdwsystemconfig.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. See the enclosed file LICENSE for a copy or if
* that was not distributed with this file, You can obtain one at
* http://mozilla.org/MPL/2.0/.
*
* Copyright 2017 Max H. Gerlach
*
* */
#ifndef DETSDWSYSTEMCONFIG_H_
#define DETSDWSYSTEMCONFIG_H_
#include <armadillo>
#include "detsdwsystemconfigfilehandle.h"
#include "detsdwparams.h"
typedef arma::Col<num> VecNum;
typedef arma::Cube<num> CubeNum;
typedef arma::Mat<int32_t> MatInt;
// class to pass around and save system configurations for the SDW model
class DetSDW_SystemConfig {
public:
DetSDW_SystemConfig();
DetSDW_SystemConfig(const ModelParamsDetSDW& pars, const CubeNum& phi_current, const MatInt& cdwl_current);
DetSDW_SystemConfig(const ModelParamsDetSDW& pars, const CubeNum& phi_current);
void write_to_disk(DetSDW_SystemConfig_FileHandle& file_handle) const;
private:
uint32_t L;
uint32_t m;
uint32_t opdim;
//slice indexes timeslice, column indexes order parameter
// dimension, row indexes site
// [Index order: row, col, slice]
// [Data layout; slice after slice, matrices then column major]
CubeNum phi;
//discrete field for cdwU: l_i(\tau_k) == cdwl(i,k).
//row indexes site, column indexes timeslice
MatInt cdwl;
void write_to_disk_phi_text(DetSDW_SystemConfig_FileHandle& file_handle) const;
void write_to_disk_cdwl_text(DetSDW_SystemConfig_FileHandle& file_handle) const;
void write_to_disk_phi_binary(DetSDW_SystemConfig_FileHandle& file_handle) const;
void write_to_disk_cdwl_binary(DetSDW_SystemConfig_FileHandle& file_handle) const;
private:
friend class boost::serialization::access;
// serialization to pass around system configurations by MPI
template<class Archive>
void serialize(Archive & ar, const unsigned int /*version*/) {
ar & L & m & opdim
& phi & cdwl;
}
};
void serialize_systemConfig_to_buffer(std::string& buffer, const DetSDW_SystemConfig& systemConfig);
void deserialize_systemConfig_from_buffer(DetSDW_SystemConfig& systemConfig, const std::string& buffer);
#endif//DETSDWSYSTEMCONFIG_H_