Commit 97346d06 authored by Franjo Juretic's avatar Franjo Juretic
Browse files

Increased usage of DynList for sorting of edges

parent be20a8a4
...@@ -50,7 +50,7 @@ void sortEdgesIntoChains::createNodeLabels() ...@@ -50,7 +50,7 @@ void sortEdgesIntoChains::createNodeLabels()
newNodeLabel_.insert(e.end(), nPoints++); newNodeLabel_.insert(e.end(), nPoints++);
} }
edgesAtPoint_.setSize(nPoints, DynList<label>()); edgesAtPoint_.setSize(nPoints);
forAll(bEdges_, eI) forAll(bEdges_, eI)
{ {
const edge& e = bEdges_[eI]; const edge& e = bEdges_[eI];
...@@ -69,7 +69,7 @@ void sortEdgesIntoChains::createNodeLabels() ...@@ -69,7 +69,7 @@ void sortEdgesIntoChains::createNodeLabels()
bool sortEdgesIntoChains::findPointsBelongingToTheChain bool sortEdgesIntoChains::findPointsBelongingToTheChain
( (
const label currPos, const label currPos,
boolList& chainEdges DynList<bool>& chainEdges
) const ) const
{ {
# ifdef DEBUGSort # ifdef DEBUGSort
...@@ -150,7 +150,7 @@ bool sortEdgesIntoChains::findPointsBelongingToTheChain ...@@ -150,7 +150,7 @@ bool sortEdgesIntoChains::findPointsBelongingToTheChain
return true; return true;
} }
void sortEdgesIntoChains::shrinkEdges(const boolList& chainEdges) void sortEdgesIntoChains::shrinkEdges(const DynList<bool>& chainEdges)
{ {
forAll(chainEdges, eI) forAll(chainEdges, eI)
if( chainEdges[eI] ) if( chainEdges[eI] )
...@@ -168,14 +168,14 @@ void sortEdgesIntoChains::shrinkEdges(const boolList& chainEdges) ...@@ -168,14 +168,14 @@ void sortEdgesIntoChains::shrinkEdges(const boolList& chainEdges)
} }
} }
void sortEdgesIntoChains::createChainFromEdges(const boolList& chainEdges) void sortEdgesIntoChains::createChainFromEdges(const DynList<bool>& chainEdges)
{ {
direction i(0); label i(0);
forAll(chainEdges, eI) forAll(chainEdges, eI)
if( chainEdges[eI] ) if( chainEdges[eI] )
++i; ++i;
labelList chainPoints(i); DynList<label> chainPoints(i);
i = 0; i = 0;
forAll(chainEdges, eI) forAll(chainEdges, eI)
...@@ -232,7 +232,7 @@ void sortEdgesIntoChains::sortEdges() ...@@ -232,7 +232,7 @@ void sortEdgesIntoChains::sortEdges()
if( !openEdges_ ) if( !openEdges_ )
{ {
boolList chainEdges(bEdges_.size()); DynList<bool> chainEdges(bEdges_.size());
forAll(edgesAtPoint_, pI) forAll(edgesAtPoint_, pI)
if( findPointsBelongingToTheChain(pI, chainEdges) ) if( findPointsBelongingToTheChain(pI, chainEdges) )
{ {
...@@ -257,12 +257,11 @@ sortEdgesIntoChains::sortEdgesIntoChains(const DynList<edge>& bEdges) ...@@ -257,12 +257,11 @@ sortEdgesIntoChains::sortEdgesIntoChains(const DynList<edge>& bEdges)
} }
sortEdgesIntoChains::~sortEdgesIntoChains() sortEdgesIntoChains::~sortEdgesIntoChains()
{ {}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
// Member functions // Member functions
const DynList<labelList>& sortEdgesIntoChains::sortedChains() const const DynList<DynList<label> >& sortEdgesIntoChains::sortedChains() const
{ {
return createdChains_; return createdChains_;
} }
......
...@@ -39,7 +39,6 @@ SourceFiles ...@@ -39,7 +39,6 @@ SourceFiles
#include "labelList.H" #include "labelList.H"
#include "edge.H" #include "edge.H"
#include "Map.H" #include "Map.H"
#include "boolList.H"
namespace Foam namespace Foam
{ {
...@@ -52,43 +51,43 @@ class sortEdgesIntoChains ...@@ -52,43 +51,43 @@ class sortEdgesIntoChains
{ {
// Members // Members
const DynList<edge>& bEdges_; const DynList<edge>& bEdges_;
bool openEdges_; bool openEdges_;
Map<label> newNodeLabel_; Map<label> newNodeLabel_;
List<DynList<label> > edgesAtPoint_; DynList<DynList<label> > edgesAtPoint_;
DynList<labelList> createdChains_; DynList<DynList<label> > createdChains_;
// Private member functions // Private member functions
void createNodeLabels(); void createNodeLabels();
bool findPointsBelongingToTheChain bool findPointsBelongingToTheChain
( (
const label currPos, const label currPos,
boolList& chainEdges DynList<bool>& chainEdges
) const; ) const;
void shrinkEdges(const boolList& chainEdges); void shrinkEdges(const DynList<bool>& chainEdges);
void createChainFromEdges(const boolList& chainEdges); void createChainFromEdges(const DynList<bool>& chainEdges);
void sortEdges(); void sortEdges();
public: public:
sortEdgesIntoChains sortEdgesIntoChains
( (
const DynList<edge>& bEdges const DynList<edge>& bEdges
); );
~sortEdgesIntoChains(); ~sortEdgesIntoChains();
// Member functions // Member functions
//- a list of points which have not yet been resolved //- a list of points which have not yet been resolved
const DynList<labelList>& sortedChains() const; const DynList<DynList<label> >& sortedChains() const;
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment