Commit 4591fed4 authored by Jan Schäfer's avatar Jan Schäfer
Browse files

dodelano podle pressureGetter

parent e0921e8d
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -9,13 +9,12 @@ template< typename Mesh,
          typename Real = typename Mesh::RealType,
          typename Index = typename Mesh::IndexType >
class EulerPressureGetter
: public tnlDomain< Mesh::geMeshDimensions(), MeshDomain >
: public tnlDomain< Mesh::getMeshDimensions(), MeshDomain >
{
   public:
      
      typedef Mesh MeshType;
      typedef Real RealType;
      typedef Device DeviceType;
      typedef Index IndexType;
      typedef tnlMeshFunction< MeshType > MeshFunctionType;
      enum { Dimensions = MeshType::getMeshDimensions() };
+30 −185
Original line number Diff line number Diff line
@@ -3,213 +3,58 @@

#include <core/vectors/tnlVector.h>
#include <mesh/tnlGrid.h>
#include <functions/tnlDomain.h>

template< typename Mesh,
          typename Real = typename Mesh::RealType,
          typename Index = typename Mesh::IndexType >
class EulerPressureGetter
{
};

template< typename MeshReal,
          typename Device,
          typename MeshIndex,
          typename Real,
          typename Index >
class EulerPressureGetter< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index >
: public tnlDomain< Mesh::getMeshDimensions(), MeshDomain >
{
   public:
      typedef tnlGrid< 1, MeshReal, Device, MeshIndex > MeshType;
      typedef typename MeshType::CoordinatesType CoordinatesType;
      
      typedef Mesh MeshType;
      typedef Real RealType;
      typedef Device DeviceType;
//      typedef Device DeviceType;
      typedef Index IndexType;
      typedef tnlMeshFunction< MeshType > MeshFunctionType;
      enum { Dimensions = MeshType::getMeshDimensions() };

      static tnlString getType();
      Real gamma;
      MeshFunctionType& velocity;
      MeshFunctionType& rhoVel;
      MeshFunctionType& energy;

      void setGamma(const Real& gamma)
      {
          this->gamma = gamma;
      };

      void setVelocity(const MeshFunctionType& velocity)
      {
          this->velocity = velocity;
      };

      void setRhoVel(const MeshFunctionType& rhoVel)
      {
          this->rhoVel = rhoVel;
      };
      
      void setEnergy(const MeshFunctionType& energy)
      {
          this->energy = energy;
      };

      template< typename MeshFunction, typename MeshEntity >
      __cuda_callable__
      Real operator()( const MeshFunction& u,
                       const MeshEntity& entity,
                       const RealType& time = 0.0 ) const;
      EulerPressureGetter( const MeshFunctionType& velocity,
                           const MeshFunctionType& rhoVel,
                           const MeshFunctionType& energy,
                           const RealType& gamma )
      : velocity( velocity ), rhoVel( rhoVel ), energy( energy ), gamma( gamma )
      {}

      __cuda_callable__
      template< typename MeshEntity >
      Index getLinearSystemRowLength( const MeshType& mesh,
                                      const IndexType& index,
                                      const MeshEntity& entity ) const;

      template< typename MeshEntity, typename Vector, typename MatrixRow >
      __cuda_callable__
      void updateLinearSystem( const RealType& time,
                               const RealType& tau,
                               const MeshType& mesh,
                               const IndexType& index,
                               const MeshEntity& entity,
                               const MeshFunctionType& u,
                               Vector& b,
                               MatrixRow& matrixRow ) const;
};

template< typename MeshReal,
          typename Device,
          typename MeshIndex,
          typename Real,
          typename Index >
class EulerPressureGetter< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index >
{
   public:
      typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType;
      typedef typename MeshType::CoordinatesType CoordinatesType;
      typedef Real RealType;
      typedef Device DeviceType;
      typedef Index IndexType;
      typedef tnlMeshFunction< MeshType > MeshFunctionType;
      enum { Dimensions = MeshType::getMeshDimensions() };

      static tnlString getType();
      Real gamma;
      MeshFunctionType& velocity;
      MeshFunctionType& rhoVel;
      MeshFunctionType& energy;

      void setGamma(const Real& gamma)
      Real operator()( const MeshEntity& entity,
                       const RealType& time = 0.0 ) const
      {
          this->gamma = gamma;
      };

      void setVelocity(const MeshFunctionType& velocity)
      {
          this->velocity = velocity;
      };
         return this->operator[]( entity.getIndex() );
      }
      
      void setRhoVel(const MeshFunctionType& rhoVel)
      {
          this->rhoVel = rhoVel;
      };

      void setEnergy(const MeshFunctionType& energy)
      {
          this->energy = energy;
      };

      template< typename MeshFunction, typename MeshEntity >
      __cuda_callable__
      Real operator()( const MeshFunction& u,
                       const MeshEntity& entity,
                       const RealType& time = 0.0 ) const;

      __cuda_callable__
      template< typename MeshEntity >
      Index getLinearSystemRowLength( const MeshType& mesh,
                                      const IndexType& index,
                                      const MeshEntity& entity ) const;

      template< typename MeshEntity, typename Vector, typename MatrixRow >
      __cuda_callable__
      void updateLinearSystem( const RealType& time,
                               const RealType& tau,
                               const MeshType& mesh,
                               const IndexType& index,
                               const MeshEntity& entity,
                               const MeshFunctionType& u,
                               Vector& b,
                               MatrixRow& matrixRow ) const;
};

template< typename MeshReal,
          typename Device,
          typename MeshIndex,
          typename Real,
          typename Index >
class EulerPressureGetter< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index >
      Real operator[]( const IndexType& idx ) const
      {
   public:
      typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType;
      typedef typename MeshType::CoordinatesType CoordinatesType;
      typedef Real RealType;
      typedef Device DeviceType;
      typedef Index IndexType;
      typedef tnlMeshFunction< MeshType > MeshFunctionType;
      enum { Dimensions = MeshType::getMeshDimensions() };
         return ( this->gamma - 1.0 ) * ( this->energy[ idx ] - 0.5 * this->rhoVel[ idx ] * this->velocity[ idx ]);
      }

      static tnlString getType();
      Real gamma;
      MeshFunctionType& velocity;
      MeshFunctionType& rhoVel;
      MeshFunctionType& energy;
      
      void setGamma(const Real& gamma)
      {
          this->gamma = gamma;
      };
   protected:
      
      void setVelocity(const MeshFunctionType& velocity)
      {
          this->velocity = velocity;
      };
      Real gamma;
      
      void setRhoVel(const MeshFunctionType& rhoVel)
      {
          this->rhoVel = rhoVel;
      };
      const MeshFunctionType& velocity;
      
      void setEnergy(const MeshFunctionType& energy)
      {
          this->energy = energy;
      };

      template< typename MeshFunction, typename MeshEntity >
      __cuda_callable__
      Real operator()( const MeshFunction& u,
                       const MeshEntity& entity,
                       const RealType& time = 0.0 ) const;
      const MeshFunctionType& rhoVel;
      
      __cuda_callable__
      template< typename MeshEntity >
      Index getLinearSystemRowLength( const MeshType& mesh,
                                      const IndexType& index,
                                      const MeshEntity& entity ) const;
      const MeshFunctionType& energy;

      template< typename MeshEntity, typename Vector, typename MatrixRow >
      __cuda_callable__
      void updateLinearSystem( const RealType& time,
                               const RealType& tau,
                               const MeshType& mesh,
                               const IndexType& index,
                               const MeshEntity& entity,
                               const MeshFunctionType& u,
                               Vector& b,
                               MatrixRow& matrixRow ) const;
};


#include "EulerPressureGetter_impl.h"

#endif	/* EulerPressureGetter_H */
+22 −151
Original line number Diff line number Diff line
@@ -8,174 +8,45 @@ template< typename Mesh,
          typename Real = typename Mesh::RealType,
          typename Index = typename Mesh::IndexType >
class EulerVelGetter
{
};

template< typename MeshReal,
          typename Device,
          typename MeshIndex,
          typename Real,
          typename Index >
class EulerVelGetter< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index >
: public tnlDomain< Mesh::getMeshDimensions(), MeshDomain >
{
   public:
      typedef tnlGrid< 1, MeshReal, Device, MeshIndex > MeshType;
      typedef typename MeshType::CoordinatesType CoordinatesType;
      
      typedef Mesh MeshType;
      typedef Real RealType;
      typedef Device DeviceType;
      typedef Index IndexType;
      typedef tnlMeshFunction< MeshType > MeshFunctionType;
      enum { Dimensions = MeshType::getMeshDimensions() };

      static tnlString getType();
      MeshFunctionType rhoVel;
      MeshFunctionType rho;

      void setRhoVel(const MeshFunctionType& rhoVel)
      {
          this->rhoVel = rhoVel;
      };
      
      void setRho(const MeshFunctionType& rho)
      {
          this->rho = rho;
      };

      template< typename MeshFunction, typename MeshEntity >
      __cuda_callable__
      Real operator()( const MeshFunction& u,
                       const MeshEntity& entity,
                       const RealType& time = 0.0 ) const;
      EulerVelGetter( const MeshFunctionType& rho,
                      const MeshFunctionType& rhoVel)
      : rho( rho ), rhoVel( rhoVel )
      {}

      __cuda_callable__
      template< typename MeshEntity >
      Index getLinearSystemRowLength( const MeshType& mesh,
                                      const IndexType& index,
                                      const MeshEntity& entity ) const;

      template< typename MeshEntity, typename Vector, typename MatrixRow >
      __cuda_callable__
      void updateLinearSystem( const RealType& time,
                               const RealType& tau,
                               const MeshType& mesh,
                               const IndexType& index,
                               const MeshEntity& entity,
                               const MeshFunctionType& u,
                               Vector& b,
                               MatrixRow& matrixRow ) const;
};

template< typename MeshReal,
          typename Device,
          typename MeshIndex,
          typename Real,
          typename Index >
class EulerVelGetter< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index >
      Real operator()( const MeshEntity& entity,
                       const RealType& time = 0.0 ) const
      {
   public:
      typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType;
      typedef typename MeshType::CoordinatesType CoordinatesType;
      typedef Real RealType;
      typedef Device DeviceType;
      typedef Index IndexType;
      typedef tnlMeshFunction< MeshType > MeshFunctionType;
      enum { Dimensions = MeshType::getMeshDimensions() };
         return this->operator[]( entity.getIndex() );
      }
      
      static tnlString getType();
      MeshFunctionType rhoVel;
      MeshFunctionType rho;

      void setRhoVel(const MeshFunctionType& rhoVel)
      {
          this->rhoVel = rhoVel;
      };

      void setRho(const MeshFunctionType& rho)
      {
          this->rho = rho;
      };


      template< typename MeshFunction, typename MeshEntity >
      __cuda_callable__
      Real operator()( const MeshFunction& u,
                       const MeshEntity& entity,
                       const RealType& time = 0.0 ) const;

      __cuda_callable__
      template< typename MeshEntity >
      Index getLinearSystemRowLength( const MeshType& mesh,
                                      const IndexType& index,
                                      const MeshEntity& entity ) const;

      template< typename MeshEntity, typename Vector, typename MatrixRow >
      __cuda_callable__
      void updateLinearSystem( const RealType& time,
                               const RealType& tau,
                               const MeshType& mesh,
                               const IndexType& index,
                               const MeshEntity& entity,
                               const MeshFunctionType& u,
                               Vector& b,
                               MatrixRow& matrixRow ) const;
};

template< typename MeshReal,
          typename Device,
          typename MeshIndex,
          typename Real,
          typename Index >
class EulerVelGetter< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index >
{
   public:
      typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType;
      typedef typename MeshType::CoordinatesType CoordinatesType;
      typedef Real RealType;
      typedef Device DeviceType;
      typedef Index IndexType;
      typedef tnlMeshFunction< MeshType > MeshFunctionType;
      enum { Dimensions = MeshType::getMeshDimensions() };

      static tnlString getType();
      MeshFunctionType rhoVel;
      MeshFunctionType rho;

      void setRhoVel(const MeshFunctionType& rhoVel)
      Real operator[]( const IndexType& idx ) const
      {
          this->rhoVel = rhoVel;
      };
         return this->rho[ idx ] / this->rhoVel[ idx ];
      }

      void setRho(const MeshFunctionType& rho)
      {
          this->rho = rho;
      };
      
   protected:
      
      template< typename MeshFunction, typename MeshEntity >
      __cuda_callable__
      Real operator()( const MeshFunction& u,
                       const MeshEntity& entity,
                       const RealType& time = 0.0 ) const;
      const MeshFunctionType& rho;
      
      __cuda_callable__
      template< typename MeshEntity >
      Index getLinearSystemRowLength( const MeshType& mesh,
                                      const IndexType& index,
                                      const MeshEntity& entity ) const;
      const MeshFunctionType& rhoVel;

      template< typename MeshEntity, typename Vector, typename MatrixRow >
      __cuda_callable__
      void updateLinearSystem( const RealType& time,
                               const RealType& tau,
                               const MeshType& mesh,
                               const IndexType& index,
                               const MeshEntity& entity,
                               const MeshFunctionType& u,
                               Vector& b,
                               MatrixRow& matrixRow ) const;
};


#include "EulerVelGetter_impl.h"

#endif	/* EulerVelGetter_H */
+22 −151
Original line number Diff line number Diff line
@@ -8,174 +8,45 @@ template< typename Mesh,
          typename Real = typename Mesh::RealType,
          typename Index = typename Mesh::IndexType >
class EulerVelGetter
{
};

template< typename MeshReal,
          typename Device,
          typename MeshIndex,
          typename Real,
          typename Index >
class EulerVelGetter< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index >
: public tnlDomain< Mesh::getMeshDimensions(), MeshDomain >
{
   public:
      typedef tnlGrid< 1, MeshReal, Device, MeshIndex > MeshType;
      typedef typename MeshType::CoordinatesType CoordinatesType;
      
      typedef Mesh MeshType;
      typedef Real RealType;
      typedef Device DeviceType;
      typedef Index IndexType;
      typedef tnlMeshFunction< MeshType > MeshFunctionType;
      enum { Dimensions = MeshType::getMeshDimensions() };

      static tnlString getType();
      MeshFunctionType rhoVel;
      MeshFunctionType rho;

      void setRhoVel(const MeshFunctionType& rhoVel)
      {
          this->rhoVel = rhoVel;
      };
      
      void setRho(const MeshFunctionType& rho)
      {
          this->rho = rho;
      };

      template< typename MeshFunction, typename MeshEntity >
      __cuda_callable__
      Real operator()( const MeshFunction& u,
                       const MeshEntity& entity,
                       const RealType& time = 0.0 ) const;
      EulerVelGetter( const MeshFunctionType& rho,
                      const MeshFunctionType& rhoVel)
      : rho( rho ), rhoVel( rhoVel )
      {}

      __cuda_callable__
      template< typename MeshEntity >
      Index getLinearSystemRowLength( const MeshType& mesh,
                                      const IndexType& index,
                                      const MeshEntity& entity ) const;

      template< typename MeshEntity, typename Vector, typename MatrixRow >
      __cuda_callable__
      void updateLinearSystem( const RealType& time,
                               const RealType& tau,
                               const MeshType& mesh,
                               const IndexType& index,
                               const MeshEntity& entity,
                               const MeshFunctionType& u,
                               Vector& b,
                               MatrixRow& matrixRow ) const;
};

