# distutils: language = c++

cdef extern from "Solver/VSP_Optimizer.C":
    pass


cdef extern from "Solver/VSP_Optimizer.H":
    cdef cppclass VSP_OPTIMIZER:
        VSP_OPTIMIZER()
        int GetNumberOfThreads()
        void SetNumberOfThreads(int)
        void ActivateAutoDiffStack()
        void DeactivateAutoDiffStack()
        int GetUnsteadyAnalysis()
        int SetUnsteadyAnalysis(int)
        int NumberOfNodes()
        int NumberOfLoops()
        int NumberOfAdjointEquations()
        void UpdateGeometry(double *NodeXYZ)
        void GetForwardSolutionVector(double *Gamma)
        void SetForwardSolutionVector(double *Gamma)
        void SetMachNumber(double)
        void SetAoADegrees(double)
        void SetBetaDegrees(double)
        void SetVinf(double)
        void SetVref(double)
        void SetDensity(double)
        void SetReCref(double)
        void SetRotationalRate_p(double)
        void SetRotationalRate_q(double)
        void SetRotationalRate_r(double)
        void SetSref(double)
        void SetCref(double)
        void SetBref(double)
        void SetXcg(double)
        void SetYcg(double)
        void SetZcg(double)
        void SetClo2D(double)
        void SetClMax(double)
        void SetWakeIterations(int)
        void SetNumWakeNodes(int)
        void SetFarDist(double)
        void SetGMRESToleranceFactor(double)
        int GetNumberOfOptimizationFunctions()
        void SetNumberOfOptimizationFunctions(int)
        int GetOptimizationFunction(int Case)
        void SetOptimizationFunction(int Case, int Value)
        int GetOptimizationSet(int Case)
        void SetOptimizationSet(int Case, int Value)
        int OptimizationFunctionLength(int Case)
        int OptimizationNumberOfTimeSteps(int Case)
        void Setup(char *FileName)
        void Solve()
        void SolveForward()
        void SetGradientVector(int Case, double *Vec)
        void SolveAdjoint()
        void CalculateForwardMatrixVectorProduct(double *VecIn, double *VecOut)
        void CalculateForwardRightHandSide(double *RHS)
        void CalculateForwardResidual(double *Gamma, double *Residual)
        void CalculateAdjointMatrixVectorProduct(double *VecIn, double *VecOut)
        void CalculateAdjointRightHandSide(int Case, double *RHS)
        void CalculateOptimizationFunctionPartials(int Case, double *pF_pMesh, double *pF_pInputVariable, double *pF_pGamma)
        void CalculateAdjointResidualPartialProducts(double *Psi, double *pR_pMesh, double *pR_pInputVariable)
        void SolveAdjointLinearSystem(double *Psi, double *RHS)
        void CalculateOptimizationFunctions(double *VecIn)
        void GetFunctionValue(double &Vec)
        void GetFunctionValue(int Case, double &Vec)
        void GetFunctionValue(double *Vec)
        void GetFunctionValue(int Case, double *Vec)
        void GetUnsteadyFunctionValue(int Case, int Time, double *Vec)
        void GetUnsteadyFunctionValue(int Time, double *Vec)
        void GetFunctionGradients(double *Gradients)
        void GetFunctionGradients(int Case, double *Gradients)
        double NodeX(int i)
        double NodeY(int i)
        double NodeZ(int i)
        double GradientX(int i)
        double GradientY(int i)
        double GradientZ(int i)
        double GradientX(int Case, int i)
        double GradientY(int Case, int i)
        double GradientZ(int Case, int i)
        double dF_dInputVariable(int InputVariable)
        double dF_dInputVariable(int Case, int InputVariable)
        double dF_dInputVariable(int Case, int Time, int InputVariable)
        void GetNodalPressures(double *Pressure)
        void GetNodalForces(double *Force)
        void CalculateNodalForcePartialProducts(double *pF_pForces, double * pF_pMesh, double *pF_pInputVariable,
                                                double *pF_pGamma)
        void GetpFupMesh(double *pFU_pP, double *pFU_pMesh)
        int GetNodalConnectivityLength();
        void GetNodalConnectivity(int *conn, int *ptr);
        void SetArrayOffSetType(int ArrayType)
        void WriteOutCart3dTriFile()
        void SupressStdout()
        void ResumeStdout()
