Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2010-02-12 19:12:51 +00:00
31 changed files with 393 additions and 791 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -39,16 +39,6 @@ Usage
Specify an alternative geometry scaling factor.
The default is @b 1000 (scale @em [m] to @em [mm]).
@param -surface \n
Extract the surface of the volume mesh only.
This can be useful, for example, for surface morphing in an external
package.
@param -tri \n
Extract a triangulated surface.
The @b -surface options is implicitly selected.
Note
The cellTable information available in the files
@c constant/cellTable and @c constant/polyMesh/cellTableId
@ -87,34 +77,13 @@ int main(int argc, char *argv[])
"noBnd",
"suppress writing the .bnd file"
);
argList::addBoolOption
(
"tri",
"Extract a triangulated surface. Implies -surface"
);
argList::addBoolOption
(
"surface",
"extract the surface of the volume mesh only"
);
# include "setRootCase.H"
# include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
bool surfaceOnly = false;
if (args.optionFound("surface") || args.optionFound("tri"))
{
surfaceOnly = true;
}
fileName exportName = meshWriter::defaultMeshName;
if (surfaceOnly)
{
exportName = meshWriter::defaultSurfaceName;
}
if (args.optionFound("case"))
{
exportName += '-' + args.globalCaseName();
@ -132,7 +101,6 @@ int main(int argc, char *argv[])
# include "createPolyMesh.H"
forAll(timeDirs, timeI)
{
runTime.setTime(timeDirs[timeI], timeI);
@ -156,21 +124,7 @@ int main(int argc, char *argv[])
meshName += '_' + runTime.timeName();
}
if (surfaceOnly)
{
if (args.optionFound("tri"))
{
writer.writeSurface(meshName, true);
}
else
{
writer.writeSurface(meshName);
}
}
else
{
writer.write(meshName);
}
writer.write(meshName);
}
Info<< nl << endl;

View File

@ -36,6 +36,9 @@ Usage
Specify an alternative geometry scaling factor.
Eg, use @b 1000 to scale @em [m] to @em [mm].
@param -tri \n
Triangulate surface.
\*---------------------------------------------------------------------------*/
#include "argList.H"
@ -62,6 +65,11 @@ int main(int argc, char *argv[])
"scale",
"specify geometry scaling factor"
);
argList::addBoolOption
(
"tri",
"triangulate surface"
);
# include "setRootCase.H"
@ -69,6 +77,7 @@ int main(int argc, char *argv[])
scalar scaleFactor = 0;
args.optionReadIfPresent<scalar>("scale", scaleFactor);
const bool doTriangulate = args.optionFound("tri");
fileName exportName(params[0]);
@ -107,6 +116,12 @@ int main(int argc, char *argv[])
surf.scalePoints(scaleFactor);
Info<< "writing " << exportName;
if (doTriangulate)
{
Info<< " triangulated";
surf.triangulate();
}
if (scaleFactor <= 0)
{
Info<< " without scaling" << endl;

View File

@ -260,11 +260,31 @@ int main(int argc, char *argv[])
procMeshes.boundaryProcAddressing()
);
pointReconstructor.reconstructFields<scalar>(objects);
pointReconstructor.reconstructFields<vector>(objects);
pointReconstructor.reconstructFields<sphericalTensor>(objects);
pointReconstructor.reconstructFields<symmTensor>(objects);
pointReconstructor.reconstructFields<tensor>(objects);
pointReconstructor.reconstructFields<scalar>
(
objects,
selectedFields
);
pointReconstructor.reconstructFields<vector>
(
objects,
selectedFields
);
pointReconstructor.reconstructFields<sphericalTensor>
(
objects,
selectedFields
);
pointReconstructor.reconstructFields<symmTensor>
(
objects,
selectedFields
);
pointReconstructor.reconstructFields<tensor>
(
objects,
selectedFields
);
}
else
{

View File

@ -30,13 +30,10 @@ License
#include "fvMesh.H"
#include "globalMeshData.H"
#include "PstreamCombineReduceOps.H"
#include "processorPolyPatch.H"
#include "cellModeller.H"
#include "IOmanip.H"
#include "itoa.H"
#include "ensightWriteBinary.H"
#include "globalIndex.H"
#include "PackedBoolList.H"
#include "mapDistribute.H"
#include <fstream>
@ -1111,14 +1108,11 @@ void Foam::ensightMesh::writeAllFacePrimsBinary
writeEnsDataBinary(key,ensightGeometryFile);
writeEnsDataBinary(nPrims,ensightGeometryFile);
if (&prims != NULL)
{
writeFacePrimsBinary
(
UIndirectList<face>(patchFaces, prims)(),
ensightGeometryFile
);
}
writeFacePrimsBinary
(
UIndirectList<face>(patchFaces, prims)(),
ensightGeometryFile
);
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
@ -1348,17 +1342,18 @@ void Foam::ensightMesh::writeAscii
// Renumber the patch points/faces into unique points
labelList pointToGlobal;
labelList uniquePointLabels;
labelList uniqueMeshPointLabels;
autoPtr<globalIndex> globalPointsPtr =
mesh_.globalData().mergePoints
(
p.meshPoints(),
p.meshPointMap(),
pointToGlobal,
uniquePointLabels
uniqueMeshPointLabels
);
pointField uniquePoints(p.localPoints(), uniquePointLabels);
pointField uniquePoints(mesh_.points(), uniqueMeshPointLabels);
// Renumber the patch faces
faceList patchFaces(p.localFaces());
forAll(patchFaces, i)
@ -1601,16 +1596,17 @@ void Foam::ensightMesh::writeBinary
// Renumber the patch points/faces into unique points
labelList pointToGlobal;
labelList uniquePointLabels;
labelList uniqueMeshPointLabels;
autoPtr<globalIndex> globalPointsPtr =
mesh_.globalData().mergePoints
(
p.meshPoints(),
p.meshPointMap(),
pointToGlobal,
uniquePointLabels
uniqueMeshPointLabels
);
pointField uniquePoints(p.localPoints(), uniquePointLabels);
pointField uniquePoints(mesh_.points(), uniqueMeshPointLabels);
// Renumber the patch faces
faceList patchFaces(p.localFaces());
forAll(patchFaces, i)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -50,6 +50,9 @@ Usage
@param -to \<coordinateSystem\> \n
Specify a coordinate System when writing files.
@param -tri \n
Triangulate surface.
Note
The filename extensions are used to determine the file format type.
@ -73,13 +76,47 @@ int main(int argc, char *argv[])
argList::validArgs.append("inputFile");
argList::validArgs.append("outputFile");
argList::addBoolOption("clean");
argList::addBoolOption
(
"clean",
"perform some surface checking/cleanup on the input surface"
);
argList::addOption
(
"scaleIn",
"scale",
"specify input geometry scaling factor"
);
argList::addOption
(
"scaleOut",
"scale",
"specify output geometry scaling factor"
);
argList::addOption
(
"dict",
"file",
"specify alternative dictionary for the coordinateSystems descriptions"
);
argList::addOption
(
"from",
"system",
"specify the source coordinate system, applied after '-scaleIn'"
);
argList::addOption
(
"to",
"system",
"specify the target coordinate system, applied before '-scaleOut'"
);
argList::addBoolOption
(
"tri",
"triangulate surface"
);
argList::addOption("scaleIn", "scale");
argList::addOption("scaleOut", "scale");
argList::addOption("dict", "coordinateSystemsDict");
argList::addOption("from", "sourceCoordinateSystem");
argList::addOption("to", "targetCoordinateSystem");
argList args(argc, argv);
Time runTime(args.rootPath(), args.caseName());
@ -242,6 +279,12 @@ int main(int argc, char *argv[])
surf.scalePoints(scaleOut);
}
if (args.optionFound("tri"))
{
Info<< "triangulate" << endl;
surf.triangulate();
}
Info<< "writing " << exportName;
surf.write(exportName);
}

