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
8342f113
Commit
8342f113
authored
13 years ago
by
Van Dung Nguyen
Browse files
Options
Downloads
Patches
Plain Diff
add PETSC_COMM_WORLD as defaut in linearSystemPETSc
parent
589f4a14
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.h
+2
-1
2 additions, 1 deletion
Solver/linearSystemPETSc.h
Solver/linearSystemPETSc.hpp
+5
-4
5 additions, 4 deletions
Solver/linearSystemPETSc.hpp
with
7 additions
and
5 deletions
Solver/linearSystemPETSc.h
+
2
−
1
View file @
8342f113
...
...
@@ -46,6 +46,7 @@
template
<
class
scalar
>
class
linearSystemPETSc
:
public
linearSystem
<
scalar
>
{
protected:
MPI_Comm
_comm
;
int
_blockSize
;
// for block Matrix
bool
_isAllocated
,
_kspAllocated
,
_entriesPreAllocated
;
Mat
_a
;
...
...
@@ -55,7 +56,7 @@ class linearSystemPETSc : public linearSystem<scalar> {
sparsityPattern
_sparsity
;
void
_kspCreate
();
public:
linearSystemPETSc
();
linearSystemPETSc
(
MPI_Comm
com
=
PETSC_COMM_WORLD
);
virtual
~
linearSystemPETSc
();
void
insertInSparsityPattern
(
int
i
,
int
j
);
virtual
bool
isAllocated
()
const
{
return
_isAllocated
;
}
...
...
This diff is collapsed.
Click to expand it.
Solver/linearSystemPETSc.hpp
+
5
−
4
View file @
8342f113
...
...
@@ -16,7 +16,7 @@ static void _try(int ierr)
template
<
class
scalar
>
void
linearSystemPETSc
<
scalar
>::
_kspCreate
()
{
_try
(
KSPCreate
(
PETSC_COMM_WORLD
,
&
_ksp
));
_try
(
KSPCreate
(
_comm
,
&
_ksp
));
PC
pc
;
_try
(
KSPGetPC
(
_ksp
,
&
pc
));
// set some default options
...
...
@@ -34,8 +34,9 @@ void linearSystemPETSc<scalar>::_kspCreate()
}
template
<
class
scalar
>
linearSystemPETSc
<
scalar
>::
linearSystemPETSc
()
linearSystemPETSc
<
scalar
>::
linearSystemPETSc
(
MPI_Comm
com
)
{
_comm
=
com
;
_isAllocated
=
false
;
_blockSize
=
0
;
_kspAllocated
=
false
;
...
...
@@ -103,7 +104,7 @@ template <class scalar>
void
linearSystemPETSc
<
scalar
>::
allocate
(
int
nbRows
)
{
clear
();
_try
(
MatCreate
(
PETSC_COMM_WORLD
,
&
_a
));
_try
(
MatCreate
(
_comm
,
&
_a
));
_try
(
MatSetSizes
(
_a
,
nbRows
,
nbRows
,
PETSC_DETERMINE
,
PETSC_DETERMINE
));
// override the default options with the ones from the option
// database (if any)
...
...
@@ -117,7 +118,7 @@ void linearSystemPETSc<scalar>::allocate(int nbRows)
_localSize
=
_localRowEnd
-
_localRowStart
;
_try
(
MatGetSize
(
_a
,
&
_globalSize
,
&
nbColumns
));
// preallocation option must be set after other options
_try
(
VecCreate
(
PETSC_COMM_WORLD
,
&
_x
));
_try
(
VecCreate
(
_comm
,
&
_x
));
_try
(
VecSetSizes
(
_x
,
nbRows
,
PETSC_DETERMINE
));
// override the default options with the ones from the option
// database (if any)
...
...
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