mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
construct from dictionary
This commit is contained in:
@ -52,20 +52,11 @@ Foam::tmp
|
||||
typename Foam::GeometricField<Type, PatchField, GeoMesh>::
|
||||
GeometricBoundaryField
|
||||
>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::readField(Istream& is)
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::readField
|
||||
(
|
||||
const dictionary& fieldDict
|
||||
)
|
||||
{
|
||||
if (is.version() < 2.0)
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"GeometricField<Type, PatchField, GeoMesh>::readField(Istream&)",
|
||||
is
|
||||
) << "IO versions < 2.0 are not supported."
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
dictionary fieldDict(is);
|
||||
|
||||
DimensionedField<Type, GeoMesh>::readField(fieldDict, "internalField");
|
||||
|
||||
tmp<GeometricBoundaryField> tboundaryField
|
||||
@ -96,6 +87,28 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::readField(Istream& is)
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::tmp
|
||||
<
|
||||
typename Foam::GeometricField<Type, PatchField, GeoMesh>::
|
||||
GeometricBoundaryField
|
||||
>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::readField(Istream& is)
|
||||
{
|
||||
if (is.version() < 2.0)
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"GeometricField<Type, PatchField, GeoMesh>::readField(Istream&)",
|
||||
is
|
||||
) << "IO versions < 2.0 are not supported."
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
return readField(dictionary(is));
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
bool Foam::GeometricField<Type, PatchField, GeoMesh>::readIfPresent()
|
||||
{
|
||||
@ -404,6 +417,44 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
|
||||
(
|
||||
const IOobject& io,
|
||||
const Mesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
DimensionedField<Type, GeoMesh>(io, mesh, dimless),
|
||||
timeIndex_(this->time().timeIndex()),
|
||||
field0Ptr_(NULL),
|
||||
fieldPrevIterPtr_(NULL),
|
||||
boundaryField_(*this, readField(dict))
|
||||
{
|
||||
// Check compatibility between field and mesh
|
||||
|
||||
if (this->size() != GeoMesh::size(this->mesh()))
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"GeometricField<Type, PatchField, GeoMesh>::GeometricField"
|
||||
"(const IOobject&, const Mesh&, const dictionary&)"
|
||||
) << " number of field elements = " << this->size()
|
||||
<< " number of mesh elements = " << GeoMesh::size(this->mesh())
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
readOldTimeIfPresent();
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Finishing dictionary-construct of "
|
||||
"GeometricField<Type, PatchField, GeoMesh>"
|
||||
<< endl << this->info() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// construct as copy
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
|
||||
|
||||
@ -240,6 +240,9 @@ private:
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Read the field from the dictionary
|
||||
tmp<GeometricBoundaryField> readField(const dictionary&);
|
||||
|
||||
//- Read the field from the given stream
|
||||
tmp<GeometricBoundaryField> readField(Istream& is);
|
||||
|
||||
@ -327,6 +330,14 @@ public:
|
||||
Istream&
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
GeometricField
|
||||
(
|
||||
const IOobject&,
|
||||
const Mesh&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
GeometricField
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user