File: EdgeSplitOp.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 (93 lines) | stat: -rw-r--r-- 2,519 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
// -*- 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: Olivier Pierard, Gaetan Compere, Jean-Francois Remacle
// -------------------------------------------------------------------

#ifndef _H_EDGESPLITOP
#define _H_EDGESPLITOP

#include "MAdOperatorBase.h"
#include "MeshSizeBase.h"

namespace MAd {

  // -------------------------------------------------------------------
  class edgeSplitOp: public MAdOperatorBase
  {
  public:

    edgeSplitOp(pMesh, DiscreteSF *);
    edgeSplitOp(const edgeSplitOp &);
    ~edgeSplitOp() { if (xyzSize) delete xyzSize; }

    operationType type() const { return MAd_ESPLIT; }

    // stores the edge to be splitted, computes the location of the split 
    // and returns the (unique) adimensional square length of the resulting edges
    double setSplitEdge(pEdge);

    void getCavity(pPList *) const;

    void apply();

  private:

    bool checkConstraints() const;
    bool checkGeometry();
    bool evaluateShapes();
    bool evaluateShapes2D();
    void evaluateLengths() const;

  private:

    pEdge edge;
    double xyz[3], u; // new vertex location: euclidian and edge parameter
    pMSize xyzSize;   // size at the new vertex
  };

  // -------------------------------------------------------------------
  inline edgeSplitOp::edgeSplitOp(const edgeSplitOp & _es):
    MAdOperatorBase(_es)
  {
    edge = _es.edge;
    xyz[0] = _es.xyz[0];
    xyz[1] = _es.xyz[1];
    xyz[2] = _es.xyz[2];
    u = _es.u;
    xyzSize = MS_copy(_es.xyzSize);
  }

  // -------------------------------------------------------------------
  inline edgeSplitOp::edgeSplitOp(pMesh _m, DiscreteSF * _sf):
    MAdOperatorBase(_m,_sf), edge(NULL)
  {
    xyz[0] = 0.;
    xyz[1] = 0.;
    xyz[2] = 0.;
    u = -1.;
    xyzSize = NULL;
  }

  // -------------------------------------------------------------------
  inline double edgeSplitOp::setSplitEdge(pEdge _edge)
  {
    if ( xyzSize ) delete xyzSize;
    edge = _edge;
    double lenReduc;
    u = sizeField->SF_E_center(_edge,xyz,&lenReduc,&xyzSize);
    return lenReduc;
  }

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

}

#endif