ENH: Updating utilities based on internal development line

This commit is contained in:
Andrew Heather
2015-12-02 10:17:28 +00:00
parent eaf5030600
commit 73dac8c7ee
56 changed files with 1040 additions and 360 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -601,6 +601,53 @@ int main(int argc, char *argv[])
+ vtf.size();
// Construct dimensioned fields
PtrList<volScalarField::DimensionedInternalField> dsf;
PtrList<volVectorField::DimensionedInternalField> dvf;
PtrList<volSphericalTensorField::DimensionedInternalField> dSpheretf;
PtrList<volSymmTensorField::DimensionedInternalField> dSymmtf;
PtrList<volTensorField::DimensionedInternalField> dtf;
if (!specifiedFields || selectedFields.size())
{
readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, dsf);
print(" volScalarFields::Internal :", Info, dsf);
readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, dvf);
print(" volVectorFields::Internal :", Info, dvf);
readFields
(
vMesh,
vMesh.baseMesh(),
objects,
selectedFields,
dSpheretf
);
print(" volSphericalTensorFields::Internal :", Info, dSpheretf);
readFields
(
vMesh,
vMesh.baseMesh(),
objects,
selectedFields,
dSymmtf
);
print(" volSymmTensorFields::Internal :", Info, dSymmtf);
readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, dtf);
print(" volTensorFields::Internal :", Info, dtf);
}
label nDimFields =
dsf.size()
+ dvf.size()
+ dSpheretf.size()
+ dSymmtf.size()
+ dtf.size();
// Construct pointMesh only if nessecary since constructs edge
// addressing (expensive on polyhedral meshes)
if (noPointValues)
@ -701,7 +748,7 @@ int main(int argc, char *argv[])
(
writer.os(),
vMesh.nFieldCells(),
1+nVolFields
1 + nVolFields + nDimFields
);
// Write cellID field
@ -714,13 +761,20 @@ int main(int argc, char *argv[])
writer.write(vSymmtf);
writer.write(vtf);
// Write dimensionedFields
writer.write<scalar, volMesh>(dsf);
writer.write<vector, volMesh>(dvf);
writer.write<sphericalTensor, volMesh>(dSpheretf);
writer.write<symmTensor, volMesh>(dSymmtf);
writer.write<tensor, volMesh>(dtf);
if (!noPointValues)
{
writeFuns::writePointDataHeader
(
writer.os(),
vMesh.nFieldPoints(),
nVolFields+nPointFields
nVolFields + nDimFields + nPointFields
);
// pointFields
@ -737,6 +791,12 @@ int main(int argc, char *argv[])
writer.write(pInterp, vSpheretf);
writer.write(pInterp, vSymmtf);
writer.write(pInterp, vtf);
writer.write<scalar, volMesh>(pInterp, dsf);
writer.write<vector, volMesh>(pInterp, dvf);
writer.write<sphericalTensor, volMesh>(pInterp, dSpheretf);
writer.write<symmTensor, volMesh>(pInterp, dSymmtf);
writer.write<tensor, volMesh>(pInterp, dtf);
}
}

View File

@ -94,6 +94,13 @@ public:
const PtrList<GeometricField<Type, PatchField, GeoMesh> >&
);
//- Write generic internal fields
template<class Type, class GeoMesh>
void write
(
const PtrList<DimensionedField<Type, volMesh> >& flds
);
//- Interpolate and write volFields
template<class Type>
void write
@ -101,6 +108,14 @@ public:
const volPointInterpolation&,
const PtrList<GeometricField<Type, fvPatchField, volMesh> >&
);
//- Interpolate and internal fields
template<class Type, class GeoMesh>
void write
(
const volPointInterpolation&,
const PtrList<DimensionedField<Type, volMesh> >&
);
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -41,6 +41,19 @@ void Foam::internalWriter::write
}
template<class Type, class GeoMesh>
void Foam::internalWriter::write
(
const PtrList<DimensionedField<Type, volMesh> >& flds
)
{
forAll(flds, i)
{
writeFuns::write(os_, binary_, flds[i], vMesh_);
}
}
template<class Type>
void Foam::internalWriter::write
(
@ -62,4 +75,25 @@ void Foam::internalWriter::write
}
template<class Type, class GeoMesh>
void Foam::internalWriter::write
(
const volPointInterpolation& pInterp,
const PtrList<DimensionedField<Type, volMesh> >& flds
)
{
forAll(flds, i)
{
writeFuns::write
(
os_,
binary_,
flds[i],
pInterp.interpolate(flds[i])(),
vMesh_
);
}
}
// ************************************************************************* //

View File

@ -113,7 +113,7 @@ public:
(
std::ostream&,
const bool binary,
const GeometricField<Type, fvPatchField, volMesh>&,
const DimensionedField<Type, volMesh>&,
const vtkMesh&
);
@ -135,8 +135,8 @@ public:
(
std::ostream&,
const bool binary,
const GeometricField<Type, fvPatchField, volMesh>&,
const GeometricField<Type, pointPatchField, pointMesh>&,
const DimensionedField<Type, volMesh>&,
const DimensionedField<Type, pointMesh>&,
const vtkMesh&
);
@ -150,6 +150,16 @@ public:
const vtkMesh&
);
//- Write generic dimensioned internal fields
template<class Type>
static void write
(
std::ostream&,
const bool binary,
const PtrList<DimensionedField<Type, volMesh> >&,
const vtkMesh&
);
//- Interpolate and write volFields
template<class Type>
static void write

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -64,7 +64,7 @@ void Foam::writeFuns::write
(
std::ostream& os,
const bool binary,
const GeometricField<Type, fvPatchField, volMesh>& vvf,
const DimensionedField<Type, volMesh>& vvf,
const vtkMesh& vMesh
)
{
@ -79,7 +79,7 @@ void Foam::writeFuns::write
DynamicList<floatScalar> fField(pTraits<Type>::nComponents*nValues);
insert(vvf.internalField(), fField);
insert(vvf, fField);
forAll(superCells, superCellI)
{
@ -128,8 +128,8 @@ void Foam::writeFuns::write
(
std::ostream& os,
const bool binary,
const GeometricField<Type, fvPatchField, volMesh>& vvf,
const GeometricField<Type, pointPatchField, pointMesh>& pvf,
const DimensionedField<Type, volMesh>& vvf,
const DimensionedField<Type, pointMesh>& pvf,
const vtkMesh& vMesh
)
{
@ -164,6 +164,22 @@ void Foam::writeFuns::write
const PtrList<GeometricField<Type, PatchField, GeoMesh> >& flds,
const vtkMesh& vMesh
)
{
forAll(flds, i)
{
write(os, binary, flds[i].dimensionedInternalField(), vMesh);
}
}
template<class Type>
void Foam::writeFuns::write
(
std::ostream& os,
const bool binary,
const PtrList<DimensionedField<Type, volMesh> >& flds,
const vtkMesh& vMesh
)
{
forAll(flds, i)
{