trinitycrmod 0.7.3 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5ac9c19e9dada81c1e6a71927804d2871931e915
4
- data.tar.gz: f4a0b5d4baa473fdce6ee84b071948aca3919958
3
+ metadata.gz: b4c4064ac49be83fd3218fe6019c7c43abe85f88
4
+ data.tar.gz: 310f019da68adf055c8cc32a70048fdfac956ceb
5
5
  SHA512:
6
- metadata.gz: c5ef5ad0a3aebd7ee5412e939f6dbb6f88f92d6832ca22009e2aee4f840135055c438009c66ace33841fcd2b257097fba4444f0bd3e42019f2fb14ea4e688d44
7
- data.tar.gz: b229817ccdabf6cfb7ee4cfdc1872a2c24fb21a46d4546896993d67dc473346f5067c2305255fdb5311e66c2bb2d0d24c4e3e3034af6c0e455d0dfd36d8a008f
6
+ metadata.gz: 1d8442ecee17f61f52c84115d1db381bfa806fd97a343ea46ae6112a744be096aa353dbb83ad5eda37a3a35c60c66ee64e7afb928b38001838dc0985883158b3
7
+ data.tar.gz: 1fd338e931c0d1fd2dc94d86c8fb6c2382154f3bdea2e0ff5349b0792ece360b3e5dc1eb9ca76954c69069088d5f6494f51db6742342374f8534c564aab0c568
data/Gemfile CHANGED
@@ -4,6 +4,7 @@ source "http://rubygems.org"
4
4
  gem "coderunner", ">= 0.16.10"
5
5
  gem "text-data-tools", ">= 1.1.6"
6
6
  gem "gs2crmod", ">=0.11.76"
7
+ gem "gryfxcrmod", ">=0.1.9"
7
8
 
8
9
  # Add dependencies to develop your gem here.
9
10
  # Include everything needed to run rake, tests, features, etc.
data/Rakefile CHANGED
@@ -27,7 +27,7 @@ end
27
27
  Jeweler::RubygemsDotOrgTasks.new
28
28
 
29
29
  require 'rake/testtask'
30
- Rake::TestTask.new(:test) do |test|
30
+ Rake::TestTask.new(:test => [:clean_tests]) do |test|
31
31
  test.libs << 'lib' << 'test'
32
32
  test.pattern = 'test/**/test_*.rb'
33
33
  test.verbose = true
@@ -38,6 +38,41 @@ Rake::TestTask.new(:sync_variables) do |test|
38
38
  test.pattern = 'sync_variables/sync_variables.rb'
39
39
  test.verbose = true
40
40
  end
41
+
42
+ task :clean_tests do
43
+ require 'coderunner'
44
+ require 'rubygems'
45
+ require 'bundler'
46
+ begin
47
+ Bundler.setup(:default, :development)
48
+ rescue Bundler::BundlerError => e
49
+ $stderr.puts e.message
50
+ $stderr.puts "Run `bundle install` to install missing gems"
51
+ exit e.status_code
52
+ end
53
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
54
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
55
+ @runner = CodeRunner.fetch_runner(Y: 'test/gs2_42982', C: 'trinity', X: '/dev/null')
56
+ FileUtils.rm(@runner.run_class.rcp.user_defaults_location + '/rake_test_gs2_42982_defaults.rb') rescue nil
57
+ FileUtils.rm('test/gs2_42982/rake_test_gs2_42982_defaults.rb') rescue nil
58
+ FileUtils.rm('test/gs2_42982/pr08_jet_42982_1d.dat') rescue nil
59
+ FileUtils.rm('test/gs2_42982/pr08_jet_42982_2d.dat') rescue nil
60
+ FileUtils.rm('test/gs2_42982/.CODE_RUNNER_TEMP_RUN_LIST_CACHE') rescue nil
61
+ #STDIN.gets
62
+ FileUtils.rm_r('test/gs2_42982/v/') rescue nil
63
+ FileUtils.rm_r('test/gs2_42982_results/v') rescue nil
64
+ FileUtils.rm('test/gs2_42982_results/.code_runner_script_defaults.rb') rescue nil
65
+ FileUtils.rm('test/gs2_42982_results/.CODE_RUNNER_TEMP_RUN_LIST_CACHE') rescue nil
66
+ FileUtils.rm('test/ifspppl_results/.code_runner_script_defaults.rb') rescue nil
67
+ FileUtils.rm_r('test/ifspppl_results/v/id_1/') rescue nil
68
+ FileUtils.rm('test/ifspppl/.code_runner_script_defaults.rb') rescue nil
69
+ FileUtils.rm('test/ifspppl/.CODE_RUNNER_TEMP_RUN_LIST_CACHE') rescue nil
70
+ FileUtils.rm('test/gs2_42982/pr08_jet_42982_1d.dat') rescue nil
71
+ FileUtils.rm('test/gs2_42982/pr08_jet_42982_2d.dat') rescue nil
72
+ FileUtils.rm_r('test/ifspppl/v') rescue nil
73
+ end
74
+
75
+
41
76
 
