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
4b42dba7
Commit
4b42dba7
authored
9 years ago
by
Dr. Felix Tobias Schindler
Browse files
Options
Downloads
Patches
Plain Diff
[operators.projections.l2] add L2ProjectionOperator
parent
45ad3e5a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/gdt/operators/projections/l2.hh
+125
-0
125 additions, 0 deletions
dune/gdt/operators/projections/l2.hh
with
125 additions
and
0 deletions
dune/gdt/operators/projections/l2.hh
+
125
−
0
View file @
4b42dba7
...
...
@@ -39,6 +39,15 @@ public:
};
// class L2ProjectionLocalizableOperatorTraits
template
<
class
GridViewType
,
class
FieldImp
=
double
>
class
L2ProjectionOperatorTraits
{
public:
typedef
L2ProjectionOperator
<
GridViewType
,
FieldImp
>
derived_type
;
typedef
FieldImp
FieldType
;
};
}
// namespace internal
...
...
@@ -86,6 +95,122 @@ make_l2_projection_localizable_operator(const SourceType& source, DiscreteFuncti
}
// ... make_l2_projection_localizable_operator(...)
template
<
class
GridViewImp
,
class
FieldImp
>
class
L2ProjectionOperator
:
public
OperatorInterface
<
internal
::
L2ProjectionOperatorTraits
<
GridViewImp
,
FieldImp
>>
{
typedef
OperatorInterface
<
internal
::
L2ProjectionOperatorTraits
<
GridViewImp
,
FieldImp
>>
BaseType
;
public:
typedef
internal
::
L2ProjectionOperatorTraits
<
GridViewImp
,
FieldImp
>
Traits
;
typedef
GridViewImp
GridViewType
;
using
typename
BaseType
::
FieldType
;
private:
typedef
typename
Stuff
::
Grid
::
Entity
<
GridViewType
>::
Type
E
;
typedef
typename
GridViewType
::
ctype
D
;
static
const
size_t
d
=
GridViewType
::
dimension
;
public:
L2ProjectionOperator
(
const
size_t
over_integrate
,
GridViewType
grid_view
)
:
grid_view_
(
grid_view
)
,
over_integrate_
(
over_integrate
)
{
}
L2ProjectionOperator
(
GridViewType
grid_view
)
:
grid_view_
(
grid_view
)
,
over_integrate_
(
0
)
{
}
template
<
class
R
,
size_t
r
,
size_t
rC
,
class
S
,
class
V
>
void
apply
(
const
Stuff
::
LocalizableFunctionInterface
<
E
,
D
,
d
,
R
,
r
,
rC
>&
source
,
DiscreteFunction
<
S
,
V
>&
range
)
const
{
redirect
<
S
::
continuous
>::
apply
(
grid_view_
,
source
,
range
,
over_integrate_
);
}
template
<
class
RangeType
,
class
SourceType
>
FieldType
apply2
(
const
RangeType
&
/*range*/
,
const
SourceType
&
/*source*/
)
const
{
DUNE_THROW
(
NotImplemented
,
"Go ahead if you think this makes sense!"
);
}
template
<
class
RangeType
,
class
SourceType
>
void
apply_inverse
(
const
RangeType
&
/*range*/
,
SourceType
&
/*source*/
,
const
Stuff
::
Common
::
Configuration
&
/*opts*/
)
const
{
DUNE_THROW
(
NotImplemented
,
"Go ahead if you think this makes sense!"
);
}
std
::
vector
<
std
::
string
>
invert_options
()
const
{
DUNE_THROW
(
NotImplemented
,
"Go ahead if you think this makes sense!"
);
}
Stuff
::
Common
::
Configuration
invert_options
(
const
std
::
string
&
/*type*/
)
const
{
DUNE_THROW
(
NotImplemented
,
"Go ahead if you think this makes sense!"
);
}
private
:
template
<
bool
continuous
=
true
,
bool
anything
=
true
>
struct
redirect
{
template
<
class
SourceType
,
class
RangeType
>
static
void
apply
(
const
GridViewType
&
grd_vw
,
const
SourceType
&
src
,
RangeType
&
rng
,
const
size_t
over_integrate
)
{
L2GlobalProjectionLocalizableOperator
<
GridViewType
,
SourceType
,
RangeType
>
(
over_integrate
,
grd_vw
,
src
,
rng
)
.
apply
();
}
};
template
<
bool
anything
>
struct
redirect
<
false
,
anything
>
{
template
<
class
SourceType
,
class
RangeType
>
static
void
apply
(
const
GridViewType
&
grd_vw
,
const
SourceType
&
src
,
RangeType
&
rng
,
const
size_t
over_integrate
)
{
L2LocalProjectionLocalizableOperator
<
GridViewType
,
SourceType
,
RangeType
>
(
over_integrate
,
grd_vw
,
src
,
rng
)
.
apply
();
}
};
GridViewType
grid_view_
;
const
size_t
over_integrate_
;
};
// class L2ProjectionOperator
template
<
class
GridViewType
>
typename
std
::
enable_if
<
Stuff
::
Grid
::
is_grid_layer
<
GridViewType
>::
value
,
std
::
unique_ptr
<
L2ProjectionOperator
<
GridViewType
>>>::
type
make_l2_projection_operator
(
const
GridViewType
&
grid_view
,
const
size_t
over_integrate
=
0
)
{
return
DSC
::
make_unique
<
L2ProjectionOperator
<
GridViewType
>>
(
over_integrate
,
grid_view
);
}
template
<
class
GridViewType
,
class
SourceType
,
class
SpaceType
,
class
VectorType
>
typename
std
::
enable_if
<
Stuff
::
Grid
::
is_grid_layer
<
GridViewType
>::
value
&&
Stuff
::
is_localizable_function
<
SourceType
>::
value
&&
is_space
<
SpaceType
>::
value
&&
Stuff
::
LA
::
is_vector
<
VectorType
>::
value
,
void
>::
type
project_l2
(
const
GridViewType
&
grid_view
,
const
SourceType
&
source
,
DiscreteFunction
<
SpaceType
,
VectorType
>&
range
,
const
size_t
over_integrate
=
0
)
{
make_l2_projection_operator
(
grid_view
,
over_integrate
)
->
apply
(
source
,
range
);
}
template
<
class
SourceType
,
class
SpaceType
,
class
VectorType
>
typename
std
::
enable_if
<
Stuff
::
is_localizable_function
<
SourceType
>::
value
&&
is_space
<
SpaceType
>::
value
&&
Stuff
::
LA
::
is_vector
<
VectorType
>::
value
,
void
>::
type
project_l2
(
const
SourceType
&
source
,
DiscreteFunction
<
SpaceType
,
VectorType
>&
range
,
const
size_t
over_integrate
=
0
)
{
make_l2_projection_operator
(
range
.
space
().
grid_view
(),
over_integrate
)
->
apply
(
source
,
range
);
}
}
// namespace GDT
}
// namespace Dune
...
...
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