Page MenuHomec4science

mini_mesh.hh
No OneTemporary

File Metadata

Created
Sat, Sep 28, 09:27

mini_mesh.hh

#ifndef _MINI_MESH_H_
#define _MINI_MESH_H_
#include "common.hh"
#include "point_container.hh"
#include <vector>
/*! This class allows to create miniature meshes based on a connectivity and a
* point container for quality calculations and similar
*/
template <Uint DIM>
class MiniMesh {
public:
MiniMesh(const std::vector<const int*> & connectivity,
const std::vector<int> & free_nodes,
PointContainer<DIM> & nodes);
virtual ~MiniMesh(){};
class StopIterError: public std::runtime_error {
public:
StopIterError(std::string str):std::runtime_error(str){};
virtual ~StopIterError(){};
};
class FiniteStepError: public std::runtime_error {
public:
FiniteStepError(std::string str):std::runtime_error(str){};
virtual ~FiniteStepError(){};
};
class NanStepError: public FiniteStepError {
public:
NanStepError(std::string str):FiniteStepError(str){};
virtual ~NanStepError(){};
};
class ZeroStepError: public FiniteStepError {
public:
ZeroStepError(std::string str):FiniteStepError(str){};
virtual ~ZeroStepError(){};
};
Uint relax(Real imposed_step_size,
Uint max_iter,
Real threshold,
Real min_step_size,
bool verbose = false);
private:
/// returns the maximum quality (worst element) in the minimesh
Real computeQuality();
/// computes numerically the gradient of the quality
void updateGradient(const Real & step_size);
/// normalize the gradient so that the largest point move is step_size
void normGradient(Real step_size);
/// step along the gradient
void stepGradient(Real factor = 1.);
const std::vector<const int*> & connectivity;
const std::vector<int> & free_nodes;
PointContainer<DIM> & nodes;
std::vector<Real> grad;
};
#endif /* _MINI_MESH_H_ */

Event Timeline