Skip to content
Snippets Groups Projects
Commit 60ff30a5 authored by andy's avatar andy
Browse files

STYLE: corrected poor formatting

parent ba0647ee
No related merge requests found
...@@ -25,6 +25,7 @@ License ...@@ -25,6 +25,7 @@ License
#include "pairPatchAgglomeration.H" #include "pairPatchAgglomeration.H"
#include "meshTools.H" #include "meshTools.H"
#include "unitConversion.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
...@@ -53,7 +54,7 @@ void Foam::pairPatchAgglomeration::setBasedEdgeWeights() ...@@ -53,7 +54,7 @@ void Foam::pairPatchAgglomeration::setBasedEdgeWeights()
const bPatch& coarsePatch = patchLevels_[0]; const bPatch& coarsePatch = patchLevels_[0];
forAll(coarsePatch.edges(), i) forAll(coarsePatch.edges(), i)
{ {
if(coarsePatch.isInternalEdge(i)) if (coarsePatch.isInternalEdge(i))
{ {
scalar edgeLength = scalar edgeLength =
coarsePatch.edges()[i].mag(coarsePatch.localPoints()); coarsePatch.edges()[i].mag(coarsePatch.localPoints());
...@@ -63,12 +64,12 @@ void Foam::pairPatchAgglomeration::setBasedEdgeWeights() ...@@ -63,12 +64,12 @@ void Foam::pairPatchAgglomeration::setBasedEdgeWeights()
if (eFaces.size() == 2) if (eFaces.size() == 2)
{ {
scalar cosI = scalar cosI =
coarsePatch.faceNormals()[eFaces[0]] & coarsePatch.faceNormals()[eFaces[0]]
coarsePatch.faceNormals()[eFaces[1]]; & coarsePatch.faceNormals()[eFaces[1]];
const edge edgeCommon = edge(eFaces[0], eFaces[1]); const edge edgeCommon = edge(eFaces[0], eFaces[1]);
if(facePairWeight_.found(edgeCommon)) if (facePairWeight_.found(edgeCommon))
{ {
facePairWeight_[edgeCommon] += edgeLength; facePairWeight_[edgeCommon] += edgeLength;
} }
...@@ -77,14 +78,7 @@ void Foam::pairPatchAgglomeration::setBasedEdgeWeights() ...@@ -77,14 +78,7 @@ void Foam::pairPatchAgglomeration::setBasedEdgeWeights()
facePairWeight_.insert(edgeCommon, edgeLength); facePairWeight_.insert(edgeCommon, edgeLength);
} }
if if (cosI < Foam::cos(degToRad(featureAngle_)))
(
cosI <
Foam::cos
(
featureAngle_*constant::mathematical::pi/180.0
)
)
{ {
facePairWeight_[edgeCommon] = -1.0; facePairWeight_[edgeCommon] = -1.0;
} }
...@@ -109,11 +103,8 @@ void Foam::pairPatchAgglomeration::setEdgeWeights ...@@ -109,11 +103,8 @@ void Foam::pairPatchAgglomeration::setEdgeWeights
const bPatch& coarsePatch = patchLevels_[fineLevelIndex]; const bPatch& coarsePatch = patchLevels_[fineLevelIndex];
const labelList& fineToCoarse = restrictAddressing_[fineLevelIndex]; const labelList& fineToCoarse = restrictAddressing_[fineLevelIndex];
const label nCoarseI = max(fineToCoarse)+1; const label nCoarseI = max(fineToCoarse) + 1;
labelListList coarseToFine labelListList coarseToFine(invertOneToMany(nCoarseI, fineToCoarse));
(
invertOneToMany(nCoarseI, fineToCoarse)
);
HashSet<edge, Hash<edge> > fineFeaturedFaces(coarsePatch.nEdges()/10); HashSet<edge, Hash<edge> > fineFeaturedFaces(coarsePatch.nEdges()/10);
...@@ -138,7 +129,7 @@ void Foam::pairPatchAgglomeration::setEdgeWeights ...@@ -138,7 +129,7 @@ void Foam::pairPatchAgglomeration::setEdgeWeights
forAll(coarsePatch.edges(), i) forAll(coarsePatch.edges(), i)
{ {
if(coarsePatch.isInternalEdge(i)) if (coarsePatch.isInternalEdge(i))
{ {
scalar edgeLength = scalar edgeLength =
coarsePatch.edges()[i].mag(coarsePatch.localPoints()); coarsePatch.edges()[i].mag(coarsePatch.localPoints());
...@@ -148,7 +139,7 @@ void Foam::pairPatchAgglomeration::setEdgeWeights ...@@ -148,7 +139,7 @@ void Foam::pairPatchAgglomeration::setEdgeWeights
if (eFaces.size() == 2) if (eFaces.size() == 2)
{ {
const edge edgeCommon = edge(eFaces[0], eFaces[1]); const edge edgeCommon = edge(eFaces[0], eFaces[1]);
if(facePairWeight_.found(edgeCommon)) if (facePairWeight_.found(edgeCommon))
{ {
facePairWeight_[edgeCommon] += edgeLength; facePairWeight_[edgeCommon] += edgeLength;
} }
...@@ -220,11 +211,13 @@ Foam::pairPatchAgglomeration::pairPatchAgglomeration ...@@ -220,11 +211,13 @@ Foam::pairPatchAgglomeration::pairPatchAgglomeration
setBasedEdgeWeights(); setBasedEdgeWeights();
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::pairPatchAgglomeration::~pairPatchAgglomeration() Foam::pairPatchAgglomeration::~pairPatchAgglomeration()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::bPatch& Foam::pairPatchAgglomeration::patchLevel const Foam::bPatch& Foam::pairPatchAgglomeration::patchLevel
...@@ -259,8 +252,15 @@ bool Foam::pairPatchAgglomeration::agglomeratePatch ...@@ -259,8 +252,15 @@ bool Foam::pairPatchAgglomeration::agglomeratePatch
{ {
if (min(fineToCoarse) == -1) if (min(fineToCoarse) == -1)
{ {
FatalErrorIn("pairPatchAgglomeration::agglomeratePatch") FatalErrorIn
<< "min(fineToCoarse) == -1" << exit(FatalError); (
"pairPatchAgglomeration::agglomeratePatch"
"("
"const bPatch&, "
"const labelList&, "
"const label"
")"
) << "min(fineToCoarse) == -1" << exit(FatalError);
} }
if (fineToCoarse.size() != patch.size()) if (fineToCoarse.size() != patch.size())
...@@ -268,7 +268,11 @@ bool Foam::pairPatchAgglomeration::agglomeratePatch ...@@ -268,7 +268,11 @@ bool Foam::pairPatchAgglomeration::agglomeratePatch
FatalErrorIn FatalErrorIn
( (
"pairPatchAgglomeration::agglomeratePatch" "pairPatchAgglomeration::agglomeratePatch"
"(const label fineLevelIndex)" "("
"const bPatch&, "
"const labelList&, "
"const label"
")"
) << "restrict map does not correspond to fine level. " << endl ) << "restrict map does not correspond to fine level. " << endl
<< " Sizes: restrictMap: " << fineToCoarse.size() << " Sizes: restrictMap: " << fineToCoarse.size()
<< " nEqns: " << patch.size() << " nEqns: " << patch.size()
...@@ -279,10 +283,7 @@ bool Foam::pairPatchAgglomeration::agglomeratePatch ...@@ -279,10 +283,7 @@ bool Foam::pairPatchAgglomeration::agglomeratePatch
List<face> patchFaces(nCoarseI); List<face> patchFaces(nCoarseI);
// Patch faces per agglomeration // Patch faces per agglomeration
labelListList coarseToFine labelListList coarseToFine(invertOneToMany(nCoarseI, fineToCoarse));
(
invertOneToMany(nCoarseI, fineToCoarse)
);
for (label coarseI = 0; coarseI < nCoarseI; coarseI++) for (label coarseI = 0; coarseI < nCoarseI; coarseI++)
{ {
...@@ -371,7 +372,7 @@ void Foam::pairPatchAgglomeration:: agglomerate() ...@@ -371,7 +372,7 @@ void Foam::pairPatchAgglomeration:: agglomerate()
restrictAddressing_.set(nCreatedLevels, finalAgglomPtr); restrictAddressing_.set(nCreatedLevels, finalAgglomPtr);
mapBaseToTopAgglom(nCreatedLevels); mapBaseToTopAgglom(nCreatedLevels);
if(!continueAgglomerating(nCoarseCells)) if (!continueAgglomerating(nCoarseCells))
{ {
break; break;
} }
...@@ -407,7 +408,7 @@ Foam::tmp<Foam::labelField> Foam::pairPatchAgglomeration::agglomerateOneLevel ...@@ -407,7 +408,7 @@ Foam::tmp<Foam::labelField> Foam::pairPatchAgglomeration::agglomerateOneLevel
nCoarseCells = 0; nCoarseCells = 0;
forAll (faceFaces, facei) forAll(faceFaces, facei)
{ {
const labelList& fFaces = faceFaces[facei]; const labelList& fFaces = faceFaces[facei];
...@@ -425,8 +426,8 @@ Foam::tmp<Foam::labelField> Foam::pairPatchAgglomeration::agglomerateOneLevel ...@@ -425,8 +426,8 @@ Foam::tmp<Foam::labelField> Foam::pairPatchAgglomeration::agglomerateOneLevel
if if
( (
facePairWeight_[edgeCommon] > maxFaceWeight facePairWeight_[edgeCommon] > maxFaceWeight
&& coarseCellMap[faceNeig] < 0 && coarseCellMap[faceNeig] < 0
&& facePairWeight_[edgeCommon] != -1.0 && facePairWeight_[edgeCommon] != -1.0
) )
{ {
// Match found. Pick up all the necessary data // Match found. Pick up all the necessary data
...@@ -472,7 +473,8 @@ Foam::tmp<Foam::labelField> Foam::pairPatchAgglomeration::agglomerateOneLevel ...@@ -472,7 +473,8 @@ Foam::tmp<Foam::labelField> Foam::pairPatchAgglomeration::agglomerateOneLevel
coarseCellMap[facei] = coarseCellMap[clusterMatchFaceNo]; coarseCellMap[facei] = coarseCellMap[clusterMatchFaceNo];
} }
else else
{// if not create single-cell "clusters" for each {
// if not create single-cell "clusters" for each
coarseCellMap[facei] = nCoarseCells; coarseCellMap[facei] = nCoarseCells;
nCoarseCells ++; nCoarseCells ++;
} }
...@@ -499,6 +501,7 @@ Foam::tmp<Foam::labelField> Foam::pairPatchAgglomeration::agglomerateOneLevel ...@@ -499,6 +501,7 @@ Foam::tmp<Foam::labelField> Foam::pairPatchAgglomeration::agglomerateOneLevel
return tcoarseCellMap; return tcoarseCellMap;
} }
void Foam::pairPatchAgglomeration::combineLevels(const label curLevel) void Foam::pairPatchAgglomeration::combineLevels(const label curLevel)
{ {
label prevLevel = curLevel - 1; label prevLevel = curLevel - 1;
...@@ -522,4 +525,6 @@ void Foam::pairPatchAgglomeration::combineLevels(const label curLevel) ...@@ -522,4 +525,6 @@ void Foam::pairPatchAgglomeration::combineLevels(const label curLevel)
patchLevels_.set(prevLevel, patchLevels_.set(curLevel, NULL)); patchLevels_.set(prevLevel, patchLevels_.set(curLevel, NULL));
} }
// ************************************************************************* // // ************************************************************************* //
...@@ -148,13 +148,13 @@ public: ...@@ -148,13 +148,13 @@ public:
// Destructor // Destructor
~pairPatchAgglomeration(); ~pairPatchAgglomeration();
// Member Functions // Member Functions
//- Agglomerate patch //- Agglomerate patch
void agglomerate(); void agglomerate();
// Access // Access
...@@ -200,7 +200,6 @@ public: ...@@ -200,7 +200,6 @@ public:
const Field<Type>& cf, const Field<Type>& cf,
const label coarseLevelIndex const label coarseLevelIndex
) const; ) const;
}; };
......
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