/* * Project: MoleCuilder * Description: creates and alters molecular systems * Copyright (C) 2010-2012 University of Bonn. All rights reserved. * * * This file is part of MoleCuilder. * * MoleCuilder is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * MoleCuilder is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with MoleCuilder. If not, see . */ /* * BoundaryPointSet.cpp * * Created on: Jul 29, 2010 * Author: heber */ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include "CodePatterns/MemDebug.hpp" #include "BoundaryPointSet.hpp" #include #include "BoundaryLineSet.hpp" #include "BoundaryTriangleSet.hpp" #include "Atom/TesselPoint.hpp" #include "CodePatterns/Assert.hpp" #include "CodePatterns/Info.hpp" #include "CodePatterns/Log.hpp" #include "LinearAlgebra/Vector.hpp" #include "CodePatterns/Verbose.hpp" using namespace std; // ======================================== Points on Boundary ================================= /** Constructor of BoundaryPointSet. */ BoundaryPointSet::BoundaryPointSet() : LinesCount(0), value(0.), Nr(-1) { //Info FunctionInfo(__func__); LOG(1, "Adding noname."); } ; /** Constructor of BoundaryPointSet with Tesselpoint. * \param *Walker TesselPoint this boundary point represents */ BoundaryPointSet::BoundaryPointSet(TesselPoint * const Walker) : LinesCount(0), node(Walker), value(0.), Nr(Walker->getNr()) { //Info FunctionInfo(__func__); LOG(5, "DEBUG: Adding Node " << *Walker); } ; /** Destructor of BoundaryPointSet. * Sets node to NULL to avoid removing the original, represented TesselPoint. * \note When removing point from a class Tesselation, use RemoveTesselationPoint() */ BoundaryPointSet::~BoundaryPointSet() { //Info FunctionInfo(__func__); //LOG(0, "Erasing point Nr. " << Nr << "."); if (!lines.empty()) ELOG(2, "Memory Leak! I " << *this << " am still connected to some lines."); node = NULL; } ; /** Add a line to the LineMap of this point. * \param *line line to add */ void BoundaryPointSet::AddLine(BoundaryLineSet * const line) { //Info FunctionInfo(__func__); LOG(5, "DEBUG: Adding " << *this << " to line " << *line << "."); if (line->endpoints[0] == this) { lines.insert(LinePair(line->endpoints[1]->Nr, line)); } else { lines.insert(LinePair(line->endpoints[0]->Nr, line)); } LinesCount++; } const std::string& BoundaryPointSet::getName() const { ASSERT(node != NULL, "BoundaryPointSet::getName() - internal node is NULL."); return node->getName(); } const Vector& BoundaryPointSet::getPosition() const { ASSERT(node != NULL, "BoundaryPointSet::getPosition() - internal node is NULL."); return node->getPosition(); } const int& BoundaryPointSet::getNr() const { ASSERT(node != NULL, "BoundaryPointSet::getPosition() - internal node is NULL."); return node->getNr(); } TesselPoint *BoundaryPointSet::getTesselPoint() { return node; } ostream & operator <<(ostream &ost, const BoundaryPointSet &a) { ost << "[" << a.Nr << "|" << a.getName() << " at " << a.getPosition() << "]"; return ost; }