DimensionedField: Added "New" methods to return unregistered temporary fields

This commit is contained in:
Henry Weller
2018-12-19 13:55:09 +00:00
parent 3708da6175
commit b55c176eb8
2 changed files with 74 additions and 0 deletions

View File

@ -276,6 +276,64 @@ DimensionedField<Type, GeoMesh>::clone() const
}
template<class Type, class GeoMesh>
Foam::tmp<Foam::DimensionedField<Type, GeoMesh>>
DimensionedField<Type, GeoMesh>::New
(
const word& name,
const Mesh& mesh,
const dimensionSet& ds
)
{
return tmp<DimensionedField<Type, GeoMesh>>
(
new DimensionedField<Type, GeoMesh>
(
IOobject
(
name,
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh,
ds,
false
)
);
}
template<class Type, class GeoMesh>
Foam::tmp<Foam::DimensionedField<Type, GeoMesh>>
DimensionedField<Type, GeoMesh>::New
(
const word& newName,
const tmp<DimensionedField<Type, GeoMesh>>& tdf
)
{
return tmp<DimensionedField<Type, GeoMesh>>
(
new DimensionedField<Type, GeoMesh>
(
IOobject
(
newName,
tdf().instance(),
tdf().local(),
tdf().db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
tdf
)
);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type, class GeoMesh>

View File

@ -236,6 +236,22 @@ public:
//- Clone
tmp<DimensionedField<Type, GeoMesh>> clone() const;
//- Return a temporary field constructed from name, mesh
// and dimensionSet
static tmp<DimensionedField<Type, GeoMesh>> New
(
const word& name,
const Mesh& mesh,
const dimensionSet&
);
//- Rename temporary field and return
static tmp<DimensionedField<Type, GeoMesh>> New
(
const word& newName,
const tmp<DimensionedField<Type, GeoMesh>>&
);
//- Destructor
virtual ~DimensionedField();