Merge commit 'origin/master' into splitCyclic

Conflicts:
	applications/utilities/parallelProcessing/decomposePar/decomposePar.C
	applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C
	applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H
	applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C
	src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.C
	src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.C
	src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.H
	src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C
	src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C
	src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H
	src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C
This commit is contained in:
mattijs
2010-03-09 21:28:53 +00:00
1005 changed files with 34625 additions and 13475 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
@ -41,8 +41,8 @@ using namespace Foam;
int main(int argc, char *argv[])
{
# include "addOverwriteOption.H"
argList::noParallel();
argList::addBoolOption("overwrite");
# include "setRootCase.H"
# include "createTime.H"
@ -50,7 +50,7 @@ int main(int argc, char *argv[])
# include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance();
bool overwrite = args.optionFound("overwrite");
const bool overwrite = args.optionFound("overwrite");
if (!overwrite)
{

View File

@ -1,10 +1,7 @@
EXE_INC = \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude
EXE_LIBS = \
-ltriSurface \
-ldynamicMesh \
-lmeshTools

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
@ -69,9 +69,9 @@ void collectFeatureEdges(const boundaryMesh& bMesh, labelList& markedEdges)
int main(int argc, char *argv[])
{
# include "addOverwriteOption.H"
argList::noParallel();
argList::validArgs.append("feature angle[0-180]");
argList::addBoolOption("overwrite");
# include "setRootCase.H"
# include "createTime.H"
@ -84,21 +84,20 @@ int main(int argc, char *argv[])
<< " s\n" << endl << endl;
//
// Use boundaryMesh to reuse all the featureEdge stuff in there.
//
const scalar featureAngle = args.argRead<scalar>(1);
const bool overwrite = args.optionFound("overwrite");
boundaryMesh bMesh;
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
bool overwrite = args.optionFound("overwrite");
scalar minCos = Foam::cos(degToRad(featureAngle));
const scalar minCos = Foam::cos(degToRad(featureAngle));
Info<< "Feature:" << featureAngle << endl
<< "minCos :" << minCos << endl
<< endl;
//
// Use boundaryMesh to reuse all the featureEdge stuff in there.
//
boundaryMesh bMesh;
bMesh.read(mesh);
// Set feature angle (calculate feature edges)

View File

@ -47,6 +47,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
Info<< " <<Writing " << nNonAligned
<< " points on non-aligned edges to set "
<< nonAlignedPoints.name() << endl;
nonAlignedPoints.instance() = mesh.pointsInstance();
nonAlignedPoints.write();
}
}
@ -67,6 +68,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
{
Info<< " <<Writing " << nNonClosed
<< " non closed cells to set " << cells.name() << endl;
cells.instance() = mesh.pointsInstance();
cells.write();
}
}
@ -78,6 +80,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
Info<< " <<Writing " << nHighAspect
<< " cells with high aspect ratio to set "
<< aspectCells.name() << endl;
aspectCells.instance() = mesh.pointsInstance();
aspectCells.write();
}
}
@ -94,6 +97,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
{
Info<< " <<Writing " << nFaces
<< " zero area faces to set " << faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
}
}
@ -111,6 +115,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
{
Info<< " <<Writing " << nCells
<< " zero volume cells to set " << cells.name() << endl;
cells.instance() = mesh.pointsInstance();
cells.write();
}
}
@ -129,6 +134,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
{
Info<< " <<Writing " << nFaces
<< " non-orthogonal faces to set " << faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
}
}
@ -147,6 +153,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
Info<< " <<Writing " << nFaces
<< " faces with incorrect orientation to set "
<< faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
}
}
@ -164,6 +171,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
{
Info<< " <<Writing " << nFaces
<< " skew faces to set " << faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
}
}
@ -184,6 +192,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
Info<< " <<Writing " << nPoints
<< " points on short edges to set " << points.name()
<< endl;
points.instance() = mesh.pointsInstance();
points.write();
}
}
@ -202,6 +211,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
Info<< " <<Writing " << nPoints
<< " near (closer than " << Foam::sqrt(minDistSqr)
<< " apart) points to set " << nearPoints.name() << endl;
nearPoints.instance() = mesh.pointsInstance();
nearPoints.write();
}
}
@ -221,6 +231,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
Info<< " <<Writing " << nFaces
<< " faces with concave angles to set " << faces.name()
<< endl;
faces.instance() = mesh.pointsInstance();
faces.write();
}
}
@ -239,6 +250,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
{
Info<< " <<Writing " << nFaces
<< " warped faces to set " << faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
}
}
@ -255,6 +267,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
Info<< " <<Writing " << nCells
<< " under-determined cells to set " << cells.name() << endl;
cells.instance() = mesh.pointsInstance();
cells.write();
}
}

View File

