Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Neos optimal transport
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
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
Show more breadcrumbs
ELBADA Haytham
Neos optimal transport
Commits
0759b72a
Commit
0759b72a
authored
3 years ago
by
Laurent FACQ
Browse files
Options
Downloads
Patches
Plain Diff
Add solveAgainLaplacian() for multiple RHS solve with same matrix
parent
e1959074
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/maths/Laplacian.hpp
+1
-0
1 addition, 0 deletions
src/maths/Laplacian.hpp
src/maths/solvers/LaplacianPetsc.cpp
+12
-4
12 additions, 4 deletions
src/maths/solvers/LaplacianPetsc.cpp
src/maths/solvers/LaplacianPetsc.hpp
+7
-0
7 additions, 0 deletions
src/maths/solvers/LaplacianPetsc.hpp
with
20 additions
and
4 deletions
src/maths/Laplacian.hpp
+
1
−
0
View file @
0759b72a
...
@@ -64,6 +64,7 @@ virtual void addRHSValue(int row, double val) = 0;
...
@@ -64,6 +64,7 @@ virtual void addRHSValue(int row, double val) = 0;
virtual
double
getRHSValue
(
const
int
row
)
=
0
;
virtual
double
getRHSValue
(
const
int
row
)
=
0
;
virtual
void
zeroRHS
()
=
0
;
virtual
void
zeroRHS
()
=
0
;
virtual
double
solveLaplacian
()
=
0
;
virtual
double
solveLaplacian
()
=
0
;
virtual
double
solveAgainLaplacian
()
=
0
;
virtual
std
::
vector
<
double
>
getSolution
()
=
0
;
virtual
std
::
vector
<
double
>
getSolution
()
=
0
;
virtual
std
::
vector
<
double
>
error
()
=
0
;
virtual
std
::
vector
<
double
>
error
()
=
0
;
virtual
void
dumpMatrix
()
=
0
;
virtual
void
dumpMatrix
()
=
0
;
...
...
This diff is collapsed.
Click to expand it.
src/maths/solvers/LaplacianPetsc.cpp
+
12
−
4
View file @
0759b72a
...
@@ -37,8 +37,6 @@ void LaplacianPetsc::zeroMatrix()
...
@@ -37,8 +37,6 @@ void LaplacianPetsc::zeroMatrix()
double
LaplacianPetsc
::
solveLaplacian
()
double
LaplacianPetsc
::
solveLaplacian
()
{
{
PetscInt
nbIteration
;
PetscReal
norm
;
PetscBool
assembled
;
PetscBool
assembled
;
if
(
!
MatAssembled
(
_LaplacianMatrix
,
&
assembled
))
{
if
(
!
MatAssembled
(
_LaplacianMatrix
,
&
assembled
))
{
...
@@ -46,8 +44,6 @@ double LaplacianPetsc::solveLaplacian()
...
@@ -46,8 +44,6 @@ double LaplacianPetsc::solveLaplacian()
MatAssemblyEnd
(
_LaplacianMatrix
,
MAT_FINAL_ASSEMBLY
);
MatAssemblyEnd
(
_LaplacianMatrix
,
MAT_FINAL_ASSEMBLY
);
}
}
VecAssemblyBegin
(
_RHS
);
VecAssemblyEnd
(
_RHS
);
VecDuplicate
(
_RHS
,
&
_dum
);
VecDuplicate
(
_RHS
,
&
_dum
);
KSPSetOperators
(
_ksp
,
_LaplacianMatrix
,
_LaplacianMatrix
);
KSPSetOperators
(
_ksp
,
_LaplacianMatrix
,
_LaplacianMatrix
);
...
@@ -62,6 +58,18 @@ double LaplacianPetsc::solveLaplacian()
...
@@ -62,6 +58,18 @@ double LaplacianPetsc::solveLaplacian()
MatSetNullSpace
(
_LaplacianMatrix
,
_nullsp
);
MatSetNullSpace
(
_LaplacianMatrix
,
_nullsp
);
}
}
}
}
return
LaplacianPetsc
::
solveAgainLaplacian
();
}
double
LaplacianPetsc
::
solveAgainLaplacian
()
{
PetscInt
nbIteration
;
PetscReal
norm
;
VecAssemblyBegin
(
_RHS
);
VecAssemblyEnd
(
_RHS
);
KSPSolve
(
_ksp
,
_RHS
,
_dum
);
KSPSolve
(
_ksp
,
_RHS
,
_dum
);
KSPGetIterationNumber
(
_ksp
,
&
nbIteration
);
KSPGetIterationNumber
(
_ksp
,
&
nbIteration
);
KSPGetResidualNorm
(
_ksp
,
&
norm
);
KSPGetResidualNorm
(
_ksp
,
&
norm
);
...
...
This diff is collapsed.
Click to expand it.
src/maths/solvers/LaplacianPetsc.hpp
+
7
−
0
View file @
0759b72a
...
@@ -111,6 +111,13 @@ void dumpRHS();
...
@@ -111,6 +111,13 @@ void dumpRHS();
*/
*/
double
solveLaplacian
();
double
solveLaplacian
();
/**
* @brief Solve again the LaplacianPetsc (same system, different RHS)
*
* @brief[out] return residual norm
*/
double
solveAgainLaplacian
();
/**
/**
* @brief get Solution converted in std::vector
* @brief get Solution converted in std::vector
*/
*/
...
...
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