mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -146,5 +146,3 @@
|
||||
(
|
||||
additionalControlsDict.lookup("solvePrimaryRegion")
|
||||
);
|
||||
|
||||
IObasicSourceList sources(mesh);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -36,7 +36,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::cellSplitter, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(cellSplitter, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -466,8 +466,8 @@ int main(int argc, char *argv[])
|
||||
labelListList pointPoints;
|
||||
autoPtr<mapDistribute> meshDistributor = buildMap(mesh, pointPoints);
|
||||
|
||||
triadField alignments = buildAlignmentField(mesh);
|
||||
pointField points = buildPointField(mesh);
|
||||
triadField alignments(buildAlignmentField(mesh));
|
||||
pointField points(buildPointField(mesh));
|
||||
|
||||
mesh.printInfo(Info);
|
||||
|
||||
|
||||
@ -168,7 +168,8 @@ public:
|
||||
);
|
||||
|
||||
//- Inserts points into the triangulation if the point is within
|
||||
// the circumsphere of another cell
|
||||
// the circumsphere of another cell. Returns HashSet of failed
|
||||
// point insertions
|
||||
template<class PointIterator>
|
||||
labelPairHashSet rangeInsertReferredWithInfo
|
||||
(
|
||||
|
||||
@ -24,7 +24,7 @@ EXE_INC = \
|
||||
-IPrintTable \
|
||||
-I../vectorTools
|
||||
|
||||
EXE_LIBS = \
|
||||
LIB_LIBS = \
|
||||
-lmeshTools \
|
||||
-ledgeMesh \
|
||||
-lfileFormats \
|
||||
|
||||
@ -585,7 +585,7 @@ Foam::label Foam::cellShapeControl::refineMesh
|
||||
const autoPtr<backgroundMeshDecomposition>& decomposition
|
||||
)
|
||||
{
|
||||
const pointField cellCentres = shapeControlMesh_.cellCentres();
|
||||
const pointField cellCentres(shapeControlMesh_.cellCentres());
|
||||
|
||||
Info<< " Created cell centres" << endl;
|
||||
|
||||
@ -682,7 +682,7 @@ Foam::label Foam::cellShapeControl::refineMesh
|
||||
)
|
||||
);
|
||||
verts.last().targetCellSize() = lastCellSize;
|
||||
verts.last().alignment() = tensor::I;
|
||||
verts.last().alignment() = triad::unset;
|
||||
}
|
||||
}
|
||||
|
||||
@ -704,8 +704,8 @@ void Foam::cellShapeControl::smoothMesh()
|
||||
pointPoints
|
||||
);
|
||||
|
||||
triadField alignments = buildAlignmentField(shapeControlMesh_);
|
||||
pointField points = buildPointField(shapeControlMesh_);
|
||||
triadField alignments(buildAlignmentField(shapeControlMesh_));
|
||||
pointField points(buildPointField(shapeControlMesh_));
|
||||
// Setup the sizes and alignments on each point
|
||||
triadField fixedAlignments(shapeControlMesh_.vertexCount(), triad::unset);
|
||||
|
||||
@ -721,12 +721,7 @@ void Foam::cellShapeControl::smoothMesh()
|
||||
{
|
||||
const tensor& alignment = vit->alignment();
|
||||
|
||||
fixedAlignments[vit->index()] = triad
|
||||
(
|
||||
alignment.x(),
|
||||
alignment.y(),
|
||||
alignment.z()
|
||||
);
|
||||
fixedAlignments[vit->index()] = alignment;
|
||||
}
|
||||
}
|
||||
|
||||
@ -881,12 +876,7 @@ void Foam::cellShapeControl::smoothMesh()
|
||||
{
|
||||
if (vit->real())
|
||||
{
|
||||
vit->alignment() = tensor
|
||||
(
|
||||
alignments[vit->index()].x(),
|
||||
alignments[vit->index()].y(),
|
||||
alignments[vit->index()].z()
|
||||
);
|
||||
vit->alignment() = alignments[vit->index()];
|
||||
}
|
||||
}
|
||||
|
||||
@ -911,9 +901,7 @@ void Foam::cellShapeControl::smoothMesh()
|
||||
{
|
||||
if (vit->referred())
|
||||
{
|
||||
const triad& t = alignments[referredPoints[referredI++]];
|
||||
|
||||
vit->alignment() = tensor(t.x(), t.y(), t.z());
|
||||
vit->alignment() = alignments[referredPoints[referredI++]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -684,7 +684,7 @@ void Foam::cellShapeControlMesh::insertBoundingPoints(const boundBox& bb)
|
||||
boundBox bbInflate = bb;
|
||||
bbInflate.inflate(10);
|
||||
|
||||
pointField pts = bbInflate.points();
|
||||
pointField pts(bbInflate.points());
|
||||
|
||||
forAll(pts, pI)
|
||||
{
|
||||
|
||||
@ -263,8 +263,6 @@ Foam::triSurfaceScalarField Foam::automatic::load()
|
||||
|
||||
surfaceCellSize.write();
|
||||
|
||||
debug = 1;
|
||||
|
||||
if (debug)
|
||||
{
|
||||
faceList faces(surface_.size());
|
||||
|
||||
@ -30,6 +30,7 @@ License
|
||||
#include "indexedCellChecks.H"
|
||||
|
||||
#include "CGAL/Exact_predicates_exact_constructions_kernel.h"
|
||||
#include "CGAL/Gmpq.h"
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
@ -211,9 +212,8 @@ void Foam::conformalVoronoiMesh::checkDuals()
|
||||
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel EK2;
|
||||
typedef CGAL::Regular_triangulation_euclidean_traits_3<EK2> EK;
|
||||
typedef CGAL::Cartesian_converter<typename baseK::Kernel, EK2> To_exact;
|
||||
typedef CGAL::Cartesian_converter<EK2, typename baseK::Kernel>
|
||||
Back_from_exact;
|
||||
typedef CGAL::Cartesian_converter<baseK::Kernel, EK2> To_exact;
|
||||
typedef CGAL::Cartesian_converter<EK2, baseK::Kernel> Back_from_exact;
|
||||
|
||||
// PackedBoolList bPoints(number_of_finite_cells());
|
||||
|
||||
@ -391,13 +391,13 @@ void Foam::conformalVoronoiMesh::checkDuals()
|
||||
CGAL::Gmpq z(CGAL::to_double(masterPoint.z()));
|
||||
|
||||
std::cout<< "master = " << x << " " << y << " " << z
|
||||
<< endl;
|
||||
<< std::endl;
|
||||
|
||||
CGAL::Gmpq xs(CGAL::to_double(closestPoint.x()));
|
||||
CGAL::Gmpq ys(CGAL::to_double(closestPoint.y()));
|
||||
CGAL::Gmpq zs(CGAL::to_double(closestPoint.z()));
|
||||
std::cout<< "slave = " << xs << " " << ys << " " << zs
|
||||
<< endl;
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -142,7 +142,7 @@ inline int CGAL::indexedVertex<Gt, Vb>::index() const
|
||||
|
||||
|
||||
template<class Gt, class Vb>
|
||||
inline typename CGAL::indexedVertex<Gt, Vb>::vertexType&
|
||||
inline Foam::indexedVertexEnum::vertexType&
|
||||
CGAL::indexedVertex<Gt, Vb>::type()
|
||||
{
|
||||
return type_;
|
||||
@ -150,7 +150,7 @@ CGAL::indexedVertex<Gt, Vb>::type()
|
||||
|
||||
|
||||
template<class Gt, class Vb>
|
||||
inline typename CGAL::indexedVertex<Gt, Vb>::vertexType
|
||||
inline Foam::indexedVertexEnum::vertexType
|
||||
CGAL::indexedVertex<Gt, Vb>::type() const
|
||||
{
|
||||
return type_;
|
||||
|
||||
@ -64,14 +64,22 @@ int main(int argc, char *argv[])
|
||||
)
|
||||
);
|
||||
|
||||
conformalVoronoiMesh::debug = true;
|
||||
|
||||
conformalVoronoiMesh mesh(runTime, cvMeshDict);
|
||||
|
||||
|
||||
if (checkGeometry)
|
||||
{
|
||||
const searchableSurfaces& allGeometry = mesh.allGeometry();
|
||||
const searchableSurfaces allGeometry
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"cvSearchableSurfaces",
|
||||
runTime.constant(),
|
||||
"triSurface",
|
||||
runTime,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
cvMeshDict.subDict("geometry")
|
||||
);
|
||||
|
||||
// Write some stats
|
||||
allGeometry.writeStats(List<wordList>(0), Info);
|
||||
@ -91,6 +99,11 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
conformalVoronoiMesh::debug = true;
|
||||
|
||||
conformalVoronoiMesh mesh(runTime, cvMeshDict);
|
||||
|
||||
|
||||
while (runTime.loop())
|
||||
{
|
||||
Info<< nl << "Time = " << runTime.timeName() << endl;
|
||||
|
||||
@ -803,7 +803,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
|
||||
if (allGeometry)
|
||||
{
|
||||
cellSet cells(mesh, "underdeterminedCells", mesh.nCells()/100);
|
||||
if (mesh.checkCellDeterminant(true, &cells, mesh.geometricD()))
|
||||
if (mesh.checkCellDeterminant(true, &cells))
|
||||
{
|
||||
noFailedChecks++;
|
||||
|
||||
|
||||
@ -33,7 +33,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::mergePolyMesh, 1);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(mergePolyMesh, 1);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -34,7 +34,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::meshDualiser, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(meshDualiser, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -14,7 +14,7 @@ if [ -f /usr/include/readline/readline.h -a "${1%NO_READLINE}" = "$1" ]
|
||||
then
|
||||
echo "Found <readline/readline.h> -- enabling readline support."
|
||||
export COMP_FLAGS="-DHAS_READLINE"
|
||||
export LINK_FLAGS="-lreadline -lncurses"
|
||||
export LINK_FLAGS="-lreadline"
|
||||
fi
|
||||
|
||||
wmake
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
cellSelection/cellSelection.C
|
||||
cellSelection/badQualityCellSelection.C
|
||||
cellSelection/outsideCellSelection.C
|
||||
subsetMesh.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/subsetMesh
|
||||
|
||||
@ -1,417 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "outsideCellSelection.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "faceSet.H"
|
||||
#include "polyMesh.H"
|
||||
#include "motionSmoother.H"
|
||||
#include "regionSplit.H"
|
||||
#include "syncTools.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace cellSelections
|
||||
{
|
||||
defineTypeNameAndDebug(outsideCellSelection, 0);
|
||||
addToRunTimeSelectionTable(cellSelection, outsideCellSelection, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::cellSelections::outsideCellSelection::generateField
|
||||
(
|
||||
const word& name,
|
||||
const boolList& lst
|
||||
) const
|
||||
{
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(mesh_);
|
||||
|
||||
tmp<volScalarField> tfld
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
name,
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar(name, dimless, 0),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
)
|
||||
);
|
||||
scalarField& fld = tfld().internalField();
|
||||
|
||||
forAll(fld, celli)
|
||||
{
|
||||
fld[celli] = 1.0*lst[celli];
|
||||
}
|
||||
tfld().correctBoundaryConditions();
|
||||
|
||||
return tfld;
|
||||
}
|
||||
|
||||
|
||||
void Foam::cellSelections::outsideCellSelection::markRegionFaces
|
||||
(
|
||||
const boolList& selectedCell,
|
||||
boolList& regionFace
|
||||
) const
|
||||
{
|
||||
// Internal faces
|
||||
const labelList& faceOwner = mesh_.faceOwner();
|
||||
const labelList& faceNeighbour = mesh_.faceNeighbour();
|
||||
forAll(faceNeighbour, faceI)
|
||||
{
|
||||
if
|
||||
(
|
||||
selectedCell[faceOwner[faceI]]
|
||||
!= selectedCell[faceNeighbour[faceI]]
|
||||
)
|
||||
{
|
||||
regionFace[faceI] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Swap neighbour selectedCell state
|
||||
boolList nbrSelected;
|
||||
syncTools::swapBoundaryCellList(mesh_, selectedCell, nbrSelected);
|
||||
|
||||
// Boundary faces
|
||||
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
|
||||
forAll(pbm, patchI)
|
||||
{
|
||||
const polyPatch& pp = pbm[patchI];
|
||||
const labelUList& faceCells = pp.faceCells();
|
||||
forAll(faceCells, i)
|
||||
{
|
||||
label faceI = pp.start()+i;
|
||||
label bFaceI = faceI-mesh_.nInternalFaces();
|
||||
if
|
||||
(
|
||||
selectedCell[faceCells[i]]
|
||||
!= selectedCell[nbrSelected[bFaceI]]
|
||||
)
|
||||
{
|
||||
regionFace[faceI] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::boolList Foam::cellSelections::outsideCellSelection::findRegions
|
||||
(
|
||||
const bool verbose,
|
||||
const regionSplit& cellRegion
|
||||
) const
|
||||
{
|
||||
boolList keepRegion(cellRegion.nRegions(), false);
|
||||
|
||||
forAll(locationsInMesh_, i)
|
||||
{
|
||||
// Find the region containing the insidePoint
|
||||
|
||||
label cellI = mesh_.findCell(locationsInMesh_[i]);
|
||||
|
||||
label keepRegionI = -1;
|
||||
label keepProcI = -1;
|
||||
if (cellI != -1)
|
||||
{
|
||||
keepRegionI = cellRegion[cellI];
|
||||
keepProcI = Pstream::myProcNo();
|
||||
}
|
||||
reduce(keepRegionI, maxOp<label>());
|
||||
keepRegion[keepRegionI] = true;
|
||||
|
||||
reduce(keepProcI, maxOp<label>());
|
||||
|
||||
if (keepProcI == -1)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"outsideCellSelection::findRegions"
|
||||
"(const bool, const regionSplit&)"
|
||||
) << "Did not find " << locationsInMesh_[i]
|
||||
<< " in mesh." << " Mesh bounds are " << mesh_.bounds()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
Info<< "Found location " << locationsInMesh_[i]
|
||||
<< " in cell " << cellI << " on processor " << keepProcI
|
||||
<< " in global region " << keepRegionI
|
||||
<< " out of " << cellRegion.nRegions() << " regions." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
return keepRegion;
|
||||
}
|
||||
|
||||
|
||||
void Foam::cellSelections::outsideCellSelection::unselectOutsideRegions
|
||||
(
|
||||
boolList& selectedCell
|
||||
) const
|
||||
{
|
||||
// Determine faces on the edge of selectedCell
|
||||
boolList blockedFace(mesh_.nFaces(), false);
|
||||
markRegionFaces(selectedCell, blockedFace);
|
||||
|
||||
// Determine regions
|
||||
regionSplit cellRegion(mesh_, blockedFace);
|
||||
|
||||
// Determine regions containing locationsInMesh_
|
||||
boolList keepRegion(findRegions(true, cellRegion));
|
||||
|
||||
// Go back to bool per cell
|
||||
forAll(cellRegion, cellI)
|
||||
{
|
||||
if (!keepRegion[cellRegion[cellI]])
|
||||
{
|
||||
selectedCell[cellI] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::cellSelections::outsideCellSelection::shrinkRegions
|
||||
(
|
||||
boolList& selectedCell
|
||||
) const
|
||||
{
|
||||
// Select points on unselected cells and boundary
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
boolList boundaryPoint(mesh_.nPoints(), false);
|
||||
|
||||
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
|
||||
|
||||
forAll(pbm, patchI)
|
||||
{
|
||||
const polyPatch& pp = pbm[patchI];
|
||||
|
||||
if (!pp.coupled() && !isA<emptyPolyPatch>(pp))
|
||||
{
|
||||
forAll(pp, i)
|
||||
{
|
||||
const face& f = pp[i];
|
||||
forAll(f, fp)
|
||||
{
|
||||
boundaryPoint[f[fp]] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
forAll(selectedCell, cellI)
|
||||
{
|
||||
if (!selectedCell[cellI])
|
||||
{
|
||||
const labelList& cPoints = mesh_.cellPoints(cellI);
|
||||
forAll(cPoints, i)
|
||||
{
|
||||
boundaryPoint[cPoints[i]] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
syncTools::syncPointList(mesh_, boundaryPoint, orEqOp<bool>(), false);
|
||||
|
||||
|
||||
// Select all cells using these points
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
label nChanged = 0;
|
||||
forAll(boundaryPoint, pointI)
|
||||
{
|
||||
if (boundaryPoint[pointI])
|
||||
{
|
||||
const labelList& pCells = mesh_.pointCells(pointI);
|
||||
forAll(pCells, i)
|
||||
{
|
||||
label cellI = pCells[i];
|
||||
if (selectedCell[cellI])
|
||||
{
|
||||
selectedCell[cellI] = false;
|
||||
nChanged++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::cellSelections::outsideCellSelection::erode
|
||||
(
|
||||
boolList& selectedCell
|
||||
) const
|
||||
{
|
||||
//Info<< "Entering shrinkRegions:" << count(selectedCell) << endl;
|
||||
//generateField("selectedCell_before", selectedCell)().write();
|
||||
|
||||
// Now erode and see which regions get disconnected
|
||||
boolList shrunkSelectedCell(selectedCell);
|
||||
|
||||
for (label iter = 0; iter < nErode_; iter++)
|
||||
{
|
||||
shrinkRegions(shrunkSelectedCell);
|
||||
}
|
||||
|
||||
//Info<< "After shrinking:" << count(shrunkSelectedCell) << endl;
|
||||
//generateField("shrunkSelectedCell", shrunkSelectedCell)().write();
|
||||
|
||||
|
||||
|
||||
// Determine faces on the edge of shrunkSelectedCell
|
||||
boolList blockedFace(mesh_.nFaces(), false);
|
||||
markRegionFaces(shrunkSelectedCell, blockedFace);
|
||||
|
||||
// Find disconnected regions
|
||||
regionSplit cellRegion(mesh_, blockedFace);
|
||||
|
||||
// Determine regions containing insidePoints
|
||||
boolList keepRegion(findRegions(true, cellRegion));
|
||||
|
||||
|
||||
// Extract cells in regions that are not to be kept.
|
||||
boolList removeCell(mesh_.nCells(), false);
|
||||
forAll(cellRegion, cellI)
|
||||
{
|
||||
if (shrunkSelectedCell[cellI] && !keepRegion[cellRegion[cellI]])
|
||||
{
|
||||
removeCell[cellI] = true;
|
||||
}
|
||||
}
|
||||
|
||||
//Info<< "removeCell before:" << count(removeCell) << endl;
|
||||
//generateField("removeCell_before", removeCell)().write();
|
||||
|
||||
|
||||
|
||||
// Grow removeCell
|
||||
for (label iter = 0; iter < nErode_; iter++)
|
||||
{
|
||||
// Grow selected cell in regions that are not for keeping
|
||||
boolList boundaryPoint(mesh_.nPoints(), false);
|
||||
forAll(removeCell, cellI)
|
||||
{
|
||||
if (removeCell[cellI])
|
||||
{
|
||||
const labelList& cPoints = mesh_.cellPoints(cellI);
|
||||
forAll(cPoints, i)
|
||||
{
|
||||
boundaryPoint[cPoints[i]] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
syncTools::syncPointList(mesh_, boundaryPoint, orEqOp<bool>(), false);
|
||||
|
||||
// Select all cells using these points
|
||||
|
||||
label nChanged = 0;
|
||||
forAll(boundaryPoint, pointI)
|
||||
{
|
||||
if (boundaryPoint[pointI])
|
||||
{
|
||||
const labelList& pCells = mesh_.pointCells(pointI);
|
||||
forAll(pCells, i)
|
||||
{
|
||||
label cellI = pCells[i];
|
||||
if (!removeCell[cellI])
|
||||
{
|
||||
removeCell[cellI] = true;
|
||||
nChanged++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Info<< "removeCell after:" << count(removeCell) << endl;
|
||||
//generateField("removeCell_after", removeCell)().write();
|
||||
|
||||
|
||||
// Unmark removeCell
|
||||
forAll(removeCell, cellI)
|
||||
{
|
||||
if (removeCell[cellI])
|
||||
{
|
||||
selectedCell[cellI] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cellSelections::outsideCellSelection::outsideCellSelection
|
||||
(
|
||||
const word& name,
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
cellSelection(name, mesh, dict),
|
||||
locationsInMesh_(dict.lookup("locationsInMesh")),
|
||||
nErode_(readLabel(dict.lookup("nErodeLayers")))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cellSelections::outsideCellSelection::~outsideCellSelection()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::cellSelections::outsideCellSelection::select
|
||||
(
|
||||
boolList& selectedCell
|
||||
) const
|
||||
{
|
||||
// Unselect all disconnected regions
|
||||
unselectOutsideRegions(selectedCell);
|
||||
|
||||
if (nErode_ > 0)
|
||||
{
|
||||
erode(selectedCell);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,145 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::cellSelections::outsideCellSelection
|
||||
|
||||
Description
|
||||
Deselect cells not reachable from 'inside' points
|
||||
|
||||
SourceFiles
|
||||
outsideCellSelection.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef outsideCellSelection_H
|
||||
#define outsideCellSelection_H
|
||||
|
||||
#include "cellSelection.H"
|
||||
#include "pointField.H"
|
||||
#include "boolList.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class regionSplit;
|
||||
|
||||
namespace cellSelections
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class outsideCellSelection Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class outsideCellSelection
|
||||
:
|
||||
public cellSelection
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Locations to keep
|
||||
const pointField locationsInMesh_;
|
||||
|
||||
//- Number of layers to erode
|
||||
const label nErode_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- For debugging: generate volScalarField with 1.0 for all true
|
||||
tmp<volScalarField> generateField
|
||||
(
|
||||
const word& name,
|
||||
const boolList& lst
|
||||
) const;
|
||||
|
||||
//- Mark faces inbetween selected and unselected elements
|
||||
void markRegionFaces
|
||||
(
|
||||
const boolList& selectedCell,
|
||||
boolList& regionFace
|
||||
) const;
|
||||
|
||||
//- Determine for every disconnected region in the mesh whether
|
||||
// it contains a locationInMesh
|
||||
boolList findRegions(const bool verbose, const regionSplit&) const;
|
||||
|
||||
//- Unselect regions not containing a locationInMesh
|
||||
void unselectOutsideRegions(boolList& selectedCell) const;
|
||||
|
||||
//- Unselect one layer of cells from selectedCell
|
||||
void shrinkRegions(boolList& selectedCell) const;
|
||||
|
||||
//- Erode a given number of layers from selectedCell. Remove any
|
||||
// region that gets disconnected that way.
|
||||
void erode(boolList& selectedCell) const;
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("outside");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
outsideCellSelection
|
||||
(
|
||||
const word& name,
|
||||
const polyMesh& mesh,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Clone
|
||||
autoPtr<cellSelection> clone() const
|
||||
{
|
||||
notImplemented("autoPtr<cellSelection> clone() const");
|
||||
return autoPtr<cellSelection>(NULL);
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~outsideCellSelection();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Apply this selector
|
||||
virtual void select(boolList&) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace cellSelections
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -37,12 +37,12 @@ Description
|
||||
#include "cellSet.H"
|
||||
#include "IOobjectList.H"
|
||||
#include "volFields.H"
|
||||
#include "cellSelection.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
template<class Type>
|
||||
void subsetVolFields
|
||||
(
|
||||
@ -152,16 +152,12 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addNote
|
||||
(
|
||||
"select a mesh subset based on a provided cellSet and/or"
|
||||
" selection criteria"
|
||||
);
|
||||
#include "addDictOption.H"
|
||||
argList::addOption
|
||||
(
|
||||
"cellSet",
|
||||
"name",
|
||||
"operates on specified cellSet name"
|
||||
"select a mesh subset based on a cellSet"
|
||||
);
|
||||
|
||||
#include "addOverwriteOption.H"
|
||||
#include "addRegionOption.H"
|
||||
argList::validArgs.append("cellSet");
|
||||
argList::addOption
|
||||
(
|
||||
"patch",
|
||||
@ -169,73 +165,23 @@ int main(int argc, char *argv[])
|
||||
"add exposed internal faces to specified patch instead of to "
|
||||
"'oldInternalFaces'"
|
||||
);
|
||||
|
||||
#include "addOverwriteOption.H"
|
||||
#include "addRegionOption.H"
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
runTime.functionObjects().off();
|
||||
|
||||
word setName;
|
||||
const bool useCellSet = args.optionReadIfPresent("cellSet", setName);
|
||||
const bool useDict = args.optionFound("dict");
|
||||
const bool overwrite = args.optionFound("overwrite");
|
||||
|
||||
if (!useCellSet && !useDict)
|
||||
{
|
||||
FatalErrorIn(args.executable())
|
||||
<< "No cells to operate on selected. Please supply at least one of "
|
||||
<< "'-cellSet', '-dict'"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
Foam::word meshRegionName = polyMesh::defaultRegion;
|
||||
args.optionReadIfPresent("region", meshRegionName);
|
||||
|
||||
#include "createNamedMesh.H"
|
||||
|
||||
|
||||
const word oldInstance = mesh.pointsInstance();
|
||||
|
||||
autoPtr<cellSet> currentSet;
|
||||
if (useCellSet)
|
||||
{
|
||||
// Load the cellSet
|
||||
Info<< "Operating on cell set " << setName << nl << endl;
|
||||
currentSet.reset(new cellSet(mesh, setName));
|
||||
}
|
||||
|
||||
PtrList<cellSelection> selectors;
|
||||
if (useDict)
|
||||
{
|
||||
const word dictName("subsetMeshDict");
|
||||
#include "setSystemMeshDictionaryIO.H"
|
||||
Info<< "Reading selection criteria from " << dictName << nl << endl;
|
||||
IOdictionary dict(dictIO);
|
||||
|
||||
const dictionary& selectionsDict = dict.subDict("selections");
|
||||
|
||||
label n = 0;
|
||||
forAllConstIter(dictionary, selectionsDict, iter)
|
||||
{
|
||||
if (iter().isDict())
|
||||
{
|
||||
n++;
|
||||
}
|
||||
}
|
||||
selectors.setSize(n);
|
||||
n = 0;
|
||||
forAllConstIter(dictionary, selectionsDict, iter)
|
||||
{
|
||||
if (iter().isDict())
|
||||
{
|
||||
selectors.set
|
||||
(
|
||||
n++,
|
||||
cellSelection::New(iter().keyword(), mesh, iter().dict())
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
const word setName = args[1];
|
||||
const bool overwrite = args.optionFound("overwrite");
|
||||
|
||||
|
||||
Info<< "Reading cell set from " << setName << endl << endl;
|
||||
|
||||
// Create mesh subsetting engine
|
||||
fvMeshSubset subsetter(mesh);
|
||||
@ -266,54 +212,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
// Select cells to operate on
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
boolList selectedCell(mesh.nCells(), false);
|
||||
if (currentSet.valid())
|
||||
{
|
||||
const cellSet& set = currentSet();
|
||||
forAllConstIter(cellSet, set, iter)
|
||||
{
|
||||
selectedCell[iter.key()] = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
selectedCell = true;
|
||||
}
|
||||
|
||||
|
||||
// Manipulate selectedCell according to dictionary
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
forAll(selectors, i)
|
||||
{
|
||||
Info<< "Applying cellSelector " << selectors[i].name() << endl;
|
||||
selectors[i].select(selectedCell);
|
||||
|
||||
Info<< "After applying cellSelector " << selectors[i].name()
|
||||
<< " have " << cellSelection::count(selectedCell)
|
||||
<< " cells" << nl << endl;
|
||||
}
|
||||
|
||||
|
||||
// Back from selectedCells to region
|
||||
{
|
||||
Info<< "Final selection : " << cellSelection::count(selectedCell)
|
||||
<< " cells" << nl << endl;
|
||||
|
||||
labelList cellRegion(mesh.nCells(), -1);
|
||||
forAll(selectedCell, cellI)
|
||||
{
|
||||
if (selectedCell[cellI])
|
||||
{
|
||||
cellRegion[cellI] = 0;
|
||||
}
|
||||
}
|
||||
subsetter.setLargeCellSubset(cellRegion, 0, patchI, true);
|
||||
}
|
||||
cellSet currentSet(mesh, setName);
|
||||
|
||||
subsetter.setLargeCellSubset(currentSet, patchI, true);
|
||||
|
||||
IOobjectList objects(mesh, runTime.timeName());
|
||||
|
||||
|
||||
@ -1,50 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object subsetMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Load snappyHexMeshDict settings so we can use some entries below.
|
||||
#include "./snappyHexMeshDict"
|
||||
|
||||
|
||||
selections
|
||||
{
|
||||
badQuality
|
||||
{
|
||||
// Remove any cells using a 'bad quality' face. Uses the mesh checks
|
||||
// used by snappyHexMesh, cvMesh.
|
||||
type badQuality;
|
||||
// Use the quality criteria from the snappyHexMeshDict
|
||||
${:meshQualityControls}
|
||||
}
|
||||
|
||||
outside
|
||||
{
|
||||
// Remove any cells not reachable from provided locations
|
||||
type outside;
|
||||
|
||||
//- Number of cell layers to erode mesh to detect holes in the mesh
|
||||
// Set to 0 if not used.
|
||||
nErodeLayers 3;
|
||||
|
||||
//- Define mesh location for keeping.
|
||||
// In this case use the one from snappyHexMeshDict. This can
|
||||
// optionally be a list of locations.
|
||||
locationsInMesh (${:castellatedMeshControls.locationInMesh});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -167,8 +167,10 @@ FoamFile
|
||||
// source regionToCell;
|
||||
// sourceInfo
|
||||
// {
|
||||
// set c0; // name of cellSet giving mesh subset
|
||||
// insidePoint (1 2 3); // point inside region to select
|
||||
// set c0; // optional name of cellSet giving mesh subset
|
||||
// insidePoints ((1 2 3)); // points inside region to select
|
||||
// nErode 0; // optional number of layers to erode
|
||||
// // selection
|
||||
// }
|
||||
//
|
||||
// // Cells underneath plane such that volume is reached. E.g. for use
|
||||
|
||||
@ -1,16 +1,14 @@
|
||||
/* Note: enable vtkPolyhedron when available */
|
||||
|
||||
PARAVIEW_INC = $(ParaView_DIR)/include/paraview-$(ParaView_MAJOR)
|
||||
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I../../vtkPV3Readers/lnInclude \
|
||||
-I../PV3FoamReader \
|
||||
-I$(PARAVIEW_INC) \
|
||||
-I$(ParaView_INCLUDE_DIR) \
|
||||
$(shell \
|
||||
test -f $(PARAVIEW_INC)/vtkPolyhedron.h && \
|
||||
test -f $(ParaView_INCLUDE_DIR)/vtkPolyhedron.h && \
|
||||
echo "-DHAS_VTK_POLYHEDRON" || echo "-UHAS_VTK_POLYHEDRON" \
|
||||
)
|
||||
|
||||
|
||||
@ -40,7 +40,11 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::vtkPV3Foam, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(vtkPV3Foam, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
PARAVIEW_INC = $(ParaView_DIR)/include/paraview-$(ParaView_MAJOR)
|
||||
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/mesh/blockMesh/lnInclude \
|
||||
-I$(PARAVIEW_INC) \
|
||||
-I$(ParaView_INCLUDE_DIR) \
|
||||
-I../../vtkPV3Readers/lnInclude \
|
||||
-I../PV3blockMeshReader
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -41,7 +41,11 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::vtkPV3blockMesh, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(vtkPV3blockMesh, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
PARAVIEW_INC = $(ParaView_DIR)/include/paraview-$(ParaView_MAJOR)
|
||||
|
||||
EXE_INC = \
|
||||
-I$(PARAVIEW_INC)
|
||||
-I$(ParaView_INCLUDE_DIR)
|
||||
|
||||
LIB_LIBS = \
|
||||
$(GLIBS)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -39,7 +39,11 @@ Description
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::vtkPV3Readers, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(vtkPV3Readers, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -36,55 +36,55 @@ using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Dump collapse region to .obj file
|
||||
static void writeRegionOBJ
|
||||
(
|
||||
const triSurface& surf,
|
||||
const label regionI,
|
||||
const labelList& collapseRegion,
|
||||
const labelList& outsideVerts
|
||||
)
|
||||
{
|
||||
fileName dir("regions");
|
||||
|
||||
mkDir(dir);
|
||||
fileName regionName(dir / "region_" + name(regionI) + ".obj");
|
||||
|
||||
Pout<< "Dumping region " << regionI << " to file " << regionName << endl;
|
||||
|
||||
boolList include(surf.size(), false);
|
||||
|
||||
forAll(collapseRegion, faceI)
|
||||
{
|
||||
if (collapseRegion[faceI] == regionI)
|
||||
{
|
||||
include[faceI] = true;
|
||||
}
|
||||
}
|
||||
|
||||
labelList pointMap, faceMap;
|
||||
|
||||
triSurface regionSurf(surf.subsetMesh(include, pointMap, faceMap));
|
||||
|
||||
Pout<< "Region " << regionI << " surface:" << nl;
|
||||
regionSurf.writeStats(Pout);
|
||||
|
||||
regionSurf.write(regionName);
|
||||
|
||||
|
||||
// Dump corresponding outside vertices.
|
||||
fileName pointsName(dir / "regionPoints_" + name(regionI) + ".obj");
|
||||
|
||||
Pout<< "Dumping region " << regionI << " points to file " << pointsName
|
||||
<< endl;
|
||||
|
||||
OFstream str(pointsName);
|
||||
|
||||
forAll(outsideVerts, i)
|
||||
{
|
||||
meshTools::writeOBJ(str, surf.localPoints()[outsideVerts[i]]);
|
||||
}
|
||||
}
|
||||
//// Dump collapse region to .obj file
|
||||
//static void writeRegionOBJ
|
||||
//(
|
||||
// const triSurface& surf,
|
||||
// const label regionI,
|
||||
// const labelList& collapseRegion,
|
||||
// const labelList& outsideVerts
|
||||
//)
|
||||
//{
|
||||
// fileName dir("regions");
|
||||
//
|
||||
// mkDir(dir);
|
||||
// fileName regionName(dir / "region_" + name(regionI) + ".obj");
|
||||
//
|
||||
// Pout<< "Dumping region " << regionI << " to file " << regionName << endl;
|
||||
//
|
||||
// boolList include(surf.size(), false);
|
||||
//
|
||||
// forAll(collapseRegion, faceI)
|
||||
// {
|
||||
// if (collapseRegion[faceI] == regionI)
|
||||
// {
|
||||
// include[faceI] = true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// labelList pointMap, faceMap;
|
||||
//
|
||||
// triSurface regionSurf(surf.subsetMesh(include, pointMap, faceMap));
|
||||
//
|
||||
// Pout<< "Region " << regionI << " surface:" << nl;
|
||||
// regionSurf.writeStats(Pout);
|
||||
//
|
||||
// regionSurf.write(regionName);
|
||||
//
|
||||
//
|
||||
// // Dump corresponding outside vertices.
|
||||
// fileName pointsName(dir / "regionPoints_" + name(regionI) + ".obj");
|
||||
//
|
||||
// Pout<< "Dumping region " << regionI << " points to file " << pointsName
|
||||
// << endl;
|
||||
//
|
||||
// OFstream str(pointsName);
|
||||
//
|
||||
// forAll(outsideVerts, i)
|
||||
// {
|
||||
// meshTools::writeOBJ(str, surf.localPoints()[outsideVerts[i]]);
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
// Split triangle into multiple triangles because edge e being split
|
||||
|
||||
@ -11,6 +11,11 @@ cyclic
|
||||
type cyclic;
|
||||
}
|
||||
|
||||
cyclicAMI
|
||||
{
|
||||
type cyclicAMI;
|
||||
}
|
||||
|
||||
cyclicSlip
|
||||
{
|
||||
type cyclicSlip;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
# \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
@ -39,7 +39,7 @@
|
||||
#
|
||||
|
||||
set foamFile=`$WM_PROJECT_DIR/bin/foamEtcFile -mode o config/paraview.csh`
|
||||
if ( $status == 0 ) source $foamFile ParaView_VERSION=3.9.0
|
||||
if ( $status == 0 ) source $foamFile ParaView_VERSION=3.12.0
|
||||
|
||||
unset foamFile
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
# \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
@ -39,7 +39,7 @@
|
||||
#
|
||||
|
||||
foamFile=$($WM_PROJECT_DIR/bin/foamEtcFile -mode o config/paraview.sh 2>/dev/null)
|
||||
[ $? -eq 0 ] && . $foamFile ParaView_VERSION=3.9.0
|
||||
[ $? -eq 0 ] && . $foamFile ParaView_VERSION=3.12.0
|
||||
|
||||
unset foamFile
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
# \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
@ -88,6 +88,7 @@ if ( -r $ParaView_DIR || -r $paraviewInstDir ) then
|
||||
setenv PATH ${ParaView_DIR}/bin:${PATH}
|
||||
setenv LD_LIBRARY_PATH "${ParaView_DIR}/lib/paraview-${ParaView_MAJOR}:${LD_LIBRARY_PATH}"
|
||||
setenv PV_PLUGIN_PATH $FOAM_LIBBIN/paraview-${ParaView_MAJOR}
|
||||
setenv ParaView_INCLUDE_DIR $ParaView_DIR/include/paraview-${ParaView_MAJOR}
|
||||
|
||||
# add in python libraries if required
|
||||
set paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
# \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
@ -98,6 +98,8 @@ then
|
||||
export LD_LIBRARY_PATH=$ParaView_DIR/lib/paraview-$ParaView_MAJOR:$LD_LIBRARY_PATH
|
||||
export PV_PLUGIN_PATH=$FOAM_LIBBIN/paraview-$ParaView_MAJOR
|
||||
|
||||
export ParaView_INCLUDE_DIR=$ParaView_DIR/include/paraview-$ParaView_MAJOR
|
||||
|
||||
# add in python libraries if required
|
||||
paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping
|
||||
if [ -r $paraviewPython ]
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
# \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
@ -125,6 +125,7 @@ unsetenv OPAL_PREFIX
|
||||
unsetenv ENSIGHT9_READER
|
||||
unsetenv CMAKE_HOME
|
||||
unsetenv ParaView_DIR
|
||||
unsetenv ParaView_INCLUDE_DIR
|
||||
unsetenv PV_PLUGIN_PATH
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
# \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
@ -112,6 +112,7 @@ unset OPAL_PREFIX
|
||||
unset ENSIGHT9_READER
|
||||
unset CMAKE_HOME
|
||||
unset ParaView_DIR
|
||||
unset ParaView_INCLUDE_DIR
|
||||
unset PV_PLUGIN_PATH
|
||||
|
||||
|
||||
|
||||
@ -994,7 +994,7 @@ DimensionSets
|
||||
acceleration acceleration [ m s^-2 ] 1.0;
|
||||
kinematicPressure kinematicPressure [ Pa density^-1 ] 1.0;
|
||||
|
||||
// Scaled units. Only allowed in dymensionedType (dimensionedScalar,
|
||||
// Scaled units. Only allowed in dimensionedType (dimensionedScalar,
|
||||
// dimensionedVector etc.) and UniformDimensionedField, not
|
||||
// in DimensionedField or GeometricField
|
||||
cm cm [ m ] 1e-2;
|
||||
|
||||
@ -76,6 +76,8 @@ wmake $makeType engine
|
||||
|
||||
wmake $makeType fieldSources
|
||||
|
||||
wmake $makeType regionCoupled
|
||||
|
||||
postProcessing/Allwmake $*
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,10 +28,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::KRR4, 0);
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(KRR4, 0);
|
||||
|
||||
addToRunTimeSelectionTable(ODESolver, KRR4, ODE);
|
||||
|
||||
const scalar
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,9 +27,9 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::ODESolver, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(ODESolver, 0);
|
||||
defineRunTimeSelectionTable(ODESolver, ODE);
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,7 +30,7 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(Foam::RK, 0);
|
||||
defineTypeNameAndDebug(RK, 0);
|
||||
addToRunTimeSelectionTable(ODESolver, RK, ODE);
|
||||
|
||||
const scalar
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,10 +28,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::SIBS, 0);
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(SIBS, 0);
|
||||
|
||||
addToRunTimeSelectionTable(ODESolver, SIBS, ODE);
|
||||
|
||||
const label SIBS::nSeq_[iMaxX_] = {2, 6, 10, 14, 22, 34, 50, 70};
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -67,7 +67,11 @@ Description
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::POSIX, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(POSIX, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -45,13 +45,13 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::fileMonitor, 0);
|
||||
|
||||
const Foam::NamedEnum<Foam::fileMonitor::fileState, 3>
|
||||
Foam::fileMonitor::fileStateNames_;
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(fileMonitor, 0);
|
||||
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -31,11 +31,41 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
// Signal number to catch
|
||||
int Foam::sigStopAtWriteNow::signal_
|
||||
int sigStopAtWriteNow::signal_
|
||||
(
|
||||
debug::optimisationSwitch("stopAtWriteNowSignal", -1)
|
||||
);
|
||||
// Register re-reader
|
||||
class addstopAtWriteNowSignalToOpt
|
||||
:
|
||||
public ::Foam::simpleRegIOobject
|
||||
{
|
||||
public:
|
||||
addstopAtWriteNowSignalToOpt(const char* name)
|
||||
:
|
||||
::Foam::simpleRegIOobject(Foam::debug::addOptimisationObject, name)
|
||||
{}
|
||||
virtual ~addstopAtWriteNowSignalToOpt()
|
||||
{}
|
||||
virtual void readData(Foam::Istream& is)
|
||||
{
|
||||
sigStopAtWriteNow::signal_ = readLabel(is);
|
||||
sigStopAtWriteNow::set(true);
|
||||
}
|
||||
virtual void writeData(Foam::Ostream& os) const
|
||||
{
|
||||
os << sigStopAtWriteNow::signal_;
|
||||
}
|
||||
};
|
||||
addstopAtWriteNowSignalToOpt addstopAtWriteNowSignalToOpt_
|
||||
(
|
||||
"stopAtWriteNowSignal"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
static Foam::Time const* runTimePtr_ = NULL;
|
||||
|
||||
@ -80,6 +110,36 @@ Foam::sigStopAtWriteNow::sigStopAtWriteNow
|
||||
const bool verbose,
|
||||
const Time& runTime
|
||||
)
|
||||
{
|
||||
// Store runTime
|
||||
runTimePtr_ = &runTime;
|
||||
|
||||
set(verbose);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::sigStopAtWriteNow::~sigStopAtWriteNow()
|
||||
{
|
||||
// Reset old handling
|
||||
if (signal_ > 0)
|
||||
{
|
||||
if (sigaction(signal_, &oldAction_, NULL) < 0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::sigStopAtWriteNow::~sigStopAtWriteNow()"
|
||||
) << "Cannot reset " << signal_ << " trapping"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::sigStopAtWriteNow::set(const bool verbose)
|
||||
{
|
||||
if (signal_ > 0)
|
||||
{
|
||||
@ -98,9 +158,6 @@ Foam::sigStopAtWriteNow::sigStopAtWriteNow
|
||||
}
|
||||
|
||||
|
||||
// Store runTime
|
||||
runTimePtr_ = &runTime;
|
||||
|
||||
struct sigaction newAction;
|
||||
newAction.sa_handler = sigHandler;
|
||||
newAction.sa_flags = SA_NODEFER;
|
||||
@ -125,27 +182,6 @@ Foam::sigStopAtWriteNow::sigStopAtWriteNow
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::sigStopAtWriteNow::~sigStopAtWriteNow()
|
||||
{
|
||||
// Reset old handling
|
||||
if (signal_ > 0)
|
||||
{
|
||||
if (sigaction(signal_, &oldAction_, NULL) < 0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::sigStopAtWriteNow::~sigStopAtWriteNow()"
|
||||
) << "Cannot reset " << signal_ << " trapping"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::sigStopAtWriteNow::active() const
|
||||
{
|
||||
return signal_ > 0;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -68,6 +68,9 @@ class sigStopAtWriteNow
|
||||
|
||||
public:
|
||||
|
||||
//- wip. Have setter have access to signal_
|
||||
friend class addstopAtWriteNowSignalToOpt;
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
@ -83,6 +86,9 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
//- (re)set signal catcher
|
||||
static void set(const bool verbose);
|
||||
|
||||
//- Is active?
|
||||
bool active() const;
|
||||
};
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -31,11 +31,39 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
// Signal number to catch
|
||||
int Foam::sigWriteNow::signal_
|
||||
int sigWriteNow::signal_
|
||||
(
|
||||
debug::optimisationSwitch("writeNowSignal", -1)
|
||||
);
|
||||
// Register re-reader
|
||||
class addwriteNowSignalToOpt
|
||||
:
|
||||
public ::Foam::simpleRegIOobject
|
||||
{
|
||||
public:
|
||||
addwriteNowSignalToOpt(const char* name)
|
||||
:
|
||||
::Foam::simpleRegIOobject(Foam::debug::addOptimisationObject, name)
|
||||
{}
|
||||
virtual ~addwriteNowSignalToOpt()
|
||||
{}
|
||||
virtual void readData(Foam::Istream& is)
|
||||
{
|
||||
sigWriteNow::signal_ = readLabel(is);
|
||||
sigWriteNow::set(true);
|
||||
}
|
||||
virtual void writeData(Foam::Ostream& os) const
|
||||
{
|
||||
os << sigWriteNow::signal_;
|
||||
}
|
||||
};
|
||||
addwriteNowSignalToOpt addwriteNowSignalToOpt_("writeNowSignal");
|
||||
|
||||
}
|
||||
|
||||
|
||||
static Foam::Time* runTimePtr_ = NULL;
|
||||
|
||||
@ -64,31 +92,10 @@ Foam::sigWriteNow::sigWriteNow()
|
||||
|
||||
Foam::sigWriteNow::sigWriteNow(const bool verbose, Time& runTime)
|
||||
{
|
||||
if (signal_ >= 0)
|
||||
{
|
||||
// Store runTime
|
||||
runTimePtr_ = &runTime;
|
||||
|
||||
struct sigaction newAction;
|
||||
newAction.sa_handler = sigHandler;
|
||||
newAction.sa_flags = SA_NODEFER;
|
||||
sigemptyset(&newAction.sa_mask);
|
||||
if (sigaction(signal_, &newAction, &oldAction_) < 0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::sigWriteNow::sigWriteNow(const bool, const Time&)"
|
||||
) << "Cannot set " << signal_ << " trapping"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
Info<< "sigWriteNow :"
|
||||
<< " Enabling writing upon signal " << signal_
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
set(verbose);
|
||||
}
|
||||
|
||||
|
||||
@ -113,6 +120,33 @@ Foam::sigWriteNow::~sigWriteNow()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::sigWriteNow::set(const bool verbose)
|
||||
{
|
||||
if (signal_ >= 0)
|
||||
{
|
||||
struct sigaction newAction;
|
||||
newAction.sa_handler = sigHandler;
|
||||
newAction.sa_flags = SA_NODEFER;
|
||||
sigemptyset(&newAction.sa_mask);
|
||||
if (sigaction(signal_, &newAction, &oldAction_) < 0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::sigWriteNow::sigWriteNow(const bool, const Time&)"
|
||||
) << "Cannot set " << signal_ << " trapping"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
Info<< "sigWriteNow :"
|
||||
<< " Enabling writing upon signal " << signal_
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::sigWriteNow::active() const
|
||||
{
|
||||
return signal_ > 0;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -69,6 +69,9 @@ public:
|
||||
|
||||
friend class sigStopAtWriteNow;
|
||||
|
||||
//- wip. Have setter have access to signal_
|
||||
friend class addwriteNowSignalToOpt;
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
@ -84,6 +87,9 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
//- (re)set signal catcher
|
||||
static void set(const bool verbose);
|
||||
|
||||
//- Is active?
|
||||
bool active() const;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,13 +30,17 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::timer, 0);
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(timer, 0);
|
||||
|
||||
jmp_buf Foam::timer::envAlarm;
|
||||
jmp_buf timer::envAlarm;
|
||||
|
||||
struct sigaction Foam::timer::oldAction_;
|
||||
struct sigaction timer::oldAction_;
|
||||
|
||||
unsigned int timer::oldTimeOut_ = 0;
|
||||
}
|
||||
|
||||
unsigned int Foam::timer::oldTimeOut_ = 0;
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -427,6 +427,10 @@ $(polyMesh)/polyMeshInitMesh.C
|
||||
$(polyMesh)/polyMeshClear.C
|
||||
$(polyMesh)/polyMeshUpdate.C
|
||||
|
||||
polyMeshCheck = $(polyMesh)/polyMeshCheck
|
||||
$(polyMeshCheck)/polyMeshCheck.C
|
||||
$(polyMeshCheck)/polyMeshTools.C
|
||||
|
||||
primitiveMesh = meshes/primitiveMesh
|
||||
$(primitiveMesh)/primitiveMesh.C
|
||||
$(primitiveMesh)/primitiveMeshCellCells.C
|
||||
@ -447,9 +451,9 @@ $(primitiveMesh)/primitiveMeshCalcCellShapes.C
|
||||
|
||||
primitiveMeshCheck = $(primitiveMesh)/primitiveMeshCheck
|
||||
$(primitiveMeshCheck)/primitiveMeshCheck.C
|
||||
$(primitiveMeshCheck)/primitiveMeshCheckMotion.C
|
||||
$(primitiveMeshCheck)/primitiveMeshCheckPointNearness.C
|
||||
$(primitiveMeshCheck)/primitiveMeshCheckEdgeLength.C
|
||||
$(primitiveMeshCheck)/primitiveMeshTools.C
|
||||
|
||||
primitivePatch = $(primitiveMesh)/primitivePatch
|
||||
$(primitivePatch)/patchZones.C
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,7 +28,9 @@ License
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
Foam::Dictionary<T>::Dictionary()
|
||||
Foam::Dictionary<T>::Dictionary(const label size)
|
||||
:
|
||||
DictionaryBase<IDLList<T>, T>(size)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -61,8 +61,8 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Null constructor
|
||||
Dictionary();
|
||||
//- Construct given initial table size
|
||||
Dictionary(const label size = 128);
|
||||
|
||||
//- Copy construct
|
||||
Dictionary(const Dictionary&);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -45,7 +45,9 @@ void Foam::DictionaryBase<IDLListType, T>::addEntries()
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class IDLListType, class T>
|
||||
Foam::DictionaryBase<IDLListType, T>::DictionaryBase()
|
||||
Foam::DictionaryBase<IDLListType, T>::DictionaryBase(const label size)
|
||||
:
|
||||
hashedTs_(size)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -90,8 +90,8 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Null constructor
|
||||
DictionaryBase();
|
||||
//- Construct given initial table size
|
||||
DictionaryBase(const label size = 128);
|
||||
|
||||
//- Copy construct
|
||||
DictionaryBase(const DictionaryBase&);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,7 +28,9 @@ License
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
Foam::PtrDictionary<T>::PtrDictionary()
|
||||
Foam::PtrDictionary<T>::PtrDictionary(const label size)
|
||||
:
|
||||
DictionaryBase<DLPtrList<T>, T>(size)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -61,8 +61,8 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Null constructor
|
||||
PtrDictionary();
|
||||
//- Construct given initial table size
|
||||
PtrDictionary(const label size = 128);
|
||||
|
||||
//- Copy construct
|
||||
PtrDictionary(const PtrDictionary&);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,7 +28,9 @@ License
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
Foam::UPtrDictionary<T>::UPtrDictionary()
|
||||
Foam::UPtrDictionary<T>::UPtrDictionary(const label size)
|
||||
:
|
||||
DictionaryBase<DLList<T*>, T>(size)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -61,8 +61,8 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Null constructor
|
||||
UPtrDictionary();
|
||||
//- Construct given initial table size
|
||||
UPtrDictionary(const label size = 128);
|
||||
|
||||
//- Copy construct
|
||||
UPtrDictionary(const UPtrDictionary&);
|
||||
|
||||
@ -240,6 +240,12 @@ bool Foam::UPstream::floatTransfer
|
||||
(
|
||||
debug::optimisationSwitch("floatTransfer", 0)
|
||||
);
|
||||
registerOptSwitchWithName
|
||||
(
|
||||
Foam::UPstream::floatTransfer,
|
||||
floatTransfer,
|
||||
"floatTransfer"
|
||||
);
|
||||
|
||||
// Number of processors at which the reduce algorithm changes from linear to
|
||||
// tree
|
||||
@ -247,18 +253,55 @@ int Foam::UPstream::nProcsSimpleSum
|
||||
(
|
||||
debug::optimisationSwitch("nProcsSimpleSum", 16)
|
||||
);
|
||||
registerOptSwitchWithName
|
||||
(
|
||||
Foam::UPstream::nProcsSimpleSum,
|
||||
nProcsSimpleSum,
|
||||
"nProcsSimpleSum"
|
||||
);
|
||||
|
||||
// Default commsType
|
||||
Foam::UPstream::commsTypes Foam::UPstream::defaultCommsType
|
||||
(
|
||||
commsTypeNames.read(debug::optimisationSwitches().lookup("commsType"))
|
||||
);
|
||||
// Register re-reader
|
||||
class addcommsTypeToOpt
|
||||
:
|
||||
public ::Foam::simpleRegIOobject
|
||||
{
|
||||
public:
|
||||
addcommsTypeToOpt(const char* name)
|
||||
:
|
||||
::Foam::simpleRegIOobject(Foam::debug::addOptimisationObject, name)
|
||||
{}
|
||||
virtual ~addcommsTypeToOpt()
|
||||
{}
|
||||
virtual void readData(Foam::Istream& is)
|
||||
{
|
||||
Foam::UPstream::defaultCommsType = Foam::UPstream::commsTypeNames.read
|
||||
(
|
||||
is
|
||||
);
|
||||
}
|
||||
virtual void writeData(Foam::Ostream& os) const
|
||||
{
|
||||
os << Foam::UPstream::commsTypeNames[Foam::UPstream::defaultCommsType];
|
||||
}
|
||||
};
|
||||
addcommsTypeToOpt addcommsTypeToOpt_("commsType");
|
||||
|
||||
|
||||
// Number of polling cycles in processor updates
|
||||
int Foam::UPstream::nPollProcInterfaces
|
||||
(
|
||||
debug::optimisationSwitch("nPollProcInterfaces", 0)
|
||||
);
|
||||
|
||||
registerOptSwitchWithName
|
||||
(
|
||||
Foam::UPstream::nPollProcInterfaces,
|
||||
nPollProcInterfaces,
|
||||
"nPollProcInterfaces"
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -32,8 +32,9 @@ namespace Foam
|
||||
const char* const token::typeName = "token";
|
||||
token token::undefinedToken;
|
||||
|
||||
defineTypeNameAndDebug(token::compound, 0);
|
||||
defineRunTimeSelectionTable(token::compound, Istream);
|
||||
typedef token::compound tokenCompound;
|
||||
defineTypeNameAndDebug(tokenCompound, 0);
|
||||
defineRunTimeSelectionTable(tokenCompound, Istream);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -26,6 +26,7 @@ License
|
||||
#include "Time.H"
|
||||
#include "Pstream.H"
|
||||
#include "simpleObjectRegistry.H"
|
||||
#include "dimensionedConstants.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
@ -40,52 +41,55 @@ void Foam::Time::readDict()
|
||||
|
||||
|
||||
// Check for local switches and settings
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// Debug switches
|
||||
if (controlDict_.found("DebugSwitches"))
|
||||
{
|
||||
Info<< "Overriding DebugSwitches according to " << controlDict_.name()
|
||||
<< endl;
|
||||
|
||||
simpleObjectRegistry& objects = debug::debugObjects();
|
||||
const dictionary& localSettings = controlDict_.subDict("DebugSwitches");
|
||||
forAllConstIter(dictionary, localSettings, iter)
|
||||
{
|
||||
const word& name = iter().keyword();
|
||||
simpleObjectRegistry::iterator fnd = objects.find(name);
|
||||
if (fnd != objects.end())
|
||||
|
||||
simpleObjectRegistryEntry* objPtr = objects.lookupPtr(name);
|
||||
|
||||
if (objPtr)
|
||||
{
|
||||
Info<< controlDict_.name() << " : overriding debug switch "
|
||||
<< name << endl;
|
||||
Info<< " " << iter() << endl;
|
||||
|
||||
const List<simpleRegIOobject*>& objects = *objPtr;
|
||||
|
||||
if (iter().isDict())
|
||||
{
|
||||
forAll(objects, i)
|
||||
{
|
||||
OStringStream os(IOstream::ASCII);
|
||||
os << iter().dict();
|
||||
IStringStream is(os.str());
|
||||
fnd()->readData(is);
|
||||
objects[i]->readData(is);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fnd()->readData(iter().stream());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (controlDict_.found("DimensionSets"))
|
||||
forAll(objects, i)
|
||||
{
|
||||
dictionary dict(Foam::dimensionSystems());
|
||||
dict.merge(controlDict_.subDict("DimensionSets"));
|
||||
|
||||
simpleObjectRegistry& objects = debug::dimensionSetObjects();
|
||||
simpleObjectRegistry::iterator fnd = objects.find("DimensionSets");
|
||||
if (fnd != objects.end())
|
||||
{
|
||||
Info<< controlDict_.name() << " : overriding DimensionSets" << endl;
|
||||
|
||||
OStringStream os(IOstream::ASCII);
|
||||
os << dict;
|
||||
IStringStream is(os.str());
|
||||
fnd()->readData(is);
|
||||
objects[i]->readData(iter().stream());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Optimisation Switches
|
||||
if (controlDict_.found("OptimisationSwitches"))
|
||||
{
|
||||
Info<< "Overriding OptimisationSwitches according to "
|
||||
<< controlDict_.name() << endl;
|
||||
|
||||
simpleObjectRegistry& objects = debug::optimisationObjects();
|
||||
const dictionary& localSettings = controlDict_.subDict
|
||||
(
|
||||
@ -94,27 +98,208 @@ void Foam::Time::readDict()
|
||||
forAllConstIter(dictionary, localSettings, iter)
|
||||
{
|
||||
const word& name = iter().keyword();
|
||||
simpleObjectRegistry::iterator fnd = objects.find(name);
|
||||
if (fnd != objects.end())
|
||||
|
||||
simpleObjectRegistryEntry* objPtr = objects.lookupPtr(name);
|
||||
|
||||
if (objPtr)
|
||||
{
|
||||
Info<< controlDict_.name()
|
||||
<< " : overriding optimisation switch "
|
||||
<< name << endl;
|
||||
Info<< " " << iter() << endl;
|
||||
|
||||
const List<simpleRegIOobject*>& objects = *objPtr;
|
||||
|
||||
if (iter().isDict())
|
||||
{
|
||||
forAll(objects, i)
|
||||
{
|
||||
OStringStream os(IOstream::ASCII);
|
||||
os << iter().dict();
|
||||
IStringStream is(os.str());
|
||||
fnd()->readData(is);
|
||||
objects[i]->readData(is);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fnd()->readData(iter().stream());
|
||||
forAll(objects, i)
|
||||
{
|
||||
objects[i]->readData(iter().stream());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// DimensionedConstants. Handled as a special case since both e.g.
|
||||
// the 'unitSet' might be changed and the individual values
|
||||
if (controlDict_.found("DimensionedConstants"))
|
||||
{
|
||||
Info<< "Overriding DimensionedConstants according to "
|
||||
<< controlDict_.name() << endl;
|
||||
|
||||
// Change in-memory
|
||||
dimensionedConstants().merge
|
||||
(
|
||||
controlDict_.subDict("DimensionedConstants")
|
||||
);
|
||||
|
||||
|
||||
simpleObjectRegistry& objects = debug::dimensionedConstantObjects();
|
||||
|
||||
IStringStream dummyIs("");
|
||||
|
||||
forAllConstIter(simpleObjectRegistry, objects, iter)
|
||||
{
|
||||
const List<simpleRegIOobject*>& objects = *iter;
|
||||
|
||||
forAll(objects, i)
|
||||
{
|
||||
objects[i]->readData(dummyIs);
|
||||
|
||||
Info<< " ";
|
||||
objects[i]->writeData(Info);
|
||||
Info<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//{
|
||||
// // fundamentalConstants.C
|
||||
// Info<< "constant::universal::hr:"
|
||||
// << Foam::constant::universal::hr
|
||||
// << endl;
|
||||
// Info<< "constant::universal::c:"
|
||||
// << Foam::constant::universal::c
|
||||
// << endl;
|
||||
// Info<< "constant::universal::G:"
|
||||
// << Foam::constant::universal::G
|
||||
// << endl;
|
||||
// Info<< "constant::universal::h:"
|
||||
// << Foam::constant::universal::h
|
||||
// << endl;
|
||||
// Info<< "constant::electromagnetic::e:"
|
||||
// << Foam::constant::electromagnetic::e
|
||||
// << endl;
|
||||
// Info<< "constant::atomic::me:"
|
||||
// << Foam::constant::atomic::me
|
||||
// << endl;
|
||||
// Info<< "constant::atomic::mp:"
|
||||
// << Foam::constant::atomic::mp
|
||||
// << endl;
|
||||
// Info<< "constant::physicoChemical::mu:"
|
||||
// << Foam::constant::physicoChemical::mu
|
||||
// << endl;
|
||||
// Info<< "constant::physicoChemical::NA:"
|
||||
// << Foam::constant::physicoChemical::NA
|
||||
// << endl;
|
||||
// Info<< "constant::physicoChemical::k:"
|
||||
// << Foam::constant::physicoChemical::k
|
||||
// << endl;
|
||||
// Info<< "constant::standard::Pstd:"
|
||||
// << Foam::constant::standard::Pstd
|
||||
// << endl;
|
||||
// Info<< "constant::standard::Tstd:"
|
||||
// << Foam::constant::standard::Tstd
|
||||
// << endl;
|
||||
//
|
||||
// // universalConstants.C
|
||||
// Info<< "constant::universal::hr:"
|
||||
// << Foam::constant::universal::hr
|
||||
// << endl;
|
||||
//
|
||||
// // electromagneticConstants.C
|
||||
// Info<< "constant::electromagnetic::mu0:"
|
||||
// << Foam::constant::electromagnetic::mu0
|
||||
// << endl;
|
||||
// Info<< "constant::electromagnetic::epsilon0:"
|
||||
// << Foam::constant::electromagnetic::epsilon0
|
||||
// << endl;
|
||||
// Info<< "constant::electromagnetic::Z0:"
|
||||
// << Foam::constant::electromagnetic::Z0
|
||||
// << endl;
|
||||
// Info<< "constant::electromagnetic::kappa:"
|
||||
// << Foam::constant::electromagnetic::kappa
|
||||
// << endl;
|
||||
// Info<< "constant::electromagnetic::G0:"
|
||||
// << Foam::constant::electromagnetic::G0
|
||||
// << endl;
|
||||
// Info<< "constant::electromagnetic::KJ:"
|
||||
// << Foam::constant::electromagnetic::KJ
|
||||
// << endl;
|
||||
// Info<< "constant::electromagnetic::RK:"
|
||||
// << Foam::constant::electromagnetic::RK
|
||||
// << endl;
|
||||
//
|
||||
//
|
||||
// // atomicConstants.C
|
||||
// Info<< "constant::atomic::alpha:"
|
||||
// << Foam::constant::atomic::alpha
|
||||
// << endl;
|
||||
// Info<< "constant::atomic::Rinf:"
|
||||
// << Foam::constant::atomic::Rinf
|
||||
// << endl;
|
||||
// Info<< "constant::atomic::a0:"
|
||||
// << Foam::constant::atomic::a0
|
||||
// << endl;
|
||||
// Info<< "constant::physiatomic::re:"
|
||||
// << Foam::constant::atomic::re
|
||||
// << endl;
|
||||
// Info<< "constant::atomic::Eh:"
|
||||
// << Foam::constant::atomic::Eh
|
||||
// << endl;
|
||||
//
|
||||
//
|
||||
// // physicoChemicalConstants.C
|
||||
// Info<< "constant::physicoChemical::R:"
|
||||
// << Foam::constant::physicoChemical::R
|
||||
// << endl;
|
||||
// Info<< "constant::physicoChemical::F:"
|
||||
// << Foam::constant::physicoChemical::F
|
||||
// << endl;
|
||||
// Info<< "constant::physicoChemical::sigma:"
|
||||
// << Foam::constant::physicoChemical::sigma
|
||||
// << endl;
|
||||
// Info<< "constant::physicoChemical::b:"
|
||||
// << Foam::constant::physicoChemical::b
|
||||
// << endl;
|
||||
// Info<< "constant::physicoChemical::c1:"
|
||||
// << Foam::constant::physicoChemical::c1
|
||||
// << endl;
|
||||
// Info<< "constant::physicoChemical::c2:"
|
||||
// << Foam::constant::physicoChemical::c2
|
||||
// << endl;
|
||||
//}
|
||||
|
||||
|
||||
// Dimension sets
|
||||
if (controlDict_.found("DimensionSets"))
|
||||
{
|
||||
Info<< "Overriding DimensionSets according to "
|
||||
<< controlDict_.name() << endl;
|
||||
|
||||
dictionary dict(Foam::dimensionSystems());
|
||||
dict.merge(controlDict_.subDict("DimensionSets"));
|
||||
|
||||
simpleObjectRegistry& objects = debug::dimensionSetObjects();
|
||||
|
||||
simpleObjectRegistryEntry* objPtr = objects.lookupPtr("DimensionSets");
|
||||
|
||||
if (objPtr)
|
||||
{
|
||||
Info<< controlDict_.subDict("DimensionSets") << endl;
|
||||
|
||||
const List<simpleRegIOobject*>& objects = *objPtr;
|
||||
|
||||
forAll(objects, i)
|
||||
{
|
||||
OStringStream os(IOstream::ASCII);
|
||||
os << dict;
|
||||
IStringStream is(os.str());
|
||||
objects[i]->readData(is);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -37,6 +37,13 @@ namespace Foam
|
||||
(
|
||||
debug::optimisationSwitch("fileModificationSkew", 30)
|
||||
);
|
||||
registerOptSwitchWithName
|
||||
(
|
||||
Foam::regIOobject::fileModificationSkew,
|
||||
fileModificationSkew,
|
||||
"fileModificationSkew"
|
||||
);
|
||||
|
||||
|
||||
template<>
|
||||
const char* NamedEnum
|
||||
@ -67,6 +74,35 @@ Foam::regIOobject::fileCheckTypes Foam::regIOobject::fileModificationChecking
|
||||
)
|
||||
)
|
||||
);
|
||||
// Register re-reader
|
||||
class addfileModificationCheckingToOpt
|
||||
:
|
||||
public ::Foam::simpleRegIOobject
|
||||
{
|
||||
public:
|
||||
addfileModificationCheckingToOpt(const char* name)
|
||||
:
|
||||
::Foam::simpleRegIOobject(Foam::debug::addOptimisationObject, name)
|
||||
{}
|
||||
virtual ~addfileModificationCheckingToOpt()
|
||||
{}
|
||||
virtual void readData(Foam::Istream& is)
|
||||
{
|
||||
Foam::regIOobject::fileModificationChecking =
|
||||
Foam::regIOobject::fileCheckTypesNames.read(is);
|
||||
}
|
||||
virtual void writeData(Foam::Ostream& os) const
|
||||
{
|
||||
os << Foam::regIOobject::fileCheckTypesNames
|
||||
[
|
||||
Foam::regIOobject::fileModificationChecking
|
||||
];
|
||||
}
|
||||
};
|
||||
addfileModificationCheckingToOpt addfileModificationCheckingToOpt_
|
||||
(
|
||||
"fileModificationChecking"
|
||||
);
|
||||
|
||||
|
||||
bool Foam::regIOobject::masterOnlyReading = false;
|
||||
|
||||
@ -31,6 +31,7 @@ Description
|
||||
|
||||
#include "word.H"
|
||||
#include "debug.H"
|
||||
#include "debugName.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -133,84 +134,6 @@ public: \
|
||||
|
||||
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// definitions (debug information only)
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
//- Define the debug information, lookup as \a Name
|
||||
#define registerDebugSwitchWithName(Type,Tag,Name)\
|
||||
class add##Tag##ToDebug\
|
||||
:\
|
||||
public ::Foam::simpleRegIOobject\
|
||||
{\
|
||||
public:\
|
||||
add##Tag##ToDebug(const char* name)\
|
||||
:\
|
||||
::Foam::simpleRegIOobject(Foam::debug::addDebugObject, name)\
|
||||
{}\
|
||||
virtual ~add##Tag##ToDebug()\
|
||||
{}\
|
||||
virtual void readData(Foam::Istream& is)\
|
||||
{\
|
||||
Type::debug = readLabel(is);\
|
||||
}\
|
||||
virtual void writeData(Foam::Ostream& os) const\
|
||||
{\
|
||||
os << Type::debug;\
|
||||
}\
|
||||
};\
|
||||
add##Tag##ToDebug add##Tag##ToDebug_(Name)
|
||||
|
||||
|
||||
//- Define the debug information, lookup as \a Name
|
||||
#define defineDebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||
int Type::debug(::Foam::debug::debugSwitch(Name, DebugSwitch))
|
||||
|
||||
//- Define the debug information
|
||||
#define defineDebugSwitch(Type, DebugSwitch) \
|
||||
defineDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch)
|
||||
|
||||
#ifdef __INTEL_COMPILER
|
||||
//- Define the debug information for templates, lookup as \a Name
|
||||
# define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||
defineDebugSwitchWithName(Type, Name, DebugSwitch)
|
||||
//- Define the debug information for templates sub-classes, lookup as \a Name
|
||||
# define defineTemplate2DebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||
defineDebugSwitchWithName(Type, Name, DebugSwitch)
|
||||
#else
|
||||
//- Define the debug information for templates, lookup as \a Name
|
||||
# define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||
template<> \
|
||||
defineDebugSwitchWithName(Type, Name, DebugSwitch)
|
||||
//- Define the debug information for templates sub-classes, lookup as \a Name
|
||||
# define defineTemplate2DebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||
template<> \
|
||||
defineDebugSwitchWithName(Type, Name, DebugSwitch)
|
||||
#endif
|
||||
|
||||
//- Define the debug information for templates
|
||||
// Useful with typedefs
|
||||
#define defineTemplateDebugSwitch(Type, DebugSwitch) \
|
||||
defineTemplateDebugSwitchWithName(Type, #Type, DebugSwitch)
|
||||
|
||||
//- Define the debug information directly for templates
|
||||
#define defineNamedTemplateDebugSwitch(Type, DebugSwitch) \
|
||||
defineTemplateDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch)
|
||||
|
||||
|
||||
// for templated sub-classes
|
||||
|
||||
//- Define the debug information for templates
|
||||
// Useful with typedefs
|
||||
#define defineTemplate2DebugSwitch(Type, DebugSwitch) \
|
||||
defineTemplate2DebugSwitchWithName(Type, #Type, DebugSwitch)
|
||||
|
||||
//- Define the debug information directly for templates
|
||||
#define defineNamedTemplate2DebugSwitch(Type, DebugSwitch) \
|
||||
defineTemplate2DebugSwitchWithName(Type, Type::typeName_(), DebugSwitch)
|
||||
|
||||
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// definitions (with debug information)
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
172
src/OpenFOAM/db/typeInfo/debugName.H
Normal file
172
src/OpenFOAM/db/typeInfo/debugName.H
Normal file
@ -0,0 +1,172 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Macro definitions for debug symbols etc.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef debugName_H
|
||||
#define debugName_H
|
||||
|
||||
#include "simpleRegIOobject.H"
|
||||
#include "word.H"
|
||||
#include "debug.H"
|
||||
#include "label.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// definitions (debug information only)
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
//- Define the debug information, lookup as \a Name
|
||||
#define registerDebugSwitchWithName(Type,Tag,Name) \
|
||||
class add##Tag##ToDebug \
|
||||
: \
|
||||
public ::Foam::simpleRegIOobject \
|
||||
{ \
|
||||
public: \
|
||||
add##Tag##ToDebug(const char* name) \
|
||||
: \
|
||||
::Foam::simpleRegIOobject(Foam::debug::addDebugObject, name) \
|
||||
{} \
|
||||
virtual ~add##Tag##ToDebug() \
|
||||
{} \
|
||||
virtual void readData(Foam::Istream& is) \
|
||||
{ \
|
||||
Type::debug = readLabel(is); \
|
||||
} \
|
||||
virtual void writeData(Foam::Ostream& os) const \
|
||||
{ \
|
||||
os << Type::debug; \
|
||||
} \
|
||||
}; \
|
||||
add##Tag##ToDebug add##Tag##ToDebug_(Name)
|
||||
|
||||
|
||||
//- Register info switch (if int), lookup as \a Name
|
||||
#define registerInfoSwitchWithName(Switch,Tag,Name) \
|
||||
class add##Tag##ToInfo \
|
||||
: \
|
||||
public ::Foam::simpleRegIOobject \
|
||||
{ \
|
||||
public: \
|
||||
add##Tag##ToInfo(const char* name) \
|
||||
: \
|
||||
::Foam::simpleRegIOobject(Foam::debug::addInfoObject, name) \
|
||||
{} \
|
||||
virtual ~add##Tag##ToInfo() \
|
||||
{} \
|
||||
virtual void readData(Foam::Istream& is) \
|
||||
{ \
|
||||
Switch = readLabel(is); \
|
||||
} \
|
||||
virtual void writeData(Foam::Ostream& os) const \
|
||||
{ \
|
||||
os << Switch; \
|
||||
} \
|
||||
}; \
|
||||
add##Tag##ToInfo add##Tag##ToInfo_(Name)
|
||||
|
||||
|
||||
//- Register optimisation switch (if int), lookup as \a Name
|
||||
#define registerOptSwitchWithName(Switch,Tag,Name) \
|
||||
class add##Tag##ToOpt \
|
||||
: \
|
||||
public ::Foam::simpleRegIOobject \
|
||||
{ \
|
||||
public: \
|
||||
add##Tag##ToOpt(const char* name) \
|
||||
: \
|
||||
::Foam::simpleRegIOobject(Foam::debug::addOptimisationObject,name)\
|
||||
{} \
|
||||
virtual ~add##Tag##ToOpt() \
|
||||
{} \
|
||||
virtual void readData(Foam::Istream& is) \
|
||||
{ \
|
||||
Switch = readLabel(is); \
|
||||
} \
|
||||
virtual void writeData(Foam::Ostream& os) const \
|
||||
{ \
|
||||
os << Switch; \
|
||||
} \
|
||||
}; \
|
||||
add##Tag##ToOpt add##Tag##ToOpt_(Name)
|
||||
|
||||
|
||||
//- Define the debug information, lookup as \a Name
|
||||
#define defineDebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||
int Type::debug(::Foam::debug::debugSwitch(Name, DebugSwitch))
|
||||
|
||||
//- Define the debug information
|
||||
#define defineDebugSwitch(Type, DebugSwitch) \
|
||||
defineDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch); \
|
||||
registerDebugSwitchWithName(Type, Type, Type::typeName_())
|
||||
|
||||
#ifdef __INTEL_COMPILER
|
||||
//- Define the debug information for templates, lookup as \a Name
|
||||
# define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||
defineDebugSwitchWithName(Type, Name, DebugSwitch)
|
||||
//- Define the debug information for templates sub-classes, lookup as \a Name
|
||||
# define defineTemplate2DebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||
defineDebugSwitchWithName(Type, Name, DebugSwitch)
|
||||
#else
|
||||
//- Define the debug information for templates, lookup as \a Name
|
||||
# define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||
template<> \
|
||||
defineDebugSwitchWithName(Type, Name, DebugSwitch)
|
||||
//- Define the debug information for templates sub-classes, lookup as \a Name
|
||||
# define defineTemplate2DebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||
template<> \
|
||||
defineDebugSwitchWithName(Type, Name, DebugSwitch)
|
||||
#endif
|
||||
|
||||
//- Define the debug information for templates
|
||||
// Useful with typedefs
|
||||
#define defineTemplateDebugSwitch(Type, DebugSwitch) \
|
||||
defineTemplateDebugSwitchWithName(Type, #Type, DebugSwitch)
|
||||
|
||||
//- Define the debug information directly for templates
|
||||
#define defineNamedTemplateDebugSwitch(Type, DebugSwitch) \
|
||||
defineTemplateDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch)
|
||||
|
||||
|
||||
// for templated sub-classes
|
||||
|
||||
//- Define the debug information for templates
|
||||
// Useful with typedefs
|
||||
#define defineTemplate2DebugSwitch(Type, DebugSwitch) \
|
||||
defineTemplate2DebugSwitchWithName(Type, #Type, DebugSwitch)
|
||||
|
||||
//- Define the debug information directly for templates
|
||||
#define defineNamedTemplate2DebugSwitch(Type, DebugSwitch) \
|
||||
defineTemplate2DebugSwitchWithName(Type, Type::typeName_(), DebugSwitch)
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -194,6 +194,10 @@ private:
|
||||
};
|
||||
|
||||
|
||||
//- Reset exponents to nearest integer if close to it. Used to
|
||||
// handle reading with insufficient precision.
|
||||
void round(const scalar tol);
|
||||
|
||||
dimensionedScalar parse
|
||||
(
|
||||
const label lastPrior,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -26,6 +26,7 @@ License
|
||||
#include "dimensionSet.H"
|
||||
#include "IOstreams.H"
|
||||
#include "dimensionedScalar.H"
|
||||
#include <limits>
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -142,7 +143,7 @@ void Foam::dimensionSet::tokeniser::splitWord(const word& w)
|
||||
word subWord = w(start, i-start);
|
||||
if (isdigit(subWord[0]) || subWord[0] == token::SUBTRACT)
|
||||
{
|
||||
push(token(readLabel(IStringStream(subWord)())));
|
||||
push(token(readScalar(IStringStream(subWord)())));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -153,7 +154,7 @@ void Foam::dimensionSet::tokeniser::splitWord(const word& w)
|
||||
{
|
||||
if (isdigit(w[i]))
|
||||
{
|
||||
push(token(readLabel(IStringStream(w[i])())));
|
||||
push(token(readScalar(IStringStream(w[i])())));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -168,7 +169,7 @@ void Foam::dimensionSet::tokeniser::splitWord(const word& w)
|
||||
word subWord = w(start, w.size()-start);
|
||||
if (isdigit(subWord[0]) || subWord[0] == token::SUBTRACT)
|
||||
{
|
||||
push(token(readLabel(IStringStream(subWord)())));
|
||||
push(token(readScalar(IStringStream(subWord)())));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -213,6 +214,29 @@ void Foam::dimensionSet::tokeniser::putBack(const token& t)
|
||||
}
|
||||
|
||||
|
||||
void Foam::dimensionSet::round(const scalar tol)
|
||||
{
|
||||
for (int i=0; i < dimensionSet::nDimensions; ++i)
|
||||
{
|
||||
scalar integralPart;
|
||||
scalar fractionalPart = std::modf(exponents_[i], &integralPart);
|
||||
|
||||
if (mag(fractionalPart-1.0) <= tol)
|
||||
{
|
||||
exponents_[i] = 1.0+integralPart;
|
||||
}
|
||||
else if (mag(fractionalPart+1.0) <= tol)
|
||||
{
|
||||
exponents_[i] = -1.0+integralPart;
|
||||
}
|
||||
else if (mag(fractionalPart) <= tol)
|
||||
{
|
||||
exponents_[i] = integralPart;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::dimensionedScalar Foam::dimensionSet::parse
|
||||
(
|
||||
const label lastPrior,
|
||||
@ -327,6 +351,8 @@ Foam::dimensionedScalar Foam::dimensionSet::parse
|
||||
dimensionedScalar exp(parse(nextPrior, tis, readSet));
|
||||
|
||||
ds.dimensions().reset(pow(ds.dimensions(), exp.value()));
|
||||
// Round to nearest integer if close to it
|
||||
ds.dimensions().round(10*smallExponent);
|
||||
ds.value() = Foam::pow(ds.value(), exp.value());
|
||||
}
|
||||
else
|
||||
@ -535,6 +561,8 @@ Foam::Istream& Foam::dimensionSet::read
|
||||
s.read(readSet[symbol], readSet);
|
||||
|
||||
symbolSet.reset(pow(s.dimensions(), exponent));
|
||||
// Round to nearest integer if close to it
|
||||
symbolSet.round(10*smallExponent);
|
||||
multiplier *= Foam::pow(s.value(), exponent);
|
||||
}
|
||||
else
|
||||
@ -634,6 +662,13 @@ Foam::Ostream& Foam::dimensionSet::write
|
||||
writeUnits.coefficients(exponents);
|
||||
|
||||
bool hasPrinted = false;
|
||||
|
||||
// Set precision to lots
|
||||
std::streamsize oldPrecision = os.precision
|
||||
(
|
||||
std::numeric_limits<scalar>::digits10
|
||||
);
|
||||
|
||||
forAll(exponents, i)
|
||||
{
|
||||
if (mag(exponents[i]) > smallExponent)
|
||||
@ -658,6 +693,9 @@ Foam::Ostream& Foam::dimensionSet::write
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reset precision
|
||||
os.precision(oldPrecision);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -35,21 +35,16 @@ namespace Foam
|
||||
|
||||
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
|
||||
|
||||
//- Since dimensionSystems() can be reread we actually store a copy of
|
||||
// the controlDict subDict (v.s. a reference to the subDict for e.g.
|
||||
// dimensionedConstants)
|
||||
dictionary* dimensionSystemsPtr_(NULL);
|
||||
HashTable<dimensionedScalar>* unitSetPtr_(NULL);
|
||||
dimensionSets* writeUnitSetPtr_(NULL);
|
||||
|
||||
dictionary& dimensionSystems()
|
||||
{
|
||||
return debug::switchSet
|
||||
(
|
||||
"DimensionSets",
|
||||
dimensionSystemsPtr_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
autoPtr<HashTable<dimensionedScalar> > unitSetPtr_;
|
||||
autoPtr<dimensionSets> writeUnitSetPtr_;
|
||||
|
||||
//- Helper class to
|
||||
// - register re-reader
|
||||
// - deallocate demand-driven data
|
||||
class addDimensionSetsToDebug
|
||||
:
|
||||
public ::Foam::simpleRegIOobject
|
||||
@ -60,12 +55,17 @@ public:
|
||||
::Foam::simpleRegIOobject(Foam::debug::addDimensionSetObject, name)
|
||||
{}
|
||||
virtual ~addDimensionSetsToDebug()
|
||||
{}
|
||||
{
|
||||
deleteDemandDrivenData(dimensionSystemsPtr_);
|
||||
deleteDemandDrivenData(unitSetPtr_);
|
||||
deleteDemandDrivenData(writeUnitSetPtr_);
|
||||
|
||||
}
|
||||
virtual void readData(Foam::Istream& is)
|
||||
{
|
||||
deleteDemandDrivenData(dimensionSystemsPtr_);
|
||||
unitSetPtr_.clear();
|
||||
writeUnitSetPtr_.clear();
|
||||
deleteDemandDrivenData(unitSetPtr_);
|
||||
deleteDemandDrivenData(writeUnitSetPtr_);
|
||||
dimensionSystemsPtr_ = new dictionary(is);
|
||||
}
|
||||
virtual void writeData(Foam::Ostream& os) const
|
||||
@ -76,10 +76,27 @@ public:
|
||||
addDimensionSetsToDebug addDimensionSetsToDebug_("DimensionSets");
|
||||
|
||||
|
||||
dictionary& dimensionSystems()
|
||||
{
|
||||
if (!dimensionSystemsPtr_)
|
||||
{
|
||||
dictionary* cachedPtr = NULL;
|
||||
dimensionSystemsPtr_ = new dictionary
|
||||
(
|
||||
debug::switchSet
|
||||
(
|
||||
"DimensionSets",
|
||||
cachedPtr
|
||||
)
|
||||
);
|
||||
}
|
||||
return *dimensionSystemsPtr_;
|
||||
}
|
||||
|
||||
|
||||
const HashTable<dimensionedScalar>& unitSet()
|
||||
{
|
||||
if (!unitSetPtr_.valid())
|
||||
if (!unitSetPtr_)
|
||||
{
|
||||
const dictionary& dict = dimensionSystems();
|
||||
|
||||
@ -101,10 +118,7 @@ const HashTable<dimensionedScalar>& unitSet()
|
||||
|
||||
const dictionary& unitDict = dict.subDict(unitSetCoeffs);
|
||||
|
||||
unitSetPtr_.reset
|
||||
(
|
||||
new HashTable<dimensionedScalar>(unitDict.size())
|
||||
);
|
||||
unitSetPtr_ = new HashTable<dimensionedScalar>(unitDict.size());
|
||||
|
||||
forAllConstIter(dictionary, unitDict, iter)
|
||||
{
|
||||
@ -132,14 +146,7 @@ const HashTable<dimensionedScalar>& unitSet()
|
||||
)
|
||||
);
|
||||
|
||||
writeUnitSetPtr_.reset
|
||||
(
|
||||
new dimensionSets
|
||||
(
|
||||
unitSetPtr_(),
|
||||
writeUnitNames
|
||||
)
|
||||
);
|
||||
writeUnitSetPtr_ = new dimensionSets(*unitSetPtr_, writeUnitNames);
|
||||
|
||||
if (writeUnitNames.size() != 0 && writeUnitNames.size() != 7)
|
||||
{
|
||||
@ -149,17 +156,17 @@ const HashTable<dimensionedScalar>& unitSet()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
return unitSetPtr_();
|
||||
return *unitSetPtr_;
|
||||
}
|
||||
|
||||
|
||||
const dimensionSets& writeUnitSet()
|
||||
{
|
||||
if (!writeUnitSetPtr_.valid())
|
||||
if (!writeUnitSetPtr_)
|
||||
{
|
||||
(void)unitSet();
|
||||
}
|
||||
return writeUnitSetPtr_();
|
||||
return *writeUnitSetPtr_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -32,100 +32,107 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
const char* const Foam::constant::atomic::group = "atomic";
|
||||
namespace Foam
|
||||
{
|
||||
namespace constant
|
||||
{
|
||||
|
||||
const char* const atomic::group = "atomic";
|
||||
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::atomic::alpha
|
||||
defineDimensionedConstantWithDefault
|
||||
(
|
||||
dimensionedConstant
|
||||
(
|
||||
group,
|
||||
"alpha",
|
||||
atomic::group,
|
||||
atomic::alpha,
|
||||
dimensionedScalar
|
||||
(
|
||||
"alpha",
|
||||
sqr(constant::electromagnetic::e)
|
||||
sqr(electromagnetic::e)
|
||||
/(
|
||||
dimensionedScalar("C", dimless, 2.0)
|
||||
*constant::electromagnetic::epsilon0
|
||||
*constant::universal::h
|
||||
*constant::universal::c
|
||||
)
|
||||
)
|
||||
*electromagnetic::epsilon0
|
||||
*universal::h
|
||||
*universal::c
|
||||
)
|
||||
),
|
||||
constantatomicalpha,
|
||||
"alpha"
|
||||
);
|
||||
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::atomic::Rinf
|
||||
defineDimensionedConstantWithDefault
|
||||
(
|
||||
dimensionedConstant
|
||||
(
|
||||
group,
|
||||
"Rinf",
|
||||
atomic::group,
|
||||
atomic::Rinf,
|
||||
dimensionedScalar
|
||||
(
|
||||
"Rinf",
|
||||
sqr(alpha)*me*constant::universal::c
|
||||
/(dimensionedScalar("C", dimless, 2.0)*constant::universal::h)
|
||||
)
|
||||
)
|
||||
sqr(atomic::alpha)
|
||||
*atomic::me
|
||||
*universal::c
|
||||
/(Foam::dimensionedScalar("C", Foam::dimless, 2.0)*universal::h)
|
||||
),
|
||||
constantatomicRinf,
|
||||
"Rinf"
|
||||
);
|
||||
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::atomic::a0
|
||||
defineDimensionedConstantWithDefault
|
||||
(
|
||||
dimensionedConstant
|
||||
(
|
||||
group,
|
||||
"a0",
|
||||
atomic::group,
|
||||
atomic::a0,
|
||||
dimensionedScalar
|
||||
(
|
||||
"a0",
|
||||
alpha
|
||||
atomic::alpha
|
||||
/(
|
||||
dimensionedScalar("C", dimless, 4.0*constant::mathematical::pi)
|
||||
*Rinf
|
||||
)
|
||||
)
|
||||
Foam::dimensionedScalar("C", Foam::dimless, 4.0*mathematical::pi)
|
||||
*atomic::Rinf
|
||||
)
|
||||
),
|
||||
constantatomica0,
|
||||
"a0"
|
||||
);
|
||||
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::atomic::re
|
||||
defineDimensionedConstantWithDefault
|
||||
(
|
||||
dimensionedConstant
|
||||
(
|
||||
group,
|
||||
"re",
|
||||
atomic::group,
|
||||
atomic::re,
|
||||
dimensionedScalar
|
||||
(
|
||||
"re",
|
||||
sqr(constant::electromagnetic::e)
|
||||
Foam::sqr(electromagnetic::e)
|
||||
/(
|
||||
dimensionedScalar("C", dimless, 4.0*constant::mathematical::pi)
|
||||
*constant::electromagnetic::epsilon0
|
||||
*me
|
||||
*sqr(constant::universal::c)
|
||||
)
|
||||
)
|
||||
Foam::dimensionedScalar("C", Foam::dimless, 4.0*mathematical::pi)
|
||||
*electromagnetic::epsilon0
|
||||
*atomic::me
|
||||
*Foam::sqr(universal::c)
|
||||
)
|
||||
),
|
||||
constantatomicre,
|
||||
"re"
|
||||
);
|
||||
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::atomic::Eh
|
||||
defineDimensionedConstantWithDefault
|
||||
(
|
||||
dimensionedConstant
|
||||
(
|
||||
group,
|
||||
"Eh",
|
||||
atomic::group,
|
||||
atomic::Eh,
|
||||
dimensionedScalar
|
||||
(
|
||||
"Eh",
|
||||
dimensionedScalar("C", dimless, 2.0)
|
||||
*Rinf*constant::universal::h*constant::universal::c
|
||||
)
|
||||
)
|
||||
Foam::dimensionedScalar("C", Foam::dimless, 2.0)
|
||||
*atomic::Rinf*universal::h*universal::c
|
||||
),
|
||||
constantatomicEh,
|
||||
"Eh"
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace constant
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,7 +28,7 @@ License
|
||||
// Constants supplied in the main controlDict
|
||||
#include "fundamentalConstants.C"
|
||||
|
||||
// Derived constants
|
||||
// Derived constants. Note:order is important
|
||||
#include "universalConstants.C"
|
||||
#include "electromagneticConstants.C"
|
||||
#include "atomicConstants.C"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -92,6 +92,104 @@ T dimensionedConstant
|
||||
}
|
||||
|
||||
|
||||
//- Defined dimensioned constant , lookup as \a Name
|
||||
#define defineDimensionedConstant(Group,Switch,Tag,Name) \
|
||||
const Foam::dimensionedScalar Switch; \
|
||||
class add##Tag##ToDimensionedConstant \
|
||||
: \
|
||||
public Foam::simpleRegIOobject \
|
||||
{ \
|
||||
public: \
|
||||
add##Tag##ToDimensionedConstant(const char* name) \
|
||||
: \
|
||||
Foam::simpleRegIOobject \
|
||||
(Foam::debug::addDimensionedConstantObject,name) \
|
||||
{ \
|
||||
Foam::dimensionedScalar ds \
|
||||
( \
|
||||
Foam::dimensionedConstant \
|
||||
( \
|
||||
Group, \
|
||||
Name \
|
||||
) \
|
||||
); \
|
||||
Foam::dimensionedScalar& s = const_cast<Foam::dimensionedScalar&> \
|
||||
( \
|
||||
Switch \
|
||||
); \
|
||||
s.dimensions().reset(ds.dimensions()); \
|
||||
s = ds; \
|
||||
} \
|
||||
virtual ~add##Tag##ToDimensionedConstant() \
|
||||
{} \
|
||||
virtual void readData(Foam::Istream& is) \
|
||||
{ \
|
||||
const_cast<Foam::dimensionedScalar&>(Switch) = \
|
||||
Foam::dimensionedConstant \
|
||||
( \
|
||||
Group, \
|
||||
Name \
|
||||
); \
|
||||
} \
|
||||
virtual void writeData(Foam::Ostream& os) const \
|
||||
{ \
|
||||
os << Switch; \
|
||||
} \
|
||||
}; \
|
||||
add##Tag##ToDimensionedConstant add##Tag##ToDimensionedConstant_(Name)
|
||||
|
||||
|
||||
//- Defined dimensioned constant with default , lookup as \a Name
|
||||
#define defineDimensionedConstantWithDefault\
|
||||
(Group,Switch,DefaultExpr,Tag,Name) \
|
||||
const Foam::dimensionedScalar Switch; \
|
||||
class add##Tag##ToDimensionedConstantWithDefault \
|
||||
: \
|
||||
public Foam::simpleRegIOobject \
|
||||
{ \
|
||||
public: \
|
||||
add##Tag##ToDimensionedConstantWithDefault(const char* name) \
|
||||
: \
|
||||
Foam::simpleRegIOobject \
|
||||
(Foam::debug::addDimensionedConstantObject,name) \
|
||||
{ \
|
||||
Foam::dimensionedScalar ds \
|
||||
( \
|
||||
Foam::dimensionedConstant \
|
||||
( \
|
||||
Group, \
|
||||
Name, \
|
||||
Foam::dimensionedScalar(Name,DefaultExpr) \
|
||||
) \
|
||||
); \
|
||||
Foam::dimensionedScalar& s = const_cast<Foam::dimensionedScalar&> \
|
||||
( \
|
||||
Switch \
|
||||
); \
|
||||
s.dimensions().reset(ds.dimensions()); \
|
||||
s = ds; \
|
||||
} \
|
||||
virtual ~add##Tag##ToDimensionedConstantWithDefault() \
|
||||
{} \
|
||||
virtual void readData(Foam::Istream& is) \
|
||||
{ \
|
||||
const_cast<Foam::dimensionedScalar&>(Switch) = \
|
||||
Foam::dimensionedConstant \
|
||||
( \
|
||||
Group, \
|
||||
Name, \
|
||||
Foam::dimensionedScalar(Name,DefaultExpr) \
|
||||
); \
|
||||
} \
|
||||
virtual void writeData(Foam::Ostream& os) const \
|
||||
{ \
|
||||
os << Switch; \
|
||||
} \
|
||||
}; \
|
||||
add##Tag##ToDimensionedConstantWithDefault \
|
||||
add##Tag##ToDimensionedConstantWithDefault_(Name)
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -32,135 +32,145 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
const char* const Foam::constant::electromagnetic::group = "electromagnetic";
|
||||
namespace Foam
|
||||
{
|
||||
namespace constant
|
||||
{
|
||||
|
||||
const char* const electromagnetic::group = "electromagnetic";
|
||||
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::electromagnetic::mu0
|
||||
defineDimensionedConstantWithDefault
|
||||
(
|
||||
dimensionedConstant
|
||||
(
|
||||
group,
|
||||
"mu0",
|
||||
electromagnetic::group,
|
||||
electromagnetic::mu0,
|
||||
dimensionedScalar
|
||||
(
|
||||
"mu0",
|
||||
dimensionSet(1, 1, -2, 0, 0, -2, 0),
|
||||
4.0*constant::mathematical::pi*1e-07
|
||||
)
|
||||
)
|
||||
4.0*mathematical::pi*1e-07
|
||||
),
|
||||
constantelectromagneticmu0,
|
||||
"mu0"
|
||||
);
|
||||
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::electromagnetic::epsilon0
|
||||
defineDimensionedConstantWithDefault
|
||||
(
|
||||
dimensionedConstant
|
||||
(
|
||||
group,
|
||||
"epsilon0",
|
||||
electromagnetic::group,
|
||||
electromagnetic::epsilon0,
|
||||
|
||||
dimensionedScalar
|
||||
(
|
||||
"epsilon0",
|
||||
dimensionedScalar("C", dimless, 1.0)
|
||||
/(mu0*sqr(constant::universal::c))
|
||||
)
|
||||
)
|
||||
/(electromagnetic::mu0*sqr(universal::c))
|
||||
),
|
||||
constantelectromagneticepsilon0,
|
||||
"epsilon0"
|
||||
);
|
||||
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::electromagnetic::Z0
|
||||
defineDimensionedConstantWithDefault
|
||||
(
|
||||
dimensionedConstant
|
||||
(
|
||||
group,
|
||||
"Z0",
|
||||
electromagnetic::group,
|
||||
electromagnetic::Z0,
|
||||
dimensionedScalar
|
||||
(
|
||||
"Z0",
|
||||
mu0*constant::universal::c
|
||||
)
|
||||
)
|
||||
electromagnetic::mu0*universal::c
|
||||
),
|
||||
constantelectromagneticZ0,
|
||||
"Z0"
|
||||
);
|
||||
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::electromagnetic::kappa
|
||||
defineDimensionedConstantWithDefault
|
||||
(
|
||||
dimensionedConstant
|
||||
(
|
||||
group,
|
||||
"kappa",
|
||||
electromagnetic::group,
|
||||
electromagnetic::kappa,
|
||||
|
||||
dimensionedScalar
|
||||
(
|
||||
"kappa",
|
||||
dimensionedScalar
|
||||
(
|
||||
"C",
|
||||
dimless,
|
||||
1.0/(4.0*constant::mathematical::pi)
|
||||
)
|
||||
/epsilon0
|
||||
)
|
||||
Foam::dimless,
|
||||
1.0/(4.0*mathematical::pi)
|
||||
)
|
||||
/electromagnetic::epsilon0
|
||||
),
|
||||
|
||||
constantelectromagnetickappa,
|
||||
"kappa"
|
||||
);
|
||||
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::electromagnetic::G0
|
||||
defineDimensionedConstantWithDefault
|
||||
(
|
||||
dimensionedConstant
|
||||
(
|
||||
group,
|
||||
"G0",
|
||||
electromagnetic::group,
|
||||
electromagnetic::G0,
|
||||
dimensionedScalar
|
||||
(
|
||||
"G0",
|
||||
dimensionedScalar("C", dimless, 2)*sqr(e)/constant::universal::h
|
||||
)
|
||||
)
|
||||
dimensionedScalar("C", dimless, 2)
|
||||
*sqr(electromagnetic::e)
|
||||
/universal::h
|
||||
),
|
||||
constantelectromagneticG0,
|
||||
"G0"
|
||||
);
|
||||
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::electromagnetic::KJ
|
||||
defineDimensionedConstantWithDefault
|
||||
(
|
||||
dimensionedConstant
|
||||
(
|
||||
group,
|
||||
"KJ",
|
||||
electromagnetic::group,
|
||||
electromagnetic::KJ,
|
||||
dimensionedScalar
|
||||
(
|
||||
"KJ",
|
||||
dimensionedScalar("C", dimless, 2)*e/constant::universal::h
|
||||
)
|
||||
)
|
||||
dimensionedScalar("C", dimless, 2)
|
||||
*electromagnetic::e
|
||||
/universal::h
|
||||
),
|
||||
constantelectromagneticKJ,
|
||||
"KJ"
|
||||
);
|
||||
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::electromagnetic::phi0
|
||||
defineDimensionedConstantWithDefault
|
||||
(
|
||||
dimensionedConstant
|
||||
(
|
||||
group,
|
||||
"phi0",
|
||||
electromagnetic::group,
|
||||
electromagnetic::phi0,
|
||||
dimensionedScalar
|
||||
(
|
||||
"phi0",
|
||||
constant::universal::h/(dimensionedScalar("C", dimless, 2)*e)
|
||||
)
|
||||
)
|
||||
universal::h
|
||||
/(dimensionedScalar("C", dimless, 2)*electromagnetic::e)
|
||||
),
|
||||
constantelectromagneticphi0,
|
||||
"phi0"
|
||||
);
|
||||
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::electromagnetic::RK
|
||||
defineDimensionedConstantWithDefault
|
||||
(
|
||||
dimensionedConstant
|
||||
(
|
||||
group,
|
||||
"RK",
|
||||
electromagnetic::group,
|
||||
electromagnetic::RK,
|
||||
dimensionedScalar
|
||||
(
|
||||
"RK",
|
||||
constant::universal::h/sqr(e)
|
||||
)
|
||||
)
|
||||
universal::h/Foam::sqr(electromagnetic::e)
|
||||
),
|
||||
constantelectromagneticRK,
|
||||
"RK"
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace constant
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -39,89 +39,127 @@ Description
|
||||
|
||||
// Universal constants
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::universal::c
|
||||
namespace Foam
|
||||
{
|
||||
namespace constant
|
||||
{
|
||||
|
||||
defineDimensionedConstant
|
||||
(
|
||||
dimensionedConstant(universal::group, "c")
|
||||
universal::group,
|
||||
universal::c,
|
||||
constantuniversalc,
|
||||
"c"
|
||||
);
|
||||
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::universal::G
|
||||
defineDimensionedConstant
|
||||
(
|
||||
dimensionedConstant(universal::group, "G")
|
||||
universal::group,
|
||||
universal::G,
|
||||
constantuniversalG,
|
||||
"G"
|
||||
);
|
||||
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::universal::h
|
||||
defineDimensionedConstant
|
||||
(
|
||||
dimensionedConstant(universal::group, "h")
|
||||
universal::group,
|
||||
universal::h,
|
||||
constantuniversalh,
|
||||
"h"
|
||||
);
|
||||
|
||||
|
||||
// Electromagnetic
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::electromagnetic::e
|
||||
defineDimensionedConstant
|
||||
(
|
||||
dimensionedConstant(electromagnetic::group, "e")
|
||||
electromagnetic::group,
|
||||
electromagnetic::e,
|
||||
constantelectromagnetice,
|
||||
"e"
|
||||
);
|
||||
|
||||
|
||||
// Atomic
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::atomic::me
|
||||
defineDimensionedConstant
|
||||
(
|
||||
dimensionedConstant(atomic::group, "me")
|
||||
atomic::group,
|
||||
atomic::me,
|
||||
constantatomicme,
|
||||
"me"
|
||||
);
|
||||
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::atomic::mp
|
||||
defineDimensionedConstant
|
||||
(
|
||||
dimensionedConstant(atomic::group, "mp")
|
||||
atomic::group,
|
||||
atomic::mp,
|
||||
constantatomicmp,
|
||||
"mp"
|
||||
);
|
||||
|
||||
|
||||
// Physico-chemical
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::physicoChemical::mu
|
||||
defineDimensionedConstant
|
||||
(
|
||||
dimensionedConstant(physicoChemical::group, "mu")
|
||||
);
|
||||
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::physicoChemical::NA
|
||||
(
|
||||
// dimensionedConstant(physicoChemical::group, "NA")
|
||||
dimensionedConstant
|
||||
(
|
||||
physicoChemical::group,
|
||||
"NA",
|
||||
dimensionedScalar
|
||||
(
|
||||
"NA",
|
||||
dimless/dimMoles,
|
||||
6.0221417930e+23
|
||||
)
|
||||
)
|
||||
physicoChemical::mu,
|
||||
constantphysicoChemicalmu,
|
||||
"mu"
|
||||
);
|
||||
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::physicoChemical::k
|
||||
defineDimensionedConstantWithDefault
|
||||
(
|
||||
dimensionedConstant(physicoChemical::group, "k")
|
||||
physicoChemical::group,
|
||||
physicoChemical::NA,
|
||||
Foam::dimensionedScalar
|
||||
(
|
||||
"NA",
|
||||
Foam::dimless/Foam::dimMoles,
|
||||
6.0221417930e+23
|
||||
),
|
||||
constantphysicoChemicalNA,
|
||||
"NA"
|
||||
);
|
||||
|
||||
|
||||
defineDimensionedConstant
|
||||
(
|
||||
physicoChemical::group,
|
||||
physicoChemical::k,
|
||||
constantphysicoChemicalk,
|
||||
"k"
|
||||
);
|
||||
|
||||
|
||||
// Standard
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::standard::Pstd
|
||||
defineDimensionedConstant
|
||||
(
|
||||
dimensionedConstant("standard", "Pstd")
|
||||
"standard",
|
||||
standard::Pstd,
|
||||
constantstandardPstd,
|
||||
"Pstd"
|
||||
);
|
||||
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::standard::Tstd
|
||||
defineDimensionedConstant
|
||||
(
|
||||
dimensionedConstant("standard", "Tstd")
|
||||
"standard",
|
||||
standard::Tstd,
|
||||
constantstandardTstd,
|
||||
"Tstd"
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace constant
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -32,105 +32,109 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
const char* const Foam::constant::physicoChemical::group = "physicoChemical";
|
||||
namespace Foam
|
||||
{
|
||||
namespace constant
|
||||
{
|
||||
|
||||
const char* const physicoChemical::group = "physicoChemical";
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::physicoChemical::R
|
||||
defineDimensionedConstantWithDefault
|
||||
(
|
||||
dimensionedConstant
|
||||
(
|
||||
group,
|
||||
"R",
|
||||
physicoChemical::group,
|
||||
physicoChemical::R,
|
||||
dimensionedScalar
|
||||
(
|
||||
"R",
|
||||
NA*k
|
||||
)
|
||||
)
|
||||
physicoChemical::NA*physicoChemical::k
|
||||
),
|
||||
constantphysicoChemicalR,
|
||||
"R"
|
||||
);
|
||||
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::physicoChemical::F
|
||||
defineDimensionedConstantWithDefault
|
||||
(
|
||||
dimensionedConstant
|
||||
(
|
||||
group,
|
||||
"F",
|
||||
physicoChemical::group,
|
||||
physicoChemical::F,
|
||||
dimensionedScalar
|
||||
(
|
||||
"F",
|
||||
NA*constant::electromagnetic::e
|
||||
)
|
||||
)
|
||||
physicoChemical::NA*electromagnetic::e
|
||||
),
|
||||
constantphysicoChemicalF,
|
||||
"F"
|
||||
);
|
||||
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::physicoChemical::sigma
|
||||
defineDimensionedConstantWithDefault
|
||||
(
|
||||
dimensionedConstant
|
||||
(
|
||||
group,
|
||||
"sigma",
|
||||
physicoChemical::group,
|
||||
physicoChemical::sigma,
|
||||
dimensionedScalar
|
||||
(
|
||||
"sigma",
|
||||
dimensionedScalar
|
||||
Foam::dimensionedScalar
|
||||
(
|
||||
"C",
|
||||
dimless,
|
||||
sqr(constant::mathematical::pi)/60.0
|
||||
)
|
||||
*pow4(k)/(pow3(constant::universal::hr)*sqr(constant::universal::c))
|
||||
)
|
||||
Foam::dimless,
|
||||
Foam::sqr(mathematical::pi)/60.0
|
||||
)
|
||||
*Foam::pow4(physicoChemical::k)
|
||||
/(pow3(universal::hr)*sqr(universal::c))
|
||||
),
|
||||
constantphysicoChemicalsigma,
|
||||
"sigma"
|
||||
);
|
||||
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::physicoChemical::b
|
||||
defineDimensionedConstantWithDefault
|
||||
(
|
||||
dimensionedConstant
|
||||
(
|
||||
group,
|
||||
"b",
|
||||
physicoChemical::group,
|
||||
physicoChemical::b,
|
||||
dimensionedScalar
|
||||
(
|
||||
"b",
|
||||
(constant::universal::h*constant::universal::c/k)
|
||||
/dimensionedScalar("C", dimless, 4.965114231)
|
||||
)
|
||||
)
|
||||
(universal::h*universal::c/physicoChemical::k)
|
||||
/Foam::dimensionedScalar("C", Foam::dimless, 4.965114231)
|
||||
),
|
||||
constantphysicoChemicalb,
|
||||
"b"
|
||||
);
|
||||
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::physicoChemical::c1
|
||||
defineDimensionedConstantWithDefault
|
||||
(
|
||||
dimensionedConstant
|
||||
(
|
||||
group,
|
||||
"c1",
|
||||
physicoChemical::group,
|
||||
physicoChemical::c1,
|
||||
dimensionedScalar
|
||||
(
|
||||
"c1",
|
||||
dimensionedScalar("C", dimless, constant::mathematical::twoPi)
|
||||
*constant::universal::h*sqr(constant::universal::c)
|
||||
)
|
||||
)
|
||||
Foam::dimensionedScalar("C", Foam::dimless, mathematical::twoPi)
|
||||
*universal::h*Foam::sqr(universal::c)
|
||||
),
|
||||
constantphysicoChemicalc1,
|
||||
"c1"
|
||||
);
|
||||
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::physicoChemical::c2
|
||||
defineDimensionedConstantWithDefault
|
||||
(
|
||||
dimensionedConstant
|
||||
(
|
||||
group,
|
||||
"c2",
|
||||
physicoChemical::group,
|
||||
physicoChemical::c2,
|
||||
dimensionedScalar
|
||||
(
|
||||
"c2",
|
||||
constant::universal::h*constant::universal::c/k
|
||||
)
|
||||
)
|
||||
universal::h*universal::c/physicoChemical::k
|
||||
),
|
||||
constantphysicoChemicalc2,
|
||||
"c2"
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace constant
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,22 +30,32 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
const char* const Foam::constant::universal::group = "universal";
|
||||
namespace Foam
|
||||
{
|
||||
namespace constant
|
||||
{
|
||||
|
||||
const char* const universal::group = "universal";
|
||||
|
||||
|
||||
const Foam::dimensionedScalar Foam::constant::universal::hr
|
||||
defineDimensionedConstantWithDefault
|
||||
(
|
||||
dimensionedConstant
|
||||
(
|
||||
group,
|
||||
"hr",
|
||||
"universal",
|
||||
universal::hr,
|
||||
dimensionedScalar
|
||||
(
|
||||
"hr",
|
||||
h/(dimensionedScalar("C", dimless, constant::mathematical::twoPi))
|
||||
)
|
||||
)
|
||||
universal::h
|
||||
/(dimensionedScalar("C", dimless, mathematical::twoPi))
|
||||
),
|
||||
constantuniversalhr,
|
||||
"hr"
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace constant
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -47,6 +47,14 @@ dictionary* debugSwitchesPtr_(NULL);
|
||||
dictionary* infoSwitchesPtr_(NULL);
|
||||
dictionary* optimisationSwitchesPtr_(NULL);
|
||||
|
||||
// Debug switch read and write callback tables.
|
||||
simpleObjectRegistry* debugObjectsPtr_(NULL);
|
||||
simpleObjectRegistry* infoObjectsPtr_(NULL);
|
||||
simpleObjectRegistry* optimisationObjectsPtr_(NULL);
|
||||
simpleObjectRegistry* dimensionSetObjectsPtr_(NULL);
|
||||
simpleObjectRegistry* dimensionedConstantObjectsPtr_(NULL);
|
||||
|
||||
|
||||
// to ensure controlDictPtr_ is deleted at the end of the run
|
||||
class deleteControlDictPtr
|
||||
{
|
||||
@ -57,35 +65,20 @@ public:
|
||||
|
||||
~deleteControlDictPtr()
|
||||
{
|
||||
deleteDemandDrivenData(debugObjectsPtr_);
|
||||
deleteDemandDrivenData(infoObjectsPtr_);
|
||||
deleteDemandDrivenData(optimisationObjectsPtr_);
|
||||
deleteDemandDrivenData(dimensionSetObjectsPtr_);
|
||||
deleteDemandDrivenData(dimensionedConstantObjectsPtr_);
|
||||
|
||||
debugSwitchesPtr_ = NULL;
|
||||
infoSwitchesPtr_ = NULL;
|
||||
optimisationSwitchesPtr_ = NULL;
|
||||
deleteDemandDrivenData(controlDictPtr_);
|
||||
}
|
||||
};
|
||||
|
||||
deleteControlDictPtr deleteControlDictPtr_;
|
||||
|
||||
|
||||
// Debug switch read and write callback tables.
|
||||
simpleObjectRegistry* debugObjectsPtr_(NULL);
|
||||
simpleObjectRegistry* infoObjectsPtr_(NULL);
|
||||
simpleObjectRegistry* optimisationObjectsPtr_(NULL);
|
||||
simpleObjectRegistry* dimensionSetObjectsPtr_(NULL);
|
||||
class deleteDebugSwitchPtr
|
||||
{
|
||||
public:
|
||||
|
||||
deleteDebugSwitchPtr()
|
||||
{}
|
||||
|
||||
~deleteDebugSwitchPtr()
|
||||
{
|
||||
deleteDemandDrivenData(debugObjectsPtr_);
|
||||
deleteDemandDrivenData(infoObjectsPtr_);
|
||||
deleteDemandDrivenData(optimisationObjectsPtr_);
|
||||
deleteDemandDrivenData(dimensionSetObjectsPtr_);
|
||||
}
|
||||
};
|
||||
|
||||
deleteDebugSwitchPtr deleteDebugSwitchPtr_;
|
||||
//! \endcond
|
||||
|
||||
|
||||
@ -190,13 +183,43 @@ int Foam::debug::optimisationSwitch(const char* name, const int defaultValue)
|
||||
|
||||
void Foam::debug::addDebugObject(const char* name, simpleRegIOobject* obj)
|
||||
{
|
||||
debugObjects().insert(name, obj);
|
||||
simpleObjectRegistryEntry* ptr = debugObjects().lookupPtr(name);
|
||||
if (ptr)
|
||||
{
|
||||
ptr->append(obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
debugObjects().append
|
||||
(
|
||||
name,
|
||||
new simpleObjectRegistryEntry
|
||||
(
|
||||
List<simpleRegIOobject*>(1, obj)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::debug::addInfoObject(const char* name, simpleRegIOobject* obj)
|
||||
{
|
||||
infoObjects().insert(name, obj);
|
||||
simpleObjectRegistryEntry* ptr = infoObjects().lookupPtr(name);
|
||||
if (ptr)
|
||||
{
|
||||
ptr->append(obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
infoObjects().append
|
||||
(
|
||||
name,
|
||||
new simpleObjectRegistryEntry
|
||||
(
|
||||
List<simpleRegIOobject*>(1, obj)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -206,7 +229,22 @@ void Foam::debug::addOptimisationObject
|
||||
simpleRegIOobject* obj
|
||||
)
|
||||
{
|
||||
optimisationObjects().insert(name, obj);
|
||||
simpleObjectRegistryEntry* ptr = optimisationObjects().lookupPtr(name);
|
||||
if (ptr)
|
||||
{
|
||||
ptr->append(obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
optimisationObjects().append
|
||||
(
|
||||
name,
|
||||
new simpleObjectRegistryEntry
|
||||
(
|
||||
List<simpleRegIOobject*>(1, obj)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -216,7 +254,50 @@ void Foam::debug::addDimensionSetObject
|
||||
simpleRegIOobject* obj
|
||||
)
|
||||
{
|
||||
dimensionSetObjects().insert(name, obj);
|
||||
simpleObjectRegistryEntry* ptr = dimensionSetObjects().lookupPtr(name);
|
||||
if (ptr)
|
||||
{
|
||||
ptr->append(obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
dimensionSetObjects().append
|
||||
(
|
||||
name,
|
||||
new simpleObjectRegistryEntry
|
||||
(
|
||||
List<simpleRegIOobject*>(1, obj)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::debug::addDimensionedConstantObject
|
||||
(
|
||||
const char* name,
|
||||
simpleRegIOobject* obj
|
||||
)
|
||||
{
|
||||
simpleObjectRegistryEntry* ptr = dimensionedConstantObjects().lookupPtr
|
||||
(
|
||||
name
|
||||
);
|
||||
if (ptr)
|
||||
{
|
||||
ptr->append(obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
dimensionedConstantObjects().append
|
||||
(
|
||||
name,
|
||||
new simpleObjectRegistryEntry
|
||||
(
|
||||
List<simpleRegIOobject*>(1, obj)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -235,7 +316,7 @@ Foam::simpleObjectRegistry& Foam::debug::infoObjects()
|
||||
{
|
||||
if (!infoObjectsPtr_)
|
||||
{
|
||||
infoObjectsPtr_ = new simpleObjectRegistry(1000);
|
||||
infoObjectsPtr_ = new simpleObjectRegistry(100);
|
||||
}
|
||||
|
||||
return *infoObjectsPtr_;
|
||||
@ -246,7 +327,7 @@ Foam::simpleObjectRegistry& Foam::debug::optimisationObjects()
|
||||
{
|
||||
if (!optimisationObjectsPtr_)
|
||||
{
|
||||
optimisationObjectsPtr_ = new simpleObjectRegistry(1000);
|
||||
optimisationObjectsPtr_ = new simpleObjectRegistry(100);
|
||||
}
|
||||
|
||||
return *optimisationObjectsPtr_;
|
||||
@ -257,13 +338,24 @@ Foam::simpleObjectRegistry& Foam::debug::dimensionSetObjects()
|
||||
{
|
||||
if (!dimensionSetObjectsPtr_)
|
||||
{
|
||||
dimensionSetObjectsPtr_ = new simpleObjectRegistry(1000);
|
||||
dimensionSetObjectsPtr_ = new simpleObjectRegistry(100);
|
||||
}
|
||||
|
||||
return *dimensionSetObjectsPtr_;
|
||||
}
|
||||
|
||||
|
||||
Foam::simpleObjectRegistry& Foam::debug::dimensionedConstantObjects()
|
||||
{
|
||||
if (!dimensionedConstantObjectsPtr_)
|
||||
{
|
||||
dimensionedConstantObjectsPtr_ = new simpleObjectRegistry(100);
|
||||
}
|
||||
|
||||
return *dimensionedConstantObjectsPtr_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -93,6 +93,9 @@ namespace debug
|
||||
//- Register DimensionSets read/write object
|
||||
void addDimensionSetObject(const char* name, simpleRegIOobject* obj);
|
||||
|
||||
//- Register DimensionedConstant read/write object
|
||||
void addDimensionedConstantObject(const char* name, simpleRegIOobject*);
|
||||
|
||||
|
||||
//- Get access to registered debug switch objects
|
||||
simpleObjectRegistry& debugObjects();
|
||||
@ -106,6 +109,8 @@ namespace debug
|
||||
//- Get access to registered dimensionSets switch objects
|
||||
simpleObjectRegistry& dimensionSetObjects();
|
||||
|
||||
//- Get access to registered dimensionedConstant switch objects
|
||||
simpleObjectRegistry& dimensionedConstantObjects();
|
||||
|
||||
} // End namespace debug
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,7 +25,7 @@ Class
|
||||
Foam::simpleObjectRegistry
|
||||
|
||||
Description
|
||||
Object registry for simpleRegIOobject
|
||||
Object registry for simpleRegIOobject. Maintains ordering.
|
||||
|
||||
SourceFiles
|
||||
|
||||
@ -34,7 +34,8 @@ SourceFiles
|
||||
#ifndef simpleObjectRegistry_H
|
||||
#define simpleObjectRegistry_H
|
||||
|
||||
#include "HashTable.H"
|
||||
//#include "UPtrDictionary.H"
|
||||
#include "Dictionary.H"
|
||||
#include "simpleRegIOobject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -42,22 +43,40 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class simpleObjectRegistryEntry Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class simpleObjectRegistryEntry
|
||||
:
|
||||
public Dictionary<simpleObjectRegistryEntry>::link,
|
||||
public List<simpleRegIOobject*>
|
||||
{
|
||||
public:
|
||||
|
||||
simpleObjectRegistryEntry(const List<simpleRegIOobject*>& data)
|
||||
:
|
||||
List<simpleRegIOobject*>(data)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class simpleObjectRegistry Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class simpleObjectRegistry
|
||||
:
|
||||
public HashTable<simpleRegIOobject*>
|
||||
public Dictionary<simpleObjectRegistryEntry>
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from initial estimate
|
||||
//- Construct given initial table size
|
||||
simpleObjectRegistry(const label nIoObjects = 128)
|
||||
:
|
||||
HashTable<simpleRegIOobject*>(nIoObjects)
|
||||
Dictionary<simpleObjectRegistryEntry>(nIoObjects)
|
||||
{}
|
||||
|
||||
};
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -33,8 +33,9 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(graph::writer, 0);
|
||||
defineRunTimeSelectionTable(graph::writer, word);
|
||||
typedef graph::writer graphWriter;
|
||||
defineTypeNameAndDebug(graphWriter, 0);
|
||||
defineRunTimeSelectionTable(graphWriter, word);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -27,6 +27,13 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
inline Foam::DiagonalMatrix<Type>::DiagonalMatrix()
|
||||
:
|
||||
List<Type>()
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
template<class Form>
|
||||
Foam::DiagonalMatrix<Type>::DiagonalMatrix(const Matrix<Form, Type>& a)
|
||||
|
||||
@ -60,6 +60,9 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Null constructor.
|
||||
DiagonalMatrix<Type>();
|
||||
|
||||
//- Construct from diagonal component of a Matrix
|
||||
template<class Form>
|
||||
DiagonalMatrix<Type>(const Matrix<Form, Type>&);
|
||||
|
||||
@ -421,6 +421,40 @@ Form Foam::operator*(const scalar s, const Matrix<Form, Type>& a)
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Type>
|
||||
Form Foam::operator*(const Matrix<Form, Type>& a, const Matrix<Form, Type>& b)
|
||||
{
|
||||
if (a.m() != b.n())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Matrix<Form, Type>::operator*"
|
||||
"(const Matrix<Form, Type>&, const Matrix<Form, Type>&)"
|
||||
) << "attempted to multiply incompatible matrices:" << nl
|
||||
<< "Matrix A : " << a.n() << " rows, " << a.m() << " columns" << nl
|
||||
<< "Matrix B : " << b.n() << " rows, " << b.m() << " columns" << nl
|
||||
<< "In order to multiply matrices, columns of A must equal "
|
||||
<< "rows of B"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
Form ab(a.n(), b.m(), scalar(0));
|
||||
|
||||
for (register label i = 0; i < ab.n(); i++)
|
||||
{
|
||||
for (register label j = 0; j < ab.m(); j++)
|
||||
{
|
||||
for (register label l = 0; l < b.n(); l++)
|
||||
{
|
||||
ab[i][j] += a[i][l]*b[l][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ab;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * //
|
||||
|
||||
#include "MatrixIO.C"
|
||||
|
||||
@ -215,6 +215,12 @@ template<class Form, class Type> Form operator*
|
||||
const Matrix<Form, Type>&
|
||||
);
|
||||
|
||||
template<class Form, class Type> Form operator*
|
||||
(
|
||||
const Matrix<Form, Type>&,
|
||||
const Matrix<Form, Type>&
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -258,7 +258,8 @@ void Foam::GAMGAgglomeration::agglomerateLduAddressing
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
restrictMap
|
||||
)
|
||||
),
|
||||
fineLevelIndex
|
||||
).ptr()
|
||||
);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -65,7 +65,11 @@ Foam::GAMGSolver::GAMGSolver
|
||||
// which may be overridden by those in controlDict
|
||||
cacheAgglomeration_(false),
|
||||
nPreSweeps_(0),
|
||||
preSweepsLevelMultiplier_(1),
|
||||
maxPreSweeps_(4),
|
||||
nPostSweeps_(2),
|
||||
postSweepsLevelMultiplier_(1),
|
||||
maxPostSweeps_(4),
|
||||
nFinestSweeps_(2),
|
||||
scaleCorrection_(matrix.symmetric()),
|
||||
directSolveCoarsest_(false),
|
||||
@ -156,7 +160,19 @@ void Foam::GAMGSolver::readControls()
|
||||
// we could also consider supplying defaults here too
|
||||
controlDict_.readIfPresent("cacheAgglomeration", cacheAgglomeration_);
|
||||
controlDict_.readIfPresent("nPreSweeps", nPreSweeps_);
|
||||
controlDict_.readIfPresent
|
||||
(
|
||||
"preSweepsLevelMultiplier",
|
||||
preSweepsLevelMultiplier_
|
||||
);
|
||||
controlDict_.readIfPresent("maxPreSweeps", maxPreSweeps_);
|
||||
controlDict_.readIfPresent("nPostSweeps", nPostSweeps_);
|
||||
controlDict_.readIfPresent
|
||||
(
|
||||
"postSweepsLevelMultiplier",
|
||||
postSweepsLevelMultiplier_
|
||||
);
|
||||
controlDict_.readIfPresent("maxPostSweeps", maxPostSweeps_);
|
||||
controlDict_.readIfPresent("nFinestSweeps", nFinestSweeps_);
|
||||
controlDict_.readIfPresent("scaleCorrection", scaleCorrection_);
|
||||
controlDict_.readIfPresent("directSolveCoarsest", directSolveCoarsest_);
|
||||
|
||||
@ -79,9 +79,21 @@ class GAMGSolver
|
||||
//- Number of pre-smoothing sweeps
|
||||
label nPreSweeps_;
|
||||
|
||||
//- Lever multiplier for the number of pre-smoothing sweeps
|
||||
label preSweepsLevelMultiplier_;
|
||||
|
||||
//- Maximum number of pre-smoothing sweeps
|
||||
label maxPreSweeps_;
|
||||
|
||||
//- Number of post-smoothing sweeps
|
||||
label nPostSweeps_;
|
||||
|
||||
//- Lever multiplier for the number of post-smoothing sweeps
|
||||
label postSweepsLevelMultiplier_;
|
||||
|
||||
//- Maximum number of post-smoothing sweeps
|
||||
label maxPostSweeps_;
|
||||
|
||||
//- Number of smoothing sweeps on finest mesh
|
||||
label nFinestSweeps_;
|
||||
|
||||
|
||||
@ -156,7 +156,11 @@ void Foam::GAMGSolver::Vcycle
|
||||
coarseCorrFields[leveli],
|
||||
coarseSources[leveli],
|
||||
cmpt,
|
||||
nPreSweeps_ + leveli
|
||||
min
|
||||
(
|
||||
nPreSweeps_ + preSweepsLevelMultiplier_*leveli,
|
||||
maxPreSweeps_
|
||||
)
|
||||
);
|
||||
|
||||
scalarField::subField ACf
|
||||
@ -297,7 +301,11 @@ void Foam::GAMGSolver::Vcycle
|
||||
coarseCorrFields[leveli],
|
||||
coarseSources[leveli],
|
||||
cmpt,
|
||||
nPostSweeps_ + leveli
|
||||
min
|
||||
(
|
||||
nPostSweeps_ + postSweepsLevelMultiplier_*leveli,
|
||||
maxPostSweeps_
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@ SourceFiles
|
||||
|
||||
#include "autoPtr.H"
|
||||
#include "lduInterfacePtrsList.H"
|
||||
#include "GAMGAgglomeration.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -99,14 +100,16 @@ public:
|
||||
const lduInterfacePtrsList& coarseInterfaces,
|
||||
const lduInterface& fineInterface,
|
||||
const labelField& localRestrictAddressing,
|
||||
const labelField& neighbourRestrictAddressing
|
||||
const labelField& neighbourRestrictAddressing,
|
||||
const label fineLevelIndex
|
||||
),
|
||||
(
|
||||
index,
|
||||
coarseInterfaces,
|
||||
fineInterface,
|
||||
localRestrictAddressing,
|
||||
neighbourRestrictAddressing
|
||||
neighbourRestrictAddressing,
|
||||
fineLevelIndex
|
||||
)
|
||||
);
|
||||
|
||||
@ -121,7 +124,8 @@ public:
|
||||
const lduInterfacePtrsList& coarseInterfaces,
|
||||
const lduInterface& fineInterface,
|
||||
const labelField& localRestrictAddressing,
|
||||
const labelField& neighbourRestrictAddressing
|
||||
const labelField& neighbourRestrictAddressing,
|
||||
const label fineLevelIndex
|
||||
);
|
||||
|
||||
|
||||
@ -135,7 +139,8 @@ public:
|
||||
const lduInterfacePtrsList& coarseInterfaces,
|
||||
const lduInterface&,
|
||||
const labelField&,
|
||||
const labelField&
|
||||
const labelField&,
|
||||
const label fineLevelIndex = -1
|
||||
)
|
||||
:
|
||||
index_(index),
|
||||
|
||||
@ -24,6 +24,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "GAMGInterface.H"
|
||||
#include "GAMGAgglomeration.H"
|
||||
#include "lduMatrix.H"
|
||||
|
||||
|
||||
@ -35,7 +36,8 @@ Foam::autoPtr<Foam::GAMGInterface> Foam::GAMGInterface::New
|
||||
const lduInterfacePtrsList& coarseInterfaces,
|
||||
const lduInterface& fineInterface,
|
||||
const labelField& localRestrictAddressing,
|
||||
const labelField& neighbourRestrictAddressing
|
||||
const labelField& neighbourRestrictAddressing,
|
||||
const label fineLevelIndex
|
||||
)
|
||||
{
|
||||
const word coupleType(fineInterface.type());
|
||||
@ -65,7 +67,8 @@ Foam::autoPtr<Foam::GAMGInterface> Foam::GAMGInterface::New
|
||||
coarseInterfaces,
|
||||
fineInterface,
|
||||
localRestrictAddressing,
|
||||
neighbourRestrictAddressing
|
||||
neighbourRestrictAddressing,
|
||||
fineLevelIndex
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -50,7 +50,8 @@ Foam::cyclicGAMGInterface::cyclicGAMGInterface
|
||||
const lduInterfacePtrsList& coarseInterfaces,
|
||||
const lduInterface& fineInterface,
|
||||
const labelField& localRestrictAddressing,
|
||||
const labelField& neighbourRestrictAddressing
|
||||
const labelField& neighbourRestrictAddressing,
|
||||
const label fineLevelIndex
|
||||
)
|
||||
:
|
||||
GAMGInterface
|
||||
|
||||
@ -84,7 +84,8 @@ public:
|
||||
const lduInterfacePtrsList& coarseInterfaces,
|
||||
const lduInterface& fineInterface,
|
||||
const labelField& restrictAddressing,
|
||||
const labelField& neighbourRestrictAddressing
|
||||
const labelField& neighbourRestrictAddressing,
|
||||
const label fineLevelIndex
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -49,7 +49,8 @@ Foam::processorCyclicGAMGInterface::processorCyclicGAMGInterface
|
||||
const lduInterfacePtrsList& coarseInterfaces,
|
||||
const lduInterface& fineInterface,
|
||||
const labelField& localRestrictAddressing,
|
||||
const labelField& neighbourRestrictAddressing
|
||||
const labelField& neighbourRestrictAddressing,
|
||||
const label fineLevelIndex
|
||||
)
|
||||
:
|
||||
processorGAMGInterface
|
||||
@ -58,7 +59,8 @@ Foam::processorCyclicGAMGInterface::processorCyclicGAMGInterface
|
||||
coarseInterfaces,
|
||||
fineInterface,
|
||||
localRestrictAddressing,
|
||||
neighbourRestrictAddressing
|
||||
neighbourRestrictAddressing,
|
||||
fineLevelIndex
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -75,7 +75,8 @@ public:
|
||||
const lduInterfacePtrsList& coarseInterfaces,
|
||||
const lduInterface& fineInterface,
|
||||
const labelField& restrictAddressing,
|
||||
const labelField& neighbourRestrictAddressing
|
||||
const labelField& neighbourRestrictAddressing,
|
||||
const label fineLevelIndex
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -50,7 +50,8 @@ Foam::processorGAMGInterface::processorGAMGInterface
|
||||
const lduInterfacePtrsList& coarseInterfaces,
|
||||
const lduInterface& fineInterface,
|
||||
const labelField& localRestrictAddressing,
|
||||
const labelField& neighbourRestrictAddressing
|
||||
const labelField& neighbourRestrictAddressing,
|
||||
const label fineLevelIndex
|
||||
)
|
||||
:
|
||||
GAMGInterface
|
||||
|
||||
@ -84,7 +84,8 @@ public:
|
||||
const lduInterfacePtrsList& coarseInterfaces,
|
||||
const lduInterface& fineInterface,
|
||||
const labelField& restrictAddressing,
|
||||
const labelField& neighbourRestrictAddressing
|
||||
const labelField& neighbourRestrictAddressing,
|
||||
const label fineLevelIndex
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -255,7 +255,7 @@ Foam::SVD::SVD(const scalarRectangularMatrix& A, const scalar minCondition)
|
||||
{
|
||||
scalar c = 0.0;
|
||||
s = 1.0;
|
||||
for (label i = l-1; i < k+1; i++)
|
||||
for (label i = l; i < k+1; i++)
|
||||
{
|
||||
scalar f = s*rv1[i];
|
||||
rv1[i] = c*rv1[i];
|
||||
|
||||
@ -136,41 +136,6 @@ void Foam::LUDecompose
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::multiply
|
||||
(
|
||||
scalarRectangularMatrix& ans, // value changed in return
|
||||
const scalarRectangularMatrix& A,
|
||||
const scalarRectangularMatrix& B
|
||||
)
|
||||
{
|
||||
if (A.m() != B.n())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"multiply("
|
||||
"scalarRectangularMatrix& answer "
|
||||
"const scalarRectangularMatrix& A, "
|
||||
"const scalarRectangularMatrix& B)"
|
||||
) << "A and B must have identical inner dimensions but A.m = "
|
||||
<< A.m() << " and B.n = " << B.n()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
ans = scalarRectangularMatrix(A.n(), B.m(), scalar(0));
|
||||
|
||||
for (register label i = 0; i < A.n(); i++)
|
||||
{
|
||||
for (register label j = 0; j < B.m(); j++)
|
||||
{
|
||||
for (register label l = 0; l < B.n(); l++)
|
||||
{
|
||||
ans[i][j] += A[i][l]*B[l][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::multiply
|
||||
(
|
||||
scalarRectangularMatrix& ans, // value changed in return
|
||||
|
||||
@ -88,11 +88,12 @@ void LUBacksubstitute
|
||||
template<class Type>
|
||||
void LUsolve(scalarSquareMatrix& matrix, Field<Type>& source);
|
||||
|
||||
template<class Form, class Type>
|
||||
void multiply
|
||||
(
|
||||
scalarRectangularMatrix& answer, // value changed in return
|
||||
const scalarRectangularMatrix& A,
|
||||
const scalarRectangularMatrix& B
|
||||
Matrix<Form, Type>& answer, // value changed in return
|
||||
const Matrix<Form, Type>& A,
|
||||
const Matrix<Form, Type>& B
|
||||
);
|
||||
|
||||
void multiply
|
||||
|
||||
@ -176,4 +176,40 @@ void Foam::LUsolve
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Type>
|
||||
void Foam::multiply
|
||||
(
|
||||
Matrix<Form, Type>& ans, // value changed in return
|
||||
const Matrix<Form, Type>& A,
|
||||
const Matrix<Form, Type>& B
|
||||
)
|
||||
{
|
||||
if (A.m() != B.n())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"multiply("
|
||||
"Matrix<Form, Type>& answer "
|
||||
"const Matrix<Form, Type>& A, "
|
||||
"const Matrix<Form, Type>& B)"
|
||||
) << "A and B must have identical inner dimensions but A.m = "
|
||||
<< A.m() << " and B.n = " << B.n()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
ans = Matrix<Form, Type>(A.n(), B.m(), scalar(0));
|
||||
|
||||
for (register label i = 0; i < A.n(); i++)
|
||||
{
|
||||
for (register label j = 0; j < B.m(); j++)
|
||||
{
|
||||
for (register label l = 0; l < B.n(); l++)
|
||||
{
|
||||
ans[i][j] += A[i][l]*B[l][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -47,12 +47,6 @@ License
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(polyMesh, 0);
|
||||
registerDebugSwitchWithName
|
||||
(
|
||||
polyMesh,
|
||||
polyMesh,
|
||||
polyMesh::typeName_()
|
||||
);
|
||||
|
||||
word polyMesh::defaultRegion = "region0";
|
||||
word polyMesh::meshSubDir = "polyMesh";
|
||||
@ -1129,7 +1123,7 @@ Foam::tmp<Foam::scalarField> Foam::polyMesh::movePoints
|
||||
if (debug)
|
||||
{
|
||||
// Check mesh motion
|
||||
if (primitiveMesh::checkMeshMotion(points_, true))
|
||||
if (checkMeshMotion(points_, true))
|
||||
{
|
||||
Info<< "tmp<scalarField> polyMesh::movePoints"
|
||||
<< "(const pointField&) : "
|
||||
|
||||
@ -34,6 +34,7 @@ SourceFiles
|
||||
polyMeshFromShapeMesh.C
|
||||
polyMeshIO.C
|
||||
polyMeshUpdate.C
|
||||
polyMeshCheck.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -224,7 +225,45 @@ private:
|
||||
cellList& cells
|
||||
);
|
||||
|
||||
// Geometry checks
|
||||
|
||||
//- Check non-orthogonality
|
||||
bool checkFaceOrthogonality
|
||||
(
|
||||
const vectorField& fAreas,
|
||||
const vectorField& cellCtrs,
|
||||
const bool report,
|
||||
const bool detailedReport,
|
||||
labelHashSet* setPtr
|
||||
) const;
|
||||
|
||||
//- Check face skewness
|
||||
bool checkFaceSkewness
|
||||
(
|
||||
const pointField& points,
|
||||
const vectorField& fCtrs,
|
||||
const vectorField& fAreas,
|
||||
const vectorField& cellCtrs,
|
||||
const bool report,
|
||||
const bool detailedReport,
|
||||
labelHashSet* setPtr
|
||||
) const;
|
||||
|
||||
bool checkEdgeAlignment
|
||||
(
|
||||
const pointField& p,
|
||||
const bool report,
|
||||
const Vector<label>& directions,
|
||||
labelHashSet* setPtr
|
||||
) const;
|
||||
|
||||
bool checkCellDeterminant
|
||||
(
|
||||
const vectorField& faceAreas,
|
||||
const bool report,
|
||||
labelHashSet* setPtr,
|
||||
const Vector<label>& meshD
|
||||
) const;
|
||||
|
||||
public:
|
||||
|
||||
@ -535,6 +574,48 @@ public:
|
||||
void removeFiles() const;
|
||||
|
||||
|
||||
// Geometric checks. Selectively override primitiveMesh functionality.
|
||||
|
||||
//- Check boundary for closedness
|
||||
virtual bool checkClosedBoundary(const bool report = false) const;
|
||||
|
||||
//- Check non-orthogonality
|
||||
virtual bool checkFaceOrthogonality
|
||||
(
|
||||
const bool report = false,
|
||||
labelHashSet* setPtr = NULL
|
||||
) const;
|
||||
|
||||
//- Check face skewness
|
||||
virtual bool checkFaceSkewness
|
||||
(
|
||||
const bool report = false,
|
||||
labelHashSet* setPtr = NULL
|
||||
) const;
|
||||
|
||||
//- Check edge alignment for 1D/2D cases
|
||||
virtual bool checkEdgeAlignment
|
||||
(
|
||||
const bool report,
|
||||
const Vector<label>& directions,
|
||||
labelHashSet* setPtr
|
||||
) const;
|
||||
|
||||
virtual bool checkCellDeterminant
|
||||
(
|
||||
const bool report,
|
||||
labelHashSet* setPtr
|
||||
) const;
|
||||
|
||||
//- Check mesh motion for correctness given motion points
|
||||
virtual bool checkMeshMotion
|
||||
(
|
||||
const pointField& newPoints,
|
||||
const bool report = false,
|
||||
const bool detailedReport = false
|
||||
) const;
|
||||
|
||||
|
||||
// Helper functions
|
||||
|
||||
//- Find the cell, tetFaceI and tetPtI for the given position
|
||||
|
||||
679
src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshCheck.C
Normal file
679
src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshCheck.C
Normal file
@ -0,0 +1,679 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "polyMesh.H"
|
||||
#include "polyMeshTools.H"
|
||||
#include "unitConversion.H"
|
||||
#include "syncTools.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::polyMesh::checkFaceOrthogonality
|
||||
(
|
||||
const vectorField& fAreas,
|
||||
const vectorField& cellCtrs,
|
||||
const bool report,
|
||||
const bool detailedReport,
|
||||
labelHashSet* setPtr
|
||||
) const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "bool polyMesh::checkFaceOrthogonality("
|
||||
<< "const bool, labelHashSet*) const: "
|
||||
<< "checking mesh non-orthogonality" << endl;
|
||||
}
|
||||
|
||||
const labelList& own = faceOwner();
|
||||
const labelList& nei = faceNeighbour();
|
||||
|
||||
// Calculate orthogonality for all internal and coupled boundary faces
|
||||
// (1 for uncoupled boundary faces)
|
||||
tmp<scalarField> tortho = polyMeshTools::faceOrthogonality
|
||||
(
|
||||
*this,
|
||||
fAreas,
|
||||
cellCtrs
|
||||
);
|
||||
const scalarField& ortho = tortho();
|
||||
|
||||
// Severe nonorthogonality threshold
|
||||
const scalar severeNonorthogonalityThreshold =
|
||||
::cos(degToRad(primitiveMesh::nonOrthThreshold_));
|
||||
|
||||
|
||||
scalar minDDotS = GREAT;
|
||||
scalar sumDDotS = 0.0;
|
||||
label nSummed = 0;
|
||||
label severeNonOrth = 0;
|
||||
label errorNonOrth = 0;
|
||||
|
||||
|
||||
// Statistics only for internal and masters of coupled faces
|
||||
PackedBoolList isMasterFace(syncTools::getInternalOrMasterFaces(*this));
|
||||
|
||||
forAll(ortho, faceI)
|
||||
{
|
||||
if (ortho[faceI] < severeNonorthogonalityThreshold)
|
||||
{
|
||||
if (ortho[faceI] > SMALL)
|
||||
{
|
||||
if (setPtr)
|
||||
{
|
||||
setPtr->insert(faceI);
|
||||
}
|
||||
|
||||
severeNonOrth++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Error : non-ortho too large
|
||||
if (setPtr)
|
||||
{
|
||||
setPtr->insert(faceI);
|
||||
}
|
||||
if (detailedReport && errorNonOrth == 0)
|
||||
{
|
||||
// Non-orthogonality greater than 90 deg
|
||||
WarningIn
|
||||
(
|
||||
"polyMesh::checkFaceOrthogonality"
|
||||
"(const pointField&, const bool) const"
|
||||
) << "Severe non-orthogonality for face "
|
||||
<< faceI
|
||||
<< " between cells " << own[faceI]
|
||||
<< " and " << nei[faceI]
|
||||
<< ": Angle = " << radToDeg(::acos(ortho[faceI]))
|
||||
<< " deg." << endl;
|
||||
}
|
||||
|
||||
errorNonOrth++;
|
||||
}
|
||||
}
|
||||
|
||||
if (isMasterFace[faceI])
|
||||
{
|
||||
minDDotS = min(minDDotS, ortho[faceI]);
|
||||
sumDDotS += ortho[faceI];
|
||||
nSummed++;
|
||||
}
|
||||
}
|
||||
|
||||
reduce(minDDotS, minOp<scalar>());
|
||||
reduce(sumDDotS, sumOp<scalar>());
|
||||
reduce(nSummed, sumOp<label>());
|
||||
reduce(severeNonOrth, sumOp<label>());
|
||||
reduce(errorNonOrth, sumOp<label>());
|
||||
|
||||
if (debug || report)
|
||||
{
|
||||
if (nSummed > 0)
|
||||
{
|
||||
if (debug || report)
|
||||
{
|
||||
Info<< " Mesh non-orthogonality Max: "
|
||||
<< radToDeg(::acos(minDDotS))
|
||||
<< " average: " << radToDeg(::acos(sumDDotS/nSummed))
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (severeNonOrth > 0)
|
||||
{
|
||||
Info<< " *Number of severely non-orthogonal faces: "
|
||||
<< severeNonOrth << "." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (errorNonOrth > 0)
|
||||
{
|
||||
if (debug || report)
|
||||
{
|
||||
Info<< " ***Number of non-orthogonality errors: "
|
||||
<< errorNonOrth << "." << endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (debug || report)
|
||||
{
|
||||
Info<< " Non-orthogonality check OK." << endl;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::polyMesh::checkFaceSkewness
|
||||
(
|
||||
const pointField& points,
|
||||
const vectorField& fCtrs,
|
||||
const vectorField& fAreas,
|
||||
const vectorField& cellCtrs,
|
||||
const bool report,
|
||||
const bool detailedReport,
|
||||
labelHashSet* setPtr
|
||||
) const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "bool polyMesh::checkFaceSkewnesss("
|
||||
<< "const bool, labelHashSet*) const: "
|
||||
<< "checking face skewness" << endl;
|
||||
}
|
||||
|
||||
const labelList& own = faceOwner();
|
||||
const labelList& nei = faceNeighbour();
|
||||
|
||||
// Warn if the skew correction vector is more than skewWarning times
|
||||
// larger than the face area vector
|
||||
|
||||
tmp<scalarField> tskew = polyMeshTools::faceSkewness
|
||||
(
|
||||
*this,
|
||||
points,
|
||||
fCtrs,
|
||||
fAreas,
|
||||
cellCtrs
|
||||
);
|
||||
const scalarField& skew = tskew();
|
||||
|
||||
scalar maxSkew = max(skew);
|
||||
label nWarnSkew = 0;
|
||||
|
||||
// Statistics only for all faces except slave coupled faces
|
||||
PackedBoolList isMasterFace(syncTools::getMasterFaces(*this));
|
||||
|
||||
forAll(skew, faceI)
|
||||
{
|
||||
// Check if the skewness vector is greater than the PN vector.
|
||||
// This does not cause trouble but is a good indication of a poor mesh.
|
||||
if (skew[faceI] > skewThreshold_)
|
||||
{
|
||||
if (setPtr)
|
||||
{
|
||||
setPtr->insert(faceI);
|
||||
}
|
||||
if (detailedReport && nWarnSkew == 0)
|
||||
{
|
||||
// Non-orthogonality greater than 90 deg
|
||||
if (isInternalFace(faceI))
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"polyMesh::checkFaceSkewnesss"
|
||||
"(const pointField&, const bool) const"
|
||||
) << "Severe skewness " << skew[faceI]
|
||||
<< " for face " << faceI
|
||||
<< " between cells " << own[faceI]
|
||||
<< " and " << nei[faceI];
|
||||
}
|
||||
else
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"polyMesh::checkFaceSkewnesss"
|
||||
"(const pointField&, const bool) const"
|
||||
) << "Severe skewness " << skew[faceI]
|
||||
<< " for boundary face " << faceI
|
||||
<< " on cell " << own[faceI];
|
||||
}
|
||||
}
|
||||
|
||||
if (isMasterFace[faceI])
|
||||
{
|
||||
nWarnSkew++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
reduce(maxSkew, maxOp<scalar>());
|
||||
reduce(nWarnSkew, sumOp<label>());
|
||||
|
||||
if (nWarnSkew > 0)
|
||||
{
|
||||
if (debug || report)
|
||||
{
|
||||
Info<< " ***Max skewness = " << maxSkew
|
||||
<< ", " << nWarnSkew << " highly skew faces detected"
|
||||
" which may impair the quality of the results"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (debug || report)
|
||||
{
|
||||
Info<< " Max skewness = " << maxSkew << " OK." << endl;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check 1D/2Dness of edges. Gets passed the non-empty directions and
|
||||
// checks all edges in the mesh whether they:
|
||||
// - have no component in a non-empty direction or
|
||||
// - are only in a singe non-empty direction.
|
||||
// Empty direction info is passed in as a vector of labels (synchronised)
|
||||
// which are 1 if the direction is non-empty, 0 if it is.
|
||||
bool Foam::polyMesh::checkEdgeAlignment
|
||||
(
|
||||
const pointField& p,
|
||||
const bool report,
|
||||
const Vector<label>& directions,
|
||||
labelHashSet* setPtr
|
||||
) const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "bool polyMesh::checkEdgeAlignment("
|
||||
<< "const bool, const Vector<label>&, labelHashSet*) const: "
|
||||
<< "checking edge alignment" << endl;
|
||||
}
|
||||
|
||||
label nDirs = 0;
|
||||
for (direction cmpt=0; cmpt<vector::nComponents; cmpt++)
|
||||
{
|
||||
if (directions[cmpt] == 1)
|
||||
{
|
||||
nDirs++;
|
||||
}
|
||||
else if (directions[cmpt] != 0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"polyMesh::checkEdgeAlignment"
|
||||
"(const bool, const Vector<label>&, labelHashSet*)"
|
||||
) << "directions should contain 0 or 1 but is now " << directions
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
if (nDirs == vector::nComponents)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const faceList& fcs = faces();
|
||||
|
||||
EdgeMap<label> edgesInError;
|
||||
|
||||
forAll(fcs, faceI)
|
||||
{
|
||||
const face& f = fcs[faceI];
|
||||
|
||||
forAll(f, fp)
|
||||
{
|
||||
label p0 = f[fp];
|
||||
label p1 = f.nextLabel(fp);
|
||||
if (p0 < p1)
|
||||
{
|
||||
vector d(p[p1]-p[p0]);
|
||||
scalar magD = mag(d);
|
||||
|
||||
if (magD > ROOTVSMALL)
|
||||
{
|
||||
d /= magD;
|
||||
|
||||
// Check how many empty directions are used by the edge.
|
||||
label nEmptyDirs = 0;
|
||||
label nNonEmptyDirs = 0;
|
||||
for (direction cmpt=0; cmpt<vector::nComponents; cmpt++)
|
||||
{
|
||||
if (mag(d[cmpt]) > 1e-6)
|
||||
{
|
||||
if (directions[cmpt] == 0)
|
||||
{
|
||||
nEmptyDirs++;
|
||||
}
|
||||
else
|
||||
{
|
||||
nNonEmptyDirs++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nEmptyDirs == 0)
|
||||
{
|
||||
// Purely in ok directions.
|
||||
}
|
||||
else if (nEmptyDirs == 1)
|
||||
{
|
||||
// Ok if purely in empty directions.
|
||||
if (nNonEmptyDirs > 0)
|
||||
{
|
||||
edgesInError.insert(edge(p0, p1), faceI);
|
||||
}
|
||||
}
|
||||
else if (nEmptyDirs > 1)
|
||||
{
|
||||
// Always an error
|
||||
edgesInError.insert(edge(p0, p1), faceI);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
label nErrorEdges = returnReduce(edgesInError.size(), sumOp<label>());
|
||||
|
||||
if (nErrorEdges > 0)
|
||||
{
|
||||
if (debug || report)
|
||||
{
|
||||
Info<< " ***Number of edges not aligned with or perpendicular to "
|
||||
<< "non-empty directions: " << nErrorEdges << endl;
|
||||
}
|
||||
|
||||
if (setPtr)
|
||||
{
|
||||
setPtr->resize(2*edgesInError.size());
|
||||
forAllConstIter(EdgeMap<label>, edgesInError, iter)
|
||||
{
|
||||
setPtr->insert(iter.key()[0]);
|
||||
setPtr->insert(iter.key()[1]);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (debug || report)
|
||||
{
|
||||
Info<< " All edges aligned with or perpendicular to "
|
||||
<< "non-empty directions." << endl;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::polyMesh::checkCellDeterminant
|
||||
(
|
||||
const vectorField& faceAreas,
|
||||
const bool report,
|
||||
labelHashSet* setPtr,
|
||||
const Vector<label>& meshD
|
||||
) const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "bool polyMesh::checkCellDeterminant(const bool"
|
||||
<< ", labelHashSet*) const: "
|
||||
<< "checking for under-determined cells" << endl;
|
||||
}
|
||||
|
||||
// Determine number of dimensions and (for 2D) missing dimension
|
||||
label nDims = 0;
|
||||
label twoD = -1;
|
||||
for (direction dir = 0; dir < vector::nComponents; dir++)
|
||||
{
|
||||
if (meshD[dir] == 1)
|
||||
{
|
||||
nDims++;
|
||||
}
|
||||
else
|
||||
{
|
||||
twoD = dir;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tmp<scalarField> tcellDeterminant = primitiveMeshTools::cellDeterminant
|
||||
(
|
||||
*this,
|
||||
meshD,
|
||||
faceAreas,
|
||||
syncTools::getInternalOrCoupledFaces(*this)
|
||||
);
|
||||
scalarField& cellDeterminant = tcellDeterminant();
|
||||
|
||||
|
||||
label nErrorCells = 0;
|
||||
scalar minDet = min(cellDeterminant);
|
||||
scalar sumDet = sum(cellDeterminant);
|
||||
|
||||
forAll (cellDeterminant, cellI)
|
||||
{
|
||||
if (cellDeterminant[cellI] < 1e-3)
|
||||
{
|
||||
if (setPtr)
|
||||
{
|
||||
setPtr->insert(cellI);
|
||||
}
|
||||
|
||||
nErrorCells++;
|
||||
}
|
||||
}
|
||||
|
||||
reduce(nErrorCells, sumOp<label>());
|
||||
reduce(minDet, minOp<scalar>());
|
||||
reduce(sumDet, sumOp<scalar>());
|
||||
label nSummed = returnReduce(cellDeterminant.size(), sumOp<label>());
|
||||
|
||||
if (debug || report)
|
||||
{
|
||||
if (nSummed > 0)
|
||||
{
|
||||
Info<< " Cell determinant (wellposedness) : minimum: " << minDet
|
||||
<< " average: " << sumDet/nSummed
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (nErrorCells > 0)
|
||||
{
|
||||
if (debug || report)
|
||||
{
|
||||
Info<< " ***Cells with small determinant found, number of cells: "
|
||||
<< nErrorCells << endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (debug || report)
|
||||
{
|
||||
Info<< " Cell determinant check OK." << endl;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::polyMesh::checkClosedBoundary(const bool report) const
|
||||
{
|
||||
return primitiveMesh::checkClosedBoundary
|
||||
(
|
||||
faceAreas(),
|
||||
report,
|
||||
syncTools::getInternalOrCoupledFaces(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::polyMesh::checkFaceOrthogonality
|
||||
(
|
||||
const bool report,
|
||||
labelHashSet* setPtr
|
||||
) const
|
||||
{
|
||||
return checkFaceOrthogonality
|
||||
(
|
||||
faceAreas(),
|
||||
cellCentres(),
|
||||
report,
|
||||
false, // detailedReport
|
||||
setPtr
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::polyMesh::checkFaceSkewness
|
||||
(
|
||||
const bool report,
|
||||
labelHashSet* setPtr
|
||||
) const
|
||||
{
|
||||
return checkFaceSkewness
|
||||
(
|
||||
points(),
|
||||
faceCentres(),
|
||||
faceAreas(),
|
||||
cellCentres(),
|
||||
report,
|
||||
false, // detailedReport
|
||||
setPtr
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::polyMesh::checkEdgeAlignment
|
||||
(
|
||||
const bool report,
|
||||
const Vector<label>& directions,
|
||||
labelHashSet* setPtr
|
||||
) const
|
||||
{
|
||||
return checkEdgeAlignment
|
||||
(
|
||||
points(),
|
||||
report,
|
||||
directions,
|
||||
setPtr
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::polyMesh::checkCellDeterminant
|
||||
(
|
||||
const bool report,
|
||||
labelHashSet* setPtr
|
||||
) const
|
||||
{
|
||||
return checkCellDeterminant
|
||||
(
|
||||
faceAreas(),
|
||||
report,
|
||||
setPtr,
|
||||
geometricD()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::polyMesh::checkMeshMotion
|
||||
(
|
||||
const pointField& newPoints,
|
||||
const bool report,
|
||||
const bool detailedReport
|
||||
) const
|
||||
{
|
||||
if (debug || report)
|
||||
{
|
||||
Pout<< "bool polyMesh::checkMeshMotion("
|
||||
<< "const pointField&, const bool, const bool) const: "
|
||||
<< "checking mesh motion" << endl;
|
||||
}
|
||||
|
||||
vectorField fCtrs(nFaces());
|
||||
vectorField fAreas(nFaces());
|
||||
|
||||
makeFaceCentresAndAreas(newPoints, fCtrs, fAreas);
|
||||
|
||||
// Check cell volumes and calculate new cell centres
|
||||
vectorField cellCtrs(nCells());
|
||||
scalarField cellVols(nCells());
|
||||
|
||||
makeCellCentresAndVols(fCtrs, fAreas, cellCtrs, cellVols);
|
||||
|
||||
// Check cell volumes
|
||||
bool error = checkCellVolumes
|
||||
(
|
||||
cellVols, // vols
|
||||
report, // report
|
||||
detailedReport, // detailedReport
|
||||
NULL // setPtr
|
||||
);
|
||||
|
||||
|
||||
// Check face areas
|
||||
bool areaError = checkFaceAreas
|
||||
(
|
||||
faceAreas(),
|
||||
report, // report
|
||||
detailedReport, // detailedReport,
|
||||
NULL // setPtr
|
||||
);
|
||||
error = error || areaError;
|
||||
|
||||
|
||||
// Check pyramid volumes
|
||||
bool pyrVolError = checkFacePyramids
|
||||
(
|
||||
newPoints,
|
||||
cellCtrs,
|
||||
report, // report,
|
||||
detailedReport, // detailedReport,
|
||||
-SMALL, // minPyrVol
|
||||
NULL // setPtr
|
||||
);
|
||||
error = error || pyrVolError;
|
||||
|
||||
|
||||
// Check face non-orthogonality
|
||||
bool nonOrthoError = checkFaceOrthogonality
|
||||
(
|
||||
fAreas,
|
||||
cellCtrs,
|
||||
report, // report
|
||||
detailedReport, // detailedReport
|
||||
NULL // setPtr
|
||||
);
|
||||
error = error || nonOrthoError;
|
||||
|
||||
|
||||
if (!error && (debug || report))
|
||||
{
|
||||
Pout<< "Mesh motion check OK." << endl;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user