GIT: Initial state after latest Foundation merge

This commit is contained in:
Andrew Heather
2016-09-20 14:49:08 +01:00
4571 changed files with 115696 additions and 74609 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -83,9 +83,9 @@ int main(int argc, char *argv[])
// Writing number of faces
label nFaces = mesh.nFaces();
forAll(mesh.boundary(), patchI)
forAll(mesh.boundary(), patchi)
{
nFaces += mesh.boundary()[patchI].size();
nFaces += mesh.boundary()[patchi].size();
}
fluentDataFile

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -45,22 +45,22 @@ void writeFluentField
Ostream& stream
)
{
const scalarField& phiInternal = phi.internalField();
const scalarField& phiInternal = phi;
// Writing cells
stream
<< "(300 ("
<< fluentFieldIdentifier << " " // Field identifier
<< "1 " // Zone ID: (cells=1, internal faces=2,
// patch faces=patchI+10)
// patch faces=patchi+10)
<< "1 " // Number of components (scalar=1, vector=3)
<< "0 0 " // Unused
<< "1 " << phiInternal.size() // Start and end of list
<< ")(" << endl;
forAll(phiInternal, cellI)
forAll(phiInternal, celli)
{
stream << phiInternal[cellI] << endl;
stream << phiInternal[celli] << endl;
}
stream
@ -69,23 +69,23 @@ void writeFluentField
label nWrittenFaces = phiInternal.size();
// Writing boundary faces
forAll(phi.boundaryField(), patchI)
forAll(phi.boundaryField(), patchi)
{
if (isType<emptyFvPatchScalarField>(phi.boundaryField()[patchI]))
if (isType<emptyFvPatchScalarField>(phi.boundaryField()[patchi]))
{
// Form empty patch field repeat the internal field to
// allow for the node interpolation in Fluent
const scalarField& phiInternal = phi.internalField();
const scalarField& phiInternal = phi;
// Get reference to internal cells
const labelList emptyFaceCells =
phi.boundaryField()[patchI].patch().patch().faceCells();
phi.boundaryField()[patchi].patch().patch().faceCells();
// Writing cells for empty patch
stream
<< "(300 ("
<< fluentFieldIdentifier << " " // Field identifier
<< patchI + 10 << " " // Zone ID: patchI+10
<< patchi + 10 << " " // Zone ID: patchi+10
<< "1 " // Number of components (scalar=1, vector=3)
<< "0 0 " // Unused
<< nWrittenFaces + 1 << " "
@ -94,9 +94,9 @@ void writeFluentField
nWrittenFaces += emptyFaceCells.size();
forAll(emptyFaceCells, faceI)
forAll(emptyFaceCells, facei)
{
stream << phiInternal[emptyFaceCells[faceI]] << endl;
stream << phiInternal[emptyFaceCells[facei]] << endl;
}
stream
@ -107,13 +107,13 @@ void writeFluentField
// Regular patch
label nWrittenFaces = phiInternal.size();
const scalarField& patchPhi = phi.boundaryField()[patchI];
const scalarField& patchPhi = phi.boundaryField()[patchi];
// Write header
stream
<< "(300 ("
<< fluentFieldIdentifier << " " // Field identifier
<< patchI + 10 << " " // Zone ID: patchI+10
<< patchi + 10 << " " // Zone ID: patchi+10
<< "1 " // Number of components (scalar=1, vector=3)
<< "0 0 " // Unused
<< nWrittenFaces + 1 << " " << nWrittenFaces + patchPhi.size()
@ -122,9 +122,9 @@ void writeFluentField
nWrittenFaces += patchPhi.size();
forAll(patchPhi, faceI)
forAll(patchPhi, facei)
{
stream << patchPhi[faceI] << endl;
stream << patchPhi[facei] << endl;
}
stream

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -44,25 +44,25 @@ void writeFluentField
Ostream& stream
)
{
const vectorField& phiInternal = phi.internalField();
const vectorField& phiInternal = phi;
// Writing cells
stream
<< "(300 ("
<< fluentFieldIdentifier << " " // Field identifier
<< "1 " // Zone ID: (cells=1, internal faces=2,
// patch faces=patchI+10)
// patch faces=patchi+10)
<< "3 " // Number of components (scalar=1, vector=3)
<< "0 0 " // Unused
<< "1 " << phiInternal.size() // Start and end of list
<< ")(" << endl;
forAll(phiInternal, cellI)
forAll(phiInternal, celli)
{
stream
<< phiInternal[cellI].x() << " "
<< phiInternal[cellI].y() << " "
<< phiInternal[cellI].z() << " "
<< phiInternal[celli].x() << " "
<< phiInternal[celli].y() << " "
<< phiInternal[celli].z() << " "
<< endl;
}
@ -72,15 +72,15 @@ void writeFluentField
label nWrittenFaces = phiInternal.size();
// Writing boundary faces
forAll(phi.boundaryField(), patchI)
forAll(phi.boundaryField(), patchi)
{
const vectorField& patchPhi = phi.boundaryField()[patchI];
const vectorField& patchPhi = phi.boundaryField()[patchi];
// Write header
stream
<< "(300 ("
<< fluentFieldIdentifier << " " // Field identifier
<< patchI + 10 << " " // Zone ID: patchI+10
<< patchi + 10 << " " // Zone ID: patchi+10
<< "3 " // Number of components (scalar=1, vector=3)
<< "0 0 " // Unused
<< nWrittenFaces + 1 << " " << nWrittenFaces + patchPhi.size()
@ -89,12 +89,12 @@ void writeFluentField
nWrittenFaces += patchPhi.size();
forAll(patchPhi, faceI)
forAll(patchPhi, facei)
{
stream
<< patchPhi[faceI].x() << " "
<< patchPhi[faceI].y() << " "
<< patchPhi[faceI].z() << " "
<< patchPhi[facei].x() << " "
<< patchPhi[facei].y() << " "
<< patchPhi[facei].z() << " "
<< endl;
}

View File

@ -1,5 +1,4 @@
EXE_INC = \
/* -DFULLDEBUG -g -O0 */ \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
@ -8,10 +7,8 @@ EXE_INC = \
-I$(LIB_SRC)/lagrangian/basic/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools \
-ldynamicMesh \
-lfileFormats \
-lsampling \
-lgenericPatchFields \
-llagrangian

View File

@ -217,7 +217,7 @@ bool writePatchField
(
const Field<Type>& pf,
const label patchi,
const label ensightPatchI,
const label ensightPatchi,
const faceSets& boundaryFaceSet,
const ensightMesh::nFacePrimitives& nfp,
ensightStream& ensightFile
@ -227,7 +227,7 @@ bool writePatchField
{
if (Pstream::master())
{
ensightFile.writePartHeader(ensightPatchI);
ensightFile.writePartHeader(ensightPatchi);
}
writeField
@ -281,7 +281,7 @@ void writePatchField
const HashTable<ensightMesh::nFacePrimitives>&
nPatchPrims = eMesh.nPatchPrims();
label ensightPatchI = eMesh.patchPartOffset();
label ensightPatchi = eMesh.patchPartOffset();
label patchi = -1;
@ -292,7 +292,7 @@ void writePatchField
patchi = i;
break;
}
ensightPatchI++;
ensightPatchi++;
}
@ -300,7 +300,7 @@ void writePatchField
word timeFile = prepend + itoa(timeIndex);
ensightStream* ensightFilePtr = NULL;
ensightStream* ensightFilePtr = nullptr;
if (Pstream::master())
{
if (timeIndex == 0)
@ -349,7 +349,7 @@ void writePatchField
(
pf,
patchi,
ensightPatchI,
ensightPatchi,
boundaryFaceSets[patchi],
nPatchPrims.find(patchName)(),
ensightFile
@ -363,7 +363,7 @@ void writePatchField
(
Field<Type>(),
-1,
ensightPatchI,
ensightPatchi,
nullFaceSets,
nPatchPrims.find(patchName)(),
ensightFile
@ -414,7 +414,7 @@ void ensightField
const labelList& hexes = meshCellSets.hexes;
const labelList& polys = meshCellSets.polys;
ensightStream* ensightFilePtr = NULL;
ensightStream* ensightFilePtr = nullptr;
if (Pstream::master())
{
// set the filename of the ensight file
@ -502,7 +502,7 @@ void ensightField
);
}
label ensightPatchI = eMesh.patchPartOffset();
label ensightPatchi = eMesh.patchPartOffset();
forAll(allPatchNames, patchi)
{
@ -518,14 +518,14 @@ void ensightField
(
vf.boundaryField()[patchi],
patchi,
ensightPatchI,
ensightPatchi,
boundaryFaceSets[patchi],
nPatchPrims.find(patchName)(),
ensightFile
)
)
{
ensightPatchI++;
ensightPatchi++;
}
}
}
@ -566,20 +566,20 @@ void ensightField
label j = 0;
forAll(fz, i)
{
label faceI = fz[i];
if (mesh.isInternalFace(faceI))
label facei = fz[i];
if (mesh.isInternalFace(facei))
{
values[j] = sf[faceI];
values[j] = sf[facei];
++j;
}
else
{
if (eMesh.faceToBeIncluded(faceI))
if (eMesh.faceToBeIncluded(facei))
{
label patchI = mesh.boundaryMesh().whichPatch(faceI);
const polyPatch& pp = mesh.boundaryMesh()[patchI];
label patchFaceI = pp.whichFace(faceI);
Type value = sf.boundaryField()[patchI][patchFaceI];
label patchi = mesh.boundaryMesh().whichPatch(facei);
const polyPatch& pp = mesh.boundaryMesh()[patchi];
label patchFacei = pp.whichFace(facei);
Type value = sf.boundaryField()[patchi][patchFacei];
values[j] = value;
++j;
}
@ -592,14 +592,14 @@ void ensightField
(
values,
zoneID,
ensightPatchI,
ensightPatchi,
faceZoneFaceSets[zoneID],
nFaceZonePrims.find(faceZoneName)(),
ensightFile
)
)
{
ensightPatchI++;
ensightPatchi++;
}
}
}
@ -632,7 +632,7 @@ void ensightPointField
const wordHashSet& faceZoneNames = eMesh.faceZoneNames();
ensightStream* ensightFilePtr = NULL;
ensightStream* ensightFilePtr = nullptr;
if (Pstream::master())
{
// set the filename of the ensight file
@ -687,13 +687,13 @@ void ensightPointField
writeField
(
"coordinates",
Field<Type>(pf.internalField(), eMesh.uniquePointMap()),
Field<Type>(pf.primitiveField(), eMesh.uniquePointMap()),
ensightFile
);
}
label ensightPatchI = eMesh.patchPartOffset();
label ensightPatchi = eMesh.patchPartOffset();
forAll(allPatchNames, patchi)
{
@ -724,17 +724,17 @@ void ensightPointField
if (Pstream::master())
{
ensightFile.writePartHeader(ensightPatchI);
ensightFile.writePartHeader(ensightPatchi);
}
writeField
(
"coordinates",
Field<Type>(pf.internalField(), uniqueMeshPointLabels),
Field<Type>(pf.primitiveField(), uniqueMeshPointLabels),
ensightFile
);
ensightPatchI++;
ensightPatchi++;
}
}
}
@ -768,7 +768,7 @@ void ensightPointField
if (Pstream::master())
{
ensightFile.writePartHeader(ensightPatchI);
ensightFile.writePartHeader(ensightPatchi);
}
writeField
@ -776,13 +776,13 @@ void ensightPointField
"coordinates",
Field<Type>
(
pf.internalField(),
pf.primitiveField(),
uniqueMeshPointLabels
),
ensightFile
);
ensightPatchI++;
ensightPatchi++;
}
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -131,34 +131,34 @@ void Foam::ensightMesh::correct()
label nHexes = 0;
label nPolys = 0;
forAll(cellShapes, cellI)
forAll(cellShapes, celli)
{
const cellShape& cellShape = cellShapes[cellI];
const cellShape& cellShape = cellShapes[celli];
const cellModel& cellModel = cellShape.model();
if (cellModel == tet)
{
tets[nTets++] = cellI;
tets[nTets++] = celli;
}
else if (cellModel == pyr)
{
pyrs[nPyrs++] = cellI;
pyrs[nPyrs++] = celli;
}
else if (cellModel == prism)
{
prisms[nPrisms++] = cellI;
prisms[nPrisms++] = celli;
}
else if (cellModel == wedge)
{
wedges[nWedges++] = cellI;
wedges[nWedges++] = celli;
}
else if (cellModel == hex)
{
hexes[nHexes++] = cellI;
hexes[nHexes++] = celli;
}
else
{
polys[nPolys++] = cellI;
polys[nPolys++] = celli;
}
}
@ -213,21 +213,21 @@ void Foam::ensightMesh::correct()
label nQuads = 0;
label nPolys = 0;
forAll(p, faceI)
forAll(p, facei)
{
const face& f = p[faceI];
const face& f = p[facei];
if (f.size() == 3)
{
tris[nTris++] = faceI;
tris[nTris++] = facei;
}
else if (f.size() == 4)
{
quads[nQuads++] = faceI;
quads[nQuads++] = facei;
}
else
{
polys[nPolys++] = faceI;
polys[nPolys++] = facei;
}
}
@ -286,19 +286,19 @@ void Foam::ensightMesh::correct()
1
);
forAll(mesh_.boundaryMesh(), patchI)
forAll(mesh_.boundaryMesh(), patchi)
{
const polyPatch& pp = mesh_.boundaryMesh()[patchI];
const polyPatch& pp = mesh_.boundaryMesh()[patchi];
if
(
isA<processorPolyPatch>(pp)
&& !refCast<const processorPolyPatch>(pp).owner()
)
{
label bFaceI = pp.start()-mesh_.nInternalFaces();
label bFacei = pp.start()-mesh_.nInternalFaces();
forAll(pp, i)
{
boundaryFaceToBeIncluded_[bFaceI++] = 0;
boundaryFaceToBeIncluded_[bFacei++] = 0;
}
}
}
@ -329,12 +329,12 @@ void Foam::ensightMesh::correct()
forAll(fz, i)
{
label faceI = fz[i];
label facei = fz[i];
// Avoid counting faces on processor boundaries twice
if (faceToBeIncluded(faceI))
if (faceToBeIncluded(facei))
{
const face& f = mesh_.faces()[faceI];
const face& f = mesh_.faces()[facei];
if (f.size() == 3)
{
@ -427,17 +427,17 @@ Foam::ensightMesh::~ensightMesh()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::ensightMesh::faceToBeIncluded(const label faceI) const
bool Foam::ensightMesh::faceToBeIncluded(const label facei) const
{
bool res = false;
if (mesh_.isInternalFace(faceI))
if (mesh_.isInternalFace(facei))
{
res = true;
}
else
{
res = boundaryFaceToBeIncluded_[faceI-mesh_.nInternalFaces()];
res = boundaryFaceToBeIncluded_[facei-mesh_.nInternalFaces()];
}
return res;
@ -531,9 +531,9 @@ void Foam::ensightMesh::writePrims
List<int> temp(cellPoints.size());
forAll(cellPoints, pointI)
forAll(cellPoints, pointi)
{
temp[pointI] = cellPoints[pointI] + 1;
temp[pointi] = cellPoints[pointi] + 1;
}
ensightGeometryFile.write(temp);
}
@ -550,9 +550,9 @@ void Foam::ensightMesh::writePrims
{
const cellShape& cellPoints = cellShapes[i];
forAll(cellPoints, pointI)
forAll(cellPoints, pointi)
{
temp[n] = cellPoints[pointI] + 1;
temp[n] = cellPoints[pointi] + 1;
n++;
}
}
@ -588,9 +588,9 @@ void Foam::ensightMesh::writePolysNPointsPerFace
{
const labelList& cf = cellFaces[polys[i]];
forAll(cf, faceI)
forAll(cf, facei)
{
ensightGeometryFile.write(faces[cf[faceI]].size());
ensightGeometryFile.write(faces[cf[facei]].size());
}
}
}
@ -609,9 +609,9 @@ void Foam::ensightMesh::writePolysPoints
{
const labelList& cf = cellFaces[polys[i]];
forAll(cf, faceI)
forAll(cf, facei)
{
const label faceId = cf[faceI];
const label faceId = cf[facei];
const face& f = faces[faceId]; // points of face (in global points)
const label np = f.size();
bool reverseOrder = false;
@ -641,15 +641,15 @@ void Foam::ensightMesh::writePolysPoints
// EnSight prefers to have all the faces of an nfaced cell
// oriented in the same way.
List<int> temp(np);
forAll(f, pointI)
forAll(f, pointi)
{
if (reverseOrder)
{
temp[np-1-pointI] = f[pointI] + 1;
temp[np-1-pointi] = f[pointi] + 1;
}
else
{
temp[pointI] = f[pointI] + 1;
temp[pointi] = f[pointi] + 1;
}
}
ensightGeometryFile.write(temp);
@ -835,9 +835,9 @@ void Foam::ensightMesh::writeFacePrims
const face& patchFace = patchFaces[i];
List<int> temp(patchFace.size());
forAll(patchFace, pointI)
forAll(patchFace, pointi)
{
temp[pointI] = patchFace[pointI] + 1;
temp[pointi] = patchFace[pointi] + 1;
}
ensightGeometryFile.write(temp);
@ -1043,7 +1043,7 @@ void Foam::ensightMesh::write
// set the filename of the ensight file
fileName ensightGeometryFileName = timeFile + "mesh";
ensightStream* ensightGeometryFilePtr = NULL;
ensightStream* ensightGeometryFilePtr = nullptr;
if (Pstream::master())
{
if (binary_)
@ -1138,7 +1138,7 @@ void Foam::ensightMesh::write
}
label ensightPatchI = patchPartOffset_;
label ensightPatchi = patchPartOffset_;
forAll(allPatchNames_, patchi)
{
@ -1178,7 +1178,7 @@ void Foam::ensightMesh::write
writeAllPoints
(
ensightPatchI++,
ensightPatchi++,
patchName,
uniquePoints,
globalPointsPtr().size(),
@ -1253,9 +1253,9 @@ void Foam::ensightMesh::write
// a better way of doing this?
label nMasterFaces = 0;
forAll(fz, faceI)
forAll(fz, facei)
{
if (faceToBeIncluded(fz[faceI]))
if (faceToBeIncluded(fz[facei]))
{
++nMasterFaces;
}
@ -1266,11 +1266,11 @@ void Foam::ensightMesh::write
label currentFace = 0;
forAll(fz, faceI)
forAll(fz, facei)
{
if (faceToBeIncluded(fz[faceI]))
if (faceToBeIncluded(fz[facei]))
{
faceZoneMasterFaces[currentFace] = faceZoneFaces[faceI];
faceZoneMasterFaces[currentFace] = faceZoneFaces[facei];
++currentFace;
}
}
@ -1283,7 +1283,7 @@ void Foam::ensightMesh::write
writeAllPoints
(
ensightPatchI++,
ensightPatchi++,
faceZoneName,
uniquePoints,
globalPointsPtr().size(),

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -361,7 +361,7 @@ public:
//- When exporting faceZones, check if a given face has to be included
// or not (i.e. faces on processor boundaries)
bool faceToBeIncluded(const label faceI) const;
bool faceToBeIncluded(const label facei) const;
//- Helper to cause barrier. Necessary on Quadrics.
static void barrier();

View File

@ -33,24 +33,24 @@ Description
An Ensight part is created for the internalMesh and for each patch.
Usage
- foamToEnsight [OPTION] \n
Translates OpenFOAM data to Ensight format
\b foamToEnsight [OPTION]
\param -ascii \n
Write Ensight data in ASCII format instead of "C Binary"
Options:
- \par -ascii
Write Ensight data in ASCII format instead of "C Binary"
\param -patches patchList \n
Specify particular patches to write.
Specifying an empty list suppresses writing the internalMesh.
- \par -patches patchList
Specify particular patches to write.
Specifying an empty list suppresses writing the internalMesh.
\param -noPatches \n
Suppress writing any patches.
- \par -noPatches
Suppress writing any patches.
\param -faceZones zoneList \n
Specify faceZones to write, with wildcards
- \par -faceZones zoneList
Specify faceZones to write, with wildcards
\param -cellZone zoneName \n
Specify single cellZone to write (not lagrangian)
- \par -cellZone zoneName
Specify single cellZone to write (not lagrangian)
Note
Parallel support for cloud data is not supported
@ -212,7 +212,7 @@ int main(int argc, char *argv[])
const word prepend = args.globalCaseName() + '.';
OFstream *ensightCaseFilePtr = NULL;
OFstream *ensightCaseFilePtr = nullptr;
if (Pstream::master())
{
fileName caseFileName = prepend + "case";

View File

@ -32,28 +32,28 @@ Description
An Ensight part is created for each cellZone and patch.
Usage
- foamToEnsightParts [OPTION] \n
Translates OpenFOAM data to Ensight format
\b foamToEnsightParts [OPTION]
\param -ascii \n
Write Ensight data in ASCII format instead of "C Binary"
Options:
- \par -ascii
Write Ensight data in ASCII format instead of "C Binary"
\param -name \<subdir\>\n
define sub-directory name to use for Ensight data (default: "Ensight")
- \par -name \<subdir\>
Define sub-directory name to use for Ensight data (default: "Ensight")
\param -noZero \n
Exclude the often incomplete initial conditions.
- \par -noZero
Exclude the often incomplete initial conditions.
\param -index \<start\>\n
Ignore the time index contained in the time file and use a
simple indexing when creating the \c Ensight/data/######## files.
- \par -index \<start\>
Ignore the time index contained in the time file and use a
simple indexing when creating the \c Ensight/data/######## files.
\param -noMesh \n
Suppress writing the geometry. Can be useful for converting partial
results for a static geometry.
- \par -noMesh
Suppress writing the geometry. Can be useful for converting partial
results for a static geometry.
\param -width \<n\>\n
width of Ensight data subdir
- \par -width \<n\>
Width of Ensight data subdir
Note
- no parallel data.
@ -402,7 +402,7 @@ int main(int argc, char *argv[])
// check that the positions field is present for this time
IOobject* positionPtr = cloudObjs.lookup(word("positions"));
if (positionPtr != NULL)
if (positionPtr != nullptr)
{
ensightParticlePositions
(

View File

@ -8,7 +8,7 @@ if [ ! -d ${WM_THIRD_PARTY_DIR}/tecio ]
then
echo "Did not find tecio in ${WM_THIRD_PARTY_DIR}. Not building foamToTecplot360."
else
wmake
wmake $targetType
fi
#------------------------------------------------------------------------------

View File

@ -8,8 +8,7 @@ EXE_INC = \
EXE_LIBS = \
-llagrangian \
-lfiniteVolume \
-ldynamicMesh \
-ldynamicMesh \
-lgenericPatchFields \
-lmeshTools \
-L$(FOAM_EXT_LIBBIN) -ltecio

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -31,44 +31,45 @@ Description
Tecplot binary file format writer.
Usage
\b foamToTecplot360 [OPTION]
- foamToTecplot360 [OPTION]
Options:
- \par -fields \<names\>
Convert selected fields only. For example,
\verbatim
-fields '( p T U )'
\endverbatim
The quoting is required to avoid shell expansions and to pass the
information as a single argument.
\param -fields \<names\>\n
Convert selected fields only. For example,
\verbatim
-fields '( p T U )'
\endverbatim
The quoting is required to avoid shell expansions and to pass the
information as a single argument.
- \par -cellSet \<name\>
\param -cellSet \<name\>\n
\param -faceSet \<name\>\n
Restrict conversion to the cellSet, faceSet.
- \par -faceSet \<name\>
Restrict conversion to the cellSet, faceSet.
\param -nearCellValue \n
Output cell value on patches instead of patch value itself
- \par -nearCellValue
Output cell value on patches instead of patch value itself
\param -noInternal \n
Do not generate file for mesh, only for patches
- \par -noInternal
Do not generate file for mesh, only for patches
\param -noPointValues \n
No pointFields
- \par -noPointValues
No pointFields
\param -noFaceZones \n
No faceZones
- \par -noFaceZones
No faceZones
\param -excludePatches \<patchNames\>\n
Specify patches (wildcards) to exclude. For example,
\verbatim
-excludePatches '( inlet_1 inlet_2 "proc.*")'
\endverbatim
The quoting is required to avoid shell expansions and to pass the
information as a single argument. The double quotes denote a regular
expression.
- \par -excludePatches \<patchNames\>
Specify patches (wildcards) to exclude. For example,
\verbatim
-excludePatches '( inlet_1 inlet_2 "proc.*")'
\endverbatim
The quoting is required to avoid shell expansions and to pass the
information as a single argument. The double quotes denote a regular
expression.
\param -useTimeName \n
use the time index in the VTK file name instead of the time index
- \par -useTimeName
use the time index in the VTK file name instead of the time index
\*---------------------------------------------------------------------------*/
@ -132,9 +133,9 @@ labelList getSelectedPatches
Info<< "Combining patches:" << endl;
forAll(patches, patchI)
forAll(patches, patchi)
{
const polyPatch& pp = patches[patchI];
const polyPatch& pp = patches[patchi];
if
(
@ -142,18 +143,18 @@ labelList getSelectedPatches
|| (Pstream::parRun() && isType<processorPolyPatch>(pp))
)
{
Info<< " discarding empty/processor patch " << patchI
Info<< " discarding empty/processor patch " << patchi
<< " " << pp.name() << endl;
}
else if (findStrings(excludePatches, pp.name()))
{
Info<< " excluding patch " << patchI
Info<< " excluding patch " << patchi
<< " " << pp.name() << endl;
}
else
{
patchIDs.append(patchI);
Info<< " patch " << patchI << " " << pp.name() << endl;
patchIDs.append(patchi);
Info<< " patch " << patchi << " " << pp.name() << endl;
}
}
return patchIDs.shrink();
@ -327,9 +328,9 @@ int main(int argc, char *argv[])
const fvMesh& mesh = vMesh.mesh();
INTEGER4 nFaceNodes = 0;
forAll(mesh.faces(), faceI)
forAll(mesh.faces(), facei)
{
nFaceNodes += mesh.faces()[faceI].size();
nFaceNodes += mesh.faces()[facei].size();
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -111,8 +111,8 @@ Pout<< "zoneName:" << zoneName
INTEGER4 *PassiveVarArray = NULL;
INTEGER4 *VarShareArray = NULL;
INTEGER4 *PassiveVarArray = nullptr;
INTEGER4 *VarShareArray = nullptr;
INTEGER4 ShrConn = 0;
INTEGER4 NumBConns = 0; /* No Boundary Connections */
@ -191,8 +191,8 @@ Pout<< "zoneName:" << zoneName
<< endl;
INTEGER4 *PassiveVarArray = NULL;
INTEGER4 *VarShareArray = NULL;
INTEGER4 *PassiveVarArray = nullptr;
INTEGER4 *VarShareArray = nullptr;
INTEGER4 ShrConn = 0;
INTEGER4 NumBConns = 0; /* No Boundary Connections */
@ -273,8 +273,8 @@ Pout<< "zoneName:" << zoneName
<< endl;
INTEGER4 *PassiveVarArray = NULL;
INTEGER4 *VarShareArray = NULL;
INTEGER4 *PassiveVarArray = nullptr;
INTEGER4 *VarShareArray = nullptr;
INTEGER4 ShrConn = 0;
@ -318,25 +318,25 @@ void Foam::tecplotWriter::writeConnectivity(const fvMesh& mesh) const
{
List<INTEGER4> FaceNodeCounts(mesh.nFaces());
forAll(mesh.faces(), faceI)
forAll(mesh.faces(), facei)
{
const face& f = mesh.faces()[faceI];
FaceNodeCounts[faceI] = INTEGER4(f.size());
const face& f = mesh.faces()[facei];
FaceNodeCounts[facei] = INTEGER4(f.size());
}
INTEGER4 nFaceNodes = 0;
forAll(mesh.faces(), faceI)
forAll(mesh.faces(), facei)
{
nFaceNodes += mesh.faces()[faceI].size();
nFaceNodes += mesh.faces()[facei].size();
}
List<INTEGER4> FaceNodes(nFaceNodes);
label nodeI = 0;
forAll(mesh.faces(), faceI)
forAll(mesh.faces(), facei)
{
const face& f = mesh.faces()[faceI];
const face& f = mesh.faces()[facei];
forAll(f, fp)
{
FaceNodes[nodeI++] = INTEGER4(f[fp]+1);
@ -345,24 +345,24 @@ void Foam::tecplotWriter::writeConnectivity(const fvMesh& mesh) const
List<INTEGER4> FaceLeftElems(mesh.nFaces());
forAll(mesh.faceOwner(), faceI)
forAll(mesh.faceOwner(), facei)
{
FaceLeftElems[faceI] = mesh.faceOwner()[faceI]+1;
FaceLeftElems[facei] = mesh.faceOwner()[facei]+1;
}
List<INTEGER4> FaceRightElems(mesh.nFaces());
forAll(mesh.faceNeighbour(), faceI)
forAll(mesh.faceNeighbour(), facei)
{
FaceRightElems[faceI] = mesh.faceNeighbour()[faceI]+1;
FaceRightElems[facei] = mesh.faceNeighbour()[facei]+1;
}
for
(
label faceI = mesh.nInternalFaces();
faceI < mesh.nFaces();
faceI++
label facei = mesh.nInternalFaces();
facei < mesh.nFaces();
facei++
)
{
FaceRightElems[faceI] = 0;
FaceRightElems[facei] = 0;
}
if
@ -373,9 +373,9 @@ void Foam::tecplotWriter::writeConnectivity(const fvMesh& mesh) const
FaceNodes.begin(), /* The face nodes array */
FaceLeftElems.begin(), /* The left elements array */
FaceRightElems.begin(), /* The right elements array */
NULL, /* No boundary connection counts */
NULL, /* No boundary connection elements */
NULL /* No boundary connection zones */
nullptr, /* No boundary connection counts */
nullptr, /* No boundary connection elements */
nullptr /* No boundary connection zones */
)
)
{
@ -487,9 +487,9 @@ void Foam::tecplotWriter::writeConnectivity
FaceNodes.begin(), /* The face nodes array */
FaceLeftElems.begin(), /* The left elements array */
FaceRightElems.begin(), /* The right elements array */
NULL, /* No boundary connection counts */
NULL, /* No boundary connection elements */
NULL /* No boundary connection zones */
nullptr, /* No boundary connection counts */
nullptr, /* No boundary connection elements */
nullptr /* No boundary connection zones */
)
)
{

View File

@ -124,7 +124,7 @@ public:
(
const bool nearCellValue,
const GeometricField<Type, fvPatchField, volMesh>& vfld,
const label patchI
const label patchi
) const;
//- Get mixed field: fvsPatchField for boundary faces and

View File

@ -69,16 +69,16 @@ Foam::tmp<Field<Type>> Foam::tecplotWriter::getPatchField
(
const bool nearCellValue,
const GeometricField<Type, fvPatchField, volMesh>& vfld,
const label patchI
const label patchi
) const
{
if (nearCellValue)
{
return vfld.boundaryField()[patchI].patchInternalField();
return vfld.boundaryField()[patchi].patchInternalField();
}
else
{
return vfld.boundaryField()[patchI];
return vfld.boundaryField()[patchi];
}
}
@ -97,18 +97,18 @@ Foam::tmp<Field<Type>> Foam::tecplotWriter::getFaceField
forAll(faceLabels, i)
{
label faceI = faceLabels[i];
label facei = faceLabels[i];
label patchI = patches.whichPatch(faceI);
label patchi = patches.whichPatch(facei);
if (patchI == -1)
if (patchi == -1)
{
fld[i] = sfld[faceI];
fld[i] = sfld[facei];
}
else
{
label localFaceI = faceI - patches[patchI].start();
fld[i] = sfld.boundaryField()[patchI][localFaceI];
label localFacei = facei - patches[patchi].start();
fld[i] = sfld.boundaryField()[patchi][localFacei];
}
}

View File

@ -94,36 +94,36 @@ void ReadAndMapFields
)
);
Field<Type>& fld = tetFields[i].internalField();
Field<Type>& fld = tetFields[i].primitiveFieldRef();
// Map from read field. Set unmapped entries to nullValue.
fld.setSize(map.size(), nullValue);
forAll(map, pointI)
forAll(map, pointi)
{
label index = map[pointI];
label index = map[pointi];
if (index > 0)
{
label cellI = index-1;
fld[pointI] = readField[cellI];
label celli = index-1;
fld[pointi] = readField[celli];
}
else if (index < 0)
{
label faceI = -index-1;
label bFaceI = faceI - mesh.nInternalFaces();
if (bFaceI >= 0)
label facei = -index-1;
label bFacei = facei - mesh.nInternalFaces();
if (bFacei >= 0)
{
label patchI = mesh.boundaryMesh().patchID()[bFaceI];
label localFaceI = mesh.boundaryMesh()[patchI].whichFace
label patchi = mesh.boundaryMesh().patchID()[bFacei];
label localFacei = mesh.boundaryMesh()[patchi].whichFace
(
faceI
facei
);
fld[pointI] = readField.boundaryField()[patchI][localFaceI];
fld[pointi] = readField.boundaryField()[patchi][localFacei];
}
//else
//{
// FatalErrorInFunction
// << "Face " << faceI << " from index " << index
// << "Face " << facei << " from index " << index
// << " is not a boundary face." << abort(FatalError);
//}
@ -131,8 +131,8 @@ void ReadAndMapFields
//else
//{
// WarningInFunction
// << "Point " << pointI << " at "
// << tetDualMesh.points()[pointI]
// << "Point " << pointi << " at "
// << tetDualMesh.points()[pointi]
// << " has no dual correspondence." << endl;
//}
}
@ -203,9 +203,9 @@ int main(int argc, char *argv[])
label nCells = 0;
label nPatchFaces = 0;
label nUnmapped = 0;
forAll(pointDualAddressing, pointI)
forAll(pointDualAddressing, pointi)
{
label index = pointDualAddressing[pointI];
label index = pointDualAddressing[pointi];
if (index > 0)
{
@ -217,11 +217,11 @@ int main(int argc, char *argv[])
}
else
{
label faceI = -index-1;
if (faceI < mesh.nInternalFaces())
label facei = -index-1;
if (facei < mesh.nInternalFaces())
{
FatalErrorInFunction
<< "Face " << faceI << " from index " << index
<< "Face " << facei << " from index " << index
<< " is not a boundary face."
<< " nInternalFaces:" << mesh.nInternalFaces()
<< exit(FatalError);

View File

@ -0,0 +1,11 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
set -x
wmake $targetType foamToVTK
wmake $targetType
#------------------------------------------------------------------------------

View File

@ -1,15 +1,3 @@
surfaceMeshWriter.C
foamToVTK.C
internalWriter.C
lagrangianWriter.C
patchWriter.C
writeFuns.C
writeFaceSet.C
writePointSet.C
writeSurfFields.C
vtkMesh.C
vtkTopo.C
EXE = $(FOAM_APPBIN)/foamToVTK

View File

@ -1,13 +1,12 @@
EXE_INC = \
-IfoamToVTK/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lfoamToVTK \
-ldynamicMesh \
-llagrangian \
-lgenericPatchFields \
-lmeshTools
-lgenericPatchFields

View File

@ -30,73 +30,74 @@ Group
Description
Legacy VTK file format writer.
- handles volScalar, volVector, pointScalar, pointVector, surfaceScalar
- Handles volFields, pointFields, surfaceScalarField, surfaceVectorField
fields.
- mesh topo changes.
- both ascii and binary.
- single time step writing.
- write subset only.
- automatic decomposition of cells; polygons on boundary undecomposed since
- Mesh topo changes.
- Both ascii and binary.
- Single time step writing.
- Write subset only.
- Automatic decomposition of cells; polygons on boundary undecomposed since
handled by vtk.
Usage
\b foamToVTK [OPTION]
- foamToVTK [OPTION]
Options:
- \par -ascii
Write VTK data in ASCII format instead of binary.
\param -ascii \n
Write VTK data in ASCII format instead of binary.
- \par -mesh \<name\>
Use a different mesh name (instead of -region)
\param -mesh \<name\>\n
Use a different mesh name (instead of -region)
- \par -fields \<fields\>
Convert selected fields only. For example,
\verbatim
-fields "( p T U )"
\endverbatim
The quoting is required to avoid shell expansions and to pass the
information as a single argument.
\param -fields \<fields\>\n
Convert selected fields only. For example,
\verbatim
-fields "( p T U )"
\endverbatim
The quoting is required to avoid shell expansions and to pass the
information as a single argument.
- \par -surfaceFields
Write surfaceScalarFields (e.g., phi)
\param -surfaceFields \n
Write surfaceScalarFields (e.g., phi)
- \par -cellSet \<name\>
- \par -faceSet \<name\>
\param -cellSet \<name\>\n
\param -faceSet \<name\>\n
\param -pointSet \<name\>\n
Restrict conversion to the cellSet, faceSet or pointSet.
- \par -pointSet \<name\>
Restrict conversion to the cellSet, faceSet or pointSet.
\param -nearCellValue \n
Output cell value on patches instead of patch value itself
- \par -nearCellValue
Output cell value on patches instead of patch value itself
\param -noInternal \n
Do not generate file for mesh, only for patches
- \par -noInternal
Do not generate file for mesh, only for patches
\param -noPointValues \n
No pointFields
- \par -noPointValues
No pointFields
\param -noFaceZones \n
No faceZones
- \par -noFaceZones
No faceZones
\param -noLinks \n
(in parallel) do not link processor files to master
- \par -noLinks
(in parallel) do not link processor files to master
\param poly \n
write polyhedral cells without tet/pyramid decomposition
- \par poly
write polyhedral cells without tet/pyramid decomposition
\param -allPatches \n
Combine all patches into a single file
- \par -allPatches
Combine all patches into a single file
\param -excludePatches \<patchNames\>\n
Specify patches (wildcards) to exclude. For example,
\verbatim
-excludePatches '( inlet_1 inlet_2 "proc.*")'
\endverbatim
The quoting is required to avoid shell expansions and to pass the
information as a single argument. The double quotes denote a regular
expression.
- \par -excludePatches \<patchNames\>
Specify patches (wildcards) to exclude. For example,
\verbatim
-excludePatches '( inlet_1 inlet_2 "proc.*")'
\endverbatim
The quoting is required to avoid shell expansions and to pass the
information as a single argument. The double quotes denote a regular
expression.
\param -useTimeName \n
use the time index in the VTK file name instead of the time index
- \par -useTimeName
use the time index in the VTK file name instead of the time index
Note
mesh subset is handled by vtkMesh. Slight inconsistency in
@ -108,7 +109,7 @@ Note
whole-mesh values onto the subset patch.
Note
new file format: \n
\par new file format:
no automatic timestep recognition.
However can have .pvd file format which refers to time simulation
if XML *.vtu files are available:
@ -168,7 +169,7 @@ Note
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class GeoField>
void print(const char* msg, Ostream& os, const PtrList<GeoField>& flds)
void print(const char* msg, Ostream& os, const PtrList<const GeoField>& flds)
{
if (flds.size())
{
@ -195,35 +196,35 @@ void print(Ostream& os, const wordList& flds)
labelList getSelectedPatches
(
const polyBoundaryMesh& patches,
const List<wordRe>& excludePatches //HashSet<word>& excludePatches
const List<wordRe>& excludePatches
)
{
DynamicList<label> patchIDs(patches.size());
Info<< "Combining patches:" << endl;
forAll(patches, patchI)
forAll(patches, patchi)
{
const polyPatch& pp = patches[patchI];
const polyPatch& pp = patches[patchi];
if
(
isType<emptyPolyPatch>(pp)
|| (Pstream::parRun() && isType<processorPolyPatch>(pp))
|| (Pstream::parRun() && isType<processorPolyPatch>(pp))
)
{
Info<< " discarding empty/processor patch " << patchI
Info<< " discarding empty/processor patch " << patchi
<< " " << pp.name() << endl;
}
else if (findStrings(excludePatches, pp.name()))
{
Info<< " excluding patch " << patchI
Info<< " excluding patch " << patchi
<< " " << pp.name() << endl;
}
else
{
patchIDs.append(patchI);
Info<< " patch " << patchI << " " << pp.name() << endl;
patchIDs.append(patchi);
Info<< " patch " << patchi << " " << pp.name() << endl;
}
}
return patchIDs.shrink();
@ -406,6 +407,7 @@ int main(int argc, char *argv[])
// VTK/ directory in the case
fileName fvPath(runTime.path()/"VTK");
// Directory of mesh (region0 gets filtered out)
fileName regionPrefix = "";
@ -569,11 +571,11 @@ int main(int argc, char *argv[])
// Construct the vol fields (on the original mesh if subsetted)
PtrList<volScalarField> vsf;
PtrList<volVectorField> vvf;
PtrList<volSphericalTensorField> vSpheretf;
PtrList<volSymmTensorField> vSymmtf;
PtrList<volTensorField> vtf;
PtrList<const volScalarField> vsf;
PtrList<const volVectorField> vvf;
PtrList<const volSphericalTensorField> vSpheretf;
PtrList<const volSymmTensorField> vSymmtf;
PtrList<const volTensorField> vtf;
if (!specifiedFields || selectedFields.size())
{
@ -672,11 +674,11 @@ int main(int argc, char *argv[])
<< " (\"-noPointValues\" (at your option)\n";
}
PtrList<pointScalarField> psf;
PtrList<pointVectorField> pvf;
PtrList<pointSphericalTensorField> pSpheretf;
PtrList<pointSymmTensorField> pSymmtf;
PtrList<pointTensorField> ptf;
PtrList<const pointScalarField> psf;
PtrList<const pointVectorField> pvf;
PtrList<const pointSphericalTensorField> pSpheretf;
PtrList<const pointSymmTensorField> pSymmtf;
PtrList<const pointTensorField> ptf;
if (!noPointValues && !(specifiedFields && selectedFields.empty()))
{
@ -820,7 +822,7 @@ int main(int argc, char *argv[])
if (args.optionFound("surfaceFields"))
{
PtrList<surfaceScalarField> ssf;
PtrList<const surfaceScalarField> ssf;
readFields
(
vMesh,
@ -831,7 +833,7 @@ int main(int argc, char *argv[])
);
print(" surfScalarFields :", Info, ssf);
PtrList<surfaceVectorField> svf;
PtrList<const surfaceVectorField> svf;
readFields
(
vMesh,
@ -853,8 +855,9 @@ int main(int argc, char *argv[])
forAll(ssf, i)
{
svf.set(sz+i, ssf[i]*n);
svf[sz+i].rename(ssf[i].name());
surfaceVectorField* ssfiPtr = (ssf[i]*n).ptr();
ssfiPtr->rename(ssf[i].name());
svf.set(sz+i, ssfiPtr);
}
ssf.clear();
@ -963,9 +966,9 @@ int main(int argc, char *argv[])
}
else
{
forAll(patches, patchI)
forAll(patches, patchi)
{
const polyPatch& pp = patches[patchI];
const polyPatch& pp = patches[patchi];
if (!findStrings(excludePatches, pp.name()))
{
@ -998,7 +1001,7 @@ int main(int argc, char *argv[])
binary,
nearCellValue,
patchFileName,
labelList(1, patchI)
labelList(1, patchi)
);
if (!isA<emptyPolyPatch>(pp))
@ -1063,7 +1066,7 @@ int main(int argc, char *argv[])
if (doFaceZones)
{
PtrList<surfaceScalarField> ssf;
PtrList<const surfaceScalarField> ssf;
readFields
(
vMesh,
@ -1074,7 +1077,7 @@ int main(int argc, char *argv[])
);
print(" surfScalarFields :", Info, ssf);
PtrList<surfaceVectorField> svf;
PtrList<const surfaceVectorField> svf;
readFields
(
vMesh,

View File

@ -0,0 +1,14 @@
surfaceMeshWriter.C
internalWriter.C
lagrangianWriter.C
patchWriter.C
writeFuns.C
writeFaceSet.C
writePointSet.C
writeSurfFields.C
vtkMesh.C
vtkTopo.C
writeVTK/writeVTK.C
LIB = $(FOAM_LIBBIN)/libfoamToVTK

View File

@ -0,0 +1,10 @@
EXE_INC = \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
LIB_LIBS = \
-ldynamicMesh \
-llagrangian \
-lgenericPatchFields

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -80,18 +80,18 @@ Foam::internalWriter::internalWriter
// Count total number of vertices referenced.
label nFaceVerts = 0;
forAll(vtkVertLabels, cellI)
forAll(vtkVertLabels, celli)
{
nFaceVerts += vtkVertLabels[cellI].size() + 1;
nFaceVerts += vtkVertLabels[celli].size() + 1;
}
os_ << "CELLS " << vtkVertLabels.size() << ' ' << nFaceVerts << std::endl;
DynamicList<label> vertLabels(nFaceVerts);
forAll(vtkVertLabels, cellI)
forAll(vtkVertLabels, celli)
{
const labelList& vtkVerts = vtkVertLabels[cellI];
const labelList& vtkVerts = vtkVertLabels[celli];
vertLabels.append(vtkVerts.size());
@ -133,28 +133,28 @@ void Foam::internalWriter::writeCellIDs()
{
const labelList& cMap = vMesh_.subsetter().cellMap();
forAll(mesh.cells(), cellI)
forAll(mesh.cells(), celli)
{
cellId[labelI++] = cMap[cellI];
cellId[labelI++] = cMap[celli];
}
forAll(superCells, superCellI)
forAll(superCells, superCelli)
{
label origCellI = cMap[superCells[superCellI]];
label origCelli = cMap[superCells[superCelli]];
cellId[labelI++] = origCellI;
cellId[labelI++] = origCelli;
}
}
else
{
forAll(mesh.cells(), cellI)
forAll(mesh.cells(), celli)
{
cellId[labelI++] = cellI;
cellId[labelI++] = celli;
}
forAll(superCells, superCellI)
forAll(superCells, superCelli)
{
label origCellI = superCells[superCellI];
label origCelli = superCells[superCelli];
cellId[labelI++] = origCellI;
cellId[labelI++] = origCelli;
}
}

View File

@ -91,7 +91,7 @@ public:
template<class Type, template<class> class PatchField, class GeoMesh>
void write
(
const PtrList<GeometricField<Type, PatchField, GeoMesh>>&
const UPtrList<const GeometricField<Type, PatchField, GeoMesh>>&
);
//- Write generic internal fields
@ -106,7 +106,7 @@ public:
void write
(
const volPointInterpolation&,
const PtrList<GeometricField<Type, fvPatchField, volMesh>>&
const UPtrList<const GeometricField<Type, fvPatchField, volMesh>>&
);
//- Interpolate and internal fields

View File

@ -31,7 +31,7 @@ License
template<class Type, template<class> class PatchField, class GeoMesh>
void Foam::internalWriter::write
(
const PtrList<GeometricField<Type, PatchField, GeoMesh>>& flds
const UPtrList<const GeometricField<Type, PatchField, GeoMesh>>& flds
)
{
forAll(flds, i)
@ -58,7 +58,7 @@ template<class Type>
void Foam::internalWriter::write
(
const volPointInterpolation& pInterp,
const PtrList<GeometricField<Type, fvPatchField, volMesh>>& flds
const UPtrList<const GeometricField<Type, fvPatchField, volMesh>>& flds
)
{
forAll(flds, i)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -70,9 +70,9 @@ Foam::patchWriter::patchWriter
nPoints_ += pp.nPoints();
nFaces_ += pp.size();
forAll(pp, faceI)
forAll(pp, facei)
{
nFaceVerts += pp[faceI].size() + 1;
nFaceVerts += pp[facei].size() + 1;
}
}
@ -98,9 +98,9 @@ Foam::patchWriter::patchWriter
{
const polyPatch& pp = patches[patchIDs_[i]];
forAll(pp, faceI)
forAll(pp, facei)
{
const face& f = pp.localFaces()[faceI];
const face& f = pp.localFaces()[facei];
vertLabels.append(f.size());
writeFuns::insert(f + offset, vertLabels);
@ -123,13 +123,13 @@ void Foam::patchWriter::writePatchIDs()
forAll(patchIDs_, i)
{
label patchI = patchIDs_[i];
label patchi = patchIDs_[i];
const polyPatch& pp = mesh.boundaryMesh()[patchI];
const polyPatch& pp = mesh.boundaryMesh()[patchi];
if (!isA<emptyPolyPatch>(pp))
{
writeFuns::insert(scalarField(pp.size(), patchI), fField);
writeFuns::insert(scalarField(pp.size(), patchi), fField);
}
}
writeFuns::write(os_, binary_, fField);

View File

@ -114,14 +114,17 @@ public:
template<class Type>
void write
(
const PtrList<GeometricField<Type, fvPatchField, volMesh>>&
const UPtrList<const GeometricField<Type, fvPatchField, volMesh>>&
);
//- Write pointFields
template<class Type>
void write
(
const PtrList<GeometricField<Type, pointPatchField, pointMesh>>&
const UPtrList
<
const GeometricField<Type, pointPatchField, pointMesh>
>&
);
//- Interpolate and write volFields
@ -129,7 +132,7 @@ public:
void write
(
const PrimitivePatchInterpolation<primitivePatch>&,
const PtrList<GeometricField<Type, fvPatchField, volMesh>>&
const UPtrList<const GeometricField<Type, fvPatchField, volMesh>>&
);
};

View File

@ -31,12 +31,12 @@ License
template<class Type>
void Foam::patchWriter::write
(
const PtrList<GeometricField<Type, fvPatchField, volMesh>>& flds
const UPtrList<const GeometricField<Type, fvPatchField, volMesh>>& flds
)
{
forAll(flds, fieldI)
forAll(flds, fieldi)
{
const GeometricField<Type, fvPatchField, volMesh>& fld = flds[fieldI];
const GeometricField<Type, fvPatchField, volMesh>& fld = flds[fieldi];
os_ << fld.name() << ' '
<< int(pTraits<Type>::nComponents) << ' '
@ -46,9 +46,9 @@ void Foam::patchWriter::write
forAll(patchIDs_, j)
{
label patchI = patchIDs_[j];
label patchi = patchIDs_[j];
const fvPatchField<Type>& pfld = fld.boundaryField()[patchI];
const fvPatchField<Type>& pfld = fld.boundaryField()[patchi];
if (nearCellValue_)
{
@ -67,13 +67,13 @@ void Foam::patchWriter::write
template<class Type>
void Foam::patchWriter::write
(
const PtrList<GeometricField<Type, pointPatchField, pointMesh>>& flds
const UPtrList<const GeometricField<Type, pointPatchField, pointMesh>>& flds
)
{
forAll(flds, fieldI)
forAll(flds, fieldi)
{
const GeometricField<Type, pointPatchField, pointMesh>& fld =
flds[fieldI];
flds[fieldi];
os_ << fld.name() << ' '
<< int(pTraits<Type>::nComponents) << ' '
@ -83,9 +83,9 @@ void Foam::patchWriter::write
forAll(patchIDs_, j)
{
label patchI = patchIDs_[j];
label patchi = patchIDs_[j];
const pointPatchField<Type>& pfld = fld.boundaryField()[patchI];
const pointPatchField<Type>& pfld = fld.boundaryField()[patchi];
writeFuns::insert(pfld.patchInternalField()(), fField);
}
@ -98,12 +98,12 @@ template<class Type>
void Foam::patchWriter::write
(
const PrimitivePatchInterpolation<primitivePatch>& pInter,
const PtrList<GeometricField<Type, fvPatchField, volMesh>>& flds
const UPtrList<const GeometricField<Type, fvPatchField, volMesh>>& flds
)
{
forAll(flds, fieldI)
forAll(flds, fieldi)
{
const GeometricField<Type, fvPatchField, volMesh>& fld = flds[fieldI];
const GeometricField<Type, fvPatchField, volMesh>& fld = flds[fieldi];
os_ << fld.name() << ' '
<< int(pTraits<Type>::nComponents) << ' '
@ -113,9 +113,9 @@ void Foam::patchWriter::write
forAll(patchIDs_, j)
{
label patchI = patchIDs_[j];
label patchi = patchIDs_[j];
const fvPatchField<Type>& pfld = fld.boundaryField()[patchI];
const fvPatchField<Type>& pfld = fld.boundaryField()[patchi];
if (nearCellValue_)
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,7 +40,7 @@ void readFields
const typename GeoField::Mesh& mesh,
const IOobjectList& objects,
const HashSet<word>& selectedFields,
PtrList<GeoField>& fields
PtrList<const GeoField>& fields
)
{
// Search list of objects for volScalarFields
@ -64,7 +64,7 @@ void readFields
*iter(),
mesh
)
)
).ptr()
);
nFields++;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -52,7 +52,7 @@ void readFields
const typename GeoField::Mesh& mesh,
const IOobjectList& objects,
const HashSet<word>& selectedFields,
PtrList<GeoField>& fields
PtrList<const GeoField>& fields
);
} // End namespace Foam

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -49,9 +49,9 @@ Foam::surfaceMeshWriter::surfaceMeshWriter
// Write topology
label nFaceVerts = 0;
forAll(pp, faceI)
forAll(pp, facei)
{
nFaceVerts += pp[faceI].size() + 1;
nFaceVerts += pp[facei].size() + 1;
}
os_ << "POINTS " << pp.nPoints() << " float" << std::endl;
@ -65,9 +65,9 @@ Foam::surfaceMeshWriter::surfaceMeshWriter
DynamicList<label> vertLabels(nFaceVerts);
forAll(pp, faceI)
forAll(pp, facei)
{
const face& f = pp.localFaces()[faceI];
const face& f = pp.localFaces()[facei];
vertLabels.append(f.size());
writeFuns::insert(f, vertLabels);

View File

@ -99,7 +99,10 @@ public:
template<class Type>
void write
(
const PtrList<GeometricField<Type, fvsPatchField, surfaceMesh>>&
const UPtrList
<
const GeometricField<Type, fvsPatchField, surfaceMesh>
>&
);
};

View File

@ -41,18 +41,18 @@ Foam::tmp<Field<Type>> Foam::surfaceMeshWriter::getFaceField
forAll(pp_.addressing(), i)
{
label faceI = pp_.addressing()[i];
label facei = pp_.addressing()[i];
label patchI = patches.whichPatch(faceI);
label patchi = patches.whichPatch(facei);
if (patchI == -1)
if (patchi == -1)
{
fld[i] = sfld[faceI];
fld[i] = sfld[facei];
}
else
{
label localFaceI = faceI - patches[patchI].start();
fld[i] = sfld.boundaryField()[patchI][localFaceI];
label localFacei = facei - patches[patchi].start();
fld[i] = sfld.boundaryField()[patchi][localFacei];
}
}
@ -63,13 +63,16 @@ Foam::tmp<Field<Type>> Foam::surfaceMeshWriter::getFaceField
template<class Type>
void Foam::surfaceMeshWriter::write
(
const PtrList<GeometricField<Type, fvsPatchField, surfaceMesh>>& sflds
const UPtrList
<
const GeometricField<Type, fvsPatchField, surfaceMesh>
>& sflds
)
{
forAll(sflds, fieldI)
forAll(sflds, fieldi)
{
const GeometricField<Type, fvsPatchField, surfaceMesh>& fld =
sflds[fieldI];
sflds[fieldi];
os_ << fld.name() << ' '
<< int(pTraits<Type>::nComponents) << ' '

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -71,9 +71,9 @@ Foam::vtkTopo::vtkTopo(const polyMesh& mesh)
// and cells
if (decomposePoly)
{
forAll(cellShapes, cellI)
forAll(cellShapes, celli)
{
const cellModel& model = cellShapes[cellI].model();
const cellModel& model = cellShapes[celli].model();
if
(
@ -85,11 +85,11 @@ Foam::vtkTopo::vtkTopo(const polyMesh& mesh)
&& model != tetWedge
)
{
const cell& cFaces = mesh_.cells()[cellI];
const cell& cFaces = mesh_.cells()[celli];
forAll(cFaces, cFaceI)
forAll(cFaces, cFacei)
{
const face& f = mesh_.faces()[cFaces[cFaceI]];
const face& f = mesh_.faces()[cFaces[cFacei]];
label nQuads = 0;
label nTris = 0;
@ -120,26 +120,26 @@ Foam::vtkTopo::vtkTopo(const polyMesh& mesh)
cellTypes_.setSize(cellShapes.size() + nAddCells);
// Set counters for additional points and additional cells
label addPointI = 0, addCellI = 0;
label addPointi = 0, addCelli = 0;
forAll(cellShapes, cellI)
forAll(cellShapes, celli)
{
const cellShape& cellShape = cellShapes[cellI];
const cellShape& cellShape = cellShapes[celli];
const cellModel& cellModel = cellShape.model();
labelList& vtkVerts = vertLabels_[cellI];
labelList& vtkVerts = vertLabels_[celli];
if (cellModel == tet)
{
vtkVerts = cellShape;
cellTypes_[cellI] = VTK_TETRA;
cellTypes_[celli] = VTK_TETRA;
}
else if (cellModel == pyr)
{
vtkVerts = cellShape;
cellTypes_[cellI] = VTK_PYRAMID;
cellTypes_[celli] = VTK_PYRAMID;
}
else if (cellModel == prism)
{
@ -150,20 +150,20 @@ Foam::vtkTopo::vtkTopo(const polyMesh& mesh)
Foam::Swap(vtkVerts[1], vtkVerts[2]);
Foam::Swap(vtkVerts[4], vtkVerts[5]);
cellTypes_[cellI] = VTK_WEDGE;
cellTypes_[celli] = VTK_WEDGE;
}
else if (cellModel == tetWedge)
else if (cellModel == tetWedge && decomposePoly)
{
// Treat as squeezed prism
// Treat as squeezed prism (VTK_WEDGE)
vtkVerts.setSize(6);
vtkVerts[0] = cellShape[0];
vtkVerts[1] = cellShape[2];
vtkVerts[2] = cellShape[1];
vtkVerts[3] = cellShape[3];
vtkVerts[4] = cellShape[4];
vtkVerts[5] = cellShape[4];
vtkVerts[5] = cellShape[3];
cellTypes_[cellI] = VTK_WEDGE;
cellTypes_[celli] = VTK_WEDGE;
}
else if (cellModel == wedge)
{
@ -178,32 +178,32 @@ Foam::vtkTopo::vtkTopo(const polyMesh& mesh)
vtkVerts[6] = cellShape[5];
vtkVerts[7] = cellShape[6];
cellTypes_[cellI] = VTK_HEXAHEDRON;
cellTypes_[celli] = VTK_HEXAHEDRON;
}
else if (cellModel == hex)
{
vtkVerts = cellShape;
cellTypes_[cellI] = VTK_HEXAHEDRON;
cellTypes_[celli] = VTK_HEXAHEDRON;
}
else if (decomposePoly)
{
// Polyhedral cell. Decompose into tets + pyramids.
// Mapping from additional point to cell
addPointCellLabels_[addPointI] = cellI;
addPointCellLabels_[addPointi] = celli;
// The new vertex from the cell-centre
const label newVertexLabel = mesh_.nPoints() + addPointI;
const label newVertexLabel = mesh_.nPoints() + addPointi;
// Whether to insert cell in place of original or not.
bool substituteCell = true;
const labelList& cFaces = mesh_.cells()[cellI];
forAll(cFaces, cFaceI)
const labelList& cFaces = mesh_.cells()[celli];
forAll(cFaces, cFacei)
{
const face& f = mesh_.faces()[cFaces[cFaceI]];
const bool isOwner = (owner[cFaces[cFaceI]] == cellI);
const face& f = mesh_.faces()[cFaces[cFacei]];
const bool isOwner = (owner[cFaces[cFacei]] == celli);
// Number of triangles and quads in decomposition
label nTris = 0;
@ -219,20 +219,20 @@ Foam::vtkTopo::vtkTopo(const polyMesh& mesh)
forAll(quadFcs, quadI)
{
label thisCellI;
label thisCelli;
if (substituteCell)
{
thisCellI = cellI;
thisCelli = celli;
substituteCell = false;
}
else
{
thisCellI = mesh_.nCells() + addCellI;
superCells_[addCellI++] = cellI;
thisCelli = mesh_.nCells() + addCelli;
superCells_[addCelli++] = celli;
}
labelList& addVtkVerts = vertLabels_[thisCellI];
labelList& addVtkVerts = vertLabels_[thisCelli];
addVtkVerts.setSize(5);
@ -261,26 +261,26 @@ Foam::vtkTopo::vtkTopo(const polyMesh& mesh)
}
addVtkVerts[4] = newVertexLabel;
cellTypes_[thisCellI] = VTK_PYRAMID;
cellTypes_[thisCelli] = VTK_PYRAMID;
}
forAll(triFcs, triI)
{
label thisCellI;
label thisCelli;
if (substituteCell)
{
thisCellI = cellI;
thisCelli = celli;
substituteCell = false;
}
else
{
thisCellI = mesh_.nCells() + addCellI;
superCells_[addCellI++] = cellI;
thisCelli = mesh_.nCells() + addCelli;
superCells_[addCelli++] = celli;
}
labelList& addVtkVerts = vertLabels_[thisCellI];
labelList& addVtkVerts = vertLabels_[thisCelli];
const face& tri = triFcs[triI];
@ -301,26 +301,26 @@ Foam::vtkTopo::vtkTopo(const polyMesh& mesh)
}
addVtkVerts[3] = newVertexLabel;
cellTypes_[thisCellI] = VTK_TETRA;
cellTypes_[thisCelli] = VTK_TETRA;
}
}
addPointI++;
addPointi++;
}
else
{
// Polyhedral cell - not decomposed
cellTypes_[cellI] = VTK_POLYHEDRON;
cellTypes_[celli] = VTK_POLYHEDRON;
const labelList& cFaces = mesh_.cells()[cellI];
const labelList& cFaces = mesh_.cells()[celli];
// space for the number of faces and size of each face
label nData = 1 + cFaces.size();
// count total number of face points
forAll(cFaces, cFaceI)
forAll(cFaces, cFacei)
{
const face& f = mesh.faces()[cFaces[cFaceI]];
const face& f = mesh.faces()[cFaces[cFacei]];
nData += f.size(); // space for the face labels
}
@ -330,10 +330,10 @@ Foam::vtkTopo::vtkTopo(const polyMesh& mesh)
vtkVerts[nData++] = cFaces.size();
// build face stream
forAll(cFaces, cFaceI)
forAll(cFaces, cFacei)
{
const face& f = mesh.faces()[cFaces[cFaceI]];
const bool isOwner = (owner[cFaces[cFaceI]] == cellI);
const face& f = mesh.faces()[cFaces[cFacei]];
const bool isOwner = (owner[cFaces[cFacei]] == celli);
// number of labels for this face
vtkVerts[nData++] = f.size();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -61,13 +61,13 @@ void Foam::writeFaceSet
faceList setFaces(set.size());
labelList setFaceLabels(set.size());
label setFaceI = 0;
label setFacei = 0;
forAllConstIter(faceSet, set, iter)
{
setFaceLabels[setFaceI] = iter.key();
setFaces[setFaceI] = faces[iter.key()];
setFaceI++;
setFaceLabels[setFacei] = iter.key();
setFaces[setFacei] = faces[iter.key()];
setFacei++;
}
primitiveFacePatch fp(setFaces, vMesh.mesh().points());
@ -85,18 +85,18 @@ void Foam::writeFaceSet
label nFaceVerts = 0;
forAll(fp.localFaces(), faceI)
forAll(fp.localFaces(), facei)
{
nFaceVerts += fp.localFaces()[faceI].size() + 1;
nFaceVerts += fp.localFaces()[facei].size() + 1;
}
ostr<< "POLYGONS " << fp.size() << ' ' << nFaceVerts << std::endl;
DynamicList<label> vertLabels(nFaceVerts);
forAll(fp.localFaces(), faceI)
forAll(fp.localFaces(), facei)
{
const face& f = fp.localFaces()[faceI];
const face& f = fp.localFaces()[facei];
vertLabels.append(f.size());

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -80,13 +80,13 @@ void Foam::writeFuns::write
DynamicList<floatScalar> fField(pTraits<Type>::nComponents*nValues);
insert(vvf, fField);
insert(vvf.primitiveField(), fField);
forAll(superCells, superCellI)
forAll(superCells, superCelli)
{
label origCellI = superCells[superCellI];
label origCelli = superCells[superCelli];
insert(vvf[origCellI], fField);
insert(vvf[origCelli], fField);
}
write(os, binary, fField);
}
@ -117,9 +117,9 @@ void Foam::writeFuns::write
forAll(addPointCellLabels, api)
{
label origCellI = addPointCellLabels[api];
label origCelli = addPointCellLabels[api];
insert(interpolatePointToCell(pvf, origCellI), fField);
insert(interpolatePointToCell(pvf, origCelli), fField);
}
write(os, binary, fField);
}
@ -151,9 +151,9 @@ void Foam::writeFuns::write
forAll(addPointCellLabels, api)
{
label origCellI = addPointCellLabels[api];
label origCelli = addPointCellLabels[api];
insert(vvf[origCellI], fField);
insert(vvf[origCelli], fField);
}
write(os, binary, fField);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -30,19 +30,14 @@ License
#include "emptyFvsPatchFields.H"
#include "fvsPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
void writeSurfFields
void Foam::writeSurfFields
(
const bool binary,
const vtkMesh& vMesh,
const fileName& fileName,
const PtrList<surfaceVectorField>& surfVectorFields
const UPtrList<const surfaceVectorField>& surfVectorFields
)
{
const fvMesh& mesh = vMesh.mesh();
@ -64,9 +59,9 @@ void writeSurfFields
DynamicList<floatScalar> pField(3*mesh.nFaces());
for (label faceI = 0; faceI < mesh.nFaces(); faceI++)
for (label facei = 0; facei < mesh.nFaces(); facei++)
{
writeFuns::insert(fc[faceI], pField);
writeFuns::insert(fc[facei], pField);
}
writeFuns::write(str, binary, pField);
@ -75,25 +70,25 @@ void writeSurfFields
<< "FIELD attributes " << surfVectorFields.size() << std::endl;
// surfVectorFields
forAll(surfVectorFields, fieldI)
forAll(surfVectorFields, fieldi)
{
const surfaceVectorField& svf = surfVectorFields[fieldI];
const surfaceVectorField& svf = surfVectorFields[fieldi];
str << svf.name() << " 3 "
<< mesh.nFaces() << " float" << std::endl;
DynamicList<floatScalar> fField(3*mesh.nFaces());
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
for (label facei = 0; facei < mesh.nInternalFaces(); facei++)
{
writeFuns::insert(svf[faceI], fField);
writeFuns::insert(svf[facei], fField);
}
forAll(svf.boundaryField(), patchI)
forAll(svf.boundaryField(), patchi)
{
const fvsPatchVectorField& pf = svf.boundaryField()[patchI];
const fvsPatchVectorField& pf = svf.boundaryField()[patchi];
const fvPatch& pp = mesh.boundary()[patchI];
const fvPatch& pp = mesh.boundary()[patchi];
if (isA<emptyFvsPatchVectorField>(pf))
{
@ -117,8 +112,4 @@ void writeSurfFields
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -50,7 +50,7 @@ void writeSurfFields
const bool binary,
const vtkMesh& vMesh,
const fileName& fileName,
const PtrList<surfaceVectorField>& surfVectorFields
const UPtrList<const surfaceVectorField>& surfVectorFields
);
} // End namespace Foam

View File

@ -0,0 +1,81 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// So we get a decent warning if we have multiple functionObject entries
// with the same name.
#inputMode error;
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 0.5;
deltaT 0.005;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression uncompressed;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
functions
{
writeVTK
{
type writeVTK;
// Where to load it from
libs ("libfoamToVTK.so");
// When to write:
// timeStep (with optional writeInterval)
// writeTime (with optional writeInterval)
// adjustableTime
// runTime
// clockTime
// cpuTime
writeControl writeTime;
// Write every writeInterval (only valid for timeStemp, writeTime)
writeInterval 1;
// Interval of time (valid for adjustableTime, runTime, clockTime,
// cpuTime)
writeInterval 1;
// Objects to write
objectNames ();
}
}
// ************************************************************************* //

View File

@ -0,0 +1,156 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "writeVTK.H"
#include "dictionary.H"
#include "Time.H"
#include "vtkMesh.H"
#include "internalWriter.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
defineTypeNameAndDebug(writeVTK, 0);
addToRunTimeSelectionTable(functionObject, writeVTK, dictionary);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjects::writeVTK::writeVTK
(
const word& name,
const Time& runTime,
const dictionary& dict
)
:
fvMeshFunctionObject(name, runTime, dict),
objectNames_()
{
read(dict);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::writeVTK::~writeVTK()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::writeVTK::read(const dictionary& dict)
{
dict.lookup("objects") >> objectNames_;
return true;
}
bool Foam::functionObjects::writeVTK::execute()
{
return true;
}
bool Foam::functionObjects::writeVTK::write()
{
Info<< type() << " " << name() << " output:" << nl;
Info<< "Time: " << time_.timeName() << endl;
word timeDesc = time_.timeName();
// VTK/ directory in the case
fileName fvPath(time_.path()/"VTK");
mkDir(fvPath);
string vtkName = time_.caseName();
if (Pstream::parRun())
{
// Strip off leading casename, leaving just processor_DDD ending.
string::size_type i = vtkName.rfind("processor");
if (i != string::npos)
{
vtkName = vtkName.substr(i);
}
}
// Create file and write header
fileName vtkFileName
(
fvPath/vtkName
+ "_"
+ timeDesc
+ ".vtk"
);
Info<< " Internal : " << vtkFileName << endl;
vtkMesh vMesh(const_cast<fvMesh&>(mesh_));
// Write mesh
internalWriter writer(vMesh, false, vtkFileName);
UPtrList<const volScalarField> vsf(lookupFields<volScalarField>());
UPtrList<const volVectorField> vvf(lookupFields<volVectorField>());
UPtrList<const volSphericalTensorField> vsptf
(
lookupFields<volSphericalTensorField>()
);
UPtrList<const volSymmTensorField> vstf(lookupFields<volSymmTensorField>());
UPtrList<const volTensorField> vtf(lookupFields<volTensorField>());
// Write header for cellID and volFields
writeFuns::writeCellDataHeader
(
writer.os(),
vMesh.nFieldCells(),
1 + vsf.size() + vvf.size() + vsptf.size() + vstf.size() + vtf.size()
);
// Write cellID field
writer.writeCellIDs();
// Write volFields
writer.write(vsf);
writer.write(vvf);
writer.write(vsptf);
writer.write(vstf);
writer.write(vtf);
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,179 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::functionObjects::writeVTK
Group
grpUtilitiesFunctionObjects
Description
This functionObject writes objects registered to the database in VTK format
using the foamToVTK library.
Currently only the writing of the cell-values of volFields is supported but
support for other field types, patch fields, Lagrangian data etc. will be
added.
Example of function object specification:
\verbatim
writeVTK1
{
type writeVTK;
libs ("libutilityFunctionObjects.so");
...
objectNames (obj1 obj2);
}
\endverbatim
Usage
\table
Property | Description | Required | Default value
type | type name: writeVTK | yes |
objectNames | objects to write | yes |
\endtable
See also
Foam::functionObjects::fvMeshFunctionObject
Foam::functionObjects::timeControl
Example of function object specification to calculate Lambda2:
\verbatim
Lambda2_1
{
type Lambda2;
functionObjectLibs ("libutilityFunctionObjects.so");
...
}
\endverbatim
\heading Function object usage
\table
Property | Description | Required | Default value
type | Type name: Lambda2 | yes |
UName | Name of velocity field | no | U
resultName | Name of Lambda2 field | no | <function name>
log | Log to standard output | no | yes
\endtable
SourceFiles
writeVTK.C
IOwriteVTK.H
\*---------------------------------------------------------------------------*/
#ifndef functionObjects_writeVTK_H
#define functionObjects_writeVTK_H
#include "fvMeshFunctionObject.H"
#include "wordReList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
/*---------------------------------------------------------------------------*\
Class writeVTK Declaration
\*---------------------------------------------------------------------------*/
class writeVTK
:
public fvMeshFunctionObject
{
// Private data
//- Names of objects
wordReList objectNames_;
//- Result name
word resultName_;
//- Switch to send output to Info as well as to file
Switch log_;
// Private Member Functions
template<class GeoField>
UPtrList<const GeoField> lookupFields() const;
//- Disallow default bitwise copy construct
writeVTK(const writeVTK&);
//- Disallow default bitwise assignment
void operator=(const writeVTK&);
public:
//- Runtime type information
TypeName("writeVTK");
// Constructors
//- Construct from Time and dictionary
writeVTK
(
const word& name,
const Time& t,
const dictionary&
);
//- Destructor
virtual ~writeVTK();
// Member Functions
//- Read the writeVTK data
virtual bool read(const dictionary&);
//- Execute, currently does nothing
virtual bool execute();
//- Write the writeVTK
virtual bool write();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "writeVTKTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,61 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "writeVTK.H"
#include "objectRegistry.H"
#include "DynamicList.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class GeoField>
Foam::UPtrList<const GeoField>
Foam::functionObjects::writeVTK::lookupFields() const
{
DynamicList<word> allNames(obr_.toc().size());
forAll(objectNames_, i)
{
wordList names(obr_.names<GeoField>(objectNames_[i]));
if (names.size())
{
allNames.append(names);
}
}
UPtrList<const GeoField> fields(allNames.size());
forAll(allNames, i)
{
const GeoField& field = obr_.lookupObject<GeoField>(allNames[i]);
Info<< " Writing " << GeoField::typeName
<< " field " << field.name() << endl;
fields.set(i, &field);
}
return fields;
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -209,14 +209,14 @@ int main(int argc, char *argv[])
sFields[i]->correctBoundaryConditions();
sFields[i]->write();
delete sFields[i];
sFields[i] = NULL;
sFields[i] = nullptr;
}
else if (vFields[i])
{
vFields[i]->correctBoundaryConditions();
vFields[i]->write();
delete vFields[i];
vFields[i] = NULL;
vFields[i] = nullptr;
}
}