mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: foamyHexMesh: Better reading of Delaunay meshes
This commit is contained in:
@ -55,6 +55,8 @@ Foam::DelaunayMesh<Triangulation>::DelaunayMesh
|
||||
cellCount_(0),
|
||||
runTime_(runTime)
|
||||
{
|
||||
Info<< "Reading " << meshName << " from " << runTime.timeName() << endl;
|
||||
|
||||
pointIOField pts
|
||||
(
|
||||
IOobject
|
||||
@ -109,42 +111,35 @@ Foam::DelaunayMesh<Triangulation>::DelaunayMesh
|
||||
|
||||
if (pts.headerOk())
|
||||
{
|
||||
forAll(pts, ptI)
|
||||
List<Vb> pointsToInsert(pts.size());
|
||||
|
||||
forAll(pointsToInsert, pI)
|
||||
{
|
||||
Vertex_handle vh = this->insert(toPoint(pts[ptI]));
|
||||
|
||||
if (indices.headerOk())
|
||||
{
|
||||
vh->index() = indices[ptI];
|
||||
vertexCount_++;
|
||||
}
|
||||
else
|
||||
{
|
||||
vh->index() = getNewVertexIndex();
|
||||
}
|
||||
|
||||
if (processorIndices.headerOk())
|
||||
{
|
||||
vh->procIndex() = processorIndices[ptI];
|
||||
}
|
||||
else
|
||||
{
|
||||
vh->procIndex() = Pstream::myProcNo();
|
||||
}
|
||||
|
||||
if (types.headerOk())
|
||||
{
|
||||
vh->type() =
|
||||
static_cast<Foam::indexedVertexEnum::vertexType>
|
||||
pointsToInsert[pI] =
|
||||
Vb
|
||||
(
|
||||
toPoint(pts[pI]),
|
||||
(indices.headerOk() ? indices[pI] : -1),
|
||||
(
|
||||
types[ptI]
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
vh->type() = Vb::vtUnassigned;
|
||||
}
|
||||
types.headerOk()
|
||||
? static_cast<indexedVertexEnum::vertexType>(types[pI])
|
||||
: Vb::vtInternal
|
||||
),
|
||||
(
|
||||
processorIndices.headerOk()
|
||||
? processorIndices[pI]
|
||||
: Pstream::myProcNo()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
rangeInsertWithInfo
|
||||
(
|
||||
pointsToInsert.begin(),
|
||||
pointsToInsert.end(),
|
||||
false,
|
||||
false
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -282,7 +277,8 @@ void Foam::DelaunayMesh<Triangulation>::rangeInsertWithInfo
|
||||
(
|
||||
PointIterator begin,
|
||||
PointIterator end,
|
||||
bool printErrors
|
||||
bool printErrors,
|
||||
bool reIndex
|
||||
)
|
||||
{
|
||||
typedef DynamicList
|
||||
@ -342,7 +338,14 @@ void Foam::DelaunayMesh<Triangulation>::rangeInsertWithInfo
|
||||
}
|
||||
else
|
||||
{
|
||||
hint->index() = getNewVertexIndex();
|
||||
if (reIndex)
|
||||
{
|
||||
hint->index() = getNewVertexIndex();
|
||||
}
|
||||
else
|
||||
{
|
||||
hint->index() = vert.index();
|
||||
}
|
||||
hint->type() = vert.type();
|
||||
hint->procIndex() = vert.procIndex();
|
||||
hint->targetCellSize() = vert.targetCellSize();
|
||||
|
||||
@ -241,7 +241,8 @@ public:
|
||||
(
|
||||
PointIterator begin,
|
||||
PointIterator end,
|
||||
bool printErrors = false
|
||||
bool printErrors = false,
|
||||
bool reIndex = true
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -425,7 +425,6 @@ Foam::cellShapeControlMesh::cellShapeControlMesh(const Time& runTime)
|
||||
&& alignments.size() == this->vertexCount()
|
||||
)
|
||||
{
|
||||
label count = 0;
|
||||
for
|
||||
(
|
||||
Finite_vertices_iterator vit = finite_vertices_begin();
|
||||
@ -433,9 +432,8 @@ Foam::cellShapeControlMesh::cellShapeControlMesh(const Time& runTime)
|
||||
++vit
|
||||
)
|
||||
{
|
||||
vit->targetCellSize() = sizes[count];
|
||||
vit->alignment() = alignments[count];
|
||||
count++;
|
||||
vit->targetCellSize() = sizes[vit->index()];
|
||||
vit->alignment() = alignments[vit->index()];
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -60,7 +60,10 @@ pointFile::pointFile
|
||||
),
|
||||
pointFileName_(detailsDict().lookup("pointFile")),
|
||||
insideOutsideCheck_(detailsDict().lookup("insideOutsideCheck"))
|
||||
{}
|
||||
{
|
||||
Info<< " Inside/Outside check is " << insideOutsideCheck_.asText()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
@ -38,6 +38,7 @@ SourceFiles
|
||||
|
||||
#include "fileName.H"
|
||||
#include "pointIOField.H"
|
||||
#include "Switch.H"
|
||||
#include "initialPointsMethod.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -62,7 +63,7 @@ private:
|
||||
fileName pointFileName_;
|
||||
|
||||
//- Check if inserted points are inside or outside
|
||||
bool insideOutsideCheck_;
|
||||
Switch insideOutsideCheck_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user