42
77
 
43
78
  #require 'rcov/rcovtask
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.3
1
+ 0.7.4
@@ -12,6 +12,11 @@ class CodeRunner
12
12
  class FluxOptionError < StandardError; end
13
13
 
14
14
 
15
+ # Setup gs2 in case people are using it
16
+ CodeRunner.setup_run_class('gs2')
17
+ # Setup gryfx in case people are using it
18
+ CodeRunner.setup_run_class('gryfx')
19
+ require 'trinitycrmod/trinity_gs2'
15
20
 
16
21
  # Where this file is
17
22
  @code_module_folder = File.dirname(File.expand_path(__FILE__)) # i.e. the directory this file is in
@@ -28,12 +33,6 @@ class CodeRunner
28
33
  require 'trinitycrmod/flux_interpolator'
29
34
  require 'trinitycrmod/read_netcdf'
30
35
 
31
- # Setup gs2 in case people are using it
32
- CodeRunner.setup_run_class('gs2')
33
- require 'trinitycrmod/trinity_gs2'
34
-
35
- # Setup gryfx in case people are using it
36
- CodeRunner.setup_run_class('gryfx')
37
36
 
38
37
  ################################################
39
38
  # Quantities that are read or determined by CodeRunner
@@ -102,10 +101,10 @@ class CodeRunner
102
101
  #new_run = self.dup
103
102
  (rcp.variables).each{|v| new_run.set(v, send(v)) if send(v) or new_run.send(v)}
104
103
  if @flux_option == "gs2"
105
- gs2_runs.each_with_index do |run, i|
104
+ flux_runs.each_with_index do |run, i|
106
105
  CodeRunner::Gs2.rcp.variables.each{|v|
107
106
  next if [:ginit_option, :delt_option].include? v and new_run.no_restart_gs2
108
- new_run.gs2_runs[i].set(v, run.send(v)) if run.send(v) or new_run.gs2_runs[i].send(v)
107
+ new_run.flux_runs[i].set(v, run.send(v)) if run.send(v) or new_run.flux_runs[i].send(v)
109
108
  }
110
109
  end
111
110
  end
@@ -122,7 +121,7 @@ class CodeRunner
122
121
  new_run.init_file = @run_name + ".tmp"
123
122
  @runner.nprocs = @nprocs if @runner.nprocs == "1" # 1 is the default so this means the user probably didn't specify nprocs
124
123
  # This is unnecessary for single restart file.
125
- warning( "Restart is not on the same number of processors as the previous run: new is #{new_run.nprocs.inspect} and old is #{@nprocs.inspect}... this is only OK if you are using parallel netcdf and single restart files.") if not new_run.no_restart_gs2 and (!new_run.nprocs or new_run.nprocs != @nprocs)
124
+ warning( "Restart is not on the same number of processors as the previous run: new is #{new_run.nprocs.inspect} and old is #{@nprocs.inspect}... this is only OK if you are using parallel netcdf and single restart files.") if flux_gs2? and not new_run.no_restart_gs2 and (!new_run.nprocs or new_run.nprocs != @nprocs)
126
125
  raise "Restart cannot have a different sized jacobian: new is #{new_run.n_flux_tubes_jac} and old is #{n_flux_tubes_jac}" unless new_run.n_flux_tubes_jac == n_flux_tubes_jac
127
126
  # @runner.parameters.each{|var, value| new_run.set(var,value)} if @runner.parameters
128
127
  # ep @runner.parameters
@@ -141,38 +140,24 @@ class CodeRunner
141
140
  # run.
142
141
  FileUtils.cp("#@directory/#@run_name.#{ext}", "#{new_run.directory}/.")
143
142
  end
144
- if new_run.flux_option == "gs2" and @flux_option == "gs2" and not new_run.no_restart_gs2
143
+ if (new_run.flux_gs2? and flux_gs2?) and not new_run.no_restart_gs2
145
144
  for i in 0...n_flux_tubes
146
145
  break if i >= new_run.n_flux_tubes
147
- #if i >= n_flux_tubes_jac
148
- #jn = i - n_flux_tubes_jac + 1
149
- ##run_name = "calibrate_" + @run_name + (jn).to_s
150
- #folder = "calibrate_#{jn}"
151
- #else
152
- #jn = i + 1
153
- ##run_name = @run_name + (jn).to_s
154
- #folder = "flux_tube_#{jn}"
155
- #end
156
- #
157
- folder = gs2_folder_name(i)
158
-
159
- new_run.gs2_runs[i].directory = new_run.directory + "/#{folder}"
160
- FileUtils.makedirs(new_run.gs2_runs[i].directory)
161
- #ep ['gs2_runs[i] before', gs2_runs[i].nwrite, new_run.gs2_runs[i].nwrite, new_run.gs2_runs[i].parameter_hash]
162
- gs2_runs[i].restart(new_run.gs2_runs[i])
146
+ folder = flux_folder_name(i)
147
+
148
+ new_run.flux_runs[i].directory = new_run.directory + "/#{folder}"
149
+ FileUtils.makedirs(new_run.flux_runs[i].directory)
150
+ flux_runs[i].restart(new_run.flux_runs[i])
163
151
  if new_run.neval_calibrate and new_run.neval_calibrate > 0 and
164
- new_run.gs2_runs[i].nonlinear_mode == "off"
152
+ new_run.flux_runs[i].nonlinear_mode == "off"
165
153
 
166
- new_run.gs2_runs[i].ginit_option = "noise"
167
- new_run.gs2_runs[i].delt_option = "default"
168
- new_run.gs2_runs[i].is_a_restart = false
169
- new_run.gs2_runs[i].restart_id = nil
154
+ new_run.flux_runs[i].ginit_option = "noise"
155
+ new_run.flux_runs[i].delt_option = "default"
156
+ new_run.flux_runs[i].is_a_restart = false
157
+ new_run.flux_runs[i].restart_id = nil
170
158
  end
171
- #ep ['gs2_runs[i] after', gs2_runs[i].nwrite, new_run.gs2_runs[i].nwrite, new_run.gs2_runs[i].parameter_hash]
172
- #new_run.gs2_runs[i].run_name = new_run.run_name + (i+1).to_s
173
159
  end
174
160
  end
175
- #@runner.submit(new_run)
176
161
  new_run
177
162
  end
178
163
  # This is a hook which gets called just before submitting a simulation. It sets up the folder and generates any necessary input files.
@@ -184,7 +169,7 @@ class CodeRunner
184
169
  setup_chease if uses_chease?
185
170
  check_parameters
186
171
  write_input_file
187
- generate_gs2_input_files if @flux_option == "gs2"
172
+ generate_flux_input_files if flux_gs2? or flux_gryfx?
188
173
  end
189
174
 
190
175
 
@@ -198,10 +183,10 @@ class CodeRunner
198
183
  def update_submission_parameters(parameters, start_from_defaults=true)
199
184
  @set_flux_defaults_procs ||= []
200
185
  super(parameters, start_from_defaults)
201
- if @flux_option == "gs2"
186
+ if flux_gs2? or flux_gryfx?
202
187
  raise "No set_flux_defaults_procs defined" unless @set_flux_defaults_procs.size > 0
203
188
  @set_flux_defaults_procs.each{|prc| prc.call}
204
- gs2_parameter_hashes = {}
189
+ flux_parameter_hashes = {}
205
190
  if @flux_pars
206
191
  @flux_pars.each do |par, val|
207
192
  if val.kind_of? Hash
@@ -215,8 +200,8 @@ class CodeRunner
215
200
  range = n..n
216
201
  end
217
202
  for i in range
218
- gs2_parameter_hashes[i] ||= {}
219
- gs2_parameter_hashes[i][par] = v
203
+ flux_parameter_hashes[i] ||= {}
204
+ flux_parameter_hashes[i][par] = v
220
205
  end
221
206
  #gs2_parameter_hashes[n] ||= {}
222
207
  #gs2_parameter_hashes[n][par] = v
@@ -224,15 +209,15 @@ class CodeRunner
224
209
  else
225
210
  for i in 0...n_flux_tubes
226
211
  #gs2_runs.each{|r| r.set(par, val)}
227
- gs2_parameter_hashes[i] ||= {}
228
- gs2_parameter_hashes[i][par] = val
212
+ flux_parameter_hashes[i] ||= {}
213
+ flux_parameter_hashes[i][par] = val
229
214
  end
230
215
  end
231
216
  end
232
217
  end
233
218
  for i in 0...n_flux_tubes
234
- gs2_runs[i].parameter_hash = (gs2_parameter_hashes[i] || {}).inspect
235
- gs2_runs[i].update_submission_parameters(gs2_runs[i].parameter_hash, false)
219
+ flux_runs[i].parameter_hash = (flux_parameter_hashes[i] || {}).inspect
220
+ flux_runs[i].update_submission_parameters(flux_runs[i].parameter_hash, false)
236
221
  end
237
222
  end
238
223
  self
@@ -286,14 +271,14 @@ class CodeRunner
286
271
 
287
272
  # Writes the gs2 input files, creating separate subfolders
288
273
  # for them if @subfolders is .true.
289
- def generate_gs2_input_files
274
+ def generate_flux_input_files
290
275
  # At the moment we must use subfolders
291
276
  for i in 0...n_flux_tubes
292
277
  #gs2run = gs2_run(:base).dup
293
278
  #gs2_run(i).instance_variables.each do |var|
294
279
  #gs2run.instance_variable_set(var, gs2_run(i).instance_variable_get(var))
295
280
  #end
296
- gs2run = gs2_runs[i]
281
+ fluxrun = flux_runs[i]
297
282
  #ep ['gs2_runs[i] in generate', gs2_runs[i].nwrite]
298
283
  #p ['i',i]
299
284
  #if i >= n_flux_tubes_jac
@@ -306,20 +291,20 @@ class CodeRunner
306
291
  #folder = "flux_tube_#{jn}"
307
292
  #end
308
293
 
309
- folder = gs2_folder_name(i)
310
- run_name = gs2_run_name(i)
294
+ folder = flux_folder_name(i)
295
+ run_name = flux_run_name(i)
311
296
 
312
297
  if @subfolders and @subfolders.fortran_true?
313
- gs2run.directory = @directory + "/" + folder
314
- FileUtils.makedirs(gs2run.directory)
315
- gs2run.relative_directory = @relative_directory + "/" + folder
316
- gs2run.restart_dir = gs2run.directory + "/nc"
298
+ fluxrun.directory = @directory + "/" + folder
299
+ FileUtils.makedirs(fluxrun.directory)
300
+ fluxrun.relative_directory = @relative_directory + "/" + folder
301
+ fluxrun.restart_dir = fluxrun.directory + "/nc"
317
302
  else
318
- gs2run.directory = @directory
319
- gs2run.relative_directory = @relative_directory
303
+ fluxrun.directory = @directory
304
+ fluxrun.relative_directory = @relative_directory
320
305
  end
321
- gs2run.run_name = run_name
322
- gs2run.nprocs = @nprocs
306
+ fluxrun.run_name = run_name
307
+ fluxrun.nprocs = @nprocs
323
308
  if i==0
324
309
  block = Proc.new{check_parameters}
325
310
  else
@@ -327,15 +312,15 @@ class CodeRunner
327
312
  end
328
313
  #if @restart_id
329
314
  #gs2run.restart_id =
330
- Dir.chdir(gs2run.directory) do
331
- gs2run.generate_input_file(&block)
332
- gs2run.write_info
315
+ Dir.chdir(fluxrun.directory) do
316
+ fluxrun.generate_input_file(&block)
317
+ fluxrun.write_info
333
318
  end
334
319
 
335
320
  ### Hack the input file so that gs2 gets the location of
336
321
  # the restart dir correctly within trinity
337
- if @subfolders and @subfolders.fortran_true?
338
- infile = gs2run.directory + "/" + gs2run.run_name + ".in"
322
+ if @subfolders and @subfolders.fortran_true?
323
+ infile = fluxrun.directory + "/" + fluxrun.run_name + ".in"
339
324
  text = File.read(infile)
