Commit 19df5f69 authored by laurence's avatar laurence
Browse files

Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

parents 0df0edf3 f3433b3a
......@@ -25,7 +25,7 @@ Application
thermoFoam
Description
Evolves the thermodynamics on a forzen flow field
Evolves the thermodynamics on a frozen flow field
\*---------------------------------------------------------------------------*/
......
......@@ -614,11 +614,6 @@ int main(int argc, char *argv[])
"boundBox",
"simplify the surface using snappyHexMesh starting from a boundBox"
);
Foam::argList::addBoolOption
(
"writeLevel",
"write pointLevel and cellLevel postprocessing files"
);
Foam::argList::addOption
(
"patches",
......@@ -640,7 +635,6 @@ int main(int argc, char *argv[])
const bool overwrite = args.optionFound("overwrite");
const bool checkGeometry = args.optionFound("checkGeometry");
const bool surfaceSimplify = args.optionFound("surfaceSimplify");
const bool writeLevel = args.optionFound("writeLevel");
autoPtr<fvMesh> meshPtr;
......@@ -852,6 +846,8 @@ int main(int argc, char *argv[])
autoLayerDriver::debug = debug;
}
const bool writeLevel = meshDict.lookupOrDefault<bool>("writeLevel", false);
// Read geometry
// ~~~~~~~~~~~~~
......
......@@ -213,25 +213,21 @@ void Foam::doxygenXmlParser::skipForward
) const
{
// recurse to move forward in 'is' until come across <blockName>
// fast-forward until we reach a '<'
char c;
while (is.get(c) && c != '<')
{}
string entryName = "";
while (is.get(c) && c != '>')
{
entryName = entryName + c;
}
char c;
if (entryName == blockName)
{
return;
}
else
while (is.good() && (entryName != blockName))
{
skipForward(is, blockName);
entryName = "";
// fast-forward until we reach a '<'
while (is.get(c) && c != '<')
{}
while (is.get(c) && c != '>')
{
entryName = entryName + c;
}
}
}
......
......@@ -39,6 +39,31 @@ using namespace Foam;
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh> >
volField
(
const fvMeshSubset& meshSubsetter,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
if (meshSubsetter.hasSubMesh())
{
tmp<GeometricField<Type, fvPatchField, volMesh> > tfld
(
meshSubsetter.interpolate(vf)
);
tfld().checkOut();
tfld().rename(vf.name());
return tfld;
}
else
{
return vf;
}
}
template<class Type>
Field<Type> map
(
......@@ -680,7 +705,7 @@ void ensightPointField
template<class Type>
void ensightField
(
const IOobject& fieldObject,
const GeometricField<Type, fvPatchField, volMesh>& vf,
const ensightMesh& eMesh,
const fileName& postProcPath,
const word& prepend,
......@@ -690,14 +715,11 @@ void ensightField
Ostream& ensightCaseFile
)
{
// Read field
GeometricField<Type, fvPatchField, volMesh> vf(fieldObject, eMesh.mesh());
if (nodeValues)
{
tmp<GeometricField<Type, pointPatchField, pointMesh> > pfld
(
volPointInterpolation::New(eMesh.mesh()).interpolate(vf)
volPointInterpolation::New(vf.mesh()).interpolate(vf)
);
pfld().rename(vf.name());
......
......@@ -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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -35,13 +35,24 @@ SourceFiles
#define ensightField_H
#include "ensightMesh.H"
#include "fvMeshSubset.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Wrapper to get hold of the field or the subsetted field
template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
volField
(
const Foam::fvMeshSubset&,
const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>& vf
);
template<class Type>
void ensightField
(
const Foam::IOobject& fieldObject,
const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>& vf,
const Foam::ensightMesh& eMesh,
const Foam::fileName& postProcPath,
const Foam::word& prepend,
......
......@@ -57,14 +57,6 @@ void Foam::ensightMesh::correct()
nFaceZonePrims_ = 0;
boundaryFaceToBeIncluded_.clear();
const cellShapeList& cellShapes = mesh_.cellShapes();
const cellModel& tet = *(cellModeller::lookup("tet"));
const cellModel& pyr = *(cellModeller::lookup("pyr"));
const cellModel& prism = *(cellModeller::lookup("prism"));
const cellModel& wedge = *(cellModeller::lookup("wedge"));
const cellModel& hex = *(cellModeller::lookup("hex"));
if (!noPatches_)
{
// Patches are output. Check that they're synced.
......@@ -111,6 +103,16 @@ void Foam::ensightMesh::correct()
}
else
{
const cellShapeList& cellShapes = mesh_.cellShapes();
const cellModel& tet = *(cellModeller::lookup("tet"));
const cellModel& pyr = *(cellModeller::lookup("pyr"));
const cellModel& prism = *(cellModeller::lookup("prism"));
const cellModel& wedge = *(cellModeller::lookup("wedge"));
const cellModel& hex = *(cellModeller::lookup("hex"));
// Count the shapes
labelList& tets = meshCellSets_.tets;
labelList& pyrs = meshCellSets_.pyrs;
......@@ -926,8 +928,10 @@ void Foam::ensightMesh::writeAllNSided
}
void Foam::ensightMesh::writeAllInternalPoints
void Foam::ensightMesh::writeAllPoints
(
const label ensightPartI,
const word& ensightPartName,
const pointField& uniquePoints,
const label nPoints,
ensightStream& ensightGeometryFile
......@@ -937,49 +941,8 @@ void Foam::ensightMesh::writeAllInternalPoints
if (Pstream::master())
{
ensightGeometryFile.writePartHeader(1);
ensightGeometryFile.write("internalMesh");
ensightGeometryFile.write("coordinates");
ensightGeometryFile.write(nPoints);
for (direction d=0; d<vector::nComponents; d++)
{
ensightGeometryFile.write(uniquePoints.component(d));
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
scalarField pointsComponent(fromSlave);
ensightGeometryFile.write(pointsComponent);
}
}
}
else
{
for (direction d=0; d<vector::nComponents; d++)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< uniquePoints.component(d);
}
}
}
void Foam::ensightMesh::writeAllPatchPoints
(
const label ensightPatchI,
const word& patchName,
const pointField& uniquePoints,
const label nPoints,
ensightStream& ensightGeometryFile
) const
{
barrier();
if (Pstream::master())
{
ensightGeometryFile.writePartHeader(ensightPatchI);
ensightGeometryFile.write(patchName.c_str());
ensightGeometryFile.writePartHeader(ensightPartI);
ensightGeometryFile.write(ensightPartName.c_str());
ensightGeometryFile.write("coordinates");
ensightGeometryFile.write(nPoints);
......@@ -998,11 +961,7 @@ void Foam::ensightMesh::writeAllPatchPoints
{
for (direction d=0; d<vector::nComponents; d++)
{
OPstream toMaster
(
Pstream::scheduled,
Pstream::masterNo()
);
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< uniquePoints.component(d);
}
}
......@@ -1076,8 +1035,10 @@ void Foam::ensightMesh::write
const pointField uniquePoints(mesh_.points(), uniquePointMap_);
writeAllInternalPoints
writeAllPoints
(
1,
"internalMesh",
uniquePoints,
nPoints,
ensightGeometryFile
......@@ -1166,7 +1127,7 @@ void Foam::ensightMesh::write
inplaceRenumber(pointToGlobal, patchFaces[i]);
}
writeAllPatchPoints
writeAllPoints
(
ensightPatchI++,
patchName,
......@@ -1271,7 +1232,7 @@ void Foam::ensightMesh::write
inplaceRenumber(pointToGlobal, faceZoneMasterFaces[i]);
}
writeAllPatchPoints
writeAllPoints
(
ensightPatchI++,
faceZoneName,
......
......@@ -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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -244,17 +244,10 @@ private:
ensightStream& ensightGeometryFile
) const;
void writeAllInternalPoints
void writeAllPoints
(
const pointField& uniquePoints,
const label nPoints,
ensightStream& ensightGeometryFile
) const;
void writeAllPatchPoints
(
label ensightPatchI,
const word& patchName,
const label ensightPartI,
const word& ensightPartName,
const pointField& uniquePoints,
const label nPoints,
ensightStream& ensightGeometryFile
......
......@@ -46,6 +46,9 @@ Usage
\param -faceZones zoneList \n
Specify faceZones to write, with wildcards
\param -cellZone zoneName \n
Specify single cellZone to write (not lagrangian)
Note
Parallel support for cloud data is not supported
- writes to \a EnSight directory to avoid collisions with foamToEnsightParts
......@@ -72,6 +75,9 @@ Note
#include "fvc.H"
#include "cellSet.H"
#include "fvMeshSubset.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -128,6 +134,12 @@ int main(int argc, char *argv[])
"wordReList",
"specify faceZones to write - eg '( slice \"mfp-.*\" )'."
);
argList::addOption
(
"cellZone",
"word",
"specify cellZone to write"
);
#include "setRootCase.H"
......@@ -212,9 +224,28 @@ int main(int argc, char *argv[])
zonePatterns = wordReList(args.optionLookup("faceZones")());
}
word cellZoneName;
const bool doCellZone = args.optionReadIfPresent("cellZone", cellZoneName);
fvMeshSubset meshSubsetter(mesh);
if (doCellZone)
{
Info<< "Converting cellZone " << cellZoneName
<< " only (puts outside faces into patch "
<< mesh.boundaryMesh()[0].name()
<< ")" << endl;
const cellZone& cz = mesh.cellZones()[cellZoneName];
cellSet c0(mesh, "c0", labelHashSet(cz));
meshSubsetter.setLargeCellSubset(c0, 0);
}
ensightMesh eMesh
(
mesh,
(
meshSubsetter.hasSubMesh()
? meshSubsetter.subMesh()
: meshSubsetter.baseMesh()
),
args.optionFound("noPatches"),
selectedPatches,
patchPatterns,
......@@ -349,6 +380,17 @@ int main(int argc, char *argv[])
Info<< "Translating time = " << runTime.timeName() << nl;
polyMesh::readUpdateState meshState = mesh.readUpdate();
if (timeIndex != 0 && meshSubsetter.hasSubMesh())
{
Info<< "Converting cellZone " << cellZoneName
<< " only (puts outside faces into patch "
<< mesh.boundaryMesh()[0].name()
<< ")" << endl;
const cellZone& cz = mesh.cellZones()[cellZoneName];
cellSet c0(mesh, "c0", labelHashSet(cz));
meshSubsetter.setLargeCellSubset(c0, 0);
}
if (meshState != polyMesh::UNCHANGED)
{
......@@ -406,9 +448,10 @@ int main(int argc, char *argv[])
if (volFieldTypes[i] == volScalarField::typeName)
{
volScalarField vf(fieldObject, mesh);
ensightField<scalar>
(
fieldObject,
volField(meshSubsetter, vf),
eMesh,
ensightDir,
prepend,
......@@ -420,9 +463,10 @@ int main(int argc, char *argv[])
}
else if (volFieldTypes[i] == volVectorField::typeName)
{
volVectorField vf(fieldObject, mesh);
ensightField<vector>
(
fieldObject,
volField(meshSubsetter, vf),
eMesh,
ensightDir,
prepend,
......@@ -434,9 +478,10 @@ int main(int argc, char *argv[])
}
else if (volFieldTypes[i] == volSphericalTensorField::typeName)
{
volSphericalTensorField vf(fieldObject, mesh);
ensightField<sphericalTensor>
(
fieldObject,
volField(meshSubsetter, vf),
eMesh,
ensightDir,
prepend,
......@@ -448,9 +493,10 @@ int main(int argc, char *argv[])
}
else if (volFieldTypes[i] == volSymmTensorField::typeName)
{
volSymmTensorField vf(fieldObject, mesh);
ensightField<symmTensor>
(
fieldObject,
volField(meshSubsetter, vf),
eMesh,
ensightDir,
prepend,
......@@ -462,9 +508,10 @@ int main(int argc, char *argv[])
}
else if (volFieldTypes[i] == volTensorField::typeName)
{
volTensorField vf(fieldObject, mesh);
ensightField<tensor>
(
fieldObject,
volField(meshSubsetter, vf),
eMesh,
ensightDir,
prepend,
......
......@@ -952,8 +952,20 @@ int main(int argc, char *argv[])
forAllConstIter(dictionary, dict, iter)
{
if (!iter().isDict())
{
continue;
}
const dictionary& surfaceDict = iter().dict();
if (!surfaceDict.found("extractionMethod"))
{
continue;
}
const word extractionMethod = surfaceDict.lookup("extractionMethod");
const fileName surfFileName = iter().keyword();
const fileName sFeatFileName = surfFileName.lessExt().name();
......@@ -971,8 +983,6 @@ int main(int argc, char *argv[])
const Switch closeness =
surfaceDict.lookupOrDefault<Switch>("closeness", "off");
const word extractionMethod = surfaceDict.lookup("extractionMethod");
Info<< nl << "Feature line extraction is only valid on closed manifold "
<< "surfaces." << endl;
......
......@@ -30,6 +30,9 @@ sh/csh variants:
* scotch.sh
application settings for compiling against scotch
* metis.sh
application settings for compiling against metis 5
---
The config/example directory contains various example configuration files
......
......@@ -146,7 +146,7 @@ bool Foam::entry::New(dictionary& parentDict, Istream& is)
if (ePtr)
{
// Read as primitiveEntry
const word newKeyword(ePtr->stream());
const keyType newKeyword(ePtr->stream());
return parentDict.add
(
......
......@@ -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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -37,6 +37,14 @@ namespace functionEntries
{
defineTypeNameAndDebug(calcEntry, 0);
addToMemberFunctionSelectionTable
(
functionEntry,
calcEntry,
execute,
dictionaryIstream
);
addToMemberFunctionSelectionTable
(
functionEntry,
......@@ -96,4 +104,48 @@ bool Foam::functionEntries::calcEntry::execute
}
bool Foam::functionEntries::calcEntry::execute
(
dictionary& parentDict,
Istream& is
)
{
Info<< "Using #calcEntry at line " << is.lineNumber()
<< " in file " << parentDict.name() << endl;
dynamicCode::checkSecurity
(
"functionEntries::calcEntry::execute(..)",
parentDict
);
// Read string
string s(is);
// Make sure we stop this entry
//is.putBack(token(token::END_STATEMENT, is.lineNumber()));
// Construct codeDict for codeStream
// must reference parent for stringOps::expand to work nicely.
dictionary codeSubDict;
codeSubDict.add("code", "os << (" + s + ");");
dictionary codeDict(parentDict, codeSubDict);
codeStream::streamingFunctionType function = codeStream::getFunction
(
parentDict,
codeDict
);
// use function to write stream
OStringStream os(is.format());
(*function)(os, parentDict);
// get the entry from this stream
IStringStream resultStream(os.str());
parentDict.read(resultStream);