Neko 1.99.1
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
buffer.F90
Go to the documentation of this file.
1! Copyright (c) 2024, Gregor Weiss (HLRS)
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!
34module buffer
35 use num_types, only : rp
36 use vector, only : vector_t
37#ifdef HAVE_ADIOS2_FORTRAN
38 use adios2
39#endif
40 implicit none
41
42 type, abstract :: buffer_t
43 logical :: dp_precision = .false.
44 contains
45 procedure :: init => buffer_init
46 procedure :: fill => buffer_fill
47#ifdef HAVE_ADIOS2_FORTRAN
48 procedure :: define => buffer_define
49 procedure :: inquire => buffer_inquire
50 procedure :: write => buffer_write
51 procedure :: read => buffer_read
52#endif
53 procedure :: copy => buffer_copy
54 procedure :: set_precision => buffer_set_precision
55 end type buffer_t
56
57contains
58
59 subroutine buffer_init(this, precision, gdim, glb_nelv, offset_el, nelv, &
60 lx, ly, lz)
61 class(buffer_t), intent(inout) :: this
62 logical, intent(in) :: precision
63 integer, intent(in) :: gdim, glb_nelv, offset_el, nelv, lx, ly, lz
64 end subroutine buffer_init
65
66 subroutine buffer_fill(this, x, n)
67 class(buffer_t), intent(inout) :: this
68 integer, intent(inout) :: n
69 real(kind=rp), intent(inout) :: x(n)
70 end subroutine buffer_fill
71
72#ifdef HAVE_ADIOS2_FORTRAN
73
74 subroutine buffer_define(this, variable, io, variable_name, ierr)
75 class(buffer_t), intent(inout) :: this
76 type(adios2_variable), intent(inout) :: variable
77 type(adios2_io), intent(inout) :: io
78 character(len=*), intent(in) :: variable_name
79 integer, intent(inout) :: ierr
80 end subroutine buffer_define
81
82 subroutine buffer_inquire(this, variable, io, variable_name, ierr)
83 class(buffer_t), intent(inout) :: this
84 type(adios2_variable), intent(inout) :: variable
85 type(adios2_io), intent(inout) :: io
86 character(len=*), intent(in) :: variable_name
87 integer, intent(inout) :: ierr
88 end subroutine buffer_inquire
89
90 subroutine buffer_write(this, engine, variable, ierr)
91 class(buffer_t), intent(inout) :: this
92 type(adios2_engine), intent(in) :: engine
93 type(adios2_variable), intent(in) :: variable
94 integer, intent(inout) :: ierr
95 end subroutine buffer_write
96
97 subroutine buffer_read(this, engine, variable, ierr)
98 class(buffer_t), intent(inout) :: this
99 type(adios2_engine), intent(in) :: engine
100 type(adios2_variable), intent(in) :: variable
101 integer, intent(inout) :: ierr
102 end subroutine buffer_read
103
104#endif
105
106 subroutine buffer_copy(this, x)
107 class(buffer_t), intent(inout) :: this
108 type(vector_t), intent(inout) :: x
109 end subroutine buffer_copy
110
111 subroutine buffer_set_precision(this, precision)
112 class(buffer_t) :: this
113 logical, intent(in) :: precision
114
115
116 this%dp_precision = precision
117
118 end subroutine buffer_set_precision
119
120end module buffer
Generic buffer that is extended with buffers of varying rank.
Definition buffer.F90:34
subroutine buffer_fill(this, x, n)
Definition buffer.F90:67
subroutine buffer_copy(this, x)
Definition buffer.F90:107
subroutine buffer_init(this, precision, gdim, glb_nelv, offset_el, nelv, lx, ly, lz)
Definition buffer.F90:61
subroutine buffer_set_precision(this, precision)
Definition buffer.F90:112
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12
Defines a vector.
Definition vector.f90:34