Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
0fc5231d
Commit
0fc5231d
authored
13 years ago
by
Jonathan Lambrechts
Browse files
Options
Downloads
Patches
Plain Diff
dg : dgSW3dLinearSystemColumn ok in parallel
parent
6c327a84
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
Solver/linearSystemPETSc.cpp
+7
-5
7 additions, 5 deletions
Solver/linearSystemPETSc.cpp
Solver/linearSystemPETSc.h
+2
-1
2 additions, 1 deletion
Solver/linearSystemPETSc.h
with
9 additions
and
6 deletions
Solver/linearSystemPETSc.cpp
+
7
−
5
View file @
0fc5231d
...
@@ -16,7 +16,7 @@ template class linearSystemPETSc<std::complex<double> >;
...
@@ -16,7 +16,7 @@ template class linearSystemPETSc<std::complex<double> >;
void
linearSystemPETScBlockDouble
::
_kspCreate
()
{
void
linearSystemPETScBlockDouble
::
_kspCreate
()
{
KSPCreate
(
PETSC_COMM_WORLD
,
&
_ksp
);
KSPCreate
(
_sequential
?
PETSC_COMM_SELF
:
PETSC_COMM_WORLD
,
&
_ksp
);
if
(
this
->
_parameters
.
count
(
"petscPrefix"
))
if
(
this
->
_parameters
.
count
(
"petscPrefix"
))
KSPAppendOptionsPrefix
(
_ksp
,
this
->
_parameters
[
"petscPrefix"
].
c_str
());
KSPAppendOptionsPrefix
(
_ksp
,
this
->
_parameters
[
"petscPrefix"
].
c_str
());
KSPSetFromOptions
(
_ksp
);
KSPSetFromOptions
(
_ksp
);
...
@@ -112,15 +112,16 @@ void linearSystemPETScBlockDouble::getFromSolution(int row, fullMatrix<double> &
...
@@ -112,15 +112,16 @@ void linearSystemPETScBlockDouble::getFromSolution(int row, fullMatrix<double> &
void
linearSystemPETScBlockDouble
::
allocate
(
int
nbRows
)
void
linearSystemPETScBlockDouble
::
allocate
(
int
nbRows
)
{
{
MPI_Comm
comm
=
_sequential
?
PETSC_COMM_SELF
:
PETSC_COMM_WORLD
;
if
(
this
->
_parameters
.
count
(
"petscOptions"
))
if
(
this
->
_parameters
.
count
(
"petscOptions"
))
PetscOptionsInsertString
(
this
->
_parameters
[
"petscOptions"
].
c_str
());
PetscOptionsInsertString
(
this
->
_parameters
[
"petscOptions"
].
c_str
());
_blockSize
=
strtol
(
_parameters
[
"blockSize"
].
c_str
(),
NULL
,
10
);
_blockSize
=
strtol
(
_parameters
[
"blockSize"
].
c_str
(),
NULL
,
10
);
if
(
_blockSize
==
0
)
if
(
_blockSize
==
0
)
Msg
::
Error
(
"'blockSize' parameters must be set for linearSystemPETScBlock"
);
Msg
::
Error
(
"'blockSize' parameters must be set for linearSystemPETScBlock"
);
clear
();
clear
();
MatCreate
(
PETSC_COMM_WORLD
,
&
_a
);
MatCreate
(
comm
,
&
_a
);
MatSetSizes
(
_a
,
nbRows
*
_blockSize
,
nbRows
*
_blockSize
,
PETSC_DETERMINE
,
PETSC_DETERMINE
);
MatSetSizes
(
_a
,
nbRows
*
_blockSize
,
nbRows
*
_blockSize
,
PETSC_DETERMINE
,
PETSC_DETERMINE
);
if
(
Msg
::
GetCommSize
()
>
1
)
{
if
(
Msg
::
GetCommSize
()
>
1
&&
!
_sequential
)
{
MatSetType
(
_a
,
MATMPIBAIJ
);
MatSetType
(
_a
,
MATMPIBAIJ
);
}
else
{
}
else
{
MatSetType
(
_a
,
MATSEQBAIJ
);
MatSetType
(
_a
,
MATSEQBAIJ
);
...
@@ -136,7 +137,7 @@ void linearSystemPETScBlockDouble::allocate(int nbRows)
...
@@ -136,7 +137,7 @@ void linearSystemPETScBlockDouble::allocate(int nbRows)
_localRowEnd
/=
_blockSize
;
_localRowEnd
/=
_blockSize
;
// override the default options with the ones from the option
// override the default options with the ones from the option
// database (if any)
// database (if any)
VecCreate
(
PETSC_COMM_WORLD
,
&
_x
);
VecCreate
(
comm
,
&
_x
);
VecSetSizes
(
_x
,
nbRows
*
_blockSize
,
PETSC_DETERMINE
);
VecSetSizes
(
_x
,
nbRows
*
_blockSize
,
PETSC_DETERMINE
);
// override the default options with the ones from the option
// override the default options with the ones from the option
// database (if any)
// database (if any)
...
@@ -256,11 +257,12 @@ void linearSystemPETScBlockDouble::zeroSolution()
...
@@ -256,11 +257,12 @@ void linearSystemPETScBlockDouble::zeroSolution()
}
}
linearSystemPETScBlockDouble
::
linearSystemPETScBlockDouble
()
linearSystemPETScBlockDouble
::
linearSystemPETScBlockDouble
(
bool
sequential
)
{
{
_entriesPreAllocated
=
false
;
_entriesPreAllocated
=
false
;
_isAllocated
=
false
;
_isAllocated
=
false
;
_kspAllocated
=
false
;
_kspAllocated
=
false
;
_sequential
=
sequential
;
}
}
double
linearSystemPETScBlockDouble
::
normInfRightHandSide
()
const
double
linearSystemPETScBlockDouble
::
normInfRightHandSide
()
const
...
...
This diff is collapsed.
Click to expand it.
Solver/linearSystemPETSc.h
+
2
−
1
View file @
0fc5231d
...
@@ -87,6 +87,7 @@ class linearSystemPETScBlockDouble : public linearSystem<fullMatrix<double> > {
...
@@ -87,6 +87,7 @@ class linearSystemPETScBlockDouble : public linearSystem<fullMatrix<double> > {
Vec
_b
,
_x
;
Vec
_b
,
_x
;
KSP
_ksp
;
KSP
_ksp
;
int
_blockSize
,
_localRowStart
,
_localRowEnd
,
_globalSize
,
_localSize
;
int
_blockSize
,
_localRowStart
,
_localRowEnd
,
_globalSize
,
_localSize
;
bool
_sequential
;
public:
public:
void
_kspCreate
();
void
_kspCreate
();
virtual
void
addToMatrix
(
int
row
,
int
col
,
const
fullMatrix
<
double
>
&
val
);
virtual
void
addToMatrix
(
int
row
,
int
col
,
const
fullMatrix
<
double
>
&
val
);
...
@@ -105,7 +106,7 @@ class linearSystemPETScBlockDouble : public linearSystem<fullMatrix<double> > {
...
@@ -105,7 +106,7 @@ class linearSystemPETScBlockDouble : public linearSystem<fullMatrix<double> > {
void
zeroSolution
();
void
zeroSolution
();
double
normInfRightHandSide
()
const
;
double
normInfRightHandSide
()
const
;
void
insertInSparsityPattern
(
int
i
,
int
j
);
void
insertInSparsityPattern
(
int
i
,
int
j
);
linearSystemPETScBlockDouble
();
linearSystemPETScBlockDouble
(
bool
sequential
=
false
);
};
};
#else
#else
...
...
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