boundingBox has mag() and span() methods - use them

This commit is contained in:
Mark Olesen
2008-12-31 17:58:23 +01:00
parent 172b862c47
commit dcc82bf77b
25 changed files with 106 additions and 123 deletions

View File

@ -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.min());
const scalar mergeSqrDist = SMALL*magSqr(bb.span());
// This is an N^2 algorithm

View File

@ -177,9 +177,9 @@ int main(int argc, char *argv[])
const boundBox& bb = mesh.globalData().bb();
const vector span(bb.max() - bb.min());
const vector span = bb.span();
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

View File

@ -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.min());
scalar mergeDist = mergeTol * meshBb.mag();
scalar writeTol = std::pow
(
scalar(10.0),

View File

@ -20,7 +20,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
// Min length
scalar minDistSqr = magSqr(1e-6*(globalBb.max() - globalBb.min()));
scalar minDistSqr = magSqr(1e-6 * globalBb.span());
// Non-empty directions
const Vector<label> validDirs = (mesh.directions() + Vector<label>::one)/2;

View File

@ -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.min());
const scalar mergeDist = mergeTol * bb.mag();
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

View File

@ -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.min());
scalar mergeDist = mergeTol * bb.mag();
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
(

View File

@ -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.min());
scalar smallDim = 1E-6 * bb.mag();
Pout<< "Checking for points less than 1E-6 of bounding box ("
<< bb.max() - bb.min() << " meter) apart."
Pout<< "Checking for points less than 1E-6 of bounding box ("
<< bb.span() << " 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;

View File

@ -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;