Cabana 0.8.0-dev
 
Loading...
Searching...
No Matches
Cabana_Grid_Types.hpp
Go to the documentation of this file.
1/****************************************************************************
2 * Copyright (c) 2018-2023 by the Cabana authors *
3 * All rights reserved. *
4 * *
5 * This file is part of the Cabana library. Cabana is distributed under a *
6 * BSD 3-clause license. For the licensing terms see the LICENSE file in *
7 * the top-level directory. *
8 * *
9 * SPDX-License-Identifier: BSD-3-Clause *
10 ****************************************************************************/
11
16#ifndef CABANA_GRID_TYPES_HPP
17#define CABANA_GRID_TYPES_HPP
18
19#include <type_traits>
20
21namespace Cabana
22{
23namespace Grid
24{
25
26//---------------------------------------------------------------------------//
30struct Dim
31{
33 enum Values
34 {
35 I = 0,
36 J = 1,
37 K = 2
38 };
39};
40
41//---------------------------------------------------------------------------//
42// Entity type tags.
43//---------------------------------------------------------------------------//
44
48struct Cell
49{
50};
51
55struct Node
56{
57};
58
63template <int D>
64struct Face;
65
67template <>
68struct Face<Dim::I>
69{
71 static constexpr int dim = Dim::I;
72};
73
75template <>
76struct Face<Dim::J>
77{
79 static constexpr int dim = Dim::J;
80};
81
83template <>
84struct Face<Dim::K>
85{
87 static constexpr int dim = Dim::K;
88};
89
94template <int D>
95struct Edge;
96
98template <>
99struct Edge<Dim::I>
100{
102 static constexpr int dim = Dim::I;
103};
104
106template <>
107struct Edge<Dim::J>
108{
110 static constexpr int dim = Dim::J;
111};
112
114template <>
115struct Edge<Dim::K>
116{
118 static constexpr int dim = Dim::K;
119};
120
121// Type checkers.
122template <class T>
123struct isCell : public std::false_type
124{
125};
126
127template <>
128struct isCell<Cell> : public std::true_type
129{
130};
131
132template <>
133struct isCell<const Cell> : public std::true_type
134{
135};
136
137template <class T>
138struct isNode : public std::false_type
139{
140};
141
142template <>
143struct isNode<Node> : public std::true_type
144{
145};
146
147template <>
148struct isNode<const Node> : public std::true_type
149{
150};
151
152template <class T>
153struct isFace : public std::false_type
154{
155};
156
157template <int Dir>
158struct isFace<Face<Dir>> : public std::true_type
159{
160};
161
162template <int Dir>
163struct isFace<const Face<Dir>> : public std::true_type
164{
165};
166
167template <class T>
168struct isEdge : public std::false_type
169{
170};
171
172template <int Dir>
173struct isEdge<Edge<Dir>> : public std::true_type
174{
175};
176
177template <int Dir>
178struct isEdge<const Edge<Dir>> : public std::true_type
179{
180};
181
182//---------------------------------------------------------------------------//
183// Decomposition tags.
184//---------------------------------------------------------------------------//
185
189struct Own
190{
191};
192
196struct Ghost
197{
198};
199
200//---------------------------------------------------------------------------//
201// Index type tags.
202//---------------------------------------------------------------------------//
203
207struct Local
208{
209};
210
214struct Global
215{
216};
217
218//---------------------------------------------------------------------------//
219// Mesh type tags.
220//---------------------------------------------------------------------------//
221
225template <class Scalar, std::size_t NumSpaceDim = 3>
227{
229 using scalar_type = Scalar;
230
232 static constexpr std::size_t num_space_dim = NumSpaceDim;
233};
234
238template <class Scalar, std::size_t NumSpaceDim = 3>
240{
242 using scalar_type = Scalar;
243
245 static constexpr std::size_t num_space_dim = NumSpaceDim;
246};
247
251template <class Scalar, std::size_t NumSpaceDim = 3>
253{
255 using scalar_type = Scalar;
256
258 static constexpr std::size_t num_space_dim = NumSpaceDim;
259};
260
261// Type checker.
262template <class T>
263struct isMeshType : public std::false_type
264{
265};
266
267template <class Scalar, std::size_t NumSpaceDim>
268struct isMeshType<UniformMesh<Scalar, NumSpaceDim>> : public std::true_type
269{
270};
271
272template <class Scalar, std::size_t NumSpaceDim>
273struct isMeshType<const UniformMesh<Scalar, NumSpaceDim>>
274 : public std::true_type
275{
276};
277
278template <class Scalar, std::size_t NumSpaceDim>
279struct isMeshType<NonUniformMesh<Scalar, NumSpaceDim>> : public std::true_type
280{
281};
282
283template <class Scalar, std::size_t NumSpaceDim>
284struct isMeshType<const NonUniformMesh<Scalar, NumSpaceDim>>
285 : public std::true_type
286{
287};
288
289template <class Scalar, std::size_t NumSpaceDim>
290struct isMeshType<SparseMesh<Scalar, NumSpaceDim>> : public std::true_type
291{
292};
293
294template <class Scalar, std::size_t NumSpaceDim>
295struct isMeshType<const SparseMesh<Scalar, NumSpaceDim>> : public std::true_type
296{
297};
298
299// Uniform mesh checker.
300template <class T>
301struct isUniformMesh : public std::false_type
302{
303};
304
305template <class Scalar, std::size_t NumSpaceDim>
306struct isUniformMesh<UniformMesh<Scalar, NumSpaceDim>> : public std::true_type
307{
308};
309
310template <class Scalar, std::size_t NumSpaceDim>
311struct isUniformMesh<const UniformMesh<Scalar, NumSpaceDim>>
312 : public std::true_type
313{
314};
315
316// Non-uniform mesh checker.
317template <class T>
318struct isNonUniformMesh : public std::false_type
319{
320};
321
322template <class Scalar, std::size_t NumSpaceDim>
323struct isNonUniformMesh<NonUniformMesh<Scalar, NumSpaceDim>>
324 : public std::true_type
325{
326};
327
328template <class Scalar, std::size_t NumSpaceDim>
329struct isNonUniformMesh<const NonUniformMesh<Scalar, NumSpaceDim>>
330 : public std::true_type
331{
332};
333
334// Sparse mesh checker
335template <class T>
336struct isSparseMesh : public std::false_type
337{
338};
339
340template <class Scalar, std::size_t NumSpaceDim>
341struct isSparseMesh<SparseMesh<Scalar, NumSpaceDim>> : public std::true_type
342{
343};
344
345template <class Scalar, std::size_t NumSpaceDim>
346struct isSparseMesh<const SparseMesh<Scalar, NumSpaceDim>>
347 : public std::true_type
348{
349};
350//---------------------------------------------------------------------------//
351} // namespace Grid
352} // namespace Cabana
353
354#endif // CABANA_GRID_TYPES_HPP
Core: particle data structures and algorithms.
Definition Cabana_AoSoA.hpp:36
Mesh cell tag.
Definition Cabana_Grid_Types.hpp:49
Logical dimension index.
Definition Cabana_Grid_Types.hpp:31
Values
Spatial dimension.
Definition Cabana_Grid_Types.hpp:34
static constexpr int dim
Spatial dimension.
Definition Cabana_Grid_Types.hpp:102
static constexpr int dim
Spatial dimension.
Definition Cabana_Grid_Types.hpp:110
static constexpr int dim
Spatial dimension.
Definition Cabana_Grid_Types.hpp:118
Mesh edge tag.
Definition Cabana_Grid_Types.hpp:95
static constexpr int dim
Spatial dimension.
Definition Cabana_Grid_Types.hpp:71
static constexpr int dim
Spatial dimension.
Definition Cabana_Grid_Types.hpp:79
static constexpr int dim
Spatial dimension.
Definition Cabana_Grid_Types.hpp:87
Mesh face tag.
Definition Cabana_Grid_Types.hpp:64
Ghosted decomposition tag.
Definition Cabana_Grid_Types.hpp:197
Global index tag.
Definition Cabana_Grid_Types.hpp:215
Local index tag.
Definition Cabana_Grid_Types.hpp:208
Mesh node tag.
Definition Cabana_Grid_Types.hpp:56
Non-uniform mesh tag.
Definition Cabana_Grid_Types.hpp:240
static constexpr std::size_t num_space_dim
Definition Cabana_Grid_Types.hpp:245
Scalar scalar_type
Definition Cabana_Grid_Types.hpp:242
Owned decomposition tag.
Definition Cabana_Grid_Types.hpp:190
Sparse mesh tag.
Definition Cabana_Grid_Types.hpp:253
static constexpr std::size_t num_space_dim
Definition Cabana_Grid_Types.hpp:258
Scalar scalar_type
Definition Cabana_Grid_Types.hpp:255
Uniform mesh tag.
Definition Cabana_Grid_Types.hpp:227
static constexpr std::size_t num_space_dim
Definition Cabana_Grid_Types.hpp:232
Scalar scalar_type
Definition Cabana_Grid_Types.hpp:229
Definition Cabana_Grid_Types.hpp:124
Definition Cabana_Grid_Types.hpp:169
Definition Cabana_Grid_Types.hpp:154
Definition Cabana_Grid_Types.hpp:264
Definition Cabana_Grid_Types.hpp:139
Definition Cabana_Grid_Types.hpp:319
Definition Cabana_Grid_Types.hpp:337
Definition Cabana_Grid_Types.hpp:302