Merge branch 'master' into particleInteractions

This commit is contained in:
graham
2010-03-19 16:01:41 +00:00
341 changed files with 5103 additions and 1262 deletions

4
.gitignore vendored
View File

@ -55,6 +55,10 @@ doc/[Dd]oxygen/man
/*.html /*.html
/doc/*.html /doc/*.html
# untracked configuration files
/etc/prefs.csh
/etc/prefs.sh
# source packages - anywhere # source packages - anywhere
*.tar.bz2 *.tar.bz2
*.tar.gz *.tar.gz

3
README
View File

@ -112,7 +112,7 @@
which may be obtained from http://gcc.gnu.org/. which may be obtained from http://gcc.gnu.org/.
Install the compiler in Install the compiler in
$WM_THIRD_PARTY_DIR/gcc-<GCC_VERSION>/platforms/$WM_ARCH$WM_COMPILER_ARCH/ $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gcc-<GCC_VERSION>
and change the gcc version number in $WM_PROJECT_DIR/etc/settings.sh and and change the gcc version number in $WM_PROJECT_DIR/etc/settings.sh and
$WM_PROJECT_DIR/etc/settings.csh appropriately and finally update the $WM_PROJECT_DIR/etc/settings.csh appropriately and finally update the
environment variables as in section 3. environment variables as in section 3.
@ -166,6 +166,7 @@
gcc-4.3.3. Execute the following: gcc-4.3.3. Execute the following:
+ cd $WM_THIRD_PARTY_DIR + cd $WM_THIRD_PARTY_DIR
+ rm -rf paraview-3.6.1/platforms + rm -rf paraview-3.6.1/platforms
+ rm -rf platforms/*/paraview-3.6.1
+ ./makeParaView + ./makeParaView
The PV3blockMeshReader and the PV3FoamReader ParaView plugins are compiled The PV3blockMeshReader and the PV3FoamReader ParaView plugins are compiled

View File

@ -58,7 +58,7 @@ int main(int argc, char *argv[])
mesh mesh
), ),
mesh, mesh,
dimensionedVector("n", dimLength, wallPoint::greatPoint) dimensionedVector("n", dimLength, point::max)
); );
// Fill wall patches with unit normal // Fill wall patches with unit normal

View File