340
325
  File.open(infile, 'w'){|f| f.puts text.sub(/restart_dir\s*=\s*"nc"/, "restart_dir = \"#{folder}/nc\"")}
341
326
  end
@@ -377,11 +362,8 @@ class CodeRunner
377
362
  def generate_component_runs
378
363
  #puts "HERE"
379
364
  @component_runs ||= []
380
- if @flux_option == "gs2"
381
- #puts "HERE"
382
- #puts "generate_component_runs", @component_runs.size, @runner.run_list.size, caller.to_a.slice(0..9)
383
- #puts @component_runs[1].ginit_option if @component_runs.size > 0
384
- #STDIN.gets
365
+ if flux_gryfx? or flux_gs2?
366
+ fclass = flux_class
385
367
 
386
368
  for i in 0...n_flux_tubes
387
369
  component = @component_runs[i]
@@ -389,7 +371,7 @@ class CodeRunner
389
371
  if not component
390
372
  #p "HEELO"
391
373
  #p [i, '3,', component, '4', @component_runs.size]
392
- component = @component_runs[i] = Gs2::TrinityComponent.new(@runner, self).create_component
374
+ component = @component_runs[i] = fclass.new(@runner, self).create_component
393
375
  #component.instance_variable_set(:@output_file, output_file)
394
376
  #p [i, '3,', component, '4', @component_runs.size]
395
377
  if false
@@ -417,7 +399,7 @@ class CodeRunner
417
399
  #component.status = @status
418
400
  #p ["HERE2", @component_runs.size, @component_runs[i]]
419
401
  #Dir.chdir(@directory) {
420
- compdir = gs2_folder_name(i) # "flux_tube_#{i+1}"
402
+ compdir = flux_folder_name(i) # "flux_tube_#{i+1}"
421
403
  Dir.chdir(compdir){component.process_directory} if FileTest.exist? compdir
422
404
  #}
423
405
  component.component_runs = []
@@ -435,27 +417,6 @@ class CodeRunner
435
417
  end
436
418
 
437
419
 
438
- def save
439
- #@gs2_run_list.values.each{|r| r.runner = nil; r.component_runs = []} if @gs2_run_list.kind_of? Hash
440
- super
441
- #@gs2_run_list.values.each{|r| r.runner = @runner} if @gs2_run_list.kind_of? Hash
442
-
443
- #logf(:save)
444
- #raise CRFatal.new("Something has gone horribly wrong: runner.class is #{@runner.class} instead of CodeRunner") unless @runner.class.to_s == "CodeRunner"
445
- #runner, @runner = @runner, nil
446
- #@system_triers, old_triers = nil, @system_triers
447
- #@component_runs.each{|run| run.runner = nil; run.component_runs = []} if @component_runs
448
- ##@component_runs.each{|run| run.runner = nil} if @component_runs
449
- ## logi(self)
450
- ##pp self
451
- ##@component_runs.each{|ph| ph.instance_variables.each{|var| puts var; pp ph.instance_variable_get(var); STDIN.gets; puts ph.Marshal.dump(instance_variable_get(var))}} if @component_runs
452
- ##instance_variables.each{|var| puts var; instance_variable_get(var); puts Marshal.dump(instance_variable_get(var)); STDIN.gets}
453
- #Dir.chdir(@directory){File.open(".code_runner_run_data", 'w'){|file| file.puts Marshal.dump(self)}}
454
- #@runner = runner
455
- #@component_runs.each{|run| run.runner = runner} if @component_runs
456
- #@system_triers = old_triers
457
- end
458
-
459
420
  @source_code_subfolders = []
460
421
 
461
422
  # This method, as its name suggests, is called whenever CodeRunner is asked to analyse a run directory. This happens if the run status is not :Complete, or if the user has specified recalc_all(-A on the command line) or reprocess_all (-a on the command line).
@@ -7,8 +7,8 @@
7
7
  #end
8
8
  #end
9
9
  class CodeRunner
10
- class Gs2
11
- class TrinityComponent < Gs2
10
+ class Trinity
11
+ module TrinityComponent
12
12
  attr_accessor :trinity_run
13
13
  def initialize(runner, trinity_run)
14
14
  super(runner)
