Newer
Older

Jan Schäfer
committed
/***************************************************************************
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>

Jan Schäfer
committed
#include <TNL/Pointers/SharedPointer.h>

Jan Schäfer
committed
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;

Jan Schäfer
committed
typedef Pointers::SharedPointer< MeshType > MeshPointer;
typedef Pointers::SharedPointer< MeshFunctionType > MeshFunctionPointer;
typedef Pointers::SharedPointer< VelocityFieldType > MomentumFieldPointer;

Jan Schäfer
committed
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(){};
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__

Jan Schäfer
committed
MeshFunctionPointer& getDensity()
{
return this->density;
}
Jakub Klinkovský
committed
__cuda_callable__

Jan Schäfer
committed
const MeshFunctionPointer& getDensity() const
{
return this->density;
}
void setDensity( MeshFunctionPointer& density )
{
this->density = density;
}
Jakub Klinkovský
committed
__cuda_callable__

Jan Schäfer
committed
MomentumFieldPointer& getMomentum()
{
return this->momentum;
}
Jakub Klinkovský
committed
__cuda_callable__

Jan Schäfer
committed
const MomentumFieldPointer& getMomentum() const
{
return this->momentum;
}
void setMomentum( MomentumFieldPointer& momentum )
{
this->momentum = momentum;
}
Jakub Klinkovský
committed
/*
__cuda_callable__
MeshFunctionPointer& getPressure()

Jan Schäfer
committed
{
return this->pressure;
}
Jakub Klinkovský
committed
__cuda_callable__

Jan Schäfer
committed
const MeshFunctionPointer& getPressure() const
{
return this->pressure;
}
void setPressure( MeshFunctionPointer& pressure )
{
this->pressure = pressure;
}*/
Jakub Klinkovský
committed
__cuda_callable__

Jan Schäfer
committed
MeshFunctionPointer& getEnergy()
{
return this->energy;
}
Jakub Klinkovský
committed
__cuda_callable__

Jan Schäfer
committed
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