1 // clang-format off
2 /* ----------------------------------------------------------------------
3 LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
4 https://www.lammps.org/, Sandia National Laboratories
5 Steve Plimpton, sjplimp@sandia.gov
6
7 Copyright (2003) Sandia Corporation. Under the terms of Contract
8 DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
9 certain rights in this software. This software is distributed under
10 the GNU General Public License.
11
12 See the README file in the top-level LAMMPS directory.
13 ------------------------------------------------------------------------- */
14
15 #include "fft3d_wrap.h"
16
17 #include "error.h"
18
19 using namespace LAMMPS_NS;
20
21 /* ---------------------------------------------------------------------- */
22
FFT3d(LAMMPS * lmp,MPI_Comm comm,int nfast,int nmid,int nslow,int in_ilo,int in_ihi,int in_jlo,int in_jhi,int in_klo,int in_khi,int out_ilo,int out_ihi,int out_jlo,int out_jhi,int out_klo,int out_khi,int scaled,int permute,int * nbuf,int usecollective)23 FFT3d::FFT3d(LAMMPS *lmp, MPI_Comm comm, int nfast, int nmid, int nslow,
24 int in_ilo, int in_ihi, int in_jlo, int in_jhi,
25 int in_klo, int in_khi,
26 int out_ilo, int out_ihi, int out_jlo, int out_jhi,
27 int out_klo, int out_khi,
28 int scaled, int permute, int *nbuf, int usecollective) : Pointers(lmp)
29 {
30 plan = fft_3d_create_plan(comm,nfast,nmid,nslow,
31 in_ilo,in_ihi,in_jlo,in_jhi,in_klo,in_khi,
32 out_ilo,out_ihi,out_jlo,out_jhi,out_klo,out_khi,
33 scaled,permute,nbuf,usecollective);
34 if (plan == nullptr) error->one(FLERR,"Could not create 3d FFT plan");
35 }
36
37 /* ---------------------------------------------------------------------- */
38
~FFT3d()39 FFT3d::~FFT3d()
40 {
41 fft_3d_destroy_plan(plan);
42 }
43
44 /* ---------------------------------------------------------------------- */
45
compute(FFT_SCALAR * in,FFT_SCALAR * out,int flag)46 void FFT3d::compute(FFT_SCALAR *in, FFT_SCALAR *out, int flag)
47 {
48 fft_3d((FFT_DATA *) in,(FFT_DATA *) out,flag,plan);
49 }
50
51 /* ---------------------------------------------------------------------- */
52
timing1d(FFT_SCALAR * in,int nsize,int flag)53 void FFT3d::timing1d(FFT_SCALAR *in, int nsize, int flag)
54 {
55 fft_1d_only((FFT_DATA *) in,nsize,flag,plan);
56 }
57