Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-gdt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
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-gdt
Commits
4f92e289
Commit
4f92e289
authored
6 years ago
by
Dr. Felix Tobias Schindler
Browse files
Options
Downloads
Patches
Plain Diff
[spaces] add contains(), operator<<
parent
1e492f20
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/gdt/spaces/interface.hh
+54
-15
54 additions, 15 deletions
dune/gdt/spaces/interface.hh
with
54 additions
and
15 deletions
dune/gdt/spaces/interface.hh
+
54
−
15
View file @
4f92e289
...
...
@@ -15,6 +15,7 @@
#include
<dune/geometry/type.hh>
#include
<dune/xt/la/container/vector-interface.hh>
#include
<dune/xt/grid/type_traits.hh>
#include
<dune/gdt/exceptions.hh>
...
...
@@ -28,6 +29,11 @@ namespace Dune {
namespace
GDT
{
// forward
template
<
class
V
,
class
GV
,
size_t
r
,
size_t
rC
,
class
R
>
class
ConstDiscreteFunction
;
template
<
class
GridView
,
size_t
range_dim
=
1
,
size_t
range_dim_columns
=
1
,
class
RangeField
=
double
>
class
SpaceInterface
{
...
...
@@ -55,12 +61,10 @@ public:
virtual
~
SpaceInterface
()
=
default
;
virtual
const
GridViewType
&
grid_view
()
const
=
0
;
/// \name These methods provide the actual functionality, they have to be implemented.
/// \{
/**
* \name These methods provide the actual functionality, they have to be implemented.
* \{
**/
virtual
const
GridViewType
&
grid_view
()
const
=
0
;
virtual
const
MapperType
&
mapper
()
const
=
0
;
...
...
@@ -69,11 +73,8 @@ public:
virtual
const
FiniteElementType
&
finite_element
(
const
GeometryType
&
geometry_type
)
const
=
0
;
/// \}
/**
* \name These methods help to identify the space, they have to be implemented.
* \{
**/
/// \name These methods help to identify the space, they have to be implemented.
/// \{
virtual
SpaceType
type
()
const
=
0
;
...
...
@@ -94,11 +95,8 @@ public:
virtual
bool
is_lagrangian
()
const
=
0
;
/// \}
/**
* \name These methods are required for MPI communication, they are provided.
* \{
*/
/// \name These methods are required for MPI communication, they are provided.
/// \{
virtual
const
DofCommunicatorType
&
dof_communicator
()
const
{
...
...
@@ -110,6 +108,35 @@ public:
}
/// \}
/// \name These methods are provided for convenience.
/// \{
template
<
class
V
>
bool
contains
(
const
XT
::
LA
::
VectorInterface
<
V
>&
vector
)
const
{
return
vector
.
size
()
==
this
->
mapper
().
size
();
}
/**
* \note A return value of true cannot be ultimately trusted yet.
*
* \sa https://github.com/dune-community/dune-gdt/issues/123
*/
template
<
class
V
>
bool
contains
(
const
ConstDiscreteFunction
<
V
,
GV
,
r
,
rC
,
R
>&
function
)
const
{
// this is the only case where we are sure^^
if
(
&
function
.
space
()
==
this
)
return
true
;
if
(
function
.
space
().
type
()
!=
this
->
type
())
return
false
;
if
(
function
.
space
().
mapper
().
size
()
!=
this
->
mapper
().
size
())
return
false
;
// the spaces might still differ (different grid views of same size), but we have no means to check this
return
true
;
}
/// \}
protected
:
void
create_communicator
()
...
...
@@ -126,7 +153,19 @@ private:
};
// class SpaceInterface
template
<
class
GV
,
size_t
r
,
size_t
rC
,
class
R
>
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
SpaceInterface
<
GV
,
r
,
rC
,
R
>&
space
)
{
out
<<
"Space("
<<
space
.
type
()
<<
", "
<<
space
.
mapper
().
size
()
<<
" DoFs)"
;
return
out
;
}
}
// namespace GDT
}
// namespace Dune
#include
<dune/gdt/discretefunction/default.hh>
#endif // DUNE_GDT_SPACES_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