7 #define XTENSOR_USE_XSIMD 8 #include <xtensor/xfixed.hpp> 17 std::vector<xt::xtensorf<double, xt::xshape<4> > > spins;
18 std::vector<xt::xtensorf<int, xt::xshape<4> > > locs;
19 std::vector<std::vector<int> > neighbours;
20 std::vector<std::vector<int> > adj;
21 std::vector<std::vector<int> > neigh_choice;
23 std::vector<xt::xtensorf<int, xt::xshape<4> > > loc_diffs;
24 std::vector<double> J_diffs;
25 std::vector<xt::xtensorf<double, xt::xshape<4> > > D_vecs;
33 xt::xtensorf<double, xt::xshape<4>> upspin;
34 xt::xtensorf<double, xt::xshape<4>> downspin;
35 xt::xtensorf<double, xt::xshape<4>> testspin;
36 xt::xtensorf<int, xt::xshape<4>> blankloc;
62 std::string J_filename);
80 xt::xtensorf<double, xt::xshape<4>>&
access(
int index) {
return spins[index];}
89 std::vector<int>&
get_neigh(
int index) {
return neighbours[index];}
98 std::vector<int>&
get_adj(
int index) {
return adj[index];}
107 double&
get_J(
int i,
int j) {
return J_diffs[neigh_choice[i][j]];}
116 xt::xtensorf<double, xt::xshape<4>>&
get_D_vec(
int i,
int j)
117 {
return D_vecs[neigh_choice[i][j]];}
126 xt::xtensorf<int, xt::xshape<4>>&
get_loc(
int index)
127 {
return locs[index];}
134 void add_spin(xt::xtensorf<
int, xt::xshape<4>>& loc);
167 void set_rand(
int index) {spins[index] = testspin;}
174 void set_up(
int index) {spins[index] = upspin;}
181 void set_down(
int index) {spins[index] = downspin;}
188 void set_spin(
int index, xt::xtensorf<
double, xt::xshape<4> >& in)
201 xt::xtensorf<double, xt::xshape<4>>&
get_rand() {
return testspin;}
223 const std::string groupname,
233 void print(std::string filename, std::string arrname);
void set_spin(int index, xt::xtensorf< double, xt::xshape< 4 > > &in)
Definition: field_type.hpp:188
void print_setup(const std::string filename, const std::string groupname, const int Tmax, const int Hmax)
void set_neigh()
Determine the neighbours of the spins.
int get_edge()
Definition: field_type.hpp:160
~field_type()
Destructor.
Definition: field_type.hpp:67
void all_rand()
Set all spins to a random state.
int get_dim()
Definition: field_type.hpp:153
xt::xtensorf< int, xt::xshape< 4 > > & get_loc(int index)
Definition: field_type.hpp:126
Definition: field_type.hpp:10
xt::xtensorf< double, xt::xshape< 4 > > & get_D_vec(int i, int j)
Definition: field_type.hpp:116
void set_rand(int index)
Definition: field_type.hpp:167
Base class for fields.
Definition: field_type.hpp:14
void print(std::string filename, std::string arrname)
double & get_J(int i, int j)
Definition: field_type.hpp:107
void set_down(int index)
Definition: field_type.hpp:181
void set_up(int index)
Definition: field_type.hpp:174
void add_spin(xt::xtensorf< int, xt::xshape< 4 >> &loc)
bool use_J()
Are the exchanges on?
Definition: field_type.hpp:252
xt::xtensorf< double, xt::xshape< 4 > > & access(int index)
Definition: field_type.hpp:80
xt::xtensorf< double, xt::xshape< 4 > > & get_rand()
Definition: field_type.hpp:201
void recv_data(int src_rank)
std::vector< int > & get_adj(int index)
Definition: field_type.hpp:98
void gen_rand()
Generate a random spin state.
bool use_D()
Are the dmis on?
Definition: field_type.hpp:257
void send_data(int dest_rank)
field_type()
Default constructor.
Definition: field_type.hpp:42
void all_zero()
Set all spins to a zero state.
void set_default_spins()
Set default spins.
std::vector< int > & get_neigh(int index)
Definition: field_type.hpp:89
unsigned int get_size()
Definition: field_type.hpp:146