Skip to content

Commit

Permalink
Merge pull request CambridgeNuclear#93 from valeriaRaffuzzi/Factories
Browse files Browse the repository at this point in the history
Factories
  • Loading branch information
valeriaRaffuzzi authored Oct 27, 2023
2 parents 435acf6 + bce2245 commit ccd58bb
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 138 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ module collisionProcessorFactory_func

public :: new_collisionProcessor

! *** ADD NAME OF A NEW COLLISION PROCESSOR HERE ***!
! List that contains all accaptable types of collisionProcessors
! It is printed if type was unrecognised
! NOTE:
Expand Down Expand Up @@ -45,31 +44,25 @@ subroutine new_collisionProcessor(new,dict)
call dict % get(type,'type')

! Allocate approperiate subclass of collisionProcessor
! *** ADD CASE STATEMENT FOR A NEW COLLISION PROCESSOR BELOW ***!
select case(type)
case('neutronCEstd')
allocate(neutronCEstd :: new)
call new % init(dict)

case('neutronCEimp')
allocate(neutronCEimp :: new)
call new % init(dict)

case('neutronMGstd')
allocate(neutronMGstd :: new)
call new % init(dict)

!*** NEW COLLISION PROCESSOR TEMPLATE ***!
!case('<newcollisionProcessorName>')
! allocate(<newcollisionProcessorName> :: new)
! call new % init(dict)
!
case default
print *, AVALIBLE_collisionProcessors
call fatalError(Here, 'Unrecognised type of collisionProcessor: ' // trim(type))

end select

! Initialise new processor
call new % init(dict)

end subroutine new_collisionProcessor

end module collisionProcessorFactory_func
2 changes: 0 additions & 2 deletions Geometry/Cells/cellFactory_func.f90
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ module cellFactory_func
implicit none
private

! ** ADD NAME OF NEW CELL TO THE LIST **!
! List that contains acceptable types of cells
! NOTE: It is necessary to adjust trailing blanks so all entries have the same length
character(nameLen), dimension(*), parameter :: AVAILABLE_CELL = ['simpleCell']
Expand Down Expand Up @@ -49,7 +48,6 @@ function new_cell_ptr(dict, surfs) result(new)
call dict % get(type, 'type')

! Allocate approperiate cell
! ** FOR NEW CELL ADD CASE STATEMENT HERE ** !
select case (type)
case ('simpleCell')
allocate(simpleCell :: new)
Expand Down
3 changes: 1 addition & 2 deletions Geometry/Surfaces/surfaceFactory_func.f90
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ module surfaceFactory_func
implicit none
private

! ** ADD NAME OF NEW SURFACE TO THE LIST **!
! List that contains all accaptable types of surfaces
! NOTE: It is necessary to adjust trailing blanks so all entries have the same length
character(nameLen), dimension(*), parameter :: AVAILABLE_SURFACE = ['xPlane ',&
Expand Down Expand Up @@ -67,7 +66,6 @@ function new_surface_ptr(dict) result(new)
call dict % get(type, 'type')

! Allocate approperiate subclass
! *** FOR NEW SURFACE ADD CASE STATEMENT HERE ***!
select case (type)
case ('xPlane', 'yPlane', 'zPlane')
allocate (aPlane :: new)
Expand All @@ -94,6 +92,7 @@ function new_surface_ptr(dict) result(new)
print '(A)' , ' AVAILABLE SURFACES: '
print '(A)' , AVAILABLE_SURFACE
call fatalError(Here, 'Unrecognised type of a surface: '//trim(type))

end select

! Initialise surface
Expand Down
2 changes: 0 additions & 2 deletions Geometry/Universes/universeFactory_func.f90
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ module universeFactory_func
implicit none
private

! ** ADD NAME OF NEW UNIVERSE TO THE LIST
! List contains acceptable types of universe
! NOTE: It is necessary to adjust trailing blanks so all entries have the same length
character(nameLen), dimension(*), parameter :: AVAILABLE_UNI = ['rootUniverse',&
Expand Down Expand Up @@ -60,7 +59,6 @@ subroutine new_universe_ptr(ptr, fill, dict, cells, surfs, mats)
call dict % get(type, 'type')

! Allocate appropriate universe
! ** FOR NEW UNIVERSE ADD CASE STATEMENT HERE ** !
select case (type)
case ('rootUniverse')
allocate(rootUniverse :: ptr)
Expand Down
13 changes: 3 additions & 10 deletions ParticleObjects/Source/sourceFactory_func.f90
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ module sourceFactory_func

public :: new_source

! *** ADD NAME OF A NEW SOURCE HERE ***!
! List that contains all accaptable types of sources
! It is printed if type was unrecognised
! NOTE:
Expand Down Expand Up @@ -49,31 +48,25 @@ subroutine new_source(new, dict, geom)
call dict % get(type,'type')

! Allocate approperiate subclass of source
! *** ADD CASE STATEMENT FOR A NEW SOURCE BELOW ***!
select case(type)
case('pointSource')
allocate(pointSource :: new)
call new % init(dict, geom)

case('fissionSource')
allocate(fissionSource :: new)
call new % init(dict, geom)

case('materialSource')
allocate(materialSource :: new)
call new % init(dict, geom)

!*** NEW SOURCE TEMPLATE ***!
!case('<newSourceName>')
! allocate(<newSourceName> :: new)
! call new % init(dict, geom)
!
case default
print *, AVAILABLE_sources
call fatalError(Here, 'Unrecognised type of source: ' // trim(type))

end select

! Initialise new source
call new % init(dict, geom)

end subroutine new_source

end module sourceFactory_func
33 changes: 3 additions & 30 deletions PhysicsPackages/physicsPackageFactory_func.f90
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ module physicsPackageFactory_func
implicit none
private

! *** ADD NAME OF A NEW PHYSICS PACKAGE HERE ***!
! List that contains all accaptable types of Physics Packages
! It is printed if type was unrecognised
! NOTE:
Expand Down Expand Up @@ -51,54 +50,28 @@ function new_physicsPackage(dict) result(new)
call dict % get(type,'type')

! Allocate approperiate subclass of physicsPackage
! *** ADD CASE STATEMENT FOR A PHYSICS PACKAGE BELOW ***!
! **** AT THE MOMENT ALLOCATE + SELECT TYPE + INIT is very unelegant implementation
! **** Will have to be improved
select case(type)
case('eigenPhysicsPackage')
! Allocate and initialise
allocate( eigenPhysicsPackage :: new)
select type(new)
type is (eigenPhysicsPackage)
call new % init(dict)
end select

case('fixedSourcePhysicsPackage')
! Allocate and initialise
allocate( fixedSourcePhysicsPackage :: new)
select type(new)
type is (fixedSourcePhysicsPackage)
call new % init(dict)
end select
!
! case('dynamPhysicsPackage')
! ! Allocate and initialise
! allocate( dynamPhysicsPackage :: new)
! select type(new)
! type is (dynamPhysicsPackage)
! call new % init(dict)
! end select


case('vizPhysicsPackage')
! Allocate and initialise
allocate( vizPhysicsPackage :: new)
select type(new)
type is (vizPhysicsPackage)
call new % init(dict)
end select

case('rayVolPhysicsPackage')
! Allocate and initialise
allocate( rayVolPhysicsPackage :: new)
call new % init(dict)

case default
print *, AVAILABLE_physicsPackages
call fatalError(Here, 'Unrecognised type of Physics Package : ' // trim(type))

end select

! Initialise new physics package
call new % init(dict)

end function new_physicsPackage

!!
Expand Down
20 changes: 3 additions & 17 deletions Tallies/TallyClerks/tallyClerkFactory_func.f90
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ module tallyClerkFactory_func

public :: new_tallyClerk

! *** ADD NAME OF A NEW TALLY FILTER HERE ***!
! List that contains all accaptable types of tallyClerks
! It is printed if type was unrecognised
! NOTE:
Expand Down Expand Up @@ -60,59 +59,46 @@ subroutine new_tallyClerk(new, dict, name)
call dict % get(type,'type')

! Allocate approperiate subclass of tallyClerk
! *** ADD CASE STATEMENT FOR A NEW TALLY MAP BELOW ***!
select case(type)
case('keffAnalogClerk')
allocate(keffAnalogClerk :: new)
call new % init(dict, name)

case('keffImplicitClerk')
allocate(keffImplicitClerk :: new)
call new % init(dict, name)

case('collisionClerk')
allocate(collisionClerk :: new)
call new % init(dict, name)

case('collisionProbabilityClerk')
allocate(collisionProbabilityClerk :: new)
call new % init(dict, name)

case('trackClerk')
allocate(trackClerk :: new)
call new % init(dict, name)

case('simpleFMClerk')
allocate(simpleFMClerk :: new)
call new % init(dict, name)

case('dancoffBellClerk')
allocate(dancoffBellClerk :: new)
call new % init(dict, name)

case('shannonEntropyClerk')
allocate(shannonEntropyClerk :: new)
call new % init(dict, name)

case('centreOfMassClerk')
allocate(centreOfMassClerk :: new)
call new % init(dict, name)

case('mgXsClerk')
allocate(mgXsClerk :: new)
call new % init(dict, name)

!*** NEW TALLY MAP TEMPLATE ***!
!case('<newtallyClerkName>')
! allocate(<newtallyClerkName> :: new)
! call new % init(dict, name)
!
case default
print *, AVALIBLE_tallyClerks
call fatalError(Here, 'Unrecognised type of tallyClerk: ' // trim(type))

end select

! Initialise new clerk
call new % init(dict, name)

end subroutine new_tallyClerk

end module tallyClerkFactory_func
12 changes: 3 additions & 9 deletions Tallies/TallyFilters/tallyFilterFactory_func.f90
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ module tallyFilterFactory_func

public :: new_tallyFilter

! *** ADD NAME OF A NEW TALLY FILTER HERE ***!
! List that contains all accaptable types of tallyFilters
! It is printed if type was unrecognised
! NOTE:
Expand All @@ -43,27 +42,22 @@ subroutine new_tallyFilter(new,dict)
call dict % get(type,'type')

! Allocate approperiate subclass of tallyFilter
! *** ADD CASE STATEMENT FOR A NEW TALLY MAP BELOW ***!
select case(type)
case('energyFilter')
allocate(energyFilter :: new)
call new % init(dict)

case('testFilter')
allocate(testFilter :: new)
call new % init(dict)

!*** NEW TALLY MAP TEMPLATE ***!
!case('<newtallyFilterName>')
! allocate(<newtallyFilterName> :: new)
! call new % init(dict)
!
case default
print *, AVALIBLE_tallyFilters
call fatalError(Here, 'Unrecognised type of tallyFilter: ' // trim(type))

end select

! Initialise new filter
call new % init(dict)

end subroutine new_tallyFilter

end module tallyFilterFactory_func
27 changes: 6 additions & 21 deletions Tallies/TallyMaps/tallyMap1DFactory_func.f90
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,13 @@ module tallyMap1DFactory_func
use weightMap_class, only : weightMap
use cellMap_class, only : cellMap
use testMap_class, only : testMap
! use matXsMap_class, only : matXsMap

implicit none
private

public :: new_tallyMap1D
public :: new_tallyMap


! *** ADD NAME OF A NEW TALLY MAP 1D HERE ***!
! List that contains all accaptable types of tallyMaps1D
! It is printed if type was unrecognised
! NOTE:
Expand Down Expand Up @@ -81,48 +78,36 @@ subroutine new_tallyMap1D(new, dict)
call dict % get(type,'type')

! Allocate approperiate subclass of tallyMap
! *** ADD CASE STATEMENT FOR A NEW TALLY MAP BELOW ***!
select case(type)
case('energyMap')
allocate(energyMap :: new)
call new % init(dict)

case('spaceMap')
allocate(spaceMap :: new)
call new % init(dict)

case('materialMap')
allocate(materialMap :: new)
call new % init(dict)

case('homogMatMap')
allocate(homogMatMap :: new)
call new % init(dict)

case('weightMap')
allocate(weightMap :: new)
call new % init(dict)

case('cellMap')
allocate(cellMap :: new)
call new % init(dict)

case('testMap')
allocate(testMap :: new)
call new % init(dict)

!*** NEW TALLY MAP TEMPLATE ***!
!case('<newTallyMapName>')
! allocate(<newTallyMapName> :: new)
! call new % init(dict)
!
case default
print *, AVALIBLE_tallyMaps1D
call fatalError(Here,'Unrecognised type of tallyMap1D : ' // trim(type))

end select

! Print error if failed to allocate
if(.not.allocated(new)) then
print *, AVALIBLE_tallyMaps1D
call fatalError(Here,'Unrecognised type of tallyMap1D : ' // trim(type))
end if
! Initialise new map
call new % init(dict)

end subroutine new_tallyMap1D

Expand Down
Loading

0 comments on commit ccd58bb

Please sign in to comment.