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
5b20dc34
Commit
5b20dc34
authored
12 years ago
by
Van Dung Nguyen
Browse files
Options
Downloads
Patches
Plain Diff
add create matrix function
parent
a93a5168
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
Solver/linearSystem.h
+1
-0
1 addition, 0 deletions
Solver/linearSystem.h
Solver/linearSystemPETSc.h
+1
-0
1 addition, 0 deletions
Solver/linearSystemPETSc.h
Solver/linearSystemPETSc.hpp
+23
-0
23 additions, 0 deletions
Solver/linearSystemPETSc.hpp
with
25 additions
and
0 deletions
Solver/linearSystem.h
+
1
−
0
View file @
5b20dc34
...
@@ -26,6 +26,7 @@ class linearSystemBase {
...
@@ -26,6 +26,7 @@ class linearSystemBase {
void
setParameter
(
std
::
string
key
,
std
::
string
value
);
void
setParameter
(
std
::
string
key
,
std
::
string
value
);
virtual
void
insertInSparsityPattern
(
int
_row
,
int
_col
){};
virtual
void
insertInSparsityPattern
(
int
_row
,
int
_col
){};
virtual
double
normInfRightHandSide
()
const
=
0
;
virtual
double
normInfRightHandSide
()
const
=
0
;
virtual
void
createMatrix
()
{};
};
};
template
<
class
scalar
>
template
<
class
scalar
>
...
...
This diff is collapsed.
Click to expand it.
Solver/linearSystemPETSc.h
+
1
−
0
View file @
5b20dc34
...
@@ -79,6 +79,7 @@ class linearSystemPETSc : public linearSystem<scalar> {
...
@@ -79,6 +79,7 @@ class linearSystemPETSc : public linearSystem<scalar> {
std
::
vector
<
scalar
>
getData
();
std
::
vector
<
scalar
>
getData
();
std
::
vector
<
int
>
getRowPointers
();
std
::
vector
<
int
>
getRowPointers
();
std
::
vector
<
int
>
getColumnsIndices
();
std
::
vector
<
int
>
getColumnsIndices
();
virtual
void
createMatrix
();
};
};
class
linearSystemPETScBlockDouble
:
public
linearSystem
<
fullMatrix
<
double
>
>
{
class
linearSystemPETScBlockDouble
:
public
linearSystem
<
fullMatrix
<
double
>
>
{
...
...
This diff is collapsed.
Click to expand it.
Solver/linearSystemPETSc.hpp
+
23
−
0
View file @
5b20dc34
...
@@ -131,6 +131,29 @@ void linearSystemPETSc<scalar>::allocate(int nbRows)
...
@@ -131,6 +131,29 @@ void linearSystemPETSc<scalar>::allocate(int nbRows)
_entriesPreAllocated
=
false
;
_entriesPreAllocated
=
false
;
}
}
template
<
class
scalar
>
void
linearSystemPETSc
<
scalar
>::
createMatrix
(){
if
(
isAllocated
())
#if (PETSC_VERSION_RELEASE == 0 || ((PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR >= 2)))
_try
(
MatDestroy
(
&
_a
));
#else
_try
(
MatDestroy
(
_a
));
#endif
_try
(
MatCreate
(
_comm
,
&
_a
));
_try
(
MatSetSizes
(
_a
,
_localSize
,
_localSize
,
_globalSize
,
_globalSize
));
// override the default options with the ones from the option
// database (if any)
if
(
this
->
_parameters
.
count
(
"petscOptions"
))
_try
(
PetscOptionsInsertString
(
this
->
_parameters
[
"petscOptions"
].
c_str
()));
if
(
this
->
_parameters
.
count
(
"petscPrefix"
))
_try
(
MatAppendOptionsPrefix
(
_a
,
this
->
_parameters
[
"petscPrefix"
].
c_str
()));
_try
(
MatSetFromOptions
(
_a
));
_entriesPreAllocated
=
false
;
_matrixModified
=
true
;
_isAllocated
=
true
;
};
template
<
class
scalar
>
template
<
class
scalar
>
void
linearSystemPETSc
<
scalar
>::
print
()
void
linearSystemPETSc
<
scalar
>::
print
()
{
{
...
...
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