Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-tectonic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
podlesny
dune-tectonic
Commits
22498e27
Commit
22498e27
authored
13 years ago
by
Elias Pipping
Committed by
Elias Pipping
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add TrivialNonlinearity class
parent
8b60d867
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
src/trivialnonlinearity.hh
+137
-0
137 additions, 0 deletions
src/trivialnonlinearity.hh
with
137 additions
and
0 deletions
src/trivialnonlinearity.hh
0 → 100644
+
137
−
0
View file @
22498e27
/* -*- mode:c++; mode:semantic -*- */
#ifndef TRIVIALNONLINEARITY_HH
#define TRIVIALNONLINEARITY_HH
#include
<dune/tnnmg/problem-classes/nonlinearity.hh>
template
<
class
LocalVectorTypeTEMPLATE
=
Dune
::
FieldVector
<
double
,
1
>,
class
LocalMatrixTypeTEMPLATE
=
Dune
::
FieldMatrix
<
double
,
1
,
1
>>
class
TrivialNonlinearity
:
Nonlinearity
<
LocalVectorTypeTEMPLATE
,
LocalMatrixTypeTEMPLATE
>
{
public:
typedef
typename
Nonlinearity
<
LocalVectorTypeTEMPLATE
,
LocalMatrixTypeTEMPLATE
>::
IndexSet
IndexSet
;
typedef
typename
Nonlinearity
<
LocalVectorTypeTEMPLATE
,
LocalMatrixTypeTEMPLATE
>::
LocalVectorType
LocalVectorType
;
typedef
typename
Nonlinearity
<
LocalVectorTypeTEMPLATE
,
LocalMatrixTypeTEMPLATE
>::
MatrixType
MatrixType
;
typedef
typename
Nonlinearity
<
LocalVectorTypeTEMPLATE
,
LocalMatrixTypeTEMPLATE
>::
VectorType
VectorType
;
enum
{
block_size
=
Nonlinearity
<
LocalVectorTypeTEMPLATE
,
LocalMatrixTypeTEMPLATE
>::
block_size
};
//! Evaluate the nonlinearity at v.
virtual
double
operator
()(
const
VectorType
&
v
)
const
{
return
0
;
}
//! Add the gradient of the nonlinearity at v to the vector gradient.
virtual
void
addGradient
(
const
VectorType
&
v
,
VectorType
&
gradient
)
const
{}
//! Add the Hessian matrix of the nonlinearity at v to the matrix Hessian.
virtual
void
addHessian
(
const
VectorType
&
v
,
MatrixType
&
hessian
)
const
{}
//! Add the indices of the Hessian matrix to the index set.
virtual
void
addHessianIndices
(
IndexSet
&
indices
)
const
{}
/** \brief Set the internal position vector u_pos to v.
*
* This is only needed if the nonlinearity does not decouple in the Euclidean
*directions.
* If the nonlinearity decouples in the Euclidean directions this can be
*empty.
*/
virtual
void
setVector
(
const
VectorType
&
v
)
{}
/** \brief Update the (i,j)-th entry of the internal position vector u_pos to
*x.
*
* \param i global index
* \param j local index
* \param x new value of the entry (u_pos)_(i,j)
*/
virtual
void
updateEntry
(
int
i
,
double
x
,
int
j
)
{}
/** \brief Compute the subdifferential of the nonlinearity restricted to the
* line u_pos' +t e_(i,j) at t=0.
*
* Here e_(i,j) is the (i,j)-th Euclidean unit vector,
* and u_pos' is the internal position vector u_pos with the (i,j)-the entry
*replaced by x.
* If the nonlinearity decouples in the Euclidean directions this is simply
*the (i,j)-th
* component of the subdifferential.
*
* \param i global index
* \param j local index
* \param x value of the (i,j)-th entry of position to evaluate the
*nonlinearity at
* \param[out] D the subdifferential
*/
virtual
void
subDiff
(
int
i
,
double
x
,
Interval
<
double
>&
D
,
int
j
)
const
{
D
[
0
]
=
D
[
1
]
=
0.0
;
}
/** \brief Return the regularity of the nonlinearity restricted to the
* line u_pos' +t e_(i,j) at t=0.
*
* Here e_(i,j) is the (i,j)-th Euclidean unit vector,
* and u_pos' is the internal position vector u_pos with the (i,j)-the entry
*replaced by x.
* Usually this will be the third derivative or a local Lipschitz constant of
*the second
* derivative. Note that if the subdifferential is set-valued at this
*position, this
* value will normally be infinity.
*
* \param i global index
* \param j local index
* \param x value of the (i,j)-th entry of position to evaluate the
*nonlinearity at
* \returns a value measuring the regularity
*/
virtual
double
regularity
(
int
i
,
double
x
,
int
j
)
const
{
return
0
;
}
/** \brief Compute the domain of the nonlinearity restricted to the
* line t e_(i,j) at t=0 where e_(i,j) is the (i,j)-th Euclidean unit vector.
*
* Notice that this does not depend on the position since the nonsmooth
* part of the nonlinearity must decouple in the Euclidean directions.
*
* \param i global index
* \param j local index
* \param[out] dom the domain
*/
virtual
void
domain
(
int
i
,
Interval
<
double
>&
dom
,
int
j
)
const
{
dom
[
1
]
=
std
::
numeric_limits
<
double
>::
max
();
dom
[
0
]
=
std
::
numeric_limits
<
double
>::
min
();
}
/** \brief Compute a local domain around t=0 where the nonlinearity restricted
*to the
* line u_pos' +t e_(i,j) is smooth.
*
* Here e_(i,j) is the (i,j)-th Euclidean unit vector,
* and u_pos' is the internal position vector u_pos with the (i,j)-the entry
*replaced by x.
* This defaults to the whole domain. Usually there is no need to use
*different values here.
*
* \param i global index
* \param j local index
* \param x value of the (i,j)-th entry of position to evaluate the
*nonlinearity at
* \param[out] dom the domain
*/
virtual
void
smoothDomain
(
int
i
,
double
x
,
double
regularity
,
Interval
<
double
>&
dom
,
int
j
)
const
{
dom
[
1
]
=
std
::
numeric_limits
<
double
>::
max
();
dom
[
0
]
=
std
::
numeric_limits
<
double
>::
min
();
return
;
}
};
#endif
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