Skip to content

Commit bdbb70b

Browse files
committed
update recip_to_real in the rhpw
1 parent 8973c25 commit bdbb70b

File tree

3 files changed

+329
-71
lines changed

3 files changed

+329
-71
lines changed

source/module_basis/module_pw/pw_basis.h

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,35 @@ class PW_Basis
267267
const bool add = false,
268268
const FPTYPE factor = 1.0) const; // in:(nz, ns) ; out(nplane,nx*ny)
269269

270+
template <typename FPTYPE, typename Device>
271+
void real_to_recip(const std::complex<FPTYPE>* in,
272+
std::complex<FPTYPE>* out,
273+
const Device* ctx=get_default_device_ctx(),
274+
const int ik=0,
275+
const bool add = false,
276+
const FPTYPE factor = 1.0) const; // in:(nplane,nx*ny) ; out(nz, ns)
277+
template <typename FPTYPE, typename Device>
278+
void recip_to_real(const std::complex<FPTYPE>* in,
279+
std::complex<FPTYPE>* out,
280+
const Device* ctx=get_default_device_ctx(),
281+
const int ik=0,
282+
const bool add = false,
283+
const FPTYPE factor = 1.0) const; // in:(nz, ns) ; out(nplane,nx*ny)
284+
285+
template <typename FPTYPE, typename Device = base_device::DEVICE_CPU>
286+
void real_to_recip(FPTYPE* in,
287+
std::complex<FPTYPE>* out,
288+
const Device* ctx=get_default_device_ctx(),
289+
const int ik=0,
290+
const bool add = false,
291+
const FPTYPE factor = 1.0) const; // in:(nplane,nx*ny) ; out(nz, ns)
292+
template <typename FPTYPE, typename Device = base_device::DEVICE_CPU>
293+
void recip_to_real(const std::complex<FPTYPE>* in,
294+
FPTYPE* out,
295+
const Device* ctx=get_default_device_ctx() ,
296+
const int ik=0,
297+
const bool add = false,
298+
const FPTYPE factor = 1.0) const; // in:(nz, ns) ; out(nplane,nx*ny)
270299
protected:
271300
//gather planes and scatter sticks of all processors
272301
template <typename T>
@@ -282,15 +311,16 @@ class PW_Basis
282311

283312
using resmem_int_op = base_device::memory::resize_memory_op<int, base_device::DEVICE_GPU>;
284313
using delmem_int_op = base_device::memory::delete_memory_op<int, base_device::DEVICE_GPU>;
285-
using syncmem_int_h2d_op
286-
= base_device::memory::synchronize_memory_op<int, base_device::DEVICE_GPU, base_device::DEVICE_CPU>;
287-
314+
using syncmem_int_h2d_op = base_device::memory::synchronize_memory_op<int, base_device::DEVICE_GPU, base_device::DEVICE_CPU>;
315+
// using default_device_cpu = base_device::DEVICE_CPU;
316+
288317
void set_device(std::string device_);
289318
void set_precision(std::string precision_);
290319

291320
protected:
292321
std::string device = "cpu";
293322
std::string precision = "double";
323+
static const base_device::DEVICE_CPU* get_default_device_ctx();
294324
};
295325

296326
}

0 commit comments

Comments
 (0)