Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
83df212
Fix to keff for MG scattering
ChasingNeutrons Jan 22, 2025
0791fe2
BEAVRS_HZP and geometry fixes
ChasingNeutrons Feb 6, 2025
8e51a1c
Merge branch 'CambridgeNuclear:main' into develop
ChasingNeutrons Feb 6, 2025
03cae61
Adding cell searching accelerations
ChasingNeutrons Apr 1, 2025
95ada4f
Small fixes
ChasingNeutrons Apr 3, 2025
a607f7f
Added overlap feature to cellUniverse
ChasingNeutrons Apr 7, 2025
8577994
Fixes to BEAVRS to remove overlaps
ChasingNeutrons Apr 8, 2025
13e4438
Update Tallies/TallyClerks/collisionClerk_class.f90
ChasingNeutrons Jul 26, 2025
11e24de
Update TransportOperator/transportOperatorDT_class.f90
ChasingNeutrons Jul 26, 2025
4144f52
Update TransportOperator/transportOperatorDT_class.f90
ChasingNeutrons Jul 26, 2025
615f1ac
Update Geometry/Universes/cellUniverse_class.f90
ChasingNeutrons Jul 26, 2025
2e44464
Update TransportOperator/transportOperatorDT_class.f90
ChasingNeutrons Jul 26, 2025
e121a35
Update TransportOperator/transportOperatorDT_class.f90
ChasingNeutrons Jul 26, 2025
abf5edc
Update TransportOperator/transportOperatorHT_class.f90
ChasingNeutrons Jul 26, 2025
3bd0741
Update TransportOperator/transportOperatorHT_class.f90
ChasingNeutrons Jul 26, 2025
8f71c1d
Update TransportOperator/transportOperatorHT_class.f90
ChasingNeutrons Jul 26, 2025
09f25a9
Addressing changes and robust matIdx check
ChasingNeutrons Jul 26, 2025
6e8a9c7
Merge branch 'cellSearch' of https://github.com/ChasingNeutrons/SCONE…
ChasingNeutrons Jul 26, 2025
a0e5fef
Return nudge to original value
ChasingNeutrons Jul 26, 2025
b246928
Typo fix
ChasingNeutrons Jul 26, 2025
60c99f3
Update Geometry/Universes/cellUniverse_class.f90
ChasingNeutrons Jul 26, 2025
804c0d5
Update ParticleObjects/Source/fissionSource_class.f90
ChasingNeutrons Jul 26, 2025
855b5eb
Merge branch 'main' into cellSearch
ChasingNeutrons Jul 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions DataStructures/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ add_sources( ./dictionary_class.f90
./charMap_class.f90
./stack_class.f90
./dynArray_class.f90
./linkedList_class.f90
./dictParser_func.f90)

# Add Unit Tests to a global List
add_unit_tests( ./Tests/dictionary_test.f90
./Tests/intMap_test.f90
./Tests/charMap_test.f90
./Tests/dynArray_test.f90
./Tests/linkedList_test.f90
./Tests/dictParser_test.f90)

add_integration_tests( ./Tests/dictParser_iTest.f90)
6 changes: 3 additions & 3 deletions DataStructures/Tests/dynArray_test.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ subroutine testUnallocatedInt()
@assertEqual(0, array % capacity(), 'Capacity of unallocated array')
@assertTrue(array % isEmpty(),'isEmpty on unallocated array')

! Make shure no SEG ERR happens
! Make sure no SEG ERR happens
call array % shrink()

end subroutine testUnallocatedInt
Expand All @@ -40,7 +40,7 @@ subroutine testEmptyInt()
@assertEqual(0, array % getSize(),'Size of empty array')
@assertTrue(array % isEmpty(),'isEmpty on empty array')

! Make shure no SEG ERR happens
! Make sure no SEG ERR happens
call array % shrink()
@assertEqual(0, array % capacity(),'Capacity of shrunk empty array')

Expand Down Expand Up @@ -101,7 +101,7 @@ subroutine testUsage()
@assertEqual(2*i, array % pop())
end do

! Test building by emelent and vector
! Test building by element and vector
call array % add(1)
call array % add([8,3])

Expand Down
91 changes: 91 additions & 0 deletions DataStructures/Tests/linkedList_test.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
module linkedList_test
use numPrecision
use linkedList_class, only : linkedIntList
use funit

implicit none

contains

!!<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
!! PROPER TESTS BEGIN HERE
!!<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

!!
!! Test correct behaviour on unallocated linkedList
!!
@Test
subroutine testUnallocatedInt()
type(linkedIntList) :: list

@assertEqual(0, list % getSize(),'Size of unallocated list')

end subroutine testUnallocatedInt

!!
!! Test correct behaviour on empty linkedIntList
!!
@Test
subroutine testEmptyInt()
type(linkedIntlist) :: list

call list % add(5)
call list % add(3)
call list % add(4)

call list % kill()

@assertEqual(0, list % getSize(),'Size of empty list')

end subroutine testEmptyInt

!!
!! Test resizing
!!
@Test
subroutine testAddInt()
type(linkedIntList) :: list

call list % add(7)
@assertEqual(1, list % getSize())

call list % add(4)
call list % add(6)
@assertEqual(3, list % getSize())

call list % kill()
@assertEqual(0, list % getSize())

end subroutine testAddInt

!!
!! Test usage
!!
@Test
subroutine testUsage()
type(linkedIntList) :: list
integer(shortInt) :: i

call list % add(8)
call list % add(42)
call list % add(666)

