Bridge++
Ver. 1.1.x
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
gaugeConfig.cpp
Go to the documentation of this file.
1
14
#include "
gaugeConfig.h
"
15
16
#include "
commonParameters.h
"
17
#include "
communicator.h
"
18
#include "
bridgeIO.h
"
19
using
Bridge::vout
;
20
21
#include "
field.h
"
22
#include "
mat_SU_N.h
"
23
24
#include "
fieldIO.h
"
25
#include "
fieldIO_Text.h
"
26
#include "
fieldIO_Binary.h
"
27
#include "
fieldIO_Binary_Parallel.h
"
28
#include "
fieldIO_Fortran.h
"
29
#include "
fieldIO_LIME.h
"
30
#include "
io_format.h
"
31
#include "
io_format_gauge.h
"
32
33
34
//====================================================================
35
void
GaugeConfig::set_cold
(
Field
*U)
36
{
37
int
Nc =
CommonParameters::Nc
();
38
int
Nvol =
CommonParameters::Nvol
();
39
int
Ndim =
CommonParameters::Ndim
();
40
41
Field_G
*up = (
Field_G
*)U;
42
Mat_SU_N
ut(Nc);
43
44
ut.
unit
();
45
46
for
(
int
mu = 0; mu < Ndim; ++mu) {
47
for
(
int
site = 0; site < Nvol; ++site) {
48
up->
set_mat
(site, mu, ut);
49
}
50
}
51
52
vout
.
detailed
(
"gauge config. was set to unity.\n"
);
53
}
54
55
56
//====================================================================
57
GaugeConfig::GaugeConfig
(
const
string
& type)
58
: m_prefix(), m_postfix(), m_vl(
CommonParameters
::Vlevel()), m_fieldio()
59
{
60
if
(type ==
"Text"
) {
61
m_fieldio
=
new
FieldIO_Text
(
IO_Format::Gauge::ILDG
);
62
}
else
if
(type ==
"Binary"
) {
63
m_fieldio
=
new
FieldIO_Binary
(
IO_Format::Gauge::ILDG
);
64
}
else
if
(type ==
"Fortran_JLQCD"
) {
65
m_fieldio
=
new
FieldIO_Fortran
(
IO_Format::Gauge::JLQCD
);
66
}
else
if
(type ==
"Fortran_ILDG"
) {
67
m_fieldio
=
new
FieldIO_Fortran
(
IO_Format::Gauge::ILDG
);
68
}
else
if
(type ==
"ILDG"
) {
69
m_fieldio
=
new
FieldIO_LIME
(
IO_Format::Gauge::ILDG
);
70
}
else
if
(type ==
"Binary_Parallel"
) {
71
m_fieldio
=
new
FieldIO_Binary_Parallel
(
IO_Format::Gauge::ILDG
);
72
}
else
{
73
vout
.
crucial
(
"GaugeConfig: unsupported type \"%s\".\n"
, type.c_str());
74
abort();
75
}
76
}
77
78
79
//====================================================================
80
GaugeConfig::~GaugeConfig
()
81
{
82
if
(
m_fieldio
)
delete
m_fieldio
;
83
m_fieldio
= 0;
84
}
85
86
87
//====================================================================
88
string
GaugeConfig::config_filename
(
const
int
confnum)
89
{
90
const
size_t
filename_len = 256;
91
char
buf[filename_len];
92
93
snprintf(buf, filename_len,
"%s%06d%s"
,
m_prefix
.c_str(), confnum,
m_postfix
.c_str());
94
95
return
string(buf);
96
}
97
98
99
//====================================================================
100
void
GaugeConfig::read_file
(
Field
*u,
const
string
& filename)
101
{
102
if
(!
m_fieldio
) {
103
vout
.
crucial
(
"GaugeConfig::read_config(): FieldIO not set."
);
104
abort();
105
}
106
107
m_fieldio
->
read_file
(u, filename);
108
}
109
110
111
//====================================================================
112
void
GaugeConfig::write_file
(
Field
*u,
const
string
& filename)
113
{
114
if
(!
m_fieldio
) {
115
vout
.
crucial
(
"GaugeConfig::read_config(): FieldIO not set."
);
116
abort();
117
}
118
119
m_fieldio
->
write_file
(u, filename);
120
}
121
122
123
//====================================================================
124
void
GaugeConfig::read_config
(
Field
*U,
int
confnum)
125
{
126
return
read_file
(U,
config_filename
(confnum));
127
}
128
129
130
//====================================================================
131
void
GaugeConfig::write_config
(
Field
*U,
int
confnum)
132
{
133
return
write_file
(U,
config_filename
(confnum));
134
}
135
136
137
//====================================================================
138
//============================================================END=====
src
IO
gaugeConfig.cpp
Generated on Tue Jul 23 2013 10:48:49 for Bridge++ by
1.8.3.1