Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tnl-dev
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
TNL
tnl-dev
Commits
6d78d9f9
There was an error fetching the commit references. Please try again later.
Commit
6d78d9f9
authored
8 years ago
by
Tomáš Oberhuber
Browse files
Options
Downloads
Patches
Plain Diff
Fixing tnl-quickstart.
parent
1520b3d8
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Tools/tnl-quickstart/problem.h.in
+16
-13
16 additions, 13 deletions
src/Tools/tnl-quickstart/problem.h.in
src/Tools/tnl-quickstart/problem_impl.h.in
+24
-24
24 additions, 24 deletions
src/Tools/tnl-quickstart/problem_impl.h.in
with
40 additions
and
37 deletions
src/Tools/tnl-quickstart/problem.h.in
+
16
−
13
View file @
6d78d9f9
...
@@ -20,6 +20,9 @@ class {problemBaseName}Problem:
...
@@ -20,6 +20,9 @@ class {problemBaseName}Problem:
typedef typename DifferentialOperator::IndexType IndexType;
typedef typename DifferentialOperator::IndexType IndexType;
typedef TNL::Functions::MeshFunction< Mesh > MeshFunctionType;
typedef TNL::Functions::MeshFunction< Mesh > MeshFunctionType;
typedef TNL::Problems::PDEProblem< Mesh, RealType, DeviceType, IndexType > BaseType;
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::MeshType;
using typename BaseType::MeshPointer;
using typename BaseType::MeshPointer;
...
@@ -42,17 +45,17 @@ class {problemBaseName}Problem:
...
@@ -42,17 +45,17 @@ class {problemBaseName}Problem:
bool setInitialCondition( const TNL::Config::ParameterContainer& parameters,
bool setInitialCondition( const TNL::Config::ParameterContainer& parameters,
const MeshPointer& mesh,
const MeshPointer& mesh,
DofVector
Type
& dofs,
DofVector
Pointer
& dofs,
MeshDependentDataType& meshDependentData );
MeshDependentDataType& meshDependentData );
template< typename Matrix >
template< typename Matrix
Pointer
>
bool setupLinearSystem( const MeshPointer& mesh,
bool setupLinearSystem( const MeshPointer& mesh,
Matrix& matrix );
Matrix
Pointer
& matrix
Pointer
);
bool makeSnapshot( const RealType& time,
bool makeSnapshot( const RealType& time,
const IndexType& step,
const IndexType& step,
const MeshPointer& mesh,
const MeshPointer& mesh,
DofVector
Type
& dofs,
DofVector
Pointer
& dofs,
MeshDependentDataType& meshDependentData );
MeshDependentDataType& meshDependentData );
IndexType getDofs( const MeshPointer& mesh ) const;
IndexType getDofs( const MeshPointer& mesh ) const;
...
@@ -63,24 +66,24 @@ class {problemBaseName}Problem:
...
@@ -63,24 +66,24 @@ class {problemBaseName}Problem:
void getExplicitRHS( const RealType& time,
void getExplicitRHS( const RealType& time,
const RealType& tau,
const RealType& tau,
const MeshPointer& mesh,
const MeshPointer& mesh,
DofVector
Type
& _u,
DofVector
Pointer
& _u,
DofVector
Type
& _fu,
DofVector
Pointer
& _fu,
MeshDependentDataType& meshDependentData );
MeshDependentDataType& meshDependentData );
template< typename Matrix >
template< typename Matrix
Pointer
>
void assemblyLinearSystem( const RealType& time,
void assemblyLinearSystem( const RealType& time,
const RealType& tau,
const RealType& tau,
const MeshPointer& mesh,
const MeshPointer& mesh,
DofVector
Type
& dofs,
DofVector
Pointer
& dofs,
Matrix& matrix,
Matrix
Pointer
& matrix
Pointer
,
DofVector
Type
& rightHandSide,
DofVector
Pointer
& rightHandSide,
MeshDependentDataType& meshDependentData );
MeshDependentDataType& meshDependentData );
protected:
protected:
DifferentialOperator differentialOperator;
DifferentialOperator
Pointer
differentialOperator;
BoundaryCondition boundaryCondition;
BoundaryCondition
Pointer
boundaryCondition;
RightHandSide rightHandSide;
RightHandSide
Pointer
rightHandSide;
}};
}};
#include "{problemBaseName}Problem_impl.h"
#include "{problemBaseName}Problem_impl.h"
This diff is collapsed.
Click to expand it.
src/Tools/tnl-quickstart/problem_impl.h.in
+
24
−
24
View file @
6d78d9f9
...
@@ -53,7 +53,7 @@ setup( const MeshPointer& meshPointer,
...
@@ -53,7 +53,7 @@ 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( 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;
...
@@ -71,7 +71,7 @@ getDofs( const MeshPointer& mesh ) const
...
@@ -71,7 +71,7 @@ getDofs( const MeshPointer& mesh ) const
* Return number of DOFs (degrees of freedom) i.e. number
* Return number of DOFs (degrees of freedom) i.e. number
* of unknowns to be resolved by the main solver.
* 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,
template< typename Mesh,
...
@@ -93,7 +93,7 @@ bool
...
@@ -93,7 +93,7 @@ bool
{problemBaseName}Problem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
{problemBaseName}Problem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
setInitialCondition( const TNL::Config::ParameterContainer& parameters,
setInitialCondition( const TNL::Config::ParameterContainer& parameters,
const MeshPointer& mesh,
const MeshPointer& mesh,
DofVector
Type
& dofs,
DofVector
Pointer
& dofs,
MeshDependentDataType& meshDependentData )
MeshDependentDataType& meshDependentData )
{{
{{
const TNL::String& initialConditionFile = parameters.getParameter< TNL::String >( "initial-condition" );
const TNL::String& initialConditionFile = parameters.getParameter< TNL::String >( "initial-condition" );
...
@@ -110,24 +110,24 @@ template< typename Mesh,
...
@@ -110,24 +110,24 @@ template< typename Mesh,
typename BoundaryCondition,
typename BoundaryCondition,
typename RightHandSide,
typename RightHandSide,
typename DifferentialOperator >
typename DifferentialOperator >
template< typename Matrix >
template< typename Matrix
Pointer
>
bool
bool
{problemBaseName}Problem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
{problemBaseName}Problem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
setupLinearSystem( const MeshPointer& mesh,
setupLinearSystem( const MeshPointer& mesh
Pointer
,
Matrix& matrix )
Matrix
Pointer
& matrix
Pointer
)
{{
{{
const IndexType dofs = this->getDofs( mesh );
const IndexType dofs = this->getDofs( mesh
Pointer
);
typedef typename Matrix::CompressedRowsLengthsVector CompressedRowsLengthsVectorType;
typedef typename Matrix
Pointer::ObjectType
::CompressedRowsLengthsVector CompressedRowsLengthsVectorType;
CompressedRowsLengthsVectorType rowLengths;
TNL::SharedPointer<
CompressedRowsLengthsVectorType
>
rowLengths
Pointer
;
if( ! rowLengths
.
setSize( dofs ) )
if( ! rowLengths
Pointer->
setSize( dofs ) )
return false;
return false;
TNL::Matrices::MatrixSetter< MeshType, DifferentialOperator, BoundaryCondition, CompressedRowsLengthsVectorType > matrixSetter;
TNL::Matrices::MatrixSetter< MeshType, DifferentialOperator, BoundaryCondition, CompressedRowsLengthsVectorType > matrixSetter;
matrixSetter.template getCompressedRowsLengths< typename Mesh::Cell >( mesh,
matrixSetter.template getCompressedRowsLengths< typename Mesh::Cell >( mesh
Pointer
,
differentialOperator,
differentialOperator,
boundaryCondition,
boundaryCondition,
rowLengths );
rowLengths
Pointer
);
matrix
.
setDimensions( dofs, dofs );
matrix
Pointer->
setDimensions( dofs, dofs );
if( ! matrix
.
setCompressedRowsLengths( rowLengths ) )
if( ! matrix
Pointer->
setCompressedRowsLengths(
*
rowLengths
Pointer
) )
return false;
return false;
return true;
return true;
}}
}}
...
@@ -141,7 +141,7 @@ bool
...
@@ -141,7 +141,7 @@ bool
makeSnapshot( const RealType& time,
makeSnapshot( const RealType& time,
const IndexType& step,
const IndexType& step,
const MeshPointer& mesh,
const MeshPointer& mesh,
DofVector
Type
& dofs,
DofVector
Pointer
& dofs,
MeshDependentDataType& meshDependentData )
MeshDependentDataType& meshDependentData )
{{
{{
std::cout << std::endl << "Writing output at time " << time << " step " << step << "." << std::endl;
std::cout << std::endl << "Writing output at time " << time << " step " << step << "." << std::endl;
...
@@ -150,7 +150,7 @@ makeSnapshot( const RealType& time,
...
@@ -150,7 +150,7 @@ makeSnapshot( const RealType& time,
fileName.setFileNameBase( "u-" );
fileName.setFileNameBase( "u-" );
fileName.setExtension( "tnl" );
fileName.setExtension( "tnl" );
fileName.setIndex( step );
fileName.setIndex( step );
if( ! dofs
.
save( fileName.getFileName() ) )
if( ! dofs
->
save( fileName.getFileName() ) )
return false;
return false;
return true;
return true;
}}
}}
...
@@ -164,8 +164,8 @@ void
...
@@ -164,8 +164,8 @@ void
getExplicitRHS( const RealType& time,
getExplicitRHS( const RealType& time,
const RealType& tau,
const RealType& tau,
const MeshPointer& mesh,
const MeshPointer& mesh,
DofVector
Type
& _u,
DofVector
Pointer
& _u,
DofVector
Type
& _fu,
DofVector
Pointer
& _fu,
MeshDependentDataType& meshDependentData )
MeshDependentDataType& meshDependentData )
{{
{{
/****
/****
...
@@ -199,15 +199,15 @@ template< typename Mesh,
...
@@ -199,15 +199,15 @@ template< typename Mesh,
typename BoundaryCondition,
typename BoundaryCondition,
typename RightHandSide,
typename RightHandSide,
typename DifferentialOperator >
typename DifferentialOperator >
template< typename Matrix >
template< typename Matrix
Pointer
>
void
void
{problemBaseName}Problem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
{problemBaseName}Problem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
assemblyLinearSystem( const RealType& time,
assemblyLinearSystem( const RealType& time,
const RealType& tau,
const RealType& tau,
const MeshPointer& mesh,
const MeshPointer& mesh,
DofVector
Type
& _u,
DofVector
Pointer
& _u,
Matrix& matrix,
Matrix
Pointer
& matrix
Pointer
,
DofVector
Type
& b,
DofVector
Pointer
& b,
MeshDependentDataType& meshDependentData )
MeshDependentDataType& meshDependentData )
{{
{{
TNL::Solvers::PDE::LinearSystemAssembler< Mesh,
TNL::Solvers::PDE::LinearSystemAssembler< Mesh,
...
@@ -216,7 +216,7 @@ assemblyLinearSystem( const RealType& time,
...
@@ -216,7 +216,7 @@ assemblyLinearSystem( const RealType& time,
BoundaryCondition,
BoundaryCondition,
RightHandSide,
RightHandSide,
TNL::Solvers::PDE::BackwardTimeDiscretisation,
TNL::Solvers::PDE::BackwardTimeDiscretisation,
Matrix
,
typename MatrixPointer::ObjectType
,
DofVectorType > systemAssembler;
DofVectorType > systemAssembler;
TNL::Functions::MeshFunction< Mesh > u( mesh, _u );
TNL::Functions::MeshFunction< Mesh > u( mesh, _u );
...
@@ -227,6 +227,6 @@ assemblyLinearSystem( const RealType& time,
...
@@ -227,6 +227,6 @@ assemblyLinearSystem( const RealType& time,
this->boundaryCondition,
this->boundaryCondition,
this->rightHandSide,
this->rightHandSide,
u,
u,
matrix,
matrix
Pointer
,
b );
b );
}}
}}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment