Create a Cartesian block with linearly spaced nodes.
If the extents (emin, emax) of the block are not passed, the values already saved into the block are used.
re-add elemental attribute.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(block_object), | intent(inout) | :: | self | Block. |
||
| type(vector), | intent(in), | optional | :: | emin | Coordinates of minimum abscissa of the block. |
|
| type(vector), | intent(in), | optional | :: | emax | Coordinates of maximum abscissa of the block. |
subroutine create_linspace(self, emin, emax)
!< Create a Cartesian block with linearly spaced nodes.
!<
!< @note If the extents (emin, emax) of the block are not passed, the values already saved into the block are used.
!<
!< @TODO re-add elemental attribute.
class(block_object), intent(inout) :: self !< Block.
type(vector), intent(in), optional :: emin !< Coordinates of minimum abscissa of the block.
type(vector), intent(in), optional :: emax !< Coordinates of maximum abscissa of the block.
type(vector) :: delta !< Diagonal of block bounding-box.
real(R8P) :: delta_x !< X component of diagonal of block bounding-box.
real(R8P) :: delta_y !< Y component of diagonal of block bounding-box.
real(R8P) :: delta_z !< Z component of diagonal of block bounding-box.
integer(I4P) :: i !< Counter.
integer(I4P) :: j !< Counter.
integer(I4P) :: k !< Counter.
self%error%status = ERROR_BLOCK_CREATE_LINSPACE_FAILED
self%signature%is_cartesian = .true.
if (present(emin)) self%signature%emin = emin
if (present(emax)) self%signature%emax = emax
associate(gc=>self%signature%gc, ni=>self%signature%ni, nj=>self%signature%nj, nk=>self%signature%nk)
if (self%signature%emin/=self%signature%emax) then
delta = (self%signature%emax - self%signature%emin) / (ni * ex + nj * ey + nk * ez)
delta_x = delta.dot.ex
delta_y = delta.dot.ey
delta_z = delta.dot.ez
do k=0 - gc(5), nk + gc(6)
do j=0 - gc(3), nj + gc(4)
do i=0 - gc(1), ni + gc(2)
self%node(i, j, k)%vertex = self%signature%emin + (i * delta_x) * ex + (j * delta_y) * ey + (k * delta_z) * ez
enddo
enddo
enddo
call self%compute_metrics
self%error%status = NO_ERROR
endif
endassociate
endsubroutine create_linspace