diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C index 2058dde5ea1a8ef18a6813b41a3c97f4c2bcf132..e4f7325be9f406ef3d38a8861a309407b0ee1b19 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C @@ -31,6 +31,7 @@ License #include "DispersionModel.H" #include "DragModel.H" #include "InjectionModel.H" +#include "PostProcessingModel.H" #include "WallInteractionModel.H" @@ -131,6 +132,14 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud *this ) ), + postProcessingModel_ + ( + PostProcessingModel<KinematicCloud<ParcelType> >::New + ( + this->particleProperties_, + *this + ) + ), wallInteractionModel_ ( WallInteractionModel<KinematicCloud<ParcelType> >::New @@ -227,6 +236,8 @@ void Foam::KinematicCloud<ParcelType>::evolve() } Cloud<ParcelType>::move(td); + + this->postProcessing().post(); } diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H index 0a27aede96010b26dba378820285e3b6c7e746ff..94d55a5c61a3712d94800e8ebd68c913a61fc674 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H @@ -71,6 +71,9 @@ class DragModel; template<class CloudType> class InjectionModel; +template<class CloudType> +class PostProcessingModel; + template<class CloudType> class WallInteractionModel; @@ -153,6 +156,10 @@ class KinematicCloud autoPtr<InjectionModel<KinematicCloud<ParcelType> > > injectionModel_; + //- Post-processing model + autoPtr<PostProcessingModel<KinematicCloud<ParcelType> > > + postProcessingModel_; + //- Wall interaction model autoPtr<WallInteractionModel<KinematicCloud<ParcelType> > > wallInteractionModel_; @@ -295,6 +302,10 @@ public: inline InjectionModel<KinematicCloud<ParcelType> >& injection(); + //- Return reference to post-processing model + inline PostProcessingModel<KinematicCloud<ParcelType> >& + postProcessing(); + //- Return reference to wall interaction model inline const WallInteractionModel<KinematicCloud<ParcelType> >& wallInteraction() const; diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H index b02b0f0d8f4ac3d5f9d716186981385f388949cb..4746efd73554663fed0a87fa3233f1f229702b26 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H @@ -166,6 +166,14 @@ Foam::KinematicCloud<ParcelType>::injection() } +template<class ParcelType> +inline Foam::PostProcessingModel<Foam::KinematicCloud<ParcelType> >& +Foam::KinematicCloud<ParcelType>::postProcessing() +{ + return postProcessingModel_(); +} + + template<class ParcelType> inline const Foam::WallInteractionModel<Foam::KinematicCloud<ParcelType> >& Foam::KinematicCloud<ParcelType>::wallInteraction() const diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C index bce296229cf9e4c53fc2ba8066841d02a82fa88e..d9a0cb4eacfffbbe11a5b24276d3d7ea4efc9466 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C @@ -215,6 +215,8 @@ void Foam::ReactingCloud<ParcelType>::evolve() } Cloud<ParcelType>::move(td); + + this->postProcessing().post(); } diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C index 4ffc5306149f0f3b0294d67d475264b4e7ed49fe..126054dd69d4281e5eb95c0564176fe94a7ab3da 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C @@ -190,6 +190,8 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::evolve() } Cloud<ParcelType>::move(td); + + this->postProcessing().post(); } diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C index 91d7a2fb7f8423eb1dc6b5da92c499d1970fd6ba..abf956a859467856e5ee6f29839f68787ab010bc 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C @@ -212,6 +212,8 @@ void Foam::ThermoCloud<ParcelType>::evolve() } Cloud<ParcelType>::move(td); + + this->postProcessing().post(); } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/NoPostProcessing/NoPostProcessing.C b/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/NoPostProcessing/NoPostProcessing.C new file mode 100644 index 0000000000000000000000000000000000000000..dbb088327c74c1ccaec9b8481ecf55e18119869e --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/NoPostProcessing/NoPostProcessing.C @@ -0,0 +1,78 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "NoPostProcessing.H" + +// * * * * * * * * * * * * * protected Member Functions * * * * * * * * * * // + +template<class CloudType> +void Foam::NoPostProcessing<CloudType>::write() +{ +// do nothing +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::NoPostProcessing<CloudType>::NoPostProcessing +( + const dictionary&, + CloudType& owner +) +: + PostProcessingModel<CloudType>(owner) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::NoPostProcessing<CloudType>::~NoPostProcessing() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class CloudType> +bool Foam::NoPostProcessing<CloudType>::active() const +{ + return false; +} + + +template<class CloudType> +void Foam::NoPostProcessing<CloudType>::postPatch +( + const typename CloudType::parcelType&, + const label +) +{ +// do nothing +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/NoPostProcessing/NoPostProcessing.H b/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/NoPostProcessing/NoPostProcessing.H new file mode 100644 index 0000000000000000000000000000000000000000..4acc81252c9b702718b8e74a99ce6ad4b53833ee --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/NoPostProcessing/NoPostProcessing.H @@ -0,0 +1,109 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::NoPostProcessing + +Description + Place holder for 'none' option + +SourceFiles + NoPostProcessing.C + +\*---------------------------------------------------------------------------*/ + +#ifndef NoPostProcessing_H +#define NoPostProcessing_H + +#include "PostProcessingModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class NoPostProcessing Declaration +\*---------------------------------------------------------------------------*/ + +template<class CloudType> +class NoPostProcessing +: + public PostProcessingModel<CloudType> +{ +protected: + + // Protected member functions + + //- Write post-processing info + void write(); + + +public: + + //- Runtime type information + TypeName("none"); + + + // Constructors + + //- Construct from components + NoPostProcessing(const dictionary&, CloudType&); + + + //- Destructor + virtual ~NoPostProcessing(); + + + // Member Functions + + // Evaluation + + //- Flag to indicate whether model activates post-processing model + bool active() const; + + //- Gather post-processing info on patch + void postPatch + ( + const typename CloudType::parcelType& p, + const label patchI + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "NoPostProcessing.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/PostProcessingModel/NewPostProcessingModel.C b/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/PostProcessingModel/NewPostProcessingModel.C new file mode 100644 index 0000000000000000000000000000000000000000..587d982c13692b45189164e00e071f6fe79e6f71 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/PostProcessingModel/NewPostProcessingModel.C @@ -0,0 +1,66 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "PostProcessingModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::autoPtr<Foam::PostProcessingModel<CloudType> > +Foam::PostProcessingModel<CloudType>::New +( + const dictionary& dict, + CloudType& owner +) +{ + word PostProcessingModelType(dict.lookup("PostProcessingModel")); + + Info<< "Selecting PostProcessingModel " << PostProcessingModelType << endl; + + typename dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(PostProcessingModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "PostProcessingModel<CloudType>::New" + "(" + "const dictionary&, " + "CloudType&" + ")" + ) << "Unknown PostProcessingModelType type " + << PostProcessingModelType + << ", constructor not in hash table" << nl << nl + << " Valid PostProcessingModel types are:" << nl + << dictionaryConstructorTablePtr_->toc() << exit(FatalError); + } + + return autoPtr<PostProcessingModel<CloudType> >(cstrIter()(dict, owner)); +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/PostProcessingModel/PostProcessingModel.C b/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/PostProcessingModel/PostProcessingModel.C new file mode 100644 index 0000000000000000000000000000000000000000..2bef3a450dafcbe85971b92e3bb16f73b5f35f37 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/PostProcessingModel/PostProcessingModel.C @@ -0,0 +1,77 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "PostProcessingModel.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::PostProcessingModel<CloudType>::PostProcessingModel(CloudType& owner) +: + dict_(dictionary::null), + owner_(owner), + coeffDict_(dictionary::null) +{} + + +template<class CloudType> +Foam::PostProcessingModel<CloudType>::PostProcessingModel +( + const dictionary& dict, + CloudType& owner, + const word& type +) +: + dict_(dict), + owner_(owner), + coeffDict_(dict.subDict(type + "Coeffs")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::PostProcessingModel<CloudType>::~PostProcessingModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class CloudType> +void Foam::PostProcessingModel<CloudType>::post() +{ + if (owner_.time().outputTime()) + { + this->write(); + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "NewPostProcessingModel.C" + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/PostProcessingModel/PostProcessingModel.H b/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/PostProcessingModel/PostProcessingModel.H new file mode 100644 index 0000000000000000000000000000000000000000..c450ed07c40fd2c584604c259491752f1e1c167e --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/PostProcessingModel/PostProcessingModel.H @@ -0,0 +1,195 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::PostProcessingModel + +Description + Templated post-processing model class + +SourceFiles + PostProcessingModel.C + NewPostProcessingModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef PostProcessingModel_H +#define PostProcessingModel_H + +#include "IOdictionary.H" +#include "autoPtr.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class PostProcessingModel Declaration +\*---------------------------------------------------------------------------*/ + +template<class CloudType> +class PostProcessingModel +{ + // Private data + + //- The cloud dictionary + const dictionary& dict_; + + //- Reference to the owner cloud class + CloudType& owner_; + + //- The coefficients dictionary + const dictionary coeffDict_; + + +protected: + + // Protected member functions + + //- Write post-processing info + virtual void write() = 0; + + +public: + + //- Runtime type information + TypeName("PostProcessingModel"); + + //- Declare runtime constructor selection table + declareRunTimeSelectionTable + ( + autoPtr, + PostProcessingModel, + dictionary, + ( + const dictionary& dict, + CloudType& owner + ), + (dict, owner) + ); + + + // Constructors + + //- Construct null from owner + PostProcessingModel(CloudType& owner); + + //- Construct from dictionary + PostProcessingModel + ( + const dictionary& dict, + CloudType& owner, + const word& type + ); + + + //- Destructor + virtual ~PostProcessingModel(); + + + //- Selector + static autoPtr<PostProcessingModel<CloudType> > New + ( + const dictionary& dict, + CloudType& owner + ); + + + // Member Functions + + // Access + + //- Return the owner cloud dictionary + inline const dictionary& dict() const; + + //- Return const access the owner cloud object + inline const CloudType& owner() const; + + //- Return non-const access the owner cloud object for manipulation + inline CloudType& owner(); + + //- Return the coefficients dictionary + inline const dictionary& coeffDict() const; + + + // Evaluation + + //- Flag to indicate whether model activates post-processing model + virtual bool active() const = 0; + + //- Main post-processing function + void post(); + + //- Gather post-processing info on patch + virtual void postPatch + ( + const typename CloudType::parcelType& p, + const label patchI + ) = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makePostProcessingModel(CloudType) \ + \ + defineNamedTemplateTypeNameAndDebug(PostProcessingModel<CloudType>, 0); \ + \ + defineTemplateRunTimeSelectionTable \ + ( \ + PostProcessingModel<CloudType>, \ + dictionary \ + ); + + +#define makePostProcessingModelType(SS, CloudType, ParcelType) \ + \ + defineNamedTemplateTypeNameAndDebug(SS<CloudType<ParcelType> >, 0); \ + \ + PostProcessingModel<CloudType<ParcelType> >:: \ + adddictionaryConstructorToTable<SS<CloudType<ParcelType> > > \ + add##SS##CloudType##ParcelType##ConstructorToTable_; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "PostProcessingModelI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "PostProcessingModel.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/PostProcessingModel/PostProcessingModelI.H b/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/PostProcessingModel/PostProcessingModelI.H new file mode 100644 index 0000000000000000000000000000000000000000..f863c575a9a9eaaac900abb58df06e3a0eaa4860 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/PostProcessingModel/PostProcessingModelI.H @@ -0,0 +1,55 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +template<class CloudType> +const Foam::dictionary& Foam::PostProcessingModel<CloudType>::dict() const +{ + return dict_; +} + + +template<class CloudType> +const CloudType& Foam::PostProcessingModel<CloudType>::owner() const +{ + return owner_; +} + + +template<class CloudType> +CloudType& Foam::PostProcessingModel<CloudType>::owner() +{ + return owner_; +} + + +template<class CloudType> +const Foam::dictionary& Foam::PostProcessingModel<CloudType>::coeffDict() const +{ + return coeffDict_; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/StandardPostProcessing/StandardPostProcessing.C b/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/StandardPostProcessing/StandardPostProcessing.C new file mode 100644 index 0000000000000000000000000000000000000000..c3e2a80f3e455af335f555bee30b1f23562e547c --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/StandardPostProcessing/StandardPostProcessing.C @@ -0,0 +1,139 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "StandardPostProcessing.H" +#include "IOPtrList.H" + +// * * * * * * * * * * * * * protected Member Functions * * * * * * * * * * // + +template<class CloudType> +void Foam::StandardPostProcessing<CloudType>::write() +{ + forAll(patchData_, patchI) + { + IOPtrList<parcelType> postObject + ( + IOobject + ( + patchNames_[patchI] + ".post", + this->owner().time().timeName(), + "postProcessing", + this->owner(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + patchData_[patchI].size() + ); + + forAll(postObject, ptrI) + { + postObject.set(ptrI, patchData_[patchI][ptrI].ptr()); + } + + postObject.note() = parcelType::propHeader; + + postObject.writeObject + ( + IOstream::ASCII, + IOstream::currentVersion, + mesh_.time().writeCompression() + ); + + patchData_[patchI].clear(); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::StandardPostProcessing<CloudType>::StandardPostProcessing +( + const dictionary& dict, + CloudType& owner +) +: + PostProcessingModel<CloudType>(dict, owner, typeName), + mesh_(owner.mesh()), + patchNames_(this->coeffDict().lookup("patches")), + patchData_(patchNames_.size()) +{ + forAll(patchNames_, patchI) + { + label id = mesh_.boundaryMesh().findPatchID(patchNames_[patchI]); + if (id < 0) + { + FatalErrorIn + ( + "StandardPostProcessing<CloudType>::StandardPostProcessing" + "(" + "const dictionary&, " + "CloudType& owner" + ")" + )<< "Requested patch " << patchNames_[patchI] << " not found" << nl + << "Available patches are: " << mesh_.boundaryMesh().names() << nl + << exit(FatalError); + } + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::StandardPostProcessing<CloudType>::~StandardPostProcessing() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class CloudType> +bool Foam::StandardPostProcessing<CloudType>::active() const +{ + return true; +} + + +template<class CloudType> +void Foam::StandardPostProcessing<CloudType>::postPatch +( + const parcelType& p, + const label patchI +) +{ + const word& patchName = mesh_.boundaryMesh()[patchI].name(); + forAll(patchNames_, i) + { + if (patchNames_[i] == patchName) + { + patchData_[i].append(p.clone()); + break; + } + } +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/StandardPostProcessing/StandardPostProcessing.H b/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/StandardPostProcessing/StandardPostProcessing.H new file mode 100644 index 0000000000000000000000000000000000000000..deb17b7ef65c209246f60787bca59a7d08401582 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/StandardPostProcessing/StandardPostProcessing.H @@ -0,0 +1,137 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::StandardPostProcessing + +Description + Standard post-processing + +SourceFiles + StandardPostProcessing.C + +\*---------------------------------------------------------------------------*/ + +#ifndef StandardPostProcessing_H +#define StandardPostProcessing_H + +#include "PostProcessingModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class StandardPostProcessing Declaration +\*---------------------------------------------------------------------------*/ + +template<class CloudType> +class StandardPostProcessing +: + public PostProcessingModel<CloudType> +{ + // Private data + + typedef typename CloudType::parcelType parcelType; + + //- Reference to the mesh + const polyMesh& mesh_; + + //- List of patch names + wordList patchNames_; + + //- List of parcel data per patch + List<DynamicList<autoPtr<parcelType> > > patchData_; + + +protected: + + // Protected member functions + + //- Write post-processing info + void write(); + + +public: + + //- Runtime type information + TypeName("StandardPostProcessing"); + + + // Constructors + + //- Construct from dictionary + StandardPostProcessing(const dictionary& dict, CloudType& owner); + + + //- Destructor + virtual ~StandardPostProcessing(); + + + // Member Functions + + // Access + + //- Return const access to the mesh + inline const polyMesh& mesh() const; + + + //- Return const access to the list of patch names + inline const wordList& patchNames() const; + + + // Evaluation + + //- Flag to indicate whether model activates post-processing model + bool active() const; + + //- Gather post-processing info on patch + void postPatch + ( + const parcelType& p, + const label patchI + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "StandardPostProcessingI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "StandardPostProcessing.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/StandardPostProcessing/StandardPostProcessingI.H b/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/StandardPostProcessing/StandardPostProcessingI.H new file mode 100644 index 0000000000000000000000000000000000000000..aabf85999d8237b037b60e6b16da161d0fa0a0c0 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/PostProcessingModel/StandardPostProcessing/StandardPostProcessingI.H @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +template<class CloudType> +const Foam::polyMesh& Foam::StandardPostProcessing<CloudType>::mesh() const +{ + return mesh_; +} + + +template<class CloudType> +const Foam::wordList& +Foam::StandardPostProcessing<CloudType>::patchNames() const +{ + return patchNames_; +} + + +// ************************************************************************* //