class Ikra::Symbolic::StencilArrayInput
An array containing values produced by one previous command.
Attributes
offsets[R]
out_of_bounds_value[R]
Public Class Methods
new(command:, pattern:, offsets:, out_of_bounds_value:)
click to toggle source
Calls superclass method
Ikra::Symbolic::Input::new
# File lib/symbolic/input.rb, line 46 def initialize(command:, pattern:, offsets:, out_of_bounds_value:) super(pattern: pattern) @command = command @offsets = offsets @out_of_bounds_value = out_of_bounds_value end
Public Instance Methods
==(other)
click to toggle source
Calls superclass method
Ikra::Symbolic::Input#==
# File lib/symbolic/input.rb, line 54 def ==(other) return super(other) && offsets == other.offsets && out_of_bounds_value == other.out_of_bounds_value end
accept(visitor)
click to toggle source
# File lib/symbolic/input_visitor.rb, line 19 def accept(visitor) visitor.visit_stecil_array_input(self, pattern: pattern) end
get_parameters(parent_command:, start_eat_params_offset: 0)
click to toggle source
# File lib/types/inference/input_inference.rb, line 32 def get_parameters(parent_command:, start_eat_params_offset: 0) # Parameters are allocated in a constant-sized array return [Translator::Variable.new( name: parent_command.block_parameter_names[start_eat_params_offset], type: command.result_type.to_array_type)] end
translate_input(parent_command:, command_translator:, start_eat_params_offset: 0)
click to toggle source
# File lib/translator/input_translator.rb, line 45 def translate_input(parent_command:, command_translator:, start_eat_params_offset: 0) # Parameters are allocated in a constant-sized array # Count number of parameters num_parameters = parent_command.offsets.size # Get single parameter name block_param_name = parent_command.block_parameter_names[start_eat_params_offset] # Translate input using visitor input_command_translation_result = command_translator.translate_input(self) # Take return type from previous computation parameters = [Translator::Variable.new( name: block_param_name, type: input_command_translation_result.result_type.to_array_type)] # Allocate and fill array of parameters actual_parameter_names = (0...num_parameters).map do |param_index| "_#{block_param_name}_#{param_index}" end param_array_init = "{ " + actual_parameter_names.join(", ") + " }" pre_execution = Translator.read_file(file_name: "stencil_array_reconstruction.cpp", replacements: { "type" => input_command_translation_result.result_type.to_c_type, "name" => block_param_name.to_s, "initializer" => param_array_init}) # Pass multiple single values instead of array override_block_parameters = actual_parameter_names.map do |param_name| Translator::Variable.new( name: param_name, type: input_command_translation_result.result_type) end return Translator::InputTranslationResult.new( pre_execution: pre_execution, parameters: parameters, override_block_parameters: override_block_parameters, command_translation_result: input_command_translation_result) end