View File

@ -35,7 +35,7 @@
# determine the cmake to be used
unset CMAKE_HOME
for cmake in cmake-2.6.4 cmake-2.6.2 cmake-2.4.6
for cmake in cmake-2.8.0 cmake-2.6.4 cmake-2.6.2 cmake-2.4.6
do
cmake=$WM_THIRD_PARTY_DIR/$cmake/platforms/$WM_ARCH
if [ -r $cmake ]

View File

@ -35,7 +35,7 @@
# determine the cmake to be used
unsetenv CMAKE_HOME
foreach cmake ( cmake-2.6.4 cmake-2.6.2 cmake-2.4.6 )
foreach cmake ( cmake-2.8.0 cmake-2.6.4 cmake-2.6.2 cmake-2.4.6 )
set cmake=$WM_THIRD_PARTY_DIR/$cmake/platforms/$WM_ARCH
if ( -r $cmake ) then
setenv CMAKE_HOME $cmake

View File

@ -1705,7 +1705,7 @@ Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints
const labelList& meshPoints,
const Map<label>& meshPointMap,
labelList& pointToGlobal,
labelList& uniquePoints
labelList& uniqueMeshPoints
) const
{
const indirectPrimitivePatch& cpp = coupledPatch();
@ -1713,125 +1713,175 @@ Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints
const mapDistribute& pointSlavesMap = globalPointSlavesMap();
// 1. Count number of masters on my processor.
label nCoupledMaster = 0;
label nCoupledSlave = 0;
PackedBoolList isMaster(meshPoints.size(), 1);
// The patch points come in two variants:
// - not on a coupled patch so guaranteed unique
// - on a coupled patch
// If the point is on a coupled patch the problem is that the
// master-slave structure (globalPointSlaves etc.) assigns one of the
// coupled points to be the master but this master point is not
// necessarily on the patch itself! (it might just be connected to the
// patch point via coupled patches).
// So this means that all master point loops should be over the
// master-slave structure, not over the patch points and that the unique
// point returned is a mesh point.
// (unless we want to do the whole master-slave analysis again for the
// current patch only).
forAll(meshPoints, localPointI)
// Determine mapping from coupled point to patch point and vice versa
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
labelList patchToCoupled(meshPoints.size(), -1);
label nCoupled = 0;
labelList coupledToPatch(pointSlavesMap.constructSize(), -1);
// Note: loop over patch since usually smaller
forAll(meshPoints, patchPointI)
{
label meshPointI = meshPoints[localPointI];
label meshPointI = meshPoints[patchPointI];
Map<label>::const_iterator iter = cpp.meshPointMap().find(meshPointI);
if (iter != cpp.meshPointMap().end())
{
// My localPointI is a coupled point.
patchToCoupled[patchPointI] = iter();
coupledToPatch[iter()] = patchPointI;
nCoupled++;
}
}
label coupledPointI = iter();
//Pout<< "Patch:" << nl
// << " points:" << meshPoints.size() << nl
// << " of which on coupled patch:" << nCoupled << endl;
if (pointSlaves[coupledPointI].size() > 0)
// Pull coupled-to-patch information to master
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pointSlavesMap.distribute(coupledToPatch);
// Check on master whether point is anywhere on patch
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// List of master points that are on the patch
DynamicList<label> masterPoints(pointSlaves.size());
forAll(pointSlaves, coupledPointI)
{
const labelList& slaves = pointSlaves[coupledPointI];
if (slaves.size() > 0)
{
// I am master. Is this point on the patch on myself or on any
// any slave?
if (coupledToPatch[coupledPointI] != -1)
{
nCoupledMaster++;
masterPoints.append(coupledPointI);
}
else
{
isMaster[localPointI] = 0;
nCoupledSlave++;
}
}
}
label myUniquePoints = meshPoints.size() - nCoupledSlave;
Pout<< "Points :" << nl
<< " patch : " << meshPoints.size() << nl
<< " of which coupled : " << nCoupledMaster+nCoupledSlave << nl
<< " of which master : " << nCoupledMaster << nl
<< " of which slave : " << nCoupledSlave << nl
<< endl;
// 2. Create global indexing for unique points.
autoPtr<globalIndex> globalPointsPtr(new globalIndex(myUniquePoints));
// 3. Assign global point numbers. Keep slaves unset.
pointToGlobal.setSize(meshPoints.size());
pointToGlobal = -1;
uniquePoints.setSize(myUniquePoints);
label nMaster = 0;
forAll(isMaster, localPointI)
{
if (isMaster[localPointI])
{
pointToGlobal[localPointI] = globalPointsPtr().toGlobal(nMaster);
uniquePoints[nMaster] = localPointI;
nMaster++;
}
}
// 4. Push global index for coupled points to slaves.
{
labelList masterToGlobal(pointSlavesMap.constructSize(), -1);
forAll(meshPoints, localPointI)
{
label meshPointI = meshPoints[localPointI];
Map<label>::const_iterator iter = cpp.meshPointMap().find
(
meshPointI
);
if (iter != cpp.meshPointMap().end())
{
// My localPointI is a coupled point.
label coupledPointI = iter();
const labelList& slaves = pointSlaves[coupledPointI];
if (slaves.size() > 0)
forAll(slaves, i)
{
// Duplicate master globalpoint into slave slots
masterToGlobal[coupledPointI] = pointToGlobal[localPointI];
forAll(slaves, i)
if (coupledToPatch[slaves[i]] != -1)
{
masterToGlobal[slaves[i]] = pointToGlobal[localPointI];
masterPoints.append(coupledPointI);
break;
}
}
}
}
}
// Send back
pointSlavesMap.reverseDistribute(cpp.nPoints(), masterToGlobal);
// On slave copy master index into overal map.
forAll(meshPoints, localPointI)
// Create global indexing
// ~~~~~~~~~~~~~~~~~~~~~~
// 1. patch points that are not on coupled patch:
// meshPoints.size()-nCoupled
// 2. master points that are on patch:
// masterPoints.size()
label myUniquePoints = meshPoints.size()-nCoupled+masterPoints.size();
autoPtr<globalIndex> globalPointsPtr(new globalIndex(myUniquePoints));
//Pout<< "CoupledPatch:" << nl
// << " points:" << cpp.nPoints() << nl
// << " of which on patch:" << masterPoints.size() << endl;
// Allocate unique points
// ~~~~~~~~~~~~~~~~~~~~~~
pointToGlobal.setSize(meshPoints.size());
pointToGlobal = -1;
uniqueMeshPoints.setSize(myUniquePoints);
// Allocate globals for uncoupled patch points
label nMaster = 0;
forAll(patchToCoupled, patchPointI)
{
if (patchToCoupled[patchPointI] == -1)
{
label meshPointI = meshPoints[localPointI];
// Allocate global point
label globalI = globalPointsPtr().toGlobal(nMaster);
pointToGlobal[patchPointI] = globalI;
uniqueMeshPoints[nMaster] = meshPoints[patchPointI];
nMaster++;
}
}
Map<label>::const_iterator iter = cpp.meshPointMap().find
(
meshPointI
);
// Allocate globals for master
labelList masterToGlobal(pointSlavesMap.constructSize(), -456);
if (iter != cpp.meshPointMap().end())
forAll(masterPoints, i)
{
label coupledPointI = masterPoints[i];
// Allocate global point
label globalI = globalPointsPtr().toGlobal(nMaster);
if (coupledToPatch[coupledPointI] != -1)
{
pointToGlobal[coupledToPatch[coupledPointI]] = globalI;
}
uniqueMeshPoints[nMaster] = cpp.meshPoints()[coupledPointI];
nMaster++;
// Put global into slave slots
const labelList& slaves = pointSlaves[coupledPointI];
masterToGlobal[coupledPointI] = globalI; // not really necessary
forAll(slaves, i)
{
masterToGlobal[slaves[i]] = globalI;
}
}
if (nMaster != myUniquePoints)
{
FatalErrorIn("globalMeshData::mergePoints(..)")
<< "problem." << abort(FatalError);
}
// Send back (from slave slots) to originating processor
pointSlavesMap.reverseDistribute(cpp.nPoints(), masterToGlobal);
// On slaves take over global number
forAll(patchToCoupled, patchPointI)
{
label coupledPointI = patchToCoupled[patchPointI];
if (coupledPointI != -1)
{
const labelList& slaves = pointSlaves[coupledPointI];
if (slaves.size() == 0)
{
// My localPointI is a coupled point.
label coupledPointI = iter();
const labelList& slaves = pointSlaves[coupledPointI];
if (slaves.size() == 0)
{
pointToGlobal[localPointI] = masterToGlobal[coupledPointI];
}
pointToGlobal[patchPointI] = masterToGlobal[coupledPointI];
}
}
}
return globalPointsPtr;
}

