Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-istl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Core Modules
dune-istl
Commits
b34fb142
Commit
b34fb142
authored
11 months ago
by
Simon Praetorius
Browse files
Options
Downloads
Patches
Plain Diff
Cleanup the constructors
parent
b2fdc57a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!463
Cleanup the VariableBlockVector implementation
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/istl/vbvector.hh
+17
-16
17 additions, 16 deletions
dune/istl/vbvector.hh
with
17 additions
and
16 deletions
dune/istl/vbvector.hh
+
17
−
16
View file @
b34fb142
...
...
@@ -46,6 +46,8 @@ namespace Dune {
// on the large array. However, access operators have to be
// overwritten.
{
using
Base
=
Imp
::
block_vector_unmanaged
<
B
,
typename
A
::
size_type
>
;
// just a shorthand
using
window_type
=
Imp
::
BlockVectorWindow
<
B
,
A
>
;
...
...
@@ -95,7 +97,7 @@ namespace Dune {
* \note object cannot be used yet. The size and block sizes need to be initialized.
*/
VariableBlockVector
()
:
Imp
::
block_vector_unmanaged
<
B
,
size_type
>
()
Base
()
{}
/**
...
...
@@ -105,11 +107,9 @@ namespace Dune {
* `createbegin()` and `createend()` create-iterators to fill the block sizes.
*/
explicit
VariableBlockVector
(
size_type
numBlocks
)
:
Imp
::
block_vector_unmanaged
<
B
,
size_type
>
()
{
// we can allocate the windows now
block
.
resize
(
numBlocks
);
}
Base
(),
block
(
numBlocks
)
{}
/**
* \brief Construct a vector with given number of blocks each having a
...
...
@@ -120,14 +120,13 @@ namespace Dune {
* \param blockSize Number of elements in each block
*/
VariableBlockVector
(
size_type
numBlocks
,
size_type
blockSize
)
:
Imp
::
block_vector_unmanaged
<
B
,
size_type
>
()
Base
(),
block
(
numBlocks
),
storage_
(
numBlocks
*
blockSize
)
{
// and we can allocate the big array in the base class
storage_
.
resize
(
numBlocks
*
blockSize
);
syncBaseArray
();
block
.
resize
(
numBlocks
);
// set the windows into the big array
for
(
size_type
i
=
0
;
i
<
numBlocks
;
++
i
)
block
[
i
].
set
(
blockSize
,
this
->
p
+
(
i
*
blockSize
));
...
...
@@ -138,6 +137,7 @@ namespace Dune {
//! Copy constructor, has copy semantics
VariableBlockVector
(
const
VariableBlockVector
&
a
)
:
Base
(
static_cast
<
const
Base
&>
(
a
)),
block
(
a
.
block
),
storage_
(
a
.
storage_
)
{
...
...
@@ -154,15 +154,16 @@ namespace Dune {
initialized
=
a
.
initialized
;
}
~
VariableBlockVector
()
=
default
;
//! Move constructor:
VariableBlockVector
(
VariableBlockVector
&&
tmp
)
:
VariableBlockVector
()
Base
()
{
tmp
.
swap
(
*
this
);
}
~
VariableBlockVector
()
=
default
;
//! Copy and move assignment
VariableBlockVector
&
operator
=
(
VariableBlockVector
tmp
)
{
...
...
@@ -375,7 +376,7 @@ namespace Dune {
#ifdef DUNE_ISTL_WITH_CHECKING
if
(
initialized
)
DUNE_THROW
(
ISTLError
,
"no CreateIterator in initialized state"
);
#endif
return
CreateIterator
(
*
this
,
0
,
false
);
return
CreateIterator
(
*
this
,
0
,
false
);
}
//! get create iterator pointing to one after the last block
...
...
@@ -540,8 +541,8 @@ namespace Dune {
this
->
n
=
storage_
.
size
();
}
VectorWindows
block
;
// vector of blocks pointing to the array in the base class
std
::
vector
<
B
,
A
>
storage_
;
VectorWindows
block
=
{}
;
// vector of blocks pointing to the array in the base class
std
::
vector
<
B
,
A
>
storage_
=
{}
;
bool
initialized
=
false
;
// true if vector has been initialized
};
...
...
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