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.
1002 1003 1004 1005 |
# File 'lib/BOAST/Algorithm.rb', line 1002 def initialize(array,type = nil) super(array) @type = type::new if type end |
Instance Method Details
#to_s ⇒ Object
1006 1007 1008 |
# File 'lib/BOAST/Algorithm.rb', line 1006 def to_s self.to_str end |
#to_str ⇒ Object
1009 1010 1011 1012 |
# File 'lib/BOAST/Algorithm.rb', line 1009 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
1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 |
# File 'lib/BOAST/Algorithm.rb', line 1025 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
1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 |
# File 'lib/BOAST/Algorithm.rb', line 1013 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 |