Class: BOAST::Dimension

Inherits:
Object show all
Defined in:
lib/BOAST/Algorithm.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(v1 = nil, v2 = nil) ⇒ Dimension

Returns a new instance of Dimension.



1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
# File 'lib/BOAST/Algorithm.rb', line 1045

def initialize(v1=nil,v2=nil)
  @size = nil
  @val1 = nil
  @val2 = nil
  if v2.nil? and v1 then
    @val1 = BOAST::get_array_start
    @val2 = v1 + BOAST::get_array_start - 1
    @size = v1
  else
    @val1 = v1
    @val2 = v2
  end
end

Instance Attribute Details

#size ⇒ Object (readonly)

Returns the value of attribute size.



1044
1045
1046
# File 'lib/BOAST/Algorithm.rb', line 1044

def size
  @size
end

#val1 ⇒ Object (readonly)

Returns the value of attribute val1.



1042
1043
1044
# File 'lib/BOAST/Algorithm.rb', line 1042

def val1
  @val1
end

#val2 ⇒ Object (readonly)

Returns the value of attribute val2.



1043
1044
1045
# File 'lib/BOAST/Algorithm.rb', line 1043

def val2
  @val2
end

Class Method Details

.parens(*args, &block) ⇒ Object



1038
1039
1040
# File 'lib/BOAST/Algorithm.rb', line 1038

def self.parens(*args,&block)
  return self::new(*args,&block)
end

Instance Method Details

#to_s ⇒ Object



1075
1076
1077
# File 'lib/BOAST/Algorithm.rb', line 1075

def to_s
  self.to_str
end

#to_str ⇒ Object



1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
# File 'lib/BOAST/Algorithm.rb', line 1058

def to_str
  s = ""
  if @val2 then
    if BOAST::get_lang == FORTRAN then
      s += @val1.to_s
      s += ":"
      s += @val2.to_s
    elsif [C, CL, CUDA].include?( BOAST::get_lang ) then
      s += (@val2 - @val1 + 1).to_s
    end
  elsif @val1.nil? then
    return nil
  else
    s += @val1.to_s
  end
  return s
end