Skip to content
Snippets Groups Projects
Commit 4fee00d6 authored by Andrew Heather's avatar Andrew Heather
Browse files

corrected patchIds

parent d0bb30e7
Branches
Tags
No related merge requests found
......@@ -27,6 +27,26 @@ License
#include "PatchPostProcessing.H"
#include "IOPtrList.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template <class CloudType>
Foam::label Foam::PatchPostProcessing<CloudType>::applyToPatch
(
const label globalPatchI
) const
{
forAll(patchIds_, patchI)
{
if (patchIds_[patchI] == globalPatchI)
{
return patchI;
}
}
return -1;
}
// * * * * * * * * * * * * * protected Member Functions * * * * * * * * * * //
template<class CloudType>
......@@ -80,9 +100,8 @@ Foam::PatchPostProcessing<CloudType>::PatchPostProcessing
mesh_(owner.mesh()),
patchNames_(this->coeffDict().lookup("patches")),
patchData_(patchNames_.size()),
globalToLocalPatchIds_(patchNames_.size())
patchIds_(patchNames_.size())
{
labelList localToGlobal(patchNames_.size());
forAll(patchNames_, patchI)
{
label id = mesh_.boundaryMesh().findPatchID(patchNames_[patchI]);
......@@ -99,12 +118,7 @@ Foam::PatchPostProcessing<CloudType>::PatchPostProcessing
<< "Available patches are: " << mesh_.boundaryMesh().names() << nl
<< exit(FatalError);
}
localToGlobal[patchI] = id;
}
forAll(localToGlobal, patchI)
{
globalToLocalPatchIds_[localToGlobal[patchI]] = patchI;
patchIds_[patchI] = id;
}
}
......@@ -132,8 +146,8 @@ void Foam::PatchPostProcessing<CloudType>::postPatch
const label patchI
)
{
label localPatchI = globalToLocalPatchIds_[patchI];
if (patchData_[localPatchI].size() < maxStoredParcels_)
label localPatchI = applyToPatch(patchI);
if (localPatchI >= 0 && patchData_[localPatchI].size() < maxStoredParcels_)
{
patchData_[localPatchI].append(p.clone());
}
......
......@@ -44,7 +44,7 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class PatchPostProcessing Declaration
Class PatchPostProcessing Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
......@@ -59,7 +59,7 @@ class PatchPostProcessing
//- Reference to the mesh
const polyMesh& mesh_;
//- Maximum number of parcels to store per patch
//- Maximum number of parcels to store
label maxStoredParcels_;
//- List of patch names
......@@ -68,8 +68,14 @@ class PatchPostProcessing
//- List of parcel data per patch
List<DynamicList<autoPtr<parcelType> > > patchData_;
//- Mapping from global to local patch ids
labelList globalToLocalPatchIds_;
//- Mapping from local to global patch ids
labelList patchIds_;
// Private member functions
//- Returns local patchI if patch is in patchIds_ list
label applyToPatch(const label globalPatchI) const;
protected:
......@@ -109,8 +115,8 @@ public:
//- Return const access to the list of patch names
inline const wordList& patchNames() const;
//- Return const mapping from global to local patch ids
inline const labelList& globalToLocalPatchIds() const;
//- Return const mapping from local to global patch ids
inline const labelList& patchIds() const;
// Evaluation
......
......@@ -47,9 +47,9 @@ const Foam::wordList& Foam::PatchPostProcessing<CloudType>::patchNames() const
template<class CloudType>
const Foam::labelList&
Foam::PatchPostProcessing<CloudType>::globalToLocalPatchIds() const
Foam::PatchPostProcessing<CloudType>::patchIds() const
{
return globalToLocalPatchIds_;
return patchIds_;
}
......
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