mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: update DimensionedField and GeometricField New factory methods
- allow separate specification of the registerObject (no/yes/auto) to improve the flexibility of the factory methods.
This commit is contained in:
@ -81,6 +81,8 @@ void Foam::objectRegistry::deleteCachedObject(regIOobject* io) const
|
|||||||
{
|
{
|
||||||
io->release(); // Relinquish any ownership by registry
|
io->release(); // Relinquish any ownership by registry
|
||||||
io->checkOut();
|
io->checkOut();
|
||||||
|
// Additional safety - not certain this is actually needed...
|
||||||
|
io->rename(io->name() + "-Cache");
|
||||||
delete io;
|
delete io;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -376,6 +376,16 @@ Foam::DimensionedField<Type, GeoMesh>::clone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type, class GeoMesh>
|
||||||
|
Foam::DimensionedField<Type, GeoMesh>::~DimensionedField()
|
||||||
|
{
|
||||||
|
// FUTURE: register cache field info
|
||||||
|
// // this->db().cacheTemporaryObject(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type, class GeoMesh>
|
template<class Type, class GeoMesh>
|
||||||
|
|||||||
@ -117,6 +117,17 @@ private:
|
|||||||
|
|
||||||
void readIfPresent(const word& fieldDictEntry = "value");
|
void readIfPresent(const word& fieldDictEntry = "value");
|
||||||
|
|
||||||
|
//- Implementation for 'New' with specified registerObject preference.
|
||||||
|
// For LEGACY_REGISTER, registration is determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
|
template<class... Args>
|
||||||
|
static tmp<DimensionedField<Type, GeoMesh>> New_impl
|
||||||
|
(
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
|
const word& name,
|
||||||
|
const Mesh& mesh,
|
||||||
|
Args&&... args
|
||||||
|
);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -298,10 +309,25 @@ public:
|
|||||||
|
|
||||||
// Factory Methods
|
// Factory Methods
|
||||||
|
|
||||||
//- Return tmp field from name, mesh, dimensions,
|
//- Return tmp field (NO_READ, NO_WRITE)
|
||||||
//- copy of internal field.
|
//- from name, mesh, dimensions, copy of internal field.
|
||||||
// The field is NO_READ, NO_WRITE, unregistered and uses the
|
//- [Takes current timeName from the mesh registry].
|
||||||
// current timeName from the mesh registry
|
// For LEGACY_REGISTER, registration is determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
|
static tmp<DimensionedField<Type, GeoMesh>> New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const dimensionSet& dims,
|
||||||
|
const Field<Type>& iField
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Return tmp field (NO_READ, NO_WRITE)
|
||||||
|
//- from name, mesh, dimensions, copy of internal field.
|
||||||
|
//- [Takes current timeName from the mesh registry].
|
||||||
|
// Registration/persistence determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
static tmp<DimensionedField<Type, GeoMesh>> New
|
static tmp<DimensionedField<Type, GeoMesh>> New
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
@ -310,10 +336,25 @@ public:
|
|||||||
const Field<Type>& iField
|
const Field<Type>& iField
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Return tmp field from name, mesh, dimensions,
|
//- Return tmp field (NO_READ, NO_WRITE)
|
||||||
//- moved internal field contents.
|
//- from name, mesh, dimensions, move internal field contents.
|
||||||
// The field is NO_READ, NO_WRITE, unregistered and uses the
|
//- [Takes current timeName from the mesh registry].
|
||||||
// current timeName from the mesh registry
|
// For LEGACY_REGISTER, registration is determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
|
static tmp<DimensionedField<Type, GeoMesh>> New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const dimensionSet& dims,
|
||||||
|
Field<Type>&& iField
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Return tmp field (NO_READ, NO_WRITE)
|
||||||
|
//- from name, mesh, dimensions, move internal field contents.
|
||||||
|
//- [Takes current timeName from the mesh registry].
|
||||||
|
// Registration/persistence determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
static tmp<DimensionedField<Type, GeoMesh>> New
|
static tmp<DimensionedField<Type, GeoMesh>> New
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
@ -322,9 +363,24 @@ public:
|
|||||||
Field<Type>&& iField
|
Field<Type>&& iField
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Return tmp field from name, mesh, dimensions.
|
//- Return tmp field (NO_READ, NO_WRITE)
|
||||||
// The field is NO_READ, NO_WRITE, unregistered and uses the
|
//- from name, mesh, dimensions.
|
||||||
// current timeName from the mesh registry
|
//- [Takes current timeName from the mesh registry].
|
||||||
|
// For LEGACY_REGISTER, registration is determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
|
static tmp<DimensionedField<Type, GeoMesh>> New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const dimensionSet& dims
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Return tmp field (NO_READ, NO_WRITE)
|
||||||
|
//- from name, mesh, dimensions.
|
||||||
|
//- [Takes current timeName from the mesh registry].
|
||||||
|
// Registration/persistence determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
static tmp<DimensionedField<Type, GeoMesh>> New
|
static tmp<DimensionedField<Type, GeoMesh>> New
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
@ -332,9 +388,25 @@ public:
|
|||||||
const dimensionSet& dims
|
const dimensionSet& dims
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Return uniform value tmp field from name, mesh, dimensions, value.
|
//- Return tmp field (NO_READ, NO_WRITE)
|
||||||
// The field is NO_READ, NO_WRITE, unregistered and uses the
|
//- from name, mesh, value, dimensions.
|
||||||
// current timeName from the mesh registry
|
//- [Takes current timeName from the mesh registry].
|
||||||
|
// For LEGACY_REGISTER, registration is determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
|
static tmp<DimensionedField<Type, GeoMesh>> New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const Type& value,
|
||||||
|
const dimensionSet& dims
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Return tmp field (NO_READ, NO_WRITE)
|
||||||
|
//- from name, mesh, value, dimensions.
|
||||||
|
//- [Takes current timeName from the mesh registry].
|
||||||
|
// Registration/persistence determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
static tmp<DimensionedField<Type, GeoMesh>> New
|
static tmp<DimensionedField<Type, GeoMesh>> New
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
@ -343,9 +415,24 @@ public:
|
|||||||
const dimensionSet& dims
|
const dimensionSet& dims
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Return tmp field from name, mesh, dimensioned\<Type\>.
|
//- Return tmp field (NO_READ, NO_WRITE)
|
||||||
// The field is NO_READ, NO_WRITE, unregistered and uses the
|
//- from name, mesh, dimensioned-type.
|
||||||
// current timeName from the mesh registry
|
//- [Takes current timeName from the mesh registry].
|
||||||
|
// For LEGACY_REGISTER, registration is determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
|
static tmp<DimensionedField<Type, GeoMesh>> New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const dimensioned<Type>& dt
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Return tmp field (NO_READ, NO_WRITE)
|
||||||
|
//- from name, mesh, dimensioned-type.
|
||||||
|
//- [Takes current timeName from the mesh registry].
|
||||||
|
// Registration/persistence determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
static tmp<DimensionedField<Type, GeoMesh>> New
|
static tmp<DimensionedField<Type, GeoMesh>> New
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
@ -353,19 +440,21 @@ public:
|
|||||||
const dimensioned<Type>& dt
|
const dimensioned<Type>& dt
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Return renamed tmp field
|
//- Return renamed tmp field (NO_READ, NO_WRITE).
|
||||||
// The field is NO_READ, NO_WRITE, unregistered and uses the
|
//- [Takes current timeName from the mesh registry].
|
||||||
// current timeName from the mesh registry
|
// Registration/persistence determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
static tmp<DimensionedField<Type, GeoMesh>> New
|
static tmp<DimensionedField<Type, GeoMesh>> New
|
||||||
(
|
(
|
||||||
const word& newName,
|
const word& newName,
|
||||||
const tmp<DimensionedField<Type, GeoMesh>>& tfld
|
const tmp<DimensionedField<Type, GeoMesh>>& tfld
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct tmp field based on mesh/registry information from
|
//- Construct tmp field (NO_READ, NO_WRITE)
|
||||||
//- an existing field.
|
//- based on mesh/registry information from an existing field.
|
||||||
// Created NO_READ, NO_WRITE, NO_REGISTER, using the instance
|
//- [Takes instance from the field].
|
||||||
// from the field
|
// Registration/persistence determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
template<class AnyType>
|
template<class AnyType>
|
||||||
static tmp<DimensionedField<Type, GeoMesh>> New
|
static tmp<DimensionedField<Type, GeoMesh>> New
|
||||||
(
|
(
|
||||||
@ -374,10 +463,11 @@ public:
|
|||||||
const dimensionSet& dims
|
const dimensionSet& dims
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct tmp field based on mesh/registry information from
|
//- Construct tmp field (NO_READ, NO_WRITE)
|
||||||
//- an existing field and initialise with value.
|
//- based on mesh/registry information from an existing field
|
||||||
// Created NO_READ, NO_WRITE, NO_REGISTER, using the instance
|
//- and initialise with value.
|
||||||
// from the field
|
// Registration/persistence determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
template<class AnyType>
|
template<class AnyType>
|
||||||
static tmp<DimensionedField<Type, GeoMesh>> New
|
static tmp<DimensionedField<Type, GeoMesh>> New
|
||||||
(
|
(
|
||||||
@ -388,7 +478,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~DimensionedField() = default;
|
virtual ~DimensionedField();
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -471,8 +561,12 @@ public:
|
|||||||
|
|
||||||
// Write
|
// Write
|
||||||
|
|
||||||
|
//- Write dimensions, oriented flag (if valid) and the
|
||||||
|
//- field data as a dictionary entry with the specified name.
|
||||||
bool writeData(Ostream& os, const word& fieldDictEntry) const;
|
bool writeData(Ostream& os, const word& fieldDictEntry) const;
|
||||||
|
|
||||||
|
//- The writeData function (required by regIOobject),
|
||||||
|
//- call writeData with dictionary entry name = "value"
|
||||||
bool writeData(Ostream& os) const;
|
bool writeData(Ostream& os) const;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -25,16 +25,17 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type, class GeoMesh>
|
template<class Type, class GeoMesh>
|
||||||
|
template<class... Args>
|
||||||
Foam::tmp<Foam::DimensionedField<Type, GeoMesh>>
|
Foam::tmp<Foam::DimensionedField<Type, GeoMesh>>
|
||||||
Foam::DimensionedField<Type, GeoMesh>::New
|
Foam::DimensionedField<Type, GeoMesh>::New_impl
|
||||||
(
|
(
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
const word& name,
|
const word& name,
|
||||||
const Mesh& mesh,
|
const Mesh& mesh,
|
||||||
const dimensionSet& dims,
|
Args&&... args
|
||||||
const Field<Type>& iField
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
auto ptr = tmp<DimensionedField<Type, GeoMesh>>::New
|
auto ptr = tmp<DimensionedField<Type, GeoMesh>>::New
|
||||||
@ -49,13 +50,18 @@ Foam::DimensionedField<Type, GeoMesh>::New
|
|||||||
IOobjectOption::NO_REGISTER
|
IOobjectOption::NO_REGISTER
|
||||||
),
|
),
|
||||||
mesh,
|
mesh,
|
||||||
dims,
|
std::forward<Args>(args)...
|
||||||
iField
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if
|
if (IOobjectOption::REGISTER == regOpt)
|
||||||
|
{
|
||||||
|
ptr->checkIn();
|
||||||
|
}
|
||||||
|
else if
|
||||||
(
|
(
|
||||||
ptr->db().is_cacheTemporaryObject(ptr.get())
|
// LEGACY_REGISTER: detect if caching is desired
|
||||||
|
(IOobjectOption::LEGACY_REGISTER == regOpt)
|
||||||
|
&& ptr->db().is_cacheTemporaryObject(ptr.get())
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ptr.protect(true);
|
ptr.protect(true);
|
||||||
@ -65,6 +71,73 @@ Foam::DimensionedField<Type, GeoMesh>::New
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type, class GeoMesh>
|
||||||
|
Foam::tmp<Foam::DimensionedField<Type, GeoMesh>>
|
||||||
|
Foam::DimensionedField<Type, GeoMesh>::New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const dimensionSet& dims,
|
||||||
|
const Field<Type>& iField
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return DimensionedField<Type, GeoMesh>::New_impl
|
||||||
|
(
|
||||||
|
regOpt,
|
||||||
|
name,
|
||||||
|
mesh,
|
||||||
|
dims,
|
||||||
|
iField
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type, class GeoMesh>
|
||||||
|
Foam::tmp<Foam::DimensionedField<Type, GeoMesh>>
|
||||||
|
Foam::DimensionedField<Type, GeoMesh>::New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const dimensionSet& dims,
|
||||||
|
const Field<Type>& iField
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return DimensionedField<Type, GeoMesh>::New_impl
|
||||||
|
(
|
||||||
|
IOobjectOption::LEGACY_REGISTER,
|
||||||
|
name,
|
||||||
|
mesh,
|
||||||
|
dims,
|
||||||
|
iField
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type, class GeoMesh>
|
||||||
|
Foam::tmp<Foam::DimensionedField<Type, GeoMesh>>
|
||||||
|
Foam::DimensionedField<Type, GeoMesh>::New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const dimensionSet& dims,
|
||||||
|
Field<Type>&& iField
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return DimensionedField<Type, GeoMesh>::New_impl
|
||||||
|
(
|
||||||
|
regOpt,
|
||||||
|
name,
|
||||||
|
mesh,
|
||||||
|
dims,
|
||||||
|
std::move(iField)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type, class GeoMesh>
|
template<class Type, class GeoMesh>
|
||||||
Foam::tmp<Foam::DimensionedField<Type, GeoMesh>>
|
Foam::tmp<Foam::DimensionedField<Type, GeoMesh>>
|
||||||
Foam::DimensionedField<Type, GeoMesh>::New
|
Foam::DimensionedField<Type, GeoMesh>::New
|
||||||
@ -75,31 +148,35 @@ Foam::DimensionedField<Type, GeoMesh>::New
|
|||||||
Field<Type>&& iField
|
Field<Type>&& iField
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
auto ptr = tmp<DimensionedField<Type, GeoMesh>>::New
|
return DimensionedField<Type, GeoMesh>::New_impl
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
(
|
||||||
|
IOobjectOption::LEGACY_REGISTER,
|
||||||
name,
|
name,
|
||||||
mesh.thisDb().time().timeName(),
|
|
||||||
mesh.thisDb(),
|
|
||||||
IOobjectOption::NO_READ,
|
|
||||||
IOobjectOption::NO_WRITE,
|
|
||||||
IOobjectOption::NO_REGISTER
|
|
||||||
),
|
|
||||||
mesh,
|
mesh,
|
||||||
dims,
|
dims,
|
||||||
std::move(iField)
|
std::move(iField)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if
|
|
||||||
|
template<class Type, class GeoMesh>
|
||||||
|
Foam::tmp<Foam::DimensionedField<Type, GeoMesh>>
|
||||||
|
Foam::DimensionedField<Type, GeoMesh>::New
|
||||||
(
|
(
|
||||||
ptr->db().is_cacheTemporaryObject(ptr.get())
|
const word& name,
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const dimensionSet& dims
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ptr.protect(true);
|
return DimensionedField<Type, GeoMesh>::New_impl
|
||||||
ptr->checkIn();
|
(
|
||||||
}
|
regOpt,
|
||||||
return ptr;
|
name,
|
||||||
|
mesh,
|
||||||
|
dims,
|
||||||
|
false // No checkIOFlags (is NO_READ anyhow)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -112,31 +189,37 @@ Foam::DimensionedField<Type, GeoMesh>::New
|
|||||||
const dimensionSet& dims
|
const dimensionSet& dims
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
auto ptr = tmp<DimensionedField<Type, GeoMesh>>::New
|
return DimensionedField<Type, GeoMesh>::New_impl
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
(
|
||||||
|
IOobjectOption::LEGACY_REGISTER,
|
||||||
name,
|
name,
|
||||||
mesh.thisDb().time().timeName(),
|
|
||||||
mesh.thisDb(),
|
|
||||||
IOobjectOption::NO_READ,
|
|
||||||
IOobjectOption::NO_WRITE,
|
|
||||||
IOobjectOption::NO_REGISTER
|
|
||||||
),
|
|
||||||
mesh,
|
mesh,
|
||||||
dims,
|
dims,
|
||||||
false // checkIOFlags off
|
false // No checkIOFlags (is NO_READ anyhow)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if
|
|
||||||
|
template<class Type, class GeoMesh>
|
||||||
|
Foam::tmp<Foam::DimensionedField<Type, GeoMesh>>
|
||||||
|
Foam::DimensionedField<Type, GeoMesh>::New
|
||||||
(
|
(
|
||||||
ptr->db().is_cacheTemporaryObject(ptr.get())
|
const word& name,
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const Type& value,
|
||||||
|
const dimensionSet& dims
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ptr.protect(true);
|
return DimensionedField<Type, GeoMesh>::New_impl
|
||||||
ptr->checkIn();
|
(
|
||||||
}
|
regOpt,
|
||||||
return ptr;
|
name,
|
||||||
|
mesh,
|
||||||
|
value,
|
||||||
|
dims,
|
||||||
|
false // No checkIOFlags (is NO_READ anyhow)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -150,32 +233,36 @@ Foam::DimensionedField<Type, GeoMesh>::New
|
|||||||
const dimensionSet& dims
|
const dimensionSet& dims
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
auto ptr = tmp<DimensionedField<Type, GeoMesh>>::New
|
return DimensionedField<Type, GeoMesh>::New_impl
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
(
|
||||||
|
IOobjectOption::LEGACY_REGISTER,
|
||||||
name,
|
name,
|
||||||
mesh.thisDb().time().timeName(),
|
|
||||||
mesh.thisDb(),
|
|
||||||
IOobjectOption::NO_READ,
|
|
||||||
IOobjectOption::NO_WRITE,
|
|
||||||
IOobjectOption::NO_REGISTER
|
|
||||||
),
|
|
||||||
mesh,
|
mesh,
|
||||||
value,
|
value,
|
||||||
dims,
|
dims,
|
||||||
false // checkIOFlags off
|
false // No checkIOFlags (is NO_READ anyhow)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if
|
|
||||||
|
template<class Type, class GeoMesh>
|
||||||
|
Foam::tmp<Foam::DimensionedField<Type, GeoMesh>>
|
||||||
|
Foam::DimensionedField<Type, GeoMesh>::New
|
||||||
(
|
(
|
||||||
ptr->db().is_cacheTemporaryObject(ptr.get())
|
const word& name,
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const dimensioned<Type>& dt
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ptr.protect(true);
|
return DimensionedField<Type, GeoMesh>::New
|
||||||
ptr->checkIn();
|
(
|
||||||
}
|
name,
|
||||||
return ptr;
|
regOpt,
|
||||||
|
mesh,
|
||||||
|
dt.value(),
|
||||||
|
dt.dimensions()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -899,6 +899,11 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::~GeometricField()
|
|||||||
|
|
||||||
deleteDemandDrivenData(field0Ptr_);
|
deleteDemandDrivenData(field0Ptr_);
|
||||||
deleteDemandDrivenData(fieldPrevIterPtr_);
|
deleteDemandDrivenData(fieldPrevIterPtr_);
|
||||||
|
|
||||||
|
// FUTURE: register cache field info
|
||||||
|
// // this->db().cacheTemporaryObject(*this);
|
||||||
|
|
||||||
|
clearOldTimes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -955,6 +960,14 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::boundaryFieldRef
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||||
|
Foam::label
|
||||||
|
Foam::GeometricField<Type, PatchField, GeoMesh>::nOldTimes() const noexcept
|
||||||
|
{
|
||||||
|
return (field0Ptr_ ? (field0Ptr_->nOldTimes() + 1) : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||||
void Foam::GeometricField<Type, PatchField, GeoMesh>::storeOldTimes() const
|
void Foam::GeometricField<Type, PatchField, GeoMesh>::storeOldTimes() const
|
||||||
{
|
{
|
||||||
@ -995,18 +1008,6 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::storeOldTime() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
|
||||||
Foam::label Foam::GeometricField<Type, PatchField, GeoMesh>::nOldTimes() const
|
|
||||||
{
|
|
||||||
if (field0Ptr_)
|
|
||||||
{
|
|
||||||
return field0Ptr_->nOldTimes() + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||||
const Foam::GeometricField<Type, PatchField, GeoMesh>&
|
const Foam::GeometricField<Type, PatchField, GeoMesh>&
|
||||||
Foam::GeometricField<Type, PatchField, GeoMesh>::oldTime() const
|
Foam::GeometricField<Type, PatchField, GeoMesh>::oldTime() const
|
||||||
@ -1097,6 +1098,14 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::prevIter() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||||
|
void Foam::GeometricField<Type, PatchField, GeoMesh>::clearOldTimes()
|
||||||
|
{
|
||||||
|
deleteDemandDrivenData(field0Ptr_);
|
||||||
|
deleteDemandDrivenData(fieldPrevIterPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||||
void Foam::GeometricField<Type, PatchField, GeoMesh>::
|
void Foam::GeometricField<Type, PatchField, GeoMesh>::
|
||||||
correctBoundaryConditions()
|
correctBoundaryConditions()
|
||||||
|
|||||||
@ -134,6 +134,18 @@ private:
|
|||||||
//- Read the field - create the field dictionary on-the-fly
|
//- Read the field - create the field dictionary on-the-fly
|
||||||
void readFields();
|
void readFields();
|
||||||
|
|
||||||
|
//- Implementation for 'New' with specified registerObject preference.
|
||||||
|
// For LEGACY_REGISTER, registration is determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
|
template<class... Args>
|
||||||
|
static tmp<GeometricField<Type, PatchField, GeoMesh>> New_impl
|
||||||
|
(
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
|
const word& name,
|
||||||
|
const Mesh& mesh,
|
||||||
|
Args&&... args
|
||||||
|
);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
@ -405,9 +417,25 @@ public:
|
|||||||
|
|
||||||
// Factory Methods
|
// Factory Methods
|
||||||
|
|
||||||
//- Return tmp field from name, mesh, dimensions and patch type.
|
//- Return tmp field (NO_READ, NO_WRITE)
|
||||||
// The field is NO_READ, NO_WRITE, unregistered and uses the
|
//- from name, mesh, dimensions and patch type.
|
||||||
// current timeName from the mesh registry
|
//- [Takes current timeName from the mesh registry].
|
||||||
|
// For LEGACY_REGISTER, registration is determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
|
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const dimensionSet& dims,
|
||||||
|
const word& patchFieldType = PatchField<Type>::calculatedType()
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Return tmp field (NO_READ, NO_WRITE)
|
||||||
|
//- from name, mesh, dimensions and patch type.
|
||||||
|
//- [Takes current timeName from the mesh registry].
|
||||||
|
// Registration/persistence determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
@ -416,10 +444,26 @@ public:
|
|||||||
const word& patchFieldType = PatchField<Type>::calculatedType()
|
const word& patchFieldType = PatchField<Type>::calculatedType()
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Return tmp field from name, mesh, dimensions,
|
//- Return tmp field (NO_READ, NO_WRITE)
|
||||||
//- copy of internal field, with specified patch type.
|
//- from name, mesh, dimensions, copy of internal field and patch type.
|
||||||
// The field is NO_READ, NO_WRITE, unregistered and uses the
|
//- [Takes current timeName from the mesh registry].
|
||||||
// current timeName from the mesh registry
|
// For LEGACY_REGISTER, registration is determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
|
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const dimensionSet& dims,
|
||||||
|
const Field<Type>& iField,
|
||||||
|
const word& patchFieldType = PatchField<Type>::calculatedType()
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Return tmp field (NO_READ, NO_WRITE)
|
||||||
|
//- from name, mesh, dimensions, copy of internal field and patch type.
|
||||||
|
//- [Takes current timeName from the mesh registry].
|
||||||
|
// Registration/persistence determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
@ -429,10 +473,28 @@ public:
|
|||||||
const word& patchFieldType = PatchField<Type>::calculatedType()
|
const word& patchFieldType = PatchField<Type>::calculatedType()
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Return tmp field from name, mesh, dimensions,
|
//- Return tmp field (NO_READ, NO_WRITE)
|
||||||
//- moved internal field contents, with specified patch type.
|
//- from name, mesh, dimensions, moved internal field contents
|
||||||
// The field is NO_READ, NO_WRITE, unregistered and uses the
|
//- and patch type.
|
||||||
// current timeName from the mesh registry
|
//- [Takes current timeName from the mesh registry].
|
||||||
|
// For LEGACY_REGISTER, registration is determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
|
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const dimensionSet& dims,
|
||||||
|
Field<Type>&& iField,
|
||||||
|
const word& patchFieldType = PatchField<Type>::calculatedType()
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Return tmp field (NO_READ, NO_WRITE)
|
||||||
|
//- from name, mesh, dimensions, moved internal field contents
|
||||||
|
//- and patch type.
|
||||||
|
//- [Takes current timeName from the mesh registry].
|
||||||
|
// Registration/persistence determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
@ -442,10 +504,26 @@ public:
|
|||||||
const word& patchFieldType = PatchField<Type>::calculatedType()
|
const word& patchFieldType = PatchField<Type>::calculatedType()
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Return tmp field from name, mesh, dimensions, initial field value
|
//- Return tmp field (NO_READ, NO_WRITE)
|
||||||
//- and patch type.
|
//- from name, mesh, field value, dimensions and patch type.
|
||||||
// The field is NO_READ, NO_WRITE, unregistered and uses the
|
//- [Takes current timeName from the mesh registry].
|
||||||
// current timeName from the mesh registry
|
// For LEGACY_REGISTER, registration is determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
|
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const Type& value,
|
||||||
|
const dimensionSet& dims,
|
||||||
|
const word& patchFieldType = PatchField<Type>::calculatedType()
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Return tmp field (NO_READ, NO_WRITE)
|
||||||
|
//- from name, mesh, field value, dimensions and patch type.
|
||||||
|
//- [Takes current timeName from the mesh registry].
|
||||||
|
// Registration/persistence determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
@ -455,10 +533,27 @@ public:
|
|||||||
const word& patchFieldType = PatchField<Type>::calculatedType()
|
const word& patchFieldType = PatchField<Type>::calculatedType()
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Return tmp field from name, mesh, dimensioned\<Type\>
|
//- Return tmp field (NO_READ, NO_WRITE)
|
||||||
//- and patch types.
|
//- from name, mesh, field value, dimensions and patch field types.
|
||||||
// The field is NO_READ, NO_WRITE, unregistered and uses the
|
//- [Takes current timeName from the mesh registry].
|
||||||
// current timeName from the mesh registry
|
// For LEGACY_REGISTER, registration is determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
|
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const Type& value,
|
||||||
|
const dimensionSet& dims,
|
||||||
|
const wordList& patchFieldTypes,
|
||||||
|
const wordList& actualPatchTypes = wordList()
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Return tmp field (NO_READ, NO_WRITE)
|
||||||
|
//- from name, mesh, field value, dimensions and patch field types.
|
||||||
|
//- [Takes current timeName from the mesh registry].
|
||||||
|
// Registration/persistence determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
@ -469,10 +564,25 @@ public:
|
|||||||
const wordList& actualPatchTypes = wordList()
|
const wordList& actualPatchTypes = wordList()
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Return tmp field from name, mesh, dimensioned\<Type\>
|
//- Return tmp field (NO_READ, NO_WRITE)
|
||||||
//- and patch type.
|
//- from name, mesh, dimensioned-type and patch type.
|
||||||
// The field is NO_READ, NO_WRITE, unregistered and uses the
|
//- [Takes current timeName from the mesh registry].
|
||||||
// current timeName from the mesh registry
|
// For LEGACY_REGISTER, registration is determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
|
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const dimensioned<Type>& dt,
|
||||||
|
const word& patchFieldType = PatchField<Type>::calculatedType()
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Return tmp field (NO_READ, NO_WRITE)
|
||||||
|
//- from name, mesh, dimensioned-type and patch type.
|
||||||
|
//- [Takes current timeName from the mesh registry].
|
||||||
|
// Registration/persistence determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
@ -481,10 +591,26 @@ public:
|
|||||||
const word& patchFieldType = PatchField<Type>::calculatedType()
|
const word& patchFieldType = PatchField<Type>::calculatedType()
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Return tmp field from name, mesh, dimensioned\<Type\>
|
//- Return tmp field (NO_READ, NO_WRITE)
|
||||||
//- and patch types.
|
//- from name, mesh, dimensioned-type and patch field types.
|
||||||
// The field is NO_READ, NO_WRITE, unregistered and uses the
|
//- [Takes current timeName from the mesh registry].
|
||||||
// current timeName from the mesh registry
|
// For LEGACY_REGISTER, registration is determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
|
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const dimensioned<Type>& dt,
|
||||||
|
const wordList& patchFieldTypes,
|
||||||
|
const wordList& actualPatchTypes = wordList()
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Return tmp field (NO_READ, NO_WRITE)
|
||||||
|
//- from name, mesh, dimensioned-type and patch field types.
|
||||||
|
//- [Takes current timeName from the mesh registry].
|
||||||
|
// Registration/persistence determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
@ -494,18 +620,21 @@ public:
|
|||||||
const wordList& actualPatchTypes = wordList()
|
const wordList& actualPatchTypes = wordList()
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Return renamed tmp field
|
//- Return renamed tmp field (NO_READ, NO_WRITE)
|
||||||
// The field is NO_READ, NO_WRITE, unregistered and uses the
|
//- [Takes current timeName from the mesh registry].
|
||||||
// current timeName from the mesh registry
|
// Registration/persistence determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||||
(
|
(
|
||||||
const word& newName,
|
const word& newName,
|
||||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf
|
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Rename tmp field and reset patch field type
|
//- Return renamed tmp field (NO_READ, NO_WRITE)
|
||||||
// The field is NO_READ, NO_WRITE, unregistered and uses the
|
//- with reset patch field type.
|
||||||
// current timeName from the mesh registry
|
//- [Takes current timeName from the mesh registry].
|
||||||
|
// Registration/persistence determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||||
(
|
(
|
||||||
const word& newName,
|
const word& newName,
|
||||||
@ -513,9 +642,11 @@ public:
|
|||||||
const word& patchFieldType
|
const word& patchFieldType
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Rename tmp field and reset patch field types and return
|
//- Return renamed tmp field (NO_READ, NO_WRITE)
|
||||||
// The field is NO_READ, NO_WRITE, unregistered and uses the
|
//- with reset patch field types.
|
||||||
// current timeName from the mesh registry
|
//- [Takes instance from the field].
|
||||||
|
// Registration/persistence determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||||
(
|
(
|
||||||
const word& newName,
|
const word& newName,
|
||||||
@ -524,10 +655,11 @@ public:
|
|||||||
const wordList& actualPatchTypes = wordList()
|
const wordList& actualPatchTypes = wordList()
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct tmp field based on mesh/registry information from
|
//- Construct tmp field (NO_READ, NO_WRITE)
|
||||||
//- an existing field.
|
//- based on mesh/registry information from an existing field.
|
||||||
// Created NO_READ, NO_WRITE, NO_REGISTER, using the instance
|
//- [Takes instance from the field].
|
||||||
// from the field
|
// Registration/persistence determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
template<class AnyType>
|
template<class AnyType>
|
||||||
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||||
(
|
(
|
||||||
@ -537,10 +669,12 @@ public:
|
|||||||
const word& patchFieldType = PatchField<Type>::calculatedType()
|
const word& patchFieldType = PatchField<Type>::calculatedType()
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct tmp field based on mesh/registry information from
|
//- Construct tmp field (NO_READ, NO_WRITE)
|
||||||
//- an existing field and initialise with value.
|
//- based on mesh/registry information from an existing field.
|
||||||
// Created NO_READ, NO_WRITE, NO_REGISTER, using the instance
|
//- and initialise with value.
|
||||||
// from the field
|
//- [Takes instance from the field].
|
||||||
|
// Registration/persistence determined by
|
||||||
|
// objectRegistry::is_cacheTemporaryObject().
|
||||||
template<class AnyType>
|
template<class AnyType>
|
||||||
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||||
(
|
(
|
||||||
@ -610,15 +744,15 @@ public:
|
|||||||
//- Write-access to the time index of the field
|
//- Write-access to the time index of the field
|
||||||
inline label& timeIndex() noexcept;
|
inline label& timeIndex() noexcept;
|
||||||
|
|
||||||
|
//- The number of old time fields stored
|
||||||
|
label nOldTimes() const noexcept;
|
||||||
|
|
||||||
//- Store the old-time fields
|
//- Store the old-time fields
|
||||||
void storeOldTimes() const;
|
void storeOldTimes() const;
|
||||||
|
|
||||||
//- Store the old-time field
|
//- Store the old-time field
|
||||||
void storeOldTime() const;
|
void storeOldTime() const;
|
||||||
|
|
||||||
//- Return the number of old time fields stored
|
|
||||||
label nOldTimes() const;
|
|
||||||
|
|
||||||
//- Return old time field
|
//- Return old time field
|
||||||
const GeometricField<Type, PatchField, GeoMesh>& oldTime() const;
|
const GeometricField<Type, PatchField, GeoMesh>& oldTime() const;
|
||||||
|
|
||||||
@ -632,6 +766,9 @@ public:
|
|||||||
//- Return previous iteration field
|
//- Return previous iteration field
|
||||||
const GeometricField<Type, PatchField, GeoMesh>& prevIter() const;
|
const GeometricField<Type, PatchField, GeoMesh>& prevIter() const;
|
||||||
|
|
||||||
|
//- Remove old-time and prev-iter fields
|
||||||
|
void clearOldTimes();
|
||||||
|
|
||||||
//- Correct boundary field
|
//- Correct boundary field
|
||||||
void correctBoundaryConditions();
|
void correctBoundaryConditions();
|
||||||
|
|
||||||
@ -648,9 +785,6 @@ public:
|
|||||||
const direction
|
const direction
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- WriteData member function required by regIOobject
|
|
||||||
bool writeData(Ostream&) const;
|
|
||||||
|
|
||||||
//- Return transpose (only if it is a tensor field)
|
//- Return transpose (only if it is a tensor field)
|
||||||
tmp<GeometricField<Type, PatchField, GeoMesh>> T() const;
|
tmp<GeometricField<Type, PatchField, GeoMesh>> T() const;
|
||||||
|
|
||||||
@ -774,6 +908,13 @@ public:
|
|||||||
bool operator!=(const dimensioned<Type>&) = delete;
|
bool operator!=(const dimensioned<Type>&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
// Write
|
||||||
|
|
||||||
|
//- The writeData function (required by regIOobject),
|
||||||
|
//- calls operator<<
|
||||||
|
bool writeData(Ostream& os) const;
|
||||||
|
|
||||||
|
|
||||||
// Ostream Operators
|
// Ostream Operators
|
||||||
|
|
||||||
friend Ostream& operator<< <Type, PatchField, GeoMesh>
|
friend Ostream& operator<< <Type, PatchField, GeoMesh>
|
||||||
|
|||||||
@ -26,16 +26,17 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||||
|
template<class... Args>
|
||||||
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||||
Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
Foam::GeometricField<Type, PatchField, GeoMesh>::New_impl
|
||||||
(
|
(
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
const word& name,
|
const word& name,
|
||||||
const Mesh& mesh,
|
const Mesh& mesh,
|
||||||
const dimensionSet& dims,
|
Args&&... args
|
||||||
const word& patchFieldType
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
auto ptr = tmp<GeometricField<Type, PatchField, GeoMesh>>::New
|
auto ptr = tmp<GeometricField<Type, PatchField, GeoMesh>>::New
|
||||||
@ -50,13 +51,18 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
|||||||
IOobjectOption::NO_REGISTER
|
IOobjectOption::NO_REGISTER
|
||||||
),
|
),
|
||||||
mesh,
|
mesh,
|
||||||
dims,
|
std::forward<Args>(args)...
|
||||||
patchFieldType
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if
|
if (IOobjectOption::REGISTER == regOpt)
|
||||||
|
{
|
||||||
|
ptr->checkIn();
|
||||||
|
}
|
||||||
|
else if
|
||||||
(
|
(
|
||||||
ptr->db().is_cacheTemporaryObject(ptr.get())
|
// LEGACY_REGISTER: detect if caching is desired
|
||||||
|
(IOobjectOption::LEGACY_REGISTER == regOpt)
|
||||||
|
&& ptr->db().is_cacheTemporaryObject(ptr.get())
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ptr.protect(true);
|
ptr.protect(true);
|
||||||
@ -66,6 +72,75 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||||
|
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||||
|
Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const dimensionSet& dims,
|
||||||
|
const word& patchFieldType
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return GeometricField<Type, PatchField, GeoMesh>::New_impl
|
||||||
|
(
|
||||||
|
regOpt,
|
||||||
|
name,
|
||||||
|
mesh,
|
||||||
|
dims,
|
||||||
|
patchFieldType
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||||
|
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||||
|
Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const dimensionSet& dims,
|
||||||
|
const word& patchFieldType
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return GeometricField<Type, PatchField, GeoMesh>::New_impl
|
||||||
|
(
|
||||||
|
IOobjectOption::LEGACY_REGISTER,
|
||||||
|
name,
|
||||||
|
mesh,
|
||||||
|
dims,
|
||||||
|
patchFieldType
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||||
|
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||||
|
Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const dimensionSet& dims,
|
||||||
|
const Field<Type>& iField,
|
||||||
|
const word& patchFieldType
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return GeometricField<Type, PatchField, GeoMesh>::New_impl
|
||||||
|
(
|
||||||
|
regOpt,
|
||||||
|
name,
|
||||||
|
mesh,
|
||||||
|
dims,
|
||||||
|
iField,
|
||||||
|
patchFieldType
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||||
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||||
Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
||||||
@ -77,32 +152,39 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
|||||||
const word& patchFieldType
|
const word& patchFieldType
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
auto ptr = tmp<GeometricField<Type, PatchField, GeoMesh>>::New
|
return GeometricField<Type, PatchField, GeoMesh>::New_impl
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
(
|
||||||
|
IOobjectOption::LEGACY_REGISTER,
|
||||||
name,
|
name,
|
||||||
mesh.thisDb().time().timeName(),
|
|
||||||
mesh.thisDb(),
|
|
||||||
IOobjectOption::NO_READ,
|
|
||||||
IOobjectOption::NO_WRITE,
|
|
||||||
IOobjectOption::NO_REGISTER
|
|
||||||
),
|
|
||||||
mesh,
|
mesh,
|
||||||
dims,
|
dims,
|
||||||
iField,
|
iField,
|
||||||
patchFieldType
|
patchFieldType
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if
|
|
||||||
|
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||||
|
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||||
|
Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
||||||
(
|
(
|
||||||
ptr->db().is_cacheTemporaryObject(ptr.get())
|
const word& name,
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const dimensionSet& dims,
|
||||||
|
Field<Type>&& iField,
|
||||||
|
const word& patchFieldType
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ptr.protect(true);
|
return GeometricField<Type, PatchField, GeoMesh>::New_impl
|
||||||
ptr->checkIn();
|
(
|
||||||
}
|
regOpt,
|
||||||
return ptr;
|
name,
|
||||||
|
mesh,
|
||||||
|
dims,
|
||||||
|
std::move(iField),
|
||||||
|
patchFieldType
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -117,32 +199,39 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
|||||||
const word& patchFieldType
|
const word& patchFieldType
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
auto ptr = tmp<GeometricField<Type, PatchField, GeoMesh>>::New
|
return GeometricField<Type, PatchField, GeoMesh>::New_impl
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
(
|
||||||
|
IOobjectOption::LEGACY_REGISTER,
|
||||||
name,
|
name,
|
||||||
mesh.thisDb().time().timeName(),
|
|
||||||
mesh.thisDb(),
|
|
||||||
IOobjectOption::NO_READ,
|
|
||||||
IOobjectOption::NO_WRITE,
|
|
||||||
IOobjectOption::NO_REGISTER
|
|
||||||
),
|
|
||||||
mesh,
|
mesh,
|
||||||
dims,
|
dims,
|
||||||
std::move(iField),
|
std::move(iField),
|
||||||
patchFieldType
|
patchFieldType
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if
|
|
||||||
|
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||||
|
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||||
|
Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
||||||
(
|
(
|
||||||
ptr->db().is_cacheTemporaryObject(ptr.get())
|
const word& name,
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const Type& value,
|
||||||
|
const dimensionSet& dims,
|
||||||
|
const word& patchFieldType
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ptr.protect(true);
|
return GeometricField<Type, PatchField, GeoMesh>::New_impl
|
||||||
ptr->checkIn();
|
(
|
||||||
}
|
regOpt,
|
||||||
return ptr;
|
name,
|
||||||
|
mesh,
|
||||||
|
value,
|
||||||
|
dims,
|
||||||
|
patchFieldType
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -157,32 +246,41 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
|||||||
const word& patchFieldType
|
const word& patchFieldType
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
auto ptr = tmp<GeometricField<Type, PatchField, GeoMesh>>::New
|
return GeometricField<Type, PatchField, GeoMesh>::New_impl
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
(
|
||||||
|
IOobjectOption::LEGACY_REGISTER,
|
||||||
name,
|
name,
|
||||||
mesh.thisDb().time().timeName(),
|
|
||||||
mesh.thisDb(),
|
|
||||||
IOobjectOption::NO_READ,
|
|
||||||
IOobjectOption::NO_WRITE,
|
|
||||||
IOobjectOption::NO_REGISTER
|
|
||||||
),
|
|
||||||
mesh,
|
mesh,
|
||||||
value,
|
value,
|
||||||
dims,
|
dims,
|
||||||
patchFieldType
|
patchFieldType
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if
|
|
||||||
|
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||||
|
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||||
|
Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
||||||
(
|
(
|
||||||
ptr->db().is_cacheTemporaryObject(ptr.get())
|
const word& name,
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const Type& value,
|
||||||
|
const dimensionSet& dims,
|
||||||
|
const wordList& patchFieldTypes,
|
||||||
|
const wordList& actualPatchTypes
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ptr.protect(true);
|
return GeometricField<Type, PatchField, GeoMesh>::New_impl
|
||||||
ptr->checkIn();
|
(
|
||||||
}
|
regOpt,
|
||||||
return ptr;
|
name,
|
||||||
|
mesh,
|
||||||
|
value,
|
||||||
|
dims,
|
||||||
|
patchFieldTypes,
|
||||||
|
actualPatchTypes
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -198,33 +296,39 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
|||||||
const wordList& actualPatchTypes
|
const wordList& actualPatchTypes
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
auto ptr = tmp<GeometricField<Type, PatchField, GeoMesh>>::New
|
return GeometricField<Type, PatchField, GeoMesh>::New_impl
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
(
|
||||||
|
IOobjectOption::LEGACY_REGISTER,
|
||||||
name,
|
name,
|
||||||
mesh.thisDb().time().timeName(),
|
|
||||||
mesh.thisDb(),
|
|
||||||
IOobjectOption::NO_READ,
|
|
||||||
IOobjectOption::NO_WRITE,
|
|
||||||
IOobjectOption::NO_REGISTER
|
|
||||||
),
|
|
||||||
mesh,
|
mesh,
|
||||||
value,
|
value,
|
||||||
dims,
|
dims,
|
||||||
patchFieldTypes,
|
patchFieldTypes,
|
||||||
actualPatchTypes
|
actualPatchTypes
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if
|
|
||||||
|
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||||
|
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||||
|
Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
||||||
(
|
(
|
||||||
ptr->db().is_cacheTemporaryObject(ptr.get())
|
const word& name,
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const dimensioned<Type>& dt,
|
||||||
|
const word& patchFieldType
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ptr.protect(true);
|
return GeometricField<Type, PatchField, GeoMesh>::New
|
||||||
ptr->checkIn();
|
(
|
||||||
}
|
name,
|
||||||
return ptr;
|
regOpt,
|
||||||
|
mesh,
|
||||||
|
dt.value(),
|
||||||
|
dt.dimensions(),
|
||||||
|
patchFieldType
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -249,6 +353,31 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||||
|
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||||
|
Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
IOobjectOption::registerOption regOpt,
|
||||||
|
const Mesh& mesh,
|
||||||
|
const dimensioned<Type>& dt,
|
||||||
|
const wordList& patchFieldTypes,
|
||||||
|
const wordList& actualPatchTypes
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return GeometricField<Type, PatchField, GeoMesh>::New
|
||||||
|
(
|
||||||
|
name,
|
||||||
|
regOpt,
|
||||||
|
mesh,
|
||||||
|
dt.value(),
|
||||||
|
dt.dimensions(),
|
||||||
|
patchFieldTypes,
|
||||||
|
actualPatchTypes
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||||
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||||
Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
||||||
|
|||||||
@ -89,7 +89,7 @@ void Foam::heThermo<BasicThermo, MixtureType>::init
|
|||||||
this->heBoundaryCorrection(he);
|
this->heBoundaryCorrection(he);
|
||||||
|
|
||||||
// Note: T does not have oldTime
|
// Note: T does not have oldTime
|
||||||
if (p.nOldTimes() > 0)
|
if (p.nOldTimes())
|
||||||
{
|
{
|
||||||
init(p.oldTime(), T.oldTime(), he.oldTime());
|
init(p.oldTime(), T.oldTime(), he.oldTime());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user