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