diff --git a/MathLib/CMakeLists.txt b/MathLib/CMakeLists.txt index 819e251d0d5532b1e9030feebb8608d03b386f0f..7f64f5550870ba9983b0fd8260c67af090194ee2 100644 --- a/MathLib/CMakeLists.txt +++ b/MathLib/CMakeLists.txt @@ -5,7 +5,6 @@ SET( HEADERS MathTools.h Vector3.h EarClippingTriangulation.h - LinkedTriangle.h max.h sparse.h vector_io.h @@ -36,7 +35,6 @@ SET( SOURCES LinearInterpolation.cpp MathTools.cpp EarClippingTriangulation.cpp - LinkedTriangle.cpp LinAlg/Sparse/amuxCRS.cpp LinAlg/Solvers/BiCGStab.cpp LinAlg/Solvers/CG.cpp diff --git a/MathLib/LinAlg/Sparse/CRSMatrixDiagPrecond.h b/MathLib/LinAlg/Sparse/CRSMatrixDiagPrecond.h index 30c4f4b0cc301d4117751181dce255268e730614..7bee253808a0dff9e7112d3d094d8d77a8f04f19 100644 --- a/MathLib/LinAlg/Sparse/CRSMatrixDiagPrecond.h +++ b/MathLib/LinAlg/Sparse/CRSMatrixDiagPrecond.h @@ -13,9 +13,8 @@ class CRSMatrixDiagPrecond : public CRSMatrix<double> { public: CRSMatrixDiagPrecond (std::string const &fname) - : CRSMatrix<double>(fname), _inv_diag(NULL) + : CRSMatrix<double>(fname), _inv_diag(new double[_n_rows]) { - _inv_diag = new double[_n_rows]; if (!generateDiagPrecond (_n_rows, _row_ptr, _col_idx, _data, _inv_diag)) { std::cout << "Could not create diagonal preconditioner" << std::endl; } diff --git a/MathLib/LinkedTriangle.cpp b/MathLib/LinkedTriangle.cpp deleted file mode 100644 index 2207b967cff9f6b590ac39dd96d988809e360a2e..0000000000000000000000000000000000000000 --- a/MathLib/LinkedTriangle.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * LinkedTriangle.cpp - * - * Created on: Mar 25, 2010 - * Author: fischeth - */ - -#include "LinkedTriangle.h" - -namespace MathLib { - -LinkedTriangle::LinkedTriangle(std::vector<GEOLIB::Point*> const &pnt_vec, - size_t pnt_a, size_t pnt_b, size_t pnt_c, LinkedTriangle* tri_a, - LinkedTriangle* tri_b, LinkedTriangle* tri_c) : - GEOLIB::Triangle(pnt_vec, pnt_a, pnt_b, pnt_c) -{ - if (tri_a) _neighbor_triangles[0] = tri_a; - else _neighbor_triangles[0] = NULL; - if (tri_b) _neighbor_triangles[1] = tri_b; - else _neighbor_triangles[1] = NULL; - if (tri_c) _neighbor_triangles[2] = tri_c; - else _neighbor_triangles[2] = NULL; -} - -void LinkedTriangle::setNeighborTriangle(size_t idx, LinkedTriangle* tri) -{ - assert(idx < 3); - _neighbor_triangles[idx] = tri; -} - -void LinkedTriangle::setNeighborTriangleByPointIdx (size_t idx, LinkedTriangle* tri) -{ - if (idx == _pnt_ids[0]) setNeighborTriangle (0, tri); - else { - if (idx == _pnt_ids[1]) setNeighborTriangle (1, tri); - else setNeighborTriangle (2, tri); - } -} - -LinkedTriangle* LinkedTriangle::getNeighborTriangle(size_t idx) -{ - assert(idx < 3); - return _neighbor_triangles[idx]; -} - -size_t LinkedTriangle::getIdxOfNeighborTriangle(LinkedTriangle* tri) -{ - if (tri == _neighbor_triangles[0]) return 0; - if (tri == _neighbor_triangles[1]) return 1; - if (tri == _neighbor_triangles[2]) return 2; - return 3; -} - -size_t LinkedTriangle::getIdxOfPoint (size_t i) const -{ - if (_pnt_ids[0] == i) return 0; - if (_pnt_ids[1] == i) return 1; - if (_pnt_ids[2] == i) return 2; - return 3; -} - -void LinkedTriangle::writeNeighbor (std::ostream &os, size_t idx) const -{ - if (_neighbor_triangles[idx]) { - os << "["; - (_neighbor_triangles[idx])->write (os); - os << "]"; - } - else os << "NULL"; -} - -LinkedTriangle::~LinkedTriangle() -{ - // TODO Auto-generated destructor stub -} - -std::ostream& operator<< (std::ostream &os, const LinkedTriangle &tri) -{ - tri.write (os); - return os; -} - -} // end namespace MathLib diff --git a/MathLib/LinkedTriangle.h b/MathLib/LinkedTriangle.h deleted file mode 100644 index 46cdf8321be7e48a6c6cf8ae5421616b6694428a..0000000000000000000000000000000000000000 --- a/MathLib/LinkedTriangle.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * LinkedTriangle.h - * - * Created on: Mar 25, 2010 - * Author: fischeth - */ - -#ifndef LINKEDTRIANGLE_H_ -#define LINKEDTRIANGLE_H_ - -#include <vector> -#include <iostream> - -// GEO -#include "Triangle.h" -#include "Point.h" - -namespace MathLib { - -class LinkedTriangle : public GEOLIB::Triangle { -public: - LinkedTriangle(std::vector<GEOLIB::Point*> const&pnt_vec, size_t pnt_a, - size_t pnt_b, size_t pnt_c, LinkedTriangle* tri_a, - LinkedTriangle* tri_b, LinkedTriangle* tri_c); - virtual ~LinkedTriangle(); - - void setNeighborTriangle (size_t idx, LinkedTriangle* tri); - void setNeighborTriangleByPointIdx (size_t idx, LinkedTriangle* tri); - - LinkedTriangle* getNeighborTriangle (size_t idx); - size_t getIdxOfNeighborTriangle(LinkedTriangle* tri); - - size_t getIdxOfPoint (size_t i) const; - - void write (std::ostream &os) const - { - os << _pnt_ids[0] << " " << _pnt_ids[1] << " " << _pnt_ids[2]; - } - - void writeNeighbor (std::ostream &os, size_t idx) const; - -private: - /** - * pointers to the neighbor triangles - */ - LinkedTriangle* _neighbor_triangles[3]; -}; - -/** overload the output operator for class LinkedTriangle */ -std::ostream& operator<< (std::ostream &os, const LinkedTriangle &tri); - -} // end namespace MathLib - -#endif /* LINKEDTRIANGLE_H_ */