mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: preserve face point order for VTK
- less important for VTK (may help in future though) but preserve the face point 0 when flipping faces to ensure that the result is the same as having called face::reverseFace()
This commit is contained in:
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -497,7 +497,7 @@ void Foam::vtk::vtuSizing::populateArrays
|
|||||||
addPointsIds[nPointDecomp++] = celli;
|
addPointsIds[nPointDecomp++] = celli;
|
||||||
|
|
||||||
// Whether to insert cell in place of original or not.
|
// Whether to insert cell in place of original or not.
|
||||||
bool first = true;
|
bool firstCell = true;
|
||||||
|
|
||||||
const labelList& cFaces = mesh.cells()[celli];
|
const labelList& cFaces = mesh.cells()[celli];
|
||||||
|
|
||||||
@ -523,9 +523,9 @@ void Foam::vtk::vtuSizing::populateArrays
|
|||||||
constexpr label nShapePoints = 5; // pyr (5 vertices)
|
constexpr label nShapePoints = 5; // pyr (5 vertices)
|
||||||
|
|
||||||
label celLoc, vrtLoc;
|
label celLoc, vrtLoc;
|
||||||
if (first)
|
if (firstCell)
|
||||||
{
|
{
|
||||||
first = false;
|
firstCell = false;
|
||||||
celLoc = celli;
|
celLoc = celli;
|
||||||
vrtLoc = nVertLabels;
|
vrtLoc = nVertLabels;
|
||||||
nVertLabels += prefix + nShapePoints;
|
nVertLabels += prefix + nShapePoints;
|
||||||
@ -551,10 +551,10 @@ void Foam::vtk::vtuSizing::populateArrays
|
|||||||
// See note above about the orientation.
|
// See note above about the orientation.
|
||||||
if (isOwner)
|
if (isOwner)
|
||||||
{
|
{
|
||||||
|
vertLabels[vrtLoc++] = quad[0];
|
||||||
vertLabels[vrtLoc++] = quad[3];
|
vertLabels[vrtLoc++] = quad[3];
|
||||||
vertLabels[vrtLoc++] = quad[2];
|
vertLabels[vrtLoc++] = quad[2];
|
||||||
vertLabels[vrtLoc++] = quad[1];
|
vertLabels[vrtLoc++] = quad[1];
|
||||||
vertLabels[vrtLoc++] = quad[0];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -575,9 +575,9 @@ void Foam::vtk::vtuSizing::populateArrays
|
|||||||
constexpr label nShapePoints = 4; // tet (4 vertices)
|
constexpr label nShapePoints = 4; // tet (4 vertices)
|
||||||
|
|
||||||
label celLoc, vrtLoc;
|
label celLoc, vrtLoc;
|
||||||
if (first)
|
if (firstCell)
|
||||||
{
|
{
|
||||||
first = false;
|
firstCell = false;
|
||||||
celLoc = celli;
|
celLoc = celli;
|
||||||
vrtLoc = nVertLabels;
|
vrtLoc = nVertLabels;
|
||||||
nVertLabels += prefix + nShapePoints;
|
nVertLabels += prefix + nShapePoints;
|
||||||
@ -603,9 +603,9 @@ void Foam::vtk::vtuSizing::populateArrays
|
|||||||
// See note above about the orientation.
|
// See note above about the orientation.
|
||||||
if (isOwner)
|
if (isOwner)
|
||||||
{
|
{
|
||||||
|
vertLabels[vrtLoc++] = tria[0];
|
||||||
vertLabels[vrtLoc++] = tria[2];
|
vertLabels[vrtLoc++] = tria[2];
|
||||||
vertLabels[vrtLoc++] = tria[1];
|
vertLabels[vrtLoc++] = tria[1];
|
||||||
vertLabels[vrtLoc++] = tria[0];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -633,7 +633,7 @@ void Foam::vtk::vtuSizing::populateArrays
|
|||||||
|
|
||||||
if (output == contentType::LEGACY)
|
if (output == contentType::LEGACY)
|
||||||
{
|
{
|
||||||
faceOutput[startLabel] = 0; // placeholder for size
|
faceOutput[startLabel] = 0; // placeholder for total size
|
||||||
++faceIndexer;
|
++faceIndexer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -643,24 +643,24 @@ void Foam::vtk::vtuSizing::populateArrays
|
|||||||
{
|
{
|
||||||
const face& f = mesh.faces()[facei];
|
const face& f = mesh.faces()[facei];
|
||||||
const bool isOwner = (owner[facei] == celli);
|
const bool isOwner = (owner[facei] == celli);
|
||||||
|
const label nFacePoints = f.size();
|
||||||
|
|
||||||
hashUniqId.insert(f);
|
hashUniqId.insert(f);
|
||||||
|
|
||||||
// The number of labels for this face
|
// The number of labels for this face
|
||||||
faceOutput[faceIndexer++] = f.size();
|
faceOutput[faceIndexer++] = nFacePoints;
|
||||||
|
|
||||||
|
faceOutput[faceIndexer++] = f[0];
|
||||||
if (isOwner)
|
if (isOwner)
|
||||||
{
|
{
|
||||||
forAll(f, fp)
|
for (label fp = 1; fp < nFacePoints; ++fp)
|
||||||
{
|
{
|
||||||
faceOutput[faceIndexer++] = f[fp];
|
faceOutput[faceIndexer++] = f[fp];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// fairly immaterial if we reverse the list
|
for (label fp = nFacePoints - 1; fp > 0; --fp)
|
||||||
// or use face::reverseFace()
|
|
||||||
forAllReverse(f, fp)
|
|
||||||
{
|
{
|
||||||
faceOutput[faceIndexer++] = f[fp];
|
faceOutput[faceIndexer++] = f[fp];
|
||||||
}
|
}
|
||||||
@ -684,10 +684,9 @@ void Foam::vtk::vtuSizing::populateArrays
|
|||||||
vertLabels[nVertLabels++] = hashUniqId.size();
|
vertLabels[nVertLabels++] = hashUniqId.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
const labelList uniq = hashUniqId.sortedToc();
|
for (const label pointi : hashUniqId.sortedToc())
|
||||||
for (const label fpi : uniq)
|
|
||||||
{
|
{
|
||||||
vertLabels[nVertLabels++] = fpi;
|
vertLabels[nVertLabels++] = pointi;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -726,7 +725,7 @@ void Foam::vtk::vtuSizing::populateArrays
|
|||||||
|
|
||||||
for (LabelType& off : faceOffset)
|
for (LabelType& off : faceOffset)
|
||||||
{
|
{
|
||||||
const auto sz = off;
|
const LabelType sz(off);
|
||||||
if (sz > 0)
|
if (sz > 0)
|
||||||
{
|
{
|
||||||
prev += sz;
|
prev += sz;
|
||||||
@ -745,7 +744,7 @@ void Foam::vtk::vtuSizing::populateArrays
|
|||||||
|
|
||||||
for (LabelType& off : vertOffset)
|
for (LabelType& off : vertOffset)
|
||||||
{
|
{
|
||||||
const auto sz = off;
|
const LabelType sz(off);
|
||||||
off = beg;
|
off = beg;
|
||||||
beg += 1 + sz; // Additional 1 to skip embedded prefix
|
beg += 1 + sz; // Additional 1 to skip embedded prefix
|
||||||
}
|
}
|
||||||
@ -758,7 +757,7 @@ void Foam::vtk::vtuSizing::populateArrays
|
|||||||
|
|
||||||
for (LabelType& off : faceOffset)
|
for (LabelType& off : faceOffset)
|
||||||
{
|
{
|
||||||
const auto sz = off;
|
const LabelType sz(off);
|
||||||
if (sz > 0)
|
if (sz > 0)
|
||||||
{
|
{
|
||||||
off = beg;
|
off = beg;
|
||||||
@ -782,7 +781,7 @@ void Foam::vtk::vtuSizing::populateArrays
|
|||||||
|
|
||||||
for (LabelType& off : vertOffset)
|
for (LabelType& off : vertOffset)
|
||||||
{
|
{
|
||||||
const auto sz = off;
|
const LabelType sz(off);
|
||||||
off = total;
|
off = total;
|
||||||
total += sz;
|
total += sz;
|
||||||
}
|
}
|
||||||
@ -795,7 +794,7 @@ void Foam::vtk::vtuSizing::populateArrays
|
|||||||
|
|
||||||
for (LabelType& off : faceOffset)
|
for (LabelType& off : faceOffset)
|
||||||
{
|
{
|
||||||
const auto sz = off;
|
const LabelType sz(off);
|
||||||
if (sz > 0)
|
if (sz > 0)
|
||||||
{
|
{
|
||||||
off = beg;
|
off = beg;
|
||||||
|
|||||||
Reference in New Issue
Block a user