mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Insert background cell size mesh using the cell size functions
This commit is contained in:
@ -156,6 +156,8 @@ public:
|
||||
|
||||
// Query
|
||||
|
||||
virtual label maxPriority() const = 0;
|
||||
|
||||
virtual void cellSizeFunctionVertices
|
||||
(
|
||||
DynamicList<Foam::point>& pts,
|
||||
|
||||
@ -72,9 +72,11 @@ Foam::fileControl::fileControl
|
||||
),
|
||||
pointsFile_(controlFunctionDict.lookup("pointsFile")),
|
||||
sizesFile_(controlFunctionDict.lookup("sizesFile")),
|
||||
alignmentsFile_(controlFunctionDict.lookup("alignmentsFile"))
|
||||
alignmentsFile_(controlFunctionDict.lookup("alignmentsFile")),
|
||||
maxPriority_(readLabel(controlFunctionDict.lookup("priority")))
|
||||
{
|
||||
Info<< indent << "Loading " << name << " from file:" << nl
|
||||
<< indent << " priority : " << maxPriority_ << nl
|
||||
<< indent << " points : " << pointsFile_ << nl
|
||||
<< indent << " sizes : " << sizesFile_ << nl
|
||||
<< indent << " alignments : " << alignmentsFile_
|
||||
|
||||
@ -58,6 +58,8 @@ class fileControl
|
||||
|
||||
const fileName alignmentsFile_;
|
||||
|
||||
label maxPriority_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -112,6 +114,11 @@ public:
|
||||
// ) const;
|
||||
|
||||
|
||||
virtual label maxPriority() const
|
||||
{
|
||||
return maxPriority_;
|
||||
}
|
||||
|
||||
// Edit
|
||||
|
||||
virtual void cellSizeFunctionVertices
|
||||
|
||||
@ -245,6 +245,8 @@ void Foam::controlMeshRefinement::initialMeshPopulation
|
||||
// );
|
||||
}
|
||||
|
||||
Map<label> priorityMap;
|
||||
|
||||
const PtrList<cellSizeAndAlignmentControl>& controlFunctions =
|
||||
sizeControls_.controlFunctions();
|
||||
|
||||
@ -377,13 +379,24 @@ void Foam::controlMeshRefinement::initialMeshPopulation
|
||||
|
||||
if (forceInsertion || insertPoint)
|
||||
{
|
||||
mesh_.insert
|
||||
const label oldSize = mesh_.vertexCount();
|
||||
|
||||
cellShapeControlMesh::Vertex_handle insertedVert = mesh_.insert
|
||||
(
|
||||
pt,
|
||||
calculatedCellSize,
|
||||
vertices[vI].alignment(),
|
||||
Vb::vtInternalNearBoundary
|
||||
);
|
||||
|
||||
if (oldSize == mesh_.vertexCount() - 1)
|
||||
{
|
||||
priorityMap.insert
|
||||
(
|
||||
insertedVert->index(),
|
||||
controlFunction.maxPriority()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -506,6 +519,30 @@ void Foam::controlMeshRefinement::initialMeshPopulation
|
||||
|
||||
if (forceInsertion || insertPoint)
|
||||
{
|
||||
// Check the priority
|
||||
|
||||
cellShapeControlMesh::Cell_handle ch =
|
||||
mesh_.locate(toPoint<cellShapeControlMesh::Point>(pt));
|
||||
|
||||
const label newPtPriority = controlFunction.maxPriority();
|
||||
|
||||
label highestPriority = -1;
|
||||
for (label cI = 0; cI < 4; ++cI)
|
||||
{
|
||||
const label vertPriority =
|
||||
priorityMap[ch->vertex(cI)->index()];
|
||||
|
||||
if (vertPriority > highestPriority)
|
||||
{
|
||||
highestPriority = vertPriority;
|
||||
}
|
||||
}
|
||||
|
||||
if (newPtPriority >= highestPriority)
|
||||
{
|
||||
const label oldSize = mesh_.vertexCount();
|
||||
|
||||
cellShapeControlMesh::Vertex_handle insertedVert =
|
||||
mesh_.insert
|
||||
(
|
||||
pt,
|
||||
@ -513,12 +550,22 @@ void Foam::controlMeshRefinement::initialMeshPopulation
|
||||
vertices[vI].alignment(),
|
||||
Vb::vtInternal
|
||||
);
|
||||
|
||||
if (oldSize == mesh_.vertexCount() - 1)
|
||||
{
|
||||
priorityMap.insert
|
||||
(
|
||||
insertedVert->index(),
|
||||
newPtPriority
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//mesh_.rangeInsertWithInfo(vertices.begin(), vertices.end());
|
||||
|
||||
Info<< " Inserted "
|
||||
Info<< " Inserted extra points "
|
||||
<< returnReduce
|
||||
(
|
||||
label(mesh_.number_of_vertices()) - preInsertedSize,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
Reference in New Issue
Block a user