Commit ef15d04e authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Small refactoring of the code.

parent da94aef3
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -19,8 +19,8 @@
#define TNL_HEAT_EQUATION_EOC_H_

#include <solvers/tnlSolver.h>
#include <solvers/tnlFastBuildConfig.h>
#include <solvers/tnlConfigTags.h>
#include <solvers/tnlFastBuildConfigTag.h>
#include <solvers/tnlBuildConfigTags.h>
#include <functors/tnlTestFunction.h>
#include <operators/diffusion/tnlLinearDiffusion.h>
#include <operators/diffusion/tnlExactLinearDiffusion.h>
@@ -28,7 +28,7 @@
#include <problems/tnlHeatEquationEocRhs.h>
#include <problems/tnlHeatEquationEocProblem.h>

//typedef tnlDefaultConfigTag BuildConfig;
//typedef tnlDefaultBuildConfigTag BuildConfig;
typedef tnlFastBuildConfig BuildConfig;

template< typename ConfigTag >
+4 −5
Original line number Diff line number Diff line
@@ -19,8 +19,8 @@
#define TNL_HEAT_EQUATION_H_

#include <solvers/tnlSolver.h>
#include <solvers/tnlFastBuildConfig.h>
#include <solvers/tnlConfigTags.h>
#include <solvers/tnlFastBuildConfigTag.h>
#include <solvers/tnlBuildConfigTags.h>
#include <operators/diffusion/tnlLinearDiffusion.h>
#include <operators/tnlAnalyticDirichletBoundaryConditions.h>
#include <operators/tnlDirichletBoundaryConditions.h>
@@ -29,7 +29,7 @@
#include <functors/tnlConstantFunction.h>
#include <problems/tnlHeatEquationProblem.h>

//typedef tnlDefaultConfigTag BuildConfig;
//typedef tnlDefaultBuildConfigTag BuildConfig;
typedef tnlFastBuildConfig BuildConfig;

template< typename ConfigTag >
@@ -106,8 +106,7 @@ class heatEquationSetter

int main( int argc, char* argv[] )
{
   tnlSolver< heatEquationSetter, heatEquationConfig, BuildConfig > solver;
   if( ! solver. run( argc, argv ) )
   if( ! tnlSolver< heatEquationSetter, heatEquationConfig, BuildConfig >::run( argc, argv ) )
      return EXIT_FAILURE;
   return EXIT_SUCCESS;
}
+2 −2
Original line number Diff line number Diff line
@@ -282,8 +282,8 @@ typename Operation :: IndexType reduceOnCudaDevice( const Operation& operation,
   typedef typename Operation :: RealType RealType;
   typedef typename Operation :: ResultType ResultType;

   const IndexType desBlockSize( 512 );
   const IndexType desGridSize( 2048 );
   const IndexType desBlockSize( 256 );
   const IndexType desGridSize( 65536 );
   dim3 blockSize( 0 ), gridSize( 0 );

   /***
+5 −3
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ class tnlHeatEquationProblem : public tnlPDEProblem< Mesh,

      using typename BaseType::MeshType;
      using typename BaseType::DofVectorType;
      using typename BaseType::MeshDependentDataType;

      static tnlString getTypeStatic();

@@ -55,7 +56,7 @@ class tnlHeatEquationProblem : public tnlPDEProblem< Mesh,
      bool setInitialCondition( const tnlParameterContainer& parameters,
                                const MeshType& mesh,
                                DofVectorType& dofs,
                                DofVectorType& auxDofs );
                                MeshDependentDataType& meshDependentData );

      template< typename Matrix >
      bool setupLinearSystem( const MeshType& mesh,
@@ -65,7 +66,7 @@ class tnlHeatEquationProblem : public tnlPDEProblem< Mesh,
                         const IndexType& step,
                         const MeshType& mesh,
                         DofVectorType& dofs,
                         DofVectorType& auxDofs );
                         MeshDependentDataType& meshDependentData );

      IndexType getDofs( const MeshType& mesh ) const;

@@ -76,6 +77,7 @@ class tnlHeatEquationProblem : public tnlPDEProblem< Mesh,
                           const RealType& tau,
                           const MeshType& mesh,
                           DofVectorType& _u,
                           MeshDependentDataType& meshDependentData,
                           DofVectorType& _fu );

      template< typename Matrix >
@@ -83,7 +85,7 @@ class tnlHeatEquationProblem : public tnlPDEProblem< Mesh,
                                 const RealType& tau,
                                 const MeshType& mesh,
                                 DofVectorType& dofs,
                                 DofVectorType& auxDofs,
                                 MeshDependentDataType& meshDependentData,
                                 Matrix& matrix,
                                 DofVectorType& rightHandSide );

+24 −3
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ tnlHeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOper
setInitialCondition( const tnlParameterContainer& parameters,
                     const MeshType& mesh,
                     DofVectorType& dofs,
                     DofVectorType& auxiliaryDofs )
                     MeshDependentDataType& meshDependentData )
{
   this->bindDofs( mesh, dofs );
   const tnlString& initialConditionFile = parameters.getParameter< tnlString >( "initial-condition" );
@@ -158,7 +158,7 @@ makeSnapshot( const RealType& time,
              const IndexType& step,
              const MeshType& mesh,
              DofVectorType& dofs,
              DofVectorType& auxiliaryDofs )
              MeshDependentDataType& meshDependentData )
{
   cout << endl << "Writing output at time " << time << " step " << step << "." << endl;

@@ -181,6 +181,7 @@ getExplicitRHS( const RealType& time,
                const RealType& tau,
                const MeshType& mesh,
                DofVectorType& u,
                MeshDependentDataType& meshDependentData,
                DofVectorType& fu )
{
   /****
@@ -220,7 +221,7 @@ assemblyLinearSystem( const RealType& time,
                      const RealType& tau,
                      const MeshType& mesh,
                      DofVectorType& u,
                      DofVectorType& auxDofs,
                      MeshDependentDataType& meshDependentData,
                      Matrix& matrix,
                      DofVectorType& b )
{
@@ -244,6 +245,26 @@ assemblyLinearSystem( const RealType& time,
   cout << endl << b << endl;
   cout << endl << u << endl;
   abort();*/
   /*cout << "Matrix multiplication test ..." << endl;
   tnlVector< RealType, DeviceType, IndexType > y;
   y.setLike( u );
   tnlTimerRT timer;
   timer.reset();
   timer.start();
   for( int i = 0; i < 100; i++ )
      matrix.vectorProduct( u, y );
   timer.stop();
   cout << "The time is " << timer.getTime();
   cout << "Scalar product test ..." << endl;
   timer.reset();
   RealType a;
   timer.start();
   for( int i = 0; i < 100; i++ )
      a = y.scalarProduct( u );
   timer.stop();
   cout << "The time is " << timer.getTime();
   cout << endl;
   abort();*/
}

#endif /* TNLHEATEQUATIONPROBLEM_IMPL_H_ */
Loading