View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004192 | OpenFOAM | Patch | public | 2024-12-18 15:29 | 2024-12-18 16:40 |
Reporter | wyldckat | Assigned To | henry | ||
Priority | low | Severity | text | Reproducibility | N/A |
Status | resolved | Resolution | fixed | ||
Product Version | dev | ||||
Fixed in Version | dev | ||||
Summary | 0004192: writeObjects header description does not list 'fields' nor 'field' as alternatives to 'objects' | ||||
Description | The feature for defining 'fields' or 'field' as an alternative to 'objects' was introduced in commit 6221186311d back in 2016. This wasn't reflected in the header description, for which the proposed patch adds examples and updated description for it. The attached files are as follows: - update_writeObjects_H.patch - Shows the proposed changes. - update_writeObjects_H.tar.gz - Has the updated file within its full path. - writeObjects.H - The modified file itself. | ||||
Tags | No tags attached. | ||||
|
writeObjects.H (5,828 bytes)
/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ 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::writeObjects Description Allows specification of different writing frequency of fields/objects registered to the database. It has similar functionality as the main time database through the \c writeControl setting: - timeStep - writeTime - adjustableRunTime - runTime - clockTime - cpuTime It also has the ability to write the selected objects that were defined with the respective write mode for the requested \c writeOption, namely: \vartable autoWrite | objects set to write at output time noWrite | objects set to not write by default anyWrite | any option of the previous two \endvartable Examples of function object specification: \verbatim writeObjects1 { type writeObjects; libs ("libutilityFunctionObjects.so"); fields (obj1 obj2); writeOption anyWrite; } writeObjects2 { type writeObjects; libs ("libutilityFunctionObjects.so"); field obj3; writeOption anyWrite; } writeObjects3 { type writeObjects; libs ("libutilityFunctionObjects.so"); objects (obj4 obj5); //inherited from writeObjectsBase writeOption anyWrite; } \endverbatim Usage \table Property | Description | Required | Default value type | type name: writeObjects | yes | fields, field or objects | field(s)/objects to write | yes | writeOption | only those with this write option | no | anyWrite \endtable Note: Regular expressions can also be used in \c objects. See also Foam::functionObject Foam::functionObjects::writeObjectsBase Foam::functionObjects::timeControl SourceFiles writeObjects.C \*---------------------------------------------------------------------------*/ #ifndef functionObjects_writeObjects_H #define functionObjects_writeObjects_H #include "functionObject.H" #include "writeObjectsBase.H" #include "NamedEnum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { namespace functionObjects { /*---------------------------------------------------------------------------*\ Class writeObjects Declaration \*---------------------------------------------------------------------------*/ class writeObjects : public functionObject, public writeObjectsBase { public: // Public data types //- Re-enumeration defining the write options, based on the original // ones at IOobject::writeOption enum class writeOption { AUTO_WRITE, NO_WRITE, ANY_WRITE }; static const NamedEnum<writeOption, 3> writeOptionNames_; private: // Private Data //- To only write objects of defined writeOption writeOption writeOption_; // Private Member Functions //- Write the requested registered IO object virtual void writeObject(const regIOobject& obj); public: //- Runtime type information TypeName("writeObjects"); // Constructors //- Construct from Time and dictionary writeObjects ( const word& name, const Time& runTime, const dictionary& dict ); //- Disallow default bitwise copy construction writeObjects(const writeObjects&) = delete; //- Destructor virtual ~writeObjects(); // Member Functions //- Read the writeObjects data virtual bool read(const dictionary&); //- Return the list of fields required virtual wordList fields() const { return wordList::null(); } //- Do nothing virtual bool execute(); //- Write the registered objects virtual bool write(); // Member Operators //- Disallow default bitwise assignment void operator=(const writeObjects&) = delete; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace functionObjects } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif // ************************************************************************* // update_writeObjects_H.patch (2,459 bytes)
diff --git a/src/functionObjects/utilities/writeObjects/writeObjects.H b/src/functionObjects/utilities/writeObjects/writeObjects.H index 10df95f17e..a8c763e5fe 100644 --- a/src/functionObjects/utilities/writeObjects/writeObjects.H +++ b/src/functionObjects/utilities/writeObjects/writeObjects.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,8 +25,8 @@ Class Foam::functionObjects::writeObjects Description - Allows specification of different writing frequency of objects registered - to the database. + Allows specification of different writing frequency of fields/objects + registered to the database. It has similar functionality as the main time database through the \c writeControl setting: @@ -45,7 +45,7 @@ Description anyWrite | any option of the previous two \endvartable - Example of function object specification: + Examples of function object specification: \verbatim writeObjects1 { @@ -53,7 +53,27 @@ Description libs ("libutilityFunctionObjects.so"); - objects (obj1 obj2); + fields (obj1 obj2); + writeOption anyWrite; + } + + writeObjects2 + { + type writeObjects; + + libs ("libutilityFunctionObjects.so"); + + field obj3; + writeOption anyWrite; + } + + writeObjects3 + { + type writeObjects; + + libs ("libutilityFunctionObjects.so"); + + objects (obj4 obj5); //inherited from writeObjectsBase writeOption anyWrite; } \endverbatim @@ -62,7 +82,7 @@ Usage \table Property | Description | Required | Default value type | type name: writeObjects | yes | - objects | objects to write | yes | + fields, field or objects | field(s)/objects to write | yes | writeOption | only those with this write option | no | anyWrite \endtable |
|
Every line of the writeObjects.H file provided is different to the src/functionObjects/utilities/writeObjects/writeObjects.H file, maybe because it was edited on a Windows machine, either way I was unable to use it directly. It is not clear why your description you have elevated the fields and field options above objects given that the purpose of writeObjects is to write objects, that is any registered object, not limited to or specialised for fields and the fields and field options are just there to provide backwards compatibility and simplicity of interface for field based functionObjects. I have added documentation for the fields and field options in a manner I think better represents their purpose at this level. |
|
Resolved by commit efa957c1c0c2e63f61662f1bcabc10a73020a19e |
Date Modified | Username | Field | Change |
---|---|---|---|
2024-12-18 15:29 | wyldckat | New Issue | |
2024-12-18 15:29 | wyldckat | File Added: writeObjects.H | |
2024-12-18 15:29 | wyldckat | File Added: update_writeObjects_H.patch | |
2024-12-18 15:29 | wyldckat | File Added: update_writeObjects_H.tar.gz | |
2024-12-18 16:40 | henry | Note Added: 0013490 | |
2024-12-18 16:40 | henry | Assigned To | => henry |
2024-12-18 16:40 | henry | Status | new => resolved |
2024-12-18 16:40 | henry | Resolution | open => fixed |
2024-12-18 16:40 | henry | Fixed in Version | => dev |
2024-12-18 16:40 | henry | Note Added: 0013491 |