Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93588531
sparse_matrix_petsc_tmpl.hh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Nov 29, 23:35
Size
2 KB
Mime Type
text/x-c++
Expires
Sun, Dec 1, 23:35 (2 d)
Engine
blob
Format
Raw Data
Handle
22668777
Attached To
rAKA akantu
sparse_matrix_petsc_tmpl.hh
View Options
/* -------------------------------------------------------------------------- */
#include "sparse_matrix_petsc.hh"
#include "petsc_wrapper.hh"
/* -------------------------------------------------------------------------- */
namespace
akantu
{
/* -------------------------------------------------------------------------- */
inline
UInt
SparseMatrixPETSc
::
add
(
UInt
i
,
UInt
j
)
{
PETSc_call
(
MatSetValue
,
mat
,
i
,
j
,
0
,
ADD_VALUES
);
return
0
;
}
/* -------------------------------------------------------------------------- */
inline
void
SparseMatrixPETSc
::
add
(
UInt
i
,
UInt
j
,
Real
val
)
{
PETSc_call
(
MatSetValue
,
mat
,
i
,
j
,
val
,
ADD_VALUES
);
}
/* -------------------------------------------------------------------------- */
inline
void
SparseMatrixPETSc
::
addLocal
(
UInt
i
,
UInt
j
)
{
PETSc_call
(
MatSetValueLocal
,
mat
,
i
,
j
,
0
,
ADD_VALUES
);
}
/* -------------------------------------------------------------------------- */
inline
void
SparseMatrixPETSc
::
addLocal
(
UInt
i
,
UInt
j
,
Real
val
)
{
PETSc_call
(
MatSetValueLocal
,
mat
,
i
,
j
,
val
,
ADD_VALUES
);
}
/* -------------------------------------------------------------------------- */
template
<
class
Rows
,
class
Cols
,
class
Values
>
void
SparseMatrixPETSc
::
addLocal
(
const
Rows
&
rows
,
const
Cols
&
cols
,
const
Values
&
vals
)
{
PETSc_call
(
MatSetValuesLocal
,
mat
,
rows
.
size
(),
rows
.
storage
(),
cols
.
size
(),
cols
.
storage
(),
vals
.
storage
(),
ADD_VALUES
);
}
/* -------------------------------------------------------------------------- */
template
<
class
Rows
,
class
Cols
,
class
Values
>
void
SparseMatrixPETSc
::
addValues
(
const
Rows
&
rows
,
const
Cols
&
cols
,
const
Values
&
vals
,
MatrixType
type
)
{
if
(
type
==
_unsymmetric
and
matrix_type
==
_symmetric
)
{
PETSc_call
(
MatSetOption
,
mat
,
MAT_SYMMETRIC
,
PETSC_FALSE
);
PETSc_call
(
MatSetOption
,
mat
,
MAT_STRUCTURALLY_SYMMETRIC
,
PETSC_TRUE
);
}
PETSc_call
(
MatSetValues
,
mat
,
rows
.
size
(),
rows
.
storage
(),
cols
.
size
(),
cols
.
storage
(),
vals
.
storage
(),
ADD_VALUES
);
}
/* -------------------------------------------------------------------------- */
}
// namespace akantu
Event Timeline
Log In to Comment