Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
e2482a4e
Commit
e2482a4e
authored
Apr 11, 2013
by
laurence
Browse files
ENH: Merge searchableSurface and indexedOctree volumeType
parent
05b6a09b
Changes
42
Hide whitespace changes
Inline
Side-by-side
applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C
View file @
e2482a4e
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-201
2
OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-201
3
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -155,10 +155,10 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
// For each cell in the mesh has it been determined if it is fully
// inside, outside, or overlaps the surface
labelList
volumeStatus
List
<
volumeType
>
volumeStatus
(
mesh_
.
nCells
(),
searchableSurfac
e
::
UNKNOWN
volumeTyp
e
::
UNKNOWN
);
// Surface refinement
...
...
@@ -168,7 +168,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
// Determine/update the status of each cell
forAll
(
volumeStatus
,
cellI
)
{
if
(
volumeStatus
[
cellI
]
==
searchableSurfac
e
::
UNKNOWN
)
if
(
volumeStatus
[
cellI
]
==
volumeTyp
e
::
UNKNOWN
)
{
treeBoundBox
cellBb
(
...
...
@@ -181,16 +181,15 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
if
(
geometry
.
overlaps
(
cellBb
))
{
volumeStatus
[
cellI
]
=
searchableSurfac
e
::
MIXED
;
volumeStatus
[
cellI
]
=
volumeTyp
e
::
MIXED
;
}
else
if
(
geometry
.
inside
(
cellBb
.
midpoint
()))
{
volumeStatus
[
cellI
]
=
searchableSurfac
e
::
INSIDE
;
volumeStatus
[
cellI
]
=
volumeTyp
e
::
INSIDE
;
}
else
{
volumeStatus
[
cellI
]
=
searchableSurface
::
OUTSIDE
;
volumeStatus
[
cellI
]
=
volumeType
::
OUTSIDE
;
}
}
}
...
...
@@ -216,9 +215,9 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
{
label
cellI
=
newCellsToRefine
[
nCTRI
];
if
(
volumeStatus
[
cellI
]
==
searchableSurfac
e
::
MIXED
)
if
(
volumeStatus
[
cellI
]
==
volumeTyp
e
::
MIXED
)
{
volumeStatus
[
cellI
]
=
searchableSurfac
e
::
UNKNOWN
;
volumeStatus
[
cellI
]
=
volumeTyp
e
::
UNKNOWN
;
}
icellWeights
[
cellI
]
=
max
...
...
@@ -260,7 +259,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
const
labelList
&
cellMap
=
map
().
cellMap
();
labelList
newVolumeStatus
(
cellMap
.
size
());
List
<
volumeType
>
newVolumeStatus
(
cellMap
.
size
());
forAll
(
cellMap
,
newCellI
)
{
...
...
@@ -268,8 +267,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
if
(
oldCellI
==
-
1
)
{
newVolumeStatus
[
newCellI
]
=
searchableSurface
::
UNKNOWN
;
newVolumeStatus
[
newCellI
]
=
volumeType
::
UNKNOWN
;
}
else
{
...
...
@@ -289,7 +287,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
// Determine/update the status of each cell
forAll
(
volumeStatus
,
cellI
)
{
if
(
volumeStatus
[
cellI
]
==
searchableSurfac
e
::
UNKNOWN
)
if
(
volumeStatus
[
cellI
]
==
volumeTyp
e
::
UNKNOWN
)
{
treeBoundBox
cellBb
(
...
...
@@ -302,16 +300,15 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
if
(
geometry
.
overlaps
(
cellBb
))
{
volumeStatus
[
cellI
]
=
searchableSurfac
e
::
MIXED
;
volumeStatus
[
cellI
]
=
volumeTyp
e
::
MIXED
;
}
else
if
(
geometry
.
inside
(
cellBb
.
midpoint
()))
{
volumeStatus
[
cellI
]
=
searchableSurfac
e
::
INSIDE
;
volumeStatus
[
cellI
]
=
volumeTyp
e
::
INSIDE
;
}
else
{
volumeStatus
[
cellI
]
=
searchableSurface
::
OUTSIDE
;
volumeStatus
[
cellI
]
=
volumeType
::
OUTSIDE
;
}
}
}
...
...
@@ -325,7 +322,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
forAll
(
volumeStatus
,
cellI
)
{
if
(
volumeStatus
[
cellI
]
==
searchableSurfac
e
::
OUTSIDE
)
if
(
volumeStatus
[
cellI
]
==
volumeTyp
e
::
OUTSIDE
)
{
cellsToRemove
.
append
(
cellI
);
}
...
...
@@ -372,7 +369,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
const
labelList
&
cellMap
=
map
().
cellMap
();
labelList
newVolumeStatus
(
cellMap
.
size
());
List
<
volumeType
>
newVolumeStatus
(
cellMap
.
size
());
forAll
(
cellMap
,
newCellI
)
{
...
...
@@ -380,13 +377,11 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
if
(
oldCellI
==
-
1
)
{
newVolumeStatus
[
newCellI
]
=
searchableSurface
::
UNKNOWN
;
newVolumeStatus
[
newCellI
]
=
volumeType
::
UNKNOWN
;
}
else
{
newVolumeStatus
[
newCellI
]
=
volumeStatus
[
oldCellI
];
newVolumeStatus
[
newCellI
]
=
volumeStatus
[
oldCellI
];
}
}
...
...
@@ -511,7 +506,7 @@ void Foam::backgroundMeshDecomposition::printMeshData
bool
Foam
::
backgroundMeshDecomposition
::
refineCell
(
label
cellI
,
label
volType
,
volumeType
volType
,
scalar
&
weightEstimate
)
const
{
...
...
@@ -531,7 +526,7 @@ bool Foam::backgroundMeshDecomposition::refineCell
weightEstimate
=
1
.
0
;
if
(
volType
==
searchableSurfac
e
::
MIXED
)
if
(
volType
==
volumeTyp
e
::
MIXED
)
{
// // Assess the cell size at the nearest point on the surface for the
// // MIXED cells, if the cell is large with respect to the cell size,
...
...
@@ -611,7 +606,7 @@ bool Foam::backgroundMeshDecomposition::refineCell
// return true;
// }
}
else
if
(
volType
==
searchableSurfac
e
::
INSIDE
)
else
if
(
volType
==
volumeTyp
e
::
INSIDE
)
{
// scalar s = cvMesh_.cellShapeControl_.cellSize(cellBb.midpoint());
...
...
@@ -634,7 +629,7 @@ bool Foam::backgroundMeshDecomposition::refineCell
Foam
::
labelList
Foam
::
backgroundMeshDecomposition
::
selectRefinementCells
(
labelList
&
volumeStatus
,
List
<
volumeType
>
&
volumeStatus
,
volScalarField
&
cellWeights
)
const
{
...
...
@@ -645,7 +640,7 @@ Foam::labelList Foam::backgroundMeshDecomposition::selectRefinementCells
// Determine/update the status of each cell
forAll
(
volumeStatus
,
cellI
)
{
if
(
volumeStatus
[
cellI
]
==
searchableSurfac
e
::
MIXED
)
if
(
volumeStatus
[
cellI
]
==
volumeTyp
e
::
MIXED
)
{
if
(
meshCutter_
.
cellLevel
()[
cellI
]
<
minLevels_
)
{
...
...
@@ -653,7 +648,7 @@ Foam::labelList Foam::backgroundMeshDecomposition::selectRefinementCells
}
}
if
(
volumeStatus
[
cellI
]
!=
searchableSurfac
e
::
OUTSIDE
)
if
(
volumeStatus
[
cellI
]
!=
volumeTyp
e
::
OUTSIDE
)
{
if
(
...
...
@@ -705,7 +700,12 @@ void Foam::backgroundMeshDecomposition::buildPatchAndTree()
(
new
indexedOctree
<
treeDataBPatch
>
(
treeDataBPatch
(
false
,
boundaryFacesPtr_
()),
treeDataBPatch
(
false
,
boundaryFacesPtr_
(),
indexedOctree
<
treeDataBPatch
>::
perturbTol
()
),
overallBb
.
extend
(
rnd
,
1e-4
),
10
,
// maxLevel
10
,
// leafSize
...
...
@@ -1064,11 +1064,7 @@ bool Foam::backgroundMeshDecomposition::positionOnThisProcessor
{
// return bFTreePtr_().findAnyOverlap(pt, 0.0);
return
(
bFTreePtr_
().
getVolumeType
(
pt
)
==
indexedOctree
<
treeDataBPatch
>::
INSIDE
);
return
(
bFTreePtr_
().
getVolumeType
(
pt
)
==
volumeType
::
INSIDE
);
}
...
...
applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.H
View file @
e2482a4e
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-201
2
OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-201
3
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -71,6 +71,7 @@ SourceFiles
#include
"pointField.H"
#include
"indexedOctree.H"
#include
"treeDataPrimitivePatch.H"
#include
"volumeType.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -166,7 +167,7 @@ class backgroundMeshDecomposition
bool
refineCell
(
label
cellI
,
label
volType
,
volumeType
volType
,
scalar
&
weightEstimate
)
const
;
...
...
@@ -174,7 +175,7 @@ class backgroundMeshDecomposition
// meshed
labelList
selectRefinementCells
(
labelList
&
volumeStatus
,
List
<
volumeType
>
&
volumeStatus
,
volScalarField
&
cellWeights
)
const
;
...
...
applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/linearDistance/linearDistance.C
View file @
e2482a4e
...
...
@@ -27,6 +27,7 @@ License
#include
"addToRunTimeSelectionTable.H"
#include
"triSurfaceMesh.H"
#include
"triSurfaceFields.H"
#include
"volumeType.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -125,7 +126,7 @@ bool linearDistance::cellSize(const point& pt, scalar& size) const
}
pointField
ptF
(
1
,
pt
);
List
<
searchableSurface
::
volumeType
>
vTL
;
List
<
volumeType
>
vTL
;
surface_
.
getVolumeType
(
ptF
,
vTL
);
...
...
@@ -134,7 +135,7 @@ bool linearDistance::cellSize(const point& pt, scalar& size) const
if
(
sideMode_
==
smInside
&&
vTL
[
0
]
==
searchableSurfac
e
::
INSIDE
&&
vTL
[
0
]
==
volumeTyp
e
::
INSIDE
)
{
size
=
sizeFunction
(
hitPt
,
dist
,
hitIndex
);
...
...
@@ -144,7 +145,7 @@ bool linearDistance::cellSize(const point& pt, scalar& size) const
else
if
(
sideMode_
==
smOutside
&&
vTL
[
0
]
==
searchableSurfac
e
::
OUTSIDE
&&
vTL
[
0
]
==
volumeTyp
e
::
OUTSIDE
)
{
size
=
sizeFunction
(
hitPt
,
dist
,
hitIndex
);
...
...
applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/linearSpatial/linearSpatial.C
View file @
e2482a4e
...
...
@@ -25,6 +25,7 @@ License
#include
"linearSpatial.H"
#include
"addToRunTimeSelectionTable.H"
#include
"volumeType.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -108,7 +109,7 @@ bool linearSpatial::cellSize
}
pointField
ptF
(
1
,
pt
);
List
<
searchableSurface
::
volumeType
>
vTL
;
List
<
volumeType
>
vTL
;
surface_
.
getVolumeType
(
ptF
,
vTL
);
...
...
@@ -117,7 +118,7 @@ bool linearSpatial::cellSize
if
(
sideMode_
==
smInside
&&
vTL
[
0
]
==
searchableSurfac
e
::
INSIDE
&&
vTL
[
0
]
==
volumeTyp
e
::
INSIDE
)
{
size
=
sizeFunction
(
pt
);
...
...
@@ -127,7 +128,7 @@ bool linearSpatial::cellSize
else
if
(
sideMode_
==
smOutside
&&
vTL
[
0
]
==
searchableSurfac
e
::
OUTSIDE
&&
vTL
[
0
]
==
volumeTyp
e
::
OUTSIDE
)
{
size
=
sizeFunction
(
pt
);
...
...
applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/surfaceOffsetLinearDistance/surfaceOffsetLinearDistance.C
View file @
e2482a4e
...
...
@@ -25,6 +25,7 @@ License
#include
"surfaceOffsetLinearDistance.H"
#include
"addToRunTimeSelectionTable.H"
#include
"volumeType.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -194,7 +195,7 @@ bool surfaceOffsetLinearDistance::cellSize
}
pointField
ptF
(
1
,
pt
);
List
<
searchableSurface
::
volumeType
>
vTL
;
List
<
volumeType
>
vTL
;
surface_
.
getVolumeType
(
ptF
,
vTL
);
...
...
@@ -203,7 +204,7 @@ bool surfaceOffsetLinearDistance::cellSize
if
(
sideMode_
==
smInside
&&
vTL
[
0
]
==
searchableSurfac
e
::
INSIDE
&&
vTL
[
0
]
==
volumeTyp
e
::
INSIDE
)
{
size
=
sizeFunction
(
hitPt
,
dist
,
hitIndex
);
...
...
@@ -213,7 +214,7 @@ bool surfaceOffsetLinearDistance::cellSize
else
if
(
sideMode_
==
smOutside
&&
vTL
[
0
]
==
searchableSurfac
e
::
OUTSIDE
&&
vTL
[
0
]
==
volumeTyp
e
::
OUTSIDE
)
{
size
=
sizeFunction
(
hitPt
,
dist
,
hitIndex
);
...
...
applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/uniform/uniform.C
View file @
e2482a4e
...
...
@@ -25,6 +25,7 @@ License
#include
"uniform.H"
#include
"addToRunTimeSelectionTable.H"
#include
"volumeType.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -103,7 +104,7 @@ bool uniform::cellSize
}
pointField
ptF
(
1
,
pt
);
List
<
searchableSurface
::
volumeType
>
vTL
(
1
);
List
<
volumeType
>
vTL
(
1
);
surface_
.
getVolumeType
(
ptF
,
vTL
);
...
...
@@ -112,7 +113,7 @@ bool uniform::cellSize
if
(
sideMode_
==
smInside
&&
vTL
[
0
]
==
searchableSurfac
e
::
INSIDE
&&
vTL
[
0
]
==
volumeTyp
e
::
INSIDE
)
{
size
=
surfaceCellSizeFunction_
().
interpolate
(
hitPt
,
index
);
...
...
@@ -122,7 +123,7 @@ bool uniform::cellSize
else
if
(
sideMode_
==
smOutside
&&
vTL
[
0
]
==
searchableSurfac
e
::
OUTSIDE
&&
vTL
[
0
]
==
volumeTyp
e
::
OUTSIDE
)
{
size
=
surfaceCellSizeFunction_
().
interpolate
(
hitPt
,
index
);
...
...
applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/uniformDistance/uniformDistance.C
View file @
e2482a4e
...
...
@@ -25,7 +25,7 @@ License
#include
"uniformDistance.H"
#include
"addToRunTimeSelectionTable.H"
#include
"
dimensionSet
.H"
#include
"
volumeType
.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -95,7 +95,7 @@ bool uniformDistance::cellSize
}
pointField
ptF
(
1
,
pt
);
List
<
searchableSurface
::
volumeType
>
vTL
;
List
<
volumeType
>
vTL
;
surface_
.
getVolumeType
(
ptF
,
vTL
);
...
...
@@ -104,7 +104,7 @@ bool uniformDistance::cellSize
if
(
sideMode_
==
smInside
&&
vTL
[
0
]
==
searchableSurfac
e
::
INSIDE
&&
vTL
[
0
]
==
volumeTyp
e
::
INSIDE
)
{
size
=
surfaceCellSizeFunction_
().
surfaceSize
(
hitInfo
.
index
());
...
...
@@ -114,7 +114,7 @@ bool uniformDistance::cellSize
else
if
(
sideMode_
==
smOutside
&&
vTL
[
0
]
==
searchableSurfac
e
::
OUTSIDE
&&
vTL
[
0
]
==
volumeTyp
e
::
OUTSIDE
)
{
size
=
surfaceCellSizeFunction_
().
surfaceSize
(
hitInfo
.
index
());
...
...
applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformationSurfaces/conformationSurfaces.C
View file @
e2482a4e
...
...
@@ -27,11 +27,19 @@ License
#include
"conformalVoronoiMesh.H"
#include
"triSurface.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace
Foam
{
defineTypeNameAndDebug
(
conformationSurfaces
,
0
);
}
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
void
Foam
::
conformationSurfaces
::
hasBoundedVolume
(
List
<
searchableSurface
::
volumeType
>&
referenceVolumeTypes
List
<
volumeType
>&
referenceVolumeTypes
)
const
{
vector
sum
(
vector
::
zero
);
...
...
@@ -41,14 +49,18 @@ void Foam::conformationSurfaces::hasBoundedVolume
{
const
searchableSurface
&
surface
(
allGeometry_
[
surfaces_
[
s
]]);
if
(
surface
.
hasVolumeType
())
if
(
surface
.
hasVolumeType
()
&&
!
baffleSurfaces_
[
regionOffset_
[
s
]]
)
{
pointField
pts
(
1
,
locationInMesh_
);
List
<
searchableSurface
::
volumeType
>
vTypes
List
<
volumeType
>
vTypes
(
pts
.
size
(),
searchableSurfac
e
::
UNKNOWN
volumeTyp
e
::
UNKNOWN
);
surface
.
getVolumeType
(
pts
,
vTypes
);
...
...
@@ -56,7 +68,7 @@ void Foam::conformationSurfaces::hasBoundedVolume
referenceVolumeTypes
[
s
]
=
vTypes
[
0
];
Info
<<
" is "
<<
searchableSurface
::
volumeType
N
ames
[
referenceVolumeTypes
[
s
]]
<<
volumeType
::
n
ames
[
referenceVolumeTypes
[
s
]]
<<
" surface "
<<
surface
.
name
()
<<
endl
;
}
...
...
@@ -407,7 +419,7 @@ Foam::conformationSurfaces::conformationSurfaces
referenceVolumeTypes_
.
setSize
(
surfaces_
.
size
(),
searchableSurfac
e
::
UNKNOWN
volumeTyp
e
::
UNKNOWN
);
Info
<<
endl
...
...
@@ -471,24 +483,24 @@ bool Foam::conformationSurfaces::outside
const
point
&
samplePt
)
const
{
return
!
inside
(
samplePt
);
return
wellOutside
(
pointField
(
1
,
samplePt
),
scalarField
(
1
,
0
))[
0
];
//return !inside(samplePt);
}
Foam
::
Field
<
bool
>
Foam
::
conformationSurfaces
::
wellIn
OutS
ide
Foam
::
Field
<
bool
>
Foam
::
conformationSurfaces
::
wellIn
s
ide
(
const
pointField
&
samplePts
,
const
scalarField
&
testDistSqr
,
bool
testForInside
const
scalarField
&
testDistSqr
)
const
{
List
<
List
<
searchableSurface
::
volumeType
>
>
surfaceVolumeTests
List
<
List
<
volumeType
>
>
surfaceVolumeTests
(
surfaces_
.
size
(),
List
<
searchableSurface
::
volumeType
>
List
<
volumeType
>
(
samplePts
.
size
(),
searchableSurfac
e
::
UNKNOWN
volumeTyp
e
::
UNKNOWN
)
);
...
...
@@ -497,7 +509,9 @@ Foam::Field<bool> Foam::conformationSurfaces::wellInOutSide
{
const
searchableSurface
&
surface
(
allGeometry_
[
surfaces_
[
s
]]);
if
(
surface
.
hasVolumeType
())
const
label
regionI
=
regionOffset_
[
s
];
if
(
!
baffleSurfaces_
[
regionI
])
{
surface
.
getVolumeType
(
samplePts
,
surfaceVolumeTests
[
s
]);
}
...
...
@@ -508,7 +522,7 @@ Foam::Field<bool> Foam::conformationSurfaces::wellInOutSide
// distanceSquared
// Assume that the point is wellInside until demonstrated otherwise.
Field
<
bool
>
in
OutS
idePoint
(
samplePts
.
size
(),
t
estForInsid
e
);
Field
<
bool
>
in
s
idePoint
(
samplePts
.
size
(),
t
ru
e
);
//Check if the points are inside the surface by the given distance squared
...
...
@@ -534,37 +548,47 @@ Foam::Field<bool> Foam::conformationSurfaces::wellInOutSide
{
// If the point is within range of the surface, then it can't be
// well (in|out)side
in
OutS
idePoint
[
i
]
=
false
;
in
s
idePoint
[
i
]
=
false
;
continue
;
}
forAll
(
surfaces_
,
s
)
{
const
label
regionI
=
regionOffset_
[
s
];
const
searchableSurface
&
surface
(
allGeometry_
[
surfaces_
[
s
]]);
if
(
!
surface
.
hasVolumeType
()
&&
!
surface
.
bounds
().
contains
(
samplePts
[
i
])
)
{
continue
;
}
// If one of the pattern tests is failed, then the point cannot be
// inside, therefore, if this is a testForInside = true call, the
// result is false. If this is a testForInside = false call, then
// the result is true.
if
(
surfaceVolumeTests
[
s
][
i
]
!=
referenceVolumeTypes_
[
s
])
if
(
baffleSurfaces_
[
regionI
])