Method: CodeRunner::Run::FortranNamelist.process_synchronisation

Defined in:
lib/coderunner/fortran_namelist.rb

.process_synchronisation(source, nms, all_variables_in_source, namelist_declarations) ⇒ Object



1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
# File 'lib/coderunner/fortran_namelist.rb', line 1228

def self.process_synchronisation(source, nms, all_variables_in_source, namelist_declarations)
  delete_old_variables(all_variables_in_source)

  raise "No namelists found" if nms.size == 0
  eputs nms.keys.zip(nms.values.map{|vs| vs.size})
  eputs "Namelists to be added to. (Press Enter)"; STDIN.gets unless CodeRunner.global_options(:non_interactive)
  n = 0
  ep nms
#   ep nms.values.sum
  nms.values.sum.each do |var|
    eputs var if variable_exists? var
  end
  eputs "Conflicting Variables. (Press Enter)";; STDIN.gets unless CodeRunner.global_options(:non_interactive)
  nms.each do |namelist, vars|
    ep namelist
    ep vars
    vars.each do |var|
#       next unless var == :w_antenna
      sample_val = get_sample_value(source, var)
      p namelist, var, sample_val
      add_code_variable_to_namelist(namelist, var, sample_val)
    end
  end
  ep n
end