ENH: Merge searchableSurface and indexedOctree volumeType

This commit is contained in:
laurence
2013-04-11 19:52:03 +01:00
parent bfd30ea006
commit c2d3bab08e
33 changed files with 362 additions and 210 deletions

View File

@ -31,6 +31,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "triSurface.H" #include "triSurface.H"
#include "triSurfaceSearch.H"
#include "argList.H" #include "argList.H"
#include "OFstream.H" #include "OFstream.H"
#include "IFstream.H" #include "IFstream.H"
@ -40,6 +41,7 @@ Description
#include "indexedOctree.H" #include "indexedOctree.H"
#include "treeDataTriSurface.H" #include "treeDataTriSurface.H"
#include "Random.H" #include "Random.H"
#include "volumeType.H"
using namespace Foam; using namespace Foam;
@ -242,26 +244,16 @@ int main(int argc, char *argv[])
// Read surface to select on // Read surface to select on
triSurface selectSurf(surfName); triSurface selectSurf(surfName);
// bb of surface triSurfaceSearch searchSelectSurf
treeBoundBox bb(selectSurf.localPoints());
// Random number generator
Random rndGen(354543);
// search engine
indexedOctree<treeDataTriSurface> selectTree
( (
treeDataTriSurface selectSurf,
( indexedOctree<treeDataTriSurface>::perturbTol(),
selectSurf, 8
indexedOctree<treeDataTriSurface>::perturbTol()
),
bb.extend(rndGen, 1e-4), // slightly randomize bb
8, // maxLevel
10, // leafsize
3.0 // duplicity
); );
const indexedOctree<treeDataTriSurface>& selectTree =
searchSelectSurf.tree();
// Check if face (centre) is in outside or inside. // Check if face (centre) is in outside or inside.
forAll(facesToSubset, faceI) forAll(facesToSubset, faceI)
{ {
@ -269,14 +261,13 @@ int main(int argc, char *argv[])
{ {
const point fc(surf1[faceI].centre(surf1.points())); const point fc(surf1[faceI].centre(surf1.points()));
indexedOctree<treeDataTriSurface>::volumeType t = volumeType t = selectTree.getVolumeType(fc);
selectTree.getVolumeType(fc);
if if
( (
outside outside
? (t == indexedOctree<treeDataTriSurface>::OUTSIDE) ? (t == volumeType::OUTSIDE)
: (t == indexedOctree<treeDataTriSurface>::INSIDE) : (t == volumeType::INSIDE)
) )
{ {
facesToSubset[faceI] = true; facesToSubset[faceI] = true;

View File

@ -605,6 +605,7 @@ $(interpolationWeights)/splineInterpolationWeights/splineInterpolationWeights.C
algorithms/indexedOctree/indexedOctreeName.C algorithms/indexedOctree/indexedOctreeName.C
algorithms/indexedOctree/treeDataCell.C algorithms/indexedOctree/treeDataCell.C
algorithms/indexedOctree/volumeType.C
algorithms/dynamicIndexedOctree/dynamicIndexedOctreeName.C algorithms/dynamicIndexedOctree/dynamicIndexedOctreeName.C

View File

@ -334,15 +334,14 @@ void Foam::dynamicIndexedOctree<Type>::recursiveSubDivision
// Recurses to determine status of lowest level boxes. Level above is // Recurses to determine status of lowest level boxes. Level above is
// combination of octants below. // combination of octants below.
template<class Type> template<class Type>
typename Foam::dynamicIndexedOctree<Type>::volumeType Foam::volumeType Foam::dynamicIndexedOctree<Type>::calcVolumeType
Foam::dynamicIndexedOctree<Type>::calcVolumeType
( (
const label nodeI const label nodeI
) const ) const
{ {
const node& nod = nodes_[nodeI]; const node& nod = nodes_[nodeI];
volumeType myType = UNKNOWN; volumeType myType = volumeType::UNKNOWN;
for (direction octant = 0; octant < nod.subNodes_.size(); octant++) for (direction octant = 0; octant < nod.subNodes_.size(); octant++)
{ {
@ -359,7 +358,7 @@ Foam::dynamicIndexedOctree<Type>::calcVolumeType
{ {
// Contents. Depending on position in box might be on either // Contents. Depending on position in box might be on either
// side. // side.
subType = MIXED; subType = volumeType::MIXED;
} }
else else
{ {
@ -378,13 +377,13 @@ Foam::dynamicIndexedOctree<Type>::calcVolumeType
// Combine sub node types into type for treeNode. Result is 'mixed' if // Combine sub node types into type for treeNode. Result is 'mixed' if
// types differ among subnodes. // types differ among subnodes.
if (myType == UNKNOWN) if (myType == volumeType::UNKNOWN)
{ {
myType = subType; myType = subType;
} }
else if (subType != myType) else if (subType != myType)
{ {
myType = MIXED; myType = volumeType::MIXED;
} }
} }
return myType; return myType;
@ -392,8 +391,7 @@ Foam::dynamicIndexedOctree<Type>::calcVolumeType
template<class Type> template<class Type>
typename Foam::dynamicIndexedOctree<Type>::volumeType Foam::volumeType Foam::dynamicIndexedOctree<Type>::getVolumeType
Foam::dynamicIndexedOctree<Type>::getVolumeType
( (
const label nodeI, const label nodeI,
const point& sample const point& sample
@ -403,22 +401,22 @@ Foam::dynamicIndexedOctree<Type>::getVolumeType
direction octant = nod.bb_.subOctant(sample); direction octant = nod.bb_.subOctant(sample);
volumeType octantType = volumeType(nodeTypes_.get((nodeI<<3)+octant)); volumeType octantType = volumeType::type(nodeTypes_.get((nodeI<<3)+octant));
if (octantType == INSIDE) if (octantType == volumeType::INSIDE)
{ {
return octantType; return octantType;
} }
else if (octantType == OUTSIDE) else if (octantType == volumeType::OUTSIDE)
{ {
return octantType; return octantType;
} }
else if (octantType == UNKNOWN) else if (octantType == volumeType::UNKNOWN)
{ {
// Can happen for e.g. non-manifold surfaces. // Can happen for e.g. non-manifold surfaces.
return octantType; return octantType;
} }
else if (octantType == MIXED) else if (octantType == volumeType::MIXED)
{ {
labelBits index = nod.subNodes_[octant]; labelBits index = nod.subNodes_[octant];
@ -447,7 +445,7 @@ Foam::dynamicIndexedOctree<Type>::getVolumeType
<< "Empty subnode has invalid volume type MIXED." << "Empty subnode has invalid volume type MIXED."
<< abort(FatalError); << abort(FatalError);
return UNKNOWN; return volumeType::UNKNOWN;
} }
} }
else else
@ -462,14 +460,13 @@ Foam::dynamicIndexedOctree<Type>::getVolumeType
<< "Node has invalid volume type " << octantType << "Node has invalid volume type " << octantType
<< abort(FatalError); << abort(FatalError);
return UNKNOWN; return volumeType::UNKNOWN;
} }
} }
template<class Type> template<class Type>
typename Foam::dynamicIndexedOctree<Type>::volumeType Foam::volumeType Foam::dynamicIndexedOctree<Type>::getSide
Foam::dynamicIndexedOctree<Type>::getSide
( (
const vector& outsideNormal, const vector& outsideNormal,
const vector& vec const vector& vec
@ -477,11 +474,11 @@ Foam::dynamicIndexedOctree<Type>::getSide
{ {
if ((outsideNormal&vec) >= 0) if ((outsideNormal&vec) >= 0)
{ {
return OUTSIDE; return volumeType::OUTSIDE;
} }
else else
{ {
return INSIDE; return volumeType::INSIDE;
} }
} }
@ -2582,15 +2579,14 @@ const Foam::labelList& Foam::dynamicIndexedOctree<Type>::findIndices
// Determine type (inside/outside/mixed) per node. // Determine type (inside/outside/mixed) per node.
template<class Type> template<class Type>
typename Foam::dynamicIndexedOctree<Type>::volumeType Foam::volumeType Foam::dynamicIndexedOctree<Type>::getVolumeType
Foam::dynamicIndexedOctree<Type>::getVolumeType
( (
const point& sample const point& sample
) const ) const
{ {
if (nodes_.empty()) if (nodes_.empty())
{ {
return UNKNOWN; return volumeType::UNKNOWN;
} }
if (nodeTypes_.size() != 8*nodes_.size()) if (nodeTypes_.size() != 8*nodes_.size())
@ -2598,7 +2594,7 @@ Foam::dynamicIndexedOctree<Type>::getVolumeType
// Calculate type for every octant of node. // Calculate type for every octant of node.
nodeTypes_.setSize(8*nodes_.size()); nodeTypes_.setSize(8*nodes_.size());
nodeTypes_ = UNKNOWN; nodeTypes_ = volumeType::UNKNOWN;
calcVolumeType(0); calcVolumeType(0);
@ -2611,21 +2607,21 @@ Foam::dynamicIndexedOctree<Type>::getVolumeType
forAll(nodeTypes_, i) forAll(nodeTypes_, i)
{ {
volumeType type = volumeType(nodeTypes_.get(i)); volumeType type = volumeType::type(nodeTypes_.get(i));
if (type == UNKNOWN) if (type == volumeType::UNKNOWN)
{ {
nUNKNOWN++; nUNKNOWN++;
} }
else if (type == MIXED) else if (type == volumeType::MIXED)
{ {
nMIXED++; nMIXED++;
} }
else if (type == INSIDE) else if (type == volumeType::INSIDE)
{ {
nINSIDE++; nINSIDE++;
} }
else if (type == OUTSIDE) else if (type == volumeType::OUTSIDE)
{ {
nOUTSIDE++; nOUTSIDE++;
} }

View File

@ -43,6 +43,7 @@ SourceFiles
#include "HashSet.H" #include "HashSet.H"
#include "labelBits.H" #include "labelBits.H"
#include "PackedList.H" #include "PackedList.H"
#include "volumeType.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -83,16 +84,6 @@ public:
// Data types // Data types
//- volume types
enum volumeType
{
UNKNOWN = 0,
MIXED = 1,
INSIDE = 2,
OUTSIDE = 3
};
//- Tree node. Has up pointer and down pointers. //- Tree node. Has up pointer and down pointers.
class node class node
{ {

View File

@ -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) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -57,13 +57,13 @@ Foam::dynamicTreeDataPoint::shapePoints() const
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface. //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
// Only makes sense for closed surfaces. // Only makes sense for closed surfaces.
Foam::label Foam::dynamicTreeDataPoint::getVolumeType Foam::volumeType Foam::dynamicTreeDataPoint::getVolumeType
( (
const dynamicIndexedOctree<dynamicTreeDataPoint>& oc, const dynamicIndexedOctree<dynamicTreeDataPoint>& oc,
const point& sample const point& sample
) const ) const
{ {
return dynamicIndexedOctree<dynamicTreeDataPoint>::UNKNOWN; return volumeType::UNKNOWN;
} }

View File

@ -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) 2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -43,6 +43,7 @@ SourceFiles
#include "pointField.H" #include "pointField.H"
#include "treeBoundBox.H" #include "treeBoundBox.H"
#include "linePointRef.H" #include "linePointRef.H"
#include "volumeType.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -92,7 +93,7 @@ public:
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface. //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
// Only makes sense for closed surfaces. // Only makes sense for closed surfaces.
label getVolumeType volumeType getVolumeType
( (
const dynamicIndexedOctree<dynamicTreeDataPoint>&, const dynamicIndexedOctree<dynamicTreeDataPoint>&,
const point& const point&

View File

@ -356,15 +356,14 @@ Foam::label Foam::indexedOctree<Type>::compactContents
// Recurses to determine status of lowest level boxes. Level above is // Recurses to determine status of lowest level boxes. Level above is
// combination of octants below. // combination of octants below.
template<class Type> template<class Type>
typename Foam::indexedOctree<Type>::volumeType Foam::volumeType Foam::indexedOctree<Type>::calcVolumeType
Foam::indexedOctree<Type>::calcVolumeType
( (
const label nodeI const label nodeI
) const ) const
{ {
const node& nod = nodes_[nodeI]; const node& nod = nodes_[nodeI];
volumeType myType = UNKNOWN; volumeType myType = volumeType::UNKNOWN;
for (direction octant = 0; octant < nod.subNodes_.size(); octant++) for (direction octant = 0; octant < nod.subNodes_.size(); octant++)
{ {
@ -381,7 +380,7 @@ Foam::indexedOctree<Type>::calcVolumeType
{ {
// Contents. Depending on position in box might be on either // Contents. Depending on position in box might be on either
// side. // side.
subType = MIXED; subType = volumeType::MIXED;
} }
else else
{ {
@ -389,10 +388,7 @@ Foam::indexedOctree<Type>::calcVolumeType
// of its bounding box. // of its bounding box.
const treeBoundBox subBb = nod.bb_.subBbox(octant); const treeBoundBox subBb = nod.bb_.subBbox(octant);
subType = volumeType subType = shapes_.getVolumeType(*this, subBb.midpoint());
(
shapes_.getVolumeType(*this, subBb.midpoint())
);
} }
// Store octant type // Store octant type
@ -400,13 +396,13 @@ Foam::indexedOctree<Type>::calcVolumeType
// Combine sub node types into type for treeNode. Result is 'mixed' if // Combine sub node types into type for treeNode. Result is 'mixed' if
// types differ among subnodes. // types differ among subnodes.
if (myType == UNKNOWN) if (myType == volumeType::UNKNOWN)
{ {
myType = subType; myType = subType;
} }
else if (subType != myType) else if (subType != myType)
{ {
myType = MIXED; myType = volumeType::MIXED;
} }
} }
return myType; return myType;
@ -414,8 +410,7 @@ Foam::indexedOctree<Type>::calcVolumeType
template<class Type> template<class Type>
typename Foam::indexedOctree<Type>::volumeType Foam::volumeType Foam::indexedOctree<Type>::getVolumeType
Foam::indexedOctree<Type>::getVolumeType
( (
const label nodeI, const label nodeI,
const point& sample const point& sample
@ -425,22 +420,22 @@ Foam::indexedOctree<Type>::getVolumeType
direction octant = nod.bb_.subOctant(sample); direction octant = nod.bb_.subOctant(sample);
volumeType octantType = volumeType(nodeTypes_.get((nodeI<<3)+octant)); volumeType octantType = volumeType::type(nodeTypes_.get((nodeI<<3)+octant));
if (octantType == INSIDE) if (octantType == volumeType::INSIDE)
{ {
return octantType; return octantType;
} }
else if (octantType == OUTSIDE) else if (octantType == volumeType::OUTSIDE)
{ {
return octantType; return octantType;
} }
else if (octantType == UNKNOWN) else if (octantType == volumeType::UNKNOWN)
{ {
// Can happen for e.g. non-manifold surfaces. // Can happen for e.g. non-manifold surfaces.
return octantType; return octantType;
} }
else if (octantType == MIXED) else if (octantType == volumeType::MIXED)
{ {
labelBits index = nod.subNodes_[octant]; labelBits index = nod.subNodes_[octant];
@ -469,7 +464,7 @@ Foam::indexedOctree<Type>::getVolumeType
<< "Empty subnode has invalid volume type MIXED." << "Empty subnode has invalid volume type MIXED."
<< abort(FatalError); << abort(FatalError);
return UNKNOWN; return volumeType::UNKNOWN;
} }
} }
else else
@ -484,14 +479,13 @@ Foam::indexedOctree<Type>::getVolumeType
<< "Node has invalid volume type " << octantType << "Node has invalid volume type " << octantType
<< abort(FatalError); << abort(FatalError);
return UNKNOWN; return volumeType::UNKNOWN;
} }
} }
template<class Type> template<class Type>
typename Foam::indexedOctree<Type>::volumeType Foam::volumeType Foam::indexedOctree<Type>::getSide
Foam::indexedOctree<Type>::getSide
( (
const vector& outsideNormal, const vector& outsideNormal,
const vector& vec const vector& vec
@ -499,11 +493,11 @@ Foam::indexedOctree<Type>::getSide
{ {
if ((outsideNormal&vec) >= 0) if ((outsideNormal&vec) >= 0)
{ {
return OUTSIDE; return volumeType::OUTSIDE;
} }
else else
{ {
return INSIDE; return volumeType::INSIDE;
} }
} }
@ -2972,23 +2966,29 @@ const Foam::labelList& Foam::indexedOctree<Type>::findIndices
// Determine type (inside/outside/mixed) per node. // Determine type (inside/outside/mixed) per node.
template<class Type> template<class Type>
typename Foam::indexedOctree<Type>::volumeType Foam::volumeType Foam::indexedOctree<Type>::getVolumeType
Foam::indexedOctree<Type>::getVolumeType
( (
const point& sample const point& sample
) const ) const
{ {
if (nodes_.empty()) if (nodes_.empty())
{ {
return UNKNOWN; return volumeType::UNKNOWN;
} }
// // If the sample is not within the octree, then have to query shapes
// // directly
// if (!nodes_[0].bb_.contains(sample))
// {
// return volumeType(shapes_.getVolumeType(*this, sample));
// }
if (nodeTypes_.size() != 8*nodes_.size()) if (nodeTypes_.size() != 8*nodes_.size())
{ {
// Calculate type for every octant of node. // Calculate type for every octant of node.
nodeTypes_.setSize(8*nodes_.size()); nodeTypes_.setSize(8*nodes_.size());
nodeTypes_ = UNKNOWN; nodeTypes_ = volumeType::UNKNOWN;
calcVolumeType(0); calcVolumeType(0);
@ -3001,21 +3001,21 @@ Foam::indexedOctree<Type>::getVolumeType
forAll(nodeTypes_, i) forAll(nodeTypes_, i)
{ {
volumeType type = volumeType(nodeTypes_.get(i)); volumeType type = volumeType::type(nodeTypes_.get(i));
if (type == UNKNOWN) if (type == volumeType::UNKNOWN)
{ {
nUNKNOWN++; nUNKNOWN++;
} }
else if (type == MIXED) else if (type == volumeType::MIXED)
{ {
nMIXED++; nMIXED++;
} }
else if (type == INSIDE) else if (type == volumeType::INSIDE)
{ {
nINSIDE++; nINSIDE++;
} }
else if (type == OUTSIDE) else if (type == volumeType::OUTSIDE)
{ {
nOUTSIDE++; nOUTSIDE++;
} }

View File

@ -42,6 +42,7 @@ SourceFiles
#include "HashSet.H" #include "HashSet.H"
#include "labelBits.H" #include "labelBits.H"
#include "PackedList.H" #include "PackedList.H"
#include "volumeType.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -74,16 +75,6 @@ public:
// Data types // Data types
//- volume types
enum volumeType
{
UNKNOWN = 0,
MIXED = 1,
INSIDE = 2,
OUTSIDE = 3
};
//- Tree node. Has up pointer and down pointers. //- Tree node. Has up pointer and down pointers.
class node class node
{ {

View File

@ -38,6 +38,7 @@ SourceFiles
#include "polyMesh.H" #include "polyMesh.H"
#include "treeBoundBoxList.H" #include "treeBoundBoxList.H"
#include "volumeType.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -196,7 +197,7 @@ public:
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface. //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
// Only makes sense for closed surfaces. // Only makes sense for closed surfaces.
label getVolumeType volumeType getVolumeType
( (
const indexedOctree<treeDataCell>&, const indexedOctree<treeDataCell>&,
const point& const point&
@ -207,7 +208,7 @@ public:
"treeDataCell::getVolumeType" "treeDataCell::getVolumeType"
"(const indexedOctree<treeDataCell>&, const point&)" "(const indexedOctree<treeDataCell>&, const point&)"
); );
return -1; return volumeType::UNKNOWN;
} }
//- Does (bb of) shape at index overlap bb //- Does (bb of) shape at index overlap bb

View File

@ -0,0 +1,79 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 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 "volumeType.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
template<>
const char* Foam::NamedEnum
<
Foam::volumeType,
4
>::names[] =
{
"unknown",
"mixed",
"inside",
"outside"
};
}
const Foam::NamedEnum<Foam::volumeType, 4> Foam::volumeType::names;
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Istream& Foam::operator>>(Istream& is, volumeType& vt)
{
// Read beginning of volumeType
is.readBegin("volumeType");
int type;
is >> type;
vt.t_ = static_cast<volumeType::type>(type);
// Read end of volumeType
is.readEnd("volumeType");
// Check state of Istream
is.check("operator>>(Istream&, volumeType&)");
return is;
}
Foam::Ostream& Foam::operator<<(Ostream& os, const volumeType& vt)
{
os << static_cast<int>(vt.t_);
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,127 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 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::volumeType
Description
SourceFiles
volumeType.C
\*---------------------------------------------------------------------------*/
#ifndef volumeType_H
#define volumeType_H
#include "NamedEnum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of friend functions and operators
class volumeType;
Istream& operator>>(Istream& is, volumeType&);
Ostream& operator<<(Ostream& os, const volumeType& C);
/*---------------------------------------------------------------------------*\
Class volumeType Declaration
\*---------------------------------------------------------------------------*/
class volumeType
{
public:
//- Volume types
enum type
{
UNKNOWN = 0,
MIXED = 1,
INSIDE = 2,
OUTSIDE = 3
};
private:
// Private data
//- Volume type
type t_;
public:
// Static data
static const NamedEnum<volumeType, 4> names;
// Constructors
//- Construct null
volumeType()
:
t_(UNKNOWN)
{}
//- Construct from components
volumeType(type t)
:
t_(t)
{}
// Member Functions
operator type() const
{
return t_;
}
// IOstream operators
friend Istream& operator>>(Istream& is, volumeType& vt);
friend Ostream& operator<<(Ostream& os, const volumeType& vt);
};
//- Data associated with volumeType type are contiguous
template<>
inline bool contiguous<volumeType>() {return true;}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -31,6 +31,7 @@ License
#include "labelPair.H" #include "labelPair.H"
#include "searchableSurfacesQueries.H" #include "searchableSurfacesQueries.H"
#include "UPtrList.H" #include "UPtrList.H"
#include "volumeType.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -1302,7 +1303,7 @@ void Foam::refinementSurfaces::findInside
if (allGeometry_[surfaces_[surfI]].hasVolumeType()) if (allGeometry_[surfaces_[surfI]].hasVolumeType())
{ {
List<searchableSurface::volumeType> volType; List<volumeType> volType;
allGeometry_[surfaces_[surfI]].getVolumeType(pt, volType); allGeometry_[surfaces_[surfI]].getVolumeType(pt, volType);
forAll(volType, pointI) forAll(volType, pointI)
@ -1312,11 +1313,11 @@ void Foam::refinementSurfaces::findInside
if if
( (
( (
volType[pointI] == triSurfaceMesh::INSIDE volType[pointI] == volumeType::INSIDE
&& zoneInside_[surfI] == INSIDE && zoneInside_[surfI] == INSIDE
) )
|| ( || (
volType[pointI] == triSurfaceMesh::OUTSIDE volType[pointI] == volumeType::OUTSIDE
&& zoneInside_[surfI] == OUTSIDE && zoneInside_[surfI] == OUTSIDE
) )
) )

View File

@ -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) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -31,6 +31,7 @@ License
#include "searchableSurfaces.H" #include "searchableSurfaces.H"
#include "orientedSurface.H" #include "orientedSurface.H"
#include "pointIndexHit.H" #include "pointIndexHit.H"
#include "volumeType.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -329,7 +330,7 @@ void Foam::shellSurfaces::findHigherLevel
candidateMap.setSize(candidateI); candidateMap.setSize(candidateI);
// Do the expensive nearest test only for the candidate points. // Do the expensive nearest test only for the candidate points.
List<searchableSurface::volumeType> volType; List<volumeType> volType;
allGeometry_[shells_[shellI]].getVolumeType(candidates, volType); allGeometry_[shells_[shellI]].getVolumeType(candidates, volType);
forAll(volType, i) forAll(volType, i)
@ -340,11 +341,11 @@ void Foam::shellSurfaces::findHigherLevel
( (
( (
modes_[shellI] == INSIDE modes_[shellI] == INSIDE
&& volType[i] == searchableSurface::INSIDE && volType[i] == volumeType::INSIDE
) )
|| ( || (
modes_[shellI] == OUTSIDE modes_[shellI] == OUTSIDE
&& volType[i] == searchableSurface::OUTSIDE && volType[i] == volumeType::OUTSIDE
) )
) )
{ {

View File

@ -132,13 +132,13 @@ Foam::pointField Foam::treeDataEdge::shapePoints() const
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface. //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
// Only makes sense for closed surfaces. // Only makes sense for closed surfaces.
Foam::label Foam::treeDataEdge::getVolumeType Foam::volumeType Foam::treeDataEdge::getVolumeType
( (
const indexedOctree<treeDataEdge>& oc, const indexedOctree<treeDataEdge>& oc,
const point& sample const point& sample
) const ) const
{ {
return indexedOctree<treeDataEdge>::UNKNOWN; return volumeType::UNKNOWN;
} }

View File

@ -37,6 +37,7 @@ SourceFiles
#include "treeBoundBoxList.H" #include "treeBoundBoxList.H"
#include "linePointRef.H" #include "linePointRef.H"
#include "volumeType.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -197,7 +198,7 @@ public:
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface. //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
// Only makes sense for closed surfaces. // Only makes sense for closed surfaces.
label getVolumeType volumeType getVolumeType
( (
const indexedOctree<treeDataEdge>&, const indexedOctree<treeDataEdge>&,
const point& const point&

View File

@ -180,7 +180,7 @@ Foam::pointField Foam::treeDataFace::shapePoints() const
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface. //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
// Only makes sense for closed surfaces. // Only makes sense for closed surfaces.
Foam::label Foam::treeDataFace::getVolumeType Foam::volumeType Foam::treeDataFace::getVolumeType
( (
const indexedOctree<treeDataFace>& oc, const indexedOctree<treeDataFace>& oc,
const point& sample const point& sample
@ -433,7 +433,7 @@ Foam::label Foam::treeDataFace::getVolumeType
// - tolerances are wrong. (if e.g. face has zero area) // - tolerances are wrong. (if e.g. face has zero area)
// - or (more likely) surface is not closed. // - or (more likely) surface is not closed.
return indexedOctree<treeDataFace>::UNKNOWN; return volumeType::UNKNOWN;
} }

View File

@ -40,6 +40,7 @@ SourceFiles
#include "treeBoundBoxList.H" #include "treeBoundBoxList.H"
#include "PackedBoolList.H" #include "PackedBoolList.H"
#include "primitiveMesh.H" #include "primitiveMesh.H"
#include "volumeType.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -200,7 +201,7 @@ public:
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface. //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
// Only makes sense for closed surfaces. // Only makes sense for closed surfaces.
label getVolumeType volumeType getVolumeType
( (
const indexedOctree<treeDataFace>&, const indexedOctree<treeDataFace>&,
const point& const point&

View File

@ -92,13 +92,13 @@ Foam::pointField Foam::treeDataPoint::shapePoints() const
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface. //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
// Only makes sense for closed surfaces. // Only makes sense for closed surfaces.
Foam::label Foam::treeDataPoint::getVolumeType Foam::volumeType Foam::treeDataPoint::getVolumeType
( (
const indexedOctree<treeDataPoint>& oc, const indexedOctree<treeDataPoint>& oc,
const point& sample const point& sample
) const ) const
{ {
return indexedOctree<treeDataPoint>::UNKNOWN; return volumeType::UNKNOWN;
} }

View File

@ -43,6 +43,7 @@ SourceFiles
#include "pointField.H" #include "pointField.H"
#include "treeBoundBox.H" #include "treeBoundBox.H"
#include "linePointRef.H" #include "linePointRef.H"
#include "volumeType.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -172,7 +173,7 @@ public:
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface. //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
// Only makes sense for closed surfaces. // Only makes sense for closed surfaces.
label getVolumeType volumeType getVolumeType
( (
const indexedOctree<treeDataPoint>&, const indexedOctree<treeDataPoint>&,
const point& const point&

View File

@ -205,7 +205,7 @@ Foam::pointField Foam::treeDataPrimitivePatch<PatchType>::shapePoints() const
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface. //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
// Only makes sense for closed surfaces. // Only makes sense for closed surfaces.
template<class PatchType> template<class PatchType>
Foam::label Foam::treeDataPrimitivePatch<PatchType>::getVolumeType Foam::volumeType Foam::treeDataPrimitivePatch<PatchType>::getVolumeType
( (
const indexedOctree<treeDataPrimitivePatch<PatchType> >& oc, const indexedOctree<treeDataPrimitivePatch<PatchType> >& oc,
const point& sample const point& sample
@ -435,7 +435,7 @@ Foam::label Foam::treeDataPrimitivePatch<PatchType>::getVolumeType
// - tolerances are wrong. (if e.g. face has zero area) // - tolerances are wrong. (if e.g. face has zero area)
// - or (more likely) surface is not closed. // - or (more likely) surface is not closed.
return indexedOctree<treeDataPrimitivePatch>::UNKNOWN; return volumeType::UNKNOWN;
} }

View File

@ -36,6 +36,7 @@ SourceFiles
#define treeDataPrimitivePatch_H #define treeDataPrimitivePatch_H
#include "treeBoundBoxList.H" #include "treeBoundBoxList.H"
#include "volumeType.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -213,7 +214,7 @@ public:
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface. //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
// Only makes sense for closed surfaces. // Only makes sense for closed surfaces.
label getVolumeType volumeType getVolumeType
( (
const indexedOctree<treeDataPrimitivePatch<PatchType> >&, const indexedOctree<treeDataPrimitivePatch<PatchType> >&,
const point& const point&

View File

@ -29,7 +29,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<> template<>
Foam::label Foam::treeDataPrimitivePatch<Foam::triSurface>::getVolumeType Foam::volumeType Foam::treeDataPrimitivePatch<Foam::triSurface>::getVolumeType
( (
const indexedOctree<treeDataPrimitivePatch<triSurface> >& oc, const indexedOctree<treeDataPrimitivePatch<triSurface> >& oc,
const point& sample const point& sample
@ -60,21 +60,21 @@ Foam::label Foam::treeDataPrimitivePatch<Foam::triSurface>::getVolumeType
if (t == triSurfaceTools::UNKNOWN) if (t == triSurfaceTools::UNKNOWN)
{ {
return indexedOctree<treeDataPrimitivePatch<triSurface> >::UNKNOWN; return volumeType::UNKNOWN;
} }
else if (t == triSurfaceTools::INSIDE) else if (t == triSurfaceTools::INSIDE)
{ {
return indexedOctree<treeDataPrimitivePatch<triSurface> >::INSIDE; return volumeType::INSIDE;
} }
else if (t == triSurfaceTools::OUTSIDE) else if (t == triSurfaceTools::OUTSIDE)
{ {
return indexedOctree<treeDataPrimitivePatch<triSurface> >::OUTSIDE; return volumeType::OUTSIDE;
} }
else else
{ {
FatalErrorIn("treeDataPrimitivePatch<PatchType>::getVolumeType(..)") FatalErrorIn("treeDataPrimitivePatch<PatchType>::getVolumeType(..)")
<< "problem" << abort(FatalError); << "problem" << abort(FatalError);
return indexedOctree<treeDataPrimitivePatch<triSurface> >::UNKNOWN; return volumeType::UNKNOWN;
} }
} }

View File

@ -39,6 +39,7 @@ SourceFiles
#include "triSurface.H" #include "triSurface.H"
#include "point.H" #include "point.H"
#include "indexedOctree.H" #include "indexedOctree.H"
#include "volumeType.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -48,7 +49,7 @@ namespace Foam
//- Template specialisation of getVolumeType for treeDataTriSurface //- Template specialisation of getVolumeType for treeDataTriSurface
template<> template<>
label treeDataPrimitivePatch<triSurface>::getVolumeType volumeType treeDataPrimitivePatch<triSurface>::getVolumeType
( (
const indexedOctree<treeDataPrimitivePatch<triSurface> >& oc, const indexedOctree<treeDataPrimitivePatch<triSurface> >& oc,
const point& sample const point& sample

View File

@ -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) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -947,9 +947,7 @@ Foam::List<Foam::pointIndexHit> Foam::meshSearch::intersections
bool Foam::meshSearch::isInside(const point& p) const bool Foam::meshSearch::isInside(const point& p) const
{ {
return return (boundaryTree().getVolumeType(p) == volumeType::INSIDE);
boundaryTree().getVolumeType(p)
== indexedOctree<treeDataFace>::INSIDE;
} }

View File

@ -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) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -583,7 +583,7 @@ void Foam::searchableBox::getVolumeType
) const ) const
{ {
volType.setSize(points.size()); volType.setSize(points.size());
volType = INSIDE; volType = volumeType::INSIDE;
forAll(points, pointI) forAll(points, pointI)
{ {
@ -593,7 +593,7 @@ void Foam::searchableBox::getVolumeType
{ {
if (pt[dir] < min()[dir] || pt[dir] > max()[dir]) if (pt[dir] < min()[dir] || pt[dir] > max()[dir])
{ {
volType[pointI] = OUTSIDE; volType[pointI] = volumeType::OUTSIDE;
break; break;
} }
} }

View File

@ -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) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -673,7 +673,7 @@ void Foam::searchableCylinder::getVolumeType
) const ) const
{ {
volType.setSize(points.size()); volType.setSize(points.size());
volType = INSIDE; volType = volumeType::INSIDE;
forAll(points, pointI) forAll(points, pointI)
{ {
@ -687,12 +687,12 @@ void Foam::searchableCylinder::getVolumeType
if (parallel < 0) if (parallel < 0)
{ {
// left of point1 endcap // left of point1 endcap
volType[pointI] = OUTSIDE; volType[pointI] = volumeType::OUTSIDE;
} }
else if (parallel > magDir_) else if (parallel > magDir_)
{ {
// right of point2 endcap // right of point2 endcap
volType[pointI] = OUTSIDE; volType[pointI] = volumeType::OUTSIDE;
} }
else else
{ {
@ -701,11 +701,11 @@ void Foam::searchableCylinder::getVolumeType
if (mag(v) > radius_) if (mag(v) > radius_)
{ {
volType[pointI] = OUTSIDE; volType[pointI] = volumeType::OUTSIDE;
} }
else else
{ {
volType[pointI] = INSIDE; volType[pointI] = volumeType::INSIDE;
} }
} }
} }

View File

@ -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) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -334,7 +334,7 @@ void Foam::searchableSphere::getVolumeType
) const ) const
{ {
volType.setSize(points.size()); volType.setSize(points.size());
volType = INSIDE; volType = volumeType::INSIDE;
forAll(points, pointI) forAll(points, pointI)
{ {
@ -342,11 +342,11 @@ void Foam::searchableSphere::getVolumeType
if (magSqr(pt - centre_) <= sqr(radius_)) if (magSqr(pt - centre_) <= sqr(radius_))
{ {
volType[pointI] = INSIDE; volType[pointI] = volumeType::INSIDE;
} }
else else
{ {
volType[pointI] = OUTSIDE; volType[pointI] = volumeType::OUTSIDE;
} }
} }
} }

View File

@ -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) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -30,26 +30,12 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(searchableSurface, 0);
defineRunTimeSelectionTable(searchableSurface, dict);
template<> defineTypeNameAndDebug(searchableSurface, 0);
const char* Foam::NamedEnum defineRunTimeSelectionTable(searchableSurface, dict);
<
Foam::searchableSurface::volumeType,
4
>::names[] =
{
"unknown",
"mixed",
"inside",
"outside"
};
} }
const Foam::NamedEnum<Foam::searchableSurface::volumeType, 4>
Foam::searchableSurface::volumeTypeNames;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -48,6 +48,7 @@ SourceFiles
#include "pointIndexHit.H" #include "pointIndexHit.H"
#include "linePointRef.H" #include "linePointRef.H"
#include "objectRegistry.H" #include "objectRegistry.H"
#include "volumeType.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -67,25 +68,6 @@ class searchableSurface
: :
public regIOobject public regIOobject
{ {
public:
// Data types
//- Volume types
enum volumeType
{
UNKNOWN = 0,
MIXED = 1, // not used. only here to maintain consistency with
// indexedOctree volumeType.
INSIDE = 2,
OUTSIDE = 3
};
static const NamedEnum<volumeType, 4> volumeTypeNames;
private:
// Private data // Private data
const word name_; const word name_;

View File

@ -735,7 +735,7 @@ void Foam::searchableSurfacesQueries::signedDistance
const labelList& surfacesToTest, const labelList& surfacesToTest,
const pointField& samples, const pointField& samples,
const scalarField& nearestDistSqr, const scalarField& nearestDistSqr,
const searchableSurface::volumeType illegalHandling, const volumeType illegalHandling,
labelList& nearestSurfaces, labelList& nearestSurfaces,
scalarField& distance scalarField& distance
) )
@ -775,7 +775,7 @@ void Foam::searchableSurfacesQueries::signedDistance
} }
// Calculate sideness of these surface points // Calculate sideness of these surface points
List<searchableSurface::volumeType> volType; List<volumeType> volType;
allSurfaces[surfacesToTest[testI]].getVolumeType(surfPoints, volType); allSurfaces[surfacesToTest[testI]].getVolumeType(surfPoints, volType);
// Push back to original // Push back to original
@ -784,13 +784,13 @@ void Foam::searchableSurfacesQueries::signedDistance
label pointI = surfIndices[i]; label pointI = surfIndices[i];
scalar dist = mag(samples[pointI] - nearestInfo[pointI].hitPoint()); scalar dist = mag(samples[pointI] - nearestInfo[pointI].hitPoint());
searchableSurface::volumeType vT = volType[i]; volumeType vT = volType[i];
if (vT == searchableSurface::OUTSIDE) if (vT == volumeType::OUTSIDE)
{ {
distance[pointI] = dist; distance[pointI] = dist;
} }
else if (vT == searchableSurface::INSIDE) else if (vT == volumeType::INSIDE)
{ {
distance[i] = -dist; distance[i] = -dist;
} }
@ -798,12 +798,12 @@ void Foam::searchableSurfacesQueries::signedDistance
{ {
switch (illegalHandling) switch (illegalHandling)
{ {
case searchableSurface::OUTSIDE: case volumeType::OUTSIDE:
{ {
distance[pointI] = dist; distance[pointI] = dist;
break; break;
} }
case searchableSurface::INSIDE: case volumeType::INSIDE:
{ {
distance[pointI] = -dist; distance[pointI] = -dist;
break; break;
@ -817,7 +817,7 @@ void Foam::searchableSurfacesQueries::signedDistance
<< " surface:" << " surface:"
<< allSurfaces[surfacesToTest[testI]].name() << allSurfaces[surfacesToTest[testI]].name()
<< " volType:" << " volType:"
<< searchableSurface::volumeTypeNames[vT] << volumeType::names[vT]
<< exit(FatalError); << exit(FatalError);
break; break;
} }

View File

@ -206,7 +206,7 @@ public:
const labelList& surfacesToTest, const labelList& surfacesToTest,
const pointField& samples, const pointField& samples,
const scalarField& nearestDistSqr, const scalarField& nearestDistSqr,
const searchableSurface::volumeType illegalHandling, const volumeType illegalHandling,
labelList& nearestSurfaces, labelList& nearestSurfaces,
scalarField& distance scalarField& distance
); );

View File

@ -740,7 +740,7 @@ void Foam::triSurfaceMesh::getVolumeType
// - use cached volume type per each tree node // - use cached volume type per each tree node
// - cheat conversion since same values // - cheat conversion since same values
volType[pointI] = static_cast<volumeType>(tree().getVolumeType(pt)); volType[pointI] = tree().getVolumeType(pt);
} }
indexedOctree<treeDataTriSurface>::perturbTol() = oldTol; indexedOctree<treeDataTriSurface>::perturbTol() = oldTol;

View File

@ -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) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -29,6 +29,7 @@ License
#include "volPointInterpolation.H" #include "volPointInterpolation.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "volumeType.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -94,19 +95,19 @@ void Foam::distanceSurface::createGeometry()
if (signed_) if (signed_)
{ {
List<searchableSurface::volumeType> volType; List<volumeType> volType;
surfPtr_().getVolumeType(cc, volType); surfPtr_().getVolumeType(cc, volType);
forAll(volType, i) forAll(volType, i)
{ {
searchableSurface::volumeType vT = volType[i]; volumeType vT = volType[i];
if (vT == searchableSurface::OUTSIDE) if (vT == volumeType::OUTSIDE)
{ {
fld[i] = Foam::mag(cc[i] - nearest[i].hitPoint()); fld[i] = Foam::mag(cc[i] - nearest[i].hitPoint());
} }
else if (vT == searchableSurface::INSIDE) else if (vT == volumeType::INSIDE)
{ {
fld[i] = -Foam::mag(cc[i] - nearest[i].hitPoint()); fld[i] = -Foam::mag(cc[i] - nearest[i].hitPoint());
} }
@ -146,19 +147,19 @@ void Foam::distanceSurface::createGeometry()
if (signed_) if (signed_)
{ {
List<searchableSurface::volumeType> volType; List<volumeType> volType;
surfPtr_().getVolumeType(cc, volType); surfPtr_().getVolumeType(cc, volType);
forAll(volType, i) forAll(volType, i)
{ {
searchableSurface::volumeType vT = volType[i]; volumeType vT = volType[i];
if (vT == searchableSurface::OUTSIDE) if (vT == volumeType::OUTSIDE)
{ {
fld[i] = Foam::mag(cc[i] - nearest[i].hitPoint()); fld[i] = Foam::mag(cc[i] - nearest[i].hitPoint());
} }
else if (vT == searchableSurface::INSIDE) else if (vT == volumeType::INSIDE)
{ {
fld[i] = -Foam::mag(cc[i] - nearest[i].hitPoint()); fld[i] = -Foam::mag(cc[i] - nearest[i].hitPoint());
} }
@ -203,20 +204,20 @@ void Foam::distanceSurface::createGeometry()
if (signed_) if (signed_)
{ {
List<searchableSurface::volumeType> volType; List<volumeType> volType;
surfPtr_().getVolumeType(pts, volType); surfPtr_().getVolumeType(pts, volType);
forAll(volType, i) forAll(volType, i)
{ {
searchableSurface::volumeType vT = volType[i]; volumeType vT = volType[i];
if (vT == searchableSurface::OUTSIDE) if (vT == volumeType::OUTSIDE)
{ {
pointDistance_[i] = pointDistance_[i] =
Foam::mag(pts[i] - nearest[i].hitPoint()); Foam::mag(pts[i] - nearest[i].hitPoint());
} }
else if (vT == searchableSurface::INSIDE) else if (vT == volumeType::INSIDE)
{ {
pointDistance_[i] = pointDistance_[i] =
-Foam::mag(pts[i] - nearest[i].hitPoint()); -Foam::mag(pts[i] - nearest[i].hitPoint());