diff --git a/Base/printList.h b/Base/printList.h index bb0e7dd1c80af3ffa0b6cfbc8eb0cd2586e72bd4..7a4a4bb16f9336ffe35e388d5fe90bf8df098dad 100644 --- a/Base/printList.h +++ b/Base/printList.h @@ -13,7 +13,7 @@ #include <string> #include <iostream> -namespace BASELIB { +namespace BaseLib { void printList (std::list<size_t> const& mylist, std::string const& title) { @@ -25,6 +25,6 @@ void printList (std::list<size_t> const& mylist, std::string const& title) std::cout << std::endl; } -} // end namespace BASELIB +} // end namespace BaseLib #endif /* PRINTLIST_H_ */ diff --git a/Base/quicksort.h b/Base/quicksort.h index 72648f2ebb66dcca98d1c6e934be496c09990aa8..d2d031c52434135c55882faa7c37c4c642e0eb81 100644 --- a/Base/quicksort.h +++ b/Base/quicksort.h @@ -36,10 +36,10 @@ unsigned partition_(T* array, unsigned beg, unsigned end) while ((j>beg) && !(array[j] < m)) j--; if (i >= j) break; - BASELIB::swap(array[i], array[j]); + BaseLib::swap(array[i], array[j]); } - BASELIB::swap(array[beg], array[j]); + BaseLib::swap(array[beg], array[j]); return j; } @@ -67,14 +67,15 @@ size_t partition_(T1* array, size_t beg, size_t end, T2 *second_array) while ((j > beg) && !(array[j] <= m)) j--; - if (i >= j) - break; - BASELIB::swap(array[i], array[j]); - BASELIB::swap(second_array[i], second_array[j]); + if (i >= j) break; + + BaseLib::swap(array[i], array[j]); + BaseLib::swap(second_array[i], second_array[j]); } - BASELIB::swap(array[beg], array[j]); - BASELIB::swap(second_array[beg], second_array[j]); + BaseLib::swap(array[beg], array[j]); + BaseLib::swap(second_array[beg], second_array[j]); + return j; } @@ -121,12 +122,12 @@ private: if (i >= j) break; - BASELIB::swap(array[i], array[j]); - BASELIB::swap(perm[i], perm[j]); + BaseLib::swap(array[i], array[j]); + BaseLib::swap(perm[i], perm[j]); } - BASELIB::swap(array[beg], array[j]); - BASELIB::swap(perm[beg], perm[j]); + BaseLib::swap(array[beg], array[j]); + BaseLib::swap(perm[beg], perm[j]); return j; } @@ -169,12 +170,12 @@ private: if (i >= j) break; - BASELIB::swap(array[i], array[j]); - BASELIB::swap(perm[i], perm[j]); + BaseLib::swap(array[i], array[j]); + BaseLib::swap(perm[i], perm[j]); } - BASELIB::swap(array[beg], array[j]); - BASELIB::swap(perm[beg], perm[j]); + BaseLib::swap(array[beg], array[j]); + BaseLib::swap(perm[beg], perm[j]); return j; } @@ -201,12 +202,12 @@ private: if (i >= j) break; - BASELIB::swap(perm[i], perm[j]); - BASELIB::swap(array[i], array[j]); + BaseLib::swap(perm[i], perm[j]); + BaseLib::swap(array[i], array[j]); } - BASELIB::swap(perm[beg], perm[j]); - BASELIB::swap(array[beg], array[j]); + BaseLib::swap(perm[beg], perm[j]); + BaseLib::swap(array[beg], array[j]); return j; } diff --git a/Base/swap.h b/Base/swap.h index 9915e9135c3aecbd70a69b9aa4b76e18791bb525..265054b11302c9c1ad931bc0d2a504e80ba7639b 100644 --- a/Base/swap.h +++ b/Base/swap.h @@ -1,7 +1,7 @@ #ifndef SWAP_H_ #define SWAP_H_ -namespace BASELIB { +namespace BaseLib { /** * swap the content of arg0 and arg1 @@ -13,6 +13,6 @@ template<class T> void swap(T& arg0, T& arg1) arg1 = temp; } -} // end namespace BASELIB +} // end namespace BaseLib #endif //SWAP_H_ diff --git a/Base/uniqueListInsert.h b/Base/uniqueListInsert.h index 779545a7ca4b097a517b222f541bdf862b58f156..38804f59dc72e8c395de923ae8dcd52aaa420234 100644 --- a/Base/uniqueListInsert.h +++ b/Base/uniqueListInsert.h @@ -10,7 +10,7 @@ #include <list> -namespace BASELIB { +namespace BaseLib { void uniqueListInsert (std::list<size_t>& list, size_t element) { @@ -23,6 +23,6 @@ void uniqueListInsert (std::list<size_t>& list, size_t element) list.push_back (element); } -} // end namespace BASELIB +} // end namespace BaseLib #endif /* UNIQUELISTINSERT_H_ */ diff --git a/Base/wait.h b/Base/wait.h index 2973158740e78f9a94c09eb52d7386530d35c342..c56de0311396508c69f0904ec886bd00fd562325 100644 --- a/Base/wait.h +++ b/Base/wait.h @@ -9,7 +9,7 @@ #include <ctime> -namespace BASELIB { +namespace BaseLib { void wait(int seconds) { @@ -23,6 +23,6 @@ void wait(int seconds) while((cur_time - start_time) < seconds); } -} // end namespace BASELIB +} // end namespace BaseLib #endif //WAIT_H diff --git a/GeoLib/Polygon.cpp b/GeoLib/Polygon.cpp index 90e79664ba1ad33ad82171b0100a26eda0ba581c..12721118874f9956cc7c5fb590c3dc289f908938 100644 --- a/GeoLib/Polygon.cpp +++ b/GeoLib/Polygon.cpp @@ -267,7 +267,7 @@ void Polygon::ensureCWOrientation () size_t tmp_n_pnts (n_pnts); tmp_n_pnts++; // include last point of polygon (which is identical to the first) for (size_t k(0); k<tmp_n_pnts/2; k++) { - BASELIB::swap (_ply_pnt_ids[k], _ply_pnt_ids[tmp_n_pnts-1-k]); + BaseLib::swap (_ply_pnt_ids[k], _ply_pnt_ids[tmp_n_pnts-1-k]); } } @@ -288,7 +288,7 @@ void Polygon::splitPolygonAtIntersection (std::list<Polygon*>::iterator polygon_ const_cast<std::vector<Point*>& >(_ply_pnts).push_back (intersection_pnt); // split Polygon - if (idx0 > idx1) BASELIB::swap (idx0, idx1); + if (idx0 > idx1) BaseLib::swap (idx0, idx1); GEOLIB::Polygon* polygon0 (new GEOLIB::Polygon((*polygon_it)->getPointsVec(), false)); for (size_t k(0); k<=idx0; k++) polygon0->addPoint ((*polygon_it)->getPointID (k)); @@ -343,7 +343,7 @@ void Polygon::splitPolygonAtPoint (std::list<GEOLIB::Polygon*>::iterator polygon delete [] perm; delete [] id_vec; - if (idx0 > idx1) BASELIB::swap (idx0, idx1); + if (idx0 > idx1) BaseLib::swap (idx0, idx1); // create two closed polylines GEOLIB::Polygon* polygon0 (new GEOLIB::Polygon((*polygon_it)->getPointsVec())); diff --git a/GeoLib/Polyline.cpp b/GeoLib/Polyline.cpp index 0176824553cd42d1fea7c1e14682472db9b72687..7d40cb35c68a1723d1bb6fae6f4602de07d7cebc 100644 --- a/GeoLib/Polyline.cpp +++ b/GeoLib/Polyline.cpp @@ -244,13 +244,13 @@ bool containsEdge (const Polyline& ply, size_t id0, size_t id1) std::cerr << "no valid edge id0 == id1 == " << id0 << std::endl; return false; } - if (id0 > id1) BASELIB::swap (id0,id1); + if (id0 > id1) BaseLib::swap (id0,id1); const size_t n (ply.getNumberOfPoints() - 1); for (size_t k(0); k<n; k++) { size_t ply_pnt0 (ply.getPointID (k)); size_t ply_pnt1 (ply.getPointID (k+1)); if (ply_pnt0 > ply_pnt1) - BASELIB::swap (ply_pnt0, ply_pnt1); + BaseLib::swap (ply_pnt0, ply_pnt1); if (ply_pnt0 == id0 && ply_pnt1 == id1) return true; } diff --git a/MathLib/EarClippingTriangulation.cpp b/MathLib/EarClippingTriangulation.cpp index 45eb1fa5235506c7d2240fd8f5d4c7d495260f89..d8832cbd5fbc0f8e3b3d418d220cbc54d52a1c67 100644 --- a/MathLib/EarClippingTriangulation.cpp +++ b/MathLib/EarClippingTriangulation.cpp @@ -8,7 +8,7 @@ // STL #include <vector> -// BASELIB +// BaseLib #include "swap.h" #include "printList.h" #include "uniqueListInsert.h" @@ -119,7 +119,7 @@ void EarClippingTriangulation::ensureCWOrientation () if (_original_orient == MathLib::CCW) { // switch orientation for (size_t k(0); k<n_pnts/2; k++) { - BASELIB::swap (_pnts[k], _pnts[n_pnts-1-k]); + BaseLib::swap (_pnts[k], _pnts[n_pnts-1-k]); } } } @@ -222,11 +222,11 @@ void EarClippingTriangulation::clipEars() MathLib::Orientation orientation = getOrientation(_pnts[*prevprev], _pnts[*prev], _pnts[*next]); if (orientation == CW) { - BASELIB::uniqueListInsert(_convex_vertex_list, *prev); + BaseLib::uniqueListInsert(_convex_vertex_list, *prev); // prev is convex if (isEar(*prevprev, *prev, *next)) { // prev is an ear tip - BASELIB::uniqueListInsert(_ear_list, *prev); + BaseLib::uniqueListInsert(_ear_list, *prev); } else { // if necessary remove prev _ear_list.remove(*prev); @@ -261,11 +261,11 @@ void EarClippingTriangulation::clipEars() orientation = getOrientation(_pnts[*prev], _pnts[*next], _pnts[*nextnext]); if (orientation == CW) { - BASELIB::uniqueListInsert(_convex_vertex_list, *next); + BaseLib::uniqueListInsert(_convex_vertex_list, *next); // next is convex if (isEar(*prev, *next, *nextnext)) { // next is an ear tip - BASELIB::uniqueListInsert(_ear_list, *next); + BaseLib::uniqueListInsert(_ear_list, *next); } else { // if necessary remove *next _ear_list.remove(*next); diff --git a/MathLib/LinAlg/Solvers/GaussAlgorithm.cpp b/MathLib/LinAlg/Solvers/GaussAlgorithm.cpp index 98007abaf93e22fa66e300f39ee437970208353b..2f0031c3035fa1880f63c85af2683abf16bebb48 100644 --- a/MathLib/LinAlg/Solvers/GaussAlgorithm.cpp +++ b/MathLib/LinAlg/Solvers/GaussAlgorithm.cpp @@ -30,7 +30,7 @@ GaussAlgorithm::GaussAlgorithm (Matrix <double> &A) : // exchange rows if (_perm[k] != k) { - for (j=0; j<nc; j++) BASELIB::swap (_mat(_perm[k],j), _mat(k,j)); + for (j=0; j<nc; j++) BaseLib::swap (_mat(_perm[k],j), _mat(k,j)); } // eliminate @@ -59,7 +59,7 @@ void GaussAlgorithm::execute (double *b) const void GaussAlgorithm::permuteRHS (double* b) const { for (size_t i=0; i<_n; i++) { - if (_perm[i] != i) BASELIB::swap(b[i], b[_perm[i]]); + if (_perm[i] != i) BaseLib::swap(b[i], b[_perm[i]]); } } diff --git a/MathLib/LinAlg/Sparse/CRSMatrix.h b/MathLib/LinAlg/Sparse/CRSMatrix.h index a4fc2bb3a0ad7b9ba89304144aff1b27ee4f4d2f..4c99ce9421c5ec57a361da87ec5ddad9e42d30a7 100644 --- a/MathLib/LinAlg/Sparse/CRSMatrix.h +++ b/MathLib/LinAlg/Sparse/CRSMatrix.h @@ -298,9 +298,9 @@ protected: } MatrixBase::_n_rows -= n_rows_cols; - BASELIB::swap (row_ptr_new, _row_ptr); - BASELIB::swap (col_idx_new, _col_idx); - BASELIB::swap (data_new, _data); + BaseLib::swap (row_ptr_new, _row_ptr); + BaseLib::swap (col_idx_new, _col_idx); + BaseLib::swap (data_new, _data); delete [] row_ptr_new_tmp; delete [] row_ptr_new; @@ -351,9 +351,9 @@ protected: } MatrixBase::_n_rows = n_cols; - BASELIB::swap(row_ptr_trans, _row_ptr); - BASELIB::swap(col_idx_trans, _col_idx); - BASELIB::swap(data_trans, _data); + BaseLib::swap(row_ptr_trans, _row_ptr); + BaseLib::swap(col_idx_trans, _col_idx); + BaseLib::swap(data_trans, _data); delete[] row_ptr_nnz; delete[] row_ptr_trans; diff --git a/MathLib/LinAlg/Sparse/NestedDissectionPermutation/AdjMat.cpp b/MathLib/LinAlg/Sparse/NestedDissectionPermutation/AdjMat.cpp index 9280eb5bdf118e0ad18946b11ec43b70566b0f5f..bccd00a113af59d4f0d35be45c049170e7d3fc18 100644 --- a/MathLib/LinAlg/Sparse/NestedDissectionPermutation/AdjMat.cpp +++ b/MathLib/LinAlg/Sparse/NestedDissectionPermutation/AdjMat.cpp @@ -137,8 +137,8 @@ void genAdjMat(unsigned n, unsigned* &iA, unsigned* &jA) if (i < jA[k]) jAn[con[i]++] = jA[k]; - BASELIB::swap(jA, jAn); - BASELIB::swap(iA, iAn); + BaseLib::swap(jA, jAn); + BaseLib::swap(iA, iAn); delete[] jAn; delete[] con; @@ -184,8 +184,8 @@ void genFullAdjMat(unsigned n, unsigned* &iA, unsigned* &jA) } } - BASELIB::swap(jA, jAn); - BASELIB::swap(iA, iAn); + BaseLib::swap(jA, jAn); + BaseLib::swap(iA, iAn); delete[] jAn; delete[] iAn; diff --git a/MathLib/LinAlg/Sparse/NestedDissectionPermutation/Cluster.cpp b/MathLib/LinAlg/Sparse/NestedDissectionPermutation/Cluster.cpp index 05d1eb93fbb80f4776a77a679bf49849b839ac65..1b3915cd72f33c2cfdda8779e90e698f226edc93 100644 --- a/MathLib/LinAlg/Sparse/NestedDissectionPermutation/Cluster.cpp +++ b/MathLib/LinAlg/Sparse/NestedDissectionPermutation/Cluster.cpp @@ -121,6 +121,7 @@ void Cluster::subdivide(unsigned bmin) // _l_adj_mat = NULL; // } // end if next recursion step } // end if ( connected && size () > bmin ) + } @@ -134,9 +135,9 @@ void Cluster::updatePerm(unsigned* reordering, unsigned &isep0, while (beg < end && reordering[end] >= 1) --end; // local permutation - BASELIB::swap(l_op_perm[beg], l_op_perm[end]); - BASELIB::swap(l_po_perm[l_op_perm[beg]], l_po_perm[l_op_perm[end]]); - BASELIB::swap(reordering[beg], reordering[end]); + BaseLib::swap(l_op_perm[beg], l_op_perm[end]); + BaseLib::swap(l_po_perm[l_op_perm[beg]], l_po_perm[l_op_perm[end]]); + BaseLib::swap(reordering[beg], reordering[end]); } ++beg; } @@ -152,9 +153,9 @@ void Cluster::updatePerm(unsigned* reordering, unsigned &isep0, while (beg < end && reordering[end] == 2) --end; // local permutation - BASELIB::swap(l_op_perm[beg], l_op_perm[end]); - BASELIB::swap(l_po_perm[l_op_perm[beg]], l_po_perm[l_op_perm[end]]); - BASELIB::swap(reordering[beg], reordering[end]); + BaseLib::swap(l_op_perm[beg], l_op_perm[end]); + BaseLib::swap(l_po_perm[l_op_perm[beg]], l_po_perm[l_op_perm[end]]); + BaseLib::swap(reordering[beg], reordering[end]); } ++beg; } diff --git a/MathLib/LinAlg/Sparse/NestedDissectionPermutation/Separator.cpp b/MathLib/LinAlg/Sparse/NestedDissectionPermutation/Separator.cpp index 7d7d211ab0b67f51cc7cb7d6763d0e6e8db18998..226329ef83e5b35deb278bce2a1b6c660ff3b6d1 100644 --- a/MathLib/LinAlg/Sparse/NestedDissectionPermutation/Separator.cpp +++ b/MathLib/LinAlg/Sparse/NestedDissectionPermutation/Separator.cpp @@ -34,8 +34,8 @@ unsigned Separator::updatePerm(unsigned* reordering, unsigned* l_op_perm, unsign --end; while (beg < end && reordering[end] == 1) --end; // local permutation - BASELIB::swap(l_op_perm [beg], l_op_perm[end]); - BASELIB::swap(l_po_perm[l_op_perm [beg]], l_po_perm[l_op_perm[end]]); + BaseLib::swap(l_op_perm [beg], l_op_perm[end]); + BaseLib::swap(l_po_perm[l_op_perm [beg]], l_po_perm[l_op_perm[end]]); } ++beg; }