Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openfoam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
openfoam
Commits
4f3b415b
Commit
4f3b415b
authored
13 years ago
by
mattijs
Browse files
Options
Downloads
Patches
Plain Diff
ENH: searchableSurfacesQueries: added signed-distance calculation
parent
ff1d39c9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/meshTools/searchableSurface/searchableSurfacesQueries.C
+77
-1
77 additions, 1 deletion
src/meshTools/searchableSurface/searchableSurfacesQueries.C
src/meshTools/searchableSurface/searchableSurfacesQueries.H
+12
-1
12 additions, 1 deletion
src/meshTools/searchableSurface/searchableSurfacesQueries.H
with
89 additions
and
2 deletions
src/meshTools/searchableSurface/searchableSurfacesQueries.C
+
77
−
1
View file @
4f3b415b
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011
-2012
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -27,6 +27,7 @@ License
#include
"ListOps.H"
#include
"OFstream.H"
#include
"meshTools.H"
#include
"DynamicField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -686,6 +687,81 @@ void Foam::searchableSurfacesQueries::findNearest
}
void
Foam
::
searchableSurfacesQueries
::
signedDistance
(
const
PtrList
<
searchableSurface
>&
allSurfaces
,
const
labelList
&
surfacesToTest
,
const
pointField
&
samples
,
const
scalarField
&
nearestDistSqr
,
labelList
&
nearestSurfaces
,
scalarField
&
distance
)
{
// Initialise
distance
.
setSize
(
samples
.
size
());
distance
=
-
GREAT
;
// Find nearest
List
<
pointIndexHit
>
nearestInfo
;
findNearest
(
allSurfaces
,
surfacesToTest
,
samples
,
nearestDistSqr
,
nearestSurfaces
,
nearestInfo
);
// Determine sign of nearest. Sort by surface to do this.
DynamicField
<
point
>
surfPoints
(
samples
.
size
());
DynamicList
<
label
>
surfIndices
(
samples
.
size
());
forAll
(
surfacesToTest
,
testI
)
{
// Extract samples on this surface
surfPoints
.
clear
();
surfIndices
.
clear
();
forAll
(
nearestSurfaces
,
i
)
{
if
(
nearestSurfaces
[
i
]
==
testI
)
{
surfPoints
.
append
(
samples
[
i
]);
surfIndices
.
append
(
i
);
}
}
// Calculate sideness of these surface points
List
<
searchableSurface
::
volumeType
>
volType
;
allSurfaces
[
surfacesToTest
[
testI
]].
getVolumeType
(
surfPoints
,
volType
);
// Push back to original
forAll
(
volType
,
i
)
{
label
pointI
=
surfIndices
[
i
];
scalar
dist
=
mag
(
samples
[
pointI
]
-
nearestInfo
[
pointI
].
hitPoint
());
searchableSurface
::
volumeType
vT
=
volType
[
i
];
if
(
vT
==
searchableSurface
::
OUTSIDE
)
{
distance
[
pointI
]
=
dist
;
}
else
if
(
vT
==
searchableSurface
::
INSIDE
)
{
distance
[
i
]
=
-
dist
;
}
else
{
FatalErrorIn
(
"signedDistance()"
)
<<
"getVolumeType failure, neither INSIDE or OUTSIDE"
<<
exit
(
FatalError
);
}
}
}
}
Foam
::
boundBox
Foam
::
searchableSurfacesQueries
::
bounds
(
const
PtrList
<
searchableSurface
>&
allSurfaces
,
...
...
This diff is collapsed.
Click to expand it.
src/meshTools/searchableSurface/searchableSurfacesQueries.H
+
12
−
1
View file @
4f3b415b
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011
-2012
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -184,6 +184,17 @@ public:
List
<
pointIndexHit
>&
);
//- Find signed distance to nearest surface
static
void
signedDistance
(
const
PtrList
<
searchableSurface
>&
allSurfaces
,
const
labelList
&
surfacesToTest
,
const
pointField
&
samples
,
const
scalarField
&
nearestDistSqr
,
labelList
&
nearestSurfaces
,
scalarField
&
distance
);
//- Find the boundBox of the selected surfaces
static
boundBox
bounds
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment