coderunner 0.11.5 → 0.11.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/coderunner.gemspec +3 -2
- data/lib/coderunner/fortran_namelist.rb +13 -4
- data/lib/coderunner/instance_methods.rb +22 -18
- data/lib/coderunner/system_modules/moab.rb +2 -0
- metadata +3 -6
data/Rakefile
CHANGED
@@ -24,6 +24,7 @@ Jeweler::Tasks.new do |gem|
|
|
24
24
|
gem.authors = ["Edmund Highcock"]
|
25
25
|
gem.extensions = "ext/extconf.rb"
|
26
26
|
gem.files.include('ext/*.c', 'include/*.h', 'ext/*.rb')
|
27
|
+
gem.required_ruby_version = '>= 1.9.1'
|
27
28
|
# dependencies defined in Gemfile
|
28
29
|
end
|
29
30
|
Jeweler::RubygemsDotOrgTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.11.
|
1
|
+
0.11.6
|
data/coderunner.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "coderunner"
|
8
|
-
s.version = "0.11.
|
8
|
+
s.version = "0.11.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Edmund Highcock"]
|
12
|
-
s.date = "2012-10-
|
12
|
+
s.date = "2012-10-10"
|
13
13
|
s.description = "CodeRunner is a framework for the automated running and analysis of simulations. It automatically generates any necessary input files, organises the output data and analyses it. Because it is a modular system, it can easily be customised to work with any system and any simulation code. One of its greatest strengths is that it is independent of any one simulation code; thus it can easily plot and compare the data from different codes."
|
14
14
|
s.email = "edmundhighcock@sourceforge.net"
|
15
15
|
s.executables = ["coderunner"]
|
@@ -71,6 +71,7 @@ Gem::Specification.new do |s|
|
|
71
71
|
s.homepage = "http://coderunner.sourceforge.net"
|
72
72
|
s.licenses = ["GPLv3"]
|
73
73
|
s.require_paths = ["lib"]
|
74
|
+
s.required_ruby_version = Gem::Requirement.new(">= 1.9.1")
|
74
75
|
s.rubyforge_project = "coderunner"
|
75
76
|
s.rubygems_version = "1.8.24"
|
76
77
|
s.summary = "A framework for the automated running and analysis of simulations."
|
@@ -64,6 +64,12 @@ class Run
|
|
64
64
|
end
|
65
65
|
arr
|
66
66
|
end
|
67
|
+
|
68
|
+
@variable_names_from_code_names = @variables_with_hashes.inject({}) do |hash, (var, var_hash)|
|
69
|
+
hash[(var_hash[:code_name] || var)] = var
|
70
|
+
hash
|
71
|
+
end
|
72
|
+
|
67
73
|
|
68
74
|
|
69
75
|
# VARIABLES = VARIABLES_WITH_HELP.keys
|
@@ -534,9 +540,11 @@ def self.parse_input_file(input_file, strict=true)
|
|
534
540
|
end
|
535
541
|
namelist_hash = {}
|
536
542
|
regex = Regexp.new("#{rcp.matching_regex.to_s}\\s*(?:\\!(?<comment>.*))?\\n")
|
543
|
+
#ep input_file
|
537
544
|
text.scan(/(?:^\s*\!\s*(?<namelist_comment>[^\n]+))?\n^\&(?<namelist>\S+).*?^\//m) do
|
538
545
|
namelist = $~[:namelist].to_sym
|
539
546
|
hash = namelist_hash[namelist] = {}
|
547
|
+
#p $~
|
540
548
|
scan_text_for_variables($~.to_s).each do |var, val|
|
541
549
|
add_code_variable_to_namelist(namelist, var, val) if @strict
|
542
550
|
hash[var] = val
|
@@ -555,8 +563,8 @@ def self.scan_text_for_variables(text)
|
|
555
563
|
match = $~
|
556
564
|
var = match[:name].to_sym
|
557
565
|
default = match[:default.to_sym]
|
558
|
-
default = (match[:float] or match[:complex]) ? match[:default].gsub(/(\.)(\D|$)/, '\10\2').gsub(/[dD]/, 'e').gsub(/(\D)(\.)/, '\10\2') : match[:default]
|
559
|
-
#
|
566
|
+
default = (match[:float] or match[:complex]) ? match[:default].gsub(/(\.)(\D|$)/, '\10\2').gsub(/[dD]/, 'e').gsub(/(\D|^)(\.)/, '\10\2') : match[:default]
|
567
|
+
#ep 'default', default
|
560
568
|
default = eval(default) unless match[:word] or match[:complex]
|
561
569
|
default= Complex(*default.scan(LongRegexen::FLOAT).map{|f| f[0].to_f}) if match[:complex]
|
562
570
|
arr.push [var, default]
|
@@ -787,11 +795,12 @@ def make_info_file(file=ARGV[-1], strict=true)
|
|
787
795
|
namelist = namelist.to_s.sub(/\_(?<num>\d+)$/, '').to_sym
|
788
796
|
if $~ # I.e if there was a number at the end of the namelist
|
789
797
|
# ep namelist
|
790
|
-
"This namelist: #{namelist} should have an enumerator and does not have one" if not rcp.namelists[namelist][:enumerator]
|
798
|
+
raise "This namelist: #{namelist} should have an enumerator and does not have one" if not rcp.namelists[namelist][:enumerator]
|
791
799
|
num = $~[:num]
|
792
800
|
end
|
793
801
|
vars.each do |var, value|
|
794
|
-
var
|
802
|
+
#ep 'var', var
|
803
|
+
var = (rcp.variable_names_from_code_names[var.to_sym] + (num ? "_#{num}" : "")).to_sym
|
795
804
|
# p var, value
|
796
805
|
set(var, value)
|
797
806
|
end
|
@@ -206,7 +206,7 @@ class CodeRunner
|
|
206
206
|
|
207
207
|
def read_defaults
|
208
208
|
DEFAULT_RUNNER_OPTIONS.each{|key,value| set(key, value)}
|
209
|
-
#
|
209
|
+
#ep DEFAULT_RUNNER_OPTIONS, @multiple_processes
|
210
210
|
|
211
211
|
read_folder_defaults
|
212
212
|
end
|
@@ -343,13 +343,13 @@ class CodeRunner
|
|
343
343
|
setup_run_class(code.downcase, modlet: modlet)
|
344
344
|
end
|
345
345
|
|
346
|
+
SETUP_RUN_CLASSES =[]
|
346
347
|
|
347
348
|
# Create, set up and check the validity of the custom class which deals with a particular simulation code. This class will be defined in a custom module in the folder <tt>code_modules/code_name</tt>, where <tt>'code_name'</tt> is the name of the code. The only option is <tt>modlet:</tt>.
|
348
349
|
#
|
349
350
|
# If the custom class has already been set up, this method just returns the class.
|
350
351
|
|
351
352
|
|
352
|
-
SETUP_RUN_CLASSES =[]
|
353
353
|
def self.setup_run_class(code, options={})
|
354
354
|
# logf(:setup_code)
|
355
355
|
# log(:code, code)
|
@@ -387,6 +387,7 @@ class CodeRunner
|
|
387
387
|
|
388
388
|
|
389
389
|
code_module_name = SCRIPT_FOLDER+ "/code_modules/#{code}/#{code}.rb"
|
390
|
+
code_module_name = "#{code}crmod"
|
390
391
|
require code_module_name
|
391
392
|
# ep get_run_class_name(code, nil)
|
392
393
|
run_class = const_get(get_run_class_name(code, nil))
|
@@ -410,19 +411,22 @@ class CodeRunner
|
|
410
411
|
#Some codes require an modlet; the flag modlet_required is specified in the code module
|
411
412
|
if run_class.rcp.modlet_required
|
412
413
|
raise CRFatal.new("Modlet necessary and none given") unless modlet
|
414
|
+
end
|
415
|
+
#If a modlet is specified (modlets can also be optional)
|
416
|
+
if modlet
|
413
417
|
# Log.logi(:modlet, modlet)
|
414
|
-
if ( modlet_location = "#{SCRIPT_FOLDER}/code_modules/#{code}/default_modlets";
|
415
|
-
file_name = "#{modlet_location}/#{modlet}.rb";
|
416
|
-
FileTest.exist? file_name
|
417
|
-
)
|
418
|
-
elsif ( modlet_location = "#{SCRIPT_FOLDER}/code_modules/#{code}/my_modlets";
|
419
|
-
file_name = "#{modlet_location}/#{modlet}.rb";
|
420
|
-
FileTest.exist? file_name
|
421
|
-
)
|
422
|
-
else
|
423
|
-
raise CRFatal.new("Could not find modlet file: #{modlet}.rb")
|
424
|
-
end
|
425
|
-
require file_name
|
418
|
+
#if ( modlet_location = "#{SCRIPT_FOLDER}/code_modules/#{code}/default_modlets";
|
419
|
+
#file_name = "#{modlet_location}/#{modlet}.rb";
|
420
|
+
#FileTest.exist? file_name
|
421
|
+
#)
|
422
|
+
#elsif ( modlet_location = "#{SCRIPT_FOLDER}/code_modules/#{code}/my_modlets";
|
423
|
+
#file_name = "#{modlet_location}/#{modlet}.rb";
|
424
|
+
#FileTest.exist? file_name
|
425
|
+
#)
|
426
|
+
#else
|
427
|
+
#raise CRFatal.new("Could not find modlet file: #{modlet}.rb")
|
428
|
+
#end
|
429
|
+
#require file_name
|
426
430
|
# ep run_class.constants
|
427
431
|
# ep run_class_names
|
428
432
|
|
@@ -1391,11 +1395,11 @@ EOF
|
|
1391
1395
|
def similar_runs(exclude_variables=[], run=@run) #all runs for which variables are the same as 'run', with the exception of exclude_variables
|
1392
1396
|
logf(:similar_runs)
|
1393
1397
|
raise CRFatal.new("generate_combined_ids must be called before this function is called") unless (@combined_run_list.size > 0 and @combined_ids.size > 0) or @ids.size ==0
|
1394
|
-
command = (run.class.rcp.variables+run.class.rcp.run_info-exclude_variables - [:output_file, :error_file]).inject("@combined_ids.find_all{|id| @combined_run_list[id].class == run.class}"){ |s,v|
|
1395
|
-
s + %<.find_all{|id| @combined_run_list[id].#{v}.class == #{run.send(v).inspect}.class and @combined_run_list[id].#{v} == #{run.send(v).inspect}}>} #the second send call retrieves the type conversion
|
1398
|
+
command = (run.class.rcp.variables+run.class.rcp.run_info-exclude_variables - [:output_file, :error_file, :runner, :phantom_runs]).inject("@combined_ids.find_all{|id| @combined_run_list[id].class == run.class}"){ |s,v|
|
1399
|
+
s + %<.find_all{|id| ep '#{v}'; @combined_run_list[id].#{v}.class == #{run.send(v).inspect}.class and @combined_run_list[id].#{v} == #{run.send(v).inspect}}>} #the second send call retrieves the type conversion
|
1396
1400
|
|
1397
1401
|
# log command
|
1398
|
-
#
|
1402
|
+
#puts command
|
1399
1403
|
begin
|
1400
1404
|
similar = instance_eval(command)
|
1401
1405
|
rescue => err
|
@@ -1733,7 +1737,7 @@ end
|
|
1733
1737
|
"/merged_code_runner.rb",
|
1734
1738
|
'/run.rb',
|
1735
1739
|
'/heuristic_run_methods.rb',
|
1736
|
-
|
1740
|
+
'/run_backwards_compatibility.rb'
|
1737
1741
|
].each do |file|
|
1738
1742
|
file = CodeRunner::SCRIPT_FOLDER + file
|
1739
1743
|
require file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coderunner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: graphkit
|
@@ -262,10 +262,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
262
262
|
requirements:
|
263
263
|
- - ! '>='
|
264
264
|
- !ruby/object:Gem::Version
|
265
|
-
version:
|
266
|
-
segments:
|
267
|
-
- 0
|
268
|
-
hash: -1092233251972131996
|
265
|
+
version: 1.9.1
|
269
266
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
270
267
|
none: false
|
271
268
|
requirements:
|