Commit ea2e6d7b authored by Steffen Schotthöfer's avatar Steffen Schotthöfer
Browse files

commented optimizers and added some comments on mesh

parent 21547b33
......@@ -21,7 +21,8 @@ class Mesh
const unsigned _numNodes; /*! @brief: number of nodes in the mesh (for node centered view)*/
const unsigned _numNodesPerCell; /*! @brief: number of nodes per cell */
const unsigned _numBoundaries; /*! @brief: number of boundary cells in the mesh */
const unsigned _ghostCellID; // used for what? /*! @brief: equal to _numCells and therefore has the ID of the last cell + 1 */
const unsigned _ghostCellID; /*! @brief: Id of the ghost cell. (we use only one ghost cell). equal to _numCells and therefore has the ID of the
last cell + 1 */
std::vector<std::pair<double, double>> _bounds; // ???
......@@ -44,8 +45,8 @@ class Mesh
void ComputeCellAreas(); /*! @brief: Computes only the areas of the mesh cells. Write to _cellAreas. */
void ComputeCellMidpoints(); /*! @brief: Compute only the midpoints of the cells. Write to _cellMidPoints*/
void ComputeConnectivity(); /*! @brief: Computes ??? */
void ComputePartitioning(); /*! @brief: Computes ??? */
void ComputeConnectivity(); /*! @brief: Computes _cellNeighbors and _nodeNeighbors, i.e. neighborship relation in mesh*/
void ComputePartitioning(); /*! @brief: Computes local partitioning for openMP */
/*! @brief: Computes outward facing normal of two neighboring nodes nodeA and nodeB with common cellCellcenter.
* Normals are scaled with their respective edge length
......@@ -54,7 +55,7 @@ class Mesh
* @param: cellCenter: Center of the cell that has nodeA and nodeB as nodes.
* @return: outward facing normal */
Vector ComputeOutwardFacingNormal( const Vector& nodeA, const Vector& nodeB, const Vector& cellCenter );
void ComputeBounds(); /*! @brief: Computes ??? */
void ComputeBounds(); /*! @brief: Computes the spatial bounds of a 2D domain. */
public:
Mesh() = delete; // no default constructor
......@@ -111,7 +112,7 @@ class Mesh
* @return dimension: scalar */
double GetDistanceToOrigin( unsigned idx_cell ) const;
/*! @brief ComputeSlopes calculates the slope in every cell into x and y direction
/*! @brief ComputeSlopes calculates the slope in every cell into x and y direction using the divergence theorem.
* @param nq is number of quadrature points
* @param psiDerX is slope in x direction (gets computed. Slope is stored here)
* @param psiDerY is slope in y direction (gets computed. Slope is stored here)
......@@ -119,7 +120,9 @@ class Mesh
// Not used
void ComputeSlopes( unsigned nq, VectorVector& psiDerX, VectorVector& psiDerY, const VectorVector& psi ) const;
/*! @brief: Considering the neighborign information o each cell and use limiters for structured mesh */
void ReconstructSlopesS( unsigned nq, VectorVector& psiDerX, VectorVector& psiDerY, const VectorVector& psi ) const;
/*! @brief: Use gauss theorem and limiters. For unstructured mesh */
void ReconstructSlopesU( unsigned nq, VectorVector& psiDerX, VectorVector& psiDerY, const VectorVector& psi ) const;
};
......
/*!
* @file newtonoptimizer.h
* @brief class for solving the minimal entropy optimization problem using a newton optimizer with line search.
* @author S. Schotthöfer
*/
#ifndef NEWTONOPTIMIZER_H
#define NEWTONOPTIMIZER_H
......@@ -10,7 +16,7 @@ class NewtonOptimizer : public OptimizerBase
public:
NewtonOptimizer( Config* settings );
inline ~NewtonOptimizer() {}
~NewtonOptimizer();
void Solve( Vector& lambda, Vector& u, VectorVector& moments ) override;
......
/*!
* @file optimizerbase.h
* @brief Base class for solving the minimal entropy optimization problem
* @author S. Schotthöfer
*/
#ifndef OPTIMIZERBASE_H
#define OPTIMIZERBASE_H
#include "common/typedef.h"
#include "entropies/entropybase.h"
// Foward declaration
class Config;
class EntropyBase;
class OptimizerBase
{
public:
OptimizerBase( Config* settings );
virtual inline ~OptimizerBase() { delete _entropy; }
~OptimizerBase();
/*! @brief: Optimizer creator: Depending on the chosen option, this function creates an object of the chosen child class of OptimizerBase */
static OptimizerBase* Create( Config* settings );
/*! @brief : Computes the optimal Lagrange multilpiers for the dual entropy minimization problem
......@@ -23,7 +30,7 @@ class OptimizerBase
protected:
EntropyBase* _entropy; /*! @brief: Class to handle entropy functional evaluations */
Config* _settings;
Config* _settings; /*! @biref: Pointer to settings class of the solver */
};
#endif // OPTIMIZERBASE_H
#include "optimizers/newtonoptimizer.h"
#include "common/config.h"
#include "entropies/entropybase.h"
#include "quadratures/quadraturebase.h"
#include "toolboxes/errormessages.h"
......@@ -15,6 +16,8 @@ NewtonOptimizer::NewtonOptimizer( Config* settings ) : OptimizerBase( settings )
_epsilon = settings->GetNewtonOptimizerEpsilon();
}
NewtonOptimizer::~NewtonOptimizer() { delete _quadrature; }
double NewtonOptimizer::ComputeObjFunc( Vector& alpha, Vector& sol, VectorVector& moments ) {
double result = 0.0;
......
#include "optimizers/optimizerbase.h"
#include "common/config.h"
#include "entropies/entropybase.h"
#include "optimizers/newtonoptimizer.h"
OptimizerBase::OptimizerBase( Config* settings ) {
......@@ -7,6 +8,8 @@ OptimizerBase::OptimizerBase( Config* settings ) {
_settings = settings;
}
OptimizerBase::~OptimizerBase() { delete _entropy; }
OptimizerBase* OptimizerBase::Create( Config* settings ) {
switch( settings->GetOptimizerName() ) {
case NEWTON: return new NewtonOptimizer( settings );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment