\hypertarget{get__mex__arguments_8cpp}{
\section{D:/Basile/Visual\-Cpp\-Projects/hydro\-MEX3/hydro\-MEX3/hydro\_\-source/get\_\-mex\_\-arguments.cpp File Reference}
\label{get__mex__arguments_8cpp}\index{D:/Basile/VisualCppProjects/hydroMEX3/hydroMEX3/hydro_source/get_mex_arguments.cpp@{D:/Basile/VisualCppProjects/hydroMEX3/hydroMEX3/hydro\_\-source/get\_\-mex\_\-arguments.cpp}}
}
{\tt \#include \char`\"{}math.h\char`\"{}}\par
{\tt \#include \char`\"{}mex.h\char`\"{}}\par
{\tt \#include \char`\"{}string.h\char`\"{}}\par
{\tt \#include \char`\"{}Datas.h\char`\"{}}\par
{\tt \#include \char`\"{}get\_\-mex\_\-arguments.h\char`\"{}}\par


Include dependency graph for get\_\-mex\_\-arguments.cpp:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=384pt]{get__mex__arguments_8cpp__incl}
\end{center}
\end{figure}
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define \hyperlink{get__mex__arguments_8cpp_1daf785e3f68d293c7caa1c756d5cb74}{pi}~3.141592653589793
\item 
\#define \hyperlink{get__mex__arguments_8cpp_598a3330b3c21701223ee0ca14316eca}{PI}~3.141592653589793
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{get__mex__arguments_8cpp_0f89a01311e66438fe2f0813747d24e0}{init\-Parameters} (struct \hyperlink{structparameters}{parameters} $\ast$P)
\begin{CompactList}\small\item\em Initialize integrator options to default. \item\end{CompactList}\item 
void \hyperlink{get__mex__arguments_8cpp_60b56cb5be1a277a718073b3f4ce4190}{get\_\-Parameters} (int nlhs, mx\-Array $\ast$plhs\mbox{[}$\,$\mbox{]}, int nrhs, const mx\-Array $\ast$prhs\mbox{[}$\,$\mbox{]}, struct \hyperlink{structparameters}{parameters} $\ast$P)
\begin{CompactList}\small\item\em Get integrator options parameters From MATLAB. \item\end{CompactList}\item 
double $\ast$ \hyperlink{get__mex__arguments_8cpp_9e6d1904b36adacc28c7ce91cc37314e}{get\_\-state} (int nlhs, mx\-Array $\ast$plhs\mbox{[}$\,$\mbox{]}, int nrhs, const mx\-Array $\ast$prhs\mbox{[}$\,$\mbox{]})
\begin{CompactList}\small\item\em Get the initial ($ t=0 $) state vector ($ \vec{q} $) from MATLAB. \item\end{CompactList}\item 
void \hyperlink{get__mex__arguments_8cpp_21666d3e94bd56e02580bb690ea523d6}{delete\_\-state} (double $\ast$state)
\begin{CompactList}\small\item\em Free state vector ($ \vec{q} $) memory. \item\end{CompactList}\item 
char $\ast$ \hyperlink{get__mex__arguments_8cpp_477ae92a30cb18a4d8b0a6f96cfed340}{get\_\-flag} (int nlhs, mx\-Array $\ast$plhs\mbox{[}$\,$\mbox{]}, int nrhs, const mx\-Array $\ast$prhs\mbox{[}$\,$\mbox{]})
\begin{CompactList}\small\item\em Get flag from MATLAB (not used). \item\end{CompactList}\item 
void \hyperlink{get__mex__arguments_8cpp_3c6c9ceea1c72fef37d277657857cef4}{get\_\-joystick\_\-parameters} (int nlhs, mx\-Array $\ast$plhs\mbox{[}$\,$\mbox{]}, int nrhs, const mx\-Array $\ast$prhs\mbox{[}$\,$\mbox{]}, struct \hyperlink{structjoy__parameters}{joy\_\-parameters} $\ast$j\-P)
\begin{CompactList}\small\item\em Get joystick options parameters From MATLAB. \item\end{CompactList}\item 
void \hyperlink{get__mex__arguments_8cpp_78bf47f99d3da4252677a9587f93cc39}{get\_\-time} (int nlhs, mx\-Array $\ast$plhs\mbox{[}$\,$\mbox{]}, int nrhs, const mx\-Array $\ast$prhs\mbox{[}$\,$\mbox{]}, \hyperlink{struct_o_d_e__data}{ODE\_\-data} $\ast$f\_\-dat)
\begin{CompactList}\small\item\em Get time parameter from MATLAB. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
\begin{Desc}
\item[Author:]\href{mailto:basile.graf@epfl.ch}{\tt basile.graf@epfl.ch}\end{Desc}
This file contains functions for getting parameters from MATLAB 

Definition in file \hyperlink{get__mex__arguments_8cpp-source}{get\_\-mex\_\-arguments.cpp}.

\subsection{Define Documentation}
\hypertarget{get__mex__arguments_8cpp_598a3330b3c21701223ee0ca14316eca}{
\index{get_mex_arguments.cpp@{get\_\-mex\_\-arguments.cpp}!PI@{PI}}
\index{PI@{PI}!get_mex_arguments.cpp@{get\_\-mex\_\-arguments.cpp}}
\subsubsection[PI]{\setlength{\rightskip}{0pt plus 5cm}\#define PI~3.141592653589793}}
\label{get__mex__arguments_8cpp_598a3330b3c21701223ee0ca14316eca}




Definition at line 19 of file get\_\-mex\_\-arguments.cpp.\hypertarget{get__mex__arguments_8cpp_1daf785e3f68d293c7caa1c756d5cb74}{
\index{get_mex_arguments.cpp@{get\_\-mex\_\-arguments.cpp}!pi@{pi}}
\index{pi@{pi}!get_mex_arguments.cpp@{get\_\-mex\_\-arguments.cpp}}
\subsubsection[pi]{\setlength{\rightskip}{0pt plus 5cm}\#define pi~3.141592653589793}}
\label{get__mex__arguments_8cpp_1daf785e3f68d293c7caa1c756d5cb74}




Definition at line 18 of file get\_\-mex\_\-arguments.cpp.

\subsection{Function Documentation}
\hypertarget{get__mex__arguments_8cpp_21666d3e94bd56e02580bb690ea523d6}{
\index{get_mex_arguments.cpp@{get\_\-mex\_\-arguments.cpp}!delete_state@{delete\_\-state}}
\index{delete_state@{delete\_\-state}!get_mex_arguments.cpp@{get\_\-mex\_\-arguments.cpp}}
\subsubsection[delete\_\-state]{\setlength{\rightskip}{0pt plus 5cm}void delete\_\-state (double $\ast$ {\em state})}}
\label{get__mex__arguments_8cpp_21666d3e94bd56e02580bb690ea523d6}


Free state vector ($ \vec{q} $) memory. 

Free the memory alocated by \hyperlink{get__mex__arguments_8cpp_9e6d1904b36adacc28c7ce91cc37314e}{get\_\-state()} \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em $\ast$state}]pointer to the double\mbox{[}12\mbox{]} state array ($ \vec{q} $) \end{description}
\end{Desc}


Definition at line 175 of file get\_\-mex\_\-arguments.cpp.

Referenced by mex\-Function().\hypertarget{get__mex__arguments_8cpp_477ae92a30cb18a4d8b0a6f96cfed340}{
\index{get_mex_arguments.cpp@{get\_\-mex\_\-arguments.cpp}!get_flag@{get\_\-flag}}
\index{get_flag@{get\_\-flag}!get_mex_arguments.cpp@{get\_\-mex\_\-arguments.cpp}}
\subsubsection[get\_\-flag]{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ get\_\-flag (int {\em nlhs}, mx\-Array $\ast$ {\em plhs}\mbox{[}$\,$\mbox{]}, int {\em nrhs}, const mx\-Array $\ast$ {\em prhs}\mbox{[}$\,$\mbox{]})}}
\label{get__mex__arguments_8cpp_477ae92a30cb18a4d8b0a6f96cfed340}


Get flag from MATLAB (not used). 

Get the flag parameter from MATLAB (NOT USED) \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em nlhs}]Number of left hand side arguments in the MATLAB prompt \item[{\em $\ast$plhs\mbox{[}$\,$\mbox{]}}]Array of pointers to the left hand side arguments from MATLAB prompt \item[{\em nrhs}]Number of right hand side arguments in the MATLAB prompt \item[{\em $\ast$prhs\mbox{[}$\,$\mbox{]}}]Array of pointers to the right hand side arguments from MATLAB prompt \end{description}
\end{Desc}


Definition at line 182 of file get\_\-mex\_\-arguments.cpp.\hypertarget{get__mex__arguments_8cpp_3c6c9ceea1c72fef37d277657857cef4}{
\index{get_mex_arguments.cpp@{get\_\-mex\_\-arguments.cpp}!get_joystick_parameters@{get\_\-joystick\_\-parameters}}
\index{get_joystick_parameters@{get\_\-joystick\_\-parameters}!get_mex_arguments.cpp@{get\_\-mex\_\-arguments.cpp}}
\subsubsection[get\_\-joystick\_\-parameters]{\setlength{\rightskip}{0pt plus 5cm}void get\_\-joystick\_\-parameters (int {\em nlhs}, mx\-Array $\ast$ {\em plhs}\mbox{[}$\,$\mbox{]}, int {\em nrhs}, const mx\-Array $\ast$ {\em prhs}\mbox{[}$\,$\mbox{]}, struct \hyperlink{structjoy__parameters}{joy\_\-parameters} $\ast$ {\em j\-P})}}
\label{get__mex__arguments_8cpp_3c6c9ceea1c72fef37d277657857cef4}


Get joystick options parameters From MATLAB. 

Get joystick settings from MATLAB. \par
 In the MATLAB prompt, a struct j\-P can be passed containing some or all of the followings (if not set, default is used): \par
 \hyperlink{graphics__main_8cpp_b1761c91e3594dec827fe60e992d2e1a}{j\-P.dir\-X}: Positive direction for axis X \par
 \hyperlink{graphics__main_8cpp_72324d3d2f391a353c57aaa03b148d8d}{j\-P.dir\-Y}: Positive direction for axis Y \par
 \hyperlink{graphics__main_8cpp_6fc68ee789a22aa3976562aef3e39780}{j\-P.dir\-Z}: Positive direction for axis Z \par
 \hyperlink{graphics__main_8cpp_019c032406906b366853fee46fe14ee8}{j\-P.dir\-R}: Positive direction for axis R \par
 \hyperlink{graphics__main_8cpp_5a3c2aa9a76204fb5a88ad3feaa9a0f4}{j\-P.do\-X}: Use joystick control or keyboard for axis X \par
 \hyperlink{graphics__main_8cpp_400d40cdb5ad93ffc84da0cc86cb351c}{j\-P.do\-Y}: Use joystick control or keyboard for axis Y \par
 \hyperlink{graphics__main_8cpp_8ffdb1e1aa5b4f8c1f41601c9c69529a}{j\-P.do\-Z}: Use joystick control or keyboard for axis Z \par
 \hyperlink{graphics__main_8cpp_9b61dde9e1f583fd397cc8d18889eb20}{j\-P.do\-R}: Use joystick control or keyboard for axis R \par
 

Definition at line 213 of file get\_\-mex\_\-arguments.cpp.

References joy\_\-parameters::dir\-R, joy\_\-parameters::dir\-X, joy\_\-parameters::dir\-Y, joy\_\-parameters::dir\-Z, joy\_\-parameters::do\-R, joy\_\-parameters::do\-X, joy\_\-parameters::do\-Y, and joy\_\-parameters::do\-Z.

Referenced by mex\-Function().\hypertarget{get__mex__arguments_8cpp_60b56cb5be1a277a718073b3f4ce4190}{
\index{get_mex_arguments.cpp@{get\_\-mex\_\-arguments.cpp}!get_Parameters@{get\_\-Parameters}}
\index{get_Parameters@{get\_\-Parameters}!get_mex_arguments.cpp@{get\_\-mex\_\-arguments.cpp}}
\subsubsection[get\_\-Parameters]{\setlength{\rightskip}{0pt plus 5cm}void get\_\-Parameters (int {\em nlhs}, mx\-Array $\ast$ {\em plhs}\mbox{[}$\,$\mbox{]}, int {\em nrhs}, const mx\-Array $\ast$ {\em prhs}\mbox{[}$\,$\mbox{]}, struct \hyperlink{structparameters}{parameters} $\ast$ {\em P})}}
\label{get__mex__arguments_8cpp_60b56cb5be1a277a718073b3f4ce4190}


Get integrator options parameters From MATLAB. 

Get solver settings from MATLAB. \par
 In the MATLAB prompt, a struct P can (must) be passed containing some or all of the followings (if not set, default is used, exept for param): \par
 P.abstol: Absolute tolerance (scalar (all the same) or vector of length 12) \par
 P.reltol: Relative tolerance (scalar) \par
 P.param : Parameters vector (diverse), MUST be given, see MATLAB model... \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em nlhs}]Number of left hand side arguments in the MATLAB prompt \item[{\em $\ast$plhs\mbox{[}$\,$\mbox{]}}]Array of pointers to the left hand side arguments from MATLAB prompt \item[{\em nrhs}]Number of right hand side arguments in the MATLAB prompt \item[{\em $\ast$prhs\mbox{[}$\,$\mbox{]}}]Array of pointers to the right hand side arguments from MATLAB prompt \item[{\em $\ast$P}]pointer to the parameters struct (in C code) \end{description}
\end{Desc}


Definition at line 49 of file get\_\-mex\_\-arguments.cpp.

References parameters::reltol.

Referenced by mex\-Function().\hypertarget{get__mex__arguments_8cpp_9e6d1904b36adacc28c7ce91cc37314e}{
\index{get_mex_arguments.cpp@{get\_\-mex\_\-arguments.cpp}!get_state@{get\_\-state}}
\index{get_state@{get\_\-state}!get_mex_arguments.cpp@{get\_\-mex\_\-arguments.cpp}}
\subsubsection[get\_\-state]{\setlength{\rightskip}{0pt plus 5cm}double$\ast$ get\_\-state (int {\em nlhs}, mx\-Array $\ast$ {\em plhs}\mbox{[}$\,$\mbox{]}, int {\em nrhs}, const mx\-Array $\ast$ {\em prhs}\mbox{[}$\,$\mbox{]})}}
\label{get__mex__arguments_8cpp_9e6d1904b36adacc28c7ce91cc37314e}


Get the initial ($ t=0 $) state vector ($ \vec{q} $) from MATLAB. 

Copy $ \vec{q} $ at $ t=0 $ from MATLAB \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em nlhs}]Number of left hand side arguments in the MATLAB prompt \item[{\em $\ast$plhs\mbox{[}$\,$\mbox{]}}]Array of pointers to the left hand side arguments from MATLAB prompt \item[{\em nrhs}]Number of right hand side arguments in the MATLAB prompt \item[{\em $\ast$prhs\mbox{[}$\,$\mbox{]}}]Array of pointers to the right hand side arguments from MATLAB prompt \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]pointer to the double\mbox{[}12\mbox{]} state array ($ \vec{q} $) \end{Desc}


