Commit 99e8bf75 authored by mattijs's avatar mattijs
Browse files

volPointInterpolation, pointMesh now MeshObject

parent cdb0a8a8
......@@ -46,9 +46,6 @@
)
);
pointMesh pMesh(mesh);
volPointInterpolation vpi(mesh, pMesh);
word kinematicCloudName("kinematicCloud");
if (args.options().found("cloudName"))
......@@ -60,7 +57,6 @@
basicKinematicCloud kinematicCloud
(
kinematicCloudName,
vpi,
rho,
U,
thermo().mu(),
......
Info << "Constructing Spray" << endl;
pointMesh pMesh(mesh);
volPointInterpolation vpi(mesh, pMesh);
PtrList<specieProperties> gasProperties(Y.size());
forAll(gasProperties, i)
{
......@@ -18,7 +15,6 @@ forAll(gasProperties, i)
spray dieselSpray
(
vpi,
U,
rho,
p,
......
......@@ -41,6 +41,7 @@ Description
#include "multivariateScheme.H"
#include "Switch.H"
#include "OFstream.H"
#include "volPointInterpolation.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -75,7 +76,10 @@ int main(int argc, char *argv[])
Info<< "Crank angle = " << runTime.theta() << " CA-deg" << endl;
mesh.move();
vpi.updateMesh();
const_cast<volPointInterpolation&>
(
volPointInterpolation::New(mesh)
).updateMesh();
dieselSpray.evolve();
......
......@@ -52,8 +52,7 @@ int main(int argc, char *argv[])
# include "createTime.H"
# include "createMesh.H"
pointMesh pMesh(mesh);
volPointInterpolation pInterp(mesh, pMesh);
volPointInterpolation pInterp(mesh);
// Get times list
instantList Times = runTime.times();
......
......@@ -642,8 +642,7 @@ int main(int argc, char *argv[])
//Info<< "Writing variables data ..." << endl;
pointMesh pMesh(mesh);
volPointInterpolation pInterp(mesh, pMesh);
volPointInterpolation pInterp(mesh);
writeInt(fvFile, FV_VARIABLES);
......
......@@ -489,7 +489,7 @@ int main(int argc, char *argv[])
readFields
(
vMesh,
vMesh.basePointMesh(),
pointMesh::New(vMesh.baseMesh()),
objects,
selectedFields,
psf
......@@ -499,7 +499,7 @@ int main(int argc, char *argv[])
readFields
(
vMesh,
vMesh.basePointMesh(),
pointMesh::New(vMesh.baseMesh()),
objects,
selectedFields,
pvf
......@@ -509,7 +509,7 @@ int main(int argc, char *argv[])
readFields
(
vMesh,
vMesh.basePointMesh(),
pointMesh::New(vMesh.baseMesh()),
objects,
selectedFields,
pSpheretf
......@@ -519,7 +519,7 @@ int main(int argc, char *argv[])
readFields
(
vMesh,
vMesh.basePointMesh(),
pointMesh::New(vMesh.baseMesh()),
objects,
selectedFields,
pSymmtf
......@@ -529,7 +529,7 @@ int main(int argc, char *argv[])
readFields
(
vMesh,
vMesh.basePointMesh(),
pointMesh::New(vMesh.baseMesh()),
objects,
selectedFields,
ptf
......@@ -598,7 +598,7 @@ int main(int argc, char *argv[])
writer.write(ptf);
// Interpolated volFields
volPointInterpolation pInterp(mesh, vMesh.pMesh());
volPointInterpolation pInterp(mesh);
writer.write(pInterp, vsf);
writer.write(pInterp, vvf);
writer.write(pInterp, vSpheretf);
......
......@@ -70,7 +70,6 @@ Foam::polyMesh::readUpdateState Foam::vtkMesh::readUpdate()
// the subset even if only movement.
topoPtr_.clear();
pointMeshPtr_.clear();
if (setName_.size() > 0)
{
......
......@@ -39,7 +39,6 @@ SourceFiles
#include "vtkTopo.H"
#include "fvMeshSubset.H"
#include "pointMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -60,9 +59,6 @@ class vtkMesh
//- Reference to mesh
fvMesh& baseMesh_;
//- Demand driven pointMesh
mutable autoPtr<pointMesh> pointMeshPtr_;
//- Subsetting engine + sub-fvMesh
fvMeshSubset subsetter_;
......@@ -101,15 +97,6 @@ public:
return baseMesh_;
}
const pointMesh& basePointMesh() const
{
if (!pointMeshPtr_.valid())
{
pointMeshPtr_.reset(new pointMesh(baseMesh_));
}
return pointMeshPtr_();
}
const fvMeshSubset& subsetter() const
{
return subsetter_;
......@@ -144,19 +131,6 @@ public:
}
}
//- Access either pointMesh of base or pointMesh of subset
const pointMesh& pMesh() const
{
if (useSubMesh())
{
return subsetter_.subPointMesh();
}
else
{
return basePointMesh();
}
}
//- Number of field cells
label nFieldCells() const
{
......@@ -166,7 +140,7 @@ public:
//- Number of field points
label nFieldPoints() const
{
return pMesh().size() + topo().addPointCellLabels().size();
return mesh().nPoints() + topo().addPointCellLabels().size();
}
......
......@@ -107,8 +107,7 @@ void Foam::vtkPV3Foam::convertVolFields
}
// Construct interpolation on the raw mesh
pointMesh pMesh(mesh);
volPointInterpolation pInterp(mesh, pMesh);
volPointInterpolation pInterp(mesh);
PtrList<PrimitivePatchInterpolation<primitivePatch> >
ppInterpList(mesh.boundaryMesh().size());
......
......@@ -62,11 +62,16 @@ Foam::pointMesh::pointMesh
bool alwaysConstructGlobalPatch
)
:
MeshObject<polyMesh, pointMesh>(pMesh),
GeoMesh<polyMesh>(pMesh),
boundary_(*this, pMesh.boundaryMesh())
{
// Add the globalPointPatch if there are global points
if (alwaysConstructGlobalPatch || mesh_.globalData().nGlobalPoints())
if
(
alwaysConstructGlobalPatch
|| GeoMesh<polyMesh>::mesh_.globalData().nGlobalPoints()
)
{
boundary_.setSize(boundary_.size() + 1);
......
......@@ -34,6 +34,7 @@ Description
#define pointMesh_H
#include "GeoMesh.H"
#include "MeshObject.H"
#include "polyMesh.H"
#include "pointBoundaryMesh.H"
......@@ -48,6 +49,7 @@ namespace Foam
class pointMesh
:
public MeshObject<polyMesh, pointMesh>,
public GeoMesh<polyMesh>
{
// Permanent data
......@@ -95,7 +97,7 @@ public:
//- Return number of points
static label size(const Mesh& mesh)
{
return mesh.mesh_.nPoints();
return mesh.GeoMesh<polyMesh>::mesh_.nPoints();
}
//- Return reference to boundary mesh
......@@ -107,7 +109,13 @@ public:
//- Return parallel info
const globalMeshData& globalData() const
{
return mesh_.globalData();
return GeoMesh<polyMesh>::mesh_.globalData();
}
//- Return database (only needed for compilation purposes)
const objectRegistry& db() const
{
return GeoMesh<polyMesh>::mesh_.db();
}
......
......@@ -28,6 +28,8 @@ License
#include "primitiveMesh.H"
#include "globalMeshData.H"
#include "demandDrivenData.H"
#include "pointMesh.H"
#include "Time.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
......@@ -65,6 +67,8 @@ void Foam::polyMesh::clearGeom()
{
boundary_[patchI].clearGeom();
}
pointMesh::Delete(*this);
}
......@@ -82,6 +86,8 @@ void Foam::polyMesh::clearAddressing()
// parallelData depends on the processorPatch ordering so force
// recalculation
deleteDemandDrivenData(globalMeshDataPtr_);
pointMesh::Delete(*this);
}
......
......@@ -31,6 +31,7 @@ Description
#include "mapPolyMesh.H"
#include "Time.H"
#include "globalMeshData.H"
#include "pointMesh.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
......@@ -66,6 +67,26 @@ void Foam::polyMesh::updateMesh(const mapPolyMesh& mpm)
// Map the list
newMotionPoints.map(oldMotionPoints, mpm.pointMap());
}
// Hack until proper callbacks. Below are all the polyMesh-MeshObjects.
// pointMesh
if
(
db().objectRegistry::foundObject<pointMesh>
(
pointMesh::typeName
)
)
{
const_cast<pointMesh&>
(
db().objectRegistry::lookupObject<pointMesh>
(
pointMesh::typeName
)
).updateMesh(mpm);
}
}
......
......@@ -34,7 +34,6 @@ License
#include "cellSet.H"
#include "syncTools.H"
#include "motionSmoother.H"
#include "pointMesh.H"
#include "refinementParameters.H"
#include "snapParameters.H"
#include "layerParameters.H"
......
......@@ -3082,7 +3082,7 @@ void Foam::autoLayerDriver::doLayers
Info<< "Constructing mesh displacer ..." << endl;
{
pointMesh pMesh(mesh);
const pointMesh& pMesh = pointMesh::New(mesh);
motionSmoother meshMover
(
......
......@@ -675,7 +675,6 @@ void Foam::autoLayerDriver::medialAxisSmoothingInfo
const polyMesh& mesh = meshMover.mesh();
const pointField& points = mesh.points();
const pointMesh& pMesh = meshMover.pMesh();
const indirectPrimitivePatch& pp = meshMover.patch();
const vectorField& faceNormals = pp.faceNormals();
......@@ -788,7 +787,7 @@ void Foam::autoLayerDriver::medialAxisSmoothingInfo
List<pointData> edgeWallDist(mesh.nEdges());
PointEdgeWave<pointData> wallDistCalc
(
pMesh,
mesh,
meshPoints,
wallInfo,
pointWallDist,
......@@ -892,7 +891,7 @@ void Foam::autoLayerDriver::medialAxisSmoothingInfo
// Do all calculations
PointEdgeWave<pointData> medialDistCalc
(
pMesh,
mesh,
maxPoints,
maxInfo,
......@@ -975,7 +974,6 @@ void Foam::autoLayerDriver::shrinkMeshMedialDistance
Info<< "shrinkMeshMedialDistance : Smoothing using Medial Axis ..." << endl;
const polyMesh& mesh = meshMover.mesh();
const pointMesh& pMesh = meshMover.pMesh();
const indirectPrimitivePatch& pp = meshMover.patch();
const labelList& meshPoints = pp.meshPoints();
......@@ -1100,7 +1098,7 @@ void Foam::autoLayerDriver::shrinkMeshMedialDistance
// Do all calculations
PointEdgeWave<pointData> wallDistCalc
(
pMesh,
mesh,
wallPoints,
wallInfo,
pointWallDist,
......
......@@ -527,7 +527,7 @@ Foam::tmp<Foam::scalarField> Foam::autoSnapDriver::edgePatchDist
PointEdgeWave<pointEdgePoint> wallCalc
(
pMesh,
mesh,
pp.meshPoints(),
wallInfo,
......@@ -1504,7 +1504,7 @@ void Foam::autoSnapDriver::doSnap
Info<< "Constructing mesh displacer ..." << endl;
Info<< "Using mesh parameters " << motionDict << nl << endl;
pointMesh pMesh(mesh);
const pointMesh& pMesh = pointMesh::New(mesh);
motionSmoother meshMover
(
......
......@@ -1992,7 +1992,7 @@ void Foam::meshRefinement::dumpRefinementLevel() const
volRefLevel.write();
pointMesh pMesh(mesh_);
const pointMesh& pMesh = pointMesh::New(mesh_);
pointScalarField pointRefLevel
(
......
......@@ -680,7 +680,6 @@ void Foam::fvMeshSubset::setCellSubset
newCells
)
);
pointMeshSubsetPtr_.clear();
// Add old patches
......@@ -1180,7 +1179,6 @@ void Foam::fvMeshSubset::setLargeCellSubset
syncPar // parallel synchronisation
)
);
pointMeshSubsetPtr_.clear();
// Add old patches
List<polyPatch*> newBoundary(nbSize);
......@@ -1370,26 +1368,6 @@ fvMesh& Foam::fvMeshSubset::subMesh()
}
const pointMesh& Foam::fvMeshSubset::subPointMesh() const
{
if (!pointMeshSubsetPtr_.valid())
{
pointMeshSubsetPtr_.reset(new pointMesh(subMesh()));
}
return pointMeshSubsetPtr_();
}
pointMesh& Foam::fvMeshSubset::subPointMesh()
{
if (!pointMeshSubsetPtr_.valid())
{
pointMeshSubsetPtr_.reset(new pointMesh(subMesh()));
}
return pointMeshSubsetPtr_();
}
const labelList& Foam::fvMeshSubset::pointMap() const
{
checkCellSubset();
......
......@@ -171,8 +171,6 @@ private:
//- Subset mesh pointer
autoPtr<fvMesh> fvMeshSubsetPtr_;
mutable autoPtr<pointMesh> pointMeshSubsetPtr_;
//- Point mapping array
labelList pointMap_;
......@@ -278,11 +276,6 @@ public:
fvMesh& subMesh();
//- Return reference to demand-driven subset pointMesh
const pointMesh& subPointMesh() const;
pointMesh& subPointMesh();
//- Return point map
const labelList& pointMap() const;
......
......@@ -409,7 +409,7 @@ tmp<GeometricField<Type, pointPatchField, pointMesh> > fvMeshSubset::interpolate
return interpolate
(
sf,
subPointMesh(), // subsetted point mesh
pointMesh::New(subMesh()), // subsetted point mesh
subMesh(), // registry (pointfields are stored on the polyMesh)
patchMap(),
pointMap()
......
......@@ -46,7 +46,6 @@ namespace Foam
{
class polyMesh;
class volPointInterpolation;
/*---------------------------------------------------------------------------*\
Class interpolation Declaration
......@@ -83,10 +82,9 @@ public:
interpolation,
dictionary,
(
const volPointInterpolation& pInterp,
const GeometricField<Type, fvPatchField, volMesh>& psi
),
(pInterp, psi)
(psi)
);
......@@ -96,7 +94,6 @@ public:
static autoPtr<interpolation<Type> > New
(
const word& interpolationType,
const volPointInterpolation& pInterp,
const GeometricField<Type, fvPatchField, volMesh>& psi
);
......@@ -104,7 +101,6 @@ public:
static autoPtr<interpolation<Type> > New
(
const dictionary& interpolationSchemes,
const volPointInterpolation& pInterp,
const GeometricField<Type, fvPatchField, volMesh>& psi
);
......
......@@ -34,7 +34,6 @@ Foam::autoPtr<Foam::interpolation<Type> >
Foam::interpolation<Type>::New
(
const word& interpolationType,
const volPointInterpolation& pInterp,
const GeometricField<Type, fvPatchField, volMesh>& psi
)
{
......@@ -55,7 +54,7 @@ Foam::interpolation<Type>::New
<< exit(FatalError);
}
return autoPtr<interpolation<Type> >(cstrIter()(pInterp, psi));
return autoPtr<interpolation<Type> >(cstrIter()(psi));
}
......@@ -64,11 +63,10 @@ Foam::autoPtr<Foam::interpolation<Type> >
Foam::interpolation<Type>::New
(
const dictionary& interpolationSchemes,
const volPointInterpolation& pInterp,
const GeometricField<Type, fvPatchField, volMesh>& psi
)
{
return New(word(interpolationSchemes.lookup(psi.name())), pInterp, psi);
return New(word(interpolationSchemes.lookup(psi.name())), psi);
}
......
......@@ -39,7 +39,6 @@ namespace Foam
template<class Type>
interpolationCell<Type>::interpolationCell
(
const volPointInterpolation&,
const GeometricField<Type, fvPatchField, volMesh>& psi
)
:
......
......@@ -63,7 +63,6 @@ public:
//- Construct from components
interpolationCell
(
const volPointInterpolation& pInterp,
const GeometricField<Type, fvPatchField, volMesh>& psi
);
......