Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/***************************************************************************
CompressibleConservativeVariables.h - description
-------------------
begin : Feb 12, 2017
copyright : (C) 2017 by Tomas Oberhuber
email : tomas.oberhuber@fjfi.cvut.cz
***************************************************************************/
/* See Copyright Notice in tnl/Copyright */
#pragma once
#include <TNL/Functions/MeshFunction.h>
#include <TNL/Functions/VectorField.h>
#include <TNL/Pointers/SharedPointer.h>
namespace TNL {
template< typename Mesh >
class CompressibleConservativeVariables
{
public:
typedef Mesh MeshType;
static const int Dimensions = MeshType::getMeshDimension();
typedef typename MeshType::RealType RealType;
typedef typename MeshType::DeviceType DeviceType;
typedef typename MeshType::IndexType IndexType;
typedef Functions::MeshFunction< Mesh > MeshFunctionType;
typedef Functions::VectorField< Dimensions, MeshFunctionType > VelocityFieldType;
typedef Pointers::SharedPointer< MeshType > MeshPointer;
typedef Pointers::SharedPointer< MeshFunctionType > MeshFunctionPointer;
typedef Pointers::SharedPointer< VelocityFieldType > MomentumFieldPointer;
CompressibleConservativeVariables(){};
CompressibleConservativeVariables( const MeshPointer& meshPointer )
: density( meshPointer ),
momentum( meshPointer ),
//pressure( meshPointer ),
energy( meshPointer ){};
void setMesh( const MeshPointer& meshPointer )
{
this->density->setMesh( meshPointer );
this->momentum->setMesh( meshPointer );
//this->pressure.setMesh( meshPointer );
this->energy->setMesh( meshPointer );
}
template< typename Vector >
void bind( const MeshPointer& meshPointer,
const Vector& data,
IndexType offset = 0 )
{
IndexType currentOffset( offset );
this->density->bind( meshPointer, data, currentOffset );
currentOffset += this->density->getDofs( meshPointer );
for( IndexType i = 0; i < Dimensions; i++ )
{
( *this->momentum )[ i ]->bind( meshPointer, data, currentOffset );
currentOffset += ( *this->momentum )[ i ]->getDofs( meshPointer );
}
this->energy->bind( meshPointer, data, currentOffset );
}
IndexType getDofs( const MeshPointer& meshPointer ) const
{
return this->density->getDofs( meshPointer ) +
this->momentum->getDofs( meshPointer ) +
this->energy->getDofs( meshPointer );
}
MeshFunctionPointer& getDensity()
{
return this->density;
}
const MeshFunctionPointer& getDensity() const
{
return this->density;
}
void setDensity( MeshFunctionPointer& density )
{
this->density = density;
}
MomentumFieldPointer& getMomentum()
{
return this->momentum;
}
const MomentumFieldPointer& getMomentum() const
{
return this->momentum;
}
void setMomentum( MomentumFieldPointer& momentum )
{
this->momentum = momentum;
}
/*MeshFunctionPointer& getPressure()
{
return this->pressure;
}
const MeshFunctionPointer& getPressure() const
{
return this->pressure;
}
void setPressure( MeshFunctionPointer& pressure )
{
this->pressure = pressure;
}*/
MeshFunctionPointer& getEnergy()
{
return this->energy;
}
const MeshFunctionPointer& getEnergy() const
{
return this->energy;
}
void setEnergy( MeshFunctionPointer& energy )
{
this->energy = energy;
}
void getVelocityField( VelocityFieldType& velocityField )
{
}
protected:
MeshFunctionPointer density;
MomentumFieldPointer momentum;
MeshFunctionPointer energy;
};
} // namespace TN