1
// Gmsh - Copyright (C) 1997-2009 C. Geuzaine, J.-F. Remacle
3
// See the LICENSE.txt file for license information. Please report all
4
// bugs and problems to <gmsh@geuz.org>.
6
#ifndef _HIGH_ORDER_SMOOTHER_H_
7
#define _HIGH_ORDER_SMOOTHER_H_
12
#include "fullMatrix.h"
13
#include "dofManager.h"
14
#include "elasticityTerm.h"
21
class highOrderSmoother
24
std::map<MVertex*,SVector3> _straightSidedLocation;
25
std::map<MVertex*,SVector3> _targetLocation;
29
_straightSidedLocation.clear();
30
_targetLocation.clear();
33
void moveTo(MVertex *v, const std::map<MVertex*,SVector3> &) const;
35
highOrderSmoother(int dim) : _tag(111), _dim(dim) {_clean();}
36
void add(MVertex * v, const SVector3 &d ) {
37
_straightSidedLocation[v] = d;
38
_targetLocation[v] = SPoint3(v->x(),v->y(),v->z());
40
void smooth(std::vector<MElement*> & );
41
double smooth_metric_(std::vector<MElement*> &, GFace *gf,
42
dofManager<double,double> &myAssembler,
43
std::set<MVertex*> &verticesToMove,
45
void smooth_metric(std::vector<MElement*> &, GFace *gf );
46
void smooth(GFace *, bool metric = false);
47
void smooth_p2point(GFace *);
48
void smooth_pNpoint(GFace *);
49
void smooth(GRegion*);
50
int getTag() const { return _tag; }
52
edgeContainer &edgeVertices,
53
faceContainer &faceVertices);
54
void optimize(GFace *,
55
edgeContainer &edgeVertices,
56
faceContainer &faceVertices);
57
void computeMetricVector(GFace *gf,
59
fullMatrix<double> &J,
60
fullMatrix<double> &JT,
61
fullVector<double> &D);
62
void moveToStraightSidedLocation(MVertex *) const;
63
void moveToTargetLocation(MVertex *) const;
64
void moveToStraightSidedLocation(MElement *) const;
65
void moveToTargetLocation(MElement *) const;
66
void updateTargetLocation(MVertex*, const SPoint3 &, const SPoint2 &) ;
67
inline SVector3 getSSL(MVertex *v) const
69
std::map<MVertex*,SVector3>::const_iterator it = _straightSidedLocation.find(v);
70
if (it != _straightSidedLocation.end())return it->second;
71
else return SVector3(v->x(),v->y(),v->z());
73
inline SVector3 getDisplacement(MVertex *v) const
75
std::map<MVertex*,SVector3>::const_iterator it = _straightSidedLocation.find(v);
76
std::map<MVertex*,SVector3>::const_iterator itt = _targetLocation.find(v);
77
if (it == _straightSidedLocation.end())
78
return SVector3(0.0,0.0,0.0);
80
return SVector3(itt->second.x() - it->second.x(),
81
itt->second.y() - it->second.y(),
82
itt->second.z() - it->second.z());