functionObjectBase.H 4.56 KB
Newer Older
1 2 3 4
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
5
    \\  /    A nd           | Copyright (C) 2016-2018 OpenCFD Ltd.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
     \\/     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 3 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, see <http://www.gnu.org/licenses/>.

Class
    Foam::functionObjects::runTimePostPro::functionObjectBase

Description
    Base class for function object visualisation

30 31 32 33 34 35 36
    Dictionary controls
    \table
        Property     | Description                      | Required    | Default
        functionObject | The data source                | yes         |
        clearObjects  | Remove file after use           | no          | no
    \endtable

37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
SourceFiles
    functionObjectBase.C

\*---------------------------------------------------------------------------*/

#ifndef functionObjects_runTimePostPro_functionObjectBase_H
#define functionObjects_runTimePostPro_functionObjectBase_H

#include "fieldVisualisationBase.H"
#include "stateFunctionObject.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{
namespace functionObjects
{
namespace runTimePostPro
{

/*---------------------------------------------------------------------------*\
                     Class functionObjectBase Declaration
\*---------------------------------------------------------------------------*/

class functionObjectBase
:
    public fieldVisualisationBase
{
protected:

    // Protected data

        //- Reference to the state
        const stateFunctionObject& state_;

72
        //- The function object name which provides the source data
73 74 75 76 77 78 79 80
        word functionObjectName_;

        //- Flag to indicate that source data should be cleared after use
        bool clearObjects_;


    // Protected Member Functions

81 82 83 84 85 86 87 88 89 90 91
        //- Retrieve the filename used to create the scene object
        //- using information stored via the stateFunctionObject.
        //
        //  \param keyword is normally "file"
        //  \param subDictName is the sub-dictionary name, which is often
        //     the fieldName when one file is used per field.
        //
        //  Eg,
        //  \verbatim
        //      T
        //      {
92
        //          file    "<case>/relpath/T_object.vtk";
93 94 95
        //      }
        //      defaultCloud
        //      {
96
        //          file    "<case>/relpath/cloud_0001.vtp";
97 98 99 100 101 102 103 104 105 106 107 108 109 110
        //          fields  (T U);
        //      }
        //  \endverbatim
        fileName getFileName
        (
            const word& keyword,
            const word& subDictName
        ) const;

        //- Remove file used to create the scene object.
        //  Same naming semantics as getFileName.
        //
        //  \note does not change the stateFunctionObject
        bool removeFile(const word& keyword, const word& subDictName);
111

112 113 114 115 116 117
        //- No copy construct
        functionObjectBase(const functionObjectBase&) = delete;

        //- No copy assignment
        void operator=(const functionObjectBase&) = delete;

118

119 120 121 122 123 124 125 126 127 128 129 130 131
public:

    //- Run-time type information
    TypeName("functionObjectBase");


    // Constructors

        //- Construct from dictionary
        functionObjectBase
        (
            const stateFunctionObject& state,
            const dictionary& dict,
132
            const HashPtrTable<Function1<vector>>& colours
133 134 135 136
        );


    //- Destructor
137
    virtual ~functionObjectBase() = default;
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157


    // Member Functions

        //- Clear files used to create the object(s)
        virtual bool clear();
};


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace runTimePostPro
} // End namespace functionObjects
} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //