Peano 4
Loading...
Searching...
No Matches
ContextCartesian.h
Go to the documentation of this file.
1#ifndef EXASEIS_CARTESIAN_CONTEXT_HEADER
2#define EXASEIS_CARTESIAN_CONTEXT_HEADER
3
4#include "Context.h"
5#include "../../../ExaHyPE/kernels/GaussLegendreBasis.h"
6#include "../../../../ExaHyPE/kernels/KernelUtils.h"
7
8template <class Shortcuts, int basisSize>
9class ContextCartesian: public Context<Shortcuts, basisSize> {
10
11public:
12 ContextCartesian(std::string& scenario_string, DomainInformation* info):
13 Context<Shortcuts, basisSize>(scenario_string, info) {
14 m_info = info;
15 };
16
18
19 virtual void initUnknownsPatch(
20 double* luh,
23 double t,
24 double dt
25 ) {
26
27 Shortcuts s;
28
29 constexpr int numberOfData = s.SizeVariables + s.SizeParameters;
30 kernels::idx3 id_xyz(basisSize, basisSize, basisSize);
31 kernels::idx4 id_xyzf(basisSize, basisSize, basisSize, numberOfData);
32
33 int num_nodes = basisSize;
34
35 double offset_x = center[0] - 0.5 * dx[0];
36 double offset_y = center[1] - 0.5 * dx[1];
37 double offset_z = center[2] - 0.5 * dx[2];
38
39 double width_x = dx[0];
40 double width_y = dx[1];
41 double width_z = dx[2];
42 std::fill_n(luh, basisSize * basisSize * basisSize * (s.SizeVariables + s.SizeParameters), 0);
43
44 for (int k = 0; k < basisSize; k++) {
45 for (int j = 0; j < basisSize; j++) {
46 for (int i = 0; i < basisSize; i++) {
47 double* Q = luh + id_xyzf(k, j, i, 0);
48 double x[3];
49 x[0] = (offset_x + width_x * kernels::legendre::nodes[basisSize - 1][i]);
50 x[1] = (offset_y + width_y * kernels::legendre::nodes[basisSize - 1][j]);
51 x[2] = (offset_z + width_z * kernels::legendre::nodes[basisSize - 1][k]);
52 this->scenario->initUnknownsPointwise(x, center, t, dt, Q);
53 }
54 }
55 }
56 };
58};
59
60#endif
And from this we can write down f$ nabla phi_i nabla phi_i dx but since we are constructing matrix let s investigate the f$ j
we integrate over each cell and then take the sum across each of the cells We also consider the terms that enter the f$ k
we integrate over each cell and then take the sum across each of the cells We also consider the terms that enter the f$ so we are integrating with f$ phi_k phi_k dx
virtual void initUnknownsPatch(double *luh, const tarch::la::Vector< Dimensions, double > &center, const tarch::la::Vector< Dimensions, double > &dx, double t, double dt)
ContextCartesian(std::string &scenario_string, DomainInformation *info)
DomainInformation * m_info
examples::exahype2::elastic::VariableShortcuts s
Definition loh.cpp:10
Simple vector class.
Definition Vector.h:134