File: SliverFaceHandler.h

package info (click to toggle)
madlib 1.3.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,196 kB
  • sloc: cpp: 39,851; sh: 10,041; makefile: 473
file content (111 lines) | stat: -rw-r--r-- 2,895 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// -*- C++ -*-
// -------------------------------------------------------------------
// MAdLib - Copyright (C) 2008-2009 Universite catholique de Louvain
//
// See the Copyright.txt and License.txt files for license information. 
// You should have received a copy of these files along with MAdLib. 
// If not, see <http://www.madlib.be/license/>
//
// Please report all bugs and problems to <contrib@madlib.be>
//
// Authors: Gaetan Compere, Jean-Francois Remacle
// -------------------------------------------------------------------

#ifndef _H_SLIVERFACEHANDLER
#define _H_SLIVERFACEHANDLER

#include "MAdOperatorBase.h"

#include <string>

namespace MAd {

  // -------------------------------------------------------------------
  class sliverFaceHandler {

  public:

    sliverFaceHandler(pMesh, DiscreteSF *);
    ~sliverFaceHandler() {}

  public:

    void removeSliverFaces(int * nbIn=NULL, int * nbOut=NULL);

    void setSizeField(DiscreteSF *);

    // whether we can use operations on boundaries
    void collapseOnBoundary(bool, double);

    // whether we can use operations that add nodes
    void newVertexPermission(bool);
    bool getNewVertexPermission() const { return addNodes; }

    void enableReport(std::string);

  private:

    int findOperation(pFace, pMAdOperator *);

    bool F_isSliver(pFace);
    bool F_isSliver(pFace, double *);

    void reportSliver(pFace);

  private:

    pMesh mesh;
    DiscreteSF * sizeField;
    MeshQualityManager& mqm;

    bool collapseOnBdry;
    double dATol;

    bool addNodes; // whether or not we can use operators that add nodes 
                   // (edge split)

    bool   reportFailures;
    int    reportId;
    std::string reportPrefix;

  };

  // -------------------------------------------------------------------
  inline sliverFaceHandler::sliverFaceHandler(pMesh m, DiscreteSF * sf):
    mesh(m),sizeField(sf), mqm(MeshQualityManagerSgl::instance()), 
    collapseOnBdry(false), dATol(MAdTOL), addNodes(true), 
    reportFailures(false),reportId(0),reportPrefix("")
  {}

  // -------------------------------------------------------------------
  inline void sliverFaceHandler::setSizeField(DiscreteSF * sf)
  {
    sizeField = sf;
  }

  // -------------------------------------------------------------------
  inline void sliverFaceHandler::collapseOnBoundary(bool cob, double tolerance)
  {
    collapseOnBdry = cob;
    dATol = tolerance;
  }

  // -------------------------------------------------------------------
  inline void sliverFaceHandler::newVertexPermission(bool allow)
  {
    addNodes = allow;
  }

  // -------------------------------------------------------------------
  inline void sliverFaceHandler::enableReport(std::string prefix)
  {
    reportFailures = true; 
    reportPrefix   = prefix;
  }

  // -------------------------------------------------------------------

}

#endif