-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1D tally maps #122
Merged
valeriaRaffuzzi
merged 5 commits into
CambridgeNuclear:main
from
valeriaRaffuzzi:angleMap
May 16, 2024
Merged
1D tally maps #122
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
faec966
Tidying the 1D tally maps, adding 1D radial and angular maps
3d6a9c4
Merge branch 'angleMap' of https://github.com/valeriaRaffuzzi/SCONE i…
98ec4df
Merge cyl and sph radial maps into one radialMap
6989dfb
Updating the directionMap to degrees, and updating the docs
64a09b9
Making the origin 3D in all cases
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
# Add Source Files to the global list | ||
add_sources(./tallyMap_inter.f90 | ||
./tallyMap1D_inter.f90 | ||
./tallyMap1DFactory_func.f90 | ||
./tallyMapFactory_func.f90 | ||
./tallyMapSlot_class.f90 | ||
./testMap_class.f90 | ||
./energyMap_class.f90 | ||
./spaceMap_class.f90 | ||
./materialMap_class.f90 | ||
./homogMatMap_class.f90 | ||
./multiMap_class.f90 | ||
./weightMap_class.f90 | ||
./sphericalMap_class.f90 | ||
./cellMap_class.f90 | ||
./cylindricalMap_class.f90 | ||
./collNumMap_class.f90 | ||
# ./matXsMap_class.f90 | ||
./cylindricalMap_class.f90 | ||
./Maps1D/tallyMap1D_inter.f90 | ||
./Maps1D/tallyMap1DFactory_func.f90 | ||
./Maps1D/testMap_class.f90 | ||
./Maps1D/energyMap_class.f90 | ||
./Maps1D/spaceMap_class.f90 | ||
./Maps1D/materialMap_class.f90 | ||
./Maps1D/homogMatMap_class.f90 | ||
./Maps1D/weightMap_class.f90 | ||
./Maps1D/cellMap_class.f90 | ||
./Maps1D/radialMap_class.f90 | ||
./Maps1D/collNumMap_class.f90 | ||
./Maps1D/directionMap_class.f90 | ||
) | ||
|
||
add_unit_tests(./Tests/materialMap_test.f90 | ||
./Tests/energyMap_test.f90 | ||
./Tests/weightMap_test.f90 | ||
./Tests/spaceMap_test.f90 | ||
./Tests/testMap_test.f90 | ||
./Tests/multiMap_test.f90 | ||
./Tests/homogMatMap_test.f90 | ||
./Tests/sphericalMap_test.f90 | ||
./Tests/cellMap_test.f90 | ||
add_unit_tests(./Tests/multiMap_test.f90 | ||
./Tests/cylindricalMap_test.f90 | ||
./Tests/collNumMap_test.f90) | ||
./Maps1D/Tests/materialMap_test.f90 | ||
./Maps1D/Tests/energyMap_test.f90 | ||
./Maps1D/Tests/weightMap_test.f90 | ||
./Maps1D/Tests/spaceMap_test.f90 | ||
./Maps1D/Tests/testMap_test.f90 | ||
./Maps1D/Tests/homogMatMap_test.f90 | ||
./Maps1D/Tests/radialMap_test.f90 | ||
./Maps1D/Tests/cellMap_test.f90 | ||
./Maps1D/Tests/collNumMap_test.f90 | ||
./Maps1D/Tests/directionMap_test.f90) |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
module directionMap_test | ||
use numPrecision | ||
use pFUnit_mod | ||
use particle_class, only : particleState | ||
use dictionary_class, only : dictionary | ||
use outputFile_class, only : outputFile | ||
|
||
use directionMap_class, only : directionMap | ||
|
||
implicit none | ||
|
||
|
||
@testCase | ||
type, extends(TestCase) :: test_directionMap | ||
private | ||
type(directionMap) :: map1 | ||
type(directionMap) :: map2 | ||
|
||
contains | ||
procedure :: setUp | ||
procedure :: tearDown | ||
|
||
end type test_directionMap | ||
|
||
contains | ||
|
||
!! | ||
!! Sets up test_directionMap object | ||
!! | ||
subroutine setUp(this) | ||
class(test_directionMap), intent(inout) :: this | ||
type(dictionary) :: tempDict | ||
|
||
! Build map with yz plane | ||
call tempDict % init(2) | ||
call tempDict % store('plane','yz') | ||
call tempDict % store('N', 4) | ||
|
||
call this % map1 % init(tempDict) | ||
call tempDict % kill() | ||
|
||
! Build map with default plane | ||
call tempDict % init(3) | ||
call tempDict % store('N', 9) | ||
call tempDict % store('min', 90) | ||
call tempDict % store('max', 180) | ||
|
||
call this % map2 % init(tempDict) | ||
call tempDict % kill() | ||
|
||
end subroutine setUp | ||
|
||
!! | ||
!! Kills test_directionMap objects | ||
!! | ||
subroutine tearDown(this) | ||
class(test_directionMap), intent(inout) :: this | ||
|
||
call this % map1 % kill() | ||
call this % map2 % kill() | ||
|
||
end subroutine tearDown | ||
|
||
!!<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> | ||
!! PROPER TESTS BEGIN HERE | ||
!!<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> | ||
|
||
!! | ||
!! Test first map | ||
!! | ||
@Test | ||
subroutine testMap1(this) | ||
class(test_directionMap), intent(inout) :: this | ||
real(defReal),dimension(4),parameter :: x = [0.44_defReal, 15.8_defReal, 83.2_defReal, 999.1_defReal] | ||
real(defReal),dimension(4),parameter :: phi = [100.1_defReal, 20.84_defReal, 333.9_defReal, 264.8_defReal]*PI/180.0_defReal | ||
integer(shortInt),dimension(4),parameter :: RES_IDX = [4, 3, 2, 1] | ||
integer(shortInt),dimension(4) :: idx | ||
type(particleState),dimension(4) :: states | ||
|
||
! Initialise states | ||
states(:) % dir(1) = x | ||
states(:) % dir(2) = cos(phi) | ||
states(:) % dir(3) = sin(phi) | ||
|
||
idx = this % map1 % map(states) | ||
|
||
@assertEqual(RES_IDX, idx) | ||
|
||
end subroutine testMap1 | ||
|
||
!! | ||
!! Test second | ||
!! | ||
@Test | ||
subroutine testMap2(this) | ||
class(test_directionMap), intent(inout) :: this | ||
real(defReal),dimension(4),parameter :: z = [0.44_defReal, 15.8_defReal, 83.2_defReal, 999.1_defReal] | ||
real(defReal),dimension(4),parameter :: phi = [170.1_defReal, 90.84_defReal, 133.9_defReal, 264.8_defReal]*PI/180.0_defReal | ||
integer(shortInt),dimension(4),parameter :: RES_IDX = [9, 1, 5, 0] | ||
integer(shortInt),dimension(4) :: idx | ||
type(particleState),dimension(4) :: states | ||
|
||
! Initialise states | ||
states(:) % dir(1) = cos(phi) | ||
states(:) % dir(2) = sin(phi) | ||
states(:) % dir(3) = z | ||
|
||
idx = this % map2 % map(states) | ||
|
||
@assertEqual(RES_IDX, idx) | ||
|
||
end subroutine testMap2 | ||
|
||
!! | ||
!! Test bin number retrival | ||
!! | ||
@Test | ||
subroutine testBinNumber(this) | ||
class(test_directionMap), intent(inout) :: this | ||
|
||
! Test that map is 1D | ||
@assertEqual(4, this % map1 % bins(0),'All bins') | ||
@assertEqual(4, this % map1 % bins(1),'1st dimension') | ||
@assertEqual(0, this % map2 % bins(2),'2nd dimension') | ||
@assertEqual(9, this % map2 % bins(1),'1st dimension') | ||
|
||
! Get dimensionality | ||
@assertEqual(1, this % map1 % dimensions()) | ||
@assertEqual(1, this % map2 % dimensions()) | ||
|
||
end subroutine testBinNumber | ||
|
||
!! | ||
!! Test correctness of print subroutine | ||
!! Does not check that values are correct, but that call sequence is without errors | ||
!! | ||
@Test | ||
subroutine testPrint(this) | ||
class(test_directionMap), intent(inout) :: this | ||
type(outputFile) :: out | ||
|
||
call out % init('dummyPrinter', fatalErrors = .false.) | ||
|
||
call this % map2 % print(out) | ||
@assertTrue(out % isValid(),'Radial map case') | ||
call out % reset() | ||
|
||
call this % map1 % print(out) | ||
@assertTrue(out % isValid(),'Unstruct map case') | ||
call out % reset() | ||
|
||
end subroutine testPrint | ||
|
||
|
||
end module directionMap_test |
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps more descriptively it should be azimuthalDirectionMap or something similar? This would be to distinguish it from an eventual polar direction map.