Commit f5016a96 authored by Praetorius, Simon's avatar Praetorius, Simon

expression cheat sheet added

parent cdbabfdf
......@@ -90,8 +90,7 @@ where `EXPRESSION` can contain e.g.
- Other DOFVectors: `valueOf(V)`, `gradientOf(V)`
- Matrix and vector expressions: `two_norm(...)`, `vec * vec`
([Expressions manual](https://gitlab.mn.tu-dresden.de/iwr/amdis/wikis/expressions))
List of possible expressions, see `X0_expressions.html` or cheat sheets.
---
......@@ -157,9 +156,7 @@ integrate(pow<2>(valueOf(U)) + unary_dot(gradientOf(U)));
# Working with the mesh
.center[
<img src="images/ellipt_macro.png" width="30%" /><img src="images/torus_macro.jpg" width="30%" />
]
<img src="images/ellipt_macro.png" width="30%" /> <img src="images/torus_macro.jpg" width="30%" />
### Change position of mesh vertices:
<img src="images/Fsi.png" width="70%" />
......
<!DOCTYPE html>
<html>
<head>
<title>AMDiS - Adaptive Multi-Dimensional Simulations</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<style type="text/css">
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);
@import url(https://fonts.googleapis.com/css?family=Raleway);
@import url(https://fonts.googleapis.com/css?family=Ubuntu);
@import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic);
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic);
</style>
<!--<link rel="stylesheet" type="text/css" href="style_display.css" />-->
<link rel="stylesheet" type="text/css" href="style_print2.css" />
</head>
<body>
<textarea id="source">
## List of Expressions
### Terminal/elemental epressions
In the following table, a `DV` represents a pointer or reference to a `DOFVector<T>` of some value type `T`:
| Expression | Semantics |
| --------------- | ----------------------------- |
| `valueOf(DV)` | Evaluation of a DOFVector in local coordinates |
| `gradientOf(DV)`| Evaluation of the gradient of a DOFVector in local coodinates |
| `derivativeOf(DV, i)` | Evaluation of the partial derivative of a DOFVector w.r.t. component i |
| `hessianOf(DV)` | Evaluation of the hessian of a DOFVector, i.e. `H_ij = d_i(d_j(DV))` |
| `laplacianOf(DV)` | Evaluation of the Lacplacian of a DOFVector, i.e. `L = sum_i(d_i(d_i(DV)))` |
| `componentOf(DV, i)` | The i-th Component of a (vector valued) DOFVector |
| `X(), X(i)` | The global coordinate `x(lambda)` of the local coordinate `lambda`, or its i-th component. |
| `N(b), N(b,i)` | The outer boundary normal vector, w.r.t. the boundary face wiht nr `b`, or its i-th component. |
| `M(), M(i)` | The surface normal vector (element normal) for surface grids, or its i-th component. |
| `constant(c), c` | A constant numeric value |
| `constant<C>()` | A constant numeric value evaluable at compile time. Useful for symbolic differentiation, see below. |
| `ref_(c)` | A reference wrapper of a dynamic numeric value. |
The expression `valueOf(DV)` can also be applied to vector or matrices of DOFVectors.:
| Expression | Semantics |
| ---------- | --------- |
| `valueOf(DV)` | Evaluation of a DOFVector in local coordinates |
| `valueOf(vector<DV<T>>)` | Results in a `vector<T>` with values from the DOFVectors evaluated in the local coordinates. |
| `valueOf(matrix<DV<T>>)` | Results in a `matrix<T>` with values from the DOFVectors evaluated in the local coordinates |
| `valueOf<Name>(X)` | An expression with a name, i.e. a unique type `Name`. Usefull for symbolic differentiation. |
---
### Operations on expressions
In the following table operations are listed that can be applied to elemental expressions or combination of those. In the list `T` and `Tn` represent an expression (term) and `F` represents a funktor-objekt (see below).
| Expression | Semantics |
| ---------- | --------- |
| `+, -, *, /` | Arithmetic operations |
| `pow<p>(T)` | The p-th power of an expression. |
| `sqrt(T)` | The square-root of an expression |
| `exp(T)` | The exponential function applied to the evaluated expression |
| `log(T)` | The natural logarithm applied to an evaluated expression. |
| `cos(T), sin(T), tan(T)` | Cosine, sine, and tangens applied to an evaluated expression. |
| `acos(T), asin(T), atan(T)` | Arccosine, Arcsine, and arctangent applied to an evaluated expression |
| `atan2(T1, T2)` | The atan2 function, i.e. arctan(T1 / T2). |
| `cosh(T), sinh(T), tanh(T)` | Hyperbolic cosine, hyperbolic sine, and hyperbolic tangent. |
| `acosh(T), asinh(T), atanh(T)` | Inverse hyperbolic functions applied to an evaluated expression. |
| `max(T1, T2), min(T1, T2)` | The maximum/minimum of two evaluated expressions T1 and T2. |
| `abs_(T), signum(T)` | The absolute value and the sign (`T < 0 => signum(T) := -1, T>0 => signum(T) := 1, T==0 => signum(T) := 0`) |
| `clamp(T, lo, hi)` | Applies the `std::clamp` function locally to the evaluated expression `T`, where `lo` and `hi` are fixed values. |
| `ceil(T), floor(T)` | Round down or up the evaluated expression. |
| `function_(F, T1, T2, T3, ...)` | Apply a functor to the evaluated expressions `T1,T2,...` |
---
A functor is a class with the following structure:
```c++
struct Functor : public FunctorBase
{
typedef (...) value_type;
int getDegree(int d1, int d2, ...) const { return (...); }
value_type operator()(const T1::value_type&, const T2::value_type&, ...) const { return (...); }
};
```
or any valid function object in c++. When it is derived from `FunctorBase` one can specify an polynomial degree of the functor, relative to
the polynomial degrees of the arguments passed to the functor, i.e. the polynomial degrees of the passed expressions.
The `getDegree()` functor is then evaluated in the following form:
```c++
getDegree(T1.getDegree(), T2.getDegree(), ...)
```
---
### Vector-/Matrix-Expressions
For vector- and matrix-valued expressions, like, e.g., `gradientOf(DV)` one can apply functions that act on the vectors/matrices on
evaluation. In the following list, the notation `V` refers to a vector expressions and `M` to a matrix expression:
| Expression | Semantics |
| ---------- | --------- |
| `+, -` | Arithmetic operations (elementwise) |
| `unary_dot(V)` | Scalarprodukt (dorproduct) of a vector with itself: `result = V^H * V`. |
| `dot(V1, V2)` | Scalarprodukt (dorproduct) of two vectors: `result = V1^H * V2`. |
| `one_norm(V)` | The 1-norm of a vectors `result = sum_i(abs(V_i))`. |
| `one_norm(M)` | The 1-norm of a matrix `result = max_j(sum_i(abs(M_ij)))`. |
| `two_norm(V)` | The 2-norm of a vector `result = sqrt(V^H * V)`. |
| `p_norm<p>(V)` | The p-norm of a vector `result = [sum_i(abs(v_i)^p)]^(1/p)`. |
| `cross(V1, V2)` | Crossproduct of two vectors: `result = V1 x V2`. |
| `diagonal(V)` | Diagonal matrix with diagonal entries of the passed vector: `matrix = diagonal(V)`. |
| `outer(V1, V2)` | Outer product (dyadic product / tensorproduct) of two vectors: `matrix = V1 * V2^T`. |
| `trans(M)` | The transposed matrix: `result = M^T`. |
| `at(V, i)` | Access a component of a vector: `result = V_i`. |
| `at(M, i, j)` | Access a component of a matrix: `result = M_ij`. |
</textarea>
<script src="lib/remark.js" type="text/javascript"></script>
<script type="text/javascript" src="MathJax/MathJax.js?config=TeX-AMS_HTML"></script>
<script type="text/javascript">
var slideshow = remark.create({
ratio: "4:3",
highlightLanguage: "cpp"
});
// Setup MathJax
MathJax.Hub.Config({
tex2jax: {
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre']
}
});
MathJax.Hub.Queue(function() {
$(MathJax.Hub.getAllJax()).map(function(index, elem) {
return(elem.SourceElement());
}).parent().addClass('has-jax');
});
MathJax.Hub.Configured();
</script>
</body>
</html>
body { font-family: 'Univers'; }
h1 { font-family: 'DIN-Bold'; }
h2 { font-family: 'DIN-Medium'; }
h3 { font-family: 'Univers'; }
strong { color: #0d4d68; }
a { color: #c55800; }
a:after {
content: " (" attr(href) ")";
}
@page {
size: 960px 720px;
margin: 0;
}
@media print {
.remark-slide-scaler {
width: 100% !important;
height: 100% !important;
transform: scale(1) !important;
top: 0 !important;
left: 0 !important;
}
}
.remark-slide-content {
background: #fff;
color: #333;
padding: 20px;
font-size: 14px;
}
.remark-slide-content h1 {
font-size: 35px;
}
.remark-slide-content h2 {
font-size: 28px;
}
.remark-slide-content h3 {
font-size: 20px;
}
.remark-code, .remark-inline-code { font-family: 'Ubuntu Mono'; font-size: 14px; }
code.remark-code { border-top: 1px solid #ccc; border-bottom: 1px solid #ccc; }
.katex-html { display: none; }
.MathJax_Display {
background: #fff;
color: #333;
padding-top: 10px;
padding-bottom: 10px;
}
.remark-slide-content.fullscreen {
padding: 0;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment