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
e1fd499c
Commit
e1fd499c
authored
Jan 26, 2011
by
mattijs
Browse files
ENH: sampledTriSurfaceMesh : only sample non-coupled faces
parent
4877156d
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.C
View file @
e1fd499c
...
...
@@ -76,6 +76,63 @@ namespace Foam
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
const
Foam
::
indexedOctree
<
Foam
::
treeDataFace
>&
Foam
::
sampledTriSurfaceMesh
::
nonCoupledboundaryTree
()
const
{
// Variant of meshSearch::boundaryTree() that only does non-coupled
// boundary faces.
if
(
!
boundaryTreePtr_
.
valid
())
{
// all non-coupled boundary faces (not just walls)
const
polyBoundaryMesh
&
patches
=
mesh
().
boundaryMesh
();
labelList
bndFaces
(
mesh
().
nFaces
()
-
mesh
().
nInternalFaces
());
label
bndI
=
0
;
forAll
(
patches
,
patchI
)
{
const
polyPatch
&
pp
=
patches
[
patchI
];
if
(
!
pp
.
coupled
())
{
forAll
(
pp
,
i
)
{
bndFaces
[
bndI
++
]
=
pp
.
start
()
+
i
;
}
}
}
bndFaces
.
setSize
(
bndI
);
treeBoundBox
overallBb
(
mesh
().
points
());
Random
rndGen
(
123456
);
overallBb
=
overallBb
.
extend
(
rndGen
,
1E-4
);
overallBb
.
min
()
-=
point
(
ROOTVSMALL
,
ROOTVSMALL
,
ROOTVSMALL
);
overallBb
.
max
()
+=
point
(
ROOTVSMALL
,
ROOTVSMALL
,
ROOTVSMALL
);
boundaryTreePtr_
.
reset
(
new
indexedOctree
<
treeDataFace
>
(
treeDataFace
// all information needed to search faces
(
false
,
// do not cache bb
mesh
(),
bndFaces
// boundary faces only
),
overallBb
,
// overall search domain
8
,
// maxLevel
10
,
// leafsize
3
.
0
// duplicity
)
);
}
return
boundaryTreePtr_
();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam
::
sampledTriSurfaceMesh
::
sampledTriSurfaceMesh
...
...
@@ -159,6 +216,8 @@ bool Foam::sampledTriSurfaceMesh::expire()
sampledSurface
::
clearGeom
();
MeshStorage
::
clear
();
boundaryTreePtr_
.
clear
();
sampleElements_
.
clear
();
samplePoints_
.
clear
();
...
...
@@ -224,7 +283,10 @@ bool Foam::sampledTriSurfaceMesh::update()
{
// Search for nearest boundaryFace
const
indexedOctree
<
treeDataFace
>&
bTree
=
meshSearcher
.
boundaryTree
();
////- Search on all (including coupled) boundary faces
//const indexedOctree<treeDataFace>& bTree = meshSearcher.boundaryTree()
//- Search on all non-coupled boundary faces
const
indexedOctree
<
treeDataFace
>&
bTree
=
nonCoupledboundaryTree
();
forAll
(
fc
,
triI
)
{
...
...
src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.H
View file @
e1fd499c
...
...
@@ -28,12 +28,31 @@ Description
A sampledSurface from a triSurfaceMesh. It samples on the points/triangles
of the triSurface.
It samples using the cell nearest to the triangle centre so does
not check the cell the centre is actually in ...
In parallel every processor just operates on the part of the surface
where the face centres are inside the mesh. It is then up to the
caller to stitch the partial surfaces together.
- it either samples cells or (non-coupled) boundary faces
- 4 different modes:
- source=cells, interpolate=false:
finds per triangle centre the nearest cell centre and uses its value
- source=cells, interpolate=true
finds per triangle centre the nearest cell centre.
Per surface point checks if this nearest cell is the one containing
point; otherwise projects the point onto the nearest point on
the boundary of the cell (to make sure interpolateCellPoint
gets a valid location)
- source=boundaryFaces, interpolate=false:
finds per triangle centre the nearest point on the boundary
(uncoupled faces only) and uses the value (or 0 if the nearest
is on an empty boundary)
- source=boundaryFaces, interpolate=true:
finds per triangle centre the nearest point on the boundary
(uncoupled faces only).
Per surface point projects the point onto this boundary face
(to make sure interpolateCellPoint gets a valid location)
- since it finds a nearest per triangle each triangle is guaranteed
to be on one processor only. So after stitching (by sampledSurfaces)
the original surface should be complete.
SourceFiles
sampledTriSurfaceMesh.C
...
...
@@ -52,6 +71,8 @@ SourceFiles
namespace
Foam
{
class
treeDataFace
;
/*---------------------------------------------------------------------------*\
Class sampledTriSurfaceMesh Declaration
\*---------------------------------------------------------------------------*/
...
...
@@ -88,6 +109,9 @@ private:
//- Track if the surface needs an update
mutable
bool
needsUpdate_
;
//- Search tree for all non-coupled boundary faces
mutable
autoPtr
<
indexedOctree
<
treeDataFace
>
>
boundaryTreePtr_
;
//- From local surface triangle to mesh cell/face.
labelList
sampleElements_
;
...
...
@@ -97,6 +121,9 @@ private:
// Private Member Functions
//- Get tree of all non-coupled boundary faces
const
indexedOctree
<
treeDataFace
>&
nonCoupledboundaryTree
()
const
;
//- sample field on faces
template
<
class
Type
>
tmp
<
Field
<
Type
>
>
sampleField
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment