Commit fec4c09b authored by Tomas Sobotik's avatar Tomas Sobotik
Browse files

Minor changes to generalized schemes.

parent d18aba48
Loading
Loading
Loading
Loading
+23 −22
Original line number Diff line number Diff line
@@ -52,13 +52,7 @@ class tnlSDFGridValue< Mesh, 1, Real > : public tnlSDFGridValueBase< Real >
	typedef typename Mesh::IndexType IndexType;
	typedef tnlVector< RealType2, DeviceType, IndexType> DofVectorType;
   typedef typename Mesh::CoordinatesType CoordinatesType;
   VertexType origin;
   RealType2 hx;
   Mesh mesh;
   DofVectorType u;

   void bind( const Mesh& mesh,
	          DofVectorType& dofVector );
   bool setup( const tnlParameterContainer& parameters,
           const tnlString& prefix = ""  );

@@ -78,6 +72,13 @@ class tnlSDFGridValue< Mesh, 1, Real > : public tnlSDFGridValueBase< Real >
           const Real& time = 0.0  ) const;
#endif

   private:

   VertexType origin;
   RealType2 hx;
   Mesh mesh;
   DofVectorType u;

};

template< typename Mesh, typename Real >
@@ -93,15 +94,7 @@ class tnlSDFGridValue< Mesh, 2, Real > : public tnlSDFGridValueBase< Real >
	typedef typename Mesh::IndexType IndexType;
	typedef tnlVector< RealType2, DeviceType, IndexType> DofVectorType;
   typedef typename Mesh::CoordinatesType CoordinatesType;
   CoordinatesType dimensions;
   VertexType origin;
   RealType2 hx, hy;
   Mesh mesh;
   DofVectorType u;


   void bind( const Mesh& mesh,
	          DofVectorType& dofVector );
   bool setup( const tnlParameterContainer& parameters,
           const tnlString& prefix = ""  );

@@ -121,6 +114,14 @@ class tnlSDFGridValue< Mesh, 2, Real > : public tnlSDFGridValueBase< Real >
           const Real& time = 0.0  ) const;
#endif

   private:

   CoordinatesType dimensions;
   VertexType origin;
   RealType2 hx, hy;
   Mesh mesh;
   DofVectorType u;

};

template< typename Mesh, typename Real >
@@ -136,15 +137,7 @@ class tnlSDFGridValue< Mesh, 3, Real > : public tnlSDFGridValueBase< Real >
	typedef typename Mesh::IndexType IndexType;
	typedef tnlVector< RealType2, DeviceType, IndexType> DofVectorType;
   typedef typename Mesh::CoordinatesType CoordinatesType;
   CoordinatesType dimensions;
   VertexType origin;
   RealType2 hx, hy, hz;
   Mesh mesh;
   DofVectorType u;


   void bind( const Mesh& mesh,
	          DofVectorType& dofVector );
   bool setup( const tnlParameterContainer& parameters,
           const tnlString& prefix = ""  );

@@ -164,6 +157,14 @@ class tnlSDFGridValue< Mesh, 3, Real > : public tnlSDFGridValueBase< Real >
           const Real& time = 0.0  ) const;
#endif

   private:

   CoordinatesType dimensions;
   VertexType origin;
   RealType2 hx, hy, hz;
   Mesh mesh;
   DofVectorType u;

};