View File

@ -560,13 +560,17 @@ public:
) const;
//- Helper for merging patch point data. Takes maps from
// local points to/from mesh
// local points to/from mesh. Determines
// - my unique points. These are mesh points, not patch points
// since the master might not be on the patch.
// - global numbering over all unique indices.
// - the global number for all local points.
autoPtr<globalIndex> mergePoints
(
const labelList& meshPoints,
const Map<label>& meshPointMap,
labelList& pointToGlobal,
labelList& uniquePoints
labelList& uniqueMeshPoints
) const;

View File

@ -29,6 +29,9 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
Foam::string Foam::meshWriter::defaultMeshName = "meshExport";
const Foam::cellModel* Foam::meshWriter::unknownModel = Foam::cellModeller::
lookup
(
@ -64,10 +67,6 @@ lookup
);
Foam::string Foam::meshWriter::defaultMeshName = "meshExport";
Foam::string Foam::meshWriter::defaultSurfaceName = "surfExport";
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::meshWriter::meshWriter(const polyMesh& mesh, const scalar scaleFactor)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -85,7 +85,7 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class meshWriter Declaration
Class meshWriter Declaration
\*---------------------------------------------------------------------------*/
class meshWriter
@ -133,13 +133,12 @@ public:
// Static data members
//- Specify a default mesh name
static string defaultMeshName;
static string defaultSurfaceName;
// Constructors
//- Ccreate a writer obejct
//- Create a writer obejct
meshWriter
(
const polyMesh&,
@ -167,26 +166,14 @@ public:
writeBoundary_ = false;
}
// Write
//- Write volume mesh
// subclass must to supply this method
//- Write volume mesh. Subclass must supply this method
virtual bool write
(
const fileName& timeName = fileName::null
) const = 0;
//- Write surface mesh with optional triangulation
// subclass could supply this information
virtual bool writeSurface
(
const fileName& timeName = fileName::null,
const bool triangulate = false
) const
{
return false;
}
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -527,201 +527,4 @@ bool Foam::meshWriters::STARCD::write(const fileName& meshName) const
}
bool Foam::meshWriters::STARCD::writeSurface
(
const fileName& meshName,
const bool triangulate
) const
{
fileName baseName(meshName);
if (baseName.empty())
{
baseName = meshWriter::defaultSurfaceName;
if
(
mesh_.time().timeName() != "0"
&& mesh_.time().timeName() != "constant"
)
{
baseName += "_" + mesh_.time().timeName();
}
}
rmFiles(baseName);
OFstream celFile(baseName + ".cel");
writeHeader(celFile, "CELL");
Info<< "Writing " << celFile.name() << endl;
// mesh and patch info
const pointField& points = mesh_.points();
const labelList& owner = mesh_.faceOwner();
const faceList& meshFaces = mesh_.faces();
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
label shapeId = 3; // shell/baffle element
label typeId = 4; // 4(shell)
// remember which points need to be written
labelHashSet pointHash;
// write boundary faces as normal STAR-CD mesh
if (triangulate)
{
// cell Id has no particular meaning - just increment
// use the cellTable id from the patch Number
label cellId = 0;
forAll(patches, patchI)
{
label patchStart = patches[patchI].start();
label patchSize = patches[patchI].size();
label ctableId = patchI + 1;
for
(
label faceI = patchStart;
faceI < (patchStart + patchSize);
++faceI
)
{
const face& f = meshFaces[faceI];
label nTri = f.nTriangles(points);
faceList triFaces;
// triangulate polygons, but not quads
if (nTri <= 2)
{
triFaces.setSize(1);
triFaces[0] = f;
}
else
{
triFaces.setSize(nTri);
nTri = 0;
f.triangles(points, nTri, triFaces);
}
forAll(triFaces, faceI)
{
const labelList& vrtList = triFaces[faceI];
celFile
<< cellId + 1 << " "
<< shapeId << " "
<< vrtList.size() << " "
<< ctableId << " "
<< typeId;
// must be 3 (triangle) but could be quad
label count = 0;
forAll(vrtList, i)
{
if ((count % 8) == 0)
{
celFile
<< nl
<< " " << cellId + 1;
}
// remember which points we'll need to write
pointHash.insert(vrtList[i]);
celFile << " " << vrtList[i] + 1;
count++;
}
celFile << endl;
cellId++;
}
}
}
}
else
{
// cell Id is the OpenFOAM face Id
// use the cellTable id from the face owner
// - allows separation of parts
forAll(patches, patchI)
{
label patchStart = patches[patchI].start();
label patchSize = patches[patchI].size();
for
(
label faceI = patchStart;
faceI < (patchStart + patchSize);
++faceI
)
{
const labelList& vrtList = meshFaces[faceI];
label cellId = faceI;
celFile
<< cellId + 1 << " "
<< shapeId << " "
<< vrtList.size() << " "
<< cellTableId_[owner[faceI]] << " "
<< typeId;
// likely <= 8 vertices, but prevent overrun anyhow
label count = 0;
forAll(vrtList, i)
{
if ((count % 8) == 0)
{
celFile
<< nl
<< " " << cellId + 1;
}
// remember which points we'll need to write
pointHash.insert(vrtList[i]);
celFile << " " << vrtList[i] + 1;
count++;
}
celFile << endl;
}
}
}
OFstream vrtFile(baseName + ".vrt");
writeHeader(vrtFile, "VERTEX");
vrtFile.precision(10);
vrtFile.setf(std::ios::showpoint); // force decimal point for Fortran
Info<< "Writing " << vrtFile.name() << endl;
// build sorted table of contents
SortableList<label> toc(pointHash.size());
{
label i = 0;
forAllConstIter(labelHashSet, pointHash, iter)
{
toc[i++] = iter.key();
}
}
toc.sort();
toc.shrink();
pointHash.clear();
// write points in sorted order
forAll(toc, i)
{
label vrtId = toc[i];
vrtFile
<< vrtId + 1
<< " " << scaleFactor_ * points[vrtId].x()
<< " " << scaleFactor_ * points[vrtId].y()
<< " " << scaleFactor_ * points[vrtId].z()
<< endl;
}
return true;
}
// ************************************************************************* //

