Skip to content
GitLab
Menu
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
dcc82bf7
Commit
dcc82bf7
authored
Dec 31, 2008
by
Mark Olesen
Browse files
boundingBox has mag() and span() methods - use them
parent
172b862c
Changes
25
Hide whitespace changes
Inline
Side-by-side
applications/utilities/mesh/generation/blockMesh/createMergeList.C
View file @
dcc82bf7
...
...
@@ -93,7 +93,7 @@ Foam::labelList Foam::blockMesh::createMergeList()
// the size of the block.
boundBox
bb
(
blockCells
[
blockPlabel
].
points
(
blockFaces
,
blockPoints
));
const
scalar
mergeSqrDist
=
SMALL
*
magSqr
(
bb
.
max
()
-
bb
.
mi
n
());
const
scalar
mergeSqrDist
=
SMALL
*
magSqr
(
bb
.
spa
n
());
// This is an N^2 algorithm
...
...
applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C
View file @
dcc82bf7
...
...
@@ -177,9 +177,9 @@ int main(int argc, char *argv[])
const
boundBox
&
bb
=
mesh
.
globalData
().
bb
();
const
vector
span
(
bb
.
max
()
-
bb
.
mi
n
()
)
;
const
vector
span
=
bb
.
spa
n
();
const
scalar
minDim
=
min
(
span
[
0
],
min
(
span
[
1
],
span
[
2
]));
const
scalar
mergeDim
=
1E-4
*
minDim
;
const
scalar
mergeDim
=
1E-4
*
minDim
;
Pout
<<
"Mesh bounding box:"
<<
bb
<<
nl
<<
" with span:"
<<
span
<<
nl
...
...
applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C
View file @
dcc82bf7
...
...
@@ -55,7 +55,7 @@ using namespace Foam;
scalar
getMergeDistance
(
const
polyMesh
&
mesh
,
const
scalar
mergeTol
)
{
const
boundBox
&
meshBb
=
mesh
.
bounds
();
scalar
mergeDist
=
mergeTol
*
mag
(
meshBb
.
max
()
-
meshBb
.
m
in
()
);
scalar
mergeDist
=
mergeTol
*
meshBb
.
m
ag
(
);
scalar
writeTol
=
std
::
pow
(
scalar
(
10
.
0
),
...
...
applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C
View file @
dcc82bf7
...
...
@@ -20,7 +20,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
// Min length
scalar
minDistSqr
=
magSqr
(
1e-6
*
(
globalBb
.
max
()
-
globalBb
.
mi
n
())
)
;
scalar
minDistSqr
=
magSqr
(
1e-6
*
globalBb
.
spa
n
());
// Non-empty directions
const
Vector
<
label
>
validDirs
=
(
mesh
.
directions
()
+
Vector
<
label
>::
one
)
/
2
;
...
...
applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C
View file @
dcc82bf7
...
...
@@ -471,7 +471,7 @@ int main(int argc, char *argv[])
bb
.
min
()
=
min
(
bb
.
min
(),
domainBb
.
min
());
bb
.
max
()
=
max
(
bb
.
max
(),
domainBb
.
max
());
}
const
scalar
mergeDist
=
mergeTol
*
mag
(
bb
.
max
()
-
bb
.
m
in
()
);
const
scalar
mergeDist
=
mergeTol
*
bb
.
m
ag
(
);
Info
<<
"Overall mesh bounding box : "
<<
bb
<<
nl
<<
"Relative tolerance : "
<<
mergeTol
<<
nl
...
...
@@ -533,15 +533,14 @@ int main(int argc, char *argv[])
// Find geometrically shared points/faces.
autoPtr
<
faceCoupleInfo
>
couples
=
determineCoupledFaces
(
fullMatch
,
procI
,
masterMesh
,
meshToAdd
,
mergeDist
);
autoPtr
<
faceCoupleInfo
>
couples
=
determineCoupledFaces
(
fullMatch
,
procI
,
masterMesh
,
meshToAdd
,
mergeDist
);
// Add elements to mesh
...
...
applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C
View file @
dcc82bf7
...
...
@@ -244,7 +244,8 @@ scalar getMergeDistance
{
mergeTol
=
readScalar
(
IStringStream
(
args
.
options
()[
"mergeTol"
])());
}
scalar
writeTol
=
scalar
writeTol
=
Foam
::
pow
(
scalar
(
10
.
0
),
-
scalar
(
IOstream
::
defaultPrecision
()));
Info
<<
"Merge tolerance : "
<<
mergeTol
<<
nl
...
...
@@ -263,7 +264,7 @@ scalar getMergeDistance
<<
exit
(
FatalError
);
}
scalar
mergeDist
=
mergeTol
*
mag
(
bb
.
max
()
-
bb
.
m
in
()
);
scalar
mergeDist
=
mergeTol
*
bb
.
m
ag
(
);
Info
<<
"Overall meshes bounding box : "
<<
bb
<<
nl
<<
"Relative tolerance : "
<<
mergeTol
<<
nl
...
...
@@ -276,26 +277,15 @@ scalar getMergeDistance
void
printMeshData
(
Ostream
&
os
,
const
polyMesh
&
mesh
)
{
os
<<
"Number of points: "
<<
mesh
.
points
().
size
()
<<
nl
<<
" edges: "
<<
mesh
.
edges
().
size
()
<<
nl
<<
" faces: "
<<
mesh
.
faces
().
size
()
<<
nl
<<
" internal faces: "
<<
mesh
.
faceNeighbour
().
size
()
<<
nl
<<
" cells: "
<<
mesh
.
cells
().
size
()
<<
nl
<<
" boundary patches: "
<<
mesh
.
boundaryMesh
().
size
()
<<
nl
<<
" point zones: "
<<
mesh
.
pointZones
().
size
()
<<
nl
<<
" face zones: "
<<
mesh
.
faceZones
().
size
()
<<
nl
<<
" cell zones: "
<<
mesh
.
cellZones
().
size
()
<<
nl
;
os
<<
"Number of points: "
<<
mesh
.
points
().
size
()
<<
nl
<<
" edges: "
<<
mesh
.
edges
().
size
()
<<
nl
<<
" faces: "
<<
mesh
.
faces
().
size
()
<<
nl
<<
" internal faces: "
<<
mesh
.
faceNeighbour
().
size
()
<<
nl
<<
" cells: "
<<
mesh
.
cells
().
size
()
<<
nl
<<
" boundary patches: "
<<
mesh
.
boundaryMesh
().
size
()
<<
nl
<<
" point zones: "
<<
mesh
.
pointZones
().
size
()
<<
nl
<<
" face zones: "
<<
mesh
.
faceZones
().
size
()
<<
nl
<<
" cell zones: "
<<
mesh
.
cellZones
().
size
()
<<
nl
;
}
...
...
@@ -308,7 +298,7 @@ void writeDecomposition
)
{
Info
<<
"Writing wanted cell distribution to volScalarField "
<<
name
<<
" for postprocessing purposes."
<<
nl
<<
endl
;
<<
" for postprocessing purposes."
<<
nl
<<
endl
;
volScalarField
procCells
(
...
...
applications/utilities/surface/surfaceCheck/surfaceCheck.C
View file @
dcc82bf7
...
...
@@ -325,7 +325,7 @@ int main(int argc, char *argv[])
Pout
<<
" "
<<
min
<<
" .. "
<<
min
+
dist
<<
" : "
<<
1
.
0
/
surf
.
size
()
*
binCount
[
binI
]
<<
endl
;
min
+=
dist
;
min
+=
dist
;
}
Pout
<<
endl
;
...
...
@@ -408,10 +408,10 @@ int main(int argc, char *argv[])
const
pointField
&
localPoints
=
surf
.
localPoints
();
const
boundBox
bb
(
localPoints
);
scalar
smallDim
=
1E-6
*
mag
(
bb
.
max
()
-
bb
.
m
in
()
);
scalar
smallDim
=
1E-6
*
bb
.
m
ag
(
);
Pout
<<
"Checking for points less than 1E-6 of bounding box ("
<<
bb
.
max
()
-
bb
.
mi
n
()
<<
" meter) apart."
Pout
<<
"Checking for points less than 1E-6 of bounding box ("
<<
bb
.
spa
n
()
<<
" meter) apart."
<<
endl
;
// Sort points
...
...
@@ -495,7 +495,7 @@ int main(int argc, char *argv[])
nSingleEdges
++
;
}
}
label
nMultEdges
=
0
;
forAll
(
eFaces
,
edgeI
)
{
...
...
@@ -654,7 +654,7 @@ int main(int argc, char *argv[])
}
Pout
<<
endl
;
}
Pout
<<
"End
\n
"
<<
endl
;
...
...
applications/utilities/surface/surfaceToPatch/surfaceToPatch.C
View file @
dcc82bf7
...
...
@@ -202,8 +202,7 @@ int main(int argc, char *argv[])
// Get search box. Anything not within this box will not be considered.
const
boundBox
&
meshBb
=
mesh
.
globalData
().
bb
();
const
vector
searchSpan
(
searchTol
*
(
meshBb
.
max
()
-
meshBb
.
min
()));
const
vector
searchSpan
=
searchTol
*
meshBb
.
span
();
Info
<<
"All boundary faces further away than "
<<
searchTol
<<
" of mesh bounding box "
<<
meshBb
...
...
@@ -217,7 +216,7 @@ int main(int argc, char *argv[])
{
Info
<<
" "
<<
mesh
.
boundaryMesh
()[
patchI
].
name
()
<<
'\t'
<<
mesh
.
boundaryMesh
()[
patchI
].
size
()
<<
endl
;
}
}
Info
<<
endl
;
...
...
@@ -309,7 +308,7 @@ int main(int argc, char *argv[])
{
Info
<<
" "
<<
mesh
.
boundaryMesh
()[
patchI
].
name
()
<<
'\t'
<<
mesh
.
boundaryMesh
()[
patchI
].
size
()
<<
endl
;
}
}
Info
<<
endl
;
...
...
@@ -318,7 +317,7 @@ int main(int argc, char *argv[])
// Write resulting mesh
Info
<<
"Writing modified mesh to time "
<<
runTime
.
value
()
<<
endl
;
mesh
.
write
();
}
}
Info
<<
"End
\n
"
<<
endl
;
...
...
src/OpenFOAM/meshes/boundBox/boundBox.H
View file @
dcc82bf7
...
...
@@ -98,26 +98,37 @@ public:
// Access
//- Minimum describing the bounding box
const
point
&
min
()
const
{
return
min_
;
}
//- Maximum describing the bounding box
const
point
&
max
()
const
{
return
max_
;
}
//- Minimum describing the bounding box, non-const access
point
&
min
()
{
return
min_
;
}
//- Maximum describing the bounding box, non-const access
point
&
max
()
{
return
max_
;
}
//- The bounding box span (from minimum to maximum)
vector
span
()
const
{
return
(
max_
-
min_
);
}
//- The magnitude of the bounding box span
scalar
mag
()
const
{
return
::
Foam
::
mag
(
max_
-
min_
);
...
...
src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C
View file @
dcc82bf7
...
...
@@ -663,7 +663,7 @@ Foam::pointField Foam::globalMeshData::geometricSharedPoints() const
combineReduce
(
sharedPoints
,
plusEqOp
<
pointField
>
());
// Merge tolerance
scalar
tolDim
=
matchTol_
*
mag
(
bb_
.
ma
x
()
-
bb_
.
min
()
);
scalar
tolDim
=
matchTol_
*
bb_
.
ma
g
(
);
// And see how many are unique
labelList
pMap
;
...
...
@@ -731,7 +731,7 @@ void Foam::globalMeshData::updateMesh()
// Bounding box (does communication)
bb_
=
boundBox
(
mesh_
.
points
(),
true
);
scalar
tolDim
=
matchTol_
*
mag
(
bb_
.
ma
x
()
-
bb_
.
min
()
);
scalar
tolDim
=
matchTol_
*
bb_
.
ma
g
(
);
if
(
debug
)
{
...
...
src/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.C
View file @
dcc82bf7
...
...
@@ -46,10 +46,8 @@ License
namespace
Foam
{
defineTypeNameAndDebug
(
autoHexMeshDriver
,
0
);
}
// End namespace Foam
defineTypeNameAndDebug
(
autoHexMeshDriver
,
0
);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
...
...
@@ -59,7 +57,7 @@ Foam::scalar Foam::autoHexMeshDriver::getMergeDistance(const scalar mergeTol)
const
{
const
boundBox
&
meshBb
=
mesh_
.
bounds
();
scalar
mergeDist
=
mergeTol
*
mag
(
meshBb
.
max
()
-
meshBb
.
m
in
()
);
scalar
mergeDist
=
mergeTol
*
meshBb
.
m
ag
(
);
scalar
writeTol
=
std
::
pow
(
scalar
(
10
.
0
),
...
...
@@ -118,7 +116,7 @@ Foam::scalar Foam::autoHexMeshDriver::getMergeDistance(const scalar mergeTol)
//
// if (hasSurface)
// {
// const point outsidePt
(2*overallBb.max() -
overallBb.
mi
n()
)
;
// const point outsidePt
= 2 *
overallBb.
spa
n();
//
// //Info<< "Using point " << outsidePt << " to orient shells" << endl;
//
...
...
src/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C
View file @
dcc82bf7
...
...
@@ -193,7 +193,7 @@ void Foam::shellSurfaces::orient()
if
(
hasSurface
)
{
const
point
outsidePt
(
2
*
overallBb
.
max
()
-
overallBb
.
mi
n
()
)
;
const
point
outsidePt
=
2
*
overallBb
.
spa
n
();
//Info<< "Using point " << outsidePt << " to orient shells" << endl;
...
...
src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C
View file @
dcc82bf7
...
...
@@ -4375,8 +4375,7 @@ void Foam::hexRef8::distribute(const mapDistributePolyMesh& map)
void
Foam
::
hexRef8
::
checkMesh
()
const
{
const
boundBox
&
meshBb
=
mesh_
.
globalData
().
bb
();
const
scalar
smallDim
=
1E-6
*
mag
(
meshBb
.
max
()
-
meshBb
.
min
());
const
scalar
smallDim
=
1E-6
*
mesh_
.
globalData
().
bb
().
mag
();
if
(
debug
)
{
...
...
src/fvMotionSolver/fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C
View file @
dcc82bf7
...
...
@@ -224,10 +224,8 @@ void Foam::displacementSBRStressFvMotionSolver::updateMesh
);
// Note: boundBox does reduce
const
boundBox
bb0
(
points0_
,
true
);
const
vector
span0
(
bb0
.
max
()
-
bb0
.
min
());
const
boundBox
bb
(
points
,
true
);
const
vector
span
(
bb
.
max
()
-
bb
.
min
());
const
vector
span0
=
boundBox
(
points0_
,
true
).
span
();
const
vector
span
=
boundBox
(
points
,
true
).
span
();
vector
scaleFactors
(
cmptDivide
(
span0
,
span
));
...
...
src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationFvMotionSolver.C
View file @
dcc82bf7
...
...
@@ -433,10 +433,8 @@ void Foam::displacementInterpolationFvMotionSolver::updateMesh
);
// Note: boundBox does reduce
const
boundBox
bb0
(
points0_
,
true
);
const
vector
span0
(
bb0
.
max
()
-
bb0
.
min
());
const
boundBox
bb
(
points
,
true
);
const
vector
span
(
bb
.
max
()
-
bb
.
min
());
const
vector
span0
=
boundBox
(
points0_
,
true
).
span
();
const
vector
span
=
boundBox
(
points
,
true
).
span
();
vector
scaleFactors
(
cmptDivide
(
span0
,
span
));
...
...
@@ -445,7 +443,7 @@ void Foam::displacementInterpolationFvMotionSolver::updateMesh
forAll
(
newPoints0
,
pointI
)
{
label
oldPointI
=
mpm
.
pointMap
()[
pointI
];
if
(
oldPointI
>=
0
)
{
label
masterPointI
=
mpm
.
reversePointMap
()[
oldPointI
];
...
...
src/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C
View file @
dcc82bf7
...
...
@@ -166,7 +166,7 @@ Foam::displacementLaplacianFvMotionSolver::
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam
::
tmp
<
Foam
::
pointField
>
Foam
::
tmp
<
Foam
::
pointField
>
Foam
::
displacementLaplacianFvMotionSolver
::
curPoints
()
const
{
volPointInterpolation
::
New
(
fvMesh_
).
interpolate
...
...
@@ -272,10 +272,8 @@ void Foam::displacementLaplacianFvMotionSolver::updateMesh
);
// Note: boundBox does reduce
const
boundBox
bb0
(
points0_
,
true
);
const
vector
span0
(
bb0
.
max
()
-
bb0
.
min
());
const
boundBox
bb
(
points
,
true
);
const
vector
span
(
bb
.
max
()
-
bb
.
min
());
const
vector
span0
=
boundBox
(
points0_
,
true
).
span
();
const
vector
span
=
boundBox
(
points
,
true
).
span
();
vector
scaleFactors
(
cmptDivide
(
span0
,
span
));
...
...
@@ -284,7 +282,7 @@ void Foam::displacementLaplacianFvMotionSolver::updateMesh
forAll
(
newPoints0
,
pointI
)
{
label
oldPointI
=
mpm
.
pointMap
()[
pointI
];
if
(
oldPointI
>=
0
)
{
label
masterPointI
=
mpm
.
reversePointMap
()[
oldPointI
];
...
...
src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C
View file @
dcc82bf7
...
...
@@ -169,12 +169,12 @@ void surfaceSlipDisplacementPointPatchVectorField::evaluate
{
const
polyMesh
&
mesh
=
patch
().
boundaryMesh
().
mesh
()();
//const scalar deltaT = mesh.time().deltaT().value();
//
const scalar deltaT = mesh.time().deltaT().value();
// Construct large enough vector in direction of projectDir so
// we're guaranteed to hit something.
const
scalar
projectLen
=
mag
(
mesh
.
bounds
().
ma
x
()
-
mesh
.
bounds
().
min
()
);
const
scalar
projectLen
=
mesh
.
bounds
().
ma
g
(
);
// For case of fixed projection vector:
vector
projectVec
;
...
...
@@ -307,7 +307,7 @@ void surfaceSlipDisplacementPointPatchVectorField::evaluate
rightHit
);
}
List
<
pointIndexHit
>
leftHit
;
{
labelList
leftSurf
;
...
...
src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.C
View file @
dcc82bf7
...
...
@@ -243,7 +243,7 @@ void Foam::directMappedPolyPatch::findSamples
nearInfo
=
boundaryTree
().
findNearest
(
sample
,
magSqr
(
patchBb
.
max
()
-
patchBb
.
mi
n
())
magSqr
(
patchBb
.
spa
n
())
);
if
(
!
nearInfo
.
hit
())
...
...
src/meshTools/indexedOctree/treeDataTriSurface.C
View file @
dcc82bf7
...
...
@@ -220,7 +220,7 @@ Foam::label Foam::treeDataTriSurface::getVolumeType
max
(
Foam
::
sqr
(
GREAT
),
Foam
::
magSqr
(
treeBb
.
max
()
-
treeBb
.
mi
n
())
Foam
::
magSqr
(
treeBb
.
spa
n
())
)
);
...
...
src/meshTools/meshSearch/meshSearch.C
View file @
dcc82bf7
...
...
@@ -100,8 +100,8 @@ Foam::label Foam::meshSearch::findNearestCellTree(const point& location) const
{
const
indexedOctree
<
treeDataPoint
>&
tree
=
cellCentreTree
();
scalar
span
=
mag
(
tree
.
bb
().
ma
x
()
-
tree
.
bb
().
min
()
);
scalar
span
=
tree
.
bb
().
ma
g
(
);
pointIndexHit
info
=
tree
.
findNearest
(
location
,
Foam
::
sqr
(
span
));
if
(
!
info
.
hit
())
...
...
@@ -177,7 +177,7 @@ Foam::label Foam::meshSearch::findNearestFaceTree(const point& location) const
// Search nearest cell centre.
const
indexedOctree
<
treeDataPoint
>&
tree
=
cellCentreTree
();
scalar
span
=
mag
(
tree
.
bb
().
ma
x
()
-
tree
.
bb
().
min
()
);
scalar
span
=
tree
.
bb
().
ma
g
(
);
// Search with decent span
pointIndexHit
info
=
tree
.
findNearest
(
location
,
Foam
::
sqr
(
span
));
...
...
@@ -803,7 +803,7 @@ Foam::label Foam::meshSearch::findNearestBoundaryFace
{
const
indexedOctree
<
treeDataFace
>&
tree
=
boundaryTree
();
scalar
span
=
mag
(
tree
.
bb
().
ma
x
()
-
tree
.
bb
().
min
()
);
scalar
span
=
tree
.
bb
().
ma
g
(
);
pointIndexHit
info
=
boundaryTree
().
findNearest
(
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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