Esempio n. 1
0
    def _getGlobalFFTWMachine(FFTMachineType, GridShape, dtype):
        """Returns an FFTWMachine matching the arguments.
        Makes sure an FFTW machine is initialized only once per process, and only as needed.
        """
        machine = ClassDDEGridMachine._global_fftw_machines.get(
            (GridShape, dtype))
        if machine is None:
            if FFTMachineType == "FFTW":
                # use single-core FFT because we parallelize by facet instead
                ClassDDEGridMachine._global_fftw_machines[(
                    GridShape,
                    dtype)] = machine = ModFFTW.FFTW_2Donly(GridShape,
                                                            dtype,
                                                            ncores=1)
            elif FFTMachineType == "LAPACK":
                ClassDDEGridMachine._global_fftw_machines[(
                    GridShape, dtype)] = machine = ModFFTW.FFTW_2Donly_np(
                        GridShape, dtype)

        return machine
Esempio n. 2
0
    def __init__(self,
                 GridShape=None,
                 PaddingInnerCoord=None,
                 OverS=None,
                 Padding=None,
                 dtype=None,
                 ifzfCF=None,
                 Mode="Blender",
                 GD=None):

        self.GridShape = GridShape
        self.PaddingInnerCoord = PaddingInnerCoord
        self.OverS = OverS
        self.Padding = Padding
        self.dtype = dtype
        self.ifzfCF = ifzfCF
        self.GD = GD
        self.FFTWMachine = ModFFTW.FFTW_2Donly_np(self.GridShape,
                                                  self.dtype,
                                                  ncores=1)
        self.Mode = Mode