mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: sampledTriSurfaceMesh: external call with supplied bb
This commit is contained in:
@ -135,145 +135,12 @@ Foam::sampledTriSurfaceMesh::nonCoupledboundaryTree() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
bool Foam::sampledTriSurfaceMesh::update(const meshSearch& meshSearcher)
|
||||||
|
|
||||||
Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const polyMesh& mesh,
|
|
||||||
const word& surfaceName,
|
|
||||||
const samplingSource sampleSource
|
|
||||||
)
|
|
||||||
:
|
|
||||||
sampledSurface(name, mesh),
|
|
||||||
surface_
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
surfaceName,
|
|
||||||
mesh.time().constant(), // instance
|
|
||||||
"triSurface", // local
|
|
||||||
mesh, // registry
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
),
|
|
||||||
sampleSource_(sampleSource),
|
|
||||||
needsUpdate_(true),
|
|
||||||
sampleElements_(0),
|
|
||||||
samplePoints_(0)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const polyMesh& mesh,
|
|
||||||
const dictionary& dict
|
|
||||||
)
|
|
||||||
:
|
|
||||||
sampledSurface(name, mesh, dict),
|
|
||||||
surface_
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
dict.lookup("surface"),
|
|
||||||
mesh.time().constant(), // instance
|
|
||||||
"triSurface", // local
|
|
||||||
mesh, // registry
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
),
|
|
||||||
sampleSource_(samplingSourceNames_[dict.lookup("source")]),
|
|
||||||
needsUpdate_(true),
|
|
||||||
sampleElements_(0),
|
|
||||||
samplePoints_(0)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const polyMesh& mesh,
|
|
||||||
const triSurface& surface,
|
|
||||||
const word& sampleSourceName
|
|
||||||
)
|
|
||||||
:
|
|
||||||
sampledSurface(name, mesh),
|
|
||||||
surface_
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
name,
|
|
||||||
mesh.time().constant(), // instance
|
|
||||||
"triSurface", // local
|
|
||||||
mesh, // registry
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
surface
|
|
||||||
),
|
|
||||||
sampleSource_(samplingSourceNames_[sampleSourceName]),
|
|
||||||
needsUpdate_(true),
|
|
||||||
sampleElements_(0),
|
|
||||||
samplePoints_(0)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::sampledTriSurfaceMesh::~sampledTriSurfaceMesh()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
bool Foam::sampledTriSurfaceMesh::needsUpdate() const
|
|
||||||
{
|
{
|
||||||
return needsUpdate_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Foam::sampledTriSurfaceMesh::expire()
|
|
||||||
{
|
|
||||||
// already marked as expired
|
|
||||||
if (needsUpdate_)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
sampledSurface::clearGeom();
|
|
||||||
MeshStorage::clear();
|
|
||||||
|
|
||||||
boundaryTreePtr_.clear();
|
|
||||||
sampleElements_.clear();
|
|
||||||
samplePoints_.clear();
|
|
||||||
|
|
||||||
needsUpdate_ = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Foam::sampledTriSurfaceMesh::update()
|
|
||||||
{
|
|
||||||
if (!needsUpdate_)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Find the cells the triangles of the surface are in.
|
// Find the cells the triangles of the surface are in.
|
||||||
// Does approximation by looking at the face centres only
|
// Does approximation by looking at the face centres only
|
||||||
const pointField& fc = surface_.faceCentres();
|
const pointField& fc = surface_.faceCentres();
|
||||||
|
|
||||||
// Mesh search engine, no triangulation of faces.
|
|
||||||
meshSearch meshSearcher(mesh(), polyMesh::FACEPLANES);
|
|
||||||
|
|
||||||
|
|
||||||
List<nearInfo> nearest(fc.size());
|
List<nearInfo> nearest(fc.size());
|
||||||
|
|
||||||
// Global numbering for cells/faces - only used to uniquely identify local
|
// Global numbering for cells/faces - only used to uniquely identify local
|
||||||
@ -611,6 +478,157 @@ bool Foam::sampledTriSurfaceMesh::update()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const word& surfaceName,
|
||||||
|
const samplingSource sampleSource
|
||||||
|
)
|
||||||
|
:
|
||||||
|
sampledSurface(name, mesh),
|
||||||
|
surface_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
surfaceName,
|
||||||
|
mesh.time().constant(), // instance
|
||||||
|
"triSurface", // local
|
||||||
|
mesh, // registry
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
),
|
||||||
|
sampleSource_(sampleSource),
|
||||||
|
needsUpdate_(true),
|
||||||
|
sampleElements_(0),
|
||||||
|
samplePoints_(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
sampledSurface(name, mesh, dict),
|
||||||
|
surface_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
dict.lookup("surface"),
|
||||||
|
mesh.time().constant(), // instance
|
||||||
|
"triSurface", // local
|
||||||
|
mesh, // registry
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
),
|
||||||
|
sampleSource_(samplingSourceNames_[dict.lookup("source")]),
|
||||||
|
needsUpdate_(true),
|
||||||
|
sampleElements_(0),
|
||||||
|
samplePoints_(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const triSurface& surface,
|
||||||
|
const word& sampleSourceName
|
||||||
|
)
|
||||||
|
:
|
||||||
|
sampledSurface(name, mesh),
|
||||||
|
surface_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
name,
|
||||||
|
mesh.time().constant(), // instance
|
||||||
|
"triSurface", // local
|
||||||
|
mesh, // registry
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
surface
|
||||||
|
),
|
||||||
|
sampleSource_(samplingSourceNames_[sampleSourceName]),
|
||||||
|
needsUpdate_(true),
|
||||||
|
sampleElements_(0),
|
||||||
|
samplePoints_(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::sampledTriSurfaceMesh::~sampledTriSurfaceMesh()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::sampledTriSurfaceMesh::needsUpdate() const
|
||||||
|
{
|
||||||
|
return needsUpdate_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::sampledTriSurfaceMesh::expire()
|
||||||
|
{
|
||||||
|
// already marked as expired
|
||||||
|
if (needsUpdate_)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
sampledSurface::clearGeom();
|
||||||
|
MeshStorage::clear();
|
||||||
|
|
||||||
|
boundaryTreePtr_.clear();
|
||||||
|
sampleElements_.clear();
|
||||||
|
samplePoints_.clear();
|
||||||
|
|
||||||
|
needsUpdate_ = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::sampledTriSurfaceMesh::update()
|
||||||
|
{
|
||||||
|
if (!needsUpdate_)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mesh search engine, no triangulation of faces.
|
||||||
|
meshSearch meshSearcher(mesh(), polyMesh::FACEPLANES);
|
||||||
|
|
||||||
|
return update(meshSearcher);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::sampledTriSurfaceMesh::update(const treeBoundBox& bb)
|
||||||
|
{
|
||||||
|
if (!needsUpdate_)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mesh search engine on subset, no triangulation of faces.
|
||||||
|
meshSearch meshSearcher(mesh(), bb, polyMesh::FACEPLANES);
|
||||||
|
|
||||||
|
return update(meshSearcher);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::scalarField> Foam::sampledTriSurfaceMesh::sample
|
Foam::tmp<Foam::scalarField> Foam::sampledTriSurfaceMesh::sample
|
||||||
(
|
(
|
||||||
const volScalarField& vField
|
const volScalarField& vField
|
||||||
|
|||||||
@ -72,6 +72,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
class treeDataFace;
|
class treeDataFace;
|
||||||
|
class meshSearch;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class sampledTriSurfaceMesh Declaration
|
Class sampledTriSurfaceMesh Declaration
|
||||||
@ -136,6 +137,8 @@ private:
|
|||||||
tmp<Field<Type> >
|
tmp<Field<Type> >
|
||||||
interpolateField(const interpolation<Type>&) const;
|
interpolateField(const interpolation<Type>&) const;
|
||||||
|
|
||||||
|
bool update(const meshSearch& meshSearcher);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
@ -189,6 +192,10 @@ public:
|
|||||||
// Do nothing (and return false) if no update was needed
|
// Do nothing (and return false) if no update was needed
|
||||||
virtual bool update();
|
virtual bool update();
|
||||||
|
|
||||||
|
//- Update the surface using a bound box to limit the searching.
|
||||||
|
// For direct use, i.e. not through sample.
|
||||||
|
// Do nothing (and return false) if no update was needed
|
||||||
|
bool update(const treeBoundBox&);
|
||||||
|
|
||||||
//- Points of surface
|
//- Points of surface
|
||||||
virtual const pointField& points() const
|
virtual const pointField& points() const
|
||||||
|
|||||||
Reference in New Issue
Block a user