mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: snappyHexMesh: fix growing of attraction. Split off debug/writing/output
This commit is contained in:
@ -576,25 +576,30 @@ void writeMesh
|
|||||||
(
|
(
|
||||||
const string& msg,
|
const string& msg,
|
||||||
const meshRefinement& meshRefiner,
|
const meshRefinement& meshRefiner,
|
||||||
const bool writeLevel,
|
const meshRefinement::debugType debugLevel,
|
||||||
const label debug
|
const meshRefinement::writeType writeLevel
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const fvMesh& mesh = meshRefiner.mesh();
|
const fvMesh& mesh = meshRefiner.mesh();
|
||||||
|
|
||||||
meshRefiner.printMeshInfo(debug, msg);
|
meshRefiner.printMeshInfo(debugLevel, msg);
|
||||||
Info<< "Writing mesh to time " << meshRefiner.timeName() << endl;
|
Info<< "Writing mesh to time " << meshRefiner.timeName() << endl;
|
||||||
|
|
||||||
label flag = meshRefinement::MESH;
|
//label flag = meshRefinement::MESH;
|
||||||
if (writeLevel)
|
//if (writeLevel)
|
||||||
{
|
//{
|
||||||
flag |= meshRefinement::SCALARLEVELS;
|
// flag |= meshRefinement::SCALARLEVELS;
|
||||||
}
|
//}
|
||||||
if (debug & meshRefinement::OBJINTERSECTIONS)
|
//if (debug & meshRefinement::OBJINTERSECTIONS)
|
||||||
{
|
//{
|
||||||
flag |= meshRefinement::OBJINTERSECTIONS;
|
// flag |= meshRefinement::OBJINTERSECTIONS;
|
||||||
}
|
//}
|
||||||
meshRefiner.write(flag, mesh.time().path()/meshRefiner.timeName());
|
meshRefiner.write
|
||||||
|
(
|
||||||
|
debugLevel,
|
||||||
|
meshRefinement::writeType(writeLevel | meshRefinement::WRITEMESH),
|
||||||
|
mesh.time().path()/meshRefiner.timeName()
|
||||||
|
);
|
||||||
Info<< "Wrote mesh in = "
|
Info<< "Wrote mesh in = "
|
||||||
<< mesh.time().cpuTimeIncrement() << " s." << endl;
|
<< mesh.time().cpuTimeIncrement() << " s." << endl;
|
||||||
}
|
}
|
||||||
@ -837,16 +842,74 @@ int main(int argc, char *argv[])
|
|||||||
// Debug
|
// Debug
|
||||||
// ~~~~~
|
// ~~~~~
|
||||||
|
|
||||||
const label debug = meshDict.lookupOrDefault<label>("debug", 0);
|
// Set debug level
|
||||||
if (debug > 0)
|
meshRefinement::debugType debugLevel = meshRefinement::debugType
|
||||||
|
(
|
||||||
|
meshDict.lookupOrDefault<label>
|
||||||
|
(
|
||||||
|
"debug",
|
||||||
|
0
|
||||||
|
)
|
||||||
|
);
|
||||||
{
|
{
|
||||||
meshRefinement::debug = debug;
|
wordList flags;
|
||||||
autoRefineDriver::debug = debug;
|
if (meshDict.readIfPresent("debugFlags", flags))
|
||||||
autoSnapDriver::debug = debug;
|
{
|
||||||
autoLayerDriver::debug = debug;
|
debugLevel = meshRefinement::debugType
|
||||||
|
(
|
||||||
|
meshRefinement::readFlags
|
||||||
|
(
|
||||||
|
meshRefinement::IOdebugTypeNames,
|
||||||
|
flags
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (debugLevel > 0)
|
||||||
|
{
|
||||||
|
meshRefinement::debug = debugLevel;
|
||||||
|
autoRefineDriver::debug = debugLevel;
|
||||||
|
autoSnapDriver::debug = debugLevel;
|
||||||
|
autoLayerDriver::debug = debugLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool writeLevel = meshDict.lookupOrDefault<bool>("writeLevel", false);
|
// Set file writing level
|
||||||
|
{
|
||||||
|
wordList flags;
|
||||||
|
if (meshDict.readIfPresent("writeFlags", flags))
|
||||||
|
{
|
||||||
|
meshRefinement::writeLevel
|
||||||
|
(
|
||||||
|
meshRefinement::writeType
|
||||||
|
(
|
||||||
|
meshRefinement::readFlags
|
||||||
|
(
|
||||||
|
meshRefinement::IOwriteTypeNames,
|
||||||
|
flags
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set output level
|
||||||
|
{
|
||||||
|
wordList flags;
|
||||||
|
if (meshDict.readIfPresent("outputFlags", flags))
|
||||||
|
{
|
||||||
|
meshRefinement::outputLevel
|
||||||
|
(
|
||||||
|
meshRefinement::outputType
|
||||||
|
(
|
||||||
|
meshRefinement::readFlags
|
||||||
|
(
|
||||||
|
meshRefinement::IOoutputTypeNames,
|
||||||
|
flags
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Read geometry
|
// Read geometry
|
||||||
@ -1047,11 +1110,12 @@ int main(int argc, char *argv[])
|
|||||||
<< mesh.time().cpuTimeIncrement() << " s" << nl << endl;
|
<< mesh.time().cpuTimeIncrement() << " s" << nl << endl;
|
||||||
|
|
||||||
// Some stats
|
// Some stats
|
||||||
meshRefiner.printMeshInfo(debug, "Initial mesh");
|
meshRefiner.printMeshInfo(debugLevel, "Initial mesh");
|
||||||
|
|
||||||
meshRefiner.write
|
meshRefiner.write
|
||||||
(
|
(
|
||||||
debug & meshRefinement::OBJINTERSECTIONS,
|
meshRefinement::debugType(debugLevel&meshRefinement::OBJINTERSECTIONS),
|
||||||
|
meshRefinement::writeType(0),
|
||||||
mesh.time().path()/meshRefiner.timeName()
|
mesh.time().path()/meshRefiner.timeName()
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1271,7 +1335,7 @@ int main(int argc, char *argv[])
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
if (!overwrite && !debug)
|
if (!overwrite && !debugLevel)
|
||||||
{
|
{
|
||||||
const_cast<Time&>(mesh.time())++;
|
const_cast<Time&>(mesh.time())++;
|
||||||
}
|
}
|
||||||
@ -1289,8 +1353,8 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
"Refined mesh",
|
"Refined mesh",
|
||||||
meshRefiner,
|
meshRefiner,
|
||||||
writeLevel,
|
debugLevel,
|
||||||
debug
|
meshRefinement::writeLevel()
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< "Mesh refined in = "
|
Info<< "Mesh refined in = "
|
||||||
@ -1308,7 +1372,7 @@ int main(int argc, char *argv[])
|
|||||||
globalToSlavePatch
|
globalToSlavePatch
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!overwrite && !debug)
|
if (!overwrite && !debugLevel)
|
||||||
{
|
{
|
||||||
const_cast<Time&>(mesh.time())++;
|
const_cast<Time&>(mesh.time())++;
|
||||||
}
|
}
|
||||||
@ -1330,8 +1394,8 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
"Snapped mesh",
|
"Snapped mesh",
|
||||||
meshRefiner,
|
meshRefiner,
|
||||||
writeLevel,
|
debugLevel,
|
||||||
debug
|
meshRefinement::writeLevel()
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< "Mesh snapped in = "
|
Info<< "Mesh snapped in = "
|
||||||
@ -1357,7 +1421,7 @@ int main(int argc, char *argv[])
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
if (!overwrite && !debug)
|
if (!overwrite && !debugLevel)
|
||||||
{
|
{
|
||||||
const_cast<Time&>(mesh.time())++;
|
const_cast<Time&>(mesh.time())++;
|
||||||
}
|
}
|
||||||
@ -1376,8 +1440,8 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
"Layer mesh",
|
"Layer mesh",
|
||||||
meshRefiner,
|
meshRefiner,
|
||||||
writeLevel,
|
debugLevel,
|
||||||
debug
|
meshRefinement::writeLevel()
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< "Layers added in = "
|
Info<< "Layers added in = "
|
||||||
|
|||||||
@ -475,14 +475,22 @@ meshQualityControls
|
|||||||
|
|
||||||
// Advanced
|
// Advanced
|
||||||
|
|
||||||
// Flags for optional output
|
//// Debug flags
|
||||||
// 0 : only write final meshes
|
//debugFlags
|
||||||
// 1 : write intermediate meshes
|
//(
|
||||||
// 2 : write volScalarField with cellLevel for postprocessing
|
// mesh // write intermediate meshes
|
||||||
// 4 : write current mesh intersections as .obj files
|
// intersections // write current mesh intersections as .obj files
|
||||||
// 8 : write information about explicit feature edge refinement
|
// featureSeeds, // write information about explicit feature edge refinement
|
||||||
// 16 : write information about layers
|
// layerInfo // write information about layers
|
||||||
debug 0;
|
//);
|
||||||
|
//
|
||||||
|
//// Write flags
|
||||||
|
//writeFlags
|
||||||
|
//(
|
||||||
|
// scalarLevels // write volScalarField with cellLevel for postprocessing
|
||||||
|
// layerSets // write cellSets, faceSets of faces in layer
|
||||||
|
// layerFields // write volScalarField for layer coverage
|
||||||
|
//);
|
||||||
|
|
||||||
// Merge tolerance. Is fraction of overall bounding box of initial mesh.
|
// Merge tolerance. Is fraction of overall bounding box of initial mesh.
|
||||||
// Note: the write tolerance needs to be higher than this.
|
// Note: the write tolerance needs to be higher than this.
|
||||||
|
|||||||
@ -2472,6 +2472,99 @@ void Foam::autoLayerDriver::getLayerCellsFaces
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::autoLayerDriver::printLayerData
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const labelList& patchIDs,
|
||||||
|
const labelList& cellNLayers,
|
||||||
|
const scalarField& faceWantedThickness,
|
||||||
|
const scalarField& faceRealThickness
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||||
|
|
||||||
|
// Find maximum length of a patch name, for a nicer output
|
||||||
|
label maxPatchNameLen = 0;
|
||||||
|
forAll(patchIDs, i)
|
||||||
|
{
|
||||||
|
label patchI = patchIDs[i];
|
||||||
|
word patchName = pbm[patchI].name();
|
||||||
|
maxPatchNameLen = max(maxPatchNameLen, label(patchName.size()));
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< nl
|
||||||
|
<< setf(ios_base::left) << setw(maxPatchNameLen) << "patch"
|
||||||
|
<< setw(0) << " faces layers overall thickness" << nl
|
||||||
|
<< setf(ios_base::left) << setw(maxPatchNameLen) << " "
|
||||||
|
<< setw(0) << " [m] [%]" << nl
|
||||||
|
<< setf(ios_base::left) << setw(maxPatchNameLen) << "-----"
|
||||||
|
<< setw(0) << " ----- ------ --- ---" << endl;
|
||||||
|
|
||||||
|
|
||||||
|
forAll(patchIDs, i)
|
||||||
|
{
|
||||||
|
label patchI = patchIDs[i];
|
||||||
|
const polyPatch& pp = pbm[patchI];
|
||||||
|
|
||||||
|
label sumSize = pp.size();
|
||||||
|
|
||||||
|
// Number of layers
|
||||||
|
const labelList& faceCells = pp.faceCells();
|
||||||
|
label sumNLayers = 0;
|
||||||
|
forAll(faceCells, i)
|
||||||
|
{
|
||||||
|
sumNLayers += cellNLayers[faceCells[i]];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Thickness
|
||||||
|
scalarField::subField patchWanted = pbm[patchI].patchSlice
|
||||||
|
(
|
||||||
|
faceWantedThickness
|
||||||
|
);
|
||||||
|
scalarField::subField patchReal = pbm[patchI].patchSlice
|
||||||
|
(
|
||||||
|
faceRealThickness
|
||||||
|
);
|
||||||
|
|
||||||
|
scalar sumRealThickness = sum(patchReal);
|
||||||
|
scalar sumFraction = 0;
|
||||||
|
forAll(patchReal, i)
|
||||||
|
{
|
||||||
|
if (patchWanted[i] > VSMALL)
|
||||||
|
{
|
||||||
|
sumFraction += (patchReal[i]/patchWanted[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
reduce(sumSize, sumOp<label>());
|
||||||
|
reduce(sumNLayers, sumOp<label>());
|
||||||
|
reduce(sumRealThickness, sumOp<scalar>());
|
||||||
|
reduce(sumFraction, sumOp<scalar>());
|
||||||
|
|
||||||
|
|
||||||
|
scalar avgLayers = 0;
|
||||||
|
scalar avgReal = 0;
|
||||||
|
scalar avgFraction = 0;
|
||||||
|
if (sumSize > 0)
|
||||||
|
{
|
||||||
|
avgLayers = scalar(sumNLayers)/sumSize;
|
||||||
|
avgReal = sumRealThickness/sumSize;
|
||||||
|
avgFraction = sumFraction/sumSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< setf(ios_base::left) << setw(maxPatchNameLen)
|
||||||
|
<< pbm[patchI].name() << setprecision(3)
|
||||||
|
<< " " << setw(8) << sumSize
|
||||||
|
<< " " << setw(8) << avgLayers
|
||||||
|
<< " " << setw(8) << avgReal
|
||||||
|
<< " " << setw(8) << 100*avgFraction
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
Info<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::autoLayerDriver::writeLayerData
|
bool Foam::autoLayerDriver::writeLayerData
|
||||||
(
|
(
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
@ -2483,6 +2576,8 @@ bool Foam::autoLayerDriver::writeLayerData
|
|||||||
{
|
{
|
||||||
bool allOk = true;
|
bool allOk = true;
|
||||||
|
|
||||||
|
if (meshRefinement::writeLevel() & meshRefinement::WRITELAYERSETS)
|
||||||
|
{
|
||||||
{
|
{
|
||||||
label nAdded = 0;
|
label nAdded = 0;
|
||||||
forAll(cellNLayers, cellI)
|
forAll(cellNLayers, cellI)
|
||||||
@ -2534,6 +2629,10 @@ bool Foam::autoLayerDriver::writeLayerData
|
|||||||
bool ok = layerFacesSet.write();
|
bool ok = layerFacesSet.write();
|
||||||
allOk = allOk & ok;
|
allOk = allOk & ok;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (meshRefinement::writeLevel() & meshRefinement::WRITELAYERFIELDS)
|
||||||
|
{
|
||||||
{
|
{
|
||||||
volScalarField fld
|
volScalarField fld
|
||||||
(
|
(
|
||||||
@ -2568,36 +2667,6 @@ bool Foam::autoLayerDriver::writeLayerData
|
|||||||
bool ok = fld.write();
|
bool ok = fld.write();
|
||||||
allOk = allOk & ok;
|
allOk = allOk & ok;
|
||||||
}
|
}
|
||||||
{
|
|
||||||
volScalarField fld
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"wantedThickness",
|
|
||||||
mesh.time().timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::AUTO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
mesh,
|
|
||||||
dimensionedScalar("zero", dimless, 0),
|
|
||||||
fixedValueFvPatchScalarField::typeName
|
|
||||||
);
|
|
||||||
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
|
||||||
forAll(patchIDs, i)
|
|
||||||
{
|
|
||||||
label patchI = patchIDs[i];
|
|
||||||
fld.boundaryField()[patchI] == pbm[patchI].patchSlice
|
|
||||||
(
|
|
||||||
faceWantedThickness
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Info<< "Writing volScalarField " << fld.name()
|
|
||||||
<< " with wanted thickness" << endl;
|
|
||||||
bool ok = fld.write();
|
|
||||||
allOk = allOk & ok;
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
volScalarField fld
|
volScalarField fld
|
||||||
(
|
(
|
||||||
@ -2624,10 +2693,72 @@ bool Foam::autoLayerDriver::writeLayerData
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
Info<< "Writing volScalarField " << fld.name()
|
Info<< "Writing volScalarField " << fld.name()
|
||||||
<< " with layer thickness" << endl;
|
<< " with overall layer thickness" << endl;
|
||||||
bool ok = fld.write();
|
bool ok = fld.write();
|
||||||
allOk = allOk & ok;
|
allOk = allOk & ok;
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
volScalarField fld
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"thicknessFraction",
|
||||||
|
mesh.time().timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar("zero", dimless, 0),
|
||||||
|
fixedValueFvPatchScalarField::typeName
|
||||||
|
);
|
||||||
|
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||||
|
forAll(patchIDs, i)
|
||||||
|
{
|
||||||
|
label patchI = patchIDs[i];
|
||||||
|
|
||||||
|
scalarField::subField patchWanted = pbm[patchI].patchSlice
|
||||||
|
(
|
||||||
|
faceWantedThickness
|
||||||
|
);
|
||||||
|
scalarField::subField patchReal = pbm[patchI].patchSlice
|
||||||
|
(
|
||||||
|
faceRealThickness
|
||||||
|
);
|
||||||
|
|
||||||
|
// Convert patchReal to relavtive thickness
|
||||||
|
scalarField pfld(patchReal.size(), 0.0);
|
||||||
|
forAll(patchReal, i)
|
||||||
|
{
|
||||||
|
if (patchWanted[i] > VSMALL)
|
||||||
|
{
|
||||||
|
pfld[i] = patchReal[i]/patchWanted[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fld.boundaryField()[patchI] == pfld;
|
||||||
|
}
|
||||||
|
Info<< "Writing volScalarField " << fld.name()
|
||||||
|
<< " with overall layer thickness as fraction"
|
||||||
|
<< " of desired thickness" << endl;
|
||||||
|
bool ok = fld.write();
|
||||||
|
allOk = allOk & ok;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//if (meshRefinement::outputLevel() & meshRefinement::OUTPUTLAYERINFO)
|
||||||
|
{
|
||||||
|
printLayerData
|
||||||
|
(
|
||||||
|
mesh,
|
||||||
|
patchIDs,
|
||||||
|
cellNLayers,
|
||||||
|
faceWantedThickness,
|
||||||
|
faceRealThickness
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return allOk;
|
return allOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2737,7 +2868,12 @@ void Foam::autoLayerDriver::addLayers
|
|||||||
<< meshRefiner_.timeName() << endl;
|
<< meshRefiner_.timeName() << endl;
|
||||||
meshRefiner_.write
|
meshRefiner_.write
|
||||||
(
|
(
|
||||||
debug,
|
meshRefinement::debugType(debug),
|
||||||
|
meshRefinement::writeType
|
||||||
|
(
|
||||||
|
meshRefinement::writeLevel()
|
||||||
|
| meshRefinement::WRITEMESH
|
||||||
|
),
|
||||||
mesh.time().path()/meshRefiner_.timeName()
|
mesh.time().path()/meshRefiner_.timeName()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -3173,7 +3309,12 @@ void Foam::autoLayerDriver::addLayers
|
|||||||
|
|
||||||
meshRefiner_.write
|
meshRefiner_.write
|
||||||
(
|
(
|
||||||
debug,
|
meshRefinement::debugType(debug),
|
||||||
|
meshRefinement::writeType
|
||||||
|
(
|
||||||
|
meshRefinement::writeLevel()
|
||||||
|
| meshRefinement::WRITEMESH
|
||||||
|
),
|
||||||
mesh.time().path()/meshRefiner_.timeName()
|
mesh.time().path()/meshRefiner_.timeName()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -380,6 +380,16 @@ class autoLayerDriver
|
|||||||
scalarField& faceRealThickness
|
scalarField& faceRealThickness
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Print layer coverage table
|
||||||
|
void printLayerData
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const labelList& patchIDs,
|
||||||
|
const labelList& cellNLayers,
|
||||||
|
const scalarField& faceWantedThickness,
|
||||||
|
const scalarField& faceRealThickness
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Write cellSet,faceSet for layers
|
//- Write cellSet,faceSet for layers
|
||||||
bool writeLayerData
|
bool writeLayerData
|
||||||
(
|
(
|
||||||
|
|||||||
@ -1330,7 +1330,12 @@ void Foam::autoLayerDriver::medialAxisSmoothingInfo
|
|||||||
meshRefiner_.mesh().setInstance(meshRefiner_.timeName());
|
meshRefiner_.mesh().setInstance(meshRefiner_.timeName());
|
||||||
meshRefiner_.write
|
meshRefiner_.write
|
||||||
(
|
(
|
||||||
debug,
|
meshRefinement::debugType(debug),
|
||||||
|
meshRefinement::writeType
|
||||||
|
(
|
||||||
|
meshRefinement::writeLevel()
|
||||||
|
| meshRefinement::WRITEMESH
|
||||||
|
),
|
||||||
mesh.time().path()/meshRefiner_.timeName()
|
mesh.time().path()/meshRefiner_.timeName()
|
||||||
);
|
);
|
||||||
dispVec.write();
|
dispVec.write();
|
||||||
@ -1775,7 +1780,12 @@ void Foam::autoLayerDriver::shrinkMeshMedialDistance
|
|||||||
|
|
||||||
meshRefiner_.write
|
meshRefiner_.write
|
||||||
(
|
(
|
||||||
debug,
|
meshRefinement::debugType(debug),
|
||||||
|
meshRefinement::writeType
|
||||||
|
(
|
||||||
|
meshRefinement::writeLevel()
|
||||||
|
| meshRefinement::WRITEMESH
|
||||||
|
),
|
||||||
mesh.time().path()/meshRefiner_.timeName()
|
mesh.time().path()/meshRefiner_.timeName()
|
||||||
);
|
);
|
||||||
dispVec.write();
|
dispVec.write();
|
||||||
|
|||||||
@ -698,7 +698,16 @@ void Foam::autoRefineDriver::removeInsideCells
|
|||||||
{
|
{
|
||||||
Pout<< "Writing subsetted mesh to time "
|
Pout<< "Writing subsetted mesh to time "
|
||||||
<< meshRefiner_.timeName() << '.' << endl;
|
<< meshRefiner_.timeName() << '.' << endl;
|
||||||
meshRefiner_.write(debug, mesh.time().path()/meshRefiner_.timeName());
|
meshRefiner_.write
|
||||||
|
(
|
||||||
|
meshRefinement::debugType(debug),
|
||||||
|
meshRefinement::writeType
|
||||||
|
(
|
||||||
|
meshRefinement::writeLevel()
|
||||||
|
| meshRefinement::WRITEMESH
|
||||||
|
),
|
||||||
|
mesh.time().path()/meshRefiner_.timeName()
|
||||||
|
);
|
||||||
Pout<< "Dumped mesh in = "
|
Pout<< "Dumped mesh in = "
|
||||||
<< mesh.time().cpuTimeIncrement() << " s\n" << nl << endl;
|
<< mesh.time().cpuTimeIncrement() << " s\n" << nl << endl;
|
||||||
}
|
}
|
||||||
@ -956,7 +965,12 @@ void Foam::autoRefineDriver::zonify
|
|||||||
<< meshRefiner_.timeName() << '.' << endl;
|
<< meshRefiner_.timeName() << '.' << endl;
|
||||||
meshRefiner_.write
|
meshRefiner_.write
|
||||||
(
|
(
|
||||||
debug,
|
meshRefinement::debugType(debug),
|
||||||
|
meshRefinement::writeType
|
||||||
|
(
|
||||||
|
meshRefinement::writeLevel()
|
||||||
|
| meshRefinement::WRITEMESH
|
||||||
|
),
|
||||||
mesh.time().path()/meshRefiner_.timeName()
|
mesh.time().path()/meshRefiner_.timeName()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1071,7 +1085,16 @@ void Foam::autoRefineDriver::splitAndMergeBaffles
|
|||||||
{
|
{
|
||||||
Pout<< "Writing handleProblemCells mesh to time "
|
Pout<< "Writing handleProblemCells mesh to time "
|
||||||
<< meshRefiner_.timeName() << '.' << endl;
|
<< meshRefiner_.timeName() << '.' << endl;
|
||||||
meshRefiner_.write(debug, mesh.time().path()/meshRefiner_.timeName());
|
meshRefiner_.write
|
||||||
|
(
|
||||||
|
meshRefinement::debugType(debug),
|
||||||
|
meshRefinement::writeType
|
||||||
|
(
|
||||||
|
meshRefinement::writeLevel()
|
||||||
|
| meshRefinement::WRITEMESH
|
||||||
|
),
|
||||||
|
mesh.time().path()/meshRefiner_.timeName()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -730,7 +730,12 @@ void Foam::autoSnapDriver::preSmoothPatch
|
|||||||
<< meshRefiner.timeName() << '.' << endl;
|
<< meshRefiner.timeName() << '.' << endl;
|
||||||
meshRefiner.write
|
meshRefiner.write
|
||||||
(
|
(
|
||||||
debug,
|
meshRefinement::debugType(debug),
|
||||||
|
meshRefinement::writeType
|
||||||
|
(
|
||||||
|
meshRefinement::writeLevel()
|
||||||
|
| meshRefinement::WRITEMESH
|
||||||
|
),
|
||||||
mesh.time().path()/meshRefiner.timeName()
|
mesh.time().path()/meshRefiner.timeName()
|
||||||
);
|
);
|
||||||
Info<< "Dumped mesh in = "
|
Info<< "Dumped mesh in = "
|
||||||
@ -2027,7 +2032,12 @@ void Foam::autoSnapDriver::smoothDisplacement
|
|||||||
|
|
||||||
meshRefiner_.write
|
meshRefiner_.write
|
||||||
(
|
(
|
||||||
debug,
|
meshRefinement::debugType(debug),
|
||||||
|
meshRefinement::writeType
|
||||||
|
(
|
||||||
|
meshRefinement::writeLevel()
|
||||||
|
| meshRefinement::WRITEMESH
|
||||||
|
),
|
||||||
mesh.time().path()/meshRefiner_.timeName()
|
mesh.time().path()/meshRefiner_.timeName()
|
||||||
);
|
);
|
||||||
Info<< "Writing displacement field ..." << endl;
|
Info<< "Writing displacement field ..." << endl;
|
||||||
@ -2497,8 +2507,13 @@ void Foam::autoSnapDriver::doSnap
|
|||||||
<< endl;
|
<< endl;
|
||||||
meshRefiner_.write
|
meshRefiner_.write
|
||||||
(
|
(
|
||||||
debug, mesh.time().path()
|
meshRefinement::debugType(debug),
|
||||||
/"duplicatedPoints"
|
meshRefinement::writeType
|
||||||
|
(
|
||||||
|
meshRefinement::writeLevel()
|
||||||
|
| meshRefinement::WRITEMESH
|
||||||
|
),
|
||||||
|
mesh.time().path()/"duplicatedPoints"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2804,7 +2819,12 @@ void Foam::autoSnapDriver::doSnap
|
|||||||
<< meshRefiner_.timeName() << endl;
|
<< meshRefiner_.timeName() << endl;
|
||||||
meshRefiner_.write
|
meshRefiner_.write
|
||||||
(
|
(
|
||||||
debug,
|
meshRefinement::debugType(debug),
|
||||||
|
meshRefinement::writeType
|
||||||
|
(
|
||||||
|
meshRefinement::writeLevel()
|
||||||
|
| meshRefinement::WRITEMESH
|
||||||
|
),
|
||||||
mesh.time().path()/meshRefiner_.timeName()
|
mesh.time().path()/meshRefiner_.timeName()
|
||||||
);
|
);
|
||||||
Info<< "Writing displacement field ..." << endl;
|
Info<< "Writing displacement field ..." << endl;
|
||||||
@ -2866,7 +2886,12 @@ void Foam::autoSnapDriver::doSnap
|
|||||||
<< meshRefiner_.timeName() << endl;
|
<< meshRefiner_.timeName() << endl;
|
||||||
meshRefiner_.write
|
meshRefiner_.write
|
||||||
(
|
(
|
||||||
debug,
|
meshRefinement::debugType(debug),
|
||||||
|
meshRefinement::writeType
|
||||||
|
(
|
||||||
|
meshRefinement::writeLevel()
|
||||||
|
| meshRefinement::WRITEMESH
|
||||||
|
),
|
||||||
meshRefiner_.timeName()
|
meshRefiner_.timeName()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -131,13 +131,13 @@ class autoSnapDriver
|
|||||||
const List<pointConstraint>& constraints,
|
const List<pointConstraint>& constraints,
|
||||||
vectorField& disp
|
vectorField& disp
|
||||||
) const;
|
) const;
|
||||||
void smoothAndConstrain2
|
//void smoothAndConstrain2
|
||||||
(
|
//(
|
||||||
const bool applyConstraints,
|
// const bool applyConstraints,
|
||||||
const indirectPrimitivePatch& pp,
|
// const indirectPrimitivePatch& pp,
|
||||||
const List<pointConstraint>& constraints,
|
// const List<pointConstraint>& constraints,
|
||||||
vectorField& disp
|
// vectorField& disp
|
||||||
) const;
|
//) const;
|
||||||
void calcNearest
|
void calcNearest
|
||||||
(
|
(
|
||||||
const label iter,
|
const label iter,
|
||||||
|
|||||||
@ -25,10 +25,9 @@ License
|
|||||||
|
|
||||||
#include "autoSnapDriver.H"
|
#include "autoSnapDriver.H"
|
||||||
#include "polyTopoChange.H"
|
#include "polyTopoChange.H"
|
||||||
#include "OFstream.H"
|
|
||||||
#include "syncTools.H"
|
#include "syncTools.H"
|
||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "OFstream.H"
|
#include "OBJstream.H"
|
||||||
#include "motionSmoother.H"
|
#include "motionSmoother.H"
|
||||||
#include "refinementSurfaces.H"
|
#include "refinementSurfaces.H"
|
||||||
#include "refinementFeatures.H"
|
#include "refinementFeatures.H"
|
||||||
@ -216,77 +215,77 @@ void Foam::autoSnapDriver::smoothAndConstrain
|
|||||||
}
|
}
|
||||||
//XXXXXX
|
//XXXXXX
|
||||||
//TODO: make proper parallel so coupled edges don't have double influence
|
//TODO: make proper parallel so coupled edges don't have double influence
|
||||||
void Foam::autoSnapDriver::smoothAndConstrain2
|
//void Foam::autoSnapDriver::smoothAndConstrain2
|
||||||
(
|
//(
|
||||||
const bool applyConstraints,
|
// const bool applyConstraints,
|
||||||
const indirectPrimitivePatch& pp,
|
// const indirectPrimitivePatch& pp,
|
||||||
const List<pointConstraint>& constraints,
|
// const List<pointConstraint>& constraints,
|
||||||
vectorField& disp
|
// vectorField& disp
|
||||||
) const
|
//) const
|
||||||
{
|
//{
|
||||||
const fvMesh& mesh = meshRefiner_.mesh();
|
// const fvMesh& mesh = meshRefiner_.mesh();
|
||||||
|
//
|
||||||
for (label avgIter = 0; avgIter < 20; avgIter++)
|
// for (label avgIter = 0; avgIter < 20; avgIter++)
|
||||||
{
|
// {
|
||||||
vectorField dispSum(pp.nPoints(), vector::zero);
|
// vectorField dispSum(pp.nPoints(), vector::zero);
|
||||||
labelList dispCount(pp.nPoints(), 0);
|
// labelList dispCount(pp.nPoints(), 0);
|
||||||
|
//
|
||||||
const labelListList& pointEdges = pp.pointEdges();
|
// const labelListList& pointEdges = pp.pointEdges();
|
||||||
const edgeList& edges = pp.edges();
|
// const edgeList& edges = pp.edges();
|
||||||
|
//
|
||||||
forAll(pointEdges, pointI)
|
// forAll(pointEdges, pointI)
|
||||||
{
|
// {
|
||||||
const labelList& pEdges = pointEdges[pointI];
|
// const labelList& pEdges = pointEdges[pointI];
|
||||||
|
//
|
||||||
forAll(pEdges, i)
|
// forAll(pEdges, i)
|
||||||
{
|
// {
|
||||||
label nbrPointI = edges[pEdges[i]].otherVertex(pointI);
|
// label nbrPointI = edges[pEdges[i]].otherVertex(pointI);
|
||||||
dispSum[pointI] += disp[nbrPointI];
|
// dispSum[pointI] += disp[nbrPointI];
|
||||||
dispCount[pointI]++;
|
// dispCount[pointI]++;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
syncTools::syncPointList
|
// syncTools::syncPointList
|
||||||
(
|
// (
|
||||||
mesh,
|
// mesh,
|
||||||
pp.meshPoints(),
|
// pp.meshPoints(),
|
||||||
dispSum,
|
// dispSum,
|
||||||
plusEqOp<point>(),
|
// plusEqOp<point>(),
|
||||||
vector::zero,
|
// vector::zero,
|
||||||
mapDistribute::transform()
|
// mapDistribute::transform()
|
||||||
);
|
// );
|
||||||
syncTools::syncPointList
|
// syncTools::syncPointList
|
||||||
(
|
// (
|
||||||
mesh,
|
// mesh,
|
||||||
pp.meshPoints(),
|
// pp.meshPoints(),
|
||||||
dispCount,
|
// dispCount,
|
||||||
plusEqOp<label>(),
|
// plusEqOp<label>(),
|
||||||
0,
|
// 0,
|
||||||
mapDistribute::transform()
|
// mapDistribute::transform()
|
||||||
);
|
// );
|
||||||
|
//
|
||||||
// Constraints
|
// // Constraints
|
||||||
forAll(constraints, pointI)
|
// forAll(constraints, pointI)
|
||||||
{
|
// {
|
||||||
if (dispCount[pointI] > 0)// && constraints[pointI].first() <= 1)
|
// if (dispCount[pointI] > 0)// && constraints[pointI].first() <= 1)
|
||||||
{
|
// {
|
||||||
// Mix my displacement with neighbours' displacement
|
// // Mix my displacement with neighbours' displacement
|
||||||
disp[pointI] =
|
// disp[pointI] =
|
||||||
0.5
|
// 0.5
|
||||||
*(disp[pointI] + dispSum[pointI]/dispCount[pointI]);
|
// *(disp[pointI] + dispSum[pointI]/dispCount[pointI]);
|
||||||
|
//
|
||||||
if (applyConstraints)
|
// if (applyConstraints)
|
||||||
{
|
// {
|
||||||
disp[pointI] = transform
|
// disp[pointI] = transform
|
||||||
(
|
// (
|
||||||
constraints[pointI].constraintTransformation(),
|
// constraints[pointI].constraintTransformation(),
|
||||||
disp[pointI]
|
// disp[pointI]
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
//XXXXXX
|
//XXXXXX
|
||||||
|
|
||||||
|
|
||||||
@ -1082,16 +1081,13 @@ void Foam::autoSnapDriver::featureAttractionUsingReconstruction
|
|||||||
List<pointConstraint>& patchConstraints
|
List<pointConstraint>& patchConstraints
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
autoPtr<OFstream> feStr;
|
autoPtr<OBJstream> feStr;
|
||||||
label feVertI = 0;
|
autoPtr<OBJstream> fpStr;
|
||||||
autoPtr<OFstream> fpStr;
|
|
||||||
label fpVertI = 0;
|
|
||||||
|
|
||||||
if (debug&meshRefinement::OBJINTERSECTIONS)
|
if (debug&meshRefinement::OBJINTERSECTIONS)
|
||||||
{
|
{
|
||||||
feStr.reset
|
feStr.reset
|
||||||
(
|
(
|
||||||
new OFstream
|
new OBJstream
|
||||||
(
|
(
|
||||||
meshRefiner_.mesh().time().path()
|
meshRefiner_.mesh().time().path()
|
||||||
/ "implicitFeatureEdge_" + name(iter) + ".obj"
|
/ "implicitFeatureEdge_" + name(iter) + ".obj"
|
||||||
@ -1102,7 +1098,7 @@ void Foam::autoSnapDriver::featureAttractionUsingReconstruction
|
|||||||
|
|
||||||
fpStr.reset
|
fpStr.reset
|
||||||
(
|
(
|
||||||
new OFstream
|
new OBJstream
|
||||||
(
|
(
|
||||||
meshRefiner_.mesh().time().path()
|
meshRefiner_.mesh().time().path()
|
||||||
/ "implicitFeaturePoint_" + name(iter) + ".obj"
|
/ "implicitFeaturePoint_" + name(iter) + ".obj"
|
||||||
@ -1139,7 +1135,10 @@ void Foam::autoSnapDriver::featureAttractionUsingReconstruction
|
|||||||
if
|
if
|
||||||
(
|
(
|
||||||
(constraint.first() > patchConstraints[pointI].first())
|
(constraint.first() > patchConstraints[pointI].first())
|
||||||
|| (magSqr(attraction) < magSqr(patchAttraction[pointI]))
|
|| (
|
||||||
|
(constraint.first() == patchConstraints[pointI].first())
|
||||||
|
&& (magSqr(attraction) < magSqr(patchAttraction[pointI]))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
patchAttraction[pointI] = attraction;
|
patchAttraction[pointI] = attraction;
|
||||||
@ -1149,19 +1148,11 @@ void Foam::autoSnapDriver::featureAttractionUsingReconstruction
|
|||||||
|
|
||||||
if (patchConstraints[pointI].first() == 2 && feStr.valid())
|
if (patchConstraints[pointI].first() == 2 && feStr.valid())
|
||||||
{
|
{
|
||||||
meshTools::writeOBJ(feStr(), pt);
|
feStr().write(linePointRef(pt, pt+patchAttraction[pointI]));
|
||||||
feVertI++;
|
|
||||||
meshTools::writeOBJ(feStr(), pt+patchAttraction[pointI]);
|
|
||||||
feVertI++;
|
|
||||||
feStr() << "l " << feVertI-1 << ' ' << feVertI << nl;
|
|
||||||
}
|
}
|
||||||
else if (patchConstraints[pointI].first() == 3 && fpStr.valid())
|
else if (patchConstraints[pointI].first() == 3 && fpStr.valid())
|
||||||
{
|
{
|
||||||
meshTools::writeOBJ(fpStr(), pt);
|
fpStr().write(linePointRef(pt, pt+patchAttraction[pointI]));
|
||||||
fpVertI++;
|
|
||||||
meshTools::writeOBJ(fpStr(), pt+patchAttraction[pointI]);
|
|
||||||
fpVertI++;
|
|
||||||
fpStr() << "l " << fpVertI-1 << ' ' << fpVertI << nl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1604,18 +1595,15 @@ void Foam::autoSnapDriver::determineFeatures
|
|||||||
List<pointConstraint>& patchConstraints
|
List<pointConstraint>& patchConstraints
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
autoPtr<OFstream> featureEdgeStr;
|
autoPtr<OBJstream> featureEdgeStr;
|
||||||
label featureEdgeVertI = 0;
|
autoPtr<OBJstream> missedEdgeStr;
|
||||||
autoPtr<OFstream> missedEdgeStr;
|
autoPtr<OBJstream> featurePointStr;
|
||||||
label missedVertI = 0;
|
|
||||||
autoPtr<OFstream> featurePointStr;
|
|
||||||
label featurePointVertI = 0;
|
|
||||||
|
|
||||||
if (debug&meshRefinement::OBJINTERSECTIONS)
|
if (debug&meshRefinement::OBJINTERSECTIONS)
|
||||||
{
|
{
|
||||||
featureEdgeStr.reset
|
featureEdgeStr.reset
|
||||||
(
|
(
|
||||||
new OFstream
|
new OBJstream
|
||||||
(
|
(
|
||||||
meshRefiner_.mesh().time().path()
|
meshRefiner_.mesh().time().path()
|
||||||
/ "featureEdge_" + name(iter) + ".obj"
|
/ "featureEdge_" + name(iter) + ".obj"
|
||||||
@ -1626,7 +1614,7 @@ void Foam::autoSnapDriver::determineFeatures
|
|||||||
|
|
||||||
missedEdgeStr.reset
|
missedEdgeStr.reset
|
||||||
(
|
(
|
||||||
new OFstream
|
new OBJstream
|
||||||
(
|
(
|
||||||
meshRefiner_.mesh().time().path()
|
meshRefiner_.mesh().time().path()
|
||||||
/ "missedFeatureEdge_" + name(iter) + ".obj"
|
/ "missedFeatureEdge_" + name(iter) + ".obj"
|
||||||
@ -1637,7 +1625,7 @@ void Foam::autoSnapDriver::determineFeatures
|
|||||||
|
|
||||||
featurePointStr.reset
|
featurePointStr.reset
|
||||||
(
|
(
|
||||||
new OFstream
|
new OBJstream
|
||||||
(
|
(
|
||||||
meshRefiner_.mesh().time().path()
|
meshRefiner_.mesh().time().path()
|
||||||
/ "featurePoint_" + name(iter) + ".obj"
|
/ "featurePoint_" + name(iter) + ".obj"
|
||||||
@ -1677,7 +1665,10 @@ void Foam::autoSnapDriver::determineFeatures
|
|||||||
if
|
if
|
||||||
(
|
(
|
||||||
(constraint.first() > patchConstraints[pointI].first())
|
(constraint.first() > patchConstraints[pointI].first())
|
||||||
|| (magSqr(attraction) < magSqr(patchAttraction[pointI]))
|
|| (
|
||||||
|
(constraint.first() == patchConstraints[pointI].first())
|
||||||
|
&& (magSqr(attraction) < magSqr(patchAttraction[pointI]))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
patchAttraction[pointI] = attraction;
|
patchAttraction[pointI] = attraction;
|
||||||
@ -1724,34 +1715,20 @@ void Foam::autoSnapDriver::determineFeatures
|
|||||||
// Dump
|
// Dump
|
||||||
if (featureEdgeStr.valid())
|
if (featureEdgeStr.valid())
|
||||||
{
|
{
|
||||||
meshTools::writeOBJ(featureEdgeStr(), pt);
|
featureEdgeStr().write
|
||||||
featureEdgeVertI++;
|
|
||||||
meshTools::writeOBJ
|
|
||||||
(
|
(
|
||||||
featureEdgeStr(),
|
linePointRef(pt, nearInfo.hitPoint())
|
||||||
nearInfo.hitPoint()
|
|
||||||
);
|
);
|
||||||
featureEdgeVertI++;
|
|
||||||
featureEdgeStr()
|
|
||||||
<< "l " << featureEdgeVertI-1 << ' '
|
|
||||||
<< featureEdgeVertI << nl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (missedEdgeStr.valid())
|
if (missedEdgeStr.valid())
|
||||||
{
|
{
|
||||||
meshTools::writeOBJ(missedEdgeStr(), pt);
|
missedEdgeStr().write
|
||||||
missedVertI++;
|
|
||||||
meshTools::writeOBJ
|
|
||||||
(
|
(
|
||||||
missedEdgeStr(),
|
linePointRef(pt, nearInfo.missPoint())
|
||||||
nearInfo.missPoint()
|
|
||||||
);
|
);
|
||||||
missedVertI++;
|
|
||||||
missedEdgeStr()
|
|
||||||
<< "l " << missedVertI-1 << ' '
|
|
||||||
<< missedVertI << nl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1788,34 +1765,20 @@ void Foam::autoSnapDriver::determineFeatures
|
|||||||
// Dump
|
// Dump
|
||||||
if (featureEdgeStr.valid())
|
if (featureEdgeStr.valid())
|
||||||
{
|
{
|
||||||
meshTools::writeOBJ(featureEdgeStr(), pt);
|
featureEdgeStr().write
|
||||||
featureEdgeVertI++;
|
|
||||||
meshTools::writeOBJ
|
|
||||||
(
|
(
|
||||||
featureEdgeStr(),
|
linePointRef(pt, nearInfo.hitPoint())
|
||||||
nearInfo.hitPoint()
|
|
||||||
);
|
);
|
||||||
featureEdgeVertI++;
|
|
||||||
featureEdgeStr()
|
|
||||||
<< "l " << featureEdgeVertI-1 << ' '
|
|
||||||
<< featureEdgeVertI << nl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (missedEdgeStr.valid())
|
if (missedEdgeStr.valid())
|
||||||
{
|
{
|
||||||
meshTools::writeOBJ(missedEdgeStr(), pt);
|
missedEdgeStr().write
|
||||||
missedVertI++;
|
|
||||||
meshTools::writeOBJ
|
|
||||||
(
|
(
|
||||||
missedEdgeStr(),
|
linePointRef(pt, nearInfo.missPoint())
|
||||||
nearInfo.missPoint()
|
|
||||||
);
|
);
|
||||||
missedVertI++;
|
|
||||||
missedEdgeStr()
|
|
||||||
<< "l " << missedVertI-1 << ' '
|
|
||||||
<< missedVertI << nl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1852,13 +1815,7 @@ void Foam::autoSnapDriver::determineFeatures
|
|||||||
const point& featPt =
|
const point& featPt =
|
||||||
shapes.points()[nearInfo.second()];
|
shapes.points()[nearInfo.second()];
|
||||||
|
|
||||||
meshTools::writeOBJ(featurePointStr(), pt);
|
featurePointStr().write(linePointRef(pt, featPt));
|
||||||
featurePointVertI++;
|
|
||||||
meshTools::writeOBJ(featurePointStr(), featPt);
|
|
||||||
featurePointVertI++;
|
|
||||||
featurePointStr()
|
|
||||||
<< "l " << featurePointVertI-1 << ' '
|
|
||||||
<< featurePointVertI << nl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2000,13 +1957,12 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges
|
|||||||
const scalar baffleFeatureCos = Foam::cos(degToRad(91));
|
const scalar baffleFeatureCos = Foam::cos(degToRad(91));
|
||||||
|
|
||||||
|
|
||||||
autoPtr<OFstream> baffleEdgeStr;
|
autoPtr<OBJstream> baffleEdgeStr;
|
||||||
label baffleEdgeVertI = 0;
|
|
||||||
if (debug&meshRefinement::OBJINTERSECTIONS)
|
if (debug&meshRefinement::OBJINTERSECTIONS)
|
||||||
{
|
{
|
||||||
baffleEdgeStr.reset
|
baffleEdgeStr.reset
|
||||||
(
|
(
|
||||||
new OFstream
|
new OBJstream
|
||||||
(
|
(
|
||||||
meshRefiner_.mesh().time().path()
|
meshRefiner_.mesh().time().path()
|
||||||
/ "baffleEdge_" + name(iter) + ".obj"
|
/ "baffleEdge_" + name(iter) + ".obj"
|
||||||
@ -2040,12 +1996,7 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges
|
|||||||
{
|
{
|
||||||
const point& p0 = pp.localPoints()[e[0]];
|
const point& p0 = pp.localPoints()[e[0]];
|
||||||
const point& p1 = pp.localPoints()[e[1]];
|
const point& p1 = pp.localPoints()[e[1]];
|
||||||
meshTools::writeOBJ(baffleEdgeStr(), p0);
|
baffleEdgeStr().write(linePointRef(p0, p1));
|
||||||
baffleEdgeVertI++;
|
|
||||||
meshTools::writeOBJ(baffleEdgeStr(), p1);
|
|
||||||
baffleEdgeVertI++;
|
|
||||||
baffleEdgeStr() << "l " << baffleEdgeVertI-1
|
|
||||||
<< ' ' << baffleEdgeVertI << nl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2226,6 +2177,22 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges
|
|||||||
{
|
{
|
||||||
const fvMesh& mesh = meshRefiner_.mesh();
|
const fvMesh& mesh = meshRefiner_.mesh();
|
||||||
|
|
||||||
|
//autoPtr<OBJstream> attractStr;
|
||||||
|
//if (debug&meshRefinement::OBJINTERSECTIONS)
|
||||||
|
//{
|
||||||
|
// attractStr.reset
|
||||||
|
// (
|
||||||
|
// new OBJstream
|
||||||
|
// (
|
||||||
|
// meshRefiner_.mesh().time().path()
|
||||||
|
// / "initAttract_" + name(iter) + ".obj"
|
||||||
|
// )
|
||||||
|
// );
|
||||||
|
// Info<< nl << "Dumping initial attract points to "
|
||||||
|
// << attractStr().name() << endl;
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
boolList isFeatureEdgeOrPoint(pp.nPoints(), false);
|
boolList isFeatureEdgeOrPoint(pp.nPoints(), false);
|
||||||
label nFeats = 0;
|
label nFeats = 0;
|
||||||
forAll(rawPatchConstraints, pointI)
|
forAll(rawPatchConstraints, pointI)
|
||||||
@ -2234,6 +2201,19 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges
|
|||||||
{
|
{
|
||||||
isFeatureEdgeOrPoint[pointI] = true;
|
isFeatureEdgeOrPoint[pointI] = true;
|
||||||
nFeats++;
|
nFeats++;
|
||||||
|
|
||||||
|
//if (attractStr.valid())
|
||||||
|
//{
|
||||||
|
// const point& pt = pp.localPoints()[pointI];
|
||||||
|
// attractStr().write
|
||||||
|
// (
|
||||||
|
// linePointRef
|
||||||
|
// (
|
||||||
|
// pt,
|
||||||
|
// pt+rawPatchAttraction[pointI]
|
||||||
|
// )
|
||||||
|
// );
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2254,6 +2234,8 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges
|
|||||||
|
|
||||||
for (label nGrow = 0; nGrow < 1; nGrow++)
|
for (label nGrow = 0; nGrow < 1; nGrow++)
|
||||||
{
|
{
|
||||||
|
boolList newIsFeatureEdgeOrPoint(isFeatureEdgeOrPoint);
|
||||||
|
|
||||||
forAll(pp.localFaces(), faceI)
|
forAll(pp.localFaces(), faceI)
|
||||||
{
|
{
|
||||||
const face& f = pp.localFaces()[faceI];
|
const face& f = pp.localFaces()[faceI];
|
||||||
@ -2265,12 +2247,15 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges
|
|||||||
// Mark all points on face
|
// Mark all points on face
|
||||||
forAll(f, fp)
|
forAll(f, fp)
|
||||||
{
|
{
|
||||||
isFeatureEdgeOrPoint[f[fp]] = true;
|
newIsFeatureEdgeOrPoint[f[fp]] = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isFeatureEdgeOrPoint = newIsFeatureEdgeOrPoint;
|
||||||
|
|
||||||
syncTools::syncPointList
|
syncTools::syncPointList
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
@ -2282,12 +2267,40 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//autoPtr<OBJstream> finalStr;
|
||||||
|
//if (debug&meshRefinement::OBJINTERSECTIONS)
|
||||||
|
//{
|
||||||
|
// finalStr.reset
|
||||||
|
// (
|
||||||
|
// new OBJstream
|
||||||
|
// (
|
||||||
|
// meshRefiner_.mesh().time().path()
|
||||||
|
// / "finalAttract_" + name(iter) + ".obj"
|
||||||
|
// )
|
||||||
|
// );
|
||||||
|
// Info<< nl << "Dumping final attract points to "
|
||||||
|
// << finalStr().name() << endl;
|
||||||
|
//}
|
||||||
|
|
||||||
// Collect attractPoints
|
// Collect attractPoints
|
||||||
forAll(isFeatureEdgeOrPoint, pointI)
|
forAll(isFeatureEdgeOrPoint, pointI)
|
||||||
{
|
{
|
||||||
if (isFeatureEdgeOrPoint[pointI])
|
if (isFeatureEdgeOrPoint[pointI])
|
||||||
{
|
{
|
||||||
attractPoints.append(pointI);
|
attractPoints.append(pointI);
|
||||||
|
|
||||||
|
//if (finalStr.valid())
|
||||||
|
//{
|
||||||
|
// const point& pt = pp.localPoints()[pointI];
|
||||||
|
// finalStr().write
|
||||||
|
// (
|
||||||
|
// linePointRef
|
||||||
|
// (
|
||||||
|
// pt,
|
||||||
|
// pt+rawPatchAttraction[pointI]
|
||||||
|
// )
|
||||||
|
// );
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2440,12 +2453,12 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges
|
|||||||
// (hopefully)
|
// (hopefully)
|
||||||
if (multiRegionFeatureSnap)
|
if (multiRegionFeatureSnap)
|
||||||
{
|
{
|
||||||
autoPtr<OFstream> multiPatchStr;
|
autoPtr<OBJstream> multiPatchStr;
|
||||||
if (debug&meshRefinement::OBJINTERSECTIONS)
|
if (debug&meshRefinement::OBJINTERSECTIONS)
|
||||||
{
|
{
|
||||||
multiPatchStr.reset
|
multiPatchStr.reset
|
||||||
(
|
(
|
||||||
new OFstream
|
new OBJstream
|
||||||
(
|
(
|
||||||
meshRefiner_.mesh().time().path()
|
meshRefiner_.mesh().time().path()
|
||||||
/ "multiPatch_" + name(iter) + ".obj"
|
/ "multiPatch_" + name(iter) + ".obj"
|
||||||
@ -2540,11 +2553,7 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges
|
|||||||
|
|
||||||
if (multiPatchStr.valid())
|
if (multiPatchStr.valid())
|
||||||
{
|
{
|
||||||
meshTools::writeOBJ
|
multiPatchStr().write(pp.localPoints()[pointI]);
|
||||||
(
|
|
||||||
multiPatchStr(),
|
|
||||||
pp.localPoints()[pointI]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2561,53 +2570,34 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges
|
|||||||
// Dump
|
// Dump
|
||||||
if (debug&meshRefinement::OBJINTERSECTIONS)
|
if (debug&meshRefinement::OBJINTERSECTIONS)
|
||||||
{
|
{
|
||||||
OFstream featureEdgeStr
|
OBJstream featureEdgeStr
|
||||||
(
|
(
|
||||||
meshRefiner_.mesh().time().path()
|
meshRefiner_.mesh().time().path()
|
||||||
/ "edgeAttractors_" + name(iter) + ".obj"
|
/ "edgeAttractors_" + name(iter) + ".obj"
|
||||||
);
|
);
|
||||||
label featureEdgeVertI = 0;
|
|
||||||
Pout<< "Dumping feature-edge attraction to "
|
Pout<< "Dumping feature-edge attraction to "
|
||||||
<< featureEdgeStr.name() << endl;
|
<< featureEdgeStr.name() << endl;
|
||||||
|
|
||||||
OFstream featurePointStr
|
OBJstream featurePointStr
|
||||||
(
|
(
|
||||||
meshRefiner_.mesh().time().path()
|
meshRefiner_.mesh().time().path()
|
||||||
/ "pointAttractors_" + name(iter) + ".obj"
|
/ "pointAttractors_" + name(iter) + ".obj"
|
||||||
);
|
);
|
||||||
label featurePointVertI = 0;
|
|
||||||
Pout<< "Dumping feature-point attraction to "
|
Pout<< "Dumping feature-point attraction to "
|
||||||
<< featurePointStr.name() << endl;
|
<< featurePointStr.name() << endl;
|
||||||
|
|
||||||
forAll(patchConstraints, pointI)
|
forAll(patchConstraints, pointI)
|
||||||
{
|
{
|
||||||
const point& pt = pp.localPoints()[pointI];
|
const point& pt = pp.localPoints()[pointI];
|
||||||
|
const vector& attr = patchAttraction[pointI];
|
||||||
|
|
||||||
if (patchConstraints[pointI].first() == 2)
|
if (patchConstraints[pointI].first() == 2)
|
||||||
{
|
{
|
||||||
meshTools::writeOBJ(featureEdgeStr, pt);
|
featureEdgeStr.write(linePointRef(pt, pt+attr));
|
||||||
featureEdgeVertI++;
|
|
||||||
meshTools::writeOBJ
|
|
||||||
(
|
|
||||||
featureEdgeStr,
|
|
||||||
pt+patchAttraction[pointI]
|
|
||||||
);
|
|
||||||
featureEdgeVertI++;
|
|
||||||
featureEdgeStr << "l " << featureEdgeVertI-1
|
|
||||||
<< ' ' << featureEdgeVertI << nl;
|
|
||||||
}
|
}
|
||||||
else if (patchConstraints[pointI].first() == 3)
|
else if (patchConstraints[pointI].first() == 3)
|
||||||
{
|
{
|
||||||
meshTools::writeOBJ(featurePointStr, pt);
|
featurePointStr.write(linePointRef(pt, pt+attr));
|
||||||
featurePointVertI++;
|
|
||||||
meshTools::writeOBJ
|
|
||||||
(
|
|
||||||
featurePointStr,
|
|
||||||
pt+patchAttraction[pointI]
|
|
||||||
);
|
|
||||||
featurePointVertI++;
|
|
||||||
featurePointStr << "l " << featurePointVertI-1
|
|
||||||
<< ' ' << featurePointVertI << nl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,8 +62,61 @@ License
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(meshRefinement, 0);
|
defineTypeNameAndDebug(meshRefinement, 0);
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const char* Foam::NamedEnum
|
||||||
|
<
|
||||||
|
Foam::meshRefinement::IOdebugType,
|
||||||
|
4
|
||||||
|
>::names[] =
|
||||||
|
{
|
||||||
|
"mesh",
|
||||||
|
//"scalarLevels",
|
||||||
|
"intersections",
|
||||||
|
"featureSeeds",
|
||||||
|
"layerInfo"
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const char* Foam::NamedEnum
|
||||||
|
<
|
||||||
|
Foam::meshRefinement::IOoutputType,
|
||||||
|
1
|
||||||
|
>::names[] =
|
||||||
|
{
|
||||||
|
"layerInfo"
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const char* Foam::NamedEnum
|
||||||
|
<
|
||||||
|
Foam::meshRefinement::IOwriteType,
|
||||||
|
4
|
||||||
|
>::names[] =
|
||||||
|
{
|
||||||
|
"mesh",
|
||||||
|
"scalarLevels",
|
||||||
|
"layerSets",
|
||||||
|
"layerFields"
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Foam::NamedEnum<Foam::meshRefinement::IOdebugType, 4>
|
||||||
|
Foam::meshRefinement::IOdebugTypeNames;
|
||||||
|
|
||||||
|
const Foam::NamedEnum<Foam::meshRefinement::IOoutputType, 1>
|
||||||
|
Foam::meshRefinement::IOoutputTypeNames;
|
||||||
|
|
||||||
|
const Foam::NamedEnum<Foam::meshRefinement::IOwriteType, 4>
|
||||||
|
Foam::meshRefinement::IOwriteTypeNames;
|
||||||
|
|
||||||
|
|
||||||
|
Foam::meshRefinement::writeType Foam::meshRefinement::writeLevel_;
|
||||||
|
|
||||||
|
Foam::meshRefinement::outputType Foam::meshRefinement::outputLevel_;
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::meshRefinement::calcNeighbourData
|
void Foam::meshRefinement::calcNeighbourData
|
||||||
@ -2728,23 +2781,48 @@ void Foam::meshRefinement::dumpIntersections(const fileName& prefix) const
|
|||||||
|
|
||||||
void Foam::meshRefinement::write
|
void Foam::meshRefinement::write
|
||||||
(
|
(
|
||||||
const label flag,
|
const debugType debugFlags,
|
||||||
|
const writeType writeFlags,
|
||||||
const fileName& prefix
|
const fileName& prefix
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (flag & MESH)
|
if (writeFlags & WRITEMESH)
|
||||||
{
|
{
|
||||||
write();
|
write();
|
||||||
}
|
}
|
||||||
if (flag & SCALARLEVELS)
|
if (writeFlags & WRITELEVELS)
|
||||||
{
|
{
|
||||||
dumpRefinementLevel();
|
dumpRefinementLevel();
|
||||||
}
|
}
|
||||||
if (flag & OBJINTERSECTIONS && prefix.size())
|
if (debugFlags & OBJINTERSECTIONS && prefix.size())
|
||||||
{
|
{
|
||||||
dumpIntersections(prefix);
|
dumpIntersections(prefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::meshRefinement::writeType Foam::meshRefinement::writeLevel()
|
||||||
|
{
|
||||||
|
return writeLevel_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::meshRefinement::writeLevel(const writeType flags)
|
||||||
|
{
|
||||||
|
writeLevel_ = flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::meshRefinement::outputType Foam::meshRefinement::outputLevel()
|
||||||
|
{
|
||||||
|
return outputLevel_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::meshRefinement::outputLevel(const outputType flags)
|
||||||
|
{
|
||||||
|
outputLevel_ = flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -85,16 +85,52 @@ public:
|
|||||||
|
|
||||||
// Public data types
|
// Public data types
|
||||||
|
|
||||||
//- Enumeration for debug dumping
|
//- Enumeration for what to debug
|
||||||
enum writeFlag
|
enum IOdebugType
|
||||||
{
|
{
|
||||||
MESH = 1,
|
IOMESH,
|
||||||
SCALARLEVELS = 2,
|
//IOSCALARLEVELS,
|
||||||
OBJINTERSECTIONS = 4,
|
IOOBJINTERSECTIONS,
|
||||||
FEATURESEEDS = 8,
|
IOFEATURESEEDS,
|
||||||
LAYERINFO = 16
|
IOLAYERINFO
|
||||||
|
};
|
||||||
|
static const NamedEnum<IOdebugType, 4> IOdebugTypeNames;
|
||||||
|
enum debugType
|
||||||
|
{
|
||||||
|
MESH = 1<<IOMESH,
|
||||||
|
//SCALARLEVELS = 1<<IOSCALARLEVELS,
|
||||||
|
OBJINTERSECTIONS = 1<<IOOBJINTERSECTIONS,
|
||||||
|
FEATURESEEDS = 1<<IOFEATURESEEDS,
|
||||||
|
LAYERINFO = 1<<IOLAYERINFO
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//- Enumeration for what to output
|
||||||
|
enum IOoutputType
|
||||||
|
{
|
||||||
|
IOOUTPUTLAYERINFO
|
||||||
|
};
|
||||||
|
static const NamedEnum<IOoutputType, 1> IOoutputTypeNames;
|
||||||
|
enum outputType
|
||||||
|
{
|
||||||
|
OUTPUTLAYERINFO = 1<<IOOUTPUTLAYERINFO
|
||||||
|
};
|
||||||
|
|
||||||
|
//- Enumeration for what to write
|
||||||
|
enum IOwriteType
|
||||||
|
{
|
||||||
|
IOWRITEMESH,
|
||||||
|
IOWRITELEVELS,
|
||||||
|
IOWRITELAYERSETS,
|
||||||
|
IOWRITELAYERFIELDS
|
||||||
|
};
|
||||||
|
static const NamedEnum<IOwriteType, 4> IOwriteTypeNames;
|
||||||
|
enum writeType
|
||||||
|
{
|
||||||
|
WRITEMESH = 1<<IOWRITEMESH,
|
||||||
|
WRITELEVELS = 1<<IOWRITELEVELS,
|
||||||
|
WRITELAYERSETS = 1<<IOWRITELAYERSETS,
|
||||||
|
WRITELAYERFIELDS = 1<<IOWRITELAYERFIELDS
|
||||||
|
};
|
||||||
|
|
||||||
//- Enumeration for how the userdata is to be mapped upon refinement.
|
//- Enumeration for how the userdata is to be mapped upon refinement.
|
||||||
enum mapType
|
enum mapType
|
||||||
@ -107,6 +143,15 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
// Static data members
|
||||||
|
|
||||||
|
//- Control of writing level
|
||||||
|
static writeType writeLevel_;
|
||||||
|
|
||||||
|
//- Control of output/log level
|
||||||
|
static outputType outputLevel_;
|
||||||
|
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Reference to mesh
|
//- Reference to mesh
|
||||||
@ -1007,9 +1052,13 @@ public:
|
|||||||
//- Debug: Write intersection information to OBJ format
|
//- Debug: Write intersection information to OBJ format
|
||||||
void dumpIntersections(const fileName& prefix) const;
|
void dumpIntersections(const fileName& prefix) const;
|
||||||
|
|
||||||
//- Do any one of above IO functions. flag is combination of
|
//- Do any one of above IO functions
|
||||||
// writeFlag values.
|
void write
|
||||||
void write(const label flag, const fileName&) const;
|
(
|
||||||
|
const debugType debugFlags,
|
||||||
|
const writeType writeFlags,
|
||||||
|
const fileName&
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Helper: calculate average
|
//- Helper: calculate average
|
||||||
template<class T>
|
template<class T>
|
||||||
@ -1030,6 +1079,21 @@ public:
|
|||||||
const UList<T>& values
|
const UList<T>& values
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Get/set write level
|
||||||
|
static writeType writeLevel();
|
||||||
|
static void writeLevel(const writeType);
|
||||||
|
|
||||||
|
//- Get/set output level
|
||||||
|
static outputType outputLevel();
|
||||||
|
static void outputLevel(const outputType);
|
||||||
|
|
||||||
|
|
||||||
|
//- Helper: convert wordList into bit pattern using provided
|
||||||
|
// NamedEnum
|
||||||
|
template<class Enum>
|
||||||
|
static int readFlags(const Enum& namedEnum, const wordList&);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -685,7 +685,7 @@ Foam::List<Foam::labelPair> Foam::meshRefinement::getDuplicateFaces
|
|||||||
<< " pairs of duplicate faces." << nl << endl;
|
<< " pairs of duplicate faces." << nl << endl;
|
||||||
|
|
||||||
|
|
||||||
if (debug&meshRefinement::MESH)
|
if (debug&MESH)
|
||||||
{
|
{
|
||||||
faceSet duplicateFaceSet(mesh_, "duplicateFaces", 2*dupI);
|
faceSet duplicateFaceSet(mesh_, "duplicateFaces", 2*dupI);
|
||||||
|
|
||||||
@ -790,12 +790,17 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createZoneBaffles
|
|||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug&meshRefinement::MESH)
|
if (debug&MESH)
|
||||||
{
|
{
|
||||||
const_cast<Time&>(mesh_.time())++;
|
const_cast<Time&>(mesh_.time())++;
|
||||||
Pout<< "Writing zone-baffled mesh to time " << timeName()
|
Pout<< "Writing zone-baffled mesh to time " << timeName()
|
||||||
<< endl;
|
<< endl;
|
||||||
write(debug, mesh_.time().path()/"baffles");
|
write
|
||||||
|
(
|
||||||
|
debugType(debug),
|
||||||
|
writeType(writeLevel() | WRITEMESH),
|
||||||
|
mesh_.time().path()/"baffles"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Info<< "Created " << nZoneFaces << " baffles in = "
|
Info<< "Created " << nZoneFaces << " baffles in = "
|
||||||
@ -1920,9 +1925,9 @@ void Foam::meshRefinement::handleSnapProblems
|
|||||||
Info<< "Analyzed problem cells in = "
|
Info<< "Analyzed problem cells in = "
|
||||||
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
|
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
|
||||||
|
|
||||||
if (debug&meshRefinement::MESH)
|
if (debug&MESH)
|
||||||
{
|
{
|
||||||
faceSet problemFaces(mesh_, "problemFaces", 100);
|
faceSet problemFaces(mesh_, "problemFaces", mesh_.nFaces()/100);
|
||||||
|
|
||||||
forAll(facePatch, faceI)
|
forAll(facePatch, faceI)
|
||||||
{
|
{
|
||||||
@ -1957,11 +1962,16 @@ void Foam::meshRefinement::handleSnapProblems
|
|||||||
|
|
||||||
printMeshInfo(debug, "After introducing baffles");
|
printMeshInfo(debug, "After introducing baffles");
|
||||||
|
|
||||||
if (debug&meshRefinement::MESH)
|
if (debug&MESH)
|
||||||
{
|
{
|
||||||
Pout<< "Writing extra baffled mesh to time "
|
Pout<< "Writing extra baffled mesh to time "
|
||||||
<< timeName() << endl;
|
<< timeName() << endl;
|
||||||
write(debug, runTime.path()/"extraBaffles");
|
write
|
||||||
|
(
|
||||||
|
debugType(debug),
|
||||||
|
writeType(writeLevel() | WRITEMESH),
|
||||||
|
runTime.path()/"extraBaffles"
|
||||||
|
);
|
||||||
Pout<< "Dumped debug data in = "
|
Pout<< "Dumped debug data in = "
|
||||||
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
|
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
|
||||||
}
|
}
|
||||||
@ -2519,11 +2529,16 @@ void Foam::meshRefinement::baffleAndSplitMesh
|
|||||||
|
|
||||||
printMeshInfo(debug, "After introducing baffles");
|
printMeshInfo(debug, "After introducing baffles");
|
||||||
|
|
||||||
if (debug&meshRefinement::MESH)
|
if (debug&MESH)
|
||||||
{
|
{
|
||||||
Pout<< "Writing baffled mesh to time " << timeName()
|
Pout<< "Writing baffled mesh to time " << timeName()
|
||||||
<< endl;
|
<< endl;
|
||||||
write(debug, runTime.path()/"baffles");
|
write
|
||||||
|
(
|
||||||
|
debugType(debug),
|
||||||
|
writeType(writeLevel() | WRITEMESH),
|
||||||
|
runTime.path()/"baffles"
|
||||||
|
);
|
||||||
Pout<< "Dumped debug data in = "
|
Pout<< "Dumped debug data in = "
|
||||||
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
|
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
|
||||||
}
|
}
|
||||||
@ -2575,11 +2590,16 @@ void Foam::meshRefinement::baffleAndSplitMesh
|
|||||||
|
|
||||||
printMeshInfo(debug, "After subsetting");
|
printMeshInfo(debug, "After subsetting");
|
||||||
|
|
||||||
if (debug&meshRefinement::MESH)
|
if (debug&MESH)
|
||||||
{
|
{
|
||||||
Pout<< "Writing subsetted mesh to time " << timeName()
|
Pout<< "Writing subsetted mesh to time " << timeName()
|
||||||
<< endl;
|
<< endl;
|
||||||
write(debug, runTime.path()/timeName());
|
write
|
||||||
|
(
|
||||||
|
debugType(debug),
|
||||||
|
writeType(writeLevel() | WRITEMESH),
|
||||||
|
runTime.path()/timeName()
|
||||||
|
);
|
||||||
Pout<< "Dumped debug data in = "
|
Pout<< "Dumped debug data in = "
|
||||||
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
|
<< runTime.cpuTimeIncrement() << " s\n" << nl << endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -593,7 +593,12 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
|
|||||||
mesh_.movePoints(newPoints);
|
mesh_.movePoints(newPoints);
|
||||||
Pout<< "Writing newPoints mesh to time " << timeName()
|
Pout<< "Writing newPoints mesh to time " << timeName()
|
||||||
<< endl;
|
<< endl;
|
||||||
write(debug, mesh_.time().path()/"newPoints");
|
write
|
||||||
|
(
|
||||||
|
debugType(debug),
|
||||||
|
writeType(writeLevel() | WRITEMESH),
|
||||||
|
mesh_.time().path()/"newPoints"
|
||||||
|
);
|
||||||
mesh_.movePoints(oldPoints);
|
mesh_.movePoints(oldPoints);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2253,9 +2253,9 @@ Foam::meshRefinement::refineAndBalance
|
|||||||
<< " mesh to time " << timeName() << endl;
|
<< " mesh to time " << timeName() << endl;
|
||||||
write
|
write
|
||||||
(
|
(
|
||||||
debug,
|
debugType(debug),
|
||||||
mesh_.time().path()
|
writeType(writeLevel() | WRITEMESH),
|
||||||
/timeName()
|
mesh_.time().path()/timeName()
|
||||||
);
|
);
|
||||||
Pout<< "Dumped debug data in = "
|
Pout<< "Dumped debug data in = "
|
||||||
<< mesh_.time().cpuTimeIncrement() << " s" << endl;
|
<< mesh_.time().cpuTimeIncrement() << " s" << endl;
|
||||||
@ -2317,7 +2317,8 @@ Foam::meshRefinement::refineAndBalance
|
|||||||
<< " mesh to time " << timeName() << endl;
|
<< " mesh to time " << timeName() << endl;
|
||||||
write
|
write
|
||||||
(
|
(
|
||||||
debug,
|
debugType(debug),
|
||||||
|
writeType(writeLevel() | WRITEMESH),
|
||||||
mesh_.time().path()/timeName()
|
mesh_.time().path()/timeName()
|
||||||
);
|
);
|
||||||
Pout<< "Dumped debug data in = "
|
Pout<< "Dumped debug data in = "
|
||||||
@ -2439,7 +2440,8 @@ Foam::meshRefinement::balanceAndRefine
|
|||||||
<< " mesh to time " << timeName() << endl;
|
<< " mesh to time " << timeName() << endl;
|
||||||
write
|
write
|
||||||
(
|
(
|
||||||
debug,
|
debugType(debug),
|
||||||
|
writeType(writeLevel() | WRITEMESH),
|
||||||
mesh_.time().path()/timeName()
|
mesh_.time().path()/timeName()
|
||||||
);
|
);
|
||||||
Pout<< "Dumped debug data in = "
|
Pout<< "Dumped debug data in = "
|
||||||
@ -2462,9 +2464,9 @@ Foam::meshRefinement::balanceAndRefine
|
|||||||
<< " mesh to time " << timeName() << endl;
|
<< " mesh to time " << timeName() << endl;
|
||||||
write
|
write
|
||||||
(
|
(
|
||||||
debug,
|
debugType(debug),
|
||||||
mesh_.time().path()
|
writeType(writeLevel() | WRITEMESH),
|
||||||
/timeName()
|
mesh_.time().path()/timeName()
|
||||||
);
|
);
|
||||||
Pout<< "Dumped debug data in = "
|
Pout<< "Dumped debug data in = "
|
||||||
<< mesh_.time().cpuTimeIncrement() << " s" << endl;
|
<< mesh_.time().cpuTimeIncrement() << " s" << endl;
|
||||||
|
|||||||
@ -315,6 +315,21 @@ void meshRefinement::reorderPatchFields(fvMesh& mesh, const labelList& oldToNew)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Enum>
|
||||||
|
int meshRefinement::readFlags(const Enum& namedEnum, const wordList& words)
|
||||||
|
{
|
||||||
|
int flags = 0;
|
||||||
|
|
||||||
|
forAll(words, i)
|
||||||
|
{
|
||||||
|
int index = namedEnum[words[i]];
|
||||||
|
int val = 1<<index;
|
||||||
|
flags |= val;
|
||||||
|
}
|
||||||
|
return flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|||||||
Reference in New Issue
Block a user