adding limit to number of stored parcels

This commit is contained in:
andy
2009-06-09 14:00:09 +01:00
parent 0903bf0b3b
commit 304d3fe442
3 changed files with 40 additions and 11 deletions

View File

@ -62,7 +62,7 @@ void Foam::PatchPostProcessing<CloudType>::write()
mesh_.time().writeCompression()
);
patchData_[patchI].clear();
patchData_[patchI].clearStorage();
}
}
@ -79,8 +79,10 @@ Foam::PatchPostProcessing<CloudType>::PatchPostProcessing
PostProcessingModel<CloudType>(dict, owner, typeName),
mesh_(owner.mesh()),
patchNames_(this->coeffDict().lookup("patches")),
patchData_(patchNames_.size())
patchData_(patchNames_.size()),
globalToLocalPatchIds_(patchNames_.size())
{
labelList localToGlobal(patchNames_.size());
forAll(patchNames_, patchI)
{
label id = mesh_.boundaryMesh().findPatchID(patchNames_[patchI]);
@ -97,6 +99,12 @@ Foam::PatchPostProcessing<CloudType>::PatchPostProcessing
<< "Available patches are: " << mesh_.boundaryMesh().names() << nl
<< exit(FatalError);
}
localToGlobal[patchI] = id;
}
forAll(localToGlobal, patchI)
{
globalToLocalPatchIds_[localToGlobal[patchI]] = patchI;
}
}
@ -124,14 +132,10 @@ void Foam::PatchPostProcessing<CloudType>::postPatch
const label patchI
)
{
const word& patchName = mesh_.boundaryMesh()[patchI].name();
forAll(patchNames_, i)
label localPatchI = globalToLocalPatchIds_[patchI];
if (patchData_[localPatchI].size() < maxStoredParcels_)
{
if (patchNames_[i] == patchName)
{
patchData_[i].append(p.clone());
break;
}
patchData_[localPatchI].append(p.clone());
}
}

View File

@ -59,12 +59,18 @@ class PatchPostProcessing
//- Reference to the mesh
const polyMesh& mesh_;
//- Maximum number of parcels to store per patch
label maxStoredParcels_;
//- List of patch names
wordList patchNames_;
//- List of parcel data per patch
List<DynamicList<autoPtr<parcelType> > > patchData_;
//- Mapping from global to local patch ids
labelList globalToLocalPatchIds_;
protected:
@ -97,10 +103,15 @@ public:
//- Return const access to the mesh
inline const polyMesh& mesh() const;
//- Return maximum number of parcels to store per patch
inline label maxStoredParcels() const;
//- 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;
// Evaluation

View File

@ -32,11 +32,25 @@ const Foam::polyMesh& Foam::PatchPostProcessing<CloudType>::mesh() const
template<class CloudType>
const Foam::wordList&
Foam::PatchPostProcessing<CloudType>::patchNames() const
Foam::label Foam::PatchPostProcessing<CloudType>::maxStoredParcels() const
{
return maxStoredParcels_;
}
template<class CloudType>
const Foam::wordList& Foam::PatchPostProcessing<CloudType>::patchNames() const
{
return patchNames_;
}
template<class CloudType>
const Foam::labelList&
Foam::PatchPostProcessing<CloudType>::globalToLocalPatchIds() const
{
return globalToLocalPatchIds_;
}
// ************************************************************************* //