| 
    rsvs3D
    0.0.0
    
   Codes for the c++ implementation of the 3D RSVS 
   | 
 
Class to handle the RSVS calculation. More...
#include <RSVScalc.hpp>
  
Public Member Functions | |
| bool | UseFullMath () const | 
| Decides wether full or sparse math should be used.  More... | |
| void | BuildMathArrays (int nDv, int nConstr) | 
| Builds mathematics arrays.  More... | |
| void | BuildConstrMap (const triangulation &triangleRSVS) | 
| Builds the constraint mapping.  More... | |
| void | BuildConstrMap (const mesh &meshin) | 
| Builds the constraint mapping.  More... | |
| int | BuildDVMap (const std::vector< int > &vecin) | 
| Builds a Design variable map.  More... | |
| bool | SnakDVcond (const triangulation &triRSVS, int ii) | 
| Returns wether a snaxel is a design variable or not.  More... | |
| void | PrepTriangulationCalc (const triangulation &triRSVS) | 
| Groups actions needed before the calculation of triangular quantities.  More... | |
| void | CalculateMesh (mesh &meshin) | 
| Calculates the mesh volumes.  More... | |
| void | CalculateTriangulation (const triangulation &triRSVS, int derivMethod=0) | 
| Calculates the triangulation volume and area derivatives.  More... | |
| void | CalcTriangle (const triangle &triIn, const triangulation &triRSVS, bool isObj=true, bool isConstr=true, bool isDeriv=true) | 
| Calculates the properties of single triangle.  More... | |
| void | CalcTriangleFD (const triangle &triIn, const triangulation &triRSVS, bool isObj=true, bool isConstr=true, bool isDeriv=true) | 
| Calculates the properties of single triangle using Finite difference.  More... | |
| void | CalcTriangleDirectVolume (const triangle &triIn, const triangulation &triRSVS, bool isObj=true, bool isConstr=true, bool isDeriv=true) | 
| Calculates the properties of single triangle using direct calculation.  More... | |
| void | CalcTriangleEdgeLength (const triangle &triIn, const triangulation &triRSVS, bool isObj=true, bool isConstr=true, bool isDeriv=true) | 
| Calculates the properties of single triangle for 2D RSVS.  More... | |
| void | ReturnConstrToMesh (triangulation &triRSVS) const | 
| Returns a constraint to the triangulation::meshDep.  More... | |
| void | ReturnConstrToMesh (mesh &meshin, double volu::*mp=&volu::volume) const | 
| Returns a constraint to the mesh.  More... | |
| void | CheckAndCompute (int calcMethod=0, bool sensCalc=false) | 
| Prepare the active arrays for SQP calculation and calculate the SQP step.  More... | |
| void | ComputeSQPstep (int calcMethod, Eigen::MatrixXd &dConstrAct, Eigen::RowVectorXd &dObjAct, Eigen::VectorXd &constrAct, Eigen::VectorXd &lagMultAct) | 
| Calculates the next SQP step.  More... | |
| void | ComputeSQPstep (int calcMethod, MatrixXd_sparse &dConstrAct, Eigen::RowVectorXd &dObjAct, Eigen::VectorXd &constrAct, Eigen::VectorXd &lagMultAct) | 
| void | ComputeSQPsens (int calcMethod, const Eigen::MatrixXd &sensMult, const Eigen::MatrixXd &sensInv, Eigen::MatrixXd &sensRes) | 
| void | ComputeSQPsens (int calcMethod, Eigen::MatrixXd &sensMult, MatrixXd_sparse &sensInv, Eigen::MatrixXd &sensRes) | 
| bool | PrepareMatricesForSQP (Eigen::MatrixXd &dConstrAct, Eigen::MatrixXd &HConstrAct, Eigen::MatrixXd &HObjAct, MatrixXd_sparse &dConstrAct_sparse, MatrixXd_sparse &HConstrAct_sparse, MatrixXd_sparse &HObjAct_sparse, Eigen::RowVectorXd &dObjAct, Eigen::VectorXd &constrAct, Eigen::VectorXd &lagMultAct) | 
| Prepares the matrices needed for the SQP step calculation.  More... | |
| void | PrepareMatricesForSQPFull (Eigen::MatrixXd &dConstrAct, Eigen::MatrixXd &HConstrAct, Eigen::MatrixXd &HObjAct) | 
| void | PrepareMatricesForSQPSparse (MatrixXd_sparse &dConstrAct_sparse, MatrixXd_sparse &HConstrAct_sparse, MatrixXd_sparse &HObjAct_sparse) | 
| bool | PrepareMatricesForSQPSensitivity (const Eigen::MatrixXd &dConstrAct, const Eigen::MatrixXd &HConstrAct, const Eigen::MatrixXd &HObjAct, Eigen::MatrixXd &sensMult, Eigen::MatrixXd &sensInv, Eigen::MatrixXd &sensRes) const | 
| Prepares the matrices needed for the calculation of the sensitivity of the SQP.  More... | |
| bool | PrepareMatricesForSQPSensitivity (const MatrixXd_sparse &dConstrAct, const MatrixXd_sparse &HConstrAct, MatrixXd_sparse &HObjAct, Eigen::MatrixXd &sensMult, MatrixXd_sparse &sensInv, Eigen::MatrixXd &sensRes) const | 
| void | ReturnVelocities (triangulation &triRSVS) | 
| Returns velocities to the snaxels.  More... | |
| void | ReturnSensitivities (const triangulation &triRSVS, std::vector< double > &sensVec, int constrNum) const | 
| void | ReturnGradient (const triangulation &triRSVS, std::vector< double > &sensVec, int constrNum) const | 
| int | numConstr () const | 
| Getter for the number of constraints.  More... | |
| void | Print2Screen (int outType=0) const | 
Prints different amounts of RSVScalc owned data to the screen.  More... | |
| void | ConvergenceLog (std::ofstream &out, int loglvl=3) const | 
| Print convergence information to file stream.  More... | |
| void | CalculateVelocities (triangulation &triRSVS, int calculationMethod=0, bool calculateDerivatives=true, int derivativeMethod=1) override | 
| void | setDevParameters (const param::dev::devparam &devset) override | 
| Set the Development parameters of the Calculator object.  | |
| void | SetUseSurfCentreDeriv (int in) | 
| bool | GetUseSurfCentreDeriv () const | 
| void | SetUseSurfCentreHessian (int in) | 
| bool | SetUseSurfCentreHessian () const | 
| void | SetSparseDVcutoff (int in) | 
| int | GetSparseDVcutoff () const | 
Public Attributes | |
| Eigen::MatrixXd | dConstr | 
| Constraint Jacobian, size: [nConstr, nDv].  | |
| SparseMatrixTriplet | dConstr_sparse | 
| Eigen::MatrixXd | HConstr | 
| Constraint Hessian, size: [nDv, nDv].  | |
| SparseMatrixTriplet | HConstr_sparse | 
| Eigen::MatrixXd | HObj | 
| Objective Hessian, size: [nDv, nDv].  | |
| SparseMatrixTriplet | HObj_sparse | 
| Eigen::MatrixXd | HLag | 
| Lagrangian Hessian, size: [nDv, nDv].  | |
| MatrixXd_sparse | HLag_sparse | 
| Eigen::RowVectorXd | dLag | 
| Eigen::RowVectorXd | dObj | 
| Objective Jacobian, size: [1, nDv].  | |
| Eigen::VectorXd | constr | 
| Constraint value vector, size: [nConstr, 1].  | |
| Eigen::VectorXd | lagMult | 
| Lagrangian multiplier, size: [nConstr, 1].  | |
| Eigen::VectorXd | deltaDV | 
| Change in design variable, assigned to snake velocity, size: [nDv, 1].  | |
| Eigen::VectorXd | constrTarg | 
| Constraint target values, size: [nConstr, 1].  | |
| Eigen::MatrixXd | dvCallConstr | 
| Eigen::MatrixXd | sensDv | 
| Sensitivity of the optimum design variables to the constraint.  | |
| double | obj = 0.0 | 
| Objective function value.  | |
| double | limLag = INFINITY | 
| Value at which a Lagrangian multiplier is considered problematically large.  | |
| std::vector< bool > | isConstrAct | 
| is the corresponding constraint active?  | |
| std::vector< bool > | isDvAct | 
| Is the corresponding design variable active?  | |
| HashedVector< int, int > | subConstrAct | 
| Vector of subscripts of the active constraints.  | |
| HashedVector< int, int > | subDvAct | 
| Vector of subscripts of the active design variables.  | |
| HashedVector< int, int > | dvMap | 
| Maps the snake indices to the position in the design variable vector.  | |
| HashedMap< int, int, int > | constrMap | 
| maps snakemesh() volu onto constr  | |
| std::vector< std::pair< int, int > > | constrList | 
| keeps pairs with parentindex and voluindex  | |
Protected Member Functions | |
| void | ZeroTimers () | 
| void | PrintTimers () const | 
Protected Attributes | |
| int | nDv = 0 | 
| Number of design variables.  | |
| int | nConstr = 0 | 
| Number of constraints.  | |
| int | falseaccess = 0 | 
| Number of false access operations.  | |
| int | sparseDVcutoff = 200 | 
| Number of design variables to start using sparse mathematics.  | |
| int | nonZeroPerDV = 10 | 
| bool | returnDeriv = true | 
| Return the derivatives (obsolete/unused)  | |
| bool | useSurfCentreDeriv = true | 
| Enable or disable surfcentroid derivatives.  | |
| bool | useSurfCentreHessian = false | 
| Enable or disable surfcentroid derivatives.  | |
| int | timer1 = 0 | 
| int | timer2 = 0 | 
| int | timer3 = 0 | 
Class to handle the RSVS calculation.
This class calculates volume and area metrics in a triangulated snake to update the velocity and volumes. It uses an SQP algorithm to compute the velocities.
Definition at line 129 of file RSVScalc.hpp.
| void RSVScalc::BuildConstrMap | ( | const mesh & | meshin | ) | 
Builds the constraint mapping.
| [in] | meshin | mesh for constraint building. | 
Definition at line 505 of file RSVScalc.cpp.
| void RSVScalc::BuildConstrMap | ( | const triangulation & | triangleRSVS | ) | 
Builds the constraint mapping.
| [in] | triangleRSVS | Triangulation containing the RSVS. | 
Definition at line 488 of file RSVScalc.cpp.
| int RSVScalc::BuildDVMap | ( | const std::vector< int > & | vecin | ) | 
Builds a Design variable map.
| [in] | vecin | The input vector of design variable indices. | 
Definition at line 522 of file RSVScalc.cpp.
| void RSVScalc::BuildMathArrays | ( | int | nDv, | 
| int | nConstr | ||
| ) | 
Builds mathematics arrays.
| [in] | nDv | Number of design variables. | 
| [in] | nConstr | Number of constraints. | 
Definition at line 443 of file RSVScalc.cpp.
| void RSVScalc::CalcTriangle | ( | const triangle & | triIn, | 
| const triangulation & | triRSVS, | ||
| bool | isObj = true,  | 
        ||
| bool | isConstr = true,  | 
        ||
| bool | isDeriv = true  | 
        ||
| ) | 
Calculates the properties of single triangle.
These values are returned to the class math arrays.
| [in] | triIn | The triangle to measure. | 
| [in] | triRSVS | The containing triangulation object. | 
| [in] | isObj | Calculate objective? | 
| [in] | isConstr | Calculate constraint? | 
| [in] | isDeriv | Calculate derivatives? | 
Definition at line 32 of file RSVScalc_core.cpp.
| void RSVScalc::CalcTriangleDirectVolume | ( | const triangle & | triIn, | 
| const triangulation & | triRSVS, | ||
| bool | isObj = true,  | 
        ||
| bool | isConstr = true,  | 
        ||
| bool | isDeriv = true  | 
        ||
| ) | 
Calculates the properties of single triangle using direct calculation.
These values are returned to the class math arrays.
| [in] | triIn | The triangle to measure. | 
| [in] | triRSVS | The containing triangulation object. | 
| [in] | isObj | Calculate objective? | 
| [in] | isConstr | Calculate constraint? | 
| [in] | isDeriv | Calculate derivatives? | 
<--—Change assignement
<--—Change assignement
Definition at line 355 of file RSVScalc_core.cpp.
| void RSVScalc::CalcTriangleEdgeLength | ( | const triangle & | triIn, | 
| const triangulation & | triRSVS, | ||
| bool | isObj = true,  | 
        ||
| bool | isConstr = true,  | 
        ||
| bool | isDeriv = true  | 
        ||
| ) | 
Calculates the properties of single triangle for 2D RSVS.
These values are returned to the class math arrays.
| [in] | triIn | The triangle to measure. | 
| [in] | triRSVS | The containing triangulation object. | 
| [in] | isObj | Calculate objective? | 
| [in] | isConstr | Calculate constraint? | 
| [in] | isDeriv | Calculate derivatives? | 
Definition at line 574 of file RSVScalc_core.cpp.
| void RSVScalc::CalcTriangleFD | ( | const triangle & | triIn, | 
| const triangulation & | triRSVS, | ||
| bool | isObj = true,  | 
        ||
| bool | isConstr = true,  | 
        ||
| bool | isDeriv = true  | 
        ||
| ) | 
Calculates the properties of single triangle using Finite difference.
These values are returned to the class math arrays.
| [in] | triIn | The triangle to measure. | 
| [in] | triRSVS | The containing triangulation object. | 
| [in] | isObj | Calculate objective? | 
| [in] | isConstr | Calculate constraint? | 
| [in] | isDeriv | Calculate derivatives? | 
Definition at line 199 of file RSVScalc_core.cpp.
| void RSVScalc::CalculateMesh | ( | mesh & | meshin | ) | 
Calculates the mesh volumes.
| meshin | The mesh. | 
Definition at line 294 of file RSVScalc.cpp.
| void RSVScalc::CalculateTriangulation | ( | const triangulation & | triRSVS, | 
| int | derivMethod = 0  | 
        ||
| ) | 
Calculates the triangulation volume and area derivatives.
| [in] | triRSVS | The triangle rsvs | 
| [in] | derivMethod | The differentiation method to use. 1 : Finite Difference, 2 : Direct calculation, all others : differentiation. | 
Definition at line 95 of file RSVScalc.cpp.
| void RSVScalc::CheckAndCompute | ( | int | calcMethod = 0,  | 
        
| bool | sensCalc = false  | 
        ||
| ) | 
Prepare the active arrays for SQP calculation and calculate the SQP step.
| [in] | calcMethod | Calculation method for SQP. Check :meth:RSVScalc::ComputeSQPstep for detail. | 
Definition at line 264 of file RSVScalc_SQP.cpp.
| void RSVScalc::ComputeSQPstep | ( | int | calcMethod, | 
| Eigen::MatrixXd & | dConstrAct, | ||
| Eigen::RowVectorXd & | dObjAct, | ||
| Eigen::VectorXd & | constrAct, | ||
| Eigen::VectorXd & | lagMultAct | ||
| ) | 
Calculates the next SQP step.
In normal operation the constraint should be 0 through 4. With 0 the default. By adding 10 to these values the "constraint only" mode is enabled which performs a gradient descent step based on the constraint.
| [in] | calcMethod | The calculation method. 10 can be added to all values to enable the "constraint only" mode. Values correspond to the following: Eigen::HouseholderQR (1); * Eigen::ColPivHouseholderQR (2) - Default; Eigen::LLT<Eigen::MatrixXd> (3); Eigen::PartialPivLU (4);  | 
| dConstrAct | The active constraint Jacobian | |
| dObjAct | The active objective Jacobian | |
| constrAct | The active constraint values | |
| lagMultAct | The active lagrangian multipliers. | 
      
  | 
  virtual | 
Print convergence information to file stream.
| out | The output filestream | |
| [in] | loglvl | The logging detail to output. <1 nothing, ==1 Vector statistics, ==2 ...and constraint vectors, >2 ...and snaxel velocity vector. | 
Implements rsvs3d::SnakeVelocityCalculator.
Definition at line 531 of file RSVScalc.cpp.
      
  | 
  inline | 
Getter for the number of constraints.
Definition at line 455 of file RSVScalc.hpp.
| bool RSVScalc::PrepareMatricesForSQP | ( | Eigen::MatrixXd & | dConstrAct, | 
| Eigen::MatrixXd & | HConstrAct, | ||
| Eigen::MatrixXd & | HObjAct, | ||
| MatrixXd_sparse & | dConstrAct_sparse, | ||
| MatrixXd_sparse & | HConstrAct_sparse, | ||
| MatrixXd_sparse & | HObjAct_sparse, | ||
| Eigen::RowVectorXd & | dObjAct, | ||
| Eigen::VectorXd & | constrAct, | ||
| Eigen::VectorXd & | lagMultAct | ||
| ) | 
Prepares the matrices needed for the SQP step calculation.
| dConstrAct | The active constraint Jacobian | 
| HConstrAct | The active constraint hessian | 
| HObjAct | The active objective hessian | 
| dObjAct | The active objective Jacobian | 
| constrAct | The active constraint values | 
| lagMultAct | The active lagrangian multipliers. | 
Definition at line 28 of file RSVScalc_SQP.cpp.
| bool RSVScalc::PrepareMatricesForSQPSensitivity | ( | const Eigen::MatrixXd & | dConstrAct, | 
| const Eigen::MatrixXd & | HConstrAct, | ||
| const Eigen::MatrixXd & | HObjAct, | ||
| Eigen::MatrixXd & | sensMult, | ||
| Eigen::MatrixXd & | sensInv, | ||
| Eigen::MatrixXd & | sensRes | ||
| ) | const | 
Prepares the matrices needed for the calculation of the sensitivity of the SQP.
This is done to then call RSVScalc::ComputeSQPsens which implements the SQP optimality sensitivity giving the change in design variables due to a small change of constraint at the optimal condition.
| dConstrAct | The active constraint Jacobian | 
| HConstrAct | The active constraint hessian | 
| HObjAct | The active objective hessian | 
| sensMult | The sensitivity RHS multiplier | 
| sensInv | The sensitivity RHS Matrix equation | 
| sensRes | The sensitivity LHS result matrix. | 
| bool RSVScalc::PrepareMatricesForSQPSensitivity | ( | const MatrixXd_sparse & | dConstrAct, | 
| const MatrixXd_sparse & | HConstrAct, | ||
| MatrixXd_sparse & | HObjAct, | ||
| Eigen::MatrixXd & | sensMult, | ||
| MatrixXd_sparse & | sensInv, | ||
| Eigen::MatrixXd & | sensRes | ||
| ) | const | 
sensitivity requires : [H_d L , J_d constr; J_d constr ^T, 0]^-1 [Dd^TD_v L (=0s) ; D_V constr (=eye(lagMult))]
Definition at line 215 of file RSVScalc_SQP.cpp.
| void RSVScalc::PrepTriangulationCalc | ( | const triangulation & | triRSVS | ) | 
Groups actions needed before the calculation of triangular quantities.
| [in] | triRSVS | The triangulation object. | 
Definition at line 35 of file RSVScalc.cpp.
| void RSVScalc::Print2Screen | ( | int | outType = 0 | ) | const | 
Prints different amounts of RSVScalc owned data to the screen. 
| [in] | outType | The output type to print, values [2,3,4]. | 
Definition at line 334 of file RSVScalc.cpp.
| void RSVScalc::ReturnConstrToMesh | ( | mesh & | meshin, | 
| double volu::* | mp = &volu::volume  | 
        ||
| ) | const | 
Returns a constraint to the mesh.
| meshin | The input mesh. | |
| [in] | volu | The volumetric field that data needs to be returned to. It is a member point of class volu. | 
Definition at line 429 of file RSVScalc.cpp.
| void RSVScalc::ReturnConstrToMesh | ( | triangulation & | triRSVS | ) | const | 
Returns a constraint to the triangulation::meshDep.
| triRSVS | The triangulation object. | 
Definition at line 400 of file RSVScalc.cpp.
| void RSVScalc::ReturnVelocities | ( | triangulation & | triRSVS | ) | 
Returns velocities to the snaxels.
Returns velocities to the snake in the triangulation object.
| triRSVS | The triangulation object, affects the triangulation::snakeDep attribute. | 
| triRSVS | The triangulation object of the RSVS | 
Definition at line 143 of file RSVScalc.cpp.
| bool RSVScalc::SnakDVcond | ( | const triangulation & | triRSVS, | 
| int | ii | ||
| ) | 
Returns wether a snaxel is a design variable or not.
If the snaxel is frozen and all its neighbours are frozen, it is not a design variable.
| [in] | triRSVS | The triangulation which is being calculated | 
| [in] | ii | the snaxel subscript. | 
Definition at line 73 of file RSVScalc.cpp.
      
  | 
  inline | 
Decides wether full or sparse math should be used.
Definition at line 215 of file RSVScalc.hpp.