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
3cf7bde6
Commit
3cf7bde6
authored
6 years ago
by
Tim Keil
Browse files
Options
Downloads
Patches
Plain Diff
[sliced] move and update to introduce bind of functions
sliced -> base/sliced
parent
7497e417
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/xt/functions/base/sliced.hh
+44
-40
44 additions, 40 deletions
dune/xt/functions/base/sliced.hh
with
44 additions
and
40 deletions
dune/xt/functions/sliced.hh
→
dune/xt/functions/
base/
sliced.hh
+
44
−
40
View file @
3cf7bde6
...
@@ -8,13 +8,13 @@
...
@@ -8,13 +8,13 @@
// Felix Schindler (2017)
// Felix Schindler (2017)
// Rene Milk (2018)
// Rene Milk (2018)
#ifndef DUNE_XT_FUNCTIONS_SLICED_HH
#ifndef DUNE_XT_FUNCTIONS_
BASE_
SLICED_HH
#define DUNE_XT_FUNCTIONS_SLICED_HH
#define DUNE_XT_FUNCTIONS_
BASE_
SLICED_HH
#if 0
#include
<dune/common/typetraits.hh>
#include
<dune/common/typetraits.hh>
#include
<dune/xt/functions/type_traits.hh>
#include
<dune/xt/functions/type_traits.hh>
#include <dune/xt/functions/interfaces/
localizable
-function.hh>
#include
<dune/xt/functions/interfaces/
grid
-function.hh>
namespace
Dune
{
namespace
Dune
{
...
@@ -23,7 +23,7 @@ namespace Functions {
...
@@ -23,7 +23,7 @@ namespace Functions {
template
<
class
LF
,
size_t
r
,
size_t
rC
=
1
>
template
<
class
LF
,
size_t
r
,
size_t
rC
=
1
>
class Sliced
Localizable
Function
class
Sliced
Grid
Function
{
{
static_assert
(
AlwaysFalse
<
LF
>::
value
,
"Not available for matrix-valued functions (yet)!"
);
static_assert
(
AlwaysFalse
<
LF
>::
value
,
"Not available for matrix-valued functions (yet)!"
);
};
};
...
@@ -43,61 +43,67 @@ auto energy = XT::Functions::make_sliced_function<1>(u, {3}, "energy");
...
@@ -43,61 +43,67 @@ auto energy = XT::Functions::make_sliced_function<1>(u, {3}, "energy");
\endcode
\endcode
*/
*/
template
<
class
LF
,
size_t
r
>
template
<
class
LF
,
size_t
r
>
class SlicedLocalizableFunction<LF, r, 1>
class
SlicedGridFunction
<
LF
,
r
,
1
>
:
public
XT
::
Functions
::
GridFunctionInterface
<
typename
LF
::
E
,
r
,
1
,
typename
LF
::
R
>
: public XT::Functions::LocalizableFunctionInterface<typename LF::E, typename LF::D, LF::d, typename LF::R, r, 1>
{
{
static_assert(is_
localizable
_function<LF>::value, "");
static_assert
(
is_
grid
_function
<
LF
>::
value
,
""
);
static_assert
(
r
<=
LF
::
r
,
"Does not make sense!"
);
static_assert
(
r
<=
LF
::
r
,
"Does not make sense!"
);
using BaseType =
using
BaseType
=
XT
::
Functions
::
GridFunctionInterface
<
typename
LF
::
E
,
r
,
1
,
typename
LF
::
R
>
;
XT::Functions::LocalizableFunctionInterface<typename LF::E, typename LF::D, LF::d, typename LF::R, r, 1>;
class SlicedLocalFunction
class
SlicedLocalFunction
:
public
XT
::
Functions
::
ElementFunctionInterface
<
typename
LF
::
E
,
r
,
1
,
typename
LF
::
R
>
: public XT::Functions::LocalfunctionInterface<typename LF::E, typename LF::D, LF::d, typename LF::R, r, 1>
{
{
using BaseType = XT::Functions::
Localf
unctionInterface<typename LF::E,
typename LF::D, LF::d
, typename LF::R
, r, 1
>;
using
BaseType
=
XT
::
Functions
::
ElementF
unctionInterface
<
typename
LF
::
E
,
r
,
1
,
typename
LF
::
R
>
;
public:
public:
using typename BaseType::E
ntity
Type;
using
typename
BaseType
::
E
lement
Type
;
using
typename
BaseType
::
DomainType
;
using
typename
BaseType
::
DomainType
;
using
typename
BaseType
::
RangeType
;
using
typename
BaseType
::
RangeType
;
using typename BaseType::JacobianRangeType;
using
typename
BaseType
::
RangeReturnType
;
using
typename
BaseType
::
DerivativeRangeType
;
using
typename
BaseType
::
DerivativeRangeReturnType
;
SlicedLocalFunction(const LF& function, const std::array<size_t, r>& dims
, const EntityType& ent
)
SlicedLocalFunction
(
const
LF
&
function
,
const
std
::
array
<
size_t
,
r
>&
dims
)
: BaseType(
ent
)
:
BaseType
()
, local_function_(function.local_function(
ent
))
,
local_function_
(
function
.
local_function
())
,
dims_
(
dims
)
,
dims_
(
dims
)
{
{
}
}
size_t order(const XT::Common::Parameter& = {}) const override final
void
post_bind
(
const
ElementType
&
element
)
override
final
{
local_function_
->
post_bind
(
element
);
}
int
order
(
const
XT
::
Common
::
Parameter
&
=
{})
const
override
final
{
{
return
local_function_
->
order
();
return
local_function_
->
order
();
}
}
void
evaluate(const DomainType& xx,
RangeType& ret,
const XT::Common::Parameter& m
u
= {}) const override final
RangeReturnType
evaluate
(
const
DomainType
&
xx
,
const
XT
::
Common
::
Parameter
&
para
m
=
{})
const
override
final
{
{
const auto value = local_function_->evaluate(xx, mu);
RangeReturnType
ret
;
const
auto
value
=
local_function_
->
evaluate
(
xx
,
param
);
for
(
size_t
ii
=
0
;
ii
<
r
;
++
ii
)
for
(
size_t
ii
=
0
;
ii
<
r
;
++
ii
)
ret
[
ii
]
=
value
[
dims_
[
ii
]];
ret
[
ii
]
=
value
[
dims_
[
ii
]];
return
ret
;
}
}
void jacobian(const DomainType& /*xx*/,
DerivativeRangeReturnType
jacobian
(
const
DomainType
&
/*xx*/
,
JacobianRangeType& /*ret*/,
const
XT
::
Common
::
Parameter
&
/*param*/
=
{})
const
override
final
const XT::Common::Parameter& /*mu*/ = {}) const override final
{
{
DUNE_THROW
(
NotImplemented
,
"Yet!"
);
DUNE_THROW
(
NotImplemented
,
"Yet!"
);
}
}
private
:
private
:
const std::unique_ptr<typename LF::Local
f
unctionType> local_function_;
const
std
::
unique_ptr
<
typename
LF
::
Local
F
unctionType
>
local_function_
;
const
std
::
array
<
size_t
,
r
>&
dims_
;
const
std
::
array
<
size_t
,
r
>&
dims_
;
};
// class SlicedLocalFunction
};
// class SlicedLocalFunction
public
:
public
:
using typename BaseType::E
ntity
Type;
using
typename
BaseType
::
E
lement
Type
;
using typename BaseType::Local
f
unctionType;
using
typename
BaseType
::
Local
F
unctionType
;
Sliced
Localizable
Function(const LF& function, const std::array<size_t, r>& dims, const std::string& nm = "")
Sliced
Grid
Function
(
const
LF
&
function
,
const
std
::
array
<
size_t
,
r
>&
dims
,
const
std
::
string
&
nm
=
""
)
:
function_
(
function
)
:
function_
(
function
)
,
dims_
(
dims
)
,
dims_
(
dims
)
,
name_
(
nm
)
,
name_
(
nm
)
...
@@ -115,35 +121,33 @@ public:
...
@@ -115,35 +121,33 @@ public:
<<
dims_
[
ii
]);
<<
dims_
[
ii
]);
}
}
std::string name() const override final
const
std
::
string
&
name
()
const
override
final
{
{
return
name_
.
empty
()
?
"sliced "
+
function_
.
name
()
:
name_
;
return
name_
.
empty
()
?
"sliced "
+
function_
.
name
()
:
name_
;
}
}
std::unique_ptr<Local
f
unctionType> local_function(
const EntityType& entity
) const override final
std
::
unique_ptr
<
Local
F
unctionType
>
local_function
()
const
override
final
{
{
return std::make_unique<SlicedLocalFunction>(function_, dims_
, entity
);
return
std
::
make_unique
<
SlicedLocalFunction
>
(
function_
,
dims_
);
}
}
private
:
private
:
const
LF
&
function_
;
const
LF
&
function_
;
const
std
::
array
<
size_t
,
r
>
dims_
;
const
std
::
array
<
size_t
,
r
>
dims_
;
const std::string name_;
const
std
::
string
&
name_
;
}; // class Sliced
Localizable
Function
};
// class Sliced
Grid
Function
template <size_t sliced_r, class E, class D, size_t d, class R, size_t r>
template
<
size_t
sliced_r
,
class
E
,
size_t
r
>
SlicedLocalizableFunction<LocalizableFunctionInterface<E, D, d, R, r>, sliced_r>
SlicedGridFunction
<
GridFunctionInterface
<
E
,
r
>
,
sliced_r
>
make_sliced_function
(
make_sliced_function(const LocalizableFunctionInterface<E, D, d, R, r>& function,
const
GridFunctionInterface
<
E
,
r
>&
function
,
const
std
::
array
<
size_t
,
sliced_r
>&
dims
,
const
std
::
string
&
name
=
""
)
const std::array<size_t, sliced_r>& dims,
const std::string& name = "")
{
{
return Sliced
LocalizableFunction<Localizable
FunctionInterface<E,
D, d, R,
r>, sliced_r>(function, dims, name);
return
Sliced
GridFunction
<
Grid
FunctionInterface
<
E
,
r
>
,
sliced_r
>
(
function
,
dims
,
name
);
}
}
}
// namespace Functions
}
// namespace Functions
}
// namespace XT
}
// namespace XT
}
// namespace Dune
}
// namespace Dune
#endif
#endif // DUNE_XT_FUNCTIONS_SLICED_HH
#endif // DUNE_XT_FUNCTIONS_SLICED_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