@@ -40,30 +40,37 @@ class CodeRunner
40
40
  @trinity_run = trinrun
41
41
  end
42
42
  end
43
- end
44
- class Trinity
43
+
44
+ class TrinityComponent::Gs2 < CodeRunner::Gs2
45
+ include TrinityComponent
46
+ end
47
+
48
+ class TrinityComponent::Gryfx < CodeRunner::Gryfx
49
+ include TrinityComponent
50
+ end
45
51
 
46
52
  # This function creates a new Trinity defaults file, with Trinity parameters taken from
47
53
  # trinity_input_file, and GS2 parameters taken from gs2_input_file. The file is then moved
48
54
  # to the CodeRunner central defaults location, the current folder is configured to use
49
55
  # the defaults file.
50
- def self.use_new_defaults_file_with_gs2(name = ARGV[-3], trinity_input_file = ARGV[-2], gs2_input_file = ARGV[-1])
51
- raise "Please specify a name, a trinity input file and a gs2 input file" if name == "use_new_gs2_defaults_file"
56
+ def self.use_new_defaults_file_with_flux(name = ARGV[-4], trinity_input_file = ARGV[-3], flux_input_file = ARGV[-2], fluxcode=ARGV[-1])
57
+ raise "Please specify a name, a trinity input file and a flux code input file" if name == "use_new_defaults_file_with_flux"
52
58
  defaults_filename = "#{name}_defaults.rb"
53
- tmp_filename = "#{name}_gs2tmp_defaults.rb"
59
+ tmp_filename = "#{name}_flxtmp_defaults.rb"
54
60
  central_defaults_filename = rcp.user_defaults_location + "/" + defaults_filename
55
- FileUtils.rm(name + '_defaults.rb') if FileTest.exist?(name + '_defaults.rb')
56
- FileUtils.rm(central_defaults_filename) if FileTest.exist?(central_defaults_filename)
61
+ #FileUtils.rm(name + '_defaults.rb') if FileTest.exist?(name + '_defaults.rb')
62
+ #FileUtils.rm(central_defaults_filename) if FileTest.exist?(central_defaults_filename)
57
63
  FileUtils.rm(tmp_filename) if FileTest.exist?(tmp_filename)
58
64
  raise "Defaults file: #{central_defaults_filename} already exists" if FileTest.exist? central_defaults_filename
59
65
 
66
+ flxclass = flux_class(fluxcode)
60
67
 
61
68
  make_new_defaults_file(name, trinity_input_file)
62
- CodeRunner::Gs2.make_new_defaults_file(name + '_gs2tmp', gs2_input_file)
69
+ flxclass.make_new_defaults_file(name + '_flxtmp', flux_input_file)
63
70
 
