mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: moved cellree functionality from Cloud to primitiveMesh
This commit is contained in:
@ -2,7 +2,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) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -26,8 +26,6 @@ License
|
|||||||
#include "primitiveMesh.H"
|
#include "primitiveMesh.H"
|
||||||
#include "demandDrivenData.H"
|
#include "demandDrivenData.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
defineTypeNameAndDebug(Foam::primitiveMesh, 0);
|
defineTypeNameAndDebug(Foam::primitiveMesh, 0);
|
||||||
@ -63,6 +61,8 @@ Foam::primitiveMesh::primitiveMesh()
|
|||||||
ppPtr_(NULL),
|
ppPtr_(NULL),
|
||||||
cpPtr_(NULL),
|
cpPtr_(NULL),
|
||||||
|
|
||||||
|
cellTreePtr_(NULL),
|
||||||
|
|
||||||
labels_(0),
|
labels_(0),
|
||||||
|
|
||||||
cellCentresPtr_(NULL),
|
cellCentresPtr_(NULL),
|
||||||
@ -105,6 +105,8 @@ Foam::primitiveMesh::primitiveMesh
|
|||||||
ppPtr_(NULL),
|
ppPtr_(NULL),
|
||||||
cpPtr_(NULL),
|
cpPtr_(NULL),
|
||||||
|
|
||||||
|
cellTreePtr_(NULL),
|
||||||
|
|
||||||
labels_(0),
|
labels_(0),
|
||||||
|
|
||||||
cellCentresPtr_(NULL),
|
cellCentresPtr_(NULL),
|
||||||
@ -347,4 +349,36 @@ const Foam::cellShapeList& Foam::primitiveMesh::cellShapes() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::indexedOctree<Foam::treeDataCell>&
|
||||||
|
Foam::primitiveMesh::cellTree() const
|
||||||
|
{
|
||||||
|
if (!cellTreePtr_)
|
||||||
|
{
|
||||||
|
treeBoundBox overallBb(points());
|
||||||
|
|
||||||
|
Random rndGen(261782);
|
||||||
|
|
||||||
|
overallBb = overallBb.extend(rndGen, 1E-4);
|
||||||
|
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||||
|
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||||
|
|
||||||
|
cellTreePtr_ =
|
||||||
|
new indexedOctree<treeDataCell>
|
||||||
|
(
|
||||||
|
treeDataCell
|
||||||
|
(
|
||||||
|
false, // not cache bb
|
||||||
|
*this
|
||||||
|
),
|
||||||
|
overallBb,
|
||||||
|
8, // maxLevel
|
||||||
|
10, // leafsize
|
||||||
|
3.0 // duplicity
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return *cellTreePtr_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -2,7 +2,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) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -67,6 +67,8 @@ SourceFiles
|
|||||||
#include "Map.H"
|
#include "Map.H"
|
||||||
#include "EdgeMap.H"
|
#include "EdgeMap.H"
|
||||||
#include "boundBox.H"
|
#include "boundBox.H"
|
||||||
|
#include "indexedOctree.H"
|
||||||
|
#include "treeDataCell.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -155,6 +157,9 @@ class primitiveMesh
|
|||||||
//- Cell-points
|
//- Cell-points
|
||||||
mutable labelListList* cpPtr_;
|
mutable labelListList* cpPtr_;
|
||||||
|
|
||||||
|
//- Search tree to allow spatial tet searching
|
||||||
|
mutable indexedOctree<treeDataCell>* cellTreePtr_;
|
||||||
|
|
||||||
|
|
||||||
// On-the-fly edge addresing storage
|
// On-the-fly edge addresing storage
|
||||||
|
|
||||||
@ -482,6 +487,10 @@ public:
|
|||||||
const labelListList& cellPoints() const;
|
const labelListList& cellPoints() const;
|
||||||
|
|
||||||
|
|
||||||
|
//- Build (if necessary) and return the cell search tree
|
||||||
|
const indexedOctree<treeDataCell>& cellTree() const;
|
||||||
|
|
||||||
|
|
||||||
// Geometric data (raw!)
|
// Geometric data (raw!)
|
||||||
|
|
||||||
const vectorField& cellCentres() const;
|
const vectorField& cellCentres() const;
|
||||||
@ -814,6 +823,9 @@ public:
|
|||||||
//- Clear topological data
|
//- Clear topological data
|
||||||
void clearAddressing();
|
void clearAddressing();
|
||||||
|
|
||||||
|
//- Clear cell tree data
|
||||||
|
void clearCellTree();
|
||||||
|
|
||||||
//- Clear all geometry and addressing unnecessary for CFD
|
//- Clear all geometry and addressing unnecessary for CFD
|
||||||
void clearOut();
|
void clearOut();
|
||||||
};
|
};
|
||||||
|
|||||||
@ -2,7 +2,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) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -99,6 +99,11 @@ void Foam::primitiveMesh::printAllocated() const
|
|||||||
Pout<< " Cell-point" << endl;
|
Pout<< " Cell-point" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cellTreePtr_)
|
||||||
|
{
|
||||||
|
Pout<< " Cell-tree" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
// Geometry
|
// Geometry
|
||||||
if (cellCentresPtr_)
|
if (cellCentresPtr_)
|
||||||
{
|
{
|
||||||
@ -165,6 +170,14 @@ void Foam::primitiveMesh::clearAddressing()
|
|||||||
deleteDemandDrivenData(pePtr_);
|
deleteDemandDrivenData(pePtr_);
|
||||||
deleteDemandDrivenData(ppPtr_);
|
deleteDemandDrivenData(ppPtr_);
|
||||||
deleteDemandDrivenData(cpPtr_);
|
deleteDemandDrivenData(cpPtr_);
|
||||||
|
|
||||||
|
deleteDemandDrivenData(cellTreePtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::primitiveMesh::clearCellTree()
|
||||||
|
{
|
||||||
|
deleteDemandDrivenData(cellTreePtr_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,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) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,11 +25,11 @@ License
|
|||||||
|
|
||||||
#include "primitiveMesh.H"
|
#include "primitiveMesh.H"
|
||||||
#include "cell.H"
|
#include "cell.H"
|
||||||
|
#include "tetIndices.H"
|
||||||
|
#include "polyMeshTetDecomposition.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Is the point in the cell bounding box
|
|
||||||
bool Foam::primitiveMesh::pointInCellBB
|
bool Foam::primitiveMesh::pointInCellBB
|
||||||
(
|
(
|
||||||
const point& p,
|
const point& p,
|
||||||
@ -60,7 +60,6 @@ bool Foam::primitiveMesh::pointInCellBB
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Is the point in the cell
|
|
||||||
bool Foam::primitiveMesh::pointInCell(const point& p, label celli) const
|
bool Foam::primitiveMesh::pointInCell(const point& p, label celli) const
|
||||||
{
|
{
|
||||||
const labelList& f = cells()[celli];
|
const labelList& f = cells()[celli];
|
||||||
@ -86,7 +85,6 @@ bool Foam::primitiveMesh::pointInCell(const point& p, label celli) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Find the cell with the nearest cell centre
|
|
||||||
Foam::label Foam::primitiveMesh::findNearestCell(const point& location) const
|
Foam::label Foam::primitiveMesh::findNearestCell(const point& location) const
|
||||||
{
|
{
|
||||||
const vectorField& centres = cellCentres();
|
const vectorField& centres = cellCentres();
|
||||||
@ -109,7 +107,6 @@ Foam::label Foam::primitiveMesh::findNearestCell(const point& location) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Find cell enclosing this location
|
|
||||||
Foam::label Foam::primitiveMesh::findCell(const point& location) const
|
Foam::label Foam::primitiveMesh::findCell(const point& location) const
|
||||||
{
|
{
|
||||||
if (nCells() == 0)
|
if (nCells() == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user