Neko 1.99.2
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
output.f90
Go to the documentation of this file.
1! Copyright (c) 2020-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!
34module output
35 use num_types, only : rp
36 use file, only : file_t
37 implicit none
38 private
39
41 type, public, abstract :: output_t
42 type(file_t) :: file_
43 contains
44 procedure, pass(this) :: init_base => output_init_base
45 procedure, pass(this) :: free_base => output_free_base
46 procedure, pass(this) :: set_counter => output_set_counter
47 procedure, pass(this) :: set_start_counter => output_set_start_counter
48 procedure(output_sample), pass(this), deferred :: sample
49 procedure(output_free), pass(this), deferred :: free
50 end type output_t
51
53 type, public :: output_ptr_t
54 class(output_t), pointer :: ptr => null()
55 end type output_ptr_t
56
58 abstract interface
59 subroutine output_sample(this, t)
60 import :: output_t
61 import rp
62 class(output_t), intent(inout) :: this
63 real(kind=rp), intent(in) :: t
64 end subroutine output_sample
65
66 subroutine output_free(this)
67 import :: output_t
68 class(output_t), intent(inout) :: this
69 end subroutine output_free
70 end interface
71
72contains
73
77 subroutine output_init_base(this, fname, precision, layout, overwrite)
78 class(output_t), intent(inout) :: this
79 character(len=*), intent(inout) :: fname
80 integer, intent(in), optional :: precision
81 integer, intent(in), optional :: layout
82 logical, intent(in), optional :: overwrite
83
84 call this%file_%init(fname, precision = precision, layout = layout, &
85 overwrite = overwrite)
86
87 end subroutine output_init_base
88
90 subroutine output_set_counter(this, n)
91 class(output_t), intent(inout) :: this
92 integer, intent(in) :: n
93 call this%file_%set_counter(n)
94 end subroutine output_set_counter
95
97 subroutine output_set_start_counter(this, n)
98 class(output_t), intent(inout) :: this
99 integer, intent(in) :: n
100 call this%file_%set_start_counter(n)
101 end subroutine output_set_start_counter
102
104 subroutine output_free_base(this)
105 class(output_t), intent(inout) :: this
106 call this%file_%free()
107 end subroutine output_free_base
108
109end module output
Abstract interface for sampling an output type at time t.
Definition output.f90:59
Module for file I/O operations.
Definition file.f90:34
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12
Defines an output.
Definition output.f90:34
subroutine output_set_start_counter(this, n)
Update the start of output's file counter.
Definition output.f90:98
subroutine output_set_counter(this, n)
Update the output's file counter.
Definition output.f90:91
subroutine output_init_base(this, fname, precision, layout, overwrite)
Output constructor.
Definition output.f90:78
subroutine output_free_base(this)
Free the output.
Definition output.f90:105
A wrapper around a polymorphic generic_file_t that handles its init. This is essentially a factory fo...
Definition file.f90:55
Wrapper around an output_t pointer.
Definition output.f90:53
Abstract type defining an output type.
Definition output.f90:41