MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
fvcartesiansurfacecollector.h
Go to the documentation of this file.
1// Copyright (C) 2024 The m-AIA AUTHORS
2//
3// This file is part of m-AIA (https://git.rwth-aachen.de/aia/m-AIA/m-AIA)
4//
5// SPDX-License-Identifier: LGPL-3.0-only
6
7#ifndef MAIAFVSURFACECOLLECTOR_H_
8#define MAIAFVSURFACECOLLECTOR_H_
9
10#include <algorithm>
11#include <bitset>
12#include <limits>
13#include <type_traits>
14#include <vector>
16#include "INCLUDE/maiamacro.h"
17#include "INCLUDE/maiatypes.h"
18#include "IO/context.h"
19#include "MEMORY/container.h"
20#include "UTIL/functions.h"
21#include "compiler_config.h"
22
23// The following macro enables the "Structure-of-Arrays" memory layout for multi-dimensional node
24// variables. This might be beneficial for GPU computations. Default is "Array-of-Structures".
25// Examples (for nodes nN with four children cM each)
26// Array-of-Structures (AOS): n0c0, n0c1, n0c2, n0c3, n1c0, n1c1, n1c2, n1c3, n2c0, n2c1, ...
27// Structure-of-Arrays (SOA): n0c0, n1c0, n2c0, n3c0, ..., n0c1, n1c1, n2c1, n3c1, ..., n0c2, ...
28// #define FVSURFACECOLLECTOR_SOA_MEMORY_LAYOUT
29
30// Sanity-checking macros for accessors
31#if defined(FVSURFACECOLLECTOR_SANITY_CHECKS_ACCESSORS) || defined(MAIA_ASSERT_ACCESSORS)
32#define ENSURE_VALID_ID_ACCESSOR(id) \
33 do { \
34 MAIA_CONTAINER_ENSURE_VALID_ID(id); \
35 } while(false)
36#define ENSURE_VALID_VARIABLE_ID_ACCESSOR(id) \
37 do { \
38 MAIA_CONTAINER_ENSURE( \
39 id >= 0 && id < noVariables(), \
40 "variable id = " + std::to_string(id) + " out-of-bounds [0, " + std::to_string(noVariables()) + ")", AT_); \
41 } while(false)
42#define ENSURE_VALID_FLUX_VARIABLE_ID_ACCESSOR(id) \
43 do { \
44 MAIA_CONTAINER_ENSURE(id >= 0 && id < noFVariables(), \
45 "flux variable id = " + std::to_string(id) + " out-of-bounds [0, " \
46 + std::to_string(noFVariables()) + ")", \
47 AT_); \
48 } while(false)
49#define ENSURE_VALID_DIR_ACCESSOR(id) \
50 do { \
51 MAIA_CONTAINER_ENSURE(id >= 0 && id < 2, "dir = " + std::to_string(id) + " out-of-bounds [0, 2)", AT_); \
52 } while(false)
53#define ENSURE_VALID_COORDINATE_DIR_ACCESSOR(dir) \
54 do { \
55 MAIA_CONTAINER_ENSURE( \
56 dir >= 0 && dir < nDim, \
57 "direction dir = " + std::to_string(dir) + " out-of-bounds [0, " + std::to_string(nDim) + ")", AT_); \
58 } while(false)
59#define ENSURE_VALID_SURFACE_COEFFICIENT_ID_ACCESSOR(id) \
60 do { \
61 MAIA_CONTAINER_ENSURE(id >= 0 && id < noSurfaceCoefficients(), \
62 "surface coefficient id = " + std::to_string(id) + " out-of-bounds [0, " \
63 + std::to_string(noSurfaceCoefficients()) + ")", \
64 AT_); \
65 } while(false)
66#else
67#define ENSURE_VALID_ID_ACCESSOR(id) \
68 do { \
69 } while(false)
70#define ENSURE_VALID_VARIABLE_ID_ACCESSOR(id) \
71 do { \
72 } while(false)
73#define ENSURE_VALID_FLUX_VARIABLE_ID_ACCESSOR(id) \
74 do { \
75 } while(false)
76#define ENSURE_VALID_DIR_ACCESSOR(id) \
77 do { \
78 } while(false)
79#define ENSURE_VALID_COORDINATE_DIR_ACCESSOR(dir) \
80 do { \
81 } while(false)
82#define ENSURE_VALID_SURFACE_COEFFICIENT_ID_ACCESSOR(id) \
83 do { \
84 } while(false)
85#endif
86
87
90
91// Type traits for invalid values. These values are used to initialize/erase nodes
92template <class T>
93struct Invalid {};
94
95// Invalid value for ids is 'INT_MIN'
96template <>
97struct Invalid<MInt> {
98 static constexpr MInt value() { return std::numeric_limits<MInt>::min(); }
99};
100
101// Invalid value for longs is 'INT_MIN'
102template <>
103struct Invalid<MLong> {
104 static constexpr MLong value() { return std::numeric_limits<MLong>::min(); }
105};
106
107// Invalid value for floats is 'NaN'
108template <>
110 static constexpr MFloat value() {
111#ifdef MAIA_PGI_COMPILER
112 return std::numeric_limits<MFloat>::quiet_NaN();
113#else
114 return std::numeric_limits<MFloat>::signaling_NaN();
115#endif
116 }
117};
118
119
121template <MInt nDim>
122class FvSurfaceCollector : public maia::container::Container<FvSurfaceCollector<nDim>, Invalid> {
123 // Necessary for CRTP
125
126 // Make base class functions known to use without this pointer
128 using Base::resetStorage;
130 template <class T>
131 using Storage = typename Base::template Storage<T>;
132
133
134 public:
135 // Types
136 template <class T>
138
139 // Constructors
141 constexpr FvSurfaceCollector() = default;
142 void checkVariables();
143
144 // Ensure that base class method is found when called from outside
145 using Base::copyData;
146 using Base::fill_invalid;
147 using Base::reset;
148 using Base::resize;
149
150 // Accessors
151 MInt& bndryCndId(const MInt id);
152 MInt bndryCndId(const MInt id) const;
153
154 MInt& orientation(const MInt id);
155 MInt orientation(const MInt id) const;
156
157 MFloat& factor(const MInt id, const MInt varId);
158 MFloat factor(const MInt id, const MInt varId) const;
159
160 MFloat& area(const MInt id);
161 MFloat area(const MInt id) const;
162
163 MFloat& coordinate(const MInt id, const MInt dir);
164 MFloat coordinate(const MInt id, const MInt dir) const;
165
166 MFloat& deltaX(const MInt id, const MInt varId);
167 MFloat deltaX(const MInt id, const MInt varId) const;
168
169 MInt& nghbrCellId(const MInt id, const MInt dir);
170 MInt nghbrCellId(const MInt id, const MInt dir) const;
171
172 MFloat& variable(const MInt id, const MInt dir, const MInt varId);
173 MFloat variable(const MInt id, const MInt dir, const MInt varId) const;
174
175 MFloat& upwindCoefficient(const MInt id);
176 MFloat upwindCoefficient(const MInt id) const;
177
178 MFloat& surfaceCoefficient(const MInt id, const MInt dimCoefficient);
179 MFloat surfaceCoefficient(const MInt id, const MInt dimCoefficient) const;
180
181 MFloat& flux(const MInt id, const MInt fVarId);
182 MFloat flux(const MInt id, const MInt fVarId) const;
183
184 // Allow setting number of PVs
185 void setNoSpecies(const MInt noSpecies_);
186 void setNoMaxSrfcs(const MInt noMaxSrfcs_);
187 void setNoVariables(const MInt noVariables_);
188 void setNoFVariables(const MInt noFVariables_);
189 void setNoSurfaceCoefficients(const MInt noSurfaceCoefficients_);
190 void setSolverType(const MInt solverType);
191
193 constexpr MInt noSpecies() const { return m_noSpecies; }
194
196 constexpr MInt noMaxSrfcs() const { return m_noMaxSrfcs; }
197
199 constexpr MInt noVariables() const { return m_noVariables; }
200
202 constexpr MInt noFVariables() const { return m_noFVariables; }
203
206
208 constexpr SolverType solverType() const { return (SolverType)m_solverType; }
209
210 private:
211 // Methods required by base class for CRTP
212 void reset();
213 void resize() override;
214 void invalidate(const MInt begin, const MInt end);
215 template <class Functor, class T>
216 void rawCopyGeneric(Functor&& c, const T& source, const MInt begin, const MInt end, const MInt destination);
217
218 // TODO:FV,toremove
221
222 // Number of maximum surfaces
224
225 // Number of variables
227
228 // Number of flux variables
230
231 // Number of surface coefficients
233
234 // Solver type
236
237 // Data containers
249};
250
251
253template <MInt nDim>
255 std::cerr << "@FvSurfaceCollector: noVariables() = " << noVariables() << ", noFVariables() = " << noFVariables()
256 << ", noSurfaceCoefficients() = " << noSurfaceCoefficients() << ", m_noMaxSrfcs = " << noMaxSrfcs()
257 << std::endl;
258}
259
260// TODO labels:FV replace reset with resize+invalidate?
262template <MInt nDim>
264 resetStorage(1, m_bndryCndId);
265 resetStorage(1, m_orientation);
266 resetStorage(2, m_factor);
267 resetStorage(1, m_area);
268 resetStorage(nDim, m_coordinates);
269 resetStorage(2 * nDim, m_deltaX);
270 resetStorage(2, m_nghbrCellIds);
271 resetStorage(2 * noVariables(), m_variables);
272 resetStorage(1, m_upwindCoefficent);
273 resetStorage(noSurfaceCoefficients(), m_surfaceCoefficients);
274 resetStorage(noFVariables(), m_flux);
275}
276
277
279template <MInt nDim>
281 resizeStorage(1, m_bndryCndId);
282 resizeStorage(1, m_orientation);
283 resizeStorage(2, m_factor);
284 resizeStorage(1, m_area);
285 resizeStorage(nDim, m_coordinates);
286 resizeStorage(2 * nDim, m_deltaX);
287 resizeStorage(2, m_nghbrCellIds);
288 resizeStorage(2 * noVariables(), m_variables);
289 resizeStorage(1, m_upwindCoefficent);
290 resizeStorage(noSurfaceCoefficients(), m_surfaceCoefficients);
291 resizeStorage(noFVariables(), m_flux);
292}
293
294
295// TODO:FV Accessor function variables and macros might need to be changed later
296// TODO:FV id is used as the surfaceId
297// Which must be defined when the collector is created as
298// noBoundarySurfaces + noInnerSurfaces. However, since this information
299// is not known, the number of cells can be used to estimate the collector size
301template <MInt nDim>
303// Prevent accidental compilation without support for SoA layout
304#ifdef FVSURFACECOLLECTOR_SOA_MEMORY_LAYOUT
305#error Missing implementation for structure-of-arrays memory layout.
306#endif
307 ENSURE_VALID_ID_ACCESSOR(id);
308 return m_bndryCndId[id];
309}
311template <MInt nDim>
313// Prevent accidental compilation without support for SoA layout
314#ifdef FVSURFACECOLLECTOR_SOA_MEMORY_LAYOUT
315#error Missing implementation for structure-of-arrays memory layout.
316#endif
317 ENSURE_VALID_ID_ACCESSOR(id);
318 return m_bndryCndId[id];
319}
320
322template <MInt nDim>
324// Prevent accidental compilation without support for SoA layout
325#ifdef FVSURFACECOLLECTOR_SOA_MEMORY_LAYOUT
326#error Missing implementation for structure-of-arrays memory layout.
327#endif
328 ENSURE_VALID_ID_ACCESSOR(id);
329 return m_orientation[id];
330}
332template <MInt nDim>
334// Prevent accidental compilation without support for SoA layout
335#ifdef FVSURFACECOLLECTOR_SOA_MEMORY_LAYOUT
336#error Missing implementation for structure-of-arrays memory layout.
337#endif
338 ENSURE_VALID_ID_ACCESSOR(id);
339 return m_orientation[id];
340}
341
343template <MInt nDim>
345// Prevent accidental compilation without support for SoA layout
346#ifdef FVSURFACECOLLECTOR_SOA_MEMORY_LAYOUT
347#error Missing implementation for structure-of-arrays memory layout.
348#endif
349 ENSURE_VALID_ID_ACCESSOR(id);
350 ENSURE_VALID_VARIABLE_ID_ACCESSOR(varId);
351 return m_factor[id * 2 + varId];
352}
354template <MInt nDim>
355MFloat FvSurfaceCollector<nDim>::factor(const MInt id, const MInt varId) const {
356// Prevent accidental compilation without support for SoA layout
357#ifdef FVSURFACECOLLECTOR_SOA_MEMORY_LAYOUT
358#error Missing implementation for structure-of-arrays memory layout.
359#endif
360 ENSURE_VALID_ID_ACCESSOR(id);
361 ENSURE_VALID_VARIABLE_ID_ACCESSOR(varId);
362 return m_factor[id * 2 + varId];
363}
364
366template <MInt nDim>
368// Prevent accidental compilation without support for SoA layout
369#ifdef FVSURFACECOLLECTOR_SOA_MEMORY_LAYOUT
370#error Missing implementation for structure-of-arrays memory layout.
371#endif
372 ENSURE_VALID_ID_ACCESSOR(id);
373 return m_area[id];
374}
376template <MInt nDim>
378// Prevent accidental compilation without support for SoA layout
379#ifdef FVSURFACECOLLECTOR_SOA_MEMORY_LAYOUT
380#error Missing implementation for structure-of-arrays memory layout.
381#endif
382 ENSURE_VALID_ID_ACCESSOR(id);
383 return m_area[id];
384}
385
387template <MInt nDim>
389// Prevent accidental compilation without support for SoA layout
390#ifdef FVSURFACECOLLECTOR_SOA_MEMORY_LAYOUT
391#error Missing implementation for structure-of-arrays memory layout.
392#endif
393 ENSURE_VALID_ID_ACCESSOR(id);
394 ENSURE_VALID_COORDINATE_DIR_ACCESSOR(dir);
395 return m_coordinates[id * nDim + dir];
396}
398template <MInt nDim>
400// Prevent accidental compilation without support for SoA layout
401#ifdef FVSURFACECOLLECTOR_SOA_MEMORY_LAYOUT
402#error Missing implementation for structure-of-arrays memory layout.
403#endif
404 ENSURE_VALID_ID_ACCESSOR(id);
405 ENSURE_VALID_COORDINATE_DIR_ACCESSOR(dir);
406 return m_coordinates[id * nDim + dir];
407}
408
410template <MInt nDim>
412// Prevent accidental compilation without support for SoA layout
413#ifdef FVSURFACECOLLECTOR_SOA_MEMORY_LAYOUT
414#error Missing implementation for structure-of-arrays memory layout.
415#endif
416 ENSURE_VALID_ID_ACCESSOR(id);
417 ENSURE_VALID_VARIABLE_ID_ACCESSOR(varId);
418 return m_deltaX[id * 2 * nDim + varId];
419}
421template <MInt nDim>
422MFloat FvSurfaceCollector<nDim>::deltaX(const MInt id, const MInt varId) const {
423// Prevent accidental compilation without support for SoA layout
424#ifdef FVSURFACECOLLECTOR_SOA_MEMORY_LAYOUT
425#error Missing implementation for structure-of-arrays memory layout.
426#endif
427 ENSURE_VALID_ID_ACCESSOR(id);
428 ENSURE_VALID_VARIABLE_ID_ACCESSOR(varId);
429 return m_deltaX[id * 2 * nDim + varId];
430}
431
433template <MInt nDim>
435// Prevent accidental compilation without support for SoA layout
436#ifdef FVSURFACECOLLECTOR_SOA_MEMORY_LAYOUT
437#error Missing implementation for structure-of-arrays memory layout.
438#endif
439 ENSURE_VALID_ID_ACCESSOR(id);
440 ENSURE_VALID_COORDINATE_DIR_ACCESSOR(dir);
441 return m_nghbrCellIds[id * 2 + dir];
442}
444template <MInt nDim>
446// Prevent accidental compilation without support for SoA layout
447#ifdef FVSURFACECOLLECTOR_SOA_MEMORY_LAYOUT
448#error Missing implementation for structure-of-arrays memory layout.
449#endif
450 ENSURE_VALID_ID_ACCESSOR(id);
451 ENSURE_VALID_COORDINATE_DIR_ACCESSOR(dir);
452 return m_nghbrCellIds[id * 2 + dir];
453}
454
456template <MInt nDim>
457MFloat& FvSurfaceCollector<nDim>::variable(const MInt id, const MInt dir, const MInt varId) {
458// Prevent accidental compilation without support for SoA layout
459#ifdef FVSURFACECOLLECTOR_SOA_MEMORY_LAYOUT
460#error Missing implementation for structure-of-arrays memory layout.
461#endif
462 ENSURE_VALID_ID_ACCESSOR(id);
463 ENSURE_VALID_DIR_ACCESSOR(dir);
464 ENSURE_VALID_VARIABLE_ID_ACCESSOR(varId);
465 return m_variables[(id * 2 + dir) * noVariables() + varId];
466}
468template <MInt nDim>
469MFloat FvSurfaceCollector<nDim>::variable(const MInt id, const MInt dir, const MInt varId) const {
470// Prevent accidental compilation without support for SoA layout
471#ifdef FVSURFACECOLLECTOR_SOA_MEMORY_LAYOUT
472#error Missing implementation for structure-of-arrays memory layout.
473#endif
474 ENSURE_VALID_ID_ACCESSOR(id);
475 ENSURE_VALID_DIR_ACCESSOR(dir);
476 ENSURE_VALID_VARIABLE_ID_ACCESSOR(varId);
477 return m_variables[(id * 2 + dir) * noVariables() + varId];
478}
479
481template <MInt nDim>
483// Prevent accidental compilation without support for SoA layout
484#ifdef FVSURFACECOLLECTOR_SOA_MEMORY_LAYOUT
485#error Missing implementation for structure-of-arrays memory layout.
486#endif
487 ENSURE_VALID_ID_ACCESSOR(id);
488 return m_upwindCoefficent[id];
489}
491template <MInt nDim>
493// Prevent accidental compilation without support for SoA layout
494#ifdef FVSURFACECOLLECTOR_SOA_MEMORY_LAYOUT
495#error Missing implementation for structure-of-arrays memory layout.
496#endif
497 ENSURE_VALID_ID_ACCESSOR(id);
498 return m_upwindCoefficent[id];
499}
500
502template <MInt nDim>
504// Prevent accidental compilation without support for SoA layout
505#ifdef FVSURFACECOLLECTOR_SOA_MEMORY_LAYOUT
506#error Missing implementation for structure-of-arrays memory layout.
507#endif
508 ENSURE_VALID_ID_ACCESSOR(id);
509 ENSURE_VALID_SURFACE_COEFFICIENT_ID_ACCESSOR(dimCoefficient);
510 return m_surfaceCoefficients[id * noSurfaceCoefficients() + dimCoefficient];
511}
513template <MInt nDim>
514MFloat FvSurfaceCollector<nDim>::surfaceCoefficient(const MInt id, const MInt dimCoefficient) const {
515// Prevent accidental compilation without support for SoA layout
516#ifdef FVSURFACECOLLECTOR_SOA_MEMORY_LAYOUT
517#error Missing implementation for structure-of-arrays memory layout.
518#endif
519 ENSURE_VALID_ID_ACCESSOR(id);
520 ENSURE_VALID_SURFACE_COEFFICIENT_ID_ACCESSOR(dimCoefficient);
521 return m_surfaceCoefficients[id * noSurfaceCoefficients() + dimCoefficient];
522}
523
525template <MInt nDim>
527// Prevent accidental compilation without support for SoA layout
528#ifdef FVSURFACECOLLECTOR_SOA_MEMORY_LAYOUT
529#error Missing implementation for structure-of-arrays memory layout.
530#endif
531 ENSURE_VALID_ID_ACCESSOR(id);
532 ENSURE_VALID_FLUX_VARIABLE_ID_ACCESSOR(varId);
533 return m_flux[id * noFVariables() + fVarId];
534}
536template <MInt nDim>
537MFloat FvSurfaceCollector<nDim>::flux(const MInt id, const MInt fVarId) const {
538// Prevent accidental compilation without support for SoA layout
539#ifdef FVSURFACECOLLECTOR_SOA_MEMORY_LAYOUT
540#error Missing implementation for structure-of-arrays memory layout.
541#endif
542 ENSURE_VALID_ID_ACCESSOR(id);
543 ENSURE_VALID_FLUX_VARIABLE_ID_ACCESSOR(varId);
544 return m_flux[id * noFVariables() + fVarId];
545}
547template <MInt nDim>
549 m_noSpecies = noSpecies_;
550}
551
553template <MInt nDim>
555 m_noMaxSrfcs = noMaxSrfcs_;
556}
557
559template <MInt nDim>
561 m_noVariables = noVariables_;
562}
563
565template <MInt nDim>
567 m_noFVariables = noFVariables_;
568}
569
571template <MInt nDim>
573 m_noSurfaceCoefficients = noSurfaceCoefficients_;
574}
575
577template <MInt nDim>
579 m_solverType = solverType;
580}
581
583template <MInt nDim>
584void FvSurfaceCollector<nDim>::invalidate(const MInt begin, const MInt end) {
585// Prevent accidental compilation without support for SoA layout
586#ifdef FVSURFACECOLLECTOR_SOA_MEMORY_LAYOUT
587#error Missing implementation for structure-of-arrays memory layout.
588#endif
589
590 // bndryCndId
591 fill_invalid(m_bndryCndId, begin, end, 1, -1);
592 // orientation
593 fill_invalid(m_orientation, begin, end, 1, -1);
594 // factors
595 fill_invalid(m_factor, begin, end, 2);
596 // area
597 fill_invalid(m_area, begin, end);
598 // coordinates
599 fill_invalid(m_coordinates, begin, end, nDim);
600 // deltaX
601 fill_invalid(m_deltaX, begin, end, 2 * nDim);
602 // nghbrCellIds
603 fill_invalid(m_nghbrCellIds, begin, end, 2, -1);
604 // variables
605 fill_invalid(m_variables, begin, end, 2 * noVariables());
606 // upwindCoefficient
607 fill_invalid(m_upwindCoefficent, begin, end);
608 // surfaceCoefficients
609 fill_invalid(m_surfaceCoefficients, begin, end, noSurfaceCoefficients());
610 // flux
611 fill_invalid(m_flux, begin, end, noFVariables());
612}
613
615template <MInt nDim>
616template <class Functor, class T>
617void FvSurfaceCollector<nDim>::rawCopyGeneric(Functor&& c, const T& source, const MInt begin, const MInt end,
618 const MInt destination) {
619// Prevent accidental compilation without support for SoA layout
620#ifdef FVSURFACECOLLECTOR_SOA_MEMORY_LAYOUT
621#error Missing implementation for structure-of-arrays memory layout.
622#endif
623
624 // bndryCndId
625 copyData(source.m_bndryCndId, m_bndryCndId, c, begin, end, destination);
626 // orientation
627 copyData(source.m_orientation, m_orientation, c, begin, end, destination);
628 // factors
629 copyData(source.m_factor, m_factor, c, begin, end, destination, 2);
630 // area
631 copyData(source.m_area, m_area, c, begin, end, destination);
632 // coordinates
633 copyData(source.m_coordinates, m_coordinates, c, begin, end, destination, nDim);
634 // deltaX
635 copyData(source.m_deltaX, m_deltaX, c, begin, end, destination, 2 * nDim);
636 // nghbrCellIds
637 copyData(source.m_nghbrCellIds, m_nghbrCellIds, c, begin, end, destination, 2);
638 // variables
639 copyData(source.m_variables, m_variables, c, begin, end, destination, 2 * noVariables());
640 // upwindCoefficient
641 copyData(source.m_upwindCoefficent, m_upwindCoefficent, c, begin, end, destination);
642 // surfaceCoefficients
643 copyData(source.m_surfaceCoefficients, m_surfaceCoefficients, c, begin, end, destination, noSurfaceCoefficients());
644 // flux
645 copyData(source.m_flux, m_flux, c, begin, end, destination, noFVariables());
646}
647} // namespace maia::fv::surface_collector
648
649
650// Undefine macros that should not be used outside this file
651#undef FVSURFACECOLLECTOR_SANITY_CHECKS_ACCESSORS
652#undef ENSURE_VALID_ID_ACCESSOR
653#undef ENSURE_VALID_VARIABLE_ID_ACCESSOR
654#undef ENSURE_VALID_FLUX_VARIABLE_ID_ACCESSOR
655#undef ENSURE_VALID_DIR_ACCESSOR
656#undef ENSURE_VALID_COORDINATE_DIR_ACCESSOR
657#undef ENSURE_VALID_SURFACE_COEFFICIENT_ID_ACCESSOR
658
659#endif // ifndef MAIAFVSURFACECOLLECTOR_H_
void copyData(const Container_ &source, Container_ &target, Functor &&f, const MInt begin, const MInt end, const MInt dest, const MInt solverSize=1)
Copy [begin, end) range with given solver size from source to dest position of target.
Definition: container.h:138
void fill_invalid(Container_ &c, const MInt begin, const MInt end, const MInt solverSize=1, const T value=Invalid< T >::value())
Definition: container.h:131
void resetStorage(const MInt n, Storage< T > &c)
Create new container with given size and replace original one.
Definition: container.h:420
void resizeStorage(const MInt n, Storage< T > &c)
Resize container with given size.
Definition: container.h:436
void reset(const MInt capacity)
Reset tree, re-create data structures with given capacity, and set size to zero.
Definition: container.h:187
Class that represents FV surface collector.
MFloat & area(const MInt id)
Accessor for area.
constexpr MInt noVariables() const
Return number of variables.
void rawCopyGeneric(Functor &&c, const T &source, const MInt begin, const MInt end, const MInt destination)
Helper function for rawCopy(). Destination may refer to beginning or end of target range.
constexpr MInt noMaxSrfcs() const
Return number of maximum surfaces.
MFloat & coordinate(const MInt id, const MInt dir)
Accessor for coordinate.
MFloat & upwindCoefficient(const MInt id)
Accessor for upwind coefficient.
constexpr FvSurfaceCollector()=default
Default c'tor does nothing.
MFloat & factor(const MInt id, const MInt varId)
Accessor for factor.
void setNoSurfaceCoefficients(const MInt noSurfaceCoefficients_)
Set number of surface coefficients and update number of surface coefficients.
void setNoVariables(const MInt noVariables_)
Set number of variables and update number of variables.
MFloat & flux(const MInt id, const MInt fVarId)
Accessor for flux.
constexpr MInt noSpecies() const
Return number of species.
MFloat & deltaX(const MInt id, const MInt varId)
Accessor for deltaX.
constexpr SolverType solverType() const
Return solver type.
void resize() override
Reset tree, re-create data structures with given capacity, and set size to zero.
MFloat & variable(const MInt id, const MInt dir, const MInt varId)
Accessor for variable.
MInt & nghbrCellId(const MInt id, const MInt dir)
Accessor for nghbrCellId.
void reset()
Reset tree, re-create data structures with given capacity, and set size to zero.
void invalidate(const MInt begin, const MInt end)
Erase range of nodes such that they contain no sensible values anymore.
MInt & bndryCndId(const MInt id)
Accessor for bndryCndId.
MInt m_noSpecies
Number of species (not being used)
void setNoSpecies(const MInt noSpecies_)
Set number of species and update number of variables.
MInt & orientation(const MInt id)
Accessor for orientation.
typename maia::fv::surface_collector::Invalid< T > Invalid
void setSolverType(const MInt solverType)
Set solver type.
constexpr MInt noSurfaceCoefficients() const
Return number of surface coefficients.
constexpr MInt noFVariables() const
Return number of flux variables.
void setNoFVariables(const MInt noFVariables_)
Set number of flux variables.
MFloat & surfaceCoefficient(const MInt id, const MInt dimCoefficient)
Accessor for surfaceCoefficient.
void setNoMaxSrfcs(const MInt noMaxSrfcs_)
Set number of maximum surfaces and update number of variables.
SolverType
Definition: enums.h:22
int32_t MInt
Definition: maiatypes.h:62
double MFloat
Definition: maiatypes.h:52
int64_t MLong
Definition: maiatypes.h:64
MInt id
Definition: maiatypes.h:71
Namespace for auxiliary functions/classes.