! Test getting elements by index
@assertEqual(8, list % get(1))
@assertEqual(42, list % get(2))
@assertEqual(666, list % get(3))

end subroutine testUsage

!!
!! Test kill of unallocated array
!!
@Test
subroutine testKillUnalloc()
type(linkedIntList) :: list

call list % kill()

end subroutine testKillUnalloc

end module linkedList_test
188 changes: 188 additions & 0 deletions DataStructures/linkedList_class.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
module linkedList_class

use numPrecision
use genericProcedures, only : fatalError

implicit none
private

!! Presently only contains a linked list of shortInts. Can be easily duplicated
!! for other variable types.

!!
!! Linked list node containing an int and pointer
!! to the next node
!!
type :: intNode
integer(shortInt) :: data
type(intNode), pointer :: next => null()
end type intNode


!!
!! Linked list for shortIntegers
!!
!! Contains the start of the list and end (for faster additions).
!! Could be optimised by returning the node as an iterator.
!! The current implementation of traversal will start to become slow
!! for searching long lists.
!!
!! Public interface:
!! add -> add a new entry to the list (omp critical)
!! get -> get a value in the list at a particular index
!! getSize -> return the length of the list
!! display -> output the contents of the list to display
!! kill -> clean up the list
!!
!! Private procedures:
!! traverse -> move to a specified node in the list
!!
type, public :: linkedIntList
private
type(intNode), pointer :: head => null()
type(intNode), pointer :: tail => null()
integer(shortInt) :: length = 0
contains
! Public interface
procedure :: add => add_shortInt
procedure :: get => get_shortInt
procedure :: getSize => getSize_shortInt
procedure :: display => display_shortInt
procedure :: kill => kill_shortInt

! Private procedures
procedure, private :: traverse => traverse_shortInt

end type linkedIntList

contains

!!
!! Add entry at the end of linked list.
!!
!! Enclosed in a critical statement to prevent corruption.
!!
subroutine add_shortInt(self, entry)
class(linkedIntList), intent(inout) :: self
integer(shortInt), intent(in) :: entry
class(intNode), pointer :: tail

!$omp critical
! Go to the end of the list
if (self % length == 0) then
allocate(self % head)
self % head % data = entry
self % tail => self % head

else
tail => self % tail
allocate(tail % next)
self % tail => tail % next
self % tail % data = entry
end if

self % length = self % length + 1
!$omp end critical

end subroutine add_shortInt

!!
!! Move down the linked list until a given index
!!
!! Errors:
!! Requested index exceeds the length of the list
!!
function traverse_shortInt(self, idx) result(resNode)
class(linkedIntList), intent(in) :: self
integer(shortInt), intent(in) :: idx
class(intNode), pointer :: resNode
integer(shortInt) :: i
character(100), parameter :: Here = 'traverse_shortInt (linkedList_Class.f90)'

if (idx > self % length) call fatalError(Here,&
'Requested index exceeds list length')

resNode => self % head
i = 1
do while (i < idx)
resNode => resNode % next
i = i + 1
end do

end function traverse_shortInt

!!
!! Get size of the linked list
!!
pure function getSize_shortInt(self) result(S)
class(linkedIntList), intent(in) :: self
integer(shortInt) :: S

S = self % length

end function getSize_shortInt

!!
!! Return a value from the list at a given index
!!
!! Errors:
!! The list has no elements
!!
function get_shortInt(self, idx) result(res)
class(linkedIntList), intent(in) :: self
integer(shortInt), intent(in) :: idx
integer(shortInt) :: res
class(intNode), pointer :: resNode
character(100), parameter :: Here = 'get_shortInt (linkedList_Class.f90)'

if (self % getSize() == 0) call fatalError(Here,'Linked list is not allocated')

resNode => self % traverse(idx)
res = resNode % data

end function get_shortInt

!!
!! Deallocate linked list
!!
subroutine kill_shortInt(self)
class(linkedIntList), intent(inout) :: self
integer(shortInt) :: i
class(intNode), pointer :: resNode

! Traverse the list and nullify pointers
do while (self % length > 1)
self % length = self % length - 1
resNode => self % traverse(self % length)
resNode % next => null()
end do
self % head => null()
self % tail => null()
self % length = 0

end subroutine kill_shortInt

!!
!! Print contents of linked list
!!
subroutine display_shortInt(self)
class(linkedIntList), intent(inout) :: self
integer(shortInt) :: i
class(intNode), pointer :: resNode

if (self % length == 0) then
print *,'Empty list'
return
end if

resNode => self % head
i = 1
do while (i < self % length)
print *, resNode % data
resNode => resNode % next
i = i + 1
end do

end subroutine display_shortInt

end module linkedList_class
8 changes: 4 additions & 4 deletions Geometry/Cells/cell_inter.f90
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module cell_inter
!!
!! Abstract interface for all cells
!!
!! Cell is intendet to represent a volume of space. It is not intended to be
!! Cell is intended to represent a volume of space. It is not intended to be
!! a independent entity, but rather to be used as a component of universes.
!!
!! Private Members:
Expand All @@ -40,9 +40,9 @@ module cell_inter
!! inside -> Return true is a given position is cntained inside the cell
!! distance -> Assuming the point is inside the cell, calculate distance to the boundary
!! and give surfIdx for the surface that will be crossed
!! setId -> Set ID of a cell
!! id -> Return id of a cell
!! kill -> Return to uninitialised state
!! setId -> Set ID of a cell
!! id -> Return id of a cell
!! kill -> Return to uninitialised state
!!
type, public, abstract :: cell
private
Expand Down
Loading