View File

@ -28,11 +28,6 @@ Class
Description
Writes polyMesh in pro-STAR (v4) bnd/cel/vrt format
Alternatively, extracts the surface of the FOAM mesh into
pro-STAR (v4) .cel/.vrt/ format.
This can be useful, for example, for surface morphing in an external
package.
The cellTableId and cellTable information are used (if available).
Otherwise the cellZones are used (if available).
@ -131,12 +126,6 @@ public:
const fileName& meshName = fileName::null
) const;
//- Write surface mesh with optional triangulation
virtual bool writeSurface
(
const fileName& meshName = fileName::null,
const bool triangulate = false
) const;
};

View File

@ -138,7 +138,11 @@ public:
//- Reconstruct and write all fields
template<class Type>
void reconstructFields(const IOobjectList& objects);
void reconstructFields
(
const IOobjectList& objects,
const HashSet<word>& selectedFields
);
};

View File

@ -143,7 +143,8 @@ Foam::pointFieldReconstructor::reconstructField(const IOobject& fieldIoObject)
template<class Type>
void Foam::pointFieldReconstructor::reconstructFields
(
const IOobjectList& objects
const IOobjectList& objects,
const HashSet<word>& selectedFields
)
{
word fieldClassName
@ -157,16 +158,18 @@ void Foam::pointFieldReconstructor::reconstructFields
{
Info<< " Reconstructing " << fieldClassName << "s\n" << endl;
for
(
IOobjectList::iterator fieldIter = fields.begin();
fieldIter != fields.end();
++fieldIter
)
forAllConstIter(IOobjectList, fields, fieldIter)
{
Info<< " " << fieldIter()->name() << endl;
if
(
!selectedFields.size()
|| selectedFields.found(fieldIter()->name())
)
{
Info<< " " << fieldIter()->name() << endl;
reconstructField<Type>(*fieldIter())().write();
reconstructField<Type>(*fieldIter())().write();
}
}
Info<< endl;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -225,9 +225,9 @@ void Foam::fileFormats::OBJsurfaceFormat<Face>::write
// for no zones, suppress the group name
const List<surfZone>& zones =
(
surf.surfZones().size() > 1
? surf.surfZones()
: oneZone(faceLst, "")
surf.surfZones().empty()
? oneZone(faceLst, "")
: surf.surfZones()
);
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -52,9 +52,9 @@ void Foam::fileFormats::SMESHsurfaceFormat<Face>::write
const List<surfZone>& zones =
(
surf.surfZones().size() > 1
? surf.surfZones()
: oneZone(faceLst)
surf.surfZones().empty()
? oneZone(faceLst)
: surf.surfZones()
);
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -256,9 +256,9 @@ void Foam::fileFormats::STARCDsurfaceFormat<Face>::write
const List<surfZone>& zones =
(
surf.surfZones().size() > 1
? surf.surfZones()
: oneZone(faceLst)
surf.surfZones().empty()
? oneZone(faceLst)
: surf.surfZones()
);
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -213,9 +213,9 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::writeAscii
const List<surfZone>& zones =
(
surf.surfZones().size() > 1
? surf.surfZones()
: oneZone(faceLst)
surf.surfZones().empty()
? oneZone(faceLst)
: surf.surfZones()
);
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -139,9 +139,9 @@ void Foam::fileFormats::TRIsurfaceFormat<Face>::write
const List<surfZone>& zones =
(
surf.surfZones().size() > 1
? surf.surfZones()
: oneZone(faceLst)
surf.surfZones().empty()
? oneZone(faceLst)
: surf.surfZones()
);
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -70,9 +70,9 @@ void Foam::fileFormats::VTKsurfaceFormat<Face>::write
const List<surfZone>& zones =
(
surf.surfZones().size() > 1
? surf.surfZones()
: oneZone(faceLst)
surf.surfZones().empty()
? oneZone(faceLst)
: surf.surfZones()
);
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -53,9 +53,9 @@ void Foam::fileFormats::WRLsurfaceFormat<Face>::write
// for no zones, suppress the group name
const List<surfZone>& zones =
(
surf.surfZones().size() > 1
? surf.surfZones()
: oneZone(faceLst, "")
surf.surfZones().empty()
? oneZone(faceLst, "")
: surf.surfZones()
);
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -55,9 +55,9 @@ void Foam::fileFormats::X3DsurfaceFormat<Face>::write
// for no zones, suppress the group name
const List<surfZone>& zones =
(
surf.surfZones().size() > 1
? surf.surfZones()
: oneZone(faceLst, "")
surf.surfZones().empty()
? oneZone(faceLst, "")
: surf.surfZones()
);
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);

View File

@ -38,12 +38,6 @@ boundaryField
momentOfInertia (0.08622222 0.08622222 0.144);
mass 9.6;
rhoInf 1; // for forces calculation
// See sixDoFRigidBodyMotionState
Q (1 0 0 0 1 0 0 0 1);
v (0 0 0);
a (0 0 0);
pi (0 0 0);
tau (0 0 0);
value uniform (0 0 0);
}
}

