mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Updating utilities based on internal development line
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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> >&
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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_
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -390,15 +390,6 @@ class vtkPV4Foam
|
||||
//- Reduce memory footprint after conversion
|
||||
void reduceMemory();
|
||||
|
||||
//- Volume fields
|
||||
void updateVolFields(vtkMultiBlockDataSet*);
|
||||
|
||||
//- Point fields
|
||||
void updatePointFields(vtkMultiBlockDataSet*);
|
||||
|
||||
//- Lagrangian fields
|
||||
void updateLagrangianFields(vtkMultiBlockDataSet*);
|
||||
|
||||
|
||||
// Mesh conversion functions
|
||||
|
||||
@ -492,6 +483,16 @@ class vtkPV4Foam
|
||||
|
||||
// Convert OpenFOAM fields
|
||||
|
||||
//- Volume field - all types
|
||||
template<class Type>
|
||||
void convertVolField
|
||||
(
|
||||
const PtrList<PrimitivePatchInterpolation<primitivePatch> >&,
|
||||
const GeometricField<Type, fvPatchField, volMesh>&,
|
||||
const bool interpFields,
|
||||
vtkMultiBlockDataSet* output
|
||||
);
|
||||
|
||||
//- Volume fields - all types
|
||||
template<class Type>
|
||||
void convertVolFields
|
||||
@ -503,6 +504,17 @@ class vtkPV4Foam
|
||||
vtkMultiBlockDataSet* output
|
||||
);
|
||||
|
||||
//- Volume internal fields (DimensionedField)- all types
|
||||
template<class Type>
|
||||
void convertDimFields
|
||||
(
|
||||
const fvMesh&,
|
||||
const PtrList<PrimitivePatchInterpolation<primitivePatch> >&,
|
||||
const IOobjectList&,
|
||||
const bool interpFields,
|
||||
vtkMultiBlockDataSet* output
|
||||
);
|
||||
|
||||
//- Volume field - all selected parts
|
||||
template<class Type>
|
||||
void convertVolFieldBlock
|
||||
|
||||
@ -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
|
||||
@ -143,6 +143,27 @@ void Foam::vtkPV4Foam::convertVolFields
|
||||
mesh, ppInterpList, objects, interpFields, output
|
||||
);
|
||||
|
||||
convertDimFields<scalar>
|
||||
(
|
||||
mesh, ppInterpList, objects, interpFields, output
|
||||
);
|
||||
convertDimFields<vector>
|
||||
(
|
||||
mesh, ppInterpList, objects, interpFields, output
|
||||
);
|
||||
convertDimFields<sphericalTensor>
|
||||
(
|
||||
mesh, ppInterpList, objects, interpFields, output
|
||||
);
|
||||
convertDimFields<symmTensor>
|
||||
(
|
||||
mesh, ppInterpList, objects, interpFields, output
|
||||
);
|
||||
convertDimFields<tensor>
|
||||
(
|
||||
mesh, ppInterpList, objects, interpFields, output
|
||||
);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "<end> Foam::vtkPV4Foam::convertVolFields" << endl;
|
||||
|
||||
@ -99,6 +99,34 @@ void Foam::vtkPV4Foam::updateInfoFields
|
||||
objects
|
||||
);
|
||||
|
||||
//- Add dimensioned fields to GUI
|
||||
addToSelection<DimensionedField<scalar, meshType> >
|
||||
(
|
||||
select,
|
||||
objects
|
||||
);
|
||||
addToSelection<DimensionedField<vector, meshType> >
|
||||
(
|
||||
select,
|
||||
objects
|
||||
);
|
||||
addToSelection<DimensionedField<sphericalTensor, meshType> >
|
||||
(
|
||||
select,
|
||||
objects
|
||||
);
|
||||
addToSelection<DimensionedField<symmTensor, meshType> >
|
||||
(
|
||||
select,
|
||||
objects
|
||||
);
|
||||
addToSelection<DimensionedField<tensor, meshType> >
|
||||
(
|
||||
select,
|
||||
objects
|
||||
);
|
||||
|
||||
|
||||
// restore the enabled selections
|
||||
setSelectedArrayEntries(select, enabledEntries);
|
||||
|
||||
|
||||
@ -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
|
||||
@ -34,6 +34,7 @@ InClass
|
||||
#include "wallPolyPatch.H"
|
||||
#include "faceSet.H"
|
||||
#include "volPointInterpolation.H"
|
||||
#include "zeroGradientFvPatchField.H"
|
||||
|
||||
#include "vtkPV4FoamFaceField.H"
|
||||
#include "vtkPV4FoamPatchField.H"
|
||||
@ -42,6 +43,224 @@ InClass
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::vtkPV4Foam::convertVolField
|
||||
(
|
||||
const PtrList<PrimitivePatchInterpolation<primitivePatch> >& ppInterpList,
|
||||
const GeometricField<Type, fvPatchField, volMesh>& tf,
|
||||
const bool interpFields,
|
||||
vtkMultiBlockDataSet* output
|
||||
)
|
||||
{
|
||||
const fvMesh& mesh = tf.mesh();
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
// Interpolated field (demand driven)
|
||||
autoPtr<GeometricField<Type, pointPatchField, pointMesh> > ptfPtr;
|
||||
if (interpFields)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "convertVolFieldBlock interpolating:" << tf.name()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
ptfPtr.reset
|
||||
(
|
||||
volPointInterpolation::New(mesh).interpolate(tf).ptr()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Convert activated internalMesh regions
|
||||
convertVolFieldBlock
|
||||
(
|
||||
tf,
|
||||
ptfPtr,
|
||||
output,
|
||||
arrayRangeVolume_,
|
||||
regionPolyDecomp_
|
||||
);
|
||||
|
||||
// Convert activated cellZones
|
||||
convertVolFieldBlock
|
||||
(
|
||||
tf,
|
||||
ptfPtr,
|
||||
output,
|
||||
arrayRangeCellZones_,
|
||||
zonePolyDecomp_
|
||||
);
|
||||
|
||||
// Convert activated cellSets
|
||||
convertVolFieldBlock
|
||||
(
|
||||
tf,
|
||||
ptfPtr,
|
||||
output,
|
||||
arrayRangeCellSets_,
|
||||
csetPolyDecomp_
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// Convert patches - if activated
|
||||
//
|
||||
for
|
||||
(
|
||||
int partId = arrayRangePatches_.start();
|
||||
partId < arrayRangePatches_.end();
|
||||
++partId
|
||||
)
|
||||
{
|
||||
const word patchName = getPartName(partId);
|
||||
const label datasetNo = partDataset_[partId];
|
||||
const label patchId = patches.findPatchID(patchName);
|
||||
|
||||
if (!partStatus_[partId] || datasetNo < 0 || patchId < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const fvPatchField<Type>& ptf = tf.boundaryField()[patchId];
|
||||
|
||||
if
|
||||
(
|
||||
isType<emptyFvPatchField<Type> >(ptf)
|
||||
||
|
||||
(
|
||||
reader_->GetExtrapolatePatches()
|
||||
&& !polyPatch::constraintType(patches[patchId].type())
|
||||
)
|
||||
)
|
||||
{
|
||||
fvPatch p(ptf.patch().patch(), mesh.boundary());
|
||||
|
||||
tmp<Field<Type> > tpptf
|
||||
(
|
||||
fvPatchField<Type>(p, tf).patchInternalField()
|
||||
);
|
||||
|
||||
convertPatchField
|
||||
(
|
||||
tf.name(),
|
||||
tpptf(),
|
||||
output,
|
||||
arrayRangePatches_,
|
||||
datasetNo
|
||||
);
|
||||
|
||||
if (interpFields)
|
||||
{
|
||||
convertPatchPointField
|
||||
(
|
||||
tf.name(),
|
||||
ppInterpList[patchId].faceToPointInterpolate(tpptf)(),
|
||||
output,
|
||||
arrayRangePatches_,
|
||||
datasetNo
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
convertPatchField
|
||||
(
|
||||
tf.name(),
|
||||
ptf,
|
||||
output,
|
||||
arrayRangePatches_,
|
||||
datasetNo
|
||||
);
|
||||
|
||||
if (interpFields)
|
||||
{
|
||||
convertPatchPointField
|
||||
(
|
||||
tf.name(),
|
||||
ppInterpList[patchId].faceToPointInterpolate(ptf)(),
|
||||
output,
|
||||
arrayRangePatches_,
|
||||
datasetNo
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Convert face zones - if activated
|
||||
//
|
||||
for
|
||||
(
|
||||
int partId = arrayRangeFaceZones_.start();
|
||||
partId < arrayRangeFaceZones_.end();
|
||||
++partId
|
||||
)
|
||||
{
|
||||
const word zoneName = getPartName(partId);
|
||||
const label datasetNo = partDataset_[partId];
|
||||
|
||||
if (!partStatus_[partId] || datasetNo < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const faceZoneMesh& zMesh = mesh.faceZones();
|
||||
const label zoneId = zMesh.findZoneID(zoneName);
|
||||
|
||||
if (zoneId < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
convertFaceField
|
||||
(
|
||||
tf,
|
||||
output,
|
||||
arrayRangeFaceZones_,
|
||||
datasetNo,
|
||||
mesh,
|
||||
zMesh[zoneId]
|
||||
);
|
||||
|
||||
// TODO: points
|
||||
}
|
||||
|
||||
//
|
||||
// Convert face sets - if activated
|
||||
//
|
||||
for
|
||||
(
|
||||
int partId = arrayRangeFaceSets_.start();
|
||||
partId < arrayRangeFaceSets_.end();
|
||||
++partId
|
||||
)
|
||||
{
|
||||
const word selectName = getPartName(partId);
|
||||
const label datasetNo = partDataset_[partId];
|
||||
|
||||
if (!partStatus_[partId] || datasetNo < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const faceSet fSet(mesh, selectName);
|
||||
|
||||
convertFaceField
|
||||
(
|
||||
tf,
|
||||
output,
|
||||
arrayRangeFaceSets_,
|
||||
datasetNo,
|
||||
mesh,
|
||||
fSet.toc()
|
||||
);
|
||||
|
||||
// TODO: points
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::vtkPV4Foam::convertVolFields
|
||||
(
|
||||
@ -52,8 +271,6 @@ void Foam::vtkPV4Foam::convertVolFields
|
||||
vtkMultiBlockDataSet* output
|
||||
)
|
||||
{
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
forAllConstIter(IOobjectList, objects, iter)
|
||||
{
|
||||
// restrict to GeometricField<Type, ...>
|
||||
@ -73,209 +290,69 @@ void Foam::vtkPV4Foam::convertVolFields
|
||||
mesh
|
||||
);
|
||||
|
||||
// Interpolated field (demand driven)
|
||||
autoPtr<GeometricField<Type, pointPatchField, pointMesh> > ptfPtr;
|
||||
if (interpFields)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "convertVolFieldBlock interpolating:" << tf.name()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
ptfPtr.reset
|
||||
(
|
||||
volPointInterpolation::New(tf.mesh()).interpolate(tf).ptr()
|
||||
);
|
||||
}
|
||||
// Convert
|
||||
convertVolField(ppInterpList, tf, interpFields, output);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Convert activated internalMesh regions
|
||||
convertVolFieldBlock
|
||||
template<class Type>
|
||||
void Foam::vtkPV4Foam::convertDimFields
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const PtrList<PrimitivePatchInterpolation<primitivePatch> >& ppInterpList,
|
||||
const IOobjectList& objects,
|
||||
const bool interpFields,
|
||||
vtkMultiBlockDataSet* output
|
||||
)
|
||||
{
|
||||
forAllConstIter(IOobjectList, objects, iter)
|
||||
{
|
||||
// restrict to DimensionedField<Type, ...>
|
||||
if
|
||||
(
|
||||
tf,
|
||||
ptfPtr,
|
||||
output,
|
||||
arrayRangeVolume_,
|
||||
regionPolyDecomp_
|
||||
);
|
||||
|
||||
// Convert activated cellZones
|
||||
convertVolFieldBlock
|
||||
(
|
||||
tf,
|
||||
ptfPtr,
|
||||
output,
|
||||
arrayRangeCellZones_,
|
||||
zonePolyDecomp_
|
||||
);
|
||||
|
||||
// Convert activated cellSets
|
||||
convertVolFieldBlock
|
||||
(
|
||||
tf,
|
||||
ptfPtr,
|
||||
output,
|
||||
arrayRangeCellSets_,
|
||||
csetPolyDecomp_
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// Convert patches - if activated
|
||||
//
|
||||
for
|
||||
(
|
||||
int partId = arrayRangePatches_.start();
|
||||
partId < arrayRangePatches_.end();
|
||||
++partId
|
||||
iter()->headerClassName()
|
||||
!= DimensionedField<Type, volMesh>::typeName
|
||||
)
|
||||
{
|
||||
const word patchName = getPartName(partId);
|
||||
const label datasetNo = partDataset_[partId];
|
||||
const label patchId = patches.findPatchID(patchName);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!partStatus_[partId] || datasetNo < 0 || patchId < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// Load field
|
||||
DimensionedField<Type, volMesh> dimFld(*iter(), mesh);
|
||||
|
||||
const fvPatchField<Type>& ptf = tf.boundaryField()[patchId];
|
||||
|
||||
if
|
||||
// Construct volField with zero-gradient patch fields
|
||||
|
||||
IOobject io(dimFld);
|
||||
io.readOpt() = IOobject::NO_READ;
|
||||
|
||||
PtrList<fvPatchField<Type> > patchFields(mesh.boundary().size());
|
||||
forAll(patchFields, patchI)
|
||||
{
|
||||
patchFields.set
|
||||
(
|
||||
isType<emptyFvPatchField<Type> >(ptf)
|
||||
||
|
||||
patchI,
|
||||
fvPatchField<Type>::New
|
||||
(
|
||||
reader_->GetExtrapolatePatches()
|
||||
&& !polyPatch::constraintType(patches[patchId].type())
|
||||
zeroGradientFvPatchField<scalar>::typeName,
|
||||
mesh.boundary()[patchI],
|
||||
dimFld
|
||||
)
|
||||
)
|
||||
{
|
||||
fvPatch p(ptf.patch().patch(), tf.mesh().boundary());
|
||||
|
||||
tmp<Field<Type> > tpptf
|
||||
(
|
||||
fvPatchField<Type>(p, tf).patchInternalField()
|
||||
);
|
||||
|
||||
convertPatchField
|
||||
(
|
||||
tf.name(),
|
||||
tpptf(),
|
||||
output,
|
||||
arrayRangePatches_,
|
||||
datasetNo
|
||||
);
|
||||
|
||||
if (interpFields)
|
||||
{
|
||||
convertPatchPointField
|
||||
(
|
||||
tf.name(),
|
||||
ppInterpList[patchId].faceToPointInterpolate(tpptf)(),
|
||||
output,
|
||||
arrayRangePatches_,
|
||||
datasetNo
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
convertPatchField
|
||||
(
|
||||
tf.name(),
|
||||
ptf,
|
||||
output,
|
||||
arrayRangePatches_,
|
||||
datasetNo
|
||||
);
|
||||
|
||||
if (interpFields)
|
||||
{
|
||||
convertPatchPointField
|
||||
(
|
||||
tf.name(),
|
||||
ppInterpList[patchId].faceToPointInterpolate(ptf)(),
|
||||
output,
|
||||
arrayRangePatches_,
|
||||
datasetNo
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Convert face zones - if activated
|
||||
//
|
||||
for
|
||||
(
|
||||
int partId = arrayRangeFaceZones_.start();
|
||||
partId < arrayRangeFaceZones_.end();
|
||||
++partId
|
||||
)
|
||||
{
|
||||
const word zoneName = getPartName(partId);
|
||||
const label datasetNo = partDataset_[partId];
|
||||
|
||||
if (!partStatus_[partId] || datasetNo < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const faceZoneMesh& zMesh = mesh.faceZones();
|
||||
const label zoneId = zMesh.findZoneID(zoneName);
|
||||
|
||||
if (zoneId < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
convertFaceField
|
||||
(
|
||||
tf,
|
||||
output,
|
||||
arrayRangeFaceZones_,
|
||||
datasetNo,
|
||||
mesh,
|
||||
zMesh[zoneId]
|
||||
);
|
||||
|
||||
// TODO: points
|
||||
}
|
||||
|
||||
//
|
||||
// Convert face sets - if activated
|
||||
//
|
||||
for
|
||||
GeometricField<Type, fvPatchField, volMesh> volFld
|
||||
(
|
||||
int partId = arrayRangeFaceSets_.start();
|
||||
partId < arrayRangeFaceSets_.end();
|
||||
++partId
|
||||
)
|
||||
{
|
||||
const word selectName = getPartName(partId);
|
||||
const label datasetNo = partDataset_[partId];
|
||||
io,
|
||||
dimFld.mesh(),
|
||||
dimFld.dimensions(),
|
||||
dimFld,
|
||||
patchFields
|
||||
);
|
||||
volFld.correctBoundaryConditions();
|
||||
|
||||
if (!partStatus_[partId] || datasetNo < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const faceSet fSet(mesh, selectName);
|
||||
|
||||
convertFaceField
|
||||
(
|
||||
tf,
|
||||
output,
|
||||
arrayRangeFaceSets_,
|
||||
datasetNo,
|
||||
mesh,
|
||||
fSet.toc()
|
||||
);
|
||||
|
||||
// TODO: points
|
||||
}
|
||||
convertVolField(ppInterpList, volFld, interpFields, output);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
@ -247,6 +247,8 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
@ -331,7 +331,7 @@ int main(int argc, char *argv[])
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
Info<< "\ndone" << endl;
|
||||
Info<< "End" << nl << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -156,7 +156,11 @@ void calc
|
||||
functionObjectList& fol
|
||||
)
|
||||
{
|
||||
if (args.optionFound("noFlow"))
|
||||
if (args.optionFound("noRead"))
|
||||
{
|
||||
fol.execute(true);
|
||||
}
|
||||
else if (args.optionFound("noFlow"))
|
||||
{
|
||||
Info<< " Operating in no-flow mode; no models will be loaded."
|
||||
<< " All vol, surface and point fields will be loaded." << endl;
|
||||
|
||||
@ -138,6 +138,8 @@ int main(int argc, char *argv[])
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
Info<< "End" << nl << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -49,6 +49,8 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
|
||||
mesh.readUpdate();
|
||||
|
||||
volScalarField mgb
|
||||
@ -114,8 +116,12 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
wdot.write();
|
||||
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
Info<< "End" << nl << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -105,6 +105,8 @@ int main(int argc, char *argv[])
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
Info<< nl << "End" << nl << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -144,7 +144,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
|
||||
Info<< " Missing U or T" << endl;
|
||||
}
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
Info<< nl << "End" << nl << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -274,6 +274,8 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
|
||||
{
|
||||
Info<< " No phi" << endl;
|
||||
}
|
||||
|
||||
Info<< "End" << nl << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user