Class: DefIterSolve

Inherits:
DefGslClass show all
Defined in:
ext/numo/gsl/spmatrix/parse_spmatrix.rb

Constant Summary collapse

ITERSOLVE_TYPES =
ErbppGsl.read_type.select{|s|
  /gsl_splinalg_itersolve_/ =~ s
}

Instance Attribute Summary

Attributes inherited from ErbPP

#children, #parent

Instance Method Summary collapse

Methods inherited from DefGslClass

#define_method, #to_method_name

Methods included from ErbppGsl

FM, dbl, dblp, int, intp, long, read_const, read_enum, read_eval, read_func, read_func_pattern, read_type, str, szt, sztp, tp, uint, ulong, void

Methods inherited from DefClass

#_mod_var, #free_func, #init_erb, #initialize, #super_class

Methods inherited from DefModule

#_mod_var, #def_id, #id_list, #init_def, #init_erb, #initialize, #method_code

Methods included from DeclMethod

#def_alias, #def_alloc_func, #def_const, #def_method, #def_module_function, #def_singleton_method, #undef_alloc_func, #undef_method, #undef_singleton_method

Methods inherited from ErbPP

#add_child, #description, #find, #find_tmpl, #get, #init_def, #initialize, #load_erb, #method_missing, #method_missing_alias, #result, #run, #set, #write

Constructor Details

This class inherits a constructor from DefClass

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ErbPP

Instance Method Details

#check_func(h) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'ext/numo/gsl/spmatrix/parse_spmatrix.rb', line 54

def check_func(h)
  if t = lookup(h)
    m = h[:func_name].sub(/^gsl_splinalg_itersolve_/,"")
    DefMethod.new(self, t, name:m, **h)
    if /_alloc$/ =~ h[:func_name]
      t = "itersolve_type_new"
      ITERSOLVE_TYPES.each do |st|
        DefSubclassNew.new(self, t, st, **h)
      end
    end
    return true
  end
  $stderr.puts "skip #{h[:func_name]}"
  false
end

#lookup(h) ⇒ Object



40
41
42
43
44
45
46
47
48
# File 'ext/numo/gsl/spmatrix/parse_spmatrix.rb', line 40

def lookup(h)
  case h
  when FM(name:/_free$/);              false
  when FM(name:/_itersolve_alloc$/);   "itersolve_new"
  when FM(name:/_itersolve_iterate$/); "itersolve_iterate"
  when FM(tp, type:str);               "c_str_f_void"
  when FM(tp, type:dbl);               "c_double_f_void"
  end
end