Bridge++  Ver. 2.0.2
qws_lib.cpp
Go to the documentation of this file.
1 
10 #include "lib_alt_QXS/inline/define_params.h"
12 #include "lib/IO/bridgeIO.h"
13 
14 #ifdef USE_QWSLIB
15 #include "qws_lib.h"
16 
17 using Bridge::vout;
18 
19 namespace QWS_lib {
20  // static int qws_is_setup = 0;
21  int qws_is_setup = 0;
23 
24  void init_qws(const int *boundary)
25  {
26  if (qws_is_setup > 0) {
27  ++qws_is_setup;
28  return;
29  }
30 
31  int Nx = CommonParameters::Nx();
32  int Ny = CommonParameters::Ny();
33  int Nz = CommonParameters::Nz();
34  int Nt = CommonParameters::Nt();
35 
36  int npe_f[4];
37  npe_f[0] = CommonParameters::NPEx();
38  npe_f[1] = CommonParameters::NPEy();
39  npe_f[2] = CommonParameters::NPEz();
40  npe_f[3] = CommonParameters::NPEt();
41  int fbc_f[4];
42  fbc_f[0] = boundary[0];
43  fbc_f[1] = boundary[1];
44  fbc_f[2] = boundary[2];
45  fbc_f[3] = boundary[3];
46 
47  int pce_f = 0;
48  int pco_f = 1 - pce_f;
49 
50  int block_size[4]; // now not used, dummy.
51  block_size[0] = 2;
52  block_size[1] = 1;
53  block_size[2] = 1;
54  block_size[3] = 1;
55 
56  vout.general(vl, "qws_is_setup = %d\n", qws_is_setup);
57  vout.general(vl, " boundary conditation: %d %d %d %d\n", fbc_f[0], fbc_f[1], fbc_f[2], fbc_f[3]);
58  if (qws_is_setup == 0) {
59  qws_init_(&Nx, &Ny, &Nz, &Nt, npe_f, fbc_f, &pce_f, &pco_f,
60  block_size);
61  ++qws_is_setup;
62  vout.general(vl, "qws_init_ was called: new qws_is_setup=%d\n", qws_is_setup);
63  }
64  }
65 
66 
67  void tidyup_qws()
68  {
69  if (qws_is_setup > 0) {
70  qws_finalize_();
71  }
72  return;
73 
74  if (qws_is_setup == 0) {
75  return;
76  }
77  --qws_is_setup;
78  if (qws_is_setup == 0) {
79  qws_finalize_();
80  }
81  }
82 }
83 
84 extern "C" {
85 /*
86  extern int nt, nz, ny, nx;
87 
88  int std_xyzt2i_(int* j){
89  return j[0] + nx*(j[1] + ny*(j[2] + nz*j[3]));
90  }
91 
92  int e_o_(int* j){
93  return (j[0] + j[1] + j[2] + j[3]) % 2;
94  }
95 */
96 }
97 
98 #endif
CommonParameters::Ny
static int Ny()
Definition: commonParameters.h:106
CommonParameters::Nz
static int Nz()
Definition: commonParameters.h:107
bridgeIO.h
Bridge::GENERAL
@ GENERAL
Definition: bridgeIO.h:45
CommonParameters::Nx
static int Nx()
Definition: commonParameters.h:105
qws_lib.h
ParameterCheck::vl
Bridge::VerboseLevel vl
Definition: parameterCheck.cpp:18
CommonParameters::Nt
static int Nt()
Definition: commonParameters.h:108
CommonParameters::NPEz
static int NPEz()
Definition: commonParameters.h:99
CommonParameters::NPEy
static int NPEy()
Definition: commonParameters.h:98
CommonParameters::NPEx
static int NPEx()
Definition: commonParameters.h:97
CommonParameters::NPEt
static int NPEt()
Definition: commonParameters.h:100
commonParameters.h
Bridge::VerboseLevel
VerboseLevel
Definition: bridgeIO.h:42
Bridge::BridgeIO::general
void general(const char *format,...)
Definition: bridgeIO.cpp:200
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512