Loading src/Tools/tnl-quickstart/problem.h.in +16 −13 Original line number Diff line number Diff line Loading @@ -20,6 +20,9 @@ class {problemBaseName}Problem: typedef typename DifferentialOperator::IndexType IndexType; typedef TNL::Functions::MeshFunction< Mesh > MeshFunctionType; typedef TNL::Problems::PDEProblem< Mesh, RealType, DeviceType, IndexType > BaseType; typedef TNL::SharedPointer< DifferentialOperator > DifferentialOperatorPointer; typedef TNL::SharedPointer< BoundaryCondition > BoundaryConditionPointer; typedef TNL::SharedPointer< RightHandSide, DeviceType > RightHandSidePointer; using typename BaseType::MeshType; using typename BaseType::MeshPointer; Loading @@ -42,17 +45,17 @@ class {problemBaseName}Problem: bool setInitialCondition( const TNL::Config::ParameterContainer& parameters, const MeshPointer& mesh, DofVectorType& dofs, DofVectorPointer& dofs, MeshDependentDataType& meshDependentData ); template< typename Matrix > template< typename MatrixPointer > bool setupLinearSystem( const MeshPointer& mesh, Matrix& matrix ); MatrixPointer& matrixPointer ); bool makeSnapshot( const RealType& time, const IndexType& step, const MeshPointer& mesh, DofVectorType& dofs, DofVectorPointer& dofs, MeshDependentDataType& meshDependentData ); IndexType getDofs( const MeshPointer& mesh ) const; Loading @@ -63,24 +66,24 @@ class {problemBaseName}Problem: void getExplicitRHS( const RealType& time, const RealType& tau, const MeshPointer& mesh, DofVectorType& _u, DofVectorType& _fu, DofVectorPointer& _u, DofVectorPointer& _fu, MeshDependentDataType& meshDependentData ); template< typename Matrix > template< typename MatrixPointer > void assemblyLinearSystem( const RealType& time, const RealType& tau, const MeshPointer& mesh, DofVectorType& dofs, Matrix& matrix, DofVectorType& rightHandSide, DofVectorPointer& dofs, MatrixPointer& matrixPointer, DofVectorPointer& rightHandSide, MeshDependentDataType& meshDependentData ); protected: DifferentialOperator differentialOperator; BoundaryCondition boundaryCondition; RightHandSide rightHandSide; DifferentialOperatorPointer differentialOperator; BoundaryConditionPointer boundaryCondition; RightHandSidePointer rightHandSide; }}; #include "{problemBaseName}Problem_impl.h" src/Tools/tnl-quickstart/problem_impl.h.in +24 −24 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ setup( const MeshPointer& meshPointer, const TNL::Config::ParameterContainer& parameters, const TNL::String& prefix ) {{ if( ! this->boundaryCondition.setup( parameters, "boundary-conditions-" ) || if( ! this->boundaryCondition.setup( meshPointer, parameters, "boundary-conditions-" ) || ! this->rightHandSide.setup( parameters, "right-hand-side-" ) ) return false; return true; Loading @@ -71,7 +71,7 @@ getDofs( const MeshPointer& mesh ) const * Return number of DOFs (degrees of freedom) i.e. number * of unknowns to be resolved by the main solver. */ return mesh.template getEntitiesCount< typename MeshType::Cell >(); return mesh->template getEntitiesCount< typename MeshType::Cell >(); }} template< typename Mesh, Loading @@ -93,7 +93,7 @@ bool {problemBaseName}Problem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >:: setInitialCondition( const TNL::Config::ParameterContainer& parameters, const MeshPointer& mesh, DofVectorType& dofs, DofVectorPointer& dofs, MeshDependentDataType& meshDependentData ) {{ const TNL::String& initialConditionFile = parameters.getParameter< TNL::String >( "initial-condition" ); Loading @@ -110,24 +110,24 @@ template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator > template< typename Matrix > template< typename MatrixPointer > bool {problemBaseName}Problem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >:: setupLinearSystem( const MeshPointer& mesh, Matrix& matrix ) setupLinearSystem( const MeshPointer& meshPointer, MatrixPointer& matrixPointer ) {{ const IndexType dofs = this->getDofs( mesh ); typedef typename Matrix::CompressedRowsLengthsVector CompressedRowsLengthsVectorType; CompressedRowsLengthsVectorType rowLengths; if( ! rowLengths.setSize( dofs ) ) const IndexType dofs = this->getDofs( meshPointer ); typedef typename MatrixPointer::ObjectType::CompressedRowsLengthsVector CompressedRowsLengthsVectorType; TNL::SharedPointer< CompressedRowsLengthsVectorType > rowLengthsPointer; if( ! rowLengthsPointer->setSize( dofs ) ) return false; TNL::Matrices::MatrixSetter< MeshType, DifferentialOperator, BoundaryCondition, CompressedRowsLengthsVectorType > matrixSetter; matrixSetter.template getCompressedRowsLengths< typename Mesh::Cell >( mesh, matrixSetter.template getCompressedRowsLengths< typename Mesh::Cell >( meshPointer, differentialOperator, boundaryCondition, rowLengths ); matrix.setDimensions( dofs, dofs ); if( ! matrix.setCompressedRowsLengths( rowLengths ) ) rowLengthsPointer ); matrixPointer->setDimensions( dofs, dofs ); if( ! matrixPointer->setCompressedRowsLengths( *rowLengthsPointer ) ) return false; return true; }} Loading @@ -141,7 +141,7 @@ bool makeSnapshot( const RealType& time, const IndexType& step, const MeshPointer& mesh, DofVectorType& dofs, DofVectorPointer& dofs, MeshDependentDataType& meshDependentData ) {{ std::cout << std::endl << "Writing output at time " << time << " step " << step << "." << std::endl; Loading @@ -150,7 +150,7 @@ makeSnapshot( const RealType& time, fileName.setFileNameBase( "u-" ); fileName.setExtension( "tnl" ); fileName.setIndex( step ); if( ! dofs.save( fileName.getFileName() ) ) if( ! dofs->save( fileName.getFileName() ) ) return false; return true; }} Loading @@ -164,8 +164,8 @@ void getExplicitRHS( const RealType& time, const RealType& tau, const MeshPointer& mesh, DofVectorType& _u, DofVectorType& _fu, DofVectorPointer& _u, DofVectorPointer& _fu, MeshDependentDataType& meshDependentData ) {{ /**** Loading Loading @@ -199,15 +199,15 @@ template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator > template< typename Matrix > template< typename MatrixPointer > void {problemBaseName}Problem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >:: assemblyLinearSystem( const RealType& time, const RealType& tau, const MeshPointer& mesh, DofVectorType& _u, Matrix& matrix, DofVectorType& b, DofVectorPointer& _u, MatrixPointer& matrixPointer, DofVectorPointer& b, MeshDependentDataType& meshDependentData ) {{ TNL::Solvers::PDE::LinearSystemAssembler< Mesh, Loading @@ -216,7 +216,7 @@ assemblyLinearSystem( const RealType& time, BoundaryCondition, RightHandSide, TNL::Solvers::PDE::BackwardTimeDiscretisation, Matrix, typename MatrixPointer::ObjectType, DofVectorType > systemAssembler; TNL::Functions::MeshFunction< Mesh > u( mesh, _u ); Loading @@ -227,6 +227,6 @@ assemblyLinearSystem( const RealType& time, this->boundaryCondition, this->rightHandSide, u, matrix, matrixPointer, b ); }} Loading
src/Tools/tnl-quickstart/problem.h.in +16 −13 Original line number Diff line number Diff line Loading @@ -20,6 +20,9 @@ class {problemBaseName}Problem: typedef typename DifferentialOperator::IndexType IndexType; typedef TNL::Functions::MeshFunction< Mesh > MeshFunctionType; typedef TNL::Problems::PDEProblem< Mesh, RealType, DeviceType, IndexType > BaseType; typedef TNL::SharedPointer< DifferentialOperator > DifferentialOperatorPointer; typedef TNL::SharedPointer< BoundaryCondition > BoundaryConditionPointer; typedef TNL::SharedPointer< RightHandSide, DeviceType > RightHandSidePointer; using typename BaseType::MeshType; using typename BaseType::MeshPointer; Loading @@ -42,17 +45,17 @@ class {problemBaseName}Problem: bool setInitialCondition( const TNL::Config::ParameterContainer& parameters, const MeshPointer& mesh, DofVectorType& dofs, DofVectorPointer& dofs, MeshDependentDataType& meshDependentData ); template< typename Matrix > template< typename MatrixPointer > bool setupLinearSystem( const MeshPointer& mesh, Matrix& matrix ); MatrixPointer& matrixPointer ); bool makeSnapshot( const RealType& time, const IndexType& step, const MeshPointer& mesh, DofVectorType& dofs, DofVectorPointer& dofs, MeshDependentDataType& meshDependentData ); IndexType getDofs( const MeshPointer& mesh ) const; Loading @@ -63,24 +66,24 @@ class {problemBaseName}Problem: void getExplicitRHS( const RealType& time, const RealType& tau, const MeshPointer& mesh, DofVectorType& _u, DofVectorType& _fu, DofVectorPointer& _u, DofVectorPointer& _fu, MeshDependentDataType& meshDependentData ); template< typename Matrix > template< typename MatrixPointer > void assemblyLinearSystem( const RealType& time, const RealType& tau, const MeshPointer& mesh, DofVectorType& dofs, Matrix& matrix, DofVectorType& rightHandSide, DofVectorPointer& dofs, MatrixPointer& matrixPointer, DofVectorPointer& rightHandSide, MeshDependentDataType& meshDependentData ); protected: DifferentialOperator differentialOperator; BoundaryCondition boundaryCondition; RightHandSide rightHandSide; DifferentialOperatorPointer differentialOperator; BoundaryConditionPointer boundaryCondition; RightHandSidePointer rightHandSide; }}; #include "{problemBaseName}Problem_impl.h"
src/Tools/tnl-quickstart/problem_impl.h.in +24 −24 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ setup( const MeshPointer& meshPointer, const TNL::Config::ParameterContainer& parameters, const TNL::String& prefix ) {{ if( ! this->boundaryCondition.setup( parameters, "boundary-conditions-" ) || if( ! this->boundaryCondition.setup( meshPointer, parameters, "boundary-conditions-" ) || ! this->rightHandSide.setup( parameters, "right-hand-side-" ) ) return false; return true; Loading @@ -71,7 +71,7 @@ getDofs( const MeshPointer& mesh ) const * Return number of DOFs (degrees of freedom) i.e. number * of unknowns to be resolved by the main solver. */ return mesh.template getEntitiesCount< typename MeshType::Cell >(); return mesh->template getEntitiesCount< typename MeshType::Cell >(); }} template< typename Mesh, Loading @@ -93,7 +93,7 @@ bool {problemBaseName}Problem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >:: setInitialCondition( const TNL::Config::ParameterContainer& parameters, const MeshPointer& mesh, DofVectorType& dofs, DofVectorPointer& dofs, MeshDependentDataType& meshDependentData ) {{ const TNL::String& initialConditionFile = parameters.getParameter< TNL::String >( "initial-condition" ); Loading @@ -110,24 +110,24 @@ template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator > template< typename Matrix > template< typename MatrixPointer > bool {problemBaseName}Problem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >:: setupLinearSystem( const MeshPointer& mesh, Matrix& matrix ) setupLinearSystem( const MeshPointer& meshPointer, MatrixPointer& matrixPointer ) {{ const IndexType dofs = this->getDofs( mesh ); typedef typename Matrix::CompressedRowsLengthsVector CompressedRowsLengthsVectorType; CompressedRowsLengthsVectorType rowLengths; if( ! rowLengths.setSize( dofs ) ) const IndexType dofs = this->getDofs( meshPointer ); typedef typename MatrixPointer::ObjectType::CompressedRowsLengthsVector CompressedRowsLengthsVectorType; TNL::SharedPointer< CompressedRowsLengthsVectorType > rowLengthsPointer; if( ! rowLengthsPointer->setSize( dofs ) ) return false; TNL::Matrices::MatrixSetter< MeshType, DifferentialOperator, BoundaryCondition, CompressedRowsLengthsVectorType > matrixSetter; matrixSetter.template getCompressedRowsLengths< typename Mesh::Cell >( mesh, matrixSetter.template getCompressedRowsLengths< typename Mesh::Cell >( meshPointer, differentialOperator, boundaryCondition, rowLengths ); matrix.setDimensions( dofs, dofs ); if( ! matrix.setCompressedRowsLengths( rowLengths ) ) rowLengthsPointer ); matrixPointer->setDimensions( dofs, dofs ); if( ! matrixPointer->setCompressedRowsLengths( *rowLengthsPointer ) ) return false; return true; }} Loading @@ -141,7 +141,7 @@ bool makeSnapshot( const RealType& time, const IndexType& step, const MeshPointer& mesh, DofVectorType& dofs, DofVectorPointer& dofs, MeshDependentDataType& meshDependentData ) {{ std::cout << std::endl << "Writing output at time " << time << " step " << step << "." << std::endl; Loading @@ -150,7 +150,7 @@ makeSnapshot( const RealType& time, fileName.setFileNameBase( "u-" ); fileName.setExtension( "tnl" ); fileName.setIndex( step ); if( ! dofs.save( fileName.getFileName() ) ) if( ! dofs->save( fileName.getFileName() ) ) return false; return true; }} Loading @@ -164,8 +164,8 @@ void getExplicitRHS( const RealType& time, const RealType& tau, const MeshPointer& mesh, DofVectorType& _u, DofVectorType& _fu, DofVectorPointer& _u, DofVectorPointer& _fu, MeshDependentDataType& meshDependentData ) {{ /**** Loading Loading @@ -199,15 +199,15 @@ template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator > template< typename Matrix > template< typename MatrixPointer > void {problemBaseName}Problem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >:: assemblyLinearSystem( const RealType& time, const RealType& tau, const MeshPointer& mesh, DofVectorType& _u, Matrix& matrix, DofVectorType& b, DofVectorPointer& _u, MatrixPointer& matrixPointer, DofVectorPointer& b, MeshDependentDataType& meshDependentData ) {{ TNL::Solvers::PDE::LinearSystemAssembler< Mesh, Loading @@ -216,7 +216,7 @@ assemblyLinearSystem( const RealType& time, BoundaryCondition, RightHandSide, TNL::Solvers::PDE::BackwardTimeDiscretisation, Matrix, typename MatrixPointer::ObjectType, DofVectorType > systemAssembler; TNL::Functions::MeshFunction< Mesh > u( mesh, _u ); Loading @@ -227,6 +227,6 @@ assemblyLinearSystem( const RealType& time, this->boundaryCondition, this->rightHandSide, u, matrix, matrixPointer, b ); }}