MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
cartesiangridgencell.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#include <climits>
9#include "globals.h"
10
11template <MInt nDim>
13template <MInt nDim>
15template <MInt nDim>
17template <MInt nDim>
19
20using namespace maia::collector_memory;
21
22template <MInt nDim>
23void GridgenCell<nDim>::allocateElements(void*, void* basePtr, const MInt cellId) {
24 // init
25 m_rfnDistance_ = std::numeric_limits<MInt>::max();
26 b_properties_.fill(0);
27 b_solverAffiliation_.fill(0);
28 b_solverBoundary_.fill(0);
29 b_solverToRefine_.fill(0);
30
31 // Member pointers are set to the cell memory here:
32 moveElements(nullptr, basePtr, cellId);
33}
34
35template <MInt nDim>
36void GridgenCell<nDim>::moveElements(void*, void* basePtr, const MInt cellId) {
37 rowMajor1D(m_level_, basePtr, cellId, 1, s_maxNoCells);
38 rowMajor1D(m_parentId_, basePtr, cellId, 1, s_maxNoCells);
39 rowMajor1D(m_globalId_, basePtr, cellId, 1, s_maxNoCells);
40 rowMajor1D(m_noChildIds_, basePtr, cellId, 1, s_maxNoCells);
41 rowMajor1D(m_childIds_, basePtr, cellId, s_noChilds, s_maxNoCells);
42 rowMajor1D(m_nghbrIds_, basePtr, cellId, s_noNghbrs, s_maxNoCells);
43 rowMajor1D(m_coordinates_, basePtr, cellId, s_dimensions, s_maxNoCells);
44 rowMajor1D(m_noSolidLayer_, basePtr, cellId, s_maxNoSolvers, s_maxNoCells);
45}
46
47template <MInt nDim>
48void GridgenCell<nDim>::memCopyElements(void* basePtr, void*, void*, MLong) {
49 const GridgenCell<nDim>* const from = reinterpret_cast<GridgenCell<nDim>*>(basePtr);
50
51 copyElements1D(m_level_, from->m_level_, 1);
52 copyElements1D(m_parentId_, from->m_parentId_, 1);
53 copyElements1D(m_globalId_, from->m_globalId_, 1);
54 copyElements1D(m_noChildIds_, from->m_noChildIds_, 1);
55 copyElements1D(m_childIds_, from->m_childIds_, s_noChilds);
56 copyElements1D(m_nghbrIds_, from->m_nghbrIds_, s_noNghbrs);
57 copyElements1D(m_coordinates_, from->m_coordinates_, s_dimensions);
58 copyElements1D(m_noSolidLayer_, from->m_noSolidLayer_, s_maxNoSolvers);
59}
60
61
62// Explicit instantiations for 2D and 3D
63template class GridgenCell<2>;
64template class GridgenCell<3>;
MFloat * m_coordinates_
void moveElements(void *, void *basePtr, const MInt cellId)
void memCopyElements(void *basePtr, void *, void *, MLong)
void allocateElements(void *, void *basePtr, const MInt cellId)
int32_t MInt
Definition: maiatypes.h:62
int64_t MLong
Definition: maiatypes.h:64
Helper functions useful for allocating collector memory.
Definition: collector.h:178
void copyElements1D(T *to, T *from, const MInt Nrows)
Copies 1D cell elements.
Definition: collector.h:258
void rowMajor1D(T *&p, void *&base, const MInt cellId, const MInt Nrows, const MInt maxNoCells)
Stores 1D variables in row-major order.
Definition: collector.h:210
void const MInt cellId
Definition: collector.h:239