@@ -10,43 +10,89 @@ namespace ModuleIO
1010{
1111bool read_cube (
1212#ifdef __MPI
13- Parallel_Grid* Pgrid,
13+ const Parallel_Grid*const Pgrid,
1414#endif
15- int my_rank,
16- std::string esolver_type,
17- int rank_in_stogroup,
18- const int & is,
15+ const int my_rank,
16+ const std::string esolver_type,
17+ const int rank_in_stogroup,
18+ const int is,
1919 std::ofstream& ofs_running,
20- const int & nspin,
20+ const int nspin,
2121 const std::string& fn,
22- double * data,
23- const int & nx,
24- const int & ny,
25- const int & nz,
22+ double *const data,
23+ const int nx,
24+ const int ny,
25+ const int nz,
2626 double & ef,
27- const UnitCell* ucell,
27+ const UnitCell*const ucell,
2828 int & prenspin,
29- const bool & warning_flag = true );
29+ const bool warning_flag = true );
3030
3131void write_cube (
3232#ifdef __MPI
33- const int & bz,
34- const int & nbz,
35- const int & nplane,
36- const int & startz_current,
33+ const int bz,
34+ const int nbz,
35+ const int nplane,
36+ const int startz_current,
3737#endif
38- const double * data,
39- const int & is,
40- const int & nspin,
41- const int & iter,
38+ const double *const data,
39+ const int is,
40+ const int nspin,
41+ const int iter,
4242 const std::string& fn,
43- const int & nx,
44- const int & ny,
45- const int & nz,
46- const double & ef,
47- const UnitCell* ucell,
48- const int & precision = 11 ,
49- const int & out_fermi = 1 ); // mohan add 2007-10-17
43+ const int nx,
44+ const int ny,
45+ const int nz,
46+ const double ef,
47+ const UnitCell*const ucell,
48+ const int precision = 11 ,
49+ const int out_fermi = 1 ); // mohan add 2007-10-17
50+
51+
52+ // when MPI:
53+ // read file as order (ixy,iz) to data[ixy*nz+iz]
54+ // when serial:
55+ // read file as order (ixy,iz) to data[iz*nxy+ixy]
56+ void read_cube_core_match (
57+ std::ifstream &ifs,
58+ #ifdef __MPI
59+ const Parallel_Grid*const Pgrid,
60+ const bool flag_read_rank,
61+ #endif
62+ double *const data,
63+ const int nxy,
64+ const int nz);
65+
66+ void read_cube_core_mismatch (
67+ std::ifstream &ifs,
68+ #ifdef __MPI
69+ const Parallel_Grid*const Pgrid,
70+ const bool flag_read_rank,
71+ #endif
72+ double *const data,
73+ const int nx,
74+ const int ny,
75+ const int nz,
76+ const int nx_read,
77+ const int ny_read,
78+ const int nz_read);
79+
80+ // when MPI:
81+ // write data[ixy*nplane+iz] to file as order (ixy,iz)
82+ // when serial:
83+ // write data[iz*nxy+ixy] to file as order (ixy,iz)
84+ void write_cube_core (
85+ std::ofstream &ofs_cube,
86+ #ifdef __MPI
87+ const int bz,
88+ const int nbz,
89+ const int nplane,
90+ const int startz_current,
91+ #endif
92+ const double *const data,
93+ const int nxy,
94+ const int nz,
95+ const int n_data_newline);
5096
5197 /* *
5298 * @brief The trilinear interpolation method
@@ -86,7 +132,7 @@ void write_cube(
86132 const int & ny,
87133 const int & nz,
88134#ifdef __MPI
89- double ** data
135+ std::vector<std::vector< double >> & data
90136#else
91137 double * data
92138#endif
0 commit comments