Skip to content

Commit 0eaa9af

Browse files
committed
Add set_size() for BaseMatrix.
1 parent 38cef80 commit 0eaa9af

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

source/module_hamilt_lcao/module_hcontainer/atom_pair.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,10 @@ void AtomPair<T>::set_size(const int& col_size_in, const int& row_size_in)
347347
{
348348
this->col_size = col_size_in;
349349
this->row_size = row_size_in;
350+
for (int i = 0; i < this->values.size(); i++)
351+
{
352+
this->values[i].set_size(row_size_in, col_size_in);
353+
}
350354
}
351355

352356
// get paraV for check

source/module_hamilt_lcao/module_hcontainer/base_matrix.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,14 @@ size_t BaseMatrix<T>::get_memory_size() const
216216
return memory_size;
217217
}
218218

219+
// set size
220+
template <typename T>
221+
void BaseMatrix<T>::set_size(const int& nrow, const int& ncol)
222+
{
223+
this->nrow_local = nrow;
224+
this->ncol_local = ncol;
225+
}
226+
219227
// T of BaseMatrix can be double or complex<double>
220228
template class BaseMatrix<double>;
221229
template class BaseMatrix<std::complex<double>>;

source/module_hamilt_lcao/module_hcontainer/base_matrix.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,18 @@ class BaseMatrix
8080
*/
8181
size_t get_memory_size() const;
8282

83-
/**
83+
/**
8484
* @brief get col_size for this matrix
8585
*/
8686
int get_col_size() const {return ncol_local;};
8787
/**
8888
* @brief get row_size for this matrix
8989
*/
9090
int get_row_size() const {return nrow_local;};
91+
/**
92+
* @brief set col_size and row_size
93+
*/
94+
void set_size(const int& col_size_in, const int& row_size_in);
9195

9296
private:
9397
bool allocated = false;

0 commit comments

Comments
 (0)