Skip to content
Snippets Groups Projects
Commit 4db50c8f authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Fixing tnl-quickstart.

parent 6d78d9f9
No related branches found
No related tags found
No related merge requests found
...@@ -227,11 +227,11 @@ getExplicitRHS( const RealType& time, ...@@ -227,11 +227,11 @@ getExplicitRHS( const RealType& time,
this->rightHandSidePointer, this->rightHandSidePointer,
this->uPointer, this->uPointer,
fuPointer ); fuPointer );
/*BoundaryConditionsSetter< MeshFunctionType, BoundaryCondition > boundaryConditionsSetter; Solvers::PDE::BoundaryConditionsSetter< MeshFunctionType, BoundaryCondition > boundaryConditionsSetter;
boundaryConditionsSetter.template apply< typename Mesh::Cell >( boundaryConditionsSetter.template apply< typename Mesh::Cell >(
this->boundaryCondition, this->boundaryConditionPointer,
time + tau, time + tau,
this->u );*/ this->uPointer );
//fu.write( "fu.txt", "gnuplot" ); //fu.write( "fu.txt", "gnuplot" );
//this->u.write( "u.txt", "gnuplot"); //this->u.write( "u.txt", "gnuplot");
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <TNL/Devices/Cuda.h> #include <TNL/Devices/Cuda.h>
#include <TNL/Functions/FunctionAdapter.h> #include <TNL/Functions/FunctionAdapter.h>
#include <TNL/SharedPointer.h>
namespace TNL { namespace TNL {
namespace Solvers { namespace Solvers {
...@@ -55,11 +56,14 @@ class BoundaryConditionsSetter ...@@ -55,11 +56,14 @@ class BoundaryConditionsSetter
RealType, RealType,
MeshFunction, MeshFunction,
BoundaryConditions > TraverserUserData; BoundaryConditions > TraverserUserData;
typedef SharedPointer< MeshType, DeviceType > MeshPointer;
typedef SharedPointer< BoundaryConditions, DeviceType > BoundaryConditionsPointer;
typedef SharedPointer< MeshFunction, DeviceType > MeshFunctionPointer;
template< typename EntityType = typename MeshType::Cell > template< typename EntityType = typename MeshType::Cell >
static void apply( const BoundaryConditions& boundaryConditions, static void apply( const BoundaryConditionsPointer& boundaryConditions,
const RealType& time, const RealType& time,
MeshFunction& u ); MeshFunctionPointer& u );
class TraverserBoundaryEntitiesProcessor class TraverserBoundaryEntitiesProcessor
{ {
......
...@@ -22,20 +22,22 @@ template< typename MeshFunction, ...@@ -22,20 +22,22 @@ template< typename MeshFunction,
template< typename EntityType > template< typename EntityType >
void void
BoundaryConditionsSetter< MeshFunction, BoundaryConditions >:: BoundaryConditionsSetter< MeshFunction, BoundaryConditions >::
apply( const BoundaryConditions& boundaryConditions, apply( const BoundaryConditionsPointer& boundaryConditions,
const RealType& time, const RealType& time,
MeshFunction& u ) MeshFunctionPointer& u )
{ {
if( std::is_same< DeviceType, Devices::Host >::value ) //if( std::is_same< DeviceType, Devices::Host >::value )
{ {
TraverserUserData userData( time, boundaryConditions, u ); TraverserUserData userData( time,
boundaryConditions.template getData< DeviceType >(),
u.template modifyData< DeviceType >() );
Meshes::Traverser< MeshType, EntityType > meshTraverser; Meshes::Traverser< MeshType, EntityType > meshTraverser;
meshTraverser.template processBoundaryEntities< TraverserUserData, meshTraverser.template processBoundaryEntities< TraverserUserData,
TraverserBoundaryEntitiesProcessor > TraverserBoundaryEntitiesProcessor >
( u.getMeshPointer(), ( u->getMeshPointer(),
userData ); userData );
} }
if( std::is_same< DeviceType, Devices::Cuda >::value ) /*if( std::is_same< DeviceType, Devices::Cuda >::value )
{ {
RealType* kernelTime = Devices::Cuda::passToDevice( time ); RealType* kernelTime = Devices::Cuda::passToDevice( time );
BoundaryConditions* kernelBoundaryConditions = Devices::Cuda::passToDevice( boundaryConditions ); BoundaryConditions* kernelBoundaryConditions = Devices::Cuda::passToDevice( boundaryConditions );
...@@ -51,7 +53,7 @@ apply( const BoundaryConditions& boundaryConditions, ...@@ -51,7 +53,7 @@ apply( const BoundaryConditions& boundaryConditions,
Devices::Cuda::freeFromDevice( kernelBoundaryConditions ); Devices::Cuda::freeFromDevice( kernelBoundaryConditions );
Devices::Cuda::freeFromDevice( kernelU ); Devices::Cuda::freeFromDevice( kernelU );
checkCudaDevice; checkCudaDevice;
} }*/
} }
} // namespace PDE } // namespace PDE
......
...@@ -30,14 +30,14 @@ class {operatorName}< TNL::Meshes::Grid< {meshDimensions}, MeshReal, Device, Mes ...@@ -30,14 +30,14 @@ class {operatorName}< TNL::Meshes::Grid< {meshDimensions}, MeshReal, Device, Mes
template< typename MeshEntity, typename Vector, typename MatrixRow > template< typename MeshEntity, typename Vector, typename MatrixRow >
__cuda_callable__ __cuda_callable__
void updateLinearSystem( const RealType& time, void setMatrixElements( const RealType& time,
const RealType& tau, const RealType& tau,
const MeshType& mesh, const MeshType& mesh,
const IndexType& index, const IndexType& index,
const MeshEntity& entity, const MeshEntity& entity,
const MeshFunctionType& u, const MeshFunctionType& u,
Vector& b, Vector& b,
MatrixRow& matrixRow ) const; MatrixRow& matrixRow ) const;
}}; }};
...@@ -73,14 +73,14 @@ template< typename MeshReal, ...@@ -73,14 +73,14 @@ template< typename MeshReal,
__cuda_callable__ __cuda_callable__
void void
{operatorName}< TNL::Meshes::Grid< {meshDimensions}, MeshReal, Device, MeshIndex >, Real, Index >:: {operatorName}< TNL::Meshes::Grid< {meshDimensions}, MeshReal, Device, MeshIndex >, Real, Index >::
updateLinearSystem( const RealType& time, setMatrixElements( const RealType& time,
const RealType& tau, const RealType& tau,
const MeshType& mesh, const MeshType& mesh,
const IndexType& index, const IndexType& index,
const MeshEntity& entity, const MeshEntity& entity,
const MeshFunctionType& u, const MeshFunctionType& u,
Vector& b, Vector& b,
MatrixRow& matrixRow ) const MatrixRow& matrixRow ) const
{{ {{
/**** /****
* Setup the non-zero elements of the linear system here. * Setup the non-zero elements of the linear system here.
......
...@@ -53,8 +53,8 @@ setup( const MeshPointer& meshPointer, ...@@ -53,8 +53,8 @@ setup( const MeshPointer& meshPointer,
const TNL::Config::ParameterContainer& parameters, const TNL::Config::ParameterContainer& parameters,
const TNL::String& prefix ) const TNL::String& prefix )
{{ {{
if( ! this->boundaryCondition.setup( meshPointer, parameters, "boundary-conditions-" ) || if( ! this->boundaryCondition->setup( meshPointer, parameters, "boundary-conditions-" ) ||
! this->rightHandSide.setup( parameters, "right-hand-side-" ) ) ! this->rightHandSide->setup( parameters, "right-hand-side-" ) )
return false; return false;
return true; return true;
}} }}
...@@ -179,8 +179,8 @@ getExplicitRHS( const RealType& time, ...@@ -179,8 +179,8 @@ getExplicitRHS( const RealType& time,
this->bindDofs( mesh, _u ); this->bindDofs( mesh, _u );
TNL::Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, DifferentialOperator, BoundaryCondition, RightHandSide > explicitUpdater; TNL::Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, DifferentialOperator, BoundaryCondition, RightHandSide > explicitUpdater;
MeshFunctionType u( mesh, _u ); TNL::SharedPointer< MeshFunctionType > u( mesh, _u );
MeshFunctionType fu( mesh, _fu ); TNL::SharedPointer< MeshFunctionType > fu( mesh, _fu );
explicitUpdater.template update< typename Mesh::Cell >( time, explicitUpdater.template update< typename Mesh::Cell >( time,
mesh, mesh,
this->differentialOperator, this->differentialOperator,
...@@ -219,7 +219,7 @@ assemblyLinearSystem( const RealType& time, ...@@ -219,7 +219,7 @@ assemblyLinearSystem( const RealType& time,
typename MatrixPointer::ObjectType, typename MatrixPointer::ObjectType,
DofVectorType > systemAssembler; DofVectorType > systemAssembler;
TNL::Functions::MeshFunction< Mesh > u( mesh, _u ); TNL::SharedPointer< TNL::Functions::MeshFunction< Mesh > > u( mesh, _u );
systemAssembler.template assembly< typename Mesh::Cell >( time, systemAssembler.template assembly< typename Mesh::Cell >( time,
tau, tau,
mesh, mesh,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment