Commit be692131 authored by Franjo's avatar Franjo
Browse files

Merge branch 'enhancement-refinementThicknessLocalRefinement' into developmentPublicRepo

parents e67cbb7f e9caf4f8
......@@ -47,8 +47,7 @@ meshOctreeCreator::meshOctreeCreator(meshOctree& mo)
meshDictPtr_(NULL),
hexRefinement_(false),
globalRefLevel_(0),
surfRefLevel_(mo.surface().size(), direction(0)),
surfRefThickness_(mo.surface().size(), 0.0)
surfRefLevel_(mo.surface().size())
{}
meshOctreeCreator::meshOctreeCreator
......@@ -62,8 +61,7 @@ meshOctreeCreator::meshOctreeCreator
meshDictPtr_(&dict),
hexRefinement_(false),
globalRefLevel_(0),
surfRefLevel_(mo.surface().size(), direction(0)),
surfRefThickness_(mo.surface().size(), 0.0)
surfRefLevel_(mo.surface().size())
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
......
......@@ -109,10 +109,7 @@ private:
direction globalRefLevel_;
//- this list contains ref level for each surface triangle
List<direction> surfRefLevel_;
//- refinement thickness for each surface triangle
scalarList surfRefThickness_;
List<DynList<std::pair<direction, scalar> > > surfRefLevel_;
//- set the boundBox such that maxCellSize is achieved
void setRootCubeSizeAndRefParameters();
......
......@@ -94,31 +94,49 @@ void meshOctreeCreator::refineBoundary()
oc.slotPtr()->containedTriangles_;
bool refine(false);
direction minRequestedLevel(255);
scalar maxThicknessForLevel(0.0);
forAllRow(containedTriangles, elRowI, tI)
{
const label triI = containedTriangles(elRowI, tI);
DynList<std::pair<direction, scalar> >& refRequests =
surfRefLevel_[triI];
if( surfRefLevel_[triI] > oc.level() )
forAllReverse(refRequests, i)
{
refine = true;
}
if( surfRefThickness_[triI] > VSMALL )
{
useNLayers = true;
const std::pair<direction, scalar>& rp = refRequests[i];
if( rp.first <= oc.level() )
{
continue;
}
rThickness[leafI] =
Foam::max
(
rThickness[leafI],
surfRefThickness_[triI]
);
if( rp.first < minRequestedLevel )
{
refine = true;
minRequestedLevel = rp.first;
maxThicknessForLevel = rp.second;
}
else if
(
(rp.first == minRequestedLevel) &&
(rp.second > maxThicknessForLevel)
)
{
maxThicknessForLevel = rp.second;
}
}
}
if( refine )
{
refineCubes[leafI] = 1;
if( maxThicknessForLevel > VSMALL )
{
rThickness[leafI] = maxThicknessForLevel;
useNLayers = true;
}
changed = true;
}
}
......
......@@ -114,7 +114,9 @@ void meshOctreeCreator::setRootCubeSizeAndRefParameters()
octreeModifier.isRootInitialisedAccess() = true;
surfRefLevel_ = globalRefLevel_;
//surfRefLevel_ = globalRefLevel_;
forAll(surfRefLevel_, triI)
surfRefLevel_[triI].append(std::make_pair(globalRefLevel_, 0.0));
//- set other refinement parameters
//- set boundary ref level
......@@ -156,6 +158,7 @@ void meshOctreeCreator::setRootCubeSizeAndRefParameters()
Info << "Requested boundary cell size corresponds to octree level "
<< label(boundaryRefLevel_) << endl;
scalar thickness(0.0);
if( meshDictPtr_->found("boundaryCellSizeRefinementThickness") )
{
const scalar s =
......@@ -163,10 +166,12 @@ void meshOctreeCreator::setRootCubeSizeAndRefParameters()
(
meshDictPtr_->lookup("boundaryCellSizeRefinementThickness")
);
surfRefThickness_ = mag(s);
thickness = mag(s);
}
surfRefLevel_ = boundaryRefLevel_;
forAll(surfRefLevel_, triI)
surfRefLevel_[triI][0] =
std::make_pair(boundaryRefLevel_, thickness);
}
//- set patch-wise ref levels
......@@ -241,13 +246,12 @@ void meshOctreeCreator::setRootCubeSizeAndRefParameters()
reduce(addLevel, maxOp<label>());
const direction level = globalRefLevel_ + addLevel;
std::pair<direction, scalar> pp(level, 0.0);
forAll(surface, triI)
{
if(
(surface[triI].region() == regionI) &&
(surfRefLevel_[triI] < level)
)
surfRefLevel_[triI] = level;
if( surface[triI].region() == regionI )
surfRefLevel_[triI].append(pp);
}
}
}
......@@ -322,9 +326,10 @@ void meshOctreeCreator::setRootCubeSizeAndRefParameters()
labelLongList subsetFaces;
surface.facetsInSubset(subsetID, subsetFaces);
const direction level = globalRefLevel_ + addLevel;
const std::pair<direction, scalar> pp(level, 0.0);
forAll(subsetFaces, tI)
if( surfRefLevel_[subsetFaces[tI]] < level )
surfRefLevel_[subsetFaces[tI]] = level;
surfRefLevel_[subsetFaces[tI]].append(pp);
}
}
......@@ -399,6 +404,8 @@ void meshOctreeCreator::setRootCubeSizeAndRefParameters()
const labelList matchedPatches = surface.findPatches(pName);
std::pair<direction, scalar> rp(level, refinementThickness);
forAll(matchedPatches, matchI)
{
//- patch-based refinement
......@@ -408,14 +415,7 @@ void meshOctreeCreator::setRootCubeSizeAndRefParameters()
{
if( surface[triI].region() == patchI )
{
surfRefLevel_[triI] =
Foam::max(surfRefLevel_[triI], level);
surfRefThickness_[triI] =
Foam::max
(
surfRefThickness_[triI],
refinementThickness
);
surfRefLevel_[triI].append(rp);
}
}
}
......@@ -430,15 +430,7 @@ void meshOctreeCreator::setRootCubeSizeAndRefParameters()
forAll(facetsInSubset, i)
{
const label triI = facetsInSubset[i];
surfRefLevel_[triI] =
Foam::max(surfRefLevel_[triI], level);
surfRefThickness_[triI] =
Foam::max
(
surfRefThickness_[triI],
refinementThickness
);
surfRefLevel_[triI].append(rp);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment