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
17The documentation policy of the library is based on three complementary documentations:
18\begin{itemize}
19\item a online documentation compliant with \doxygen syntax,
20\item a user documentation describing main features of the library with some examples,
21\item a developer documentation describing as possible all the features and given additional
22explanations.
23\end{itemize}
24It is the responsibility and the duty of the developers to write these documentations \textbf{in
25English}.
26
27\section{Inline documentation}
28
29The inline documentation is compliant with \doxygen syntax and the html documentation is automatically
30generated with majors updates by the source control manager.
31
32This inline documentation follows a documentation convention available on the development page
33of the \xlifepp website: \url{http://uma.ensta-paristech.fr/XLiFE++/} . We will
34sum it up now in the following:
35
36\subsection{General points}
37
38\begin{enumerate}
39\item The reference language of the documentation is English.
40\item Function or operation declarations  are documented with brief (one-line, one-sentence)
41comments and only brief comments.
42\item Function or operation definitions (inline or not) are documented by detailed comments.
43\end{enumerate}
44
45\subsection{Documentation of a file}
46
47Here is the structure of the comment you have to write to document a file (header or source)
48:
49
50\begin{lstlisting}
51/*!
52    brief comment
53
54    \file Parameter.hpp
55    \author T. Anderson
56    \date 25 jan 2011
57    \since 3 mar 2007
58
59    next part of detailed comment
60 */
61\end{lstlisting}
62
63This comment is dedicated to present the content of the file: list of classes, list of external
64functions, \ldots It is written at the top of the file before everything else.
65
66\medskip
67
68Some additional remarks:
69
70\begin{itemize}
71\item Thanks to the \lstinline{QT_AUTOBRIEF = YES} parameter, the first line of the comment
72is interpreted as the brief comment. Therefore, the brief comment has to be placed before everything
73else. There is another solution with the macro $\backslash$brief:
74
75\begin{lstlisting}
76/*!
77    \file Parameter.hpp
78    \author T. Anderson
79    \date 25 jan 2011
80    \since 3 mar 2007
81
82    \brief brief comment
83
84    next part of detailed comment
85 */
86\end{lstlisting}
87
88\item The $\backslash$date macro is the last modification date.
89\item The $\backslash$since macro is the file creation date.
90\item When there are several authors, you will use the $\backslash$authors macro:
91
92\begin{lstlisting}
93/*!
94    brief comment
95
96    \file Parameter.hpp
97    \authors T. Anderson, R. Cypher
98    \date 25 jan 2011
99    \since 3 mar 2007
100
101    next part of detailed comment
102 */
103\end{lstlisting}
104In this case, authors are separated by commas.
105\end{itemize}
106
107The file documentation rules are:
108
109\begin{enumerate}
110\item The file documentation is written at the top of the file, before everything else,
111\item The file documentation follows one of the previous syntaxes, with the 4 pieces of information
112file name, author(s), creation date and last modification date.
113\end{enumerate}
114
115\subsection{Documentation of a class, a typedef, an enum or a struct}
116
117\begin{enumerate}
118\item A class documentation is written just before the class declaration/definition in the
119header file.
120\item The structure of the class documentation is as follows:
121
122\begin{lstlisting}
123/*!
124    \class A
125    brief comment associated to A
126
127    next part of detailed comment associated to A
128 */
129class A {
130...
131};
132\end{lstlisting}
133\item To document a typedef, you will use the $\backslash$typedef macro instead of the $\backslash$class
134macro.
135\item To document a struct, you will use the $\backslash$struct macro instead of the $\backslash$class
136macro.
137\item To document an enum, you will use the $\backslash$enum macro instead of the $\backslash$class
138macro.
139\end{enumerate}
140
141\subsection{Documentation of attributes}
142
143\begin{enumerate}
144\item Attributes can be documented according to one of the following syntax:
145\begin{lstlisting}
146class A {
147  public :
148    //! comment associated to i
149    int i;
150    double j; //!< comment associated to j
151    /*!
152      comment associated to k
153     */
154    B k;
155    ...
156\end{lstlisting}
157\end{enumerate}
158
159\subsection{Documentation of functions and constructors}
160
161\begin{enumerate}
162\item Functions and operations declarations are documented with a brief comment, and only a
163brief comment. The syntax, shown here for operations but valid for external functions, is one
164of the following
165:
166\begin{lstlisting}
167class A {
168  public :
169    ...
170   //! brief comment associated to declaration of f
171   void f();
172
173   /*!
174       brief comment associated to declaration of g
175    */
176   void g();
177
178   void h(); //!< comment associated to declaration of h
179};
180\end{lstlisting}
181\item Functions and operations definitions (inline or not) are documented with detailed comments.
182If the declaration has not been commented first, the first line of the comment will be the
183brief comment, as seen in previous sections. The syntax, shown here for inline operations but
184valid for the others types, is one of the following:
185
186\begin{lstlisting}
187class A {
188  public :
189    B b;
190    ...
191   //! comment associated to definition of f
192   void f() {
193   ...
194   }
195   void g() //! comment associated to definition of g
196   {
197   ...
198   }
199   A() //! comment associated to definition of composite constructor
200   : B()
201   {
202   ...
203   }
204
205   /*!
206      comment associated to definition of h
207    */
208   void h() {
209   ...
210   }
211};
212\end{lstlisting}
213
214You may notice that for the function g, the comment marking is //! and not //!< and that for
215the constructor in the same case, the comment is placed before components constructor calls.
216\end{enumerate}
217
218Let's see how to document function arguments.
219
220\subsection{Documentation of arguments}
221
222\begin{enumerate}
223\item In the case only of a function definition (or an operation definition), you may want
224to document arguments and return value. The syntax is one of the following
225:
226\begin{lstlisting}
227/*!
228    comment of function f
229 */
230int f (double d, //!< comment of d
231       int i //!< comment of i
232      ) {
233...
234}
235/*!
236    comment of function g
237    \param d comment of d
238    \param i comment of i
239    \return comment of return value
240 */
241int g (double d, int i) {
242...
243}
244\end{lstlisting}
245\end{enumerate}
246
247\section{User and developer documentation}
248
249User documentation as well developer documentation have to be written \textbf{in \LaTeX{} format}.
250Each tex file concerns a package of files of the library, namely a topics of the library, for
251instance Parameters. For each package {\lib xxx}, two files have to be written: the user documentation
252file, named  \emph{xxx.tex} placed in subdirectory {\tt doc/pdf/inputs/dev/} and the developer
253documentation file, also named \emph{xxx.tex}, but placed in the subdirectory {\tt doc/pdf/inputs/usr/}.
254In these files, there are only latex section items (one or fewer) and subsection items, no
255chapter items. All these files are collected in the main tex files: \emph{user\_documentation.tex}
256and \emph{dev\_documentation.tex} in chapter environment, each chapter corresponding to a folder
257of the library. \\
258
259For instance, the Parameters user documentation (\emph{Parameters.tex}) looks like:
260
261\begin{lstlisting}[language={}]
262\section{Parameters classes}
263
264In order to attached some user's data to anything (in particular functions), two classes
265(Parameter and Parameters) are proposed. The {\class Parameter} class handles a single data
266of type \emph{integer, real, complex, string} or \emph{void *} with the possibility to name
267the parameter. The {\class Parameters} class handles a list of {\class Parameter} objects.\\
268
269\subsection{The {\class Parameter} object}
270
271It is easy to define a parameter by its constructor or the assignment operation:
272...
273\subsection{The {\class Parameters} object: List of parameters}
274...
275
276\end{lstlisting}
277
278The Parameters developer documentation (\emph{Parameters.tex}) looks like:
279
280\begin{lstlisting}[language={}]
281\section{Parameters}
282
283It may be useful to have a data structure to store freely any kind of parameters (values,
284string, ...) with a very simple interface for the end user. In particular, such structure
285could be attached to user functions (see chap. \ref{chapfunctions}). This is achieved with
286two classes: the {\class Parameter} class which define one parameter and the
287{\class Parameters} class which manages a list of {\class Parameter} objects.
288
289\subsection{The {\class Parameter} class}
290
291The aim of the {\class Parameter} class is to encapsulate in the same structure, a data of
292integer type, real type, complex type, string type and pointer type (void pointer) with the
293capability to name the parameter. Thus, this class proposes as private members:
294...
295\subsection{The {\class Parameters} class}
296...
297
298\displayInfos{library=utils, header=Parameters.hpp, implementation=Parameters.cpp,
299 test=test\_Parameters.cpp, header dep={config.h, String.hpp}, stl dep={map, iostream,
300sstream}}
301\end{lstlisting}
302
303\begin{itemize}
304\item The end of a file has to be exposed the file dependences with the following form:
305
306\displayInfos{library=utils, header=Parameters.hpp, implementation=Parameters.cpp, test=test\_Parameters.cpp,
307header dep={config.h, String.hpp}}
308
309For this purpose, you have to use the {\bf $\backslash$displayInfos} macro.
310
311\item To handle some C++ lines, you have to use the environment \emph{lstlisting}:
312
313\begin{verbatim}
314\begin{lstlisting}
315class Parameter
316{...};
317\end{lstlisting}
318\end{verbatim}
319
320\begin{lstlisting}
321class Parameter
322{...};
323\end{lstlisting}
324\vspace{2mm}
325or if you want to ignore language colors:
326\begin{verbatim}
327\begin{lstlisting}[language={}]
328class Parameter
329{...};
330\end{lstlisting}
331\end{verbatim}
332
333\begin{lstlisting}[language={}]
334class Parameter
335{...};
336\end{lstlisting}
337
338\item When you name a class, for example {\class Messages}, you have to use the {\bf $\backslash$class}
339macro:
340\begin{verbatim}
341The {\class Messages} class
342\end{verbatim}
343
344\item When you name a sublibrary of \xlifepp (a subdirectory of src), you have to use the {\bf
345$\backslash$lib} macro:
346\begin{verbatim}
347The {\lib utils} library
348\end{verbatim}
349
350\item When you name a function, you have to use the {\bf $\backslash$cmd} macro:
351\begin{verbatim}
352The {\cmd findDomain} function
353\end{verbatim}
354
355\item When you name the library \xlifepp, you have to use the {\bf $\backslash$xlifepp} macro. For external libraries of softwares, such as \gmsh or \arpackpp, you have to use {\bf $\backslash$gmsh} or {\bf $\backslash$arpackpp} macros. The full available list is : {\bf $\backslash$xlifepp}, {\bf $\backslash$gmsh}, {\bf $\backslash$arpack}, {\bf $\backslash$arpackpp}, {\bf $\backslash$blas}, {\bf $\backslash$lapack}, {\bf $\backslash$umfpack}, {\bf $\backslash$eispack}, {\bf $\backslash$melina}, {\bf $\backslash$melinapp}, {\bf $\backslash$montjoie}, {\bf $\backslash$paraview}, {\bf $\backslash$freefem}, {\bf $\backslash$doxygen}, {\bf $\backslash$cmake}, {\bf $\backslash$git} and {\bf $\backslash$convmesh}.
356
357\item When you add a package documentation in \emph{user\_documentation.tex} or \emph{dev\_documentation.tex},
358you have to use the {\bf $\backslash$inputDoc} with the basename of the file in argument, and
359to add it in the main itemize of the library:
360
361\begin{lstlisting}[language={[LaTeX]TeX}]
362\chapter{The {\lib utils} library}
363
364The {\lib utils} library collects all the general useful classes and functionalities of the
365\xlifepp library. It is an independent library. It addresses:
366
367\begin{itemize}
368\item {\class String} capabilities (mainly additional functions to the
369{\class std::string} class)
370\item {\class Point} class to deal with point of any dimension
371\item {\class Vector} class to deal with numerical vectors (say real or complex vectors)
372\item {\class Matrix} class to deal with numerical matrices with dense storage (small
373matrices)
374\item {\class Parameter} classes to deal with general set of user parameters
375\item {\class Function} class encapsulating user functions
376\item {\class Messages} classes to handle error, warning and info messages
377\end{itemize}
378
379\inputDoc{String}
380\inputDoc{Point}
381\inputDoc{Vector}
382\inputDoc{Matrix}
383\inputDoc{Parameters}
384\inputDoc{Functions}
385\inputDoc{Messages}
386\end{lstlisting}
387
388\item When you add a general documentation in \emph{user\_documentation.tex} or \emph{dev\_documentation.tex},
389you have to use the {\bf $\backslash$inputDoc*} with the basename of the file in argument,
390and to add it in the main itemize of the library:
391
392\begin{lstlisting}[language={[LaTeX]TeX}]
393\chapter{Tests policy}
394
395In order to maintain backward compatibility of the code during its development, it is
396mandatory to have various test functions. Some of them are local test functions, says
397low level tests, and concerns "exhaustive" tests of functionalities of a class or a
398collection of classes or utilities. Others are global test functions, say high level test
399functions, involving a lot of classes of the library, for instance, solving a physical
400problem from the mesh up to the results.
401
402\inputDoc*{tests_policy}
403\end{lstlisting}
404\end{itemize}
405
406
407
408