1: #pragma once 3: #include <petsc/private/taoimpl.h> 4: #include <petscis.h> 5: #define LCL_FORWARD1 0 6: #define LCL_ADJOINT1 1 7: #define LCL_FORWARD2 2 8: #define LCL_ADJOINT2 3 10: typedef struct { 11: Mat M; /* Quasi-newton hessian matrix */ 12: Vec dbar; /* Reduced gradient */ 13: Vec GL; 14: Vec GAugL; 15: Vec GL_U; /* Gradient of lagrangian */ 16: Vec GL_V; /* Gradient of lagrangian */ 17: Vec GAugL_U; /* Augmented lagrangian gradient */ 18: Vec GAugL_V; /* Augmented lagrangian gradient */ 19: Vec GL_U0; /* Gradient of lagrangian */ 20: Vec GL_V0; /* Gradient of lagrangian */ 21: Vec GAugL_U0; /* Augmented lagrangian gradient */ 22: Vec GAugL_V0; /* Augmented lagrangian gradient */ 24: IS UIS; /* Index set to state */ 25: IS UID; /* Index set to design */ 26: IS UIM; /* Full index set to all constraints */ 27: VecScatter state_scatter; 28: VecScatter design_scatter; 30: Vec U; /* State variable */ 31: Vec V; /* Design variable */ 32: Vec U0; /* State variable */ 33: Vec V0; /* Design variable */ 34: Vec V1; /* Design variable */ 36: Vec DU; /* State step */ 37: Vec DV; /* Design step */ 38: Vec DL; /* Multipliers step */ 40: Vec GU; /* Gradient wrt U */ 41: Vec GV; /* Gradient wrt V */ 42: Vec GU0; /* Gradient wrt U */ 43: Vec GV0; /* Gradient wrt V */ 45: Vec W; /* work vector */ 46: Vec X0; 47: Vec G0; 48: Vec WU; /* state work vector */ 49: Vec WV; /* design work vector */ 50: Vec r; 51: Vec s; 52: Vec g1, g2; 53: Vec con1; 55: PetscInt m; /* number of constraints */ 56: PetscInt n; /* number of variables */ 58: Mat jacobian_state0; /* Jacobian wrt U */ 59: Mat jacobian_state0_pre; /* preconditioning matrix wrt U */ 60: Mat jacobian_design0; /* Jacobian wrt V */ 61: Mat jacobian_state_inv0; /* Inverse of Jacobian wrt U */ 62: Mat R; 64: Vec lambda; /* Lagrange Multiplier */ 65: Vec lambda0; /* Lagrange Multiplier */ 66: Vec lambda1; /* Lagrange Multiplier */ 68: Vec WL; /* Work vector */ 69: PetscReal rho; /* Penalty parameter */ 70: PetscReal rho0; 71: PetscReal rhomax; 72: PetscReal eps1, eps2; 73: PetscReal aug, aug0, lgn, lgn0; 74: PetscInt subset_type; 75: PetscInt solve_type; 76: PetscBool recompute_jacobian_flag; 77: PetscInt phase2_niter; 78: PetscBool verbose; 79: PetscReal tau[4]; 81: } TAO_LCL;