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
f7142172
Commit
f7142172
authored
6 years ago
by
Dr. Felix Tobias Schindler
Browse files
Options
Downloads
Patches
Plain Diff
[functionals.localizable] add LocalizableFunctionalBase
parent
747344b1
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/gdt/functionals/localizable-functional.hh
+112
-0
112 additions, 0 deletions
dune/gdt/functionals/localizable-functional.hh
with
112 additions
and
0 deletions
dune/gdt/functionals/localizable-functional.hh
0 → 100644
+
112
−
0
View file @
f7142172
// This file is part of the dune-gdt project:
// https://github.com/dune-community/dune-gdt
// Copyright 2010-2018 dune-gdt 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_GDT_FUNCTIONALS_LOCALIZABLE_FUNCTIONAL_HH
#define DUNE_GDT_FUNCTIONALS_LOCALIZABLE_FUNCTIONAL_HH
#include
<dune/xt/la/type_traits.hh>
#include
<dune/xt/grid/type_traits.hh>
#include
<dune/xt/grid/walker.hh>
#include
<dune/xt/functions/interfaces/grid-function.hh>
#include
<dune/gdt/local/assembler/functional-accumulators.hh>
#include
<dune/gdt/local/functionals/interfaces.hh>
namespace
Dune
{
namespace
GDT
{
template
<
class
GridView
,
size_t
range_dim
=
1
,
size_t
range_dim_cols
=
1
,
class
RangeField
=
double
,
class
Field
=
double
>
class
LocalizableFunctionalBase
:
public
XT
::
Grid
::
Walker
<
GridView
>
{
static_assert
(
XT
::
Grid
::
is_view
<
GridView
>::
value
,
""
);
using
ThisType
=
LocalizableFunctionalBase
<
GridView
,
range_dim
,
range_dim_cols
,
RangeField
>
;
using
BaseType
=
XT
::
Grid
::
Walker
<
GridView
>
;
public:
using
GV
=
GridView
;
using
GridViewType
=
GridView
;
using
E
=
XT
::
Grid
::
extract_entity_t
<
GV
>
;
static
const
constexpr
size_t
r
=
range_dim
;
static
const
constexpr
size_t
rC
=
range_dim_cols
;
using
R
=
RangeField
;
using
F
=
Field
;
using
SourceType
=
XT
::
Functions
::
GridFunctionInterface
<
E
,
r
,
rC
,
R
>
;
using
typename
BaseType
::
I
;
using
ElementFilterType
=
XT
::
Grid
::
ElementFilter
<
GridViewType
>
;
using
IntersectionFilterType
=
XT
::
Grid
::
IntersectionFilter
<
GridViewType
>
;
using
ApplyOnAllElements
=
XT
::
Grid
::
ApplyOn
::
AllElements
<
GridViewType
>
;
using
ApplyOnAllIntersection
=
XT
::
Grid
::
ApplyOn
::
AllIntersections
<
GridViewType
>
;
LocalizableFunctionalBase
(
GridViewType
assembly_grid_view
,
const
SourceType
&
src
)
:
BaseType
(
assembly_grid_view
)
,
source_
(
src
)
,
assembled_
(
false
)
,
result_
(
0.
)
{
// to detect assembly
this
->
append
([
&
](
const
auto
&
)
{
assembled_
=
true
;
});
}
const
SourceType
&
source
()
const
{
return
source_
;
}
using
BaseType
::
append
;
ThisType
&
append
(
const
LocalElementFunctionalInterface
<
E
,
r
,
rC
,
R
,
F
>&
local_functional
,
const
XT
::
Common
::
Parameter
&
param
=
{},
const
ElementFilterType
&
filter
=
ApplyOnAllElements
())
{
this
->
append
(
make_local_element_functional_accumulator
<
GV
>
(
local_functional
,
source_
,
result_
,
param
).
release
(),
filter
);
return
*
this
;
}
void
assemble
(
const
bool
use_tbb
=
false
)
{
if
(
assembled_
)
return
;
// This clears all appended functionals, which is ok, since we are done after assembling once!
this
->
walk
(
use_tbb
);
assembled_
=
true
;
}
Field
result
()
const
{
return
result_
;
}
protected
:
const
SourceType
&
source_
;
bool
assembled_
;
Field
result_
;
};
// class LocalizableFunctionalBase
template
<
class
GV
,
size_t
r
,
size_t
rC
,
class
R
>
std
::
enable_if_t
<
XT
::
Grid
::
is_view
<
GV
>::
value
,
LocalizableFunctionalBase
<
GV
,
r
,
rC
,
R
>>
make_localizable_functional
(
GV
assembly_grid_view
,
const
XT
::
Functions
::
GridFunctionInterface
<
XT
::
Grid
::
extract_entity_t
<
GV
>
,
r
,
rC
,
R
>&
source
)
{
return
LocalizableFunctionalBase
<
GV
,
r
,
rC
,
R
>
(
assembly_grid_view
,
source
);
}
}
// namespace GDT
}
// namespace Dune
#endif // DUNE_GDT_FUNCTIONALS_LOCALIZABLE_FUNCTIONAL_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