50 class(*),
allocatable :: data(:)
54 procedure, non_overridable, pass(this) :: init =>
stack_init
55 procedure, non_overridable, pass(this) :: free =>
stack_free
56 procedure, non_overridable, pass(this) :: clear =>
stack_clear
57 procedure, non_overridable, pass(this) :: size =>
stack_size
59 procedure, non_overridable, pass(this) :: push =>
stack_push
157 class(
stack_t),
intent(inout) :: this
158 integer,
optional :: size
161 if (
present(size))
then
162 if (
size .gt. 0)
then
176 allocate(
integer::this%data(this%size_))
178 allocate(
integer(i8)::this%data(this%size_))
180 allocate(
double precision::this%data(this%size_))
200 allocate(
point_t::this%data(this%size_))
209 class(
stack_t),
intent(inout) :: this
211 if (
allocated(this%data))
then
212 deallocate(this%data)
221 class(
stack_t),
intent(inout) :: this
227 class(
stack_t),
intent(in) :: this
234 class(
stack_t),
intent(in) :: this
236 is_empty = this%top_ .eq. 0
241 class(
stack_t),
target,
intent(inout) :: this
242 class(*),
intent(inout) :: data
243 class(*),
allocatable :: tmp(:)
246 if (this%top_ .eq. this%size_)
then
247 this%size_ = ishft(this%size_, 1)
250 allocate(
integer::tmp(this%size_))
252 allocate(
integer(i8)::tmp(this%size_))
253 type is(double precision)
254 allocate(
double precision::tmp(this%size_))
274 allocate(
point_t::tmp(this%size_))
276 call neko_error(
'Invalid data type (stack_push)')
281 select type(sdp=>this%data)
283 tmp(1:this%top_) = sdp
285 type is (
integer(i8))
286 select type(sdp=>this%data)
287 type is (
integer(i8))
288 tmp(1:this%top_) = sdp
290 type is (double precision)
291 select type(sdp=>this%data)
292 type is (double precision)
293 tmp(1:this%top_) = sdp
296 select type(sdp=>this%data)
303 select type(sdp=>this%data)
310 select type(sdp=>this%data)
317 select type(sdp=>this%data)
324 select type(sdp=>this%data)
326 tmp(1:this%top_) = sdp
329 select type(sdp=>this%data)
331 tmp(1:this%top_) = sdp
334 select type(sdp=>this%data)
336 tmp(1:this%top_) = sdp
339 select type(sdp=>this%data)
341 tmp(1:this%top_) = sdp
344 select type(sdp=>this%data)
346 tmp(1:this%top_) = sdp
349 select type(sdp=>this%data)
351 tmp(1:this%top_) = sdp
354 call neko_error(
'Invalid data type (stack_push tmp)')
356 call move_alloc(tmp, this%data)
359 this%top_ = this%top_ + 1
361 select type(sdp=>this%data)
365 sdp(this%top_) =
data
367 type is (
integer(i8))
369 type is (
integer(i8))
370 sdp(this%top_) =
data
372 type is (double precision)
374 type is (double precision)
375 sdp(this%top_) =
data
380 sdp(this%top_) =
data
385 sdp(this%top_) =
data
390 sdp(this%top_) =
data
395 sdp(this%top_) =
data
400 sdp(this%top_) =
data
405 sdp(this%top_) =
data
410 sdp(this%top_) =
data
415 sdp(this%top_) =
data
420 sdp(this%top_) =
data
425 sdp(this%top_) =
data
428 call neko_error(
'Invalid data type in stack (stack_push)')
434 class(
stack_i4_t),
target,
intent(inout) :: this
437 select type (sdp=>this%data)
439 data = sdp(this%top_)
443 this%top_ = this%top_ - 1
448 class(
stack_i4_t),
target,
intent(inout) :: this
449 integer,
contiguous,
pointer :: data(:)
451 select type (sdp=>this%data)
455 call neko_error(
'Invalid data type (i4 array)')
461 class(
stack_i8_t),
target,
intent(inout) :: this
462 integer(kind=i8) :: data
464 select type (sdp=>this%data)
465 type is (
integer(
i8))
466 data = sdp(this%top_)
470 this%top_ = this%top_ - 1
475 class(
stack_i8_t),
target,
intent(inout) :: this
476 integer(kind=i8),
contiguous,
pointer :: data(:)
478 select type (sdp=>this%data)
479 type is (
integer(
i8))
482 call neko_error(
'Invalid data type (i8 array)')
488 class(
stack_r8_t),
target,
intent(inout) :: this
489 real(kind=
dp) ::
data
491 select type (sdp=>this%data)
492 type is (double precision)
493 data = sdp(this%top_)
497 this%top_ = this%top_ -1
502 class(
stack_r8_t),
target,
intent(inout) :: this
503 real(kind=
dp),
contiguous,
pointer ::
data(:)
505 select type (sdp=>this%data)
506 type is (double precision)
509 call neko_error(
'Invalid data type (r8 array)')
518 select type (sdp=>this%data)
520 data = sdp(this%top_)
522 call neko_error(
'Invalid data type (i4t2 pop)')
524 this%top_ = this%top_ -1
530 type(
tuple_i4_t),
contiguous,
pointer :: data(:)
532 select type (sdp=>this%data)
536 call neko_error(
'Invalid data type (i4t2 array)')
545 select type (sdp=>this%data)
547 data = sdp(this%top_)
549 call neko_error(
'Invalid data type (i4t4 pop)')
551 this%top_ = this%top_ -1
559 select type (sdp=>this%data)
563 call neko_error(
'Invalid data type (i4t4 array)')
572 select type (sdp=>this%data)
574 data = sdp(this%top_)
576 call neko_error(
'Invalid data type (i4r8t2 pop)')
578 this%top_ = this%top_ -1
586 select type (sdp=>this%data)
590 call neko_error(
'Invalid data type (i4r8t2 array)')
599 select type (sdp=>this%data)
601 data = sdp(this%top_)
603 call neko_error(
'Invalid data type (i4r8t2 pop)')
605 this%top_ = this%top_ -1
613 select type (sdp=>this%data)
617 call neko_error(
'Invalid data type (i4r8t2 array)')
626 select type (sdp=>this%data)
628 data = sdp(this%top_)
630 call neko_error(
'Invalid data type (curve pop)')
632 this%top_ = this%top_ -1
640 select type (sdp=>this%data)
644 call neko_error(
'Invalid data type (curve array)')
650 class(
stack_nq_t),
target,
intent(inout) :: this
653 select type (sdp=>this%data)
655 data = sdp(this%top_)
659 this%top_ = this%top_ -1
664 class(
stack_nq_t),
target,
intent(inout) :: this
667 select type (sdp=>this%data)
671 call neko_error(
'Invalid data type (nq array)')
677 class(
stack_nh_t),
target,
intent(inout) :: this
680 select type (sdp=>this%data)
682 data = sdp(this%top_)
686 this%top_ = this%top_ -1
691 class(
stack_nh_t),
target,
intent(inout) :: this
692 type(
nmsh_hex_t),
contiguous,
pointer :: data(:)
694 select type (sdp => this%data)
698 call neko_error(
'Invalid data type (nh array)')
704 class(
stack_nz_t),
target,
intent(inout) :: this
707 select type (sdp=>this%data)
709 data = sdp(this%top_)
713 this%top_ = this%top_ -1
718 class(
stack_nz_t),
target,
intent(inout) :: this
721 select type (sdp=>this%data)
725 call neko_error(
'Invalid data type (nz array)')
731 class(
stack_nc_t),
target,
intent(inout) :: this
734 select type (sdp=>this%data)
736 data = sdp(this%top_)
740 this%top_ = this%top_ -1
745 class(
stack_nc_t),
target,
intent(inout) :: this
748 select type (sdp=>this%data)
752 call neko_error(
'Invalid data type (nc array)')
758 class(
stack_pt_t),
target,
intent(inout) :: this
761 select type (sdp=>this%data)
763 data = sdp(this%top_)
765 call neko_error(
'Invalid data type (point pop)')
767 this%top_ = this%top_ -1
772 class(
stack_pt_t),
target,
intent(inout) :: this
773 type(
point_t),
contiguous,
pointer :: data(:)
775 select type (sdp=>this%data)
779 call neko_error(
'Invalid data type (point array)')
real(kind=rp), parameter, public neko_m_ln2
integer, parameter, public i8
integer, parameter, public dp
integer, parameter, public rp
Global precision used in computations.
Implements a dynamic stack ADT.
type(struct_curve_t) function stack_curve_element_pop(this)
Pop a curve element of the stack.
type(tuple_2i4r8_t) function, dimension(:), pointer, contiguous stack_2i4r8t3_data(this)
Return a pointer to the internal 2-tuple array.
subroutine stack_free(this)
Destroy a stack.
type(tuple_2i4r8_t) function stack_2i4r8t3_pop(this)
Pop a mixed integer-double precision 3-tuple of the stack.
type(point_t) function stack_pt_pop(this)
Pop a point of the stack.
subroutine stack_clear(this)
Clear all entries of a stack.
type(nmsh_zone_t) function, dimension(:), pointer, contiguous stack_nz_data(this)
Return a pointer to the internal Neko zone array.
type(nmsh_quad_t) function stack_nq_pop(this)
Pop a Neko quad element of the stack.
type(tuple_i4_t) function, dimension(:), pointer, contiguous stack_i4t2_data(this)
Return a pointer to the interal 2-tuple array.
type(tuple_i4_t) function stack_i4t2_pop(this)
Pop an integer 2-tuple of the stack.
real(kind=dp) function, dimension(:), pointer, contiguous stack_r8_data(this)
Return a pointer to the internal double precision array.
pure integer function stack_size(this)
Return number of entries in the stack.
type(tuple4_i4_t) function, dimension(:), pointer, contiguous stack_i4t4_data(this)
Return a pointer to the internal 4-tuple array.
pure logical function stack_is_empty(this)
Return true if the stack is empty.
subroutine stack_push(this, data)
Push data onto the stack.
integer function, dimension(:), pointer, contiguous stack_i4_data(this)
Return a pointer to the internal integer array.
type(tuple4_i4_t) function stack_i4t4_pop(this)
Pop an integer 4-tuple of the stack.
real(kind=dp) function stack_r8_pop(this)
Pop a double precision value of the stack.
type(nmsh_zone_t) function stack_nz_pop(this)
Pop a Neko zone of the stack.
type(nmsh_quad_t) function, dimension(:), pointer, contiguous stack_nq_data(this)
Return a pointer to the internal Neko quad array.
subroutine stack_init(this, size)
Initialize a stack of arbitrary type.
integer function stack_i4_pop(this)
Pop an integer of the stack.
integer, parameter neko_stack_size_t
integer(kind=i8) function, dimension(:), pointer, contiguous stack_i8_data(this)
Return a pointer to the internal integer*8 array.
type(tuple_i4r8_t) function, dimension(:), pointer, contiguous stack_i4r8t2_data(this)
Return a pointer to the internal 2-tuple array.
type(nmsh_hex_t) function stack_nh_pop(this)
Pop a Neko hex element of the stack.
type(struct_curve_t) function, dimension(:), pointer, contiguous stack_curve_element_data(this)
Return a pointer to the internal curve element array.
type(tuple_i4r8_t) function stack_i4r8t2_pop(this)
Pop a mixed integer-double precision 2-tuple of the stack.
integer(kind=i8) function stack_i8_pop(this)
Pop an integer*8 of the stack.
type(nmsh_curve_el_t) function stack_nc_pop(this)
Pop a Neko curve info of the stack.
type(point_t) function, dimension(:), pointer, contiguous stack_pt_data(this)
Return a pointer to the internal point array.
type(nmsh_hex_t) function, dimension(:), pointer, contiguous stack_nh_data(this)
Return a pointer to the internal Neko quad array.
type(nmsh_curve_el_t) function, dimension(:), pointer stack_nc_data(this)
Return a pointer to the internal Neko curve info array.
Defines structs that are used... Dont know if we should keep it though.
subroutine, public neko_warning(warning_msg)
Reports a warning to standard output.
A point in with coordinates .
Mixed integer-double precision 3-tuple based stack.
Mixed integer-double precision 2-tuple based stack.
Integer 2-tuple based stack.
Integer 4-tuple based stack.
Neko curve info based stack.
Neko hex element based stack.
Neko quad element based stack.
Double precision based stack.
Mixed integer ( ) double precision ( ) 3-tuple.
Mixed integer ( ) double precision ( ) 2-tuple .