Class: CodeRunner::Cubecalc

Inherits:
Run::FortranNamelistC show all
Defined in:
lib/cubecalccrmod/empty.rb,
lib/cubecalccrmod/sleep.rb,
lib/cubecalccrmod/cubecalc.rb,
lib/cubecalccrmod/with_namelist.rb

Defined Under Namespace

Classes: Empty, Sleep, WithNamelist

Constant Summary

Constants inherited from Run::FortranNamelist

Run::FortranNamelist::FORTRAN_SINGLE_LINE

Instance Method Summary collapse

Methods inherited from Run::FortranNamelistC

get_namelists_and_variables_from_source_code, get_sample_value, update_defaults_from_source_code

Methods inherited from Run::FortranNamelist

add_code_variable_to_namelist, add_help_to_variable, add_namelist_must_pass, add_namelist_should_pass, add_variable_must_pass, add_variable_should_pass, correct_namelist_cases, correct_type_location, defaults_file_text_from_input_file, delete_old_variables, delete_variable, diff_input_files, edit_namelist_help, edit_variable_help, find_variable_hash, #formatted_variable_output, fortran_type, get_aggregated_source_code_text, get_namelists_and_variables_from_source_code, get_sample_value, get_variable_modules, help_input, help_variables, #input_file_text, known_code_variable?, #make_info_file, make_new_defaults_file, namelist_defaults_text, #namelist_text, parse_input_file, parse_old_website_docs, print_doxygen_documentation, print_doxygen_variable_documentation, process_synchronisation, read_mediawiki_documentation, save_deleted_variables, save_namelists, scan_text_for_variables, set_allowed_values, setup_namelists, sync_variable_help, synchronise_variables, synchronise_variables_from_input_file, update_defaults_from_source_code, update_folder_defaults, update_text_options, variable_exists?, write_mediawiki_documentation

Instance Method Details

#generate_input_fileObject



65
66
67
68
69
70
71
# File 'lib/cubecalccrmod/cubecalc.rb', line 65

def generate_input_file
	File.open('edges.txt', 'w') do |file|
		file.puts @width
		file.puts @height
		file.puts @depth
	end
end

#generate_phantom_runsObject



81
82
83
84
85
86
87
88
89
# File 'lib/cubecalccrmod/cubecalc.rb', line 81

def generate_phantom_runs
	return unless @sides
	@sides.each do |area|
# 		puts 'creating phantom: ' + @run_name
		phantom = create_phantom
		phantom.area = area
		phantom.phantom_run_description = :area
	end
end

#graphkit(name, options) ⇒ Object



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/cubecalccrmod/cubecalc.rb', line 91

def graphkit(name, options)
	case name
	when /sides/
# 		x = AxisKit.autocreate({data: ["'width'", "'depth'", "'height'"], name: 'Properties'})
		x = GraphKit::AxisKit.autocreate({data: sides, title: "Areas of the Sides:  #@run_name"})
# 		x.range = [0, x.data.max]
		kit = GraphKit.autocreate({x: x})
		kit.style = 'data histograms'
		kit.file_name = 'inputs'
# 		kit.with = 'histogram clustered'
		return kit
	else
		raise 'Unknown graph'
	end
end

#parameter_stringObject



61
62
63
# File 'lib/cubecalccrmod/cubecalc.rb', line 61

def parameter_string
	return sprintf("%d %s", @calculate_sides, 'edges.txt')
end

#parameter_transition(run) ⇒ Object

@run_class.variables.keys



73
74
# File 'lib/cubecalccrmod/cubecalc.rb', line 73

def parameter_transition(run)
end


49
50
51
52
53
54
55
56
57
58
59
# File 'lib/cubecalccrmod/cubecalc.rb', line 49

def print_out_line
	if @is_phantom
		if @phantom_run_description == :area
			return sprintf("%d:%d %30s %10s %f %s", @id, @job_no, @run_name, @status, (@volume or 0.0), @area.to_s)
		else
			raise 'there is only one phantom_run_description at the moment'
		end
	else
		return sprintf("%d:%d %30s %10s %f %s", @id, @job_no, @run_name, @status, (@volume or 0.0), @sides.to_s)
	end
end

#process_directory_code_specificObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/cubecalccrmod/cubecalc.rb', line 32

def process_directory_code_specific
	if @running
		@status = :Incomplete
	else
		if FileTest.exist? 'results.txt'
			@status = :Complete
			@volume = File.readlines('results.txt')[0].scan(LongRegexen::FLOAT)[0][0].to_f
		else
			@status = :Failed
		end
		@sides = []
		if FileTest.exist? 'sides.txt'
			File.read('sides.txt').scan(Regexp.new("is\\s*" + LongRegexen::FLOAT.verbatim + "$")){@sides.push $~[:float].to_f}
		end
	end
end