Class: BOAST::ConstArray
Instance Method Summary collapse
-
#initialize(array, type = nil) ⇒ ConstArray
constructor
A new instance of ConstArray.
- #to_s ⇒ Object
- #to_str ⇒ Object
- #to_str_c ⇒ Object
- #to_str_fortran ⇒ Object
Constructor Details
#initialize(array, type = nil) ⇒ ConstArray
Returns a new instance of ConstArray.
1156 1157 1158 1159 |
# File 'lib/BOAST/Algorithm.rb', line 1156 def initialize(array,type = nil) super(array) @type = type::new if type end |
Instance Method Details
#to_s ⇒ Object
1160 1161 1162 |
# File 'lib/BOAST/Algorithm.rb', line 1160 def to_s self.to_str end |
#to_str ⇒ Object
1163 1164 1165 1166 |
# File 'lib/BOAST/Algorithm.rb', line 1163 def to_str return self.to_str_fortran if BOAST::get_lang == FORTRAN return self.to_str_c if [C, CL, CUDA].include?( BOAST::get_lang ) end |
#to_str_c ⇒ Object
1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 |
# File 'lib/BOAST/Algorithm.rb', line 1179 def to_str_c s = "" return s if self.first.nil? s += "{\n" s += self.first self[1..-1].each { |v| s += ",\n"+v } s += "}" end |
#to_str_fortran ⇒ Object
1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 |
# File 'lib/BOAST/Algorithm.rb', line 1167 def to_str_fortran s = "" return s if self.first.nil? s += "(/ &\n" s += self.first s += "_wp" if @type and @type.size == 8 self[1..-1].each { |v| s += ", &\n"+v s += "_wp" if @type and @type.size == 8 } s += " /)" end |