Peano
Loading...
Searching...
No Matches
PatchToDoubleArray.template.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4
5#include "tarch/la/Vector.h"
6#include "tarch/mpi/mpi.h"
8
10#include "peano4/grid/grid.h"
11
16
17
18
27{% if FLOAT_TYPE=="std::float16_t" or FLOAT_TYPE=="std::bfloat16_t" %}
28#include <stdfloat>
29{% endif %}
30
31{% for item in NAMESPACE -%}
32 namespace {{ item }} {
33{%- endfor %}
34
35 class {{CLASSNAME}};
36
37{% for item in NAMESPACE -%}
38 }
39{%- endfor %}
40
41
42{{INCLUDES}}
43
44
45
46struct {{NAMESPACE | join("::")}}::{{CLASSNAME}} {
47 #if Parallel
48 private:
49 static MPI_Datatype Datatype;
50 public:
51 #endif
52 #if PeanoDebug>=1
53 private:
56
57
58 public:
59 void setDebugX( const tarch::la::Vector<Dimensions,double>& data );
60 void setDebugH( const tarch::la::Vector<Dimensions,double>& data );
63 #endif
64
65 #if Dimensions==2
66 alignas(AlignmentOnHeap) {{FLOAT_TYPE}} value[{{CARDINALITY_2D}}];
67 #else
68 alignas(AlignmentOnHeap) {{FLOAT_TYPE}} value[{{CARDINALITY_3D}}];
69 #endif
70
71 #if Dimensions==2
72 static constexpr int Cardinality = {{CARDINALITY_2D}};
73 #else
74 static constexpr int Cardinality = {{CARDINALITY_3D}};
75 #endif
76
77
78 enum ObjectConstruction {
79 NoData
80 };
81
82 {{CLASSNAME}}();
83 {{CLASSNAME}}( ObjectConstruction ):
84 {{CLASSNAME}}() {}
85 {{CLASSNAME}}(const {{CLASSNAME}}& other);
86 {{CLASSNAME}}& operator=(const {{CLASSNAME}}& other);
87
88 std::string toString() const;
89
90 {% if DATA_ASSOCIATION == 1 -%}
91 void merge(peano4::grid::TraversalObserver::SendReceiveContext context, const {{CLASSNAME}}& neighbour, const peano4::datamanagement::VertexMarker& marker, int spacetreeId);
92 bool send(
94 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, const {{arg[1]}}& {{arg[2]}} {% endfor %}
95 ) const;
96 bool receiveAndMerge(
98 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, const {{arg[1]}}& {{arg[2]}} {% endfor %}
99 ) const;
100 static ::peano4::grid::LoadStoreComputeFlag loadStoreComputeFlag(
102 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, const {{arg[1]}}& {{arg[2]}} {% endfor %}
103 );
104 {% endif -%}
105
106 {% if DATA_ASSOCIATION == 2 -%}
107 void merge(peano4::grid::TraversalObserver::SendReceiveContext context, const {{CLASSNAME}}& neighbour, const peano4::datamanagement::FaceMarker& marker, int spacetreeId);
108 bool send(
110 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, const {{arg[1]}}& {{arg[2]}} {% endfor %}
111 ) const;
112 bool receiveAndMerge(
114 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, const {{arg[1]}}& {{arg[2]}} {% endfor %}
115 ) const;
116 static ::peano4::grid::LoadStoreComputeFlag loadStoreComputeFlag(
118 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, const {{arg[1]}}& {{arg[2]}} {% endfor %}
119 );
120 {% endif -%}
121
122 {% if DATA_ASSOCIATION == 3 -%}
123 void merge(peano4::grid::TraversalObserver::SendReceiveContext context, const {{CLASSNAME}}& neighbour, const peano4::datamanagement::CellMarker& marker, int spacetreeId);
124 bool send(
126 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, const {{arg[1]}}& {{arg[2]}} {% endfor %}
127 ) const;
128 bool receiveAndMerge(
130 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, const {{arg[1]}}& {{arg[2]}} {% endfor %}
131 ) const;
132 static ::peano4::grid::LoadStoreComputeFlag loadStoreComputeFlag(
134 {% for arg in ADDITIONAL_LOAD_STORE_ARGUMENTS %}, const {{arg[1]}}& {{arg[2]}} {% endfor %}
135 );
136 {% endif -%}
137
143 tarch::la::Vector< Cardinality, {{FLOAT_TYPE}} > get() const;
144
145 {{FLOAT_TYPE}} get(int index) const;
146
151 void set( const tarch::la::Vector< Cardinality, {{FLOAT_TYPE}} >& );
152
153 void set(int index, {{FLOAT_TYPE}} value);
154
155 #ifdef Parallel
159 static void initDatatype();
160
164 static void shutdownDatatype();
165
173 static MPI_Datatype getForkDatatype();
174 static MPI_Datatype getJoinDatatype();
175 static MPI_Datatype getBoundaryExchangeDatatype();
176 static MPI_Datatype getMultiscaleDataExchangeDatatype();
177 static MPI_Datatype getGlobalCommunciationDatatype();
178 #endif
179};
180
#define AlignmentOnHeap
Definition LinuxAMD.h:23
std::string toString(exahype2::RefinementCommand value)
SendReceiveContext
There are three different scenarios when we merge data:
std::vector< GridControlEvent > merge(std::vector< GridControlEvent > events, const double Tolerance=0.1)
Merge set of refinement/coarsening commands.
Provide information about selected face.
Definition FaceMarker.h:35
Vertex marker to provide information about selected vertex.
Simple vector class.
Definition Vector.h:159