Module: FFTW3::FFI::BindingTemplate
- Defined in:
- lib/fftw3/ffi/binding_template.rb
Class Method Summary collapse
-
.define_bindings(mod, prefix, lib_names) ⇒ Object
rubocop:disable Metrics/AbcSize,Metrics/MethodLength.
Class Method Details
.define_bindings(mod, prefix, lib_names) ⇒ Object
rubocop:disable Metrics/AbcSize,Metrics/MethodLength
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/fftw3/ffi/binding_template.rb', line 6 def self.define_bindings(mod, prefix, lib_names) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength mod.instance_variable_set(:@available, false) mod.define_singleton_method(:available?) { @available } begin mod.module_eval do extend ::FFI::Library ffi_lib lib_names callback :"#{prefix}write_char_func", [:char, :pointer], :void callback :"#{prefix}read_char_func", [:pointer], :int # --- Plan Execution / Destruction --- attach_function :"#{prefix}execute", [:pointer], :void attach_function :"#{prefix}destroy_plan", [:pointer], :void # --- Basic: Complex DFT --- attach_function :"#{prefix}plan_dft", [:int, :pointer, :pointer, :pointer, :int, :uint], :pointer attach_function :"#{prefix}plan_dft_1d", [:int, :pointer, :pointer, :int, :uint], :pointer attach_function :"#{prefix}plan_dft_2d", [:int, :int, :pointer, :pointer, :int, :uint], :pointer attach_function :"#{prefix}plan_dft_3d", [:int, :int, :int, :pointer, :pointer, :int, :uint], :pointer # --- Basic: R2C --- attach_function :"#{prefix}plan_dft_r2c", [:int, :pointer, :pointer, :pointer, :uint], :pointer attach_function :"#{prefix}plan_dft_r2c_1d", [:int, :pointer, :pointer, :uint], :pointer attach_function :"#{prefix}plan_dft_r2c_2d", [:int, :int, :pointer, :pointer, :uint], :pointer attach_function :"#{prefix}plan_dft_r2c_3d", [:int, :int, :int, :pointer, :pointer, :uint], :pointer # --- Basic: C2R --- attach_function :"#{prefix}plan_dft_c2r", [:int, :pointer, :pointer, :pointer, :uint], :pointer attach_function :"#{prefix}plan_dft_c2r_1d", [:int, :pointer, :pointer, :uint], :pointer attach_function :"#{prefix}plan_dft_c2r_2d", [:int, :int, :pointer, :pointer, :uint], :pointer attach_function :"#{prefix}plan_dft_c2r_3d", [:int, :int, :int, :pointer, :pointer, :uint], :pointer # --- Basic: R2R --- attach_function :"#{prefix}plan_r2r", [:int, :pointer, :pointer, :pointer, :pointer, :uint], :pointer attach_function :"#{prefix}plan_r2r_1d", [:int, :pointer, :pointer, :int, :uint], :pointer attach_function :"#{prefix}plan_r2r_2d", [:int, :int, :pointer, :pointer, :int, :int, :uint], :pointer attach_function :"#{prefix}plan_r2r_3d", [:int, :int, :int, :pointer, :pointer, :int, :int, :int, :uint], :pointer # --- Advanced (many) --- attach_function :"#{prefix}plan_many_dft", [:int, :pointer, :int, :pointer, :pointer, :int, :int, :pointer, :pointer, :int, :int, :int, :uint], :pointer attach_function :"#{prefix}plan_many_dft_r2c", [:int, :pointer, :int, :pointer, :pointer, :int, :int, :pointer, :pointer, :int, :int, :uint], :pointer attach_function :"#{prefix}plan_many_dft_c2r", [:int, :pointer, :int, :pointer, :pointer, :int, :int, :pointer, :pointer, :int, :int, :uint], :pointer attach_function :"#{prefix}plan_many_r2r", [:int, :pointer, :int, :pointer, :pointer, :int, :int, :pointer, :pointer, :int, :int, :pointer, :uint], :pointer # --- Guru --- attach_function :"#{prefix}plan_guru_dft", [:int, :pointer, :int, :pointer, :pointer, :pointer, :int, :uint], :pointer attach_function :"#{prefix}plan_guru_split_dft", [:int, :pointer, :int, :pointer, :pointer, :pointer, :pointer, :pointer, :uint], :pointer attach_function :"#{prefix}plan_guru_dft_r2c", [:int, :pointer, :int, :pointer, :pointer, :pointer, :uint], :pointer attach_function :"#{prefix}plan_guru_split_dft_r2c", [:int, :pointer, :int, :pointer, :pointer, :pointer, :pointer, :uint], :pointer attach_function :"#{prefix}plan_guru_dft_c2r", [:int, :pointer, :int, :pointer, :pointer, :pointer, :uint], :pointer attach_function :"#{prefix}plan_guru_split_dft_c2r", [:int, :pointer, :int, :pointer, :pointer, :pointer, :pointer, :uint], :pointer attach_function :"#{prefix}plan_guru_r2r", [:int, :pointer, :int, :pointer, :pointer, :pointer, :pointer, :uint], :pointer # --- Guru64 --- attach_function :"#{prefix}plan_guru64_dft", [:int, :pointer, :int, :pointer, :pointer, :pointer, :int, :uint], :pointer attach_function :"#{prefix}plan_guru64_split_dft", [:int, :pointer, :int, :pointer, :pointer, :pointer, :pointer, :pointer, :uint], :pointer attach_function :"#{prefix}plan_guru64_dft_r2c", [:int, :pointer, :int, :pointer, :pointer, :pointer, :uint], :pointer attach_function :"#{prefix}plan_guru64_split_dft_r2c", [:int, :pointer, :int, :pointer, :pointer, :pointer, :pointer, :uint], :pointer attach_function :"#{prefix}plan_guru64_dft_c2r", [:int, :pointer, :int, :pointer, :pointer, :pointer, :uint], :pointer attach_function :"#{prefix}plan_guru64_split_dft_c2r", [:int, :pointer, :int, :pointer, :pointer, :pointer, :pointer, :uint], :pointer attach_function :"#{prefix}plan_guru64_r2r", [:int, :pointer, :int, :pointer, :pointer, :pointer, :pointer, :uint], :pointer # --- New-array Execute --- attach_function :"#{prefix}execute_dft", [:pointer, :pointer, :pointer], :void attach_function :"#{prefix}execute_split_dft", [:pointer, :pointer, :pointer, :pointer, :pointer], :void attach_function :"#{prefix}execute_dft_r2c", [:pointer, :pointer, :pointer], :void attach_function :"#{prefix}execute_split_dft_r2c", [:pointer, :pointer, :pointer, :pointer], :void attach_function :"#{prefix}execute_dft_c2r", [:pointer, :pointer, :pointer], :void attach_function :"#{prefix}execute_split_dft_c2r", [:pointer, :pointer, :pointer, :pointer], :void attach_function :"#{prefix}execute_r2r", [:pointer, :pointer, :pointer], :void # --- Memory --- attach_function :"#{prefix}malloc", [:size_t], :pointer attach_function :"#{prefix}alloc_real", [:size_t], :pointer attach_function :"#{prefix}alloc_complex", [:size_t], :pointer attach_function :"#{prefix}free", [:pointer], :void # --- Wisdom --- attach_function :"#{prefix}export_wisdom_to_filename", [:string], :int attach_function :"#{prefix}export_wisdom_to_file", [:pointer], :void attach_function :"#{prefix}export_wisdom_to_string", [], :pointer attach_function :"#{prefix}export_wisdom", [:"#{prefix}write_char_func", :pointer], :void attach_function :"#{prefix}import_system_wisdom", [], :int attach_function :"#{prefix}import_wisdom_from_filename", [:string], :int attach_function :"#{prefix}import_wisdom_from_file", [:pointer], :int attach_function :"#{prefix}import_wisdom_from_string", [:string], :int attach_function :"#{prefix}import_wisdom", [:"#{prefix}read_char_func", :pointer], :int attach_function :"#{prefix}forget_wisdom", [], :void # --- Utility --- attach_function :"#{prefix}cleanup", [], :void attach_function :"#{prefix}set_timelimit", [:double], :void attach_function :"#{prefix}flops", [:pointer, :pointer, :pointer, :pointer], :void attach_function :"#{prefix}estimate_cost", [:pointer], :double attach_function :"#{prefix}cost", [:pointer], :double attach_function :"#{prefix}alignment_of", [:pointer], :int attach_function :"#{prefix}fprint_plan", [:pointer, :pointer], :void attach_function :"#{prefix}print_plan", [:pointer], :void attach_function :"#{prefix}sprint_plan", [:pointer], :pointer end mod.instance_variable_set(:@available, true) rescue LoadError # Library not available — module remains unavailable end end |