diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.H b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.H index 1d9b49cc4a3fdaf8b39890c14cb8145f63a7e997..42b27946d3471f65d298867e7e96e69841a49b0c 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.H +++ b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.H @@ -138,6 +138,13 @@ public: const surfaceScalarField& phi ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~PDRDragModel(); diff --git a/src/OpenFOAM/db/IOobjects/CompactIOField/CompactIOField.H b/src/OpenFOAM/db/IOobjects/CompactIOField/CompactIOField.H index 09b6fb943fe3921a5ca8a6344c74934414b66036..0a43e80a18020be1c2a6401c7c08cf9404b232d3 100644 --- a/src/OpenFOAM/db/IOobjects/CompactIOField/CompactIOField.H +++ b/src/OpenFOAM/db/IOobjects/CompactIOField/CompactIOField.H @@ -106,6 +106,12 @@ public: //- Construct by transferring the Field contents CompactIOField(const IOobject& io, Field<T>&& content); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return regIOobject::DeepClone(*this); + } + //- Destructor virtual ~CompactIOField() = default; diff --git a/src/OpenFOAM/db/IOobjects/CompactIOList/CompactIOList.H b/src/OpenFOAM/db/IOobjects/CompactIOList/CompactIOList.H index 555114418bb13fb3eaf8a023446df5b3845e940d..d555c7d752e178ca1dd4139822f59681c7d708e1 100644 --- a/src/OpenFOAM/db/IOobjects/CompactIOList/CompactIOList.H +++ b/src/OpenFOAM/db/IOobjects/CompactIOList/CompactIOList.H @@ -107,6 +107,13 @@ public: //- Construct by transferring the List content CompactIOList(const IOobject& io, List<T>&& content); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return regIOobject::DeepClone(*this); + } + + // Destructor virtual ~CompactIOList() = default; diff --git a/src/OpenFOAM/db/IOobjects/GlobalIOField/GlobalIOField.H b/src/OpenFOAM/db/IOobjects/GlobalIOField/GlobalIOField.H index 165ea0f22a389f3b67d03e1ea62425a78e79d15c..b48b4c0752f6a0c0cb0e0a969f1a4a4e4ea1c136 100644 --- a/src/OpenFOAM/db/IOobjects/GlobalIOField/GlobalIOField.H +++ b/src/OpenFOAM/db/IOobjects/GlobalIOField/GlobalIOField.H @@ -82,6 +82,12 @@ public: //- Construct by copying/moving tmp content GlobalIOField(const IOobject& io, const tmp<Field<Type>>& tf); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return regIOobject::DeepClone(*this); + } + //- Destructor virtual ~GlobalIOField() = default; diff --git a/src/OpenFOAM/db/IOobjects/GlobalIOList/GlobalIOList.H b/src/OpenFOAM/db/IOobjects/GlobalIOList/GlobalIOList.H index 2cf6f9e39f82f2150cf0471b3c08d9fdecfcf8ef..f0cdebddda3878c5635df87089fe020155ffed64 100644 --- a/src/OpenFOAM/db/IOobjects/GlobalIOList/GlobalIOList.H +++ b/src/OpenFOAM/db/IOobjects/GlobalIOList/GlobalIOList.H @@ -78,6 +78,12 @@ public: //- Construct by transferring the List content GlobalIOList(const IOobject& io, List<Type>&& content); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return regIOobject::DeepClone(*this); + } + //- Destructor virtual ~GlobalIOList() = default; diff --git a/src/OpenFOAM/db/IOobjects/IOField/IOField.H b/src/OpenFOAM/db/IOobjects/IOField/IOField.H index 8edee8ee108f5d9baef07c3f98b5302922e4bf6c..8ff5146a615a35672961efb36c2a124c16aac2c1 100644 --- a/src/OpenFOAM/db/IOobjects/IOField/IOField.H +++ b/src/OpenFOAM/db/IOobjects/IOField/IOField.H @@ -84,6 +84,12 @@ public: //- Construct by copying/moving tmp content IOField(const IOobject& io, const tmp<Field<Type>>& tfld); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return regIOobject::DeepClone(*this); + } + //- Destructor virtual ~IOField() = default; diff --git a/src/OpenFOAM/db/IOobjects/IOList/IOList.H b/src/OpenFOAM/db/IOobjects/IOList/IOList.H index c36e78ab169e530657f22fb5351f90f33f1734d8..c80a250c82998090ec99ee2bdeb7fa528b25369e 100644 --- a/src/OpenFOAM/db/IOobjects/IOList/IOList.H +++ b/src/OpenFOAM/db/IOobjects/IOList/IOList.H @@ -79,6 +79,12 @@ public: //- Construct by transferring the List content IOList(const IOobject& io, List<T>&& content); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return regIOobject::DeepClone(*this); + } + //- Destructor virtual ~IOList() = default; diff --git a/src/OpenFOAM/db/IOobjects/IOMap/IOMap.H b/src/OpenFOAM/db/IOobjects/IOMap/IOMap.H index 68fa5fe98550b7496f0f12e5efb15cf2aac1dc84..cb3871ddda0c9c7bbba9c72cd0dc550155fadfd7 100644 --- a/src/OpenFOAM/db/IOobjects/IOMap/IOMap.H +++ b/src/OpenFOAM/db/IOobjects/IOMap/IOMap.H @@ -66,7 +66,7 @@ public: // Constructors //- Default copy construct - IOMap(const IOMap&) = default; + explicit IOMap(const IOMap&) = default; //- Construct from IOobject explicit IOMap(const IOobject& io); @@ -80,6 +80,12 @@ public: //- Construct by transferring the Map content IOMap(const IOobject&, Map<T>&& content); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return regIOobject::DeepClone(*this); + } + //- Destructor virtual ~IOMap() = default; diff --git a/src/OpenFOAM/db/IOobjects/IOPtrList/IOPtrList.H b/src/OpenFOAM/db/IOobjects/IOPtrList/IOPtrList.H index aa829d34a5841b72d6c2ba4dc37465791ec8f1cc..ba94ad9a57909491def491ef691e3cc991199d49 100644 --- a/src/OpenFOAM/db/IOobjects/IOPtrList/IOPtrList.H +++ b/src/OpenFOAM/db/IOobjects/IOPtrList/IOPtrList.H @@ -83,6 +83,12 @@ public: //- Construct by transferring the PtrList content IOPtrList(const IOobject& io, PtrList<T>&& content); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return regIOobject::DeepClone(*this); + } + //- Destructor virtual ~IOPtrList() = default; diff --git a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.H b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.H index 2ba3eb251368efee9dc5e3262742f05e547ada65..2c866a9806a1c393ae7e91e2ed0fd6acc2fe6308 100644 --- a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.H +++ b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.H @@ -60,6 +60,9 @@ public: // Constructors + //- Copy construct + IOdictionary(const IOdictionary&) = default; + //- Construct given an IOobject //- and optional fallback dictionary content // A null dictionary pointer is treated like an empty dictionary. @@ -86,6 +89,12 @@ public: //- Construct given an IOobject and Istream IOdictionary(const IOobject& io, Istream& is); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return regIOobject::DeepClone(*this); + } + //- Destructor virtual ~IOdictionary() = default; diff --git a/src/OpenFOAM/db/IOobjects/IOdictionary/localIOdictionary.H b/src/OpenFOAM/db/IOobjects/IOdictionary/localIOdictionary.H index d2e032139309a2dd3b45fe5d17777ec960d6c769..56b9ae99c415dc58d5362256510d7820e502da1a 100644 --- a/src/OpenFOAM/db/IOobjects/IOdictionary/localIOdictionary.H +++ b/src/OpenFOAM/db/IOobjects/IOdictionary/localIOdictionary.H @@ -83,6 +83,15 @@ public: //- Construct given an IOobject and Istream localIOdictionary(const IOobject& io, Istream& is); + //- Copy construct + localIOdictionary(const localIOdictionary&) = default; + + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return regIOobject::DeepClone(*this); + } + //- Destructor virtual ~localIOdictionary() = default; diff --git a/src/OpenFOAM/db/IOobjects/IOdictionary/unwatchedIOdictionary.H b/src/OpenFOAM/db/IOobjects/IOdictionary/unwatchedIOdictionary.H index b38f5cf165e5bc81f19bf58f358d4f1c1796a28e..22bc9b6f415f739cc73de468417f13f0b0467bdb 100644 --- a/src/OpenFOAM/db/IOobjects/IOdictionary/unwatchedIOdictionary.H +++ b/src/OpenFOAM/db/IOobjects/IOdictionary/unwatchedIOdictionary.H @@ -94,6 +94,15 @@ public: //- Construct given an IOobject and Istream unwatchedIOdictionary(const IOobject& io, Istream& is); + //- Default copy construct + explicit unwatchedIOdictionary(const unwatchedIOdictionary&) = default; + + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return regIOobject::DeepClone(*this); + } + //- Destructor virtual ~unwatchedIOdictionary() = default; diff --git a/src/OpenFOAM/db/Time/Time.H b/src/OpenFOAM/db/Time/Time.H index 75f0a01eae6f5ad5dd1d9fdb23f4ff1be416ace6..1c8a228cc68c52ddb3cb33c09cffc7cf08177c8f 100644 --- a/src/OpenFOAM/db/Time/Time.H +++ b/src/OpenFOAM/db/Time/Time.H @@ -226,6 +226,9 @@ public: //- The default control dictionary name (normally "controlDict") static word controlDictName; + //- Default null Time - does not load any dictionary + static const Time null; + //- Runtime type information TypeName("time"); diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistry.C b/src/OpenFOAM/db/objectRegistry/objectRegistry.C index 1ada425950242fc904c744c32ae262410311e362..6988fee5f66d75a63916aa2c15176d6ed4f47ecb 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistry.C +++ b/src/OpenFOAM/db/objectRegistry/objectRegistry.C @@ -214,6 +214,24 @@ const Foam::objectRegistry& Foam::objectRegistry::subRegistry } +const Foam::objectRegistry& Foam::objectRegistry::findSubRegistry +( + const fileName& path, + const bool forceCreate +) const +{ + const wordList names(path.components()); + + refPtr<objectRegistry> subObr(*this); + + for (const word& name : names) + { + subObr = subObr().subRegistry(name, forceCreate); + } + return subObr(); +} + + Foam::label Foam::objectRegistry::getEvent() const { label curEvent = event_++; diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistry.H b/src/OpenFOAM/db/objectRegistry/objectRegistry.H index 578391a1d68039e62eddf1ee89485c90a1d7ff4d..a1578acc613ad61731867341f66ca7841a030c8d 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistry.H +++ b/src/OpenFOAM/db/objectRegistry/objectRegistry.H @@ -132,7 +132,7 @@ class objectRegistry //- No copy construct - objectRegistry(const objectRegistry&) = delete; + //objectRegistry(const objectRegistry&) = delete; //- No copy assignment void operator=(const objectRegistry&) = delete; @@ -158,6 +158,15 @@ public: TypeName("objectRegistry"); + // Static Member Functions + + //- Return nullObject reference field + inline static const objectRegistry& null() + { + return NullObjectRef<objectRegistry>(); + } + + // Constructors //- Construct the time objectRegistry, @@ -168,6 +177,15 @@ public: //- with estimated table capacity (default: 128) explicit objectRegistry(const IOobject& io, const label nObjects=128); + //- Default copy construct + explicit objectRegistry(const objectRegistry&) = default; + + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return regIOobject::DeepClone(*this); + } + //- Destructor, with checkOut() for all objects that are ownedByRegistry virtual ~objectRegistry(); @@ -342,6 +360,16 @@ public: const bool recursive = false ) const; + //- Lookup and return a const sub-objectRegistry using a relative + // path (with '/' separator) + // + // \param forceCreate create it if it does not exist. + const objectRegistry& findSubRegistry + ( + const fileName& relativePath, + const bool forceCreate = false + ) const; + //- Return all objects with a class satisfying \c isA\<Type\> // diff --git a/src/OpenFOAM/db/regIOobject/regIOobject.C b/src/OpenFOAM/db/regIOobject/regIOobject.C index dcb7ed0cdc99f4deb0d24573df29189f1d4477fa..f4d59a2bb9df408696e2b6112326857d342a1af1 100644 --- a/src/OpenFOAM/db/regIOobject/regIOobject.C +++ b/src/OpenFOAM/db/regIOobject/regIOobject.C @@ -37,6 +37,7 @@ License namespace Foam { defineTypeNameAndDebug(regIOobject, 0); + defineRunTimeSelectionTable(regIOobject, IOobject); } bool Foam::regIOobject::masterOnlyReading = false; @@ -454,6 +455,42 @@ bool Foam::regIOobject::headerOk() } +Foam::refPtr<Foam::regIOobject> Foam::regIOobject::New +( + const word& objectType, + const IOobject& io +) +{ + DebugInFunction << "Constructing regIOobject " << io.name() + << " of type " << objectType << endl; + + auto* ctorPtr = IOobjectConstructorTable(objectType); + + if (!ctorPtr) + { + return nullptr; + } + + return refPtr<regIOobject>(ctorPtr(io)); +} + + +Foam::refPtr<Foam::regIOobject> Foam::regIOobject::New(const IOobject& io) +{ + DebugInFunction << "Constructing regIOobject" << endl; + + if (io.headerClassName().empty()) + { + //FatalIOErrorInFunction(io.objectPath()) + // << "No className in header for object " + // << io.info() << exit(FatalIOError); + return nullptr; + } + + return New(io.headerClassName(), io); +} + + void Foam::regIOobject::operator=(const IOobject& io) { // Close any file diff --git a/src/OpenFOAM/db/regIOobject/regIOobject.H b/src/OpenFOAM/db/regIOobject/regIOobject.H index 8ace12cc3becbb92b5a697cfc184d0dead44c76f..c341b1193aaab9f35d73c38ca9d24cfc18df42c7 100644 --- a/src/OpenFOAM/db/regIOobject/regIOobject.H +++ b/src/OpenFOAM/db/regIOobject/regIOobject.H @@ -158,6 +158,46 @@ public: regIOobject(const IOobject& io, const regIOobject& rio); + // Selectors + + //- Return reference or pointer to a new regIOobject from an IOobject. + // \returns nullptr if no constructor found + static refPtr<regIOobject> New + ( + const word& objectType, + const IOobject& io + ); + + //- Return reference or pointer to a new regIOobject from an IOobject. + //- Assumes IOobject contains header information. + // \returns nullptr if no constructor found + static refPtr<regIOobject> New(const IOobject& io); + + //- Clone a regIOobject + template<class Derived> + static refPtr<regIOobject> DeepClone(const Derived& io) + { + return refPtr<regIOobject>(new Derived(io)); + } + + //- Return a clone. + virtual refPtr<regIOobject> deepClone() const = 0; + + + // Declare run-time constructor selection tables + + declareRunTimeRefPtrSelectionTable + ( + refPtr, + regIOobject, + IOobject, + ( + const IOobject& io + ), + (io) + ); + + //- Destructor virtual ~regIOobject(); diff --git a/src/OpenFOAM/db/runTimeSelection/construction/addToRunTimeSelectionTable.H b/src/OpenFOAM/db/runTimeSelection/construction/addToRunTimeSelectionTable.H index 885c8bcab409017238f84ea1702972534ad53c83..94fcbf11e808ae8fc1d41fd1454ee90e8a35a995 100644 --- a/src/OpenFOAM/db/runTimeSelection/construction/addToRunTimeSelectionTable.H +++ b/src/OpenFOAM/db/runTimeSelection/construction/addToRunTimeSelectionTable.H @@ -86,6 +86,15 @@ Note ##lookup##_##other##_(#lookup,#other,ver) +//- Add to construction table with typeName as the key, using factory New +#define addToRunTimeFactorySelectionTable\ +(baseType,thisType,factoryType,argNames) \ + \ + /* Add factoryType factory method to the table */ \ + baseType::add##argNames##ConstructorToTable<thisType,factoryType> \ + add##thisType##factoryType##argNames##ConstructorTo##baseType##Table_ + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // //- Add to construction table with typeName as the key. diff --git a/src/OpenFOAM/db/runTimeSelection/construction/runTimeSelectionTables.H b/src/OpenFOAM/db/runTimeSelection/construction/runTimeSelectionTables.H index 976bd6e7df96e3986158a839241e16f0a2281514..e0385c40e1b3ec7cfb00f1efec7ac509e4de74a0 100644 --- a/src/OpenFOAM/db/runTimeSelection/construction/runTimeSelectionTables.H +++ b/src/OpenFOAM/db/runTimeSelection/construction/runTimeSelectionTables.H @@ -276,7 +276,7 @@ Description ptrWrapper<baseType>,argNames##Constructor,argList); \ \ /* Helper to add compatibility/alias for runtime selection table */ \ - template<class baseType##Type> \ + template<class baseType##Type, class Factory = baseType##Type> \ struct addAlias##argNames##ConstructorToTable \ { \ explicit addAlias##argNames##ConstructorToTable \ @@ -292,12 +292,12 @@ Description }; \ \ /* Helper to add constructor from argList to table */ \ - template<class baseType##Type> \ + template<class baseType##Type, class Factory = baseType##Type> \ struct add##argNames##ConstructorToTable \ { \ static ptrWrapper<baseType> New##baseType argList \ { \ - return ptrWrapper<baseType>(baseType##Type::New parList.ptr()); \ + return ptrWrapper<baseType>(Factory::New parList.ptr()); \ } \ \ explicit add##argNames##ConstructorToTable \ @@ -328,14 +328,14 @@ Description }; \ \ /* Helper to add constructor from argList to table */ \ - template<class baseType##Type> \ + template<class baseType##Type, class Factory = baseType##Type> \ struct addRemovable##argNames##ConstructorToTable \ { \ const ::Foam::word name; /* Retain name for later removal */ \ \ static ptrWrapper<baseType> New##baseType argList \ { \ - return ptrWrapper<baseType>(baseType##Type::New parList.ptr()); \ + return ptrWrapper<baseType>(Factory::New parList.ptr()); \ } \ \ explicit addRemovable##argNames##ConstructorToTable \ @@ -365,6 +365,105 @@ Description }; + +//MEJ +//- Declare a run-time selection for derived classes +#define declareRunTimeRefPtrSelectionTable\ +(ptrWrapper,baseType,argNames,argList,parList) \ + \ + declareRunTimeSelectionTableBase( \ + ptrWrapper<baseType>,argNames##Constructor,argList); \ + \ + /* Helper to add compatibility/alias for runtime selection table */ \ + template<class baseType##Type, class Factory = baseType##Type> \ + struct addAlias##argNames##ConstructorToTable \ + { \ + explicit addAlias##argNames##ConstructorToTable \ + ( \ + const ::Foam::word& k, \ + const ::Foam::word& alias, \ + const int ver \ + ) \ + { \ + argNames##ConstructorCompatTable() \ + .set(alias, std::pair<::Foam::word,int>(k,ver)); \ + } \ + }; \ + \ + /* Helper to add constructor from argList to table */ \ + template<class baseType##Type, class Factory = baseType##Type> \ + struct add##argNames##ConstructorToTable \ + { \ + static ptrWrapper<baseType> New##baseType argList \ + { \ + return ptrWrapper<baseType>(Factory::New parList); \ + } \ + \ + explicit add##argNames##ConstructorToTable \ + ( \ + const ::Foam::word& k = baseType##Type::typeName \ + ) \ + { \ + argNames##ConstructorTablePtr_construct(true); \ + if (!argNames##ConstructorTablePtr_->insert(k, New##baseType)) \ + { \ + std::cerr \ + << "Duplicate entry " << k << " in runtime table " \ + << #baseType << std::endl; \ + ::Foam::error::safePrintStack(std::cerr); \ + } \ + } \ + \ + ~add##argNames##ConstructorToTable() \ + { \ + argNames##ConstructorTablePtr_construct(false); \ + } \ + \ + add##argNames##ConstructorToTable \ + (const add##argNames##ConstructorToTable&) = delete; \ + \ + void operator= \ + (const add##argNames##ConstructorToTable&) = delete; \ + }; \ + \ + /* Helper to add constructor from argList to table */ \ + template<class baseType##Type, class Factory = baseType##Type> \ + struct addRemovable##argNames##ConstructorToTable \ + { \ + const ::Foam::word name; /* Retain name for later removal */ \ + \ + static ptrWrapper<baseType> New##baseType argList \ + { \ + return ptrWrapper<baseType>(Factory::New parList.ptr()); \ + } \ + \ + explicit addRemovable##argNames##ConstructorToTable \ + ( \ + const ::Foam::word& k = baseType##Type::typeName \ + ) \ + : \ + name(k) \ + { \ + argNames##ConstructorTablePtr_construct(true); \ + argNames##ConstructorTablePtr_->set(k, New##baseType); \ + } \ + \ + ~addRemovable##argNames##ConstructorToTable() \ + { \ + if (argNames##ConstructorTablePtr_) \ + { \ + argNames##ConstructorTablePtr_->erase(name); \ + } \ + } \ + \ + addRemovable##argNames##ConstructorToTable \ + (const addRemovable##argNames##ConstructorToTable&) = delete; \ + \ + void operator= \ + (const addRemovable##argNames##ConstructorToTable&) = delete; \ + }; +//MEJ + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // diff --git a/src/OpenFOAM/expressions/Function1/Function1Expression.C b/src/OpenFOAM/expressions/Function1/Function1Expression.C index 2575e0cb0140df3325e07bebb0b6a93b8a751907..1437a1500617171bd2b15e6b1ae761952082e3e2 100644 --- a/src/OpenFOAM/expressions/Function1/Function1Expression.C +++ b/src/OpenFOAM/expressions/Function1/Function1Expression.C @@ -119,7 +119,7 @@ Type Foam::Function1Types::Function1Expression<Type>::integrate template<class Type> -void Foam::Function1Types::Function1Expression<Type>::writeData +bool Foam::Function1Types::Function1Expression<Type>::writeData ( Ostream& os ) const @@ -127,6 +127,8 @@ void Foam::Function1Types::Function1Expression<Type>::writeData // Function1-from-subdict so out dictionary contains // only the relevant entries. dict_.writeEntry(this->name(), os); + + return os.good(); } diff --git a/src/OpenFOAM/expressions/Function1/Function1Expression.H b/src/OpenFOAM/expressions/Function1/Function1Expression.H index ccb91b9f6e0732fff66bb08943b6bf1808e2b12e..0ae353d6b1007284ef56007b2233de85f7b5ea3d 100644 --- a/src/OpenFOAM/expressions/Function1/Function1Expression.H +++ b/src/OpenFOAM/expressions/Function1/Function1Expression.H @@ -138,7 +138,7 @@ public: ) const; //- Write in dictionary format - virtual void writeData(Ostream& os) const; + virtual bool writeData(Ostream& os) const; }; diff --git a/src/OpenFOAM/expressions/exprResult/exprResultGlobals.H b/src/OpenFOAM/expressions/exprResult/exprResultGlobals.H index 49a4dbc678218b4a3b7507a2790f92772ea60205..3e4b4e9d914514d6fae12066136c853b928496f9 100644 --- a/src/OpenFOAM/expressions/exprResult/exprResultGlobals.H +++ b/src/OpenFOAM/expressions/exprResult/exprResultGlobals.H @@ -129,6 +129,18 @@ public: static bool Delete(const objectRegistry& obr); + // Constructors + + //- Default copy construct + explicit exprResultGlobals(const exprResultGlobals&) = default; + + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return regIOobject::DeepClone(*this); + } + + //- Destructor virtual ~exprResultGlobals() = default; diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H index 6b6931051b8b68b5b41886574a0fff0b174a8429..151e2e816afec1d12a9bd12c82094dff1b1f769a 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H @@ -281,6 +281,12 @@ public: //- Clone tmp<DimensionedField<Type, GeoMesh>> clone() const; + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return regIOobject::DeepClone(*this); + } + //- Destructor virtual ~DimensionedField() = default; diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H index 78cfc3e57244cb1ff409bb5e7850ed1d68175f2c..2e9bb6b3ad0051b560e873dd006a5289855e9662 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -477,6 +477,12 @@ public: //- Clone tmp<GeometricField<Type, PatchField, GeoMesh>> clone() const; + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return regIOobject::DeepClone(*this); + } + // Static Constructors @@ -562,6 +568,10 @@ public: const wordList& actualPatchTypes = wordList() ); + //- Return new field from IOobject if iodb() is correct type. + //- Returns null otherwise + static refPtr<regIOobject> New(const IOobject& io); + //- Destructor virtual ~GeometricField(); diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldNew.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldNew.C index 7d8c91d0a5df8ddda31bc5cb202b05d8e4e86d04..cc73047d96c4505931d183266e162e190ec7ace8 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldNew.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldNew.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -228,4 +228,28 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::New } +template<class Type, template<class> class PatchField, class GeoMesh> +Foam::refPtr<Foam::regIOobject> +Foam::GeometricField<Type, PatchField, GeoMesh>::New(const IOobject& io) +{ + DebugInFunction + << "Testing db:" << io.db().type() + << " for type " << Mesh::typeName + << " io:" << io.name() << endl; + + refPtr<regIOobject> ret; + + const auto meshPtr = GeoMesh::mesh(io.db()); + if (meshPtr) + { + ret.reset + ( + new GeometricField<Type, PatchField, GeoMesh>(io, *meshPtr) + ); + } + + return ret; +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/fields/GeometricFields/pointFields/pointFields.C b/src/OpenFOAM/fields/GeometricFields/pointFields/pointFields.C index 7701ff24f3b0f745178fb1a848eef29ac3ab9148..f439b80b78685ddd14cdce41268cde6b10b5c141 100644 --- a/src/OpenFOAM/fields/GeometricFields/pointFields/pointFields.C +++ b/src/OpenFOAM/fields/GeometricFields/pointFields/pointFields.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,6 +28,7 @@ License #include "polyMesh.H" #include "pointFields.H" +#include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -53,6 +55,36 @@ namespace Foam defineTemplateTypeNameAndDebug(pointSymmTensorField, 0); defineTemplateTypeNameAndDebug(pointTensorField, 0); + addToRunTimeSelectionTable + ( + regIOobject, + pointScalarField, + IOobject + ); + addToRunTimeSelectionTable + ( + regIOobject, + pointVectorField, + IOobject + ); + addToRunTimeSelectionTable + ( + regIOobject, + pointSphericalTensorField, + IOobject + ); + addToRunTimeSelectionTable + ( + regIOobject, + pointSymmTensorField, + IOobject + ); + addToRunTimeSelectionTable + ( + regIOobject, + pointTensorField, + IOobject + ); } // End namespace Foam diff --git a/src/OpenFOAM/fields/UniformDimensionedFields/UniformDimensionedField.H b/src/OpenFOAM/fields/UniformDimensionedFields/UniformDimensionedField.H index 77b9f520df2c1c5a1d7f4573140cc282f5fa8c23..504983a1edfd1d323536b691fb32f87f88a788ed 100644 --- a/src/OpenFOAM/fields/UniformDimensionedFields/UniformDimensionedField.H +++ b/src/OpenFOAM/fields/UniformDimensionedFields/UniformDimensionedField.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -83,6 +84,19 @@ public: //- Construct from Istream UniformDimensionedField(const IOobject& io); + //- Return wrapped pointer to a new regIOobject from an IOobject. + //- Assumes IOobject contains header information and io.db is polyMesh + static refPtr<regIOobject> New(const IOobject& io) + { + return refPtr<regIOobject>(new UniformDimensionedField<Type>(io)); + } + + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return regIOobject::DeepClone(*this); + } + //- Destructor virtual ~UniformDimensionedField(); diff --git a/src/OpenFOAM/fields/UniformDimensionedFields/uniformDimensionedFields.C b/src/OpenFOAM/fields/UniformDimensionedFields/uniformDimensionedFields.C index 0e5c1094842a8b8a36d37ae479a56f13a9075506..04bf1a83c12c4f9e68da7d4bb358369908ec3d97 100644 --- a/src/OpenFOAM/fields/UniformDimensionedFields/uniformDimensionedFields.C +++ b/src/OpenFOAM/fields/UniformDimensionedFields/uniformDimensionedFields.C @@ -25,7 +25,10 @@ License \*---------------------------------------------------------------------------*/ +#include "addToRunTimeSelectionTable.H" +#include "regIOobject.H" #include "uniformDimensionedFields.H" +#include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -40,6 +43,37 @@ defineTemplateTypeNameAndDebug(uniformDimensionedSphericalTensorField, 0); defineTemplateTypeNameAndDebug(uniformDimensionedSymmTensorField, 0); defineTemplateTypeNameAndDebug(uniformDimensionedTensorField, 0); +addToRunTimeSelectionTable +( + regIOobject, + uniformDimensionedScalarField, + IOobject +); +addToRunTimeSelectionTable +( + regIOobject, + uniformDimensionedVectorField, + IOobject +); +addToRunTimeSelectionTable +( + regIOobject, + uniformDimensionedSphericalTensorField, + IOobject +); +addToRunTimeSelectionTable +( + regIOobject, + uniformDimensionedSymmTensorField, + IOobject +); +addToRunTimeSelectionTable +( + regIOobject, + uniformDimensionedTensorField, + IOobject +); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/global/globals.C b/src/OpenFOAM/global/globals.C index 08a130f6fb3cf3342183d924256f0cc076413900..8eea21bb74cbd85e993fd69534d1967a59f34858 100644 --- a/src/OpenFOAM/global/globals.C +++ b/src/OpenFOAM/global/globals.C @@ -87,6 +87,18 @@ bool Foam::JobInfo::constructed(false); #include "debug.C" +//MEJ +#include "Time.H" +const Foam::Time Foam::Time::null +( + fileName("."), // root-path + fileName("."), // case-name + false, // No enableFunctionObjects + false // No enableLibs +); + +//MEJ + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Read file modification checking switches diff --git a/src/OpenFOAM/meshes/GeoMesh/GeoMesh.H b/src/OpenFOAM/meshes/GeoMesh/GeoMesh.H index 21f0377d1f9517938c99d16639ce51bd8075fb4a..fc2f4a2461c14a7cf6f923b1c720a4b619859845 100644 --- a/src/OpenFOAM/meshes/GeoMesh/GeoMesh.H +++ b/src/OpenFOAM/meshes/GeoMesh/GeoMesh.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -67,7 +68,7 @@ public: // Constructors //- Construct from mesh reference - explicit GeoMesh(const MESH& mesh) + explicit GeoMesh(const Mesh& mesh) : mesh_(mesh) {} @@ -75,23 +76,32 @@ public: // Member Functions - //- Return true if thisDb() is a valid DB - here = false - bool hasDb() const + //- Return true if thisDb() is a valid DB + bool hasDb() const noexcept { return true; } //- Return the object registry - const objectRegistry& thisDb() const + const objectRegistry& thisDb() const noexcept { return mesh_; } + //- Return mesh given objectRegistry (reverse of thisDb). + // \return null if objectRegistry does not hold Mesh + static refPtr<Mesh> mesh(const objectRegistry& db) + { + refPtr<Mesh> wrapped; + wrapped.cref(dynamic_cast<const Mesh*>(&db)); + return wrapped; + } + // Member Operators //- Return reference to the underlying mesh - const MESH& operator()() const + const Mesh& operator()() const noexcept { return mesh_; } diff --git a/src/OpenFOAM/meshes/MeshObject/MeshObject.H b/src/OpenFOAM/meshes/MeshObject/MeshObject.H index 4500261f94839f3a98330f22236e87d3b9e4cdb5..52d8c8c83332cbcd1167ab5d16ddd7eb0a43c5a6 100644 --- a/src/OpenFOAM/meshes/MeshObject/MeshObject.H +++ b/src/OpenFOAM/meshes/MeshObject/MeshObject.H @@ -110,6 +110,13 @@ public: template<class... Args> static const Type& New(const Mesh& mesh, Args&&... args); + //- Return a clone. Not applicable for singleton + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~MeshObject() = default; diff --git a/src/OpenFOAM/meshes/pointMesh/pointMesh.C b/src/OpenFOAM/meshes/pointMesh/pointMesh.C index 383cf15dd17323e35bfb2add270e63712e1cdea0..651c8d829b4db513d28fc31b80620ffb76fdc773 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointMesh.C +++ b/src/OpenFOAM/meshes/pointMesh/pointMesh.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2013 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -90,11 +91,22 @@ Foam::pointMesh::pointMesh(const polyMesh& pMesh) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +Foam::refPtr<Foam::pointMesh> Foam::pointMesh::mesh(const objectRegistry& db) +{ + const auto* polyPtr = isA<polyMesh>(db); + if (polyPtr) + { + return pointMesh::New(*polyPtr); + } + return nullptr; +} + + bool Foam::pointMesh::movePoints() { if (debug) { - Pout<< "pointMesh::movePoints(const pointField&): " + Pout<< "pointMesh::movePoints(): " << "Moving points." << endl; } diff --git a/src/OpenFOAM/meshes/pointMesh/pointMesh.H b/src/OpenFOAM/meshes/pointMesh/pointMesh.H index a651a74424c5ba4a32a74e36416aac0fb527f957..8ee9269b05a547f5c14466c8411dba4c0bd6ab98 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointMesh.H +++ b/src/OpenFOAM/meshes/pointMesh/pointMesh.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2013 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -53,7 +54,7 @@ class pointMesh public MeshObject<polyMesh, UpdateableMeshObject, pointMesh>, public GeoMesh<polyMesh> { - // Permanent data + // Permanent Data //- Boundary mesh pointBoundaryMesh boundary_; @@ -123,6 +124,19 @@ public: return GeoMesh<polyMesh>::mesh_.thisDb(); } + //- Return Time from polyMesh. + const Time& time() const + { + return GeoMesh<polyMesh>::mesh_.time(); + } + + //- Parent mesh (polyMesh) + using MeshObject<polyMesh, UpdateableMeshObject, pointMesh>::mesh; + + //- Return mesh given objectRegistry (reverse of thisDb). + // \return null if objectRegistry does not hold Mesh + static refPtr<pointMesh> mesh(const objectRegistry& db); + // Mesh motion diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistribute.H b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistribute.H index d277c5723b92fd0f3d2e39651763db520797cb49..1e1d1d32a4eeb5175b7837c021cf63c7f38ac619 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistribute.H +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/IOmapDistribute.H @@ -74,6 +74,15 @@ public: //- Construct, moving mapDistribute contents IOmapDistribute(const IOobject& io, mapDistribute&& map); + //- Default copy construct + IOmapDistribute(const IOmapDistribute&) = default; + + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return regIOobject::DeepClone(*this); + } + //- Destructor virtual ~IOmapDistribute() = default; diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H index 8dcf87f41d21831b05b6e2170f26b115167c3709..d7977e7576518c87c31644c8eea74f53305ba06f 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H @@ -135,6 +135,13 @@ public: const polyPatchList& ppl ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor ~polyBoundaryMesh() = default; diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMeshEntries.H b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMeshEntries.H index 4b89aa41b71098b5705a760df0d76ad5278489ad..f2fe5ae0d1599d7a8bd9e353b8cbd136648320de 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMeshEntries.H +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMeshEntries.H @@ -56,6 +56,13 @@ class polyBoundaryMeshEntries public regIOobject, public PtrList<entry> { + + // Private Member Functions + + //- No copy construct + polyBoundaryMeshEntries(const polyBoundaryMeshEntries&) = delete; + + public: //- Runtime type information @@ -82,6 +89,13 @@ public: } } + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + // Member Functions diff --git a/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H b/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H index 25f99e1fed1d3a9390d91a4af31670a25f5215b0..a8dca7d55cd5e6c1ea259fb3b692b490225f94ae 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H @@ -132,6 +132,13 @@ public: const PtrList<ZoneType>& pzm ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor ~ZoneMesh(); diff --git a/src/OpenFOAM/primitives/functions/Function1/CSV/CSV.C b/src/OpenFOAM/primitives/functions/Function1/CSV/CSV.C index 03fb6b86c0c2ec9679481f7c89b81e5732315d0c..cec15ef8999d4a3cefff783dfb8a90cccb39169a 100644 --- a/src/OpenFOAM/primitives/functions/Function1/CSV/CSV.C +++ b/src/OpenFOAM/primitives/functions/Function1/CSV/CSV.C @@ -102,7 +102,7 @@ Type Foam::Function1Types::CSV<Type>::readValue template<class Type> -void Foam::Function1Types::CSV<Type>::read() +bool Foam::Function1Types::CSV<Type>::read() { fileName expandedFile(fName_); autoPtr<ISstream> isPtr(fileHandler().NewIFstream(expandedFile.expand())); @@ -200,6 +200,8 @@ void Foam::Function1Types::CSV<Type>::read() } this->table_.transfer(values); + + return true; } @@ -227,6 +229,28 @@ Foam::Function1Types::CSV<Type>::CSV } +template<class Type> +Foam::Function1Types::CSV<Type>::CSV +( + const IOobject& io, + const dictionary& dict, + const fileName& fName +) +: + TableBase<Type>(io.name(), dict), + nHeaderLine_(dict.get<label>("nHeaderLine")), + refColumn_(dict.get<label>("refColumn")), + componentColumns_(getComponentColumns("componentColumns", dict)), + separator_(dict.getOrDefault<string>("separator", ",")[0]), + mergeSeparators_(dict.get<bool>("mergeSeparators")), + fName_(fName.empty() ? dict.get<fileName>("file") : fName) +{ + read(); + + TableBase<Type>::check(); +} + + template<class Type> Foam::Function1Types::CSV<Type>::CSV(const CSV<Type>& csv) : @@ -271,7 +295,7 @@ void Foam::Function1Types::CSV<Type>::writeEntries(Ostream& os) const template<class Type> -void Foam::Function1Types::CSV<Type>::writeData(Ostream& os) const +bool Foam::Function1Types::CSV<Type>::writeData(Ostream& os) const { Function1<Type>::writeData(os); os.endEntry(); @@ -279,6 +303,8 @@ void Foam::Function1Types::CSV<Type>::writeData(Ostream& os) const os.beginBlock(word(this->name() + "Coeffs")); writeEntries(os); os.endBlock(); + + return os.good(); } diff --git a/src/OpenFOAM/primitives/functions/Function1/CSV/CSV.H b/src/OpenFOAM/primitives/functions/Function1/CSV/CSV.H index 1c5a2bb693edf58127bb5c5c93f7138418d3ed85..4f6ce3795e355d2534af6c6ce31b990e67342b16 100644 --- a/src/OpenFOAM/primitives/functions/Function1/CSV/CSV.H +++ b/src/OpenFOAM/primitives/functions/Function1/CSV/CSV.H @@ -107,9 +107,6 @@ class CSV const dictionary& dict ); - //- Read csv data table - void read(); - //- Read component values from the split string Type readValue(const List<string>& strings) const; @@ -133,6 +130,14 @@ public: const fileName& fName = fileName::null ); + //- Construct from IOobject and dictionary + CSV + ( + const IOobject& io, + const dictionary& dict, + const fileName& fName = fileName::null + ); + //- Copy construct explicit CSV(const CSV<Type>& csv); @@ -152,8 +157,11 @@ public: //- Return const access to the file name virtual const fileName& fName() const; + //- Read csv data table + virtual bool read(); + //- Write in dictionary format - virtual void writeData(Ostream& os) const; + virtual bool writeData(Ostream& os) const; //- Write coefficient entries in dictionary format void writeEntries(Ostream& os) const; diff --git a/src/OpenFOAM/primitives/functions/Function1/Constant/Constant.C b/src/OpenFOAM/primitives/functions/Function1/Constant/Constant.C index 36c764e895e31778d0cef37d2ce322b48fd940f1..7cf16c4680176aa98bf3a1062a611739cf735c21 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Constant/Constant.C +++ b/src/OpenFOAM/primitives/functions/Function1/Constant/Constant.C @@ -78,6 +78,42 @@ Foam::Function1Types::Constant<Type>::Constant } +template<class Type> +Foam::Function1Types::Constant<Type>::Constant +( + const IOobject& io, + const dictionary& dict +) +: + Function1<Type>(io, dict), + value_(Zero) +{ + const entry* eptr = dict.findEntry(io.name(), keyType::LITERAL); + + if (eptr && eptr->isStream()) + { + // Primitive (inline) format. Eg, + // - key constant 1.2; + // - key 1.2; + + ITstream& is = eptr->stream(); + if (is.peek().isWord()) + { + is.skip(); // Discard leading 'constant' + } + is >> value_; + dict.checkITstream(is, io.name()); + } + else + { + // Dictionary format. Eg, + // key { type constant; value 1.2; } + + dict.readEntry("value", value_); + } +} + + template<class Type> Foam::Function1Types::Constant<Type>::Constant ( @@ -111,11 +147,13 @@ Foam::tmp<Foam::Field<Type>> Foam::Function1Types::Constant<Type>::value template<class Type> -void Foam::Function1Types::Constant<Type>::writeData(Ostream& os) const +bool Foam::Function1Types::Constant<Type>::writeData(Ostream& os) const { Function1<Type>::writeData(os); os << token::SPACE << value_ << token::END_STATEMENT << nl; + + return os.good(); } diff --git a/src/OpenFOAM/primitives/functions/Function1/Constant/Constant.H b/src/OpenFOAM/primitives/functions/Function1/Constant/Constant.H index 4dfac6e68a794f05296463fe94a75fba95cb9df4..ba2db1dcd558f196e3976bbb98a2778351d474de 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Constant/Constant.H +++ b/src/OpenFOAM/primitives/functions/Function1/Constant/Constant.H @@ -100,6 +100,9 @@ public: //- Construct from entry name and dictionary Constant(const word& entryName, const dictionary& dict); + //- Construct from IOobject and dictionary + Constant(const IOobject& io, const dictionary& dict); + //- Construct from entry name and Istream // Reads the constant value without the Function1 type // for backward compatibility @@ -131,7 +134,7 @@ public: virtual tmp<Field<Type>> value(const scalarField& x) const; //- Write as primitive (inline) format - virtual void writeData(Ostream& os) const; + virtual bool writeData(Ostream& os) const; }; diff --git a/src/OpenFOAM/primitives/functions/Function1/Cosine/Cosine.H b/src/OpenFOAM/primitives/functions/Function1/Cosine/Cosine.H index 08383ac1c93f1fc9aa2d578855b3fc05d864d952..eb74d029c6be62f8280dad348280a69120e1486a 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Cosine/Cosine.H +++ b/src/OpenFOAM/primitives/functions/Function1/Cosine/Cosine.H @@ -137,6 +137,13 @@ public: Sine<Type>(entryName, dict) {} + + //- Construct from IOobject and dictionary + Cosine(const IOobject& io, const dictionary& dict) + : + Sine<Type>(io, dict) + {} + //- Copy construct explicit Cosine(const Cosine<Type>& rhs) : diff --git a/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.C b/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.C index 84900b63f74cf60a617fc04761042f4b04680bb6..1cd7c61d0b3795b2cb2ea79b5c4437ff4c4834d3 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.C +++ b/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.C @@ -54,6 +54,14 @@ Foam::Function1<Type>::Function1(const Function1<Type>& rhs) {} +template<class Type> +Foam::Function1<Type>::Function1(const IOobject& io, const dictionary& dict) +: + function1Base(io, dict) +{} + + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> @@ -126,6 +134,17 @@ Foam::FieldFunction1<Function1Type>::FieldFunction1 {} +template<class Function1Type> +Foam::FieldFunction1<Function1Type>::FieldFunction1 +( + const IOobject& io, + const dictionary& dict +) +: + Function1Type(io, dict) +{} + + template<class Function1Type> Foam::tmp<Foam::Function1<typename Function1Type::returnType>> Foam::FieldFunction1<Function1Type>::clone() const @@ -163,9 +182,10 @@ void Foam::Function1<Type>::writeEntries(Ostream& os) const template<class Type> -void Foam::Function1<Type>::writeData(Ostream& os) const +bool Foam::Function1<Type>::writeData(Ostream& os) const { - os.writeKeyword(name_) << type(); + os.writeKeyword(name()) << type(); + return os.good(); } diff --git a/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.H b/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.H index 41d4f5e06e5e3212c4fa7acdb396c12c849315df..b1dfd1aeadc52b6b77b663728ec1bb2985b1103c 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.H +++ b/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.H @@ -152,6 +152,12 @@ public: //- Construct and return a clone virtual tmp<Function1<Type>> clone() const = 0; + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return refPtr<regIOobject>(clone()); + } + // Selectors @@ -191,6 +197,52 @@ public: ); + // Caching Selectors - accept wildcards in dictionary + + //- Selector with external storage of Function1. + //- This also allows wildcard matches in a dictionary + static refPtr<Function1<Type>> New + ( + HashPtrTable<Function1<Type>>& cache, + const word& entryName, + const dictionary& dict, + enum keyType::option matchOpt = keyType::LITERAL, + const bool mandatory = true + ); + + //- Selector, without fallback redirection + static refPtr<Function1<Type>> New + ( + const IOobject& io, + const dictionary& dict, + enum keyType::option matchOpt = keyType::LITERAL, + const bool mandatory = true + ); + + + // Constructors from IOobject + + //- Declare runtime constructor selection table + declareRunTimeSelectionTable + ( + refPtr, + Function1, + IOobject, + ( + const IOobject& io, + const dictionary& dict + ), + (io, dict) + ); + + //- Construct from IOobject and dictionary (unused) + Function1 + ( + const IOobject& io, + const dictionary& dict + ); + + //- Destructor virtual ~Function1() = default; @@ -228,7 +280,7 @@ public: //- Write in dictionary format. // \note The base output is \em without an END_STATEMENT - virtual void writeData(Ostream& os) const; + virtual bool writeData(Ostream& os) const; //- Write coefficient entries in dictionary format void writeEntries(Ostream& os) const; @@ -254,9 +306,22 @@ public: //- Construct from entry name and dictionary FieldFunction1(const word& entryName, const dictionary& dict); + //- Construct from IOobject and dictionary (unused) + FieldFunction1 + ( + const IOobject& io, + const dictionary& dict + ); + //- Construct and return a clone virtual tmp<Function1<Type>> clone() const; + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return refPtr<regIOobject>(clone()); + } + //- Destructor virtual ~FieldFunction1() = default; @@ -325,6 +390,23 @@ public: makeConcreteFunction1(SS, scalar); + +// Define a non-templated Function1 and add to (templated) run-time selection +#define makeConcreteIOobjectFunction1(SS, Type) \ + \ + Function1<Type>::addIOobjectConstructorToTable \ + <FieldFunction1<SS>> \ + add##SS##Type##IOobjectConstructorToTable_; + +// Define a non-templated Function1 and add to (templated) run-time selection +#define makeIOobjectFunction1Type(SS, Type) \ + \ + Function1<Type>::addIOobjectConstructorToTable \ + <FieldFunction1<Function1Types::SS<Type>>> \ + add##SS##Type##IOobjectConstructorToTable_; + + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository diff --git a/src/OpenFOAM/primitives/functions/Function1/Function1/Function1New.C b/src/OpenFOAM/primitives/functions/Function1/Function1/Function1New.C index 3e8727606aa0a802092a5f96b1370c3022493055..71fd732b8eaf38efd0c166571b1af878751e8122 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Function1/Function1New.C +++ b/src/OpenFOAM/primitives/functions/Function1/Function1/Function1New.C @@ -209,4 +209,177 @@ Foam::Function1<Type>::NewIfPresent } +template<class Type> +Foam::refPtr<Foam::Function1<Type>> +Foam::Function1<Type>::New +( + HashPtrTable<Function1<Type>>& cache, + + const word& entryName, + const dictionary& dict, + enum keyType::option matchOpt, + const bool mandatory +) +{ + // Use the dictionary to find the keyword (allowing wildcards). + // Alternative would be to have + // a HashTable where the key type uses a wildcard match + + + refPtr<Function1<Type>> fref; // return value + + // Try for direct cache hit + fref.cref(cache.get(entryName)); + + if (fref) + { + return fref; + } + + + // Lookup from dictionary + const entry* eptr = dict.findEntry(entryName, matchOpt); + + if (eptr) + { + // Use keyword (potentially a wildcard) instead of entry name + const auto& kw = eptr->keyword(); + + // Try for a cache hit + fref.cref(cache.get(kw)); + + if (!fref) + { + // Create new entry + auto fauto + ( + Function1<Type>::New + ( + kw, + eptr, // Already resolved + dict, + word::null, + mandatory + ) + ); + + if (fauto) + { + // Cache the newly created function + fref.cref(fauto.get()); + cache.set(kw, fauto); + } + } + } + + if (mandatory && !fref) + { + FatalIOErrorInFunction(dict) + << "No match for " << entryName << nl + << exit(FatalIOError); + } + + return fref; +} + + +template<class Type> +Foam::refPtr<Foam::Function1<Type>> +Foam::Function1<Type>::New +( + const IOobject& io, + const dictionary& dict, + enum keyType::option matchOpt, + const bool mandatory +) +{ + // Use the dictionary to find the keyword (allowing wildcards). + // Alternative would be to have + // a HashTable where the key type uses a wildcard match + + + refPtr<Function1<Type>> fref; // return value + + // Lookup from dictionary + const entry* eptr = dict.findEntry(io.name(), matchOpt); + + const dictionary* coeffs = (eptr ? eptr->dictPtr() : nullptr); + + word modelType; + + if (coeffs) + { + // Dictionary entry + + DebugInFunction + << "For " << io.name() << " with dictionary entries: " + << flatOutput(coeffs->toc()) << nl; + + coeffs->readEntry + ( + "type", + modelType, + keyType::LITERAL, + modelType.empty() // "type" entry is mandatory if no 'redirect' + ); + + auto* ctorPtr = IOobjectConstructorTable(modelType); + + if (ctorPtr) + { + fref = ctorPtr(io, *coeffs); + } + + // Fallthrough + } + else if (eptr) + { + // Use keyword (potentially a wildcard) instead of entry name + //const auto& kw = eptr->keyword(); + + ITstream& is = eptr->stream(); + + if (is.peek().isWord()) + { + modelType = is.peek().wordToken(); + } +// else +// { +// // A value - compatibility for reading constant +// +// const Type constValue = pTraits<Type>(is); +// +// return autoPtr<Function1<Type>> +// ( +// new Function1Types::Constant<Type>(io.name(), constValue) +// ); +// } + + Pout<< "io:" << io.name() + << " kw:" << eptr->keyword() + << " modelType:" << modelType + << endl; + + auto* ctorPtr = IOobjectConstructorTable(modelType); + + if (ctorPtr) + { + fref = ctorPtr(io, *coeffs); + } + } + + if (mandatory && !fref) + { + FatalIOErrorInFunction(dict) + << "Unknown Function1 type " + << modelType << " for " << io.name() + << "\n\nValid Function1 types :\n" + << IOobjectConstructorTablePtr_->sortedToc() << nl + << exit(FatalIOError); + } + + return fref; +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/functions/Function1/Function1/function1Base.C b/src/OpenFOAM/primitives/functions/Function1/Function1/function1Base.C index c4a6e0a19403ebd198665bb000dd73325f8f5efe..37db62628cea2d4768e7662f575c41d336e36e95 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Function1/function1Base.C +++ b/src/OpenFOAM/primitives/functions/Function1/Function1/function1Base.C @@ -32,8 +32,19 @@ License Foam::function1Base::function1Base(const word& entryName) : - refCount(), - name_(entryName) + regIOobject + ( + IOobject + ( + entryName, + "constant", // instance + Time::null, // objectRegistry + IOobject::NO_READ, + IOobject::NO_WRITE, + false // registerObject + ) + ), + refCount() {} @@ -43,18 +54,44 @@ Foam::function1Base::function1Base const dictionary& dict ) : - refCount(), - name_(entryName) + regIOobject + ( + IOobject + ( + entryName, + "constant", // instance + Time::null, // objectRegistry + IOobject::NO_READ, + IOobject::NO_WRITE, + false // registerObject + ) + ), + refCount() {} Foam::function1Base::function1Base(const function1Base& rhs) : - refCount(), - name_(rhs.name_) + regIOobject(rhs), + refCount() {} +Foam::function1Base::function1Base(const IOobject& io) +: + regIOobject(io), + refCount() +{} + + +Foam::function1Base::function1Base(const IOobject& io, const dictionary& dict) +: + regIOobject(io), + refCount() +{} + + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::function1Base::convertTimeBase(const Time& t) diff --git a/src/OpenFOAM/primitives/functions/Function1/Function1/function1Base.H b/src/OpenFOAM/primitives/functions/Function1/Function1/function1Base.H index a3191c7924e4e5ccb4a5ec834b8b92081b327748..d232d3c27f8f11aa79731c901408abe84442c3dd 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Function1/function1Base.H +++ b/src/OpenFOAM/primitives/functions/Function1/Function1/function1Base.H @@ -43,6 +43,8 @@ SourceFiles #define function1Base_H #include "dictionary.H" +#include "regIOobject.H" +#include "Time.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -50,7 +52,7 @@ namespace Foam { // Forward Declarations -class Time; +//class Time; /*---------------------------------------------------------------------------*\ Class function1Base Declaration @@ -58,16 +60,11 @@ class Time; class function1Base : + public regIOobject, public refCount { protected: - // Protected Data - - //- Name of entry - const word name_; - - // Protected Member Functions //- No copy assignment @@ -87,20 +84,15 @@ public: //- Copy construct explicit function1Base(const function1Base& rhs); + //- Construct from IOobject + function1Base(const IOobject& io); - //- Destructor - virtual ~function1Base() = default; + //- Construct from IOobject and dictionary (unused) + function1Base(const IOobject& io, const dictionary& dict); - // Member Functions - - // Access - - //- The name of the entry - const word& name() const - { - return name_; - } + //- Destructor + virtual ~function1Base() = default; // Manipulation diff --git a/src/OpenFOAM/primitives/functions/Function1/LimitRange/LimitRange.C b/src/OpenFOAM/primitives/functions/Function1/LimitRange/LimitRange.C index 8578cec6b7e8779943196bec507b58452fa8d97e..2699afa9cf877424555a0c078df950442f1aa077 100644 --- a/src/OpenFOAM/primitives/functions/Function1/LimitRange/LimitRange.C +++ b/src/OpenFOAM/primitives/functions/Function1/LimitRange/LimitRange.C @@ -30,7 +30,7 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class Type> -void Foam::Function1Types::LimitRange<Type>::read(const dictionary& coeffs) +void Foam::Function1Types::LimitRange<Type>::readDict(const dictionary& coeffs) { min_ = coeffs.get<scalar>("min"); max_ = coeffs.get<scalar>("max"); @@ -47,7 +47,20 @@ Foam::Function1Types::LimitRange<Type>::LimitRange : Function1<Type>(entryName) { - read(dict); + readDict(dict); +} + + +template<class Type> +Foam::Function1Types::LimitRange<Type>::LimitRange +( + const IOobject& io, + const dictionary& dict +) +: + Function1<Type>(io, dict) +{ + readDict(dict); } @@ -73,7 +86,7 @@ void Foam::Function1Types::LimitRange<Type>::writeEntries(Ostream& os) const template<class Type> -void Foam::Function1Types::LimitRange<Type>::writeData(Ostream& os) const +bool Foam::Function1Types::LimitRange<Type>::writeData(Ostream& os) const { Function1<Type>::writeData(os); os << token::END_STATEMENT << nl; @@ -81,6 +94,8 @@ void Foam::Function1Types::LimitRange<Type>::writeData(Ostream& os) const os.beginBlock(word(this->name() + "Coeffs")); writeEntries(os); os.endBlock(); + + return os.good(); } diff --git a/src/OpenFOAM/primitives/functions/Function1/LimitRange/LimitRange.H b/src/OpenFOAM/primitives/functions/Function1/LimitRange/LimitRange.H index e167ebba3cb6a9cfb183faf60ee2f0abde11a3c8..0eaa4e5a67d8f6ab5f4e2d106d3b52349fe22fbb 100644 --- a/src/OpenFOAM/primitives/functions/Function1/LimitRange/LimitRange.H +++ b/src/OpenFOAM/primitives/functions/Function1/LimitRange/LimitRange.H @@ -118,7 +118,7 @@ class LimitRange // Private Member Functions //- Read the coefficients from the given dictionary - void read(const dictionary& coeffs); + void readDict(const dictionary& coeffs); public: @@ -138,6 +138,9 @@ public: //- Construct from entry name and dictionary LimitRange(const word& entryName, const dictionary& dict); + //- Construct from IOobject and dictionary + LimitRange(const IOobject& io, const dictionary& dict); + //- Copy construct explicit LimitRange(const LimitRange<Type>& rhs); @@ -155,7 +158,7 @@ public: virtual inline Type integrate(const scalar x1, const scalar x2) const; //- Write in dictionary format - virtual void writeData(Ostream& os) const; + virtual bool writeData(Ostream& os) const; //- Write coefficient entries in dictionary format void writeEntries(Ostream& os) const; diff --git a/src/OpenFOAM/primitives/functions/Function1/One/OneConstant.C b/src/OpenFOAM/primitives/functions/Function1/One/OneConstant.C index f95259c44649afcf23b780996f5a33b5b206b44c..6dc19d0570363c8c5cb5dcbb1afa18bdb519ff6a 100644 --- a/src/OpenFOAM/primitives/functions/Function1/One/OneConstant.C +++ b/src/OpenFOAM/primitives/functions/Function1/One/OneConstant.C @@ -47,6 +47,17 @@ Foam::Function1Types::OneConstant<Type>::OneConstant {} +template<class Type> +Foam::Function1Types::OneConstant<Type>::OneConstant +( + const IOobject& io, + const dictionary& dict +) +: + Function1<Type>(io, dict) +{} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> @@ -71,11 +82,12 @@ Foam::tmp<Foam::Field<Type>> Foam::Function1Types::OneConstant<Type>::integrate template<class Type> -void Foam::Function1Types::OneConstant<Type>::writeData(Ostream& os) const +bool Foam::Function1Types::OneConstant<Type>::writeData(Ostream& os) const { Function1<Type>::writeData(os); + os.endEntry(); - os << token::END_STATEMENT << nl; + return os.good(); } diff --git a/src/OpenFOAM/primitives/functions/Function1/One/OneConstant.H b/src/OpenFOAM/primitives/functions/Function1/One/OneConstant.H index a072e0432d1b38e3c33fc666fee4bad4e7defc04..33aa864502c6db9d1e3c5ea7912d0594bdd1fed7 100644 --- a/src/OpenFOAM/primitives/functions/Function1/One/OneConstant.H +++ b/src/OpenFOAM/primitives/functions/Function1/One/OneConstant.H @@ -81,6 +81,9 @@ public: //- Construct from entry name and dictionary OneConstant(const word& entryName, const dictionary& dict); + //- Construct from IOobject and dictionary + OneConstant(const IOobject& io, const dictionary& dict); + //- Construct and return a clone virtual tmp<Function1<Type>> clone() const { @@ -111,7 +114,7 @@ public: ) const; //- Write as primitive (inline) format - virtual void writeData(Ostream& os) const; + virtual bool writeData(Ostream& os) const; }; diff --git a/src/OpenFOAM/primitives/functions/Function1/Polynomial/PolynomialEntry.C b/src/OpenFOAM/primitives/functions/Function1/Polynomial/PolynomialEntry.C index b5b2cc6cfed6e84a0bc4612d548ea4a2932e899b..a92a97ef53c43f7a6b73613f86b26025f65014a6 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Polynomial/PolynomialEntry.C +++ b/src/OpenFOAM/primitives/functions/Function1/Polynomial/PolynomialEntry.C @@ -100,6 +100,45 @@ Foam::Function1Types::Polynomial<Type>::Polynomial } +template<class Type> +Foam::Function1Types::Polynomial<Type>::Polynomial +( + const IOobject& io, + const dictionary& dict +) +: + Function1<Type>(io.name(), dict), + coeffs_(), + canIntegrate_(true) +{ + const entry* eptr = dict.findEntry(io.name(), keyType::LITERAL); + + if (eptr && eptr->isStream()) + { + // Primitive (inline) format. Eg, + // key polynomial ((0 0) (10 1)); + + ITstream& is = eptr->stream(); + if (is.peek().isWord()) + { + is.skip(); // Discard leading 'polynomial' + } + is >> this->coeffs_; + dict.checkITstream(is, io.name()); + } + else + { + // Dictionary format - "values" lookup. Eg, + // + // key { type polynomial; coeffs ((0 0) (10 1)); } + + dict.readEntry("coeffs", this->coeffs_); + } + + this->checkCoefficients(); +} + + template<class Type> Foam::Function1Types::Polynomial<Type>::Polynomial ( @@ -197,11 +236,13 @@ Type Foam::Function1Types::Polynomial<Type>::integrate template<class Type> -void Foam::Function1Types::Polynomial<Type>::writeData(Ostream& os) const +bool Foam::Function1Types::Polynomial<Type>::writeData(Ostream& os) const { Function1<Type>::writeData(os); os << nl << indent << coeffs_ << token::END_STATEMENT << nl; + + return os.good(); } diff --git a/src/OpenFOAM/primitives/functions/Function1/Polynomial/PolynomialEntry.H b/src/OpenFOAM/primitives/functions/Function1/Polynomial/PolynomialEntry.H index 6fc5cf924973d15fcbd175e0bb2b90a321b0e951..969a7569dab0668dca88c1dc263b681864c276f8 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Polynomial/PolynomialEntry.H +++ b/src/OpenFOAM/primitives/functions/Function1/Polynomial/PolynomialEntry.H @@ -111,6 +111,9 @@ public: //- Construct from entry name and dictionary Polynomial(const word& entryName, const dictionary& dict); + //- Construct from IOobject and dictionary + Polynomial(const IOobject& io, const dictionary& dict); + //- Construct from components Polynomial ( @@ -144,7 +147,7 @@ public: virtual Type integrate(const scalar x1, const scalar x2) const; //- Write as primitive (inline) format - virtual void writeData(Ostream& os) const; + virtual bool writeData(Ostream& os) const; }; diff --git a/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.C b/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.C index 76bb810eeed466ea572eeaabaf55fe0eefbe872c..028bad7bd6cd26059b2f02dee7092560c7885fd9 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.C +++ b/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.C @@ -31,7 +31,7 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class Type> -void Foam::Function1Types::Scale<Type>::read(const dictionary& coeffs) +void Foam::Function1Types::Scale<Type>::readDict(const dictionary& coeffs) { scale_ = Function1<scalar>::New("scale", coeffs); value_ = Function1<Type>::New("value", coeffs); @@ -47,7 +47,20 @@ Foam::Function1Types::Scale<Type>::Scale : Function1<Type>(entryName) { - read(dict); + readDict(dict); +} + + +template<class Type> +Foam::Function1Types::Scale<Type>::Scale +( + const IOobject& io, + const dictionary& dict +) +: + Function1<Type>(io, dict) +{ + readDict(dict); } @@ -71,7 +84,7 @@ void Foam::Function1Types::Scale<Type>::writeEntries(Ostream& os) const template<class Type> -void Foam::Function1Types::Scale<Type>::writeData(Ostream& os) const +bool Foam::Function1Types::Scale<Type>::writeData(Ostream& os) const { Function1<Type>::writeData(os); os << token::END_STATEMENT << nl; @@ -79,6 +92,8 @@ void Foam::Function1Types::Scale<Type>::writeData(Ostream& os) const os.beginBlock(word(this->name() + "Coeffs")); writeEntries(os); os.endBlock(); + + return os.good(); } diff --git a/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.H b/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.H index 7077203b59ca6eb4f2087e129f1c48d21beb3622..7c741fe64a2f715a7433ae9341e24b054d1996f5 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.H +++ b/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.H @@ -105,7 +105,7 @@ class Scale // Private Member Functions //- Read the coefficients from the given dictionary - void read(const dictionary& coeffs); + void readDict(const dictionary& coeffs); public: @@ -129,6 +129,13 @@ public: const dictionary& dict ); + //- Construct from IOobject and dictionary + Scale + ( + const IOobject& io, + const dictionary& dict + ); + //- Copy construct explicit Scale(const Scale<Type>& rhs); @@ -143,7 +150,7 @@ public: virtual inline Type value(const scalar t) const; //- Write in dictionary format - virtual void writeData(Ostream& os) const; + virtual bool writeData(Ostream& os) const; //- Write coefficient entries in dictionary format void writeEntries(Ostream& os) const; diff --git a/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.C b/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.C index bfcafed6db847408a18d2f781dea061fc5f158ba..0d89a0332549cd170c49f16c4908ae43a7595839 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.C +++ b/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.C @@ -52,6 +52,28 @@ Foam::Function1Types::Sine<Type>::Sine } +template<class Type> +Foam::Function1Types::Sine<Type>::Sine +( + const IOobject& io, + const dictionary& dict +) +: + Function1<Type>(io, dict), + t0_(dict.getOrDefault<scalar>("t0", 0)), + amplitude_(Function1<scalar>::NewIfPresent("amplitude", dict)), + period_(Function1<scalar>::NewIfPresent("period", dict)), + frequency_(nullptr), + scale_(Function1<Type>::New("scale", dict)), + level_(Function1<Type>::New("level", dict)) +{ + if (!period_) + { + frequency_ = Function1<scalar>::New("frequency", dict); + } +} + + template<class Type> Foam::Function1Types::Sine<Type>::Sine(const Sine<Type>& rhs) : @@ -96,7 +118,7 @@ void Foam::Function1Types::Sine<Type>::writeEntries(Ostream& os) const template<class Type> -void Foam::Function1Types::Sine<Type>::writeData(Ostream& os) const +bool Foam::Function1Types::Sine<Type>::writeData(Ostream& os) const { Function1<Type>::writeData(os); os.endEntry(); @@ -104,6 +126,8 @@ void Foam::Function1Types::Sine<Type>::writeData(Ostream& os) const os.beginBlock(word(this->name() + "Coeffs")); writeEntries(os); os.endBlock(); + + return os.good(); } diff --git a/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.H b/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.H index 64096352e7cdf5878e17c1417cc57f0a1fb78905..475c4a753c06130e7ab4cfeee1879fa9bc7a2795 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.H +++ b/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.H @@ -184,6 +184,9 @@ public: //- Construct from entry name and dictionary Sine(const word& entryName, const dictionary& dict); + //- Construct from IOobject and dictionary + Sine(const IOobject& io, const dictionary& dict); + //- Copy construct explicit Sine(const Sine<Type>& rhs); @@ -204,7 +207,7 @@ public: } //- Write in dictionary format - virtual void writeData(Ostream& os) const; + virtual bool writeData(Ostream& os) const; //- Write coefficient entries in dictionary format void writeEntries(Ostream& os) const; diff --git a/src/OpenFOAM/primitives/functions/Function1/Square/Square.C b/src/OpenFOAM/primitives/functions/Function1/Square/Square.C index adc4d91f3582fec700dff459afb55184450f4f33..12167d8f4e8687836ff23a9ab80409aaeae810bd 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Square/Square.C +++ b/src/OpenFOAM/primitives/functions/Function1/Square/Square.C @@ -43,6 +43,19 @@ Foam::Function1Types::Square<Type>::Square {} +template<class Type> +Foam::Function1Types::Square<Type>::Square +( + const IOobject& io, + const dictionary& dict +) +: + Sine<Type>(io, dict), + mark_(dict.getOrDefaultCompat<scalar>("mark", {{"markSpace", 2006}}, 1)), + space_(dict.getOrDefault<scalar>("space", 1)) +{} + + template<class Type> Foam::Function1Types::Square<Type>::Square(const Square<Type>& rhs) : @@ -64,7 +77,7 @@ void Foam::Function1Types::Square<Type>::writeEntries(Ostream& os) const template<class Type> -void Foam::Function1Types::Square<Type>::writeData(Ostream& os) const +bool Foam::Function1Types::Square<Type>::writeData(Ostream& os) const { Function1<Type>::writeData(os); os.endEntry(); @@ -72,6 +85,8 @@ void Foam::Function1Types::Square<Type>::writeData(Ostream& os) const os.beginBlock(word(this->name() + "Coeffs")); writeEntries(os); os.endBlock(); + + return os.good(); } diff --git a/src/OpenFOAM/primitives/functions/Function1/Square/Square.H b/src/OpenFOAM/primitives/functions/Function1/Square/Square.H index c79f6e12f3d3292bb0777de9f9393b236a4f6062..a5e4dbf3d2fc76b21d5c4ed0af22988d13237db4 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Square/Square.H +++ b/src/OpenFOAM/primitives/functions/Function1/Square/Square.H @@ -147,6 +147,9 @@ public: //- Construct from entry name and dictionary Square(const word& entryName, const dictionary& dict); + //- Construct from IOobject and dictionary + Square(const IOobject& io, const dictionary& dict); + //- Copy construct explicit Square(const Square<Type>& rhs); @@ -164,7 +167,7 @@ public: } //- Write in dictionary format - virtual void writeData(Ostream& os) const; + virtual bool writeData(Ostream& os) const; //- Write coefficient entries in dictionary format void writeEntries(Ostream& os) const; diff --git a/src/OpenFOAM/primitives/functions/Function1/Table/Table.C b/src/OpenFOAM/primitives/functions/Function1/Table/Table.C index cb57b8750231aeec565531f740759bbd53ef2e93..1709940a6e24792c9cc3101f60635d5f80eb828c 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Table/Table.C +++ b/src/OpenFOAM/primitives/functions/Function1/Table/Table.C @@ -88,6 +88,64 @@ Foam::Function1Types::Table<Type>::Table } +template<class Type> +Foam::Function1Types::Table<Type>::Table +( + const IOobject& io, + const dictionary& dict +) +: + TableBase<Type>(io, dict), + fName_() +{ + const entry* eptr = dict.findEntry(io.name(), keyType::LITERAL); + + if (eptr && eptr->isStream()) + { + // Primitive (inline) format. Eg, + // key table ((0 0) (10 1)); + + ITstream& is = eptr->stream(); + if (is.peek().isWord()) + { + is.skip(); // Discard leading 'table' + } + is >> this->table_; + dict.checkITstream(is, io.name()); + } + else if (dict.readIfPresent("file", fName_)) + { + // Dictionary format - "file" lookup. Eg, + // key { type table; file "name"; } + + fileName expandedFile(fName_); + expandedFile.expand(); + + autoPtr<ISstream> isPtr(fileHandler().NewIFstream(expandedFile)); + if (isPtr && isPtr->good()) + { + *isPtr >> this->table_; + } + else + { + FatalIOErrorInFunction(dict) + << "Cannot open file: " << expandedFile << nl + << exit(FatalIOError); + } + } + else + { + // Dictionary format - "values" lookup. Eg, + // + // key { type table; values ((0 0) (10 1)); } + + dict.readEntry("values", this->table_); + } + + TableBase<Type>::check(); +} + + template<class Type> Foam::Function1Types::Table<Type>::Table(const Table<Type>& tbl) : @@ -99,7 +157,7 @@ Foam::Function1Types::Table<Type>::Table(const Table<Type>& tbl) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> -void Foam::Function1Types::Table<Type>::writeData(Ostream& os) const +bool Foam::Function1Types::Table<Type>::writeData(Ostream& os) const { Function1<Type>::writeData(os); os.endEntry(); @@ -120,6 +178,8 @@ void Foam::Function1Types::Table<Type>::writeData(Ostream& os) const } os.endBlock(); + + return os.good(); } diff --git a/src/OpenFOAM/primitives/functions/Function1/Table/Table.H b/src/OpenFOAM/primitives/functions/Function1/Table/Table.H index 154e18c8e2c18f85f3930285146bef165117c71c..eafaced95fc1f696c7c7d219d7c7aafd3799d8c0 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Table/Table.H +++ b/src/OpenFOAM/primitives/functions/Function1/Table/Table.H @@ -122,6 +122,9 @@ public: //- Construct from entry name and dictionary. Table(const word& entryName, const dictionary& dict); + //- Construct from IOobject and dictionary + Table(const IOobject& io, const dictionary& dict); + //- Copy construct explicit Table(const Table<Type>& tbl); @@ -139,7 +142,7 @@ public: // Member Functions //- Write coefficients in dictionary format - virtual void writeData(Ostream& os) const; + virtual bool writeData(Ostream& os) const; }; diff --git a/src/OpenFOAM/primitives/functions/Function1/Table/TableBase.C b/src/OpenFOAM/primitives/functions/Function1/Table/TableBase.C index 497e4b4cd6c61260baf8bc69b57d727f52fc2e43..1710d7b63d7652d22779e776689ae91ab3be1ce1 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Table/TableBase.C +++ b/src/OpenFOAM/primitives/functions/Function1/Table/TableBase.C @@ -91,6 +91,39 @@ Foam::Function1Types::TableBase<Type>::TableBase {} +template<class Type> +Foam::Function1Types::TableBase<Type>::TableBase +( + const IOobject& io, + const dictionary& dict +) +: + Function1<Type>(io, dict), + bounding_ + ( + bounds::repeatableBoundingNames.getOrDefault + ( + "outOfBounds", + dict, + bounds::repeatableBounding::CLAMP, + true // Failsafe behaviour + ) + ), + interpolationScheme_ + ( + dict.getOrDefault<word> + ( + "interpolationScheme", + "linear", + keyType::LITERAL + ) + ), + table_(), + tableSamplesPtr_(nullptr), + interpolatorPtr_(nullptr) +{} + + template<class Type> Foam::Function1Types::TableBase<Type>::TableBase(const TableBase<Type>& tbl) : @@ -372,11 +405,12 @@ void Foam::Function1Types::TableBase<Type>::writeEntries(Ostream& os) const template<class Type> -void Foam::Function1Types::TableBase<Type>::writeData(Ostream& os) const +bool Foam::Function1Types::TableBase<Type>::writeData(Ostream& os) const { Function1<Type>::writeData(os); os << nl << indent << table_ << token::END_STATEMENT << nl; writeEntries(os); + return os.good(); } diff --git a/src/OpenFOAM/primitives/functions/Function1/Table/TableBase.H b/src/OpenFOAM/primitives/functions/Function1/Table/TableBase.H index 57b05c7f2ba3b9260251f0f9ad88596f64110d61..b25542bb697b676679782aa9bea09dc182b2511d 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Table/TableBase.H +++ b/src/OpenFOAM/primitives/functions/Function1/Table/TableBase.H @@ -103,6 +103,9 @@ public: //- Construct from dictionary - note table is not populated TableBase(const word& name, const dictionary& dict); + //- Construct from IOobject and dictionary + TableBase(const IOobject& io, const dictionary& dict); + //- Copy constructor. Note: steals interpolator, tableSamples explicit TableBase(const TableBase<Type>& tbl); @@ -138,7 +141,7 @@ public: virtual tmp<Field<Type>> y() const; //- Write all table data in dictionary format - virtual void writeData(Ostream& os) const; + virtual bool writeData(Ostream& os) const; //- Write keywords only in dictionary format. // Used for non-inline table types diff --git a/src/OpenFOAM/primitives/functions/Function1/TableFile/TableFile.C b/src/OpenFOAM/primitives/functions/Function1/TableFile/TableFile.C index 0f06734ee97abdae41da712c824d2f29a60ded0d..dbde2b0bb97700ca7bb7f8ee2d869589850285cf 100644 --- a/src/OpenFOAM/primitives/functions/Function1/TableFile/TableFile.C +++ b/src/OpenFOAM/primitives/functions/Function1/TableFile/TableFile.C @@ -60,6 +60,36 @@ Foam::Function1Types::TableFile<Type>::TableFile } +template<class Type> +Foam::Function1Types::TableFile<Type>::TableFile +( + const IOobject& io, + const dictionary& dict +) +: + TableBase<Type>(io, dict), + fName_() +{ + dict.readEntry("file", fName_); + + fileName expandedFile(fName_); + + autoPtr<ISstream> isPtr(fileHandler().NewIFstream(expandedFile.expand())); + ISstream& is = *isPtr; + + if (!is.good()) + { + FatalIOErrorInFunction(is) + << "Cannot open file." << nl + << exit(FatalIOError); + } + + is >> this->table_; + + TableBase<Type>::check(); +} + + template<class Type> Foam::Function1Types::TableFile<Type>::TableFile(const TableFile<Type>& tbl) : @@ -71,7 +101,7 @@ Foam::Function1Types::TableFile<Type>::TableFile(const TableFile<Type>& tbl) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> -void Foam::Function1Types::TableFile<Type>::writeData(Ostream& os) const +bool Foam::Function1Types::TableFile<Type>::writeData(Ostream& os) const { Function1<Type>::writeData(os); os.endEntry(); @@ -85,6 +115,8 @@ void Foam::Function1Types::TableFile<Type>::writeData(Ostream& os) const os.writeEntry("file", fName_); os.endBlock(); + + return os.good(); } diff --git a/src/OpenFOAM/primitives/functions/Function1/TableFile/TableFile.H b/src/OpenFOAM/primitives/functions/Function1/TableFile/TableFile.H index cabe6e2d9fc165e4fefe958d2eb2c3de19666ebe..fc604562fd920f19ed72ebdd69a8f9e9399961cb 100644 --- a/src/OpenFOAM/primitives/functions/Function1/TableFile/TableFile.H +++ b/src/OpenFOAM/primitives/functions/Function1/TableFile/TableFile.H @@ -103,6 +103,9 @@ public: //- Construct from entry name and "file" found in dictionary TableFile(const word& entryName, const dictionary& dict); + //- Construct from IOobject and dictionary + TableFile(const IOobject& io, const dictionary& dict); + //- Copy construct explicit TableFile(const TableFile<Type>& tbl); @@ -120,7 +123,7 @@ public: // Member Functions //- Write in dictionary format - virtual void writeData(Ostream& os) const; + virtual bool writeData(Ostream& os) const; }; diff --git a/src/OpenFOAM/primitives/functions/Function1/Uniform/Uniform.C b/src/OpenFOAM/primitives/functions/Function1/Uniform/Uniform.C index fa48a8b659149854b1d86a7dc030fb6d8f3573d2..cd4af3a12e643c797fd46ede775bfec5cfc5751a 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Uniform/Uniform.C +++ b/src/OpenFOAM/primitives/functions/Function1/Uniform/Uniform.C @@ -40,4 +40,15 @@ Foam::Function1Types::Uniform<Type>::Uniform {} +template<class Type> +Foam::Function1Types::Uniform<Type>::Uniform +( + const IOobject& io, + const dictionary& dict +) +: + Constant<Type>(io, dict) +{} + + // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/functions/Function1/Uniform/Uniform.H b/src/OpenFOAM/primitives/functions/Function1/Uniform/Uniform.H index 805480f504bd7bf83995b482c80a80d61421111c..5d05c16ef4315e6dd1a95ed529ef69d2dec65371 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Uniform/Uniform.H +++ b/src/OpenFOAM/primitives/functions/Function1/Uniform/Uniform.H @@ -83,6 +83,9 @@ public: //- Construct from entry name and dictionary Uniform(const word& entryName, const dictionary& dict); + + //- Construct from IOobject and dictionary + Uniform(const IOobject& io, const dictionary& dict); }; diff --git a/src/OpenFOAM/primitives/functions/Function1/Zero/ZeroConstant.C b/src/OpenFOAM/primitives/functions/Function1/Zero/ZeroConstant.C index 591e430f624ea280b14f0a48c1eebf411517c5bb..e8c3bb83756a90e53c1928adda20c4dd65d1f866 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Zero/ZeroConstant.C +++ b/src/OpenFOAM/primitives/functions/Function1/Zero/ZeroConstant.C @@ -48,14 +48,26 @@ Foam::Function1Types::ZeroConstant<Type>::ZeroConstant {} +template<class Type> +Foam::Function1Types::ZeroConstant<Type>::ZeroConstant +( + const IOobject& io, + const dictionary& dict +) +: + Function1<Type>(io, dict) +{} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> -void Foam::Function1Types::ZeroConstant<Type>::writeData(Ostream& os) const +bool Foam::Function1Types::ZeroConstant<Type>::writeData(Ostream& os) const { Function1<Type>::writeData(os); + os.endEntry(); - os << token::END_STATEMENT << nl; + return os.good(); } diff --git a/src/OpenFOAM/primitives/functions/Function1/Zero/ZeroConstant.H b/src/OpenFOAM/primitives/functions/Function1/Zero/ZeroConstant.H index 8563f6663d83f19f931892be1d20b878c15c4b80..d4a16c2628c7efa3ac6be4a205a2f66671b9abc2 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Zero/ZeroConstant.H +++ b/src/OpenFOAM/primitives/functions/Function1/Zero/ZeroConstant.H @@ -90,6 +90,9 @@ public: //- Construct from entry name and dictionary ZeroConstant(const word& entryName, const dictionary& dict); + //- Construct from IOobject and dictionary + ZeroConstant(const IOobject& io, const dictionary& dict); + //- Destructor virtual ~ZeroConstant() = default; @@ -104,7 +107,7 @@ public: virtual inline Type integrate(const scalar x1, const scalar x2) const; //- Write as primitive (inline) format - virtual void writeData(Ostream& os) const; + virtual bool writeData(Ostream& os) const; }; diff --git a/src/OpenFOAM/primitives/functions/Function1/halfCosineRamp/halfCosineRamp.C b/src/OpenFOAM/primitives/functions/Function1/halfCosineRamp/halfCosineRamp.C index c41dee31559cb82bd16dbdd7db7ad1aa5b245b68..e206e56e5280a6e529cb683d089e484b9c0315c1 100644 --- a/src/OpenFOAM/primitives/functions/Function1/halfCosineRamp/halfCosineRamp.C +++ b/src/OpenFOAM/primitives/functions/Function1/halfCosineRamp/halfCosineRamp.C @@ -50,4 +50,14 @@ Foam::Function1Types::halfCosineRamp::halfCosineRamp {} +Foam::Function1Types::halfCosineRamp::halfCosineRamp +( + const IOobject& io, + const dictionary& dict +) +: + ramp(io, dict) +{} + + // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/functions/Function1/halfCosineRamp/halfCosineRamp.H b/src/OpenFOAM/primitives/functions/Function1/halfCosineRamp/halfCosineRamp.H index 7d536988e8c75900b7847e1e2cb79531d03d7e9b..526f13d4dec03261dee739c0b64507d5c195fbc3 100644 --- a/src/OpenFOAM/primitives/functions/Function1/halfCosineRamp/halfCosineRamp.H +++ b/src/OpenFOAM/primitives/functions/Function1/halfCosineRamp/halfCosineRamp.H @@ -70,6 +70,9 @@ public: //- Construct from entry name and dictionary halfCosineRamp(const word& entryName, const dictionary& dict); + //- Construct from IOobject and dictionary + halfCosineRamp(const IOobject& io, const dictionary& dict); + //- Destructor virtual ~halfCosineRamp() = default; diff --git a/src/OpenFOAM/primitives/functions/Function1/linearRamp/linearRamp.C b/src/OpenFOAM/primitives/functions/Function1/linearRamp/linearRamp.C index de2aca2812fa0cbdef1b22e144a888a9bc433eb2..1657da829be6a0404dac4b8709439e27d50e6a03 100644 --- a/src/OpenFOAM/primitives/functions/Function1/linearRamp/linearRamp.C +++ b/src/OpenFOAM/primitives/functions/Function1/linearRamp/linearRamp.C @@ -50,4 +50,14 @@ Foam::Function1Types::linearRamp::linearRamp {} +Foam::Function1Types::linearRamp::linearRamp +( + const IOobject& io, + const dictionary& dict +) +: + ramp(io, dict) +{} + + // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/functions/Function1/linearRamp/linearRamp.H b/src/OpenFOAM/primitives/functions/Function1/linearRamp/linearRamp.H index d22271c839ccf515082bfd8aac99d4bbdf5244e6..0016464c9abfe6bc742ba8619516efd822173230 100644 --- a/src/OpenFOAM/primitives/functions/Function1/linearRamp/linearRamp.H +++ b/src/OpenFOAM/primitives/functions/Function1/linearRamp/linearRamp.H @@ -70,6 +70,9 @@ public: //- Construct from entry name and dictionary linearRamp(const word& entryName, const dictionary& dict); + //- Construct from IOobject and dictionary + linearRamp(const IOobject& io, const dictionary& dict); + //- Destructor virtual ~linearRamp() = default; diff --git a/src/OpenFOAM/primitives/functions/Function1/makeFunction1s.C b/src/OpenFOAM/primitives/functions/Function1/makeFunction1s.C index 680c49149c8c8b0a55b4e8e17f1ae69e279947a9..5feeb651ccfd8c7f26d51ff2729bbbaef62c34d9 100644 --- a/src/OpenFOAM/primitives/functions/Function1/makeFunction1s.C +++ b/src/OpenFOAM/primitives/functions/Function1/makeFunction1s.C @@ -81,4 +81,46 @@ namespace Foam } +// Construct from IOobject + +#define makeIOobjectFunction1s(Type) \ + defineTemplateRunTimeSelectionTable \ + ( \ + Function1<Type>, \ + IOobject \ + ); \ + makeIOobjectFunction1Type(Constant, Type); \ + makeIOobjectFunction1Type(Uniform, Type); \ + makeIOobjectFunction1Type(ZeroConstant, Type); \ + makeIOobjectFunction1Type(OneConstant, Type); \ + makeIOobjectFunction1Type(Polynomial, Type); \ + makeIOobjectFunction1Type(Cosine, Type); \ + makeIOobjectFunction1Type(Sine, Type); \ + makeIOobjectFunction1Type(Square, Type); \ + makeIOobjectFunction1Type(CSV, Type); \ + makeIOobjectFunction1Type(Table, Type); \ + makeIOobjectFunction1Type(TableFile, Type); \ + makeIOobjectFunction1Type(Scale, Type); \ + makeIOobjectFunction1Type(LimitRange, Type); + + +namespace Foam +{ + // Add IOobject selection table for label. To be populated. + defineTemplateRunTimeSelectionTable + ( + Function1<label>, + IOobject + ); + + makeIOobjectFunction1s(scalar); + makeIOobjectFunction1s(vector); + makeIOobjectFunction1s(sphericalTensor); + makeIOobjectFunction1s(symmTensor); + makeIOobjectFunction1s(tensor); + + // Tbd: makeIOobjectFieldFunction1s +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/functions/Function1/quadraticRamp/quadraticRamp.C b/src/OpenFOAM/primitives/functions/Function1/quadraticRamp/quadraticRamp.C index ad1ba81e5226fff7a7a7feac2997eda2578e82c1..df056c7c2be35b34831f52f4a18fb2d0c4542632 100644 --- a/src/OpenFOAM/primitives/functions/Function1/quadraticRamp/quadraticRamp.C +++ b/src/OpenFOAM/primitives/functions/Function1/quadraticRamp/quadraticRamp.C @@ -50,4 +50,14 @@ Foam::Function1Types::quadraticRamp::quadraticRamp {} +Foam::Function1Types::quadraticRamp::quadraticRamp +( + const IOobject& io, + const dictionary& dict +) +: + ramp(io, dict) +{} + + // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/functions/Function1/quadraticRamp/quadraticRamp.H b/src/OpenFOAM/primitives/functions/Function1/quadraticRamp/quadraticRamp.H index fcdfaeacb1e407c2d0a8560c89552b34c74e7178..03e8adc8d9e491e782558888811d4d5223085f18 100644 --- a/src/OpenFOAM/primitives/functions/Function1/quadraticRamp/quadraticRamp.H +++ b/src/OpenFOAM/primitives/functions/Function1/quadraticRamp/quadraticRamp.H @@ -70,6 +70,9 @@ public: //- Construct from entry name and dictionary quadraticRamp(const word& entryName, const dictionary& dict); + //- Construct from IOobject and dictionary + quadraticRamp(const IOobject& io, const dictionary& dict); + //- Destructor virtual ~quadraticRamp() = default; diff --git a/src/OpenFOAM/primitives/functions/Function1/quarterCosineRamp/quarterCosineRamp.C b/src/OpenFOAM/primitives/functions/Function1/quarterCosineRamp/quarterCosineRamp.C index c3b0b2085eedfdb4c743be5d0763aaea4683c967..94e6d68867cec6915f3ce0e0d49e110a1fe8dbad 100644 --- a/src/OpenFOAM/primitives/functions/Function1/quarterCosineRamp/quarterCosineRamp.C +++ b/src/OpenFOAM/primitives/functions/Function1/quarterCosineRamp/quarterCosineRamp.C @@ -50,4 +50,14 @@ Foam::Function1Types::quarterCosineRamp::quarterCosineRamp {} +Foam::Function1Types::quarterCosineRamp::quarterCosineRamp +( + const IOobject& io, + const dictionary& dict +) +: + ramp(io, dict) +{} + + // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/functions/Function1/quarterCosineRamp/quarterCosineRamp.H b/src/OpenFOAM/primitives/functions/Function1/quarterCosineRamp/quarterCosineRamp.H index 275d316e4767086d4db2e22a54b805b073050134..cc766f6c6c10407d105928739848ad635877d053 100644 --- a/src/OpenFOAM/primitives/functions/Function1/quarterCosineRamp/quarterCosineRamp.H +++ b/src/OpenFOAM/primitives/functions/Function1/quarterCosineRamp/quarterCosineRamp.H @@ -70,6 +70,9 @@ public: //- Construct from entry name and dictionary quarterCosineRamp(const word& entryName, const dictionary& dict); + //- Construct from IOobject and dictionary + quarterCosineRamp(const IOobject& io, const dictionary& dict); + //- Destructor virtual ~quarterCosineRamp() = default; diff --git a/src/OpenFOAM/primitives/functions/Function1/quarterSineRamp/quarterSineRamp.C b/src/OpenFOAM/primitives/functions/Function1/quarterSineRamp/quarterSineRamp.C index 287c5dfd132a2ee890c1dbedbf5887dd8bfa554a..9ef0acd7e3ff15b183e62bd5f6322b6e7203879e 100644 --- a/src/OpenFOAM/primitives/functions/Function1/quarterSineRamp/quarterSineRamp.C +++ b/src/OpenFOAM/primitives/functions/Function1/quarterSineRamp/quarterSineRamp.C @@ -50,4 +50,14 @@ Foam::Function1Types::quarterSineRamp::quarterSineRamp {} +Foam::Function1Types::quarterSineRamp::quarterSineRamp +( + const IOobject& io, + const dictionary& dict +) +: + ramp(io, dict) +{} + + // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/functions/Function1/quarterSineRamp/quarterSineRamp.H b/src/OpenFOAM/primitives/functions/Function1/quarterSineRamp/quarterSineRamp.H index 37aec55d7e4173bba5406cf2977191220abaf96b..b06339961b70ab186605182ad13d16da650e81e5 100644 --- a/src/OpenFOAM/primitives/functions/Function1/quarterSineRamp/quarterSineRamp.H +++ b/src/OpenFOAM/primitives/functions/Function1/quarterSineRamp/quarterSineRamp.H @@ -69,6 +69,9 @@ public: //- Construct from entry name and dictionary quarterSineRamp(const word& entryName, const dictionary& dict); + //- Construct from IOobject and dictionary + quarterSineRamp(const IOobject& io, const dictionary& dict); + //- Destructor virtual ~quarterSineRamp() = default; diff --git a/src/OpenFOAM/primitives/functions/Function1/ramp/ramp.C b/src/OpenFOAM/primitives/functions/Function1/ramp/ramp.C index 53fb63ccc07e4e1a08f7cf207d5ff1a4654364f5..131f6077a63456441d353637cdaca4fa8762bd3f 100644 --- a/src/OpenFOAM/primitives/functions/Function1/ramp/ramp.C +++ b/src/OpenFOAM/primitives/functions/Function1/ramp/ramp.C @@ -30,7 +30,7 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -void Foam::Function1Types::ramp::read(const dictionary& coeffs) +void Foam::Function1Types::ramp::readDict(const dictionary& coeffs) { start_ = coeffs.getOrDefault<scalar>("start", 0); coeffs.readEntry("duration", duration_); @@ -45,7 +45,19 @@ Foam::Function1Types::ramp::ramp : Function1<scalar>(entryName, dict) { - read(dict); + readDict(dict); +} + + +Foam::Function1Types::ramp::ramp +( + const IOobject& io, + const dictionary& dict +) +: + Function1<scalar>(io, dict) +{ + readDict(dict); } @@ -65,7 +77,7 @@ void Foam::Function1Types::ramp::convertTimeBase(const Time& t) } -void Foam::Function1Types::ramp::writeData(Ostream& os) const +bool Foam::Function1Types::ramp::writeData(Ostream& os) const { Function1<scalar>::writeData(os); os << token::END_STATEMENT << nl; @@ -73,6 +85,8 @@ void Foam::Function1Types::ramp::writeData(Ostream& os) const os.beginBlock(word(this->name() + "Coeffs")); writeEntries(os); os.endBlock(); + + return os.good(); } diff --git a/src/OpenFOAM/primitives/functions/Function1/ramp/ramp.H b/src/OpenFOAM/primitives/functions/Function1/ramp/ramp.H index df7ed6c00b157f7a5903d6a8e8e890ed0c4b4894..6631722a5f4d1488ad3503b482e3283498a95eac 100644 --- a/src/OpenFOAM/primitives/functions/Function1/ramp/ramp.H +++ b/src/OpenFOAM/primitives/functions/Function1/ramp/ramp.H @@ -109,7 +109,7 @@ private: // Private Member Functions //- Read the coefficients from the given dictionary - void read(const dictionary& coeffs); + void readDict(const dictionary& coeffs); //- No copy assignment void operator=(const ramp&) = delete; @@ -126,6 +126,13 @@ public: const dictionary& dict ); + //- Construct from IOobject and dictionary + ramp + ( + const IOobject& io, + const dictionary& dict + ); + //- Destructor virtual ~ramp() = default; @@ -140,7 +147,7 @@ public: virtual scalar value(const scalar t) const = 0; //- Write in dictionary format - virtual void writeData(Ostream& os) const; + virtual bool writeData(Ostream& os) const; //- Write coefficient entries in dictionary format void writeEntries(Ostream& os) const; diff --git a/src/OpenFOAM/primitives/functions/Function1/step/stepFunction.C b/src/OpenFOAM/primitives/functions/Function1/step/stepFunction.C index 4ab76010f4e0e756d11ef568055b2a17f4a0ad4d..a15c0511f12bcf57df93007e02938c39b0f63e5c 100644 --- a/src/OpenFOAM/primitives/functions/Function1/step/stepFunction.C +++ b/src/OpenFOAM/primitives/functions/Function1/step/stepFunction.C @@ -34,6 +34,9 @@ namespace Foam namespace Function1Types { makeScalarFunction1(stepFunction); + + // IOobject version + makeConcreteIOobjectFunction1(stepFunction, scalar); } } @@ -50,4 +53,14 @@ Foam::Function1Types::stepFunction::stepFunction {} +Foam::Function1Types::stepFunction::stepFunction +( + const IOobject& io, + const dictionary& dict +) +: + ramp(io, dict) +{} + + // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/functions/Function1/step/stepFunction.H b/src/OpenFOAM/primitives/functions/Function1/step/stepFunction.H index e6a6daa638ab0139fb8835afaa217306bdd9326b..84e9aa197448670cbd12ef4c2370f7aa41d4ae0f 100644 --- a/src/OpenFOAM/primitives/functions/Function1/step/stepFunction.H +++ b/src/OpenFOAM/primitives/functions/Function1/step/stepFunction.H @@ -69,6 +69,13 @@ public: //- Construct from entry name and dictionary stepFunction(const word& entryName, const dictionary& dict); + //- Construct from IOobject and dictionary + stepFunction + ( + const IOobject& io, + const dictionary& dict + ); + //- Destructor virtual ~stepFunction() = default; diff --git a/src/dynamicFaMesh/interfaceTrackingFvMesh/surfactantProperties.H b/src/dynamicFaMesh/interfaceTrackingFvMesh/surfactantProperties.H index 3806a61d20ec73d016d4a9fba051f05ac2712516..47e997fec79135fca7a44170cd37d913126372c6 100644 --- a/src/dynamicFaMesh/interfaceTrackingFvMesh/surfactantProperties.H +++ b/src/dynamicFaMesh/interfaceTrackingFvMesh/surfactantProperties.H @@ -183,7 +183,7 @@ public: IOobject ( "dSigma", - surfactConc.mesh().mesh().time().timeName(), + surfactConc.mesh().time().timeName(), surfactConc.mesh().mesh(), IOobject::NO_READ, IOobject::NO_WRITE diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/refinementHistory.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/refinementHistory.H index c0be971d0be4f75f6f5237571e9ae362fe5c5dd0..5c9dad8103ef74be1274e4dee375e0d7b1611670 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/refinementHistory.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/refinementHistory.H @@ -260,6 +260,15 @@ public: // If global number of visible cells > 0 becomes active explicit refinementHistory(const IOobject&, Istream&); + //- Copy construct + explicit refinementHistory(const refinementHistory&) = default; + + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return regIOobject::DeepClone(*this); + } + // Member Functions diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.H b/src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.H index bbfd221950785de586fdada05f3d3d12e915c1a0..6b0351e452b0d9c446591b8af4879b1910b0984a 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.H @@ -101,6 +101,13 @@ public: // Uses read-option READ_IF_PRESENT explicit polyTopoChanger(polyMesh& mesh); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~polyTopoChanger() = default; diff --git a/src/finiteArea/edgeMesh/edgeFaMesh.H b/src/finiteArea/edgeMesh/edgeFaMesh.H index e726f628810aa8c60b82f12d6f8b02f213817364..351f24a3cd0aa33b4c39f2c51aabc479b709c7f0 100644 --- a/src/finiteArea/edgeMesh/edgeFaMesh.H +++ b/src/finiteArea/edgeMesh/edgeFaMesh.H @@ -65,6 +65,7 @@ public: GeoMesh<faMesh>(mesh) {} + // Member Functions //- Return size. Number of internal edges diff --git a/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.H b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.H index b39d19aeffa57bcb9993c40a4f203dc50c717642..368364311a715dc87362c979e38706695b67ee20 100644 --- a/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.H +++ b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.H @@ -115,6 +115,13 @@ public: const label size ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor ~faBoundaryMesh() = default; diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.H b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.H index 229bbfc2c52e6e3c372583539312bdcc71bfd1b5..267c0d5e91d382c493b22c698d53dc9335f2bce6 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.H +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.H @@ -213,6 +213,13 @@ public: const word& cellZoneName = word::null ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~porosityModel() = default; diff --git a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.H b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.H index 14c06b7de27fb679293cc56336b82107c8262af7..b6602d78706997de72e91a0d0029c91a6f2124e7 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.H +++ b/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/solutionControl.H @@ -199,6 +199,13 @@ public: //- Construct from mesh solutionControl(fvMesh& mesh, const word& algorithmName); + //- Return a clone. Not applicable for singleton + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~solutionControl() = default; diff --git a/src/finiteVolume/expressions/base/fvExprDriverWriter.H b/src/finiteVolume/expressions/base/fvExprDriverWriter.H index 7553251c316ea34054202bcc6346dd84326a4991..104e88d2a2ad7dfcf6d7f30e3d2ca9ee98c3870a 100644 --- a/src/finiteVolume/expressions/base/fvExprDriverWriter.H +++ b/src/finiteVolume/expressions/base/fvExprDriverWriter.H @@ -85,6 +85,13 @@ public: //- Construct for named driver fvExprDriverWriter(const word& name, fvExprDriver& driver); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~fvExprDriverWriter() = default; diff --git a/src/finiteVolume/fields/surfaceFields/surfaceFields.C b/src/finiteVolume/fields/surfaceFields/surfaceFields.C index fd24f7d060c7022ee898eb479602194eed184f66..22f80cfef86bbd2eb76f2cd7c0e22c9b699f6aa0 100644 --- a/src/finiteVolume/fields/surfaceFields/surfaceFields.C +++ b/src/finiteVolume/fields/surfaceFields/surfaceFields.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -26,14 +27,13 @@ License \*---------------------------------------------------------------------------*/ #include "surfaceFields.H" +#include "addToRunTimeSelectionTable.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - defineTemplate2TypeNameAndDebug ( surfaceScalarField::Internal, @@ -67,8 +67,15 @@ defineTemplateTypeNameAndDebug(surfaceSphericalTensorField, 0); defineTemplateTypeNameAndDebug(surfaceSymmTensorField, 0); defineTemplateTypeNameAndDebug(surfaceTensorField, 0); +addToRunTimeSelectionTable(regIOobject, surfaceScalarField, IOobject); +addToRunTimeSelectionTable(regIOobject, surfaceVectorField, IOobject); +addToRunTimeSelectionTable(regIOobject, surfaceSphericalTensorField, IOobject); +addToRunTimeSelectionTable(regIOobject, surfaceSymmTensorField, IOobject); +addToRunTimeSelectionTable(regIOobject, surfaceTensorField, IOobject); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fields/volFields/volFields.C b/src/finiteVolume/fields/volFields/volFields.C index 768fe459141cfda909ea0b544309619ca419c3d9..f1358ae819f66cd9df1e7aad55e26d02993acec8 100644 --- a/src/finiteVolume/fields/volFields/volFields.C +++ b/src/finiteVolume/fields/volFields/volFields.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,6 +27,7 @@ License \*---------------------------------------------------------------------------*/ #include "volFields.H" +#include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -52,6 +53,12 @@ namespace Foam defineTemplateTypeNameAndDebug(volSymmTensorField, 0); defineTemplateTypeNameAndDebug(volTensorField, 0); + addToRunTimeSelectionTable(regIOobject, volScalarField, IOobject); + addToRunTimeSelectionTable(regIOobject, volVectorField, IOobject); + addToRunTimeSelectionTable(regIOobject, volSphericalTensorField, IOobject); + addToRunTimeSelectionTable(regIOobject, volSymmTensorField, IOobject); + addToRunTimeSelectionTable(regIOobject, volTensorField, IOobject); + } // End namespace Foam diff --git a/src/finiteVolume/lduPrimitiveMeshAssembly/lduPrimitiveMeshAssembly.H b/src/finiteVolume/lduPrimitiveMeshAssembly/lduPrimitiveMeshAssembly.H index 5a1edb355413f63167f1d0b22200f59b6f033665..44790a5d3bab5304bb34d58f5c391df735e1ae5c 100644 --- a/src/finiteVolume/lduPrimitiveMeshAssembly/lduPrimitiveMeshAssembly.H +++ b/src/finiteVolume/lduPrimitiveMeshAssembly/lduPrimitiveMeshAssembly.H @@ -122,6 +122,13 @@ public: const lduMesh& ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~lduPrimitiveMeshAssembly() = default; diff --git a/src/finiteVolume/surfaceMesh/surfaceMesh.H b/src/finiteVolume/surfaceMesh/surfaceMesh.H index b82d2ac9822ed8c855039e0d69f865743dcad837..e4757c01e9cd76b8d62f8ad7b0d6e9c955225a4d 100644 --- a/src/finiteVolume/surfaceMesh/surfaceMesh.H +++ b/src/finiteVolume/surfaceMesh/surfaceMesh.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -81,6 +82,18 @@ public: { return mesh_.Cf(); } + + //- Return mesh given objectRegistry. Reverse of thisDb. Returns + // null if objectRegistry does not hold Mesh + static refPtr<fvMesh> mesh(const objectRegistry& db) + { + const auto* meshPtr = isA<fvMesh>(db); + if (meshPtr) + { + return *meshPtr; + } + return nullptr; + } }; diff --git a/src/finiteVolume/volMesh/volMesh.H b/src/finiteVolume/volMesh/volMesh.H index cde07521f3718dd350a31f1cb7934811b7c4dc9e..2751d892651426f4b14b24a1097638d845ae3daa 100644 --- a/src/finiteVolume/volMesh/volMesh.H +++ b/src/finiteVolume/volMesh/volMesh.H @@ -83,6 +83,18 @@ public: { return mesh_.C(); } + + //- Return mesh given objectRegistry. Reverse of thisDb. Returns + // null if objectRegistry does not hold Mesh + static refPtr<fvMesh> mesh(const objectRegistry& db) + { + const auto* meshPtr = isA<fvMesh>(db); + if (meshPtr) + { + return *meshPtr; + } + return nullptr; + } }; diff --git a/src/lagrangian/basic/IOPosition/IOPosition.H b/src/lagrangian/basic/IOPosition/IOPosition.H index 74e62d7876ddda1920acde5476c8957adcdf9f59..1b3d7eb840382dd62ad9dcffba928be1a3ed37b2 100644 --- a/src/lagrangian/basic/IOPosition/IOPosition.H +++ b/src/lagrangian/basic/IOPosition/IOPosition.H @@ -83,6 +83,13 @@ public: cloud::geometryType geomType = cloud::geometryType::COORDINATES ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + // Member functions diff --git a/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/Basic/Basic.H b/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/Basic/Basic.H index fc037a5fa66b687a7a7cfb18877145d0f36423c9..ff00c77b23e50f6ac641389c0139dd8f0440af60 100644 --- a/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/Basic/Basic.H +++ b/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/Basic/Basic.H @@ -120,6 +120,12 @@ public: ); } + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return regIOobject::DeepClone(*this); + } + //- Destructor virtual ~Basic(); diff --git a/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/Dual/Dual.H b/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/Dual/Dual.H index 0f7c7b0fdc4842eef622e181b555ee14e5a0db63..cba3c60a23a1334b8bec2c6e887e8453c684b5d8 100644 --- a/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/Dual/Dual.H +++ b/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/Dual/Dual.H @@ -134,6 +134,12 @@ public: ); } + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return regIOobject::DeepClone(*this); + } + //- Destructor virtual ~Dual() = default; diff --git a/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/Moment/Moment.H b/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/Moment/Moment.H index c78a2583d978d484753bce3822b7cdc14f529ca4..485bf27f3b1a6b020ba7d48fa6feb68514d38255 100644 --- a/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/Moment/Moment.H +++ b/src/lagrangian/intermediate/submodels/MPPIC/AveragingMethods/Moment/Moment.H @@ -133,6 +133,12 @@ public: ); } + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return regIOobject::DeepClone(*this); + } + //- Destructor virtual ~Moment(); diff --git a/src/lumpedPointMotion/movement/lumpedPointIOMovement.H b/src/lumpedPointMotion/movement/lumpedPointIOMovement.H index 7945b591f31bbcb267b2339420d6f07768c04fc8..de24631314eff241f1779485a454af1d94227447 100644 --- a/src/lumpedPointMotion/movement/lumpedPointIOMovement.H +++ b/src/lumpedPointMotion/movement/lumpedPointIOMovement.H @@ -92,6 +92,13 @@ public: //- Construct from IOobject, optionally with some owner information explicit lumpedPointIOMovement(const IOobject& io, label ownerId = -1); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~lumpedPointIOMovement() = default; diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatch/cyclicAMIPointPatch.C b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatch/cyclicAMIPointPatch.C index f4cecf62750f5385b5c3487dc42c8213929cdb94..e35103afd3505cfbff724e90ab7532b80a832319 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatch/cyclicAMIPointPatch.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatch/cyclicAMIPointPatch.C @@ -113,7 +113,7 @@ bool Foam::cyclicAMIPointPatch::coupled() const { return Pstream::parRun() - || !this->boundaryMesh().mesh().mesh().time().processorCase(); + || !this->boundaryMesh().mesh().time().processorCase(); } diff --git a/src/meshTools/PatchFunction1/MappedFile/rawIOField.H b/src/meshTools/PatchFunction1/MappedFile/rawIOField.H index 57bd0ec1742a3201f09446c8777fbc96bda4cf6d..53bc90af74a9fae32ce1b21093e42701aaa56edf 100644 --- a/src/meshTools/PatchFunction1/MappedFile/rawIOField.H +++ b/src/meshTools/PatchFunction1/MappedFile/rawIOField.H @@ -74,6 +74,12 @@ public: //- Construct from IOobject explicit rawIOField(const IOobject& io, const bool readAverage); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return regIOobject::DeepClone(*this); + } + //- Destructor virtual ~rawIOField() = default; diff --git a/src/meshTools/coordinate/systems/coordinateSystems.H b/src/meshTools/coordinate/systems/coordinateSystems.H index eb81ff231bfea77fe70bcf85ee2ffc1c54a60ad5..dbebfb2aedae8e595171a30366524b51d980b522 100644 --- a/src/meshTools/coordinate/systems/coordinateSystems.H +++ b/src/meshTools/coordinate/systems/coordinateSystems.H @@ -123,6 +123,13 @@ public: PtrList<coordinateSystem>&& content ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + // Selectors diff --git a/src/meshTools/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.H b/src/meshTools/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.H index 26190e2f1a8942f006f9ad0dacb1c8d6593fb4fb..3ddba1feddf85f29a958f5b1745c59128f0a9f2f 100644 --- a/src/meshTools/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.H +++ b/src/meshTools/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.H @@ -123,6 +123,13 @@ public: const labelList& regionEdges ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~extendedFeatureEdgeMesh() = default; diff --git a/src/meshTools/edgeMesh/featureEdgeMesh/featureEdgeMesh.H b/src/meshTools/edgeMesh/featureEdgeMesh/featureEdgeMesh.H index d89db6b362fb62ff3bb1aaf82cc3ae00165a027e..bf92498dfed5526d2ccc44336fe6956c976d40d0 100644 --- a/src/meshTools/edgeMesh/featureEdgeMesh/featureEdgeMesh.H +++ b/src/meshTools/edgeMesh/featureEdgeMesh/featureEdgeMesh.H @@ -75,9 +75,18 @@ public: const edgeList& edges ); + //- Construct as copy + explicit featureEdgeMesh(const featureEdgeMesh&) = default; + //- Construct as copy featureEdgeMesh(const IOobject& io, const edgeMesh& em); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return regIOobject::DeepClone(*this); + } + // IO diff --git a/src/meshTools/searchableSurfaces/searchableBox/searchableBox.H b/src/meshTools/searchableSurfaces/searchableBox/searchableBox.H index c8579e51ed62120ef18f2d2e560804c51a05ef3f..99dac6f95bbc041e6e918d096db6316d42b3dacd 100644 --- a/src/meshTools/searchableSurfaces/searchableBox/searchableBox.H +++ b/src/meshTools/searchableSurfaces/searchableBox/searchableBox.H @@ -123,6 +123,13 @@ public: const dictionary& dict ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~searchableBox() = default; diff --git a/src/meshTools/searchableSurfaces/searchableCone/searchableCone.H b/src/meshTools/searchableSurfaces/searchableCone/searchableCone.H index 77c7dea6681093a83c3cb7aab27783c234586749..81e302d51e52e8de53fa045a9970729f12254523 100644 --- a/src/meshTools/searchableSurfaces/searchableCone/searchableCone.H +++ b/src/meshTools/searchableSurfaces/searchableCone/searchableCone.H @@ -175,6 +175,13 @@ public: const dictionary& dict ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~searchableCone() = default; diff --git a/src/meshTools/searchableSurfaces/searchableCylinder/searchableCylinder.H b/src/meshTools/searchableSurfaces/searchableCylinder/searchableCylinder.H index 9035af15f072502759167656c353a484dbbe1eeb..a087273849f4e20962ab8d9c3376a2baba5e24bc 100644 --- a/src/meshTools/searchableSurfaces/searchableCylinder/searchableCylinder.H +++ b/src/meshTools/searchableSurfaces/searchableCylinder/searchableCylinder.H @@ -146,6 +146,13 @@ public: const dictionary& dict ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~searchableCylinder() = default; diff --git a/src/meshTools/searchableSurfaces/searchableDisk/searchableDisk.H b/src/meshTools/searchableSurfaces/searchableDisk/searchableDisk.H index 7dec54089f844564c3c0ccdb579a095026a5d8fb..c97e3ec7e1ba7078905939e676bee65093757e9f 100644 --- a/src/meshTools/searchableSurfaces/searchableDisk/searchableDisk.H +++ b/src/meshTools/searchableSurfaces/searchableDisk/searchableDisk.H @@ -132,6 +132,13 @@ public: const dictionary& dict ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~searchableDisk() = default; diff --git a/src/meshTools/searchableSurfaces/searchableExtrudedCircle/searchableExtrudedCircle.H b/src/meshTools/searchableSurfaces/searchableExtrudedCircle/searchableExtrudedCircle.H index 1231adfc071cdf2b9d90f049e1e5b3d1cbd06465..0085564cb86246ed0adf56afc8f692f90e6ae359 100644 --- a/src/meshTools/searchableSurfaces/searchableExtrudedCircle/searchableExtrudedCircle.H +++ b/src/meshTools/searchableSurfaces/searchableExtrudedCircle/searchableExtrudedCircle.H @@ -113,6 +113,13 @@ public: const dictionary& dict ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~searchableExtrudedCircle(); diff --git a/src/meshTools/searchableSurfaces/searchablePlane/searchablePlane.H b/src/meshTools/searchableSurfaces/searchablePlane/searchablePlane.H index db9ae54b6b920ca6b40b56baaed8aecac26a843a..124c1a24f7959d0302f7c0ddf85d2ccc816877bf 100644 --- a/src/meshTools/searchableSurfaces/searchablePlane/searchablePlane.H +++ b/src/meshTools/searchableSurfaces/searchablePlane/searchablePlane.H @@ -115,6 +115,13 @@ public: const dictionary& dict ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~searchablePlane() = default; diff --git a/src/meshTools/searchableSurfaces/searchablePlate/searchablePlate.H b/src/meshTools/searchableSurfaces/searchablePlate/searchablePlate.H index f04371e1f488418254a3bee21a4734731b7744a3..e3c932e574f3047f0c8cad2513d1ea7c21f06d50 100644 --- a/src/meshTools/searchableSurfaces/searchablePlate/searchablePlate.H +++ b/src/meshTools/searchableSurfaces/searchablePlate/searchablePlate.H @@ -140,6 +140,13 @@ public: const dictionary& dict ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~searchablePlate() = default; diff --git a/src/meshTools/searchableSurfaces/searchableRotatedBox/searchableRotatedBox.H b/src/meshTools/searchableSurfaces/searchableRotatedBox/searchableRotatedBox.H index 8709528eece4a6e03d437111506b499673c216ce..c2f8c487309d2138cae83ed61fa5662c82d20c88 100644 --- a/src/meshTools/searchableSurfaces/searchableRotatedBox/searchableRotatedBox.H +++ b/src/meshTools/searchableSurfaces/searchableRotatedBox/searchableRotatedBox.H @@ -125,6 +125,13 @@ public: const dictionary& dict ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~searchableRotatedBox() = default; diff --git a/src/meshTools/searchableSurfaces/searchableSphere/searchableSphere.H b/src/meshTools/searchableSurfaces/searchableSphere/searchableSphere.H index febf3c4dd231d1f43a7624281e9a49f5f7ff8335..0269bf28a8986f6d472af26f14293702b2df99c5 100644 --- a/src/meshTools/searchableSurfaces/searchableSphere/searchableSphere.H +++ b/src/meshTools/searchableSurfaces/searchableSphere/searchableSphere.H @@ -200,6 +200,13 @@ public: const dictionary& dict ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~searchableSphere() = default; diff --git a/src/meshTools/searchableSurfaces/searchableSurface/searchableSurface.H b/src/meshTools/searchableSurfaces/searchableSurface/searchableSurface.H index 38d00526684c71e23acb6734eee450747b5b44d3..ebd74bfbf2195b3f33e9cbd93f6074d3b2d5d180 100644 --- a/src/meshTools/searchableSurfaces/searchableSurface/searchableSurface.H +++ b/src/meshTools/searchableSurfaces/searchableSurface/searchableSurface.H @@ -138,8 +138,15 @@ public: searchableSurface(const IOobject& io); - //- Clone - virtual autoPtr<searchableSurface> clone() const + ////- Clone + //virtual autoPtr<searchableSurface> clone() const + //{ + // NotImplemented; + // return nullptr; + //} + + //- Return a clone + virtual refPtr<regIOobject> deepClone() const { NotImplemented; return nullptr; diff --git a/src/meshTools/searchableSurfaces/searchableSurfaceCollection/searchableSurfaceCollection.H b/src/meshTools/searchableSurfaces/searchableSurfaceCollection/searchableSurfaceCollection.H index 3cbf15f86ac38fa4fc615495284d6ffffd02fd75..9737e7a6f9765c6650a734590dc7b563d1defd05 100644 --- a/src/meshTools/searchableSurfaces/searchableSurfaceCollection/searchableSurfaceCollection.H +++ b/src/meshTools/searchableSurfaces/searchableSurfaceCollection/searchableSurfaceCollection.H @@ -145,6 +145,13 @@ public: const dictionary& dict ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~searchableSurfaceCollection(); diff --git a/src/meshTools/searchableSurfaces/searchableSurfaceWithGaps/searchableSurfaceWithGaps.H b/src/meshTools/searchableSurfaces/searchableSurfaceWithGaps/searchableSurfaceWithGaps.H index 6b2ad80cc99782edd5fd64ddbf049664505e2a07..ace88f45aa1f6184e87af1104525662ba15686a5 100644 --- a/src/meshTools/searchableSurfaces/searchableSurfaceWithGaps/searchableSurfaceWithGaps.H +++ b/src/meshTools/searchableSurfaces/searchableSurfaceWithGaps/searchableSurfaceWithGaps.H @@ -142,6 +142,14 @@ public: const dictionary& dict ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + + //- Destructor virtual ~searchableSurfaceWithGaps() = default; diff --git a/src/meshTools/searchableSurfaces/triSurfaceMesh/triSurfaceMesh.H b/src/meshTools/searchableSurfaces/triSurfaceMesh/triSurfaceMesh.H index e5fe8825ad31d8b5b91cfede1453feb82d06a44c..6abb87eb0f7afa3cabf70dc105d6422319c56c96 100644 --- a/src/meshTools/searchableSurfaces/triSurfaceMesh/triSurfaceMesh.H +++ b/src/meshTools/searchableSurfaces/triSurfaceMesh/triSurfaceMesh.H @@ -182,6 +182,14 @@ public: ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + + //- Destructor virtual ~triSurfaceMesh(); diff --git a/src/meshTools/sets/cellSources/fieldToCell/fieldDictionary.H b/src/meshTools/sets/cellSources/fieldToCell/fieldDictionary.H index 999f5a8862c5f2bd8e2a9354a68fb2dedb517c01..323ed409dc121a87361cbe3bbbe3f6e0fc6ec5d3 100644 --- a/src/meshTools/sets/cellSources/fieldToCell/fieldDictionary.H +++ b/src/meshTools/sets/cellSources/fieldToCell/fieldDictionary.H @@ -72,6 +72,15 @@ public: close(); } + //- Construct as copy + explicit fieldDictionary(const fieldDictionary&) = default; + + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return regIOobject::DeepClone(*this); + } + // Member Functions diff --git a/src/meshTools/sets/topoSets/cellSet.H b/src/meshTools/sets/topoSets/cellSet.H index 3f03edb070b976dd5e64572db5547e7709482507..a9b90790ea994cbd29e0c96bff14c5a8d9eed524 100644 --- a/src/meshTools/sets/topoSets/cellSet.H +++ b/src/meshTools/sets/topoSets/cellSet.H @@ -155,6 +155,14 @@ public: ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + + //- Destructor virtual ~cellSet() = default; diff --git a/src/meshTools/sets/topoSets/faceSet.H b/src/meshTools/sets/topoSets/faceSet.H index 5965ed75fb982ae74eb39cbea1577f003147de88..21c6ef939e5205ff610413ccef2447e1aef9e4e2 100644 --- a/src/meshTools/sets/topoSets/faceSet.H +++ b/src/meshTools/sets/topoSets/faceSet.H @@ -118,6 +118,13 @@ public: writeOption w=NO_WRITE ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~faceSet() = default; diff --git a/src/meshTools/sets/topoSets/pointSet.H b/src/meshTools/sets/topoSets/pointSet.H index 3a0d0124c9780b367114feff7f5b21414eb37f40..241bfe0aa5780a021e0001a89e2a5dff9894bd98 100644 --- a/src/meshTools/sets/topoSets/pointSet.H +++ b/src/meshTools/sets/topoSets/pointSet.H @@ -118,6 +118,13 @@ public: writeOption w=NO_WRITE ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~pointSet() = default; diff --git a/src/meshTools/sets/topoSets/topoBitSet.H b/src/meshTools/sets/topoSets/topoBitSet.H index 6fdc551b77ce5c11dc50fc1a08def5815452546c..364cdce91b54b88b854b87db7e969197b7175eef 100644 --- a/src/meshTools/sets/topoSets/topoBitSet.H +++ b/src/meshTools/sets/topoSets/topoBitSet.H @@ -103,6 +103,14 @@ protected: public: + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + + //- Destructor virtual ~topoBitSet() = default; diff --git a/src/meshTools/sets/topoSets/topoBoolSet.H b/src/meshTools/sets/topoSets/topoBoolSet.H index 39b11652871033e8d4cfdffac162c43d93b348c3..e14bd7f55b5fae667b8d94f87738b3a01d41b362 100644 --- a/src/meshTools/sets/topoSets/topoBoolSet.H +++ b/src/meshTools/sets/topoSets/topoBoolSet.H @@ -103,6 +103,14 @@ protected: public: + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + + //- Destructor virtual ~topoBoolSet() = default; diff --git a/src/optimisation/adjointOptimisation/adjoint/ATCModel/ATCModel/ATCModel.H b/src/optimisation/adjointOptimisation/adjoint/ATCModel/ATCModel/ATCModel.H index d80c75b12eb43bb4cb62649d895b5fbf10dbbb0d..3bbffd5102354c731705aafb981334971dc2dbd4 100644 --- a/src/optimisation/adjointOptimisation/adjoint/ATCModel/ATCModel/ATCModel.H +++ b/src/optimisation/adjointOptimisation/adjoint/ATCModel/ATCModel/ATCModel.H @@ -148,6 +148,13 @@ public: const dictionary& dict ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~ATCModel() = default; diff --git a/src/optimisation/adjointOptimisation/adjoint/objectiveManager/objectiveManager/objectiveManager.H b/src/optimisation/adjointOptimisation/adjoint/objectiveManager/objectiveManager/objectiveManager.H index 0aeacc6b484ba4a72b9e60bc82add78a68a85488..4905fc3727ccfe8ae775246a5499f0a6abe27562 100644 --- a/src/optimisation/adjointOptimisation/adjoint/objectiveManager/objectiveManager/objectiveManager.H +++ b/src/optimisation/adjointOptimisation/adjoint/objectiveManager/objectiveManager/objectiveManager.H @@ -121,6 +121,13 @@ public: const word& primalSolverName ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~objectiveManager() = default; diff --git a/src/optimisation/adjointOptimisation/adjoint/solvers/adjointSolverManager/adjointSolverManager.H b/src/optimisation/adjointOptimisation/adjoint/solvers/adjointSolverManager/adjointSolverManager.H index 9f91025dad3009bdeda47b656e1f9032bcf767a4..0782fa118c7f2e13b0daa6f7c0f3359c89cbccc3 100644 --- a/src/optimisation/adjointOptimisation/adjoint/solvers/adjointSolverManager/adjointSolverManager.H +++ b/src/optimisation/adjointOptimisation/adjoint/solvers/adjointSolverManager/adjointSolverManager.H @@ -103,6 +103,13 @@ public: const dictionary& dict ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~adjointSolverManager() = default; diff --git a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/adjointRASModel/adjointRASModel.H b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/adjointRASModel/adjointRASModel.H index 6abd793144176151a3a477f85ced978ffadd0080..5ec35b3b78f2fab0e9d36af42322abd414c768f3 100644 --- a/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/adjointRASModel/adjointRASModel.H +++ b/src/optimisation/adjointOptimisation/adjoint/turbulenceModels/incompressibleAdjoint/adjointRAS/adjointRASModel/adjointRASModel.H @@ -203,6 +203,13 @@ public: adjointTurbulenceModel::typeName ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~adjointRASModel() = default; diff --git a/src/phaseSystemModels/multiphaseInter/phasesSystem/interfaceModels/porousModels/porousModel/porousModel.H b/src/phaseSystemModels/multiphaseInter/phasesSystem/interfaceModels/porousModels/porousModel/porousModel.H index 3fb3aa332df44f110953e05f518ddd3de64ca4bb..68369e76edaff125393808e0007ade7e5efb4435 100644 --- a/src/phaseSystemModels/multiphaseInter/phasesSystem/interfaceModels/porousModels/porousModel/porousModel.H +++ b/src/phaseSystemModels/multiphaseInter/phasesSystem/interfaceModels/porousModels/porousModel/porousModel.H @@ -93,6 +93,13 @@ public: const fvMesh& mesh ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~porousModel() = default; diff --git a/src/phaseSystemModels/multiphaseInter/phasesSystem/interfaceModels/surfaceTensionModels/surfaceTensionModel/surfaceTensionModel.H b/src/phaseSystemModels/multiphaseInter/phasesSystem/interfaceModels/surfaceTensionModels/surfaceTensionModel/surfaceTensionModel.H index d577ad27ddd8d183afdc665c415ec44c8734f9fc..7f4ab511b6feb45926e0cd60931a59cfb90c9b85 100644 --- a/src/phaseSystemModels/multiphaseInter/phasesSystem/interfaceModels/surfaceTensionModels/surfaceTensionModel/surfaceTensionModel.H +++ b/src/phaseSystemModels/multiphaseInter/phasesSystem/interfaceModels/surfaceTensionModels/surfaceTensionModel/surfaceTensionModel.H @@ -95,6 +95,13 @@ public: const bool registerObject ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~surfaceTensionModel() = default; diff --git a/src/phaseSystemModels/reactingEuler/multiphaseSystem/BlendedInterfacialModel/BlendedInterfacialModel.H b/src/phaseSystemModels/reactingEuler/multiphaseSystem/BlendedInterfacialModel/BlendedInterfacialModel.H index b09508e987bb92eb9cc99ae2a851202843f0cf6a..2cf720edd3f5d442932f7d844fe90cd3e0b84e03 100644 --- a/src/phaseSystemModels/reactingEuler/multiphaseSystem/BlendedInterfacialModel/BlendedInterfacialModel.H +++ b/src/phaseSystemModels/reactingEuler/multiphaseSystem/BlendedInterfacialModel/BlendedInterfacialModel.H @@ -157,6 +157,13 @@ public: const bool correctFixedFluxBCs = true ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor ~BlendedInterfacialModel(); diff --git a/src/phaseSystemModels/reactingEuler/multiphaseSystem/interfacialCompositionModels/surfaceTensionModels/surfaceTensionModel/surfaceTensionModel.H b/src/phaseSystemModels/reactingEuler/multiphaseSystem/interfacialCompositionModels/surfaceTensionModels/surfaceTensionModel/surfaceTensionModel.H index af8284cfcf6e3d5aed1e9e7ec10f0fe5c12e93d4..eb25fdf4779415d5c3546597ecc1958c39c9f8fc 100644 --- a/src/phaseSystemModels/reactingEuler/multiphaseSystem/interfacialCompositionModels/surfaceTensionModels/surfaceTensionModel/surfaceTensionModel.H +++ b/src/phaseSystemModels/reactingEuler/multiphaseSystem/interfacialCompositionModels/surfaceTensionModels/surfaceTensionModel/surfaceTensionModel.H @@ -102,6 +102,13 @@ public: const bool registerObject ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~surfaceTensionModel() = default; diff --git a/src/phaseSystemModels/reactingEuler/multiphaseSystem/interfacialModels/dragModels/dragModel/dragModel.H b/src/phaseSystemModels/reactingEuler/multiphaseSystem/interfacialModels/dragModels/dragModel/dragModel.H index 660662e2ef270b7bfebd1fc61b787dd0591106bc..71c822bbc1940680b332529722aa99464424fbab 100644 --- a/src/phaseSystemModels/reactingEuler/multiphaseSystem/interfacialModels/dragModels/dragModel/dragModel.H +++ b/src/phaseSystemModels/reactingEuler/multiphaseSystem/interfacialModels/dragModels/dragModel/dragModel.H @@ -114,6 +114,13 @@ public: const bool registerObject ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~dragModel(); diff --git a/src/phaseSystemModels/reactingEuler/multiphaseSystem/interfacialModels/virtualMassModels/virtualMassModel/virtualMassModel.H b/src/phaseSystemModels/reactingEuler/multiphaseSystem/interfacialModels/virtualMassModels/virtualMassModel/virtualMassModel.H index 10ad757b1ca9549652b617cb070f401019df52ae..d255ababc30a110e90504aee06e22e6770f83aa5 100644 --- a/src/phaseSystemModels/reactingEuler/multiphaseSystem/interfacialModels/virtualMassModels/virtualMassModel/virtualMassModel.H +++ b/src/phaseSystemModels/reactingEuler/multiphaseSystem/interfacialModels/virtualMassModels/virtualMassModel/virtualMassModel.H @@ -103,6 +103,13 @@ public: const bool registerObject ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~virtualMassModel() = default; diff --git a/src/phaseSystemModels/reactingEuler/multiphaseSystem/populationBalanceModel/populationBalanceModel/populationBalanceModel.H b/src/phaseSystemModels/reactingEuler/multiphaseSystem/populationBalanceModel/populationBalanceModel/populationBalanceModel.H index 91e31fed5bc3bb06fa289466f68c1e77b77f72ed..e8ae3e97e34d1307fea484031f287505112f70a6 100644 --- a/src/phaseSystemModels/reactingEuler/multiphaseSystem/populationBalanceModel/populationBalanceModel/populationBalanceModel.H +++ b/src/phaseSystemModels/reactingEuler/multiphaseSystem/populationBalanceModel/populationBalanceModel/populationBalanceModel.H @@ -384,6 +384,13 @@ public: } }; + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~populationBalanceModel(); diff --git a/src/phaseSystemModels/twoPhaseEuler/twoPhaseSystem/interfacialModels/dragModels/dragModel/dragModel.H b/src/phaseSystemModels/twoPhaseEuler/twoPhaseSystem/interfacialModels/dragModels/dragModel/dragModel.H index 2663b42430b5745fcee0dcb97c115cc874646c5d..e6e294944e1d194eb30be1cef2648bedb37f0b0d 100644 --- a/src/phaseSystemModels/twoPhaseEuler/twoPhaseSystem/interfacialModels/dragModels/dragModel/dragModel.H +++ b/src/phaseSystemModels/twoPhaseEuler/twoPhaseSystem/interfacialModels/dragModels/dragModel/dragModel.H @@ -114,6 +114,13 @@ public: const bool registerObject ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~dragModel(); diff --git a/src/phaseSystemModels/twoPhaseEuler/twoPhaseSystem/interfacialModels/virtualMassModels/virtualMassModel/virtualMassModel.H b/src/phaseSystemModels/twoPhaseEuler/twoPhaseSystem/interfacialModels/virtualMassModels/virtualMassModel/virtualMassModel.H index 91b5656fe0700646554960f3979f2e3c93476f21..e8c8d6ec7b1ae70dc3534671a90380802d843d78 100644 --- a/src/phaseSystemModels/twoPhaseEuler/twoPhaseSystem/interfacialModels/virtualMassModels/virtualMassModel/virtualMassModel.H +++ b/src/phaseSystemModels/twoPhaseEuler/twoPhaseSystem/interfacialModels/virtualMassModels/virtualMassModel/virtualMassModel.H @@ -103,6 +103,13 @@ public: const bool registerObject ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~virtualMassModel() = default; diff --git a/src/surfMesh/surfZone/surfZoneIOList.H b/src/surfMesh/surfZone/surfZoneIOList.H index 10681a8929064eefe03429ec92eb9e461f36eced..2f9d1a4da9a9c82edb308e0181001ed9081d936d 100644 --- a/src/surfMesh/surfZone/surfZoneIOList.H +++ b/src/surfMesh/surfZone/surfZoneIOList.H @@ -73,6 +73,15 @@ public: //- Construct from IOobject and transferring surfZoneList content surfZoneIOList(const IOobject& io, surfZoneList&& content); + //- Construct as copy + explicit surfZoneIOList(const surfZoneIOList&) = default; + + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + return regIOobject::DeepClone(*this); + } + //- Destructor virtual ~surfZoneIOList() = default; diff --git a/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.H b/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.H index 4db7724d0c12906eab80207f99f7de240cbd54e7..8f6d1b6c917cd883ce1eb3745c2ed25ebf947181 100644 --- a/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.H +++ b/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.H @@ -91,6 +91,13 @@ public: //- Construct from mesh SLGThermo(const fvMesh& mesh, fluidThermo& thermo); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~SLGThermo(); diff --git a/src/transportModels/interfaceProperties/surfaceTensionModels/constant/constantSurfaceTension.H b/src/transportModels/interfaceProperties/surfaceTensionModels/constant/constantSurfaceTension.H index df9b62a6ce8fd1753e56ad43a24c134a52600f4f..d2bfb0b2b208838bcf5f0fbfb7349436b131301f 100644 --- a/src/transportModels/interfaceProperties/surfaceTensionModels/constant/constantSurfaceTension.H +++ b/src/transportModels/interfaceProperties/surfaceTensionModels/constant/constantSurfaceTension.H @@ -89,6 +89,13 @@ public: const fvMesh& mesh ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~constant(); diff --git a/src/transportModels/interfaceProperties/surfaceTensionModels/temperatureDependent/temperatureDependentSurfaceTension.H b/src/transportModels/interfaceProperties/surfaceTensionModels/temperatureDependent/temperatureDependentSurfaceTension.H index cd2ecb264e1b99ff92b051932000424bf0fa6016..fc9287f86cc402d89ebf43cfed2cd29c314a53d6 100644 --- a/src/transportModels/interfaceProperties/surfaceTensionModels/temperatureDependent/temperatureDependentSurfaceTension.H +++ b/src/transportModels/interfaceProperties/surfaceTensionModels/temperatureDependent/temperatureDependentSurfaceTension.H @@ -104,6 +104,13 @@ public: const fvMesh& mesh ); + //- Return a clone + virtual refPtr<regIOobject> deepClone() const + { + NotImplemented; + return nullptr; + } + //- Destructor virtual ~temperatureDependent();