Definition at line 159 of file get\_\-mex\_\-arguments.cpp.

Referenced by mex\-Function().\hypertarget{get__mex__arguments_8cpp_78bf47f99d3da4252677a9587f93cc39}{
\index{get_mex_arguments.cpp@{get\_\-mex\_\-arguments.cpp}!get_time@{get\_\-time}}
\index{get_time@{get\_\-time}!get_mex_arguments.cpp@{get\_\-mex\_\-arguments.cpp}}
\subsubsection[get\_\-time]{\setlength{\rightskip}{0pt plus 5cm}void get\_\-time (int {\em nlhs}, mx\-Array $\ast$ {\em plhs}\mbox{[}$\,$\mbox{]}, int {\em nrhs}, const mx\-Array $\ast$ {\em prhs}\mbox{[}$\,$\mbox{]}, \hyperlink{struct_o_d_e__data}{ODE\_\-data} $\ast$ {\em f\_\-dat})}}
\label{get__mex__arguments_8cpp_78bf47f99d3da4252677a9587f93cc39}


Get time parameter from MATLAB. 

Meaning: \par
 $ 0 $: Simulate indefinitely without returning anything to MATLAB $ t_{end} $: Simulate from $ t=0 $ to $ t=t_{end} $ and return simulation results to MATLAB \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em nlhs}]Number of left hand side arguments in the MATLAB prompt \item[{\em $\ast$plhs\mbox{[}$\,$\mbox{]}}]Array of pointers to the left hand side arguments from MATLAB prompt \item[{\em nrhs}]Number of right hand side arguments in the MATLAB prompt \item[{\em $\ast$prhs\mbox{[}$\,$\mbox{]}}]Array of pointers to the right hand side arguments from MATLAB prompt \item[{\em $\ast$f\_\-dat}]ODE solver data struct \end{description}
\end{Desc}


Definition at line 293 of file get\_\-mex\_\-arguments.cpp.

References ODE\_\-data::time\_\-param.

Referenced by mex\-Function().\hypertarget{get__mex__arguments_8cpp_0f89a01311e66438fe2f0813747d24e0}{
\index{get_mex_arguments.cpp@{get\_\-mex\_\-arguments.cpp}!initParameters@{initParameters}}
\index{initParameters@{initParameters}!get_mex_arguments.cpp@{get\_\-mex\_\-arguments.cpp}}
\subsubsection[initParameters]{\setlength{\rightskip}{0pt plus 5cm}void init\-Parameters (struct \hyperlink{structparameters}{parameters} $\ast$ {\em P})}}
\label{get__mex__arguments_8cpp_0f89a01311e66438fe2f0813747d24e0}


Initialize integrator options to default. 

Initializes P.reltol and P.abstol to default values. \par
 The P.param array is set to zeros (not a valid default for meaningfull simulation, just to avoid any crash!!!) \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em $\ast$P}]pointer to the parameters struct \end{description}
\end{Desc}


Definition at line 23 of file get\_\-mex\_\-arguments.cpp.

References parameters::abstol, parameters::param, PARAMNUM, parameters::reltol, and STATENUM.

Referenced by mex\-Function().