mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Merge searchableSurface and indexedOctree volumeType
This commit is contained in:
@ -334,15 +334,14 @@ void Foam::dynamicIndexedOctree<Type>::recursiveSubDivision
|
||||
// Recurses to determine status of lowest level boxes. Level above is
|
||||
// combination of octants below.
|
||||
template<class Type>
|
||||
typename Foam::dynamicIndexedOctree<Type>::volumeType
|
||||
Foam::dynamicIndexedOctree<Type>::calcVolumeType
|
||||
Foam::volumeType Foam::dynamicIndexedOctree<Type>::calcVolumeType
|
||||
(
|
||||
const label nodeI
|
||||
) const
|
||||
{
|
||||
const node& nod = nodes_[nodeI];
|
||||
|
||||
volumeType myType = UNKNOWN;
|
||||
volumeType myType = volumeType::UNKNOWN;
|
||||
|
||||
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
|
||||
// side.
|
||||
subType = MIXED;
|
||||
subType = volumeType::MIXED;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -378,13 +377,13 @@ Foam::dynamicIndexedOctree<Type>::calcVolumeType
|
||||
|
||||
// Combine sub node types into type for treeNode. Result is 'mixed' if
|
||||
// types differ among subnodes.
|
||||
if (myType == UNKNOWN)
|
||||
if (myType == volumeType::UNKNOWN)
|
||||
{
|
||||
myType = subType;
|
||||
}
|
||||
else if (subType != myType)
|
||||
{
|
||||
myType = MIXED;
|
||||
myType = volumeType::MIXED;
|
||||
}
|
||||
}
|
||||
return myType;
|
||||
@ -392,8 +391,7 @@ Foam::dynamicIndexedOctree<Type>::calcVolumeType
|
||||
|
||||
|
||||
template<class Type>
|
||||
typename Foam::dynamicIndexedOctree<Type>::volumeType
|
||||
Foam::dynamicIndexedOctree<Type>::getVolumeType
|
||||
Foam::volumeType Foam::dynamicIndexedOctree<Type>::getVolumeType
|
||||
(
|
||||
const label nodeI,
|
||||
const point& sample
|
||||
@ -403,22 +401,22 @@ Foam::dynamicIndexedOctree<Type>::getVolumeType
|
||||
|
||||
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;
|
||||
}
|
||||
else if (octantType == OUTSIDE)
|
||||
else if (octantType == volumeType::OUTSIDE)
|
||||
{
|
||||
return octantType;
|
||||
}
|
||||
else if (octantType == UNKNOWN)
|
||||
else if (octantType == volumeType::UNKNOWN)
|
||||
{
|
||||
// Can happen for e.g. non-manifold surfaces.
|
||||
return octantType;
|
||||
}
|
||||
else if (octantType == MIXED)
|
||||
else if (octantType == volumeType::MIXED)
|
||||
{
|
||||
labelBits index = nod.subNodes_[octant];
|
||||
|
||||
@ -447,7 +445,7 @@ Foam::dynamicIndexedOctree<Type>::getVolumeType
|
||||
<< "Empty subnode has invalid volume type MIXED."
|
||||
<< abort(FatalError);
|
||||
|
||||
return UNKNOWN;
|
||||
return volumeType::UNKNOWN;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -462,14 +460,13 @@ Foam::dynamicIndexedOctree<Type>::getVolumeType
|
||||
<< "Node has invalid volume type " << octantType
|
||||
<< abort(FatalError);
|
||||
|
||||
return UNKNOWN;
|
||||
return volumeType::UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
typename Foam::dynamicIndexedOctree<Type>::volumeType
|
||||
Foam::dynamicIndexedOctree<Type>::getSide
|
||||
Foam::volumeType Foam::dynamicIndexedOctree<Type>::getSide
|
||||
(
|
||||
const vector& outsideNormal,
|
||||
const vector& vec
|
||||
@ -477,11 +474,11 @@ Foam::dynamicIndexedOctree<Type>::getSide
|
||||
{
|
||||
if ((outsideNormal&vec) >= 0)
|
||||
{
|
||||
return OUTSIDE;
|
||||
return volumeType::OUTSIDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return INSIDE;
|
||||
return volumeType::INSIDE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2582,15 +2579,14 @@ const Foam::labelList& Foam::dynamicIndexedOctree<Type>::findIndices
|
||||
|
||||
// Determine type (inside/outside/mixed) per node.
|
||||
template<class Type>
|
||||
typename Foam::dynamicIndexedOctree<Type>::volumeType
|
||||
Foam::dynamicIndexedOctree<Type>::getVolumeType
|
||||
Foam::volumeType Foam::dynamicIndexedOctree<Type>::getVolumeType
|
||||
(
|
||||
const point& sample
|
||||
) const
|
||||
{
|
||||
if (nodes_.empty())
|
||||
{
|
||||
return UNKNOWN;
|
||||
return volumeType::UNKNOWN;
|
||||
}
|
||||
|
||||
if (nodeTypes_.size() != 8*nodes_.size())
|
||||
@ -2598,7 +2594,7 @@ Foam::dynamicIndexedOctree<Type>::getVolumeType
|
||||
// Calculate type for every octant of node.
|
||||
|
||||
nodeTypes_.setSize(8*nodes_.size());
|
||||
nodeTypes_ = UNKNOWN;
|
||||
nodeTypes_ = volumeType::UNKNOWN;
|
||||
|
||||
calcVolumeType(0);
|
||||
|
||||
@ -2611,21 +2607,21 @@ Foam::dynamicIndexedOctree<Type>::getVolumeType
|
||||
|
||||
forAll(nodeTypes_, i)
|
||||
{
|
||||
volumeType type = volumeType(nodeTypes_.get(i));
|
||||
volumeType type = volumeType::type(nodeTypes_.get(i));
|
||||
|
||||
if (type == UNKNOWN)
|
||||
if (type == volumeType::UNKNOWN)
|
||||
{
|
||||
nUNKNOWN++;
|
||||
}
|
||||
else if (type == MIXED)
|
||||
else if (type == volumeType::MIXED)
|
||||
{
|
||||
nMIXED++;
|
||||
}
|
||||
else if (type == INSIDE)
|
||||
else if (type == volumeType::INSIDE)
|
||||
{
|
||||
nINSIDE++;
|
||||
}
|
||||
else if (type == OUTSIDE)
|
||||
else if (type == volumeType::OUTSIDE)
|
||||
{
|
||||
nOUTSIDE++;
|
||||
}
|
||||
|
||||
@ -43,6 +43,7 @@ SourceFiles
|
||||
#include "HashSet.H"
|
||||
#include "labelBits.H"
|
||||
#include "PackedList.H"
|
||||
#include "volumeType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -83,16 +84,6 @@ public:
|
||||
|
||||
// Data types
|
||||
|
||||
//- volume types
|
||||
enum volumeType
|
||||
{
|
||||
UNKNOWN = 0,
|
||||
MIXED = 1,
|
||||
INSIDE = 2,
|
||||
OUTSIDE = 3
|
||||
};
|
||||
|
||||
|
||||
//- Tree node. Has up pointer and down pointers.
|
||||
class node
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -57,13 +57,13 @@ Foam::dynamicTreeDataPoint::shapePoints() const
|
||||
|
||||
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
|
||||
// Only makes sense for closed surfaces.
|
||||
Foam::label Foam::dynamicTreeDataPoint::getVolumeType
|
||||
Foam::volumeType Foam::dynamicTreeDataPoint::getVolumeType
|
||||
(
|
||||
const dynamicIndexedOctree<dynamicTreeDataPoint>& oc,
|
||||
const point& sample
|
||||
) const
|
||||
{
|
||||
return dynamicIndexedOctree<dynamicTreeDataPoint>::UNKNOWN;
|
||||
return volumeType::UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,6 +43,7 @@ SourceFiles
|
||||
#include "pointField.H"
|
||||
#include "treeBoundBox.H"
|
||||
#include "linePointRef.H"
|
||||
#include "volumeType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -92,7 +93,7 @@ public:
|
||||
|
||||
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
|
||||
// Only makes sense for closed surfaces.
|
||||
label getVolumeType
|
||||
volumeType getVolumeType
|
||||
(
|
||||
const dynamicIndexedOctree<dynamicTreeDataPoint>&,
|
||||
const point&
|
||||
|
||||
@ -356,15 +356,14 @@ Foam::label Foam::indexedOctree<Type>::compactContents
|
||||
// Recurses to determine status of lowest level boxes. Level above is
|
||||
// combination of octants below.
|
||||
template<class Type>
|
||||
typename Foam::indexedOctree<Type>::volumeType
|
||||
Foam::indexedOctree<Type>::calcVolumeType
|
||||
Foam::volumeType Foam::indexedOctree<Type>::calcVolumeType
|
||||
(
|
||||
const label nodeI
|
||||
) const
|
||||
{
|
||||
const node& nod = nodes_[nodeI];
|
||||
|
||||
volumeType myType = UNKNOWN;
|
||||
volumeType myType = volumeType::UNKNOWN;
|
||||
|
||||
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
|
||||
// side.
|
||||
subType = MIXED;
|
||||
subType = volumeType::MIXED;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -389,10 +388,7 @@ Foam::indexedOctree<Type>::calcVolumeType
|
||||
// of its bounding box.
|
||||
const treeBoundBox subBb = nod.bb_.subBbox(octant);
|
||||
|
||||
subType = volumeType
|
||||
(
|
||||
shapes_.getVolumeType(*this, subBb.midpoint())
|
||||
);
|
||||
subType = shapes_.getVolumeType(*this, subBb.midpoint());
|
||||
}
|
||||
|
||||
// Store octant type
|
||||
@ -400,13 +396,13 @@ Foam::indexedOctree<Type>::calcVolumeType
|
||||
|
||||
// Combine sub node types into type for treeNode. Result is 'mixed' if
|
||||
// types differ among subnodes.
|
||||
if (myType == UNKNOWN)
|
||||
if (myType == volumeType::UNKNOWN)
|
||||
{
|
||||
myType = subType;
|
||||
}
|
||||
else if (subType != myType)
|
||||
{
|
||||
myType = MIXED;
|
||||
myType = volumeType::MIXED;
|
||||
}
|
||||
}
|
||||
return myType;
|
||||
@ -414,8 +410,7 @@ Foam::indexedOctree<Type>::calcVolumeType
|
||||
|
||||
|
||||
template<class Type>
|
||||
typename Foam::indexedOctree<Type>::volumeType
|
||||
Foam::indexedOctree<Type>::getVolumeType
|
||||
Foam::volumeType Foam::indexedOctree<Type>::getVolumeType
|
||||
(
|
||||
const label nodeI,
|
||||
const point& sample
|
||||
@ -425,22 +420,22 @@ Foam::indexedOctree<Type>::getVolumeType
|
||||
|
||||
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;
|
||||
}
|
||||
else if (octantType == OUTSIDE)
|
||||
else if (octantType == volumeType::OUTSIDE)
|
||||
{
|
||||
return octantType;
|
||||
}
|
||||
else if (octantType == UNKNOWN)
|
||||
else if (octantType == volumeType::UNKNOWN)
|
||||
{
|
||||
// Can happen for e.g. non-manifold surfaces.
|
||||
return octantType;
|
||||
}
|
||||
else if (octantType == MIXED)
|
||||
else if (octantType == volumeType::MIXED)
|
||||
{
|
||||
labelBits index = nod.subNodes_[octant];
|
||||
|
||||
@ -469,7 +464,7 @@ Foam::indexedOctree<Type>::getVolumeType
|
||||
<< "Empty subnode has invalid volume type MIXED."
|
||||
<< abort(FatalError);
|
||||
|
||||
return UNKNOWN;
|
||||
return volumeType::UNKNOWN;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -484,14 +479,13 @@ Foam::indexedOctree<Type>::getVolumeType
|
||||
<< "Node has invalid volume type " << octantType
|
||||
<< abort(FatalError);
|
||||
|
||||
return UNKNOWN;
|
||||
return volumeType::UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
typename Foam::indexedOctree<Type>::volumeType
|
||||
Foam::indexedOctree<Type>::getSide
|
||||
Foam::volumeType Foam::indexedOctree<Type>::getSide
|
||||
(
|
||||
const vector& outsideNormal,
|
||||
const vector& vec
|
||||
@ -499,11 +493,11 @@ Foam::indexedOctree<Type>::getSide
|
||||
{
|
||||
if ((outsideNormal&vec) >= 0)
|
||||
{
|
||||
return OUTSIDE;
|
||||
return volumeType::OUTSIDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return INSIDE;
|
||||
return volumeType::INSIDE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2972,23 +2966,29 @@ const Foam::labelList& Foam::indexedOctree<Type>::findIndices
|
||||
|
||||
// Determine type (inside/outside/mixed) per node.
|
||||
template<class Type>
|
||||
typename Foam::indexedOctree<Type>::volumeType
|
||||
Foam::indexedOctree<Type>::getVolumeType
|
||||
Foam::volumeType Foam::indexedOctree<Type>::getVolumeType
|
||||
(
|
||||
const point& sample
|
||||
) const
|
||||
{
|
||||
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())
|
||||
{
|
||||
// Calculate type for every octant of node.
|
||||
|
||||
nodeTypes_.setSize(8*nodes_.size());
|
||||
nodeTypes_ = UNKNOWN;
|
||||
nodeTypes_ = volumeType::UNKNOWN;
|
||||
|
||||
calcVolumeType(0);
|
||||
|
||||
@ -3001,21 +3001,21 @@ Foam::indexedOctree<Type>::getVolumeType
|
||||
|
||||
forAll(nodeTypes_, i)
|
||||
{
|
||||
volumeType type = volumeType(nodeTypes_.get(i));
|
||||
volumeType type = volumeType::type(nodeTypes_.get(i));
|
||||
|
||||
if (type == UNKNOWN)
|
||||
if (type == volumeType::UNKNOWN)
|
||||
{
|
||||
nUNKNOWN++;
|
||||
}
|
||||
else if (type == MIXED)
|
||||
else if (type == volumeType::MIXED)
|
||||
{
|
||||
nMIXED++;
|
||||
}
|
||||
else if (type == INSIDE)
|
||||
else if (type == volumeType::INSIDE)
|
||||
{
|
||||
nINSIDE++;
|
||||
}
|
||||
else if (type == OUTSIDE)
|
||||
else if (type == volumeType::OUTSIDE)
|
||||
{
|
||||
nOUTSIDE++;
|
||||
}
|
||||
|
||||
@ -42,6 +42,7 @@ SourceFiles
|
||||
#include "HashSet.H"
|
||||
#include "labelBits.H"
|
||||
#include "PackedList.H"
|
||||
#include "volumeType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -74,16 +75,6 @@ public:
|
||||
|
||||
// Data types
|
||||
|
||||
//- volume types
|
||||
enum volumeType
|
||||
{
|
||||
UNKNOWN = 0,
|
||||
MIXED = 1,
|
||||
INSIDE = 2,
|
||||
OUTSIDE = 3
|
||||
};
|
||||
|
||||
|
||||
//- Tree node. Has up pointer and down pointers.
|
||||
class node
|
||||
{
|
||||
|
||||
@ -38,6 +38,7 @@ SourceFiles
|
||||
|
||||
#include "polyMesh.H"
|
||||
#include "treeBoundBoxList.H"
|
||||
#include "volumeType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -196,7 +197,7 @@ public:
|
||||
|
||||
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
|
||||
// Only makes sense for closed surfaces.
|
||||
label getVolumeType
|
||||
volumeType getVolumeType
|
||||
(
|
||||
const indexedOctree<treeDataCell>&,
|
||||
const point&
|
||||
@ -207,7 +208,7 @@ public:
|
||||
"treeDataCell::getVolumeType"
|
||||
"(const indexedOctree<treeDataCell>&, const point&)"
|
||||
);
|
||||
return -1;
|
||||
return volumeType::UNKNOWN;
|
||||
}
|
||||
|
||||
//- Does (bb of) shape at index overlap bb
|
||||
|
||||
79
src/OpenFOAM/algorithms/indexedOctree/volumeType.C
Normal file
79
src/OpenFOAM/algorithms/indexedOctree/volumeType.C
Normal 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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
127
src/OpenFOAM/algorithms/indexedOctree/volumeType.H
Normal file
127
src/OpenFOAM/algorithms/indexedOctree/volumeType.H
Normal 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
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user