/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see .
InClass
Foam::vtkFoam
\*---------------------------------------------------------------------------*/
#ifndef vtkFoamConvertFields_H
#define vtkFoamConvertFields_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "vtkFoamConvertVolField.H"
#include "vtkFoamConvertPointField.H"
#include "vtkFoamConvertPatchFaceField.H"
#include "vtkFoamConvertPatchPointField.H"
#include "emptyFvPatchField.H"
template
void Foam::vtkFoam::convertVolFields
(
const fvMesh& mesh,
const volPointInterpolation& pInterp,
const IOobjectList& objects,
vtkDataArraySelection *fieldSelection
)
{
IOobjectList fieldObjects
(
objects.lookupClass
(
GeometricField::typeName
)
);
label nSelectedFields = fieldSelection->GetNumberOfArrays();
for (label i=0; iGetArraySetting(i))
{
word fieldName = fieldSelection->GetArrayName(i);
if (fieldObjects.found(fieldName))
{
GeometricField tf
(
IOobject
(
fieldName,
mesh.time().timeName(),
mesh,
IOobject::MUST_READ
),
mesh
);
tmp > tptf
(
pInterp.interpolate(tf)
);
if (selectedRegions_[0])
{
convertVolField(tf);
convertPointField(tptf(), tf);
}
label regioni = 0;
forAll (mesh.boundaryMesh(), patchi)
{
if (mesh.boundaryMesh()[patchi].size())
{
regioni++;
if (selectedRegions_[regioni])
{
const fvPatchField& ptf
(
tf.boundaryField()[patchi]
);
if (!isType >(ptf))
{
convertPatchFaceField
(
tf.name(),
ptf,
regioni
);
convertPatchPointField
(
tptf().name(),
tptf().boundaryField()[patchi]
.patchInternalField()(),
regioni
);
}
else
{
fvPatch p
(
ptf.patch().patch(),
tf.mesh().boundary()
);
convertPatchFaceField
(
tf.name(),
fvPatchField(p, tf)
.patchInternalField()(),
regioni
);
convertPatchPointField
(
tptf().name(),
tptf().boundaryField()[patchi]
.patchInternalField()(),
regioni
);
}
}
}
}
}
}
}
}
template
void Foam::vtkFoam::convertPointFields
(
const fvMesh& mesh,
const IOobjectList& objects,
vtkDataArraySelection *fieldSelection
)
{
IOobjectList fieldObjects
(
objects.lookupClass
(
GeometricField::typeName
)
);
label nSelectedFields = fieldSelection->GetNumberOfArrays();
for (label i=0; iGetArraySetting(i))
{
word fieldName = fieldSelection->GetArrayName(i);
if (fieldObjects.found(fieldName))
{
pointMesh pMesh(mesh);
GeometricField ptf
(
IOobject
(
fieldName,
mesh.time().timeName(),
mesh,
IOobject::MUST_READ
),
pMesh
);
if (selectedRegions_[0])
{
convertPointField
(
ptf,
GeometricField::null()
);
}
label regioni = 0;
forAll (mesh.boundaryMesh(), patchi)
{
if (mesh.boundaryMesh()[patchi].size())
{
regioni++;
if (selectedRegions_[regioni])
{
convertPatchPointField
(
ptf.name(),
ptf.boundaryField()[patchi]
.patchInternalField()(),
regioni
);
}
}
}
}
}
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //