64 class(*),
allocatable :: data(:)
68 procedure, non_overridable, pass(this) :: init =>
stack_init
69 procedure, non_overridable, pass(this) :: free =>
stack_free
70 procedure, non_overridable, pass(this) :: clear =>
stack_clear
71 procedure, non_overridable, pass(this) :: size =>
stack_size
73 procedure, non_overridable, pass(this) :: push =>
stack_push
171 class(
stack_t),
intent(inout) :: this
172 integer,
optional :: size
177 if (
present(size))
then
178 if (
size .gt. 0)
then
192 allocate(
integer::this%data(this%size_))
194 allocate(
integer(i8)::this%data(this%size_))
196 allocate(
double precision::this%data(this%size_))
216 allocate(
point_t::this%data(this%size_))
225 class(
stack_t),
intent(inout) :: this
227 if (
allocated(this%data))
then
228 deallocate(this%data)
237 class(
stack_t),
intent(inout) :: this
243 class(
stack_t),
intent(in) :: this
250 class(
stack_t),
intent(in) :: this
252 is_empty = this%top_ .eq. 0
257 class(
stack_t),
target,
intent(inout) :: this
258 class(*),
intent(in) :: data
259 class(*),
allocatable :: tmp(:)
262 if (this%top_ .eq. this%size_)
then
263 this%size_ = ishft(this%size_, 1)
266 allocate(
integer::tmp(this%size_))
268 allocate(
integer(i8)::tmp(this%size_))
269 type is(double precision)
270 allocate(
double precision::tmp(this%size_))
290 allocate(
point_t::tmp(this%size_))
292 call neko_error(
'Invalid data type (stack_push)')
297 select type(sdp => this%data)
299 tmp(1:this%top_) = sdp
301 type is (
integer(i8))
302 select type(sdp => this%data)
303 type is (
integer(i8))
304 tmp(1:this%top_) = sdp
306 type is (double precision)
307 select type(sdp => this%data)
308 type is (double precision)
309 tmp(1:this%top_) = sdp
312 select type(sdp => this%data)
319 select type(sdp => this%data)
326 select type(sdp => this%data)
333 select type(sdp => this%data)
340 select type(sdp => this%data)
342 tmp(1:this%top_) = sdp
345 select type(sdp => this%data)
347 tmp(1:this%top_) = sdp
350 select type(sdp => this%data)
352 tmp(1:this%top_) = sdp
355 select type(sdp => this%data)
357 tmp(1:this%top_) = sdp
360 select type(sdp => this%data)
362 tmp(1:this%top_) = sdp
365 select type(sdp => this%data)
367 tmp(1:this%top_) = sdp
370 call neko_error(
'Invalid data type (stack_push tmp)')
372 call move_alloc(tmp, this%data)
375 this%top_ = this%top_ + 1
377 select type(sdp => this%data)
381 sdp(this%top_) =
data
383 type is (
integer(i8))
385 type is (
integer(i8))
386 sdp(this%top_) =
data
388 type is (double precision)
390 type is (double precision)
391 sdp(this%top_) =
data
396 sdp(this%top_) =
data
401 sdp(this%top_) =
data
406 sdp(this%top_) =
data
411 sdp(this%top_) =
data
416 sdp(this%top_) =
data
421 sdp(this%top_) =
data
426 sdp(this%top_) =
data
431 sdp(this%top_) =
data
436 sdp(this%top_) =
data
441 sdp(this%top_) =
data
444 call neko_error(
'Invalid data type in stack (stack_push)')
450 class(
stack_i4_t),
target,
intent(inout) :: this
453 select type (sdp => this%data)
455 data = sdp(this%top_)
459 this%top_ = this%top_ - 1
464 class(
stack_i4_t),
target,
intent(inout) :: this
465 integer,
contiguous,
pointer :: data(:)
467 select type (sdp => this%data)
471 call neko_error(
'Invalid data type (i4 array)')
477 class(
stack_i8_t),
target,
intent(inout) :: this
478 integer(kind=i8) :: data
480 select type (sdp => this%data)
481 type is (
integer(
i8))
482 data = sdp(this%top_)
486 this%top_ = this%top_ - 1
491 class(
stack_i8_t),
target,
intent(inout) :: this
492 integer(kind=i8),
contiguous,
pointer :: data(:)
494 select type (sdp => this%data)
495 type is (
integer(
i8))
498 call neko_error(
'Invalid data type (i8 array)')
504 class(
stack_r8_t),
target,
intent(inout) :: this
505 real(kind=
dp) ::
data
507 select type (sdp => this%data)
508 type is (double precision)
509 data = sdp(this%top_)
513 this%top_ = this%top_ -1
518 class(
stack_r8_t),
target,
intent(inout) :: this
519 real(kind=
dp),
contiguous,
pointer ::
data(:)
521 select type (sdp => this%data)
522 type is (double precision)
525 call neko_error(
'Invalid data type (r8 array)')
534 select type (sdp => this%data)
536 data = sdp(this%top_)
538 call neko_error(
'Invalid data type (i4t2 pop)')
540 this%top_ = this%top_ -1
546 type(
tuple_i4_t),
contiguous,
pointer :: data(:)
548 select type (sdp => this%data)
552 call neko_error(
'Invalid data type (i4t2 array)')
561 select type (sdp => this%data)
563 data = sdp(this%top_)
565 call neko_error(
'Invalid data type (i4t4 pop)')
567 this%top_ = this%top_ -1
575 select type (sdp => this%data)
579 call neko_error(
'Invalid data type (i4t4 array)')
588 select type (sdp => this%data)
590 data = sdp(this%top_)
592 call neko_error(
'Invalid data type (i4r8t2 pop)')
594 this%top_ = this%top_ -1
602 select type (sdp => this%data)
606 call neko_error(
'Invalid data type (i4r8t2 array)')
615 select type (sdp => this%data)
617 data = sdp(this%top_)
619 call neko_error(
'Invalid data type (i4r8t2 pop)')
621 this%top_ = this%top_ -1
629 select type (sdp => this%data)
633 call neko_error(
'Invalid data type (i4r8t2 array)')
642 select type (sdp => this%data)
644 data = sdp(this%top_)
646 call neko_error(
'Invalid data type (curve pop)')
648 this%top_ = this%top_ -1
656 select type (sdp => this%data)
660 call neko_error(
'Invalid data type (curve array)')
666 class(
stack_nq_t),
target,
intent(inout) :: this
669 select type (sdp => this%data)
671 data = sdp(this%top_)
675 this%top_ = this%top_ -1
680 class(
stack_nq_t),
target,
intent(inout) :: this
683 select type (sdp => this%data)
687 call neko_error(
'Invalid data type (nq array)')
693 class(
stack_nh_t),
target,
intent(inout) :: this
696 select type (sdp => this%data)
698 data = sdp(this%top_)
702 this%top_ = this%top_ -1
707 class(
stack_nh_t),
target,
intent(inout) :: this
708 type(
nmsh_hex_t),
contiguous,
pointer :: data(:)
710 select type (sdp => this%data)
714 call neko_error(
'Invalid data type (nh array)')
720 class(
stack_nz_t),
target,
intent(inout) :: this
723 select type (sdp => this%data)
725 data = sdp(this%top_)
729 this%top_ = this%top_ -1
734 class(
stack_nz_t),
target,
intent(inout) :: this
737 select type (sdp => this%data)
741 call neko_error(
'Invalid data type (nz array)')
747 class(
stack_nc_t),
target,
intent(inout) :: this
750 select type (sdp => this%data)
752 data = sdp(this%top_)
756 this%top_ = this%top_ -1
761 class(
stack_nc_t),
target,
intent(inout) :: this
764 select type (sdp => this%data)
768 call neko_error(
'Invalid data type (nc array)')
774 class(
stack_pt_t),
target,
intent(inout) :: this
777 select type (sdp => this%data)
779 data = sdp(this%top_)
781 call neko_error(
'Invalid data type (point pop)')
783 this%top_ = this%top_ -1
788 class(
stack_pt_t),
target,
intent(inout) :: this
789 type(
point_t),
contiguous,
pointer :: data(:)
791 select type (sdp => this%data)
795 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 .