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

This commit is contained in:
mattijs
2010-05-10 14:31:52 +01:00
342 changed files with 7473 additions and 3660 deletions

View File

@ -48,9 +48,21 @@ int main(int argc, char *argv[])
{
timeSelector::addOptions();
# include "addRegionOption.H"
argList::addBoolOption("noTopology");
argList::addBoolOption("allGeometry");
argList::addBoolOption("allTopology");
argList::addBoolOption
(
"noTopology",
"skip checking the mesh topology"
);
argList::addBoolOption
(
"allGeometry",
"include bounding box checks"
);
argList::addBoolOption
(
"allTopology",
"include extra topology checks"
);
# include "setRootCase.H"
# include "createTime.H"

View File

@ -107,7 +107,7 @@ void modifyOrAddFace
label findPatchID(const polyMesh& mesh, const word& name)
{
label patchI = mesh.boundaryMesh().findPatchID(name);
const label patchI = mesh.boundaryMesh().findPatchID(name);
if (patchI == -1)
{
@ -124,18 +124,35 @@ label findPatchID(const polyMesh& mesh, const word& name)
int main(int argc, char *argv[])
{
# include "addOverwriteOption.H"
# include "addRegionOption.H"
argList::addNote
(
"Makes internal faces into boundary faces.\n"
"Does not duplicate points, unlike mergeOrSplitBaffles."
);
#include "addOverwriteOption.H"
#include "addRegionOption.H"
argList::validArgs.append("faceZone");
argList::validArgs.append("patch");
argList::addOption("additionalPatches", "(patch2 .. patchN)");
argList::addBoolOption("internalFacesOnly");
# include "setRootCase.H"
# include "createTime.H"
argList::addOption
(
"additionalPatches",
"(patch2 .. patchN)",
"specify additional patches for creating baffles"
);
argList::addBoolOption
(
"internalFacesOnly",
"do not convert boundary faces"
);
#include "setRootCase.H"
#include "createTime.H"
runTime.functionObjects().off();
# include "createNamedMesh.H"
#include "createNamedMesh.H"
const word oldInstance = mesh.pointsInstance();
const polyBoundaryMesh& patches = mesh.boundaryMesh();

View File

@ -681,17 +681,17 @@ int main(int argc, char *argv[])
{
const dictionary& dict = patchSources[addedI];
word patchName(dict.lookup("name"));
const word patchName(dict.lookup("name"));
label destPatchI = patches.findPatchID(patchName);
if (destPatchI == -1)
{
FatalErrorIn(args.executable()) << "patch " << patchName
<< " not added. Problem." << abort(FatalError);
FatalErrorIn(args.executable())
<< "patch " << patchName << " not added. Problem."
<< abort(FatalError);
}
word sourceType(dict.lookup("constructFrom"));
const word sourceType(dict.lookup("constructFrom"));
if (sourceType == "patches")
{
@ -719,7 +719,7 @@ int main(int argc, char *argv[])
}
else if (sourceType == "set")
{
word setName(dict.lookup("set"));
const word setName(dict.lookup("set"));
faceSet faces(mesh, setName);

View File

@ -1,15 +1,22 @@
Info<< nl << "Create Times" << endl;
const fileName masterCasePath = masterCase.path();
const fileName masterCaseName = masterCase.name();
Time runTimeMaster
(
Time::controlDictName,
rootDirMaster,
caseDirMaster
masterCasePath,
masterCaseName
);
const fileName addCasePath = addCase.path();
const fileName addCaseName = addCase.name();
Time runTimeToAdd
(
Time::controlDictName,
rootDirToAdd,
caseDirToAdd
addCasePath,
addCaseName
);

View File

@ -32,16 +32,74 @@ Description
using namespace Foam;
void getRootCase(fileName& casePath)
{
casePath.clean();
if (casePath.empty() || casePath == ".")
{
// handle degenerate form and '.'
casePath = cwd();
}
else if (casePath[0] != '/' && casePath.name() == "..")
{
// avoid relative cases ending in '..' - makes for very ugly names
casePath = cwd()/casePath;
casePath.clean();
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
argList::noParallel();
# include "setRoots.H"
# include "createTimes.H"
argList::addNote
(
"merge two meshes"
);
Info<< "Reading master mesh for time = " << runTimeMaster.timeName() << endl;
argList::noParallel();
argList::validArgs.append("masterCase");
argList::addOption
(
"masterRegion",
"name",
"specify alternative mesh region for the master mesh"
);
argList::validArgs.append("addCase");
argList::addOption
(
"addRegion",
"name",
"specify alternative mesh region for the additional mesh"
);
argList args(argc, argv);
if (!args.check())
{
FatalError.exit();
}
fileName masterCase = args[1];
word masterRegion = polyMesh::defaultRegion;
args.optionReadIfPresent("masterRegion", masterRegion);
fileName addCase = args[2];
word addRegion = polyMesh::defaultRegion;
args.optionReadIfPresent("addRegion", addRegion);
getRootCase(masterCase);
getRootCase(addCase);
Info<< "Master: " << masterCase << " region " << masterRegion << nl
<< "mesh to add: " << addCase << " region " << addRegion << endl;
#include "createTimes.H"
Info<< "Reading master mesh for time = " << runTimeMaster.timeName() << nl;
Info<< "Create mesh\n" << endl;
mergePolyMesh masterMesh
@ -55,7 +113,7 @@ int main(int argc, char *argv[])
);
Info<< "Reading mesh to add for time = " << runTimeToAdd.timeName() << endl;
Info<< "Reading mesh to add for time = " << runTimeToAdd.timeName() << nl;
Info<< "Create mesh\n" << endl;
polyMesh meshToAdd

View File

@ -1,32 +0,0 @@
argList::validArgs.clear();
argList::validArgs.append("master root");
argList::validArgs.append("master case");
argList::addOption("masterRegion", "name");
argList::validArgs.append("root to add");
argList::validArgs.append("case to add");
argList::addOption("addRegion", "name");
argList args(argc, argv);
if (!args.check())
{
FatalError.exit();
}
fileName rootDirMaster = args[1];
fileName caseDirMaster = args[2];
word masterRegion = polyMesh::defaultRegion;
args.optionReadIfPresent("masterRegion", masterRegion);
fileName rootDirToAdd = args[3];
fileName caseDirToAdd = args[4];
word addRegion = polyMesh::defaultRegion;
args.optionReadIfPresent("addRegion", addRegion);
Info<< "Master: " << rootDirMaster << " " << caseDirMaster
<< " region " << masterRegion << nl
<< "mesh to add: " << rootDirToAdd << " " << caseDirToAdd
<< " region " << addRegion << endl;

View File

@ -221,15 +221,30 @@ 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("detectOnly");
argList::addNote
(
"Detect faces that share points (baffles).\n"
"Merge them or duplicate the points."
);
# include "setRootCase.H"
# include "createTime.H"
#include "addOverwriteOption.H"
#include "addRegionOption.H"
argList::addBoolOption
(
"detectOnly",
"find baffles only, but do not merge or split them"
);
argList::addBoolOption
(
"split",
"topologically split duplicate surfaces"
);
#include "setRootCase.H"
#include "createTime.H"
runTime.functionObjects().off();
# include "createNamedMesh.H"
#include "createNamedMesh.H"
const word oldInstance = mesh.pointsInstance();
const bool split = args.optionFound("split");
@ -248,12 +263,10 @@ int main(int argc, char *argv[])
if (detectOnly)
{
findBaffles(mesh, boundaryFaces);
return 0;
}
// Read objects in time directory
IOobjectList objects(mesh, runTime.timeName());

View File

@ -110,7 +110,6 @@ labelList parseVertices(const string& line)
int main(int argc, char *argv[])
{
argList::noParallel();
argList::validArgs.clear();
argList::validArgs.append("OBJ file");
argList::validArgs.append("output VTK file");
argList args(argc, argv);

View File

@ -290,18 +290,26 @@ label twoDNess(const polyMesh& mesh)
int main(int argc, char *argv[])
{
# include "addOverwriteOption.H"
argList::addBoolOption("dict");
argList::addNote
(
"refine cells in multiple directions"
);
# include "setRootCase.H"
# include "createTime.H"
#include "addOverwriteOption.H"
argList::addBoolOption
(
"dict",
"refine according to system/refineMeshDict"
);
#include "setRootCase.H"
#include "createTime.H"
runTime.functionObjects().off();
# include "createPolyMesh.H"
#include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance();
printEdgeStats(mesh);
//
// Read/construct control dictionary
//

View File

@ -363,9 +363,21 @@ autoPtr<mapPolyMesh> reorderMesh
int main(int argc, char *argv[])
{
argList::addBoolOption("blockOrder");
argList::addBoolOption("orderPoints");
argList::addBoolOption("writeMaps");
argList::addBoolOption
(
"blockOrder",
"order cells into regions (using decomposition)"
);
argList::addBoolOption
(
"orderPoints",
"order points into internal and boundary points"
);
argList::addBoolOption
(
"writeMaps",
"write cellMap, faceMap, pointMap in polyMesh/"
);
# include "addOverwriteOption.H"
# include "addTimeOptions.H"

View File

@ -828,7 +828,12 @@ int main(int argc, char *argv[])
# include "addRegionOption.H"
argList::addBoolOption("noVTK", "do not write VTK files");
argList::addBoolOption("loop", "execute batch commands for all timesteps");
argList::addOption("batch", "file");
argList::addOption
(
"batch",
"file",
"process in batch mode, using input from specified file"
);
# include "setRootCase.H"
# include "createTime.H"

View File

@ -57,14 +57,23 @@ using namespace Foam;
int main(int argc, char *argv[])
{
argList::addBoolOption("noFlipMap");
argList::addNote
(
"add point/face/cell Zones from similar named point/face/cell Sets"
);
# include "addRegionOption.H"
# include "addTimeOptions.H"
# include "setRootCase.H"
# include "createTime.H"
argList::addBoolOption
(
"noFlipMap",
"ignore orientation of faceSet"
);
bool noFlipMap = args.optionFound("noFlipMap");
#include "addRegionOption.H"
#include "addTimeOptions.H"
#include "setRootCase.H"
#include "createTime.H"
const bool noFlipMap = args.optionFound("noFlipMap");
// Get times list
instantList Times = runTime.times();
@ -73,11 +82,11 @@ int main(int argc, char *argv[])
label endTime = Times.size();
// check -time and -latestTime options
# include "checkTimeOption.H"
#include "checkTimeOption.H"
runTime.setTime(Times[startTime], startTime);
# include "createNamedPolyMesh.H"
#include "createNamedPolyMesh.H"
// Search for list of objects for the time of the mesh
word setsInstance = runTime.findInstance
@ -153,9 +162,19 @@ int main(int argc, char *argv[])
DynamicList<label> addressing(set.size());
DynamicList<bool> flipMap(set.size());
if (!noFlipMap)
if (noFlipMap)
{
word setName(set.name() + "SlaveCells");
// No flip map.
forAll(faceLabels, i)
{
label faceI = faceLabels[i];
addressing.append(faceI);
flipMap.append(false);
}
}
else
{
const word setName(set.name() + "SlaveCells");
Info<< "Trying to load cellSet " << setName
<< " to find out the slave side of the zone." << nl
@ -226,16 +245,6 @@ int main(int argc, char *argv[])
flipMap.append(flip);
}
}
else
{
// No flip map.
forAll(faceLabels, i)
{
label faceI = faceLabels[i];
addressing.append(faceI);
flipMap.append(false);
}
}
label zoneID = mesh.faceZones().findZoneID(set.name());
if (zoneID == -1)

View File

@ -85,12 +85,12 @@ label findEdge(const primitiveMesh& mesh, const label v0, const label v1)
// Checks whether patch present
void checkPatch(const polyBoundaryMesh& bMesh, const word& name)
{
label patchI = bMesh.findPatchID(name);
const label patchI = bMesh.findPatchID(name);
if (patchI == -1)
{
FatalErrorIn("checkPatch(const polyBoundaryMesh&, const word&)")
<< "Cannot find patch " << name << endl
<< "Cannot find patch " << name << nl
<< "It should be present but of zero size" << endl
<< "Valid patches are " << bMesh.names()
<< exit(FatalError);

View File

@ -1473,26 +1473,64 @@ void writeCellToRegion(const fvMesh& mesh, const labelList& cellRegion)
}
// Main program:
int main(int argc, char *argv[])
{
# include "addOverwriteOption.H"
argList::addBoolOption("cellZones");
argList::addBoolOption("cellZonesOnly");
argList::addOption("cellZonesFileOnly", "cellZonesName");
argList::addOption("blockedFaces", "faceSet");
argList::addBoolOption("makeCellZones");
argList::addBoolOption("largestOnly");
argList::addOption("insidePoint", "point");
argList::addBoolOption("detectOnly");
argList::addBoolOption("sloppyCellZones");
argList::addNote
(
"splits mesh into multiple regions"
);
#include "addOverwriteOption.H"
argList::addBoolOption
(
"cellZones"
);
argList::addBoolOption
(
"cellZonesOnly",
"use current cellZones to split mesh into regions"
);
argList::addOption
(
"cellZonesFileOnly",
"file",
"like -cellZonesOnly, but use specified file"
);
argList::addOption
(
"blockedFaces",
"faceSet"
);
argList::addBoolOption
(
"makeCellZones",
"place cells into cellZones instead of splitting mesh"
);
argList::addBoolOption
(
"largestOnly"
);
argList::addOption
(
"insidePoint",
"point"
);
argList::addBoolOption
(
"detectOnly",
"do not write mesh"
);
argList::addBoolOption
(
"sloppyCellZones",
"try to match regions to existing cell zones"
);
# include "setRootCase.H"
# include "createTime.H"
#include "setRootCase.H"
#include "createTime.H"
runTime.functionObjects().off();
# include "createMesh.H"
#include "createMesh.H"
const word oldInstance = mesh.pointsInstance();
word blockedFacesName;
@ -1514,10 +1552,7 @@ int main(int argc, char *argv[])
if
(
(useCellZonesOnly || useCellZonesFile)
&& (
blockedFacesName != word::null
|| useCellZones
)
&& (useCellZones || blockedFacesName.size())
)
{
FatalErrorIn(args.executable())
@ -1529,7 +1564,6 @@ int main(int argc, char *argv[])
}
if (insidePoint && largestOnly)
{
FatalErrorIn(args.executable())
@ -1719,7 +1753,6 @@ int main(int argc, char *argv[])
writeCellToRegion(mesh, cellRegion);
// Sizes per region
// ~~~~~~~~~~~~~~~~

View File

@ -40,6 +40,7 @@ Description
Comparable to running a meshModifier of the form
(if masterPatch is called "M" and slavePatch "S"):
@verbatim
couple
{
type slidingInterface;
@ -51,6 +52,7 @@ Description
slavePatchName S;
typeOfMatch partial or integral
}
@endverbatim
\*---------------------------------------------------------------------------*/
@ -168,7 +170,7 @@ label addCellZone(const polyMesh& mesh, const word& name)
// Checks whether patch present
void checkPatch(const polyBoundaryMesh& bMesh, const word& name)
{
label patchI = bMesh.findPatchID(name);
const label patchI = bMesh.findPatchID(name);
if (patchI == -1)
{
@ -192,22 +194,41 @@ void checkPatch(const polyBoundaryMesh& bMesh, const word& name)
int main(int argc, char *argv[])
{
argList::addNote
(
"merge the faces on the specified patches (if geometrically possible)\n"
"so the faces become internal"
);
argList::noParallel();
# include "addOverwriteOption.H"
# include "addRegionOption.H"
#include "addOverwriteOption.H"
#include "addRegionOption.H"
argList::validArgs.append("masterPatch");
argList::validArgs.append("slavePatch");
argList::addBoolOption("partial");
argList::addBoolOption("perfect");
argList::addBoolOption
(
"partial",
"couple partially overlapping patches"
);
argList::addBoolOption
(
"perfect",
"couple perfectly aligned patches"
);
argList::addOption
(
"toleranceDict",
"file",
"dictionary file with tolerances"
);
argList::addOption("toleranceDict", "file with tolerances");
# include "setRootCase.H"
# include "createTime.H"
#include "setRootCase.H"
#include "createTime.H"
runTime.functionObjects().off();
# include "createNamedMesh.H"
#include "createNamedMesh.H"
const word oldInstance = mesh.pointsInstance();
const word masterPatchName = args[1];
@ -220,7 +241,7 @@ int main(int argc, char *argv[])
if (partialCover && perfectCover)
{
FatalErrorIn(args.executable())
<< "Cannot both supply partial and perfect." << endl
<< "Cannot supply both partial and perfect." << endl
<< "Use perfect match option if the patches perfectly align"
<< " (both vertex positions and face centres)" << endl
<< exit(FatalError);
@ -291,11 +312,7 @@ int main(int argc, char *argv[])
// Create and add face zones and mesh modifiers
// Master patch
const polyPatch& masterPatch =
mesh.boundaryMesh()
[
mesh.boundaryMesh().findPatchID(masterPatchName)
];
const polyPatch& masterPatch = mesh.boundaryMesh()[masterPatchName];
// Make list of masterPatch faces
labelList isf(masterPatch.size());
@ -352,11 +369,7 @@ int main(int argc, char *argv[])
);
// Slave patch
const polyPatch& slavePatch =
mesh.boundaryMesh()
[
mesh.boundaryMesh().findPatchID(slavePatchName)
];
const polyPatch& slavePatch = mesh.boundaryMesh()[slavePatchName];
labelList osf(slavePatch.size());

View File

@ -150,14 +150,25 @@ void subsetPointFields
int main(int argc, char *argv[])
{
# include "addOverwriteOption.H"
argList::validArgs.append("set");
argList::addOption("patch", "patch name");
argList::addNote
(
"select a mesh subset based on a cellSet"
);
# include "setRootCase.H"
# include "createTime.H"
#include "addOverwriteOption.H"
argList::validArgs.append("cellSet");
argList::addOption
(
"patch",
"name",
"add exposed internal faces to specified patch instead of to "
"'oldInternalFaces'"
);
#include "setRootCase.H"
#include "createTime.H"
runTime.functionObjects().off();
# include "createMesh.H"
#include "createMesh.H"
const word oldInstance = mesh.pointsInstance();
const word setName = args[1];
@ -190,7 +201,7 @@ int main(int argc, char *argv[])
else
{
Info<< "Adding exposed internal faces to a patch called"
<< " \"oldInternalFaces\" (created if nessecary)" << endl
<< " \"oldInternalFaces\" (created if necessary)" << endl
<< endl;
}

View File

@ -158,13 +158,13 @@ int main(int argc, char *argv[])
(
"rollPitchYaw",
"vector",
"transform in terms of '( roll pitch yaw )' in degrees"
"transform in terms of '(roll pitch yaw)' in degrees"
);
argList::addOption
(
"yawPitchRoll",
"vector",
"transform in terms of '( yaw pitch roll )' in degrees"
"transform in terms of '(yaw pitch roll)' in degrees"
);
argList::addBoolOption
(