Neko 1.99.3
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
stack.f90
Go to the documentation of this file.
1! Copyright (c) 2019-2023, The Neko Authors
2! All rights reserved.
3!
4! Redistribution and use in source and binary forms, with or without
5! modification, are permitted provided that the following conditions
6! are met:
7!
8! * Redistributions of source code must retain the above copyright
9! notice, this list of conditions and the following disclaimer.
10!
11! * Redistributions in binary form must reproduce the above
12! copyright notice, this list of conditions and the following
13! disclaimer in the documentation and/or other materials provided
14! with the distribution.
15!
16! * Neither the name of the authors nor the names of its
17! contributors may be used to endorse or promote products derived
18! from this software without specific prior written permission.
19!
20! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23! FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24! COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25! INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26! BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27! LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28! CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29! LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30! ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31! POSSIBILITY OF SUCH DAMAGE.
32!
49module stack
50 use num_types
51 use nmsh
52 use utils, only : neko_error, neko_warning
53 use point, only : point_t
54 use structs, only : struct_curve_t
55 use math, only : neko_m_ln2
57 implicit none
58 private
59
60 integer, parameter :: neko_stack_size_t = 32
61
63 type, abstract, private :: stack_t
64 class(*), allocatable :: data(:)
65 integer :: top_ = 0
66 integer :: size_ = 0
67 contains
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
72 procedure, non_overridable, pass(this) :: is_empty => stack_is_empty
73 procedure, non_overridable, pass(this) :: push => stack_push
74 end type stack_t
75
77 type, public, extends(stack_t) :: stack_i4_t
78 contains
79 procedure, public, pass(this) :: pop => stack_i4_pop
80 procedure, public, pass(this) :: array => stack_i4_data
81 end type stack_i4_t
82
84 type, public, extends(stack_t) :: stack_i8_t
85 contains
86 procedure, public, pass(this) :: pop => stack_i8_pop
87 procedure, public, pass(this) :: array => stack_i8_data
88 end type stack_i8_t
89
91 type, public, extends(stack_t) :: stack_r8_t
92 contains
93 procedure, public, pass(this) :: pop => stack_r8_pop
94 procedure, public, pass(this) :: array => stack_r8_data
95 end type stack_r8_t
96
98 type, public, extends(stack_t) :: stack_i4t2_t
99 contains
100 procedure, public, pass(this) :: pop => stack_i4t2_pop
101 procedure, public, pass(this) :: array => stack_i4t2_data
102 end type stack_i4t2_t
103
105 type, public, extends(stack_t) :: stack_i4t4_t
106 contains
107 procedure, public, pass(this) :: pop => stack_i4t4_pop
108 procedure, public, pass(this) :: array => stack_i4t4_data
109 end type stack_i4t4_t
110
112 type, public, extends(stack_t) :: stack_i4r8t2_t
113 contains
114 procedure, public, pass(this) :: pop => stack_i4r8t2_pop
115 procedure, public, pass(this) :: array => stack_i4r8t2_data
116 end type stack_i4r8t2_t
117
119 type, public, extends(stack_t) :: stack_2i4r8t3_t
120 contains
121 procedure, public, pass(this) :: pop => stack_2i4r8t3_pop
122 procedure, public, pass(this) :: array => stack_2i4r8t3_data
123 end type stack_2i4r8t3_t
124
126 type, public, extends(stack_t) :: stack_curve_t
127 contains
128 procedure, public, pass(this) :: pop => stack_curve_element_pop
129 procedure, public, pass(this) :: array => stack_curve_element_data
130 end type stack_curve_t
131
133 type, public, extends(stack_t) :: stack_nq_t
134 contains
135 procedure, public, pass(this) :: pop => stack_nq_pop
136 procedure, public, pass(this) :: array => stack_nq_data
137 end type stack_nq_t
138
140 type, public, extends(stack_t) :: stack_nh_t
141 contains
142 procedure, public, pass(this) :: pop => stack_nh_pop
143 procedure, public, pass(this) :: array => stack_nh_data
144 end type stack_nh_t
145
147 type, public, extends(stack_t) :: stack_nz_t
148 contains
149 procedure, public, pass(this) :: pop => stack_nz_pop
150 procedure, public, pass(this) :: array => stack_nz_data
151 end type stack_nz_t
152
154 type, public, extends(stack_t) :: stack_nc_t
155 contains
156 procedure, public, pass(this) :: pop => stack_nc_pop
157 procedure, public, pass(this) :: array => stack_nc_data
158 end type stack_nc_t
159
161 type, public, extends(stack_t) :: stack_pt_t
162 contains
163 procedure, public, pass(this) :: pop => stack_pt_pop
164 procedure, public, pass(this) :: array => stack_pt_data
165 end type stack_pt_t
166
167contains
168
170 subroutine stack_init(this, size)
171 class(stack_t), intent(inout) :: this
172 integer, optional :: size
173 integer :: size_t
174
175 call this%free()
176
177 if (present(size)) then
178 if (size .gt. 0) then
179 size_t = size
180 else
181 call neko_warning('Invalid stack size, using default')
182 size_t = neko_stack_size_t
183 end if
184 else
185 size_t = neko_stack_size_t
186 end if
187
188 this%size_ = ishft(1, ceiling(log(real(size_t, rp)) / neko_m_ln2))
189 this%top_ = 0
190 select type(this)
191 type is(stack_i4_t)
192 allocate(integer::this%data(this%size_))
193 type is(stack_i8_t)
194 allocate(integer(i8)::this%data(this%size_))
195 type is (stack_r8_t)
196 allocate(double precision::this%data(this%size_))
197 type is (stack_i4t2_t)
198 allocate(tuple_i4_t::this%data(this%size_))
199 type is (stack_i4t4_t)
200 allocate(tuple4_i4_t::this%data(this%size_))
201 type is (stack_i4r8t2_t)
202 allocate(tuple_i4r8_t::this%data(this%size_))
203 type is (stack_2i4r8t3_t)
204 allocate(tuple_2i4r8_t::this%data(this%size_))
205 type is (stack_curve_t)
206 allocate(struct_curve_t::this%data(this%size_))
207 type is (stack_nq_t)
208 allocate(nmsh_quad_t::this%data(this%size_))
209 type is (stack_nh_t)
210 allocate(nmsh_hex_t::this%data(this%size_))
211 type is (stack_nz_t)
212 allocate(nmsh_zone_t::this%data(this%size_))
213 type is (stack_nc_t)
214 allocate(nmsh_curve_el_t::this%data(this%size_))
215 type is (stack_pt_t)
216 allocate(point_t::this%data(this%size_))
217 class default
218 call neko_error('Invalid data type')
219 end select
220
221 end subroutine stack_init
222
224 subroutine stack_free(this)
225 class(stack_t), intent(inout) :: this
226
227 if (allocated(this%data)) then
228 deallocate(this%data)
229 this%size_ = 0
230 this%top_ = 0
231 end if
232
233 end subroutine stack_free
234
236 subroutine stack_clear(this)
237 class(stack_t), intent(inout) :: this
238 this%top_ = 0
239 end subroutine stack_clear
240
242 pure function stack_size(this) result(size)
243 class(stack_t), intent(in) :: this
244 integer :: size
245 size = this%top_
246 end function stack_size
247
249 pure function stack_is_empty(this) result(is_empty)
250 class(stack_t), intent(in) :: this
251 logical :: is_empty
252 is_empty = this%top_ .eq. 0
253 end function stack_is_empty
254
256 subroutine stack_push(this, data)
257 class(stack_t), target, intent(inout) :: this
258 class(*), intent(in) :: data
259 class(*), allocatable :: tmp(:)
260 integer :: i
261
262 if (this%top_ .eq. this%size_) then
263 this%size_ = ishft(this%size_, 1)
264 select type(data)
265 type is(integer)
266 allocate(integer::tmp(this%size_))
267 type is(integer(i8))
268 allocate(integer(i8)::tmp(this%size_))
269 type is(double precision)
270 allocate(double precision::tmp(this%size_))
271 type is(tuple_i4_t)
272 allocate(tuple_i4_t::tmp(this%size_))
273 type is(tuple4_i4_t)
274 allocate(tuple4_i4_t::tmp(this%size_))
275 type is(tuple_i4r8_t)
276 allocate(tuple_i4r8_t::tmp(this%size_))
277 type is(tuple_2i4r8_t)
278 allocate(tuple_2i4r8_t::tmp(this%size_))
279 type is(struct_curve_t)
280 allocate(struct_curve_t::tmp(this%size_))
281 type is (nmsh_quad_t)
282 allocate(nmsh_quad_t::tmp(this%size_))
283 type is (nmsh_hex_t)
284 allocate(nmsh_hex_t::tmp(this%size_))
285 type is (nmsh_zone_t)
286 allocate(nmsh_zone_t::tmp(this%size_))
287 type is (nmsh_curve_el_t)
288 allocate(nmsh_curve_el_t::tmp(this%size_))
289 type is (point_t)
290 allocate(point_t::tmp(this%size_))
291 class default
292 call neko_error('Invalid data type (stack_push)')
293 end select
294
295 select type(tmp)
296 type is (integer)
297 select type(sdp => this%data)
298 type is (integer)
299 tmp(1:this%top_) = sdp
300 end select
301 type is (integer(i8))
302 select type(sdp => this%data)
303 type is (integer(i8))
304 tmp(1:this%top_) = sdp
305 end select
306 type is (double precision)
307 select type(sdp => this%data)
308 type is (double precision)
309 tmp(1:this%top_) = sdp
310 end select
311 type is (tuple_i4_t)
312 select type(sdp => this%data)
313 type is (tuple_i4_t)
314 do i = 1, this%top_
315 tmp(i) = sdp(i)
316 end do
317 end select
318 type is (tuple4_i4_t)
319 select type(sdp => this%data)
320 type is (tuple4_i4_t)
321 do i = 1, this%top_
322 tmp(i) = sdp(i)
323 end do
324 end select
325 type is (tuple_i4r8_t)
326 select type(sdp => this%data)
327 type is (tuple_i4r8_t)
328 do i = 1, this%top_
329 tmp(i) = sdp(i)
330 end do
331 end select
332 type is (tuple_2i4r8_t)
333 select type(sdp => this%data)
334 type is (tuple_2i4r8_t)
335 do i = 1, this%top_
336 tmp(i) = sdp(i)
337 end do
338 end select
339 type is (struct_curve_t)
340 select type(sdp => this%data)
341 type is (struct_curve_t)
342 tmp(1:this%top_) = sdp
343 end select
344 type is (nmsh_quad_t)
345 select type(sdp => this%data)
346 type is(nmsh_quad_t)
347 tmp(1:this%top_) = sdp
348 end select
349 type is (nmsh_hex_t)
350 select type(sdp => this%data)
351 type is(nmsh_hex_t)
352 tmp(1:this%top_) = sdp
353 end select
354 type is (nmsh_zone_t)
355 select type(sdp => this%data)
356 type is(nmsh_zone_t)
357 tmp(1:this%top_) = sdp
358 end select
359 type is (nmsh_curve_el_t)
360 select type(sdp => this%data)
361 type is(nmsh_curve_el_t)
362 tmp(1:this%top_) = sdp
363 end select
364 type is (point_t)
365 select type(sdp => this%data)
366 type is(point_t)
367 tmp(1:this%top_) = sdp
368 end select
369 class default
370 call neko_error('Invalid data type (stack_push tmp)')
371 end select
372 call move_alloc(tmp, this%data)
373 end if
374
375 this%top_ = this%top_ + 1
376
377 select type(sdp => this%data)
378 type is (integer)
379 select type(data)
380 type is (integer)
381 sdp(this%top_) = data
382 end select
383 type is (integer(i8))
384 select type(data)
385 type is (integer(i8))
386 sdp(this%top_) = data
387 end select
388 type is (double precision)
389 select type(data)
390 type is (double precision)
391 sdp(this%top_) = data
392 end select
393 type is (tuple_i4_t)
394 select type(data)
395 type is (tuple_i4_t)
396 sdp(this%top_) = data
397 end select
398 type is (tuple4_i4_t)
399 select type(data)
400 type is (tuple4_i4_t)
401 sdp(this%top_) = data
402 end select
403 type is (tuple_i4r8_t)
404 select type(data)
405 type is (tuple_i4r8_t)
406 sdp(this%top_) = data
407 end select
408 type is (tuple_2i4r8_t)
409 select type(data)
410 type is (tuple_2i4r8_t)
411 sdp(this%top_) = data
412 end select
413 type is (struct_curve_t)
414 select type(data)
415 type is (struct_curve_t)
416 sdp(this%top_) = data
417 end select
418 type is (nmsh_quad_t)
419 select type(data)
420 type is (nmsh_quad_t)
421 sdp(this%top_) = data
422 end select
423 type is (nmsh_hex_t)
424 select type(data)
425 type is (nmsh_hex_t)
426 sdp(this%top_) = data
427 end select
428 type is (nmsh_zone_t)
429 select type(data)
430 type is (nmsh_zone_t)
431 sdp(this%top_) = data
432 end select
433 type is (nmsh_curve_el_t)
434 select type(data)
435 type is (nmsh_curve_el_t)
436 sdp(this%top_) = data
437 end select
438 type is (point_t)
439 select type(data)
440 type is (point_t)
441 sdp(this%top_) = data
442 end select
443 class default
444 call neko_error('Invalid data type in stack (stack_push)')
445 end select
446 end subroutine stack_push
447
449 function stack_i4_pop(this) result(data)
450 class(stack_i4_t), target, intent(inout) :: this
451 integer :: data
452
453 select type (sdp => this%data)
454 type is (integer)
455 data = sdp(this%top_)
456 class default
457 call neko_error('Invalid data type (i4 pop)')
458 end select
459 this%top_ = this%top_ - 1
460 end function stack_i4_pop
461
463 function stack_i4_data(this) result(data)
464 class(stack_i4_t), target, intent(inout) :: this
465 integer, contiguous, pointer :: data(:)
466
467 select type (sdp => this%data)
468 type is (integer)
469 data => sdp
470 class default
471 call neko_error('Invalid data type (i4 array)')
472 end select
473 end function stack_i4_data
474
476 function stack_i8_pop(this) result(data)
477 class(stack_i8_t), target, intent(inout) :: this
478 integer(kind=i8) :: data
479
480 select type (sdp => this%data)
481 type is (integer(i8))
482 data = sdp(this%top_)
483 class default
484 call neko_error('Invalid data type (i8 pop)')
485 end select
486 this%top_ = this%top_ - 1
487 end function stack_i8_pop
488
490 function stack_i8_data(this) result(data)
491 class(stack_i8_t), target, intent(inout) :: this
492 integer(kind=i8), contiguous, pointer :: data(:)
493
494 select type (sdp => this%data)
495 type is (integer(i8))
496 data => sdp
497 class default
498 call neko_error('Invalid data type (i8 array)')
499 end select
500 end function stack_i8_data
501
503 function stack_r8_pop(this) result(data)
504 class(stack_r8_t), target, intent(inout) :: this
505 real(kind=dp) :: data
506
507 select type (sdp => this%data)
508 type is (double precision)
509 data = sdp(this%top_)
510 class default
511 call neko_error('Invalid data type (r8 pop)')
512 end select
513 this%top_ = this%top_ -1
514 end function stack_r8_pop
515
517 function stack_r8_data(this) result(data)
518 class(stack_r8_t), target, intent(inout) :: this
519 real(kind=dp), contiguous, pointer :: data(:)
520
521 select type (sdp => this%data)
522 type is (double precision)
523 data => sdp
524 class default
525 call neko_error('Invalid data type (r8 array)')
526 end select
527 end function stack_r8_data
528
530 function stack_i4t2_pop(this) result(data)
531 class(stack_i4t2_t), target, intent(inout) :: this
532 type(tuple_i4_t) :: data
533
534 select type (sdp => this%data)
535 type is (tuple_i4_t)
536 data = sdp(this%top_)
537 class default
538 call neko_error('Invalid data type (i4t2 pop)')
539 end select
540 this%top_ = this%top_ -1
541 end function stack_i4t2_pop
542
544 function stack_i4t2_data(this) result(data)
545 class(stack_i4t2_t), target, intent(inout) :: this
546 type(tuple_i4_t), contiguous, pointer :: data(:)
547
548 select type (sdp => this%data)
549 type is (tuple_i4_t)
550 data => sdp
551 class default
552 call neko_error('Invalid data type (i4t2 array)')
553 end select
554 end function stack_i4t2_data
555
557 function stack_i4t4_pop(this) result(data)
558 class(stack_i4t4_t), target, intent(inout) :: this
559 type(tuple4_i4_t) :: data
560
561 select type (sdp => this%data)
562 type is (tuple4_i4_t)
563 data = sdp(this%top_)
564 class default
565 call neko_error('Invalid data type (i4t4 pop)')
566 end select
567 this%top_ = this%top_ -1
568 end function stack_i4t4_pop
569
571 function stack_i4t4_data(this) result(data)
572 class(stack_i4t4_t), target, intent(inout) :: this
573 type(tuple4_i4_t), contiguous, pointer :: data(:)
574
575 select type (sdp => this%data)
576 type is (tuple4_i4_t)
577 data => sdp
578 class default
579 call neko_error('Invalid data type (i4t4 array)')
580 end select
581 end function stack_i4t4_data
582
584 function stack_i4r8t2_pop(this) result(data)
585 class(stack_i4r8t2_t), target, intent(inout) :: this
586 type(tuple_i4r8_t) :: data
587
588 select type (sdp => this%data)
589 type is (tuple_i4r8_t)
590 data = sdp(this%top_)
591 class default
592 call neko_error('Invalid data type (i4r8t2 pop)')
593 end select
594 this%top_ = this%top_ -1
595 end function stack_i4r8t2_pop
596
598 function stack_i4r8t2_data(this) result(data)
599 class(stack_i4r8t2_t), target, intent(inout) :: this
600 type(tuple_i4r8_t), contiguous, pointer :: data(:)
601
602 select type (sdp => this%data)
603 type is (tuple_i4r8_t)
604 data => sdp
605 class default
606 call neko_error('Invalid data type (i4r8t2 array)')
607 end select
608 end function stack_i4r8t2_data
609
611 function stack_2i4r8t3_pop(this) result(data)
612 class(stack_2i4r8t3_t), target, intent(inout) :: this
613 type(tuple_2i4r8_t) :: data
614
615 select type (sdp => this%data)
616 type is (tuple_2i4r8_t)
617 data = sdp(this%top_)
618 class default
619 call neko_error('Invalid data type (i4r8t2 pop)')
620 end select
621 this%top_ = this%top_ -1
622 end function stack_2i4r8t3_pop
623
625 function stack_2i4r8t3_data(this) result(data)
626 class(stack_2i4r8t3_t), target, intent(inout) :: this
627 type(tuple_2i4r8_t), contiguous, pointer :: data(:)
628
629 select type (sdp => this%data)
630 type is (tuple_2i4r8_t)
631 data => sdp
632 class default
633 call neko_error('Invalid data type (i4r8t2 array)')
634 end select
635 end function stack_2i4r8t3_data
636
638 function stack_curve_element_pop(this) result(data)
639 class(stack_curve_t), target, intent(inout) :: this
640 type(struct_curve_t) :: data
641
642 select type (sdp => this%data)
643 type is (struct_curve_t)
644 data = sdp(this%top_)
645 class default
646 call neko_error('Invalid data type (curve pop)')
647 end select
648 this%top_ = this%top_ -1
649 end function stack_curve_element_pop
650
652 function stack_curve_element_data(this) result(data)
653 class(stack_curve_t), target, intent(inout) :: this
654 type(struct_curve_t), contiguous, pointer :: data(:)
655
656 select type (sdp => this%data)
657 type is (struct_curve_t)
658 data => sdp
659 class default
660 call neko_error('Invalid data type (curve array)')
661 end select
662 end function stack_curve_element_data
663
665 function stack_nq_pop(this) result(data)
666 class(stack_nq_t), target, intent(inout) :: this
667 type(nmsh_quad_t) :: data
668
669 select type (sdp => this%data)
670 type is (nmsh_quad_t)
671 data = sdp(this%top_)
672 class default
673 call neko_error('Invalid data type (nq pop)')
674 end select
675 this%top_ = this%top_ -1
676 end function stack_nq_pop
677
679 function stack_nq_data(this) result(data)
680 class(stack_nq_t), target, intent(inout) :: this
681 type(nmsh_quad_t), contiguous, pointer :: data(:)
682
683 select type (sdp => this%data)
684 type is (nmsh_quad_t)
685 data => sdp
686 class default
687 call neko_error('Invalid data type (nq array)')
688 end select
689 end function stack_nq_data
690
692 function stack_nh_pop(this) result(data)
693 class(stack_nh_t), target, intent(inout) :: this
694 type(nmsh_hex_t) :: data
695
696 select type (sdp => this%data)
697 type is (nmsh_hex_t)
698 data = sdp(this%top_)
699 class default
700 call neko_error('Invalid data type (nh pop)')
701 end select
702 this%top_ = this%top_ -1
703 end function stack_nh_pop
704
706 function stack_nh_data(this) result(data)
707 class(stack_nh_t), target, intent(inout) :: this
708 type(nmsh_hex_t), contiguous, pointer :: data(:)
709
710 select type (sdp => this%data)
711 type is (nmsh_hex_t)
712 data => sdp
713 class default
714 call neko_error('Invalid data type (nh array)')
715 end select
716 end function stack_nh_data
717
719 function stack_nz_pop(this) result(data)
720 class(stack_nz_t), target, intent(inout) :: this
721 type(nmsh_zone_t) :: data
722
723 select type (sdp => this%data)
724 type is (nmsh_zone_t)
725 data = sdp(this%top_)
726 class default
727 call neko_error('Invalid data type (nz pop)')
728 end select
729 this%top_ = this%top_ -1
730 end function stack_nz_pop
731
733 function stack_nz_data(this) result(data)
734 class(stack_nz_t), target, intent(inout) :: this
735 type(nmsh_zone_t), contiguous, pointer :: data(:)
736
737 select type (sdp => this%data)
738 type is (nmsh_zone_t)
739 data => sdp
740 class default
741 call neko_error('Invalid data type (nz array)')
742 end select
743 end function stack_nz_data
744
746 function stack_nc_pop(this) result(data)
747 class(stack_nc_t), target, intent(inout) :: this
748 type(nmsh_curve_el_t) :: data
749
750 select type (sdp => this%data)
751 type is (nmsh_curve_el_t)
752 data = sdp(this%top_)
753 class default
754 call neko_error('Invalid data type (nc pop)')
755 end select
756 this%top_ = this%top_ -1
757 end function stack_nc_pop
758
760 function stack_nc_data(this) result(data)
761 class(stack_nc_t), target, intent(inout) :: this
762 type(nmsh_curve_el_t), pointer :: data(:)
763
764 select type (sdp => this%data)
765 type is (nmsh_curve_el_t)
766 data => sdp
767 class default
768 call neko_error('Invalid data type (nc array)')
769 end select
770 end function stack_nc_data
771
773 function stack_pt_pop(this) result(data)
774 class(stack_pt_t), target, intent(inout) :: this
775 type(point_t) :: data
776
777 select type (sdp => this%data)
778 type is (point_t)
779 data = sdp(this%top_)
780 class default
781 call neko_error('Invalid data type (point pop)')
782 end select
783 this%top_ = this%top_ -1
784 end function stack_pt_pop
785
787 function stack_pt_data(this) result(data)
788 class(stack_pt_t), target, intent(inout) :: this
789 type(point_t), contiguous, pointer :: data(:)
790
791 select type (sdp => this%data)
792 type is (point_t)
793 data => sdp
794 class default
795 call neko_error('Invalid data type (point array)')
796 end select
797 end function stack_pt_data
798
799end module stack
double real
Definition math.f90:60
real(kind=rp), parameter, public neko_m_ln2
Definition math.f90:72
Neko binary mesh format.
Definition nmsh.f90:2
integer, parameter, public i8
Definition num_types.f90:7
integer, parameter, public dp
Definition num_types.f90:9
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12
Implements a point.
Definition point.f90:35
Implements a dynamic stack ADT.
Definition stack.f90:49
type(struct_curve_t) function stack_curve_element_pop(this)
Pop a curve element of the stack.
Definition stack.f90:639
type(tuple_2i4r8_t) function, dimension(:), pointer, contiguous stack_2i4r8t3_data(this)
Return a pointer to the internal 2-tuple array.
Definition stack.f90:626
subroutine stack_free(this)
Destroy a stack.
Definition stack.f90:225
type(tuple_2i4r8_t) function stack_2i4r8t3_pop(this)
Pop a mixed integer-double precision 3-tuple of the stack.
Definition stack.f90:612
type(point_t) function stack_pt_pop(this)
Pop a point of the stack.
Definition stack.f90:774
subroutine stack_clear(this)
Clear all entries of a stack.
Definition stack.f90:237
type(nmsh_zone_t) function, dimension(:), pointer, contiguous stack_nz_data(this)
Return a pointer to the internal Neko zone array.
Definition stack.f90:734
type(nmsh_quad_t) function stack_nq_pop(this)
Pop a Neko quad element of the stack.
Definition stack.f90:666
type(tuple_i4_t) function, dimension(:), pointer, contiguous stack_i4t2_data(this)
Return a pointer to the interal 2-tuple array.
Definition stack.f90:545
type(tuple_i4_t) function stack_i4t2_pop(this)
Pop an integer 2-tuple of the stack.
Definition stack.f90:531
real(kind=dp) function, dimension(:), pointer, contiguous stack_r8_data(this)
Return a pointer to the internal double precision array.
Definition stack.f90:518
pure integer function stack_size(this)
Return number of entries in the stack.
Definition stack.f90:243
type(tuple4_i4_t) function, dimension(:), pointer, contiguous stack_i4t4_data(this)
Return a pointer to the internal 4-tuple array.
Definition stack.f90:572
pure logical function stack_is_empty(this)
Return true if the stack is empty.
Definition stack.f90:250
subroutine stack_push(this, data)
Push data onto the stack.
Definition stack.f90:257
integer function, dimension(:), pointer, contiguous stack_i4_data(this)
Return a pointer to the internal integer array.
Definition stack.f90:464
type(tuple4_i4_t) function stack_i4t4_pop(this)
Pop an integer 4-tuple of the stack.
Definition stack.f90:558
real(kind=dp) function stack_r8_pop(this)
Pop a double precision value of the stack.
Definition stack.f90:504
type(nmsh_zone_t) function stack_nz_pop(this)
Pop a Neko zone of the stack.
Definition stack.f90:720
type(nmsh_quad_t) function, dimension(:), pointer, contiguous stack_nq_data(this)
Return a pointer to the internal Neko quad array.
Definition stack.f90:680
subroutine stack_init(this, size)
Initialize a stack of arbitrary type.
Definition stack.f90:171
integer function stack_i4_pop(this)
Pop an integer of the stack.
Definition stack.f90:450
integer, parameter neko_stack_size_t
Definition stack.f90:60
integer(kind=i8) function, dimension(:), pointer, contiguous stack_i8_data(this)
Return a pointer to the internal integer*8 array.
Definition stack.f90:491
type(tuple_i4r8_t) function, dimension(:), pointer, contiguous stack_i4r8t2_data(this)
Return a pointer to the internal 2-tuple array.
Definition stack.f90:599
type(nmsh_hex_t) function stack_nh_pop(this)
Pop a Neko hex element of the stack.
Definition stack.f90:693
type(struct_curve_t) function, dimension(:), pointer, contiguous stack_curve_element_data(this)
Return a pointer to the internal curve element array.
Definition stack.f90:653
type(tuple_i4r8_t) function stack_i4r8t2_pop(this)
Pop a mixed integer-double precision 2-tuple of the stack.
Definition stack.f90:585
integer(kind=i8) function stack_i8_pop(this)
Pop an integer*8 of the stack.
Definition stack.f90:477
type(nmsh_curve_el_t) function stack_nc_pop(this)
Pop a Neko curve info of the stack.
Definition stack.f90:747
type(point_t) function, dimension(:), pointer, contiguous stack_pt_data(this)
Return a pointer to the internal point array.
Definition stack.f90:788
type(nmsh_hex_t) function, dimension(:), pointer, contiguous stack_nh_data(this)
Return a pointer to the internal Neko quad array.
Definition stack.f90:707
type(nmsh_curve_el_t) function, dimension(:), pointer stack_nc_data(this)
Return a pointer to the internal Neko curve info array.
Definition stack.f90:761
Defines structs that are used... Dont know if we should keep it though.
Definition structs.f90:2
Implements a n-tuple.
Definition tuple.f90:41
Utilities.
Definition utils.f90:35
subroutine, public neko_warning(warning_msg)
Reports a warning to standard output.
Definition utils.f90:346
Neko curve data.
Definition nmsh.f90:39
Neko hex element data.
Definition nmsh.f90:24
Neko quad element data.
Definition nmsh.f90:19
Neko zone data.
Definition nmsh.f90:29
A point in with coordinates .
Definition point.f90:43
Mixed integer-double precision 3-tuple based stack.
Definition stack.f90:119
Curved element stack.
Definition stack.f90:126
Integer based stack.
Definition stack.f90:77
Mixed integer-double precision 2-tuple based stack.
Definition stack.f90:112
Integer 2-tuple based stack.
Definition stack.f90:98
Integer 4-tuple based stack.
Definition stack.f90:105
Integer*8 based stack.
Definition stack.f90:84
Neko curve info based stack.
Definition stack.f90:154
Neko hex element based stack.
Definition stack.f90:140
Neko quad element based stack.
Definition stack.f90:133
Neko zone based stack.
Definition stack.f90:147
Point based stack.
Definition stack.f90:161
Double precision based stack.
Definition stack.f90:91
Base type for a stack.
Definition stack.f90:63
Integer based 4-tuple.
Definition tuple.f90:76
Mixed integer ( ) double precision ( ) 3-tuple.
Definition tuple.f90:104
Integer based 2-tuple.
Definition tuple.f90:58
Mixed integer ( ) double precision ( ) 2-tuple .
Definition tuple.f90:94