Version of donorBasedOverlapFringe that compiles

Note: still not tested
This commit is contained in:
Vuko Vukcevic 2019-04-11 13:20:08 +02:00
parent deec392065
commit 805c942ac4
4 changed files with 32 additions and 24 deletions

View file

@ -4,6 +4,7 @@ oversetFringe/oversetFringe/oversetFringe.C
oversetFringe/oversetFringe/newOversetFringe.C oversetFringe/oversetFringe/newOversetFringe.C
oversetFringe/manualFringe/manualFringe.C oversetFringe/manualFringe/manualFringe.C
oversetFringe/faceCellsFringe/faceCellsFringe.C oversetFringe/faceCellsFringe/faceCellsFringe.C
oversetFringe/donorBasedLayeredOverlapFringe/donorBasedLayeredOverlapFringe.C
oversetFringe/overlapFringe/overlapFringe/overlapFringe.C oversetFringe/overlapFringe/overlapFringe/overlapFringe.C
oversetFringe/overlapFringe/layeredOverlapFringe/layeredOverlapFringe.C oversetFringe/overlapFringe/layeredOverlapFringe/layeredOverlapFringe.C
oversetFringe/overlapFringe/adaptiveOverlapFringe/adaptiveOverlapFringe.C oversetFringe/overlapFringe/adaptiveOverlapFringe/adaptiveOverlapFringe.C

View file

@ -3,11 +3,13 @@ EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \ -I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude -I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicMesh/dynamicFvMesh/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
-lmeshTools \ -lmeshTools \
-lsurfMesh \ -lsurfMesh \
-lsampling \ -lsampling \
-ldynamicMesh -ldynamicMesh \
-ldynamicFvMesh

View file

