Commit 989e6482 authored by Jan Schäfer's avatar Jan Schäfer
Browse files

dodelano 2d nejde MeahFunction.bind()

parent 2cac5acd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ class EulerPressureGetter

      static tnlString getType();
      
      EulerPressureGetter( const MeshFunctionType& velocity,
      EulerPressureGetter( const MeshFunctionType& rho,
                           const MeshFunctionType& rhoVel,
                           const MeshFunctionType& energy,
                           const RealType& gamma )
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ class EulerVelGetter
      __cuda_callable__
      Real operator[]( const IndexType& idx ) const
      {
         return this->rho[ idx ] / this->rhoVel[ idx ];
         return this->rhoVel[ idx ] / this->rho[ idx ];
      }

      
+3 −3
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ class LaxFridrichsContinuity< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, In

      void setVelocity(const MeshFunctionType velocity)
      {
          //this->velocity = velocity;
          velocity.bind( velocity );
      };

      template< typename MeshFunction, typename MeshEntity >
@@ -92,7 +92,7 @@ class LaxFridrichsContinuity< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, In

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


@@ -147,7 +147,7 @@ class LaxFridrichsContinuity< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, In

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


+6 −6
Original line number Diff line number Diff line
@@ -275,20 +275,20 @@ getExplicitRHS( const RealType& time,
   this->bindDofs( mesh, _u );
   lF1DContinuity.setTau(tau);
   lF1DContinuity.setVelocity(velocity);
   /*tnlExplicitUpdater< Mesh, MeshFunctionType, Continuity, BoundaryCondition, RightHandSide > explicitUpdaterContinuity;
   tnlExplicitUpdater< Mesh, MeshFunctionType, Continuity, BoundaryCondition, RightHandSide > explicitUpdaterContinuity;
   explicitUpdaterContinuity.template update< typename Mesh::Cell >( time,
                                                           mesh,
                                                           lF1DContinuity,
                                                           this->boundaryCondition,
                                                           this->rightHandSide,
                                                           uRho,
                                                           fuRho );*/
                                                           fuRho );

   cout << "explicitRHSrhovel" << endl;
   //rhoVelocity
   lF1DMomentum.setTau(tau);
   lF1DMomentum.setVelocity(velocity);
   lF1DMomentum.setPressure(pressure);
   //lF1DMomentum.setVelocity(velocity);
   //lF1DMomentum.setPressure(pressure);
   tnlExplicitUpdater< Mesh, MeshFunctionType, Momentum, BoundaryCondition, RightHandSide > explicitUpdaterMomentum;
   explicitUpdaterMomentum.template update< typename Mesh::Cell >( time,
                                                           mesh,
@@ -301,8 +301,8 @@ getExplicitRHS( const RealType& time,
   cout << "explicitRHSenergy" << endl;
   //energy
   lF1DEnergy.setTau(tau);
   lF1DEnergy.setPressure(pressure);
   lF1DEnergy.setVelocity(velocity);
   //lF1DEnergy.setPressure(pressure);
   //lF1DEnergy.setVelocity(velocity);
   tnlExplicitUpdater< Mesh, MeshFunctionType, Energy, BoundaryCondition, RightHandSide > explicitUpdaterEnergy;
   explicitUpdaterEnergy.template update< typename Mesh::Cell >( time,
                                                           mesh,
+32 −188
Original line number Diff line number Diff line
@@ -3,216 +3,60 @@

#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 Index IndexType;
      typedef tnlMeshFunction< MeshType > MeshFunctionType;
      enum { Dimensions = MeshType::getMeshDimensions() };

      static tnlString getType();
      Real gamma;
      MeshFunctionType velocity;
      MeshFunctionType rho;
      MeshFunctionType energy;
      
      void setGamma(const Real& gamma)
      {
          this->gamma = gamma;
      };

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

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

      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& rho,
                           const MeshFunctionType& rhoVelX,
                           const MeshFunctionType& rhoVelY,
                           const MeshFunctionType& energy,
                           const RealType& gamma )
      : rho( rho ), rhoVelX( rhoVelX ), rhoVelY( rhoVelY ), 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 rho;
      MeshFunctionType energy;

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

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

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

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

         return this->operator[]( entity.getIndex() );
      }
      
      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->rho[ idx ] * 
         ( this->rhoVelX[ idx ] / this->rho[ idx ] + this->rhoVelY[ idx ] / this->rho[ idx ]) );
      }

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

      void setRho(const MeshFunctionType& rho)
      {
          this->rho = rho;
      };
      Real gamma;
      
      void setEnergy(const MeshFunctionType& energy)
      {
          this->energy = energy;
      };
      const MeshFunctionType& rho;
      
      const MeshFunctionType& rhoVelX;
      
      template< typename MeshFunction, typename MeshEntity >
      __cuda_callable__
      Real operator()( const MeshFunction& u,
                       const MeshEntity& entity,
                       const RealType& time = 0.0 ) const;
      const MeshFunctionType& rhoVelY;

      __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 */
Loading