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

View File

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

View File

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