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 112 113 114 115 116 117 118 119 120 121 122 123 124
|
// -*- 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: Arnaud Francois, Gaetan Compere, Jean-Francois Remacle
// -------------------------------------------------------------------
#ifndef _H_EDGESWAPOP
#define _H_EDGESWAPOP
#include "MAdOperatorBase.h"
#include "EdgeSwapConfig.h"
namespace MAd {
// -------------------------------------------------------------------
class edgeSwapOp : public MAdOperatorBase
{
public:
edgeSwapOp();
edgeSwapOp(pMesh, DiscreteSF *);
edgeSwapOp(const edgeSwapOp &);
~edgeSwapOp() {}
operationType type() const { return MAd_ESWAP; }
int getMaxNumRgns() { return 7; }
void setSwapEdge(pEdge);
void swapOnBoundary(bool,double);
void getCavity(pPList *) const;
void apply();
private:
bool checkConstraints() const;
bool checkGeometry();
bool evaluateShapes();
void evaluateLengths() const;
bool checkGeometry2D();
bool checkGeometry3D();
bool evaluateShapes2D();
bool evaluateShapes3D();
int apply3D();
int apply2D();
pEdge edge; // the edge to be swapped
int conf; // best swap configuration - set by geomCheck()
pVertex vt; // top and bottom vertices of the edge (define the polygon orientation
pVertex vb; // w/r to vertices)
std::vector<pVertex> vertices; // oriented list of vertices defining the polygon
EdgeSwapConfiguration swap_config;
bool constrainBoundary;
bool checkVol; // tells if it's interesting to compute the variation of
// volume in the cavity (deduced from classif of edge
// and constrainBoundary)
double dVTol;
// reporting
void reportSwap( );
bool report;
int reportId;
std::string reportPrefix;
};
// -------------------------------------------------------------------
inline edgeSwapOp::edgeSwapOp(pMesh _m, DiscreteSF * _sf):
MAdOperatorBase(_m,_sf), edge(0), conf(-1), vt(0), vb(0),
constrainBoundary(true), checkVol(false), dVTol(MAdTOL),
report(false), reportId(0), reportPrefix("")
{
vertices.reserve(7);
}
// -------------------------------------------------------------------
inline edgeSwapOp::edgeSwapOp(const edgeSwapOp & _es):
MAdOperatorBase(_es), swap_config( _es.swap_config )
{
edge = _es.edge;
conf = _es.conf;
vt = _es.vt;
vb = _es.vb;
vertices = _es.vertices;
constrainBoundary = _es.constrainBoundary;
checkVol = _es.checkVol;
dVTol = _es.dVTol;
report = _es.report;
reportId = _es.reportId;
reportPrefix = _es.reportPrefix;
}
// -------------------------------------------------------------------
inline void edgeSwapOp::setSwapEdge(pEdge e)
{
edge = e;
results->reset();
conf = -1;
checkVol = false;
}
// -------------------------------------------------------------------
inline void edgeSwapOp::swapOnBoundary(bool eswapob, double dV)
{
constrainBoundary = !eswapob;
dVTol = dV;
}
}
// -------------------------------------------------------------------
#endif
|