Commit 1f2f094b authored by Jorn Bruggeman's avatar Jorn Bruggeman
Browse files

replaced domain%size with shape, start, stop

parent 13b33164
......@@ -496,10 +496,12 @@ contains
self%status = status_set_domain_done
#if _FABM_DIMENSION_COUNT_>0
self%domain%size = (/_LOCATION_/)
self%domain%shape = (/_LOCATION_/)
self%domain%start(:) = 1
self%domain%stop = self%domain%shape
#endif
#if _HORIZONTAL_DIMENSION_COUNT_>0
self%domain%horizontal_size = (/_HORIZONTAL_LOCATION_/)
self%domain%horizontal_shape = (/_HORIZONTAL_LOCATION_/)
#endif
if (present(seconds_per_time_unit)) then
......@@ -551,8 +553,8 @@ contains
# ifndef _FABM_HORIZONTAL_MASK_
# if !defined(NDEBUG)&&_FABM_DIMENSION_COUNT_>0
do i = 1, size(self%domain%size)
if (size(mask, i) /= self%domain%size(i)) &
do i = 1, size(self%domain%shape)
if (size(mask, i) /= self%domain%shape(i)) &
call fatal_error('set_mask', 'shape of provided mask does not match domain extents provided to set_domain.')
end do
# endif
......@@ -560,8 +562,8 @@ contains
# endif
# if !defined(NDEBUG)&&_HORIZONTAL_DIMENSION_COUNT_>0
do i = 1, size(self%domain%horizontal_size)
if (size(mask_hz, i) /= self%domain%horizontal_size(i)) &
do i = 1, size(self%domain%horizontal_shape)
if (size(mask_hz, i) /= self%domain%horizontal_shape(i)) &
call fatal_error('set_mask', 'shape of provided horizontal mask does not match domain extents provided to set_domain.')
end do
# endif
......@@ -584,7 +586,7 @@ contains
call fatal_error('set_bottom_index', 'set_bottom_index has not yet been called on this model object.')
if (index < 1) &
call fatal_error('set_bottom_index', 'provided index must equal or exceed 1.')
if (index > self%domain%size(_FABM_DEPTH_DIMENSION_INDEX_)) &
if (index > self%domain%shape(_FABM_DEPTH_DIMENSION_INDEX_)) &
call fatal_error('set_bottom_index', 'provided index exceeds size of the depth dimension.')
self%domain%bottom_index = index
......@@ -607,8 +609,8 @@ contains
if (self%status < status_set_domain_done) &
call fatal_error('set_bottom_index', 'set_domain has not yet been called on this model object.')
# if !defined(NDEBUG)&&_HORIZONTAL_DIMENSION_COUNT_>0
do i = 1, size(self%domain%horizontal_size)
if (size(indices, i) /= self%domain%horizontal_size(i)) &
do i = 1, size(self%domain%horizontal_shape)
if (size(indices, i) /= self%domain%horizontal_shape(i)) &
call fatal_error('set_bottom_index', 'shape of provided index array does not match domain extents provided to set_domain.')
end do
# endif
......@@ -629,7 +631,7 @@ contains
call fatal_error('set_surface_index', 'set_domain has not yet been called on this model object.')
if (index < 1) &
call fatal_error('set_surface_index', 'provided index must equal or exceed 1.')
if (index > self%domain%size(_FABM_DEPTH_DIMENSION_INDEX_)) &
if (index > self%domain%shape(_FABM_DEPTH_DIMENSION_INDEX_)) &
call fatal_error('set_surface_index', 'provided index exceeds size of the depth dimension.')
self%domain%surface_index = index
......@@ -1107,8 +1109,8 @@ contains
integer :: source_
#if !defined(NDEBUG)&&_FABM_DIMENSION_COUNT_>0
do i = 1, size(self%domain%size)
if (size(dat, i) /= self%domain%size(i)) then
do i = 1, size(self%domain%shape)
if (size(dat, i) /= self%domain%shape(i)) then
call fatal_error('link_interior_data_by_variable', trim(variable%name) // &
': extents of provided array do not match domain extents.')
end if
......@@ -1161,8 +1163,8 @@ contains
integer :: source_
#if !defined(NDEBUG)&&_HORIZONTAL_DIMENSION_COUNT_>0
do i = 1, size(self%domain%horizontal_size)
if (size(dat, i) /= self%domain%horizontal_size(i)) then
do i = 1, size(self%domain%horizontal_shape)
if (size(dat, i) /= self%domain%horizontal_shape(i)) then
call fatal_error('link_horizontal_data_by_variable', trim(variable%name) // &
': extents of provided array do not match domain extents.')
end if
......@@ -1374,7 +1376,7 @@ contains
_DECLARE_INTERIOR_INDICES_
#ifndef NDEBUG
call check_interior_location(self%domain%size _POSTARG_INTERIOR_IN_, 'initialize_interior_state')
call check_interior_location(self%domain%shape _POSTARG_INTERIOR_IN_, 'initialize_interior_state')
#endif
call cache_pack(self%domain, self%catalog, self%cache_fill_values, self%initialize_interior_state_job%first_task, self%cache_int _POSTARG_INTERIOR_IN_)
......@@ -1411,7 +1413,7 @@ contains
_DECLARE_HORIZONTAL_INDICES_
#ifndef NDEBUG
call check_horizontal_location(self%domain%size _POSTARG_HORIZONTAL_IN_, 'initialize_bottom_state')
call check_horizontal_location(self%domain%shape _POSTARG_HORIZONTAL_IN_, 'initialize_bottom_state')
#endif
call cache_pack(self%domain, self%catalog, self%cache_fill_values, self%initialize_bottom_state_job%first_task, self%cache_hz _POSTARG_HORIZONTAL_IN_)
......@@ -1448,7 +1450,7 @@ contains
_DECLARE_HORIZONTAL_INDICES_
#ifndef NDEBUG
call check_horizontal_location(self%domain%size _POSTARG_HORIZONTAL_IN_, 'initialize_surface_state')
call check_horizontal_location(self%domain%shape _POSTARG_HORIZONTAL_IN_, 'initialize_surface_state')
#endif
call cache_pack(self%domain, self%catalog, self%cache_fill_values, self%initialize_surface_state_job%first_task, self%cache_hz _POSTARG_HORIZONTAL_IN_)
......@@ -1486,7 +1488,7 @@ contains
_DECLARE_INTERIOR_INDICES_
#ifndef NDEBUG
call check_interior_location(self%domain%size _POSTARG_INTERIOR_IN_, 'get_interior_sources_rhs')
call check_interior_location(self%domain%shape _POSTARG_INTERIOR_IN_, 'get_interior_sources_rhs')
# ifdef _FABM_VECTORIZED_DIMENSION_INDEX_
call check_extents_2d(dy, _STOP_ - _START_ + 1, size(self%state_variables), 'get_interior_sources_rhs', 'dy', 'stop-start+1, # interior state variables')
# else
......@@ -1512,7 +1514,7 @@ contains
_DECLARE_INTERIOR_INDICES_
#ifndef NDEBUG
call check_interior_location(self%domain%size _POSTARG_INTERIOR_IN_, 'get_interior_sources_ppdd')
call check_interior_location(self%domain%shape _POSTARG_INTERIOR_IN_, 'get_interior_sources_ppdd')
# ifdef _FABM_VECTORIZED_DIMENSION_INDEX_
call check_extents_3d(pp, _STOP_ - _START_ + 1, size(self%state_variables), size(self%state_variables), 'get_interior_sources_ppdd', 'pp', 'stop-start+1, # interior state variables, # interior state variables')
call check_extents_3d(dd, _STOP_ - _START_ + 1, size(self%state_variables), size(self%state_variables), 'get_interior_sources_ppdd', 'dd', 'stop-start+1, # interior state variables, # interior state variables')
......@@ -1554,7 +1556,7 @@ contains
_DECLARE_INTERIOR_INDICES_
#ifndef NDEBUG
call check_interior_location(self%domain%size _POSTARG_INTERIOR_IN_, 'check_interior_state')
call check_interior_location(self%domain%shape _POSTARG_INTERIOR_IN_, 'check_interior_state')
#endif
self%cache_int%repair = repair
......@@ -1632,7 +1634,7 @@ contains
logical, intent(out) :: valid
#ifndef NDEBUG
call check_horizontal_location(self%domain%size _POSTARG_HORIZONTAL_IN_, 'check_bottom_state')
call check_horizontal_location(self%domain%shape _POSTARG_HORIZONTAL_IN_, 'check_bottom_state')
#endif
call internal_check_horizontal_state(self, self%check_bottom_state_job _POSTARG_HORIZONTAL_IN_, 2, self%bottom_state_variables, repair, valid)
......@@ -1645,7 +1647,7 @@ contains
logical, intent(out) :: valid
#ifndef NDEBUG
call check_horizontal_location(self%domain%size _POSTARG_HORIZONTAL_IN_, 'check_surface_state')
call check_horizontal_location(self%domain%shape _POSTARG_HORIZONTAL_IN_, 'check_surface_state')
#endif
call internal_check_horizontal_state(self, self%check_surface_state_job _POSTARG_HORIZONTAL_IN_, 1, self%surface_state_variables, repair, valid)
......@@ -1788,7 +1790,7 @@ contains
_DECLARE_HORIZONTAL_INDICES_
#ifndef NDEBUG
call check_horizontal_location(self%domain%size _POSTARG_HORIZONTAL_IN_, 'get_surface_sources')
call check_horizontal_location(self%domain%shape _POSTARG_HORIZONTAL_IN_, 'get_surface_sources')
# ifdef _HORIZONTAL_IS_VECTORIZED_
call check_extents_2d(flux_pel, _STOP_ - _START_ + 1, size(self%state_variables), 'get_surface_sources', 'flux_pel', 'stop-start+1, # interior state variables')
if (present(flux_sf)) call check_extents_2d(flux_sf, _STOP_ - _START_ + 1, size(self%surface_state_variables), 'get_surface_sources', 'flux_sf', 'stop-start+1, # surface state variables')
......@@ -1826,7 +1828,7 @@ contains
_DECLARE_HORIZONTAL_INDICES_
#ifndef NDEBUG
call check_horizontal_location(self%domain%size _POSTARG_HORIZONTAL_IN_, 'get_bottom_sources_rhs')
call check_horizontal_location(self%domain%shape _POSTARG_HORIZONTAL_IN_, 'get_bottom_sources_rhs')
# ifdef _HORIZONTAL_IS_VECTORIZED_
call check_extents_2d(flux_pel, _STOP_ - _START_ + 1, size(self%state_variables), 'get_bottom_sources_rhs', 'flux_pel', 'stop-start+1, # interior state variables')
call check_extents_2d(flux_ben, _STOP_ - _START_ + 1, size(self%bottom_state_variables), 'get_bottom_sources_rhs', 'flux_ben', 'stop-start+1, # bottom state variables')
......@@ -1861,7 +1863,7 @@ contains
_DECLARE_HORIZONTAL_INDICES_
#ifndef NDEBUG
call check_horizontal_location(self%domain%size _POSTARG_HORIZONTAL_IN_, 'get_bottom_sources_ppdd')
call check_horizontal_location(self%domain%shape _POSTARG_HORIZONTAL_IN_, 'get_bottom_sources_ppdd')
#endif
call cache_pack(self%domain, self%catalog, self%cache_fill_values, self%get_bottom_sources_job%first_task, self%cache_hz _POSTARG_HORIZONTAL_IN_)
......@@ -1893,7 +1895,7 @@ contains
_DECLARE_INTERIOR_INDICES_
#ifndef NDEBUG
call check_interior_location(self%domain%size _POSTARG_INTERIOR_IN_, 'get_vertical_movement')
call check_interior_location(self%domain%shape _POSTARG_INTERIOR_IN_, 'get_vertical_movement')
# ifdef _FABM_VECTORIZED_DIMENSION_INDEX_
call check_extents_2d(velocity, _STOP_ - _START_ + 1, size(self%state_variables), 'get_vertical_movement', 'velocity', 'stop-start+1, # interior state variables')
# else
......@@ -1919,7 +1921,7 @@ contains
_DECLARE_INTERIOR_INDICES_
#ifndef NDEBUG
call check_interior_location(self%domain%size _POSTARG_INTERIOR_IN_, 'get_interior_conserved_quantities')
call check_interior_location(self%domain%shape _POSTARG_INTERIOR_IN_, 'get_interior_conserved_quantities')
# ifdef _FABM_VECTORIZED_DIMENSION_INDEX_
call check_extents_2d(sums, _STOP_ - _START_ + 1, size(self%conserved_quantities), 'get_interior_conserved_quantities', 'sums', 'stop-start+1, # conserved quantities')
# else
......@@ -1943,7 +1945,7 @@ contains
_DECLARE_HORIZONTAL_INDICES_
#ifndef NDEBUG
call check_horizontal_location(self%domain%size _POSTARG_HORIZONTAL_IN_, 'get_horizontal_conserved_quantities')
call check_horizontal_location(self%domain%shape _POSTARG_HORIZONTAL_IN_, 'get_horizontal_conserved_quantities')
# ifdef _HORIZONTAL_IS_VECTORIZED_
call check_extents_2d(sums, _STOP_ - _START_ + 1, size(self%conserved_quantities), 'get_horizontal_conserved_quantities', 'sums', 'stop-start+1, # conserved quantities')
# else
......@@ -1971,8 +1973,8 @@ contains
! Jobs must be applied across the entire depth range (if any),
! so we set vertical start and stop indices here.
integer :: _VERTICAL_START_, _VERTICAL_STOP_
_VERTICAL_START_ = 1
_VERTICAL_STOP_ = self%domain%size(_FABM_DEPTH_DIMENSION_INDEX_)
_VERTICAL_START_ = self%domain%start(_FABM_DEPTH_DIMENSION_INDEX_)
_VERTICAL_STOP_ = self%domain%stop(_FABM_DEPTH_DIMENSION_INDEX_)
#endif
do i = 1, size(job%interior_store_prefill)
......@@ -2016,8 +2018,8 @@ contains
self%catalog, self%cache_fill_values, self%store, self%cache_vert _POSTARG_VERTICAL_IN_)
_END_OUTER_VERTICAL_LOOP_
#ifdef _FABM_DEPTH_DIMENSION_INDEX_
_VERTICAL_START_ = 1
_VERTICAL_STOP_ = self%domain%size(_FABM_DEPTH_DIMENSION_INDEX_)
_VERTICAL_START_ = self%domain%start(_FABM_DEPTH_DIMENSION_INDEX_)
_VERTICAL_STOP_ = self%domain%stop(_FABM_DEPTH_DIMENSION_INDEX_)
#endif
end select
task => task%next
......@@ -2029,15 +2031,15 @@ contains
class (type_fabm_model), intent(inout), target :: self
type (type_job), intent(in) :: job
integer :: _LOCATION_RANGE_
istart__ = 1
istop__ = self%domain%size(1)
istart__ = self%domain%start(1)
istop__ = self%domain%stop(1)
# if _FABM_DIMENSION_COUNT_ > 1
jstart__ = 1
jstop__ = self%domain%size(2)
jstart__ = self%domain%start(2)
jstop__ = self%domain%stop(2)
# endif
# if _FABM_DIMENSION_COUNT_ > 2
kstart__ = 1
kstop__ = self%domain%size(3)
kstart__ = self%domain%start(3)
kstop__ = self%domain%stop(3)
# endif
call process_job(self, job _ARGUMENTS_HORIZONTAL_LOCATION_RANGE_)
end subroutine process_job_everywhere
......@@ -2620,11 +2622,11 @@ contains
#if _FABM_DIMENSION_COUNT_==0
call allocate_store()
#elif _FABM_DIMENSION_COUNT_==1
call allocate_store(self%domain%size(1))
call allocate_store(self%domain%shape(1))
#elif _FABM_DIMENSION_COUNT_==2
call allocate_store(self%domain%size(1), self%domain%size(2))
call allocate_store(self%domain%shape(1), self%domain%shape(2))
#else
call allocate_store(self%domain%size(1), self%domain%size(2), self%domain%size(3))
call allocate_store(self%domain%shape(1), self%domain%shape(2), self%domain%shape(3))
#endif
! Collect missing values in array for faster access. These will be used to fill masked parts of outputs.
......
......@@ -289,7 +289,7 @@ contains
_DECLARE_INTERIOR_INDICES_
#ifndef NDEBUG
call check_interior_location(self%domain%size _POSTARG_INTERIOR_IN_, 'fabm_get_light_extinction')
call check_interior_location(self%domain%shape _POSTARG_INTERIOR_IN_, 'fabm_get_light_extinction')
# ifdef _FABM_VECTORIZED_DIMENSION_INDEX_
call check_extents_1d(extinction, _STOP_ - _START_ + 1, 'fabm_get_light_extinction', 'extinction', 'stop-start+1')
# endif
......@@ -309,7 +309,7 @@ contains
_DECLARE_HORIZONTAL_INDICES_
#ifndef NDEBUG
call check_horizontal_location(self%domain%size _POSTARG_HORIZONTAL_IN_, 'fabm_get_drag')
call check_horizontal_location(self%domain%shape _POSTARG_HORIZONTAL_IN_, 'fabm_get_drag')
# ifdef _HORIZONTAL_IS_VECTORIZED_
call check_extents_1d(drag, _STOP_ - _START_ + 1, 'fabm_get_drag', 'drag', 'stop-start+1')
# endif
......@@ -329,7 +329,7 @@ contains
_DECLARE_HORIZONTAL_INDICES_
#ifndef NDEBUG
call check_horizontal_location(self%domain%size _POSTARG_HORIZONTAL_IN_, 'fabm_get_albedo')
call check_horizontal_location(self%domain%shape _POSTARG_HORIZONTAL_IN_, 'fabm_get_albedo')
# ifdef _HORIZONTAL_IS_VECTORIZED_
call check_extents_1d(albedo, _STOP_ - _START_ + 1, 'fabm_get_albedo', 'albedo', 'stop-start+1')
# endif
......
......@@ -30,7 +30,9 @@ module fabm_work
type type_domain
! Information about the model domain
integer :: size(_FABM_DIMENSION_COUNT_)
integer :: shape(_FABM_DIMENSION_COUNT_)
integer :: start(_FABM_DIMENSION_COUNT_)
integer :: stop(_FABM_DIMENSION_COUNT_)
integer :: horizontal_size(_HORIZONTAL_DIMENSION_COUNT_)
#ifdef _HAS_MASK_
......@@ -174,7 +176,7 @@ contains
integer :: nvalid, n, n_mod, i
#ifdef _FABM_VECTORIZED_DIMENSION_INDEX_
nvalid = domain%size(_FABM_VECTORIZED_DIMENSION_INDEX_)
nvalid = domain%shape(_FABM_VECTORIZED_DIMENSION_INDEX_)
n = nvalid
# ifdef _HAS_MASK_
allocate(cache%ipack(nvalid))
......@@ -202,7 +204,7 @@ contains
integer :: nvalid, n, n_mod, i
#ifdef _HORIZONTAL_IS_VECTORIZED_
nvalid = domain%size(_FABM_VECTORIZED_DIMENSION_INDEX_)
nvalid = domain%shape(_FABM_VECTORIZED_DIMENSION_INDEX_)
n = nvalid
# ifdef _HAS_MASK_
allocate(cache%ipack(nvalid))
......@@ -230,7 +232,7 @@ contains
integer :: nvalid, n, n_mod, i
#ifdef _FABM_DEPTH_DIMENSION_INDEX_
nvalid = domain%size(_FABM_DEPTH_DIMENSION_INDEX_)
nvalid = domain%shape(_FABM_DEPTH_DIMENSION_INDEX_)
n = nvalid
# ifdef _HAS_MASK_
allocate(cache%ipack(nvalid))
......@@ -275,7 +277,7 @@ subroutine begin_interior_task(domain, catalog, fill_values, task, cache _POSTAR
cache%ipack(i) = _I_
cache%iunpack(_I_) = i
else
cache%iunpack(_I_) = domain%size(_FABM_VECTORIZED_DIMENSION_INDEX_) + 1
cache%iunpack(_I_) = domain%shape(_FABM_VECTORIZED_DIMENSION_INDEX_) + 1
end if
end do
_N_ = i
......@@ -335,7 +337,7 @@ subroutine begin_horizontal_task(domain, catalog, fill_values, task, cache _POST
cache%ipack(i) = _J_
cache%iunpack(_J_) = i
else
cache%iunpack(_J_) = domain%size(_FABM_VECTORIZED_DIMENSION_INDEX_) + 1
cache%iunpack(_J_) = domain%shape(_FABM_VECTORIZED_DIMENSION_INDEX_) + 1
end if
end do
_N_ = i
......@@ -482,7 +484,7 @@ subroutine begin_vertical_task(domain, catalog, fill_values, task, cache _POSTAR
cache%ipack(i) = _I_
cache%iunpack(_I_) = i
else
cache%iunpack(_I_) = domain%size(_FABM_DEPTH_DIMENSION_INDEX_) + 1
cache%iunpack(_I_) = domain%shape(_FABM_DEPTH_DIMENSION_INDEX_) + 1
end if
end do
_N_ = i
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment