Adding inverse addressing to record which referred cells are in range

of the referred cells.  To be used by wall interactions.
This commit is contained in:
graham
2009-09-18 19:34:49 +01:00
parent c29354a94d
commit 732fa271ba
4 changed files with 146 additions and 5 deletions

View File

@ -26,6 +26,7 @@ License
#include "DirectInteractionList.H"
#include "InteractionLists.H"
#include "ReferredCellList.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -397,7 +398,8 @@ Foam::DirectInteractionList<ParticleType>::DirectInteractionList
:
labelListList(il.mesh().nCells()),
il_(il),
wallFaces_(il.mesh().nCells())
wallFaces_(il.mesh().nCells()),
referredCellsForInteraction_(il.mesh().nCells())
{
if ((*this).size() > 1)
{
@ -423,7 +425,8 @@ Foam::DirectInteractionList<ParticleType>::DirectInteractionList
:
labelListList(il.mesh().nCells()),
il_(il),
wallFaces_(il.mesh().nCells())
wallFaces_(il.mesh().nCells()),
referredCellsForInteraction_(il.mesh().nCells())
{
Info<< " Read DirectInteractionList from disk not implemented" << endl;
}
@ -436,4 +439,111 @@ Foam::DirectInteractionList<ParticleType>::~DirectInteractionList()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParticleType>
void Foam::DirectInteractionList<ParticleType>::buildInverseAddressing()
{
const ReferredCellList<ParticleType>& ril(il_.ril());
// Temporary Dynamic lists for accumulation
List<DynamicList<label> > referredCellsForInteraction
(
referredCellsForInteraction_.size()
);
// Loop over all referred cells
forAll(ril, refCellI)
{
const ReferredCell<ParticleType>& refCell = ril[refCellI];
const labelList& realCells = refCell.realCellsForInteraction();
// Loop over all real cells in that the referred cell is to
// supply interactions to and record the index of this
// referred cell in the cells entry in
// referredCellsForInteraction_
forAll(realCells, realCellI)
{
referredCellsForInteraction[realCells[realCellI]].append(refCellI);
}
}
forAll(referredCellsForInteraction_, cellI)
{
referredCellsForInteraction_[cellI].transfer
(
referredCellsForInteraction[cellI]
);
}
}
template<class ParticleType>
void Foam::DirectInteractionList<ParticleType>::
writeReferredCellsForInteraction() const
{
const ReferredCellList<ParticleType>& ril(il_.ril());
forAll(*this, cellI)
{
const labelList& refCells = referredCellsForInteraction_[cellI];
if (!refCells.size())
{
continue;
}
fileName fName =
il_.mesh().time().path()
/"referredCellsForInteraction_" + name(cellI) + ".obj";
Info<< " Writing " << fName.name() << endl;
OFstream referredCellsFile(fName);
label vertexOffset = 1;
forAll(refCells, refCellForInteractionI)
{
const ReferredCell<ParticleType>& refCell =
ril[refCells[refCellForInteractionI]];
const vectorList& refCellPts = refCell.vertexPositions();
const faceList& refCellFaces = refCell.faces();
forAll(refCellPts, ptI)
{
referredCellsFile
<< "v "
<< refCellPts[ptI].x() << " "
<< refCellPts[ptI].y() << " "
<< refCellPts[ptI].z()
<< nl;
}
forAll(refCellFaces, faceI)
{
referredCellsFile<< "f";
forAll(refCellFaces[faceI], fPtI)
{
referredCellsFile
<< " "
<< refCellFaces[faceI][fPtI] + vertexOffset;
}
referredCellsFile<< nl;
}
vertexOffset += refCellPts.size();
}
referredCellsFile.flush();
}
}
// ************************************************************************* //

View File

@ -26,6 +26,8 @@ Class
Foam::DirectInteractionList
Description
Data stored that specifies what a "real" cell (one on the current
processor) interacts with.
SourceFiles
DirectInteractionListI.H
@ -66,6 +68,10 @@ class DirectInteractionList
// of each cell
labelListList wallFaces_;
//- Data specifying which referred cells are in range of each
// cell, Inverse data of ReferredCell's realCellsForInteraction
labelListList referredCellsForInteraction_;
// Private Member Functions
@ -108,11 +114,26 @@ public:
// Member Functions
//- Build referredCellsForInteraction by interrogating the
//- ReferredCellList of the InteractionLists object that owns
//- this object.
void buildInverseAddressing();
// Access
inline const labelListList& wallFaces() const;
inline const labelListList& wallFaces() const;
inline const labelListList& referredCellsForInteraction() const;
inline const InteractionLists<ParticleType>& il() const;
// Write
//- Write the referred cells in range of each real cell
void writeReferredCellsForInteraction() const;
inline const InteractionLists<ParticleType>& il() const;
};

View File

@ -34,6 +34,14 @@ Foam::DirectInteractionList<ParticleType>::wallFaces() const
}
template<class ParticleType>
inline const Foam::labelListList&
Foam::DirectInteractionList<ParticleType>::referredCellsForInteraction() const
{
return referredCellsForInteraction_;
}
template<class ParticleType>
inline const Foam::InteractionLists<ParticleType>&
Foam::DirectInteractionList<ParticleType>::il() const

View File

@ -46,7 +46,9 @@ Foam::InteractionLists<ParticleType>::InteractionLists
maxDistanceSqr_(maxDistanceSqr),
dil_(*this, pointPointListBuild),
ril_(*this, pointPointListBuild)
{}
{
dil_.buildInverseAddressing();
}
template<class ParticleType>