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
/***************************************************************************
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 );
}
Jakub Klinkovský
committed
__cuda_callable__
MeshFunctionPointer& getDensity()
{
return this->density;
}
Jakub Klinkovský
committed
__cuda_callable__
const MeshFunctionPointer& getDensity() const
{
return this->density;
}
void setDensity( MeshFunctionPointer& density )
{
this->density = density;
}
Jakub Klinkovský
committed
__cuda_callable__
MomentumFieldPointer& getMomentum()
{
return this->momentum;
}
Jakub Klinkovský
committed
__cuda_callable__
const MomentumFieldPointer& getMomentum() const
{
return this->momentum;
}
void setMomentum( MomentumFieldPointer& momentum )
{
this->momentum = momentum;
}
Jakub Klinkovský
committed
/*
__cuda_callable__
MeshFunctionPointer& getPressure()
{
return this->pressure;
}
Jakub Klinkovský
committed
__cuda_callable__
const MeshFunctionPointer& getPressure() const
{
return this->pressure;
}
void setPressure( MeshFunctionPointer& pressure )
{
this->pressure = pressure;
}*/
Jakub Klinkovský
committed
__cuda_callable__
MeshFunctionPointer& getEnergy()
{
return this->energy;
}
Jakub Klinkovský
committed
__cuda_callable__
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;
};
Jakub Klinkovský
committed
} // namespace TNL