MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
fvcartesianbndrycell.cpp
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
8
9#include "MEMORY/collector.h"
10#include "UTIL/debug.h"
13#include "fvcartesiansyseqnns.h"
15//#include "UTIL/timer.h"
16
17template <MInt nDim, class SysEqn>
19template <MInt nDim, class SysEqn>
21template <MInt nDim, class SysEqn>
23template <MInt nDim, class SysEqn>
25template <MInt nDim, class SysEqn>
27template <MInt nDim, class SysEqn>
29
30using namespace maia::collector_memory;
31
32template <MInt nDim, class SysEqn>
33void FvBndryCell<nDim, SysEqn>::init(MInt NotUsed(dimensions), MInt noSpecies, MInt noRansEquations,
34 MInt /*maxNoCells*/, MInt maxNoSurfaces) {
35 TRACE();
36
37 m_noSpecies = noSpecies;
38 if(noRansEquations == -1) {
39 m_noRansEquations = 0;
40 } else {
41 m_noRansEquations = noRansEquations;
42 }
43 m_noEdges = (nDim == 2) ? 4 : 24;
44 m_maxNoSurfaces = maxNoSurfaces;
45 m_noNghbrs = 2 * nDim;
46 m_noVariables = nDim + 2 + m_noSpecies + m_noRansEquations;
47}
48
49
50template <MInt nDim, class SysEqn>
51void FvBndryCell<nDim, SysEqn>::allocateElements(void* cellPtr, void*, const MInt) {
52 // TRACE();
53
54 // Initialize non-static member variables:
55 m_linkedCellId = -1;
56 m_noSrfcs = 1;
57
58 // Member pointers are set to the cell memory here:
59 moveElements(cellPtr);
60}
61
66template <MInt nDim, class SysEqn>
68 // TRACE();
69
70 unaligned_cell_wise::rowMajor1D(m_externalFaces, cellPtr, m_noNghbrs);
71 unaligned_cell_wise::rowMajor1D(m_associatedSrfc, cellPtr, m_noNghbrs);
72 unaligned_cell_wise::rowMajor1D(m_coordinates, cellPtr, nDim);
73 unaligned_cell_wise::rowMajor1D(m_masterCoordinates, cellPtr, nDim);
74
75 unaligned_cell_wise::rowMajor2D(m_srfcs, cellPtr, m_maxNoSurfaces, 1);
76 for(MInt i = 0; i < m_maxNoSurfaces; ++i) {
77 unaligned_cell_wise::rowMajor1D(m_srfcs[i]->m_cutEdge, cellPtr, 2 * m_noEdges);
78 unaligned_cell_wise::rowMajor1D(m_srfcs[i]->m_bodyId, cellPtr, 2 * m_noEdges);
79 unaligned_cell_wise::rowMajor1D(m_srfcs[i]->m_coordinates, cellPtr, nDim);
80 unaligned_cell_wise::rowMajor1D(m_srfcs[i]->m_normalVector, cellPtr, nDim);
81 unaligned_cell_wise::rowMajor1D(m_srfcs[i]->m_normalVectorCentroid, cellPtr, nDim);
82 unaligned_cell_wise::rowMajor1D(m_srfcs[i]->m_planeVector0, cellPtr, nDim);
83 unaligned_cell_wise::rowMajor1D(m_srfcs[i]->m_planeVector1, cellPtr, nDim);
84 unaligned_cell_wise::rowMajor2D(m_srfcs[i]->m_cutCoordinates, cellPtr, 2 * m_noEdges, nDim);
85 }
86
87 unaligned_cell_wise::rowMajor2D(m_srfcVariables, cellPtr, m_maxNoSurfaces, 1);
88 for(MInt i = 0; i < m_maxNoSurfaces; ++i) {
89 unaligned_cell_wise::rowMajor1D(m_srfcVariables[i]->m_srfcId, cellPtr, nDim);
90 unaligned_cell_wise::rowMajor1D(m_srfcVariables[i]->m_imageCoordinates, cellPtr, nDim);
91 unaligned_cell_wise::rowMajor1D(m_srfcVariables[i]->m_imageVariables, cellPtr, m_noVariables);
92 unaligned_cell_wise::rowMajor1D(m_srfcVariables[i]->m_variablesType, cellPtr, m_noVariables);
93 unaligned_cell_wise::rowMajor1D(m_srfcVariables[i]->m_primVars, cellPtr, m_noVariables);
94 unaligned_cell_wise::rowMajor1D(m_srfcVariables[i]->m_normalDeriv, cellPtr, m_noVariables);
95 // Invoke placement new operator to call constructor for std::vector on
96 // place in memory that was allocated before. If this is not done,
97 // std::vector will not work properly
98 new(&m_srfcVariables[i]->m_imagePointRecConst) std::vector<MFloat>();
99 }
100}
101
102// Explicit instantiations for 2D and 3D
103template class FvBndryCell<2, FvSysEqnNS<2>>;
104template class FvBndryCell<3, FvSysEqnNS<3>>;
113template class FvBndryCell<3, FvSysEqnEEGas<3>>;
void moveElements(void *)
void allocateElements(void *, void *, const MInt)
static void init(MInt, MInt, MInt, MInt, MInt)
MInt noRansEquations(RansMethod ransMethod)
int32_t MInt
Definition: maiatypes.h:62
void rowMajor1D(T *&p, void *&base, const MInt Nrows)
Store 1D variables in row-majow order relative to the start of each cell's memory solver.
Definition: collector.h:307
Helper functions useful for allocating collector memory.
Definition: collector.h:178