Method: CodeRunner::Run::FortranNamelist#input_file_text

Defined in:
lib/coderunner/fortran_namelist.rb

#input_file_textObject

Generate input file text using the namelists, the values of the run instance variables and the customised method input_file_header.



595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
# File 'lib/coderunner/fortran_namelist.rb', line 595

def input_file_text
  text = input_file_header
  rcp.namelists.each do |namelist, hash|
    next if hash[:should_include].kind_of? String and not eval(hash[:should_include])
    if en = hash[:enumerator] # Single = is deliberate!
      next unless send(en[:name])
      send(en[:name]).times do |i|
        next unless hash[:variables].keys.inject(false){|b, v| b or !send(v+"_#{i+1}".to_sym).nil?} # i.e. at least one variable must be non-nil 
        text << namelist_text(namelist, i+1)
      end
    else
      next unless hash[:variables].keys.inject(false){|b, v| b or !send(v).nil?} # i.e. at least one variable must be non-nil 
      text << namelist_text(namelist)
    end
      
      
  end
  text
end