Neko  0.9.99
A portable framework for high-order spectral element flow simulations
distdata.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 !
34 module distdata
35  use stack, only : stack_i4t2_t
36  use tuple, only : tuple_i4_t
37  use uset, only : uset_i4_t
38  implicit none
39  private
40 
41  type, public :: distdata_t
42  type(stack_i4t2_t) :: shared_el_facet
43 
44  type(uset_i4_t) :: shared_facet
45  type(uset_i4_t) :: shared_edge
46  type(uset_i4_t) :: shared_point
47 
48  integer, allocatable :: local_to_global_facet(:)
49  integer, allocatable :: local_to_global_edge(:)
50 
51  end type distdata_t
52 
57 
58 contains
59 
61  subroutine distdata_init(ddata)
62  type(distdata_t), intent(inout) :: ddata
63 
64  call distdata_free(ddata)
65 
66  call ddata%shared_el_facet%init()
67 
68  call ddata%shared_facet%init()
69  call ddata%shared_edge%init()
70  call ddata%shared_point%init()
71 
72  end subroutine distdata_init
73 
75  subroutine distdata_free(ddata)
76  type(distdata_t), intent(inout) :: ddata
77 
78  call ddata%shared_el_facet%free()
79 
80  call ddata%shared_facet%free()
81  call ddata%shared_edge%free()
82  call ddata%shared_point%free()
83 
84  if (allocated(ddata%local_to_global_facet)) then
85  deallocate(ddata%local_to_global_facet)
86  end if
87 
88  if (allocated(ddata%local_to_global_edge)) then
89  deallocate(ddata%local_to_global_edge)
90  end if
91 
92  end subroutine distdata_free
93 
95  subroutine distdata_set_shared_el_facet(ddata, element, side)
96  type(distdata_t), intent(inout) :: ddata
97  integer, intent(in), value :: element
98  integer, intent(in), value :: side
99  type(tuple_i4_t) :: t
100 
101  t%x = (/ element, side /)
102  call ddata%shared_el_facet%push(t)
103 
104  end subroutine distdata_set_shared_el_facet
105 
107  subroutine distdata_set_shared_facet(ddata, facet)
108  type(distdata_t), intent(inout) :: ddata
109  integer, value :: facet
110 
111  call ddata%shared_facet%add(facet)
112 
113  end subroutine distdata_set_shared_facet
114 
117  subroutine distdata_set_shared_edge(ddata, edge)
118  type(distdata_t), intent(inout) :: ddata
119  integer, value :: edge
120 
121  call ddata%shared_edge%add(edge)
122 
123  end subroutine distdata_set_shared_edge
124 
126  subroutine distdata_set_shared_point(ddata, point)
127  type(distdata_t), intent(inout) :: ddata
128  integer, value :: point
129 
130  call ddata%shared_point%add(point)
131 
132  end subroutine distdata_set_shared_point
133 
135  subroutine distdata_set_local_to_global_facet(ddata, local, global)
136  type(distdata_t), intent(inout) :: ddata
137  integer, intent(in), value :: local
138  integer, intent(in), value :: global
139 
140  ddata%local_to_global_facet(local) = global
141 
143 
145  subroutine distdata_set_local_to_global_edge(ddata, local, global)
146  type(distdata_t), intent(inout) :: ddata
147  integer, intent(in) , value :: local
148  integer, intent(in) , value :: global
149 
150  ddata%local_to_global_edge(local) = global
151 
152  end subroutine distdata_set_local_to_global_edge
153 
154 end module distdata
Distributed mesh data.
Definition: distdata.f90:34
subroutine, public distdata_set_shared_point(ddata, point)
Mark a point as shared.
Definition: distdata.f90:127
subroutine, public distdata_set_shared_el_facet(ddata, element, side)
Mark an element's facet as shared.
Definition: distdata.f90:96
subroutine, public distdata_set_local_to_global_facet(ddata, local, global)
Set local to global mapping (facets)
Definition: distdata.f90:136
subroutine, public distdata_free(ddata)
Free a distdata type.
Definition: distdata.f90:76
subroutine, public distdata_set_local_to_global_edge(ddata, local, global)
Set local to global mapping (edges)
Definition: distdata.f90:146
subroutine, public distdata_init(ddata)
Initialise a distdata type.
Definition: distdata.f90:62
subroutine, public distdata_set_shared_facet(ddata, facet)
Mark a facet as shared.
Definition: distdata.f90:108
subroutine, public distdata_set_shared_edge(ddata, edge)
Mark an element's edge as shared.
Definition: distdata.f90:118
Implements a point.
Definition: point.f90:35
Implements a dynamic stack ADT.
Definition: stack.f90:35
Implements a n-tuple.
Definition: tuple.f90:34
Implements an unordered set ADT.
Definition: uset.f90:35
Integer 2-tuple based stack.
Definition: stack.f90:84
Integer based 2-tuple.
Definition: tuple.f90:51
Integer based unordered set.
Definition: uset.f90:57