diff --git a/doc/dev/documentation.org b/doc/dev/documentation.org index cb40b0189eff1dad5a457a1aca5621760f12916c..7aa30aca12a32d6a7719173c538749d2d457b8ea 100644 --- a/doc/dev/documentation.org +++ b/doc/dev/documentation.org @@ -73,7 +73,7 @@ https://doc.qt.io/qt-5/model-view-programming.html (last access [fn:org] The org-mode website: https://orgmode.org/ (last access 2023-09-15) -* TODO Architecture +* Architecture Pamhyr2's architecture is based on Qt Model/View, see Figure [[graph-architecture]]. It is made up of several different components: the @@ -672,7 +672,30 @@ data has changed. # Update function code... #+end_src -** TODO Solver +** Solver + +The Pamhyr2 architecture allow to define multiple solver. A solver is +define by a: + - type + - name + - description, + - path + - command line pattern + - (optional) input formater path + - (optional) input formater command line + - (optional) output formater path + - (optional) output formater command line + +Let see Figure [[graph-multi-solver]], the application can implement +different solver type, this solver type implement the code for export +study to solver input format, and read the solver output to study +results. There exists a generic solver with a generic input and output +format, the type could be use to use a solver not implemented in +Pamhyr2, but this solver must can read/write input and output generic +format or use external script. There is possible to define different +solver with the same type, for example two differents version of the +same solver. Finaly, with input and output formater is possible to +execute a code on distant computer, for example, over ssh. #+name: graph-multi-solver #+header: :results drawer @@ -782,6 +805,16 @@ data has changed. } #+end_src +Let see Figure [[graph-pipeline]] the temporal order of action to run a +solver and get results: + - (1) Write solver input file(s) using the study data + - (2) Run the solver + - (2.1) The solver read the input file(s) + - (2.2) The solver compute results and write it to solver output + file(s) + - (3) Pamhyr2 create a Reuslts + - (3.1) The Pamhyr2 solver class read solver output file(s) and + complete Results with readed data #+name: graph-pipeline #+header: :results drawer @@ -811,8 +844,8 @@ data has changed. subgraph cluster1{ label="File System"; style=dashed; - in[label="Solver input files",shape=note]; - out[label="Solver output files",shape=note]; + in[label="Solver input file(s)",shape=note,fillcolor=white]; + out[label="Solver output file(s)",shape=note,fillcolor=white]; bin[label="Solver binary",shape=note]; } @@ -827,6 +860,10 @@ data has changed. } #+end_src +In case of generic solver (or a solver with input and output formater) +the temporal order of action is prensented in Figure +[[graph-pipeline-generic]]. + #+name: graph-pipeline-generic #+header: :results drawer #+header: :exports results @@ -858,8 +895,8 @@ data has changed. gin[label="Generic input file", shape=note,fillcolor=white]; ibin[label="Input formater", shape=note]; - in[label="Solver input files",shape=note,fillcolor=white]; - out[label="Solver output files",shape=note,fillcolor=white]; + in[label="Solver input file(s)",shape=note,fillcolor=white]; + out[label="Solver output file(s)",shape=note,fillcolor=white]; gout[label="Generic results file",shape=note,fillcolor=white]; obin[label="Output formater", shape=note]; bin[label="Solver binary",shape=note]; @@ -894,8 +931,40 @@ data has changed. } #+end_src -** TODO Unit tests -** TODO The debug mode +To implement a Solver in Pamhyr2, there exists a abstract class +=Solver.AbstractSolver=. A class who herits this class, must implement +different methods: + - =export=: Export the study to solver input file(s) + - =input_param=: Return the solver input parameter(s) as string + - =log_file=: Return the solver log file name as string + - =results=: Read the solver output file(s) and return a + =Model.Results= object. + +** Unit tests + +The unit tests is actually not implemented in Pamhyr2, it is a *work +in progress*. + +** The debug mode + +To activate an deactivate the Pamhyr2 debug mode you can open the +configuration window and type "Ctrl+G" or run Pamhyr2 with command +line: +#+begin_src shell +./Pamhyr2 debug +#+end_src + +This mode add some log and add two action in main window menu: +"About/Debug" open a window with Python Repl in current Python +environement, and "About/Debug SQLite" who open the application +SQLiteBrowser (if installed) on current Study to explore the study +data base file. + +#+NAME: debug-repl +#+ATTR_LATEX: :width 16cm +#+CAPTION: Pamhyr2 debug Python REPL +[[./images/python-debug-repl.png]] + * TODO Build the project The project uses gitlab-ci runners to build packages, but it is possible @@ -942,6 +1011,8 @@ winetricks installed. [fn:nsis] The NSIS web site: https://sourceforge.net/projects/nsis/ ** TODO Setup the CI environment +*** Linux +*** Windows (Wine) * Documentation files This document and the user documentation are org files. This text file diff --git a/doc/dev/images/python-debug-repl.png b/doc/dev/images/python-debug-repl.png new file mode 100644 index 0000000000000000000000000000000000000000..5cc506026c104ac044d71300430c0884c8d35fc2 Binary files /dev/null and b/doc/dev/images/python-debug-repl.png differ