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 Operand} class}
18
19The {\class Operand} class stores a {\class AlgebraicOperator}, a user data (either {\class Function}
20or {\class Value}) and conjugate, transpose flags. It is mainly used by the {\class OperatorOnUnknown}
21class as left or right-hand side of a generalized differential operator (see the next section).
22The only allowed algebraic operations defined in the {\class AlgebraicOperator} enumeration, are:\\
23\hspace*{5mm}$\bullet$ the standard product, operator \verb?*? \\
24\hspace*{5mm}$\bullet$ the inner product (hermitian product), operator \verb?|? \\
25\hspace*{5mm}$\bullet$ the cross product, operator \verb?^? \\
26\hspace*{5mm}$\bullet$ the contracted product, operator \verb?%? \\
27
28\vspace{.2cm}
29\begin{lstlisting}
30enum AlgebraicOperator {_product,_innerProduct,_crossProduct,_contractedProduct};
31class Operand
32{
33protected :
34   const Value* val_p;           // pointer to operand object (a Value)
35   const Function * fun_p;       // pointer to Function object
36   bool isFunction_;             // function flag
37   bool conjugate_;              // true if the operand has to be conjugated
38   bool transpose_;              // true if the operand has to be transposed
39   AlgebraicOperator operation_; // operand operator
40\end{lstlisting}
41\vspace{.2cm}
42This class provides few public constructors:
43\vspace{.1cm}
44\begin{lstlisting}[]
45Operand(const Function&,AlgebraicOperator); // from a Function
46Operand(const Value&,AlgebraicOperator);    // from a Value  (Value is copied)
47Operand(const Value*,AlgebraicOperator);    // from a Value* (Value is not copied)
48template <typename T>
49Operand(const T &,AlgebraicOperator);       // from a scalar, a Vector or a Matrix
50\end{lstlisting}
51\vspace{.1cm}
52The templated constructor avoids the user to give explicitly a Value object, "ordinary" objects
53such scalar, vector or matrix
54may be passed to the constructor.\\
55
56The other member functions are some accessors functions:
57\vspace{.1cm}
58\begin{lstlisting}[]
59bool isFunction() const;
60bool conjugate() const;
61bool& conjugate();
62bool transpose() const;
63bool& transpose();
64AlgebraicOperator operation() const;
65const Value& value() const;
66const Function& function() const;
67template<class T> T& valueT() const;
68\end{lstlisting}
69\vspace{.2cm}
70There are two printing facilities:
71\vspace{.1cm}
72\begin{lstlisting}[]
73void Operand::print(std::ostream&) const;
74std::ostream& operator<<(std::ostream&,const Operand &);
75\end{lstlisting}
76\vspace{.1cm}
77\begin{remark}
78The {\class Operand} class is an internal class linked to the {\class OperatorOnUnknown} class.
79Normally, an end user does not use this class.
80\end{remark}
81
82\displayInfos{library=operator, header=Operand.hpp, implementation=Operand.cpp, test=test\_operator.cpp,
83header dep={config.h, utils.h}}
84