@ -89,6 +89,7 @@ Foam::label Foam::checkTopology
Info<< " <<Writing " << nPoints
<< " unused points to set " << points.name() << endl;
points.instance() = mesh.pointsInstance();
points.write();
}
}
@ -106,6 +107,7 @@ Foam::label Foam::checkTopology
{
Info<< " <<Writing " << nFaces
<< " unordered faces to set " << faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
}
}
@ -122,6 +124,7 @@ Foam::label Foam::checkTopology
Info<< " <<Writing " << nCells
<< " cells with over used edges to set " << cells.name()
<< endl;
cells.instance() = mesh.pointsInstance();
cells.write();
}
}
@ -137,6 +140,7 @@ Foam::label Foam::checkTopology
Info<< " <<Writing " << nFaces
<< " faces with out-of-range or duplicate vertices to set "
<< faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write();
}
}
@ -153,6 +157,7 @@ Foam::label Foam::checkTopology
Info<< " <<Writing " << nFaces
<< " faces with incorrect edges to set " << faces.name()
<< endl;
faces.instance() = mesh.pointsInstance();
faces.write();
}
}
@ -203,6 +208,7 @@ Foam::label Foam::checkTopology
<< " cells with with single non-boundary face to set "
<< oneCells.name()
<< endl;
oneCells.instance() = mesh.pointsInstance();
oneCells.write();
}
@ -214,6 +220,7 @@ Foam::label Foam::checkTopology
<< " cells with with single non-boundary face to set "
<< twoCells.name()
<< endl;
twoCells.instance() = mesh.pointsInstance();
twoCells.write();
}
}
@ -354,6 +361,7 @@ Foam::label Foam::checkTopology
<< " conflicting points to set "
<< points.name() << endl;
points.instance() = mesh.pointsInstance();
points.write();
}

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
@ -125,12 +125,13 @@ label findPatchID(const polyMesh& mesh, const word& name)
int main(int argc, char *argv[])
{
# include "addOverwriteOption.H"
# include "addRegionOption.H"
argList::validArgs.append("faceZone");
argList::validArgs.append("patch");
argList::addOption("additionalPatches", "(patch2 .. patchN)");
argList::addBoolOption("internalFacesOnly");
argList::addBoolOption("overwrite");
# include "setRootCase.H"
# include "createTime.H"
@ -142,7 +143,7 @@ int main(int argc, char *argv[])
const faceZoneMesh& faceZones = mesh.faceZones();
// Faces to baffle
faceZoneID zoneID(args.additionalArgs()[0], faceZones);
faceZoneID zoneID(args[1], faceZones);
Info<< "Converting faces on zone " << zoneID.name()
<< " into baffles." << nl << endl;
@ -167,7 +168,7 @@ int main(int argc, char *argv[])
// Patches to put baffles into
DynamicList<label> newPatches(1);
word patchName(args.additionalArgs()[1]);
const word patchName = args[2];
newPatches.append(findPatchID(mesh, patchName));
Info<< "Using patch " << patchName
<< " at index " << newPatches[0] << endl;
@ -191,9 +192,8 @@ int main(int argc, char *argv[])
}
bool overwrite = args.optionFound("overwrite");
bool internalFacesOnly = args.optionFound("internalFacesOnly");
const bool overwrite = args.optionFound("overwrite");
const bool internalFacesOnly = args.optionFound("internalFacesOnly");
if (internalFacesOnly)
{

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
@ -487,8 +487,8 @@ void syncPoints
int main(int argc, char *argv[])
{
# include "addOverwriteOption.H"
# include "addRegionOption.H"
argList::addBoolOption("overwrite");
# include "setRootCase.H"
# include "createTime.H"

View File

@ -43,6 +43,8 @@ FoamFile
matchTolerance 1E-3;
// Do a synchronisation of coupled points after creation of any patches.
// Note: this does not work with points that are on multiple coupled patches
// with transformations.
pointSync true;
// Patches to create.

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
@ -47,7 +47,7 @@ int main(int argc, char *argv[])
# include "setRootCase.H"
scalar scaleFactor(readScalar(IStringStream(args.additionalArgs()[0])()));
const scalar scaleFactor = args.argRead<scalar>(1);
# include "createTime.H"
# include "createMesh.H"

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
@ -51,9 +51,8 @@ int main(int argc, char *argv[])
# include "createTime.H"
# include "createPolyMesh.H"
fileName surfName(args.additionalArgs()[0]);
fileName setName(args.additionalArgs()[1]);
const fileName surfName = args[1];
const fileName setName = args[2];
// Read surface
Info<< "Reading surface from " << surfName << 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

View File

@ -15,13 +15,13 @@
FatalError.exit();
}
fileName rootDirMaster(args.additionalArgs()[0]);
fileName caseDirMaster(args.additionalArgs()[1]);
fileName rootDirMaster = args[1];
fileName caseDirMaster = args[2];
word masterRegion = polyMesh::defaultRegion;
args.optionReadIfPresent("masterRegion", masterRegion);
fileName rootDirToAdd(args.additionalArgs()[2]);
fileName caseDirToAdd(args.additionalArgs()[3]);
fileName rootDirToAdd = args[3];
fileName caseDirToAdd = args[4];
word addRegion = polyMesh::defaultRegion;
args.optionReadIfPresent("addRegion", addRegion);
@ -29,3 +29,4 @@
<< " region " << masterRegion << nl
<< "mesh to add: " << rootDirToAdd << " " << caseDirToAdd
<< " region " << addRegion << 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
@ -222,19 +222,20 @@ labelList findBaffles(const polyMesh& mesh, const labelList& boundaryFaces)
int main(int argc, char *argv[])
{
# include "addOverwriteOption.H"
# include "addRegionOption.H"
argList::addBoolOption("split");
argList::addBoolOption("overwrite");
argList::addBoolOption("detectOnly");
# include "setRootCase.H"
# include "createTime.H"
runTime.functionObjects().off();
# include "createNamedMesh.H"
const word oldInstance = mesh.pointsInstance();
bool split = args.optionFound("split");
bool overwrite = args.optionFound("overwrite");
bool detectOnly = args.optionFound("detectOnly");
const bool split = args.optionFound("split");
const bool overwrite = args.optionFound("overwrite");
const bool detectOnly = args.optionFound("detectOnly");
// Collect all boundary faces
labelList boundaryFaces(mesh.nFaces() - mesh.nInternalFaces());

View File

@ -1,8 +1 @@
/*
EXE_INC = \
-I$(LIB_SRC)/triSurface/lnInclude
EXE_LIBS = \
-lmeshTools \
-ltriSurface
*/
/* */

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
@ -116,8 +116,8 @@ int main(int argc, char *argv[])
argList::validArgs.append("output VTK file");
argList::argList args(argc, argv);
fileName objName(args.additionalArgs()[0]);
fileName outName(args.additionalArgs()[1]);
const fileName objName = args[1];
const fileName outName = args[2];
std::ifstream OBJfile(objName.c_str());

View File

@ -1,9 +1,7 @@
EXE_INC = \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-ldynamicMesh \
-lmeshTools

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
@ -291,8 +291,8 @@ label twoDNess(const polyMesh& mesh)
int main(int argc, char *argv[])
{
# include "addOverwriteOption.H"
argList::addBoolOption("dict");
argList::addBoolOption("overwrite");
# include "setRootCase.H"
# include "createTime.H"
@ -307,8 +307,8 @@ int main(int argc, char *argv[])
// Read/construct control dictionary
//
bool readDict = args.optionFound("dict");
bool overwrite = args.optionFound("overwrite");
const bool readDict = args.optionFound("dict");
const bool overwrite = args.optionFound("overwrite");
// List of cells to refine
labelList refCells;

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 anispulation |
-------------------------------------------------------------------------------
License
@ -369,8 +369,8 @@ int main(int argc, char *argv[])
argList::addBoolOption("blockOrder");
argList::addBoolOption("orderPoints");
argList::addBoolOption("writeMaps");
argList::addBoolOption("overwrite");
# include "addOverwriteOption.H"
# include "addTimeOptions.H"
# include "setRootCase.H"
@ -411,7 +411,7 @@ int main(int argc, char *argv[])
<< endl;
}
bool overwrite = args.optionFound("overwrite");
const bool overwrite = args.optionFound("overwrite");
label band = getBand(mesh.faceOwner(), mesh.faceNeighbour());

View File

@ -2,8 +2,8 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anispulation |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -75,10 +75,10 @@ int main(int argc, char *argv[])
# include "setRootCase.H"
# include "createTime.H"
vector n1(IStringStream(args.additionalArgs()[0])());
vector n1 = args.argRead<vector>(1);
n1 /= mag(n1);
vector n2(IStringStream(args.additionalArgs()[1])());
vector n2 = args.argRead<vector>(2);
n2 /= mag(n2);
tensor T = rotationTensor(n1, n2);

View File

@ -1,15 +1,17 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
READLINE=0
if [ -f /usr/include/readline/readline.h ]
then
echo "Found readline/readline.h -- enabling readline support."
READLINE=1
export READLINE=1
export READLINELINK="-lreadline -lncurses"
break
else
# no readline/readline.h -- disabling readline support
export READLINE=0
unset READLINELINK
fi
export READLINE
wmake
# ----------------------------------------------------------------- end-of-file

View File

@ -1,5 +1,7 @@
/* NB: trailing zero after define improves robustness */
EXE_INC = \
-DREADLINE=$(READLINE) \
-DREADLINE=$(READLINE)0 \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \

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
@ -45,6 +45,7 @@ Description
#include "cellZoneSet.H"
#include "faceZoneSet.H"
#include "pointZoneSet.H"
#include "timeSelector.H"
#include <stdio.h>
@ -82,45 +83,6 @@ Istream& selectStream(Istream* is0Ptr, Istream* is1Ptr)
}
}
// Copy set
void backup
(
const word& setType,
const polyMesh& mesh,
const word& fromName,
const topoSet& fromSet,
const word& toName
)
{
if (fromSet.size())
{
Pout<< " Backing up " << fromName << " into " << toName << endl;
topoSet::New(setType, mesh, toName, fromSet)().write();
}
}
// Read and copy set
void backup
(
const word& setType,
const polyMesh& mesh,
const word& fromName,
const word& toName
)
{
autoPtr<topoSet> fromSet = topoSet::New
(
setType,
mesh,
fromName,
IOobject::READ_IF_PRESENT
);
backup(setType, mesh, fromName, fromSet(), toName);
}
// Write set to VTK readable files
void writeVTK
@ -304,7 +266,13 @@ void printAllSets(const polyMesh& mesh, Ostream& os)
IOobjectList objects
(
mesh,
mesh.pointsInstance(),
mesh.time().findInstance
(
polyMesh::meshSubDir/"sets",
word::null,
IOobject::READ_IF_PRESENT,
mesh.facesInstance()
),
polyMesh::meshSubDir/"sets"
);
IOobjectList cellSets(objects.lookupClass(cellSet::typeName));
@ -417,7 +385,13 @@ void removeSet
IOobjectList objects
(
mesh,
mesh.pointsInstance(),
mesh.time().findInstance
(
polyMesh::meshSubDir/"sets",
word::null,
IOobject::READ_IF_PRESENT,
mesh.facesInstance()
),
polyMesh::meshSubDir/"sets"
);
@ -465,6 +439,7 @@ bool doCommand
const word& setName,
const word& actionName,
const bool writeVTKFile,
const bool writeCurrentTime,
Istream& is
)
{
@ -525,7 +500,7 @@ bool doCommand
{
topoSet& currentSet = currentSetPtr();
Pout<< " Set:" << currentSet.name()
Info<< " Set:" << currentSet.name()
<< " Size:" << currentSet.size()
<< " Action:" << actionName
<< endl;
@ -622,25 +597,27 @@ bool doCommand
+ ".vtk"
);
Pout<< " Writing " << currentSet.name()
Info<< " Writing " << currentSet.name()
<< " (size " << currentSet.size() << ") to "
<< currentSet.instance()/currentSet.local()
/currentSet.name()
<< " and to vtk file " << vtkName << endl << endl;
currentSet.write();
writeVTK(mesh, currentSet, vtkName);
}
else
{
Pout<< " Writing " << currentSet.name()
Info<< " Writing " << currentSet.name()
<< " (size " << currentSet.size() << ") to "
<< currentSet.instance()/currentSet.local()
/currentSet.name() << endl << endl;
currentSet.write();
}
if (writeCurrentTime)
{
currentSet.instance() = mesh.time().timeName();
}
currentSet.write();
}
}
}
@ -683,7 +660,7 @@ enum commandStatus
void printMesh(const Time& runTime, const polyMesh& mesh)
{
Pout<< "Time:" << runTime.timeName()
Info<< "Time:" << runTime.timeName()
<< " cells:" << mesh.nCells()
<< " faces:" << mesh.nFaces()
<< " points:" << mesh.nPoints()
@ -692,6 +669,48 @@ void printMesh(const Time& runTime, const polyMesh& mesh)
}
polyMesh::readUpdateState meshReadUpdate(polyMesh& mesh)
{
polyMesh::readUpdateState stat = mesh.readUpdate();
switch(stat)
{
case polyMesh::UNCHANGED:
{
Info<< " mesh not changed." << endl;
break;
}
case polyMesh::POINTS_MOVED:
{
Info<< " points moved; topology unchanged." << endl;
break;
}
case polyMesh::TOPO_CHANGE:
{
Info<< " topology changed; patches unchanged." << nl
<< " ";
printMesh(mesh.time(), mesh);
break;
}
case polyMesh::TOPO_PATCH_CHANGE:
{
Info<< " topology changed and patches changed." << nl
<< " ";
printMesh(mesh.time(), mesh);
break;
}
default:
{
FatalErrorIn("meshReadUpdate(polyMesh&)")
<< "Illegal mesh update state "
<< stat << abort(FatalError);
break;
}
}
return stat;
}
commandStatus parseType
(
@ -703,19 +722,19 @@ commandStatus parseType
{
if (setType.empty())
{
Pout<< "Type 'help' for usage information" << endl;
Info<< "Type 'help' for usage information" << endl;
return INVALID;
}
else if (setType == "help")
{
printHelp(Pout);
printHelp(Info);
return INVALID;
}
else if (setType == "list")
{
printAllSets(mesh, Pout);
printAllSets(mesh, Info);
return INVALID;
}
@ -726,54 +745,20 @@ commandStatus parseType
label nearestIndex = Time::findClosestTimeIndex(Times, requestedTime);
Pout<< "Changing time from " << runTime.timeName()
Info<< "Changing time from " << runTime.timeName()
<< " to " << Times[nearestIndex].name()
<< endl;
// Set time
runTime.setTime(Times[nearestIndex], nearestIndex);
polyMesh::readUpdateState stat = mesh.readUpdate();
switch(stat)
{
case polyMesh::UNCHANGED:
{
Pout<< " mesh not changed." << endl;
break;
}
case polyMesh::POINTS_MOVED:
{
Pout<< " points moved; topology unchanged." << endl;
break;
}
case polyMesh::TOPO_CHANGE:
{
Pout<< " topology changed; patches unchanged." << nl
<< " ";
printMesh(runTime, mesh);
break;
}
case polyMesh::TOPO_PATCH_CHANGE:
{
Pout<< " topology changed and patches changed." << nl
<< " ";
printMesh(runTime, mesh);
break;
}
default:
{
FatalErrorIn("parseType")
<< "Illegal mesh update state "
<< stat << abort(FatalError);
break;
}
}
// Optionally re-read mesh
meshReadUpdate(mesh);
return INVALID;
}
else if (setType == "quit")
{
Pout<< "Quitting ..." << endl;
Info<< "Quitting ..." << endl;
return QUIT;
}
@ -840,23 +825,27 @@ commandStatus parseAction(const word& actionName)
int main(int argc, char *argv[])
{
timeSelector::addOptions(true, false);
# include "addRegionOption.H"
# include "addTimeOptions.H"
argList::addBoolOption("noVTK");
argList::addBoolOption("noVTK", "do not write VTK files");
argList::addBoolOption("loop", "execute batch commands for all timesteps");
argList::addOption("batch", "file");
# include "setRootCase.H"
# include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
bool writeVTK = !args.optionFound("noVTK");
const bool writeVTK = !args.optionFound("noVTK");
const bool loop = args.optionFound("loop");
const bool batch = args.optionFound("batch");
// Get times list
instantList Times = runTime.times();
if (loop && !batch)
{
FatalErrorIn(args.executable())
<< "Can only loop in batch mode."
<< exit(FatalError);
}
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
# include "createNamedPolyMesh.H"
@ -864,137 +853,173 @@ int main(int argc, char *argv[])
printMesh(runTime, mesh);
// Print current sets
printAllSets(mesh, Pout);
printAllSets(mesh, Info);
std::ifstream* fileStreamPtr(NULL);
if (args.optionFound("batch"))
// Read history if interactive
# if READLINE != 0
if (!batch && !read_history(historyFile))
{
fileName batchFile(args.option("batch"));
Pout<< "Reading commands from file " << batchFile << endl;
// we cannot handle .gz files
if (!isFile(batchFile, false))
{
FatalErrorIn(args.executable())
<< "Cannot open file " << batchFile << exit(FatalError);
}
fileStreamPtr = new std::ifstream(batchFile.c_str());
Info<< "Successfully read history from " << historyFile << endl;
}
#if READLINE != 0
else if (!read_history(historyFile))
# endif
// Exit status
int status = 0;
forAll(timeDirs, timeI)
{
Pout<< "Successfully read history from " << historyFile << endl;
}
#endif
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;
Pout<< "Please type 'help', 'quit' or a set command after prompt." << endl;
// Handle geometry/topology changes
meshReadUpdate(mesh);
bool ok = true;
FatalError.throwExceptions();
FatalIOError.throwExceptions();
// Main command read & execute loop
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
do
{
string rawLine;
autoPtr<IFstream> fileStreamPtr(NULL);
// Type: cellSet, faceSet, pointSet
word setType;
// Name of destination set.
word setName;
// Action (new, invert etc.)
word actionName;
commandStatus stat = INVALID;
if (fileStreamPtr)
if (batch)
{
if (!fileStreamPtr->good())
const fileName batchFile = args["batch"];
Info<< "Reading commands from file " << batchFile << endl;
// we cannot handle .gz files
if (!isFile(batchFile, false))
{
Pout<< "End of batch file" << endl;
break;
FatalErrorIn(args.executable())
<< "Cannot open file " << batchFile << exit(FatalError);
}
std::getline(*fileStreamPtr, rawLine);
if (rawLine.size())
{
Pout<< "Doing:" << rawLine << endl;
}
fileStreamPtr.reset(new IFstream(batchFile));
}
else
Info<< "Please type 'help', 'quit' or a set command after prompt."
<< endl;
// Whether to quit
bool quit = false;
FatalError.throwExceptions();
FatalIOError.throwExceptions();
do
{
# if READLINE != 0
string rawLine;
// Type: cellSet, faceSet, pointSet
word setType;
// Name of destination set.
word setName;
// Action (new, invert etc.)
word actionName;
commandStatus stat = INVALID;
if (fileStreamPtr.valid())
{
char* linePtr = readline("readline>");
rawLine = string(linePtr);
if (*linePtr)
if (!fileStreamPtr().good())
{
add_history(linePtr);
write_history(historyFile);
Info<< "End of batch file" << endl;
// No error.
break;
}
free(linePtr); // readline uses malloc, not new.
}
# else
{
Pout<< "Command>" << flush;
std::getline(std::cin, rawLine);
}
# endif
}
fileStreamPtr().getLine(rawLine);
if (rawLine.empty() || rawLine[0] == '#')
{
continue;
}
IStringStream is(rawLine + ' ');
// Type: cellSet, faceSet, pointSet, faceZoneSet
is >> setType;
stat = parseType(runTime, mesh, setType, is);
if (stat == VALIDSETCMD || stat == VALIDZONECMD)
{
if (is >> setName)
{
if (is >> actionName)
if (rawLine.size())
{
stat = parseAction(actionName);
Info<< "Doing:" << rawLine << endl;
}
}
}
ok = true;
else
{
# if READLINE != 0
{
char* linePtr = readline("readline>");
if (stat == QUIT)
rawLine = string(linePtr);
if (*linePtr)
{
add_history(linePtr);
write_history(historyFile);
}
free(linePtr); // readline uses malloc, not new.
}
# else
{
Info<< "Command>" << flush;
std::getline(std::cin, rawLine);
}
# endif
}
if (rawLine.empty() || rawLine[0] == '#')
{
continue;
}
IStringStream is(rawLine + ' ');
// Type: cellSet, faceSet, pointSet, faceZoneSet
is >> setType;
stat = parseType(runTime, mesh, setType, is);
if (stat == VALIDSETCMD || stat == VALIDZONECMD)
{
if (is >> setName)
{
if (is >> actionName)
{
stat = parseAction(actionName);
}
}
}
if (stat == QUIT)
{
// Make sure to quit
quit = true;
}
else if (stat == VALIDSETCMD || stat == VALIDZONECMD)
{
bool ok = doCommand
(
mesh,
setType,
setName,
actionName,
writeVTK,
loop, // if in looping mode dump sets to time directory
is
);
if (!ok)
{
// Exit with error.
quit = true;
status = 1;
}
}
} while (!quit);
if (quit)
{
break;
}
else if (stat == VALIDSETCMD || stat == VALIDZONECMD)
{
ok = doCommand(mesh, setType, setName, actionName, writeVTK, is);
}
} while (ok);
if (fileStreamPtr)
{
delete fileStreamPtr;
}
Pout<< "\nEnd\n" << endl;
Info<< "\nEnd\n" << endl;
return 0;
return status;
}

View File

@ -81,14 +81,17 @@ int main(int argc, char *argv[])
# include "createNamedPolyMesh.H"
// Search for list of objects for the time of the mesh
IOobjectList objects
word setsInstance = runTime.findInstance
(
mesh,
mesh.pointsInstance(),
polyMesh::meshSubDir/"sets"
polyMesh::meshSubDir/"sets",
word::null,
IOobject::MUST_READ,
mesh.facesInstance()
);
Info<< "Searched : " << mesh.pointsInstance()/polyMesh::meshSubDir/"sets"
IOobjectList objects(mesh, setsInstance, polyMesh::meshSubDir/"sets");
Info<< "Searched : " << setsInstance/polyMesh::meshSubDir/"sets"
<< nl
<< "Found : " << objects.names() << nl
<< endl;

View File

@ -66,9 +66,9 @@ void interpolateFields
int main(int argc, char *argv[])
{
argList::addBoolOption("overwrite");
# include "addOverwriteOption.H"
# include "addTimeOptions.H"
# include "setRootCase.H"
# include "createTime.H"
// Get times list
@ -78,7 +78,7 @@ int main(int argc, char *argv[])
# include "createMesh.H"
const word oldInstance = mesh.pointsInstance();
bool overwrite = args.optionFound("overwrite");
const bool overwrite = args.optionFound("overwrite");
// Read objects in time directory

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
@ -111,11 +111,11 @@ void checkPatch(const polyBoundaryMesh& bMesh, const word& name)
int main(int argc, char *argv[])
{
argList::noParallel();
# include "addOverwriteOption.H"
argList::validArgs.append("faceSet");
argList::validArgs.append("masterPatch");
argList::validArgs.append("slavePatch");
argList::addBoolOption("overwrite");
# include "setRootCase.H"
# include "createTime.H"
@ -123,10 +123,10 @@ int main(int argc, char *argv[])
# include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance();
word setName(args.additionalArgs()[0]);
word masterPatch(args.additionalArgs()[1]);
word slavePatch(args.additionalArgs()[2]);
bool overwrite = args.optionFound("overwrite");
const word setName = args[1];
const word masterPatch = args[2];
const word slavePatch = args[3];
const bool overwrite = args.optionFound("overwrite");
// List of faces to split
faceSet facesSet(mesh, setName);

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
@ -64,6 +64,7 @@ Description
#include "syncTools.H"
#include "ReadFields.H"
#include "directMappedWallPolyPatch.H"
#include "zeroGradientFvPatchFields.H"
using namespace Foam;
@ -164,25 +165,24 @@ void reorderPatchFields(fvMesh& mesh, const labelList& oldToNew)
// Adds patch if not yet there. Returns patchID.
template<class PatchType>
label addPatch(fvMesh& mesh, const word& patchName)
label addPatch(fvMesh& mesh, const polyPatch& patch)
{
polyBoundaryMesh& polyPatches =
const_cast<polyBoundaryMesh&>(mesh.boundaryMesh());
label patchI = polyPatches.findPatchID(patchName);
label patchI = polyPatches.findPatchID(patch.name());
if (patchI != -1)
{
if (isA<PatchType>(polyPatches[patchI]))
if (polyPatches[patchI].type() == patch.type())
{
// Already there
return patchI;
}
else
{
FatalErrorIn("addPatch<PatchType>(fvMesh&, const word&)")
<< "Already have patch " << patchName
<< " but of type " << PatchType::typeName
FatalErrorIn("addPatch(fvMesh&, const polyPatch*)")
<< "Already have patch " << patch.name()
<< " but of type " << patch.type()
<< exit(FatalError);
}
}
@ -219,14 +219,12 @@ label addPatch(fvMesh& mesh, const word& patchName)
polyPatches.set
(
sz,
polyPatch::New
patch.clone
(
PatchType::typeName,
patchName,
0, // size
startFaceI,
insertPatchI,
polyPatches
polyPatches,
insertPatchI, //index
0, //size
startFaceI //start
)
);
fvPatches.setSize(sz+1);
@ -1086,16 +1084,37 @@ EdgeMap<label> addRegionPatches
if (interfaceSizes[e] > 0)
{
label patchI = addPatch<directMappedWallPolyPatch>
const word inter1 = regionNames[e[0]] + "_to_" + regionNames[e[1]];
const word inter2 = regionNames[e[1]] + "_to_" + regionNames[e[0]];
directMappedWallPolyPatch patch1
(
mesh,
regionNames[e[0]] + "_to_" + regionNames[e[1]]
inter1,
0, // overridden
0, // overridden
0, // overridden
regionNames[e[1]], // sampleRegion
directMappedPatchBase::NEARESTPATCHFACE,
inter2, // samplePatch
point::zero, // offset
mesh.boundaryMesh()
);
addPatch<directMappedWallPolyPatch>
label patchI = addPatch(mesh, patch1);
directMappedWallPolyPatch patch2
(
mesh,
regionNames[e[1]] + "_to_" + regionNames[e[0]]
inter2,
0,
0,
0,
regionNames[e[0]], // sampleRegion
directMappedPatchBase::NEARESTPATCHFACE,
inter1,
point::zero, // offset
mesh.boundaryMesh()
);
addPatch(mesh, patch2);
Info<< "For interface between region " << e[0]
<< " and " << e[1] << " added patch " << patchI
@ -1290,13 +1309,13 @@ label findCorrespondingRegion
int main(int argc, char *argv[])
{
# include "addOverwriteOption.H"
argList::addBoolOption("cellZones");
argList::addBoolOption("cellZonesOnly");
argList::addOption("blockedFaces", "faceSet");
argList::addBoolOption("makeCellZones");
argList::addBoolOption("largestOnly");
argList::addOption("insidePoint", "point");
argList::addBoolOption("overwrite");
argList::addBoolOption("detectOnly");
argList::addBoolOption("sloppyCellZones");
@ -1307,21 +1326,20 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance();
word blockedFacesName;
if (args.optionFound("blockedFaces"))
if (args.optionReadIfPresent("blockedFaces", blockedFacesName))
{
blockedFacesName = args.option("blockedFaces");
Info<< "Reading blocked internal faces from faceSet "
<< blockedFacesName << nl << endl;
}
bool makeCellZones = args.optionFound("makeCellZones");
bool largestOnly = args.optionFound("largestOnly");
bool insidePoint = args.optionFound("insidePoint");
bool useCellZones = args.optionFound("cellZones");
bool useCellZonesOnly = args.optionFound("cellZonesOnly");
bool overwrite = args.optionFound("overwrite");
bool detectOnly = args.optionFound("detectOnly");
bool sloppyCellZones = args.optionFound("sloppyCellZones");
const bool makeCellZones = args.optionFound("makeCellZones");
const bool largestOnly = args.optionFound("largestOnly");
const bool insidePoint = args.optionFound("insidePoint");
const bool useCellZones = args.optionFound("cellZones");
const bool useCellZonesOnly = args.optionFound("cellZonesOnly");
const bool overwrite = args.optionFound("overwrite");
const bool detectOnly = args.optionFound("detectOnly");
const bool sloppyCellZones = args.optionFound("sloppyCellZones");
if (insidePoint && largestOnly)
{
@ -1495,7 +1513,8 @@ int main(int argc, char *argv[])
false
),
mesh,
dimensionedScalar("zero", dimless, 0)
dimensionedScalar("zero", dimless, 0),
zeroGradientFvPatchScalarField::typeName
);
forAll(cellRegion, cellI)
{
@ -1862,7 +1881,7 @@ int main(int argc, char *argv[])
if (insidePoint)
{
point insidePoint(args.optionLookup("insidePoint")());
const point insidePoint = args.optionRead<point>("insidePoint");
label regionI = -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
@ -96,29 +96,29 @@ void checkPatch(const polyBoundaryMesh& bMesh, const word& name)
int main(int argc, char *argv[])
{
argList::noParallel();
# include "addOverwriteOption.H"
# include "addRegionOption.H"
argList::validArgs.append("masterPatch");
argList::validArgs.append("slavePatch");
argList::addBoolOption("partial");
argList::addBoolOption("perfect");
argList::addBoolOption("overwrite");
argList::addOption("toleranceDict", "file with tolerances");
# include "setRootCase.H"
# include "createTime.H"
runTime.functionObjects().off();
# include "createMesh.H"
# include "createNamedMesh.H"
const word oldInstance = mesh.pointsInstance();
const word masterPatchName = args[1];
const word slavePatchName = args[2];
word masterPatchName(args.additionalArgs()[0]);
word slavePatchName(args.additionalArgs()[1]);
bool partialCover = args.optionFound("partial");
bool perfectCover = args.optionFound("perfect");
bool overwrite = args.optionFound("overwrite");
const bool partialCover = args.optionFound("partial");
const bool perfectCover = args.optionFound("perfect");
const bool overwrite = args.optionFound("overwrite");
if (partialCover && perfectCover)
{

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
@ -151,9 +151,9 @@ void subsetPointFields
int main(int argc, char *argv[])
{
# include "addOverwriteOption.H"
argList::validArgs.append("set");
argList::addOption("patch", "patch name");
argList::addBoolOption("overwrite");
# include "setRootCase.H"
# include "createTime.H"
@ -161,8 +161,8 @@ int main(int argc, char *argv[])
# include "createMesh.H"
const word oldInstance = mesh.pointsInstance();
word setName(args.additionalArgs()[0]);
bool overwrite = args.optionFound("overwrite");
const word setName = args[1];
const bool overwrite = args.optionFound("overwrite");
Info<< "Reading cell set from " << setName << endl << endl;
@ -174,7 +174,7 @@ int main(int argc, char *argv[])
if (args.optionFound("patch"))
{
word patchName(args.option("patch"));
const word patchName = args["patch"];
patchI = mesh.boundaryMesh().findPatchID(patchName);

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
@ -210,7 +210,9 @@ int main(int argc, char *argv[])
)
);
const bool doRotateFields = args.optionFound("rotateFields");
// this is not actually stringent enough:
if (args.options().empty())
{
FatalErrorIn(args.executable())
@ -219,18 +221,20 @@ int main(int argc, char *argv[])
<< exit(FatalError);
}
if (args.optionFound("translate"))
vector v;
if (args.optionReadIfPresent("translate", v))
{
vector transVector(args.optionLookup("translate")());
Info<< "Translating points by " << v << endl;
Info<< "Translating points by " << transVector << endl;
points += transVector;
points += v;
}
if (args.optionFound("rotate"))
{
Pair<vector> n1n2(args.optionLookup("rotate")());
Pair<vector> n1n2
(
args.optionLookup("rotate")()
);
n1n2[0] /= mag(n1n2[0]);
n1n2[1] /= mag(n1n2[1]);
tensor T = rotationTensor(n1n2[0], n1n2[1]);
@ -239,20 +243,17 @@ int main(int argc, char *argv[])
points = transform(T, points);
if (args.optionFound("rotateFields"))
if (doRotateFields)
{
rotateFields(args, runTime, T);
}
}
else if (args.optionFound("rollPitchYaw"))
else if (args.optionReadIfPresent("rollPitchYaw", v))
{
vector v(args.optionLookup("rollPitchYaw")());
Info<< "Rotating points by" << nl
<< " roll " << v.x() << nl
<< " pitch " << v.y() << nl
<< " yaw " << v.z() << endl;
<< " yaw " << v.z() << nl;
// Convert to radians
v *= pi/180.0;
@ -262,20 +263,17 @@ int main(int argc, char *argv[])
Info<< "Rotating points by quaternion " << R << endl;
points = transform(R, points);
if (args.optionFound("rotateFields"))
if (doRotateFields)
{
rotateFields(args, runTime, R.R());
}
}
else if (args.optionFound("yawPitchRoll"))
else if (args.optionReadIfPresent("yawPitchRoll", v))
{
vector v(args.optionLookup("yawPitchRoll")());
Info<< "Rotating points by" << nl
<< " yaw " << v.x() << nl
<< " pitch " << v.y() << nl
<< " roll " << v.z() << endl;
<< " roll " << v.z() << nl;
// Convert to radians
v *= pi/180.0;
@ -291,21 +289,19 @@ int main(int argc, char *argv[])
Info<< "Rotating points by quaternion " << R << endl;
points = transform(R, points);
if (args.optionFound("rotateFields"))
if (doRotateFields)
{
rotateFields(args, runTime, R.R());
}
}
if (args.optionFound("scale"))
if (args.optionReadIfPresent("scale", v))
{
vector scaleVector(args.optionLookup("scale")());
Info<< "Scaling points by " << v << endl;
Info<< "Scaling points by " << scaleVector << endl;
points.replace(vector::X, scaleVector.x()*points.component(vector::X));
points.replace(vector::Y, scaleVector.y()*points.component(vector::Y));
points.replace(vector::Z, scaleVector.z()*points.component(vector::Z));
points.replace(vector::X, v.x()*points.component(vector::X));
points.replace(vector::Y, v.y()*points.component(vector::Y));
points.replace(vector::Z, v.z()*points.component(vector::Z));
}
// Set the precision of the points data to 10