Loading src/include/tfrfme.h +3 −6 Original line number Original line Diff line number Diff line Loading @@ -63,6 +63,9 @@ protected: void write_legacy(const std::string& file_name); void write_legacy(const std::string& file_name); public: public: //! \brief Read only view on WK. const dcomplex *vec_wk; /*! \brief Swap1 instance constructor. /*! \brief Swap1 instance constructor. * * * \param lm: `int` Maximum field expansion order. * \param lm: `int` Maximum field expansion order. Loading Loading @@ -97,12 +100,6 @@ public: */ */ static long get_memory_requirement(int lm, int _nkv); static long get_memory_requirement(int lm, int _nkv); /*! \brief Get the pointer to the WK vector. * * \return value: `complex double *` Memory address of the WK vector. */ dcomplex *get_vector() { return wk; } /*! \brief Bring the pointer to the next element at the start of vector. /*! \brief Bring the pointer to the next element at the start of vector. */ */ void reset() { last_index = 0; } void reset() { last_index = 0; } Loading src/libnptm/tfrfme.cpp +3 −6 Original line number Original line Diff line number Diff line Loading @@ -52,6 +52,7 @@ Swap1::Swap1(int lm, int _nkv) { nlmmt = 2 * lm * (lm + 2); nlmmt = 2 * lm * (lm + 2); const int size = nkv * nkv * nlmmt; const int size = nkv * nkv * nlmmt; wk = new dcomplex[size](); wk = new dcomplex[size](); vec_wk = wk; last_index = 0; last_index = 0; } } Loading @@ -77,21 +78,19 @@ Swap1* Swap1::from_hdf5(const std::string& file_name) { string str_type; string str_type; int _nlmmt, _nkv, lm, num_elements, index; int _nlmmt, _nkv, lm, num_elements, index; dcomplex value; dcomplex value; dcomplex *_wk = NULL; if (status == 0) { if (status == 0) { status = hdf_file->read("NLMMT", "INT32", &_nlmmt); status = hdf_file->read("NLMMT", "INT32", &_nlmmt); status = hdf_file->read("NKV", "INT32", &_nkv); status = hdf_file->read("NKV", "INT32", &_nkv); lm = (int)((-2.0 + sqrt(4.0 + 2.0 * _nlmmt)) / 2.0); lm = (int)((-2.0 + sqrt(4.0 + 2.0 * _nlmmt)) / 2.0); num_elements = 2 * _nlmmt * _nkv * _nkv; num_elements = 2 * _nlmmt * _nkv * _nkv; instance = new Swap1(lm, _nkv); instance = new Swap1(lm, _nkv); _wk = instance->get_vector(); elements = new double[num_elements](); elements = new double[num_elements](); str_type = "FLOAT64_(" + to_string(num_elements) + ")"; str_type = "FLOAT64_(" + to_string(num_elements) + ")"; status = hdf_file->read("WK", str_type, elements); status = hdf_file->read("WK", str_type, elements); for (int wi = 0; wi < num_elements / 2; wi++) { for (int wi = 0; wi < num_elements / 2; wi++) { index = 2 * wi; index = 2 * wi; value = elements[index] + elements[index + 1] * I; value = elements[index] + elements[index + 1] * I; _wk[wi] = value; instance->wk[wi] = value; } // wi loop } // wi loop delete[] elements; delete[] elements; status = hdf_file->close(); status = hdf_file->close(); Loading @@ -103,7 +102,6 @@ Swap1* Swap1::from_hdf5(const std::string& file_name) { Swap1* Swap1::from_legacy(const std::string& file_name) { Swap1* Swap1::from_legacy(const std::string& file_name) { fstream input; fstream input; Swap1 *instance = NULL; Swap1 *instance = NULL; dcomplex *_wk = NULL; int _nlmmt, _nkv, lm; int _nlmmt, _nkv, lm; double rval, ival; double rval, ival; input.open(file_name.c_str(), ios::in | ios::binary); input.open(file_name.c_str(), ios::in | ios::binary); Loading @@ -112,12 +110,11 @@ Swap1* Swap1::from_legacy(const std::string& file_name) { lm = (int)((-2.0 + sqrt(4.0 + 2.0 * _nlmmt)) / 2.0); lm = (int)((-2.0 + sqrt(4.0 + 2.0 * _nlmmt)) / 2.0); input.read(reinterpret_cast<char *>(&_nkv), sizeof(int)); input.read(reinterpret_cast<char *>(&_nkv), sizeof(int)); instance = new Swap1(lm, _nkv); instance = new Swap1(lm, _nkv); _wk = instance->get_vector(); int num_elements = _nlmmt * _nkv * _nkv; int num_elements = _nlmmt * _nkv * _nkv; for (int j = 0; j < num_elements; j++) { for (int j = 0; j < num_elements; j++) { input.read(reinterpret_cast<char *>(&rval), sizeof(double)); input.read(reinterpret_cast<char *>(&rval), sizeof(double)); input.read(reinterpret_cast<char *>(&ival), sizeof(double)); input.read(reinterpret_cast<char *>(&ival), sizeof(double)); _wk[j] = rval + ival * I; instance->wk[j] = rval + ival * I; } } input.close(); input.close(); } else { } else { Loading src/libnptm/tra_subs.cpp +3 −3 File changed.Contains only whitespace changes. Show changes Loading
src/include/tfrfme.h +3 −6 Original line number Original line Diff line number Diff line Loading @@ -63,6 +63,9 @@ protected: void write_legacy(const std::string& file_name); void write_legacy(const std::string& file_name); public: public: //! \brief Read only view on WK. const dcomplex *vec_wk; /*! \brief Swap1 instance constructor. /*! \brief Swap1 instance constructor. * * * \param lm: `int` Maximum field expansion order. * \param lm: `int` Maximum field expansion order. Loading Loading @@ -97,12 +100,6 @@ public: */ */ static long get_memory_requirement(int lm, int _nkv); static long get_memory_requirement(int lm, int _nkv); /*! \brief Get the pointer to the WK vector. * * \return value: `complex double *` Memory address of the WK vector. */ dcomplex *get_vector() { return wk; } /*! \brief Bring the pointer to the next element at the start of vector. /*! \brief Bring the pointer to the next element at the start of vector. */ */ void reset() { last_index = 0; } void reset() { last_index = 0; } Loading
src/libnptm/tfrfme.cpp +3 −6 Original line number Original line Diff line number Diff line Loading @@ -52,6 +52,7 @@ Swap1::Swap1(int lm, int _nkv) { nlmmt = 2 * lm * (lm + 2); nlmmt = 2 * lm * (lm + 2); const int size = nkv * nkv * nlmmt; const int size = nkv * nkv * nlmmt; wk = new dcomplex[size](); wk = new dcomplex[size](); vec_wk = wk; last_index = 0; last_index = 0; } } Loading @@ -77,21 +78,19 @@ Swap1* Swap1::from_hdf5(const std::string& file_name) { string str_type; string str_type; int _nlmmt, _nkv, lm, num_elements, index; int _nlmmt, _nkv, lm, num_elements, index; dcomplex value; dcomplex value; dcomplex *_wk = NULL; if (status == 0) { if (status == 0) { status = hdf_file->read("NLMMT", "INT32", &_nlmmt); status = hdf_file->read("NLMMT", "INT32", &_nlmmt); status = hdf_file->read("NKV", "INT32", &_nkv); status = hdf_file->read("NKV", "INT32", &_nkv); lm = (int)((-2.0 + sqrt(4.0 + 2.0 * _nlmmt)) / 2.0); lm = (int)((-2.0 + sqrt(4.0 + 2.0 * _nlmmt)) / 2.0); num_elements = 2 * _nlmmt * _nkv * _nkv; num_elements = 2 * _nlmmt * _nkv * _nkv; instance = new Swap1(lm, _nkv); instance = new Swap1(lm, _nkv); _wk = instance->get_vector(); elements = new double[num_elements](); elements = new double[num_elements](); str_type = "FLOAT64_(" + to_string(num_elements) + ")"; str_type = "FLOAT64_(" + to_string(num_elements) + ")"; status = hdf_file->read("WK", str_type, elements); status = hdf_file->read("WK", str_type, elements); for (int wi = 0; wi < num_elements / 2; wi++) { for (int wi = 0; wi < num_elements / 2; wi++) { index = 2 * wi; index = 2 * wi; value = elements[index] + elements[index + 1] * I; value = elements[index] + elements[index + 1] * I; _wk[wi] = value; instance->wk[wi] = value; } // wi loop } // wi loop delete[] elements; delete[] elements; status = hdf_file->close(); status = hdf_file->close(); Loading @@ -103,7 +102,6 @@ Swap1* Swap1::from_hdf5(const std::string& file_name) { Swap1* Swap1::from_legacy(const std::string& file_name) { Swap1* Swap1::from_legacy(const std::string& file_name) { fstream input; fstream input; Swap1 *instance = NULL; Swap1 *instance = NULL; dcomplex *_wk = NULL; int _nlmmt, _nkv, lm; int _nlmmt, _nkv, lm; double rval, ival; double rval, ival; input.open(file_name.c_str(), ios::in | ios::binary); input.open(file_name.c_str(), ios::in | ios::binary); Loading @@ -112,12 +110,11 @@ Swap1* Swap1::from_legacy(const std::string& file_name) { lm = (int)((-2.0 + sqrt(4.0 + 2.0 * _nlmmt)) / 2.0); lm = (int)((-2.0 + sqrt(4.0 + 2.0 * _nlmmt)) / 2.0); input.read(reinterpret_cast<char *>(&_nkv), sizeof(int)); input.read(reinterpret_cast<char *>(&_nkv), sizeof(int)); instance = new Swap1(lm, _nkv); instance = new Swap1(lm, _nkv); _wk = instance->get_vector(); int num_elements = _nlmmt * _nkv * _nkv; int num_elements = _nlmmt * _nkv * _nkv; for (int j = 0; j < num_elements; j++) { for (int j = 0; j < num_elements; j++) { input.read(reinterpret_cast<char *>(&rval), sizeof(double)); input.read(reinterpret_cast<char *>(&rval), sizeof(double)); input.read(reinterpret_cast<char *>(&ival), sizeof(double)); input.read(reinterpret_cast<char *>(&ival), sizeof(double)); _wk[j] = rval + ival * I; instance->wk[j] = rval + ival * I; } } input.close(); input.close(); } else { } else { Loading