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

adding limit to number of stored parcels

parent 0903bf0b
Branches
Tags
No related merge requests found
...@@ -62,7 +62,7 @@ void Foam::PatchPostProcessing<CloudType>::write() ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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;
}
} }
} }
......
...@@ -59,12 +59,18 @@ class PatchPostProcessing ...@@ -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: ...@@ -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
......
...@@ -32,11 +32,25 @@ const Foam::polyMesh& Foam::PatchPostProcessing<CloudType>::mesh() const ...@@ -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_;
}
// ************************************************************************* // // ************************************************************************* //
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