1%%%%%%%%%%%%%%%%%%%
2% XLiFE++ is an extended library of finite elements written in C++
3%     Copyright (C) 2014  Lunéville, Eric; Kielbasiewicz, Nicolas; Lafranche, Yvon; Nguyen, Manh-Ha; Chambeyron, Colin
4%
5%     This program is free software: you can redistribute it and/or modify
6%     it under the terms of the GNU General Public License as published by
7%     the Free Software Foundation, either version 3 of the License, or
8%     (at your option) any later version.
9%     This program is distributed in the hope that it will be useful,
10%     but WITHOUT ANY WARRANTY; without even the implied warranty of
11%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12%     GNU General Public License for more details.
13%     You should have received a copy of the GNU General Public License
14%     along with this program.  If not, see <http://www.gnu.org/licenses/>.
15%%%%%%%%%%%%%%%%%%%
16
17\section{The {\classtitle TensorKernel} class}
18
19The{\class TensorKernel} class inherited from {\class Kernel} handles some particular kernels, say tensor kernels:
20$$
21K(x,y)= \sum_{m,\, n } \phi_n(y) \mathbb{A}_{mn} \psi_m(x).
22$$
23This kernel is involved in DirichletToNeumann map. \\
24\begin{remark}
25In case of complex basis functions, the {\class TensorKernel} is often involved in integral of the following form:
26$$
27\sum _{mn} \mathbb{A}_{mn}\int_\Sigma w_j(y)*\overline{\phi}_n(y)\int_\Gamma \tau_i(x)*\psi_m(x)
28$$
29where appears a conjugate operation on $\phi_n$ functions.\\
30By default, computation functions do not apply the conjugate operation. So if you have to applied to, there is a flag to enforce the conjugate operation.
31\end{remark}
32
33
34Because, {\class Kernel} class uses {\class SpectralBasis} class to handles functions $\phi_n$ and $\psi_n$, it can not be located in {\lib utils} library. It is the reason why it is located  in {\lib term} library.
35\vspace{.1cm}
36\begin{lstlisting}[]{}
37class TensorKernel : public Kernel
38{
39protected :
40  const SpectralBasis* phi_p, *psi_p; //pointers to SpectralBasis object
41  VectorEntry* matrix_p;              //matrix stored as a vector
42public :
43  bool isDiag;          //!< true if matrix is diagonal matrix
44  Function xmap, ymap;  //!< maps applied to point x and y
45  bool isConjugate;     //!< conjugate phi_p in IESP computation (default=false)
46\end{lstlisting}
47\vspace{.3cm}
48{\class SpectralBasis} class manages either a family of explicit functions given by a {\class Function} object or a family of interpolated functions given as a vector of {\class TermVector} (see {\class SpectralBasisFun} class and {\class SpectralBasisInt} defined in {\lib space} library). Stored as a {\class MatrixEntry} object, the matrix $\mathbb{A}$ may be of real or complex type.\\
49The{\class TensorKernel} class provides some explicit constructors from {\class SpectralBasis} and vector<T> (matrix $\mathbb{A}$) and some implicit constructors from {\class Unknown} associated to a spectral space equipped with a spectral basis, and vector<T>.
50\vspace{.1cm}
51\begin{lstlisting}[]{}
52TensorKernel();
53template<typename T>
54 TensorKernel(const SpectralBasis&, const std::vector<T>&, bool =false);
55template<typename T>
56 TensorKernel(const SpectralBasis&, const std::vector<T>&, const SpectralBasis&);
57template<typename T>
58 TensorKernel(const Unknown&, const std::vector<T>&, bool =false);
59template<typename T>
60  TensorKernel(const Unknown&, const std::vector<T>&, const Unknown&);
61template<typename T>
62  TensorKernel(const std::vector<TermVector>&, const std::vector<T>&, bool =false);
63template<typename T>
64  TensorKernel(const std::vector<TermVector>&, const std::vector<T>&, const std::vector<TermVector>&);
65~TensorKernel();
66\end{lstlisting}
67\vspace{.3cm}
68Besides it provides some accessors and properties
69\vspace{.1cm}
70\begin{lstlisting}[]{}
71const VectorEntry& vectorEntry() const {return *matrix_p;}
72const SpectralBasis* phip() const {return phi_p;}
73const SpectralBasis* psip() const {return psi_p;}
74const SpectralBasis& phi()  const {return *phi_p;}
75const SpectralBasis& psi()  const {return *psi_p;}
76const TensorKernel* tensorKernel() const;
77TensorKernel* tensorKernel();
78
79Dimen dimOfPhi() const;
80Dimen dimOfPsi() const;
81Number nbOfPhi() const;
82Number nbOfPsi() const;
83bool phiIsAnalytic() const;
84bool psiIsAnalytic() const;
85virtual KernelType type() const;
86virtual bool isSymbolic() const;
87virtual ValueType valueType() const;
88virtual StrucType structType() const;
89bool sameBasis() const;
90\end{lstlisting}
91\vspace{.3cm}
92It proposes two template functions that compute the product of $\mathbb{A}_m$ or $\mathbb{A}_{mn}$ by something of type T, expecting a a result of same type!
93\vspace{.1cm}
94\begin{lstlisting}[]{}
95template<typename T>
96 T kernelProduct(Number, const T&) const;
97template<typename T>
98 T kernelProduct(Number, Number, const T&) const;
99\end{lstlisting}
100\vspace{.3cm}
101
102\displayInfos{library=operator, header=TensorKernel.hpp, implementation=TensorKernel.cpp,
103test=test\_EssentialCondition.cpp, header dep={space.h, config.h, utils.h}}
104