Neko 1.99.11
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
distdata.f90
Go to the documentation of this file.
1! Copyright (c) 2020-2025, 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!
33!> Distributed mesh data
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 !> Elemenets with shared facets
43 type(stack_i4t2_t) :: shared_el_facet
44 !> List of shared facets
45 type(uset_i4_t) :: shared_facet
46 !> List of shared edges
47 type(uset_i4_t) :: shared_edge
48 !> List of shared points
49 type(uset_i4_t) :: shared_point
50 !> Local to global (facets)
51 integer, allocatable :: local_to_global_facet(:)
52 !> Local to global (edges)
53 integer, allocatable :: local_to_global_edge(:)
54
55 contains
56 procedure, pass(this) :: init => distdata_init
57 procedure, pass(this) :: free => distdata_free
58 procedure, pass(this) :: set_shared_el_facet => &
60 procedure, pass(this) :: set_shared_facet => distdata_set_shared_facet
61 procedure, pass(this) :: set_shared_edge => distdata_set_shared_edge
62 procedure, pass(this) :: set_shared_point => distdata_set_shared_point
63 procedure, pass(this) :: set_local_to_global_facet => &
65 procedure, pass(this) :: set_local_to_global_edge => &
67
68 end type distdata_t
69
70contains
71
72 !> Initialise a distdata type
73 subroutine distdata_init(this)
74 class(distdata_t), intent(inout) :: this
75
76 call distdata_free(this)
77
78 call this%shared_el_facet%init()
79
80 call this%shared_facet%init()
81 call this%shared_edge%init()
82 call this%shared_point%init()
83
84 end subroutine distdata_init
85
86 !> Free a distdata type
87 subroutine distdata_free(this)
88 class(distdata_t), intent(inout) :: this
89
90 call this%shared_el_facet%free()
91
92 call this%shared_facet%free()
93 call this%shared_edge%free()
94 call this%shared_point%free()
95
96 if (allocated(this%local_to_global_facet)) then
97 deallocate(this%local_to_global_facet)
98 end if
99
100 if (allocated(this%local_to_global_edge)) then
101 deallocate(this%local_to_global_edge)
102 end if
103
104 end subroutine distdata_free
105
106 !> Mark an element's facet as shared
107 subroutine distdata_set_shared_el_facet(this, element, side)
108 class(distdata_t), intent(inout) :: this
109 integer, intent(in), value :: element !< Element index (local numbering)
110 integer, intent(in), value :: side !< Facet index
111 type(tuple_i4_t) :: t
112
113 t%x = [element, side]
114 call this%shared_el_facet%push(t)
115
116 end subroutine distdata_set_shared_el_facet
117
118 !> Mark a facet as shared
119 subroutine distdata_set_shared_facet(this, facet)
120 class(distdata_t), intent(inout) :: this
121 integer, value :: facet !< Facet index (local numbering)
122
123 call this%shared_facet%add(facet)
124
125 end subroutine distdata_set_shared_facet
126
127 !> Mark an element's edge as shared
128 !! @attention only defined for elements where facet .ne. edges
129 subroutine distdata_set_shared_edge(this, edge)
130 class(distdata_t), intent(inout) :: this
131 integer, value :: edge !< Edge index (local numbering)
132
133 call this%shared_edge%add(edge)
134
135 end subroutine distdata_set_shared_edge
136
137 !> Mark a point as shared
138 subroutine distdata_set_shared_point(this, point)
139 class(distdata_t), intent(inout) :: this
140 integer, value :: point !< Point index (local numbering)
141
142 call this%shared_point%add(point)
143
144 end subroutine distdata_set_shared_point
145
146 !> Set local to global mapping (facets)
147 subroutine distdata_set_local_to_global_facet(this, local, global)
148 class(distdata_t), intent(inout) :: this
149 integer, intent(in), value :: local !< Local facet index
150 integer, intent(in), value :: global !< Global facet index
151
152 this%local_to_global_facet(local) = global
153
155
156 !> Set local to global mapping (edges)
157 subroutine distdata_set_local_to_global_edge(this, local, global)
158 class(distdata_t), intent(inout) :: this
159 integer, intent(in) , value :: local !< Local edge index
160 integer, intent(in) , value :: global !< Global edge index
161
162 this%local_to_global_edge(local) = global
163
165
166end module distdata
Distributed mesh data.
Definition distdata.f90:34
subroutine distdata_set_shared_el_facet(this, element, side)
Mark an element's facet as shared.
Definition distdata.f90:108
subroutine distdata_set_shared_edge(this, edge)
Mark an element's edge as shared.
Definition distdata.f90:130
subroutine distdata_init(this)
Initialise a distdata type.
Definition distdata.f90:74
subroutine distdata_set_local_to_global_edge(this, local, global)
Set local to global mapping (edges).
Definition distdata.f90:158
subroutine distdata_set_shared_facet(this, facet)
Mark a facet as shared.
Definition distdata.f90:120
subroutine distdata_free(this)
Free a distdata type.
Definition distdata.f90:88
subroutine distdata_set_shared_point(this, point)
Mark a point as shared.
Definition distdata.f90:139
subroutine distdata_set_local_to_global_facet(this, local, global)
Set local to global mapping (facets).
Definition distdata.f90:148
Implements a point.
Definition point.f90:35
Implements a dynamic stack ADT.
Definition stack.f90:49
Implements a n-tuple.
Definition tuple.f90:41
Implements an unordered set ADT.
Definition uset.f90:39
Integer 2-tuple based stack.
Definition stack.f90:98
Integer based 2-tuple.
Definition tuple.f90:58
Integer based unordered set.
Definition uset.f90:61