[d74077] | 1 | /*
|
---|
| 2 | * BoundaryPointSet.cpp
|
---|
| 3 | *
|
---|
| 4 | * Created on: Jul 29, 2010
|
---|
| 5 | * Author: heber
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #include "BoundaryPointSet.hpp"
|
---|
| 9 |
|
---|
| 10 | #include <iostream>
|
---|
| 11 |
|
---|
| 12 | #include "BoundaryLineSet.hpp"
|
---|
| 13 | #include "BoundaryTriangleSet.hpp"
|
---|
| 14 | #include "TesselPoint.hpp"
|
---|
| 15 |
|
---|
| 16 | #include "Helpers/Assert.hpp"
|
---|
[8f4df1] | 17 | #include "Helpers/Info.hpp"
|
---|
| 18 | #include "Helpers/Log.hpp"
|
---|
| 19 | #include "LinearAlgebra/Vector.hpp"
|
---|
| 20 | #include "Helpers/Verbose.hpp"
|
---|
[d74077] | 21 |
|
---|
| 22 | using namespace std;
|
---|
| 23 |
|
---|
| 24 | // ======================================== Points on Boundary =================================
|
---|
| 25 |
|
---|
| 26 | /** Constructor of BoundaryPointSet.
|
---|
| 27 | */
|
---|
| 28 | BoundaryPointSet::BoundaryPointSet() :
|
---|
| 29 | LinesCount(0), value(0.), Nr(-1)
|
---|
| 30 | {
|
---|
| 31 | Info FunctionInfo(__func__);
|
---|
| 32 | DoLog(1) && (Log() << Verbose(1) << "Adding noname." << endl);
|
---|
| 33 | }
|
---|
| 34 | ;
|
---|
| 35 |
|
---|
| 36 | /** Constructor of BoundaryPointSet with Tesselpoint.
|
---|
| 37 | * \param *Walker TesselPoint this boundary point represents
|
---|
| 38 | */
|
---|
| 39 | BoundaryPointSet::BoundaryPointSet(TesselPoint * const Walker) :
|
---|
| 40 | LinesCount(0), node(Walker), value(0.), Nr(Walker->nr)
|
---|
| 41 | {
|
---|
| 42 | Info FunctionInfo(__func__);
|
---|
| 43 | DoLog(1) && (Log() << Verbose(1) << "Adding Node " << *Walker << endl);
|
---|
| 44 | }
|
---|
| 45 | ;
|
---|
| 46 |
|
---|
| 47 | /** Destructor of BoundaryPointSet.
|
---|
| 48 | * Sets node to NULL to avoid removing the original, represented TesselPoint.
|
---|
| 49 | * \note When removing point from a class Tesselation, use RemoveTesselationPoint()
|
---|
| 50 | */
|
---|
| 51 | BoundaryPointSet::~BoundaryPointSet()
|
---|
| 52 | {
|
---|
| 53 | Info FunctionInfo(__func__);
|
---|
| 54 | //Log() << Verbose(0) << "Erasing point nr. " << Nr << "." << endl;
|
---|
| 55 | if (!lines.empty())
|
---|
| 56 | DoeLog(2) && (eLog() << Verbose(2) << "Memory Leak! I " << *this << " am still connected to some lines." << endl);
|
---|
| 57 | node = NULL;
|
---|
| 58 | }
|
---|
| 59 | ;
|
---|
| 60 |
|
---|
| 61 | /** Add a line to the LineMap of this point.
|
---|
| 62 | * \param *line line to add
|
---|
| 63 | */
|
---|
| 64 | void BoundaryPointSet::AddLine(BoundaryLineSet * const line)
|
---|
| 65 | {
|
---|
| 66 | Info FunctionInfo(__func__);
|
---|
| 67 | DoLog(1) && (Log() << Verbose(1) << "Adding " << *this << " to line " << *line << "." << endl);
|
---|
| 68 | if (line->endpoints[0] == this) {
|
---|
| 69 | lines.insert(LinePair(line->endpoints[1]->Nr, line));
|
---|
| 70 | } else {
|
---|
| 71 | lines.insert(LinePair(line->endpoints[0]->Nr, line));
|
---|
| 72 | }
|
---|
| 73 | LinesCount++;
|
---|
| 74 | }
|
---|
| 75 | ;
|
---|
| 76 |
|
---|
| 77 | /** output operator for BoundaryPointSet.
|
---|
| 78 | * \param &ost output stream
|
---|
| 79 | * \param &a boundary point
|
---|
| 80 | */
|
---|
| 81 | ostream & operator <<(ostream &ost, const BoundaryPointSet &a)
|
---|
| 82 | {
|
---|
| 83 | ost << "[" << a.Nr << "|" << a.node->getName() << " at " << a.node->getPosition() << "]";
|
---|
| 84 | return ost;
|
---|
| 85 | }
|
---|
| 86 | ;
|
---|