1 /* Siconos is a program dedicated to modeling, simulation and control
2  * of non smooth dynamical systems.
3  *
4  * Copyright 2021 INRIA.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17 */
18 
19 #include "fc3d_GlockerFischerBurmeister_functions.h"
20 #include <stddef.h>             // for NULL
21 #include "FischerBurmeister.h"  // for jacobianPhi_FB, phi_FB
22 #include "fc3d_2NCP_Glocker.h"  // for computeFGlocker, computeJacobianFGlocker
23 
24 /* size of a block */
25 /* static int Fsize; */
26 
27 /* static void F_GlockerFischerBurmeister(int sizeF, double* reaction, double* FVector, int up2Date); */
28 /* static void jacobianF_GlockerFischerBurmeister(int sizeF, double* reaction, double* jacobianFMatrix, int up2Date); */
29 
30 
31 
32 /** writes \f$ F(z) \f$ using Glocker formulation and the Fischer-Burmeister function.
33  */
F_GlockerFischerBurmeister(int sizeF,double * reaction,double * FVector,int up2Date)34 void F_GlockerFischerBurmeister(int sizeF, double* reaction, double* FVector, int up2Date)
35 {
36   /* Glocker formulation */
37   double* FGlocker = NULL;
38   computeFGlocker(&FGlocker, up2Date);
39   /* Note that FGlocker is a static var. in fc3d2NCP_Glocker and thus there is no memory allocation in
40    the present file.
41   */
42 
43   /* Call Fisher-Burmeister function => fill FVector */
44   phi_FB(sizeF, reaction, FGlocker, FVector);
45   FGlocker = NULL;
46 }
47 
48 /** writes \f$ \nabla_z F(z) \f$  using Glocker formulation and the Fischer-Burmeister function.
49  */
jacobianF_GlockerFischerBurmeister(int sizeF,double * reaction,double * jacobianFMatrix,int up2Date)50 void jacobianF_GlockerFischerBurmeister(int sizeF, double* reaction, double* jacobianFMatrix, int up2Date)
51 {
52   /* Glocker formulation */
53   double* FGlocker = NULL, *jacobianFGlocker = NULL;
54   computeFGlocker(&FGlocker, up2Date);
55   computeJacobianFGlocker(&jacobianFGlocker, up2Date);
56   /* Note that FGlocker and jacobianFGlocker are static var. in fc3d2NCP_Glocker and thus there is no memory allocation in
57    the present file.
58   */
59 
60   /* Call Fisher-Burmeister function => fill jacobianFMatrix */
61   jacobianPhi_FB(sizeF, reaction, FGlocker, jacobianFGlocker, jacobianFMatrix);
62   FGlocker = NULL;
63   jacobianFGlocker = NULL;
64 }
65