@ -187,8 +187,6 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
); );
const pointField& localPoints = allBoundary.localPoints(); const pointField& localPoints = allBoundary.localPoints();
const point greatPoint(GREAT, GREAT, GREAT);
// Point data // Point data
// ~~~~~~~~~~ // ~~~~~~~~~~
@ -196,7 +194,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
{ {
// Create some data. Use slightly perturbed positions. // Create some data. Use slightly perturbed positions.
Map<vector> sparseData; Map<vector> sparseData;
pointField fullData(mesh.nPoints(), greatPoint); pointField fullData(mesh.nPoints(), point::max);
forAll(localPoints, i) forAll(localPoints, i)
{ {
@ -222,7 +220,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
mesh, mesh,
fullData, fullData,
minEqOp<vector>(), minEqOp<vector>(),
greatPoint, point::max,
true // apply separation true // apply separation
); );
@ -232,7 +230,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
{ {
const point& fullPt = fullData[meshPointI]; const point& fullPt = fullData[meshPointI];
if (fullPt != greatPoint) if (fullPt != point::max)
{ {
const point& sparsePt = sparseData[meshPointI]; const point& sparsePt = sparseData[meshPointI];
@ -272,7 +270,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
{ {
// Create some data. Use slightly perturbed positions. // Create some data. Use slightly perturbed positions.
EdgeMap<vector> sparseData; EdgeMap<vector> sparseData;
pointField fullData(mesh.nEdges(), greatPoint); pointField fullData(mesh.nEdges(), point::max);
const edgeList& edges = allBoundary.edges(); const edgeList& edges = allBoundary.edges();
const labelList meshEdges = allBoundary.meshEdges const labelList meshEdges = allBoundary.meshEdges
@ -307,7 +305,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
mesh, mesh,
fullData, fullData,
minEqOp<vector>(), minEqOp<vector>(),
greatPoint, point::max,
true true
); );
@ -317,7 +315,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
{ {
const point& fullPt = fullData[meshEdgeI]; const point& fullPt = fullData[meshEdgeI];
if (fullPt != greatPoint) if (fullPt != point::max)
{ {
const point& sparsePt = sparseData[mesh.edges()[meshEdgeI]]; const point& sparsePt = sparseData[mesh.edges()[meshEdgeI]];
@ -364,8 +362,6 @@ void testPointSync(const polyMesh& mesh, Random& rndGen)
{ {
Info<< nl << "Testing point-wise data synchronisation." << endl; Info<< nl << "Testing point-wise data synchronisation." << endl;
const point greatPoint(GREAT, GREAT, GREAT);
// Test position. // Test position.
{ {
@ -379,7 +375,7 @@ void testPointSync(const polyMesh& mesh, Random& rndGen)
mesh, mesh,
syncedPoints, syncedPoints,
minEqOp<point>(), minEqOp<point>(),
greatPoint, point::max,
true true
); );
@ -444,8 +440,6 @@ void testEdgeSync(const polyMesh& mesh, Random& rndGen)
const edgeList& edges = mesh.edges(); const edgeList& edges = mesh.edges();
const point greatPoint(GREAT, GREAT, GREAT);
// Test position. // Test position.
{ {
@ -463,7 +457,7 @@ void testEdgeSync(const polyMesh& mesh, Random& rndGen)
mesh, mesh,
syncedMids, syncedMids,
minEqOp<point>(), minEqOp<point>(),
greatPoint, point::max,
true true
); );

View File

@ -0,0 +1,7 @@
patchPointEdgeCirculator.C
createShellMesh.C
extrudeToRegionMesh.C
EXE = $(FOAM_APPBIN)/extrudeToRegionMesh

View File

@ -0,0 +1,14 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
/* -I$(LIB_SRC)/surfMesh/lnInclude */ \
/* -I$(LIB_SRC)/lagrangian/basic/lnInclude */ \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude
EXE_LIBS = \
-lfiniteVolume \
/* -lsurfMesh */ \
/* -llagrangian */ \
-lmeshTools \
-ldynamicMesh

View File

@ -0,0 +1,588 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "createShellMesh.H"
#include "polyTopoChange.H"
#include "meshTools.H"
#include "mapPolyMesh.H"
#include "polyAddPoint.H"
#include "polyAddFace.H"
#include "polyModifyFace.H"
#include "polyAddCell.H"
#include "patchPointEdgeCirculator.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::createShellMesh, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::createShellMesh::calcPointRegions
(
const primitiveFacePatch& patch,
const PackedBoolList& nonManifoldEdge,
faceList& pointRegions,
labelList& regionPoints
)
{
pointRegions.setSize(patch.size());
forAll(pointRegions, faceI)
{
const face& f = patch.localFaces()[faceI];
pointRegions[faceI].setSize(f.size(), -1);
}
label nRegions = 0;
forAll(pointRegions, faceI)
{
const face& f = patch.localFaces()[faceI];
forAll(f, fp)
{
if (pointRegions[faceI][fp] == -1)
{
// Found unassigned point. Distribute current region.
label pointI = f[fp];
label edgeI = patch.faceEdges()[faceI][fp];
patchPointEdgeCirculator circ
(
patch,
nonManifoldEdge,
edgeI,
findIndex(patch.edgeFaces()[edgeI], faceI),
pointI
);
for
(
patchPointEdgeCirculator iter = circ.begin();
iter != circ.end();
++iter
)
{
label face2 = iter.faceID();
if (face2 != -1)
{
const face& f2 = patch.localFaces()[face2];
label fp2 = findIndex(f2, pointI);
label& region = pointRegions[face2][fp2];
if (region != -1)
{
FatalErrorIn
(
"createShellMesh::calcPointRegions(..)"
) << "On point " << pointI
<< " at:" << patch.localPoints()[pointI]
<< " found region:" << region
<< abort(FatalError);
}
region = nRegions;
}
}
nRegions++;
}
}
}
// From region back to originating point (many to one, a point might
// have multiple regions though)
regionPoints.setSize(nRegions);
forAll(pointRegions, faceI)
{
const face& f = patch.localFaces()[faceI];
forAll(f, fp)
{
regionPoints[pointRegions[faceI][fp]] = f[fp];
}
}
if (debug)
{
const labelListList& pointFaces = patch.pointFaces();
forAll(pointFaces, pointI)
{
label region = -1;
const labelList& pFaces = pointFaces[pointI];
forAll(pFaces, i)
{
label faceI = pFaces[i];
const face& f = patch.localFaces()[faceI];
label fp = findIndex(f, pointI);
if (region == -1)
{
region = pointRegions[faceI][fp];
}
else if (region != pointRegions[faceI][fp])
{
Pout<< "Non-manifold point:" << pointI
<< " at " << patch.localPoints()[pointI]
<< " region:" << region
<< " otherRegion:" << pointRegions[faceI][fp]
<< endl;
}
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::createShellMesh::createShellMesh
(
const primitiveFacePatch& patch,
const faceList& pointRegions,
const labelList& regionPoints
)
:
patch_(patch),
pointRegions_(pointRegions),
regionPoints_(regionPoints)
{
if (pointRegions_.size() != patch_.size())
{
FatalErrorIn("createShellMesh::createShellMesh(..)")
<< "nFaces:" << patch_.size()
<< " pointRegions:" << pointRegions.size()
<< exit(FatalError);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::createShellMesh::setRefinement
(
const pointField& thickness,
const labelList& topPatchID,
const labelList& bottomPatchID,
const labelListList& extrudeEdgePatches,
polyTopoChange& meshMod
)
{
if (thickness.size() != regionPoints_.size())
{
FatalErrorIn("createShellMesh::setRefinement(..)")
<< "nRegions:" << regionPoints_.size()
<< " thickness:" << thickness.size()
<< exit(FatalError);
}
if
(
topPatchID.size() != patch_.size()
&& bottomPatchID.size() != patch_.size()
)
{
FatalErrorIn("createShellMesh::setRefinement(..)")
<< "nFaces:" << patch_.size()
<< " topPatchID:" << topPatchID.size()
<< " bottomPatchID:" << bottomPatchID.size()
<< exit(FatalError);
}
if (extrudeEdgePatches.size() != patch_.nEdges())
{
FatalErrorIn("createShellMesh::setRefinement(..)")
<< "nEdges:" << patch_.nEdges()
<< " extrudeEdgePatches:" << extrudeEdgePatches.size()
<< exit(FatalError);
}
// From cell to patch (trivial)
DynamicList<label> cellToFaceMap(patch_.size());
// From face to patch+turning index
DynamicList<label> faceToFaceMap(2*patch_.size()+patch_.nEdges());
// From face to patch edge index
DynamicList<label> faceToEdgeMap(patch_.nEdges()+patch_.nEdges());
// From point to patch point index
DynamicList<label> pointToPointMap(2*patch_.nPoints());
// Introduce new cell for every face
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
labelList addedCells(patch_.size());
forAll(patch_, faceI)
{
addedCells[faceI] = meshMod.addCell
(
-1, // masterPointID
-1, // masterEdgeID
-1, // masterFaceID
cellToFaceMap.size(), // masterCellID
-1 // zoneID
);
cellToFaceMap.append(faceI);
}
// Introduce original points
// ~~~~~~~~~~~~~~~~~~~~~~~~~
// Original point numbers in local point ordering so no need to store.
forAll(patch_.localPoints(), pointI)
{
//label addedPointI =
meshMod.addPoint
(
patch_.localPoints()[pointI], // point
pointToPointMap.size(), // masterPointID
-1, // zoneID
true // inCell
);
pointToPointMap.append(pointI);
//Pout<< "Added bottom point " << addedPointI
// << " at " << patch_.localPoints()[pointI]
// << " from point " << pointI
// << endl;
}
// Introduce new points (one for every region)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
labelList addedPoints(regionPoints_.size());
forAll(regionPoints_, regionI)
{
label pointI = regionPoints_[regionI];
point extrudedPt = patch_.localPoints()[pointI] + thickness[regionI];
addedPoints[regionI] = meshMod.addPoint
(
extrudedPt, // point
pointToPointMap.size(), // masterPointID - used only addressing
-1, // zoneID
true // inCell
);
pointToPointMap.append(pointI);
//Pout<< "Added top point " << addedPoints[regionI]
// << " at " << extrudedPt
// << " from point " << pointI
// << endl;
}
// Add face on bottom side
forAll(patch_.localFaces(), faceI)
{
meshMod.addFace
(
patch_.localFaces()[faceI].reverseFace(),// vertices
addedCells[faceI], // own
-1, // nei
-1, // masterPointID
-1, // masterEdgeID
faceToFaceMap.size(), // masterFaceID : current faceI
true, // flipFaceFlux
bottomPatchID[faceI],// patchID
-1, // zoneID
false // zoneFlip
);
faceToFaceMap.append(-faceI-1); // points to flipped original face
faceToEdgeMap.append(-1);
//Pout<< "Added bottom face "
// << patch_.localFaces()[faceI].reverseFace()
// << " own " << addedCells[faceI]
// << " at " << patch_.faceCentres()[faceI]
// << endl;
}
// Add face on top
forAll(patch_.localFaces(), faceI)
{
// Get face in original ordering
const face& f = patch_.localFaces()[faceI];
// Pick up point based on region
face newF(f.size());
forAll(f, fp)
{
label region = pointRegions_[faceI][fp];
newF[fp] = addedPoints[region];
}
meshMod.addFace
(
newF, // vertices
addedCells[faceI], // own
-1, // nei
-1, // masterPointID
-1, // masterEdgeID
faceToFaceMap.size(), // masterFaceID : current faceI
false, // flipFaceFlux
topPatchID[faceI], // patchID
-1, // zoneID
false // zoneFlip
);
faceToFaceMap.append(faceI+1); // unflipped
faceToEdgeMap.append(-1);
//Pout<< "Added top face " << newF
// << " own " << addedCells[faceI]
// << " at " << patch_.faceCentres()[faceI]
// << endl;
}
// Add side faces
// ~~~~~~~~~~~~~~
// Note that we loop over edges multiple times so for edges with
// two cyclic faces they get added in two passes (for correct ordering)
// Pass1. Internal edges and first face of other edges
forAll(extrudeEdgePatches, edgeI)
{
const labelList& eFaces = patch_.edgeFaces()[edgeI];
const labelList& ePatches = extrudeEdgePatches[edgeI];
if (ePatches.size() == 0)
{
// internal face.
if (eFaces.size() != 2)
{
FatalErrorIn("createShellMesh::setRefinement(..)")
<< "edge:" << edgeI
<< " not internal but does not have side-patches defined."
<< exit(FatalError);
}
// Extrude
// Make face pointing in to eFaces[0] so out of new master face
const face& f = patch_.localFaces()[eFaces[0]];
const edge& e = patch_.edges()[edgeI];
label fp0 = findIndex(f, e[0]);
label fp1 = f.fcIndex(fp0);
if (f[fp1] != e[1])
{
fp1 = fp0;
fp0 = f.rcIndex(fp1);
}
face newF(4);
newF[0] = f[fp0];
newF[1] = f[fp1];
newF[2] = addedPoints[pointRegions_[eFaces[0]][fp1]];
newF[3] = addedPoints[pointRegions_[eFaces[0]][fp0]];
label minCellI = addedCells[eFaces[0]];
label maxCellI = addedCells[eFaces[1]];
if (minCellI > maxCellI)
{
// Swap
Swap(minCellI, maxCellI);
newF = newF.reverseFace();
}
//Pout<< "for internal edge:" << e
// << " at:" << patch_.localPoints()[e[0]]
// << patch_.localPoints()[e[1]]
// << " adding face:" << newF
// << " from f:" << f
// << " inbetween " << minCellI << " and " << maxCellI << endl;
// newF already outwards pointing.
meshMod.addFace
(
newF, // vertices
minCellI, // own
maxCellI, // nei
-1, // masterPointID
-1, // masterEdgeID
faceToFaceMap.size(), // masterFaceID
false, // flipFaceFlux
-1, // patchID
-1, // zoneID
false // zoneFlip
);
faceToFaceMap.append(0);
faceToEdgeMap.append(edgeI);
}
else
{
if (eFaces.size() != ePatches.size())
{
FatalErrorIn("createShellMesh::setRefinement(..)")
<< "external/feature edge:" << edgeI
<< " has " << eFaces.size() << " connected extruded faces "
<< " but only " << ePatches.size()
<< " boundary faces defined." << exit(FatalError);
}
// Extrude eFaces[0]
label minFaceI = eFaces[0];
// Make face pointing in to eFaces[0] so out of new master face
const face& f = patch_.localFaces()[minFaceI];
const edge& e = patch_.edges()[edgeI];
label fp0 = findIndex(f, e[0]);
label fp1 = f.fcIndex(fp0);
if (f[fp1] != e[1])
{
fp1 = fp0;
fp0 = f.rcIndex(fp1);
}
face newF(4);
newF[0] = f[fp0];
newF[1] = f[fp1];
newF[2] = addedPoints[pointRegions_[minFaceI][fp1]];
newF[3] = addedPoints[pointRegions_[minFaceI][fp0]];
//Pout<< "for external edge:" << e
// << " at:" << patch_.localPoints()[e[0]]
// << patch_.localPoints()[e[1]]
// << " adding first patch face:" << newF
// << " from:" << f
// << " into patch:" << ePatches[0]
// << " own:" << addedCells[minFaceI]
// << endl;
// newF already outwards pointing.
meshMod.addFace
(
newF, // vertices
addedCells[minFaceI], // own
-1, // nei
-1, // masterPointID
-1, // masterEdgeID
faceToFaceMap.size(), // masterFaceID
false, // flipFaceFlux
ePatches[0], // patchID
-1, // zoneID
false // zoneFlip
);
faceToFaceMap.append(0);
faceToEdgeMap.append(edgeI);
}
}
// Pass2. Other faces of boundary edges
forAll(extrudeEdgePatches, edgeI)
{
const labelList& eFaces = patch_.edgeFaces()[edgeI];
const labelList& ePatches = extrudeEdgePatches[edgeI];
if (ePatches.size() >= 2)
{
for (label i = 1; i < ePatches.size(); i++)
{
// Extrude eFaces[i]
label minFaceI = eFaces[i];
// Make face pointing in to eFaces[0] so out of new master face
const face& f = patch_.localFaces()[minFaceI];
const edge& e = patch_.edges()[edgeI];
label fp0 = findIndex(f, e[0]);
label fp1 = f.fcIndex(fp0);
if (f[fp1] != e[1])
{
fp1 = fp0;
fp0 = f.rcIndex(fp1);
}
face newF(4);
newF[0] = f[fp0];
newF[1] = f[fp1];
newF[2] = addedPoints[pointRegions_[minFaceI][fp1]];
newF[3] = addedPoints[pointRegions_[minFaceI][fp0]];
//Pout<< "for external edge:" << e
// << " at:" << patch_.localPoints()[e[0]]
// << patch_.localPoints()[e[1]]
// << " adding patch face:" << newF
// << " from:" << f
// << " into patch:" << ePatches[i]
// << endl;
// newF already outwards pointing.
meshMod.addFace
(
newF, // vertices
addedCells[minFaceI], // own
-1, // nei
-1, // masterPointID
-1, // masterEdgeID
faceToFaceMap.size(), // masterFaceID
false, // flipFaceFlux
ePatches[i], // patchID
-1, // zoneID
false // zoneFlip
);
faceToFaceMap.append(0);
faceToEdgeMap.append(edgeI);
}
}
}
cellToFaceMap_.transfer(cellToFaceMap);
faceToFaceMap_.transfer(faceToFaceMap);
faceToEdgeMap_.transfer(faceToEdgeMap);
pointToPointMap_.transfer(pointToPointMap);
}
void Foam::createShellMesh::updateMesh(const mapPolyMesh& map)
{
inplaceReorder(map.reverseCellMap(), cellToFaceMap_);
inplaceReorder(map.reverseFaceMap(), faceToFaceMap_);
inplaceReorder(map.reverseFaceMap(), faceToEdgeMap_);
inplaceReorder(map.reversePointMap(), pointToPointMap_);
}
// ************************************************************************* //

View File

@ -0,0 +1,177 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::createShellMesh
Description
Creates mesh by extruding a patch.
SourceFiles
createShellMesh.C
Extrudes into thickness direction.
- bottom faces originate from reversed original faces (have turning index)
- top faces originate from original faces (no turning index)
\*---------------------------------------------------------------------------*/
#ifndef createShellMesh_H
#define createShellMesh_H
#include "primitiveFacePatch.H"
#include "PackedBoolList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class mapPolyMesh;
class polyTopoChange;
/*---------------------------------------------------------------------------*\
Class createShellMesh Declaration
\*---------------------------------------------------------------------------*/
class createShellMesh
{
// Private data
//- Reference to patch to extrude
const primitiveFacePatch& patch_;
//- Per point on face the region
const faceList& pointRegions_;
//- From region to original patch point
const labelList& regionPoints_;
labelList cellToFaceMap_;
labelList faceToFaceMap_;
labelList faceToEdgeMap_;
labelList pointToPointMap_;
// Private Member Functions
//- Disallow default bitwise copy construct
createShellMesh(const createShellMesh&);
//- Disallow default bitwise assignment
void operator=(const createShellMesh&);
public:
//- Runtime type information
ClassName("createShellMesh");
// Constructors
//- Construct from mesh.
createShellMesh
(
const primitiveFacePatch& patch,
const faceList& pointRegions,
const labelList& regionPoints
);
// Member Functions
// Access
//- From region cell to patch face
const labelList& cellToFaceMap() const
{
return cellToFaceMap_;
}
//- From region face to patch face. Contains turning index:
// > 0 : face in same orientation as patch face. face will
// be in top patch
// < 0 : face in opposite orientation as patch face. face will
// be in bottom patch
// = 0 : for all side faces
const labelList& faceToFaceMap() const
{
return faceToFaceMap_;
}
//- From region side-face to patch edge. -1 for non-edge faces.
const labelList& faceToEdgeMap() const
{
return faceToEdgeMap_;
}
//- From region point to patch point.
const labelList& pointToPointMap() const
{
return pointToPointMap_;
}
// Other
//- Helper: calculate point regions
static void calcPointRegions
(
const primitiveFacePatch& patch,
const PackedBoolList& nonManifoldEdge,
faceList& pointRegions,
labelList& regionPoints
);
//- Play commands into polyTopoChange to create layer mesh.
void setRefinement
(
const pointField& thickness,
const labelList& topPatchID,
const labelList& bottomPatchID,
const labelListList& extrudeEdgePatches,
polyTopoChange& meshMod
);
//- Update any locally stored mesh information.
void updateMesh(const mapPolyMesh&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,68 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "patchPointEdgeCirculator.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::patchPointEdgeCirculator
Foam::patchPointEdgeCirculator::endConstIter
(
*reinterpret_cast<primitiveFacePatch*>(0), // primitiveFacePatch
*reinterpret_cast<PackedBoolList*>(0), // PackedBoolList
-1, // edgeID
-1, // index
-1 // pointID
);
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const InfoProxy<patchPointEdgeCirculator>& ip
)
{
const patchPointEdgeCirculator& c = ip.t_;
const pointField& pts = c.patch_.localPoints();
const edge& e = c.patch_.edges()[c.edgeID_];
label faceI = c.faceID();
os << "around point:" << c.pointID_
<< " coord:" << pts[c.pointID_]
<< " at edge:" << c.edgeID_
<< " coord:" << pts[e.otherVertex(c.pointID_)]
<< " in direction of face:" << faceI;
if (faceI != -1)
{
os<< " fc:" << c.patch_.localFaces()[faceI].centre(pts);
}
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,206 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::patchPointEdgeCirculator
Description
Walks from starting edge/face around point on patch.
-# Use in-place: \n
@code
patchPointEdgeCirculator circ(..);
// Walk
do
{
Info<< "edge:" << circ.edgeID() << endl;
++circ;
}
while (circ != circ.end());
@endcode
-# Use like STL iterator: \n
@code
patchPointEdgeCirculator circ(..);
for
(
patchPointEdgeCirculator iter = circ.begin();
iter != circ.end();
++iter
)
{
Info<< "edge:" << iter.edgeID() << endl;
}
@endcode
SourceFiles
patchPointEdgeCirculator.C
\*---------------------------------------------------------------------------*/
#ifndef patchPointEdgeCirculator_H
#define patchPointEdgeCirculator_H
#include "face.H"
#include "ListOps.H"
#include "primitiveFacePatch.H"
#include "PackedBoolList.H"
#include "InfoProxy.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
/*---------------------------------------------------------------------------*\
Class patchPointEdgeCirculator Declaration
\*---------------------------------------------------------------------------*/
class patchPointEdgeCirculator
{
// Static data members
//- end iterator
static const patchPointEdgeCirculator endConstIter;
// Private data
//- Patch
const primitiveFacePatch& patch_;
const PackedBoolList& nonManifoldEdge_;
//- Current edge
label edgeID_;
//- Current direction (face, expressed as index into edgeFaces()[edgeID]
label index_;
//- Point
label pointID_;
//- Starting edge so we know when to stop.
label startEdgeID_;
// Private Member Functions
//- Set to end() iterator
inline void setEnd();
//- Set edgeID_ to be the other edge on the face that uses the
// point.
inline void otherEdge(const label cellI);
public:
// Constructors
//- Construct from components
inline patchPointEdgeCirculator
(
const primitiveFacePatch&,
const PackedBoolList& nonManifoldEdge,
const label edgeID,
const label index,
const label pointID
);
//- Construct as copy
inline patchPointEdgeCirculator(const patchPointEdgeCirculator&);
// Member Functions
inline label edgeID() const;
inline label index() const;
inline label pointID() const;
//- Helper: get face according to the index.
// Returns -1 if on end.
inline label faceID() const;
//- Walk back until non-manifold edge (if any) or minimum edge.
inline void setCanonical();
// Member Operators
inline void operator=(const patchPointEdgeCirculator& iter);
inline bool operator==(const patchPointEdgeCirculator& iter) const;
inline bool operator!=(const patchPointEdgeCirculator& iter) const;
//- Step to next face.
inline patchPointEdgeCirculator& operator++();
//- iterator set to the beginning face. For internal edges this is
// the current face. For boundary edges this is the first boundary face
// reached from walking back (i.e. in opposite direction to ++)
inline patchPointEdgeCirculator begin() const;
inline patchPointEdgeCirculator cbegin() const;
//- iterator set to beyond the end of the walk.
inline const patchPointEdgeCirculator& end() const;
inline const patchPointEdgeCirculator& cend() const;
// Info
//- Return info proxy.
// Used to print token information to a stream
InfoProxy<patchPointEdgeCirculator> info() const
{
return *this;
}
friend Ostream& operator<<
(
Ostream&,
const InfoProxy<patchPointEdgeCirculator>&
);
};
Ostream& operator<<(Ostream&, const InfoProxy<patchPointEdgeCirculator>&);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "patchPointEdgeCirculatorI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,309 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::patchPointEdgeCirculator::setEnd()
{
edgeID_ = -1;
pointID_ = -1;
}
// Cross face to other edge on point
void Foam::patchPointEdgeCirculator::otherEdge(const label faceI)
{
const labelList& fEdges = patch_.faceEdges()[faceI];
const face& f = patch_.localFaces()[faceI];
label fp = findIndex(f, pointID_);
if (fEdges[fp] == edgeID_)
{
edgeID_ = fEdges[f.rcIndex(fp)];
}
else
{
// Check for now
if (fEdges[f.rcIndex(fp)] != edgeID_)
{
FatalErrorIn("patchPointEdgeCirculator::otherEdge(const label)")
<< "face:" << faceI
<< " verts:" << f
<< " edges:" << fEdges
<< " looking for other edge than " << edgeID_
<< abort(FatalError);
}
edgeID_ = fEdges[fp];
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
//- Construct from components
Foam::patchPointEdgeCirculator::patchPointEdgeCirculator
(
const primitiveFacePatch& patch,
const PackedBoolList& nonManifoldEdge,
const label edgeID,
const label index,
const label pointID
)
:
patch_(patch),
nonManifoldEdge_(nonManifoldEdge),
edgeID_(edgeID),
index_(index),
pointID_(pointID),
startEdgeID_(edgeID_)
{
if (edgeID_ != -1)
{
const edge& e = patch_.edges()[edgeID_];
if (pointID_ != e[0] && pointID_ != e[1])
{
FatalErrorIn
(
"patchPointEdgeCirculator::patchPointEdgeCirculator(..)"
) << "edge " << edgeID_ << " verts " << e
<< " does not contain point " << pointID_ << abort(FatalError);
}
}
}
//- Construct copy
Foam::patchPointEdgeCirculator::patchPointEdgeCirculator
(
const patchPointEdgeCirculator& circ
)
:
patch_(circ.patch_),
nonManifoldEdge_(circ.nonManifoldEdge_),
edgeID_(circ.edgeID_),
index_(circ.index_),
pointID_(circ.pointID_),
startEdgeID_(circ.startEdgeID_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::patchPointEdgeCirculator::edgeID() const
{
return edgeID_;
}
Foam::label Foam::patchPointEdgeCirculator::index() const
{
return index_;
}
Foam::label Foam::patchPointEdgeCirculator::pointID() const
{
return pointID_;
}
Foam::label Foam::patchPointEdgeCirculator::faceID() const
{
if (edgeID_ != -1 && index_ != -1)
{
return patch_.edgeFaces()[edgeID_][index_];
}
else
{
return -1;
}
}
void Foam::patchPointEdgeCirculator::operator=
(
const patchPointEdgeCirculator& circ
)
{
edgeID_ = circ.edgeID_;
index_ = circ.index_;
pointID_ = circ.pointID_;
startEdgeID_ = circ.startEdgeID_;
}
bool Foam::patchPointEdgeCirculator::operator==
(
const patchPointEdgeCirculator& circ
) const
{
// Do just enough to have setEnd() produce an iterator equal to end().
// Could include the direction(i.e. index_) to make sure that two
// circulators around same point but in different direction are not equal.
return edgeID_ == circ.edgeID_ && pointID_ == circ.pointID_;
}
bool Foam::patchPointEdgeCirculator::operator!=
(
const patchPointEdgeCirculator& circ
) const
{
return !(*this == circ);
}
void Foam::patchPointEdgeCirculator::setCanonical()
{
if (edgeID_ == -1)
{
FatalErrorIn("patchPointEdgeCirculator::setCanonical()")
<< "Already reached end(). Cannot walk any further."
<< abort(FatalError);
}
label minEdgeID = edgeID_;
label minIndex = index_;
while (true)
{
if (nonManifoldEdge_[edgeID_])
{
break;
}
// Step back
const labelList& eFaces = patch_.edgeFaces()[edgeID_];
if (eFaces.size() != 2)
{
FatalErrorIn("patchPointEdgeCirculator::setCanonical()")
<< "problem eFaces:" << eFaces << abort(FatalError);
}
label faceI = (index_ == 0 ? eFaces[1] : eFaces[0]);
// Step to other edge on face
otherEdge(faceI);
// Update index
index_ = findIndex(patch_.edgeFaces()[edgeID_], faceI);
if (edgeID_ < minEdgeID)
{
minEdgeID = edgeID_;
minIndex = index_;
}
if (edgeID_ == startEdgeID_)
{
edgeID_ = minEdgeID;
index_ = minIndex;
break;
}
}
startEdgeID_ = edgeID_;
}
//- Step to next edge.
Foam::patchPointEdgeCirculator::patchPointEdgeCirculator&
Foam::patchPointEdgeCirculator::operator++()
{
if (index_ == -1)
{
setEnd();
}
else
{
// Step to other edge on face
label faceI = patch_.edgeFaces()[edgeID_][index_];
otherEdge(faceI);
if (edgeID_ == startEdgeID_)
{
setEnd();
}
else if (nonManifoldEdge_[edgeID_])
{
// Reached non-manifold edge. Cannot walk further.
// Mark so it gets set to end next time.
index_ = -1;
}
else
{
const labelList& eFaces = patch_.edgeFaces()[edgeID_];
if (eFaces.size() != 2)
{
FatalErrorIn("patchPointEdgeCirculator:::operator++()")
<< "problem eFaces:" << eFaces << abort(FatalError);
}
// Point to the face that is not faceI
index_ = (eFaces[0] != faceI ? 0 : 1);
}
}
return *this;
}
Foam::patchPointEdgeCirculator Foam::patchPointEdgeCirculator::begin() const
{
patchPointEdgeCirculator iter(*this);
iter.setCanonical();
return iter;
}
Foam::patchPointEdgeCirculator Foam::patchPointEdgeCirculator::cbegin() const
{
patchPointEdgeCirculator iter(*this);
iter.setCanonical();
return iter;
}
const Foam::patchPointEdgeCirculator& Foam::patchPointEdgeCirculator::end()
const
{
return endConstIter;
}
const Foam::patchPointEdgeCirculator& Foam::patchPointEdgeCirculator::cend()
const
{
return endConstIter;
}
// ************************************************************************* //

View File

@ -1,6 +1,6 @@
EXE_INC = \ EXE_INC = \
/* -g -DFULLDEBUG -O0 */ \ /* -g -DFULLDEBUG -O0 */ \
-I$(LIB_SRC)/parallel/decompositionMethods/lnInclude \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \
-I$(LIB_SRC)/mesh/autoMesh/lnInclude \ -I$(LIB_SRC)/mesh/autoMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \

View File

@ -569,7 +569,7 @@ int main(int argc, char *argv[])
dumpCyclicMatch("initial_", mesh); dumpCyclicMatch("initial_", mesh);
// Read patch construct info from dictionary // Read patch construct info from dictionary
PtrList<dictionary> patchSources(dict.lookup("patchInfo")); PtrList<dictionary> patchSources(dict.lookup("patches"));
@ -614,7 +614,7 @@ int main(int argc, char *argv[])
if (destPatchI == -1) if (destPatchI == -1)
{ {
dictionary patchDict(dict.subDict("dictionary")); dictionary patchDict(dict.subDict("patchInfo"));
destPatchI = allPatches.size(); destPatchI = allPatches.size();

View File

@ -48,14 +48,14 @@ matchTolerance 1E-3;
pointSync true; pointSync true;
// Patches to create. // Patches to create.
patchInfo patches
( (
{ {
// Name of new patch // Name of new patch
name sidePatches; name sidePatches;
// Type of new patch // Type of new patch
dictionary patchInfo
{ {
type cyclic; type cyclic;

View File

@ -2,7 +2,7 @@ EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/parallel/decompositionMethods/lnInclude -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lmeshTools \ -lmeshTools \

View File

@ -960,7 +960,14 @@ int main(int argc, char *argv[])
# endif # endif
} }
if (rawLine.empty() || rawLine[0] == '#') // Strip off anything after #
string::size_type i = rawLine.find_first_of("#");
if (i != string::npos)
{
rawLine = rawLine(0, i);
}
if (rawLine.empty())
{ {
continue; continue;
} }

View File

@ -1,5 +1,5 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/parallel/decompositionMethods/lnInclude \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude -I$(LIB_SRC)/meshTools/lnInclude

View File

@ -162,15 +162,13 @@ void Foam::domainDecomposition::distributeCells()
// somewhere in the middle of the domain which might not be anywhere // somewhere in the middle of the domain which might not be anywhere
// near any of the cells. // near any of the cells.
const point greatPoint(GREAT, GREAT, GREAT); pointField regionCentres(globalRegion.nRegions(), point::max);
pointField regionCentres(globalRegion.nRegions(), greatPoint);
forAll(globalRegion, cellI) forAll(globalRegion, cellI)
{ {
label regionI = globalRegion[cellI]; label regionI = globalRegion[cellI];
if (regionCentres[regionI] == greatPoint) if (regionCentres[regionI] == point::max)
{ {
regionCentres[regionI] = cellCentres()[cellI]; regionCentres[regionI] = cellCentres()[cellI];
} }

View File

@ -1,7 +1,7 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/parallel/reconstruct/lnInclude -I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \

View File

@ -1,5 +1,5 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/parallel/decompositionMethods/lnInclude \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude -I$(LIB_SRC)/dynamicMesh/lnInclude

View File

@ -87,16 +87,26 @@ Foam::ensightMesh::ensightMesh
if (args.optionFound("patches")) if (args.optionFound("patches"))
{ {
wordList patchNameList(args.optionLookup("patches")()); wordReList patterns(args.optionLookup("patches")());
if (patchNameList.empty()) if (patterns.empty())
{ {
patchNameList = allPatchNames_; forAll(allPatchNames_, nameI)
{
patchNames_.insert(allPatchNames_[nameI]);
} }
}
forAll(patchNameList, i) else
{ {
patchNames_.insert(patchNameList[i]); // Find patch names which match that requested at command-line
forAll(allPatchNames_, nameI)
{
const word& patchName = allPatchNames_[nameI];
if (findStrings(patterns, patchName))
{
patchNames_.insert(patchName);
}
}
} }
} }
} }
@ -247,19 +257,17 @@ Foam::ensightMesh::ensightMesh
// faceZones // faceZones
if (args.optionFound("faceZones")) if (args.optionFound("faceZones"))
{ {
wordList patchNameList(args.optionLookup("faceZones")()); wordReList patterns(args.optionLookup("faceZones")());
const wordList faceZoneNamesAll = mesh_.faceZones().names(); const wordList faceZoneNamesAll = mesh_.faceZones().names();
// Find out faceZone names that match with what requested at command // Find faceZone names which match that requested at command-line
// line forAll(faceZoneNamesAll, nameI)
forAll(patchNameList, i)
{ {
labelList matches = findStrings(patchNameList[i], faceZoneNamesAll); const word& zoneName = faceZoneNamesAll[nameI];
if (findStrings(patterns, zoneName))
forAll(matches, matchI)
{ {
faceZoneNames_.insert(faceZoneNamesAll[matches[matchI]]); faceZoneNames_.insert(zoneName);
} }
} }
@ -353,8 +361,8 @@ Foam::ensightMesh::ensightMesh
if if
( (
faceZoneFaceSets_[zoneI].tris.size() faceZoneFaceSets_[zoneI].tris.size()
|| faceZoneFaceSets_[zoneI].quads.size() || || faceZoneFaceSets_[zoneI].quads.size()
faceZoneFaceSets_[zoneI].polys.size() || faceZoneFaceSets_[zoneI].polys.size()
) )
{ {
nfp.nTris = faceZoneFaceSets_[zoneI].tris.size(); nfp.nTris = faceZoneFaceSets_[zoneI].tris.size();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -112,21 +112,21 @@ int main(int argc, char *argv[])
argList::addOption argList::addOption
( (
"patches", "patches",
"wordList", "wordReList",
"specify particular patches to write - eg '(inlet outlet)'. " "specify particular patches to write - eg '(outlet \"inlet.*\")'. "
"An empty list suppresses writing the internalMesh." "An empty list suppresses writing the internalMesh."
); );
argList::addOption argList::addOption
( (
"faceZones", "faceZones",
"wordList", "wordReList",
"specify faceZones to write, with wildcards - eg '(mfp-.*)'. " "specify faceZones to write - eg '( slice \"mfp-.*\" )'."
); );
# include "setRootCase.H" # include "setRootCase.H"
// Check options // Check options
bool binary = !args.optionFound("ascii"); const bool binary = !args.optionFound("ascii");
# include "createTime.H" # include "createTime.H"

View File

@ -159,13 +159,6 @@ Note
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
static const label VTK_TETRA = 10;
static const label VTK_PYRAMID = 14;
static const label VTK_WEDGE = 13;
static const label VTK_HEXAHEDRON = 12;
template<class GeoField> template<class GeoField>
void print(const char* msg, Ostream& os, const PtrList<GeoField>& flds) void print(const char* msg, Ostream& os, const PtrList<GeoField>& flds)
{ {
@ -229,10 +222,7 @@ labelList getSelectedPatches
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program: // Main program:
int main(int argc, char *argv[]) int main(int argc, char *argv[])
@ -285,11 +275,11 @@ int main(int argc, char *argv[])
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
bool doWriteInternal = !args.optionFound("noInternal"); const bool doWriteInternal = !args.optionFound("noInternal");
bool doFaceZones = !args.optionFound("noFaceZones"); const bool doFaceZones = !args.optionFound("noFaceZones");
bool doLinks = !args.optionFound("noLinks"); const bool doLinks = !args.optionFound("noLinks");
bool binary = !args.optionFound("ascii"); const bool binary = !args.optionFound("ascii");
bool useTimeName = args.optionFound("useTimeName"); const bool useTimeName = args.optionFound("useTimeName");
if (binary && (sizeof(floatScalar) != 4 || sizeof(label) != 4)) if (binary && (sizeof(floatScalar) != 4 || sizeof(label) != 4))
{ {
@ -299,7 +289,7 @@ int main(int argc, char *argv[])
<< exit(FatalError); << exit(FatalError);
} }
bool nearCellValue = args.optionFound("nearCellValue"); const bool nearCellValue = args.optionFound("nearCellValue");
if (nearCellValue) if (nearCellValue)
{ {
@ -308,7 +298,7 @@ int main(int argc, char *argv[])
<< nl << endl; << nl << endl;
} }
bool noPointValues = args.optionFound("noPointValues"); const bool noPointValues = args.optionFound("noPointValues");
if (noPointValues) if (noPointValues)
{ {
@ -316,7 +306,7 @@ int main(int argc, char *argv[])
<< "Outputting cell values only" << nl << endl; << "Outputting cell values only" << nl << endl;
} }
bool allPatches = args.optionFound("allPatches"); const bool allPatches = args.optionFound("allPatches");
List<wordRe> excludePatches; List<wordRe> excludePatches;
if (args.optionFound("excludePatches")) if (args.optionFound("excludePatches"))
@ -392,15 +382,8 @@ int main(int argc, char *argv[])
Info<< "Time: " << runTime.timeName() << endl; Info<< "Time: " << runTime.timeName() << endl;
word timeDesc = ""; word timeDesc =
if (useTimeName) useTimeName ? runTime.timeName() : Foam::name(runTime.timeIndex());
{
timeDesc = runTime.timeName();
}
else
{
timeDesc = name(runTime.timeIndex());
}
// Check for new polyMesh/ and update mesh, fvMeshSubset and cell // Check for new polyMesh/ and update mesh, fvMeshSubset and cell
// decomposition. // decomposition.
@ -470,10 +453,7 @@ int main(int argc, char *argv[])
IOobjectList objects(mesh, runTime.timeName()); IOobjectList objects(mesh, runTime.timeName());
HashSet<word> selectedFields; HashSet<word> selectedFields;
if (args.optionFound("fields")) args.optionReadIfPresent("fields", selectedFields);
{
args.optionLookup("fields")() >> selectedFields;
}
// Construct the vol fields (on the original mesh if subsetted) // Construct the vol fields (on the original mesh if subsetted)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -33,10 +33,10 @@ Description
#include "polyMesh.H" #include "polyMesh.H"
#include "cellShape.H" #include "cellShape.H"
#include "cellModeller.H" #include "cellModeller.H"
#include "Swap.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::vtkTopo::vtkTopo(const polyMesh& mesh) Foam::vtkTopo::vtkTopo(const polyMesh& mesh)
: :
mesh_(mesh), mesh_(mesh),
@ -61,6 +61,9 @@ Foam::vtkTopo::vtkTopo(const polyMesh& mesh)
// Number of additional cells generated by the decomposition of polyhedra // Number of additional cells generated by the decomposition of polyhedra
label nAddCells = 0; label nAddCells = 0;
// face owner is needed to determine the face orientation
const labelList& owner = mesh.faceOwner();
// Scan for cells which need to be decomposed and count additional points // Scan for cells which need to be decomposed and count additional points
// and cells // and cells
@ -71,7 +74,7 @@ Foam::vtkTopo::vtkTopo(const polyMesh& mesh)
if if
( (
model != hex model != hex
// && model != wedge // See above. // && model != wedge // See above.
&& model != prism && model != prism
&& model != pyr && model != pyr
&& model != tet && model != tet
@ -111,7 +114,7 @@ Foam::vtkTopo::vtkTopo(const polyMesh& mesh)
cellTypes_.setSize(cellShapes.size() + nAddCells); cellTypes_.setSize(cellShapes.size() + nAddCells);
// Set counters for additional points and additional cells // Set counters for additional points and additional cells
label api = 0, aci = 0; label addPointI = 0, addCellI = 0;
forAll(cellShapes, cellI) forAll(cellShapes, cellI)
{ {
@ -134,15 +137,13 @@ Foam::vtkTopo::vtkTopo(const polyMesh& mesh)
} }
else if (cellModel == prism) else if (cellModel == prism)
{ {
vtkVerts.setSize(6); // VTK has a different node order for VTK_WEDGE
vtkVerts[0] = cellShape[0]; // their triangles point outwards!
vtkVerts[1] = cellShape[2]; vtkVerts = cellShape;
vtkVerts[2] = cellShape[1];
vtkVerts[3] = cellShape[3]; Foam::Swap(vtkVerts[1], vtkVerts[2]);
vtkVerts[4] = cellShape[5]; Foam::Swap(vtkVerts[4], vtkVerts[5]);
vtkVerts[5] = cellShape[4];
// VTK calls this a wedge.
cellTypes_[cellI] = VTK_WEDGE; cellTypes_[cellI] = VTK_WEDGE;
} }
else if (cellModel == tetWedge) else if (cellModel == tetWedge)
@ -175,34 +176,28 @@ Foam::vtkTopo::vtkTopo(const polyMesh& mesh)
// } // }
else if (cellModel == hex) else if (cellModel == hex)
{ {
vtkVerts.setSize(8); vtkVerts = cellShape;
vtkVerts[0] = cellShape[0];
vtkVerts[1] = cellShape[1];
vtkVerts[2] = cellShape[2];
vtkVerts[3] = cellShape[3];
vtkVerts[4] = cellShape[4];
vtkVerts[5] = cellShape[5];
vtkVerts[6] = cellShape[6];
vtkVerts[7] = cellShape[7];
cellTypes_[cellI] = VTK_HEXAHEDRON; cellTypes_[cellI] = VTK_HEXAHEDRON;
} }
else else
{ {
// Polyhedral cell. Decompose into tets + prisms. // Polyhedral cell. Decompose into tets + prisms.
// (see dxFoamExec/createDxConnections.C)
// Mapping from additional point to cell // Mapping from additional point to cell
addPointCellLabels_[api] = cellI; addPointCellLabels_[addPointI] = cellI;
// The new vertex from the cell-centre
const label newVertexLabel = mesh_.nPoints() + addPointI;
// Whether to insert cell in place of original or not. // Whether to insert cell in place of original or not.
bool substituteCell = true; bool substituteCell = true;
const labelList& cFaces = mesh_.cells()[cellI]; const labelList& cFaces = mesh_.cells()[cellI];
forAll(cFaces, cFaceI) forAll(cFaces, cFaceI)
{ {
const face& f = mesh_.faces()[cFaces[cFaceI]]; const face& f = mesh_.faces()[cFaces[cFaceI]];
const bool isOwner = (owner[cFaces[cFaceI]] == cellI);
// Number of triangles and quads in decomposition // Number of triangles and quads in decomposition
label nTris = 0; label nTris = 0;
@ -216,75 +211,95 @@ Foam::vtkTopo::vtkTopo(const polyMesh& mesh)
label quadi = 0; label quadi = 0;
f.trianglesQuads(mesh_.points(), trii, quadi, triFcs, quadFcs); f.trianglesQuads(mesh_.points(), trii, quadi, triFcs, quadFcs);
forAll(quadFcs, quadi) forAll(quadFcs, quadI)
{ {
label thisCellI = -1; label thisCellI;
if (substituteCell) if (substituteCell)
{ {
thisCellI = cellI; thisCellI = cellI;
substituteCell = false; substituteCell = false;
} }
else else
{ {
thisCellI = mesh_.nCells() + aci; thisCellI = mesh_.nCells() + addCellI;
superCells_[addCellI++] = cellI;
superCells_[aci] = cellI;
aci++;
} }
labelList& addVtkVerts = vertLabels_[thisCellI]; labelList& addVtkVerts = vertLabels_[thisCellI];
addVtkVerts.setSize(5); addVtkVerts.setSize(5);
const face& quad = quadFcs[quadi]; const face& quad = quadFcs[quadI];
// Ensure we have the correct orientation for the
// base of the primitive cell shape.
// If the cell is face owner, the orientation needs to be
// flipped.
// At the moment, VTK doesn't actually seem to care if
// negative cells are defined, but we'll do it anyhow
// (for safety).
if (isOwner)
{
addVtkVerts[0] = quad[3];
addVtkVerts[1] = quad[2];
addVtkVerts[2] = quad[1];
addVtkVerts[3] = quad[0];
}
else
{
addVtkVerts[0] = quad[0]; addVtkVerts[0] = quad[0];
addVtkVerts[1] = quad[1]; addVtkVerts[1] = quad[1];
addVtkVerts[2] = quad[2]; addVtkVerts[2] = quad[2];
addVtkVerts[3] = quad[3]; addVtkVerts[3] = quad[3];
addVtkVerts[4] = mesh_.nPoints() + api; }
addVtkVerts[4] = newVertexLabel;
cellTypes_[thisCellI] = VTK_PYRAMID; cellTypes_[thisCellI] = VTK_PYRAMID;
} }
forAll(triFcs, trii) forAll(triFcs, triI)
{ {
label thisCellI = -1; label thisCellI;
if (substituteCell) if (substituteCell)
{ {
thisCellI = cellI; thisCellI = cellI;
substituteCell = false; substituteCell = false;
} }
else else
{ {
thisCellI = mesh_.nCells() + aci; thisCellI = mesh_.nCells() + addCellI;
superCells_[addCellI++] = cellI;
superCells_[aci] = cellI;
aci++;
} }
labelList& addVtkVerts = vertLabels_[thisCellI]; labelList& addVtkVerts = vertLabels_[thisCellI];
const face& tri = triFcs[trii]; const face& tri = triFcs[triI];
addVtkVerts.setSize(4); addVtkVerts.setSize(4);
// See note above about the orientation.
if (isOwner)
{
addVtkVerts[0] = tri[2];
addVtkVerts[1] = tri[1];
addVtkVerts[2] = tri[0];
}
else
{
addVtkVerts[0] = tri[0]; addVtkVerts[0] = tri[0];
addVtkVerts[1] = tri[1]; addVtkVerts[1] = tri[1];
addVtkVerts[2] = tri[2]; addVtkVerts[2] = tri[2];
addVtkVerts[3] = mesh_.nPoints() + api; }
addVtkVerts[3] = newVertexLabel;
cellTypes_[thisCellI] = VTK_TETRA; cellTypes_[thisCellI] = VTK_TETRA;
} }
} }
api++; addPointI++;
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -80,7 +80,7 @@ public:
// Public static data // Public static data
// this must be consistent with the enumeration in "vtkCell.H" //- equivalent to enumeration in "vtkCellType.h"
enum vtkTypes enum vtkTypes
{ {
VTK_TRIANGLE = 5, VTK_TRIANGLE = 5,
@ -88,9 +88,10 @@ public:
VTK_QUAD = 9, VTK_QUAD = 9,
VTK_TETRA = 10, VTK_TETRA = 10,
VTK_PYRAMID = 14,
VTK_WEDGE = 13,
VTK_HEXAHEDRON = 12, VTK_HEXAHEDRON = 12,
VTK_WEDGE = 13,
VTK_PYRAMID = 14,
VTK_POLYHEDRON = 42
}; };
// Constructors // Constructors

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,9 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wclean libso vtkPV3Readers
PV3blockMeshReader/Allwclean
PV3FoamReader/Allwclean
# ----------------------------------------------------------------- end-of-file

View File

@ -91,7 +91,8 @@
animateable="0"> animateable="0">
<BooleanDomain name="bool"/> <BooleanDomain name="bool"/>
<Documentation> <Documentation>
Use vtkPolyhedron instead of decomposing polyhedra Use vtkPolyhedron instead of decomposing polyhedra.
!!Actually uses vtkConvexPointSet until this is properly supported in VTK!!
</Documentation> </Documentation>
</IntVectorProperty> </IntVectorProperty>

View File

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

View File

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

View File

@ -2,12 +2,7 @@ EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(ParaView_DIR)/VTK \ -I$(ParaView_DIR)/include/paraview-$(ParaView_MAJOR) \
-I$(ParaView_INST_DIR) \
-I$(ParaView_INST_DIR)/VTK \
-I$(ParaView_INST_DIR)/VTK/Common \
-I$(ParaView_INST_DIR)/VTK/Filtering \
-I$(ParaView_INST_DIR)/VTK/Rendering \
-I../../vtkPV3Readers/lnInclude \ -I../../vtkPV3Readers/lnInclude \
-I../PV3FoamReader -I../PV3FoamReader

View File

@ -31,6 +31,7 @@ License
#include "fvMesh.H" #include "fvMesh.H"
#include "cellModeller.H" #include "cellModeller.H"
#include "vtkOpenFOAMPoints.H" #include "vtkOpenFOAMPoints.H"
#include "Swap.H"
// VTK includes // VTK includes
#include "vtkCellArray.h" #include "vtkCellArray.h"
@ -45,6 +46,13 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
polyDecomp& decompInfo polyDecomp& decompInfo
) )
{ {
const cellModel& tet = *(cellModeller::lookup("tet"));
const cellModel& pyr = *(cellModeller::lookup("pyr"));
const cellModel& prism = *(cellModeller::lookup("prism"));
const cellModel& wedge = *(cellModeller::lookup("wedge"));
const cellModel& tetWedge = *(cellModeller::lookup("tetWedge"));
const cellModel& hex = *(cellModeller::lookup("hex"));
vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::New(); vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::New();
if (debug) if (debug)
@ -53,36 +61,27 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
printMemory(); printMemory();
} }
const cellShapeList& cellShapes = mesh.cellShapes();
// Number of additional points needed by the decomposition of polyhedra // Number of additional points needed by the decomposition of polyhedra
label nAddPoints = 0; label nAddPoints = 0;
// Number of additional cells generated by the decomposition of polyhedra // Number of additional cells generated by the decomposition of polyhedra
label nAddCells = 0; label nAddCells = 0;
// face owner is needed to determine the face orientation
const labelList& owner = mesh.faceOwner();
labelList& superCells = decompInfo.superCells(); labelList& superCells = decompInfo.superCells();
labelList& addPointCellLabels = decompInfo.addPointCellLabels(); labelList& addPointCellLabels = decompInfo.addPointCellLabels();
const cellModel& tet = *(cellModeller::lookup("tet"));
const cellModel& pyr = *(cellModeller::lookup("pyr"));
const cellModel& prism = *(cellModeller::lookup("prism"));
const cellModel& wedge = *(cellModeller::lookup("wedge"));
const cellModel& tetWedge = *(cellModeller::lookup("tetWedge"));
const cellModel& hex = *(cellModeller::lookup("hex"));
// Scan for cells which need to be decomposed and count additional points
// and cells
if (debug)
{
Info<< "... building cell-shapes" << endl;
}
const cellShapeList& cellShapes = mesh.cellShapes();
if (debug) if (debug)
{ {
Info<< "... scanning" << endl; Info<< "... scanning" << endl;
} }
// count number of cells to decompose // Scan for cells which need to be decomposed and count additional points
// and cells
if (!reader_->GetUseVTKPolyhedron()) if (!reader_->GetUseVTKPolyhedron())
{ {
forAll(cellShapes, cellI) forAll(cellShapes, cellI)
@ -105,10 +104,10 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
{ {
const face& f = mesh.faces()[cFaces[cFaceI]]; const face& f = mesh.faces()[cFaces[cFaceI]];
label nFacePoints = f.size(); label nQuads = 0;
label nTris = 0;
f.nTrianglesQuads(mesh.points(), nTris, nQuads);
label nQuads = (nFacePoints - 2)/2;
label nTris = (nFacePoints - 2)%2;
nAddCells += nQuads + nTris; nAddCells += nQuads + nTris;
} }
@ -201,8 +200,8 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
} }
else if (cellModel == prism) else if (cellModel == prism)
{ {
// VTK has a different node order - their triangles point outwards! // VTK has a different node order for VTK_WEDGE
// their triangles point outwards!
nodeIds[0] = cellShape[0]; nodeIds[0] = cellShape[0];
nodeIds[1] = cellShape[2]; nodeIds[1] = cellShape[2];
nodeIds[2] = cellShape[1]; nodeIds[2] = cellShape[1];
@ -349,29 +348,34 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
// Mapping from additional point to cell // Mapping from additional point to cell
addPointCellLabels[addPointI] = cellI; addPointCellLabels[addPointI] = cellI;
// Insert the new vertex from the cell-centre // The new vertex from the cell-centre
label newVertexLabel = mesh.nPoints() + addPointI; const label newVertexLabel = mesh.nPoints() + addPointI;
vtkInsertNextOpenFOAMPoint(vtkpoints, mesh.C()[cellI]); vtkInsertNextOpenFOAMPoint(vtkpoints, mesh.C()[cellI]);
// Whether to insert cell in place of original or not. // Whether to insert cell in place of original or not.
bool substituteCell = true; bool substituteCell = true;
const labelList& cFaces = mesh.cells()[cellI]; const labelList& cFaces = mesh.cells()[cellI];
forAll(cFaces, cFaceI) forAll(cFaces, cFaceI)
{ {
const face& f = mesh.faces()[cFaces[cFaceI]]; const face& f = mesh.faces()[cFaces[cFaceI]];
const bool isOwner = (owner[cFaces[cFaceI]] == cellI);
label nFacePoints = f.size(); // Number of triangles and quads in decomposition
label nTris = 0;
label nQuads = 0;
f.nTrianglesQuads(mesh.points(), nTris, nQuads);
label nQuads = (nFacePoints - 2)/2; // Do actual decomposition into triFcs and quadFcs.
label nTris = (nFacePoints - 2)%2; faceList triFcs(nTris);
faceList quadFcs(nQuads);
label trii = 0;
label quadi = 0;
f.trianglesQuads(mesh.points(), trii, quadi, triFcs, quadFcs);
label qpi = 0; forAll(quadFcs, quadI)
for (label quadi=0; quadi<nQuads; quadi++)
{ {
label thisCellI = -1; label thisCellI;
if (substituteCell) if (substituteCell)
{ {
@ -384,10 +388,29 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
superCells[addCellI++] = cellI; superCells[addCellI++] = cellI;
} }
nodeIds[0] = f[0]; const face& quad = quadFcs[quadI];
nodeIds[1] = f[qpi + 1];
nodeIds[2] = f[qpi + 2]; // Ensure we have the correct orientation for the
nodeIds[3] = f[qpi + 3]; // base of the primitive cell shape.
// If the cell is face owner, the orientation needs to be
// flipped.
// At the moment, VTK doesn't actually seem to care if
// negative cells are defined, but we'll do it anyhow
// (for safety).
if (isOwner)
{
nodeIds[0] = quad[3];
nodeIds[1] = quad[2];
nodeIds[2] = quad[1];
nodeIds[3] = quad[0];
}
else
{
nodeIds[0] = quad[0];
nodeIds[1] = quad[1];
nodeIds[2] = quad[2];
nodeIds[3] = quad[3];
}
nodeIds[4] = newVertexLabel; nodeIds[4] = newVertexLabel;
vtkmesh->InsertNextCell vtkmesh->InsertNextCell
( (
@ -395,13 +418,11 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
5, 5,
nodeIds nodeIds
); );
qpi += 2;
} }
if (nTris) forAll(triFcs, triI)
{ {
label thisCellI = -1; label thisCellI;
if (substituteCell) if (substituteCell)
{ {
@ -414,10 +435,23 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
superCells[addCellI++] = cellI; superCells[addCellI++] = cellI;
} }
nodeIds[0] = f[0]; const face& tri = triFcs[triI];
nodeIds[1] = f[qpi + 1];
nodeIds[2] = f[qpi + 2]; // See note above about the orientation.
if (isOwner)
{
nodeIds[0] = tri[2];
nodeIds[1] = tri[1];
nodeIds[2] = tri[0];
}
else
{
nodeIds[0] = tri[0];
nodeIds[1] = tri[1];
nodeIds[2] = tri[2];
}
nodeIds[3] = newVertexLabel; nodeIds[3] = newVertexLabel;
vtkmesh->InsertNextCell vtkmesh->InsertNextCell
( (
VTK_TETRA, VTK_TETRA,

View File

@ -1,12 +1,7 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/mesh/blockMesh/lnInclude \ -I$(LIB_SRC)/mesh/blockMesh/lnInclude \
-I$(ParaView_DIR)/VTK \ -I$(ParaView_DIR)/include/paraview-$(ParaView_MAJOR) \
-I$(ParaView_INST_DIR) \
-I$(ParaView_INST_DIR)/VTK \
-I$(ParaView_INST_DIR)/VTK/Common \
-I$(ParaView_INST_DIR)/VTK/Filtering \
-I$(ParaView_INST_DIR)/VTK/Rendering \
-I../../vtkPV3Readers/lnInclude \ -I../../vtkPV3Readers/lnInclude \
-I../PV3blockMeshReader -I../PV3blockMeshReader

View File

@ -1,10 +1,5 @@
EXE_INC = \ EXE_INC = \
-I$(ParaView_DIR)/VTK \ -I$(ParaView_DIR)/include/paraview-$(ParaView_MAJOR)
-I$(ParaView_INST_DIR) \
-I$(ParaView_INST_DIR)/VTK \
-I$(ParaView_INST_DIR)/VTK/Common \
-I$(ParaView_INST_DIR)/VTK/Filtering \
-I$(ParaView_INST_DIR)/VTK/Rendering
LIB_LIBS = \ LIB_LIBS = \
$(GLIBS) $(GLIBS)

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. # \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License
@ -38,7 +38,7 @@ Usage: ${0##*/} [OPTION]
options: options:
-help -help
* start engrid using the paraview-$ParaView_VERSION libraries * start engrid using the paraview-$ParaView_MAJOR libraries
passes through engrid options unmodified passes through engrid options unmodified
USAGE USAGE
@ -48,13 +48,8 @@ USAGE
# report usage # report usage
[ "$1" = "-h" -o "$1" = "-help" ] && usage [ "$1" = "-h" -o "$1" = "-help" ] && usage
# set the major version "<digits>.<digits>" bindir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/engrid
ParaView_MAJOR_VERSION=$(echo $ParaView_VERSION | \ libdir="$ParaView_DIR/lib/paraview-${ParaView_MAJOR:-unknown}"
sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/')
bindir=$WM_THIRD_PARTY_DIR/engrid/platforms/$WM_ARCH
libdir="$ParaView_DIR/lib/paraview-$ParaView_MAJOR_VERSION"
[ -x $bindir/engrid ] || usage "engrid executable not found in $bindir" [ -x $bindir/engrid ] || usage "engrid executable not found in $bindir"
[ -d $libdir ] || usage "paraview libraries not found" [ -d $libdir ] || usage "paraview libraries not found"

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -41,7 +41,11 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { usage() {
cat <<USAGE 1>&2 cat <<USAGE 1>&2
Usage: ${0##*/} [-strip] path [wildcard] .. [wildcard] Usage: ${0##*/} [OPTION] path [wildcard1] .. [wildcardN]
options:
-space treat 'path' as space-delimited (eg, from C-Shell)
-strip remove inaccessible directories
-help print the usage
Prints its argument (which should be a ':' separated list) cleansed from Prints its argument (which should be a ':' separated list) cleansed from
- duplicate elements - duplicate elements
@ -53,7 +57,7 @@ USAGE
} }
unset strip unset space strip
# parse options # parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
@ -61,6 +65,10 @@ do
-h | -help) -h | -help)
usage usage
;; ;;
-space)
space=true
shift
;;
-strip) -strip)
strip=true strip=true
shift shift
@ -74,7 +82,12 @@ done
[ "$#" -ge 1 ] || usage [ "$#" -ge 1 ] || usage
dirList="$1" if [ "$space" = true ]
then
dirList=$(echo "$1" | sed -e 's/ /:/g')
else
dirList="$1"
fi
shift shift
##DEBUG echo "input>$dirList<" 1>&2 ##DEBUG echo "input>$dirList<" 1>&2
@ -123,12 +136,15 @@ do
fi fi
done done
# parse on whitespace # split on whitespace
IFS=' ' IFS=' '
set -- $dirList set -- $dirList
# join on ':' # join on ':', unless -space option was specified
IFS=':' if [ "$space" != true ]
then
IFS=':'
fi
dirList="$*" dirList="$*"
# restore IFS # restore IFS

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -27,7 +27,7 @@
# foamCleanTutorials # foamCleanTutorials
# #
# Description # Description
# Run either Allclean or default cleanCase in current directory # Run either Allwclean, Allclean or default cleanCase in current directory
# and all its subdirectories. # and all its subdirectories.
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -41,24 +41,29 @@ then
thisScript="$PWD/$thisScript" thisScript="$PWD/$thisScript"
fi fi
# If an argument is supplied do not execute ./Allclean to avoid recursion # If an argument is supplied do not execute ./Allwclean or ./Allclean
if [ $# = 0 -a -f Allclean ] # (to avoid recursion)
if [ $# -eq 0 -a -f Allwclean ]
then then
# Specialised script. # Specialized script
./Allwclean
elif [ $# -eq 0 -a -f Allclean ]
then
# Specialized script
./Allclean ./Allclean
elif [ -d system ] elif [ -d system ]
then then
# Normal case. # Normal case
cleanCase cleanCase
elif [ -d Make ] elif [ -d Make ]
then then
# Normal application. # Normal application
cleanApplication cleanApplication
else else
# Recurse to subdirectories # Recurse into subdirectories
for caseDir in * for caseName in *
do do
( cd $caseDir 2>/dev/null && $thisScript ) ( cd $caseName 2>/dev/null && $thisScript )
done done
fi fi

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License
@ -34,31 +34,31 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
printUsage() usage()
{ {
echo "Usage : `basename $0` start|stop|list" echo "Usage : ${0##*/} start|stop|list"
echo "" echo ""
exit 1
} }
RSH='ssh' RSH='ssh'
if [ ! "$DISTCC_HOSTS" ]; then if [ ! "$DISTCC_HOSTS" ]
echo "`basename $0`: variable DISTCC_HOSTS not set." then
echo "`basename $0`: please set DISTCC_HOSTS to the list of hosts to use." echo "${0##*/} Warnings"
echo "`basename $0`: the format is host1:port host2:port host3:port etc." echo " variable DISTCC_HOSTS not set."
echo "" echo " please set DISTCC_HOSTS to the list of hosts to use."
echo " the format is host1:port host2:port host3:port etc."
echo
exit 1 exit 1
fi fi
if [ $# -ne 1 ]; then [ $# -eq 1 ] || usage
printUsage
exit 1
fi
if [ "$1" = 'start' ]; then case "$1" in
start)
grep -v '^#' /etc/hosts | awk '{print $1, $2 " "}' > ~/filteredHosts.txt grep -v '^#' /etc/hosts | awk '{print $1, $2 " "}' > ~/filteredHosts.txt
allowIPS='' allowIPS=''
@ -66,7 +66,8 @@ if [ "$1" = 'start' ]; then
do do
machine=`echo "$host" | awk -F: '{print $1}'` machine=`echo "$host" | awk -F: '{print $1}'`
iptest=`echo "$machine" | sed -e 's/[0-9.]//g'` iptest=`echo "$machine" | sed -e 's/[0-9.]//g'`
if [ ! "$iptest" ]; then if [ ! "$iptest" ]
then
# address only contained 0-9 and '.'. Probably ip address. # address only contained 0-9 and '.'. Probably ip address.
ip=$machine ip=$machine
else else
@ -74,7 +75,8 @@ if [ "$1" = 'start' ]; then
ip=`egrep " $machine " ~/filteredHosts.txt | awk '{print $1}'` ip=`egrep " $machine " ~/filteredHosts.txt | awk '{print $1}'`
fi fi
if [ ! "$ip" ]; then if [ ! "$ip" ]
then
echo "$0 : host specifier $host either is not an ip address or cannot be found in /etc/hosts." echo "$0 : host specifier $host either is not an ip address or cannot be found in /etc/hosts."
echo "$0 : Exiting." echo "$0 : Exiting."
exit 1 exit 1
@ -92,7 +94,8 @@ if [ "$1" = 'start' ]; then
machine=`echo "$host" | awk -F: '{print $1}'` machine=`echo "$host" | awk -F: '{print $1}'`
port=`echo "$host" | awk -F: '{print $2}'` port=`echo "$host" | awk -F: '{print $2}'`
if [ "$machine" -a "$port" ]; then if [ "$machine" -a "$port" ]
then
#echo "Machine:$machine port:$port" #echo "Machine:$machine port:$port"
echo "distccd --daemon $allowIPS --port $port"' --jobs `egrep "^processor" /proc/cpuinfo | wc -l`' echo "distccd --daemon $allowIPS --port $port"' --jobs `egrep "^processor" /proc/cpuinfo | wc -l`'
$RSH $machine "distccd --verbose --daemon $allowIPS --port $port"' --jobs `egrep "^processor" /proc/cpuinfo | wc -l`' $RSH $machine "distccd --verbose --daemon $allowIPS --port $port"' --jobs `egrep "^processor" /proc/cpuinfo | wc -l`'
@ -102,9 +105,9 @@ if [ "$1" = 'start' ]; then
exit 1 exit 1
fi fi
done done
;;
elif [ "$1" = 'stop' ]; then stop)
for host in $DISTCC_HOSTS for host in $DISTCC_HOSTS
do do
echo "" echo ""
@ -114,10 +117,9 @@ elif [ "$1" = 'stop' ]; then
$RSH $machine killall distccd $RSH $machine killall distccd
done done
;;
list)
elif [ "$1" = 'list' ]; then
for host in $DISTCC_HOSTS for host in $DISTCC_HOSTS
do do
echo "" echo ""
@ -127,12 +129,11 @@ elif [ "$1" = 'list' ]; then
$RSH $machine "ps -ef | grep distccd | grep -v grep" $RSH $machine "ps -ef | grep distccd | grep -v grep"
done done
;;
else *)
usage
printUsage ;;
exit 1 esac
fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License
@ -32,10 +32,11 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
sourcesFile=${TMPDIR:-/tmp}/sourcesFile.$$ sourcesFile=${TMPDIR:-/tmp}/sourcesFile.$$
if [ $# -ne 0 ]; then if [ $# -ne 0 ]
then
echo "Usage : ${0##*/}" echo "Usage : ${0##*/}"
echo "" echo ""
echo "Build the Ebrowse dadbase for all the .H and .C files" echo "Build the Ebrowse database for all the .H and .C files"
echo "" echo ""
exit 1 exit 1
fi fi

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -27,7 +27,7 @@
# foamNew # foamNew
# #
# Description # Description
# Create a new standard OpenFOAM source file # Create a new standard OpenFOAM source or template file
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { usage() {
@ -50,11 +50,11 @@ USAGE
case "$1" in case "$1" in
source) source)
shift shift
$WM_PROJECT_DIR/bin/templates/source/foamNewSource $* $WM_PROJECT_DIR/etc/codeTemplates/source/foamNewSource $*
;; ;;
template) template)
shift shift
$WM_PROJECT_DIR/bin/templates/sourceTemplate/foamNewTemplate $* $WM_PROJECT_DIR/etc/codeTemplates/template/foamNewTemplate $*
;; ;;
*) *)
usage "unknown type" usage "unknown type"

224
bin/foamNewCase Executable file
View File

@ -0,0 +1,224 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
#
# OpenFOAM is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenFOAM; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Script
# foamNewCase
#
# Description
# Create a new case from a template for particular applications
# - requires rsync
#
#------------------------------------------------------------------------------
siteDir=${WM_PROJECT_INST_DIR:-unknown}/site
userDir=$HOME/.OpenFOAM
version=${WM_PROJECT_VERSION:-unknown}
templateDir="appTemplates"
#------------------------------------------------------------------------------
usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
Usage: ${0##*/} [OPTION]
options:
-app <name> specify the application to use
-case <dir> specify alternative case directory, default is the cwd
-list list the applications available
-version <ver> specify an alternative version (default: '$WM_PROJECT_VERSION')
clone initial application settings to the specified case from
$userDir/$templateDir/{$version,}/<APP>
$siteDir/$templateDir/{$version,}/<APP>
USAGE
exit 1
}
#------------------------------------------------------------------------------
unset appName caseName listOpt
# parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help)
usage
;;
-app)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
appName="$2"
shift 2
;;
-case)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
caseName="$2"
shift 2
;;
-l | -list)
listOpt=true
shift
;;
-v | -ver | -version)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
version="$2"
shift 2
;;
*)
usage "unknown option/argument: '$*'"
;;
esac
done
#------------------------------------------------------------------------------
[ -n "$version" ] || {
echo "Error: no -version specified and \$WM_PROJECT_VERSION is not set"
exit 1
}
#
# find apps in current directory
# considered an app if it has constant/ and system/ directories
#
findApps()
{
for app in $(/bin/ls -d * 2>/dev/null)
do
[ -d "$app/constant" -a -d "$app/system" ] && echo $app
done
}
appList=$(
for dir in $userDir/$templateDir $siteDir/$templateDir
do
if cd $dir 2>/dev/null
then
findApps ## generic
cd $version 2>/dev/null && findApps ## version-specific
fi
done | sort | uniq
)
listApps()
{
echo
echo "applications available:"
for i in $appList
do
echo " $i"
done
echo
}
if [ "$listOpt" = true ]
then
listApps
exit 0
elif [ "$(echo $appList | wc -w)" -eq 0 ]
then
echo "Error: no applications available"
exit 1
elif [ -z "$appName" ]
then
echo "Error: no -app specified"
listApps
exit 1
fi
# get the corresponding srcDir name
srcDir=$(
for dir in $userDir/$templateDir $siteDir/$templateDir
do
if [ -d $dir ]
then
for appDir in $dir/$version/$appName $dir/$appName
do
if [ -d $appDir -a -d $appDir/constant -a -d $appDir/system ]
then
echo "$appDir"
break 2
fi
done
fi
done
)
[ -d "$srcDir" ] || {
echo "Error: could not find template for $appName"
listApps
exit 1
}
# adjust for caseName as required
if [ -n "$caseName" ]
then
[ -d "$caseName" ] || mkdir -p "$caseName"
cd "$caseName" 2>/dev/null || usage "directory does not exist: '$caseName'"
fi
newDir=$PWD
[ -d "$newDir" -a -w "$newDir" ] || {
echo "Error: target directory does not exist or is unwritable"
echo " $newDir"
exit 1
}
# add some useful subdirs:
mkdir -p $newDir/postPro
echo " application $appName"
echo " source $srcDir"
echo " target $newDir"
echo " syncing ..."
# sync updated files only, itemize changes so we know what is going on
rsync -aui $srcDir/ $newDir
#
# reuse or create new FOAM_SETTINGS (useful for queuing systems)
#
if [ -e "$newDir/FOAM_SETTINGS" ]
then
echo " retaining FOAM_SETTINGS"
else
echo " creating FOAM_SETTINGS"
cat << SETTINGS > "$newDir/FOAM_SETTINGS"
APPLICATION=$appName
FOAM_VERSION=OpenFOAM-$version
SETTINGS
fi
echo Done
#------------------------------------------------------------------------------

View File

@ -1 +1 @@
templates/source/foamNewSource ../etc/codeTemplates/source/foamNewSource

View File

@ -1 +1 @@
templates/sourceTemplate/foamNewTemplate ../etc/codeTemplates/template/foamNewTemplate

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License

View File

@ -2,7 +2,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -29,13 +29,14 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
#cleanTimeDirectories () #cleanTimeDirectories()
#{ #{
# echo "Cleaning $case case of $application application" # echo "Cleaning $case case of $application application"
# TIME_DIRS=`foamInfoExec . $1 -times | sed '1,/constant/d'` # TIME_DIRS=`foamInfoExec . $1 -times | sed '1,/constant/d'`
# for T in $TIME_DIRS # for T in $TIME_DIRS
# do # do
# if [ $T != "0" ] ; then # if [ $T != "0" ]
# then
# echo "Deleting directory $T" # echo "Deleting directory $T"
# rm -rf ${T} > /dev/null 2>&1 # rm -rf ${T} > /dev/null 2>&1
# fi # fi
@ -43,12 +44,13 @@
# rm -rf {log,log.*,log-*,logSummary.*,.fxLock,*.xml,ParaView*,paraFoam*,*.OpenFOAM} > /dev/null 2>&1 # rm -rf {log,log.*,log-*,logSummary.*,.fxLock,*.xml,ParaView*,paraFoam*,*.OpenFOAM} > /dev/null 2>&1
#} #}
cleanTimeDirectories () cleanTimeDirectories()
{ {
echo "Cleaning $PWD case" echo "Cleaning $PWD case"
nZeros=0 nZeros=0
zeros="" zeros=""
while [ $nZeros -lt 8 ] ; do while [ $nZeros -lt 8 ]
do
timeDir="0.${zeros}[1-9]*" timeDir="0.${zeros}[1-9]*"
rm -rf ${timeDir} > /dev/null 2>&1 rm -rf ${timeDir} > /dev/null 2>&1
rm -rf ./-${timeDir} > /dev/null 2>&1 rm -rf ./-${timeDir} > /dev/null 2>&1
@ -58,7 +60,7 @@ cleanTimeDirectories ()
rm -rf ./{[1-9]*,-[1-9]*,log,log.*,log-*,logSummary.*,.fxLock,*.xml,ParaView*,paraFoam*,*.OpenFOAM} > /dev/null 2>&1 rm -rf ./{[1-9]*,-[1-9]*,log,log.*,log-*,logSummary.*,.fxLock,*.xml,ParaView*,paraFoam*,*.OpenFOAM} > /dev/null 2>&1
} }
cleanCase () cleanCase()
{ {
cleanTimeDirectories cleanTimeDirectories
rm -rf processor* > /dev/null 2>&1 rm -rf processor* > /dev/null 2>&1
@ -82,23 +84,23 @@ cleanCase ()
done done
} }
removeCase () removeCase()
{ {
echo "Removing $case case" echo "Removing $case case"
rm -rf $1 rm -rf $1
} }
cleanSamples () cleanSamples()
{ {
rm -rf {sets,samples,sampleSurfaces} > /dev/null 2>&1 rm -rf {sets,samples,sampleSurfaces} > /dev/null 2>&1
} }
cleanUcomponents () cleanUcomponents()
{ {
rm -rf 0/{Ux,Uy,Uz} > /dev/null 2>&1 rm -rf 0/{Ux,Uy,Uz} > /dev/null 2>&1
} }
cleanApplication () cleanApplication()
{ {
echo "Cleaning $PWD application" echo "Cleaning $PWD application"
wclean wclean

View File

@ -2,7 +2,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -29,17 +29,19 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
getApplication () getApplication()
{ {
grep application system/controlDict | sed "s/application *\([a-zA-Z]*\);/\1/" grep application system/controlDict | sed "s/application *\([a-zA-Z]*\);/\1/"
} }
runApplication () runApplication()
{ {
APP_RUN=$1; shift APP_RUN=$1
shift
APP_NAME=${APP_RUN##*/} APP_NAME=${APP_RUN##*/}
if [ -f log.$APP_NAME ] ; then if [ -f log.$APP_NAME ]
then
echo "$APP_NAME already run on $PWD: remove log file to run" echo "$APP_NAME already run on $PWD: remove log file to run"
else else
echo "Running $APP_RUN on $PWD" echo "Running $APP_RUN on $PWD"
@ -47,11 +49,13 @@ runApplication ()
fi fi
} }
runParallel () runParallel()
{ {
APP_RUN=$1; shift APP_RUN=$1
shift
if [ -f $log.$APP_RUN ] ; then if [ -f $log.$APP_RUN ]
then
echo "$APP_RUN already run on $PWD: remove log file to run" echo "$APP_RUN already run on $PWD: remove log file to run"
else else
echo "Running $APP_RUN in parallel on $PWD using $1 processes" echo "Running $APP_RUN in parallel on $PWD using $1 processes"
@ -59,15 +63,16 @@ runParallel ()
fi fi
} }
compileApplication () compileApplication()
{ {
echo "Compiling $1 application" echo "Compiling $1 application"
wmake $1 wmake $1
} }
cloneCase () cloneCase()
{ {
if [ -d $2 ] ; then if [ -d $2 ]
then
echo "Case already cloned: remove case directory $2 to clone" echo "Case already cloned: remove case directory $2 to clone"
else else
echo "Cloning $2 case from $1" echo "Cloning $2 case from $1"

View File

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

Some files were not shown because too many files have changed in this diff Show More