Commit 8a27989c authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: Added support for internal vol fields

parent 4032ab5e
......@@ -37,9 +37,14 @@ bool Foam::functionObjects::fieldValues::volFieldValue::validField
const word& fieldName
) const
{
typedef GeometricField<Type, fvPatchField, volMesh> vf;
if (obr_.foundObject<vf>(fieldName))
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
typedef typename VolFieldType::Internal IntVolFieldType;
if
(
obr_.foundObject<VolFieldType>(fieldName)
|| obr_.foundObject<IntVolFieldType>(fieldName)
)
{
return true;
}
......@@ -56,11 +61,16 @@ Foam::functionObjects::fieldValues::volFieldValue::getFieldValues
const bool mustGet
) const
{
typedef GeometricField<Type, fvPatchField, volMesh> vf;
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
typedef typename VolFieldType::Internal IntVolFieldType;
if (obr_.foundObject<vf>(fieldName))
if (obr_.foundObject<VolFieldType>(fieldName))
{
return filterField(obr_.lookupObject<VolFieldType>(fieldName));
}
else if (obr_.foundObject<IntVolFieldType>(fieldName))
{
return filterField(obr_.lookupObject<vf>(fieldName));
return filterField(obr_.lookupObject<IntVolFieldType>(fieldName));
}
if (mustGet)
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2015-2019 OpenCFD Ltd.
Copyright (C) 2015-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -37,6 +37,7 @@ template<class Type>
bool Foam::functionObjects::readFields::loadField(const word& fieldName)
{
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
typedef typename VolFieldType::Internal IntVolFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
/// typedef DimensionedField<Type, surfGeoMesh> SurfFieldType;
......@@ -47,6 +48,13 @@ bool Foam::functionObjects::readFields::loadField(const word& fieldName)
<< " " << fieldName << " already in database"
<< endl;
}
else if (foundObject<IntVolFieldType>(fieldName))
{
DebugInfo
<< "readFields : " << IntVolFieldType::typeName
<< " " << fieldName << " already in database"
<< endl;
}
else if (foundObject<SurfaceFieldType>(fieldName))
{
DebugInfo
......@@ -76,7 +84,15 @@ bool Foam::functionObjects::readFields::loadField(const word& fieldName)
{
// Store field on mesh database
Log << " Reading " << fieldName << endl;
VolFieldType* fldPtr(new VolFieldType(fieldHeader, mesh_));
auto* fldPtr(new VolFieldType(fieldHeader, mesh_));
mesh_.objectRegistry::store(fldPtr);
return true;
}
else if (fieldHeader.typeHeaderOk<IntVolFieldType>(true, true, false))
{
// Store field on mesh database
Log << " Reading " << fieldName << endl;
auto* fldPtr(new IntVolFieldType(fieldHeader, mesh_));
mesh_.objectRegistry::store(fldPtr);
return true;
}
......@@ -84,7 +100,7 @@ bool Foam::functionObjects::readFields::loadField(const word& fieldName)
{
// Store field on mesh database
Log << " Reading " << fieldName << endl;
SurfaceFieldType* fldPtr(new SurfaceFieldType(fieldHeader, mesh_));
auto* fldPtr(new SurfaceFieldType(fieldHeader, mesh_));
mesh_.objectRegistry::store(fldPtr);
return true;
}
......@@ -97,7 +113,7 @@ bool Foam::functionObjects::readFields::loadField(const word& fieldName)
///
/// // Store field on surfMesh database
/// Log << " Reading " << fieldName << endl;
/// SurfFieldType* fldPtr(new SurfFieldType(fieldHeader, s));
/// auto* fldPtr(new SurfFieldType(fieldHeader, s));
/// s.store(fldPtr);
/// return true;
/// }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment