Fixed bug with multi-line input using type='word'. Closes #107 on github.

This commit is contained in:
Paul Romano 2012-08-27 21:54:48 -04:00
parent d74c52098b
commit 7ee4618bf4
3 changed files with 38 additions and 35 deletions

View file

@ -73,7 +73,6 @@ contains
energy_grid_ = "union"
seed_ = 0_8
no_reduce_ = ""
output_ = ""
source_ % file = ''
source_ % space % type = ''
source_ % angle % type = ''
@ -506,11 +505,10 @@ contains
if (trim(confidence_intervals_) == 'on') confidence_intervals = .true.
! Check for output options
if (len_trim(output_) > 0) then
call split_string(output_, words, n_words)
do i = 1, n_words
call lower_case(words(i))
select case (words(i))
if (associated(output_)) then
do i = 1, size(output_)
call lower_case(output_(i))
select case (output_(i))
case ('summary')
output_summary = .true.
case ('cross_sections')
@ -1371,8 +1369,8 @@ contains
! READ DATA FOR FILTERS
! Check to make sure that both cells and surfaces were not specified
if (len_trim(tally_(i) % filters % cell) > 0 .and. &
len_trim(tally_(i) % filters % surface) > 0) then
if (associated(tally_(i) % filters % cell) .and. &
associated(tally_(i) % filters % surface)) then
message = "Cannot specify both cell and surface filters for tally " &
// trim(to_str(t % id))
call fatal_error()
@ -1381,11 +1379,12 @@ contains
! TODO: Parse logical expressions instead of just each word
! Read cell filter bins
if (len_trim(tally_(i) % filters % cell) > 0) then
call split_string(tally_(i) % filters % cell, words, n_words)
if (associated(tally_(i) % filters % cell)) then
n_words = size(tally_(i) % filters % cell)
allocate(t % cell_bins(n_words))
do j = 1, n_words
t % cell_bins(j) = int(str_to_int(words(j)),4)
t % cell_bins(j) = int(str_to_int(&
tally_(i) % filters % cell(j)),4)
end do
t % n_filter_bins(FILTER_CELL) = n_words
@ -1394,11 +1393,12 @@ contains
end if
! Read surface filter bins
if (len_trim(tally_(i) % filters % surface) > 0) then
call split_string(tally_(i) % filters % surface, words, n_words)
if (associated(tally_(i) % filters % surface)) then
n_words = size(tally_(i) % filters % surface)
allocate(t % surface_bins(n_words))
do j = 1, n_words
t % surface_bins(j) = int(str_to_int(words(j)),4)
t % surface_bins(j) = int(str_to_int(&
tally_(i) % filters % surface(j)),4)
end do
t % n_filter_bins(FILTER_SURFACE) = n_words
@ -1407,11 +1407,12 @@ contains
end if
! Read universe filter bins
if (len_trim(tally_(i) % filters % universe) > 0) then
call split_string(tally_(i) % filters % universe, words, n_words)
if (associated(tally_(i) % filters % universe)) then
n_words = size(tally_(i) % filters % universe)
allocate(t % universe_bins(n_words))
do j = 1, n_words
t % universe_bins(j) = int(str_to_int(words(j)),4)
t % universe_bins(j) = int(str_to_int(&
tally_(i) % filters % universe(j)),4)
end do
t % n_filter_bins(FILTER_UNIVERSE) = n_words
@ -1420,11 +1421,12 @@ contains
end if
! Read material filter bins
if (len_trim(tally_(i) % filters % material) > 0) then
call split_string(tally_(i) % filters % material, words, n_words)
if (associated(tally_(i) % filters % material)) then
n_words = size(tally_(i) % filters % material)
allocate(t % material_bins(n_words))
do j = 1, n_words
t % material_bins(j) = int(str_to_int(words(j)),4)
t % material_bins(j) = int(str_to_int(&
tally_(i) % filters % material(j)),4)
end do
t % n_filter_bins(FILTER_MATERIAL) = n_words
@ -1453,11 +1455,12 @@ contains
end if
! Read birth region filter bins
if (len_trim(tally_(i) % filters % cellborn) > 0) then
call split_string(tally_(i) % filters % cellborn, words, n_words)
if (associated(tally_(i) % filters % cellborn)) then
n_words = size(tally_(i) % filters % cellborn)
allocate(t % cellborn_bins(n_words))
do j = 1, n_words
t % cellborn_bins(j) = int(str_to_int(words(j)),4)
t % cellborn_bins(j) = int(str_to_int(&
tally_(i) % filters % cellborn(j)),4)
end do
t % n_filter_bins(FILTER_CELLBORN) = n_words
@ -1558,11 +1561,11 @@ contains
! =======================================================================
! READ DATA FOR SCORES
if (len_trim(tally_(i) % scores) > 0) then
call split_string(tally_(i) % scores, words, n_words)
if (associated(tally_(i) % scores)) then
n_words = size(tally_(i) % scores)
allocate(t % score_bins(n_words))
do j = 1, n_words
word = words(j)
word = tally_(i) % scores(j)
call lower_case(word)
select case (trim(word))
case ('flux')
@ -1688,7 +1691,8 @@ contains
end if
case default
message = "Unknown scoring function: " // trim(words(j))
message = "Unknown scoring function: " // &
trim(tally_(i) % scores(j))
call fatal_error()
end select
end do

View file

@ -49,7 +49,7 @@
<variable name="entropy_" tag="entropy" type="mesh_xml" dimension="1" />
<variable name="fixed_source_" tag="fixed_source" type="run_parameters_xml" />
<variable name="no_reduce_" tag="no_reduce" type="word" length="3" />
<variable name="output_" tag="output" type="word" length="250" />
<variable name="output_" tag="output" type="word-array" length="20" />
<variable name="ptables_" tag="ptables" type="word" length="3" />
<variable name="seed_" tag="seed" type="integer" />
<variable name="source_" tag="source" type="source_xml" />

View file

@ -13,12 +13,12 @@
</typedef>
<typedef name="filter_xml">
<component name="cell" type="word" length="250" default="''" />
<component name="surface" type="word" length="250" default="''" />
<component name="universe" type="word" length="250" default="''" />
<component name="material" type="word" length="250" default="''" />
<component name="cell" type="word-array" length="20" />
<component name="surface" type="word-array" length="20" />
<component name="universe" type="word-array" length="20" />
<component name="material" type="word-array" length="20" />
<component name="mesh" type="integer" default="0" />
<component name="cellborn" type="word" length="250" default="''" />
<component name="cellborn" type="word-array" length="20" />
<component name="energy" type="double-array" />
<component name="energyout" type="double-array" />
</typedef>
@ -28,8 +28,7 @@
<component name="label" type="word" length="52" default="''" />
<component name="estimator" type="word" length="12" default="''" />
<component name="filters" type="filter_xml" />
<component name="scores" type="word" length="250" default="''" />
<component name="reactions" type="word" length="250" default="''" />
<component name="scores" type="word-array" length="20" />
<component name="nuclides" type="word-array" length="12" />
</typedef>