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