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

Direct Known Subclasses

Empty, Sleep, WithNamelist

Defined Under Namespace

Classes: Empty, Sleep, WithNamelist

Constant Summary

Constants inherited from Run::FortranNamelist

Run::FortranNamelist::FORTRAN_SINGLE_LINE

Instance Attribute Summary

Attributes inherited from Run

#code, #code_runner_version, #executable_name, #max_complete, #maxes, #naming_pars, #nprocs, #real_id, #run_test_flags, #runner, #sys, #version

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, use_new_defaults_file, variable_exists?, write_mediawiki_documentation

Methods inherited from Run

#actual_number_of_processors, #analyse_input_file_text, #cache, check_and_update, #code_run_environment, #comment_line, #copy_extra_files, #create_component, #data_string, #defaults_file_name, #defaults_location, #dup, #error, #evaluate_defaults_file, #executable_location, #execute_submission, finish_setting_up_class, #generate_combined_ids, #generate_run_name, #gets, gets, #hard_cache, #info_file, #initialize, #inspect, #is_complete, #job_identifier, #learn_from, load, #logiv, #max, #min, modify_job_script, #p, #prepare_submission, #pretty_print, #print, #process_directory, #puts, #rcp, rcp, #read_info, #read_results, #recheck, #results_file, #run_heuristic_analysis, #save, set_modlet, #smax, #smin, #try_by_system, #try_to_find_job_output_ends, #try_to_get_error_file, #try_to_get_job_number, #try_to_get_output_file, #update_in_queue, update_status, #update_submission_parameters, #warning, #write_info, #write_results

Constructor Details

This class inherits a constructor from CodeRunner::Run

Instance Method Details

#generate_component_runsObject



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

def generate_component_runs
	return unless @sides
	@sides.each do |area|
# 		puts 'creating component: ' + @run_name
		component = create_component
		component.area = area
		component.component_run_description = :area
	end
end

#generate_input_fileObject



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

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

#graphkit(name, options) ⇒ Object



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

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



63
64
65
# File 'lib/cubecalccrmod/cubecalc.rb', line 63

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

#parameter_transition(run) ⇒ Object



75
76
# File 'lib/cubecalccrmod/cubecalc.rb', line 75

def parameter_transition(run)
end


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

def print_out_line
	if @is_component
		if @component_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 component_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



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

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