nera 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ == 0.5.1
2
+ * 1 major enhancement:
3
+ * Add a new API function.
4
+ * 2 bug fixes:
5
+
6
+
1
7
  == 0.5.0
2
8
  * 1 major enhancement:
3
9
  * Routines to remove, dump, and import simulators are implemented.
data/lib/nera/nera_cui.rb CHANGED
@@ -90,7 +90,7 @@ HEADER
90
90
  system "less #{slc.path_to_log_file}"
91
91
  return :simulator_layer
92
92
  when "remove a simulator"
93
- sim_names = ["Cancel"] + slc.list.map do |r| r[:name] end
93
+ sim_names = ["Cancel"] + slc.dumpable_simulators
94
94
  selected = Dialog::select_one( sim_names, "Select a simulator to be removed.")
95
95
  return :simulator_layer if selected == 0
96
96
  flag = slc.remove_simulator( sim_names[selected])
@@ -101,7 +101,7 @@ HEADER
101
101
  end
102
102
  return :simulator_layer
103
103
  when "dump a simulator"
104
- sim_names = ["Cancel"] + slc.list.map do |r| r[:name] end
104
+ sim_names = ["Cancel"] + slc.dumpable_simulators
105
105
  selected = Dialog::select_one( sim_names, "Select a simulator to be dumped.")
106
106
  return :simulator_layer if selected == 0
107
107
  flag = slc.dump_simulator( sim_names[selected])
@@ -72,6 +72,15 @@ module NERA
72
72
  @db_folders.path_to_log_file
73
73
  end
74
74
 
75
+ def dumpable_simulators
76
+ job_records = NERA::JobRecords.new( @db_folders.path_to_jobs_table )
77
+ names = @sim_records.list.map do |rec| rec[:name] end
78
+ dumpable = names.find_all do |nam|
79
+ found = !( job_records.list_all.find do |jrec| jrec[:simulator] == nam end )
80
+ end
81
+ return dumpable
82
+ end
83
+
75
84
  def remove_simulator( sim_name)
76
85
  flag = true
77
86
  sim_class = get_class_by_name( sim_name)
data/lib/nera.rb CHANGED
@@ -22,5 +22,5 @@ require 'nera_simulator_records'
22
22
  require 'nera_remote_connector'
23
23
 
24
24
  module NERA
25
- VERSION = '0.5.0'
25
+ VERSION = '0.5.1'
26
26
  end
@@ -69,6 +69,29 @@ class TC_NERA_SIM_LAYER_CONTROLLER < Test::Unit::TestCase
69
69
  assert_equal( @db_folder + "/Tables/logfile.txt", path)
70
70
  end
71
71
 
72
+ def test_dumpable_simulators
73
+ d_list = @slc.dumpable_simulators
74
+ assert_equal( 2, d_list.size )
75
+ assert( d_list.include?("Ising") )
76
+ assert( d_list.include?("Heisenberg") )
77
+ plc = NERA::ParameterLayerController.new( @db_folder, "Ising")
78
+ pid = plc.create_a_new_parameter_set( {} )
79
+ rlc = NERA::RunLayerController.new( @db_folder, "Ising", pid)
80
+ jid = rlc.create_jobs( 1)
81
+ d_list = @slc.dumpable_simulators
82
+ assert_equal( ["Heisenberg"], d_list )
83
+ rlc.cancel_jobs( jid)
84
+ d_list = @slc.dumpable_simulators
85
+ assert_equal( 2, d_list.size )
86
+ assert( d_list.include?("Ising") )
87
+ assert( d_list.include?("Heisenberg") )
88
+
89
+ @slc.remove_simulator( "Ising")
90
+ d_list = @slc.dumpable_simulators
91
+ assert_equal( ["Heisenberg"], d_list )
92
+ end
93
+
94
+
72
95
  def test_remove_simulator
73
96
  assert( File.exist?( File.join(@db_folder,"Simulator_classes","Ising.rb") ) )
74
97
  assert_nil( @slc.remove_simulator( "unknown_simulator") )
data/website/index.html CHANGED
@@ -34,7 +34,7 @@
34
34
  <div class="sidebar">
35
35
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/nera"; return false'>
36
36
  <p>Get Version</p>
37
- <a href="http://rubyforge.org/projects/nera" class="numbers">0.5.0</a>
37
+ <a href="http://rubyforge.org/projects/nera" class="numbers">0.5.1</a>
38
38
  </div>
39
39
  </div>
40
40
  <h2>What</h2>
@@ -34,7 +34,7 @@
34
34
  <div class="sidebar">
35
35
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/nera"; return false'>
36
36
  <p>Get Version</p>
37
- <a href="http://rubyforge.org/projects/nera" class="numbers">0.5.0</a>
37
+ <a href="http://rubyforge.org/projects/nera" class="numbers">0.5.1</a>
38
38
  </div>
39
39
  </div>
40
40
  <p>The database created by nera is a hierarchical database which consists of three layers.<br />
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nera
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yohsuke Murase