Skip to content

Commit

Permalink
Merge pull request #765 from galacticusorg/fixSampleGridStateSize
Browse files Browse the repository at this point in the history
Fix sample grid state size for the `posteriorSamplesPriorGrid` class
  • Loading branch information
abensonca authored Jan 14, 2025
2 parents a08c21e + bfb8ed3 commit c45f348
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions source/posterior_sampling.state.samples.prior_grid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ subroutine priorGridSamples(self,simulationStates,modelParameters_)
double precision , dimension(size(modelParameters_)) :: stateVector
type (multiCounter ) :: counter
integer (c_size_t ) :: i , j
allocate(simulationStates(self%countGrid*size(modelParameters_)))

allocate(simulationStates(self%countGrid**size(modelParameters_)))
counter=multiCounter(spread(self%countGrid,1,size(modelParameters_)))
i =0
do while (counter%increment())
Expand Down
15 changes: 14 additions & 1 deletion source/utility.multi_counter.F90
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ module Multi_Counters
Constructors for multi-counters.
!!}
module procedure multiCounterConstructor
module procedure multiCounterConstructorShortInt
end interface multiCounter

contains
Expand All @@ -71,7 +72,7 @@ function multiCounterConstructor(ranges) result (self)
!!{
Constructor for multi-counters where the ranges are provided.
!!}
use :: Error , only : Error_Report
use :: Error, only : Error_Report
implicit none
type (multiCounter) :: self
integer(c_size_t ), intent(in ), dimension(:) :: ranges
Expand All @@ -86,6 +87,18 @@ function multiCounterConstructor(ranges) result (self)
return
end function multiCounterConstructor

function multiCounterConstructorShortInt(ranges) result (self)
!!{
Constructor for multi-counters where the ranges are provided as short integers.
!!}
implicit none
type (multiCounter) :: self
integer , intent(in ), dimension(:) :: ranges

self=multiCounter(int(ranges,kind=c_size_t))
return
end function multiCounterConstructorShortInt

subroutine multiCounterDestructor(self)
!!{
Destroy a multi-counter object.
Expand Down

0 comments on commit c45f348

Please sign in to comment.