Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-xt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
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
ag-ohlberger
dune-community
dune-xt
Commits
75398bca
Commit
75398bca
authored
6 years ago
by
Dr. Felix Tobias Schindler
Browse files
Options
Downloads
Patches
Plain Diff
[vector-array] propose VectorArrayInterface
parent
cc090126
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
dune/xt/la/container/vector-array/interface.hh
+104
-0
104 additions, 0 deletions
dune/xt/la/container/vector-array/interface.hh
with
104 additions
and
0 deletions
dune/xt/la/container/vector-array/interface.hh
0 → 100644
+
104
−
0
View file @
75398bca
// This file is part of the dune-xt-la project:
// https://github.com/dune-community/dune-xt-la
// Copyright 2009-2018 dune-xt-la developers and contributors. All rights reserved.
// License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
// or GPL-2.0+ (http://opensource.org/licenses/gpl-license)
// with "runtime exception" (http://www.dune-project.org/license.html)
// Authors:
// Felix Schindler (2018)
#ifndef DUNE_XT_LA_CONTAINER_VECTOR_ARRAY_INTERFACE_HH
#define DUNE_XT_LA_CONTAINER_VECTOR_ARRAY_INTERFACE_HH
#include
<dune/xt/common/crtp.hh>
#include
<dune/xt/la/container/vector-interface.hh>
namespace
Dune
{
namespace
XT
{
namespace
LA
{
/**
* \brief Models a collection of length() number of vectors of size dim() each.
*/
template
<
class
TraitsImp
>
class
VectorArrayInterface
:
public
Common
::
CRTPInterface
<
VectorArrayInterface
<
TraitsImp
>
,
TraitsImp
>
{
using
BaseType
=
Common
::
CRTPInterface
<
VectorArrayInterface
<
TraitsImp
>
,
TraitsImp
>
;
public:
using
Traits
=
typename
BaseType
::
Traits
;
using
derived_type
=
typename
BaseType
::
derived_type
;
using
VectorType
=
typename
Traits
::
VectorType
;
private:
static_assert
(
is_vector
<
VectorType
>::
value
,
""
);
public:
using
const_iterator
=
typename
Traits
::
const_iterator
;
using
iterator
=
typename
Traits
::
iterator
;
size_t
dim
()
const
{
CHECK_CRTP
(
this
->
as_imp
().
dim
());
return
this
->
as_imp
().
dim
();
}
size_t
length
()
const
{
CHECK_CRTP
(
this
->
as_imp
().
length
());
return
this
->
as_imp
().
length
();
}
const
VectorType
&
operator
[](
const
size_t
ii
)
const
{
CHECK_CRTP
(
this
->
as_imp
()[
ii
]);
return
this
->
as_imp
()[
ii
];
}
VectorType
&
operator
[](
const
size_t
ii
)
{
CHECK_CRTP
(
this
->
as_imp
()[
ii
]);
return
this
->
as_imp
()[
ii
];
}
const_iterator
begin
()
const
{
CHECK_CRTP
(
this
->
as_imp
().
begin
());
return
this
->
as_imp
().
begin
();
}
iterator
begin
()
{
CHECK_CRTP
(
this
->
as_imp
().
begin
());
return
this
->
as_imp
().
begin
();
}
const_iterator
end
()
const
{
CHECK_CRTP
(
this
->
as_imp
().
end
());
return
this
->
as_imp
().
end
();
}
iterator
end
()
{
CHECK_CRTP
(
this
->
as_imp
().
end
());
return
this
->
as_imp
().
end
();
}
template
<
class
F
>
void
set_all
(
const
F
&
scalar
)
{
for
(
auto
&
vec
:
*
this
)
vec
.
set_all
(
scalar
);
}
};
// class VectorArrayInterface
}
// namespace LA
}
// namespace XT
}
// namespace Dune
#endif // DUNE_XT_LA_CONTAINER_VECTOR_ARRAY_INTERFACE_HH
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