mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: relocate meshSubsetHelper into dynamicMesh for re-use
- reuse for foamToTecplot360 and foamToVTK. - remove dependency on vtkMesh where possible.
This commit is contained in:
@ -1,6 +1,4 @@
|
|||||||
ensightOutputCloud.C
|
ensightOutputCloud.C
|
||||||
meshSubsetHelper.C
|
|
||||||
|
|
||||||
foamToEnsight.C
|
foamToEnsight.C
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/foamToEnsight
|
EXE = $(FOAM_APPBIN)/foamToEnsight
|
||||||
|
|||||||
@ -291,7 +291,7 @@ int main(int argc, char *argv[])
|
|||||||
<< mesh.boundaryMesh()[0].name() << ")"
|
<< mesh.boundaryMesh()[0].name() << ")"
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
meshSubsetHelper myMesh(mesh, cellZoneName);
|
meshSubsetHelper myMesh(mesh, meshSubsetHelper::ZONE, cellZoneName);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Open new ensight case file, initialize header etc.
|
// Open new ensight case file, initialize header etc.
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
tecplotWriter.C
|
tecplotWriter.C
|
||||||
vtkMesh.C
|
|
||||||
foamToTecplot360.C
|
foamToTecplot360.C
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/foamToTecplot360
|
EXE = $(FOAM_APPBIN)/foamToTecplot360
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -68,9 +68,6 @@ Usage
|
|||||||
information as a single argument. The double quotes denote a regular
|
information as a single argument. The double quotes denote a regular
|
||||||
expression.
|
expression.
|
||||||
|
|
||||||
- \par -useTimeName
|
|
||||||
use the time index in the VTK file name instead of the time index
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "pointMesh.H"
|
#include "pointMesh.H"
|
||||||
@ -86,7 +83,7 @@ Usage
|
|||||||
#include "stringListOps.H"
|
#include "stringListOps.H"
|
||||||
#include "wordRe.H"
|
#include "wordRe.H"
|
||||||
|
|
||||||
#include "vtkMesh.H"
|
#include "meshSubsetHelper.H"
|
||||||
#include "readFields.H"
|
#include "readFields.H"
|
||||||
#include "tecplotWriter.H"
|
#include "tecplotWriter.H"
|
||||||
|
|
||||||
@ -99,7 +96,7 @@ Usage
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class GeoField>
|
template<class GeoField>
|
||||||
void print(const char* msg, Ostream& os, const PtrList<GeoField>& flds)
|
void print(const char* msg, Ostream& os, const PtrList<const GeoField>& flds)
|
||||||
{
|
{
|
||||||
if (flds.size())
|
if (flds.size())
|
||||||
{
|
{
|
||||||
@ -161,8 +158,7 @@ labelList getSelectedPatches
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -170,10 +166,8 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
"Tecplot binary file format writer"
|
"Tecplot binary file format writer"
|
||||||
);
|
);
|
||||||
|
|
||||||
timeSelector::addOptions();
|
timeSelector::addOptions();
|
||||||
#include "addRegionOption.H"
|
#include "addRegionOption.H"
|
||||||
|
|
||||||
argList::addOption
|
argList::addOption
|
||||||
(
|
(
|
||||||
"fields",
|
"fields",
|
||||||
@ -190,7 +184,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
"faceSet",
|
"faceSet",
|
||||||
"name",
|
"name",
|
||||||
"restrict conversion to the specified cellSet"
|
"restrict conversion to the specified faceSet"
|
||||||
);
|
);
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
@ -248,7 +242,8 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
word cellSetName;
|
word cellSetName;
|
||||||
string vtkName;
|
word faceSetName;
|
||||||
|
string vtkName = runTime.caseName();
|
||||||
|
|
||||||
if (args.optionReadIfPresent("cellSet", cellSetName))
|
if (args.optionReadIfPresent("cellSet", cellSetName))
|
||||||
{
|
{
|
||||||
@ -266,11 +261,7 @@ int main(int argc, char *argv[])
|
|||||||
vtkName = vtkName.substr(i);
|
vtkName = vtkName.substr(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
args.optionReadIfPresent("faceSet", faceSetName);
|
||||||
{
|
|
||||||
vtkName = runTime.caseName();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||||
|
|
||||||
@ -294,10 +285,11 @@ int main(int argc, char *argv[])
|
|||||||
args.optionFound("time")
|
args.optionFound("time")
|
||||||
|| args.optionFound("latestTime")
|
|| args.optionFound("latestTime")
|
||||||
|| cellSetName.size()
|
|| cellSetName.size()
|
||||||
|
|| faceSetName.size()
|
||||||
|| regionName != polyMesh::defaultRegion
|
|| regionName != polyMesh::defaultRegion
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Info<< "Keeping old files in " << fvPath << nl << endl;
|
Info<< "Keeping old tecplot files in " << fvPath << nl << endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -309,9 +301,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
mkDir(fvPath);
|
mkDir(fvPath);
|
||||||
|
|
||||||
|
// Mesh wrapper: does subsetting
|
||||||
// mesh wrapper; does subsetting and decomposition
|
meshSubsetHelper myMesh(mesh, meshSubsetHelper::SET, cellSetName);
|
||||||
vtkMesh vMesh(mesh, cellSetName);
|
|
||||||
|
|
||||||
forAll(timeDirs, timeI)
|
forAll(timeDirs, timeI)
|
||||||
{
|
{
|
||||||
@ -319,13 +310,12 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "Time: " << runTime.timeName() << endl;
|
Info<< "Time: " << runTime.timeName() << endl;
|
||||||
|
|
||||||
const word timeDesc = name(timeI); //name(runTime.timeIndex());
|
const word timeDesc = name(timeI); // Foam::name(runTime.timeIndex());
|
||||||
|
|
||||||
// Check for new polyMesh/ and update mesh, fvMeshSubset and cell
|
// Check for new polyMesh/ and update mesh, fvMeshSubset and cell
|
||||||
// decomposition.
|
// decomposition.
|
||||||
polyMesh::readUpdateState meshState = vMesh.readUpdate();
|
polyMesh::readUpdateState meshState = myMesh.readUpdate();
|
||||||
|
const fvMesh& mesh = myMesh.mesh();
|
||||||
const fvMesh& mesh = vMesh.mesh();
|
|
||||||
|
|
||||||
INTEGER4 nFaceNodes = 0;
|
INTEGER4 nFaceNodes = 0;
|
||||||
forAll(mesh.faces(), facei)
|
forAll(mesh.faces(), facei)
|
||||||
@ -348,24 +338,24 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Construct the vol fields (on the original mesh if subsetted)
|
// Construct the vol fields (on the original mesh if subsetted)
|
||||||
|
|
||||||
PtrList<volScalarField> vsf;
|
PtrList<const volScalarField> vsf;
|
||||||
readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vsf);
|
readFields(myMesh, myMesh.baseMesh(), objects, selectedFields, vsf);
|
||||||
print(" volScalarFields :", Info, vsf);
|
print(" volScalarFields :", Info, vsf);
|
||||||
|
|
||||||
PtrList<volVectorField> vvf;
|
PtrList<const volVectorField> vvf;
|
||||||
readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vvf);
|
readFields(myMesh, myMesh.baseMesh(), objects, selectedFields, vvf);
|
||||||
print(" volVectorFields :", Info, vvf);
|
print(" volVectorFields :", Info, vvf);
|
||||||
|
|
||||||
PtrList<volSphericalTensorField> vSpheretf;
|
PtrList<const volSphericalTensorField> vSpheretf;
|
||||||
readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vSpheretf);
|
readFields(myMesh, myMesh.baseMesh(), objects, selectedFields, vSpheretf);
|
||||||
print(" volSphericalTensorFields :", Info, vSpheretf);
|
print(" volSphericalTensorFields :", Info, vSpheretf);
|
||||||
|
|
||||||
PtrList<volSymmTensorField> vSymmtf;
|
PtrList<const volSymmTensorField> vSymmtf;
|
||||||
readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vSymmtf);
|
readFields(myMesh, myMesh.baseMesh(), objects, selectedFields, vSymmtf);
|
||||||
print(" volSymmTensorFields :", Info, vSymmtf);
|
print(" volSymmTensorFields :", Info, vSymmtf);
|
||||||
|
|
||||||
PtrList<volTensorField> vtf;
|
PtrList<const volTensorField> vtf;
|
||||||
readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vtf);
|
readFields(myMesh, myMesh.baseMesh(), objects, selectedFields, vtf);
|
||||||
print(" volTensorFields :", Info, vtf);
|
print(" volTensorFields :", Info, vtf);
|
||||||
|
|
||||||
|
|
||||||
@ -379,11 +369,11 @@ int main(int argc, char *argv[])
|
|||||||
<< " (\"-noPointValues\" (at your option)\n";
|
<< " (\"-noPointValues\" (at your option)\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
PtrList<pointScalarField> psf;
|
PtrList<const pointScalarField> psf;
|
||||||
PtrList<pointVectorField> pvf;
|
PtrList<const pointVectorField> pvf;
|
||||||
//PtrList<pointSphericalTensorField> pSpheretf;
|
//PtrList<const pointSphericalTensorField> pSpheretf;
|
||||||
//PtrList<pointSymmTensorField> pSymmtf;
|
//PtrList<const pointSymmTensorField> pSymmtf;
|
||||||
//PtrList<pointTensorField> ptf;
|
//PtrList<const pointTensorField> ptf;
|
||||||
|
|
||||||
|
|
||||||
if (!noPointValues)
|
if (!noPointValues)
|
||||||
@ -418,8 +408,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
readFields
|
readFields
|
||||||
(
|
(
|
||||||
vMesh,
|
myMesh,
|
||||||
pointMesh::New(vMesh.baseMesh()),
|
pointMesh::New(myMesh.baseMesh()),
|
||||||
objects,
|
objects,
|
||||||
selectedFields,
|
selectedFields,
|
||||||
psf
|
psf
|
||||||
@ -428,8 +418,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
readFields
|
readFields
|
||||||
(
|
(
|
||||||
vMesh,
|
myMesh,
|
||||||
pointMesh::New(vMesh.baseMesh()),
|
pointMesh::New(myMesh.baseMesh()),
|
||||||
objects,
|
objects,
|
||||||
selectedFields,
|
selectedFields,
|
||||||
pvf
|
pvf
|
||||||
@ -438,8 +428,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
//readFields
|
//readFields
|
||||||
//(
|
//(
|
||||||
// vMesh,
|
// myMesh,
|
||||||
// pointMesh::New(vMesh.baseMesh()),
|
// pointMesh::New(myMesh.baseMesh()),
|
||||||
// objects,
|
// objects,
|
||||||
// selectedFields,
|
// selectedFields,
|
||||||
// pSpheretf
|
// pSpheretf
|
||||||
@ -448,8 +438,8 @@ int main(int argc, char *argv[])
|
|||||||
//
|
//
|
||||||
//readFields
|
//readFields
|
||||||
//(
|
//(
|
||||||
// vMesh,
|
// myMesh,
|
||||||
// pointMesh::New(vMesh.baseMesh()),
|
// pointMesh::New(myMesh.baseMesh()),
|
||||||
// objects,
|
// objects,
|
||||||
// selectedFields,
|
// selectedFields,
|
||||||
// pSymmtf
|
// pSymmtf
|
||||||
@ -458,8 +448,8 @@ int main(int argc, char *argv[])
|
|||||||
//
|
//
|
||||||
//readFields
|
//readFields
|
||||||
//(
|
//(
|
||||||
// vMesh,
|
// myMesh,
|
||||||
// pointMesh::New(vMesh.baseMesh()),
|
// pointMesh::New(myMesh.baseMesh()),
|
||||||
// objects,
|
// objects,
|
||||||
// selectedFields,
|
// selectedFields,
|
||||||
// ptf
|
// ptf
|
||||||
@ -769,11 +759,10 @@ int main(int argc, char *argv[])
|
|||||||
//
|
//
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
if (args.optionFound("faceSet"))
|
if (faceSetName.size())
|
||||||
{
|
{
|
||||||
// Load the faceSet
|
// Load the faceSet
|
||||||
const word setName = args["faceSet"];
|
labelList faceLabels(faceSet(mesh, faceSetName).toc());
|
||||||
labelList faceLabels(faceSet(mesh, setName).toc());
|
|
||||||
|
|
||||||
// Filename as if patch with same name.
|
// Filename as if patch with same name.
|
||||||
mkDir(fvPath/setName);
|
mkDir(fvPath/setName);
|
||||||
@ -886,7 +875,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Write patches as multi-zone file
|
// Write patches as multi-zone file
|
||||||
@ -901,7 +889,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
fileName patchFileName;
|
fileName patchFileName;
|
||||||
|
|
||||||
if (vMesh.useSubMesh())
|
if (myMesh.useSubMesh())
|
||||||
{
|
{
|
||||||
patchFileName =
|
patchFileName =
|
||||||
fvPath/"boundaryMesh"/cellSetName
|
fvPath/"boundaryMesh"/cellSetName
|
||||||
@ -1072,7 +1060,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
fileName patchFileName;
|
fileName patchFileName;
|
||||||
|
|
||||||
if (vMesh.useSubMesh())
|
if (myMesh.useSubMesh())
|
||||||
{
|
{
|
||||||
patchFileName =
|
patchFileName =
|
||||||
fvPath/"faceZoneMesh"/cellSetName
|
fvPath/"faceZoneMesh"/cellSetName
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -36,37 +36,32 @@ namespace Foam
|
|||||||
template<class GeoField>
|
template<class GeoField>
|
||||||
void readFields
|
void readFields
|
||||||
(
|
(
|
||||||
const vtkMesh& vMesh,
|
const meshSubsetHelper& helper,
|
||||||
const typename GeoField::Mesh& mesh,
|
const typename GeoField::Mesh& mesh,
|
||||||
const IOobjectList& objects,
|
const IOobjectList& objects,
|
||||||
const HashSet<word>& selectedFields,
|
const HashSet<word>& selectedFields,
|
||||||
PtrList<GeoField>& fields
|
PtrList<const GeoField>& fields
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Search list of objects for volScalarFields
|
// Search list of objects for fields of type GeomField
|
||||||
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));
|
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));
|
||||||
|
|
||||||
// Construct the vol scalar fields
|
// Construct the fields
|
||||||
label nFields = fields.size();
|
fields.setSize(fieldObjects.size());
|
||||||
fields.setSize(nFields + fieldObjects.size());
|
label nFields = 0;
|
||||||
|
|
||||||
forAllIter(IOobjectList, fieldObjects, iter)
|
forAllConstIter(IOobjectList, fieldObjects, iter)
|
||||||
{
|
{
|
||||||
if (selectedFields.empty() || selectedFields.found(iter()->name()))
|
if (selectedFields.empty() || selectedFields.found(iter()->name()))
|
||||||
{
|
{
|
||||||
fields.set
|
fields.set
|
||||||
(
|
(
|
||||||
nFields,
|
nFields++,
|
||||||
vMesh.interpolate
|
helper.interpolate
|
||||||
(
|
(
|
||||||
GeoField
|
GeoField(*iter(), mesh)
|
||||||
(
|
).ptr()
|
||||||
*iter(),
|
|
||||||
mesh
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
nFields++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -34,7 +34,7 @@ SourceFiles
|
|||||||
#ifndef readFields_H
|
#ifndef readFields_H
|
||||||
#define readFields_H
|
#define readFields_H
|
||||||
|
|
||||||
#include "fvMesh.H"
|
#include "meshSubsetHelper.H"
|
||||||
#include "PtrList.H"
|
#include "PtrList.H"
|
||||||
#include "IOobjectList.H"
|
#include "IOobjectList.H"
|
||||||
#include "HashSet.H"
|
#include "HashSet.H"
|
||||||
@ -48,11 +48,11 @@ namespace Foam
|
|||||||
template<class GeoField>
|
template<class GeoField>
|
||||||
void readFields
|
void readFields
|
||||||
(
|
(
|
||||||
const vtkMesh& vMesh,
|
const meshSubsetHelper&,
|
||||||
const typename GeoField::Mesh& mesh,
|
const typename GeoField::Mesh& mesh,
|
||||||
const IOobjectList& objects,
|
const IOobjectList& objects,
|
||||||
const HashSet<word>& selectedFields,
|
const HashSet<word>& selectedFields,
|
||||||
PtrList<GeoField>& fields
|
PtrList<const GeoField>& fields
|
||||||
);
|
);
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|||||||
@ -1,83 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM 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.
|
|
||||||
|
|
||||||
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "vtkMesh.H"
|
|
||||||
#include "fvMeshSubset.H"
|
|
||||||
#include "Time.H"
|
|
||||||
#include "cellSet.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
// Construct from components
|
|
||||||
Foam::vtkMesh::vtkMesh
|
|
||||||
(
|
|
||||||
fvMesh& baseMesh,
|
|
||||||
const word& setName
|
|
||||||
)
|
|
||||||
:
|
|
||||||
baseMesh_(baseMesh),
|
|
||||||
subsetter_(baseMesh),
|
|
||||||
setName_(setName)
|
|
||||||
{
|
|
||||||
if (setName.size())
|
|
||||||
{
|
|
||||||
// Read cellSet using whole mesh
|
|
||||||
cellSet currentSet(baseMesh_, setName_);
|
|
||||||
|
|
||||||
// Set current subset
|
|
||||||
subsetter_.setLargeCellSubset(currentSet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::polyMesh::readUpdateState Foam::vtkMesh::readUpdate()
|
|
||||||
{
|
|
||||||
polyMesh::readUpdateState meshState = baseMesh_.readUpdate();
|
|
||||||
|
|
||||||
if (meshState != polyMesh::UNCHANGED)
|
|
||||||
{
|
|
||||||
// Note: since fvMeshSubset has no movePoints() functionality
|
|
||||||
// reconstruct the subset even if only movement.
|
|
||||||
|
|
||||||
// topoPtr_.clear();
|
|
||||||
|
|
||||||
if (setName_.size())
|
|
||||||
{
|
|
||||||
Info<< "Subsetting mesh based on cellSet " << setName_ << endl;
|
|
||||||
|
|
||||||
// Read cellSet using whole mesh
|
|
||||||
cellSet currentSet(baseMesh_, setName_);
|
|
||||||
|
|
||||||
subsetter_.setLargeCellSubset(currentSet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return meshState;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,178 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM 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.
|
|
||||||
|
|
||||||
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Class
|
|
||||||
Foam::vtkMesh
|
|
||||||
|
|
||||||
Description
|
|
||||||
Encapsulation of VTK mesh data. Holds mesh or meshsubset and
|
|
||||||
polyhedral-cell decomposition on it.
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
vtkMesh.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef vtkMesh_H
|
|
||||||
#define vtkMesh_H
|
|
||||||
|
|
||||||
#include "fvMeshSubset.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// Forward declaration of classes
|
|
||||||
class Time;
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class vtkMesh Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
class vtkMesh
|
|
||||||
{
|
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- Reference to mesh
|
|
||||||
fvMesh& baseMesh_;
|
|
||||||
|
|
||||||
//- Subsetting engine + sub-fvMesh
|
|
||||||
fvMeshSubset subsetter_;
|
|
||||||
|
|
||||||
//- Current cellSet (or empty)
|
|
||||||
const word setName_;
|
|
||||||
|
|
||||||
// //- Current decomposition of topology
|
|
||||||
// mutable autoPtr<vtkTopo> topoPtr_;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
|
||||||
vtkMesh(const vtkMesh&);
|
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
|
||||||
void operator=(const vtkMesh&);
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct from components
|
|
||||||
vtkMesh(fvMesh& baseMesh, const word& setName = "");
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
|
||||||
|
|
||||||
// Access
|
|
||||||
|
|
||||||
//- Whole mesh
|
|
||||||
const fvMesh& baseMesh() const
|
|
||||||
{
|
|
||||||
return baseMesh_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const fvMeshSubset& subsetter() const
|
|
||||||
{
|
|
||||||
return subsetter_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Check if running subMesh
|
|
||||||
bool useSubMesh() const
|
|
||||||
{
|
|
||||||
return setName_.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
// //- topology
|
|
||||||
// const vtkTopo& topo() const
|
|
||||||
// {
|
|
||||||
// if (topoPtr_.empty())
|
|
||||||
// {
|
|
||||||
// topoPtr_.reset(new vtkTopo(mesh()));
|
|
||||||
// }
|
|
||||||
// return topoPtr_();
|
|
||||||
// }
|
|
||||||
|
|
||||||
//- Access either mesh or submesh
|
|
||||||
const fvMesh& mesh() const
|
|
||||||
{
|
|
||||||
if (useSubMesh())
|
|
||||||
{
|
|
||||||
return subsetter_.subMesh();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return baseMesh_;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// //- Number of field cells
|
|
||||||
// label nFieldCells() const
|
|
||||||
// {
|
|
||||||
// return topo().vertLabels().size();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// //- Number of field points
|
|
||||||
// label nFieldPoints() const
|
|
||||||
// {
|
|
||||||
// return mesh().nPoints() + topo().addPointCellLabels().size();
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// Edit
|
|
||||||
|
|
||||||
//- Read mesh
|
|
||||||
polyMesh::readUpdateState readUpdate();
|
|
||||||
|
|
||||||
|
|
||||||
//- Map volume field (does in fact do very little interpolation;
|
|
||||||
// just copied from fvMeshSubset)
|
|
||||||
template<class GeoField>
|
|
||||||
tmp<GeoField> interpolate(const GeoField& fld) const
|
|
||||||
{
|
|
||||||
if (useSubMesh())
|
|
||||||
{
|
|
||||||
tmp<GeoField> subFld = subsetter_.interpolate(fld);
|
|
||||||
subFld.ref().rename(fld.name());
|
|
||||||
return subFld;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return fld;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -410,7 +410,6 @@ int main(int argc, char *argv[])
|
|||||||
args.optionReadIfPresent("pointSet", pointSetName);
|
args.optionReadIfPresent("pointSet", pointSetName);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||||
|
|
||||||
#include "createNamedMesh.H"
|
#include "createNamedMesh.H"
|
||||||
@ -450,7 +449,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
mkDir(fvPath);
|
mkDir(fvPath);
|
||||||
|
|
||||||
// Mesh wrapper; does subsetting and decomposition
|
// Mesh wrapper: does subsetting and decomposition
|
||||||
vtkMesh vMesh(mesh, cellSetName);
|
vtkMesh vMesh(mesh, cellSetName);
|
||||||
|
|
||||||
Info<< "VTK mesh topology: "
|
Info<< "VTK mesh topology: "
|
||||||
@ -503,7 +502,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< " FaceSet : " << patchFileName << endl;
|
Info<< " FaceSet : " << patchFileName << endl;
|
||||||
|
|
||||||
writeFaceSet(binary, vMesh, set, patchFileName);
|
writeFaceSet(binary, vMesh.mesh(), set, patchFileName);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -526,7 +525,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< " pointSet : " << patchFileName << endl;
|
Info<< " pointSet : " << patchFileName << endl;
|
||||||
|
|
||||||
writePointSet(binary, vMesh, set, patchFileName);
|
writePointSet(binary, vMesh.mesh(), set, patchFileName);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -849,7 +848,7 @@ int main(int argc, char *argv[])
|
|||||||
writeSurfFields
|
writeSurfFields
|
||||||
(
|
(
|
||||||
binary,
|
binary,
|
||||||
vMesh,
|
vMesh.mesh(),
|
||||||
surfFileName,
|
surfFileName,
|
||||||
svf
|
svf
|
||||||
);
|
);
|
||||||
@ -892,7 +891,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
patchWriter writer
|
patchWriter writer
|
||||||
(
|
(
|
||||||
vMesh,
|
vMesh.mesh(),
|
||||||
binary,
|
binary,
|
||||||
nearCellValue,
|
nearCellValue,
|
||||||
patchFileName,
|
patchFileName,
|
||||||
@ -970,7 +969,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
patchWriter writer
|
patchWriter writer
|
||||||
(
|
(
|
||||||
vMesh,
|
vMesh.mesh(),
|
||||||
binary,
|
binary,
|
||||||
nearCellValue,
|
nearCellValue,
|
||||||
patchFileName,
|
patchFileName,
|
||||||
@ -1188,7 +1187,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
lagrangianWriter writer
|
lagrangianWriter writer
|
||||||
(
|
(
|
||||||
vMesh,
|
vMesh.mesh(),
|
||||||
binary,
|
binary,
|
||||||
lagrFileName,
|
lagrFileName,
|
||||||
cloudName,
|
cloudName,
|
||||||
@ -1218,7 +1217,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
lagrangianWriter writer
|
lagrangianWriter writer
|
||||||
(
|
(
|
||||||
vMesh,
|
vMesh.mesh(),
|
||||||
binary,
|
binary,
|
||||||
lagrFileName,
|
lagrFileName,
|
||||||
cloudName,
|
cloudName,
|
||||||
|
|||||||
@ -6,7 +6,6 @@ writeFuns.C
|
|||||||
writeFaceSet.C
|
writeFaceSet.C
|
||||||
writePointSet.C
|
writePointSet.C
|
||||||
writeSurfFields.C
|
writeSurfFields.C
|
||||||
vtkMesh.C
|
|
||||||
vtkTopo.C
|
vtkTopo.C
|
||||||
|
|
||||||
writeVTK/writeVTK.C
|
writeVTK/writeVTK.C
|
||||||
|
|||||||
@ -41,8 +41,6 @@ SourceFiles
|
|||||||
#include "pointFields.H"
|
#include "pointFields.H"
|
||||||
#include "vtkMesh.H"
|
#include "vtkMesh.H"
|
||||||
|
|
||||||
using namespace Foam;
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -32,23 +32,21 @@ License
|
|||||||
|
|
||||||
Foam::lagrangianWriter::lagrangianWriter
|
Foam::lagrangianWriter::lagrangianWriter
|
||||||
(
|
(
|
||||||
const vtkMesh& vMesh,
|
const fvMesh& mesh,
|
||||||
const bool binary,
|
const bool binary,
|
||||||
const fileName& fName,
|
const fileName& fName,
|
||||||
const word& cloudName,
|
const word& cloudName,
|
||||||
const bool dummyCloud
|
const bool dummyCloud
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
vMesh_(vMesh),
|
mesh_(mesh),
|
||||||
binary_(binary),
|
binary_(binary),
|
||||||
fName_(fName),
|
fName_(fName),
|
||||||
cloudName_(cloudName),
|
cloudName_(cloudName),
|
||||||
os_(fName.c_str())
|
os_(fName.c_str())
|
||||||
{
|
{
|
||||||
const fvMesh& mesh = vMesh_.mesh();
|
|
||||||
|
|
||||||
// Write header
|
// Write header
|
||||||
writeFuns::writeHeader(os_, binary_, mesh.time().caseName());
|
writeFuns::writeHeader(os_, binary_, mesh_.time().caseName());
|
||||||
os_ << "DATASET POLYDATA" << std::endl;
|
os_ << "DATASET POLYDATA" << std::endl;
|
||||||
|
|
||||||
if (dummyCloud)
|
if (dummyCloud)
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -40,9 +40,6 @@ SourceFiles
|
|||||||
#include "Cloud.H"
|
#include "Cloud.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "pointFields.H"
|
#include "pointFields.H"
|
||||||
#include "vtkMesh.H"
|
|
||||||
|
|
||||||
using namespace Foam;
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -57,7 +54,7 @@ class volPointInterpolation;
|
|||||||
|
|
||||||
class lagrangianWriter
|
class lagrangianWriter
|
||||||
{
|
{
|
||||||
const vtkMesh& vMesh_;
|
const fvMesh& mesh_;
|
||||||
|
|
||||||
const bool binary_;
|
const bool binary_;
|
||||||
|
|
||||||
@ -77,7 +74,7 @@ public:
|
|||||||
//- Construct from components
|
//- Construct from components
|
||||||
lagrangianWriter
|
lagrangianWriter
|
||||||
(
|
(
|
||||||
const vtkMesh&,
|
const fvMesh&,
|
||||||
const bool binary,
|
const bool binary,
|
||||||
const fileName&,
|
const fileName&,
|
||||||
const word&,
|
const word&,
|
||||||
|
|||||||
@ -39,9 +39,9 @@ void Foam::lagrangianWriter::writeIOField(const wordList& objects)
|
|||||||
IOobject header
|
IOobject header
|
||||||
(
|
(
|
||||||
object,
|
object,
|
||||||
vMesh_.mesh().time().timeName(),
|
mesh_.time().timeName(),
|
||||||
cloud::prefix/cloudName_,
|
cloud::prefix/cloudName_,
|
||||||
vMesh_.mesh(),
|
mesh_,
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
IOobject::NO_WRITE,
|
IOobject::NO_WRITE,
|
||||||
false
|
false
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -30,21 +30,20 @@ License
|
|||||||
|
|
||||||
Foam::patchWriter::patchWriter
|
Foam::patchWriter::patchWriter
|
||||||
(
|
(
|
||||||
const vtkMesh& vMesh,
|
const fvMesh& mesh,
|
||||||
const bool binary,
|
const bool binary,
|
||||||
const bool nearCellValue,
|
const bool nearCellValue,
|
||||||
const fileName& fName,
|
const fileName& fName,
|
||||||
const labelList& patchIDs
|
const labelList& patchIDs
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
vMesh_(vMesh),
|
mesh_(mesh),
|
||||||
binary_(binary),
|
binary_(binary),
|
||||||
nearCellValue_(nearCellValue),
|
nearCellValue_(nearCellValue),
|
||||||
fName_(fName),
|
fName_(fName),
|
||||||
patchIDs_(patchIDs),
|
patchIDs_(patchIDs),
|
||||||
os_(fName.c_str())
|
os_(fName.c_str())
|
||||||
{
|
{
|
||||||
const fvMesh& mesh = vMesh_.mesh();
|
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
|
|
||||||
// Write header
|
// Write header
|
||||||
@ -115,8 +114,6 @@ Foam::patchWriter::patchWriter
|
|||||||
|
|
||||||
void Foam::patchWriter::writePatchIDs()
|
void Foam::patchWriter::writePatchIDs()
|
||||||
{
|
{
|
||||||
const fvMesh& mesh = vMesh_.mesh();
|
|
||||||
|
|
||||||
DynamicList<floatScalar> fField(nFaces_);
|
DynamicList<floatScalar> fField(nFaces_);
|
||||||
|
|
||||||
os_ << "patchID 1 " << nFaces_ << " float" << std::endl;
|
os_ << "patchID 1 " << nFaces_ << " float" << std::endl;
|
||||||
@ -125,7 +122,7 @@ void Foam::patchWriter::writePatchIDs()
|
|||||||
{
|
{
|
||||||
label patchi = patchIDs_[i];
|
label patchi = patchIDs_[i];
|
||||||
|
|
||||||
const polyPatch& pp = mesh.boundaryMesh()[patchi];
|
const polyPatch& pp = mesh_.boundaryMesh()[patchi];
|
||||||
|
|
||||||
if (!isA<emptyPolyPatch>(pp))
|
if (!isA<emptyPolyPatch>(pp))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -40,12 +40,9 @@ SourceFiles
|
|||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "pointFields.H"
|
#include "pointFields.H"
|
||||||
#include "vtkMesh.H"
|
|
||||||
#include "indirectPrimitivePatch.H"
|
#include "indirectPrimitivePatch.H"
|
||||||
#include "PrimitivePatchInterpolation.H"
|
#include "PrimitivePatchInterpolation.H"
|
||||||
|
|
||||||
using namespace Foam;
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -59,7 +56,8 @@ class volPointInterpolation;
|
|||||||
|
|
||||||
class patchWriter
|
class patchWriter
|
||||||
{
|
{
|
||||||
const vtkMesh& vMesh_;
|
//- Reference to the OpenFOAM mesh (or subset)
|
||||||
|
const fvMesh& mesh_;
|
||||||
|
|
||||||
const bool binary_;
|
const bool binary_;
|
||||||
|
|
||||||
@ -82,7 +80,7 @@ public:
|
|||||||
//- Construct from components
|
//- Construct from components
|
||||||
patchWriter
|
patchWriter
|
||||||
(
|
(
|
||||||
const vtkMesh&,
|
const fvMesh&,
|
||||||
const bool binary,
|
const bool binary,
|
||||||
const bool nearCellValue,
|
const bool nearCellValue,
|
||||||
const fileName&,
|
const fileName&,
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -36,37 +36,32 @@ namespace Foam
|
|||||||
template<class GeoField>
|
template<class GeoField>
|
||||||
void readFields
|
void readFields
|
||||||
(
|
(
|
||||||
const vtkMesh& vMesh,
|
const meshSubsetHelper& helper,
|
||||||
const typename GeoField::Mesh& mesh,
|
const typename GeoField::Mesh& mesh,
|
||||||
const IOobjectList& objects,
|
const IOobjectList& objects,
|
||||||
const HashSet<word>& selectedFields,
|
const HashSet<word>& selectedFields,
|
||||||
PtrList<const GeoField>& fields
|
PtrList<const GeoField>& fields
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Search list of objects for volScalarFields
|
// Search list of objects for fields of type GeomField
|
||||||
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));
|
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));
|
||||||
|
|
||||||
// Construct the vol scalar fields
|
// Construct the fields
|
||||||
fields.setSize(fieldObjects.size());
|
fields.setSize(fieldObjects.size());
|
||||||
label nFields = 0;
|
label nFields = 0;
|
||||||
|
|
||||||
forAllIter(IOobjectList, fieldObjects, iter)
|
forAllConstIter(IOobjectList, fieldObjects, iter)
|
||||||
{
|
{
|
||||||
if (selectedFields.empty() || selectedFields.found(iter()->name()))
|
if (selectedFields.empty() || selectedFields.found(iter()->name()))
|
||||||
{
|
{
|
||||||
fields.set
|
fields.set
|
||||||
(
|
(
|
||||||
nFields,
|
nFields++,
|
||||||
vMesh.interpolate
|
helper.interpolate
|
||||||
(
|
(
|
||||||
GeoField
|
GeoField(*iter(), mesh)
|
||||||
(
|
|
||||||
*iter(),
|
|
||||||
mesh
|
|
||||||
)
|
|
||||||
).ptr()
|
).ptr()
|
||||||
);
|
);
|
||||||
nFields++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -34,7 +34,7 @@ SourceFiles
|
|||||||
#ifndef readFields_H
|
#ifndef readFields_H
|
||||||
#define readFields_H
|
#define readFields_H
|
||||||
|
|
||||||
#include "fvMesh.H"
|
#include "meshSubsetHelper.H"
|
||||||
#include "PtrList.H"
|
#include "PtrList.H"
|
||||||
#include "IOobjectList.H"
|
#include "IOobjectList.H"
|
||||||
#include "HashSet.H"
|
#include "HashSet.H"
|
||||||
@ -48,7 +48,7 @@ namespace Foam
|
|||||||
template<class GeoField>
|
template<class GeoField>
|
||||||
void readFields
|
void readFields
|
||||||
(
|
(
|
||||||
const vtkMesh& vMesh,
|
const meshSubsetHelper&,
|
||||||
const typename GeoField::Mesh& mesh,
|
const typename GeoField::Mesh& mesh,
|
||||||
const IOobjectList& objects,
|
const IOobjectList& objects,
|
||||||
const HashSet<word>& selectedFields,
|
const HashSet<word>& selectedFields,
|
||||||
|
|||||||
@ -40,11 +40,8 @@ SourceFiles
|
|||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "surfaceFields.H"
|
#include "surfaceFields.H"
|
||||||
#include "vtkMesh.H"
|
|
||||||
#include "indirectPrimitivePatch.H"
|
#include "indirectPrimitivePatch.H"
|
||||||
|
|
||||||
using namespace Foam;
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
|
|||||||
@ -29,7 +29,8 @@ License
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Field<Type>> Foam::surfaceMeshWriter::getFaceField
|
Foam::tmp<Foam::Field<Type>>
|
||||||
|
Foam::surfaceMeshWriter::getFaceField
|
||||||
(
|
(
|
||||||
const GeometricField<Type, fvsPatchField, surfaceMesh>& sfld
|
const GeometricField<Type, fvsPatchField, surfaceMesh>& sfld
|
||||||
) const
|
) const
|
||||||
|
|||||||
@ -1,82 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM 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.
|
|
||||||
|
|
||||||
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "vtkMesh.H"
|
|
||||||
#include "fvMeshSubset.H"
|
|
||||||
#include "Time.H"
|
|
||||||
#include "cellSet.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::vtkMesh::vtkMesh
|
|
||||||
(
|
|
||||||
fvMesh& baseMesh,
|
|
||||||
const word& setName
|
|
||||||
)
|
|
||||||
:
|
|
||||||
baseMesh_(baseMesh),
|
|
||||||
subsetter_(baseMesh),
|
|
||||||
setName_(setName)
|
|
||||||
{
|
|
||||||
if (setName.size())
|
|
||||||
{
|
|
||||||
// Read cellSet using whole mesh
|
|
||||||
cellSet currentSet(baseMesh_, setName_);
|
|
||||||
|
|
||||||
// Set current subset
|
|
||||||
subsetter_.setLargeCellSubset(currentSet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::polyMesh::readUpdateState Foam::vtkMesh::readUpdate()
|
|
||||||
{
|
|
||||||
polyMesh::readUpdateState meshState = baseMesh_.readUpdate();
|
|
||||||
|
|
||||||
if (meshState != polyMesh::UNCHANGED)
|
|
||||||
{
|
|
||||||
// Note: since fvMeshSubset has no movePoints() functionality,
|
|
||||||
// reconstruct the subset even if only movement.
|
|
||||||
|
|
||||||
topoPtr_.clear();
|
|
||||||
|
|
||||||
if (setName_.size())
|
|
||||||
{
|
|
||||||
Info<< "Subsetting mesh based on cellSet " << setName_ << endl;
|
|
||||||
|
|
||||||
// Read cellSet using whole mesh
|
|
||||||
cellSet currentSet(baseMesh_, setName_);
|
|
||||||
|
|
||||||
subsetter_.setLargeCellSubset(currentSet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return meshState;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -36,46 +36,35 @@ SourceFiles
|
|||||||
#ifndef vtkMesh_H
|
#ifndef vtkMesh_H
|
||||||
#define vtkMesh_H
|
#define vtkMesh_H
|
||||||
|
|
||||||
|
#include "meshSubsetHelper.H"
|
||||||
#include "vtkTopo.H"
|
#include "vtkTopo.H"
|
||||||
#include "fvMeshSubset.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
|
||||||
class Time;
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class vtkMesh Declaration
|
Class vtkMesh Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class vtkMesh
|
class vtkMesh
|
||||||
|
:
|
||||||
|
public meshSubsetHelper
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Reference to mesh
|
|
||||||
fvMesh& baseMesh_;
|
|
||||||
|
|
||||||
//- Subsetting engine + sub-fvMesh
|
|
||||||
fvMeshSubset subsetter_;
|
|
||||||
|
|
||||||
//- Current cellSet (or empty)
|
|
||||||
const word setName_;
|
|
||||||
|
|
||||||
//- Current decomposition of topology
|
//- Current decomposition of topology
|
||||||
mutable autoPtr<vtkTopo> topoPtr_;
|
mutable autoPtr<vtkTopo> topoPtr_;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
vtkMesh(const vtkMesh&);
|
vtkMesh(const vtkMesh&) = delete;
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const vtkMesh&);
|
void operator=(const vtkMesh&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -83,31 +72,17 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
vtkMesh(fvMesh& baseMesh, const word& setName = "");
|
vtkMesh(fvMesh& baseMesh, const word& setName = word::null)
|
||||||
|
:
|
||||||
|
meshSubsetHelper(baseMesh, meshSubsetHelper::SET, setName)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Whole mesh
|
//- Topology
|
||||||
const fvMesh& baseMesh() const
|
|
||||||
{
|
|
||||||
return baseMesh_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const fvMeshSubset& subsetter() const
|
|
||||||
{
|
|
||||||
return subsetter_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Check if running subMesh
|
|
||||||
bool useSubMesh() const
|
|
||||||
{
|
|
||||||
return setName_.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
//- topology
|
|
||||||
const vtkTopo& topo() const
|
const vtkTopo& topo() const
|
||||||
{
|
{
|
||||||
if (topoPtr_.empty())
|
if (topoPtr_.empty())
|
||||||
@ -117,18 +92,6 @@ public:
|
|||||||
return topoPtr_();
|
return topoPtr_();
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Access either mesh or submesh
|
|
||||||
const fvMesh& mesh() const
|
|
||||||
{
|
|
||||||
if (useSubMesh())
|
|
||||||
{
|
|
||||||
return subsetter_.subMesh();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return baseMesh_;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Number of field cells
|
//- Number of field cells
|
||||||
label nFieldCells() const
|
label nFieldCells() const
|
||||||
@ -136,6 +99,7 @@ public:
|
|||||||
return topo().cellTypes().size();
|
return topo().cellTypes().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Number of field points
|
//- Number of field points
|
||||||
label nFieldPoints() const
|
label nFieldPoints() const
|
||||||
{
|
{
|
||||||
@ -145,26 +109,20 @@ public:
|
|||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
|
|
||||||
//- Read mesh
|
//- Read mesh, forcing topo update if necessary
|
||||||
polyMesh::readUpdateState readUpdate();
|
polyMesh::readUpdateState readUpdate()
|
||||||
|
{
|
||||||
|
polyMesh::readUpdateState meshState
|
||||||
|
= meshSubsetHelper::readUpdate();
|
||||||
|
|
||||||
|
if (meshState != polyMesh::UNCHANGED)
|
||||||
|
{
|
||||||
|
topoPtr_.clear();
|
||||||
|
}
|
||||||
|
|
||||||
//- Map volume field (does in fact do very little interpolation;
|
return meshState;
|
||||||
// just copied from fvMeshSubset)
|
|
||||||
template<class GeoField>
|
|
||||||
tmp<GeoField> interpolate(const GeoField& fld) const
|
|
||||||
{
|
|
||||||
if (useSubMesh())
|
|
||||||
{
|
|
||||||
tmp<GeoField> subFld = subsetter_.interpolate(fld);
|
|
||||||
subFld.ref().rename(fld.name());
|
|
||||||
return subFld;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return fld;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -32,12 +32,12 @@ License
|
|||||||
void Foam::writeFaceSet
|
void Foam::writeFaceSet
|
||||||
(
|
(
|
||||||
const bool binary,
|
const bool binary,
|
||||||
const vtkMesh& vMesh,
|
const fvMesh& mesh,
|
||||||
const faceSet& set,
|
const faceSet& set,
|
||||||
const fileName& fileName
|
const fileName& fileName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const faceList& faces = vMesh.mesh().faces();
|
const faceList& faces = mesh.faces();
|
||||||
|
|
||||||
std::ofstream ostr(fileName.c_str());
|
std::ofstream ostr(fileName.c_str());
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ void Foam::writeFaceSet
|
|||||||
setFaces[setFacei] = faces[iter.key()];
|
setFaces[setFacei] = faces[iter.key()];
|
||||||
setFacei++;
|
setFacei++;
|
||||||
}
|
}
|
||||||
primitiveFacePatch fp(setFaces, vMesh.mesh().points());
|
primitiveFacePatch fp(setFaces, mesh.points());
|
||||||
|
|
||||||
|
|
||||||
// Write points and faces as polygons
|
// Write points and faces as polygons
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -36,7 +36,7 @@ SourceFiles
|
|||||||
#ifndef writeFaceSet_H
|
#ifndef writeFaceSet_H
|
||||||
#define writeFaceSet_H
|
#define writeFaceSet_H
|
||||||
|
|
||||||
#include "vtkMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "faceSet.H"
|
#include "faceSet.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -48,7 +48,7 @@ namespace Foam
|
|||||||
void writeFaceSet
|
void writeFaceSet
|
||||||
(
|
(
|
||||||
const bool binary,
|
const bool binary,
|
||||||
const vtkMesh& vMesh,
|
const fvMesh&,
|
||||||
const faceSet& set,
|
const faceSet& set,
|
||||||
const fileName& fileName
|
const fileName& fileName
|
||||||
);
|
);
|
||||||
|
|||||||
@ -37,7 +37,7 @@ namespace Foam
|
|||||||
void writePointSet
|
void writePointSet
|
||||||
(
|
(
|
||||||
const bool binary,
|
const bool binary,
|
||||||
const vtkMesh& vMesh,
|
const fvMesh& mesh,
|
||||||
const pointSet& set,
|
const pointSet& set,
|
||||||
const fileName& fileName
|
const fileName& fileName
|
||||||
)
|
)
|
||||||
@ -68,7 +68,7 @@ void writePointSet
|
|||||||
|
|
||||||
writeFuns::insert
|
writeFuns::insert
|
||||||
(
|
(
|
||||||
UIndirectList<point>(vMesh.mesh().points(), set.toc())(),
|
UIndirectList<point>(mesh.points(), set.toc())(),
|
||||||
ptField
|
ptField
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -36,7 +36,7 @@ SourceFiles
|
|||||||
#ifndef writePointSet_H
|
#ifndef writePointSet_H
|
||||||
#define writePointSet_H
|
#define writePointSet_H
|
||||||
|
|
||||||
#include "vtkMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "pointSet.H"
|
#include "pointSet.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -48,7 +48,7 @@ namespace Foam
|
|||||||
void writePointSet
|
void writePointSet
|
||||||
(
|
(
|
||||||
const bool binary,
|
const bool binary,
|
||||||
const vtkMesh& vMesh,
|
const fvMesh& mesh,
|
||||||
const pointSet& set,
|
const pointSet& set,
|
||||||
const fileName& fileName
|
const fileName& fileName
|
||||||
);
|
);
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -35,13 +35,11 @@ License
|
|||||||
void Foam::writeSurfFields
|
void Foam::writeSurfFields
|
||||||
(
|
(
|
||||||
const bool binary,
|
const bool binary,
|
||||||
const vtkMesh& vMesh,
|
const fvMesh& mesh,
|
||||||
const fileName& fileName,
|
const fileName& fileName,
|
||||||
const UPtrList<const surfaceVectorField>& surfVectorFields
|
const UPtrList<const surfaceVectorField>& surfVectorFields
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const fvMesh& mesh = vMesh.mesh();
|
|
||||||
|
|
||||||
std::ofstream str(fileName.c_str());
|
std::ofstream str(fileName.c_str());
|
||||||
|
|
||||||
writeFuns::writeHeader
|
writeFuns::writeHeader
|
||||||
|
|||||||
@ -35,7 +35,7 @@ SourceFiles
|
|||||||
#ifndef writeSurfFields_H
|
#ifndef writeSurfFields_H
|
||||||
#define writeSurfFields_H
|
#define writeSurfFields_H
|
||||||
|
|
||||||
#include "vtkMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "surfaceMesh.H"
|
#include "surfaceMesh.H"
|
||||||
#include "surfaceFieldsFwd.H"
|
#include "surfaceFieldsFwd.H"
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ namespace Foam
|
|||||||
void writeSurfFields
|
void writeSurfFields
|
||||||
(
|
(
|
||||||
const bool binary,
|
const bool binary,
|
||||||
const vtkMesh& vMesh,
|
const fvMesh&,
|
||||||
const fileName& fileName,
|
const fileName& fileName,
|
||||||
const UPtrList<const surfaceVectorField>& surfVectorFields
|
const UPtrList<const surfaceVectorField>& surfVectorFields
|
||||||
);
|
);
|
||||||
|
|||||||
@ -90,6 +90,7 @@ polyMeshAdder/polyMeshAdder.C
|
|||||||
fvMeshTools/fvMeshTools.C
|
fvMeshTools/fvMeshTools.C
|
||||||
|
|
||||||
fvMeshSubset/fvMeshSubset.C
|
fvMeshSubset/fvMeshSubset.C
|
||||||
|
meshSubsetHelper/meshSubsetHelper.C
|
||||||
|
|
||||||
motionSmoother/motionSmoother.C
|
motionSmoother/motionSmoother.C
|
||||||
motionSmoother/motionSmootherAlgo.C
|
motionSmoother/motionSmootherAlgo.C
|
||||||
|
|||||||
@ -28,21 +28,34 @@ License
|
|||||||
#include "cellSet.H"
|
#include "cellSet.H"
|
||||||
#include "cellZone.H"
|
#include "cellZone.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "IOstreams.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::meshSubsetHelper::meshSubsetHelper
|
Foam::meshSubsetHelper::meshSubsetHelper
|
||||||
(
|
(
|
||||||
fvMesh& baseMesh,
|
fvMesh& baseMesh
|
||||||
const word& name,
|
|
||||||
const bool isCellSet
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
baseMesh_(baseMesh),
|
baseMesh_(baseMesh),
|
||||||
subsetter_(baseMesh),
|
subsetter_(baseMesh),
|
||||||
name_(name),
|
type_(NONE),
|
||||||
type_(name_.empty() ? 0 : isCellSet ? 1 : 2)
|
name_()
|
||||||
|
{
|
||||||
|
correct();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::meshSubsetHelper::meshSubsetHelper
|
||||||
|
(
|
||||||
|
fvMesh& baseMesh,
|
||||||
|
const subsetType type,
|
||||||
|
const word& name
|
||||||
|
)
|
||||||
|
:
|
||||||
|
baseMesh_(baseMesh),
|
||||||
|
subsetter_(baseMesh),
|
||||||
|
type_(name.empty() ? NONE : type),
|
||||||
|
name_(name)
|
||||||
{
|
{
|
||||||
correct();
|
correct();
|
||||||
}
|
}
|
||||||
@ -52,7 +65,7 @@ Foam::meshSubsetHelper::meshSubsetHelper
|
|||||||
|
|
||||||
void Foam::meshSubsetHelper::correct(bool verbose)
|
void Foam::meshSubsetHelper::correct(bool verbose)
|
||||||
{
|
{
|
||||||
if (type_ == 1)
|
if (type_ == SET)
|
||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
{
|
{
|
||||||
@ -62,7 +75,7 @@ void Foam::meshSubsetHelper::correct(bool verbose)
|
|||||||
cellSet subset(baseMesh_, name_);
|
cellSet subset(baseMesh_, name_);
|
||||||
subsetter_.setLargeCellSubset(subset);
|
subsetter_.setLargeCellSubset(subset);
|
||||||
}
|
}
|
||||||
else if (type_ == 2)
|
else if (type_ == ZONE)
|
||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
{
|
{
|
||||||
@ -54,6 +54,17 @@ class Time;
|
|||||||
|
|
||||||
class meshSubsetHelper
|
class meshSubsetHelper
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Internal book-keeping for subset type
|
||||||
|
enum subsetType
|
||||||
|
{
|
||||||
|
NONE, //<! Not a subset
|
||||||
|
SET, //<! Using a cellSet for the subset
|
||||||
|
ZONE //<! Using a cellZone for the subset
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Reference to mesh
|
//- Reference to mesh
|
||||||
@ -62,12 +73,12 @@ class meshSubsetHelper
|
|||||||
//- Subsetting engine + sub-fvMesh
|
//- Subsetting engine + sub-fvMesh
|
||||||
fvMeshSubset subsetter_;
|
fvMeshSubset subsetter_;
|
||||||
|
|
||||||
|
//- Subset type if any.
|
||||||
|
const subsetType type_;
|
||||||
|
|
||||||
//- Name of current cellSet/cellZone (or empty)
|
//- Name of current cellSet/cellZone (or empty)
|
||||||
const word name_;
|
const word name_;
|
||||||
|
|
||||||
//- Internal book-keeping. 0 = unused, 1 = set, 2 = zone
|
|
||||||
const int type_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
@ -82,12 +93,15 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
meshSubsetHelper(fvMesh& baseMesh);
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
meshSubsetHelper
|
meshSubsetHelper
|
||||||
(
|
(
|
||||||
fvMesh& baseMesh,
|
fvMesh& baseMesh,
|
||||||
const word& name = word::null,
|
const subsetType,
|
||||||
const bool isCellSet = false
|
const word& name
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -110,7 +124,7 @@ public:
|
|||||||
//- Check if running a sub-mesh is being used
|
//- Check if running a sub-mesh is being used
|
||||||
inline bool useSubMesh() const
|
inline bool useSubMesh() const
|
||||||
{
|
{
|
||||||
return type_;
|
return type_ != NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Access either mesh or submesh
|
//- Access either mesh or submesh
|
||||||
@ -146,7 +160,7 @@ public:
|
|||||||
Type,
|
Type,
|
||||||
fvPatchField,
|
fvPatchField,
|
||||||
volMesh
|
volMesh
|
||||||
>::Internal& df
|
>::Internal&
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -174,6 +188,11 @@ public:
|
|||||||
>::Internal&
|
>::Internal&
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
//- Map volume field (does in fact do very little interpolation;
|
||||||
|
// just copied from fvMeshSubset)
|
||||||
|
template<class GeoField>
|
||||||
|
tmp<GeoField> interpolate(const GeoField& fld) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -116,4 +116,25 @@ Foam::meshSubsetHelper::interpolate
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class GeoField>
|
||||||
|
Foam::tmp<GeoField>
|
||||||
|
Foam::meshSubsetHelper::interpolate
|
||||||
|
(
|
||||||
|
const GeoField& fld
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (subsetter_.hasSubMesh())
|
||||||
|
{
|
||||||
|
tmp<GeoField> subFld = subsetter_.interpolate(fld);
|
||||||
|
subFld.ref().checkOut();
|
||||||
|
subFld.ref().rename(fld.name());
|
||||||
|
return subFld;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return fld;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user