Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Mojtaba Abdolkhani
ogs
Commits
f33d54c2
Commit
f33d54c2
authored
7 years ago
by
wenqing
Browse files
Options
Downloads
Patches
Plain Diff
[PETSc] Added a more detailed description of PETScMatrix::add
parent
3abd8707
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
MathLib/LinAlg/PETSc/PETScMatrix.h
+20
-1
20 additions, 1 deletion
MathLib/LinAlg/PETSc/PETScMatrix.h
with
20 additions
and
1 deletion
MathLib/LinAlg/PETSc/PETScMatrix.h
+
20
−
1
View file @
f33d54c2
...
...
@@ -127,11 +127,30 @@ public:
MatSetValue
(
_A
,
i
,
j
,
value
,
ADD_VALUES
);
}
/// Add sub-matrix at positions given by \c indices.
/*!
\brief Add sub-matrix at positions given by global \c indices, in which
negative index indicates ghost entry.
In order to use MatZeroRows to apply Dirichlet boundary condition,
entries in the rows with the negative global indices are skipped to added
to the global matrix, meanwhile entries in the columns with the negative
global indices are added the global matrix. By using MatZeroRows to apply
Dirichlet boundary condition, the off diagonal entries in ghost rows of
the global matrix are set to zero, while the off diagonal entries in
ghost rows of the global matrix are assembled and kept for linear solver.
For the setting of Dirichlet boundary condition
in PETSc, please refer to
<a href="http://www.mcs.anl.gov/petsc/documentation/faq.html#redistribute">PETSc:Documentation:FAQ</a>
*/
template
<
class
T_DENSE_MATRIX
>
void
add
(
RowColumnIndices
<
PetscInt
>
const
&
indices
,
const
T_DENSE_MATRIX
&
sub_matrix
)
{
// Set global column indices to positive to allow all entries of columns
// to be added to the global matrix. For the ghost columns, only the
// off diagonal entries are added due to the negative indices of the
// corresponding rows.
std
::
vector
<
PetscInt
>
cols
;
cols
.
reserve
(
indices
.
columns
.
size
());
for
(
auto
col
:
indices
.
columns
)
...
...
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