View File

@ -18,7 +18,7 @@ FoamFile
solvers
{
cellDisplacement
{
{
solver GAMG;
tolerance 1e-08;
relTol 0;
@ -27,7 +27,7 @@ solvers
nCellsInCoarsestLevel 10;
agglomerator faceAreaPair;
mergeLevels 1;
}
}
pcorr
{
@ -117,7 +117,7 @@ PISO
nAlphaCorr 1;
nAlphaSubCycles 1;
cAlpha 1.5;
correctPhi no;
correctPhi yes;
}
relaxationFactors

View File

@ -1,4 +1,7 @@
# handie Coco/R attributed grammars
# handle Coco/R attributed grammars written for the C++ version
# http://www.ssw.uni-linz.ac.at/Coco/
# http://github.com/olesenm/coco-cpp/
#
.SUFFIXES: .atg

View File

@ -4,7 +4,7 @@ include $(GENERAL_RULES)/sourceToDep
include $(GENERAL_RULES)/flex
include $(GENERAL_RULES)/flex++
include $(GENERAL_RULES)/coco
include $(GENERAL_RULES)/coco-cpp
## include $(GENERAL_RULES)/byacc
## include $(GENERAL_RULES)/btyacc++
include $(GENERAL_RULES)/bison

View File

@ -1,7 +1,11 @@
/*---------------------------------------------------------------------------*\
Attributed Grammar for Coco/R (-*- C++ -*- version)
compile with:
coco-cpp wmkdependParser.atg
coco-cpp wmkdependParser.atg
For example,
$WM_THIRD_PARTY_DIR/coco-cpp/platforms/$WM_ARCH$WM_COMPILER/bin/coco-cpp \
-frames $WM_THIRD_PARTY_DIR/coco-cpp/platforms/share/coco-cpp \
wmkdependParser.atg
\*---------------------------------------------------------------------------*/
[copy]
/*---------------------------------*- C++ -*---------------------------------*\
@ -42,140 +46,7 @@ SourceFiles
#include <iostream>
#include <string>
#include <list>
//! @brief A simple HashTable implementation
/**
* @note This hash table is only vaguely STL-like. In accordance with
* its present purpose, this hash table only supports a constIterator
* and no deletions. For simplicity, the constIterator increment is
* simply via a next() method. Instead of comparing to an end value,
* the constIterator valid() method is used.
* For example,
* @code
* for
* (
* HashTable<foo>::constIterator iter = myHash.begin();
* iter.valid();
* iter.next()
* )
* {
* std::cerr<< "key: " << iter.key() << "\n";
* }
* @endcode
*
*/
class StringHashSet
{
//! An entry within the HashTable
struct hashedEntry
{
const std::string key_; //<! The lookup key
hashedEntry *next_; //<! Pointer to next hashedEntry in sub-list
hashedEntry(const std::string& key, hashedEntry *next=0)
:
key_(key), next_(next)
{}
};
const int size_; //<! fixed HashTable size
hashedEntry** table_;
public:
//! Construct with a default size
StringHashSet(int size = 500)
:
size_(size),
table_(new hashedEntry*[size_])
{
memset(table_, 0, size_ * sizeof(hashedEntry*));
}
//! Destructor
~StringHashSet()
{
for (int hashIdx = 0; hashIdx < size_; ++hashIdx)
{
hashedEntry* ep = table_[hashIdx];
while (ep)
{
hashedEntry* del = ep;
ep = ep->next_;
delete del;
}
}
delete[] table_;
table_ = 0;
}
//! Return hash index for lookup name in hash table
bool hashKeyIndex(const std::string& name) const
{
int hashIdx = 0;
// calculate hash index
for
(
std::string::const_iterator iter = name.begin();
iter != name.end();
++iter
)
{
hashIdx = hashIdx << 1 ^ *iter;
}
if (hashIdx < 0)
{
hashIdx = -hashIdx;
}
return hashIdx % size_;
}
//! Return true if name is found in hash table
bool found(const std::string& name) const
{
const int hashIdx = hashKeyIndex(name);
for (hashedEntry* ep = table_[hashIdx]; ep; ep = ep->next_)
{
if (name == ep->key_)
{
// found
return true;
}
}
// entry not found
return false;
}
//! Return true if name is found in hash table, insert if not found
bool foundOrInsert(const std::string& name)
{
const int hashIdx = hashKeyIndex(name);
for (hashedEntry* ep = table_[hashIdx]; ep; ep = ep->next_)
{
if (name == ep->key_)
{
// found - return true
return true;
}
}
// not found - insert it
table_[hashIdx] = new hashedEntry(name, table_[hashIdx]);
// entry not found (but was added) - return false
return false;
}
};
#include <set>
/*---------------------------------------------------------------------------*/
@ -188,11 +59,11 @@ COMPILER wmkdepend
/*---------------------------------------------------------------------------*/
private:
//! Hash of files already visited
static StringHashSet visitedFiles_;
//! Set of files already visited
static std::set<std::string> visitedFiles_;
//! Hash of (java) directories already visited
static StringHashSet visitedDirs_;
//! Set of (java) directories already visited
static std::set<std::string> visitedDirs_;
//! Replace all '.' with '/'
static void dotToSlash(std::string& name);
@ -224,8 +95,8 @@ public:
#include <sys/types.h>
#include <dirent.h>
StringHashSet Parser::visitedFiles_;
StringHashSet Parser::visitedDirs_;
std::set<std::string> Parser::visitedFiles_;
std::set<std::string> Parser::visitedDirs_;
std::list<std::string> Parser::includeDirs;
std::string Parser::sourceFile;
@ -246,15 +117,15 @@ void Parser::dotToSlash(std::string& name)
void Parser::ignoreDir(const std::string& name)
{
visitedDirs_.foundOrInsert(name);
visitedDirs_.insert(name);
}
void Parser::includeFile(const std::string& name)
{
if (visitedFiles_.foundOrInsert(name))
if (!visitedFiles_.insert(name).second)
{
return;
return; // already existed (did not insert)
}
// use stdio and buffering within Coco/R -- (faster)
@ -312,7 +183,7 @@ void Parser::importFile(const std::string& name)
std::string dirGlob = name.substr(0, dotPos);
dirGlob += ".*";
if (visitedDirs_.found(dirGlob))
if (visitedDirs_.find(dirGlob) != visitedDirs_.end())
{
return;
}
@ -329,9 +200,9 @@ void Parser::importFile(const std::string& name)
void Parser::importDir(const std::string& name)
{
if (visitedDirs_.foundOrInsert(name))
if (!visitedDirs_.insert(name).second)
{
return;
return; // already existed (did not insert)
}
std::string dirName = name;
@ -427,16 +298,16 @@ wmkdepend
[
"include"
[
string (.
if (isUTF8())
{
includeFile(t->toStringUTF8(1, t->length()-2));
}
else
{
includeFile(t->toString(1, t->length()-2));
}
.)
string (.
if (isUTF8())
{
includeFile(t->toStringUTF8(1, t->length()-2));
}
else
{
includeFile(t->toString(1, t->length()-2));
}
.)
]
]
[ ANY { ANY } ] '\n' // skip trailing junk
@ -444,42 +315,42 @@ wmkdepend
// Fortran-style includes
| "include"
[
sqstring (.
if (isUTF8())
{
includeFile(t->toStringUTF8(1, t->length()-2));
}
else
{
includeFile(t->toString(1, t->length()-2));
}
.)
sqstring (.
if (isUTF8())
{
includeFile(t->toStringUTF8(1, t->length()-2));
}
else
{
includeFile(t->toString(1, t->length()-2));
}
.)
]
[ ANY { ANY } ] '\n' // skip trailing junk
// Java imports
| "import"
(
package_dir (.
if (isUTF8())
{
importDir(t->toStringUTF8());
}
else
{
importDir(t->toString());
}
.)
| package_name (.
if (isUTF8())
{
importFile(t->toStringUTF8());
}
else
{
importFile(t->toString());
}
.)
package_dir (.
if (isUTF8())
{
importDir(t->toStringUTF8());
}
else
{
importDir(t->toString());
}
.)
| package_name (.
if (isUTF8())
{
importFile(t->toStringUTF8());
}
else
{
importFile(t->toString());
}
.)
)
';'
[ ANY { ANY } ] '\n' // skip trailing junk

View File

@ -52,8 +52,8 @@ namespace wmake {
#include <sys/types.h>
#include <dirent.h>
StringHashSet Parser::visitedFiles_;
StringHashSet Parser::visitedDirs_;
std::set<std::string> Parser::visitedFiles_;
std::set<std::string> Parser::visitedDirs_;
std::list<std::string> Parser::includeDirs;
std::string Parser::sourceFile;
@ -74,15 +74,15 @@ void Parser::dotToSlash(std::string& name)
void Parser::ignoreDir(const std::string& name)
{
visitedDirs_.foundOrInsert(name);
visitedDirs_.insert(name);
}
void Parser::includeFile(const std::string& name)
{
if (visitedFiles_.foundOrInsert(name))
if (!visitedFiles_.insert(name).second)
{
return;
return; // already existed (did not insert)
}
// use stdio and buffering within Coco/R -- (faster)
@ -140,7 +140,7 @@ void Parser::importFile(const std::string& name)
std::string dirGlob = name.substr(0, dotPos);
dirGlob += ".*";
if (visitedDirs_.found(dirGlob))
if (visitedDirs_.find(dirGlob) != visitedDirs_.end())
{
return;
}
@ -157,9 +157,9 @@ void Parser::importFile(const std::string& name)
void Parser::importDir(const std::string& name)
{
if (visitedDirs_.foundOrInsert(name))
if (!visitedDirs_.insert(name).second)
{
return;
return; // already existed (did not insert)
}
std::string dirName = name;

View File

@ -44,140 +44,7 @@ SourceFiles
#include <iostream>
#include <string>
#include <list>
//! @brief A simple HashTable implementation
/**
* @note This hash table is only vaguely STL-like. In accordance with
* its present purpose, this hash table only supports a constIterator
* and no deletions. For simplicity, the constIterator increment is
* simply via a next() method. Instead of comparing to an end value,
* the constIterator valid() method is used.
* For example,
* @code
* for
* (
* HashTable<foo>::constIterator iter = myHash.begin();
* iter.valid();
* iter.next()
* )
* {
* std::cerr<< "key: " << iter.key() << "\n";
* }
* @endcode
*
*/
class StringHashSet
{
//! An entry within the HashTable
struct hashedEntry
{
const std::string key_; //<! The lookup key
hashedEntry *next_; //<! Pointer to next hashedEntry in sub-list
hashedEntry(const std::string& key, hashedEntry *next=0)
:
key_(key), next_(next)
{}
};
const int size_; //<! fixed HashTable size
hashedEntry** table_;
public:
//! Construct with a default size
StringHashSet(int size = 500)
:
size_(size),
table_(new hashedEntry*[size_])
{
memset(table_, 0, size_ * sizeof(hashedEntry*));
}
//! Destructor
~StringHashSet()
{
for (int hashIdx = 0; hashIdx < size_; ++hashIdx)
{
hashedEntry* ep = table_[hashIdx];
while (ep)
{
hashedEntry* del = ep;
ep = ep->next_;
delete del;
}
}
delete[] table_;
table_ = 0;
}
//! Return hash index for lookup name in hash table
bool hashKeyIndex(const std::string& name) const
{
int hashIdx = 0;
// calculate hash index
for
(
std::string::const_iterator iter = name.begin();
iter != name.end();
++iter
)
{
hashIdx = hashIdx << 1 ^ *iter;
}
if (hashIdx < 0)
{
hashIdx = -hashIdx;
}
return hashIdx % size_;
}
//! Return true if name is found in hash table
bool found(const std::string& name) const
{
const int hashIdx = hashKeyIndex(name);
for (hashedEntry* ep = table_[hashIdx]; ep; ep = ep->next_)
{
if (name == ep->key_)
{
// found
return true;
}
}
// entry not found
return false;
}
//! Return true if name is found in hash table, insert if not found
bool foundOrInsert(const std::string& name)
{
const int hashIdx = hashKeyIndex(name);
for (hashedEntry* ep = table_[hashIdx]; ep; ep = ep->next_)
{
if (name == ep->key_)
{
// found - return true
return true;
}
}
// not found - insert it
table_[hashIdx] = new hashedEntry(name, table_[hashIdx]);
// entry not found (but was added) - return false
return false;
}
};
#include <set>
/*---------------------------------------------------------------------------*/
@ -191,7 +58,7 @@ namespace wmake {
/*---------------------------------------------------------------------------*\
Class Errors Declaration
\*---------------------------------------------------------------------------*/
//! Parser error handing
//! Parser error handling
class Errors
{
public:
@ -255,11 +122,11 @@ public:
private:
//! Hash of files already visited
static StringHashSet visitedFiles_;
//! Set of files already visited
static std::set<std::string> visitedFiles_;
//! Hash of (java) directories already visited
static StringHashSet visitedDirs_;
//! Set of (java) directories already visited
static std::set<std::string> visitedDirs_;
//! Replace all '.' with '/'
static void dotToSlash(std::string& name);

View File

@ -200,7 +200,7 @@ public:
Class Buffer Declaration
\*---------------------------------------------------------------------------*/
/*!
* @brief Scanner Buffer Token
* @brief Scanner Buffer
*
* This Buffer supports the following cases:
* -# seekable stream (file)