mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: snappyHexMesh: add -dry-run argument. See #972.
This commit is contained in:
@ -487,7 +487,11 @@ void Foam::meshRefinement::checkData()
|
||||
neiBoundaryFc
|
||||
);
|
||||
}
|
||||
|
||||
// Check meshRefinement
|
||||
const labelList& surfIndex = surfaceIndex();
|
||||
|
||||
|
||||
{
|
||||
// Get boundary face centre and level. Coupled aware.
|
||||
labelList neiLevel(nBnd);
|
||||
@ -549,14 +553,14 @@ void Foam::meshRefinement::checkData()
|
||||
// Check
|
||||
forAll(surfaceHit, facei)
|
||||
{
|
||||
if (surfaceIndex_[facei] != surfaceHit[facei])
|
||||
if (surfIndex[facei] != surfaceHit[facei])
|
||||
{
|
||||
if (mesh_.isInternalFace(facei))
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Internal face:" << facei
|
||||
<< " fc:" << mesh_.faceCentres()[facei]
|
||||
<< " cached surfaceIndex_:" << surfaceIndex_[facei]
|
||||
<< " cached surfaceIndex_:" << surfIndex[facei]
|
||||
<< " current:" << surfaceHit[facei]
|
||||
<< " ownCc:"
|
||||
<< mesh_.cellCentres()[mesh_.faceOwner()[facei]]
|
||||
@ -566,14 +570,14 @@ void Foam::meshRefinement::checkData()
|
||||
}
|
||||
else if
|
||||
(
|
||||
surfaceIndex_[facei]
|
||||
surfIndex[facei]
|
||||
!= neiHit[facei-mesh_.nInternalFaces()]
|
||||
)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Boundary face:" << facei
|
||||
<< " fc:" << mesh_.faceCentres()[facei]
|
||||
<< " cached surfaceIndex_:" << surfaceIndex_[facei]
|
||||
<< " cached surfaceIndex_:" << surfIndex[facei]
|
||||
<< " current:" << surfaceHit[facei]
|
||||
<< " ownCc:"
|
||||
<< mesh_.cellCentres()[mesh_.faceOwner()[facei]]
|
||||
@ -996,7 +1000,8 @@ Foam::label Foam::meshRefinement::splitFacesUndo
|
||||
false, // report
|
||||
mesh_,
|
||||
motionDict,
|
||||
errorFaces
|
||||
errorFaces,
|
||||
dryRun_
|
||||
);
|
||||
if (!hasErrors)
|
||||
{
|
||||
@ -1208,7 +1213,9 @@ Foam::meshRefinement::meshRefinement
|
||||
const refinementSurfaces& surfaces,
|
||||
const refinementFeatures& features,
|
||||
const shellSurfaces& shells,
|
||||
const shellSurfaces& limitShells
|
||||
const shellSurfaces& limitShells,
|
||||
const labelUList& checkFaces,
|
||||
const bool dryRun
|
||||
)
|
||||
:
|
||||
mesh_(mesh),
|
||||
@ -1219,6 +1226,7 @@ Foam::meshRefinement::meshRefinement
|
||||
features_(features),
|
||||
shells_(shells),
|
||||
limitShells_(limitShells),
|
||||
dryRun_(dryRun),
|
||||
meshCutter_
|
||||
(
|
||||
mesh,
|
||||
@ -1241,12 +1249,35 @@ Foam::meshRefinement::meshRefinement
|
||||
userFaceData_(0)
|
||||
{
|
||||
// recalculate intersections for all faces
|
||||
updateIntersections(identity(mesh_.nFaces()));
|
||||
updateIntersections(checkFaces);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::labelList& Foam::meshRefinement::surfaceIndex() const
|
||||
{
|
||||
if (surfaceIndex_.size() != mesh_.nFaces())
|
||||
{
|
||||
const_cast<meshRefinement&>(*this).updateIntersections
|
||||
(
|
||||
identity(mesh_.nFaces())
|
||||
);
|
||||
}
|
||||
return surfaceIndex_;
|
||||
}
|
||||
|
||||
|
||||
Foam::labelList& Foam::meshRefinement::surfaceIndex()
|
||||
{
|
||||
if (surfaceIndex_.size() != mesh_.nFaces())
|
||||
{
|
||||
updateIntersections(identity(mesh_.nFaces()));
|
||||
}
|
||||
return surfaceIndex_;
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::meshRefinement::countHits() const
|
||||
{
|
||||
// Stats on edges to test. Count proc faces only once.
|
||||
@ -1254,9 +1285,11 @@ Foam::label Foam::meshRefinement::countHits() const
|
||||
|
||||
label nHits = 0;
|
||||
|
||||
forAll(surfaceIndex_, facei)
|
||||
const labelList& surfIndex = surfaceIndex();
|
||||
|
||||
forAll(surfIndex, facei)
|
||||
{
|
||||
if (surfaceIndex_[facei] >= 0 && isMasterFace.test(facei))
|
||||
if (surfIndex[facei] >= 0 && isMasterFace.test(facei))
|
||||
{
|
||||
++nHits;
|
||||
}
|
||||
@ -1520,9 +1553,11 @@ Foam::labelList Foam::meshRefinement::intersectedFaces() const
|
||||
{
|
||||
label nBoundaryFaces = 0;
|
||||
|
||||
forAll(surfaceIndex_, facei)
|
||||
const labelList& surfIndex = surfaceIndex();
|
||||
|
||||
forAll(surfIndex, facei)
|
||||
{
|
||||
if (surfaceIndex_[facei] != -1)
|
||||
if (surfIndex[facei] != -1)
|
||||
{
|
||||
nBoundaryFaces++;
|
||||
}
|
||||
@ -1531,9 +1566,9 @@ Foam::labelList Foam::meshRefinement::intersectedFaces() const
|
||||
labelList surfaceFaces(nBoundaryFaces);
|
||||
nBoundaryFaces = 0;
|
||||
|
||||
forAll(surfaceIndex_, facei)
|
||||
forAll(surfIndex, facei)
|
||||
{
|
||||
if (surfaceIndex_[facei] != -1)
|
||||
if (surfIndex[facei] != -1)
|
||||
{
|
||||
surfaceFaces[nBoundaryFaces++] = facei;
|
||||
}
|
||||
@ -1550,9 +1585,11 @@ Foam::labelList Foam::meshRefinement::intersectedPoints() const
|
||||
bitSet isBoundaryPoint(mesh_.nPoints());
|
||||
label nBoundaryPoints = 0;
|
||||
|
||||
forAll(surfaceIndex_, facei)
|
||||
const labelList& surfIndex = surfaceIndex();
|
||||
|
||||
forAll(surfIndex, facei)
|
||||
{
|
||||
if (surfaceIndex_[facei] != -1)
|
||||
if (surfIndex[facei] != -1)
|
||||
{
|
||||
const face& f = faces[facei];
|
||||
|
||||
@ -3094,6 +3131,9 @@ void Foam::meshRefinement::write
|
||||
if (writeFlags && !(writeFlags & NOWRITEREFINEMENT))
|
||||
{
|
||||
meshCutter_.write();
|
||||
|
||||
// Force calculation before writing
|
||||
(void)surfaceIndex();
|
||||
surfaceIndex_.write();
|
||||
}
|
||||
|
||||
@ -3157,4 +3197,76 @@ void Foam::meshRefinement::writeLevel(const writeType flags)
|
||||
//}
|
||||
|
||||
|
||||
const Foam::dictionary& Foam::meshRefinement::subDict
|
||||
(
|
||||
const dictionary& dict,
|
||||
const word& keyword,
|
||||
const bool noExit
|
||||
)
|
||||
{
|
||||
if (noExit)
|
||||
{
|
||||
// Find non-recursive with patterns
|
||||
const dictionary::const_searcher finder
|
||||
(
|
||||
dict.csearch
|
||||
(
|
||||
keyword,
|
||||
keyType::REGEX
|
||||
)
|
||||
);
|
||||
|
||||
if (!finder.found())
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "Entry '" << keyword << "' not found in dictionary "
|
||||
<< dict.name();
|
||||
return dictionary::null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return finder.dict();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return dict.subDict(keyword);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::ITstream& Foam::meshRefinement::lookup
|
||||
(
|
||||
const dictionary& dict,
|
||||
const word& keyword,
|
||||
const bool noExit
|
||||
)
|
||||
{
|
||||
if (noExit)
|
||||
{
|
||||
const dictionary::const_searcher finder
|
||||
(
|
||||
dict.csearch(keyword, keyType::REGEX)
|
||||
);
|
||||
|
||||
if (!finder.found())
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "Entry '" << keyword << "' not found in dictionary "
|
||||
<< dict.name();
|
||||
// Fake entry
|
||||
return dict.first()->stream();
|
||||
}
|
||||
else
|
||||
{
|
||||
return finder.ref().stream();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return dict.lookup(keyword);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
Reference in New Issue
Block a user