template< typename MeshReal,
          typename Device,
          typename MeshIndex,
          typename Real,
          typename Index >
class EulerVelGetter< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index >
      Real operator()( const MeshEntity& entity,
                       const RealType& time = 0.0 ) const
      {
   public:
      typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType;
      typedef typename MeshType::CoordinatesType CoordinatesType;
      typedef Real RealType;
      typedef Device DeviceType;
      typedef Index IndexType;
      typedef tnlMeshFunction< MeshType > MeshFunctionType;
      enum { Dimensions = MeshType::getMeshDimensions() };
         return this->operator[]( entity.getIndex() );
      }
      
      static tnlString getType();
      MeshFunctionType rhoVel;
      MeshFunctionType rho;

      void setRhoVel(const MeshFunctionType& rhoVel)
      {
          this->rhoVel = rhoVel;
      };

      void setRho(const MeshFunctionType& rho)
      {
          this->rho = rho;
      };


      template< typename MeshFunction, typename MeshEntity >
      __cuda_callable__
      Real operator()( const MeshFunction& u,
                       const MeshEntity& entity,
                       const RealType& time = 0.0 ) const;

      __cuda_callable__
      template< typename MeshEntity >
      Index getLinearSystemRowLength( const MeshType& mesh,
                                      const IndexType& index,
                                      const MeshEntity& entity ) const;

      template< typename MeshEntity, typename Vector, typename MatrixRow >
      __cuda_callable__
      void updateLinearSystem( const RealType& time,
                               const RealType& tau,
                               const MeshType& mesh,
                               const IndexType& index,
                               const MeshEntity& entity,
                               const MeshFunctionType& u,
                               Vector& b,
                               MatrixRow& matrixRow ) const;
};

template< typename MeshReal,
          typename Device,
          typename MeshIndex,
          typename Real,
          typename Index >
class EulerVelGetter< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index >
{
   public:
      typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType;
      typedef typename MeshType::CoordinatesType CoordinatesType;
      typedef Real RealType;
      typedef Device DeviceType;
      typedef Index IndexType;
      typedef tnlMeshFunction< MeshType > MeshFunctionType;
      enum { Dimensions = MeshType::getMeshDimensions() };

      static tnlString getType();
      MeshFunctionType rhoVel;
      MeshFunctionType rho;

      void setRhoVel(const MeshFunctionType& rhoVel)
      Real operator[]( const IndexType& idx ) const
      {
          this->rhoVel = rhoVel;
      };
         return this->rho[ idx ] / this->rhoVel[ idx ];
      }

      void setRho(const MeshFunctionType& rho)
      {
          this->rho = rho;
      };
      
   protected:
      
      template< typename MeshFunction, typename MeshEntity >
      __cuda_callable__
      Real operator()( const MeshFunction& u,
                       const MeshEntity& entity,
                       const RealType& time = 0.0 ) const;
      const MeshFunctionType& rho;
      
      __cuda_callable__
      template< typename MeshEntity >
      Index getLinearSystemRowLength( const MeshType& mesh,
                                      const IndexType& index,
                                      const MeshEntity& entity ) const;
      const MeshFunctionType& rhoVel;

      template< typename MeshEntity, typename Vector, typename MatrixRow >
      __cuda_callable__
      void updateLinearSystem( const RealType& time,
                               const RealType& tau,
                               const MeshType& mesh,
                               const IndexType& index,
                               const MeshEntity& entity,
                               const MeshFunctionType& u,
                               Vector& b,
                               MatrixRow& matrixRow ) const;
};


#include "EulerVelGetter_impl.h"

#endif	/* EulerVelGetter_H */
+0 −342

File deleted.

Preview size limit exceeded, changes collapsed.

Loading