mesa_script 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mesa_script.rb +21 -5
  3. metadata +19 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4825bb6f1d2a1b6dcb3b4dbc7daf67235b177b98
4
- data.tar.gz: 338994544043aa2f860e76fe96fb38c7bbb5a702
3
+ metadata.gz: c5625fddbfb3e4c4f87d42ddc201c5adb6b45a75
4
+ data.tar.gz: 8b5e505dd02e1d65d84bd0bea5aaeef49076105b
5
5
  SHA512:
6
- metadata.gz: a72fdf26c9703a5e7e158d5d525cafe7a34107afefa607789953b3ed40ed4a065c232f85f7c4ee778541b850dbb94bc6aa68695148c2e90f475b72592122f575
7
- data.tar.gz: 80a2945a09ae31dc6bf664bd7d5f57d9ed1bb94de755b9ddc920a6823371ac5a3984042ef71973910617a6c0d87db7e563cc0689bde8a015deb9555f6401fba7
6
+ metadata.gz: b6659a3b7d8b6cc11a59778c5fea9932ecead35b1a1ff2d8b14416e118414a1ebd306d36bd934fd15cd85aed75de65c6440439f65c7dd7ef393e4d10b5036d40
7
+ data.tar.gz: 1d365d16c557a9f06b055d643dc56f5ffe3f29de9487a444da6691a9a041180fb7a9586241cda93c37fed8a1fa93320ee2f8aa13aed2565cd283e25fb73f2682
data/lib/mesa_script.rb CHANGED
@@ -3,6 +3,21 @@ InlistItem = Struct.new(:name, :type, :value, :namelist, :order, :is_arr,
3
3
 
4
4
  class Inlist
5
5
 
6
+ # Get access to current MESA version.
7
+ def self.version
8
+ v_num = IO.read(File.join(ENV['MESA_DIR'], 'data', 'version_number')).to_i
9
+ return v_num
10
+ end
11
+
12
+ # Determine proper file suffix for fortran source
13
+ def self.f_end
14
+ if Inlist.version >= 7380
15
+ "f90"
16
+ else
17
+ "f"
18
+ end
19
+ end
20
+
6
21
 
7
22
  @inlist_data = {}
8
23
  # Different namelists can be added or subtracted if MESA should change or
@@ -14,9 +29,10 @@ class Inlist
14
29
  ################## POINT TO .INC FILES HERE ####################
15
30
  @nt_files = {
16
31
  'star_job' => %w{star_job_controls.inc},
17
- 'controls' => %w{star_controls.inc ctrls_io.f},
32
+ 'controls' => %w{star_controls.inc},
18
33
  'pgstar' => %w{pgstar_controls.inc}
19
34
  }
35
+ @nt_files['controls'] << "ctrls_io.#{f_end}"
20
36
  # User can specify a custom name for a namelist defaults file. The default
21
37
  # is simply the namelist name followed by '.defaults'
22
38
 
@@ -240,8 +256,8 @@ class Inlist
240
256
  puts "WARNING: 'type' values are currently unsupported (regarding #{name}) because your humble author has no idea what they look like in an inlist. You should tell him what to do at wmwolf@physics.ucsb.edu. Your input, #{value}, has been passed through to your inlist verbatim."
241
257
  return value.to_s
242
258
  else
243
- raise "Error parsing value for namelist item #{name}: #{value}." +
244
- " Expected type was #{type}."
259
+ raise "Error parsing value for namelist item #{name}: #{value}. Expected "
260
+ "type was #{type}."
245
261
  end
246
262
  end
247
263
 
@@ -424,9 +440,9 @@ class Inlist
424
440
  is_arr = true
425
441
  num_indices = name.count('!') + 1
426
442
  name.sub!(/\(.*\)/, '')
427
- elsif pair[0] =~ /dimension\((.*)\)/
443
+ elsif pair[0] =~ /dimension\((.*)\)/i
428
444
  is_arr = true
429
- num_indices = $1.count(",") + 1
445
+ num_indices = $1.count(',') + 1
430
446
  end
431
447
  type_default = {:bool => false, :string => '', :float => 0.0,
432
448
  :int => 0}
metadata CHANGED
@@ -1,22 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mesa_script
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Wolf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-21 00:00:00.000000000 Z
11
+ date: 2015-02-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: " MesaScript is a domain specific language (DSL) that allows the user
14
- to write\n inlists for MESA that include variables, loops, conditionals, etc.
15
- For more\n detailed instructions, see the readme on the github page at \n\n https://github.com/wmwolf/MesaScript\n\n
16
- \ This software requires a relatively modern installation of MESA (version >\n
17
- \ 5596). It has been tested on Ruby versions > 1.9, but there is no guarantee\n
18
- \ it will work on older (or newer!) versions. Any bugs or requests should be\n
19
- \ sent to the author, Bill Wolf, at wmwolf@physics.ucsb.edu.\n"
13
+ description: MesaScript - a DSL for making dynamic inlists for the MESA stellar evolution
14
+ code.
20
15
  email: wmwolf@physics.ucsb.edu
21
16
  executables:
22
17
  - inlist2mesascript
@@ -30,7 +25,13 @@ homepage: https://wmwolf.github.io
30
25
  licenses:
31
26
  - MIT
32
27
  metadata: {}
33
- post_install_message:
28
+ post_install_message: |2
29
+ Thanks for installing MesaScript!
30
+
31
+ To learn more about how to use MesaScript and to keep up to date with its
32
+ features, check out the README at the project homepage:
33
+
34
+ https://github.com/wmwolf/MesaScript
34
35
  rdoc_options: []
35
36
  require_paths:
36
37
  - lib
@@ -46,9 +47,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
46
47
  version: '0'
47
48
  requirements: []
48
49
  rubyforge_project:
49
- rubygems_version: 2.4.2
50
+ rubygems_version: 2.4.3
50
51
  signing_key:
51
52
  specification_version: 4
52
- summary: MesaScript - a DSL for making dynamic inlists for the MESA stellar evolution
53
- code.
53
+ summary: MesaScript is a domain specific language (DSL) that allows the user to write
54
+ inlists for MESA that include variables, loops, conditionals, etc. For more detailed
55
+ instructions, see the readme on the github page at https://github.com/wmwolf/MesaScript This
56
+ software requires a relatively modern installation of MESA (version > 5596). It
57
+ has been tested on Ruby versions > 1.9, but there is no guarantee it will work on
58
+ older (or newer!) versions. Any bugs or requests should be sent to the author, Bill
59
+ Wolf, at wmwolf@physics.ucsb.edu.
54
60
  test_files: []