Class: CTioga2::Data::Backends::SMathBackend

Inherits:
Backend
  • Object
show all
Includes:
Dobjects, Math
Defined in:
lib/ctioga2/data/backends/backends/smath.rb

Instance Method Summary collapse

Methods included from Math

#abs

Methods inherited from Backend

#dataset, describe, #description, #expand_sets, #has_set?, list_backends, #set_param_from_string, #sets_available

Methods included from BackendDescriptionExtend

#base_description, #create_factory, #describe, #description, #factory_class, #factory_description, #factory_description_hash, #factory_description_list, #has_factory?, #inherit_parameters, #param, #param_accessor, #param_reader, #param_writer, #register_class, #set_description

Methods included from Log

context, counts, debug, error, fatal, #format_exception, #identify, info, init_logger, log_to, logger, set_level, #spawn, warn

Constructor Details

#initializeSMathBackend

Returns a new instance of SMathBackend.



53
54
55
56
57
58
# File 'lib/ctioga2/data/backends/backends/smath.rb', line 53

def initialize
  super()
  @samples = 30
  @u_range = -10.0..10.0
  @v_range = -10.0..10.0
end

Instance Method Details

#query_dataset(set) ⇒ Object

This is called by the architecture to get the data. It first splits the set name into func@range.



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
# File 'lib/ctioga2/data/backends/backends/smath.rb', line 62

def query_dataset(set)
  name = "#{set}"

  u_values = make_dvector(@u_range, @u_samples || @samples)
  v_values = make_dvector(@v_range, @v_samples || @samples)

  if ! (set.split_at_toplevel(/:/).size > 1)
    set = "u:v:#{set}"
  end

  val_u = Dvector.new
  val_v = Dvector.new
  for u in u_values
    for v in v_values
      val_u << u
      val_v << v
    end
  end

  

  return Dataset.dataset_from_spec(name, set) do |b|
    get_data_column(b, [val_u, val_v])
  end
end