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
e1409732
There was an error fetching the commit references. Please try again later.
Commit
e1409732
authored
10 years ago
by
Tomáš Oberhuber
Browse files
Options
Downloads
Patches
Plain Diff
Adding timeDiscretisationCoefficient for stationary problems to the
matrix assembler.
parent
5ed29452
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/solvers/pde/tnlLinearSystemAssembler.h
+30
-11
30 additions, 11 deletions
src/solvers/pde/tnlLinearSystemAssembler.h
src/solvers/pde/tnlLinearSystemAssembler_impl.h
+20
-2
20 additions, 2 deletions
src/solvers/pde/tnlLinearSystemAssembler_impl.h
with
50 additions
and
13 deletions
src/solvers/pde/tnlLinearSystemAssembler.h
+
30
−
11
View file @
e1409732
...
...
@@ -46,8 +46,11 @@ class tnlLinearSystemAssemblerTraversalUserData
Matrix
*
matrix
;
const
Real
*
timeDiscretisationCoefficient
;
tnlLinearSystemAssemblerTraversalUserData
(
const
Real
&
time
,
const
Real
&
tau
,
const
Real
&
timeDiscretisationCoefficient
,
const
DifferentialOperator
&
differentialOperator
,
const
BoundaryConditions
&
boundaryConditions
,
const
RightHandSide
&
rightHandSide
,
...
...
@@ -56,6 +59,7 @@ class tnlLinearSystemAssemblerTraversalUserData
DofVector
&
b
)
:
time
(
&
time
),
tau
(
&
tau
),
timeDiscretisationCoefficient
(
&
timeDiscretisationCoefficient
),
differentialOperator
(
&
differentialOperator
),
boundaryConditions
(
&
boundaryConditions
),
rightHandSide
(
&
rightHandSide
),
...
...
@@ -120,10 +124,6 @@ class tnlLinearSystemAssembler
*
userData
.
u
,
*
userData
.
b
,
matrixRow
);
/*userData.matrix->setRowFast( index,
userData.columns->getData(),
userData.values->getData(),
rowLength );*/
}
};
...
...
@@ -155,13 +155,8 @@ class tnlLinearSystemAssembler
*
userData
.
u
,
*
userData
.
b
,
matrixRow
);
/*userData.matrix->setRowFast( index,
userData.columns->getData(),
userData.values->getData(),
rowLength );*/
userData
.
matrix
->
addElement
(
index
,
index
,
1.0
,
1.0
);
}
};
};
...
...
@@ -195,6 +190,9 @@ class tnlLinearSystemAssembler< tnlGrid< Dimensions, Real, Device, Index >,
RightHandSide
,
MatrixType
>
TraversalUserData
;
tnlLinearSystemAssembler
()
:
timeDiscretisationCoefficient
(
1.0
){}
template
<
int
EntityDimensions
>
void
assembly
(
const
RealType
&
time
,
const
RealType
&
tau
,
...
...
@@ -206,6 +204,14 @@ class tnlLinearSystemAssembler< tnlGrid< Dimensions, Real, Device, Index >,
MatrixType
&
matrix
,
DofVector
&
b
)
const
;
/****
* TODO: Fix this. Somehow.
*/
void
setTimeDiscretisationCoefficient
(
const
Real
&
c
)
{
this
->
timeDiscretisationCoefficient
=
c
;
}
class
TraversalBoundaryEntitiesProcessor
{
public:
...
...
@@ -281,7 +287,11 @@ class tnlLinearSystemAssembler< tnlGrid< Dimensions, Real, Device, Index >,
*
userData
.
u
,
*
userData
.
b
,
matrixRow
);
userData
.
matrix
->
addElementFast
(
index
,
index
,
1.0
,
1.0
);
if
(
*
userData
.
timeDiscretisationCoefficient
!=
0.0
)
userData
.
matrix
->
addElementFast
(
index
,
index
,
*
userData
.
timeDiscretisationCoefficient
,
1.0
);
}
#ifdef HAVE_CUDA
...
...
@@ -310,9 +320,18 @@ class tnlLinearSystemAssembler< tnlGrid< Dimensions, Real, Device, Index >,
*
userData
.
u
,
*
userData
.
b
,
matrixRow
);
userData
.
matrix
->
addElementFast
(
index
,
index
,
1.0
,
1.0
);
if
(
*
userData
.
timeDiscretisationCoefficient
!=
0.0
)
userData
.
matrix
->
addElementFast
(
index
,
index
,
*
userData
.
timeDiscretisationCoefficient
,
1.0
);
}
};
protected
:
Real
timeDiscretisationCoefficient
;
};
#include
<solvers/pde/tnlLinearSystemAssembler_impl.h>
...
...
This diff is collapsed.
Click to expand it.
src/solvers/pde/tnlLinearSystemAssembler_impl.h
+
20
−
2
View file @
e1409732
...
...
@@ -123,7 +123,15 @@ assembly( const RealType& time,
if
(
(
tnlDeviceEnum
)
DeviceType
::
DeviceType
==
tnlHostDevice
)
{
TraversalUserData
userData
(
time
,
tau
,
differentialOperator
,
boundaryConditions
,
rightHandSide
,
u
,
matrix
,
b
);
TraversalUserData
userData
(
time
,
tau
,
this
->
timeDiscretisationCoefficient
,
differentialOperator
,
boundaryConditions
,
rightHandSide
,
u
,
matrix
,
b
);
tnlTraverser
<
MeshType
,
EntityDimensions
>
meshTraversal
;
meshTraversal
.
template
processBoundaryEntities
<
TraversalUserData
,
TraversalBoundaryEntitiesProcessor
>
...
...
@@ -138,13 +146,23 @@ assembly( const RealType& time,
{
RealType
*
kernelTime
=
tnlCuda
::
passToDevice
(
time
);
RealType
*
kernelTau
=
tnlCuda
::
passToDevice
(
tau
);
RealType
timeDiscretisationCoefficient
=
this
->
timeDiscretisationCoefficient
;
// retyping between different floating point types, TODO check it
RealType
*
kernelTimeDiscretisationCoefficient
=
tnlCuda
::
passToDevice
(
timeDiscretisationCoefficient
);
DifferentialOperator
*
kernelDifferentialOperator
=
tnlCuda
::
passToDevice
(
differentialOperator
);
BoundaryConditions
*
kernelBoundaryConditions
=
tnlCuda
::
passToDevice
(
boundaryConditions
);
RightHandSide
*
kernelRightHandSide
=
tnlCuda
::
passToDevice
(
rightHandSide
);
DofVector
*
kernelU
=
tnlCuda
::
passToDevice
(
u
);
DofVector
*
kernelB
=
tnlCuda
::
passToDevice
(
b
);
MatrixType
*
kernelMatrix
=
tnlCuda
::
passToDevice
(
matrix
);
TraversalUserData
userData
(
*
kernelTime
,
*
kernelTau
,
*
kernelDifferentialOperator
,
*
kernelBoundaryConditions
,
*
kernelRightHandSide
,
*
kernelU
,
*
kernelMatrix
,
*
kernelB
);
TraversalUserData
userData
(
*
kernelTime
,
*
kernelTau
,
*
kernelTimeDiscretisationCoefficient
,
*
kernelDifferentialOperator
,
*
kernelBoundaryConditions
,
*
kernelRightHandSide
,
*
kernelU
,
*
kernelMatrix
,
*
kernelB
);
checkCudaDevice
;
tnlTraverser
<
MeshType
,
EntityDimensions
>
meshTraversal
;
meshTraversal
.
template
processBoundaryEntities
<
TraversalUserData
,
...
...
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