~ubuntu-branches/debian/squeeze/gmsh/squeeze

« back to all changes in this revision

Viewing changes to Mesh/highOrderSmoother.h

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme, Christophe Prud'homme
  • Date: 2009-09-27 17:36:40 UTC
  • mfrom: (1.4.2 upstream)
  • mto: This revision was merged to the branch mainline in revision 10.
  • Revision ID: james.westby@ubuntu.com-20090927173640-meoeywl4f5hq5qas
Tags: 2.4.2.dfsg-1
[Christophe Prud'homme]
* New upstream release
  + solver code refactoring
  + better IDE integration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Gmsh - Copyright (C) 1997-2009 C. Geuzaine, J.-F. Remacle
 
2
//
 
3
// See the LICENSE.txt file for license information. Please report all
 
4
// bugs and problems to <gmsh@geuz.org>.
 
5
 
 
6
#ifndef _HIGH_ORDER_SMOOTHER_H_
 
7
#define _HIGH_ORDER_SMOOTHER_H_
 
8
 
 
9
#include <map>
 
10
#include <vector>
 
11
#include "SVector3.h"
 
12
#include "fullMatrix.h"
 
13
#include "dofManager.h"
 
14
#include "elasticityTerm.h"
 
15
 
 
16
class MVertex;
 
17
class MElement;
 
18
class GFace;
 
19
class GRegion;
 
20
 
 
21
class highOrderSmoother 
 
22
{
 
23
  const int _tag;
 
24
  std::map<MVertex*,SVector3> _straightSidedLocation;
 
25
  std::map<MVertex*,SVector3> _targetLocation;
 
26
  int _dim;
 
27
  void _clean()
 
28
  {
 
29
    _straightSidedLocation.clear();
 
30
    _targetLocation.clear();
 
31
  }
 
32
  double _MIDDLE;
 
33
  void moveTo(MVertex *v, const std::map<MVertex*,SVector3> &) const;
 
34
public:  
 
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());
 
39
  }  
 
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,
 
44
                        elasticityTerm &El);
 
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; }
 
51
  void swap(GFace *, 
 
52
            edgeContainer &edgeVertices,
 
53
            faceContainer &faceVertices);
 
54
  void optimize(GFace *, 
 
55
                edgeContainer &edgeVertices,
 
56
                faceContainer &faceVertices);
 
57
  void computeMetricVector(GFace *gf, 
 
58
                           MElement *e, 
 
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
 
68
  {
 
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());
 
72
  }
 
73
  inline SVector3 getDisplacement(MVertex *v) const
 
74
  {
 
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);
 
79
     else{
 
80
       return SVector3(itt->second.x() - it->second.x(),
 
81
                       itt->second.y() - it->second.y(),
 
82
                       itt->second.z() - it->second.z());
 
83
     }
 
84
  }
 
85
};
 
86
 
 
87
#endif