v0.13.2
Searching...
No Matches
d_one_sided_Tensor1.hpp
Go to the documentation of this file.
1/* Takes a one-sided derivative of a Tensor1 in a particular
2 direction, yieldind a Tensor1. */
3
4#pragma once
5
6namespace FTensor
7{
8 template <class T, int Dim, char i, int axis> class d_one_sided_Tensor1
9 {
11 const int di, dj, dk;
12 const double dx, dy, dz;
13
14 public:
15 typename promote<T, double>::V operator()(const int N1) const
16 {
17 return axis == 0 ? (a(N1) - *(a.ptr(N1) - di)) * dx
18 : (axis == 1 ? (a(N1) - *(a.ptr(N1) - dj)) * dy
19 : (a(N1) - *(a.ptr(N1) - dk)) * dz);
20 }
21 d_one_sided_Tensor1(const Tensor1<T *, Dim> &A, const int Di, const int Dj,
22 const int Dk, const double Dx, const double Dy,
23 const double Dz)
24 : a(A), di(Di), dj(Dj), dk(Dk), dx(Dx), dy(Dy), dz(Dz)
25 {}
26 };
27
28 template <class T, int Dim, char i, int axis>
30 typename promote<T, double>::V, Dim, i>
32 const Index<i, Dim> index1, const int &di, const int &dj,
33 const int &dk, const double &dx, const double &dy,
34 const double &dz)
35 {
36 using TensorExpr = d_one_sided_Tensor1<T, Dim, i, axis>;
38 TensorExpr(a, di, dj, dk, dx, dy, dz));
39 }
40}
static Number< 1 > N1
constexpr double a
promote< T, double >::V operator()(const int N1) const
const Tensor1< T *, Dim > & a
d_one_sided_Tensor1(const Tensor1< T *, Dim > &A, const int Di, const int Dj, const int Dk, const double Dx, const double Dy, const double Dz)
FTensor::Index< 'i', SPACE_DIM > i
Tensors class implemented by Walter Landry.
Definition: FTensor.hpp:51
promote< T, double >::V d_one_sided(const Tensor0< T * > &a, const Number< 0 > n1, const int &di, const int &dj, const int &dk, const double &dx, const double &dy, const double &dz)
constexpr AssemblyType A