ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
realarray.h
Go to the documentation of this file.
1/*******************************************
2 * ESCP:Electro-Structure Calculate Package.
3 ********************************************/
4
5#ifndef REALARRAY_H
6#define REALARRAY_H
7
8#include <cassert>
9#include <fstream>
10#include <iomanip>
11#include <iostream>
12
13
14namespace ModuleBase
15{
21{
22 public:
23 double *ptr;
24
25 realArray(const int d1 = 1, const int d2 = 1, const int d3 = 1);
26 realArray(const int d1, const int d2, const int d3, const int d4);
27 ~realArray();
28
36 void create(const int d1, const int d2, const int d3);
37 void create(const int d1, const int d2, const int d3, const int d4);
38
39 realArray(const realArray &cd);
40
47 const realArray &operator=(const realArray &right);
54 const realArray &operator=(const double &right);
55
64 double &operator()(const int d1, const int d2, const int d3);
65 double &operator()(const int d1, const int d2, const int d3, const int d4);
66
76 const double &operator()(const int d1, const int d2, const int d3) const;
77 const double &operator()(const int d1, const int d2, const int d3, const int d4) const;
78
83 void zero_out(void);
84
90 int getSize() const
91 {
92 return size;
93 }
94
101 int getDim() const
102 {
103 return dim;
104 }
105
112 int getBound1() const
113 {
114 return bound1;
115 }
116
117 int getBound2() const
118 {
119 return bound2;
120 }
121
122 int getBound3() const
123 {
124 return bound3;
125 }
126
127 int getBound4() const
128 {
129 return bound4;
130 }
131
137 static int getArrayCount(void)
138 {
139 return arrayCount;
140 }
141
142 private:
143 int size;
144 int dim;
146 static int arrayCount;
147
148 void freemem();
149};
150
151//**************************************************
152// set elements of a as zeros which a is 1_d array.
153//**************************************************
154template <class T> void zeros(T *u, const int n)
155{
156 assert(n > 0);
157 for (int i = 0; i < n; i++)
158 u[i] = 0;
159}
160
161} // namespace ModuleBase
162
163#endif // realArray class
double float array
Definition realarray.h:21
static int getArrayCount(void)
Get the Array Count object.
Definition realarray.h:137
int bound1
Definition realarray.h:145
int bound2
Definition realarray.h:145
void zero_out(void)
Set all elements of an IntArray to zero.
Definition realarray.cpp:187
static int arrayCount
Definition realarray.h:146
const realArray & operator=(const realArray &right)
Equal a realArray to another one.
Definition realarray.cpp:127
double & operator()(const int d1, const int d2, const int d3)
Access elements by using operator "()".
Definition realarray.cpp:167
void create(const int d1, const int d2, const int d3)
create 3 dimensional real array
Definition realarray.cpp:109
int getDim() const
Get the Dim object i.e. the dimension of a real array.
Definition realarray.h:101
int dim
Definition realarray.h:144
void freemem()
Definition realarray.cpp:83
int size
Definition realarray.h:143
double * ptr
Definition realarray.h:23
int getBound4() const
Definition realarray.h:127
int bound4
Definition realarray.h:145
int getSize() const
Get the Size object.
Definition realarray.h:90
int bound3
Definition realarray.h:145
int getBound1() const
Get the Bound1 object i.e. the first dimension size.
Definition realarray.h:112
~realArray()
Definition realarray.cpp:78
int getBound3() const
Definition realarray.h:122
int getBound2() const
Definition realarray.h:117
#define T
Definition exp.cpp:237
D2< double > d2
Definition gint_move.hpp:19
Definition array_pool.h:6
void zeros(std::complex< T > *u, int n)
set elements of u as zero which u is 1_d std::complex array
Definition complexarray.h:141