Loading examples/heat-equation/heatEquationSolver.h +1 −4 Original line number Diff line number Diff line Loading @@ -80,10 +80,7 @@ class heatEquationSolver protected: /*tnlSharedVector< RealType, DeviceType, IndexType > numericalSolution, exactSolution, analyticLaplace, numericalLaplace;*/ tnlSharedVector< RealType, DeviceType, IndexType > solution; tnlExplicitUpdater< Mesh, DofVectorType, DifferentialOperator, BoundaryCondition, RightHandSide > explicitUpdater; Loading examples/heat-equation/heatEquationSolver_impl.h +4 −4 Original line number Diff line number Diff line Loading @@ -90,7 +90,7 @@ bindDofs( const MeshType& mesh, DofVectorType& dofVector ) { const IndexType dofs = mesh.getNumberOfCells(); this->numericalSolution.bind( dofVector.getData(), dofs ); this->solution.bind( dofVector.getData(), dofs ); } template< typename Mesh, Loading @@ -111,7 +111,7 @@ bool heatEquationSolver< Mesh,Diffusion,BoundaryCondition,RightHandSide > const MeshType& mesh ) { const tnlString& initialConditionFile = parameters.GetParameter< tnlString >( "initial-condition" ); if( ! this->numericalSolution.load( initialConditionFile ) ) if( ! this->solution.load( initialConditionFile ) ) { cerr << "I am not able to load the initial condition from the file " << initialConditionFile << "." << endl; return false; Loading @@ -135,7 +135,7 @@ makeSnapshot( const RealType& time, tnlString fileName; FileNameBaseNumberEnding( "u-", step, 5, ".tnl", fileName ); if( ! this->numericalSolution.save( fileName ) ) if( ! this->solution.save( fileName ) ) return false; return true; } Loading @@ -161,8 +161,8 @@ void heatEquationSolver< Mesh,Diffusion,BoundaryCondition,RightHandSide > explicitUpdater.template update< Mesh::Dimensions >( time, tau, mesh, this->differentialOperator, this->boundaryCondition, this->operator, this->rightHandSide, _u, _fu ); Loading examples/heat-equation/tnlHeatEquationEocRhs.h +4 −4 Original line number Diff line number Diff line Loading @@ -34,10 +34,10 @@ class tnlHeatEquationEocRhs return true; }; template< typename Real, typename Vertex > Real getValue( const Real& time, const Vertex& vertex ) template< typename Vertex, typename Real > Real getValue( const Vertex& vertex, const Real& time ) { return testFunction.getTimeDerivative( vertex, time ) - exactOperator.getValue( testFunction, vertex, time ); }; Loading src/solvers/pde/tnlExplicitUpdater.h +9 −38 Original line number Diff line number Diff line Loading @@ -27,39 +27,6 @@ class tnlExplicitUpdaterTraversalUserData { public: template< typename DifferentialOperator, typename RightHandSide > class tnlInteriorUpdater { public: tnlInteriorUpdater( DifferentialOperator& differentialOperator, RightHandSide& rightHandSide ) : differentialOperator( differentialOperator ), rightHandSide( rightHandSide ) { } template< typename Mesh, typename Index, typename Coordinates, typename DofVector > void explicitUpdate( const Real& time, const Real& tau, const Mesh& mesh, const Index index, const Coordinates& coordinates, DofVector& u, DofVector& fu ) { ; } DifferentialOperator& differentialOperator; RightHandSide& rightHandSide; }; const Real &time, τ DifferentialOperator& differentialOperator; Loading Loading @@ -143,7 +110,7 @@ class tnlExplicitUpdater { public: template< int EntityDimension > template< int EntityDimensions > void processEntity( const MeshType& mesh, TraversalUserData& userData, const IndexType index ) Loading @@ -154,8 +121,8 @@ class tnlExplicitUpdater index, userData.u, userData.fu ); userData.fu += rightHandSide.getValue( mesh.getEntityCenter< EntityDimensions >( index ), time ); userData.fu[ index ] += userData.rightHandSide.getValue( mesh.getEntityCenter< EntityDimensions >( index ), userData.time ); } }; Loading Loading @@ -203,6 +170,10 @@ class tnlExplicitUpdater< tnlGrid< Dimensions, Real, Device, Index >, { public: /**** * TODO: This must be specialized for entities with different dimensions * otherwise 'coordinates' would not make sense without knowing the orientation. */ template< int EntityDimension > void processEntity( const MeshType& mesh, TraversalUserData& userData, Loading Loading @@ -238,8 +209,8 @@ class tnlExplicitUpdater< tnlGrid< Dimensions, Real, Device, Index >, userData.u, userData.fu ); userData.fu += rightHandSide.getValue( mesh.getEntityCenter< EntityDimensions >( coordinates ), time ); userData.fu[ index ] += userData.rightHandSide.getValue( mesh.getCellCenter( coordinates ), userData.time ); } }; Loading Loading
examples/heat-equation/heatEquationSolver.h +1 −4 Original line number Diff line number Diff line Loading @@ -80,10 +80,7 @@ class heatEquationSolver protected: /*tnlSharedVector< RealType, DeviceType, IndexType > numericalSolution, exactSolution, analyticLaplace, numericalLaplace;*/ tnlSharedVector< RealType, DeviceType, IndexType > solution; tnlExplicitUpdater< Mesh, DofVectorType, DifferentialOperator, BoundaryCondition, RightHandSide > explicitUpdater; Loading
examples/heat-equation/heatEquationSolver_impl.h +4 −4 Original line number Diff line number Diff line Loading @@ -90,7 +90,7 @@ bindDofs( const MeshType& mesh, DofVectorType& dofVector ) { const IndexType dofs = mesh.getNumberOfCells(); this->numericalSolution.bind( dofVector.getData(), dofs ); this->solution.bind( dofVector.getData(), dofs ); } template< typename Mesh, Loading @@ -111,7 +111,7 @@ bool heatEquationSolver< Mesh,Diffusion,BoundaryCondition,RightHandSide > const MeshType& mesh ) { const tnlString& initialConditionFile = parameters.GetParameter< tnlString >( "initial-condition" ); if( ! this->numericalSolution.load( initialConditionFile ) ) if( ! this->solution.load( initialConditionFile ) ) { cerr << "I am not able to load the initial condition from the file " << initialConditionFile << "." << endl; return false; Loading @@ -135,7 +135,7 @@ makeSnapshot( const RealType& time, tnlString fileName; FileNameBaseNumberEnding( "u-", step, 5, ".tnl", fileName ); if( ! this->numericalSolution.save( fileName ) ) if( ! this->solution.save( fileName ) ) return false; return true; } Loading @@ -161,8 +161,8 @@ void heatEquationSolver< Mesh,Diffusion,BoundaryCondition,RightHandSide > explicitUpdater.template update< Mesh::Dimensions >( time, tau, mesh, this->differentialOperator, this->boundaryCondition, this->operator, this->rightHandSide, _u, _fu ); Loading
examples/heat-equation/tnlHeatEquationEocRhs.h +4 −4 Original line number Diff line number Diff line Loading @@ -34,10 +34,10 @@ class tnlHeatEquationEocRhs return true; }; template< typename Real, typename Vertex > Real getValue( const Real& time, const Vertex& vertex ) template< typename Vertex, typename Real > Real getValue( const Vertex& vertex, const Real& time ) { return testFunction.getTimeDerivative( vertex, time ) - exactOperator.getValue( testFunction, vertex, time ); }; Loading
src/solvers/pde/tnlExplicitUpdater.h +9 −38 Original line number Diff line number Diff line Loading @@ -27,39 +27,6 @@ class tnlExplicitUpdaterTraversalUserData { public: template< typename DifferentialOperator, typename RightHandSide > class tnlInteriorUpdater { public: tnlInteriorUpdater( DifferentialOperator& differentialOperator, RightHandSide& rightHandSide ) : differentialOperator( differentialOperator ), rightHandSide( rightHandSide ) { } template< typename Mesh, typename Index, typename Coordinates, typename DofVector > void explicitUpdate( const Real& time, const Real& tau, const Mesh& mesh, const Index index, const Coordinates& coordinates, DofVector& u, DofVector& fu ) { ; } DifferentialOperator& differentialOperator; RightHandSide& rightHandSide; }; const Real &time, τ DifferentialOperator& differentialOperator; Loading Loading @@ -143,7 +110,7 @@ class tnlExplicitUpdater { public: template< int EntityDimension > template< int EntityDimensions > void processEntity( const MeshType& mesh, TraversalUserData& userData, const IndexType index ) Loading @@ -154,8 +121,8 @@ class tnlExplicitUpdater index, userData.u, userData.fu ); userData.fu += rightHandSide.getValue( mesh.getEntityCenter< EntityDimensions >( index ), time ); userData.fu[ index ] += userData.rightHandSide.getValue( mesh.getEntityCenter< EntityDimensions >( index ), userData.time ); } }; Loading Loading @@ -203,6 +170,10 @@ class tnlExplicitUpdater< tnlGrid< Dimensions, Real, Device, Index >, { public: /**** * TODO: This must be specialized for entities with different dimensions * otherwise 'coordinates' would not make sense without knowing the orientation. */ template< int EntityDimension > void processEntity( const MeshType& mesh, TraversalUserData& userData, Loading Loading @@ -238,8 +209,8 @@ class tnlExplicitUpdater< tnlGrid< Dimensions, Real, Device, Index >, userData.u, userData.fu ); userData.fu += rightHandSide.getValue( mesh.getEntityCenter< EntityDimensions >( coordinates ), time ); userData.fu[ index ] += userData.rightHandSide.getValue( mesh.getCellCenter( coordinates ), userData.time ); } }; Loading