v0.14.0
Tensor2_transform.hpp
Go to the documentation of this file.
1 /* Applies an arbitrary function to the Tensor2_Expr. */
2 
3 #pragma once
4 
5 namespace FTensor
6 {
7  template <class A, class B, class T, int Dim0, int Dim1, char i, char j>
9  {
11  B function;
12 
13  public:
14  T operator()(const int N1, const int N2) const
15  {
16  return function(iterA(N1, N2));
17  }
18 
20  : iterA(a), function(func)
21  {}
22  };
23 
24  template <class A, class B, class T, int Dim0, int Dim1, char i, char j>
25  Tensor2_Expr<transform_Tensor2<A, B, T, Dim0, Dim1, i, j>, T, Dim0, Dim1, i,
26  j>
28  {
31  TensorExpr(a, function));
32  }
33 }
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
FTensor::Tensor2_Expr
Definition: Tensor2_Expr.hpp:26
FTensor::transform_Tensor2::transform_Tensor2
transform_Tensor2(const Tensor2_Expr< A, T, Dim0, Dim1, i, j > &a, B func)
Definition: Tensor2_transform.hpp:19
FTensor::transform_Tensor2::iterA
const Tensor2_Expr< A, T, Dim0, Dim1, i, j > iterA
Definition: Tensor2_transform.hpp:10
a
constexpr double a
Definition: approx_sphere.cpp:30
FTensor::transform_Tensor2::operator()
T operator()(const int N1, const int N2) const
Definition: Tensor2_transform.hpp:14
FTensor::transform_Tensor2::function
B function
Definition: Tensor2_transform.hpp:11
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
FTensor::transform
Tensor2_Expr< transform_Tensor2< A, B, T, Dim0, Dim1, i, j >, T, Dim0, Dim1, i, j > transform(const Tensor2_Expr< A, T, Dim0, Dim1, i, j > &a, B function)
Definition: Tensor2_transform.hpp:27
FTensor::transform_Tensor2
Definition: Tensor2_transform.hpp:8