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
163 if (
present(size))
then
164 if (
size .gt. 0)
then
178 allocate(
integer::this%data(this%size_))
180 allocate(
integer(i8)::this%data(this%size_))
182 allocate(
double precision::this%data(this%size_))
202 allocate(
point_t::this%data(this%size_))
211 class(
stack_t),
intent(inout) :: this
213 if (
allocated(this%data))
then
214 deallocate(this%data)
223 class(
stack_t),
intent(inout) :: this
229 class(
stack_t),
intent(in) :: this
236 class(
stack_t),
intent(in) :: this
238 is_empty = this%top_ .eq. 0
243 class(
stack_t),
target,
intent(inout) :: this
244 class(*),
intent(in) :: data
245 class(*),
allocatable :: tmp(:)
248 if (this%top_ .eq. this%size_)
then
249 this%size_ = ishft(this%size_, 1)
252 allocate(
integer::tmp(this%size_))
254 allocate(
integer(i8)::tmp(this%size_))
255 type is(double precision)
256 allocate(
double precision::tmp(this%size_))
276 allocate(
point_t::tmp(this%size_))
278 call neko_error(
'Invalid data type (stack_push)')
283 select type(sdp => this%data)
285 tmp(1:this%top_) = sdp
287 type is (
integer(i8))
288 select type(sdp => this%data)
289 type is (
integer(i8))
290 tmp(1:this%top_) = sdp
292 type is (double precision)
293 select type(sdp => this%data)
294 type is (double precision)
295 tmp(1:this%top_) = sdp
298 select type(sdp => this%data)
305 select type(sdp => this%data)
312 select type(sdp => this%data)
319 select type(sdp => this%data)
326 select type(sdp => this%data)
328 tmp(1:this%top_) = sdp
331 select type(sdp => this%data)
333 tmp(1:this%top_) = sdp
336 select type(sdp => this%data)
338 tmp(1:this%top_) = sdp
341 select type(sdp => this%data)
343 tmp(1:this%top_) = sdp
346 select type(sdp => this%data)
348 tmp(1:this%top_) = sdp
351 select type(sdp => this%data)
353 tmp(1:this%top_) = sdp
356 call neko_error(
'Invalid data type (stack_push tmp)')
358 call move_alloc(tmp, this%data)
361 this%top_ = this%top_ + 1
363 select type(sdp => this%data)
367 sdp(this%top_) =
data
369 type is (
integer(i8))
371 type is (
integer(i8))
372 sdp(this%top_) =
data
374 type is (double precision)
376 type is (double precision)
377 sdp(this%top_) =
data
382 sdp(this%top_) =
data
387 sdp(this%top_) =
data
392 sdp(this%top_) =
data
397 sdp(this%top_) =
data
402 sdp(this%top_) =
data
407 sdp(this%top_) =
data
412 sdp(this%top_) =
data
417 sdp(this%top_) =
data
422 sdp(this%top_) =
data
427 sdp(this%top_) =
data
430 call neko_error(
'Invalid data type in stack (stack_push)')
436 class(
stack_i4_t),
target,
intent(inout) :: this
439 select type (sdp => this%data)
441 data = sdp(this%top_)
445 this%top_ = this%top_ - 1
450 class(
stack_i4_t),
target,
intent(inout) :: this
451 integer,
contiguous,
pointer :: data(:)
453 select type (sdp => this%data)
457 call neko_error(
'Invalid data type (i4 array)')
463 class(
stack_i8_t),
target,
intent(inout) :: this
464 integer(kind=i8) :: data
466 select type (sdp => this%data)
467 type is (
integer(
i8))
468 data = sdp(this%top_)
472 this%top_ = this%top_ - 1
477 class(
stack_i8_t),
target,
intent(inout) :: this
478 integer(kind=i8),
contiguous,
pointer :: data(:)
480 select type (sdp => this%data)
481 type is (
integer(
i8))
484 call neko_error(
'Invalid data type (i8 array)')
490 class(
stack_r8_t),
target,
intent(inout) :: this
491 real(kind=
dp) ::
data
493 select type (sdp => this%data)
494 type is (double precision)
495 data = sdp(this%top_)
499 this%top_ = this%top_ -1
504 class(
stack_r8_t),
target,
intent(inout) :: this
505 real(kind=
dp),
contiguous,
pointer ::
data(:)
507 select type (sdp => this%data)
508 type is (double precision)
511 call neko_error(
'Invalid data type (r8 array)')
520 select type (sdp => this%data)
522 data = sdp(this%top_)
524 call neko_error(
'Invalid data type (i4t2 pop)')
526 this%top_ = this%top_ -1
532 type(
tuple_i4_t),
contiguous,
pointer :: data(:)
534 select type (sdp => this%data)
538 call neko_error(
'Invalid data type (i4t2 array)')
547 select type (sdp => this%data)
549 data = sdp(this%top_)
551 call neko_error(
'Invalid data type (i4t4 pop)')
553 this%top_ = this%top_ -1
561 select type (sdp => this%data)
565 call neko_error(
'Invalid data type (i4t4 array)')
574 select type (sdp => this%data)
576 data = sdp(this%top_)
578 call neko_error(
'Invalid data type (i4r8t2 pop)')
580 this%top_ = this%top_ -1
588 select type (sdp => this%data)
592 call neko_error(
'Invalid data type (i4r8t2 array)')
601 select type (sdp => this%data)
603 data = sdp(this%top_)
605 call neko_error(
'Invalid data type (i4r8t2 pop)')
607 this%top_ = this%top_ -1
615 select type (sdp => this%data)
619 call neko_error(
'Invalid data type (i4r8t2 array)')
628 select type (sdp => this%data)
630 data = sdp(this%top_)
632 call neko_error(
'Invalid data type (curve pop)')
634 this%top_ = this%top_ -1
642 select type (sdp => this%data)
646 call neko_error(
'Invalid data type (curve array)')
652 class(
stack_nq_t),
target,
intent(inout) :: this
655 select type (sdp => this%data)
657 data = sdp(this%top_)
661 this%top_ = this%top_ -1
666 class(
stack_nq_t),
target,
intent(inout) :: this
669 select type (sdp => this%data)
673 call neko_error(
'Invalid data type (nq array)')
679 class(
stack_nh_t),
target,
intent(inout) :: this
682 select type (sdp => this%data)
684 data = sdp(this%top_)
688 this%top_ = this%top_ -1
693 class(
stack_nh_t),
target,
intent(inout) :: this
694 type(
nmsh_hex_t),
contiguous,
pointer :: data(:)
696 select type (sdp => this%data)
700 call neko_error(
'Invalid data type (nh array)')
706 class(
stack_nz_t),
target,
intent(inout) :: this
709 select type (sdp => this%data)
711 data = sdp(this%top_)
715 this%top_ = this%top_ -1
720 class(
stack_nz_t),
target,
intent(inout) :: this
723 select type (sdp => this%data)
727 call neko_error(
'Invalid data type (nz array)')
733 class(
stack_nc_t),
target,
intent(inout) :: this
736 select type (sdp => this%data)
738 data = sdp(this%top_)
742 this%top_ = this%top_ -1
747 class(
stack_nc_t),
target,
intent(inout) :: this
750 select type (sdp => this%data)
754 call neko_error(
'Invalid data type (nc array)')
760 class(
stack_pt_t),
target,
intent(inout) :: this
763 select type (sdp => this%data)
765 data = sdp(this%top_)
767 call neko_error(
'Invalid data type (point pop)')
769 this%top_ = this%top_ -1
774 class(
stack_pt_t),
target,
intent(inout) :: this
775 type(
point_t),
contiguous,
pointer :: data(:)
777 select type (sdp => this%data)
781 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 .