Compare commits
1 Commits
master
...
feature-re
Author | SHA1 | Date | |
---|---|---|---|
|
bc5a55f7e6 |
@ -138,6 +138,13 @@ public:
|
||||
const surfaceScalarField& phi
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual refPtr<regIOobject> deepClone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~PDRDragModel();
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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");
|
||||
|
@ -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_++;
|
||||
|
@ -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\>
|
||||
//
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -138,7 +138,7 @@ public:
|
||||
) const;
|
||||
|
||||
//- Write in dictionary format
|
||||
virtual void writeData(Ostream& os) const;
|
||||
virtual bool writeData(Ostream& os) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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_;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
|
@ -135,6 +135,13 @@ public:
|
||||
const polyPatchList& ppl
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual refPtr<regIOobject> deepClone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
~polyBoundaryMesh() = default;
|
||||
|
@ -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
|
||||
|
||||
|
@ -132,6 +132,13 @@ public:
|
||||
const PtrList<ZoneType>& pzm
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual refPtr<regIOobject> deepClone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
~ZoneMesh();
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
@ -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)
|
||||
:
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -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)
|
||||
|
@ -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,22 +84,17 @@ public:
|
||||
//- Copy construct
|
||||
explicit function1Base(const function1Base& rhs);
|
||||
|
||||
//- Construct from IOobject
|
||||
function1Base(const IOobject& io);
|
||||
|
||||
//- Construct from IOobject and dictionary (unused)
|
||||
function1Base(const IOobject& io, const dictionary& dict);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~function1Base() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- The name of the entry
|
||||
const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
|
||||
// Manipulation
|
||||
|
||||
//- Convert time
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
@ -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)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -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);
|
||||
};
|
||||
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
@ -50,4 +50,14 @@ Foam::Function1Types::halfCosineRamp::halfCosineRamp
|
||||
{}
|
||||
|
||||
|
||||
Foam::Function1Types::halfCosineRamp::halfCosineRamp
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
ramp(io, dict)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -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;
|
||||
|
@ -50,4 +50,14 @@ Foam::Function1Types::linearRamp::linearRamp
|
||||
{}
|
||||
|
||||
|
||||
Foam::Function1Types::linearRamp::linearRamp
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
ramp(io, dict)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -50,4 +50,14 @@ Foam::Function1Types::quadraticRamp::quadraticRamp
|
||||
{}
|
||||
|
||||
|
||||
Foam::Function1Types::quadraticRamp::quadraticRamp
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
ramp(io, dict)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -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;
|
||||
|
@ -50,4 +50,14 @@ Foam::Function1Types::quarterCosineRamp::quarterCosineRamp
|
||||
{}
|
||||
|
||||
|
||||
Foam::Function1Types::quarterCosineRamp::quarterCosineRamp
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
ramp(io, dict)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -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;
|
||||
|
@ -50,4 +50,14 @@ Foam::Function1Types::quarterSineRamp::quarterSineRamp
|
||||
{}
|
||||
|
||||
|
||||
Foam::Function1Types::quarterSineRamp::quarterSineRamp
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
ramp(io, dict)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
|
@ -65,6 +65,7 @@ public:
|
||||
GeoMesh<faMesh>(mesh)
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return size. Number of internal edges
|
||||
|
@ -115,6 +115,13 @@ public:
|
||||
const label size
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual refPtr<regIOobject> deepClone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
~faBoundaryMesh() = default;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -122,6 +122,13 @@ public:
|
||||
const lduMesh&
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual refPtr<regIOobject> deepClone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~lduPrimitiveMeshAssembly() = default;
|
||||
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -83,6 +83,13 @@ public:
|
||||
cloud::geometryType geomType = cloud::geometryType::COORDINATES
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual refPtr<regIOobject> deepClone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
|
@ -120,6 +120,12 @@ public:
|
||||
);
|
||||
}
|
||||
|
||||
//- Return a clone
|
||||
virtual refPtr<regIOobject> deepClone() const
|
||||
{
|
||||
return regIOobject::DeepClone(*this);
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~Basic();
|
||||
|
@ -134,6 +134,12 @@ public:
|
||||
);
|
||||
}
|
||||
|
||||
//- Return a clone
|
||||
virtual refPtr<regIOobject> deepClone() const
|
||||
{
|
||||
return regIOobject::DeepClone(*this);
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~Dual() = default;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user