#include <implementation/functions/tnlSDFGridValue_impl.h>
+14 −60
Original line number Diff line number Diff line
@@ -31,8 +31,6 @@ bool tnlSDFGridValue< Mesh, 1, Real >::setup( const tnlParameterContainer& param
{
   this->mesh.load(parameters.GetParameter< tnlString >( "mesh" ));
   this->u.load(parameters.GetParameter< tnlString >( "initial-condition" ));
	   this->origin=this->mesh.getOrigin();
	   this->hx=this->mesh.getHx();
   return true;
}
template< typename Mesh, typename Real >
@@ -41,10 +39,6 @@ bool tnlSDFGridValue< Mesh, 2, Real >::setup( const tnlParameterContainer& param
{
   this->mesh.load(parameters.GetParameter< tnlString >( "mesh" ));
   this->u.load(parameters.GetParameter< tnlString >( "initial-condition" ));
	   this->dimensions=this->mesh.getDimensions();
	   this->origin=this->mesh.getOrigin();
	   this->hx=this->mesh.getHx();
	   this->hy=this->mesh.getHy();
   return true;
}
template< typename Mesh, typename Real >
@@ -53,49 +47,9 @@ bool tnlSDFGridValue< Mesh, 3, Real >::setup( const tnlParameterContainer& param
{
   this->mesh.load(parameters.GetParameter< tnlString >( "mesh" ));
   this->u.load(parameters.GetParameter< tnlString >( "initial-condition" ));
	   this->dimensions=this->mesh.getDimensions();
	   this->origin=this->mesh.getOrigin();
	   this->hx=this->mesh.getHx();
	   this->hy=this->mesh.getHy();
	   this->hz=this->mesh.getHz();
   return true;
}

template< typename Mesh, typename Real >
void tnlSDFGridValue< Mesh, 1, Real >::bind( const Mesh& mesh,
        									  DofVectorType& dofVector )
{
	   const IndexType dofs = mesh.getNumberOfCells();
	   this->u.bind( dofVector.getData(), dofs );
	   this->origin=mesh.getOrigin();
	   this->hx=mesh.getHx();

}

template< typename Mesh, typename Real >
void tnlSDFGridValue< Mesh, 2, Real >::bind( const Mesh& mesh,
        									  DofVectorType& dofVector )
{
	   const IndexType dofs = mesh.getNumberOfCells();
	   this->u.bind( dofVector.getData(), dofs );
	   this->dimensions=mesh.getDimensions();
	   this->origin=mesh.getOrigin();
	   this->hx=mesh.getHx();
	   this->hy=mesh.getHy();
}

template< typename Mesh, typename Real >
void tnlSDFGridValue< Mesh, 3, Real >::bind( const Mesh& mesh,
        									  DofVectorType& dofVector )
{
	   const IndexType dofs = mesh.getNumberOfCells();
	   this->u.bind( dofVector.getData(), dofs );
	   this->dimensions=mesh.getDimensions();
	   this->origin=mesh.getOrigin();
	   this->hx=mesh.getHx();
	   this->hy=mesh.getHy();
	   this->hz=mesh.getHz();
}


template< typename Mesh, typename Real >
@@ -107,7 +61,7 @@ Real tnlSDFGridValue< Mesh, 1, Real >::getValue( const Vertex& v,
        									const Real& time) const
{

   const Real& x =  (v.x() - this->origin.x()  ) / this->hx;
   const Real& x =  (v.x() - this->mesh.getOrigin().x()  ) / this->mesh.getHx();

   if( XDiffOrder != 0 || YDiffOrder != 0 || ZDiffOrder != 0 )
      return 0.0;
@@ -125,13 +79,13 @@ Real tnlSDFGridValue< Mesh, 2, Real >::getValue( const Vertex& v,
        									const Real& time) const
{

	   const IndexType& x = ((v.x() - this->origin.x()) / this->hx);
	   const IndexType& y = ((v.y() - this->origin.y()) / this->hy);
	   const IndexType& x = ((v.x() - this->mesh.getOrigin().x()) / this->mesh.getHx());
	   const IndexType& y = ((v.y() - this->mesh.getOrigin().y()) / this->mesh.getHy());

	   if( XDiffOrder != 0 || YDiffOrder != 0 || ZDiffOrder != 0 )
	      return 0.0;
	   else
		   return u[y * this->dimensions.x() + x];
		   return u[y * this->mesh.getDimensions().x() + x];
}

template< typename Mesh, typename Real >
@@ -142,13 +96,13 @@ template< typename Mesh, typename Real >
Real tnlSDFGridValue< Mesh, 3, Real >::getValue( const Vertex& v,
        									const Real& time) const
{
	   const Real& x = floor( (v.x() - this->origin.x()) / this->hx);
	   const Real& y = floor( (v.y() - this->origin.y()) / this->hy);
	   const Real& z = floor( (v.z() - this->origin.z()) / this->hz);
	   const Real& x = floor( (v.x() - this->mesh.getOrigin().x()) / this->mesh.getHx());
	   const Real& y = floor( (v.y() - this->mesh.getOrigin().y()) / this->mesh.getHy());
	   const Real& z = floor( (v.z() - this->mesh.getOrigin().z()) / this->mesh.getHz());
	   if( XDiffOrder != 0 || YDiffOrder != 0 || ZDiffOrder != 0 )
	      return 0.0;
	   else
		   return u[( z * this->dimensions.y() + y ) * this->dimensions.x() + x];
		   return u[( z * this->mesh.getDimensions().y() + y ) * this->mesh.getDimensions().x() + x];
}

#endif /* TNLSDFGRIDVALUE_IMPL_H_ */
+0 −2
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ setBoundaryConditions( const RealType& time,
                       DofVectorType& u,
                       DofVectorType& fu )
{
   //fu[ index ] = 0;
	tmp = coordinates;

   if(coordinates.x() == 0)
@@ -121,7 +120,6 @@ setBoundaryConditions( const RealType& time,
                       DofVectorType& u,
                       DofVectorType& fu )
{
   //fu[ index ] = 0;
	tmp = coordinates;

   if(coordinates.x() == 0)
+0 −15
Original line number Diff line number Diff line
@@ -63,11 +63,6 @@ public:

	RealType sign(const RealType x, const RealType eps) const;

/*	void GetExplicitRHS( const RealType& time,
                        const RealType& tau,
                        DofVectorType& _u,
                        DofVectorType& _fu );*/

    template< typename Vector >
 #ifdef HAVE_CUDA
    __device__ __host__
@@ -123,11 +118,6 @@ public:

    RealType sign(const RealType x, const Real eps) const;

/*    void GetExplicitRHS( const RealType& time,
                         const RealType& tau,
                         DofVectorType& _u,
                         DofVectorType& _fu );*/

    template< typename Vector >
 #ifdef HAVE_CUDA
    __device__ __host__
@@ -181,11 +171,6 @@ public:

    RealType sign(const RealType x, const Real eps) const;

/*    void GetExplicitRHS( const RealType& time,
                         const RealType& tau,
                         DofVectorType& _u,
                         DofVectorType& _fu );*/

    template< typename Vector >
 #ifdef HAVE_CUDA
    __device__ __host__
+0 −15
Original line number Diff line number Diff line
@@ -64,11 +64,6 @@ public:

	RealType sign(const RealType x, const RealType eps) const;

/*	void GetExplicitRHS( const RealType& time,
                        const RealType& tau,
                        DofVectorType& _u,
                        DofVectorType& _fu );*/

    template< typename Vector >
 #ifdef HAVE_CUDA
    __device__ __host__
@@ -128,11 +123,6 @@ public:

    RealType sign(const RealType x, const Real eps) const;

/*    void GetExplicitRHS( const RealType& time,
                         const RealType& tau,
                         DofVectorType& _u,
                         DofVectorType& _fu );*/

    template< typename Vector >
 #ifdef HAVE_CUDA
    __device__ __host__
@@ -191,11 +181,6 @@ public:

    RealType sign(const RealType x, const Real eps) const;

/*    void GetExplicitRHS( const RealType& time,
                         const RealType& tau,
                         DofVectorType& _u,
                         DofVectorType& _fu );*/

    template< typename Vector >
 #ifdef HAVE_CUDA
    __device__ __host__
Loading