@ -24,10 +24,13 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "donorBasedLayeredOverlapFringe.H" #include "donorBasedLayeredOverlapFringe.H"
#include "oversetMesh.H"
#include "oversetRegion.H"
#include "faceCellsFringe.H" #include "faceCellsFringe.H"
#include "oversetRegion.H" #include "oversetRegion.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "syncTools.H" #include "syncTools.H"
#include "dynamicFvMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -46,7 +49,7 @@ namespace Foam
const Foam::debug::tolerancesSwitch const Foam::debug::tolerancesSwitch
Foam::donorBasedLayeredOverlapFringe::distTol_ Foam::donorBasedLayeredOverlapFringe::distTol_
( (
"donorBasedLayeredOverlapDistanceTolerance" "donorBasedLayeredOverlapDistanceTolerance",
0.0 0.0
); );
@ -97,7 +100,7 @@ void Foam::donorBasedLayeredOverlapFringe::calcAddressing() const
<< " with faceCells fringe as a connected region fringe." << " with faceCells fringe as a connected region fringe."
<< nl << nl
<< "Connected overset region " << region.name() << "Connected overset region " << region.name()
<< " has " << fringe.type() " fringe type. " << " has " << fringe.type() << " fringe type. "
<< nl << nl
<< "Proceed with care!" << "Proceed with care!"
<< endl; << endl;
@ -109,6 +112,7 @@ void Foam::donorBasedLayeredOverlapFringe::calcAddressing() const
} }
// Sets containing all acceptors and all holes for all connected regions // Sets containing all acceptors and all holes for all connected regions
const polyMesh& mesh = this->mesh();
labelHashSet allAcceptors(0.02*mesh.nCells()); labelHashSet allAcceptors(0.02*mesh.nCells());
labelHashSet allFringeHoles(0.02*mesh.nCells()); labelHashSet allFringeHoles(0.02*mesh.nCells());
@ -175,9 +179,9 @@ void Foam::donorBasedLayeredOverlapFringe::calcAddressing() const
} }
// Loop through extended donor cells // Loop through extended donor cells
donorAcceptor::DynamicLabelList& extDonors = const donorAcceptor::DynamicLabelList& extDonors =
daPair.extendedDonorCells(); daPair.extendedDonorCells();
donorAcceptor::DynamicPointList& extDonorPoints = const donorAcceptor::DynamicPointList& extDonorPoints =
daPair.extendedDonorPoints(); daPair.extendedDonorPoints();
forAll (extDonors, i) forAll (extDonors, i)
@ -210,7 +214,8 @@ void Foam::donorBasedLayeredOverlapFringe::calcAddressing() const
// User did not specify centre points and the centre point holds // User did not specify centre points and the centre point holds
// the sum of all the points. Reduce the data // the sum of all the points. Reduce the data
reduce(centrePoint, sumOp<vector>()); reduce(centrePoint, sumOp<vector>());
nUniqueDonors = returnReduce(donors.size(), sumOp<label>()); const label nUniqueDonors =
returnReduce(donors.size(), sumOp<label>());
// Calculate the final centre point by finding the arithmetic mean // Calculate the final centre point by finding the arithmetic mean
centrePoint /= nUniqueDonors; centrePoint /= nUniqueDonors;
@ -221,7 +226,6 @@ void Foam::donorBasedLayeredOverlapFringe::calcAddressing() const
labelHashSet acceptors(donors.size()); // Reasonable size estimate labelHashSet acceptors(donors.size()); // Reasonable size estimate
// Get necessary mesh data (from polyMesh/primitiveMesh) // Get necessary mesh data (from polyMesh/primitiveMesh)
const polyMesh& mesh = this->mesh();
const vectorField& cc = mesh.cellCentres(); const vectorField& cc = mesh.cellCentres();
const vectorField& fc = mesh.faceCentres(); const vectorField& fc = mesh.faceCentres();
const cellList& meshCells = mesh.cells(); const cellList& meshCells = mesh.cells();
@ -247,7 +251,7 @@ void Foam::donorBasedLayeredOverlapFringe::calcAddressing() const
{ {
// Get the cell index and the cell // Get the cell index and the cell
const label& cellI = iter.key(); const label& cellI = iter.key();
const label& cell = meshCells[cellI]; const cell& cFaces = meshCells[cellI];
// Get cell centre of this donor and calculate distance to // Get cell centre of this donor and calculate distance to
// centre point // centre point
@ -382,7 +386,7 @@ void Foam::donorBasedLayeredOverlapFringe::calcAddressing() const
{ {
// Get the cell index and the cell // Get the cell index and the cell
const label& cellI = iter.key(); const label& cellI = iter.key();
const label& cell = meshCells[cellI]; const cell& cFaces = meshCells[cellI];
// Note: there's no need to check for the distance here // Note: there's no need to check for the distance here
// because there's always at least one "buffer" layer // because there's always at least one "buffer" layer
@ -496,7 +500,7 @@ void Foam::donorBasedLayeredOverlapFringe::calcAddressing() const
// and holes, which will be deleted when asked for again from the // and holes, which will be deleted when asked for again from the
// iterative procedure (see candidateAcceptors() and fringeHoles()) // iterative procedure (see candidateAcceptors() and fringeHoles())
acceptorsPtr_ = new labelList(0); acceptorsPtr_ = new labelList(0);
holesPtr_ = new labelList(0); fringeHolesPtr_ = new labelList(0);
} }
} }
@ -523,7 +527,11 @@ Foam::donorBasedLayeredOverlapFringe::donorBasedLayeredOverlapFringe
connectedRegionIDs_(), connectedRegionIDs_(),
regionCentrePoints_ regionCentrePoints_
( (
dict.lookupOrDefault<pointList>("regionCentrePoints", pointList(0)) dict.lookupOrDefault<List<point> >
(
"regionCentrePoints",
List<point>(0)
)
), ),
nLayers_(readLabel(dict.lookup("nLayers"))), nLayers_(readLabel(dict.lookup("nLayers"))),
fringeHolesPtr_(nullptr), fringeHolesPtr_(nullptr),
@ -543,7 +551,7 @@ Foam::donorBasedLayeredOverlapFringe::donorBasedLayeredOverlapFringe
" const dictionary& dict\n" " const dictionary& dict\n"
")", ")",
dict dict
) << "Invalid number of layers specified, nLayers = " nLayers_ ) << "Invalid number of layers specified, nLayers = " << nLayers_
<< nl << nl
<< "The number should be greater than 0." << "The number should be greater than 0."
<< abort(FatalError); << abort(FatalError);
@ -573,7 +581,7 @@ Foam::donorBasedLayeredOverlapFringe::donorBasedLayeredOverlapFringe
const word& crName = connectedRegionNames[crI]; const word& crName = connectedRegionNames[crI];
// Find this region in the list of all regions // Find this region in the list of all regions
const label regionID = findIndex(allRegions, crName); const label regionID = findIndex(allRegionNames, crName);
if (regionID == -1) if (regionID == -1)
{ {
@ -732,7 +740,7 @@ bool Foam::donorBasedLayeredOverlapFringe::updateIteration
// Set the flag to true and return // Set the flag to true and return
updateSuitableOverlapFlag(true); updateSuitableOverlapFlag(true);
return foundSuitablaOverlap(); return foundSuitableOverlap();
} }
@ -802,17 +810,15 @@ Foam::donorAcceptorList& Foam::donorBasedLayeredOverlapFringe::finalDonorAccepto
void Foam::donorBasedLayeredOverlapFringe::update() const void Foam::donorBasedLayeredOverlapFringe::update() const
{
if (updateFringe_)
{ {
Info<< "donorBasedLayeredOverlapFringe::update() const" << endl; Info<< "donorBasedLayeredOverlapFringe::update() const" << endl;
// Clear out // Clear out
clearAddressing(); clearAddressing();
}
// Set flag to false and clear final donor/acceptors only // Set flag to false and clear final donor/acceptors only
deleteDemandDrivenData(finalDonorAcceptorsPtr_); deleteDemandDrivenData(finalDonorAcceptorsPtr_);
updateSuitableOverlapFlag(false);
} }

View file

@ -49,7 +49,6 @@ SourceFiles
#define donorBasedLayeredOverlapFringe_H #define donorBasedLayeredOverlapFringe_H
#include "oversetFringe.H" #include "oversetFringe.H"
#include "pointList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -68,13 +67,13 @@ class donorBasedLayeredOverlapFringe
//- Regions IDs from which the donors will be collected as a starting //- Regions IDs from which the donors will be collected as a starting
// point // point
labelList connectedRegionsIDs_; labelList connectedRegionIDs_;
//- Optional list of points representing a rough estimate of the centre //- Optional list of points representing a rough estimate of the centre
// for each underlying connected region. If these are not provided, the // for each underlying connected region. If these are not provided, the
// centre is calculated as the centre of all donors for a given // centre is calculated as the centre of all donors for a given
// connected region // connected region
pointList regionCentrePoints_; List<point> regionCentrePoints_;
//- How many layers to move away from connected region donors to define //- How many layers to move away from connected region donors to define
// acceptor (and holes) // acceptor (and holes)