Neko 1.99.1
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!
35module stack
36 use num_types
37 use nmsh
38 use utils, only : neko_error, neko_warning
39 use point, only : point_t
40 use structs, only : struct_curve_t
41 use math, only : neko_m_ln2
43 implicit none
44 private
45
46 integer, parameter :: neko_stack_size_t = 32
47
49 type, abstract, private :: stack_t
50 class(*), allocatable :: data(:)
51 integer :: top_
52 integer :: size_
53 contains
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
58 procedure, non_overridable, pass(this) :: is_empty => stack_is_empty
59 procedure, non_overridable, pass(this) :: push => stack_push
60 end type stack_t
61
63 type, public, extends(stack_t) :: stack_i4_t
64 contains
65 procedure, public, pass(this) :: pop => stack_i4_pop
66 procedure, public, pass(this) :: array => stack_i4_data
67 end type stack_i4_t
68
70 type, public, extends(stack_t) :: stack_i8_t
71 contains
72 procedure, public, pass(this) :: pop => stack_i8_pop
73 procedure, public, pass(this) :: array => stack_i8_data
74 end type stack_i8_t
75
77 type, public, extends(stack_t) :: stack_r8_t
78 contains
79 procedure, public, pass(this) :: pop => stack_r8_pop
80 procedure, public, pass(this) :: array => stack_r8_data
81 end type stack_r8_t
82
84 type, public, extends(stack_t) :: stack_i4t2_t
85 contains
86 procedure, public, pass(this) :: pop => stack_i4t2_pop
87 procedure, public, pass(this) :: array => stack_i4t2_data
88 end type stack_i4t2_t
89
91 type, public, extends(stack_t) :: stack_i4t4_t
92 contains
93 procedure, public, pass(this) :: pop => stack_i4t4_pop
94 procedure, public, pass(this) :: array => stack_i4t4_data
95 end type stack_i4t4_t
96
98 type, public, extends(stack_t) :: stack_i4r8t2_t
99 contains
100 procedure, public, pass(this) :: pop => stack_i4r8t2_pop
101 procedure, public, pass(this) :: array => stack_i4r8t2_data
102 end type stack_i4r8t2_t
103
105 type, public, extends(stack_t) :: stack_2i4r8t3_t
106 contains
107 procedure, public, pass(this) :: pop => stack_2i4r8t3_pop
108 procedure, public, pass(this) :: array => stack_2i4r8t3_data
109 end type stack_2i4r8t3_t
110
112 type, public, extends(stack_t) :: stack_curve_t
113 contains
114 procedure, public, pass(this) :: pop => stack_curve_element_pop
115 procedure, public, pass(this) :: array => stack_curve_element_data
116 end type stack_curve_t
117
119 type, public, extends(stack_t) :: stack_nq_t
120 contains
121 procedure, public, pass(this) :: pop => stack_nq_pop
122 procedure, public, pass(this) :: array => stack_nq_data
123 end type stack_nq_t
124
126 type, public, extends(stack_t) :: stack_nh_t
127 contains
128 procedure, public, pass(this) :: pop => stack_nh_pop
129 procedure, public, pass(this) :: array => stack_nh_data
130 end type stack_nh_t
131
133 type, public, extends(stack_t) :: stack_nz_t
134 contains
135 procedure, public, pass(this) :: pop => stack_nz_pop
136 procedure, public, pass(this) :: array => stack_nz_data
137 end type stack_nz_t
138
140 type, public, extends(stack_t) :: stack_nc_t
141 contains
142 procedure, public, pass(this) :: pop => stack_nc_pop
143 procedure, public, pass(this) :: array => stack_nc_data
144 end type stack_nc_t
145
147 type, public, extends(stack_t) :: stack_pt_t
148 contains
149 procedure, public, pass(this) :: pop => stack_pt_pop
150 procedure, public, pass(this) :: array => stack_pt_data
151 end type stack_pt_t
152
153contains
154
156 subroutine stack_init(this, size)
157 class(stack_t), intent(inout) :: this
158 integer, optional :: size
159 integer :: size_t
160
161 call this%free()
162
163 if (present(size)) then
164 if (size .gt. 0) then
165 size_t = size
166 else
167 call neko_warning('Invalid stack size, using default')
168 size_t = neko_stack_size_t
169 end if
170 else
171 size_t = neko_stack_size_t
172 end if
173
174 this%size_ = ishft(1, ceiling(log(real(size_t, rp)) / neko_m_ln2))
175 this%top_ = 0
176 select type(this)
177 type is(stack_i4_t)
178 allocate(integer::this%data(this%size_))
179 type is(stack_i8_t)
180 allocate(integer(i8)::this%data(this%size_))
181 type is (stack_r8_t)
182 allocate(double precision::this%data(this%size_))
183 type is (stack_i4t2_t)
184 allocate(tuple_i4_t::this%data(this%size_))
185 type is (stack_i4t4_t)
186 allocate(tuple4_i4_t::this%data(this%size_))
187 type is (stack_i4r8t2_t)
188 allocate(tuple_i4r8_t::this%data(this%size_))
189 type is (stack_2i4r8t3_t)
190 allocate(tuple_2i4r8_t::this%data(this%size_))
191 type is (stack_curve_t)
192 allocate(struct_curve_t::this%data(this%size_))
193 type is (stack_nq_t)
194 allocate(nmsh_quad_t::this%data(this%size_))
195 type is (stack_nh_t)
196 allocate(nmsh_hex_t::this%data(this%size_))
197 type is (stack_nz_t)
198 allocate(nmsh_zone_t::this%data(this%size_))
199 type is (stack_nc_t)
200 allocate(nmsh_curve_el_t::this%data(this%size_))
201 type is (stack_pt_t)
202 allocate(point_t::this%data(this%size_))
203 class default
204 call neko_error('Invalid data type')
205 end select
206
207 end subroutine stack_init
208
210 subroutine stack_free(this)
211 class(stack_t), intent(inout) :: this
212
213 if (allocated(this%data)) then
214 deallocate(this%data)
215 this%size_ = 0
216 this%top_ = 0
217 end if
218
219 end subroutine stack_free
220
222 subroutine stack_clear(this)
223 class(stack_t), intent(inout) :: this
224 this%top_ = 0
225 end subroutine stack_clear
226
228 pure function stack_size(this) result(size)
229 class(stack_t), intent(in) :: this
230 integer :: size
231 size = this%top_
232 end function stack_size
233
235 pure function stack_is_empty(this) result(is_empty)
236 class(stack_t), intent(in) :: this
237 logical :: is_empty
238 is_empty = this%top_ .eq. 0
239 end function stack_is_empty
240
242 subroutine stack_push(this, data)
243 class(stack_t), target, intent(inout) :: this
244 class(*), intent(in) :: data
245 class(*), allocatable :: tmp(:)
246 integer :: i
247
248 if (this%top_ .eq. this%size_) then
249 this%size_ = ishft(this%size_, 1)
250 select type(data)
251 type is(integer)
252 allocate(integer::tmp(this%size_))
253 type is(integer(i8))
254 allocate(integer(i8)::tmp(this%size_))
255 type is(double precision)
256 allocate(double precision::tmp(this%size_))
257 type is(tuple_i4_t)
258 allocate(tuple_i4_t::tmp(this%size_))
259 type is(tuple4_i4_t)
260 allocate(tuple4_i4_t::tmp(this%size_))
261 type is(tuple_i4r8_t)
262 allocate(tuple_i4r8_t::tmp(this%size_))
263 type is(tuple_2i4r8_t)
264 allocate(tuple_2i4r8_t::tmp(this%size_))
265 type is(struct_curve_t)
266 allocate(struct_curve_t::tmp(this%size_))
267 type is (nmsh_quad_t)
268 allocate(nmsh_quad_t::tmp(this%size_))
269 type is (nmsh_hex_t)
270 allocate(nmsh_hex_t::tmp(this%size_))
271 type is (nmsh_zone_t)
272 allocate(nmsh_zone_t::tmp(this%size_))
273 type is (nmsh_curve_el_t)
274 allocate(nmsh_curve_el_t::tmp(this%size_))
275 type is (point_t)
276 allocate(point_t::tmp(this%size_))
277 class default
278 call neko_error('Invalid data type (stack_push)')
279 end select
280
281 select type(tmp)
282 type is (integer)
283 select type(sdp => this%data)
284 type is (integer)
285 tmp(1:this%top_) = sdp
286 end select
287 type is (integer(i8))
288 select type(sdp => this%data)
289 type is (integer(i8))
290 tmp(1:this%top_) = sdp
291 end select
292 type is (double precision)
293 select type(sdp => this%data)
294 type is (double precision)
295 tmp(1:this%top_) = sdp
296 end select
297 type is (tuple_i4_t)
298 select type(sdp => this%data)
299 type is (tuple_i4_t)
300 do i = 1, this%top_
301 tmp(i) = sdp(i)
302 end do
303 end select
304 type is (tuple4_i4_t)
305 select type(sdp => this%data)
306 type is (tuple4_i4_t)
307 do i = 1, this%top_
308 tmp(i) = sdp(i)
309 end do
310 end select
311 type is (tuple_i4r8_t)
312 select type(sdp => this%data)
313 type is (tuple_i4r8_t)
314 do i = 1, this%top_
315 tmp(i) = sdp(i)
316 end do
317 end select
318 type is (tuple_2i4r8_t)
319 select type(sdp => this%data)
320 type is (tuple_2i4r8_t)
321 do i = 1, this%top_
322 tmp(i) = sdp(i)
323 end do
324 end select
325 type is (struct_curve_t)
326 select type(sdp => this%data)
327 type is (struct_curve_t)
328 tmp(1:this%top_) = sdp
329 end select
330 type is (nmsh_quad_t)
331 select type(sdp => this%data)
332 type is(nmsh_quad_t)
333 tmp(1:this%top_) = sdp
334 end select
335 type is (nmsh_hex_t)
336 select type(sdp => this%data)
337 type is(nmsh_hex_t)
338 tmp(1:this%top_) = sdp
339 end select
340 type is (nmsh_zone_t)
341 select type(sdp => this%data)
342 type is(nmsh_zone_t)
343 tmp(1:this%top_) = sdp
344 end select
345 type is (nmsh_curve_el_t)
346 select type(sdp => this%data)
347 type is(nmsh_curve_el_t)
348 tmp(1:this%top_) = sdp
349 end select
350 type is (point_t)
351 select type(sdp => this%data)
352 type is(point_t)
353 tmp(1:this%top_) = sdp
354 end select
355 class default
356 call neko_error('Invalid data type (stack_push tmp)')
357 end select
358 call move_alloc(tmp, this%data)
359 end if
360
361 this%top_ = this%top_ + 1
362
363 select type(sdp => this%data)
364 type is (integer)
365 select type(data)
366 type is (integer)
367 sdp(this%top_) = data
368 end select
369 type is (integer(i8))
370 select type(data)
371 type is (integer(i8))
372 sdp(this%top_) = data
373 end select
374 type is (double precision)
375 select type(data)
376 type is (double precision)
377 sdp(this%top_) = data
378 end select
379 type is (tuple_i4_t)
380 select type(data)
381 type is (tuple_i4_t)
382 sdp(this%top_) = data
383 end select
384 type is (tuple4_i4_t)
385 select type(data)
386 type is (tuple4_i4_t)
387 sdp(this%top_) = data
388 end select
389 type is (tuple_i4r8_t)
390 select type(data)
391 type is (tuple_i4r8_t)
392 sdp(this%top_) = data
393 end select
394 type is (tuple_2i4r8_t)
395 select type(data)
396 type is (tuple_2i4r8_t)
397 sdp(this%top_) = data
398 end select
399 type is (struct_curve_t)
400 select type(data)
401 type is (struct_curve_t)
402 sdp(this%top_) = data
403 end select
404 type is (nmsh_quad_t)
405 select type(data)
406 type is (nmsh_quad_t)
407 sdp(this%top_) = data
408 end select
409 type is (nmsh_hex_t)
410 select type(data)
411 type is (nmsh_hex_t)
412 sdp(this%top_) = data
413 end select
414 type is (nmsh_zone_t)
415 select type(data)
416 type is (nmsh_zone_t)
417 sdp(this%top_) = data
418 end select
419 type is (nmsh_curve_el_t)
420 select type(data)
421 type is (nmsh_curve_el_t)
422 sdp(this%top_) = data
423 end select
424 type is (point_t)
425 select type(data)
426 type is (point_t)
427 sdp(this%top_) = data
428 end select
429 class default
430 call neko_error('Invalid data type in stack (stack_push)')
431 end select
432 end subroutine stack_push
433
435 function stack_i4_pop(this) result(data)
436 class(stack_i4_t), target, intent(inout) :: this
437 integer :: data
438
439 select type (sdp => this%data)
440 type is (integer)
441 data = sdp(this%top_)
442 class default
443 call neko_error('Invalid data type (i4 pop)')
444 end select
445 this%top_ = this%top_ - 1
446 end function stack_i4_pop
447
449 function stack_i4_data(this) result(data)
450 class(stack_i4_t), target, intent(inout) :: this
451 integer, contiguous, pointer :: data(:)
452
453 select type (sdp => this%data)
454 type is (integer)
455 data => sdp
456 class default
457 call neko_error('Invalid data type (i4 array)')
458 end select
459 end function stack_i4_data
460
462 function stack_i8_pop(this) result(data)
463 class(stack_i8_t), target, intent(inout) :: this
464 integer(kind=i8) :: data
465
466 select type (sdp => this%data)
467 type is (integer(i8))
468 data = sdp(this%top_)
469 class default
470 call neko_error('Invalid data type (i8 pop)')
471 end select
472 this%top_ = this%top_ - 1
473 end function stack_i8_pop
474
476 function stack_i8_data(this) result(data)
477 class(stack_i8_t), target, intent(inout) :: this
478 integer(kind=i8), contiguous, pointer :: data(:)
479
480 select type (sdp => this%data)
481 type is (integer(i8))
482 data => sdp
483 class default
484 call neko_error('Invalid data type (i8 array)')
485 end select
486 end function stack_i8_data
487
489 function stack_r8_pop(this) result(data)
490 class(stack_r8_t), target, intent(inout) :: this
491 real(kind=dp) :: data
492
493 select type (sdp => this%data)
494 type is (double precision)
495 data = sdp(this%top_)
496 class default
497 call neko_error('Invalid data type (r8 pop)')
498 end select
499 this%top_ = this%top_ -1
500 end function stack_r8_pop
501
503 function stack_r8_data(this) result(data)
504 class(stack_r8_t), target, intent(inout) :: this
505 real(kind=dp), contiguous, pointer :: data(:)
506
507 select type (sdp => this%data)
508 type is (double precision)
509 data => sdp
510 class default
511 call neko_error('Invalid data type (r8 array)')
512 end select
513 end function stack_r8_data
514
516 function stack_i4t2_pop(this) result(data)
517 class(stack_i4t2_t), target, intent(inout) :: this
518 type(tuple_i4_t) :: data
519
520 select type (sdp => this%data)
521 type is (tuple_i4_t)
522 data = sdp(this%top_)
523 class default
524 call neko_error('Invalid data type (i4t2 pop)')
525 end select
526 this%top_ = this%top_ -1
527 end function stack_i4t2_pop
528
530 function stack_i4t2_data(this) result(data)
531 class(stack_i4t2_t), target, intent(inout) :: this
532 type(tuple_i4_t), contiguous, pointer :: data(:)
533
534 select type (sdp => this%data)
535 type is (tuple_i4_t)
536 data => sdp
537 class default
538 call neko_error('Invalid data type (i4t2 array)')
539 end select
540 end function stack_i4t2_data
541
543 function stack_i4t4_pop(this) result(data)
544 class(stack_i4t4_t), target, intent(inout) :: this
545 type(tuple4_i4_t) :: data
546
547 select type (sdp => this%data)
548 type is (tuple4_i4_t)
549 data = sdp(this%top_)
550 class default
551 call neko_error('Invalid data type (i4t4 pop)')
552 end select
553 this%top_ = this%top_ -1
554 end function stack_i4t4_pop
555
557 function stack_i4t4_data(this) result(data)
558 class(stack_i4t4_t), target, intent(inout) :: this
559 type(tuple4_i4_t), contiguous, pointer :: data(:)
560
561 select type (sdp => this%data)
562 type is (tuple4_i4_t)
563 data => sdp
564 class default
565 call neko_error('Invalid data type (i4t4 array)')
566 end select
567 end function stack_i4t4_data
568
570 function stack_i4r8t2_pop(this) result(data)
571 class(stack_i4r8t2_t), target, intent(inout) :: this
572 type(tuple_i4r8_t) :: data
573
574 select type (sdp => this%data)
575 type is (tuple_i4r8_t)
576 data = sdp(this%top_)
577 class default
578 call neko_error('Invalid data type (i4r8t2 pop)')
579 end select
580 this%top_ = this%top_ -1
581 end function stack_i4r8t2_pop
582
584 function stack_i4r8t2_data(this) result(data)
585 class(stack_i4r8t2_t), target, intent(inout) :: this
586 type(tuple_i4r8_t), contiguous, pointer :: data(:)
587
588 select type (sdp => this%data)
589 type is (tuple_i4r8_t)
590 data => sdp
591 class default
592 call neko_error('Invalid data type (i4r8t2 array)')
593 end select
594 end function stack_i4r8t2_data
595
597 function stack_2i4r8t3_pop(this) result(data)
598 class(stack_2i4r8t3_t), target, intent(inout) :: this
599 type(tuple_2i4r8_t) :: data
600
601 select type (sdp => this%data)
602 type is (tuple_2i4r8_t)
603 data = sdp(this%top_)
604 class default
605 call neko_error('Invalid data type (i4r8t2 pop)')
606 end select
607 this%top_ = this%top_ -1
608 end function stack_2i4r8t3_pop
609
611 function stack_2i4r8t3_data(this) result(data)
612 class(stack_2i4r8t3_t), target, intent(inout) :: this
613 type(tuple_2i4r8_t), contiguous, pointer :: data(:)
614
615 select type (sdp => this%data)
616 type is (tuple_2i4r8_t)
617 data => sdp
618 class default
619 call neko_error('Invalid data type (i4r8t2 array)')
620 end select
621 end function stack_2i4r8t3_data
622
624 function stack_curve_element_pop(this) result(data)
625 class(stack_curve_t), target, intent(inout) :: this
626 type(struct_curve_t) :: data
627
628 select type (sdp => this%data)
629 type is (struct_curve_t)
630 data = sdp(this%top_)
631 class default
632 call neko_error('Invalid data type (curve pop)')
633 end select
634 this%top_ = this%top_ -1
635 end function stack_curve_element_pop
636
638 function stack_curve_element_data(this) result(data)
639 class(stack_curve_t), target, intent(inout) :: this
640 type(struct_curve_t), contiguous, pointer :: data(:)
641
642 select type (sdp => this%data)
643 type is (struct_curve_t)
644 data => sdp
645 class default
646 call neko_error('Invalid data type (curve array)')
647 end select
648 end function stack_curve_element_data
649
651 function stack_nq_pop(this) result(data)
652 class(stack_nq_t), target, intent(inout) :: this
653 type(nmsh_quad_t) :: data
654
655 select type (sdp => this%data)
656 type is (nmsh_quad_t)
657 data = sdp(this%top_)
658 class default
659 call neko_error('Invalid data type (nq pop)')
660 end select
661 this%top_ = this%top_ -1
662 end function stack_nq_pop
663
665 function stack_nq_data(this) result(data)
666 class(stack_nq_t), target, intent(inout) :: this
667 type(nmsh_quad_t), contiguous, pointer :: data(:)
668
669 select type (sdp => this%data)
670 type is (nmsh_quad_t)
671 data => sdp
672 class default
673 call neko_error('Invalid data type (nq array)')
674 end select
675 end function stack_nq_data
676
678 function stack_nh_pop(this) result(data)
679 class(stack_nh_t), target, intent(inout) :: this
680 type(nmsh_hex_t) :: data
681
682 select type (sdp => this%data)
683 type is (nmsh_hex_t)
684 data = sdp(this%top_)
685 class default
686 call neko_error('Invalid data type (nh pop)')
687 end select
688 this%top_ = this%top_ -1
689 end function stack_nh_pop
690
692 function stack_nh_data(this) result(data)
693 class(stack_nh_t), target, intent(inout) :: this
694 type(nmsh_hex_t), contiguous, pointer :: data(:)
695
696 select type (sdp => this%data)
697 type is (nmsh_hex_t)
698 data => sdp
699 class default
700 call neko_error('Invalid data type (nh array)')
701 end select
702 end function stack_nh_data
703
705 function stack_nz_pop(this) result(data)
706 class(stack_nz_t), target, intent(inout) :: this
707 type(nmsh_zone_t) :: data
708
709 select type (sdp => this%data)
710 type is (nmsh_zone_t)
711 data = sdp(this%top_)
712 class default
713 call neko_error('Invalid data type (nz pop)')
714 end select
715 this%top_ = this%top_ -1
716 end function stack_nz_pop
717
719 function stack_nz_data(this) result(data)
720 class(stack_nz_t), target, intent(inout) :: this
721 type(nmsh_zone_t), contiguous, pointer :: data(:)
722
723 select type (sdp => this%data)
724 type is (nmsh_zone_t)
725 data => sdp
726 class default
727 call neko_error('Invalid data type (nz array)')
728 end select
729 end function stack_nz_data
730
732 function stack_nc_pop(this) result(data)
733 class(stack_nc_t), target, intent(inout) :: this
734 type(nmsh_curve_el_t) :: data
735
736 select type (sdp => this%data)
737 type is (nmsh_curve_el_t)
738 data = sdp(this%top_)
739 class default
740 call neko_error('Invalid data type (nc pop)')
741 end select
742 this%top_ = this%top_ -1
743 end function stack_nc_pop
744
746 function stack_nc_data(this) result(data)
747 class(stack_nc_t), target, intent(inout) :: this
748 type(nmsh_curve_el_t), pointer :: data(:)
749
750 select type (sdp => this%data)
751 type is (nmsh_curve_el_t)
752 data => sdp
753 class default
754 call neko_error('Invalid data type (nc array)')
755 end select
756 end function stack_nc_data
757
759 function stack_pt_pop(this) result(data)
760 class(stack_pt_t), target, intent(inout) :: this
761 type(point_t) :: data
762
763 select type (sdp => this%data)
764 type is (point_t)
765 data = sdp(this%top_)
766 class default
767 call neko_error('Invalid data type (point pop)')
768 end select
769 this%top_ = this%top_ -1
770 end function stack_pt_pop
771
773 function stack_pt_data(this) result(data)
774 class(stack_pt_t), target, intent(inout) :: this
775 type(point_t), contiguous, pointer :: data(:)
776
777 select type (sdp => this%data)
778 type is (point_t)
779 data => sdp
780 class default
781 call neko_error('Invalid data type (point array)')
782 end select
783 end function stack_pt_data
784
785end 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:35
type(struct_curve_t) function stack_curve_element_pop(this)
Pop a curve element of the stack.
Definition stack.f90:625
type(tuple_2i4r8_t) function, dimension(:), pointer, contiguous stack_2i4r8t3_data(this)
Return a pointer to the internal 2-tuple array.
Definition stack.f90:612
subroutine stack_free(this)
Destroy a stack.
Definition stack.f90:211
type(tuple_2i4r8_t) function stack_2i4r8t3_pop(this)
Pop a mixed integer-double precision 3-tuple of the stack.
Definition stack.f90:598
type(point_t) function stack_pt_pop(this)
Pop a point of the stack.
Definition stack.f90:760
subroutine stack_clear(this)
Clear all entries of a stack.
Definition stack.f90:223
type(nmsh_zone_t) function, dimension(:), pointer, contiguous stack_nz_data(this)
Return a pointer to the internal Neko zone array.
Definition stack.f90:720
type(nmsh_quad_t) function stack_nq_pop(this)
Pop a Neko quad element of the stack.
Definition stack.f90:652
type(tuple_i4_t) function, dimension(:), pointer, contiguous stack_i4t2_data(this)
Return a pointer to the interal 2-tuple array.
Definition stack.f90:531
type(tuple_i4_t) function stack_i4t2_pop(this)
Pop an integer 2-tuple of the stack.
Definition stack.f90:517
real(kind=dp) function, dimension(:), pointer, contiguous stack_r8_data(this)
Return a pointer to the internal double precision array.
Definition stack.f90:504
pure integer function stack_size(this)
Return number of entries in the stack.
Definition stack.f90:229
type(tuple4_i4_t) function, dimension(:), pointer, contiguous stack_i4t4_data(this)
Return a pointer to the internal 4-tuple array.
Definition stack.f90:558
pure logical function stack_is_empty(this)
Return true if the stack is empty.
Definition stack.f90:236
subroutine stack_push(this, data)
Push data onto the stack.
Definition stack.f90:243
integer function, dimension(:), pointer, contiguous stack_i4_data(this)
Return a pointer to the internal integer array.
Definition stack.f90:450
type(tuple4_i4_t) function stack_i4t4_pop(this)
Pop an integer 4-tuple of the stack.
Definition stack.f90:544
real(kind=dp) function stack_r8_pop(this)
Pop a double precision value of the stack.
Definition stack.f90:490
type(nmsh_zone_t) function stack_nz_pop(this)
Pop a Neko zone of the stack.
Definition stack.f90:706
type(nmsh_quad_t) function, dimension(:), pointer, contiguous stack_nq_data(this)
Return a pointer to the internal Neko quad array.
Definition stack.f90:666
subroutine stack_init(this, size)
Initialize a stack of arbitrary type.
Definition stack.f90:157
integer function stack_i4_pop(this)
Pop an integer of the stack.
Definition stack.f90:436
integer, parameter neko_stack_size_t
Definition stack.f90:46
integer(kind=i8) function, dimension(:), pointer, contiguous stack_i8_data(this)
Return a pointer to the internal integer*8 array.
Definition stack.f90:477
type(tuple_i4r8_t) function, dimension(:), pointer, contiguous stack_i4r8t2_data(this)
Return a pointer to the internal 2-tuple array.
Definition stack.f90:585
type(nmsh_hex_t) function stack_nh_pop(this)
Pop a Neko hex element of the stack.
Definition stack.f90:679
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:639
type(tuple_i4r8_t) function stack_i4r8t2_pop(this)
Pop a mixed integer-double precision 2-tuple of the stack.
Definition stack.f90:571
integer(kind=i8) function stack_i8_pop(this)
Pop an integer*8 of the stack.
Definition stack.f90:463
type(nmsh_curve_el_t) function stack_nc_pop(this)
Pop a Neko curve info of the stack.
Definition stack.f90:733
type(point_t) function, dimension(:), pointer, contiguous stack_pt_data(this)
Return a pointer to the internal point array.
Definition stack.f90:774
type(nmsh_hex_t) function, dimension(:), pointer, contiguous stack_nh_data(this)
Return a pointer to the internal Neko quad array.
Definition stack.f90:693
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:747
Defines structs that are used... Dont know if we should keep it though.
Definition structs.f90:2
Implements a n-tuple.
Definition tuple.f90:34
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:105
Curved element stack.
Definition stack.f90:112
Integer based stack.
Definition stack.f90:63
Mixed integer-double precision 2-tuple based stack.
Definition stack.f90:98
Integer 2-tuple based stack.
Definition stack.f90:84
Integer 4-tuple based stack.
Definition stack.f90:91
Integer*8 based stack.
Definition stack.f90:70
Neko curve info based stack.
Definition stack.f90:140
Neko hex element based stack.
Definition stack.f90:126
Neko quad element based stack.
Definition stack.f90:119
Neko zone based stack.
Definition stack.f90:133
Point based stack.
Definition stack.f90:147
Double precision based stack.
Definition stack.f90:77
Base type for a stack.
Definition stack.f90:49
Integer based 4-tuple.
Definition tuple.f90:69
Mixed integer ( ) double precision ( ) 3-tuple.
Definition tuple.f90:97
Integer based 2-tuple.
Definition tuple.f90:51
Mixed integer ( ) double precision ( ) 2-tuple .
Definition tuple.f90:87