mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -475,7 +475,7 @@ int main(int argc, char *argv[])
|
||||
{-1, -1, -1, -1, -1, -1}, // 1
|
||||
{-1, -1, -1, -1, -1, -1}, // 2
|
||||
{-1, -1, -1, -1, -1, -1}, // 3
|
||||
{-1, 2, 0, 3, 1, -1}, // tet (version 2.0)
|
||||
{ 3, 2, 0, -1, 1, -1}, // tet (version 2.0)
|
||||
{ 0, 4, 3, -1, 2, 1}, // prism
|
||||
{ 4, 2, 1, 3, 0, 5}, // hex
|
||||
};
|
||||
@ -500,12 +500,14 @@ int main(int argc, char *argv[])
|
||||
++cellIter, ++faceIter
|
||||
)
|
||||
{
|
||||
const cellShape& shape = cellShapes[cellMap[cellIter()]];
|
||||
|
||||
patchFaces.append
|
||||
(
|
||||
cellShapes[cellMap[cellIter()] ].faces()
|
||||
shape.faces()
|
||||
[
|
||||
faceIndex
|
||||
[cellShapes[cellMap[cellIter()] ].nFaces()]
|
||||
[shape.nFaces()]
|
||||
[faceIter()-1]
|
||||
]
|
||||
);
|
||||
|
||||
@ -46,10 +46,10 @@ class cellSets
|
||||
{
|
||||
public:
|
||||
|
||||
label nHexesWedges;
|
||||
label nPrisms;
|
||||
label nPyrs;
|
||||
label nTets;
|
||||
label nPyrs;
|
||||
label nPrisms;
|
||||
label nHexesWedges;
|
||||
label nPolys;
|
||||
|
||||
labelList tets;
|
||||
@ -57,6 +57,7 @@ public:
|
||||
labelList prisms;
|
||||
labelList wedges;
|
||||
labelList hexes;
|
||||
labelList hexesWedges;
|
||||
labelList polys;
|
||||
|
||||
|
||||
@ -65,10 +66,10 @@ public:
|
||||
//- Construct given the number ov cells
|
||||
cellSets(const label nCells)
|
||||
:
|
||||
nHexesWedges(0),
|
||||
nPrisms(0),
|
||||
nPyrs(0),
|
||||
nTets(0),
|
||||
nPyrs(0),
|
||||
nPrisms(0),
|
||||
nHexesWedges(0),
|
||||
nPolys(0),
|
||||
|
||||
tets(nCells),
|
||||
@ -76,6 +77,7 @@ public:
|
||||
prisms(nCells),
|
||||
wedges(nCells),
|
||||
hexes(nCells),
|
||||
hexesWedges(nCells),
|
||||
polys(nCells)
|
||||
{}
|
||||
};
|
||||
|
||||
@ -94,6 +94,11 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual bool ascii() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void write(const char* c)
|
||||
{
|
||||
str_ << c << nl;
|
||||
|
||||
@ -90,6 +90,11 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual bool ascii() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void write(const char* val)
|
||||
{
|
||||
char buffer[80] = {0};
|
||||
|
||||
@ -32,68 +32,21 @@ License
|
||||
#include "volPointInterpolation.H"
|
||||
#include "ensightBinaryStream.H"
|
||||
#include "ensightAsciiStream.H"
|
||||
#include "globalIndex.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
scalarField map
|
||||
(
|
||||
const Field<Type>& vf,
|
||||
const labelList& map,
|
||||
const label cmpt
|
||||
)
|
||||
{
|
||||
scalarField mf(map.size());
|
||||
|
||||
forAll(map, i)
|
||||
{
|
||||
mf[i] = component(vf[map[i]], cmpt);
|
||||
}
|
||||
|
||||
return mf;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
scalarField map
|
||||
(
|
||||
const Field<Type>& vf,
|
||||
const labelList& map1,
|
||||
const labelList& map2,
|
||||
const label cmpt
|
||||
)
|
||||
{
|
||||
scalarField mf(map1.size() + map2.size());
|
||||
|
||||
forAll(map1, i)
|
||||
{
|
||||
mf[i] = component(vf[map1[i]], cmpt);
|
||||
}
|
||||
|
||||
label offset = map1.size();
|
||||
|
||||
forAll(map2, i)
|
||||
{
|
||||
mf[i + offset] = component(vf[map2[i]], cmpt);
|
||||
}
|
||||
|
||||
return mf;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void writeAllData
|
||||
void writeField
|
||||
(
|
||||
const char* key,
|
||||
const Field<Type>& vf,
|
||||
const labelList& prims,
|
||||
const label nPrims,
|
||||
ensightStream& ensightFile
|
||||
)
|
||||
{
|
||||
if (nPrims)
|
||||
if (returnReduce(vf.size(), sumOp<label>()) > 0)
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
@ -101,8 +54,7 @@ void writeAllData
|
||||
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
scalarField masterData(map(vf, prims, cmpt));
|
||||
ensightFile.write(masterData);
|
||||
ensightFile.write(vf.component(cmpt));
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
@ -117,48 +69,7 @@ void writeAllData
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< map(vf, prims, cmpt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void writeAllFaceData
|
||||
(
|
||||
const char* key,
|
||||
const labelList& prims,
|
||||
const label nPrims,
|
||||
const Field<Type>& pf,
|
||||
ensightStream& ensightFile
|
||||
)
|
||||
{
|
||||
if (nPrims)
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
ensightFile.write(key);
|
||||
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
ensightFile.write(map(pf, prims, cmpt));
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
scalarField pf(fromSlave);
|
||||
|
||||
ensightFile.write(pf);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< map(pf, prims, cmpt);
|
||||
toMaster<< vf.component(cmpt);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -183,30 +94,24 @@ bool writePatchField
|
||||
ensightFile.writePartHeader(ensightPatchI);
|
||||
}
|
||||
|
||||
writeAllFaceData
|
||||
writeField
|
||||
(
|
||||
"tria3",
|
||||
boundaryFaceSet.tris,
|
||||
nfp.nTris,
|
||||
pf,
|
||||
Field<Type>(pf, boundaryFaceSet.tris),
|
||||
ensightFile
|
||||
);
|
||||
|
||||
writeAllFaceData
|
||||
writeField
|
||||
(
|
||||
"quad4",
|
||||
boundaryFaceSet.quads,
|
||||
nfp.nQuads,
|
||||
pf,
|
||||
Field<Type>(pf, boundaryFaceSet.quads),
|
||||
ensightFile
|
||||
);
|
||||
|
||||
writeAllFaceData
|
||||
writeField
|
||||
(
|
||||
"nsided",
|
||||
boundaryFaceSet.polys,
|
||||
nfp.nPolys,
|
||||
pf,
|
||||
Field<Type>(pf, boundaryFaceSet.polys),
|
||||
ensightFile
|
||||
);
|
||||
|
||||
@ -369,8 +274,7 @@ void ensightField
|
||||
const labelList& tets = meshCellSets.tets;
|
||||
const labelList& pyrs = meshCellSets.pyrs;
|
||||
const labelList& prisms = meshCellSets.prisms;
|
||||
const labelList& wedges = meshCellSets.wedges;
|
||||
const labelList& hexes = meshCellSets.hexes;
|
||||
const labelList& hexesWedges = meshCellSets.hexesWedges;
|
||||
const labelList& polys = meshCellSets.polys;
|
||||
|
||||
ensightStream* ensightFilePtr = NULL;
|
||||
@ -421,68 +325,38 @@ void ensightField
|
||||
ensightFile.writePartHeader(1);
|
||||
}
|
||||
|
||||
if (meshCellSets.nHexesWedges)
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
ensightFile.write("hexa8");
|
||||
writeField
|
||||
(
|
||||
"hexa8",
|
||||
Field<Type>(vf, hexesWedges),
|
||||
ensightFile
|
||||
);
|
||||
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
scalarField masterData(map(vf, hexes, wedges, cmpt));
|
||||
ensightFile.write(masterData);
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
scalarField data(fromSlave);
|
||||
ensightFile.write(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< map(vf, hexes, wedges, cmpt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
writeAllData
|
||||
writeField
|
||||
(
|
||||
"penta6",
|
||||
vf,
|
||||
prisms,
|
||||
meshCellSets.nPrisms,
|
||||
Field<Type>(vf, prisms),
|
||||
ensightFile
|
||||
);
|
||||
|
||||
writeAllData
|
||||
writeField
|
||||
(
|
||||
"pyramid5",
|
||||
vf,
|
||||
pyrs,
|
||||
meshCellSets.nPyrs,
|
||||
Field<Type>(vf, pyrs),
|
||||
ensightFile
|
||||
);
|
||||
|
||||
writeAllData
|
||||
writeField
|
||||
(
|
||||
"tetra4",
|
||||
vf,
|
||||
tets,
|
||||
meshCellSets.nTets,
|
||||
Field<Type>(vf, tets),
|
||||
ensightFile
|
||||
);
|
||||
|
||||
writeAllData
|
||||
writeField
|
||||
(
|
||||
"nfaced",
|
||||
vf,
|
||||
polys,
|
||||
meshCellSets.nPolys,
|
||||
Field<Type>(vf, polys),
|
||||
ensightFile
|
||||
);
|
||||
}
|
||||
@ -611,6 +485,12 @@ void ensightPointField
|
||||
|
||||
word timeFile = prepend + itoa(timeIndex);
|
||||
|
||||
const fvMesh& mesh = eMesh.mesh();
|
||||
const wordList& allPatchNames = eMesh.allPatchNames();
|
||||
const wordHashSet& patchNames = eMesh.patchNames();
|
||||
const wordHashSet& faceZoneNames = eMesh.faceZoneNames();
|
||||
|
||||
|
||||
ensightStream* ensightFilePtr = NULL;
|
||||
if (Pstream::master())
|
||||
{
|
||||
@ -622,7 +502,7 @@ void ensightPointField
|
||||
ensightFilePtr = new ensightBinaryStream
|
||||
(
|
||||
postProcPath/ensightFileName,
|
||||
eMesh.mesh().time()
|
||||
mesh.time()
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -630,7 +510,7 @@ void ensightPointField
|
||||
ensightFilePtr = new ensightAsciiStream
|
||||
(
|
||||
postProcPath/ensightFileName,
|
||||
eMesh.mesh().time()
|
||||
mesh.time()
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -656,39 +536,112 @@ void ensightPointField
|
||||
}
|
||||
|
||||
ensightFile.write(pTraits<Type>::typeName);
|
||||
ensightFile.write("part");
|
||||
ensightFile.write(1);
|
||||
ensightFile.writePartHeader(1);
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
ensightFile.write("coordinates");
|
||||
|
||||
Field<Type> uniqueFld(pf.internalField(), eMesh.uniquePointMap());
|
||||
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
ensightFile.write(uniqueFld.component(cmpt));
|
||||
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
scalarField data(fromSlave);
|
||||
ensightFile.write(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Field<Type> uniqueFld(pf.internalField(), eMesh.uniquePointMap());
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< uniqueFld.component(cmpt);
|
||||
}
|
||||
}
|
||||
writeField
|
||||
(
|
||||
"coordinates",
|
||||
Field<Type>(pf.internalField(), eMesh.uniquePointMap()),
|
||||
ensightFile
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
label ensightPatchI = eMesh.patchPartOffset();
|
||||
|
||||
forAll(allPatchNames, patchi)
|
||||
{
|
||||
const word& patchName = allPatchNames[patchi];
|
||||
|
||||
eMesh.barrier();
|
||||
|
||||
if (patchNames.empty() || patchNames.found(patchName))
|
||||
{
|
||||
const fvPatch& p = mesh.boundary()[patchi];
|
||||
if
|
||||
(
|
||||
returnReduce(p.size(), sumOp<label>())
|
||||
> 0
|
||||
)
|
||||
{
|
||||
// Renumber the patch points/faces into unique points
|
||||
labelList pointToGlobal;
|
||||
labelList uniqueMeshPointLabels;
|
||||
autoPtr<globalIndex> globalPointsPtr =
|
||||
mesh.globalData().mergePoints
|
||||
(
|
||||
p.patch().meshPoints(),
|
||||
p.patch().meshPointMap(),
|
||||
pointToGlobal,
|
||||
uniqueMeshPointLabels
|
||||
);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
ensightFile.writePartHeader(ensightPatchI);
|
||||
}
|
||||
|
||||
writeField
|
||||
(
|
||||
"coordinates",
|
||||
Field<Type>(pf.internalField(), uniqueMeshPointLabels),
|
||||
ensightFile
|
||||
);
|
||||
|
||||
ensightPatchI++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// write faceZones, if requested
|
||||
if (faceZoneNames.size())
|
||||
{
|
||||
forAllConstIter(wordHashSet, faceZoneNames, iter)
|
||||
{
|
||||
const word& faceZoneName = iter.key();
|
||||
|
||||
eMesh.barrier();
|
||||
|
||||
label zoneID = mesh.faceZones().findZoneID(faceZoneName);
|
||||
|
||||
const faceZone& fz = mesh.faceZones()[zoneID];
|
||||
|
||||
if (returnReduce(fz().nPoints(), sumOp<label>()) > 0)
|
||||
{
|
||||
// Renumber the faceZone points/faces into unique points
|
||||
labelList pointToGlobal;
|
||||
labelList uniqueMeshPointLabels;
|
||||
autoPtr<globalIndex> globalPointsPtr =
|
||||
mesh.globalData().mergePoints
|
||||
(
|
||||
fz().meshPoints(),
|
||||
fz().meshPointMap(),
|
||||
pointToGlobal,
|
||||
uniqueMeshPointLabels
|
||||
);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
ensightFile.writePartHeader(ensightPatchI);
|
||||
}
|
||||
|
||||
writeField
|
||||
(
|
||||
"coordinates",
|
||||
Field<Type>
|
||||
(
|
||||
pf.internalField(),
|
||||
uniqueMeshPointLabels
|
||||
),
|
||||
ensightFile
|
||||
);
|
||||
|
||||
ensightPatchI++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
delete ensightFilePtr;
|
||||
|
||||
@ -35,7 +35,6 @@ SourceFiles
|
||||
#define ensightField_H
|
||||
|
||||
#include "ensightMesh.H"
|
||||
#include "HashSet.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -48,6 +47,7 @@ void ensightField
|
||||
const Foam::word& prepend,
|
||||
const Foam::label timeIndex,
|
||||
const bool binary,
|
||||
const bool nodeValues,
|
||||
Foam::Ostream& ensightCaseFile
|
||||
);
|
||||
|
||||
|
||||
@ -114,6 +114,7 @@ void Foam::ensightMesh::correct()
|
||||
labelList& prisms = meshCellSets_.prisms;
|
||||
labelList& wedges = meshCellSets_.wedges;
|
||||
labelList& hexes = meshCellSets_.hexes;
|
||||
labelList& hexesWedges = meshCellSets_.hexesWedges;
|
||||
labelList& polys = meshCellSets_.polys;
|
||||
|
||||
label nTets = 0;
|
||||
@ -121,6 +122,7 @@ void Foam::ensightMesh::correct()
|
||||
label nPrisms = 0;
|
||||
label nWedges = 0;
|
||||
label nHexes = 0;
|
||||
label nHexesWedges = 0;
|
||||
label nPolys = 0;
|
||||
|
||||
forAll(cellShapes, cellI)
|
||||
@ -143,10 +145,12 @@ void Foam::ensightMesh::correct()
|
||||
else if (cellModel == wedge)
|
||||
{
|
||||
wedges[nWedges++] = cellI;
|
||||
hexesWedges[nHexesWedges++] = cellI;
|
||||
}
|
||||
else if (cellModel == hex)
|
||||
{
|
||||
hexes[nHexes++] = cellI;
|
||||
hexesWedges[nHexesWedges++] = cellI;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -170,7 +174,7 @@ void Foam::ensightMesh::correct()
|
||||
meshCellSets_.nPrisms = nPrisms;
|
||||
reduce(meshCellSets_.nPrisms, sumOp<label>());
|
||||
|
||||
meshCellSets_.nHexesWedges = nHexes + nWedges;
|
||||
meshCellSets_.nHexesWedges = nHexesWedges;
|
||||
reduce(meshCellSets_.nHexesWedges, sumOp<label>());
|
||||
|
||||
meshCellSets_.nPolys = nPolys;
|
||||
@ -508,23 +512,43 @@ void Foam::ensightMesh::writePrims
|
||||
// Create a temp int array
|
||||
if (cellShapes.size())
|
||||
{
|
||||
// All the cellShapes have the same number of elements!
|
||||
int numIntElem = cellShapes.size()*cellShapes[0].size();
|
||||
List<int> temp(numIntElem);
|
||||
|
||||
int n = 0;
|
||||
|
||||
forAll(cellShapes, i)
|
||||
if (ensightGeometryFile.ascii())
|
||||
{
|
||||
const cellShape& cellPoints = cellShapes[i];
|
||||
// Workaround for paraview issue : write one cell per line
|
||||
|
||||
forAll(cellPoints, pointI)
|
||||
forAll(cellShapes, i)
|
||||
{
|
||||
temp[n] = cellPoints[pointI] + 1;
|
||||
n++;
|
||||
const cellShape& cellPoints = cellShapes[i];
|
||||
|
||||
List<int> temp(cellPoints.size());
|
||||
|
||||
forAll(cellPoints, pointI)
|
||||
{
|
||||
temp[pointI] = cellPoints[pointI] + 1;
|
||||
}
|
||||
ensightGeometryFile.write(temp);
|
||||
}
|
||||
}
|
||||
ensightGeometryFile.write(temp);
|
||||
else
|
||||
{
|
||||
// All the cellShapes have the same number of elements!
|
||||
int numIntElem = cellShapes.size()*cellShapes[0].size();
|
||||
List<int> temp(numIntElem);
|
||||
|
||||
int n = 0;
|
||||
|
||||
forAll(cellShapes, i)
|
||||
{
|
||||
const cellShape& cellPoints = cellShapes[i];
|
||||
|
||||
forAll(cellPoints, pointI)
|
||||
{
|
||||
temp[n] = cellPoints[pointI] + 1;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
ensightGeometryFile.write(temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -86,6 +86,8 @@ public:
|
||||
return name_;
|
||||
}
|
||||
|
||||
virtual bool ascii() const = 0;
|
||||
|
||||
virtual void write(const char*) = 0;
|
||||
|
||||
virtual void write(const int) = 0;
|
||||
|
||||
@ -82,9 +82,8 @@ bool Foam::dlLibraryTable::open(const fileName& functionLibName)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!loadedLibraries.found(functionLibPtr))
|
||||
if (loadedLibraries.insert(functionLibPtr, functionLibName))
|
||||
{
|
||||
loadedLibraries.insert(functionLibPtr, functionLibName);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
@ -27,7 +27,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::scalar Foam::polyMeshTetDecomposition::minTetQuality = 1e-12;
|
||||
// Note: the use of this tolerance is ad-hoc, there may be extreme
|
||||
// cases where the resulting tetrahedra still have particle tracking
|
||||
// problems.
|
||||
const Foam::scalar Foam::polyMeshTetDecomposition::minTetQuality = SMALL;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
Reference in New Issue
Block a user