64
71
  File.open(defaults_filename, 'a'){|file| file.puts <<EOF2
65
72
  @set_flux_defaults_procs.push(Proc.new do
66
- gs2_runs.each do |run|
73
+ flux_runs.each do |run|
67
74
  run.instance_eval do
68
75
  #{File.read(tmp_filename).gsub(/\A|\n/, "\n ")}
69
76
  end
@@ -82,8 +89,9 @@ EOF2
82
89
 
83
90
  # Generates the component runs for GS2 and returns the hash
84
91
  # Raises an error if flux_option != "gs2"
85
- def gs2_runs
86
- raise FluxOptionError.new("gs2_runs called and flux_option != gs2") if not flux_gs2?
92
+ def flux_runs
93
+ raise FluxOptionError.new("flux_runs called and flux_option != gs2 or gryfx") if not flux_gs2? or flux_gryfx?
94
+
87
95
 
88
96
  #puts "2@COMMMMMMMMMMMMMPOOOOOOOOOOOOOONNNETN", @component_runs
89
97
  generate_component_runs if not (@component_runs and @component_runs.size == n_flux_tubes)
@@ -99,14 +107,14 @@ EOF2
99
107
  #@gs2_run_list[key]
100
108
  end
101
109
 
102
- # Override standard CodeRunner method to allow for Gs2 variables
110
+ # Override standard CodeRunner method to allow for flux code variables
103
111
  def evaluate_defaults_file(filename)
104
112
  text = File.read(filename)
105
113
  instance_eval(text)
106
114
  text.scan(/^\s*@(\w+)/) do
107
115
  var_name = $~[1].to_sym
108
116
  next if var_name == :defaults_file_description
109
- unless rcp.variables.include? var_name or (flux_gs2? and Gs2.rcp.variables.include? var_name)
117
+ unless rcp.variables.include? var_name or (flux_gs2? and Gs2.rcp.variables.include? var_name) or (flux_gryfx? and Gryfx.rcp.variables.include? var_name)
110
118
  warning("---#{var_name}---, specified in #{File.expand_path(filename)}, is not a variable. This could be an error")
111
119
  end
112
120
  end
@@ -123,12 +131,27 @@ EOF2
123
131
 
124
132
  end
125
133
 
134
+ def self.flux_class(code)
135
+ case code
136
+ when "gs2"
137
+ CodeRunner::Trinity::TrinityComponent::Gs2
138
+ when "gryfx"
139
+ CodeRunner::Trinity::TrinityComponent::Gryfx
140
+ end
141
+ end
142
+ def flux_class
143
+ self.class.flux_class(@flux_option)
144
+ end
126
145
  # Is the flux tube code being used gs2?
127
146
  def flux_gs2?
128
147
  @flux_option == "gs2"
129
148
  end
149
+ # Is the flux tube code being used gryfx?
150
+ def flux_gryfx?
151
+ @flux_option == "gryfx"
152
+ end
130
153
 
131
- def gs2_run_name(i)
154
+ def flux_run_name(i)
132
155
  if i >= n_flux_tubes_jac
133
156
  jn = i - n_flux_tubes_jac + 1
134
157
  run_name = "calibrate_" + @run_name + (jn).to_s
@@ -138,7 +161,7 @@ EOF2
138
161
  end
139
162
  run_name
140
163
  end
141
- def gs2_folder_name(i)
164
+ def flux_folder_name(i)
142
165
  if i >= n_flux_tubes_jac
143
166
  jn = i - n_flux_tubes_jac + 1
144
167
  folder = "calibrate_#{jn}"
data/trinitycrmod.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: trinitycrmod 0.7.3 ruby lib
5
+ # stub: trinitycrmod 0.7.4 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "trinitycrmod"
9
- s.version = "0.7.3"
9
+ s.version = "0.7.4"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
@@ -54,6 +54,7 @@ Gem::Specification.new do |s|
54
54
  s.add_runtime_dependency(%q<coderunner>, [">= 0.16.10"])
55
55
  s.add_runtime_dependency(%q<text-data-tools>, [">= 1.1.6"])
56
56
  s.add_runtime_dependency(%q<gs2crmod>, [">= 0.11.76"])
57
+ s.add_runtime_dependency(%q<gryfxcrmod>, [">= 0.1.9"])
57
58
  s.add_development_dependency(%q<shoulda>, [">= 0"])
58
59
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
59
60
  s.add_development_dependency(%q<bundler>, ["> 1.0.0"])
@@ -62,6 +63,7 @@ Gem::Specification.new do |s|
62
63
  s.add_dependency(%q<coderunner>, [">= 0.16.10"])
63
64
  s.add_dependency(%q<text-data-tools>, [">= 1.1.6"])
64
65
  s.add_dependency(%q<gs2crmod>, [">= 0.11.76"])
66
+ s.add_dependency(%q<gryfxcrmod>, [">= 0.1.9"])
65
67
  s.add_dependency(%q<shoulda>, [">= 0"])
66
68
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
67
69
  s.add_dependency(%q<bundler>, ["> 1.0.0"])
@@ -71,6 +73,7 @@ Gem::Specification.new do |s|
71
73
  s.add_dependency(%q<coderunner>, [">= 0.16.10"])
72
74
  s.add_dependency(%q<text-data-tools>, [">= 1.1.6"])
73
75
  s.add_dependency(%q<gs2crmod>, [">= 0.11.76"])
76
+ s.add_dependency(%q<gryfxcrmod>, [">= 0.1.9"])
74
77
  s.add_dependency(%q<shoulda>, [">= 0"])
75
78
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
76
79
  s.add_dependency(%q<bundler>, ["> 1.0.0"])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trinitycrmod
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edmund Highcock
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.11.76
55
+ - !ruby/object:Gem::Dependency
56
+ name: gryfxcrmod
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 0.1.9
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 0.1.9
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: shoulda
57
71
  requirement: !ruby/object:Gem::Requirement