Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
amdis
amdis-core
Commits
600cf9d3
Commit
600cf9d3
authored
Sep 30, 2019
by
Praetorius, Simon
Browse files
Some small documentation improvements
parent
99499925
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/amdis/linearalgebra/MatrixBase.hpp
View file @
600cf9d3
...
...
@@ -36,33 +36,37 @@ namespace AMDiS
using
ColBasis
=
CB
;
using
ColLocalView
=
typename
ColBasis
::
LocalView
;
/// The Linear-A
g
lebra backend used to store the assembled coefficients
/// The Linear-Al
g
ebra backend used to store the assembled coefficients
using
Backend
=
B
;
private:
using
Comm
=
typename
B
::
Traits
::
Comm
;
public:
/// (1) Constructor. Stores the shared_ptr to the bases and the communication object.
MatrixBase
(
std
::
shared_ptr
<
RowBasis
>
rowBasis
,
std
::
shared_ptr
<
ColBasis
>
colBasis
,
std
::
shared_ptr
<
Comm
>
comm
)
MatrixBase
(
std
::
shared_ptr
<
RB
>
rowBasis
,
std
::
shared_ptr
<
CB
>
colBasis
,
std
::
shared_ptr
<
Comm
>
comm
)
:
rowBasis_
(
std
::
move
(
rowBasis
))
,
colBasis_
(
std
::
move
(
colBasis
))
,
backend_
(
std
::
move
(
comm
))
{}
/// (2) Constructor. Forwards to (1) by wraping reference into non-destroying shared_ptr, see \ref Dune::wrap_or_move.
/// (2) Constructor. Forwards to (1) by wraping reference into non-destroying
/// shared_ptr, see \ref Dune::wrap_or_move.
template
<
class
RB_
,
class
CB_
,
class
Comm_
,
REQUIRES
(
Concepts
::
Similar
<
Types
<
RB_
,
CB_
,
Comm_
>,
Types
<
RB
,
CB
,
Comm
>>
)
>
MatrixBase
(
RB_
&&
rowBasis
,
CB_
&&
colBasis
,
Comm_
&&
comm
)
:
MatrixBase
(
Dune
::
wrap_or_move
(
FWD
(
rowBasis
)),
Dune
::
wrap_or_move
(
FWD
(
colBasis
)),
Dune
::
wrap_or_move
(
FWD
(
comm
)))
:
MatrixBase
(
Dune
::
wrap_or_move
(
FWD
(
rowBasis
)),
Dune
::
wrap_or_move
(
FWD
(
colBasis
)),
Dune
::
wrap_or_move
(
FWD
(
comm
)))
{}
/// (3) Constructor. Forwards to (1) by creating a new communicator
MatrixBase
(
std
::
shared_ptr
<
RowBasis
>
const
&
rowBasis
,
std
::
shared_ptr
<
ColBasis
>
const
&
colBasis
)
:
MatrixBase
(
rowBasis
,
colBasis
,
std
::
shared_ptr
<
Comm
>
(
CommunicationCreator
<
Comm
>::
create
(
*
rowBasis
)))
MatrixBase
(
std
::
shared_ptr
<
RB
>
const
&
rowBasis
,
std
::
shared_ptr
<
CB
>
const
&
colBasis
)
:
MatrixBase
(
rowBasis
,
colBasis
,
std
::
shared_ptr
<
Comm
>
(
CommunicationCreator
<
Comm
>::
create
(
*
rowBasis
)))
{}
/// (4) Constructor. Forwards to (3) by wrapping references into non-destroying shared_ptr, see \ref Dune::wrap_or_move.
/// (4) Constructor. Forwards to (3) by wrapping references into non-destroying
/// shared_ptr, see \ref Dune::wrap_or_move.
template
<
class
RB_
,
class
CB_
,
REQUIRES
(
Concepts
::
Similar
<
Types
<
RB_
,
CB_
>,
Types
<
RB
,
CB
>>
)
>
MatrixBase
(
RB_
&&
rowBasis
,
CB_
&&
colBasis
)
...
...
@@ -81,20 +85,15 @@ namespace AMDiS
return
colBasis_
;
}
Backend
&
backend
()
{
return
backend_
;
}
Backend
const
&
backend
()
const
{
return
backend_
;
}
/// Return the underlying linear algebra backend
Backend
const
&
backend
()
const
{
return
backend_
;
}
Backend
&
backend
()
{
return
backend_
;
}
/// \brief Initialize the matrix for insertion, i.e. allocate the non-zero pattern
/**
* With the optional parameter \p symmetry some additional information about the
* structure of the values or the sparsity pattern can be provided. See \ref SymmetryStructure.
* structure of the values or the sparsity pattern can be provided.
* See \ref SymmetryStructure.
**/
void
init
(
SymmetryStructure
symmetry
=
SymmetryStructure
::
unknown
)
{
...
...
@@ -123,7 +122,9 @@ namespace AMDiS
assert
(
r
.
size
()
==
localMatrix
.
rows
());
assert
(
c
.
size
()
==
localMatrix
.
cols
());
const
bool
optimized
=
std
::
is_same
<
RowLocalView
,
ColLocalView
>::
value
&&
r
.
tree
().
treeIndex
()
==
c
.
tree
().
treeIndex
();
const
bool
optimized
=
std
::
is_same
<
RowLocalView
,
ColLocalView
>::
value
&&
r
.
tree
().
treeIndex
()
==
c
.
tree
().
treeIndex
();
if
(
optimized
)
backend_
.
scatter
(
nodeIndices
(
r
),
localMatrix
);
else
...
...
src/amdis/linearalgebra/VectorBase.hpp
View file @
600cf9d3
...
...
@@ -26,8 +26,8 @@ namespace AMDiS
{
/// \brief The basic container that stores a base vector and a corresponding basis
/**
* A vector storing all the assembled Operators indexed with DOF indices. The
vector
* data is associated to a global basis.
* A vector storing all the assembled Operators indexed with DOF indices. The
*
vector
data is associated to a global basis.
*
* \tparam GB Basis of the vector
* \tparam B A linear algebra backend implementing the storage and operations.
...
...
@@ -42,16 +42,15 @@ namespace AMDiS
using
GlobalBasis
=
GB
;
using
LocalView
=
typename
GlobalBasis
::
LocalView
;
/// The Linear-A
g
lebra backend used to store the assembled coefficients
/// The Linear-Al
g
ebra backend used to store the assembled coefficients
using
Backend
=
B
;
using
Comm
=
typename
B
::
Traits
::
Comm
;
private:
// proxy class redirecting the mutable element access to the inserValue method
// proxy class redirecting the mutable element access to the inser
t
Value method
template
<
class
Index
>
struct
AccessProxy
;
using
Comm
=
typename
B
::
Traits
::
Comm
;
enum
class
VectorState
{
unknown
=
0
,
...
...
@@ -75,7 +74,8 @@ namespace AMDiS
resizeZero
();
}
/// (2) Constructor. Forwards to (1) by wraping reference into non-destroying shared_ptr.
/// (2) Constructor. Forwards to (1) by wraping reference into non-destroying
/// shared_ptr.
template
<
class
GB_
,
class
Comm_
,
REQUIRES
(
Concepts
::
Similar
<
Types
<
GB_
,
Comm_
>,
Types
<
GB
,
Comm
>>
)
>
VectorBase
(
GB_
&&
basis
,
Comm_
&&
comm
)
...
...
@@ -87,7 +87,8 @@ namespace AMDiS
:
VectorBase
(
basis
,
std
::
shared_ptr
<
Comm
>
(
CommunicationCreator
<
Comm
>::
create
(
*
basis
)))
{}
/// (4) Constructor. Forwards to (3) by wrapping references into non-destroying shared_ptr, see \ref Dune::wrap_or_move.
/// (4) Constructor. Forwards to (3) by wrapping references into non-destroying
/// shared_ptr, see \ref Dune::wrap_or_move.
template
<
class
GB_
,
REQUIRES
(
Concepts
::
Similar
<
GB_
,
GB
>)
>
explicit
VectorBase
(
GB_
&&
basis
)
...
...
@@ -167,7 +168,8 @@ namespace AMDiS
return
at
(
idx
);
}
/// Access the entry \p i of the \ref vector with write-access. Uses a proxy class the redirects to \ref insertValue.
/// Access the entry \p i of the \ref vector with write-access. Uses a proxy
/// class the redirects to \ref insertValue.
template
<
class
Index
>
AccessProxy
<
Index
>
DUNE_DEPRECATED_MSG
(
"Do not use element-wise vector access"
)
operator
[](
Index
const
&
idx
)
...
...
@@ -186,10 +188,10 @@ namespace AMDiS
/// \brief Insert a single value into the matrix (add or overwrite to existing value)
/**
* Inserts or adds a value into a certain location \p dof (given as dof multi-index)
of a vector.
* The insertion mode is determined by the \p assign functor. Use
\ref Assigner::plus_assign for
* adding values (default) or \ref Assigner::assign
for overwriting (setting) values. Different
* insertion modes can not be mixed!
* Inserts or adds a value into a certain location \p dof (given as dof multi-index)
*
of a vector.
The insertion mode is determined by the \p assign functor. Use
*
\ref Assigner::plus_assign for
adding values (default) or \ref Assigner::assign
*
for overwriting (setting) values. Different
insertion modes can not be mixed!
*
* Insertion must be closed with a call to \ref finish().
*
...
...
@@ -224,13 +226,15 @@ namespace AMDiS
}
/// \brief Extract values from the vector referring to the given local indices and store it into a buffer
/// \brief Extract values from the vector referring to the given local indices
/// and store it into a buffer
/**
* Collect value of indices and store them into a buffer. The buffer must be a vector-like container
* with `buffer.resize()` and `buffer.begin()`. The indices must be stored in an iterable container.
* Collect value of indices and store them into a buffer. The buffer must be
* a vector-like container with `buffer.resize()` and `buffer.begin()`. The
* indices must be stored in an iterable container.
*
* If the vector is not in synchronized state, collects all necessary values
possibly from
* neighbouring processors.
* If the vector is not in synchronized state, collects all necessary values
*
possibly from
neighbouring processors.
*
* [[expects: localView is bound to an element]]
* [[expects: node is in localView.tree()]]
...
...
@@ -259,18 +263,19 @@ namespace AMDiS
/// Insert a block of values into the vector (add or overwrite to existing values)
/**
* Inserts or adds values into certain locations of a vector. Insertion indices are extracted from
* the given \p localView. The insertion mode is determined by the \p assign functor. Use
* \ref Assigner::plus_assign for adding values (default) or \ref Assigner::assign for overwriting
* (setting) values. Different insertion modes can not be mixed! The \p localVector is assumed
* to be a continuous memory container with a `data()` method to get a pointer to the beginning.
* Inserts or adds values into certain locations of a vector. Insertion indices
* are extracted from the given \p localView. The insertion mode is determined
* by the \p assign functor. Use \ref Assigner::plus_assign for adding values
* (default) or \ref Assigner::assign for overwriting (setting) values. Different
* insertion modes can not be mixed! The \p localVector is assumed to be a continuous
* memory container with a `data()` method to get a pointer to the beginning.
*
* The \p mask models a boolean range with at least a `begin()` method. Must
be forward iterable
* for at least `localVector.size()` elements. Does not
need an `end()` method. See, e.g.
* \ref FakeContainer.
* The \p mask models a boolean range with at least a `begin()` method. Must
*
be forward iterable
for at least `localVector.size()` elements. Does not
*
need an `end()` method. See, e.g.
\ref FakeContainer.
*
* Insertion must be closed with a call to \ref finish(). It is not allowed
to switch insertion
* mode before calling `finish()`.
* Insertion must be closed with a call to \ref finish(). It is not allowed
*
to switch insertion
mode before calling `finish()`.
*
* [[expects: localView is bound to an element]]
* [[expects: node is in localView.tree()]]
...
...
@@ -348,8 +353,8 @@ namespace AMDiS
/// Apply \p func to each value at given indices \p localInd
/**
* First, synchronizes the values of the vector, then applies the functor to
each local value
* associated to the local indices \p localInd.
* First, synchronizes the values of the vector, then applies the functor to
*
each local value
associated to the local indices \p localInd.
*
* [[mutable]]
**/
...
...
@@ -371,8 +376,8 @@ namespace AMDiS
/// Apply \p func to each value at given indices \p localInd
/**
* First, synchronizes the values of the vector, then applies the functor to
each local value
* associated to the local indices \p localInd.
* First, synchronizes the values of the vector, then applies the functor to
*
each local value
associated to the local indices \p localInd.
*
* [[const]]
**/
...
...
@@ -424,7 +429,8 @@ namespace AMDiS
/// Data backend
Backend
backend_
;
/// The current state of the vector, one of {synchronized, insert_values, add_values, unknown}
/// The current state of the vector, one of {synchronized, insert_values,
/// add_values, unknown}
VectorState
state_
=
VectorState
::
unknown
;
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment