Flipper.c
Go to the documentation of this file.
1 /*
2  * This file is part of qpOASES.
3  *
4  * qpOASES -- An Implementation of the Online Active Set Strategy.
5  * Copyright (C) 2007-2015 by Hans Joachim Ferreau, Andreas Potschka,
6  * Christian Kirches et al. All rights reserved.
7  *
8  * qpOASES is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * qpOASES is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with qpOASES; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  */
23 
24 
36 #include <qpOASES_e/Flipper.h>
37 
38 
40 
41 
42 /*****************************************************************************
43  * P U B L I C *
44  *****************************************************************************/
45 
46 
47  /*
48  * F l i p p e r
49  */
50 void FlipperCON( Flipper* _THIS,
51  unsigned int _nV,
52  unsigned int _nC
53  )
54 {
55  Flipper_init( _THIS,_nV,_nC );
56 }
57 
58 
59 /*
60  * c o p y
61  */
62 void FlipperCPY( Flipper* FROM,
63  Flipper* TO
64  )
65 {
66  Flipper_set( TO, &(FROM->bounds),FROM->R,&(FROM->constraints),FROM->Q,FROM->T );
67 }
68 
69 
70 /*
71  * i n i t
72  */
74  unsigned int _nV,
75  unsigned int _nC
76  )
77 {
78  _THIS->nV = _nV;
79  _THIS->nC = _nC;
80 
81  return SUCCESSFUL_RETURN;
82 }
83 
84 
85 
86 /*
87  * g e t
88  */
90  Bounds* const _bounds,
91  real_t* const _R,
92  Constraints* const _constraints,
93  real_t* const _Q,
94  real_t* const _T
95  )
96 {
97  if ( _bounds != 0 )
98  BoundsCPY( &(_THIS->bounds),_bounds );
99 
100  if ( _constraints != 0 )
101  ConstraintsCPY( &(_THIS->constraints),_constraints );
102 
103  if ( _R != 0 )
104  memcpy( _R,_THIS->R, (NVMAX*NVMAX)*sizeof(real_t) );
105 
106  if ( _Q != 0 )
107  memcpy( _Q,_THIS->Q, (NVMAX*NVMAX)*sizeof(real_t) );
108 
109  if ( _T != 0 )
110  memcpy( _T,_THIS->T, (NVCMIN*NVCMIN)*sizeof(real_t) );
111 
112  return SUCCESSFUL_RETURN;
113 }
114 
115 
116 /*
117  * s e t
118  */
120  const Bounds* const _bounds,
121  const real_t* const _R,
122  const Constraints* const _constraints,
123  const real_t* const _Q,
124  const real_t* const _T
125  )
126 {
127  if ( _bounds != 0 )
128  BoundsCPY( (Bounds*)_bounds,&(_THIS->bounds) );
129 
130  if ( _constraints != 0 )
131  ConstraintsCPY( (Constraints*)_constraints,&(_THIS->constraints) );
132 
133  if ( _R != 0 )
134  memcpy( _THIS->R,_R, (NVMAX*NVMAX)*sizeof(real_t) );
135 
136  if ( _Q != 0 )
137  memcpy( _THIS->Q,_Q, (NVMAX*NVMAX)*sizeof(real_t) );
138 
139  if ( _T != 0 )
140  memcpy( _THIS->T,_T, (NVCMIN*NVCMIN)*sizeof(real_t) );
141 
142  return SUCCESSFUL_RETURN;
143 }
144 
145 
146 
147 /*****************************************************************************
148  * P R O T E C T E D *
149  *****************************************************************************/
150 
151 
152 unsigned int Flipper_getDimT( Flipper* _THIS )
153 {
154  if ( _THIS->nV > _THIS->nC )
155  return _THIS->nC * _THIS->nC;
156  else
157  return _THIS->nV * _THIS->nV;
158 }
159 
160 
162 
163 
164 /*
165  * end of file
166  */
Allows to pass back messages to the calling function.
Auxiliary class for storing a copy of the current matrix factorisations.
void ConstraintsCPY(Constraints *FROM, Constraints *TO)
Definition: Constraints.c:61
returnValue Flipper_init(Flipper *_THIS, unsigned int _nV, unsigned int _nC)
Definition: Flipper.c:73
void FlipperCPY(Flipper *FROM, Flipper *TO)
Definition: Flipper.c:62
returnValue Flipper_set(Flipper *_THIS, const Bounds *const _bounds, const real_t *const _R, const Constraints *const _constraints, const real_t *const _Q, const real_t *const _T)
Definition: Flipper.c:119
void BoundsCPY(Bounds *FROM, Bounds *TO)
Definition: Bounds.c:59
returnValue Flipper_get(Flipper *_THIS, Bounds *const _bounds, real_t *const _R, Constraints *const _constraints, real_t *const _Q, real_t *const _T)
Definition: Flipper.c:89
BEGIN_NAMESPACE_QPOASES void FlipperCON(Flipper *_THIS, unsigned int _nV, unsigned int _nC)
Definition: Flipper.c:50
Manages working sets of bounds (= box constraints).
double real_t
Definition: AD_test.c:10
unsigned int Flipper_getDimT(Flipper *_THIS)
Definition: Flipper.c:152


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:34:34